AudioDeviceManager help


#1

Hello.

I have been trying to record sound via Juce but audioDeviceManager.getCurrentAudioDevice() returns null.

When I iterate through my devices, I can see my sound devices, however current is as I said, null.

Is there a way to force set it or is there something really wrong? I am completely new in Juce and C++ components so a "For dummies" version would be appreciated!

 

Below is my code:

audioDeviceManager.initialiseWithDefaultDevices(1,1);

AudioIODeviceType *deviceType = audioDeviceManager.getCurrentDeviceTypeObject();

deviceType->scanForDevices();
StringArray deviceNames = deviceType->getDeviceNames();    

for(auto itr = deviceNames.begin(); itr != deviceNames.end(); ++itr)
    myfile << "Device name : " + *itr + "\n";

//I get the device names properly above

if (AudioIODevice* device = audioDeviceManager.getCurrentAudioDevice())//This condition is false.

 


#2

Ok.. Maybe it's because you're trying to open a device that has 1 input and 1 output channel - such a thing might not be supported by your hardware, so you might want to try 2-in, 2-out?