Using JUCE to talk to ASIO device



I'm wanting to talk to a specific ASIO device, but not sure how this is done. Could someone give me a basic example of getting audio data from a device and sending it back out again (possibly modifying the data in between)? I do not need it to be general, I will only be using ASIO and only ever talking to one specific device.

I have an AudioDeviceManager which will allow me to manage an ASIO device, and I see that the class says

To use an AudioDeviceManager, create one, and use initialise() to set it up. Then call addAudioCallback() to register your audio callback with it, and use that to process your audio data.

Creating it and initialising it I have figured out, but the adding a callback part is confusing me. I understand that a callback is usually passed a pointer to a function which is then your callback function, which presumably in this case you would use to receive and send the audio data. But the method requires a pointer instead to an AudioIOCallback object, and in trying to figure out what to do with that I got confused. The Juce Demo is not helping either, what with using an AudioSourcePlayer and then an AudioTransportSource and possibly other things.

If anyone could point me to an example or give me some example code that just does the basics, I will be very grateful.


~ miss jess


Derive a class from AudioIODeviceCallback and implement the abstract methods (audioDeviceIOCallback() etc.).
Then pass a pointer to an object of this class to the “addCallback” and the methods get called when the device is running.
In simple applications the class using the AudioDeviceManager can be the same implementing the callbacks.