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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1776 - (hide annotations) (download)
Thu Sep 11 18:48:36 2008 UTC (15 years, 7 months ago) by iliev
File size: 11674 byte(s)
* Implemented virtual MIDI keyboard

1 iliev 787 /*
2     * JSampler - a java front-end for LinuxSampler
3     *
4 iliev 1776 * Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com>
5 iliev 787 *
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 iliev 1143 import org.jsampler.event.EffectSendsListener;
26 iliev 787 import org.jsampler.event.SamplerChannelListener;
27    
28 iliev 1143 import org.linuxsampler.lscp.FxSend;
29 iliev 787 import org.linuxsampler.lscp.SamplerChannel;
30    
31 iliev 1776 import org.linuxsampler.lscp.event.MidiDataEvent;
32     import org.linuxsampler.lscp.event.MidiDataListener;
33 iliev 787
34     /**
35 iliev 911 * A data model representing a sampler channel.
36 iliev 1143 * Note that all methods that begin with <code>setBackend</code> alter the settings
37     * on the backend side.
38 iliev 787 * @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 iliev 1143 * 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 iliev 1776 * 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 iliev 787 * Gets the sampler channel number.
80     * @return The sampler channel number or -1 if the sampler channel number is not set.
81     */
82 iliev 1143 public int getChannelId();
83 iliev 787
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 iliev 1143 * Note that this method does not changes the channel settings on
94     * the backend. It is invoked just notify for channel settings' changes.
95 iliev 787 * @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 iliev 1143 * Note that this method does <b>not</b> alter the number
109     * of active disk streams on the backend side.
110 iliev 787 * @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 iliev 1143 * Note that this method does <b>not</b> alter the number
123     * of active voices on the backend side.
124 iliev 787 * @param count The new number of active voices.
125     */
126     public void setVoiceCount(int count);
127    
128     /**
129 iliev 1143 * Schedules a new task for setting the sampler engine type to be used.
130 iliev 787 * @param engine The name of the engine type to be used.
131     */
132 iliev 1143 public void setBackendEngineType(String engine);
133 iliev 787
134     /**
135 iliev 1143 * Schedules a new task for setting the mute mode of the channel.
136 iliev 787 * @param mute Specifies the mute mode. If <code>true</code> the channel is muted, else
137     * the channel is unmuted.
138     */
139 iliev 1143 public void setBackendMute(boolean mute);
140 iliev 787
141     /**
142 iliev 1143 * Schedules a new task for setting on the backend side the solo mode of the channel.
143 iliev 787 * @param solo Specifies the solo mode. If <code>true</code> the channel is soloed, else
144     * the channel is unsoloed.
145     */
146 iliev 1143 public void setBackendSolo(boolean solo);
147    
148 iliev 787 /**
149 iliev 1143 * Schedules a new task for setting the channel volume on the backend side.
150 iliev 787 * @param volume Specifies the new volume value.
151     */
152 iliev 1143 public void setBackendVolume(float volume);
153 iliev 787
154     /**
155 iliev 1143 * 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 iliev 787 */
159 iliev 1143 public void setBackendMidiInputDevice(int deviceId);
160 iliev 787
161     /**
162 iliev 1143 * Schedules a new task for setting (on the backend side) the
163     * MIDI input port of the channel represented by this model.
164 iliev 787 * @param port Specifies the number of the MIDI input port.
165     */
166 iliev 1143 public void setBackendMidiInputPort(int port);
167 iliev 787
168     /**
169 iliev 1143 * 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 iliev 787 * @param channel Specifies the MIDI channel that the channel
172     * represented by this model should listen to.
173     */
174 iliev 1143 public void setBackendMidiInputChannel(int channel);
175 iliev 787
176     /**
177 iliev 1143 * 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 iliev 787 */
181 iliev 1143 public void setBackendAudioOutputDevice(int deviceId);
182 iliev 787
183     /**
184 iliev 1143 * 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 iliev 787 * 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 iliev 1143 public void loadBackendInstrument(String filename, int InstrIndex);
208 iliev 911
209 iliev 1143 /** Schedules a new task for reseting the channel. */
210     public void resetBackendChannel();
211 iliev 911
212 iliev 1143 /** 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 iliev 1776
331     /**
332     * Sends a MIDI data message to this sampler channel.
333     */
334     public void sendBackendMidiData(MidiDataEvent e);
335    
336     /**
337     * Sends a MIDI data message to this sampler channel.
338     * @param type The type of MIDI message to send.
339     * @param arg1 Depends on the message type.
340     * @param arg2 Depends on the message type.
341     */
342     public void sendBackendMidiData(MidiDataEvent.Type type, int arg1, int arg2);
343 iliev 787 }

  ViewVC Help
Powered by ViewVC