I’ve been learning JUCE (with the purpose of audio development) for a few months now and am tying to strengthen my general understanding of how some of the audio classes work together. The documentation has been extremely helpful by the way. That, plus the JUCE demo examples have been so much fun to tear apart and learn from. I’m hooked.
On to my question:
When an AudioDeviceManager streams audio to an AudioIODeviceCallback does it still stream silent or dead audio if no legitimate audio information is being produced?
For example I have a Synthesizer that is sending its audio to an AudioSourcePlayer which is being used as an AudioIODeviceCallback to stream audio to my AudioDeviceManager to output audio. The intention of this callback is only to send audio produced by the synthesizer to the system output. The Synthesizer only outputs sound when MIDI keys are pressed.
I also have a Spectrogram Visualizer for the audio that is an AudioIODeviceCallback. This visualizer has also been added as a callback to the AudioDeviceManager, but with the intention of grabbing the output data from the synthesizer and displaying it.
Within my Spectrogram (a callback) does the overridden function audioDeviceIOCallback() continuously have audio samples that the Synthesizer outputs passed as its parameters, even if no audio is being outputted? Would the audioDeviceIOCallback() have only zeroes passed in its outputChannelData parameter for silent audio?
The reason for this question is because I have to use an FFT to display the audio data on my spectrogram. If I am only receiving silent audio, I feel like I would not want to run my FFT on a large array of just zeroes. That would be unneeded work.
If the audioDeviceIOCallback() does indeed receive even silent audio in its outputChannelData parameter, I think I would want to create some kind of flag that only processed the data through FFT if non-silent audio was incoming.
Or is there something more in depth that I’m missing? Some of the functions (such as “audioDeviceAboutToStart” & “audioDeviceStopped”) within the AudioIODeviceCallback class make me think that I need to make my own custom AudioIODevice that will stop streaming audio if no audio is being produced.
Sorry this is complicated. I’m trying to further my understanding of these classes.
Thanks!