I'm trying to implement Oboe library to my project to perform the least latency when playing sounds. I could perform playback manipulating, panning, mixing, the basics things which internal Android library such as SoundPool
can provide.
I wanted to test panning effect, I connected headphones to my device, but then, I noticed that any sound didn't play through my headphones. Device speaker also didn't play any sound either. So I disconnected my headphones to check if something went wrong. I pressed sound playing button, but I couldn't hear any sound even though headphones are completely disconnected from device.
When I firstly open the app, it can play sound through device speaker without any problems, but as soon as I connect headphones, no sound plays through both device speaker and headphones.
Same for opposite, if I start app with headphones connected to device, it can play sound very well through headphones. It can even perform panning effect too, but if I disconnect headphones from device, it stops playing any sound.
- Do I have to re-open audio stream whenever preferred audio device is changed?
- If yes for 1, is there any way to notify app that audio device is changed, so I can manually close stream and re-open it? Or can I make Oboe automatically handle audio device changes?
You need to open a new audio stream when primary audio device changes as stated here in oboe full guide. Oboe will handle the detection of device change for you automatically if you configure it.
Here is an example
Also there is a special case for Android P. Please read this, its important!