VSTGUI standalone appplication using rtaudio (audio issues)


I am trying to integrate RtAudio as the audio library in a vstgui standalone application. I have integrated everything and are able to open and start an audio stream with the help of their provided example “playsaw”. I can hear audio when opening my vstgui standalone application but as soon as I move the mouse pointer to my application window the audio stops. I guess it has something to do with threading issues since the behaviour is very “undeterministic” and sometimes exceptions occurs in different places in the code…

At the moment I do all the RtAudio stuff inside the finishLaunching function. Is there another way I should do all the RtAudio stuff? I tried to create a separate thread (owned by main thread) and do all the RtAudio stuff but the behaviour is still the same. To my understanding RtAudio itself creates an audio thread under the hood that should handle the processsing. But something with the ui is messing with the audio processing. I tried running the “playsaw” example as a console application and that works flawless so its nothing related to my code regarding the RtAudio that is faulty.

Any guidance on how to integrate an audio processing capabilities in to a vstgui standalone application?