1 |
/* |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
* |
4 |
* Copyright (C) 2005 Grigor Kirilov Iliev |
* Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
* |
6 |
* This file is part of JSampler. |
* This file is part of JSampler. |
7 |
* |
* |
59 |
import org.jsampler.HF; |
import org.jsampler.HF; |
60 |
import org.jsampler.MidiDeviceModel; |
import org.jsampler.MidiDeviceModel; |
61 |
|
|
62 |
import org.jsampler.event.AudioDeviceListEvent; |
import org.jsampler.event.ListEvent; |
63 |
import org.jsampler.event.AudioDeviceListListener; |
import org.jsampler.event.ListListener; |
64 |
import org.jsampler.event.MidiDeviceListEvent; |
import org.jsampler.event.MidiDeviceListEvent; |
65 |
import org.jsampler.event.MidiDeviceListListener; |
import org.jsampler.event.MidiDeviceListListener; |
66 |
|
|
67 |
import org.jsampler.task.AddChannel; |
import org.jsampler.task.Channel.SetAudioOutputDevice; |
68 |
|
import org.jsampler.task.Channel.SetMidiInputChannel; |
69 |
|
import org.jsampler.task.Channel.SetMidiInputDevice; |
70 |
|
import org.jsampler.task.Channel.SetMidiInputPort; |
71 |
import org.jsampler.task.LoadEngine; |
import org.jsampler.task.LoadEngine; |
72 |
import org.jsampler.task.LoadInstrument; |
import org.jsampler.task.LoadInstrument; |
|
import org.jsampler.task.SetChannelAudioOutputDevice; |
|
|
import org.jsampler.task.SetChannelMidiInputChannel; |
|
|
import org.jsampler.task.SetChannelMidiInputDevice; |
|
|
import org.jsampler.task.SetChannelMidiInputPort; |
|
73 |
|
|
74 |
import org.linuxsampler.lscp.AudioOutputDevice; |
import org.linuxsampler.lscp.AudioOutputDevice; |
75 |
import org.linuxsampler.lscp.MidiInputDevice; |
import org.linuxsampler.lscp.MidiInputDevice; |
352 |
} |
} |
353 |
|
|
354 |
public void |
public void |
355 |
initPage() { |
preinitPage() { |
356 |
updatePorts(((NewChannelWizardModel)getWizardModel()).getSelectedMidiDevice()); |
updatePorts(((NewChannelWizardModel)getWizardModel()).getSelectedMidiDevice()); |
357 |
} |
} |
358 |
|
|
470 |
private Handler |
private Handler |
471 |
getHandler() { return handler; } |
getHandler() { return handler; } |
472 |
|
|
473 |
private class Handler implements AudioDeviceListListener { |
private class Handler implements ListListener<AudioDeviceModel> { |
474 |
public void |
public void |
475 |
deviceAdded(AudioDeviceListEvent e) { |
entryAdded(ListEvent<AudioDeviceModel> e) { |
476 |
updateDeviceList(e.getAudioDeviceModel().getDeviceInfo()); |
updateDeviceList(e.getEntry().getDeviceInfo()); |
477 |
} |
} |
478 |
|
|
479 |
public void |
public void |
480 |
deviceRemoved(AudioDeviceListEvent e) { updateDeviceList(null); } |
entryRemoved(ListEvent<AudioDeviceModel> e) { updateDeviceList(null); } |
481 |
|
|
482 |
private void |
private void |
483 |
updateDeviceList(AudioOutputDevice dev) { |
updateDeviceList(AudioOutputDevice dev) { |
582 |
} |
} |
583 |
|
|
584 |
public void |
public void |
585 |
initPage() { |
preinitPage() { |
586 |
NewChannelWizardModel model = (NewChannelWizardModel)getWizardModel(); |
NewChannelWizardModel model = (NewChannelWizardModel)getWizardModel(); |
587 |
if(model.getSelectedAudioDevice() == null) { |
if(model.getSelectedAudioDevice() == null) { |
588 |
String s = i18n.getLabel("InstrumentWizardPage.additionalInstructions"); |
String s = i18n.getLabel("InstrumentWizardPage.additionalInstructions"); |
770 |
} |
} |
771 |
|
|
772 |
public void |
public void |
773 |
initPage() { |
preinitPage() { |
774 |
NewChannelWizardModel model = (NewChannelWizardModel)getWizardModel(); |
NewChannelWizardModel model = (NewChannelWizardModel)getWizardModel(); |
775 |
setMidiDevice(model.getSelectedMidiDevice()); |
setMidiDevice(model.getSelectedMidiDevice()); |
776 |
|
|
800 |
*/ |
*/ |
801 |
public boolean |
public boolean |
802 |
mayFinish() { |
mayFinish() { |
803 |
final AddChannel ac = new AddChannel(); |
final org.jsampler.task.Channel.Add ac = new org.jsampler.task.Channel.Add(); |
804 |
|
|
805 |
ac.addTaskListener(new TaskListener() { |
ac.addTaskListener(new TaskListener() { |
806 |
public void |
public void |
826 |
|
|
827 |
MidiInputDevice d = getMidiDevice(); |
MidiInputDevice d = getMidiDevice(); |
828 |
if(d != null) { |
if(d != null) { |
829 |
CC.getTaskQueue().add(new SetChannelMidiInputDevice(chn, d.getDeviceID())); |
CC.getTaskQueue().add(new SetMidiInputChannel(chn, d.getDeviceId())); |
830 |
|
|
831 |
if(getMidiPort() != null) { |
if(getMidiPort() != null) { |
832 |
int port = -1; |
int port = -1; |
838 |
} |
} |
839 |
|
|
840 |
if(port != -1) CC.getTaskQueue().add ( |
if(port != -1) CC.getTaskQueue().add ( |
841 |
new SetChannelMidiInputPort(chn, port) |
new SetMidiInputPort(chn, port) |
842 |
); |
); |
843 |
} |
} |
844 |
|
|
845 |
|
|
846 |
int mc = (getMidiChannel() == -1 ? -1 : getMidiChannel() - 1); |
int mc = (getMidiChannel() == -1 ? -1 : getMidiChannel() - 1); |
847 |
CC.getTaskQueue().add(new SetChannelMidiInputChannel(chn, mc)); |
CC.getTaskQueue().add(new SetMidiInputChannel(chn, mc)); |
848 |
} |
} |
849 |
|
|
850 |
|
|
851 |
|
|
852 |
if(getAudioDevice() != null) CC.getTaskQueue().add ( |
if(getAudioDevice() != null) CC.getTaskQueue().add ( |
853 |
new SetChannelAudioOutputDevice(chn, getAudioDevice().getDeviceID()) |
new SetAudioOutputDevice(chn, getAudioDevice().getDeviceId()) |
854 |
); |
); |
855 |
|
|
856 |
if(getInstrumentFile().length() > 0) CC.getTaskQueue().add ( |
if(getInstrumentFile().length() > 0) CC.getTaskQueue().add ( |
875 |
if(dev == null) { |
if(dev == null) { |
876 |
tfAudioDevice.setText(i18n.getLabel("ConfirmationWizardPage.notSpecified")); |
tfAudioDevice.setText(i18n.getLabel("ConfirmationWizardPage.notSpecified")); |
877 |
} else { |
} else { |
878 |
tfAudioDevice.setText(dev.getDeviceID() + " (" + dev.getDriverName() + ")"); |
tfAudioDevice.setText(dev.getDeviceId() + " (" + dev.getDriverName() + ")"); |
879 |
} |
} |
880 |
} |
} |
881 |
|
|
979 |
if(dev == null) { |
if(dev == null) { |
980 |
tfMidiDevice.setText(i18n.getLabel("ConfirmationWizardPage.notSpecified")); |
tfMidiDevice.setText(i18n.getLabel("ConfirmationWizardPage.notSpecified")); |
981 |
} else { |
} else { |
982 |
tfMidiDevice.setText(dev.getDeviceID() + " (" + dev.getDriverName() + ")"); |
tfMidiDevice.setText(dev.getDeviceId() + " (" + dev.getDriverName() + ")"); |
983 |
} |
} |
984 |
} |
} |
985 |
|
|