gpt4 book ai didi

iOS13 崩溃 - 错误 : Failed to fill complex buffer in float converter ('insz' )

转载 作者:行者123 更新时间:2023-12-03 20:03:14 24 4
gpt4 key购买 nike

我像这样使用 AudioKit 4.8

class AudioKitWrapper {

/// The main output mixer (after the amplitude tracker)
private let masterMixer: AKMixer

/// The audio input
private var microphone: EZMicrophone?

/// Construction
init() {
// global settings
AKAudioFile.cleanTempDirectory()
AKSettings.defaultToSpeaker = true
AKSettings.enableRouteChangeHandling = true
AKSettings.enableCategoryChangeHandling = true
AKSettings.disableAVAudioSessionCategoryManagement = true
AKSettings.audioInputEnabled = true
AKSettings.playbackWhileMuted = false
#if DEBUG
AKSettings.enableLogging = AppConfig.AudioConfig.debugLogEnabled
#endif
// main mixer
masterMixer = AKMixer()
}

/// Start up audiokit
func startEngine(with audioInput: Bool) throws {
// connect main nodes
AudioKit.output = masterMixer
// input
microphone?.delegate = nil
microphone = nil
if audioInput {
AKSettings.enableEchoCancellation = true
let sizeOfFloat = UInt32(MemoryLayout<Float>.stride)
microphone = EZMicrophone(microphoneDelegate: self,
with: AudioStreamBasicDescription(mSampleRate: Float64(mirgaFactory.getSampleRate()),
mFormatID: kAudioFormatLinearPCM,
mFormatFlags: kLinearPCMFormatFlagIsFloat |
kAudioFormatFlagsNativeEndian |
kAudioFormatFlagIsPacked |
kAudioFormatFlagIsNonInterleaved,
mBytesPerPacket: sizeOfFloat,
mFramesPerPacket: 1,
mBytesPerFrame: sizeOfFloat,
mChannelsPerFrame: 1,
mBitsPerChannel: sizeOfFloat * 8,
mReserved: 0),
startsImmediately: false)
}
// start
try AKSettings.session.setCategory(.playAndRecord, mode: .measurement, options: .defaultToSpeaker)
try AudioKit.start()
microphone?.startFetchingAudio()
Log.d("~~~ AudioKit: started")
}

/// Stop engine
func stopEngine() throws {
try AudioKit.stop()
microphone?.stopFetchingAudio()
Log.d("~~~ AudioKit: stopped")
}

/// Attach output
func attach(audioPlayer: AKAudioPlayer) {
audioPlayer >>> masterMixer
}

/// Reset
func reset() {
masterMixer.detach()
Log.d("~~~ AudioKit: reset")
}

}

/// Handle EZMicrophone input
extension AudioKitWrapper: EZMicrophoneDelegate {

/// Playing state changed
func microphone(_ microphone: EZMicrophone!, changedPlayingState isPlaying: Bool) {
Log.i("playing state - \(isPlaying)")
}

/// Device changed
func microphone(_ microphone: EZMicrophone!, changedDevice device: EZAudioDevice!) {
Log.i("device - \(String(describing: device))")
}

/// Audio stream description
func microphone(_ microphone: EZMicrophone!, hasAudioStreamBasicDescription audioStreamBasicDescription: AudioStreamBasicDescription) {
Log.i("stream - \(audioStreamBasicDescription)")
}

/// Input buffer handling
func microphone(_ microphone: EZMicrophone!,
hasAudioReceived buffer: UnsafeMutablePointer<UnsafeMutablePointer<Float>?>!,
withBufferSize bufferSize: UInt32,
withNumberOfChannels numberOfChannels: UInt32,
atTime timestamp: UnsafePointer<AudioTimeStamp>!) {
writeSamplesIntoCircularBuffer(buffer[0]!, bufferSize, timestamp)
}
}

iOS13 - iPhone7

它因该日志而崩溃

2019-10-11 09:37:01.917118+0200 WyntonHost[555:135079] AUBuffer.h:61:GetBufferList: EXCEPTION (-1) [mPtrState == kPtrsInvalid is false]: ""
2019-10-11 09:37:01.938441+0200 WyntonHost[555:135079] AUBuffer.h:61:GetBufferList: EXCEPTION (-1) [mPtrState == kPtrsInvalid is false]: ""
Error: Failed to fill complex buffer in float converter ('insz')

Process finished with exit code 255

iOS13 - iPadAir2

我收到此日志消息而没有崩溃(我假设每个音频帧有数百条)

2019-10-11 09:34:07.187762+0200 WyntonHost[376:18541] AUBuffer.h:61:GetBufferList: EXCEPTION (-1) [mPtrState == kPtrsInvalid is false]: ""
2019-10-11 09:34:07.211279+0200 WyntonHost[376:18541] AUBuffer.h:61:GetBufferList: EXCEPTION (-1) [mPtrState == kPtrsInvalid is false]: ""

iOS12 - iPhone6

我收到此日志消息而没有崩溃(我假设每个音频帧有数百条)

2019-10-11 09:31:59.138013+0200 WyntonHost[537:96101] 55: EXCEPTION (-1): ""
2019-10-11 09:31:59.161233+0200 WyntonHost[537:96101] 55: EXCEPTION (-1): ""

知道这条日志消息来自哪里吗?

最佳答案

我也遇到过这样的问题,后来解决了。

您需要更改EZAudioFloatConverter.m中的代码

- (void)convertDataFromAudioBufferList:(AudioBufferList *)audioBufferList
withNumberOfFrames:(UInt32)frames
toFloatBuffers:(float **)buffers
packetDescriptions:(AudioStreamPacketDescription *)packetDescriptions

在此方法中,您应该进行如下更改:

OSStatus status = AudioConverterFillComplexBuffer(self.info->converterRef,
EZAudioFloatConverterCallback,
audioBufferList,
&frames,
self.info->floatAudioBufferList,
packetDescriptions ? packetDescriptions : self.info->packetDescriptions);
if (status > 0 ) {
AudioConverterReset(self.info->converterRef);
}

我已经改变了它,它对我来说运行良好。

引用链接:

https://github.com/syedhali/EZAudio/issues/379

https://github.com/AudioKit/AudioKit/issues/1873

您也可以下载我的代码,已更改代码:

https://github.com/liunianhuaguoyanxi/EZAudio

希望这对您有帮助。

关于iOS13 崩溃 - 错误 : Failed to fill complex buffer in float converter ('insz' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58336413/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com