Hello,
I’m trying to build my JUCE app from the ground up now. And I think I need an AudioDeviceManager object. (In fact, at the current moment, my belief is that I need to create an AudioSource class and an AudioDeviceManager and I should be set!)
I’m looking through the AudioAppComponent class to see how they have done it, (the respective JUCE tutorial also bases itself off that)
I noticed this among the public member variables:
public:
AudioDeviceManager& deviceManager;
I’ve never seen an object being instantiated with the address of operator. If it were a pointer (AudioDeviceManager* deviceManager;
), I would understand that it has merely created a pointer and I would need to look elsewhere to find where the object is actually being created (and then being pointed to by the aforementioned pointer)
Among the private member variables, AudioAppComponent does declare an object in the typical fashion:
private:
AudioDeviceManager defaultDeviceManager;
And in the initialisation list of the default constructor of AudioAppComponent we see that the defaultDeviceManager object is passed into deviceManager
.
AudioAppComponent::AudioAppComponent()
: deviceManager (defaultDeviceManager),
usingCustomDeviceManager (false)
{
}
Help me break this down please. So… AudioAppComponent creates an object of AudioDeviceManager privately and publicly it creates a reference to a (emphasis on “a”) AudioDeviceManager, which it so happens to instantiate as the defaultDeviceManager in the default constructor, because alternatively in the parameterised constructor, you can feed it a DeviceManager that you have created elsewhere, and thus forth, publicly we can refer to either the default DeviceManager or any custom Device Manager that you have created by the same variable name deviceManager
.
Is that correct?
Also, is there anything else I might need to know-about / look-into in order to add audio functionality to a GUI app?
Many thanks.