3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005-2008 Christian Schoenebeck * |
* Copyright (C) 2005-2022 Christian Schoenebeck * |
7 |
* Copyright (C) 2009-2010 Christian Schoenebeck and Grigor Iliev * |
* Copyright (C) 2009-2010 Grigor Iliev * |
8 |
* * |
* * |
9 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
10 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
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[itNote->cause.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 |
// (using the note's MIDI note number instead of the MIDI event's one, |
// (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) |
// because an instrument script might have modified the note number) |
190 |
return; |
return; |
191 |
|
|
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; |
// if note-off velocity is exactly zero (which means missing sensors |
194 |
|
// in keyboard), otherwise if note-off velocity is non-zero then use |
195 |
|
// note object instead of MIDI note-off event, since note-off velocity |
196 |
|
// might have been modified by RT instrument script |
197 |
|
const uint8_t vel = itNote->cause.Param.Note.Velocity ?: pKey->Velocity; |
198 |
|
itNote->cause.Param.Note.Velocity = vel; |
199 |
|
|
200 |
// now launch the required amount of voices |
// now launch the required amount of voices |
201 |
for (int i = 0; i < voicesRequired; i++) { |
for (int i = 0; i < voicesRequired; i++) { |