/[svn]/jsampler/trunk/src/org/jsampler/SamplerChannelModel.java
ViewVC logotype

Contents of /jsampler/trunk/src/org/jsampler/SamplerChannelModel.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2200 - (show annotations) (download)
Sun Jul 3 22:01:16 2011 UTC (12 years, 9 months ago) by iliev
File size: 12059 byte(s)
* added support for exporting effects to LSCP script
* Sampler Browser (work in progress): initial
  implementation of sampler channels

1 /*
2 * JSampler - a java front-end for LinuxSampler
3 *
4 * Copyright (C) 2005-2011 Grigor Iliev <grigor@grigoriliev.com>
5 *
6 * This file is part of JSampler.
7 *
8 * JSampler is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation.
11 *
12 * JSampler is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with JSampler; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * MA 02111-1307 USA
21 */
22
23 package org.jsampler;
24
25 import org.jsampler.event.EffectSendsListener;
26 import org.jsampler.event.SamplerChannelListener;
27
28 import org.linuxsampler.lscp.FxSend;
29 import org.linuxsampler.lscp.SamplerChannel;
30
31 import org.linuxsampler.lscp.event.MidiDataEvent;
32 import org.linuxsampler.lscp.event.MidiDataListener;
33
34 /**
35 * A data model representing a sampler channel.
36 * Note that all methods that begin with <code>setBackend</code> alter the settings
37 * on the backend side.
38 * @author Grigor Iliev
39 */
40 public interface SamplerChannelModel {
41 /**
42 * Registers the specified listener for receiving event messages.
43 * @param l The <code>SamplerChannelListener</code> to register.
44 */
45 public void addSamplerChannelListener(SamplerChannelListener l);
46
47 /**
48 * Removes the specified listener.
49 * @param l The <code>SamplerChannelListener</code> to remove.
50 */
51 public void removeSamplerChannelListener(SamplerChannelListener l);
52
53 /**
54 * Registers the specified listener for receiving event messages.
55 * @param l The <code>EffectSendsListener</code> to register.
56 */
57 public void addEffectSendsListener(EffectSendsListener l);
58
59 /**
60 * Removes the specified listener.
61 * @param l The <code>EffectSendsListener</code> to remove.
62 */
63 public void removeEffectSendsListener(EffectSendsListener l);
64
65 /**
66 * Registers the specified listener to be notified when
67 * MIDI events are sent to the channel.
68 * @param l The <code>MidiDataListener</code> to register.
69 */
70 public void addMidiDataListener(MidiDataListener l);
71
72 /**
73 * Removes the specified listener.
74 * @param l The <code>MidiDataListener</code> to remove.
75 */
76 public void removeMidiDataListener(MidiDataListener l);
77
78 /**
79 * Gets the sampler channel number.
80 * @return The sampler channel number or -1 if the sampler channel number is not set.
81 */
82 public int getChannelId();
83
84 /**
85 * Gets the current settings of the sampler channel.
86 * @return <code>SamplerChannel</code> instance containing
87 * the current settings of the sampler channel.
88 */
89 public SamplerChannel getChannelInfo();
90
91 /**
92 * Sets the current settings of the sampler channel.
93 * Note that this method does not changes the channel settings on
94 * the backend. It is invoked just notify for channel settings' changes.
95 * @param channel A <code>SamplerChannel</code> instance containing
96 * the new settings for this sampler channel.
97 */
98 public void setChannelInfo(SamplerChannel channel);
99
100 /**
101 * Gets the number of active disk streams.
102 * @return The number of active disk streams.
103 */
104 public int getStreamCount();
105
106 /**
107 * Sets the number of active disk streams.
108 * Note that this method does <b>not</b> alter the number
109 * of active disk streams on the backend side.
110 * @param count The new number of active disk streams.
111 */
112 public void setStreamCount(int count);
113
114 /**
115 * Gets the number of active voices.
116 * @return The number of active voices.
117 */
118 public int getVoiceCount();
119
120 /**
121 * Sets the number of active voices.
122 * Note that this method does <b>not</b> alter the number
123 * of active voices on the backend side.
124 * @param count The new number of active voices.
125 */
126 public void setVoiceCount(int count);
127
128 /**
129 * Schedules a new task for setting the sampler engine type to be used.
130 * @param engine The name of the engine type to be used.
131 */
132 public void setBackendEngineType(String engine);
133
134 /**
135 * Schedules a new task for setting the mute mode of the channel.
136 * @param mute Specifies the mute mode. If <code>true</code> the channel is muted, else
137 * the channel is unmuted.
138 */
139 public void setBackendMute(boolean mute);
140
141 /**
142 * Schedules a new task for setting on the backend side the solo mode of the channel.
143 * @param solo Specifies the solo mode. If <code>true</code> the channel is soloed, else
144 * the channel is unsoloed.
145 */
146 public void setBackendSolo(boolean solo);
147
148 /**
149 * Schedules a new task for setting the channel volume on the backend side.
150 * @param volume Specifies the new volume value.
151 */
152 public void setBackendVolume(float volume);
153
154 /**
155 * Schedules a new task for setting on the backend side the MIDI input
156 * device of the channel represented by this model.
157 * @param deviceId Specifies the numerical ID of the MIDI input device to be set.
158 */
159 public void setBackendMidiInputDevice(int deviceId);
160
161 /**
162 * Schedules a new task for setting (on the backend side) the
163 * MIDI input port of the channel represented by this model.
164 * @param port Specifies the number of the MIDI input port.
165 */
166 public void setBackendMidiInputPort(int port);
167
168 /**
169 * Schedules a new task for setting (on the backend side) the MIDI channel
170 * that the channel represented by this model should listen to.
171 * @param channel Specifies the MIDI channel that the channel
172 * represented by this model should listen to.
173 */
174 public void setBackendMidiInputChannel(int channel);
175
176 /**
177 * Schedules a new task for setting (on the backend side) the audio output
178 * device of the channel represented by this model.
179 * @param deviceId Specifies the numerical ID of the audio output device to be set.
180 */
181 public void setBackendAudioOutputDevice(int deviceId);
182
183 /**
184 * Sets the destination of the destination of the specified audio channel.
185 * @param audioSrc The numerical ID of the sampler channel's audio
186 * output channel, which should be rerouted.
187 * @param audioDst The audio channel of the selected audio output device
188 * where <code>audioSrc</code> should be routed to.
189 */
190 public void setBackendAudioOutputChannel(int audioSrc, int audioDst);
191
192 /**
193 * Schedules a new task for assigning (on the backend side) the
194 * specified MIDI instrument map to this sampler channel.
195 * @param mapId Specify the numerical ID of the MIDI instrument
196 * map that should be assigned to this sampler
197 * channel or <code>-1</code> to remove the current map binding.
198 */
199 public void setBackendMidiInstrumentMap(int mapId);
200
201 /**
202 * Schedules a new task for loading and assigning the specified instrument
203 * to the sampler channel represented by this model.
204 * @param filename The file name of the instrument to be loaded.
205 * @param InstrIndex The index of the instrument in the instrument file to be loaded.
206 */
207 public void loadBackendInstrument(String filename, int InstrIndex);
208
209 /** Schedules a new task for reseting the channel. */
210 public void resetBackendChannel();
211
212 /** Schedules a new task for duplicating the channel. */
213 public void duplicateBackendChannel();
214
215 /**
216 * Schedules a new task for adding a new effect send on the
217 * backend side. The effect send will be actually added to this model
218 * when the backend notifies for its creation.
219 * @param midiCtrl Defines the MIDI controller, which
220 * will be able alter the effect send level.
221 */
222 public void addBackendFxSend(int midiCtrl);
223
224 /**
225 * Schedules a new task for adding a new effect send on the
226 * backend side. The effect send will be actually added to this model
227 * when the backend notifies for its creation.
228 * @param midiCtrl Defines the MIDI controller, which
229 * will be able alter the effect send level.
230 * @param name The name of the effect send entity.
231 * The name does not have to be unique.
232 */
233 public void addBackendFxSend(int midiCtrl, String name);
234
235 /**
236 * Adds the specified effect send.
237 * @param fxSend The effect send to be added.
238 */
239 public void addFxSend(FxSend fxSend);
240
241 /**
242 * Schedules a new task for removing the specified effect send on the backend side.
243 * @param fxSendId The ID of the effect send to remove.
244 */
245 public void removeBackendFxSend(int fxSendId);
246
247 /**
248 * Removes the effect send at the specified position.
249 * @param index The position of the effect send to remove.
250 * @return The removed effect send.
251 */
252 public FxSend removeFxSend(int index);
253
254 /**
255 * Removes the specified effect send.
256 * @param fxSendId The ID of the effect send to remove.
257 * @return <code>true</code> if the effect send is removed successfully, <code>false</code>
258 * if the channel does not contain effect send with ID <code>fxSendId</code>.
259 */
260 public boolean removeFxSendById(int fxSendId);
261
262 /** Removes all effect sends from this channel. */
263 public void removeAllFxSends();
264
265 /**
266 * Updates the specified effect send.
267 * @param fxSend The effect send to update.
268 */
269 public void updateFxSend(FxSend fxSend);
270
271 /**
272 * Gets the current number of effect sends.
273 * @return The current number of effect sends.
274 */
275 public int getFxSendCount();
276
277 /**
278 * Gets the effect send at the specified position.
279 * @param index The index of the effect send to be returned.
280 * @return The effect send at the specified position.
281 */
282 public FxSend getFxSend(int index);
283
284 /**
285 * Gets the effect send with the specified ID.
286 * @param fxSendId The ID of the effect send to return.
287 * @return The effect send with the specified ID or <code>null</code>
288 * if there is no effect send with ID <code>fxSendId</code>.
289 */
290 public FxSend getFxSendById(int fxSendId);
291
292 /**
293 * Gets the current list of effect sends.
294 * @return The current list of effect sends.
295 */
296 public FxSend[] getFxSends();
297
298 /**
299 * Sets the name of the specified effect send.
300 * @param fxSend The numerical ID of the effect send.
301 * @param name The new name of the effect send entity.
302 */
303 public void setBackendFxSendName(int fxSend, String name);
304
305 /**
306 * Sets the destination of an effect send's audio channel.
307 * @param fxSend The numerical ID of the effect send entity to be rerouted.
308 * @param audioSrc The numerical ID of the effect send's audio output channel,
309 * which should be rerouted.
310 * @param audioDst The audio channel of the selected audio output device
311 * where <code>audioSrc</code> should be routed to.
312 */
313 public void setBackendFxSendAudioOutputChannel(int fxSend, int audioSrc, int audioDst);
314
315 /**
316 * Sets the MIDI controller of the specified effect send.
317 * @param fxSend The numerical ID of the effect send.
318 * @param midiCtrl The MIDI controller which shall be
319 * able to modify the effect send's send level.
320 */
321 public void setBackendFxSendMidiController(int fxSend, int midiCtrl);
322
323 /**
324 * Sets the volume of the specified effect send.
325 * @param fxSend The numerical ID of the effect
326 * send, which volume should be changed.
327 * @param level The new volume value.
328 */
329 public void setBackendFxSendLevel(int fxSend, float level);
330
331 /**
332 * Sets destination effect on the specified effect send.
333 * @param fxSend The numerical ID of the effect send.
334 */
335 public void setBackendFxSendEffect(int fxSend, int chainId, int chainPos);
336
337 /**
338 * Removes the destination effect of the specified effect send.
339 * @param fxSend The numerical ID of the effect send.
340 */
341 public void removeBackendFxSendEffect(int fxSend);
342
343 /**
344 * Sends a MIDI data message to this sampler channel.
345 */
346 public void sendBackendMidiData(MidiDataEvent e);
347
348 /**
349 * Sends a MIDI data message to this sampler channel.
350 * @param type The type of MIDI message to send.
351 * @param arg1 Depends on the message type.
352 * @param arg2 Depends on the message type.
353 */
354 public void sendBackendMidiData(MidiDataEvent.Type type, int arg1, int arg2);
355 }

  ViewVC Help
Powered by ViewVC