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 |
* |
* |
29 |
import org.jsampler.event.MidiDeviceEvent; |
import org.jsampler.event.MidiDeviceEvent; |
30 |
import org.jsampler.event.MidiDeviceListener; |
import org.jsampler.event.MidiDeviceListener; |
31 |
|
|
32 |
|
import org.jsampler.task.Midi; |
33 |
|
|
34 |
import org.linuxsampler.lscp.BoolParameter; |
import org.linuxsampler.lscp.BoolParameter; |
35 |
import org.linuxsampler.lscp.MidiInputDevice; |
import org.linuxsampler.lscp.MidiInputDevice; |
36 |
import org.linuxsampler.lscp.Parameter; |
import org.linuxsampler.lscp.Parameter; |
37 |
|
|
38 |
|
|
39 |
/** |
/** |
40 |
* |
* The Default implementation of the <code>MidiDeviceModel</code> interface. |
41 |
* @author Grigor Iliev |
* @author Grigor Iliev |
42 |
*/ |
*/ |
43 |
public class DefaultMidiDeviceModel implements MidiDeviceModel { |
public class DefaultMidiDeviceModel implements MidiDeviceModel { |
81 |
* -1 if the device number is not set. |
* -1 if the device number is not set. |
82 |
*/ |
*/ |
83 |
public int |
public int |
84 |
getDeviceID() { return midiDevice.getDeviceID(); } |
getDeviceId() { return midiDevice.getDeviceId(); } |
85 |
|
|
86 |
/** |
/** |
87 |
* Gets the current settings of the MIDI device represented by this model. |
* Gets the current settings of the MIDI device represented by this model. |
122 |
isActive() { return midiDevice.isActive(); } |
isActive() { return midiDevice.isActive(); } |
123 |
|
|
124 |
/** |
/** |
125 |
|
* Schedules a new task for enabling/disabling the MIDI device. |
126 |
|
* @param active If <code>true</code> the MIDI device is enabled, |
127 |
|
* else the device is disabled. |
128 |
|
*/ |
129 |
|
public void |
130 |
|
setBackendActive(boolean active) { |
131 |
|
CC.getTaskQueue().add(new Midi.EnableDevice(getDeviceId(), active)); |
132 |
|
} |
133 |
|
|
134 |
|
/** |
135 |
|
* Schedules a new task for changing the port number of the MIDI device. |
136 |
|
* @param ports The new number of ports. |
137 |
|
*/ |
138 |
|
public void |
139 |
|
setBackendPortCount(int ports) { |
140 |
|
CC.getTaskQueue().add(new Midi.SetPortCount(getDeviceId(), ports)); |
141 |
|
} |
142 |
|
|
143 |
|
/** |
144 |
|
* Schedules a new task for altering a specific |
145 |
|
* setting of the specified MIDI input port. |
146 |
|
* @param port The port number. |
147 |
|
* @param prm The parameter to be set. |
148 |
|
*/ |
149 |
|
public void |
150 |
|
setBackendPortParameter(int port, Parameter prm) { |
151 |
|
CC.getTaskQueue().add(new Midi.SetPortParameter(getDeviceId(), port, prm)); |
152 |
|
} |
153 |
|
|
154 |
|
/** |
155 |
* Notifies listeners that the settings of the MIDI device are changed. |
* Notifies listeners that the settings of the MIDI device are changed. |
156 |
*/ |
*/ |
157 |
private void |
private void |