linuxsampler 2.3.1
|
Mapping MIDI bank/program numbers with real instruments. More...
#include <MidiInstrumentMapper.h>
Classes | |
struct | entry_t |
Defines the instrument and settings a MIDI bank MSB, LSB, program triple ought to be mapped to. More... | |
Public Types | |
enum | mode_t { ON_DEMAND = 0 , ON_DEMAND_HOLD = 1 , PERSISTENT = 2 , VOID = 127 , DONTCARE = 127 } |
Defines the life-time strategy for an instrument. More... | |
Static Public Member Functions | |
static void | AddMidiInstrumentCountListener (MidiInstrumentCountListener *l) |
Registers the specified listener to be notified when the number of MIDI instruments on a particular MIDI instrument map is changed. | |
static void | RemoveMidiInstrumentCountListener (MidiInstrumentCountListener *l) |
Removes the specified listener. | |
static void | AddMidiInstrumentInfoListener (MidiInstrumentInfoListener *l) |
Registers the specified listener to be notified when a MIDI instrument in a MIDI instrument map is changed. | |
static void | RemoveMidiInstrumentInfoListener (MidiInstrumentInfoListener *l) |
Removes the specified listener. | |
static void | AddMidiInstrumentMapCountListener (MidiInstrumentMapCountListener *l) |
Registers the specified listener to be notified when the number of MIDI instrument maps is changed. | |
static void | RemoveMidiInstrumentMapCountListener (MidiInstrumentMapCountListener *l) |
Removes the specified listener. | |
static void | AddMidiInstrumentMapInfoListener (MidiInstrumentMapInfoListener *l) |
Registers the specified listener to be notified when the settings of a MIDI instrument map are changed. | |
static void | RemoveMidiInstrumentMapInfoListener (MidiInstrumentMapInfoListener *l) |
Removes the specified listener. | |
static void | AddOrReplaceEntry (int Map, midi_prog_index_t Index, entry_t Entry, bool bInBackground=false) throw (Exception) |
Adds a new entry to the given MIDI instrument map in case an entry with Index does not exist yet, otherwise it will replace the existing entry. | |
static entry_t | GetEntry (int Map, uint MidiBank, uint MidiProg) |
Gets an entry from the MIDI instrument map. | |
static void | RemoveEntry (int Map, midi_prog_index_t Index) |
Remove an existing entry from the MIDI instrument map. | |
static void | RemoveAllEntries (int Map) |
Clear the whole given MIDI instrument map, that is delete all its entries. | |
static std::map< midi_prog_index_t, entry_t > | Entries (int Map) throw (Exception) |
Returns the currently existing MIDI instrument map entries of the given map with their current settings. | |
static std::vector< int > | Maps () |
Returns the IDs of all currently existing MIDI instrument maps. | |
static int | AddMap (String MapName="") throw (Exception) |
Create a new MIDI instrument map. | |
static String | MapName (int Map) throw (Exception) |
Returns the custom name of the given map. | |
static void | RenameMap (int Map, String NewName) throw (Exception) |
Rename the given, already existing map. | |
static void | RemoveMap (int Map) |
Delete the given map. | |
static void | RemoveAllMaps () |
Completely delete all existing maps. | |
static int | GetMapCount () |
Returns amount of currently available MIDI instrument maps. | |
static int | GetInstrumentCount () |
Returns the amount of currently available MIDI instruments in all maps. | |
static int | GetInstrumentCount (int Map) |
Returns the amount of currently available MIDI instruments in the specified map. | |
static int | GetDefaultMap () |
Gets the ID of the default map. | |
static void | SetDefaultMap (int MapId) |
Sets the default map. | |
Static Protected Member Functions | |
static void | fireMidiInstrumentCountChanged (int MapId, int NewCount) |
Notifies listeners that the number of MIDI instruments on the specified MIDI instrument map has been changed. | |
static void | fireMidiInstrumentInfoChanged (int MapId, int Bank, int Program) |
Notifies listeners that a MIDI instrument in a MIDI instrument map is changed. | |
static void | fireMidiInstrumentMapCountChanged (int NewCount) |
Notifies listeners that the number of MIDI instrument maps has been changed. | |
static void | fireMidiInstrumentMapInfoChanged (int MapId) |
Notifies listeners that the settings of a MIDI instrument map are changed. | |
static optional< entry_t > | GetEntry (int Map, midi_prog_index_t Index) |
Friends | |
class | EngineChannel |
Mapping MIDI bank/program numbers with real instruments.
By default (that is on startup) the sampler will simply ignore all MIDI program change messages. The MidiInstrumentMapper allows to map arbitrary (MIDI bank MSB, MIDI bank LSB, MIDI program) triples with an actual (Sampler Engine, Instrument File, Index) triple, so the sampler knows which instrument to load on the respective MIDI program change messages.
The sampler allows to manage arbitrary amount of MIDI instrument maps. For example you might create (at least) two MIDI instrument maps: one for "normal" instruments and one for drumkits.
Definition at line 50 of file MidiInstrumentMapper.h.
Defines the life-time strategy for an instrument.
Enumerator | |
---|---|
ON_DEMAND | Instrument will be loaded when needed, freed once not needed anymore. |
ON_DEMAND_HOLD | Instrument will be loaded when needed and kept even if not needed anymore. |
PERSISTENT | Instrument will immediately be loaded and kept all the time. |
VOID |
|
DONTCARE | Don't care, let it up to the InstrumentManager to decide for an appropriate LoadMode. |
Definition at line 55 of file MidiInstrumentMapper.h.
|
static |
Create a new MIDI instrument map.
Optionally you can assign a custom name for the map. Map names don't have to be unique.
MapName | - (optional) name for the map |
Exception | - if there's no free map ID left |
|
static |
Registers the specified listener to be notified when the number of MIDI instruments on a particular MIDI instrument map is changed.
|
static |
Registers the specified listener to be notified when a MIDI instrument in a MIDI instrument map is changed.
|
static |
Registers the specified listener to be notified when the number of MIDI instrument maps is changed.
|
static |
Registers the specified listener to be notified when the settings of a MIDI instrument map are changed.
|
static |
Adds a new entry to the given MIDI instrument map in case an entry with Index does not exist yet, otherwise it will replace the existing entry.
Note that some given settings might simply be ignored or might change the settings of other entries in the map (i.e. because another instrument in the map is part of the same file and the respective sampler engine does not allow to use different LoadModes for instruments of the same file). Note that in case of a PERSISTENT LoadMode argument the given instrument will immediately be loaded, that means by default this method will block until the whole instrument was loaded completely. You can override this behavior by setting bInBackground to true, so the instrument will be loaded in a separate thread (in that case you won't catch loading errors though, i.e. if the file does not exist or might be corrupt for example).
Map | - map index |
Index | - unique index of the new entry to add |
Entry | - the actual instrument and settings |
bInBackground | - avoid this method to block for long time |
Exception | - if the given map or engine type does not exist or instrument loading failed |
|
static |
Returns the currently existing MIDI instrument map entries of the given map with their current settings.
Map | - map index |
Exception | - in case Map does not exist |
|
staticprotected |
Notifies listeners that the number of MIDI instruments on the specified MIDI instrument map has been changed.
MapId | The numerical ID of the MIDI instrument map. |
NewCount | The new number of MIDI instruments. |
|
staticprotected |
Notifies listeners that a MIDI instrument in a MIDI instrument map is changed.
MapId | The numerical ID of the MIDI instrument map. |
Bank | The index of the MIDI bank, containing the instrument. |
Program | The MIDI program number of the instrument. |
|
staticprotected |
Notifies listeners that the number of MIDI instrument maps has been changed.
NewCount | The new number of MIDI instrument maps. |
|
staticprotected |
Notifies listeners that the settings of a MIDI instrument map are changed.
Gets the ID of the default map.
For now, the default map is the first available map. When the default map is removed, the default map becomes the next available map.
|
staticprotected |
|
static |
Gets an entry from the MIDI instrument map.
Map | - map index |
Index | - index of entry to retrieve |
Returns the amount of currently available MIDI instruments in all maps.
Map | - ID of the map |
Returns the amount of currently available MIDI instruments in the specified map.
Map | - ID of the map |
Returns amount of currently available MIDI instrument maps.
Returns the custom name of the given map.
Map | - map index |
Exception | - if given map does not exist |
Returns the IDs of all currently existing MIDI instrument maps.
Clear the whole given MIDI instrument map, that is delete all its entries.
Map | - map index |
Completely delete all existing maps.
|
static |
Remove an existing entry from the MIDI instrument map.
Map | - map index |
Index | - index of entry to delete |
Delete the given map.
Map | - ID of the map to delete |
|
static |
Removes the specified listener.
|
static |
Removes the specified listener.
|
static |
Removes the specified listener.
|
static |
Removes the specified listener.
|
static |
Rename the given, already existing map.
Map names don't have to be unique.
Map | - map index |
NewName | - the map's new name to be assigned |
Exception | - if the given map does not exist |
Sets the default map.
MapId | The ID of the new default map. |
|
friend |
Definition at line 288 of file MidiInstrumentMapper.h.