Hi
I’m not a skilled C/c++ programmer so please bare over with me with this simple question:
I have a problem with the audioDeviceManager() which I’m trying to configure using a saved Xml-file containing the soundcard configuration from the previous run of my program.
Here is what I do in the constructor:
[b]// Setup Audio throughput
XmlDocument myXmlDocument (File(“c:/audioManagerState.xml”));
XmlElement* k = myXmlDocument.getDocumentElement();
if (k == 0)
{ String error = myXmlDocument.getLastParseError();
myAudioDeviceManager.initialise(2,2,0,true);
}
else
{
myAudioDeviceManager.initialise(2,2,k,true);
}
delete k;
myAudioDeviceManager.setAudioCallback(this);
[/b]
and here is what I do when pressing the button that opens the dialog window for soundcard configuration:
[b]// Create an AudioDeviceSelectorComponent which contains the audio choice widgets…
AudioDeviceSelectorComponent audioSettingsComp( myAudioDeviceManager, 2, 2, 2, 2, true, false, true, false);
// …and show it in a DialogWindow…
audioSettingsComp.setSize (400, 600);
DialogWindow::showModalDialog (T(“Audio Settings”),
&audioSettingsComp,
this,
Colours::azure,
true);
XmlElement *k = myAudioDeviceManager.createStateXml();
if (k != 0)
k->writeToFile(File(“c:/audioManagerState.xml”),"");
delete k;
myAudioDeviceManager.setAudioCallback(this);
[/b]
I think this should work OK but my program breaks when I later do FFTs (fast-fourier-transforms) using the FFTW-library. I think the problem is that the XmlFile is not closed/released before addressing the FFTW.dll file. Can someone please tell me how I should do this properly?
Also, when the program breaks I’m not able to recompile. Visual Express prompts:
1>LINK : fatal error LNK1168: cannot open .\Debug/juce_application.exe for writing
…and I have to reboot my computer to be able to compile. Anyone knows how I can avoid rebooting?
Best Regards
Thomas