--- jsampler/trunk/src/org/jsampler/SamplerChannelModel.java 2007/04/02 20:48:15 1142 +++ jsampler/trunk/src/org/jsampler/SamplerChannelModel.java 2007/04/02 21:18:31 1143 @@ -1,7 +1,7 @@ /* * JSampler - a java front-end for LinuxSampler * - * Copyright (C) 2005 Grigor Kirilov Iliev + * Copyright (C) 2005-2006 Grigor Iliev * * This file is part of JSampler. * @@ -22,13 +22,17 @@ package org.jsampler; +import org.jsampler.event.EffectSendsListener; import org.jsampler.event.SamplerChannelListener; +import org.linuxsampler.lscp.FxSend; import org.linuxsampler.lscp.SamplerChannel; /** * A data model representing a sampler channel. + * Note that all methods that begin with setBackend alter the settings + * on the backend side. * @author Grigor Iliev */ public interface SamplerChannelModel { @@ -45,10 +49,22 @@ public void removeSamplerChannelListener(SamplerChannelListener l); /** + * Registers the specified listener for receiving event messages. + * @param l The EffectSendsListener to register. + */ + public void addEffectSendsListener(EffectSendsListener l); + + /** + * Removes the specified listener. + * @param l The EffectSendsListener to remove. + */ + public void removeEffectSendsListener(EffectSendsListener l); + + /** * Gets the sampler channel number. * @return The sampler channel number or -1 if the sampler channel number is not set. */ - public int getChannelID(); + public int getChannelId(); /** * Gets the current settings of the sampler channel. @@ -59,6 +75,8 @@ /** * Sets the current settings of the sampler channel. + * Note that this method does not changes the channel settings on + * the backend. It is invoked just notify for channel settings' changes. * @param channel A SamplerChannel instance containing * the new settings for this sampler channel. */ @@ -72,6 +90,8 @@ /** * Sets the number of active disk streams. + * Note that this method does not alter the number + * of active disk streams on the backend side. * @param count The new number of active disk streams. */ public void setStreamCount(int count); @@ -84,72 +104,212 @@ /** * Sets the number of active voices. + * Note that this method does not alter the number + * of active voices on the backend side. * @param count The new number of active voices. */ public void setVoiceCount(int count); /** - * Sets the sampler engine type to be used. + * Schedules a new task for setting the sampler engine type to be used. * @param engine The name of the engine type to be used. */ - public void setEngineType(String engine); + public void setBackendEngineType(String engine); /** - * Sets the mute mode of the channel. + * Schedules a new task for setting the mute mode of the channel. * @param mute Specifies the mute mode. If true the channel is muted, else * the channel is unmuted. */ - public void setMute(boolean mute); + public void setBackendMute(boolean mute); /** - * Sets the solo mode of the channel. + * Schedules a new task for setting on the backend side the solo mode of the channel. * @param solo Specifies the solo mode. If true the channel is soloed, else * the channel is unsoloed. */ - public void setSolo(boolean solo); - + public void setBackendSolo(boolean solo); + /** - * Sets the channel volume. + * Schedules a new task for setting the channel volume on the backend side. * @param volume Specifies the new volume value. */ - public void setVolume(float volume); + public void setBackendVolume(float volume); /** - * Sets the MIDI input device of the channel represented by this model. - * @param deviceID Specifies the numerical ID of the MIDI input device to be set. + * Schedules a new task for setting on the backend side the MIDI input + * device of the channel represented by this model. + * @param deviceId Specifies the numerical ID of the MIDI input device to be set. */ - public void setMidiInputDevice(int deviceID); + public void setBackendMidiInputDevice(int deviceId); /** - * Sets the MIDI input port of the channel represented by this model. + * Schedules a new task for setting (on the backend side) the + * MIDI input port of the channel represented by this model. * @param port Specifies the number of the MIDI input port. */ - public void setMidiInputPort(int port); + public void setBackendMidiInputPort(int port); /** - * Sets the MIDI channel that the channel represented by this model should listen to. + * Schedules a new task for setting (on the backend side) the MIDI channel + * that the channel represented by this model should listen to. * @param channel Specifies the MIDI channel that the channel * represented by this model should listen to. */ - public void setMidiInputChannel(int channel); + public void setBackendMidiInputChannel(int channel); + + /** + * Schedules a new task for setting (on the backend side) the audio output + * device of the channel represented by this model. + * @param deviceId Specifies the numerical ID of the audio output device to be set. + */ + public void setBackendAudioOutputDevice(int deviceId); /** - * Sets the audio output device of the channel represented by this model. - * @param deviceID Specifies the numerical ID of the audio output device to be set. + * Sets the destination of the destination of the specified audio channel. + * @param audioSrc The numerical ID of the sampler channel's audio + * output channel, which should be rerouted. + * @param audioDst The audio channel of the selected audio output device + * where audioSrc should be routed to. */ - public void setAudioOutputDevice(int deviceID); + public void setBackendAudioOutputChannel(int audioSrc, int audioDst); /** - * Loads and assigns the specified instrument + * Schedules a new task for assigning (on the backend side) the + * specified MIDI instrument map to this sampler channel. + * @param mapId Specify the numerical ID of the MIDI instrument + * map that should be assigned to this sampler + * channel or -1 to remove the current map binding. + */ + public void setBackendMidiInstrumentMap(int mapId); + + /** + * Schedules a new task for loading and assigning the specified instrument * to the sampler channel represented by this model. * @param filename The file name of the instrument to be loaded. * @param InstrIndex The index of the instrument in the instrument file to be loaded. */ - public void loadInstrument(String filename, int InstrIndex); + public void loadBackendInstrument(String filename, int InstrIndex); + + /** Schedules a new task for reseting the channel. */ + public void resetBackendChannel(); - /** Resets the channel. */ - public void resetChannel(); + /** Schedules a new task for duplicating the channel. */ + public void duplicateBackendChannel(); + + /** + * Schedules a new task for adding a new effect send on the + * backend side. The effect send will be actually added to this model + * when the backend notifies for its creation. + * @param midiCtrl Defines the MIDI controller, which + * will be able alter the effect send level. + */ + public void addBackendFxSend(int midiCtrl); + + /** + * Schedules a new task for adding a new effect send on the + * backend side. The effect send will be actually added to this model + * when the backend notifies for its creation. + * @param midiCtrl Defines the MIDI controller, which + * will be able alter the effect send level. + * @param name The name of the effect send entity. + * The name does not have to be unique. + */ + public void addBackendFxSend(int midiCtrl, String name); + + /** + * Adds the specified effect send. + * @param fxSend The effect send to be added. + */ + public void addFxSend(FxSend fxSend); + + /** + * Schedules a new task for removing the specified effect send on the backend side. + * @param fxSendId The ID of the effect send to remove. + */ + public void removeBackendFxSend(int fxSendId); + + /** + * Removes the effect send at the specified position. + * @param index The position of the effect send to remove. + * @return The removed effect send. + */ + public FxSend removeFxSend(int index); - /** Duplicates the channel. */ - public void duplicateChannel(); + /** + * Removes the specified effect send. + * @param fxSendId The ID of the effect send to remove. + * @return true if the effect send is removed successfully, false + * if the channel does not contain effect send with ID fxSendId. + */ + public boolean removeFxSendById(int fxSendId); + + /** Removes all effect sends from this channel. */ + public void removeAllFxSends(); + + /** + * Updates the specified effect send. + * @param fxSend The effect send to update. + */ + public void updateFxSend(FxSend fxSend); + + /** + * Gets the current number of effect sends. + * @return The current number of effect sends. + */ + public int getFxSendCount(); + + /** + * Gets the effect send at the specified position. + * @param index The index of the effect send to be returned. + * @return The effect send at the specified position. + */ + public FxSend getFxSend(int index); + + /** + * Gets the effect send with the specified ID. + * @param fxSendId The ID of the effect send to return. + * @return The effect send with the specified ID or null + * if there is no effect send with ID fxSendId. + */ + public FxSend getFxSendById(int fxSendId); + + /** + * Gets the current list of effect sends. + * @return The current list of effect sends. + */ + public FxSend[] getFxSends(); + + /** + * Sets the name of the specified effect send. + * @param fxSend The numerical ID of the effect send. + * @param name The new name of the effect send entity. + */ + public void setBackendFxSendName(int fxSend, String name); + + /** + * Sets the destination of an effect send's audio channel. + * @param fxSend The numerical ID of the effect send entity to be rerouted. + * @param audioSrc The numerical ID of the effect send's audio output channel, + * which should be rerouted. + * @param audioDst The audio channel of the selected audio output device + * where audioSrc should be routed to. + */ + public void setBackendFxSendAudioOutputChannel(int fxSend, int audioSrc, int audioDst); + + /** + * Sets the MIDI controller of the specified effect send. + * @param fxSend The numerical ID of the effect send. + * @param midiCtrl The MIDI controller which shall be + * able to modify the effect send's send level. + */ + public void setBackendFxSendMidiController(int fxSend, int midiCtrl); + + /** + * Sets the volume of the specified effect send. + * @param fxSend The numerical ID of the effect + * send, which volume should be changed. + * @param level The new volume value. + */ + public void setBackendFxSendLevel(int fxSend, float level); }