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 |
* |
* |
22 |
|
|
23 |
package org.jsampler; |
package org.jsampler; |
24 |
|
|
25 |
|
import org.jsampler.event.EffectSendsListener; |
26 |
import org.jsampler.event.SamplerChannelListener; |
import org.jsampler.event.SamplerChannelListener; |
27 |
|
|
28 |
|
import org.linuxsampler.lscp.FxSend; |
29 |
import org.linuxsampler.lscp.SamplerChannel; |
import org.linuxsampler.lscp.SamplerChannel; |
30 |
|
|
31 |
|
|
32 |
/** |
/** |
33 |
* A data model representing a sampler channel. |
* A data model representing a sampler channel. |
34 |
|
* Note that all methods that begin with <code>setBackend</code> alter the settings |
35 |
|
* on the backend side. |
36 |
* @author Grigor Iliev |
* @author Grigor Iliev |
37 |
*/ |
*/ |
38 |
public interface SamplerChannelModel { |
public interface SamplerChannelModel { |
49 |
public void removeSamplerChannelListener(SamplerChannelListener l); |
public void removeSamplerChannelListener(SamplerChannelListener l); |
50 |
|
|
51 |
/** |
/** |
52 |
|
* Registers the specified listener for receiving event messages. |
53 |
|
* @param l The <code>EffectSendsListener</code> to register. |
54 |
|
*/ |
55 |
|
public void addEffectSendsListener(EffectSendsListener l); |
56 |
|
|
57 |
|
/** |
58 |
|
* Removes the specified listener. |
59 |
|
* @param l The <code>EffectSendsListener</code> to remove. |
60 |
|
*/ |
61 |
|
public void removeEffectSendsListener(EffectSendsListener l); |
62 |
|
|
63 |
|
/** |
64 |
* Gets the sampler channel number. |
* Gets the sampler channel number. |
65 |
* @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. |
66 |
*/ |
*/ |
67 |
public int getChannelID(); |
public int getChannelId(); |
68 |
|
|
69 |
/** |
/** |
70 |
* Gets the current settings of the sampler channel. |
* Gets the current settings of the sampler channel. |
75 |
|
|
76 |
/** |
/** |
77 |
* Sets the current settings of the sampler channel. |
* Sets the current settings of the sampler channel. |
78 |
|
* Note that this method does not changes the channel settings on |
79 |
|
* the backend. It is invoked just notify for channel settings' changes. |
80 |
* @param channel A <code>SamplerChannel</code> instance containing |
* @param channel A <code>SamplerChannel</code> instance containing |
81 |
* the new settings for this sampler channel. |
* the new settings for this sampler channel. |
82 |
*/ |
*/ |
90 |
|
|
91 |
/** |
/** |
92 |
* Sets the number of active disk streams. |
* Sets the number of active disk streams. |
93 |
|
* Note that this method does <b>not</b> alter the number |
94 |
|
* of active disk streams on the backend side. |
95 |
* @param count The new number of active disk streams. |
* @param count The new number of active disk streams. |
96 |
*/ |
*/ |
97 |
public void setStreamCount(int count); |
public void setStreamCount(int count); |
104 |
|
|
105 |
/** |
/** |
106 |
* Sets the number of active voices. |
* Sets the number of active voices. |
107 |
|
* Note that this method does <b>not</b> alter the number |
108 |
|
* of active voices on the backend side. |
109 |
* @param count The new number of active voices. |
* @param count The new number of active voices. |
110 |
*/ |
*/ |
111 |
public void setVoiceCount(int count); |
public void setVoiceCount(int count); |
112 |
|
|
113 |
/** |
/** |
114 |
* Sets the sampler engine type to be used. |
* Schedules a new task for setting the sampler engine type to be used. |
115 |
* @param engine The name of the engine type to be used. |
* @param engine The name of the engine type to be used. |
116 |
*/ |
*/ |
117 |
public void setEngineType(String engine); |
public void setBackendEngineType(String engine); |
118 |
|
|
119 |
/** |
/** |
120 |
* Sets the mute mode of the channel. |
* Schedules a new task for setting the mute mode of the channel. |
121 |
* @param mute Specifies the mute mode. If <code>true</code> the channel is muted, else |
* @param mute Specifies the mute mode. If <code>true</code> the channel is muted, else |
122 |
* the channel is unmuted. |
* the channel is unmuted. |
123 |
*/ |
*/ |
124 |
public void setMute(boolean mute); |
public void setBackendMute(boolean mute); |
125 |
|
|
126 |
/** |
/** |
127 |
* Sets the solo mode of the channel. |
* Schedules a new task for setting on the backend side the solo mode of the channel. |
128 |
* @param solo Specifies the solo mode. If <code>true</code> the channel is soloed, else |
* @param solo Specifies the solo mode. If <code>true</code> the channel is soloed, else |
129 |
* the channel is unsoloed. |
* the channel is unsoloed. |
130 |
*/ |
*/ |
131 |
public void setSolo(boolean solo); |
public void setBackendSolo(boolean solo); |
132 |
|
|
133 |
/** |
/** |
134 |
* Sets the channel volume. |
* Schedules a new task for setting the channel volume on the backend side. |
135 |
* @param volume Specifies the new volume value. |
* @param volume Specifies the new volume value. |
136 |
*/ |
*/ |
137 |
public void setVolume(float volume); |
public void setBackendVolume(float volume); |
138 |
|
|
139 |
/** |
/** |
140 |
* Sets the MIDI input device of the channel represented by this model. |
* Schedules a new task for setting on the backend side the MIDI input |
141 |
* @param deviceID Specifies the numerical ID of the MIDI input device to be set. |
* device of the channel represented by this model. |
142 |
|
* @param deviceId Specifies the numerical ID of the MIDI input device to be set. |
143 |
*/ |
*/ |
144 |
public void setMidiInputDevice(int deviceID); |
public void setBackendMidiInputDevice(int deviceId); |
145 |
|
|
146 |
/** |
/** |
147 |
* Sets the MIDI input port of the channel represented by this model. |
* Schedules a new task for setting (on the backend side) the |
148 |
|
* MIDI input port of the channel represented by this model. |
149 |
* @param port Specifies the number of the MIDI input port. |
* @param port Specifies the number of the MIDI input port. |
150 |
*/ |
*/ |
151 |
public void setMidiInputPort(int port); |
public void setBackendMidiInputPort(int port); |
152 |
|
|
153 |
/** |
/** |
154 |
* Sets the MIDI channel that the channel represented by this model should listen to. |
* Schedules a new task for setting (on the backend side) the MIDI channel |
155 |
|
* that the channel represented by this model should listen to. |
156 |
* @param channel Specifies the MIDI channel that the channel |
* @param channel Specifies the MIDI channel that the channel |
157 |
* represented by this model should listen to. |
* represented by this model should listen to. |
158 |
*/ |
*/ |
159 |
public void setMidiInputChannel(int channel); |
public void setBackendMidiInputChannel(int channel); |
160 |
|
|
161 |
|
/** |
162 |
|
* Schedules a new task for setting (on the backend side) the audio output |
163 |
|
* device of the channel represented by this model. |
164 |
|
* @param deviceId Specifies the numerical ID of the audio output device to be set. |
165 |
|
*/ |
166 |
|
public void setBackendAudioOutputDevice(int deviceId); |
167 |
|
|
168 |
/** |
/** |
169 |
* Sets the audio output device of the channel represented by this model. |
* Sets the destination of the destination of the specified audio channel. |
170 |
* @param deviceID Specifies the numerical ID of the audio output device to be set. |
* @param audioSrc The numerical ID of the sampler channel's audio |
171 |
|
* output channel, which should be rerouted. |
172 |
|
* @param audioDst The audio channel of the selected audio output device |
173 |
|
* where <code>audioSrc</code> should be routed to. |
174 |
*/ |
*/ |
175 |
public void setAudioOutputDevice(int deviceID); |
public void setBackendAudioOutputChannel(int audioSrc, int audioDst); |
176 |
|
|
177 |
/** |
/** |
178 |
* Loads and assigns the specified instrument |
* Schedules a new task for assigning (on the backend side) the |
179 |
|
* specified MIDI instrument map to this sampler channel. |
180 |
|
* @param mapId Specify the numerical ID of the MIDI instrument |
181 |
|
* map that should be assigned to this sampler |
182 |
|
* channel or <code>-1</code> to remove the current map binding. |
183 |
|
*/ |
184 |
|
public void setBackendMidiInstrumentMap(int mapId); |
185 |
|
|
186 |
|
/** |
187 |
|
* Schedules a new task for loading and assigning the specified instrument |
188 |
* to the sampler channel represented by this model. |
* to the sampler channel represented by this model. |
189 |
* @param filename The file name of the instrument to be loaded. |
* @param filename The file name of the instrument to be loaded. |
190 |
* @param InstrIndex The index of the instrument in the instrument file to be loaded. |
* @param InstrIndex The index of the instrument in the instrument file to be loaded. |
191 |
*/ |
*/ |
192 |
public void loadInstrument(String filename, int InstrIndex); |
public void loadBackendInstrument(String filename, int InstrIndex); |
193 |
|
|
194 |
|
/** Schedules a new task for reseting the channel. */ |
195 |
|
public void resetBackendChannel(); |
196 |
|
|
197 |
/** Resets the channel. */ |
/** Schedules a new task for duplicating the channel. */ |
198 |
public void resetChannel(); |
public void duplicateBackendChannel(); |
199 |
|
|
200 |
|
/** |
201 |
|
* Schedules a new task for adding a new effect send on the |
202 |
|
* backend side. The effect send will be actually added to this model |
203 |
|
* when the backend notifies for its creation. |
204 |
|
* @param midiCtrl Defines the MIDI controller, which |
205 |
|
* will be able alter the effect send level. |
206 |
|
*/ |
207 |
|
public void addBackendFxSend(int midiCtrl); |
208 |
|
|
209 |
|
/** |
210 |
|
* Schedules a new task for adding a new effect send on the |
211 |
|
* backend side. The effect send will be actually added to this model |
212 |
|
* when the backend notifies for its creation. |
213 |
|
* @param midiCtrl Defines the MIDI controller, which |
214 |
|
* will be able alter the effect send level. |
215 |
|
* @param name The name of the effect send entity. |
216 |
|
* The name does not have to be unique. |
217 |
|
*/ |
218 |
|
public void addBackendFxSend(int midiCtrl, String name); |
219 |
|
|
220 |
|
/** |
221 |
|
* Adds the specified effect send. |
222 |
|
* @param fxSend The effect send to be added. |
223 |
|
*/ |
224 |
|
public void addFxSend(FxSend fxSend); |
225 |
|
|
226 |
|
/** |
227 |
|
* Schedules a new task for removing the specified effect send on the backend side. |
228 |
|
* @param fxSendId The ID of the effect send to remove. |
229 |
|
*/ |
230 |
|
public void removeBackendFxSend(int fxSendId); |
231 |
|
|
232 |
|
/** |
233 |
|
* Removes the effect send at the specified position. |
234 |
|
* @param index The position of the effect send to remove. |
235 |
|
* @return The removed effect send. |
236 |
|
*/ |
237 |
|
public FxSend removeFxSend(int index); |
238 |
|
|
239 |
/** Duplicates the channel. */ |
/** |
240 |
public void duplicateChannel(); |
* Removes the specified effect send. |
241 |
|
* @param fxSendId The ID of the effect send to remove. |
242 |
|
* @return <code>true</code> if the effect send is removed successfully, <code>false</code> |
243 |
|
* if the channel does not contain effect send with ID <code>fxSendId</code>. |
244 |
|
*/ |
245 |
|
public boolean removeFxSendById(int fxSendId); |
246 |
|
|
247 |
|
/** Removes all effect sends from this channel. */ |
248 |
|
public void removeAllFxSends(); |
249 |
|
|
250 |
|
/** |
251 |
|
* Updates the specified effect send. |
252 |
|
* @param fxSend The effect send to update. |
253 |
|
*/ |
254 |
|
public void updateFxSend(FxSend fxSend); |
255 |
|
|
256 |
|
/** |
257 |
|
* Gets the current number of effect sends. |
258 |
|
* @return The current number of effect sends. |
259 |
|
*/ |
260 |
|
public int getFxSendCount(); |
261 |
|
|
262 |
|
/** |
263 |
|
* Gets the effect send at the specified position. |
264 |
|
* @param index The index of the effect send to be returned. |
265 |
|
* @return The effect send at the specified position. |
266 |
|
*/ |
267 |
|
public FxSend getFxSend(int index); |
268 |
|
|
269 |
|
/** |
270 |
|
* Gets the effect send with the specified ID. |
271 |
|
* @param fxSendId The ID of the effect send to return. |
272 |
|
* @return The effect send with the specified ID or <code>null</code> |
273 |
|
* if there is no effect send with ID <code>fxSendId</code>. |
274 |
|
*/ |
275 |
|
public FxSend getFxSendById(int fxSendId); |
276 |
|
|
277 |
|
/** |
278 |
|
* Gets the current list of effect sends. |
279 |
|
* @return The current list of effect sends. |
280 |
|
*/ |
281 |
|
public FxSend[] getFxSends(); |
282 |
|
|
283 |
|
/** |
284 |
|
* Sets the name of the specified effect send. |
285 |
|
* @param fxSend The numerical ID of the effect send. |
286 |
|
* @param name The new name of the effect send entity. |
287 |
|
*/ |
288 |
|
public void setBackendFxSendName(int fxSend, String name); |
289 |
|
|
290 |
|
/** |
291 |
|
* Sets the destination of an effect send's audio channel. |
292 |
|
* @param fxSend The numerical ID of the effect send entity to be rerouted. |
293 |
|
* @param audioSrc The numerical ID of the effect send's audio output channel, |
294 |
|
* which should be rerouted. |
295 |
|
* @param audioDst The audio channel of the selected audio output device |
296 |
|
* where <code>audioSrc</code> should be routed to. |
297 |
|
*/ |
298 |
|
public void setBackendFxSendAudioOutputChannel(int fxSend, int audioSrc, int audioDst); |
299 |
|
|
300 |
|
/** |
301 |
|
* Sets the MIDI controller of the specified effect send. |
302 |
|
* @param fxSend The numerical ID of the effect send. |
303 |
|
* @param midiCtrl The MIDI controller which shall be |
304 |
|
* able to modify the effect send's send level. |
305 |
|
*/ |
306 |
|
public void setBackendFxSendMidiController(int fxSend, int midiCtrl); |
307 |
|
|
308 |
|
/** |
309 |
|
* Sets the volume of the specified effect send. |
310 |
|
* @param fxSend The numerical ID of the effect |
311 |
|
* send, which volume should be changed. |
312 |
|
* @param level The new volume value. |
313 |
|
*/ |
314 |
|
public void setBackendFxSendLevel(int fxSend, float level); |
315 |
} |
} |