1 |
/* |
/* |
2 |
* jlscp - a java LinuxSampler control protocol API |
* jlscp - a java LinuxSampler control protocol API |
3 |
* |
* |
4 |
* Copyright (C) 2005 Grigor Kirilov Iliev |
* Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
* |
6 |
* This file is part of jlscp. |
* This file is part of jlscp. |
7 |
* |
* |
23 |
package org.linuxsampler.lscp; |
package org.linuxsampler.lscp; |
24 |
|
|
25 |
/** |
/** |
26 |
* Provides information about current settings of a specific sampler channel. |
* Provides information about the current settings of a specific sampler channel. |
27 |
* @author Grigor Iliev |
* @author Grigor Iliev |
28 |
*/ |
*/ |
29 |
public class SamplerChannel implements Parseable { |
public class SamplerChannel implements Parseable { |
30 |
/** Indicates that the channel is muted because of the presence of a solo channel. */ |
/** Indicates that the channel is muted because of the presence of a solo channel. */ |
31 |
private final static int MUTED_BY_SOLO = -1; |
private final static int MUTED_BY_SOLO = -1; |
32 |
|
|
33 |
private int chnID = -1; |
private int chnId = -1; |
34 |
|
|
35 |
private SamplerEngine engine = null; |
private SamplerEngine engine = null; |
36 |
private int aoDevice = -1; |
private int aoDevice = -1; |
46 |
private float vol = 0; |
private float vol = 0; |
47 |
private int mute = 0; |
private int mute = 0; |
48 |
private boolean solo = false; |
private boolean solo = false; |
49 |
|
private int midiInstrumentMapId = -1; |
50 |
|
|
51 |
/** Creates a new instance of SamplerChannel */ |
/** Creates a new instance of SamplerChannel */ |
52 |
public |
public |
70 |
* @return The sampler channel number or -1 if the sampler channel number is not set. |
* @return The sampler channel number or -1 if the sampler channel number is not set. |
71 |
*/ |
*/ |
72 |
public int |
public int |
73 |
getChannelID() { return chnID; } |
getChannelId() { return chnId; } |
74 |
|
|
75 |
/** |
/** |
76 |
* Sets the sampler channel number. |
* Sets the sampler channel number. |
77 |
* @param id The new sampler channel number. |
* @param id The new sampler channel number. |
78 |
*/ |
*/ |
79 |
public void |
public void |
80 |
setChannelID(int id) { chnID = id; } |
setChannelId(int id) { chnId = id; } |
81 |
|
|
82 |
/** |
/** |
83 |
* Gets the engine that is deployed on the sampler channel. |
* Gets the engine that is deployed on the sampler channel. |
114 |
|
|
115 |
/** |
/** |
116 |
* Gets a list which reflects to which audio channel of the selected audio output device |
* Gets a list which reflects to which audio channel of the selected audio output device |
117 |
* each sampler output channel is routed to. |
* each sampler output channel is routed to. The number of the array's position represents |
118 |
|
* the sampler output channel and the value at the specified position represents |
119 |
|
* to which channel of the selected audio output device the |
120 |
|
* sampler output channel is routed to. |
121 |
* @return A list which reflects to which audio channel of the selected audio output device |
* @return A list which reflects to which audio channel of the selected audio output device |
122 |
* each sampler output channel is routed to. |
* each sampler output channel is routed to. |
123 |
*/ |
*/ |
215 |
isSoloChannel() { return solo; } |
isSoloChannel() { return solo; } |
216 |
|
|
217 |
/** |
/** |
218 |
|
* Gets the numerical id of the MIDI instrument |
219 |
|
* map, to which this sampler channel is assigned to. |
220 |
|
* @return The numerical id of the MIDI instrument map, to |
221 |
|
* which this sampler channel is assigned to, or <code>-1</code> |
222 |
|
* if no MIDI instrument map is assigned to this sampler |
223 |
|
* channel and <code>-2</code> if the channel is assigned |
224 |
|
* to the default MIDI instrument map. |
225 |
|
* @see #isUsingDefaultMidiInstrumentMap |
226 |
|
*/ |
227 |
|
public int |
228 |
|
getMidiInstrumentMapId() { return midiInstrumentMapId; } |
229 |
|
|
230 |
|
/** |
231 |
|
* Determines whether the sampler channel is |
232 |
|
* assigned to the default MIDI instrument map. |
233 |
|
* @return <code>true</code> if the sampler channel is assigned |
234 |
|
* to the default MIDI instrument map, <code>false</code> otherwise. |
235 |
|
*/ |
236 |
|
public boolean |
237 |
|
isUsingDefaultMidiInstrumentMap() { return getMidiInstrumentMapId() == -2; } |
238 |
|
|
239 |
|
/** |
240 |
* Parses a line of text. |
* Parses a line of text. |
241 |
* @param s The string to be parsed. |
* @param s The string to be parsed. |
242 |
* @return <code>true</code> if the line has been processed, <code>false</code> otherwise. |
* @return <code>true</code> if the line has been processed, <code>false</code> otherwise. |
302 |
} else if(s.startsWith("SOLO: ")) { |
} else if(s.startsWith("SOLO: ")) { |
303 |
s = s.substring("SOLO: ".length()); |
s = s.substring("SOLO: ".length()); |
304 |
solo = Boolean.parseBoolean(s); |
solo = Boolean.parseBoolean(s); |
305 |
|
} else if(s.startsWith("MIDI_INSTRUMENT_MAP: ")) { |
306 |
|
s = s.substring("MIDI_INSTRUMENT_MAP: ".length()); |
307 |
|
if(s.equals("NONE")) midiInstrumentMapId = -1; |
308 |
|
else if(s.equals("DEFAULT")) midiInstrumentMapId = -2; |
309 |
|
else midiInstrumentMapId = Parser.parseInt(s); |
310 |
} else return false; |
} else return false; |
311 |
|
|
312 |
return true; |
return true; |
317 |
* @return The numerical ID of this sampler channel. |
* @return The numerical ID of this sampler channel. |
318 |
*/ |
*/ |
319 |
public String |
public String |
320 |
toString() { return String.valueOf(getChannelID()); } |
toString() { return String.valueOf(getChannelId()); } |
321 |
} |
} |