/[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 2302 - (show annotations) (download)
Thu Dec 15 23:13:30 2011 UTC (12 years, 4 months ago) by iliev
File size: 12131 byte(s)
* Initial support for Android platforms (only sampler channel
  manipulation for now - see the screenshots on the website)

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 channel.
197 * To remove the current map binding use <code>-1</code>.
198 * To set the current map to be the default map use <code>-2</code>.
199 */
200 public void setBackendMidiInstrumentMap(int mapId);
201
202 /**
203 * Schedules a new task for loading and assigning the specified instrument
204 * to the sampler channel represented by this model.
205 * @param filename The file name of the instrument to be loaded.
206 * @param InstrIndex The index of the instrument in the instrument file to be loaded.
207 */
208 public void loadBackendInstrument(String filename, int InstrIndex);
209
210 /** Schedules a new task for reseting the channel. */
211 public void resetBackendChannel();
212
213 /** Schedules a new task for duplicating the channel. */
214 public void duplicateBackendChannel();
215
216 /**
217 * Schedules a new task for adding a new effect send on the
218 * backend side. The effect send will be actually added to this model
219 * when the backend notifies for its creation.
220 * @param midiCtrl Defines the MIDI controller, which
221 * will be able alter the effect send level.
222 */
223 public void addBackendFxSend(int midiCtrl);
224
225 /**
226 * Schedules a new task for adding a new effect send on the
227 * backend side. The effect send will be actually added to this model
228 * when the backend notifies for its creation.
229 * @param midiCtrl Defines the MIDI controller, which
230 * will be able alter the effect send level.
231 * @param name The name of the effect send entity.
232 * The name does not have to be unique.
233 */
234 public void addBackendFxSend(int midiCtrl, String name);
235
236 /**
237 * Adds the specified effect send.
238 * @param fxSend The effect send to be added.
239 */
240 public void addFxSend(FxSend fxSend);
241
242 /**
243 * Schedules a new task for removing the specified effect send on the backend side.
244 * @param fxSendId The ID of the effect send to remove.
245 */
246 public void removeBackendFxSend(int fxSendId);
247
248 /**
249 * Removes the effect send at the specified position.
250 * @param index The position of the effect send to remove.
251 * @return The removed effect send.
252 */
253 public FxSend removeFxSend(int index);
254
255 /**
256 * Removes the specified effect send.
257 * @param fxSendId The ID of the effect send to remove.
258 * @return <code>true</code> if the effect send is removed successfully, <code>false</code>
259 * if the channel does not contain effect send with ID <code>fxSendId</code>.
260 */
261 public boolean removeFxSendById(int fxSendId);
262
263 /** Removes all effect sends from this channel. */
264 public void removeAllFxSends();
265
266 /**
267 * Updates the specified effect send.
268 * @param fxSend The effect send to update.
269 */
270 public void updateFxSend(FxSend fxSend);
271
272 /**
273 * Gets the current number of effect sends.
274 * @return The current number of effect sends.
275 */
276 public int getFxSendCount();
277
278 /**
279 * Gets the effect send at the specified position.
280 * @param index The index of the effect send to be returned.
281 * @return The effect send at the specified position.
282 */
283 public FxSend getFxSend(int index);
284
285 /**
286 * Gets the effect send with the specified ID.
287 * @param fxSendId The ID of the effect send to return.
288 * @return The effect send with the specified ID or <code>null</code>
289 * if there is no effect send with ID <code>fxSendId</code>.
290 */
291 public FxSend getFxSendById(int fxSendId);
292
293 /**
294 * Gets the current list of effect sends.
295 * @return The current list of effect sends.
296 */
297 public FxSend[] getFxSends();
298
299 /**
300 * Sets the name of the specified effect send.
301 * @param fxSend The numerical ID of the effect send.
302 * @param name The new name of the effect send entity.
303 */
304 public void setBackendFxSendName(int fxSend, String name);
305
306 /**
307 * Sets the destination of an effect send's audio channel.
308 * @param fxSend The numerical ID of the effect send entity to be rerouted.
309 * @param audioSrc The numerical ID of the effect send's audio output channel,
310 * which should be rerouted.
311 * @param audioDst The audio channel of the selected audio output device
312 * where <code>audioSrc</code> should be routed to.
313 */
314 public void setBackendFxSendAudioOutputChannel(int fxSend, int audioSrc, int audioDst);
315
316 /**
317 * Sets the MIDI controller of the specified effect send.
318 * @param fxSend The numerical ID of the effect send.
319 * @param midiCtrl The MIDI controller which shall be
320 * able to modify the effect send's send level.
321 */
322 public void setBackendFxSendMidiController(int fxSend, int midiCtrl);
323
324 /**
325 * Sets the volume of the specified effect send.
326 * @param fxSend The numerical ID of the effect
327 * send, which volume should be changed.
328 * @param level The new volume value.
329 */
330 public void setBackendFxSendLevel(int fxSend, float level);
331
332 /**
333 * Sets destination effect on the specified effect send.
334 * @param fxSend The numerical ID of the effect send.
335 */
336 public void setBackendFxSendEffect(int fxSend, int chainId, int chainPos);
337
338 /**
339 * Removes the destination effect of the specified effect send.
340 * @param fxSend The numerical ID of the effect send.
341 */
342 public void removeBackendFxSendEffect(int fxSend);
343
344 /**
345 * Sends a MIDI data message to this sampler channel.
346 */
347 public void sendBackendMidiData(MidiDataEvent e);
348
349 /**
350 * Sends a MIDI data message to this sampler channel.
351 * @param type The type of MIDI message to send.
352 * @param arg1 Depends on the message type.
353 * @param arg2 Depends on the message type.
354 */
355 public void sendBackendMidiData(MidiDataEvent.Type type, int arg1, int arg2);
356 }

  ViewVC Help
Powered by ViewVC