JSampler
v0.8a

org.jsampler
Class DefaultMidiDeviceModel

java.lang.Object
  extended by org.jsampler.DefaultMidiDeviceModel
All Implemented Interfaces:
MidiDeviceModel

public class DefaultMidiDeviceModel
extends java.lang.Object
implements MidiDeviceModel

The Default implementation of the MidiDeviceModel interface.


Constructor Summary
DefaultMidiDeviceModel(MidiInputDevice midiDevice)
          Creates a new instance of DefaultMidiDeviceModel using the specified non-null MIDI device.
 
Method Summary
 void addMidiDeviceListener(MidiDeviceListener l)
          Registers the specified listener to be notified when the settings of the MIDI device are changed.
 int getDeviceId()
          Gets the numerical ID of this MIDI device.
 MidiInputDevice getDeviceInfo()
          Gets the current settings of the MIDI device represented by this model.
 boolean isActive()
          Determines whether the MIDI device is active.
 void removeMidiDeviceListener(MidiDeviceListener l)
          Removes the specified listener.
 void setActive(boolean active)
          Sets whether the MIDI device is enabled or disabled.
 void setBackendActive(boolean active)
          Schedules a new task for enabling/disabling the MIDI device.
 void setBackendDeviceParameter(Parameter prm)
          Schedules a new task for altering a specific setting of the MIDI input device.
 void setBackendPortCount(int ports)
          Schedules a new task for changing the port number of the MIDI device.
 void setBackendPortParameter(int port, Parameter prm)
          Schedules a new task for altering a specific setting of the specified MIDI input port.
 void setDeviceInfo(MidiInputDevice device)
          Updates the settings of the MIDI device represented by this model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMidiDeviceModel

public DefaultMidiDeviceModel(MidiInputDevice midiDevice)
Creates a new instance of DefaultMidiDeviceModel using the specified non-null MIDI device.

Parameters:
midiDevice - A MidiInputDevice instance providing the current settings of the MIDI device which will be represented by this model.
Throws:
java.lang.IllegalArgumentException - If midiDevice is null.
Method Detail

addMidiDeviceListener

public void addMidiDeviceListener(MidiDeviceListener l)
Registers the specified listener to be notified when the settings of the MIDI device are changed.

Specified by:
addMidiDeviceListener in interface MidiDeviceModel
Parameters:
l - The MidiDeviceListener to register.

removeMidiDeviceListener

public void removeMidiDeviceListener(MidiDeviceListener l)
Removes the specified listener.

Specified by:
removeMidiDeviceListener in interface MidiDeviceModel
Parameters:
l - The MidiDeviceListener to remove.

getDeviceId

public int getDeviceId()
Gets the numerical ID of this MIDI device.

Specified by:
getDeviceId in interface MidiDeviceModel
Returns:
The numerical ID of this MIDI device or -1 if the device number is not set.

getDeviceInfo

public MidiInputDevice getDeviceInfo()
Gets the current settings of the MIDI device represented by this model.

Specified by:
getDeviceInfo in interface MidiDeviceModel
Returns:
MidiInputDevice instance providing the current settings of the MIDI device represented by this model.

setDeviceInfo

public void setDeviceInfo(MidiInputDevice device)
Updates the settings of the MIDI device represented by this model.

Specified by:
setDeviceInfo in interface MidiDeviceModel
Parameters:
device - The new MIDI device settings.

setActive

public void setActive(boolean active)
Sets whether the MIDI device is enabled or disabled.

Specified by:
setActive in interface MidiDeviceModel
Parameters:
active - If true the MIDI device is enabled, else the device is disabled.

isActive

public boolean isActive()
Determines whether the MIDI device is active.

Specified by:
isActive in interface MidiDeviceModel
Returns:
true if the device is enabled and false otherwise.

setBackendActive

public void setBackendActive(boolean active)
Schedules a new task for enabling/disabling the MIDI device.

Specified by:
setBackendActive in interface MidiDeviceModel
Parameters:
active - If true the MIDI device is enabled, else the device is disabled.

setBackendDeviceParameter

public void setBackendDeviceParameter(Parameter prm)
Schedules a new task for altering a specific setting of the MIDI input device.

Specified by:
setBackendDeviceParameter in interface MidiDeviceModel
Parameters:
prm - The parameter to be set.

setBackendPortCount

public void setBackendPortCount(int ports)
Schedules a new task for changing the port number of the MIDI device.

Specified by:
setBackendPortCount in interface MidiDeviceModel
Parameters:
ports - The new number of ports.

setBackendPortParameter

public void setBackendPortParameter(int port,
                                    Parameter prm)
Schedules a new task for altering a specific setting of the specified MIDI input port.

Specified by:
setBackendPortParameter in interface MidiDeviceModel
Parameters:
port - The port number.
prm - The parameter to be set.

JSampler
v0.8a

Copyright © 2007 Grigor Iliev. All rights reserved.