Can't seem to change audio device?


#1

When selecting my primary audio driver I can get IO without any problems. When I change the drop-down list to my internal card, I get no audio. If I then try to change back to my primary card I get a crash. Here’s the code I’m using, perhaps I’m doing something wrong?

component constructor…
{
const String error (audioDeviceManager->initialise (1, /* number of input channels /
2, /
number of output channels /
0, /
no XML settings… /
true /
select default device on failure */));
if (error.isNotEmpty()){
showMessage(error);
}
}

menu button press event…
{
//check to see if user hit the preference button.
if(menuItemID==2 && topLevelMenuIndex==0)
{
audioDeviceManager->setAudioCallback(0);
AudioDeviceSelectorComponent myAudioSelector(*audioDeviceManager, 10, 10, 10, 10, true, true);
myAudioSelector.setSize (400, 400);
DialogWindow::showModalDialog (T(“Audio Settings”),
&myAudioSelector,
this,
Colours::cornsilk,
true);
}
else if(menuItemID==1 && topLevelMenuIndex==0)//run command
{
audioDeviceManager->setAudioCallback(this);
}

}

Can anyone spot any problems? If I open the preferences dialogue and then select ‘Primary driver’ it continues to work, but changing causes problems.


#2

Surely the context in which is crashes will give you a clue about what’s going on?


#3

Well, yes, it crashes when I try to change audio devices? The clue being that I’m not using the correct procedure to change the audio device. From looking over the demo code I’m at a loss to see how my code causes the crash but the demo code doesn’t. I’ll keep looking at it. On another note my external soundcard is my primary sound device and plays by default in the juce demo. If however I go to audio settings and select it doesn’t work, even though it works as default. Just something I’m curious about but no big deal.


#4

I meant that surely if it crashes in the debugger you’d be able to see what’s failing?