使用AudioQueueNewInput录制立体声

时间:2016-11-06 04:25:59

标签: ios

我想使用AudioQueueNewInput创建立体声录音。我按如下方式对其进行了配置:

    audioFormat.mFormatID           = kAudioFormatLinearPCM;
    hardwareChannels = 2;
    audioFormat.mChannelsPerFrame   = hardwareChannels;
    audioFormat.mFormatFlags        = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked | kAudioFormatFlagIsBigEndian;
    audioFormat.mFramesPerPacket    = 1;
    audioFormat.mBitsPerChannel     = 16;
    audioFormat.mBytesPerPacket     = (audioFormat.mBitsPerChannel / 8) * hardwareChannels;
    audioFormat.mBytesPerFrame      = audioFormat.mBytesPerPacket;
    OSStatus result =    AudioQueueNewInput(
                            &audioFormat,
                            recordingCallback,
                            (__bridge void *)(self),                    // userData
                            NULL,                   // run loop
                            NULL,                   // run loop mode
                            0,                      // flags
                            &queueObject
                        );
    AudioQueueStart (
        queueObject,
        NULL            // start time. NULL means as soon as possible.
    );

我在带有外置立体声麦克风的iPhone 6s上测试了这段代码。它似乎没有录制立体声。左右声道都获得相同的数据流。我还需要做些什么来录制立体声?

0 个答案:

没有答案