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

Diff of /jsampler/trunk/src/org/jsampler/DefaultSamplerModel.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1817 by iliev, Sat May 31 23:04:01 2008 UTC revision 1818 by iliev, Wed Dec 24 17:29:47 2008 UTC
# Line 96  public class DefaultSamplerModel impleme Line 96  public class DefaultSamplerModel impleme
96           * Registers the specified listener for receiving event messages.           * Registers the specified listener for receiving event messages.
97           * @param l The <code>SamplerListener</code> to register.           * @param l The <code>SamplerListener</code> to register.
98           */           */
99            @Override
100          public void          public void
101          addSamplerListener(SamplerListener l) { listeners.add(l); }          addSamplerListener(SamplerListener l) { listeners.add(l); }
102                    
# Line 103  public class DefaultSamplerModel impleme Line 104  public class DefaultSamplerModel impleme
104           * Removes the specified listener.           * Removes the specified listener.
105           * @param l The <code>SamplerListener</code> to remove.           * @param l The <code>SamplerListener</code> to remove.
106           */           */
107            @Override
108          public void          public void
109          removeSamplerListener(SamplerListener l) { listeners.remove(l); }          removeSamplerListener(SamplerListener l) { listeners.remove(l); }
110                    
# Line 110  public class DefaultSamplerModel impleme Line 112  public class DefaultSamplerModel impleme
112           * Registers the specified listener for receiving event messages.           * Registers the specified listener for receiving event messages.
113           * @param listener The <code>AudioDeviceListListener</code> to register.           * @param listener The <code>AudioDeviceListListener</code> to register.
114           */           */
115            @Override
116          public void          public void
117          addAudioDeviceListListener(ListListener<AudioDeviceModel> listener) {          addAudioDeviceListListener(ListListener<AudioDeviceModel> listener) {
118                  listenerList.add(ListListener.class, listener);                  listenerList.add(ListListener.class, listener);
# Line 119  public class DefaultSamplerModel impleme Line 122  public class DefaultSamplerModel impleme
122           * Removes the specified listener.           * Removes the specified listener.
123           * @param listener The <code>AudioDeviceListListener</code> to remove.           * @param listener The <code>AudioDeviceListListener</code> to remove.
124           */           */
125            @Override
126          public void          public void
127          removeAudioDeviceListListener(ListListener<AudioDeviceModel> listener) {          removeAudioDeviceListListener(ListListener<AudioDeviceModel> listener) {
128                  listenerList.remove(ListListener.class, listener);                  listenerList.remove(ListListener.class, listener);
# Line 128  public class DefaultSamplerModel impleme Line 132  public class DefaultSamplerModel impleme
132           * Registers the specified listener for receiving event messages.           * Registers the specified listener for receiving event messages.
133           * @param listener The <code>MidiDeviceListListener</code> to register.           * @param listener The <code>MidiDeviceListListener</code> to register.
134           */           */
135            @Override
136          public void          public void
137          addMidiDeviceListListener(MidiDeviceListListener listener) {          addMidiDeviceListListener(MidiDeviceListListener listener) {
138                  listenerList.add(MidiDeviceListListener.class, listener);                  listenerList.add(MidiDeviceListListener.class, listener);
# Line 137  public class DefaultSamplerModel impleme Line 142  public class DefaultSamplerModel impleme
142           * Removes the specified listener.           * Removes the specified listener.
143           * @param listener The <code>MidiDeviceListListener</code> to remove.           * @param listener The <code>MidiDeviceListListener</code> to remove.
144           */           */
145            @Override
146          public void          public void
147          removeMidiDeviceListListener(MidiDeviceListListener listener) {          removeMidiDeviceListListener(MidiDeviceListListener listener) {
148                  listenerList.remove(MidiDeviceListListener.class, listener);                  listenerList.remove(MidiDeviceListListener.class, listener);
# Line 146  public class DefaultSamplerModel impleme Line 152  public class DefaultSamplerModel impleme
152           * Registers the specified listener for receiving event messages.           * Registers the specified listener for receiving event messages.
153           * @param listener The <code>ListListener</code> to register.           * @param listener The <code>ListListener</code> to register.
154           */           */
155            @Override
156          public void          public void
157          addMidiInstrumentMapListListener(ListListener<MidiInstrumentMap> listener) {          addMidiInstrumentMapListListener(ListListener<MidiInstrumentMap> listener) {
158                  mapsListeners.add(listener);                  mapsListeners.add(listener);
# Line 155  public class DefaultSamplerModel impleme Line 162  public class DefaultSamplerModel impleme
162           * Removes the specified listener.           * Removes the specified listener.
163           * @param listener The <code>ListListener</code> to remove.           * @param listener The <code>ListListener</code> to remove.
164           */           */
165            @Override
166          public void          public void
167          removeMidiInstrumentMapListListener(ListListener<MidiInstrumentMap> listener) {          removeMidiInstrumentMapListListener(ListListener<MidiInstrumentMap> listener) {
168                  mapsListeners.remove(listener);                  mapsListeners.remove(listener);
# Line 164  public class DefaultSamplerModel impleme Line 172  public class DefaultSamplerModel impleme
172           * Registers the specified listener for receiving event messages.           * Registers the specified listener for receiving event messages.
173           * @param listener The <code>SamplerChannelListListener</code> to register.           * @param listener The <code>SamplerChannelListListener</code> to register.
174           */           */
175            @Override
176          public void          public void
177          addSamplerChannelListListener(SamplerChannelListListener listener) {          addSamplerChannelListListener(SamplerChannelListListener listener) {
178                  listenerList.add(SamplerChannelListListener.class, listener);                  listenerList.add(SamplerChannelListListener.class, listener);
# Line 173  public class DefaultSamplerModel impleme Line 182  public class DefaultSamplerModel impleme
182           * Removes the specified listener.           * Removes the specified listener.
183           * @param listener The <code>SamplerChannelListListener</code> to remove.           * @param listener The <code>SamplerChannelListListener</code> to remove.
184           */           */
185            @Override
186          public void          public void
187          removeSamplerChannelListListener(SamplerChannelListListener listener) {          removeSamplerChannelListListener(SamplerChannelListListener listener) {
188                  listenerList.remove(SamplerChannelListListener.class, listener);                  listenerList.remove(SamplerChannelListListener.class, listener);
# Line 184  public class DefaultSamplerModel impleme Line 194  public class DefaultSamplerModel impleme
194           * @return <code>ServerInfo</code> instance containing           * @return <code>ServerInfo</code> instance containing
195           * information about the LinuxSampler instance the front-end is connected to.           * information about the LinuxSampler instance the front-end is connected to.
196           */           */
197            @Override
198          public ServerInfo          public ServerInfo
199          getServerInfo() { return serverInfo; }          getServerInfo() { return serverInfo; }
200                    
# Line 202  public class DefaultSamplerModel impleme Line 213  public class DefaultSamplerModel impleme
213           * @return <code>AudioOutputDriver</code> array containing all audio output drivers           * @return <code>AudioOutputDriver</code> array containing all audio output drivers
214           * currently available for the LinuxSampler instance.           * currently available for the LinuxSampler instance.
215           */           */
216            @Override
217          public AudioOutputDriver[]          public AudioOutputDriver[]
218          getAudioOutputDrivers() { return aoDrvS; }          getAudioOutputDrivers() { return aoDrvS; }
219                    
# Line 220  public class DefaultSamplerModel impleme Line 232  public class DefaultSamplerModel impleme
232           * @return The model of the audio device at the specified position.           * @return The model of the audio device at the specified position.
233           * @see #getAudioDeviceCount           * @see #getAudioDeviceCount
234           */           */
235            @Override
236          public AudioDeviceModel          public AudioDeviceModel
237          getAudioDevice(int index) {          getAudioDevice(int index) {
238                  return audioDeviceModels.get(index);                  return audioDeviceModels.get(index);
# Line 231  public class DefaultSamplerModel impleme Line 244  public class DefaultSamplerModel impleme
244           * @return The model of the specified audio device or <code>null</code>           * @return The model of the specified audio device or <code>null</code>
245           * if there is no audio device with ID <code>deviceId</code>.           * if there is no audio device with ID <code>deviceId</code>.
246           */           */
247            @Override
248          public AudioDeviceModel          public AudioDeviceModel
249          getAudioDeviceById(int deviceId) {          getAudioDeviceById(int deviceId) {
250                  for(AudioDeviceModel m : audioDeviceModels)                  for(AudioDeviceModel m : audioDeviceModels)
# Line 243  public class DefaultSamplerModel impleme Line 257  public class DefaultSamplerModel impleme
257           * Gets the current number of audio devices.           * Gets the current number of audio devices.
258           * @return The current number of audio devices.           * @return The current number of audio devices.
259           */           */
260            @Override
261          public int          public int
262          getAudioDeviceCount() { return audioDeviceModels.size(); }          getAudioDeviceCount() { return audioDeviceModels.size(); }
263                    
# Line 250  public class DefaultSamplerModel impleme Line 265  public class DefaultSamplerModel impleme
265           * Gets the current list of audio device models.           * Gets the current list of audio device models.
266           * @return The current list of audio device models.           * @return The current list of audio device models.
267           */           */
268            @Override
269          public AudioDeviceModel[]          public AudioDeviceModel[]
270          getAudioDevices() {          getAudioDevices() {
271                  return audioDeviceModels.toArray(new AudioDeviceModel[audioDeviceModels.size()]);                  return audioDeviceModels.toArray(new AudioDeviceModel[audioDeviceModels.size()]);
# Line 259  public class DefaultSamplerModel impleme Line 275  public class DefaultSamplerModel impleme
275           * Adds the specified audio device.           * Adds the specified audio device.
276           * @param device The audio device to be added.           * @param device The audio device to be added.
277           */           */
278            @Override
279          public void          public void
280          addAudioDevice(AudioOutputDevice device) {          addAudioDevice(AudioOutputDevice device) {
281                  DefaultAudioDeviceModel model = new DefaultAudioDeviceModel(device);                  DefaultAudioDeviceModel model = new DefaultAudioDeviceModel(device);
# Line 272  public class DefaultSamplerModel impleme Line 289  public class DefaultSamplerModel impleme
289           * @return <code>true</code> if the audio device is removed successfully, <code>false</code>           * @return <code>true</code> if the audio device is removed successfully, <code>false</code>
290           * if the device list does not contain audio device with ID <code>deviceId</code>.           * if the device list does not contain audio device with ID <code>deviceId</code>.
291           */           */
292            @Override
293          public boolean          public boolean
294          removeAudioDeviceById(int deviceId) {          removeAudioDeviceById(int deviceId) {
295                  for(int i = 0; i < audioDeviceModels.size(); i++) {                  for(int i = 0; i < audioDeviceModels.size(); i++) {
# Line 290  public class DefaultSamplerModel impleme Line 308  public class DefaultSamplerModel impleme
308           * Schedules a new task for removing the specified audio device on the backend side.           * Schedules a new task for removing the specified audio device on the backend side.
309           * @param deviceId The ID of the audio device to be removed.           * @param deviceId The ID of the audio device to be removed.
310           */           */
311            @Override
312          public void          public void
313          removeBackendAudioDevice(int deviceId) {          removeBackendAudioDevice(int deviceId) {
314                  CC.getTaskQueue().add(new Audio.DestroyDevice(deviceId));                  CC.getTaskQueue().add(new Audio.DestroyDevice(deviceId));
# Line 301  public class DefaultSamplerModel impleme Line 320  public class DefaultSamplerModel impleme
320           * @return <code>MidiInputDriver</code> array containing all MIDI input drivers currently           * @return <code>MidiInputDriver</code> array containing all MIDI input drivers currently
321           * available for the LinuxSampler instance.           * available for the LinuxSampler instance.
322           */           */
323            @Override
324          public MidiInputDriver[]          public MidiInputDriver[]
325          getMidiInputDrivers() { return miDrvS; }          getMidiInputDrivers() { return miDrvS; }
326                    
# Line 318  public class DefaultSamplerModel impleme Line 338  public class DefaultSamplerModel impleme
338           * @param index The position of the MIDI device to return.           * @param index The position of the MIDI device to return.
339           * @return The model of the MIDI device at the specified position.           * @return The model of the MIDI device at the specified position.
340           */           */
341            @Override
342          public MidiDeviceModel          public MidiDeviceModel
343          getMidiDevice(int index) {          getMidiDevice(int index) {
344                  return midiDeviceModels.get(index);                  return midiDeviceModels.get(index);
# Line 329  public class DefaultSamplerModel impleme Line 350  public class DefaultSamplerModel impleme
350           * @return The model of the specified MIDI device or <code>null</code>           * @return The model of the specified MIDI device or <code>null</code>
351           * if there is no MIDI device with ID <code>deviceId</code>.           * if there is no MIDI device with ID <code>deviceId</code>.
352           */           */
353            @Override
354          public MidiDeviceModel          public MidiDeviceModel
355          getMidiDeviceById(int deviceId) {          getMidiDeviceById(int deviceId) {
356                  for(MidiDeviceModel m : midiDeviceModels)                  for(MidiDeviceModel m : midiDeviceModels)
# Line 341  public class DefaultSamplerModel impleme Line 363  public class DefaultSamplerModel impleme
363           * Gets the current number of MIDI input devices.           * Gets the current number of MIDI input devices.
364           * @return The current number of MIDI input devices.           * @return The current number of MIDI input devices.
365           */           */
366            @Override
367          public int          public int
368          getMidiDeviceCount() { return midiDeviceModels.size(); }          getMidiDeviceCount() { return midiDeviceModels.size(); }
369                    
# Line 348  public class DefaultSamplerModel impleme Line 371  public class DefaultSamplerModel impleme
371           * Gets the current list of MIDI device models.           * Gets the current list of MIDI device models.
372           * @return The current list of MIDI device models.           * @return The current list of MIDI device models.
373           */           */
374            @Override
375          public MidiDeviceModel[]          public MidiDeviceModel[]
376          getMidiDevices() {          getMidiDevices() {
377                  return midiDeviceModels.toArray(new MidiDeviceModel[midiDeviceModels.size()]);                  return midiDeviceModels.toArray(new MidiDeviceModel[midiDeviceModels.size()]);
# Line 357  public class DefaultSamplerModel impleme Line 381  public class DefaultSamplerModel impleme
381           * Adds the specified MIDI device.           * Adds the specified MIDI device.
382           * @param device The MIDI device to be added.           * @param device The MIDI device to be added.
383           */           */
384            @Override
385          public void          public void
386          addMidiDevice(MidiInputDevice device) {          addMidiDevice(MidiInputDevice device) {
387                  DefaultMidiDeviceModel model = new DefaultMidiDeviceModel(device);                  DefaultMidiDeviceModel model = new DefaultMidiDeviceModel(device);
# Line 369  public class DefaultSamplerModel impleme Line 394  public class DefaultSamplerModel impleme
394           * @param driver The desired MIDI input system.           * @param driver The desired MIDI input system.
395           * @param parameters An optional list of driver specific parameters.           * @param parameters An optional list of driver specific parameters.
396           */           */
397            @Override
398          public void          public void
399          addBackendMidiDevice(String driver, Parameter... parameters) {          addBackendMidiDevice(String driver, Parameter... parameters) {
400                  CC.getTaskQueue().add(new Midi.CreateDevice(driver, parameters));                  CC.getTaskQueue().add(new Midi.CreateDevice(driver, parameters));
# Line 380  public class DefaultSamplerModel impleme Line 406  public class DefaultSamplerModel impleme
406           * @return <code>true</code> if the MIDI device is removed successfully, <code>false</code>           * @return <code>true</code> if the MIDI device is removed successfully, <code>false</code>
407           * if the device list does not contain MIDI device with ID <code>deviceId</code>.           * if the device list does not contain MIDI device with ID <code>deviceId</code>.
408           */           */
409            @Override
410          public boolean          public boolean
411          removeMidiDeviceById(int deviceId) {          removeMidiDeviceById(int deviceId) {
412                  for(int i = 0; i < midiDeviceModels.size(); i++) {                  for(int i = 0; i < midiDeviceModels.size(); i++) {
# Line 398  public class DefaultSamplerModel impleme Line 425  public class DefaultSamplerModel impleme
425           * Schedules a new task for removing the specified MIDI device.           * Schedules a new task for removing the specified MIDI device.
426           * @param deviceId The ID of the MIDI input device to be destroyed.           * @param deviceId The ID of the MIDI input device to be destroyed.
427           */           */
428            @Override
429          public void          public void
430          removeBackendMidiDevice(int deviceId) {          removeBackendMidiDevice(int deviceId) {
431                  CC.getTaskQueue().add(new Midi.DestroyDevice(deviceId));                  CC.getTaskQueue().add(new Midi.DestroyDevice(deviceId));
# Line 409  public class DefaultSamplerModel impleme Line 437  public class DefaultSamplerModel impleme
437           * @return The MIDI instrument map with the specified ID or <code>null</code>           * @return The MIDI instrument map with the specified ID or <code>null</code>
438           * if there is no MIDI instrument map with ID <code>mapId</code>.           * if there is no MIDI instrument map with ID <code>mapId</code>.
439           */           */
440            @Override
441          public MidiInstrumentMap          public MidiInstrumentMap
442          getMidiInstrumentMapById(int mapId) {          getMidiInstrumentMapById(int mapId) {
443                  for(MidiInstrumentMap m : midiInstrMaps)                  for(MidiInstrumentMap m : midiInstrMaps)
# Line 422  public class DefaultSamplerModel impleme Line 451  public class DefaultSamplerModel impleme
451           * @param index The position of the MIDI instrument map to return.           * @param index The position of the MIDI instrument map to return.
452           * @return The MIDI instrument map at the specified position.           * @return The MIDI instrument map at the specified position.
453           */           */
454            @Override
455          public MidiInstrumentMap          public MidiInstrumentMap
456          getMidiInstrumentMap(int index) {          getMidiInstrumentMap(int index) {
457                  return midiInstrMaps.get(index);                  return midiInstrMaps.get(index);
# Line 431  public class DefaultSamplerModel impleme Line 461  public class DefaultSamplerModel impleme
461           * Gets the current number of MIDI instrument maps.           * Gets the current number of MIDI instrument maps.
462           * @return The current number of MIDI instrument maps.           * @return The current number of MIDI instrument maps.
463           */           */
464            @Override
465          public int          public int
466          getMidiInstrumentMapCount() { return midiInstrMaps.size(); }          getMidiInstrumentMapCount() { return midiInstrMaps.size(); }
467                    
# Line 438  public class DefaultSamplerModel impleme Line 469  public class DefaultSamplerModel impleme
469           * Gets the current list of MIDI instrument maps.           * Gets the current list of MIDI instrument maps.
470           * @return The current list of MIDI instrument maps.           * @return The current list of MIDI instrument maps.
471           */           */
472            @Override
473          public MidiInstrumentMap[]          public MidiInstrumentMap[]
474          getMidiInstrumentMaps() {          getMidiInstrumentMaps() {
475                  return midiInstrMaps.toArray(new MidiInstrumentMap[midiInstrMaps.size()]);                  return midiInstrMaps.toArray(new MidiInstrumentMap[midiInstrMaps.size()]);
# Line 450  public class DefaultSamplerModel impleme Line 482  public class DefaultSamplerModel impleme
482           * or -1 if <code>map</code> is <code>null</code> or           * or -1 if <code>map</code> is <code>null</code> or
483           * the map list does not contain the specified map.           * the map list does not contain the specified map.
484           */           */
485            @Override
486          public int          public int
487          getMidiInstrumentMapIndex(MidiInstrumentMap map) {          getMidiInstrumentMapIndex(MidiInstrumentMap map) {
488                  if(map == null) return -1;                  if(map == null) return -1;
# Line 466  public class DefaultSamplerModel impleme Line 499  public class DefaultSamplerModel impleme
499           * @param map The MIDI instrument map to be added.           * @param map The MIDI instrument map to be added.
500           * @throws IllegalArgumentException If <code>map</code> is <code>null</code>.           * @throws IllegalArgumentException If <code>map</code> is <code>null</code>.
501           */           */
502            @Override
503          public void          public void
504          addMidiInstrumentMap(MidiInstrumentMap map) {          addMidiInstrumentMap(MidiInstrumentMap map) {
505                  if(map == null) throw new IllegalArgumentException("map should be non-null!");                  if(map == null) throw new IllegalArgumentException("map should be non-null!");
# Line 479  public class DefaultSamplerModel impleme Line 513  public class DefaultSamplerModel impleme
513           * @param name The name of the MIDI instrument map.           * @param name The name of the MIDI instrument map.
514           * @throws IllegalArgumentException If <code>name</code> is <code>null</code>.           * @throws IllegalArgumentException If <code>name</code> is <code>null</code>.
515           */           */
516            @Override
517          public void          public void
518          addBackendMidiInstrumentMap(String name) {          addBackendMidiInstrumentMap(String name) {
519                  if(name == null) throw new IllegalArgumentException("name should be non-null!");                  if(name == null) throw new IllegalArgumentException("name should be non-null!");
# Line 493  public class DefaultSamplerModel impleme Line 528  public class DefaultSamplerModel impleme
528           * <code>false</code> if the MIDI instrument map's list does not contain           * <code>false</code> if the MIDI instrument map's list does not contain
529           * MIDI instrument map with ID <code>mapId</code>.           * MIDI instrument map with ID <code>mapId</code>.
530           */           */
531            @Override
532          public boolean          public boolean
533          removeMidiInstrumentMapById(int mapId) {          removeMidiInstrumentMapById(int mapId) {
534                  for(int i = 0; i < midiInstrMaps.size(); i++) {                  for(int i = 0; i < midiInstrMaps.size(); i++) {
# Line 521  public class DefaultSamplerModel impleme Line 557  public class DefaultSamplerModel impleme
557          }          }
558                    
559          /** Removes all MIDI instrument maps. */          /** Removes all MIDI instrument maps. */
560            @Override
561          public void          public void
562          removeAllMidiInstrumentMaps() {          removeAllMidiInstrumentMaps() {
563                  for(int i = midiInstrMaps.size() - 1; i >= 0; i--) {                  for(int i = midiInstrMaps.size() - 1; i >= 0; i--) {
# Line 535  public class DefaultSamplerModel impleme Line 572  public class DefaultSamplerModel impleme
572           * specified MIDI instrument map on the backend side.           * specified MIDI instrument map on the backend side.
573           * @param mapId The numerical ID of the MIDI instrument map to remove.           * @param mapId The numerical ID of the MIDI instrument map to remove.
574           */           */
575            @Override
576          public void          public void
577          removeBackendMidiInstrumentMap(int mapId) {          removeBackendMidiInstrumentMap(int mapId) {
578                  CC.getTaskQueue().add(new Midi.RemoveInstrumentMap(mapId));                  CC.getTaskQueue().add(new Midi.RemoveInstrumentMap(mapId));
# Line 546  public class DefaultSamplerModel impleme Line 584  public class DefaultSamplerModel impleme
584           * @param mapId The numerical ID of the MIDI instrument map.           * @param mapId The numerical ID of the MIDI instrument map.
585           * @param name The new name for the specified MIDI instrument map.           * @param name The new name for the specified MIDI instrument map.
586           */           */
587            @Override
588          public void          public void
589          setBackendMidiInstrumentMapName(final int mapId, String name) {          setBackendMidiInstrumentMapName(final int mapId, String name) {
590                  final Task t = new Midi.SetInstrumentMapInfo(mapId, name);                  final Task t = new Midi.SetInstrumentMapInfo(mapId, name);
# Line 571  public class DefaultSamplerModel impleme Line 610  public class DefaultSamplerModel impleme
610           * @return The default MIDI instrument map or <code>null</code>           * @return The default MIDI instrument map or <code>null</code>
611           * if there are no maps created.           * if there are no maps created.
612           */           */
613            @Override
614          public MidiInstrumentMap          public MidiInstrumentMap
615          getDefaultMidiInstrumentMap() {          getDefaultMidiInstrumentMap() {
616                  return defaultMidiInstrumentMap;                  return defaultMidiInstrumentMap;
# Line 598  public class DefaultSamplerModel impleme Line 638  public class DefaultSamplerModel impleme
638           * @param program The MIDI program number of the new instrument.           * @param program The MIDI program number of the new instrument.
639           * @param instrInfo Provides the MIDI instrument settings.           * @param instrInfo Provides the MIDI instrument settings.
640           */           */
641            @Override
642          public void          public void
643          mapBackendMidiInstrument(int mapId, int bank, int program, MidiInstrumentInfo instrInfo) {          mapBackendMidiInstrument(int mapId, int bank, int program, MidiInstrumentInfo instrInfo) {
644                  CC.getTaskQueue().add(new Midi.MapInstrument(mapId, bank, program, instrInfo));                  CC.getTaskQueue().add(new Midi.MapInstrument(mapId, bank, program, instrInfo));
# Line 609  public class DefaultSamplerModel impleme Line 650  public class DefaultSamplerModel impleme
650           * @param bank The index of the MIDI bank containing the instrument to be removed.           * @param bank The index of the MIDI bank containing the instrument to be removed.
651           * @param program The MIDI program number of the instrument to be removed.           * @param program The MIDI program number of the instrument to be removed.
652           */           */
653            @Override
654          public void          public void
655          unmapBackendMidiInstrument(int mapId, int bank, int program) {          unmapBackendMidiInstrument(int mapId, int bank, int program) {
656                  CC.getTaskQueue().add(new Midi.UnmapInstrument(mapId, bank, program));                  CC.getTaskQueue().add(new Midi.UnmapInstrument(mapId, bank, program));
# Line 618  public class DefaultSamplerModel impleme Line 660  public class DefaultSamplerModel impleme
660           * Gets a list of all available engines.           * Gets a list of all available engines.
661           * @return A list of all available engines.           * @return A list of all available engines.
662           */           */
663            @Override
664          public SamplerEngine[]          public SamplerEngine[]
665          getEngines() { return engines; }          getEngines() { return engines; }
666                    
# Line 634  public class DefaultSamplerModel impleme Line 677  public class DefaultSamplerModel impleme
677           * @return The model of the specified sampler channel.           * @return The model of the specified sampler channel.
678           * @see #getchannelCount           * @see #getchannelCount
679           */           */
680            @Override
681          public SamplerChannelModel          public SamplerChannelModel
682          getChannel(int index) {          getChannel(int index) {
683                  return channelModels.get(index);                  return channelModels.get(index);
# Line 645  public class DefaultSamplerModel impleme Line 689  public class DefaultSamplerModel impleme
689           * @return The model of the specified sampler channel or <code>null</code>           * @return The model of the specified sampler channel or <code>null</code>
690           * if there is no channel with ID <code>channelId</code>.           * if there is no channel with ID <code>channelId</code>.
691           */           */
692            @Override
693          public SamplerChannelModel          public SamplerChannelModel
694          getChannelById(int channelId) {          getChannelById(int channelId) {
695                  for(SamplerChannelModel m : channelModels)                  for(SamplerChannelModel m : channelModels)
# Line 659  public class DefaultSamplerModel impleme Line 704  public class DefaultSamplerModel impleme
704           * @return The position of the specified channel in the channel list or -1           * @return The position of the specified channel in the channel list or -1
705           * if the channel is not in the list.           * if the channel is not in the list.
706           */           */
707            @Override
708          public int          public int
709          getChannelIndex(SamplerChannelModel channel) {          getChannelIndex(SamplerChannelModel channel) {
710                  if(channel == null) return -1;                  if(channel == null) return -1;
# Line 673  public class DefaultSamplerModel impleme Line 719  public class DefaultSamplerModel impleme
719           * Gets the current number of sampler channels.           * Gets the current number of sampler channels.
720           * @return The current number of sampler channels.           * @return The current number of sampler channels.
721           */           */
722            @Override
723          public int          public int
724          getChannelCount() { return channelModels.size(); }          getChannelCount() { return channelModels.size(); }
725                    
# Line 680  public class DefaultSamplerModel impleme Line 727  public class DefaultSamplerModel impleme
727           * Gets the current list of sampler channel models.           * Gets the current list of sampler channel models.
728           * @return The current list of sampler channel models.           * @return The current list of sampler channel models.
729           */           */
730            @Override
731          public SamplerChannelModel[]          public SamplerChannelModel[]
732          getChannels() {          getChannels() {
733                  return channelModels.toArray(new SamplerChannelModel[channelModels.size()]);                  return channelModels.toArray(new SamplerChannelModel[channelModels.size()]);
# Line 691  public class DefaultSamplerModel impleme Line 739  public class DefaultSamplerModel impleme
739           * when the backend notifies for its creation.           * when the backend notifies for its creation.
740           * @see #addChannel           * @see #addChannel
741           */           */
742            @Override
743          public void          public void
744          addBackendChannel() {          addBackendChannel() {
745                  CC.getTaskQueue().add(new Channel.Add());                  CC.getTaskQueue().add(new Channel.Add());
# Line 701  public class DefaultSamplerModel impleme Line 750  public class DefaultSamplerModel impleme
750           * Adds the specified sampler channel.           * Adds the specified sampler channel.
751           * @param channel The channel to be added.           * @param channel The channel to be added.
752           */           */
753            @Override
754          public void          public void
755          addChannel(SamplerChannel channel) {          addChannel(SamplerChannel channel) {
756                  DefaultSamplerChannelModel model = new DefaultSamplerChannelModel(channel);                  DefaultSamplerChannelModel model = new DefaultSamplerChannelModel(channel);
# Line 713  public class DefaultSamplerModel impleme Line 763  public class DefaultSamplerModel impleme
763           * @param channel A <code>SamplerChannel</code> instance containing the new settings           * @param channel A <code>SamplerChannel</code> instance containing the new settings
764           * for the channel.           * for the channel.
765           */           */
766            @Override
767          public void          public void
768          updateChannel(SamplerChannel channel) {          updateChannel(SamplerChannel channel) {
769                  for(SamplerChannelModel m : channelModels) {                  for(SamplerChannelModel m : channelModels) {
# Line 731  public class DefaultSamplerModel impleme Line 782  public class DefaultSamplerModel impleme
782           * Determines whether there are known upcoming changes to the           * Determines whether there are known upcoming changes to the
783           * channel list, which should be considered as part of a single action.           * channel list, which should be considered as part of a single action.
784           */           */
785            @Override
786          public synchronized boolean          public synchronized boolean
787          getChannelListIsAdjusting() { return channelListIsAdjusting; }          getChannelListIsAdjusting() { return channelListIsAdjusting; }
788                    
# Line 738  public class DefaultSamplerModel impleme Line 790  public class DefaultSamplerModel impleme
790           * Sets whether the upcoming changes to the           * Sets whether the upcoming changes to the
791           * channel list should be considered part of a single action.           * channel list should be considered part of a single action.
792           */           */
793            @Override
794          public synchronized void          public synchronized void
795          setChannelListIsAdjusting(boolean b) {          setChannelListIsAdjusting(boolean b) {
796                  channelListIsAdjusting = b;                  channelListIsAdjusting = b;
# Line 745  public class DefaultSamplerModel impleme Line 798  public class DefaultSamplerModel impleme
798                    
799          /**          /**
800           * Removes the specified sampler channel.           * Removes the specified sampler channel.
801             * Note that this method doesn't remove the channel in the backend,
802             * it is used to remove the channel from the model when those channel
803             * is removed in the backend.
804           * @param channelId The ID of the channel to be removed.           * @param channelId The ID of the channel to be removed.
805           * @return <code>true</code> if the channel is removed successfully, <code>false</code>           * @return <code>true</code> if the channel is removed successfully, <code>false</code>
806           * if the channel's list does not contain channel with ID <code>channelId</code>.           * if the channel's list does not contain channel with ID <code>channelId</code>.
807           */           */
808            @Override
809          public boolean          public boolean
810          removeChannelById(int channelId) {          removeChannelById(int channelId) {
811                  for(int i = 0; i < channelModels.size(); i++) {                  for(int i = 0; i < channelModels.size(); i++) {
# Line 764  public class DefaultSamplerModel impleme Line 821  public class DefaultSamplerModel impleme
821          }          }
822                    
823          /**          /**
824             * Removes all sampler channels.
825             * Note that this method doesn't remove the channel in the backend.
826             */
827            @Override
828            public void
829            removeAllChannels() {
830                    if(channelModels.size() == 0) return;
831                    
832                    setChannelListIsAdjusting(true);
833                    for(int i = channelModels.size() - 1; i > 0; i--) {
834                            SamplerChannelModel m = channelModels.get(i);
835                            channelModels.remove(i);
836                            fireSamplerChannelRemoved(m);
837                    }
838                    setChannelListIsAdjusting(false);
839                    
840                    SamplerChannelModel m = channelModels.get(0);
841                    channelModels.remove(0);
842                    fireSamplerChannelRemoved(m);
843            }
844            
845            /**
846           * Schedules a new task for removing the specified sampler channel on the backend side.           * Schedules a new task for removing the specified sampler channel on the backend side.
847           * @param channelId The ID of the channel to be removed.           * @param channelId The ID of the channel to be removed.
848           */           */
849            @Override
850          public void          public void
851          removeBackendChannel(int channelId) {          removeBackendChannel(int channelId) {
852                  CC.getTaskQueue().add(new Channel.Remove(channelId));                  CC.getTaskQueue().add(new Channel.Remove(channelId));
# Line 777  public class DefaultSamplerModel impleme Line 857  public class DefaultSamplerModel impleme
857           * the loaded instrument on the specified sampler channel.           * the loaded instrument on the specified sampler channel.
858           * @param channelId The sampler channel number.           * @param channelId The sampler channel number.
859           */           */
860            @Override
861          public void          public void
862          editBackendInstrument(int channelId) {          editBackendInstrument(int channelId) {
863                  CC.getTaskQueue().add(new Channel.EditInstrument(channelId));                  CC.getTaskQueue().add(new Channel.EditInstrument(channelId));
# Line 788  public class DefaultSamplerModel impleme Line 869  public class DefaultSamplerModel impleme
869           * @return <code>true</code> if there is at least one solo channel in the current list of           * @return <code>true</code> if there is at least one solo channel in the current list of
870           * sampler channels, <code>false</code> otherwise.           * sampler channels, <code>false</code> otherwise.
871           */           */
872            @Override
873          public boolean          public boolean
874          hasSoloChannel() {          hasSoloChannel() {
875                  for(SamplerChannelModel m : channelModels)                  for(SamplerChannelModel m : channelModels)
# Line 800  public class DefaultSamplerModel impleme Line 882  public class DefaultSamplerModel impleme
882           * Gets the number of solo channels in the current list of sampler channels.           * Gets the number of solo channels in the current list of sampler channels.
883           * @return The number of solo channels in the current list of sampler channels.           * @return The number of solo channels in the current list of sampler channels.
884           */           */
885            @Override
886          public int          public int
887          getSoloChannelCount() {          getSoloChannelCount() {
888                  int count = 0;                  int count = 0;
# Line 814  public class DefaultSamplerModel impleme Line 897  public class DefaultSamplerModel impleme
897           * This number includes the channels muted because of the presence of a solo channel.           * This number includes the channels muted because of the presence of a solo channel.
898           * @return The number of muted channels in the current list of sampler channels.           * @return The number of muted channels in the current list of sampler channels.
899           */           */
900            @Override
901          public int          public int
902          getMutedChannelCount() {          getMutedChannelCount() {
903                  int count = 0;                  int count = 0;
# Line 827  public class DefaultSamplerModel impleme Line 911  public class DefaultSamplerModel impleme
911           * Gets the number of channels muted because of the presence of a solo channel.           * Gets the number of channels muted because of the presence of a solo channel.
912           * @return The number of channels muted because of the presence of a solo channel.           * @return The number of channels muted because of the presence of a solo channel.
913           */           */
914            @Override
915          public int          public int
916          getMutedBySoloChannelCount() {          getMutedBySoloChannelCount() {
917                  int count = 0;                  int count = 0;
# Line 840  public class DefaultSamplerModel impleme Line 925  public class DefaultSamplerModel impleme
925           * Gets the total number of active streams.           * Gets the total number of active streams.
926           * @return The total number of active streams.           * @return The total number of active streams.
927           */           */
928            @Override
929          public int          public int
930          getTotalStreamCount() { return totalStreamCount; }          getTotalStreamCount() { return totalStreamCount; }
931                    
# Line 847  public class DefaultSamplerModel impleme Line 933  public class DefaultSamplerModel impleme
933           * Gets the total number of active voices.           * Gets the total number of active voices.
934           * @return The total number of active voices.           * @return The total number of active voices.
935           */           */
936            @Override
937          public int          public int
938          getTotalVoiceCount() { return totalVoiceCount; }          getTotalVoiceCount() { return totalVoiceCount; }
939                    
# Line 854  public class DefaultSamplerModel impleme Line 941  public class DefaultSamplerModel impleme
941           * Gets the maximum number of active voices.           * Gets the maximum number of active voices.
942           * @return The maximum number of active voices.           * @return The maximum number of active voices.
943           */           */
944            @Override
945          public int          public int
946          getTotalVoiceCountMax() { return totalVoiceCountMax; }          getTotalVoiceCountMax() { return totalVoiceCountMax; }
947                    
# Line 861  public class DefaultSamplerModel impleme Line 949  public class DefaultSamplerModel impleme
949           * Gets the golobal volume of the sampler.           * Gets the golobal volume of the sampler.
950           * @return The golobal volume of the sampler.           * @return The golobal volume of the sampler.
951           */           */
952            @Override
953          public float          public float
954          getVolume() { return volume; }          getVolume() { return volume; }
955                    
# Line 868  public class DefaultSamplerModel impleme Line 957  public class DefaultSamplerModel impleme
957           * Sets the global volume.           * Sets the global volume.
958           * @param volume The new volume value.           * @param volume The new volume value.
959           */           */
960            @Override
961          public void          public void
962          setVolume(float volume) {          setVolume(float volume) {
963                  if(this.volume == volume) return;                  if(this.volume == volume) return;
# Line 880  public class DefaultSamplerModel impleme Line 970  public class DefaultSamplerModel impleme
970           * Schedules a new task for setting the global volume on the backend side.           * Schedules a new task for setting the global volume on the backend side.
971           * @param volume The new volume value.           * @param volume The new volume value.
972           */           */
973            @Override
974          public void          public void
975          setBackendVolume(float volume) {          setBackendVolume(float volume) {
976                  CC.getTaskQueue().add(new Global.SetVolume(volume));                  CC.getTaskQueue().add(new Global.SetVolume(volume));
# Line 888  public class DefaultSamplerModel impleme Line 979  public class DefaultSamplerModel impleme
979          /**          /**
980           * Schedules a new task for resetting the sampler.           * Schedules a new task for resetting the sampler.
981           */           */
982            @Override
983          public void          public void
984          resetBackend() { CC.getTaskQueue().add(new org.jsampler.task.Global.ResetSampler()); }          resetBackend() { CC.getTaskQueue().add(new org.jsampler.task.Global.ResetSampler()); }
985                    
# Line 895  public class DefaultSamplerModel impleme Line 987  public class DefaultSamplerModel impleme
987           * Updates the current number of active disk streams in the sampler.           * Updates the current number of active disk streams in the sampler.
988           * @param count The new number of active streams.           * @param count The new number of active streams.
989           */           */
990            @Override
991          public void          public void
992          updateActiveStreamsInfo(int count) {          updateActiveStreamsInfo(int count) {
993                  if(totalStreamCount == count) return;                  if(totalStreamCount == count) return;
# Line 908  public class DefaultSamplerModel impleme Line 1001  public class DefaultSamplerModel impleme
1001           * @param count The new number of active voices.           * @param count The new number of active voices.
1002           * @param countMax The maximum number of active voices.           * @param countMax The maximum number of active voices.
1003           */           */
1004            @Override
1005          public void          public void
1006          updateActiveVoiceInfo(int count, int countMax) {          updateActiveVoiceInfo(int count, int countMax) {
1007                  if(totalVoiceCount == count && totalVoiceCountMax == countMax) return;                  if(totalVoiceCount == count && totalVoiceCountMax == countMax) return;
# Line 920  public class DefaultSamplerModel impleme Line 1014  public class DefaultSamplerModel impleme
1014          /**          /**
1015           * Determines whether the sampler configuration is modified.           * Determines whether the sampler configuration is modified.
1016           */           */
1017            @Override
1018          public boolean          public boolean
1019          isModified() { return modified; }          isModified() { return modified; }
1020                    
1021          /**          /**
1022           * Sets whether the sampler configuration is modified.           * Sets whether the sampler configuration is modified.
1023           */           */
1024            @Override
1025          public void          public void
1026          setModified(boolean b) { modified = b; }          setModified(boolean b) { modified = b; }
1027                    
1028          /** Resets the model. */          /** Resets the model. */
1029            @Override
1030          public void          public void
1031          reset() {          reset() {
1032                  removeAllMidiInstrumentMaps();                  removeAllMidiInstrumentMaps();

Legend:
Removed from v.1817  
changed lines
  Added in v.1818

  ViewVC Help
Powered by ViewVC