--- linuxsampler/trunk/src/drivers/midi/MidiInstrumentMapper.h 2007/03/25 13:21:45 1129 +++ linuxsampler/trunk/src/drivers/midi/MidiInstrumentMapper.h 2007/03/25 18:59:14 1130 @@ -21,13 +21,14 @@ #ifndef __LS_MIDIINSTRUMENTMAPPER_H__ #define __LS_MIDIINSTRUMENTMAPPER_H__ +#include + +#include "midi.h" +#include "../../EventListeners.h" #include "../../common/global.h" #include "../../common/optional.h" -#include "midi.h" #include "../../engines/InstrumentManager.h" -#include - namespace LinuxSampler { // just symbol prototyping @@ -72,6 +73,50 @@ }; /** + * Registers the specified listener to be notified when the number + * of MIDI instruments on a particular MIDI instrument map is changed. + */ + static void AddMidiInstrumentCountListener(MidiInstrumentCountListener* l); + + /** + * Removes the specified listener. + */ + static void RemoveMidiInstrumentCountListener(MidiInstrumentCountListener* l); + + /** + * Registers the specified listener to be notified when + * a MIDI instrument in a MIDI instrument map is changed. + */ + static void AddMidiInstrumentInfoListener(MidiInstrumentInfoListener* l); + + /** + * Removes the specified listener. + */ + static void RemoveMidiInstrumentInfoListener(MidiInstrumentInfoListener* l); + + /** + * Registers the specified listener to be notified + * when the number of MIDI instrument maps is changed. + */ + static void AddMidiInstrumentMapCountListener(MidiInstrumentMapCountListener* l); + + /** + * Removes the specified listener. + */ + static void RemoveMidiInstrumentMapCountListener(MidiInstrumentMapCountListener* l); + + /** + * Registers the specified listener to be notified when + * the settings of a MIDI instrument map are changed. + */ + static void AddMidiInstrumentMapInfoListener(MidiInstrumentMapInfoListener* l); + + /** + * Removes the specified listener. + */ + static void RemoveMidiInstrumentMapInfoListener(MidiInstrumentMapInfoListener* l); + + /** * Adds a new entry to the given MIDI instrument map in case * an entry with \a Index does not exist yet, otherwise it will * replace the existing entry. Note that some given settings @@ -169,8 +214,42 @@ static void RemoveAllMaps(); protected: + /** + * Notifies listeners that the number of MIDI instruments + * on the specified MIDI instrument map has been changed. + * @param MapId The numerical ID of the MIDI instrument map. + * @param NewCount The new number of MIDI instruments. + */ + static void fireMidiInstrumentCountChanged(int MapId, int NewCount); + + /** + * Notifies listeners that a MIDI instrument + * in a MIDI instrument map is changed. + * @param MapId The numerical ID of the MIDI instrument map. + * @param Bank The index of the MIDI bank, containing the instrument. + * @param Program The MIDI program number of the instrument. + */ + static void fireMidiInstrumentInfoChanged(int MapId, int Bank, int Program); + + /** + * Notifies listeners that the number of MIDI instrument maps has been changed. + * @param NewCount The new number of MIDI instrument maps. + */ + static void fireMidiInstrumentMapCountChanged(int NewCount); + + /** + * Notifies listeners that the settings of a MIDI instrument map are changed. + */ + static void fireMidiInstrumentMapInfoChanged(int MapId); + static optional GetEntry(int Map, midi_prog_index_t Index); // shall only be used by MidiInputPort ATM (see source comment) friend class MidiInputPort; // allow MidiInputPort to access GetEntry() + + private: + static ListenerList llMidiInstrumentCountListeners; + static ListenerList llMidiInstrumentInfoListeners; + static ListenerList llMidiInstrumentMapCountListeners; + static ListenerList llMidiInstrumentMapInfoListeners; }; } // namespace LinuxSampler