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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1143 - (show annotations) (download)
Mon Apr 2 21:18:31 2007 UTC (17 years ago) by iliev
File size: 14888 byte(s)
* upgrading to version 0.4a

1 /*
2 * JSampler - a java front-end for LinuxSampler
3 *
4 * Copyright (C) 2005-2006 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.ListListener;
26 import org.jsampler.event.MidiDeviceListListener;
27 import org.jsampler.event.SamplerChannelListListener;
28 import org.jsampler.event.SamplerListener;
29
30 import org.linuxsampler.lscp.*;
31
32
33 /**
34 * A data model representing a sampler.
35 * Note that the setter methods does <b>not</b> alter any settings
36 * on the backend side unless otherwise specified.
37 * @author Grigor Iliev
38 */
39 public interface SamplerModel {
40 /**
41 * Registers the specified listener for receiving event messages.
42 * @param l The <code>SamplerListener</code> to register.
43 */
44 public void addSamplerListener(SamplerListener l);
45
46 /**
47 * Removes the specified listener.
48 * @param l The <code>SamplerListener</code> to remove.
49 */
50 public void removeSamplerListener(SamplerListener l);
51
52 /**
53 * Registers the specified listener for receiving event messages.
54 * @param listener The <code>ListListener</code> to register.
55 */
56 public void addAudioDeviceListListener(ListListener<AudioDeviceModel> listener);
57
58 /**
59 * Removes the specified listener.
60 * @param listener The <code>ListListener</code> to remove.
61 */
62 public void removeAudioDeviceListListener(ListListener<AudioDeviceModel> listener);
63
64 /**
65 * Registers the specified listener for receiving event messages.
66 * @param listener The <code>MidiDeviceListListener</code> to register.
67 */
68 public void addMidiDeviceListListener(MidiDeviceListListener listener);
69
70 /**
71 * Removes the specified listener.
72 * @param listener The <code>MidiDeviceListListener</code> to remove.
73 */
74 public void removeMidiDeviceListListener(MidiDeviceListListener listener);
75
76 /**
77 * Registers the specified listener for receiving event messages.
78 * @param listener The <code>ListListener</code> to register.
79 */
80 public void addMidiInstrumentMapListListener(ListListener<MidiInstrumentMap> listener);
81
82 /**
83 * Removes the specified listener.
84 * @param listener The <code>ListListener</code> to remove.
85 */
86 public void removeMidiInstrumentMapListListener(ListListener<MidiInstrumentMap> listener);
87
88 /**
89 * Registers the specified listener for receiving event messages.
90 * @param listener The <code>SamplerChannelListListener</code> to register.
91 */
92 public void addSamplerChannelListListener(SamplerChannelListListener listener);
93
94 /**
95 * Removes the specified listener.
96 * @param listener The <code>SamplerChannelListListener</code> to remove.
97 */
98 public void removeSamplerChannelListListener(SamplerChannelListListener listener);
99
100 /**
101 * Gets information about the LinuxSampler instance the front-end is connected to.
102 *
103 * @return <code>ServerInfo</code> instance containing
104 * information about the LinuxSampler instance the front-end is connected to.
105 */
106 public ServerInfo getServerInfo();
107
108 /**
109 * Gets all audio output drivers currently available for the LinuxSampler instance.
110 *
111 * @return <code>AudioOutputDriver</code> array containing all audio output drivers
112 * currently available for the LinuxSampler instance.
113 */
114 public AudioOutputDriver[] getAudioOutputDrivers();
115
116 /**
117 * Gets the model of the audio device with ID <code>deviceId</code>.
118 * @param deviceId The ID of the audio device whose model should be obtained.
119 * @return The model of the specified audio device or <code>null</code>
120 * if there is no audio device with ID <code>deviceId</code>.
121 */
122 public AudioDeviceModel getAudioDeviceModel(int deviceId);
123
124 /**
125 * Gets the current number of audio devices.
126 * @return The current number of audio devices.
127 */
128 public int getAudioDeviceCount();
129
130 /**
131 * Gets the current list of audio device models.
132 * @return The current list of audio device models.
133 */
134 public AudioDeviceModel[] getAudioDeviceModels();
135
136 /**
137 * Adds the specified audio device.
138 * @param device The audio device to be added.
139 */
140 public void addAudioDevice(AudioOutputDevice device);
141
142 /**
143 * Removes the specified audio device.
144 * @param deviceId The ID of the audio device to be removed.
145 * @return <code>true</code> if the audio device is removed successfully, <code>false</code>
146 * if the device list does not contain audio device with ID <code>deviceId</code>.
147 */
148 public boolean removeAudioDevice(int deviceId);
149
150 /**
151 * Removes (on the backend side) the specified audio device.
152 * @param deviceId The ID of the audio device to be removed.
153 */
154 public void removeBackendAudioDevice(int deviceId);
155
156 /**
157 * Gets all MIDI input drivers currently available for the LinuxSampler instance.
158 *
159 * @return <code>MidiInputDriver</code> array containing all MIDI input drivers currently
160 * available for the LinuxSampler instance.
161 */
162 public MidiInputDriver[] getMidiInputDrivers();
163
164 /**
165 * Gets the model of the MIDI device with ID <code>deviceId</code>.
166 * @param deviceId The ID of the MIDI device whose model should be obtained.
167 * @return The model of the specified MIDI device or <code>null</code>
168 * if there is no MIDI device with ID <code>deviceId</code>.
169 */
170 public MidiDeviceModel getMidiDeviceModel(int deviceId);
171
172 /**
173 * Gets the current number of MIDI input devices.
174 * @return The current number of MIDI input devices.
175 */
176 public int getMidiDeviceCount();
177
178 /**
179 * Gets the current list of MIDI device models.
180 * @return The current list of MIDI device models.
181 */
182 public MidiDeviceModel[] getMidiDeviceModels();
183
184 /**
185 * Adds the specified MIDI device.
186 * @param device The MIDI device to be added.
187 */
188 public void addMidiDevice(MidiInputDevice device);
189
190 /**
191 * Schedules a new task for adding new MIDI device.
192 * @param driver The desired MIDI input system.
193 * @param parameters An optional list of driver specific parameters.
194 */
195 public void addBackendMidiDevice(String driver, Parameter... parameters);
196
197 /**
198 * Removes the specified MIDI device.
199 * @param deviceId The ID of the MIDI device to be removed.
200 * @return <code>true</code> if the MIDI device is removed successfully, <code>false</code>
201 * if the device list does not contain MIDI device with ID <code>deviceId</code>.
202 */
203 public boolean removeMidiDevice(int deviceId);
204
205 /**
206 * Schedules a new task for removing the specified MIDI device.
207 * @param deviceId The ID of the MIDI input device to be destroyed.
208 */
209 public void removeBackendMidiDevice(int deviceId);
210
211 /**
212 * Gets the MIDI instrument map with ID <code>mapId</code>.
213 * @param mapId The ID of the MIDI instrument map to obtain.
214 * @return The MIDI instrument map with the specified ID or <code>null</code>
215 * if there is no MIDI instrument map with ID <code>mapId</code>.
216 */
217 public MidiInstrumentMap getMidiInstrumentMapById(int mapId);
218
219 /**
220 * Gets the MIDI instrument map at the specified position.
221 * @param index The position of the MIDI instrument map to return.
222 * @return The MIDI instrument map at the specified position.
223 */
224 public MidiInstrumentMap getMidiInstrumentMap(int index);
225
226 /**
227 * Gets the current number of MIDI instrument maps.
228 * @return The current number of MIDI instrument maps.
229 */
230 public int getMidiInstrumentMapCount();
231
232 /**
233 * Gets the current list of MIDI instrument maps.
234 * @return The current list of MIDI instrument maps.
235 */
236 public MidiInstrumentMap[] getMidiInstrumentMaps();
237
238 /**
239 * Adds the specified MIDI instrument map.
240 * @param map The MIDI instrument map to be added.
241 */
242 public void addMidiInstrumentMap(MidiInstrumentMap map);
243
244 /**
245 * Schedules a new task for creating a new MIDI instrument map on the backend side.
246 * @param name The name of the MIDI instrument map.
247 * @throws IllegalArgumentException If <code>name</code> is <code>null</code>.
248 */
249 public void addBackendMidiInstrumentMap(String name);
250
251 /**
252 * Removes the specified MIDI instrument map.
253 * @param mapId The ID of the MIDI instrument map to be removed.
254 * @return <code>true</code> if the MIDI instrument map is removed successfully,
255 * <code>false</code> if the MIDI instrument map's list does not contain
256 * MIDI instrument map with ID <code>mapId</code>.
257 */
258 public boolean removeMidiInstrumentMap(int mapId);
259
260 /** Removes all MIDI instrument maps. */
261 public void removeAllMidiInstrumentMaps();
262
263 /**
264 * Schedules a new task for removing the
265 * specified MIDI instrument map on the backend side.
266 * @param mapId The numerical ID of the MIDI instrument map to remove.
267 * @throws IllegalArgumentException If <code>mapId</code> is negative.
268 */
269 public void removeBackendMidiInstrumentMap(int mapId);
270
271 /**
272 * Schedules a new task for changing the name of
273 * the specified MIDI instrument map on the backend side.
274 * @param mapId The numerical ID of the MIDI instrument map.
275 * @param name The new name for the specified MIDI instrument map.
276 */
277 public void setBackendMidiInstrumentMapName(int mapId, String name);
278
279 /**
280 * Gets the default MIDI instrument map.
281 * @return The default MIDI instrument map or <code>null</code>
282 * if there are no maps created.
283 */
284 public MidiInstrumentMap getDefaultMidiInstrumentMap();
285
286 /**
287 * Schedules a new task for mapping a MIDI instrument on the backend side.
288 * @param mapId The id of the MIDI instrument map.
289 * @param bank The index of the MIDI bank, which shall contain the instrument.
290 * @param program The MIDI program number of the new instrument.
291 * @param instrInfo Provides the MIDI instrument settings.
292 */
293 public void
294 mapBackendMidiInstrument(int mapId, int bank, int program, MidiInstrumentInfo instrInfo);
295
296 /**
297 * Schedules a new task for removing a MIDI instrument on the backend side.
298 * @param mapId The id of the MIDI instrument map containing the instrument to be removed.
299 * @param bank The index of the MIDI bank containing the instrument to be removed.
300 * @param program The MIDI program number of the instrument to be removed.
301 */
302 public void unmapBackendMidiInstrument(int mapId, int bank, int program);
303
304 /**
305 * Gets a list of all available engines.
306 * @return A list of all available engines.
307 */
308 public SamplerEngine[] getEngines();
309
310 /**
311 * Gets the current list of sampler channel models.
312 * @return The current list of sampler channel models.
313 */
314 public SamplerChannelModel[] getChannelModels();
315
316 /**
317 * Gets the model of the sampler channel with ID <code>channelId</code>.
318 * @param channelId The ID of the sampler channel whose model should be obtained.
319 * @return The model of the specified sampler channel or <code>null</code>
320 * if there is no channel with ID <code>channelId</code>.
321 */
322 public SamplerChannelModel getChannelModel(int channelId);
323
324 /**
325 * Gets the current number of sampler channels.
326 * @return The current number of sampler channels.
327 */
328 public int getChannelCount();
329
330 /**
331 * Adds a new sampler channel on the backend side. The channel will
332 * be actually added to this model when the backend notifies for its creation.
333 * @see #addChannel
334 */
335 public void addBackendChannel();
336
337 /**
338 * Adds the specified sampler channel.
339 * @param channel The channel to be added.
340 */
341 public void addChannel(SamplerChannel channel);
342
343 /**
344 * Removes the specified sampler channel.
345 * Note that this method doesn't remove the channel in the backend,
346 * it is used to remove the channel from the model when those channel
347 * is removed in the backend.
348 * @param channelId The ID of the channel to be removed.
349 * @return <code>true</code> if the channel is removed successfully, <code>false</code>
350 * if the channel's list does not contain channel with ID <code>channelId</code>.
351 */
352 public boolean removeChannel(int channelId);
353
354 /**
355 * Schedules a new task for removing the specified sampler channel on the backend side.
356 * @param channelId The ID of the channel to be removed.
357 */
358 public void removeBackendChannel(int channelId);
359
360 /**
361 * Updates the settings of the specified channel.
362 * @param channel A <code>SamplerChannel</code> instance containing the new settings
363 * for the channel.
364 */
365 public void updateChannel(SamplerChannel channel);
366
367 /**
368 * Determines whether there is at least one solo channel in the current list
369 * of sampler channels.
370 * @return <code>true</code> if there is at least one solo channel in the current list of
371 * sampler channels, <code>false</code> otherwise.
372 */
373 public boolean hasSoloChannel();
374
375 /**
376 * Gets the number of solo channels in the current list of sampler channels.
377 * @return The number of solo channels in the current list of sampler channels.
378 */
379 public int getSoloChannelCount();
380
381 /**
382 * Gets the number of muted channels in the current list of sampler channels.
383 * This number includes the channels muted because of the presence of a solo channel.
384 * @return The number of muted channels in the current list of sampler channels.
385 */
386 public int getMutedChannelCount();
387
388 /**
389 * Gets the number of channels muted because of the presence of a solo channel.
390 * @return The number of channels muted because of the presence of a solo channel.
391 */
392 public int getMutedBySoloChannelCount();
393
394 /**
395 * Gets the total number of active voices.
396 * @return The total number of active voices.
397 */
398 public int getTotalVoiceCount();
399
400 /**
401 * Gets the maximum number of active voices.
402 * @return The maximum number of active voices.
403 */
404 public int getTotalVoiceCountMax();
405
406 /**
407 * Gets the golobal volume of the sampler.
408 * @return The golobal volume of the sampler.
409 */
410 public float getVolume();
411
412 /**
413 * Sets the global volume.
414 * @param volume The new volume value.
415 */
416 public void setVolume(float volume);
417
418 /**
419 * Sets the global volume on the backend side.
420 * @param volume The new volume value.
421 */
422 public void setBackendVolume(float volume);
423
424 /**
425 * Schedules a new task for resetting the sampler.
426 */
427 public void resetBackend();
428
429 /**
430 * Updates the current and the maximum number of active voices in the sampler.
431 * @param count The new number of active voices.
432 * @param countMax The maximum number of active voices.
433 */
434 public void updateActiveVoiceInfo(int count, int countMax);
435 }

  ViewVC Help
Powered by ViewVC