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 |
|
|
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()); |
|
438 |
} |
} |
439 |
|
|
440 |
private static void |
private static void |
613 |
gfs.addTaskListener(new GetFxSendsListener()); |
gfs.addTaskListener(new GetFxSendsListener()); |
614 |
getTaskQueue().add(gfs); |
getTaskQueue().add(gfs); |
615 |
} |
} |
616 |
|
|
617 |
|
// TODO: This should be done after the fx sends are set |
618 |
|
//CC.getSamplerModel().setModified(false); |
619 |
} |
} |
620 |
}); |
}); |
621 |
|
|
696 |
|
|
697 |
public static String |
public static String |
698 |
exportSessionToLscpScript() { |
exportSessionToLscpScript() { |
699 |
|
CC.getSamplerModel().setModified(false); |
700 |
|
|
701 |
StringBuffer sb = new StringBuffer("# Exported by: "); |
StringBuffer sb = new StringBuffer("# Exported by: "); |
702 |
sb.append("JSampler - a java front-end for LinuxSampler\r\n# Version: "); |
sb.append("JSampler - a java front-end for LinuxSampler\r\n# Version: "); |
703 |
sb.append(JSampler.VERSION).append("\r\n"); |
sb.append(JSampler.VERSION).append("\r\n"); |
737 |
SamplerChannelModel[] channels = getSamplerModel().getChannels(); |
SamplerChannelModel[] channels = getSamplerModel().getChannels(); |
738 |
|
|
739 |
for(int i = 0; i < channels.length; i++) { |
for(int i = 0; i < channels.length; i++) { |
740 |
SamplerChannelModel scm = getSamplerModel().getChannelById(i); |
SamplerChannelModel scm = channels[i]; |
741 |
exportChannelToLscpScript(scm.getChannelInfo(), i, lscpClient); |
exportChannelToLscpScript(scm.getChannelInfo(), i, lscpClient); |
742 |
sb.append(out.toString()); |
sb.append(out.toString()); |
743 |
out.reset(); |
out.reset(); |
805 |
try { |
try { |
806 |
lscpCLient.addSamplerChannel(); |
lscpCLient.addSamplerChannel(); |
807 |
|
|
808 |
int i = chn.getMidiInputDevice(); |
SamplerModel sm = CC.getSamplerModel(); |
809 |
if(i != -1) lscpCLient.setChannelMidiInputDevice(chnId, i); |
int id = chn.getMidiInputDevice(); |
810 |
lscpCLient.setChannelMidiInputPort(chnId, chn.getMidiInputPort()); |
if(id != -1) { |
811 |
lscpCLient.setChannelMidiInputChannel(chnId, chn.getMidiInputChannel()); |
for(int i = 0; i < sm.getMidiDeviceCount(); i++) { |
812 |
|
if(sm.getMidiDevice(i).getDeviceId() == id) { |
813 |
i = chn.getAudioOutputDevice(); |
lscpCLient.setChannelMidiInputDevice(chnId, i); |
814 |
if(i != -1) { |
break; |
815 |
lscpCLient.setChannelAudioOutputDevice(chnId, i); |
} |
816 |
|
} |
817 |
|
lscpCLient.setChannelMidiInputPort(chnId, chn.getMidiInputPort()); |
818 |
|
lscpCLient.setChannelMidiInputChannel(chnId, chn.getMidiInputChannel()); |
819 |
|
} |
820 |
|
|
821 |
|
id = chn.getAudioOutputDevice(); |
822 |
|
if(id != -1) { |
823 |
|
for(int i = 0; i < sm.getAudioDeviceCount(); i++) { |
824 |
|
if(sm.getAudioDevice(i).getDeviceId() == id) { |
825 |
|
lscpCLient.setChannelAudioOutputDevice(chnId, i); |
826 |
|
break; |
827 |
|
} |
828 |
|
} |
829 |
|
|
830 |
Integer[] routing = chn.getAudioOutputRouting(); |
Integer[] routing = chn.getAudioOutputRouting(); |
831 |
|
|
832 |
for(int j = 0; j < routing.length; j++) { |
for(int j = 0; j < routing.length; j++) { |
843 |
} |
} |
844 |
|
|
845 |
String s = chn.getInstrumentFile(); |
String s = chn.getInstrumentFile(); |
846 |
i = chn.getInstrumentIndex(); |
int i = chn.getInstrumentIndex(); |
847 |
if(s != null) lscpCLient.loadInstrument(s, i, chnId, true); |
if(s != null) lscpCLient.loadInstrument(s, i, chnId, true); |
848 |
|
|
849 |
if(chn.isMuted()) lscpCLient.setChannelMute(chnId, true); |
if(chn.isMuted()) lscpCLient.setChannelMute(chnId, true); |
880 |
|
|
881 |
private static class EventHandler implements ChannelCountListener, ChannelInfoListener, |
private static class EventHandler implements ChannelCountListener, ChannelInfoListener, |
882 |
FxSendCountListener, FxSendInfoListener, StreamCountListener, VoiceCountListener, |
FxSendCountListener, FxSendInfoListener, StreamCountListener, VoiceCountListener, |
883 |
TotalVoiceCountListener, TaskQueueListener, OrchestraListener, |
TotalStreamCountListener, TotalVoiceCountListener, TaskQueueListener, |
884 |
ListListener<OrchestraModel>, MidiInstrumentCountListener, |
OrchestraListener, ListListener<OrchestraModel>, MidiInstrumentCountListener, |
885 |
MidiInstrumentInfoListener, GlobalInfoListener { |
MidiInstrumentInfoListener, GlobalInfoListener { |
886 |
|
|
887 |
/** Invoked when the number of channels has changed. */ |
/** Invoked when the number of channels has changed. */ |
986 |
scm.setVoiceCount(e.getVoiceCount()); |
scm.setVoiceCount(e.getVoiceCount()); |
987 |
} |
} |
988 |
|
|
989 |
|
/** Invoked when the total number of active streams has changed. */ |
990 |
|
public void |
991 |
|
totalStreamCountChanged(TotalStreamCountEvent e) { |
992 |
|
getSamplerModel().updateActiveStreamsInfo(e.getTotalStreamCount()); |
993 |
|
} |
994 |
|
|
995 |
/** Invoked when the total number of active voices has changed. */ |
/** Invoked when the total number of active voices has changed. */ |
996 |
public void |
public void |
997 |
totalVoiceCountChanged(TotalVoiceCountEvent e) { |
totalVoiceCountChanged(TotalVoiceCountEvent e) { |