Class GMRemapTable

java.lang.Object
org.jjazz.outputsynth.api.GMRemapTable
All Implemented Interfaces:
Serializable

public class GMRemapTable extends Object implements Serializable
The table can associate an Instrument from a MidiSynth to each of the GM1 instruments + the special DRUMS/PERCUSSION static instances.

Association can also be done at the GM1Bank.Family level.

See Also:
  • Field Details

    • DRUMS_INSTRUMENT

      public static final Instrument DRUMS_INSTRUMENT
      Special instances for the Drums/Percussion, since GM1 does not define them.
    • PERCUSSION_INSTRUMENT

      public static final Instrument PERCUSSION_INSTRUMENT
    • PROP_FAMILY

      public static final String PROP_FAMILY
      oldValue=Family, newValue=Instrument
      See Also:
    • PROP_INSTRUMENT

      public static final String PROP_INSTRUMENT
      oldValue=GM1Instrument or the special DRUMS/PERCUSSION static instances, newValue=Instrument
      See Also:
  • Constructor Details

    • GMRemapTable

      public GMRemapTable(MidiSynth midiSynth)
      Create an instance to remap GM instruments to instruments from the specified MidiSynth.

      Parameters:
      midiSynth -
  • Method Details

    • set

      public void set(GMRemapTable rt)
      Set the mappings from another GMRemapTable which must share the same MidiSynth.
      Parameters:
      rt - Must share the same MidiSynth that this instance.
    • getMidiSynth

      public MidiSynth getMidiSynth()
      The associated MidiSynth.
      Returns:
    • getInstrumentMap

      public HashMap<Instrument,Instrument> getInstrumentMap()
      The map which associates a GM instrument (+ the special drums instances) to an instrument from the associated MidiSynth.
      Returns:
    • getFamilyInstrumentMap

      public HashMap<Family,Instrument> getFamilyInstrumentMap()
      The map which associates a GM family to an instrument from the associated MidiSynth.
      Returns:
    • clear

      public void clear()
      Remove all mappings.
    • checkRemappedInstrument

      public static void checkRemappedInstrument(Instrument remappedIns)
      Check that the specified remapped Instrument is valid.
      Parameters:
      remappedIns -
      Throws:
      IllegalArgumentException - If invalid value
    • getInstrument

      public Instrument getInstrument(Instrument remappedIns)
      Get the mapped instrument for remappedIns.
      Parameters:
      remappedIns - Must be a GM1Instrument or the special DRUMS/PERCUSSION static instances.
      Returns:
      Null if no mapping defined for remappedIns. Returned instrument belongs to the associated MidiSynth.
    • setInstrument

      public void setInstrument(Instrument remappedIns, Instrument ins, boolean useAsFamilyDefault) throws GMRemapTable.InvalidMappingException
      Set the mapped instrument for remappedIns.
      Parameters:
      remappedIns - Must be a GM1Instrument or the special DRUMS/PERCUSSION static instances.
      ins - Can be null. If remappedIns is one of the special DRUMS/PERCUSSION instances, ins must be a Drums/Perc instrument with a GM compatible DrumsKit.KeyMap. ins must belong to the associated MidiSynth. If not null must be an instrument from the associated MidiSynth.
      useAsFamilyDefault - If true ins will be also the default instrument for the remappedIns's family. Not used if remappedIns is one of the special DRUMS/PERCUSSION instances.
      Throws:
      GMRemapTable.InvalidMappingException - If arguments are invalid. The exception error message can be used for user notification.
    • getInstrument

      public Instrument getInstrument(Family family)
      Get the mapped instrument for the specified instrument family.
      Parameters:
      family -
      Returns:
      Null if no mapping defined for this family.
    • saveAsString

      public String saveAsString()
    • loadFromString

      public static GMRemapTable loadFromString(MidiSynth midiSynth, String s) throws IOException
      Throws:
      IOException
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener l)
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener l)