1

我正在使用 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;
}

我收到错误“错误:无法初始化输出单元('fmt?')”

这是什么意思?AudioDesc 设置为 PCM 16 位立体声音频的合理默认值。

更新:当我使用调试器时,我发现我得到了 OSStatus 1718449215。

4

1 回答 1

2

事实证明你必须设置

audioDesc.mFormatFlags = kAudioFormatFlagIsPacked | kAudioFormatFlagIsSignedInteger;

当您的音频格式为 PCM 时。

于 2015-01-06T04:41:48.797 回答