thestk / rtaudio

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

Airplay from MacOS to AppleTV, RTAUDIO_SYSTEM_ERROR 10 #400

Closed geminixdev closed 1 year ago

geminixdev commented 1 year ago

Using RTAudio 6, I try to play Audio on MacOS through airplay to an AppleTV. The airplay audio is recognized by rtaudio, however when opening the audio device there is the error:

RTAUDIO_SYSTEM_ERROR 10 "RtApiCore::probeDeviceOpen: timeout waiting for sample rate update for device (131)."

Here is the audio related part of the log:

[0:50:10.108 I]  Audio APIs 0 : "CoreAudio" ( "core" ) "6.0.0beta1"
[0:50:10.154 I]  0 Audio device "CoreAudio" "Apple Inc.: MacBook Pro Microphone" has no output channels, skipping it
[0:50:10.154 I]  1 Audio device "CoreAudio" "Apple Inc.: MacBook Pro Speakers" is an output device.
[0:50:10.155 I]  2 Audio device "CoreAudio" "Apple, Inc.: AirPlay" is the default output device.
[0:50:10.156 I]  Found  3  audio device(s)
[0:50:10.156 I]  Audio API:  "CoreAudio"
[0:50:10.156 I]  0 1 Audio device "Apple Inc.: MacBook Pro Microphone" has no output channels, skipping it
[0:50:10.156 I]  1 7 Supported sample rates: 44100, 48000, 88200, 96000
[0:50:10.156 I]  Device ID: 130 | Device Name: "Apple Inc.: MacBook Pro Speakers" (NOT the default output device)
[0:50:10.156 I]  Preferred sample rate: 48000
[0:50:10.156 I]  2 7 Supported sample rates: 44100
[0:50:10.156 I]  2 8 Audio device "Apple, Inc.: AirPlay" samplerate 48000 not supported
[0:50:10.156 I]  2 8 Audio device "Apple, Inc.: AirPlay" fallback to samplerate 41000 is supported
[0:50:10.156 I]  Device ID: 131 | Device Name: "Apple, Inc.: AirPlay" (Default output device)
[0:50:10.156 I]  Preferred sample rate: 44100
...
[0:50:55.269 I]  AudioPlayer::onRTAudioErrorOccurred RTAUDIO_SYSTEM_ERROR 10 "RtApiCore::probeDeviceOpen: timeout waiting for sample rate update for device (131)."
[0:50:55.269 W]  Error during openStream when opening Audiodevice. Aborting!

The app is running fine with any other audio device, just not airplay.

Am I doing something wrong, or is this a bug? Or no airplay support at all?

geminixdev commented 1 year ago

Although not mentioning airplay, #186 seems to describe the underlying issue.

geminixdev commented 1 year ago

Although not mentioning airplay, #186 seems to describe the underlying issue.

Yes, based on the info in #186 I could see what I have to do, and it works, sending audio on MacOS through Apple's Airplay to an AppleTV. There is a 2 second delay caused by Airplay, that needs to get compensated (not in RTAudio, but in my apps code), and all is fine.

Thanks for RTAudio !