/**
* Change the mixer and restart the TargetDataLine
* @param mixerName
*/
public boolean changeMixer(String mixerName) {
Mixer mx=null;
try {
//stop current line
this.line.stop();
this.line.close();
this.line.flush();
// Record this mixer change
if (debugAudio==true) audioDebugDump("changeMixer() : mixerName="+mixerName);
//set the new mixer and line
mx=getMixer(mixerName);
// If null we have a problem so return false
if (mx==null) {
if (debugAudio==true) audioDebugDump("changeMixer() : mx==null");
return false;
}
this.setMixer(mx);
this.line=(TargetDataLine) getDataLineForMixer();
//restart
if (openLine()==false) {
if (debugAudio==true) audioDebugDump("changeMixer() : openLine()==false");
return false;
}
this.line.start();
}
catch (Exception e) {
// Record the exception
errorMsg="changeMixer() : "+e.getMessage();
// then if a mixer has been obtained then display some information about it
if (mx!=null) {
Mixer.Info mInfo=mx.getMixerInfo();
errorMsg=errorMsg+"\nMixer Name : "+mInfo.getName()+"\nMixer Description : "+mInfo.getDescription();
}
audioDebugDump(errorMsg);
return false;
}