376 |
* database support the tree model is initialized on first use. |
* database support the tree model is initialized on first use. |
377 |
* @return The tree model of the instruments database or |
* @return The tree model of the instruments database or |
378 |
* <code>null</code> if the backend doesn't have instruments database support. |
* <code>null</code> if the backend doesn't have instruments database support. |
379 |
* @see org.jsampler.view.JSMainFrame#getInstrumentsDbSupport |
* @see org.jsampler.view.JSViewConfig#getInstrumentsDbSupport |
380 |
*/ |
*/ |
381 |
public static InstrumentsDbTreeModel |
public static InstrumentsDbTreeModel |
382 |
getInstrumentsDbTreeModel() { |
getInstrumentsDbTreeModel() { |
400 |
loadOrchestras() { |
loadOrchestras() { |
401 |
if(getJSamplerHome() == null) return; |
if(getJSamplerHome() == null) return; |
402 |
|
|
|
//TODO: This should be removed in the next release (including loadOrchestras0()) |
|
|
File f2 = new File(getJSamplerHome() + File.separator + "orchestras.xml"); |
|
|
if(!f2.isFile()) { |
|
|
loadOrchestras0(); |
|
|
saveOrchestras(); |
|
|
return; |
|
|
} |
|
|
/////// |
|
|
|
|
403 |
try { |
try { |
404 |
String s = getJSamplerHome(); |
String s = getJSamplerHome(); |
405 |
if(s == null) return; |
if(s == null) return; |
406 |
|
getOrchestras().addOrchestraListListener(getHandler()); |
407 |
|
|
408 |
File f = new File(s + File.separator + "orchestras.xml.bkp"); |
File f = new File(s + File.separator + "orchestras.xml.bkp"); |
409 |
if(f.isFile()) HF.createBackup("orchestras.xml.bkp", "orchestras.xml.rec"); |
if(f.isFile()) HF.createBackup("orchestras.xml.bkp", "orchestras.xml.rec"); |
432 |
for(int i = 0; i < getOrchestras().getOrchestraCount(); i++) { |
for(int i = 0; i < getOrchestras().getOrchestraCount(); i++) { |
433 |
getOrchestras().getOrchestra(i).addOrchestraListener(getHandler()); |
getOrchestras().getOrchestra(i).addOrchestraListener(getHandler()); |
434 |
} |
} |
|
getOrchestras().addOrchestraListListener(getHandler()); |
|
|
} |
|
|
|
|
|
private static void |
|
|
loadOrchestras0() { |
|
|
String s = Prefs.getOrchestras(); |
|
|
if(s == null) return; |
|
|
|
|
|
ByteArrayInputStream bais = new ByteArrayInputStream(s.getBytes()); |
|
|
Document doc = DOMUtils.readObject(bais); |
|
|
|
|
|
try { getOrchestras().readObject(doc.getDocumentElement()); } |
|
|
catch(Exception x) { HF.showErrorMessage(x, "Loading orchestras: "); } |
|
435 |
} |
} |
436 |
|
|
437 |
private static void |
private static void |
729 |
SamplerChannelModel[] channels = getSamplerModel().getChannels(); |
SamplerChannelModel[] channels = getSamplerModel().getChannels(); |
730 |
|
|
731 |
for(int i = 0; i < channels.length; i++) { |
for(int i = 0; i < channels.length; i++) { |
732 |
SamplerChannelModel scm = getSamplerModel().getChannelById(i); |
SamplerChannelModel scm = channels[i]; |
733 |
exportChannelToLscpScript(scm.getChannelInfo(), i, lscpClient); |
exportChannelToLscpScript(scm.getChannelInfo(), i, lscpClient); |
734 |
sb.append(out.toString()); |
sb.append(out.toString()); |
735 |
out.reset(); |
out.reset(); |
797 |
try { |
try { |
798 |
lscpCLient.addSamplerChannel(); |
lscpCLient.addSamplerChannel(); |
799 |
|
|
800 |
int i = chn.getMidiInputDevice(); |
SamplerModel sm = CC.getSamplerModel(); |
801 |
if(i != -1) lscpCLient.setChannelMidiInputDevice(chnId, i); |
int id = chn.getMidiInputDevice(); |
802 |
|
if(id != -1) { |
803 |
|
for(int i = 0; i < sm.getMidiDeviceCount(); i++) { |
804 |
|
if(sm.getMidiDevice(i).getDeviceId() == id) { |
805 |
|
lscpCLient.setChannelMidiInputDevice(chnId, i); |
806 |
|
break; |
807 |
|
} |
808 |
|
} |
809 |
|
} |
810 |
lscpCLient.setChannelMidiInputPort(chnId, chn.getMidiInputPort()); |
lscpCLient.setChannelMidiInputPort(chnId, chn.getMidiInputPort()); |
811 |
lscpCLient.setChannelMidiInputChannel(chnId, chn.getMidiInputChannel()); |
lscpCLient.setChannelMidiInputChannel(chnId, chn.getMidiInputChannel()); |
812 |
|
|
813 |
i = chn.getAudioOutputDevice(); |
id = chn.getAudioOutputDevice(); |
814 |
if(i != -1) { |
if(id != -1) { |
815 |
lscpCLient.setChannelAudioOutputDevice(chnId, i); |
for(int i = 0; i < sm.getAudioDeviceCount(); i++) { |
816 |
|
if(sm.getAudioDevice(i).getDeviceId() == id) { |
817 |
|
lscpCLient.setChannelAudioOutputDevice(chnId, i); |
818 |
|
break; |
819 |
|
} |
820 |
|
} |
821 |
|
|
822 |
Integer[] routing = chn.getAudioOutputRouting(); |
Integer[] routing = chn.getAudioOutputRouting(); |
823 |
|
|
824 |
for(int j = 0; j < routing.length; j++) { |
for(int j = 0; j < routing.length; j++) { |
835 |
} |
} |
836 |
|
|
837 |
String s = chn.getInstrumentFile(); |
String s = chn.getInstrumentFile(); |
838 |
i = chn.getInstrumentIndex(); |
int i = chn.getInstrumentIndex(); |
839 |
if(s != null) lscpCLient.loadInstrument(s, i, chnId, true); |
if(s != null) lscpCLient.loadInstrument(s, i, chnId, true); |
840 |
|
|
841 |
if(chn.isMuted()) lscpCLient.setChannelMute(chnId, true); |
if(chn.isMuted()) lscpCLient.setChannelMute(chnId, true); |