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-2008 Christian Schoenebeck * |
7 |
* Copyright (C) 2009-2012 Christian Schoenebeck and Grigor Iliev * |
* Copyright (C) 2009-2012 Christian Schoenebeck and Grigor Iliev * |
8 |
* Copyright (C) 2012-2016 Christian Schoenebeck and Andreas Persson * |
* Copyright (C) 2012-2017 Christian Schoenebeck and Andreas Persson * |
9 |
* * |
* * |
10 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
11 |
* 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 * |
58 |
typedef typename RTList<RR*>::Iterator RootRegionIterator; |
typedef typename RTList<RR*>::Iterator RootRegionIterator; |
59 |
typedef typename MidiKeyboardManager<V>::MidiKey MidiKey; |
typedef typename MidiKeyboardManager<V>::MidiKey MidiKey; |
60 |
|
|
61 |
EngineBase() : SuspendedRegions(128), noteIDPool(GLOBAL_MAX_NOTES) { |
EngineBase() : noteIDPool(GLOBAL_MAX_NOTES), SuspendedRegions(128) { |
62 |
pDiskThread = NULL; |
pDiskThread = NULL; |
63 |
pNotePool = new Pool< Note<V> >(GLOBAL_MAX_NOTES); |
pNotePool = new Pool< Note<V> >(GLOBAL_MAX_NOTES); |
64 |
pNotePool->setPoolElementIDsReservedBits(INSTR_SCRIPT_EVENT_ID_RESERVED_BITS); |
pNotePool->setPoolElementIDsReservedBits(INSTR_SCRIPT_EVENT_ID_RESERVED_BITS); |
163 |
dmsg(5,("Engine: Sysex received\n")); |
dmsg(5,("Engine: Sysex received\n")); |
164 |
ProcessSysex(itEvent); |
ProcessSysex(itEvent); |
165 |
break; |
break; |
166 |
|
default: ; // noop |
167 |
} |
} |
168 |
} |
} |
169 |
} |
} |
379 |
} |
} |
380 |
pVoicePool->clear(); |
pVoicePool->clear(); |
381 |
|
|
382 |
// (re)create event generator |
// update event generator |
383 |
if (pEventGenerator) delete pEventGenerator; |
pEventGenerator->SetSampleRate(pAudioOut->SampleRate()); |
|
pEventGenerator = new EventGenerator(pAudioOut->SampleRate()); |
|
384 |
|
|
385 |
dmsg(1,("Starting disk thread...")); |
dmsg(1,("Starting disk thread...")); |
386 |
pDiskThread->StartThread(); |
pDiskThread->StartThread(); |
596 |
} |
} |
597 |
|
|
598 |
// implementation of abstract method derived from class 'LinuxSampler::RegionPools' |
// implementation of abstract method derived from class 'LinuxSampler::RegionPools' |
599 |
virtual Pool<R*>* GetRegionPool(int index) { |
virtual Pool<R*>* GetRegionPool(int index) OVERRIDE { |
600 |
if (index < 0 || index > 1) throw Exception("Index out of bounds"); |
if (index < 0 || index > 1) throw Exception("Index out of bounds"); |
601 |
return pRegionPool[index]; |
return pRegionPool[index]; |
602 |
} |
} |
604 |
// implementation of abstract methods derived from class 'LinuxSampler::NotePool' |
// implementation of abstract methods derived from class 'LinuxSampler::NotePool' |
605 |
virtual Pool<V>* GetVoicePool() OVERRIDE { return pVoicePool; } |
virtual Pool<V>* GetVoicePool() OVERRIDE { return pVoicePool; } |
606 |
virtual Pool< Note<V> >* GetNotePool() OVERRIDE { return pNotePool; } |
virtual Pool< Note<V> >* GetNotePool() OVERRIDE { return pNotePool; } |
607 |
virtual Pool<note_id_t>* GetNodeIDPool() OVERRIDE { return ¬eIDPool; } |
virtual Pool<note_id_t>* GetNoteIDPool() OVERRIDE { return ¬eIDPool; } |
608 |
|
|
609 |
D* GetDiskThread() { return pDiskThread; } |
D* GetDiskThread() { return pDiskThread; } |
610 |
|
|
675 |
* @param pNoteOnEvent - event which caused this |
* @param pNoteOnEvent - event which caused this |
676 |
* @returns new note's unique ID (or zero on error) |
* @returns new note's unique ID (or zero on error) |
677 |
*/ |
*/ |
678 |
note_id_t LaunchNewNote(LinuxSampler::EngineChannel* pEngineChannel, Event* pNoteOnEvent) OVERRIDE { |
note_id_t LaunchNewNote(LinuxSampler::EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOnEvent) OVERRIDE { |
679 |
EngineChannelBase<V, R, I>* pChannel = static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel); |
EngineChannelBase<V, R, I>* pChannel = static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel); |
680 |
Pool< Note<V> >* pNotePool = GetNotePool(); |
Pool< Note<V> >* pNotePool = GetNotePool(); |
681 |
|
|
689 |
NoteIterator itNewNote = pNotePool->allocAppend(); |
NoteIterator itNewNote = pNotePool->allocAppend(); |
690 |
const note_id_t newNoteID = pNotePool->getID(itNewNote); |
const note_id_t newNoteID = pNotePool->getID(itNewNote); |
691 |
|
|
692 |
|
// remember the engine's time when this note was triggered exactly |
693 |
|
itNewNote->triggerSchedTime = itNoteOnEvent->SchedTime(); |
694 |
|
|
695 |
// usually the new note (and its subsequent voices) will be |
// usually the new note (and its subsequent voices) will be |
696 |
// allocated on the key provided by the event's note number, |
// allocated on the key provided by the event's note number, |
697 |
// however if this new note is requested not to be a regular |
// however if this new note is requested not to be a regular |
698 |
// note, but rather a child note, then this new note will be |
// note, but rather a child note, then this new note will be |
699 |
// allocated on the parent note's key instead in order to |
// allocated on the parent note's key instead in order to |
700 |
// release the child note simultaniously with its parent note |
// release the child note simultaniously with its parent note |
701 |
itNewNote->hostKey = pNoteOnEvent->Param.Note.Key; |
itNewNote->hostKey = itNoteOnEvent->Param.Note.Key; |
702 |
|
|
703 |
// in case this new note was requested to be a child note, |
// in case this new note was requested to be a child note, |
704 |
// then retrieve its parent note and link them with each other |
// then retrieve its parent note and link them with each other |
705 |
const note_id_t parentNoteID = pNoteOnEvent->Param.Note.ParentNoteID; |
const note_id_t parentNoteID = itNoteOnEvent->Param.Note.ParentNoteID; |
706 |
if (parentNoteID) { |
if (parentNoteID) { |
707 |
NoteIterator itParentNote = pNotePool->fromID(parentNoteID); |
NoteIterator itParentNote = pNotePool->fromID(parentNoteID); |
708 |
if (itParentNote) { |
if (itParentNote) { |
730 |
dmsg(2,("Launched new note on host key %d\n", itNewNote->hostKey)); |
dmsg(2,("Launched new note on host key %d\n", itNewNote->hostKey)); |
731 |
|
|
732 |
// copy event which caused this note |
// copy event which caused this note |
733 |
itNewNote->cause = *pNoteOnEvent; |
itNewNote->cause = *itNoteOnEvent; |
734 |
itNewNote->eventID = pEventPool->getID(pNoteOnEvent); |
itNewNote->eventID = pEventPool->getID(itNoteOnEvent); |
735 |
|
if (!itNewNote->eventID) { |
736 |
|
dmsg(0,("Engine: No valid event ID resolved for note. This is a bug!!!\n")); |
737 |
|
} |
738 |
|
|
739 |
// move new note to its host key |
// move new note to its host key |
740 |
MidiKey* pKey = &pChannel->pMIDIKeyInfo[itNewNote->hostKey]; |
MidiKey* pKey = &pChannel->pMIDIKeyInfo[itNewNote->hostKey]; |
741 |
itNewNote.moveToEndOf(pKey->pActiveNotes); |
itNewNote.moveToEndOf(pKey->pActiveNotes); |
742 |
|
|
743 |
// 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 |
744 |
pNoteOnEvent->Param.Note.ID = newNoteID; |
itNoteOnEvent->Param.Note.ID = newNoteID; |
745 |
|
|
746 |
return newNoteID; // success |
return newNoteID; // success |
747 |
} |
} |
801 |
case Event::type_note_pressure: |
case Event::type_note_pressure: |
802 |
//TODO: ... |
//TODO: ... |
803 |
break; |
break; |
804 |
|
|
805 |
|
case Event::type_sysex: |
806 |
|
//TODO: ... |
807 |
|
break; |
808 |
|
|
809 |
|
case Event::type_cancel_release_key: |
810 |
|
case Event::type_release_key: |
811 |
|
case Event::type_release_note: |
812 |
|
case Event::type_play_note: |
813 |
|
case Event::type_stop_note: |
814 |
|
case Event::type_kill_note: |
815 |
|
case Event::type_note_synth_param: |
816 |
|
break; // noop |
817 |
} |
} |
818 |
|
|
819 |
// see HACK comment above |
// see HACK comment above |
884 |
dmsg(5,("Engine: Stop Note received\n")); |
dmsg(5,("Engine: Stop Note received\n")); |
885 |
ProcessNoteOff((EngineChannel*)itEvent->pEngineChannel, itEvent); |
ProcessNoteOff((EngineChannel*)itEvent->pEngineChannel, itEvent); |
886 |
break; |
break; |
887 |
|
case Event::type_kill_note: |
888 |
|
dmsg(5,("Engine: Kill Note received\n")); |
889 |
|
ProcessKillNote((EngineChannel*)itEvent->pEngineChannel, itEvent); |
890 |
|
break; |
891 |
case Event::type_control_change: |
case Event::type_control_change: |
892 |
dmsg(5,("Engine: MIDI CC received\n")); |
dmsg(5,("Engine: MIDI CC received\n")); |
893 |
ProcessControlChange((EngineChannel*)itEvent->pEngineChannel, itEvent); |
ProcessControlChange((EngineChannel*)itEvent->pEngineChannel, itEvent); |
908 |
dmsg(5,("Engine: Note Synth Param received\n")); |
dmsg(5,("Engine: Note Synth Param received\n")); |
909 |
ProcessNoteSynthParam(itEvent->pEngineChannel, itEvent); |
ProcessNoteSynthParam(itEvent->pEngineChannel, itEvent); |
910 |
break; |
break; |
911 |
|
case Event::type_sysex: |
912 |
|
break; // TODO ... |
913 |
|
|
914 |
|
case Event::type_cancel_release_key: |
915 |
|
case Event::type_release_key: |
916 |
|
case Event::type_release_note: |
917 |
|
break; // noop |
918 |
} |
} |
919 |
} |
} |
920 |
} |
} |
983 |
// script event object |
// script event object |
984 |
RTList<ScriptEvent>::Iterator itScriptEvent = |
RTList<ScriptEvent>::Iterator itScriptEvent = |
985 |
pChannel->pScript->pEvents->allocAppend(); |
pChannel->pScript->pEvents->allocAppend(); |
986 |
|
// if event handler uses polyphonic variables, reset them |
987 |
|
// to zero values before starting to execute the handler |
988 |
|
if (pEventHandler->isPolyphonic()) |
989 |
|
itScriptEvent->execCtx->resetPolyphonicData(); |
990 |
ProcessScriptEvent( |
ProcessScriptEvent( |
991 |
pChannel, itEvent, pEventHandler, itScriptEvent |
pChannel, itEvent, pEventHandler, itScriptEvent |
992 |
); |
); |
1019 |
|
|
1020 |
// initialize/reset other members |
// initialize/reset other members |
1021 |
itScriptEvent->cause = *itEvent; |
itScriptEvent->cause = *itEvent; |
1022 |
|
itScriptEvent->scheduleTime = itEvent->SchedTime(); |
1023 |
itScriptEvent->currentHandler = 0; |
itScriptEvent->currentHandler = 0; |
1024 |
itScriptEvent->executionSlices = 0; |
itScriptEvent->executionSlices = 0; |
1025 |
|
itScriptEvent->ignoreAllWaitCalls = false; |
1026 |
|
itScriptEvent->handlerType = pEventHandler->eventHandlerType(); |
1027 |
// this is the native representation of the $EVENT_ID script variable |
// this is the native representation of the $EVENT_ID script variable |
1028 |
itScriptEvent->id = |
itScriptEvent->id = |
1029 |
(itEvent->Type == Event::type_note_on) |
(itEvent->Type == Event::type_note_on) |
1291 |
// the script's "init" event handler is only executed |
// the script's "init" event handler is only executed |
1292 |
// once (when the script is loaded or reloaded) |
// once (when the script is loaded or reloaded) |
1293 |
if (pEngineChannel->pScript && pEngineChannel->pScript->handlerInit) { |
if (pEngineChannel->pScript && pEngineChannel->pScript->handlerInit) { |
1294 |
|
dmsg(5,("Engine: exec handlerInit %p\n", pEngineChannel->pScript->handlerInit)); |
1295 |
RTList<ScriptEvent>::Iterator itScriptEvent = |
RTList<ScriptEvent>::Iterator itScriptEvent = |
1296 |
pEngineChannel->pScript->pEvents->allocAppend(); |
pEngineChannel->pScript->pEvents->allocAppend(); |
1297 |
|
|
1298 |
|
itScriptEvent->cause = pEventGenerator->CreateEvent(0); |
1299 |
|
itScriptEvent->cause.Type = (Event::type_t) -1; // some invalid type to avoid random event processing |
1300 |
itScriptEvent->cause.pEngineChannel = pEngineChannel; |
itScriptEvent->cause.pEngineChannel = pEngineChannel; |
1301 |
|
itScriptEvent->cause.pMidiInputPort = pEngineChannel->GetMidiInputPort(); |
1302 |
itScriptEvent->handlers[0] = pEngineChannel->pScript->handlerInit; |
itScriptEvent->handlers[0] = pEngineChannel->pScript->handlerInit; |
1303 |
itScriptEvent->handlers[1] = NULL; |
itScriptEvent->handlers[1] = NULL; |
1304 |
|
itScriptEvent->currentHandler = 0; |
1305 |
VMExecStatus_t res = pScriptVM->exec( |
itScriptEvent->executionSlices = 0; |
1306 |
pEngineChannel->pScript->parserContext, &*itScriptEvent |
itScriptEvent->ignoreAllWaitCalls = false; |
1307 |
); |
itScriptEvent->handlerType = VM_EVENT_HANDLER_INIT; |
1308 |
|
|
1309 |
|
VMExecStatus_t res; |
1310 |
|
size_t instructionsCount = 0; |
1311 |
|
const size_t maxInstructions = 200000; // aiming approx. 1 second max. (based on very roughly 5us / instruction) |
1312 |
|
bool bWarningShown = false; |
1313 |
|
do { |
1314 |
|
res = pScriptVM->exec( |
1315 |
|
pEngineChannel->pScript->parserContext, &*itScriptEvent |
1316 |
|
); |
1317 |
|
instructionsCount += itScriptEvent->execCtx->instructionsPerformed(); |
1318 |
|
if (instructionsCount > maxInstructions && !bWarningShown) { |
1319 |
|
bWarningShown = true; |
1320 |
|
dmsg(0,("[ScriptVM] WARNING: \"init\" event handler of instrument script executing for long time!\n")); |
1321 |
|
} |
1322 |
|
} while (res & VM_EXEC_SUSPENDED && !(res & VM_EXEC_ERROR)); |
1323 |
|
|
1324 |
pEngineChannel->pScript->pEvents->free(itScriptEvent); |
pEngineChannel->pScript->pEvents->free(itScriptEvent); |
1325 |
} |
} |
1380 |
// usually there should already be a new Note object |
// usually there should already be a new Note object |
1381 |
NoteIterator itNote = GetNotePool()->fromID(itVoiceStealEvent->Param.Note.ID); |
NoteIterator itNote = GetNotePool()->fromID(itVoiceStealEvent->Param.Note.ID); |
1382 |
if (!itNote) { // should not happen, but just to be sure ... |
if (!itNote) { // should not happen, but just to be sure ... |
1383 |
const note_id_t noteID = LaunchNewNote(pEngineChannel, &*itVoiceStealEvent); |
const note_id_t noteID = LaunchNewNote(pEngineChannel, itVoiceStealEvent); |
1384 |
if (!noteID) { |
if (!noteID) { |
1385 |
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")); |
1386 |
continue; |
continue; |
1657 |
* @param pEngineChannel - engine channel on which this event occurred on |
* @param pEngineChannel - engine channel on which this event occurred on |
1658 |
* @param itNoteOnEvent - key, velocity and time stamp of the event |
* @param itNoteOnEvent - key, velocity and time stamp of the event |
1659 |
*/ |
*/ |
1660 |
virtual void ProcessNoteOn(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOnEvent) { |
virtual void ProcessNoteOn(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOnEvent) OVERRIDE { |
1661 |
EngineChannelBase<V, R, I>* pChannel = |
EngineChannelBase<V, R, I>* pChannel = |
1662 |
static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel); |
static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel); |
1663 |
|
|
1788 |
* @param pEngineChannel - engine channel on which this event occurred on |
* @param pEngineChannel - engine channel on which this event occurred on |
1789 |
* @param itNoteOffEvent - key, velocity and time stamp of the event |
* @param itNoteOffEvent - key, velocity and time stamp of the event |
1790 |
*/ |
*/ |
1791 |
virtual void ProcessNoteOff(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOffEvent) { |
virtual void ProcessNoteOff(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOffEvent) OVERRIDE { |
1792 |
EngineChannelBase<V, R, I>* pChannel = static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel); |
EngineChannelBase<V, R, I>* pChannel = static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel); |
1793 |
|
|
1794 |
const int iKey = itNoteOffEvent->Param.Note.Key; |
const int iKey = itNoteOffEvent->Param.Note.Key; |
1857 |
itPseudoNoteOnEvent->Param.Note.Key = i; |
itPseudoNoteOnEvent->Param.Note.Key = i; |
1858 |
itPseudoNoteOnEvent->Param.Note.Velocity = pOtherKey->Velocity; |
itPseudoNoteOnEvent->Param.Note.Velocity = pOtherKey->Velocity; |
1859 |
// assign a new note to this note-on event |
// assign a new note to this note-on event |
1860 |
if (LaunchNewNote(pChannel, &*itPseudoNoteOnEvent)) { |
if (LaunchNewNote(pChannel, itPseudoNoteOnEvent)) { |
1861 |
// allocate and trigger new voice(s) for the other key |
// allocate and trigger new voice(s) for the other key |
1862 |
TriggerNewVoices(pChannel, itPseudoNoteOnEvent, false); |
TriggerNewVoices(pChannel, itPseudoNoteOnEvent, false); |
1863 |
} |
} |
1944 |
// spawn release triggered voice(s) if needed |
// spawn release triggered voice(s) if needed |
1945 |
if (pKey->ReleaseTrigger && pChannel->pInstrument) { |
if (pKey->ReleaseTrigger && pChannel->pInstrument) { |
1946 |
// assign a new note to this release event |
// assign a new note to this release event |
1947 |
if (LaunchNewNote(pChannel, &*itEvent)) { |
if (LaunchNewNote(pChannel, itEvent)) { |
1948 |
// allocate and trigger new release voice(s) |
// allocate and trigger new release voice(s) |
1949 |
TriggerReleaseVoices(pChannel, itEvent); |
TriggerReleaseVoices(pChannel, itEvent); |
1950 |
} |
} |
1953 |
} |
} |
1954 |
|
|
1955 |
/** |
/** |
1956 |
|
* Called on "kill note" events, which currently only happens on |
1957 |
|
* built-in real-time instrument script function fade_out(). This |
1958 |
|
* method only fulfills one task: moving the even to the Note's own |
1959 |
|
* event list so that its voices can process the kill event sample |
1960 |
|
* accurately. |
1961 |
|
*/ |
1962 |
|
void ProcessKillNote(EngineChannel* pEngineChannel, RTList<Event>::Iterator& itEvent) { |
1963 |
|
EngineChannelBase<V, R, I>* pChannel = static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel); |
1964 |
|
|
1965 |
|
NoteBase* pNote = pChannel->pEngine->NoteByID( itEvent->Param.Note.ID ); |
1966 |
|
if (!pNote || pNote->hostKey < 0 || pNote->hostKey >= 128) return; |
1967 |
|
|
1968 |
|
// move note kill event to its MIDI key |
1969 |
|
MidiKey* pKey = &pChannel->pMIDIKeyInfo[pNote->hostKey]; |
1970 |
|
itEvent.moveToEndOf(pKey->pEvents); |
1971 |
|
} |
1972 |
|
|
1973 |
|
/** |
1974 |
* Called on note synthesis parameter change events. These are |
* Called on note synthesis parameter change events. These are |
1975 |
* internal events caused by calling built-in real-time instrument |
* internal events caused by calling built-in real-time instrument |
1976 |
* script functions like change_vol(), change_pitch(), etc. |
* script functions like change_vol(), change_tune(), etc. |
1977 |
* |
* |
1978 |
* This method performs two tasks: |
* This method performs two tasks: |
1979 |
* |
* |
1988 |
* @param pEngineChannel - engine channel on which this event occurred on |
* @param pEngineChannel - engine channel on which this event occurred on |
1989 |
* @param itEvent - note synthesis parameter change event |
* @param itEvent - note synthesis parameter change event |
1990 |
*/ |
*/ |
1991 |
virtual void ProcessNoteSynthParam(EngineChannel* pEngineChannel, RTList<Event>::Iterator& itEvent) OVERRIDE { |
virtual void ProcessNoteSynthParam(EngineChannel* pEngineChannel, RTList<Event>::Iterator& itEvent) { |
1992 |
EngineChannelBase<V, R, I>* pChannel = static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel); |
EngineChannelBase<V, R, I>* pChannel = static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel); |
1993 |
|
|
1994 |
NoteBase* pNote = pChannel->pEngine->NoteByID( itEvent->Param.NoteSynthParam.NoteID ); |
NoteBase* pNote = pChannel->pEngine->NoteByID( itEvent->Param.NoteSynthParam.NoteID ); |
2004 |
pNote->Override.Volume = itEvent->Param.NoteSynthParam.Delta; |
pNote->Override.Volume = itEvent->Param.NoteSynthParam.Delta; |
2005 |
itEvent->Param.NoteSynthParam.AbsValue = pNote->Override.Volume; |
itEvent->Param.NoteSynthParam.AbsValue = pNote->Override.Volume; |
2006 |
break; |
break; |
2007 |
|
case Event::synth_param_volume_time: |
2008 |
|
pNote->Override.VolumeTime = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2009 |
|
break; |
2010 |
|
case Event::synth_param_volume_curve: |
2011 |
|
itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2012 |
|
pNote->Override.VolumeCurve = (fade_curve_t) itEvent->Param.NoteSynthParam.AbsValue; |
2013 |
|
break; |
2014 |
case Event::synth_param_pitch: |
case Event::synth_param_pitch: |
2015 |
if (relative) |
if (relative) |
2016 |
pNote->Override.Pitch *= itEvent->Param.NoteSynthParam.Delta; |
pNote->Override.Pitch *= itEvent->Param.NoteSynthParam.Delta; |
2018 |
pNote->Override.Pitch = itEvent->Param.NoteSynthParam.Delta; |
pNote->Override.Pitch = itEvent->Param.NoteSynthParam.Delta; |
2019 |
itEvent->Param.NoteSynthParam.AbsValue = pNote->Override.Pitch; |
itEvent->Param.NoteSynthParam.AbsValue = pNote->Override.Pitch; |
2020 |
break; |
break; |
2021 |
|
case Event::synth_param_pitch_time: |
2022 |
|
pNote->Override.PitchTime = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2023 |
|
break; |
2024 |
|
case Event::synth_param_pitch_curve: |
2025 |
|
itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2026 |
|
pNote->Override.PitchCurve = (fade_curve_t) itEvent->Param.NoteSynthParam.AbsValue; |
2027 |
|
break; |
2028 |
case Event::synth_param_pan: |
case Event::synth_param_pan: |
2029 |
if (relative) { |
if (relative) { |
2030 |
pNote->Override.Pan = RTMath::RelativeSummedAvg(pNote->Override.Pan, itEvent->Param.NoteSynthParam.Delta, ++pNote->Override.PanSources); |
pNote->Override.Pan = RTMath::RelativeSummedAvg(pNote->Override.Pan, itEvent->Param.NoteSynthParam.Delta, ++pNote->Override.PanSources); |
2040 |
case Event::synth_param_resonance: |
case Event::synth_param_resonance: |
2041 |
pNote->Override.Resonance = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
pNote->Override.Resonance = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2042 |
break; |
break; |
2043 |
|
case Event::synth_param_attack: |
2044 |
|
pNote->Override.Attack = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2045 |
|
break; |
2046 |
|
case Event::synth_param_decay: |
2047 |
|
pNote->Override.Decay = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2048 |
|
break; |
2049 |
|
case Event::synth_param_release: |
2050 |
|
pNote->Override.Release = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2051 |
|
break; |
2052 |
|
case Event::synth_param_amp_lfo_depth: |
2053 |
|
pNote->Override.AmpLFODepth = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2054 |
|
break; |
2055 |
|
case Event::synth_param_amp_lfo_freq: |
2056 |
|
pNote->Override.AmpLFOFreq = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2057 |
|
break; |
2058 |
|
case Event::synth_param_pitch_lfo_depth: |
2059 |
|
pNote->Override.PitchLFODepth = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2060 |
|
break; |
2061 |
|
case Event::synth_param_pitch_lfo_freq: |
2062 |
|
pNote->Override.PitchLFOFreq = itEvent->Param.NoteSynthParam.AbsValue = itEvent->Param.NoteSynthParam.Delta; |
2063 |
|
break; |
2064 |
} |
} |
2065 |
|
|
2066 |
// move note parameter event to its MIDI key |
// move note parameter event to its MIDI key |
2072 |
* Reset all voices and disk thread and clear input event queue and all |
* Reset all voices and disk thread and clear input event queue and all |
2073 |
* control and status variables. This method is protected by a mutex. |
* control and status variables. This method is protected by a mutex. |
2074 |
*/ |
*/ |
2075 |
virtual void ResetInternal() { |
virtual void ResetInternal() OVERRIDE { |
2076 |
LockGuard lock(ResetInternalMutex); |
LockGuard lock(ResetInternalMutex); |
2077 |
|
|
2078 |
// make sure that the engine does not get any sysex messages |
// make sure that the engine does not get any sysex messages |
2131 |
* @param pEngineChannel - engine channel on which all voices should be killed |
* @param pEngineChannel - engine channel on which all voices should be killed |
2132 |
* @param itKillEvent - event which caused this killing of all voices |
* @param itKillEvent - event which caused this killing of all voices |
2133 |
*/ |
*/ |
2134 |
virtual void KillAllVoices(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itKillEvent) { |
virtual void KillAllVoices(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itKillEvent) OVERRIDE { |
2135 |
EngineChannelBase<V, R, I>* pChannel = static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel); |
EngineChannelBase<V, R, I>* pChannel = static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel); |
2136 |
int count = pChannel->KillAllVoices(itKillEvent); |
int count = pChannel->KillAllVoices(itKillEvent); |
2137 |
VoiceSpawnsLeft -= count; //FIXME: just a temporary workaround, we should check the cause in StealVoice() instead |
VoiceSpawnsLeft -= count; //FIXME: just a temporary workaround, we should check the cause in StealVoice() instead |
2166 |
bool HandleKeyGroupConflicts |
bool HandleKeyGroupConflicts |
2167 |
) = 0; |
) = 0; |
2168 |
|
|
2169 |
virtual int GetMinFadeOutSamples() { return MinFadeOutSamples; } |
virtual int GetMinFadeOutSamples() OVERRIDE { return MinFadeOutSamples; } |
2170 |
|
|
2171 |
int InitNewVoice ( |
int InitNewVoice ( |
2172 |
EngineChannelBase<V, R, I>* pChannel, |
EngineChannelBase<V, R, I>* pChannel, |