25 |
#define __LS_MIDIINPUTPORT_H__ |
#define __LS_MIDIINPUTPORT_H__ |
26 |
|
|
27 |
#include "../../common/global.h" |
#include "../../common/global.h" |
28 |
|
#include "../../common/Mutex.h" |
29 |
#include "../../common/LinuxSamplerException.h" |
#include "../../common/LinuxSamplerException.h" |
30 |
#include "../DeviceParameter.h" |
#include "../DeviceParameter.h" |
31 |
#include "MidiInputDevice.h" |
#include "MidiInputDevice.h" |
102 |
|
|
103 |
/** |
/** |
104 |
* Disconnect given sampler engine from this MIDI input device. |
* Disconnect given sampler engine from this MIDI input device. |
105 |
|
* If the given engine was not connected with this device, |
106 |
|
* nothing happens. |
107 |
* |
* |
108 |
* @param pEngine - sampler engine |
* @param pEngine - sampler engine |
109 |
*/ |
*/ |
185 |
|
|
186 |
/** |
/** |
187 |
* Should be called by the implementing MIDI input device |
* Should be called by the implementing MIDI input device |
188 |
|
* whenever a program change event arrived, this will cause the |
189 |
|
* appropriate sampler channel to be connected with this MIDI |
190 |
|
* device. |
191 |
|
* |
192 |
|
* For example consider a program change event on MIDI channel |
193 |
|
* 3 for program number 18. This would cause this MIDI input |
194 |
|
* device to be connected to sampler channel 18 and would cause |
195 |
|
* sampler channel 18 to listen to MIDI channel 3. |
196 |
|
* |
197 |
|
* This is the current, general implementation of program |
198 |
|
* change events. It might change in future, e.g to allow |
199 |
|
* sampler engines to allow by themselfes how to act on a |
200 |
|
* program change event. |
201 |
|
* |
202 |
|
* @param Program - sampler channel to connect to this MIDI |
203 |
|
* input device |
204 |
|
* @param MidiChannel - MIDI channel on which sampler channel |
205 |
|
* \a Program should listen to |
206 |
|
*/ |
207 |
|
void DispatchProgramChange(uint8_t Program, uint MidiChannel); |
208 |
|
|
209 |
|
/** |
210 |
|
* Should be called by the implementing MIDI input device |
211 |
* whenever a system exclusive message arrived, this will cause |
* whenever a system exclusive message arrived, this will cause |
212 |
* the message to be forwarded to all connected engines. |
* the message to be forwarded to all connected engines. |
213 |
* |
* |
221 |
int portNumber; |
int portNumber; |
222 |
std::map<String,DeviceRuntimeParameter*> Parameters; ///< All port parameters. |
std::map<String,DeviceRuntimeParameter*> Parameters; ///< All port parameters. |
223 |
std::set<EngineChannel*> MidiChannelMap[17]; ///< Contains the list of connected engines for each MIDI channel, where index 0 points to the list of engines which are connected to all MIDI channels. Usually it's not necessary for the descendant to use this map, instead it should just use the Dispatch* methods. |
std::set<EngineChannel*> MidiChannelMap[17]; ///< Contains the list of connected engines for each MIDI channel, where index 0 points to the list of engines which are connected to all MIDI channels. Usually it's not necessary for the descendant to use this map, instead it should just use the Dispatch* methods. |
224 |
|
Mutex MidiChannelMapMutex; ///< Used to protect the MidiChannelMap from being used at the same time by different threads. |
225 |
|
|
226 |
/** |
/** |
227 |
* Constructor |
* Constructor |
234 |
virtual ~MidiInputPort(); |
virtual ~MidiInputPort(); |
235 |
|
|
236 |
friend class MidiInputDevice; |
friend class MidiInputDevice; |
237 |
|
|
238 |
|
private: |
239 |
|
EngineChannel* pPreviousProgramChangeEngineChannel; ///< Points to the engine channel which was connected by the previous DispatchProgramChange() call. |
240 |
}; |
}; |
241 |
|
|
242 |
} // namsepace LinuxSampler |
} // namsepace LinuxSampler |