202 |
PostProcess(engineChannels[i]); |
PostProcess(engineChannels[i]); |
203 |
} |
} |
204 |
|
|
205 |
|
// Just for debugging: dump the amount of free Note objects to |
206 |
|
// the terminal (note due to the static variables being used, |
207 |
|
// this is currently just intended for debugging with only one |
208 |
|
// engine channel). |
209 |
|
#if (CONFIG_DEBUG_LEVEL >= 3) |
210 |
|
{ |
211 |
|
static int slice = 0; |
212 |
|
static int noteCount = -1; |
213 |
|
if (slice++ % 10 == 0) { |
214 |
|
int n = pNotePool->countFreeElements(); |
215 |
|
if (n != noteCount) { |
216 |
|
noteCount = n; |
217 |
|
dmsg(1,("[%d] free Note objects count = %d\n", slice / 10, n)); |
218 |
|
} |
219 |
|
} |
220 |
|
} |
221 |
|
#endif |
222 |
|
|
223 |
// empty the engine's event list for the next audio fragment |
// empty the engine's event list for the next audio fragment |
224 |
ClearEventLists(); |
ClearEventLists(); |
396 |
} |
} |
397 |
pVoicePool->clear(); |
pVoicePool->clear(); |
398 |
|
|
399 |
// (re)create event generator |
// update event generator |
400 |
if (pEventGenerator) delete pEventGenerator; |
pEventGenerator->SetSampleRate(pAudioOut->SampleRate()); |
|
pEventGenerator = new EventGenerator(pAudioOut->SampleRate()); |
|
401 |
|
|
402 |
dmsg(1,("Starting disk thread...")); |
dmsg(1,("Starting disk thread...")); |
403 |
pDiskThread->StartThread(); |
pDiskThread->StartThread(); |
756 |
// move new note to its host key |
// move new note to its host key |
757 |
MidiKey* pKey = &pChannel->pMIDIKeyInfo[itNewNote->hostKey]; |
MidiKey* pKey = &pChannel->pMIDIKeyInfo[itNewNote->hostKey]; |
758 |
itNewNote.moveToEndOf(pKey->pActiveNotes); |
itNewNote.moveToEndOf(pKey->pActiveNotes); |
759 |
|
pChannel->markKeyAsActive(pKey); |
760 |
|
|
761 |
// assign unique note ID of this new note to the original note on event |
// assign unique note ID of this new note to the original note on event |
762 |
itNoteOnEvent->Param.Note.ID = newNoteID; |
itNoteOnEvent->Param.Note.ID = newNoteID; |
1001 |
// script event object |
// script event object |
1002 |
RTList<ScriptEvent>::Iterator itScriptEvent = |
RTList<ScriptEvent>::Iterator itScriptEvent = |
1003 |
pChannel->pScript->pEvents->allocAppend(); |
pChannel->pScript->pEvents->allocAppend(); |
1004 |
|
// if event handler uses polyphonic variables, reset them |
1005 |
|
// to zero values before starting to execute the handler |
1006 |
|
if (pEventHandler->isPolyphonic()) |
1007 |
|
itScriptEvent->execCtx->resetPolyphonicData(); |
1008 |
ProcessScriptEvent( |
ProcessScriptEvent( |
1009 |
pChannel, itEvent, pEventHandler, itScriptEvent |
pChannel, itEvent, pEventHandler, itScriptEvent |
1010 |
); |
); |
1042 |
itScriptEvent->executionSlices = 0; |
itScriptEvent->executionSlices = 0; |
1043 |
itScriptEvent->ignoreAllWaitCalls = false; |
itScriptEvent->ignoreAllWaitCalls = false; |
1044 |
itScriptEvent->handlerType = pEventHandler->eventHandlerType(); |
itScriptEvent->handlerType = pEventHandler->eventHandlerType(); |
1045 |
|
itScriptEvent->parentHandlerID = 0; |
1046 |
|
itScriptEvent->childHandlerID[0] = 0; |
1047 |
|
itScriptEvent->autoAbortByParent = false; |
1048 |
|
itScriptEvent->forkIndex = 0; |
1049 |
// this is the native representation of the $EVENT_ID script variable |
// this is the native representation of the $EVENT_ID script variable |
1050 |
itScriptEvent->id = |
itScriptEvent->id = |
1051 |
(itEvent->Type == Event::type_note_on) |
(itEvent->Type == Event::type_note_on) |
1158 |
* @returns 0 on success, a value < 0 if no active voice could be picked for voice stealing |
* @returns 0 on success, a value < 0 if no active voice could be picked for voice stealing |
1159 |
*/ |
*/ |
1160 |
int StealVoice(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOnEvent) { |
int StealVoice(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOnEvent) { |
1161 |
|
dmsg(3,("StealVoice()\n")); |
1162 |
if (VoiceSpawnsLeft <= 0) { |
if (VoiceSpawnsLeft <= 0) { |
1163 |
dmsg(1,("Max. voice thefts per audio fragment reached (you may raise CONFIG_MAX_VOICES).\n")); |
dmsg(1,("Max. voice thefts per audio fragment reached (you may raise CONFIG_MAX_VOICES).\n")); |
1164 |
return -1; |
return -1; |
1183 |
int iChannelIndex; |
int iChannelIndex; |
1184 |
VoiceIterator itSelectedVoice; |
VoiceIterator itSelectedVoice; |
1185 |
|
|
1186 |
|
#if CONFIG_DEVMODE |
1187 |
|
EngineChannel* pBegin = NULL; // to detect endless loop |
1188 |
|
#endif |
1189 |
|
|
1190 |
// select engine channel |
// select engine channel |
1191 |
if (pLastStolenChannel) { |
if (pLastStolenChannel) { |
1192 |
pSelectedChannel = pLastStolenChannel; |
pSelectedChannel = pLastStolenChannel; |
1229 |
} |
} |
1230 |
|
|
1231 |
#if CONFIG_DEVMODE |
#if CONFIG_DEVMODE |
1232 |
EngineChannel* pBegin = pSelectedChannel; // to detect endless loop |
pBegin = pSelectedChannel; // to detect endless loop |
1233 |
#endif // CONFIG_DEVMODE |
#endif // CONFIG_DEVMODE |
1234 |
|
|
1235 |
while (true) { // iterate through engine channels |
while (true) { // iterate through engine channels |
1322 |
RTList<ScriptEvent>::Iterator itScriptEvent = |
RTList<ScriptEvent>::Iterator itScriptEvent = |
1323 |
pEngineChannel->pScript->pEvents->allocAppend(); |
pEngineChannel->pScript->pEvents->allocAppend(); |
1324 |
|
|
1325 |
|
itScriptEvent->cause = pEventGenerator->CreateEvent(0); |
1326 |
|
itScriptEvent->cause.Type = (Event::type_t) -1; // some invalid type to avoid random event processing |
1327 |
itScriptEvent->cause.pEngineChannel = pEngineChannel; |
itScriptEvent->cause.pEngineChannel = pEngineChannel; |
1328 |
|
itScriptEvent->cause.pMidiInputPort = pEngineChannel->GetMidiInputPort(); |
1329 |
|
itScriptEvent->id = 0; |
1330 |
itScriptEvent->handlers[0] = pEngineChannel->pScript->handlerInit; |
itScriptEvent->handlers[0] = pEngineChannel->pScript->handlerInit; |
1331 |
itScriptEvent->handlers[1] = NULL; |
itScriptEvent->handlers[1] = NULL; |
1332 |
itScriptEvent->currentHandler = 0; |
itScriptEvent->currentHandler = 0; |
1333 |
itScriptEvent->executionSlices = 0; |
itScriptEvent->executionSlices = 0; |
1334 |
itScriptEvent->ignoreAllWaitCalls = false; |
itScriptEvent->ignoreAllWaitCalls = false; |
1335 |
itScriptEvent->handlerType = VM_EVENT_HANDLER_INIT; |
itScriptEvent->handlerType = VM_EVENT_HANDLER_INIT; |
1336 |
|
itScriptEvent->parentHandlerID = 0; |
1337 |
/*VMExecStatus_t res = */ pScriptVM->exec( |
itScriptEvent->childHandlerID[0] = 0; |
1338 |
pEngineChannel->pScript->parserContext, &*itScriptEvent |
itScriptEvent->autoAbortByParent = false; |
1339 |
); |
itScriptEvent->forkIndex = 0; |
1340 |
|
|
1341 |
|
VMExecStatus_t res; |
1342 |
|
size_t instructionsCount = 0; |
1343 |
|
const size_t maxInstructions = 200000; // aiming approx. 1 second max. (based on very roughly 5us / instruction) |
1344 |
|
bool bWarningShown = false; |
1345 |
|
do { |
1346 |
|
res = pScriptVM->exec( |
1347 |
|
pEngineChannel->pScript->parserContext, &*itScriptEvent |
1348 |
|
); |
1349 |
|
instructionsCount += itScriptEvent->execCtx->instructionsPerformed(); |
1350 |
|
if (instructionsCount > maxInstructions && !bWarningShown) { |
1351 |
|
bWarningShown = true; |
1352 |
|
dmsg(0,("[ScriptVM] WARNING: \"init\" event handler of instrument script executing for long time!\n")); |
1353 |
|
} |
1354 |
|
} while (res & VM_EXEC_SUSPENDED && !(res & VM_EXEC_ERROR)); |
1355 |
|
|
1356 |
pEngineChannel->pScript->pEvents->free(itScriptEvent); |
pEngineChannel->pScript->pEvents->free(itScriptEvent); |
1357 |
} |
} |
1412 |
// usually there should already be a new Note object |
// usually there should already be a new Note object |
1413 |
NoteIterator itNote = GetNotePool()->fromID(itVoiceStealEvent->Param.Note.ID); |
NoteIterator itNote = GetNotePool()->fromID(itVoiceStealEvent->Param.Note.ID); |
1414 |
if (!itNote) { // should not happen, but just to be sure ... |
if (!itNote) { // should not happen, but just to be sure ... |
1415 |
|
dmsg(2,("Engine: No Note object for stolen voice!\n")); |
1416 |
const note_id_t noteID = LaunchNewNote(pEngineChannel, itVoiceStealEvent); |
const note_id_t noteID = LaunchNewNote(pEngineChannel, itVoiceStealEvent); |
1417 |
if (!noteID) { |
if (!noteID) { |
1418 |
dmsg(1,("Engine: Voice stealing failed; No Note object and Note pool empty!\n")); |
dmsg(1,("Engine: Voice stealing failed; No Note object and Note pool empty!\n")); |
1457 |
void PostProcess(EngineChannel* pEngineChannel) { |
void PostProcess(EngineChannel* pEngineChannel) { |
1458 |
EngineChannelBase<V, R, I>* pChannel = |
EngineChannelBase<V, R, I>* pChannel = |
1459 |
static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel); |
static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel); |
1460 |
pChannel->FreeAllInactiveKyes(); |
pChannel->FreeAllInactiveKeys(); |
1461 |
|
|
1462 |
// empty the engine channel's own event lists |
// empty the engine channel's own event lists |
1463 |
// (only events of the current audio fragment cycle) |
// (only events of the current audio fragment cycle) |
1484 |
pChannel->PortamentoTime = (float) itControlChangeEvent->Param.CC.Value / 127.0f * (float) CONFIG_PORTAMENTO_TIME_MAX + (float) CONFIG_PORTAMENTO_TIME_MIN; |
pChannel->PortamentoTime = (float) itControlChangeEvent->Param.CC.Value / 127.0f * (float) CONFIG_PORTAMENTO_TIME_MAX + (float) CONFIG_PORTAMENTO_TIME_MIN; |
1485 |
break; |
break; |
1486 |
} |
} |
1487 |
case 6: { // data entry (currently only used for RPN and NRPN controllers) |
case 6: { // data entry (currently only used for RPN and NRPN parameters) |
1488 |
//dmsg(1,("DATA ENTRY %d\n", itControlChangeEvent->Param.CC.Value)); |
//dmsg(1,("DATA ENTRY %d\n", itControlChangeEvent->Param.CC.Value)); |
1489 |
if (pChannel->GetMidiRpnController() >= 0) { // RPN controller number was sent previously ... |
if (pChannel->GetMidiRpnParameter() >= 0) { // RPN parameter number was sent previously ... |
1490 |
dmsg(4,("Guess it's an RPN ...\n")); |
dmsg(4,("Guess it's an RPN ...\n")); |
1491 |
if (pChannel->GetMidiRpnController() == 2) { // coarse tuning in half tones |
if (pChannel->GetMidiRpnParameter() == 2) { // coarse tuning in half tones |
1492 |
int transpose = (int) itControlChangeEvent->Param.CC.Value - 64; |
int transpose = (int) itControlChangeEvent->Param.CC.Value - 64; |
1493 |
// limit to +- two octaves for now |
// limit to +- two octaves for now |
1494 |
transpose = RTMath::Min(transpose, 24); |
transpose = RTMath::Min(transpose, 24); |
1497 |
// workaround, so we won't have hanging notes |
// workaround, so we won't have hanging notes |
1498 |
pChannel->ReleaseAllVoices(itControlChangeEvent); |
pChannel->ReleaseAllVoices(itControlChangeEvent); |
1499 |
} |
} |
1500 |
// to prevent other MIDI CC #6 messages to be misenterpreted as RPN controller data |
// to prevent other MIDI CC #6 messages to be misenterpreted as RPN value |
1501 |
pChannel->ResetMidiRpnController(); |
pChannel->ResetMidiRpnParameter(); |
1502 |
} else if (pChannel->GetMidiNrpnController() >= 0) { // NRPN controller number was sent previously ... |
} else if (pChannel->GetMidiNrpnParameter() >= 0) { // NRPN parameter number was sent previously ... |
1503 |
dmsg(4,("Guess it's an NRPN ...\n")); |
dmsg(4,("Guess it's an NRPN ...\n")); |
1504 |
const int NrpnCtrlMSB = pChannel->GetMidiNrpnController() >> 8; |
const int NrpnMSB = pChannel->GetMidiNrpnParameter() >> 7; |
1505 |
const int NrpnCtrlLSB = pChannel->GetMidiNrpnController() & 0xff; |
const int NrpnLSB = pChannel->GetMidiNrpnParameter() & 127; |
1506 |
dmsg(4,("NRPN MSB=%d LSB=%d Data=%d\n", NrpnCtrlMSB, NrpnCtrlLSB, itControlChangeEvent->Param.CC.Value)); |
dmsg(4,("NRPN MSB=%d LSB=%d Data=%d\n", NrpnMSB, NrpnLSB, itControlChangeEvent->Param.CC.Value)); |
1507 |
switch (NrpnCtrlMSB) { |
switch (NrpnMSB) { |
1508 |
case 0x1a: { // volume level of note (Roland GS NRPN) |
case 0x1a: { // volume level of note (Roland GS NRPN) |
1509 |
const uint note = NrpnCtrlLSB; |
const uint note = NrpnLSB; |
1510 |
const uint vol = itControlChangeEvent->Param.CC.Value; |
const uint vol = itControlChangeEvent->Param.CC.Value; |
1511 |
dmsg(4,("Note Volume NRPN received (note=%d,vol=%d).\n", note, vol)); |
dmsg(4,("Note Volume NRPN received (note=%d,vol=%d).\n", note, vol)); |
1512 |
if (note < 128 && vol < 128) |
if (note < 128 && vol < 128) |
1514 |
break; |
break; |
1515 |
} |
} |
1516 |
case 0x1c: { // panpot of note (Roland GS NRPN) |
case 0x1c: { // panpot of note (Roland GS NRPN) |
1517 |
const uint note = NrpnCtrlLSB; |
const uint note = NrpnLSB; |
1518 |
const uint pan = itControlChangeEvent->Param.CC.Value; |
const uint pan = itControlChangeEvent->Param.CC.Value; |
1519 |
dmsg(4,("Note Pan NRPN received (note=%d,pan=%d).\n", note, pan)); |
dmsg(4,("Note Pan NRPN received (note=%d,pan=%d).\n", note, pan)); |
1520 |
if (note < 128 && pan < 128) { |
if (note < 128 && pan < 128) { |
1524 |
break; |
break; |
1525 |
} |
} |
1526 |
case 0x1d: { // reverb send of note (Roland GS NRPN) |
case 0x1d: { // reverb send of note (Roland GS NRPN) |
1527 |
const uint note = NrpnCtrlLSB; |
const uint note = NrpnLSB; |
1528 |
const float reverb = float(itControlChangeEvent->Param.CC.Value) / 127.0f; |
const float reverb = float(itControlChangeEvent->Param.CC.Value) / 127.0f; |
1529 |
dmsg(4,("Note Reverb Send NRPN received (note=%d,send=%f).\n", note, reverb)); |
dmsg(4,("Note Reverb Send NRPN received (note=%d,send=%f).\n", note, reverb)); |
1530 |
if (note < 128) |
if (note < 128) |
1532 |
break; |
break; |
1533 |
} |
} |
1534 |
case 0x1e: { // chorus send of note (Roland GS NRPN) |
case 0x1e: { // chorus send of note (Roland GS NRPN) |
1535 |
const uint note = NrpnCtrlLSB; |
const uint note = NrpnLSB; |
1536 |
const float chorus = float(itControlChangeEvent->Param.CC.Value) / 127.0f; |
const float chorus = float(itControlChangeEvent->Param.CC.Value) / 127.0f; |
1537 |
dmsg(4,("Note Chorus Send NRPN received (note=%d,send=%f).\n", note, chorus)); |
dmsg(4,("Note Chorus Send NRPN received (note=%d,send=%f).\n", note, chorus)); |
1538 |
if (note < 128) |
if (note < 128) |
1540 |
break; |
break; |
1541 |
} |
} |
1542 |
} |
} |
1543 |
// to prevent other MIDI CC #6 messages to be misenterpreted as NRPN controller data |
// to prevent other MIDI CC #6 messages to be misenterpreted as NRPN value |
1544 |
pChannel->ResetMidiNrpnController(); |
pChannel->ResetMidiNrpnParameter(); |
1545 |
} |
} |
1546 |
break; |
break; |
1547 |
} |
} |
1629 |
} |
} |
1630 |
break; |
break; |
1631 |
} |
} |
1632 |
case 98: { // NRPN controller LSB |
case 98: { // NRPN parameter LSB |
1633 |
dmsg(4,("NRPN LSB %d\n", itControlChangeEvent->Param.CC.Value)); |
dmsg(4,("NRPN LSB %d\n", itControlChangeEvent->Param.CC.Value)); |
1634 |
pEngineChannel->SetMidiNrpnControllerLsb(itControlChangeEvent->Param.CC.Value); |
pEngineChannel->SetMidiNrpnParameterLsb(itControlChangeEvent->Param.CC.Value); |
1635 |
break; |
break; |
1636 |
} |
} |
1637 |
case 99: { // NRPN controller MSB |
case 99: { // NRPN parameter MSB |
1638 |
dmsg(4,("NRPN MSB %d\n", itControlChangeEvent->Param.CC.Value)); |
dmsg(4,("NRPN MSB %d\n", itControlChangeEvent->Param.CC.Value)); |
1639 |
pEngineChannel->SetMidiNrpnControllerMsb(itControlChangeEvent->Param.CC.Value); |
pEngineChannel->SetMidiNrpnParameterMsb(itControlChangeEvent->Param.CC.Value); |
1640 |
break; |
break; |
1641 |
} |
} |
1642 |
case 100: { // RPN controller LSB |
case 100: { // RPN parameter LSB |
1643 |
dmsg(4,("RPN LSB %d\n", itControlChangeEvent->Param.CC.Value)); |
dmsg(4,("RPN LSB %d\n", itControlChangeEvent->Param.CC.Value)); |
1644 |
pEngineChannel->SetMidiRpnControllerLsb(itControlChangeEvent->Param.CC.Value); |
pEngineChannel->SetMidiRpnParameterLsb(itControlChangeEvent->Param.CC.Value); |
1645 |
break; |
break; |
1646 |
} |
} |
1647 |
case 101: { // RPN controller MSB |
case 101: { // RPN parameter MSB |
1648 |
dmsg(4,("RPN MSB %d\n", itControlChangeEvent->Param.CC.Value)); |
dmsg(4,("RPN MSB %d\n", itControlChangeEvent->Param.CC.Value)); |
1649 |
pEngineChannel->SetMidiRpnControllerMsb(itControlChangeEvent->Param.CC.Value); |
pEngineChannel->SetMidiRpnParameterMsb(itControlChangeEvent->Param.CC.Value); |
1650 |
break; |
break; |
1651 |
} |
} |
1652 |
|
|
1922 |
if (bShouldRelease) { |
if (bShouldRelease) { |
1923 |
itNoteOffEventOnKeyList->Type = Event::type_release_key; // transform event type |
itNoteOffEventOnKeyList->Type = Event::type_release_key; // transform event type |
1924 |
// spawn release triggered voice(s) if needed |
// spawn release triggered voice(s) if needed |
1925 |
ProcessReleaseTrigger(pChannel, itNoteOffEventOnKeyList, pKey); |
if (pKey->ReleaseTrigger & release_trigger_noteoff) |
1926 |
|
ProcessReleaseTrigger(pChannel, itNoteOffEventOnKeyList, pKey); |
1927 |
} |
} |
1928 |
} else if (itNoteOffEventOnKeyList->Type == Event::type_stop_note) { |
} else if (itNoteOffEventOnKeyList->Type == Event::type_stop_note) { |
1929 |
// This programmatically caused event is caused by a call to |
// This programmatically caused event is caused by a call to |
1954 |
* @param pEngineChannel - engine channel on which this event occurred on |
* @param pEngineChannel - engine channel on which this event occurred on |
1955 |
* @param itEvent - release trigger event (contains note number) |
* @param itEvent - release trigger event (contains note number) |
1956 |
*/ |
*/ |
1957 |
virtual void ProcessReleaseTrigger(EngineChannel* pEngineChannel, RTList<Event>::Iterator& itEvent) OVERRIDE { |
virtual void ProcessReleaseTriggerBySustain(EngineChannel* pEngineChannel, RTList<Event>::Iterator& itEvent) OVERRIDE { |
1958 |
EngineChannelBase<V, R, I>* pChannel = static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel); |
EngineChannelBase<V, R, I>* pChannel = static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel); |
1959 |
|
|
1960 |
const int iKey = itEvent->Param.Note.Key; |
const int iKey = itEvent->Param.Note.Key; |
1982 |
// allocate and trigger new release voice(s) |
// allocate and trigger new release voice(s) |
1983 |
TriggerReleaseVoices(pChannel, itEvent); |
TriggerReleaseVoices(pChannel, itEvent); |
1984 |
} |
} |
1985 |
pKey->ReleaseTrigger = false; |
pKey->ReleaseTrigger = release_trigger_none; |
1986 |
} |
} |
1987 |
} |
} |
1988 |
|
|
2028 |
NoteBase* pNote = pChannel->pEngine->NoteByID( itEvent->Param.NoteSynthParam.NoteID ); |
NoteBase* pNote = pChannel->pEngine->NoteByID( itEvent->Param.NoteSynthParam.NoteID ); |
2029 |
if (!pNote || pNote->hostKey < 0 || pNote->hostKey >= 128) return; |
if (!pNote || pNote->hostKey < 0 || pNote->hostKey >= 128) return; |
2030 |
|
|
|
const bool& relative = itEvent->Param.NoteSynthParam.Relative; |
|
|
|
|
2031 |
switch (itEvent->Param.NoteSynthParam.Type) { |
switch (itEvent->Param.NoteSynthParam.Type) { |
2032 |
case Event::synth_param_volume: |
case Event::synth_param_volume: |
2033 |
if (relative) |
pNote->apply(itEvent, &NoteBase::_Override::Volume); |
|
pNote->Override.Volume *= itEvent->Param.NoteSynthParam.Delta; |
|
|
else |
|
|
pNote->Override.Volume = itEvent->Param.NoteSynthParam.Delta; |
|
|
itEvent->Param.NoteSynthParam.AbsValue = pNote->Override.Volume; |
|
2034 |
break; |
break; |
2035 |
case Event::synth_param_volume_time: |
case Event::synth_param_volume_time: |
2036 |
pNote->Override.VolumeTime = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
pNote->Override.VolumeTime = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2037 |
break; |
break; |
2038 |
|
case Event::synth_param_volume_curve: |
2039 |
|
itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2040 |
|
pNote->Override.VolumeCurve = (fade_curve_t) itEvent->Param.NoteSynthParam.AbsValue; |
2041 |
|
break; |
2042 |
case Event::synth_param_pitch: |
case Event::synth_param_pitch: |
2043 |
if (relative) |
pNote->apply(itEvent, &NoteBase::_Override::Pitch); |
|
pNote->Override.Pitch *= itEvent->Param.NoteSynthParam.Delta; |
|
|
else |
|
|
pNote->Override.Pitch = itEvent->Param.NoteSynthParam.Delta; |
|
|
itEvent->Param.NoteSynthParam.AbsValue = pNote->Override.Pitch; |
|
2044 |
break; |
break; |
2045 |
case Event::synth_param_pitch_time: |
case Event::synth_param_pitch_time: |
2046 |
pNote->Override.PitchTime = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
pNote->Override.PitchTime = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2047 |
break; |
break; |
2048 |
|
case Event::synth_param_pitch_curve: |
2049 |
|
itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2050 |
|
pNote->Override.PitchCurve = (fade_curve_t) itEvent->Param.NoteSynthParam.AbsValue; |
2051 |
|
break; |
2052 |
case Event::synth_param_pan: |
case Event::synth_param_pan: |
2053 |
if (relative) { |
pNote->apply(itEvent, &NoteBase::_Override::Pan); |
2054 |
pNote->Override.Pan = RTMath::RelativeSummedAvg(pNote->Override.Pan, itEvent->Param.NoteSynthParam.Delta, ++pNote->Override.PanSources); |
break; |
2055 |
} else { |
case Event::synth_param_pan_time: |
2056 |
pNote->Override.Pan = itEvent->Param.NoteSynthParam.Delta; |
pNote->Override.PanTime = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2057 |
pNote->Override.PanSources = 1; // only relevant on subsequent change_pan() instrument script calls on same note with 'relative' argument being set |
break; |
2058 |
} |
case Event::synth_param_pan_curve: |
2059 |
itEvent->Param.NoteSynthParam.AbsValue = pNote->Override.Pan; |
itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2060 |
|
pNote->Override.PanCurve = (fade_curve_t) itEvent->Param.NoteSynthParam.AbsValue; |
2061 |
break; |
break; |
2062 |
case Event::synth_param_cutoff: |
case Event::synth_param_cutoff: |
2063 |
pNote->Override.Cutoff = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
pNote->apply(itEvent, &NoteBase::_Override::Cutoff); |
2064 |
break; |
break; |
2065 |
case Event::synth_param_resonance: |
case Event::synth_param_resonance: |
2066 |
pNote->Override.Resonance = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
pNote->apply(itEvent, &NoteBase::_Override::Resonance); |
2067 |
break; |
break; |
2068 |
case Event::synth_param_attack: |
case Event::synth_param_attack: |
2069 |
pNote->Override.Attack = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
pNote->apply(itEvent, &NoteBase::_Override::Attack); |
2070 |
break; |
break; |
2071 |
case Event::synth_param_decay: |
case Event::synth_param_decay: |
2072 |
pNote->Override.Decay = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
pNote->apply(itEvent, &NoteBase::_Override::Decay); |
2073 |
|
break; |
2074 |
|
case Event::synth_param_sustain: |
2075 |
|
pNote->apply(itEvent, &NoteBase::_Override::Sustain); |
2076 |
break; |
break; |
2077 |
case Event::synth_param_release: |
case Event::synth_param_release: |
2078 |
pNote->Override.Release = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
pNote->apply(itEvent, &NoteBase::_Override::Release); |
2079 |
|
break; |
2080 |
|
|
2081 |
|
case Event::synth_param_cutoff_attack: |
2082 |
|
pNote->apply(itEvent, &NoteBase::_Override::CutoffAttack); |
2083 |
|
break; |
2084 |
|
case Event::synth_param_cutoff_decay: |
2085 |
|
pNote->apply(itEvent, &NoteBase::_Override::CutoffDecay); |
2086 |
|
break; |
2087 |
|
case Event::synth_param_cutoff_sustain: |
2088 |
|
pNote->apply(itEvent, &NoteBase::_Override::CutoffSustain); |
2089 |
break; |
break; |
2090 |
|
case Event::synth_param_cutoff_release: |
2091 |
|
pNote->apply(itEvent, &NoteBase::_Override::CutoffRelease); |
2092 |
|
break; |
2093 |
|
|
2094 |
case Event::synth_param_amp_lfo_depth: |
case Event::synth_param_amp_lfo_depth: |
2095 |
pNote->Override.AmpLFODepth = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
pNote->apply(itEvent, &NoteBase::_Override::AmpLFODepth); |
2096 |
break; |
break; |
2097 |
case Event::synth_param_amp_lfo_freq: |
case Event::synth_param_amp_lfo_freq: |
2098 |
pNote->Override.AmpLFOFreq = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
pNote->apply(itEvent, &NoteBase::_Override::AmpLFOFreq); |
2099 |
|
break; |
2100 |
|
case Event::synth_param_cutoff_lfo_depth: |
2101 |
|
pNote->apply(itEvent, &NoteBase::_Override::CutoffLFODepth); |
2102 |
|
break; |
2103 |
|
case Event::synth_param_cutoff_lfo_freq: |
2104 |
|
pNote->apply(itEvent, &NoteBase::_Override::CutoffLFOFreq); |
2105 |
break; |
break; |
2106 |
case Event::synth_param_pitch_lfo_depth: |
case Event::synth_param_pitch_lfo_depth: |
2107 |
pNote->Override.PitchLFODepth = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
pNote->apply(itEvent, &NoteBase::_Override::PitchLFODepth); |
2108 |
break; |
break; |
2109 |
case Event::synth_param_pitch_lfo_freq: |
case Event::synth_param_pitch_lfo_freq: |
2110 |
pNote->Override.PitchLFOFreq = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
pNote->apply(itEvent, &NoteBase::_Override::PitchLFOFreq); |
2111 |
break; |
break; |
2112 |
} |
} |
2113 |
|
|
2237 |
} |
} |
2238 |
else { // on success |
else { // on success |
2239 |
--VoiceSpawnsLeft; |
--VoiceSpawnsLeft; |
2240 |
if (!pKey->Active) { // mark as active key |
|
2241 |
pKey->Active = true; |
// should actually be superfluous now, since this is |
2242 |
pKey->itSelf = pChannel->pActiveKeys->allocAppend(); |
// already done in LaunchNewNote() |
2243 |
*pKey->itSelf = itNoteOnEvent->Param.Note.Key; |
pChannel->markKeyAsActive(pKey); |
2244 |
} |
|
2245 |
if (itNewVoice->Type & Voice::type_release_trigger_required) pKey->ReleaseTrigger = true; // mark key for the need of release triggered voice(s) |
if (itNewVoice->Type & Voice::type_release_trigger_required) |
2246 |
|
pKey->ReleaseTrigger |= itNewVoice->GetReleaseTriggerFlags(); // mark key for the need of release triggered voice(s) |
2247 |
return 0; // success |
return 0; // success |
2248 |
} |
} |
2249 |
} |
} |