28 |
#include "../../common/Mutex.h" |
#include "../../common/Mutex.h" |
29 |
#include "../../common/LinuxSamplerException.h" |
#include "../../common/LinuxSamplerException.h" |
30 |
#include "../DeviceParameter.h" |
#include "../DeviceParameter.h" |
31 |
|
#include "midi.h" |
32 |
#include "MidiInputDevice.h" |
#include "MidiInputDevice.h" |
33 |
#include "../../engines/common/EngineChannel.h" |
#include "../../engines/common/EngineChannel.h" |
34 |
|
#include "../../common/SynchronizedConfig.h" |
35 |
|
|
36 |
namespace LinuxSampler { |
namespace LinuxSampler { |
37 |
|
|
38 |
// just symbol prototyping |
// just symbol prototyping |
39 |
class MidiInputDevice; |
class MidiInputDevice; |
40 |
|
class EngineChannel; |
41 |
|
|
42 |
class MidiInputPort { |
class MidiInputPort { |
43 |
public: |
public: |
45 |
///////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////// |
46 |
// type definitions |
// type definitions |
47 |
|
|
|
/** |
|
|
* MIDI channels |
|
|
*/ |
|
|
enum midi_chan_t { |
|
|
midi_chan_1 = 0, |
|
|
midi_chan_2 = 1, |
|
|
midi_chan_3 = 2, |
|
|
midi_chan_4 = 3, |
|
|
midi_chan_5 = 4, |
|
|
midi_chan_6 = 5, |
|
|
midi_chan_7 = 6, |
|
|
midi_chan_8 = 7, |
|
|
midi_chan_9 = 8, |
|
|
midi_chan_10 = 9, |
|
|
midi_chan_11 = 10, |
|
|
midi_chan_12 = 11, |
|
|
midi_chan_13 = 12, |
|
|
midi_chan_14 = 13, |
|
|
midi_chan_15 = 14, |
|
|
midi_chan_16 = 15, |
|
|
midi_chan_all = 16 |
|
|
}; |
|
|
|
|
48 |
/** MIDI Port Parameter 'NAME' |
/** MIDI Port Parameter 'NAME' |
49 |
* |
* |
50 |
* Used to assign an arbitrary name to the MIDI port. |
* Used to assign an arbitrary name to the MIDI port. |
105 |
*/ |
*/ |
106 |
std::map<String,DeviceRuntimeParameter*> PortParameters(); |
std::map<String,DeviceRuntimeParameter*> PortParameters(); |
107 |
|
|
108 |
|
/** |
109 |
|
* Registers that an engine wants to have sysex messages. |
110 |
|
*/ |
111 |
|
static void AddSysexListener(Engine* engine); |
112 |
|
|
113 |
|
/** |
114 |
|
* Removes engine from list of engines getting sysex |
115 |
|
* messages. |
116 |
|
* |
117 |
|
* @returns true if engine was removed, false if it wasn't |
118 |
|
* present in the list. |
119 |
|
*/ |
120 |
|
static bool RemoveSysexListener(Engine* engine); |
121 |
|
|
122 |
|
|
123 |
///////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////// |
211 |
MidiInputDevice* pDevice; |
MidiInputDevice* pDevice; |
212 |
int portNumber; |
int portNumber; |
213 |
std::map<String,DeviceRuntimeParameter*> Parameters; ///< All port parameters. |
std::map<String,DeviceRuntimeParameter*> Parameters; ///< All port parameters. |
214 |
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. |
typedef std::set<EngineChannel*> MidiChannelMap_t[17]; |
215 |
|
SynchronizedConfig<MidiChannelMap_t> MidiChannelMap; ///< 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. |
216 |
|
SynchronizedConfig<MidiChannelMap_t>::Reader MidiChannelMapReader; ///< MIDI thread access to MidiChannelMap |
217 |
Mutex MidiChannelMapMutex; ///< Used to protect the MidiChannelMap from being used at the same time by different threads. |
Mutex MidiChannelMapMutex; ///< Used to protect the MidiChannelMap from being used at the same time by different threads. |
218 |
|
SynchronizedConfig<std::set<Engine*> >::Reader SysexListenersReader; ///< MIDI thread access to SysexListeners |
219 |
|
|
220 |
/** |
/** |
221 |
* Constructor |
* Constructor |
228 |
virtual ~MidiInputPort(); |
virtual ~MidiInputPort(); |
229 |
|
|
230 |
friend class MidiInputDevice; |
friend class MidiInputDevice; |
231 |
|
|
232 |
private: |
private: |
233 |
EngineChannel* pPreviousProgramChangeEngineChannel; ///< Points to the engine channel which was connected by the previous DispatchProgramChange() call. |
EngineChannel* pPreviousProgramChangeEngineChannel; ///< Points to the engine channel which was connected by the previous DispatchProgramChange() call. |
234 |
|
static SynchronizedConfig<std::set<Engine*> > SysexListeners; ///< All engines that are listening to sysex messages. |
235 |
}; |
}; |
236 |
|
|
237 |
} // namsepace LinuxSampler |
} // namsepace LinuxSampler |