【问题标题】:Catch Audio Output written to Output Audio Device from Port Audio捕获从端口音频写入输出音频设备的音频输出
【发布时间】:2016-02-17 13:35:42
【问题描述】:

我有一个端口音频回调,它接受输入声音缓冲区并在缓冲区上执行 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));
}

【问题讨论】:

    标签: c++ audio portaudio


    【解决方案1】:

    Port Audio 不支持此功能。解决方案是使用现有的操作系​​统音频回送设备,并将此设备设置为操作系统的默认输出设备。然后环回设备可以用作端口音频中的输入流源,最终声音可以从端口音频回调路由到所需的输出设备。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-03
      • 1970-01-01
      • 1970-01-01
      • 2021-06-29
      • 1970-01-01
      • 2023-03-07
      • 1970-01-01
      相关资源
      最近更新 更多