A set of C++ classes that provide a common API for realtime audio input/output across Linux (native ALSA, JACK, PulseAudio and OSS), Macintosh OS X (CoreAudio and JACK), and Windows (DirectSound, ASIO, and WASAPI) operating systems.
Other
1.49k
stars
317
forks
source link
MacOS: Bluetooth devices change channel count during usage. #394
Hey guys, I'm not sure is it a real issue or my mistake but the situation is the following.
I'm using #define RTAUDIO_VERSION "6.0.0beta1"
I have pretty straitforward code which enumerates the audio devices on start, like:
for (auto i = 0u; i < _dac->getDeviceCount(); i++)
{
const auto di = _dac->getDeviceInfo(i);
if (di.probed && di.outputChannels > 0)
{
vec.emplace_back(std::make_tuple(i, di.name));
}
}
next, I start playing incoming stream using the standard code:
const auto out_di = _dac->getDeviceInfo(_current_out_device);
out_params.deviceId = _current_out_device;
out_params.nChannels = 2;
out_params.firstChannel = 0;
if (ret = _dac->openStream(&out_params, nullptr, RTAUDIO_SINT16, sampleRate, &bufferFrames, cb, (void *)&uinfo, &opts);
ret != RtAudioErrorType::RTAUDIO_NO_ERROR)
{ /* ... */ }
if (ret = _dac->startStream(); ret != RtAudioErrorType::RTAUDIO_NO_ERROR)
{
if (_dac->isStreamOpen())
_dac->closeStream();
return false;
}
I'm using bluetooth Sony WH-1000XM3 on MacOS. Before the start the system shows me that the device is 2ch 48kHz, after start the device switches to the 1ch 48kHz after enumeration. When start the stream I have a pretty weird state then:
The RtAudio still thinks the we have 1ch 48kHz but in the system it's 1ch 16kHz and the sound is distorted. After I close the app the device gets back to 2ch 48kHz. The same situation is with AirPods, it changes channels count in runtime during using RtAudio. But after a couple of reconnecting of the device (on dis/connect I have a watcher wich makes the same procedure like enumerate and restart the stream) at somepoint it matches the proper channels/samplerate and sounds properly.
Hey guys, I'm not sure is it a real issue or my mistake but the situation is the following. I'm using #define RTAUDIO_VERSION "6.0.0beta1" I have pretty straitforward code which enumerates the audio devices on start, like:
next, I start playing incoming stream using the standard code:
I'm using bluetooth Sony WH-1000XM3 on MacOS. Before the start the system shows me that the device is 2ch 48kHz, after start the device switches to the 1ch 48kHz after enumeration. When start the stream I have a pretty weird state then:
The RtAudio still thinks the we have 1ch 48kHz but in the system it's 1ch 16kHz and the sound is distorted. After I close the app the device gets back to 2ch 48kHz. The same situation is with AirPods, it changes channels count in runtime during using RtAudio. But after a couple of reconnecting of the device (on dis/connect I have a watcher wich makes the same procedure like enumerate and restart the stream) at somepoint it matches the proper channels/samplerate and sounds properly.