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.