EZAudio framework -"Error: Couldn't initialize output unit ('fmt?')"
EZAudio framework -"Error: Couldn't initialize output unit ('fmt?')"
我正在使用 EZAudio 框架 (https://github.com/syedhali/EZAudio),当我尝试使用自定义 AudioStreamBasicDescription 初始化我的输出时...
- (void)openMediaPlayer {
// Initialize the EZOutput instance and assign it a delegate to provide the output audio data
AudioStreamBasicDescription audioDesc;
audioDesc.mFormatID = kAudioFormatLinearPCM;
audioDesc.mSampleRate = 44100;
audioDesc.mChannelsPerFrame = 2;
audioDesc.mBytesPerFrame = 4;
audioDesc.mFramesPerPacket = 1;
audioDesc.mBytesPerPacket = 4;
audioDesc.mBitsPerChannel = 16;
audioDesc.mReserved = 0;
self.output = [EZOutput outputWithDataSource:self withAudioStreamBasicDescription:audioDesc];
self.currentAudioPieceIndex = 0;
}
我收到错误 "Error: Couldn't initialize output unit ('fmt?')"
这是什么意思? AudioDesc 为 PCM 16 位立体声音频设置了合理的默认值。
更新:当我使用调试器时,我发现我正在获取 OSStatus 1718449215。
原来你要设置
audioDesc.mFormatFlags = kAudioFormatFlagIsPacked | kAudioFormatFlagIsSignedInteger;
当您的音频格式为 PCM 时。
我正在使用 EZAudio 框架 (https://github.com/syedhali/EZAudio),当我尝试使用自定义 AudioStreamBasicDescription 初始化我的输出时...
- (void)openMediaPlayer {
// Initialize the EZOutput instance and assign it a delegate to provide the output audio data
AudioStreamBasicDescription audioDesc;
audioDesc.mFormatID = kAudioFormatLinearPCM;
audioDesc.mSampleRate = 44100;
audioDesc.mChannelsPerFrame = 2;
audioDesc.mBytesPerFrame = 4;
audioDesc.mFramesPerPacket = 1;
audioDesc.mBytesPerPacket = 4;
audioDesc.mBitsPerChannel = 16;
audioDesc.mReserved = 0;
self.output = [EZOutput outputWithDataSource:self withAudioStreamBasicDescription:audioDesc];
self.currentAudioPieceIndex = 0;
}
我收到错误 "Error: Couldn't initialize output unit ('fmt?')"
这是什么意思? AudioDesc 为 PCM 16 位立体声音频设置了合理的默认值。
更新:当我使用调试器时,我发现我正在获取 OSStatus 1718449215。
原来你要设置
audioDesc.mFormatFlags = kAudioFormatFlagIsPacked | kAudioFormatFlagIsSignedInteger;
当您的音频格式为 PCM 时。