It seems that in Big Sur the headphones and the speakers are two different devices (as opposed to previous OSX versions).
While the playback is enabled in the desktop app, if I try to remove the headphones then the application playback stops (getNextAudioCallback is not called anymore). If I try to plug in the headphones again nothing happens. What is more, I have to launch the app again to restore audio (this happens because the audio device is initialized correctly).
Based on other applications the expected behavior would be that the app should use the Speakers device (since at least on my machine it’s the only available output device).
Has anyone faced this problem? Is there any quick fix?
I’m unable to reproduce this on the lastest develop tip on macOS 11.4 using the SimpleSynthNoiseTutorial, building on Xcode 12.5 against the macOS 11.3 SDK with a deployment target of 10.11. If I disconnect the headphones whilst the application is running the output switches to the speakers and when plugging the headphones back in playback switches to the headphones as expected. getNextAudioBlock() is called continuously.
Can you stick a breakpoint on this line in the CoreAudio internals? I get a kAudioDevicePropertyDeviceHasChanged property changed callback when plugging the headphones back in (not when unplugging them) which causes the audio device to be reinitialised and prepareToPlay() to be called. Perhaps you are missing that callback for some reason so the device is not being reinitialised.