107 |
MidiChannelMapReader.Unlock(); |
MidiChannelMapReader.Unlock(); |
108 |
} |
} |
109 |
|
|
110 |
|
void MidiInputPort::DispatchNoteOn(uint8_t Key, uint8_t Velocity, uint MidiChannel, int32_t FragmentPos) { |
111 |
|
const MidiChannelMap_t& midiChannelMap = MidiChannelMapReader.Lock(); |
112 |
|
// dispatch event for engines listening to the same MIDI channel |
113 |
|
{ |
114 |
|
std::set<EngineChannel*>::iterator engineiter = midiChannelMap[MidiChannel].begin(); |
115 |
|
std::set<EngineChannel*>::iterator end = midiChannelMap[MidiChannel].end(); |
116 |
|
for (; engineiter != end; engineiter++) (*engineiter)->SendNoteOn(Key, Velocity, FragmentPos); |
117 |
|
} |
118 |
|
// dispatch event for engines listening to ALL MIDI channels |
119 |
|
{ |
120 |
|
std::set<EngineChannel*>::iterator engineiter = midiChannelMap[midi_chan_all].begin(); |
121 |
|
std::set<EngineChannel*>::iterator end = midiChannelMap[midi_chan_all].end(); |
122 |
|
for (; engineiter != end; engineiter++) (*engineiter)->SendNoteOn(Key, Velocity, FragmentPos); |
123 |
|
} |
124 |
|
MidiChannelMapReader.Unlock(); |
125 |
|
} |
126 |
|
|
127 |
void MidiInputPort::DispatchNoteOff(uint8_t Key, uint8_t Velocity, uint MidiChannel) { |
void MidiInputPort::DispatchNoteOff(uint8_t Key, uint8_t Velocity, uint MidiChannel) { |
128 |
const MidiChannelMap_t& midiChannelMap = MidiChannelMapReader.Lock(); |
const MidiChannelMap_t& midiChannelMap = MidiChannelMapReader.Lock(); |
129 |
// dispatch event for engines listening to the same MIDI channel |
// dispatch event for engines listening to the same MIDI channel |
141 |
MidiChannelMapReader.Unlock(); |
MidiChannelMapReader.Unlock(); |
142 |
} |
} |
143 |
|
|
144 |
|
void MidiInputPort::DispatchNoteOff(uint8_t Key, uint8_t Velocity, uint MidiChannel, int32_t FragmentPos) { |
145 |
|
const MidiChannelMap_t& midiChannelMap = MidiChannelMapReader.Lock(); |
146 |
|
// dispatch event for engines listening to the same MIDI channel |
147 |
|
{ |
148 |
|
std::set<EngineChannel*>::iterator engineiter = midiChannelMap[MidiChannel].begin(); |
149 |
|
std::set<EngineChannel*>::iterator end = midiChannelMap[MidiChannel].end(); |
150 |
|
for (; engineiter != end; engineiter++) (*engineiter)->SendNoteOff(Key, Velocity, FragmentPos); |
151 |
|
} |
152 |
|
// dispatch event for engines listening to ALL MIDI channels |
153 |
|
{ |
154 |
|
std::set<EngineChannel*>::iterator engineiter = midiChannelMap[midi_chan_all].begin(); |
155 |
|
std::set<EngineChannel*>::iterator end = midiChannelMap[midi_chan_all].end(); |
156 |
|
for (; engineiter != end; engineiter++) (*engineiter)->SendNoteOff(Key, Velocity, FragmentPos); |
157 |
|
} |
158 |
|
MidiChannelMapReader.Unlock(); |
159 |
|
} |
160 |
|
|
161 |
void MidiInputPort::DispatchPitchbend(int Pitch, uint MidiChannel) { |
void MidiInputPort::DispatchPitchbend(int Pitch, uint MidiChannel) { |
162 |
const MidiChannelMap_t& midiChannelMap = MidiChannelMapReader.Lock(); |
const MidiChannelMap_t& midiChannelMap = MidiChannelMapReader.Lock(); |
163 |
// dispatch event for engines listening to the same MIDI channel |
// dispatch event for engines listening to the same MIDI channel |
175 |
MidiChannelMapReader.Unlock(); |
MidiChannelMapReader.Unlock(); |
176 |
} |
} |
177 |
|
|
178 |
|
void MidiInputPort::DispatchPitchbend(int Pitch, uint MidiChannel, int32_t FragmentPos) { |
179 |
|
const MidiChannelMap_t& midiChannelMap = MidiChannelMapReader.Lock(); |
180 |
|
// dispatch event for engines listening to the same MIDI channel |
181 |
|
{ |
182 |
|
std::set<EngineChannel*>::iterator engineiter = midiChannelMap[MidiChannel].begin(); |
183 |
|
std::set<EngineChannel*>::iterator end = midiChannelMap[MidiChannel].end(); |
184 |
|
for (; engineiter != end; engineiter++) (*engineiter)->SendPitchbend(Pitch, FragmentPos); |
185 |
|
} |
186 |
|
// dispatch event for engines listening to ALL MIDI channels |
187 |
|
{ |
188 |
|
std::set<EngineChannel*>::iterator engineiter = midiChannelMap[midi_chan_all].begin(); |
189 |
|
std::set<EngineChannel*>::iterator end = midiChannelMap[midi_chan_all].end(); |
190 |
|
for (; engineiter != end; engineiter++) (*engineiter)->SendPitchbend(Pitch, FragmentPos); |
191 |
|
} |
192 |
|
MidiChannelMapReader.Unlock(); |
193 |
|
} |
194 |
|
|
195 |
void MidiInputPort::DispatchControlChange(uint8_t Controller, uint8_t Value, uint MidiChannel) { |
void MidiInputPort::DispatchControlChange(uint8_t Controller, uint8_t Value, uint MidiChannel) { |
196 |
const MidiChannelMap_t& midiChannelMap = MidiChannelMapReader.Lock(); |
const MidiChannelMap_t& midiChannelMap = MidiChannelMapReader.Lock(); |
197 |
// dispatch event for engines listening to the same MIDI channel |
// dispatch event for engines listening to the same MIDI channel |
208 |
} |
} |
209 |
MidiChannelMapReader.Unlock(); |
MidiChannelMapReader.Unlock(); |
210 |
} |
} |
211 |
|
|
212 |
|
void MidiInputPort::DispatchControlChange(uint8_t Controller, uint8_t Value, uint MidiChannel, int32_t FragmentPos) { |
213 |
|
const MidiChannelMap_t& midiChannelMap = MidiChannelMapReader.Lock(); |
214 |
|
// dispatch event for engines listening to the same MIDI channel |
215 |
|
{ |
216 |
|
std::set<EngineChannel*>::iterator engineiter = midiChannelMap[MidiChannel].begin(); |
217 |
|
std::set<EngineChannel*>::iterator end = midiChannelMap[MidiChannel].end(); |
218 |
|
for (; engineiter != end; engineiter++) (*engineiter)->SendControlChange(Controller, Value, FragmentPos); |
219 |
|
} |
220 |
|
// dispatch event for engines listening to ALL MIDI channels |
221 |
|
{ |
222 |
|
std::set<EngineChannel*>::iterator engineiter = midiChannelMap[midi_chan_all].begin(); |
223 |
|
std::set<EngineChannel*>::iterator end = midiChannelMap[midi_chan_all].end(); |
224 |
|
for (; engineiter != end; engineiter++) (*engineiter)->SendControlChange(Controller, Value, FragmentPos); |
225 |
|
} |
226 |
|
MidiChannelMapReader.Unlock(); |
227 |
|
} |
228 |
|
|
229 |
void MidiInputPort::DispatchSysex(void* pData, uint Size) { |
void MidiInputPort::DispatchSysex(void* pData, uint Size) { |
230 |
const std::set<Engine*> allEngines = SysexListenersReader.Lock(); |
const std::set<Engine*> allEngines = SysexListenersReader.Lock(); |