JSampler
v0.8a

org.jsampler
Class DefaultSamplerChannelModel

java.lang.Object
  extended by org.jsampler.DefaultSamplerChannelModel
All Implemented Interfaces:
SamplerChannelModel

public class DefaultSamplerChannelModel
extends java.lang.Object
implements SamplerChannelModel

This class provides default implementation of the SamplerChannelModel interface. Note that all methods that begin with setBackend alter the settings on the backend side.


Constructor Summary
DefaultSamplerChannelModel(SamplerChannel channel)
          Creates a new instance of DefaultSamplerChannelModel using the specified channel settings.
 
Method Summary
 void addBackendFxSend(int midiCtrl)
          Schedules a new task for adding a new effect send on the backend side.
 void addBackendFxSend(int midiCtrl, java.lang.String name)
          Schedules a new task for adding a new effect send on the backend side.
 void addEffectSendsListener(EffectSendsListener l)
          Registers the specified listener for receiving event messages.
 void addFxSend(FxSend fxSend)
          Adds the specified effect send.
 void addSamplerChannelListener(SamplerChannelListener l)
          Registers the specified listener for receiving event messages.
 void duplicateBackendChannel()
          Schedules a new task for duplicating the channel.
protected  void fireFxSendAdded(FxSend fxSend)
          Notifies listeners that the specified effect send has been added to the channel.
protected  void fireFxSendRemoved(FxSend fxSend)
          Notifies listeners that the specified effect send has been removed.
protected  void fireFxSendUpdated(FxSend fxSend)
          Notifies listeners that the specified effect send has been updated.
protected  void fireSamplerChannelChanged()
          Notifies listeners that the sampler channel settings has changed.
protected  void fireSamplerChannelChanged(SamplerChannelEvent e)
          Notifies listeners that the sampler channel settings has changed.
protected  void fireStreamCountChanged()
          Notifies listeners that the number of active disk streams has changed.
protected  void fireStreamCountChanged(SamplerChannelEvent e)
          Notifies listeners that the number of active disk streams has changed.
protected  void fireVoiceCountChanged()
          Notifies listeners that the number of active voices has changed.
protected  void fireVoiceCountChanged(SamplerChannelEvent e)
          Notifies listeners that the number of active voices has changed.
 int getChannelId()
          Gets the sampler channel number.
 SamplerChannel getChannelInfo()
          Gets the current settings of the sampler channel.
 FxSend getFxSend(int index)
          Gets the effect send at the specified position.
 FxSend getFxSendById(int fxSendId)
          Gets the effect send with the specified ID.
 int getFxSendCount()
          Gets the current number of effect sends.
 FxSend[] getFxSends()
          Gets the current list of effect sends.
 int getStreamCount()
          Gets the number of active disk streams.
 int getVoiceCount()
          Gets the number of active voices.
 void loadBackendInstrument(java.lang.String filename, int InstrIndex)
          Schedules a new task for loading and assigning the specified instrument to the sampler channel represented by this model.
 void removeAllFxSends()
          Removes all effect sends from this channel.
 void removeBackendFxSend(int fxSendId)
          Schedules a new task for removing the specified effect send on the backend side.
 void removeEffectSendsListener(EffectSendsListener l)
          Removes the specified listener.
 FxSend removeFxSend(int index)
          Removes the effect send at the specified position.
 boolean removeFxSendById(int fxSendId)
          Removes the specified effect send.
 void removeSamplerChannelListener(SamplerChannelListener l)
          Removes the specified listener.
 void resetBackendChannel()
          Schedules a new task for reseting the channel.
 void setBackendAudioOutputChannel(int audioSrc, int audioDst)
          Sets the destination of the destination of the specified audio channel.
 void setBackendAudioOutputDevice(int deviceId)
          Schedules a new task for setting (on the backend side) the audio output device of the channel represented by this model.
 void setBackendEngineType(java.lang.String engine)
          Schedules a new task for setting the sampler engine type to be used.
 void setBackendFxSendAudioOutputChannel(int fxSend, int audioSrc, int audioDst)
          Sets the destination of an effect send's audio channel.
 void setBackendFxSendLevel(int fxSend, float level)
          Sets the volume of the specified effect send.
 void setBackendFxSendMidiController(int fxSend, int midiCtrl)
          Sets the MIDI controller of the specified effect send.
 void setBackendFxSendName(int fxSend, java.lang.String name)
          Sets the name of the specified effect send.
 void setBackendMidiInputChannel(int channel)
          Schedules a new task for setting (on the backend side) the MIDI channel that the channel represented by this model should listen to.
 void setBackendMidiInputDevice(int deviceId)
          Schedules a new task for setting on the backend side the MIDI input device of the channel represented by this model.
 void setBackendMidiInputPort(int port)
          Schedules a new task for setting (on the backend side) the MIDI input port of the channel represented by this model.
 void setBackendMidiInstrumentMap(int mapId)
          Schedules a new task for assigning (on the backend side) the specified MIDI instrument map to this sampler channel.
 void setBackendMute(boolean mute)
          Schedules a new task for setting the mute mode of the channel.
 void setBackendSolo(boolean solo)
          Schedules a new task for setting on the backend side the solo mode of the channel.
 void setBackendVolume(float volume)
          Schedules a new task for setting the channel volume on the backend side.
 void setChannelInfo(SamplerChannel channel)
          Sets the current settings of the sampler channel.
 void setStreamCount(int count)
          Sets the number of active disk streams.
 void setVoiceCount(int count)
          Sets the number of active voices.
 void updateFxSend(FxSend fxSend)
          Updates the specified effect send.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSamplerChannelModel

public DefaultSamplerChannelModel(SamplerChannel channel)
Creates a new instance of DefaultSamplerChannelModel using the specified channel settings.

Parameters:
channel - A non-null SamplerChannel instance containing the current settings of the channel which will be represented by this sampler channel model.
Throws:
java.lang.IllegalArgumentException - If channel is null.
Method Detail

addSamplerChannelListener

public void addSamplerChannelListener(SamplerChannelListener l)
Registers the specified listener for receiving event messages.

Specified by:
addSamplerChannelListener in interface SamplerChannelModel
Parameters:
l - The SamplerChannelListener to register.

removeSamplerChannelListener

public void removeSamplerChannelListener(SamplerChannelListener l)
Removes the specified listener.

Specified by:
removeSamplerChannelListener in interface SamplerChannelModel
Parameters:
l - The SamplerChannelListener to remove.

addEffectSendsListener

public void addEffectSendsListener(EffectSendsListener l)
Registers the specified listener for receiving event messages.

Specified by:
addEffectSendsListener in interface SamplerChannelModel
Parameters:
l - The EffectSendsListener to register.

removeEffectSendsListener

public void removeEffectSendsListener(EffectSendsListener l)
Removes the specified listener.

Specified by:
removeEffectSendsListener in interface SamplerChannelModel
Parameters:
l - The EffectSendsListener to remove.

getChannelId

public int getChannelId()
Gets the sampler channel number.

Specified by:
getChannelId in interface SamplerChannelModel
Returns:
The sampler channel number or -1 if the sampler channel number is not set.

getChannelInfo

public SamplerChannel getChannelInfo()
Gets the current settings of the sampler channel.

Specified by:
getChannelInfo in interface SamplerChannelModel
Returns:
SamplerChannel instance containing the current settings of the sampler channel.

setChannelInfo

public void setChannelInfo(SamplerChannel channel)
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.

Specified by:
setChannelInfo in interface SamplerChannelModel
Parameters:
channel - A SamplerChannel instance containing the new settings for this sampler channel.
Throws:
java.lang.IllegalArgumentException - If channel is null.

getStreamCount

public int getStreamCount()
Gets the number of active disk streams.

Specified by:
getStreamCount in interface SamplerChannelModel
Returns:
The number of active disk streams.

setStreamCount

public void setStreamCount(int count)
Sets the number of active disk streams. Note that this method does not alter the number of active disk streams on the backend side.

Specified by:
setStreamCount in interface SamplerChannelModel
Parameters:
count - The new number of active disk streams.

getVoiceCount

public int getVoiceCount()
Gets the number of active voices.

Specified by:
getVoiceCount in interface SamplerChannelModel
Returns:
The number of active voices.

setVoiceCount

public void setVoiceCount(int count)
Sets the number of active voices. Note that this method does not alter the number of active voices on the backend side.

Specified by:
setVoiceCount in interface SamplerChannelModel
Parameters:
count - The new number of active voices.

setBackendEngineType

public void setBackendEngineType(java.lang.String engine)
Schedules a new task for setting the sampler engine type to be used.

Specified by:
setBackendEngineType in interface SamplerChannelModel
Parameters:
engine - The name of the engine type to be used.

setBackendMute

public void setBackendMute(boolean mute)
Schedules a new task for setting the mute mode of the channel.

Specified by:
setBackendMute in interface SamplerChannelModel
Parameters:
mute - Specifies the mute mode. If true the channel is muted, else the channel is unmuted.

setBackendSolo

public void setBackendSolo(boolean solo)
Schedules a new task for setting on the backend side the solo mode of the channel.

Specified by:
setBackendSolo in interface SamplerChannelModel
Parameters:
solo - Specifies the solo mode. If true the channel is soloed, else the channel is unsoloed.

setBackendVolume

public void setBackendVolume(float volume)
Schedules a new task for setting the channel volume on the backend side.

Specified by:
setBackendVolume in interface SamplerChannelModel
Parameters:
volume - Specifies the new volume value.

setBackendMidiInputDevice

public void setBackendMidiInputDevice(int deviceId)
Schedules a new task for setting on the backend side the MIDI input device of the channel represented by this model.

Specified by:
setBackendMidiInputDevice in interface SamplerChannelModel
Parameters:
deviceId - Specifies the numerical ID of the MIDI input device to be set.

setBackendMidiInputPort

public void setBackendMidiInputPort(int port)
Schedules a new task for setting (on the backend side) the MIDI input port of the channel represented by this model.

Specified by:
setBackendMidiInputPort in interface SamplerChannelModel
Parameters:
port - Specifies the number of the MIDI input port.

setBackendMidiInputChannel

public void setBackendMidiInputChannel(int channel)
Schedules a new task for setting (on the backend side) the MIDI channel that the channel represented by this model should listen to.

Specified by:
setBackendMidiInputChannel in interface SamplerChannelModel
Parameters:
channel - Specifies the MIDI channel that the channel represented by this model should listen to.

setBackendAudioOutputDevice

public void setBackendAudioOutputDevice(int deviceId)
Schedules a new task for setting (on the backend side) the audio output device of the channel represented by this model.

Specified by:
setBackendAudioOutputDevice in interface SamplerChannelModel
Parameters:
deviceId - Specifies the numerical ID of the audio output device to be set.

setBackendAudioOutputChannel

public void setBackendAudioOutputChannel(int audioSrc,
                                         int audioDst)
Sets the destination of the destination of the specified audio channel.

Specified by:
setBackendAudioOutputChannel in interface SamplerChannelModel
Parameters:
audioSrc - The numerical ID of the sampler channel's audio output channel, which should be rerouted.
audioDst - The audio channel of the selected audio output device where audioSrc should be routed to.

setBackendMidiInstrumentMap

public void setBackendMidiInstrumentMap(int mapId)
Schedules a new task for assigning (on the backend side) the specified MIDI instrument map to this sampler channel.

Specified by:
setBackendMidiInstrumentMap in interface SamplerChannelModel
Parameters:
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.

loadBackendInstrument

public void loadBackendInstrument(java.lang.String filename,
                                  int InstrIndex)
Schedules a new task for loading and assigning the specified instrument to the sampler channel represented by this model.

Specified by:
loadBackendInstrument in interface SamplerChannelModel
Parameters:
filename - The file name of the instrument to be loaded.
InstrIndex - The index of the instrument in the instrument file to be loaded.

resetBackendChannel

public void resetBackendChannel()
Schedules a new task for reseting the channel.

Specified by:
resetBackendChannel in interface SamplerChannelModel

duplicateBackendChannel

public void duplicateBackendChannel()
Schedules a new task for duplicating the channel.

Specified by:
duplicateBackendChannel in interface SamplerChannelModel

addBackendFxSend

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.

Specified by:
addBackendFxSend in interface SamplerChannelModel
Parameters:
midiCtrl - Defines the MIDI controller, which will be able alter the effect send level.

addBackendFxSend

public void addBackendFxSend(int midiCtrl,
                             java.lang.String name)
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.

Specified by:
addBackendFxSend in interface SamplerChannelModel
Parameters:
midiCtrl - Defines the MIDI controller, which will be able alter the effect send level.
name - The name of the effect send entity. The name does not have to be unique.

addFxSend

public void addFxSend(FxSend fxSend)
Adds the specified effect send.

Specified by:
addFxSend in interface SamplerChannelModel
Parameters:
fxSend - The effect send to be added.

removeBackendFxSend

public void removeBackendFxSend(int fxSendId)
Schedules a new task for removing the specified effect send on the backend side.

Specified by:
removeBackendFxSend in interface SamplerChannelModel
Parameters:
fxSendId - The ID of the effect send to remove.

getFxSend

public FxSend getFxSend(int index)
Gets the effect send at the specified position.

Specified by:
getFxSend in interface SamplerChannelModel
Parameters:
index - The index of the effect send to be returned.
Returns:
The effect send at the specified position.

getFxSendById

public FxSend getFxSendById(int fxSendId)
Gets the effect send with the specified ID.

Specified by:
getFxSendById in interface SamplerChannelModel
Parameters:
fxSendId - The ID of the effect send to return.
Returns:
The effect send with the specified ID or null if there is no effect send with ID fxSendId.

removeFxSend

public FxSend removeFxSend(int index)
Removes the effect send at the specified position.

Specified by:
removeFxSend in interface SamplerChannelModel
Parameters:
index - The position of the effect send to remove.
Returns:
The removed effect send.

removeFxSendById

public boolean removeFxSendById(int fxSendId)
Removes the specified effect send.

Specified by:
removeFxSendById in interface SamplerChannelModel
Parameters:
fxSendId - The ID of the effect send to remove.
Returns:
true if the effect send is removed successfully, false if the channel does not contain effect send with ID fxSendId.

removeAllFxSends

public void removeAllFxSends()
Removes all effect sends from this channel.

Specified by:
removeAllFxSends in interface SamplerChannelModel

updateFxSend

public void updateFxSend(FxSend fxSend)
Updates the specified effect send.

Specified by:
updateFxSend in interface SamplerChannelModel
Parameters:
fxSend - The effect send to update.

getFxSendCount

public int getFxSendCount()
Gets the current number of effect sends.

Specified by:
getFxSendCount in interface SamplerChannelModel
Returns:
The current number of effect sends.

getFxSends

public FxSend[] getFxSends()
Gets the current list of effect sends.

Specified by:
getFxSends in interface SamplerChannelModel
Returns:
The current list of effect sends.

setBackendFxSendName

public void setBackendFxSendName(int fxSend,
                                 java.lang.String name)
Sets the name of the specified effect send.

Specified by:
setBackendFxSendName in interface SamplerChannelModel
Parameters:
fxSend - The numerical ID of the effect send.
name - The new name of the effect send entity.

setBackendFxSendAudioOutputChannel

public void setBackendFxSendAudioOutputChannel(int fxSend,
                                               int audioSrc,
                                               int audioDst)
Sets the destination of an effect send's audio channel.

Specified by:
setBackendFxSendAudioOutputChannel in interface SamplerChannelModel
Parameters:
fxSend - The numerical ID of the effect send entity to be rerouted.
audioSrc - The numerical ID of the effect send's audio output channel, which should be rerouted.
audioDst - The audio channel of the selected audio output device where audioSrc should be routed to.

setBackendFxSendMidiController

public void setBackendFxSendMidiController(int fxSend,
                                           int midiCtrl)
Sets the MIDI controller of the specified effect send.

Specified by:
setBackendFxSendMidiController in interface SamplerChannelModel
Parameters:
fxSend - The numerical ID of the effect send.
midiCtrl - The MIDI controller which shall be able to modify the effect send's send level.

setBackendFxSendLevel

public void setBackendFxSendLevel(int fxSend,
                                  float level)
Sets the volume of the specified effect send.

Specified by:
setBackendFxSendLevel in interface SamplerChannelModel
Parameters:
fxSend - The numerical ID of the effect send, which volume should be changed.
level - The new volume value.

fireSamplerChannelChanged

protected void fireSamplerChannelChanged()
Notifies listeners that the sampler channel settings has changed.


fireSamplerChannelChanged

protected void fireSamplerChannelChanged(SamplerChannelEvent e)
Notifies listeners that the sampler channel settings has changed. This method should be invoked from the event-dispatching thread.


fireStreamCountChanged

protected void fireStreamCountChanged()
Notifies listeners that the number of active disk streams has changed.


fireStreamCountChanged

protected void fireStreamCountChanged(SamplerChannelEvent e)
Notifies listeners that the number of active disk streams has changed. This method should be invoked from the event-dispatching thread.


fireVoiceCountChanged

protected void fireVoiceCountChanged()
Notifies listeners that the number of active voices has changed.


fireVoiceCountChanged

protected void fireVoiceCountChanged(SamplerChannelEvent e)
Notifies listeners that the number of active voices has changed. This method should be invoked from the event-dispatching thread.


fireFxSendAdded

protected void fireFxSendAdded(FxSend fxSend)
Notifies listeners that the specified effect send has been added to the channel.


fireFxSendRemoved

protected void fireFxSendRemoved(FxSend fxSend)
Notifies listeners that the specified effect send has been removed.


fireFxSendUpdated

protected void fireFxSendUpdated(FxSend fxSend)
Notifies listeners that the specified effect send has been updated.


JSampler
v0.8a

Copyright © 2007 Grigor Iliev. All rights reserved.