there is a very noticeable audio dropout whenever one changes a device’s settings using the device manager. This can be observed using the demorunner’s audio playback demo. If, while the audio is playing, one then goes to the settings and turns on and off the active input channels, the outgoing audio is interrupted for about a half second with each change.
Can this be avoided?
I am developing a mobile app with both audio output and input. The app also plays audio when in the background. The audio input is only used for an fft analysis. If the user turns on or off the fft analysis and the input channels are also being turned on and off, then the audio dropout is very noticeable and distracting. But if I leave the audio channels on all the time to avoid the dropouts, then whenever the app is in the background, iOS displays a large orange bar with a microphone symbol to indicate that audio input is being used. This I would very much like to avoid unless when strictly necessary (when the fft analyisis is actually on).
How can the input channels be activated and deactivated without affecting the audio output? Any hints as to how to do this?
Sorry if this seems like a silly question, but if someone could give me some hints that would be great (and would save me a considerable amount of experimenting)! I guess what I would like to know is:
If (a) by not using the device manager and instead rolling my own methods (my own AudioIODeviceCallbacks, etc.) this can be at all be done.
Or if (b) by adding or removing audio input channels some type of “reset” always takes place and therefore a brief dropout on the audio output is unavoidable.
You could track whether the input channels are muted and, depending on whether they are muted or not, fade in or fade out the audio output.
I have never used JUCE to build a mobile app, so maybe my recommendations won’t work. But I would try it this way:
// be sure to include this in your header
// then somewhere in the code get your standalone filter window
StandalonePluginHolder pluginHolder = StandalonePluginHolder::getInstance()
// using your standalone filter window it could be possible to track the mute setting
bool isMuted = pluginHolder->getMuteInputValue().getValue();
Now you can track
isMuted and upon its value changing either fade in or fade out audio in
Thanks! Fading the audio output is indeed a good suggestion. It would certainly be an improvement and I will probably do so if I don’t find a better solution. But I would much rather not have any dropout or glitch at all when turning input channels on and off…
Fading in and out is the usual thing to avoid dropouts or glitches. It doesn’t matter if you mute an input, clear a buffer or unplug a microphone. Whenever you suddenly stop an audio waveform there will be noise.
A lot of audio hardware implicitly does fade in or out to avoid exactly that.