140 |
RTList<Event>::Iterator& itNoteOnEvent, |
RTList<Event>::Iterator& itNoteOnEvent, |
141 |
bool HandleKeyGroupConflicts |
bool HandleKeyGroupConflicts |
142 |
) { |
) { |
143 |
|
NoteIterator itNote = GetNotePool()->fromID(itNoteOnEvent->Param.Note.ID); |
144 |
|
if (!itNote) { |
145 |
|
dmsg(1,("gig::Engine: No Note object for triggering new voices!\n")); |
146 |
|
return; |
147 |
|
} |
148 |
|
|
149 |
EngineChannel* pChannel = static_cast<EngineChannel*>(pEngineChannel); |
EngineChannel* pChannel = static_cast<EngineChannel*>(pEngineChannel); |
150 |
|
|
151 |
// first, get total amount of required voices (dependant on amount of layers) |
// first, get total amount of required voices (dependant on amount of layers) |
152 |
::gig::Region* pRegion = pChannel->pInstrument->GetRegion(itNoteOnEvent->Param.Note.Key); |
// (using the note's MIDI note number instead of the MIDI event's one, |
153 |
|
// because an instrument script might have modified the note number) |
154 |
|
::gig::Region* pRegion = pChannel->pInstrument->GetRegion(itNote->cause.Param.Note.Key); |
155 |
if (!pRegion || RegionSuspended(pRegion)) |
if (!pRegion || RegionSuspended(pRegion)) |
156 |
return; |
return; |
157 |
const int voicesRequired = pRegion->Layers; |
const int voicesRequired = pRegion->Layers; |
158 |
if (voicesRequired <= 0) |
if (voicesRequired <= 0) |
159 |
return; |
return; |
160 |
|
|
|
NoteIterator itNote = GetNotePool()->fromID(itNoteOnEvent->Param.Note.ID); |
|
|
if (!itNote) { |
|
|
dmsg(1,("gig::Engine: No Note object for triggering new voices!\n")); |
|
|
return; |
|
|
} |
|
|
|
|
161 |
// now launch the required amount of voices |
// now launch the required amount of voices |
162 |
for (int i = 0; i < voicesRequired; i++) { |
for (int i = 0; i < voicesRequired; i++) { |
163 |
VoiceIterator itNewVoice = |
VoiceIterator itNewVoice = |
171 |
LinuxSampler::EngineChannel* pEngineChannel, |
LinuxSampler::EngineChannel* pEngineChannel, |
172 |
RTList<Event>::Iterator& itNoteOffEvent |
RTList<Event>::Iterator& itNoteOffEvent |
173 |
) { |
) { |
174 |
|
NoteIterator itNote = GetNotePool()->fromID(itNoteOffEvent->Param.Note.ID); |
175 |
|
if (!itNote) { |
176 |
|
dmsg(1,("gig::Engine: No Note object for triggering new release voices!\n")); |
177 |
|
return; |
178 |
|
} |
179 |
|
|
180 |
EngineChannel* pChannel = static_cast<EngineChannel*>(pEngineChannel); |
EngineChannel* pChannel = static_cast<EngineChannel*>(pEngineChannel); |
181 |
MidiKey* pKey = &pChannel->pMIDIKeyInfo[itNoteOffEvent->Param.Note.Key]; |
MidiKey* pKey = &pChannel->pMIDIKeyInfo[itNoteOffEvent->Param.Note.Key]; |
182 |
// first, get total amount of required voices (dependant on amount of layers) |
// first, get total amount of required voices (dependant on amount of layers) |
183 |
::gig::Region* pRegion = pChannel->pInstrument->GetRegion(itNoteOffEvent->Param.Note.Key); |
// (using the note's MIDI note number instead of the MIDI event's one, |
184 |
|
// because an instrument script might have modified the note number) |
185 |
|
::gig::Region* pRegion = pChannel->pInstrument->GetRegion(itNote->cause.Param.Note.Key); |
186 |
if (!pRegion) |
if (!pRegion) |
187 |
return; |
return; |
188 |
const int voicesRequired = pRegion->Layers; |
const int voicesRequired = pRegion->Layers; |
189 |
if (voicesRequired <= 0) |
if (voicesRequired <= 0) |
190 |
return; |
return; |
191 |
|
|
|
NoteIterator itNote = GetNotePool()->fromID(itNoteOffEvent->Param.Note.ID); |
|
|
if (!itNote) { |
|
|
dmsg(1,("gig::Engine: No Note object for triggering new release voices!\n")); |
|
|
return; |
|
|
} |
|
|
|
|
192 |
// MIDI note-on velocity is used instead of note-off velocity |
// MIDI note-on velocity is used instead of note-off velocity |
193 |
itNoteOffEvent->Param.Note.Velocity = pKey->Velocity; |
itNoteOffEvent->Param.Note.Velocity = pKey->Velocity; |
194 |
|
|
209 |
bool VoiceStealing, |
bool VoiceStealing, |
210 |
bool HandleKeyGroupConflicts |
bool HandleKeyGroupConflicts |
211 |
) { |
) { |
212 |
|
NoteIterator itNote = GetNotePool()->fromID(itNoteOnEvent->Param.Note.ID); |
213 |
|
if (!itNote) { |
214 |
|
dmsg(1,("gig::Engine: No Note object for launching voices!\n")); |
215 |
|
return Pool<Voice>::Iterator(); |
216 |
|
} |
217 |
|
|
218 |
EngineChannel* pChannel = static_cast<EngineChannel*>(pEngineChannel); |
EngineChannel* pChannel = static_cast<EngineChannel*>(pEngineChannel); |
219 |
|
// the note's MIDI note number might differ from the event's note number |
220 |
|
// because a script might have modified the note's note number |
221 |
int MIDIKey = itNoteOnEvent->Param.Note.Key; |
int MIDIKey = itNoteOnEvent->Param.Note.Key; |
222 |
|
int NoteKey = itNote->cause.Param.Note.Key; |
223 |
//EngineChannel::MidiKey* pKey = &pChannel->pMIDIKeyInfo[MIDIKey]; |
//EngineChannel::MidiKey* pKey = &pChannel->pMIDIKeyInfo[MIDIKey]; |
224 |
::gig::Region* pRegion = pChannel->pInstrument->GetRegion(MIDIKey); |
::gig::Region* pRegion = pChannel->pInstrument->GetRegion(NoteKey); |
225 |
|
|
226 |
// if nothing defined for this key |
// if nothing defined for this key |
227 |
if (!pRegion) return Pool<Voice>::Iterator(); // nothing to do |
if (!pRegion) return Pool<Voice>::Iterator(); // nothing to do |
246 |
DimValues[i] = iLayer; |
DimValues[i] = iLayer; |
247 |
break; |
break; |
248 |
case ::gig::dimension_velocity: |
case ::gig::dimension_velocity: |
249 |
DimValues[i] = itNoteOnEvent->Param.Note.Velocity; |
DimValues[i] = itNote->cause.Param.Note.Velocity; |
250 |
break; |
break; |
251 |
case ::gig::dimension_channelaftertouch: |
case ::gig::dimension_channelaftertouch: |
252 |
DimValues[i] = pChannel->ControllerTable[128]; |
DimValues[i] = pChannel->ControllerTable[128]; |
352 |
// change has occured between note on and off) |
// change has occured between note on and off) |
353 |
if (ReleaseTriggerVoice && !(VoiceType & Voice::type_release_trigger)) return Pool<Voice>::Iterator(); |
if (ReleaseTriggerVoice && !(VoiceType & Voice::type_release_trigger)) return Pool<Voice>::Iterator(); |
354 |
|
|
|
NoteIterator itNote = GetNotePool()->fromID(itNoteOnEvent->Param.Note.ID); |
|
|
|
|
355 |
::gig::DimensionRegion* pDimRgn; |
::gig::DimensionRegion* pDimRgn; |
356 |
if (!itNote->Format.Gig.DimMask) { // normal case ... |
if (!itNote->Format.Gig.DimMask) { // normal case ... |
357 |
pDimRgn = pRegion->GetDimensionRegionByValue(DimValues); |
pDimRgn = pRegion->GetDimensionRegionByValue(DimValues); |