My current project is an audio analysis plugin - it takes the input buffer, crunches numbers in order to get audio features such as loudness, fundamental frequency estimation, etc. and display it.
Currently I do as follows, which seems kind of nasty:
- At each call to ProcessBlock the AudioProcessor makes a copy of the last buffer.
- It also sends a Change Message to all its listeners
- The listeners are UI components requiring this audio data; in their changeListenerCallback they get a const reference to the AudioProcessor last buffer, do their own work of computation and display it.
The question is: what is the cleanest way to pass samples (AudioSampleBuffers actually) around?
Most of the JUCE examples rely on a standalone application and thus classes requiring audio data derive from an AudioIODevice, using its callback. How can I mimic this behaviour in a plugin?