265 |
getClient().removeVoiceCountListener(getHandler()); |
getClient().removeVoiceCountListener(getHandler()); |
266 |
getClient().addVoiceCountListener(getHandler()); |
getClient().addVoiceCountListener(getHandler()); |
267 |
|
|
268 |
|
getClient().removeTotalStreamCountListener(getHandler()); |
269 |
|
getClient().addTotalStreamCountListener(getHandler()); |
270 |
|
|
271 |
getClient().removeTotalVoiceCountListener(getHandler()); |
getClient().removeTotalVoiceCountListener(getHandler()); |
272 |
getClient().addTotalVoiceCountListener(getHandler()); |
getClient().addTotalVoiceCountListener(getHandler()); |
273 |
|
|
379 |
* database support the tree model is initialized on first use. |
* database support the tree model is initialized on first use. |
380 |
* @return The tree model of the instruments database or |
* @return The tree model of the instruments database or |
381 |
* <code>null</code> if the backend doesn't have instruments database support. |
* <code>null</code> if the backend doesn't have instruments database support. |
382 |
* @see org.jsampler.view.JSMainFrame#getInstrumentsDbSupport |
* @see org.jsampler.view.JSViewConfig#getInstrumentsDbSupport |
383 |
*/ |
*/ |
384 |
public static InstrumentsDbTreeModel |
public static InstrumentsDbTreeModel |
385 |
getInstrumentsDbTreeModel() { |
getInstrumentsDbTreeModel() { |
403 |
loadOrchestras() { |
loadOrchestras() { |
404 |
if(getJSamplerHome() == null) return; |
if(getJSamplerHome() == null) return; |
405 |
|
|
|
//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; |
|
|
} |
|
|
/////// |
|
|
|
|
406 |
try { |
try { |
407 |
String s = getJSamplerHome(); |
String s = getJSamplerHome(); |
408 |
if(s == null) return; |
if(s == null) return; |
409 |
|
getOrchestras().addOrchestraListListener(getHandler()); |
410 |
|
|
411 |
File f = new File(s + File.separator + "orchestras.xml.bkp"); |
File f = new File(s + File.separator + "orchestras.xml.bkp"); |
412 |
if(f.isFile()) HF.createBackup("orchestras.xml.bkp", "orchestras.xml.rec"); |
if(f.isFile()) HF.createBackup("orchestras.xml.bkp", "orchestras.xml.rec"); |
435 |
for(int i = 0; i < getOrchestras().getOrchestraCount(); i++) { |
for(int i = 0; i < getOrchestras().getOrchestraCount(); i++) { |
436 |
getOrchestras().getOrchestra(i).addOrchestraListener(getHandler()); |
getOrchestras().getOrchestra(i).addOrchestraListener(getHandler()); |
437 |
} |
} |
|
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: "); } |
|
438 |
} |
} |
439 |
|
|
440 |
private static void |
private static void |
732 |
SamplerChannelModel[] channels = getSamplerModel().getChannels(); |
SamplerChannelModel[] channels = getSamplerModel().getChannels(); |
733 |
|
|
734 |
for(int i = 0; i < channels.length; i++) { |
for(int i = 0; i < channels.length; i++) { |
735 |
SamplerChannelModel scm = getSamplerModel().getChannelById(i); |
SamplerChannelModel scm = channels[i]; |
736 |
exportChannelToLscpScript(scm.getChannelInfo(), i, lscpClient); |
exportChannelToLscpScript(scm.getChannelInfo(), i, lscpClient); |
737 |
sb.append(out.toString()); |
sb.append(out.toString()); |
738 |
out.reset(); |
out.reset(); |
800 |
try { |
try { |
801 |
lscpCLient.addSamplerChannel(); |
lscpCLient.addSamplerChannel(); |
802 |
|
|
803 |
int i = chn.getMidiInputDevice(); |
SamplerModel sm = CC.getSamplerModel(); |
804 |
if(i != -1) lscpCLient.setChannelMidiInputDevice(chnId, i); |
int id = chn.getMidiInputDevice(); |
805 |
lscpCLient.setChannelMidiInputPort(chnId, chn.getMidiInputPort()); |
if(id != -1) { |
806 |
lscpCLient.setChannelMidiInputChannel(chnId, chn.getMidiInputChannel()); |
for(int i = 0; i < sm.getMidiDeviceCount(); i++) { |
807 |
|
if(sm.getMidiDevice(i).getDeviceId() == id) { |
808 |
i = chn.getAudioOutputDevice(); |
lscpCLient.setChannelMidiInputDevice(chnId, i); |
809 |
if(i != -1) { |
break; |
810 |
lscpCLient.setChannelAudioOutputDevice(chnId, i); |
} |
811 |
|
} |
812 |
|
lscpCLient.setChannelMidiInputPort(chnId, chn.getMidiInputPort()); |
813 |
|
lscpCLient.setChannelMidiInputChannel(chnId, chn.getMidiInputChannel()); |
814 |
|
} |
815 |
|
|
816 |
|
id = chn.getAudioOutputDevice(); |
817 |
|
if(id != -1) { |
818 |
|
for(int i = 0; i < sm.getAudioDeviceCount(); i++) { |
819 |
|
if(sm.getAudioDevice(i).getDeviceId() == id) { |
820 |
|
lscpCLient.setChannelAudioOutputDevice(chnId, i); |
821 |
|
break; |
822 |
|
} |
823 |
|
} |
824 |
|
|
825 |
Integer[] routing = chn.getAudioOutputRouting(); |
Integer[] routing = chn.getAudioOutputRouting(); |
826 |
|
|
827 |
for(int j = 0; j < routing.length; j++) { |
for(int j = 0; j < routing.length; j++) { |
838 |
} |
} |
839 |
|
|
840 |
String s = chn.getInstrumentFile(); |
String s = chn.getInstrumentFile(); |
841 |
i = chn.getInstrumentIndex(); |
int i = chn.getInstrumentIndex(); |
842 |
if(s != null) lscpCLient.loadInstrument(s, i, chnId, true); |
if(s != null) lscpCLient.loadInstrument(s, i, chnId, true); |
843 |
|
|
844 |
if(chn.isMuted()) lscpCLient.setChannelMute(chnId, true); |
if(chn.isMuted()) lscpCLient.setChannelMute(chnId, true); |
875 |
|
|
876 |
private static class EventHandler implements ChannelCountListener, ChannelInfoListener, |
private static class EventHandler implements ChannelCountListener, ChannelInfoListener, |
877 |
FxSendCountListener, FxSendInfoListener, StreamCountListener, VoiceCountListener, |
FxSendCountListener, FxSendInfoListener, StreamCountListener, VoiceCountListener, |
878 |
TotalVoiceCountListener, TaskQueueListener, OrchestraListener, |
TotalStreamCountListener, TotalVoiceCountListener, TaskQueueListener, |
879 |
ListListener<OrchestraModel>, MidiInstrumentCountListener, |
OrchestraListener, ListListener<OrchestraModel>, MidiInstrumentCountListener, |
880 |
MidiInstrumentInfoListener, GlobalInfoListener { |
MidiInstrumentInfoListener, GlobalInfoListener { |
881 |
|
|
882 |
/** Invoked when the number of channels has changed. */ |
/** Invoked when the number of channels has changed. */ |
981 |
scm.setVoiceCount(e.getVoiceCount()); |
scm.setVoiceCount(e.getVoiceCount()); |
982 |
} |
} |
983 |
|
|
984 |
|
/** Invoked when the total number of active streams has changed. */ |
985 |
|
public void |
986 |
|
totalStreamCountChanged(TotalStreamCountEvent e) { |
987 |
|
getSamplerModel().updateActiveStreamsInfo(e.getTotalStreamCount()); |
988 |
|
} |
989 |
|
|
990 |
/** Invoked when the total number of active voices has changed. */ |
/** Invoked when the total number of active voices has changed. */ |
991 |
public void |
public void |
992 |
totalVoiceCountChanged(TotalVoiceCountEvent e) { |
totalVoiceCountChanged(TotalVoiceCountEvent e) { |