21 |
#ifndef __LS_MIDIINSTRUMENTMAPPER_H__ |
#ifndef __LS_MIDIINSTRUMENTMAPPER_H__ |
22 |
#define __LS_MIDIINSTRUMENTMAPPER_H__ |
#define __LS_MIDIINSTRUMENTMAPPER_H__ |
23 |
|
|
24 |
|
#include <map> |
25 |
|
|
26 |
|
#include "midi.h" |
27 |
|
#include "../../EventListeners.h" |
28 |
#include "../../common/global.h" |
#include "../../common/global.h" |
29 |
#include "../../common/optional.h" |
#include "../../common/optional.h" |
|
#include "midi.h" |
|
30 |
#include "../../engines/InstrumentManager.h" |
#include "../../engines/InstrumentManager.h" |
31 |
|
|
|
#include <map> |
|
|
|
|
32 |
namespace LinuxSampler { |
namespace LinuxSampler { |
33 |
|
|
34 |
// just symbol prototyping |
// just symbol prototyping |
73 |
}; |
}; |
74 |
|
|
75 |
/** |
/** |
76 |
|
* Registers the specified listener to be notified when the number |
77 |
|
* of MIDI instruments on a particular MIDI instrument map is changed. |
78 |
|
*/ |
79 |
|
static void AddMidiInstrumentCountListener(MidiInstrumentCountListener* l); |
80 |
|
|
81 |
|
/** |
82 |
|
* Removes the specified listener. |
83 |
|
*/ |
84 |
|
static void RemoveMidiInstrumentCountListener(MidiInstrumentCountListener* l); |
85 |
|
|
86 |
|
/** |
87 |
|
* Registers the specified listener to be notified when |
88 |
|
* a MIDI instrument in a MIDI instrument map is changed. |
89 |
|
*/ |
90 |
|
static void AddMidiInstrumentInfoListener(MidiInstrumentInfoListener* l); |
91 |
|
|
92 |
|
/** |
93 |
|
* Removes the specified listener. |
94 |
|
*/ |
95 |
|
static void RemoveMidiInstrumentInfoListener(MidiInstrumentInfoListener* l); |
96 |
|
|
97 |
|
/** |
98 |
|
* Registers the specified listener to be notified |
99 |
|
* when the number of MIDI instrument maps is changed. |
100 |
|
*/ |
101 |
|
static void AddMidiInstrumentMapCountListener(MidiInstrumentMapCountListener* l); |
102 |
|
|
103 |
|
/** |
104 |
|
* Removes the specified listener. |
105 |
|
*/ |
106 |
|
static void RemoveMidiInstrumentMapCountListener(MidiInstrumentMapCountListener* l); |
107 |
|
|
108 |
|
/** |
109 |
|
* Registers the specified listener to be notified when |
110 |
|
* the settings of a MIDI instrument map are changed. |
111 |
|
*/ |
112 |
|
static void AddMidiInstrumentMapInfoListener(MidiInstrumentMapInfoListener* l); |
113 |
|
|
114 |
|
/** |
115 |
|
* Removes the specified listener. |
116 |
|
*/ |
117 |
|
static void RemoveMidiInstrumentMapInfoListener(MidiInstrumentMapInfoListener* l); |
118 |
|
|
119 |
|
/** |
120 |
* Adds a new entry to the given MIDI instrument map in case |
* Adds a new entry to the given MIDI instrument map in case |
121 |
* an entry with \a Index does not exist yet, otherwise it will |
* an entry with \a Index does not exist yet, otherwise it will |
122 |
* replace the existing entry. Note that some given settings |
* replace the existing entry. Note that some given settings |
214 |
static void RemoveAllMaps(); |
static void RemoveAllMaps(); |
215 |
|
|
216 |
protected: |
protected: |
217 |
|
/** |
218 |
|
* Notifies listeners that the number of MIDI instruments |
219 |
|
* on the specified MIDI instrument map has been changed. |
220 |
|
* @param MapId The numerical ID of the MIDI instrument map. |
221 |
|
* @param NewCount The new number of MIDI instruments. |
222 |
|
*/ |
223 |
|
static void fireMidiInstrumentCountChanged(int MapId, int NewCount); |
224 |
|
|
225 |
|
/** |
226 |
|
* Notifies listeners that a MIDI instrument |
227 |
|
* in a MIDI instrument map is changed. |
228 |
|
* @param MapId The numerical ID of the MIDI instrument map. |
229 |
|
* @param Bank The index of the MIDI bank, containing the instrument. |
230 |
|
* @param Program The MIDI program number of the instrument. |
231 |
|
*/ |
232 |
|
static void fireMidiInstrumentInfoChanged(int MapId, int Bank, int Program); |
233 |
|
|
234 |
|
/** |
235 |
|
* Notifies listeners that the number of MIDI instrument maps has been changed. |
236 |
|
* @param NewCount The new number of MIDI instrument maps. |
237 |
|
*/ |
238 |
|
static void fireMidiInstrumentMapCountChanged(int NewCount); |
239 |
|
|
240 |
|
/** |
241 |
|
* Notifies listeners that the settings of a MIDI instrument map are changed. |
242 |
|
*/ |
243 |
|
static void fireMidiInstrumentMapInfoChanged(int MapId); |
244 |
|
|
245 |
static optional<entry_t> GetEntry(int Map, midi_prog_index_t Index); // shall only be used by MidiInputPort ATM (see source comment) |
static optional<entry_t> GetEntry(int Map, midi_prog_index_t Index); // shall only be used by MidiInputPort ATM (see source comment) |
246 |
friend class MidiInputPort; // allow MidiInputPort to access GetEntry() |
friend class MidiInputPort; // allow MidiInputPort to access GetEntry() |
247 |
|
|
248 |
|
private: |
249 |
|
static ListenerList<MidiInstrumentCountListener*> llMidiInstrumentCountListeners; |
250 |
|
static ListenerList<MidiInstrumentInfoListener*> llMidiInstrumentInfoListeners; |
251 |
|
static ListenerList<MidiInstrumentMapCountListener*> llMidiInstrumentMapCountListeners; |
252 |
|
static ListenerList<MidiInstrumentMapInfoListener*> llMidiInstrumentMapInfoListeners; |
253 |
}; |
}; |
254 |
|
|
255 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |