0
我有一个端口音频回调,它需要输入声音缓冲区并在缓冲区上执行fft以便在应用程序的其他部分使用。输出缓冲区未被修改。我想捕捉其他应用程序写入默认输出音频设备的声音。但是,当使用输出设备作为输入初始化一个流时,端口音频会引发错误'通道数无效'。是否有可能使用端口音频捕获写入输出设备的所有音频?流初始化代码如下:捕获从端口音频写入输出音频设备的音频输出
PaStreamParameters inputParams;
inputParams.device = Pa_GetDefaultOutputDevice();
inputParams.channelCount = 2;
inputParams.sampleFormat = paFloat32;
const PaDeviceInfo * inputInfo = Pa_GetDeviceInfo(inputParams.device);
inputParams.suggestedLatency = inputInfo->defaultLowOutputLatency;
inputParams.hostApiSpecificStreamInfo = NULL;
error = Pa_OpenStream(&_pInputStream,
&inputParams,
NULL,
inputInfo->defaultSampleRate,
paFramesPerBufferUnspecified,
0,
coreAudioCallback,
this);
if(error != paNoError){
printf("Port audio error = %s", Pa_GetErrorText(error));
}