使用RtAudio和Core-Audio时,probeDeviceOpen函数失败

Using RtAudio with Core-Audio, the probeDeviceOpen function fails

本文关键字:probeDeviceOpen 函数 失败 RtAudio Core-Audio 使用      更新时间:2023-10-16

我正在尝试写一个c++程序,播放实时处理的音频。我已经决定使用RtAudio,但不能使测试程序播放音频。

我使用Mac OS X,所以我用./configure --with-coremake编译。编译完test目录下的文件后,我运行./audioprobe,返回这个列表。

Compiled APIs:
  OS-X Core Audio
Current API: OS-X Core Audio
Found 3 device(s) ...
Device Name = Apple Inc.: Built-in Microphone
Probe Status = Successful
Output Channels = 0
Input Channels = 2
Duplex Channels = 0
This is NOT the default output device.
This is NOT the default input device.
Natively supported data formats:
  32-bit float
Supported sample rates = 44100 48000 88200 96000 
Device Name = Apple Inc.: Built-in Input
Probe Status = Successful
Output Channels = 0
Input Channels = 2
Duplex Channels = 0
This is NOT the default output device.
This is the default input device.
Natively supported data formats:
  32-bit float
Supported sample rates = 44100 48000 88200 96000 
Device Name = Apple Inc.: Built-in Output
Probe Status = Successful
Output Channels = 2
Input Channels = 0
Duplex Channels = 0
This is the default output device.
This is NOT the default input device.
Natively supported data formats:
  32-bit float
Supported sample rates = 44100 48000 88200 96000 

由于内置输出设备是索引2,我然后运行./playsaw 2 44100 2,但发生了一个错误:

RtApiCore::probeDeviceOpen: system error (kAudioHardwareUnknownPropertyError)
    getting stream format for device (2).

如何解决这个问题?

你在Lion(10.7)上吗?我在旧系统(10.6.x)上看到了同样的问题,RtAudio对我来说工作得很好。

也许你可以降级到RtAudio 4.0.6,这对我在Lion上工作,但仍然有一个潜伏在4.0.8中修复的设备名称的错误。