JSampler
v0.8a

org.jsampler
Class MidiInstrumentMap

java.lang.Object
  extended by org.jsampler.MidiInstrumentMap

public class MidiInstrumentMap
extends java.lang.Object

Represents a MIDI instrument map used for mapping instruments to corresponding MIDI bank select and MIDI program change messages.


Constructor Summary
MidiInstrumentMap(MidiInstrumentMapInfo info)
          Creates a new instance of MidiInstrumentMap.
 
Method Summary
 void addMidiInstrumentMapListener(MidiInstrumentMapListener l)
          Registers the specified listener for receiving event messages.
 MidiInstrument[] getAllMidiInstruments()
          Gets all instruments contained in this MIDI instrument map.
 MidiInstrumentEntry getAvailableEntry()
          Gets a free entry.
 MidiInstrumentMapInfo getInfo()
          Gets the information about this MIDI instrument map.
 int getMapId()
          Gets the ID of this MIDI instrument map.
 java.lang.Integer[] getMidiBanks()
          Gets the indices of all MIDI banks that contain at least one instrument.
 MidiInstrument getMidiInstrument(int bank, int program)
          Gets the instrument in the specified MIDI bank with the specified program number.
 MidiInstrument[] getMidiInstruments(int bankIndex)
          Gets all instruments contained in the specified MIDI bank.
 java.lang.String getName()
          Gets the name of this MIDI instrument map.
 void mapMidiInstrument(MidiInstrumentEntry entry, MidiInstrument instrument)
          Creates a new or replaces an existing entry in this MIDI instrument map.
 void removeMidiInstrumentMapListener(MidiInstrumentMapListener l)
          Removes the specified listener.
 void setInfo(MidiInstrumentMapInfo info)
          Sets the information about this MIDI instrument map.
 void setName(java.lang.String name)
          Sets the name of this MIDI instrument map.
 java.lang.String toString()
          Returns the name of this map.
 MidiInstrument unmapMidiInstrument(MidiInstrumentEntry entry)
          Removes an entry from this MIDI instrument map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MidiInstrumentMap

public MidiInstrumentMap(MidiInstrumentMapInfo info)
Creates a new instance of MidiInstrumentMap.

Parameters:
info - Provides the map's properties.
Method Detail

addMidiInstrumentMapListener

public void addMidiInstrumentMapListener(MidiInstrumentMapListener l)
Registers the specified listener for receiving event messages.

Parameters:
l - The MidiInstrumentMapListener to register.

removeMidiInstrumentMapListener

public void removeMidiInstrumentMapListener(MidiInstrumentMapListener l)
Removes the specified listener.

Parameters:
l - The MidiInstrumentMapListener to remove.

getMapId

public int getMapId()
Gets the ID of this MIDI instrument map.


getName

public java.lang.String getName()
Gets the name of this MIDI instrument map.

Returns:
The name of this MIDI instrument map.

setName

public void setName(java.lang.String name)
Sets the name of this MIDI instrument map.

Parameters:
name - The new name of this MIDI instrument map.

getInfo

public MidiInstrumentMapInfo getInfo()
Gets the information about this MIDI instrument map.

Returns:
The information about this MIDI instrument map.

setInfo

public void setInfo(MidiInstrumentMapInfo info)
Sets the information about this MIDI instrument map.

Parameters:
info - The new information about this MIDI instrument map.

getMidiBanks

public java.lang.Integer[] getMidiBanks()
Gets the indices of all MIDI banks that contain at least one instrument.

Returns:
The indices of all MIDI banks that contain at least one instrument.

getMidiInstrument

public MidiInstrument getMidiInstrument(int bank,
                                        int program)
Gets the instrument in the specified MIDI bank with the specified program number.

Parameters:
bank - The index of the MIDI bank, containing the requested instrument.
program - The program number of the requested instrument.
Returns:
The instrument in MIDI bank bank with program number program, or null if there is no such instrument in the map.

getMidiInstruments

public MidiInstrument[] getMidiInstruments(int bankIndex)
Gets all instruments contained in the specified MIDI bank.

Parameters:
bankIndex - The index of the MIDI bank, whose instruments should be obtained.
Returns:
All instruments contained in the specified MIDI bank.

getAllMidiInstruments

public MidiInstrument[] getAllMidiInstruments()
Gets all instruments contained in this MIDI instrument map.

Returns:
All instruments contained in this MIDI instrument map.

mapMidiInstrument

public void mapMidiInstrument(MidiInstrumentEntry entry,
                              MidiInstrument instrument)
Creates a new or replaces an existing entry in this MIDI instrument map.


unmapMidiInstrument

public MidiInstrument unmapMidiInstrument(MidiInstrumentEntry entry)
Removes an entry from this MIDI instrument map.

Parameters:
entry - The entry to remove.
Returns:
The MIDI instrument associated with the specified entry or null if there was no mapping for that entry.

getAvailableEntry

public MidiInstrumentEntry getAvailableEntry()
Gets a free entry.


toString

public java.lang.String toString()
Returns the name of this map.

Overrides:
toString in class java.lang.Object
Returns:
The name of this map.

JSampler
v0.8a

Copyright © 2007 Grigor Iliev. All rights reserved.