Package org.jjazz.outputsynth.api
Class GMRemapTable
java.lang.Object
org.jjazz.outputsynth.api.GMRemapTable
- All Implemented Interfaces:
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Specific exception for this object. -
Field Summary
Modifier and TypeFieldDescriptionstatic final Instrument
Special instances for the Drums/Percussion, since GM1 does not define them.static final Instrument
static final String
oldValue=Family, newValue=Instrumentstatic final String
oldValue=GM1Instrument or the special DRUMS/PERCUSSION static instances, newValue=Instrument -
Constructor Summary
ConstructorDescriptionGMRemapTable
(MidiSynth midiSynth) Create an instance to remap GM instruments to instruments from the specified MidiSynth. -
Method Summary
Modifier and TypeMethodDescriptionvoid
static void
checkRemappedInstrument
(Instrument remappedIns) Check that the specified remapped Instrument is valid.void
clear()
Remove all mappings.The map which associates a GM family to an instrument from the associated MidiSynth.getInstrument
(Instrument remappedIns) Get the mapped instrument for remappedIns.getInstrument
(Family family) Get the mapped instrument for the specified instrument family.The map which associates a GM instrument (+ the special drums instances) to an instrument from the associated MidiSynth.The associated MidiSynth.static GMRemapTable
loadFromString
(MidiSynth midiSynth, String s) void
void
set
(GMRemapTable rt) Set the mappings from another GMRemapTable which must share the same MidiSynth.void
setInstrument
(Instrument remappedIns, Instrument ins, boolean useAsFamilyDefault) Set the mapped instrument for remappedIns.
-
Field Details
-
DRUMS_INSTRUMENT
Special instances for the Drums/Percussion, since GM1 does not define them. -
PERCUSSION_INSTRUMENT
-
PROP_FAMILY
oldValue=Family, newValue=Instrument- See Also:
-
PROP_INSTRUMENT
oldValue=GM1Instrument or the special DRUMS/PERCUSSION static instances, newValue=Instrument- See Also:
-
-
Constructor Details
-
GMRemapTable
Create an instance to remap GM instruments to instruments from the specified MidiSynth.- Parameters:
midiSynth
-
-
-
Method Details
-
set
Set the mappings from another GMRemapTable which must share the same MidiSynth.- Parameters:
rt
- Must share the same MidiSynth that this instance.
-
getMidiSynth
The associated MidiSynth.- Returns:
-
getInstrumentMap
The map which associates a GM instrument (+ the special drums instances) to an instrument from the associated MidiSynth.- Returns:
-
getFamilyInstrumentMap
The map which associates a GM family to an instrument from the associated MidiSynth.- Returns:
-
clear
public void clear()Remove all mappings. -
checkRemappedInstrument
Check that the specified remapped Instrument is valid.- Parameters:
remappedIns
-- Throws:
IllegalArgumentException
- If invalid value
-
getInstrument
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
Get the mapped instrument for the specified instrument family.- Parameters:
family
-- Returns:
- Null if no mapping defined for this family.
-
saveAsString
-
loadFromString
- Throws:
IOException
-
addPropertyChangeListener
-
removePropertyChangeListener
-