873 |
dmsg(5,("Engine: Pitchbend received\n")); |
dmsg(5,("Engine: Pitchbend received\n")); |
874 |
ProcessPitchbend(static_cast<AbstractEngineChannel*>(itEvent->pEngineChannel), itEvent); |
ProcessPitchbend(static_cast<AbstractEngineChannel*>(itEvent->pEngineChannel), itEvent); |
875 |
break; |
break; |
876 |
|
case Event::type_note_synth_param: |
877 |
|
dmsg(5,("Engine: Note Synth Param received\n")); |
878 |
|
ProcessNoteSynthParam(itEvent->pEngineChannel, itEvent); |
879 |
|
break; |
880 |
} |
} |
881 |
} |
} |
882 |
} |
} |
1842 |
} |
} |
1843 |
|
|
1844 |
/** |
/** |
1845 |
|
* Called on note synthesis parameter change events. These are |
1846 |
|
* internal events caused by calling built-in real-time instrument |
1847 |
|
* script functions like change_vol(), change_pitch(), etc. |
1848 |
|
* |
1849 |
|
* This method performs two tasks: |
1850 |
|
* |
1851 |
|
* - It converts the event's relative values changes (Deltas) to |
1852 |
|
* the respective final new synthesis parameter value (AbsValue), |
1853 |
|
* for that particular moment of the event that is. |
1854 |
|
* |
1855 |
|
* - It moves the individual events to the Note's own event list |
1856 |
|
* (or actually to the event list of the MIDI key), so that |
1857 |
|
* voices can process those events sample accurately. |
1858 |
|
* |
1859 |
|
* @param pEngineChannel - engine channel on which this event occurred on |
1860 |
|
* @param itEvent - note synthesis parameter change event |
1861 |
|
*/ |
1862 |
|
virtual void ProcessNoteSynthParam(EngineChannel* pEngineChannel, RTList<Event>::Iterator& itEvent) OVERRIDE { |
1863 |
|
EngineChannelBase<V, R, I>* pChannel = static_cast<EngineChannelBase<V, R, I>*>(pEngineChannel); |
1864 |
|
|
1865 |
|
NoteBase* pNote = pChannel->pEngine->NoteByID( itEvent->Param.NoteSynthParam.NoteID ); |
1866 |
|
if (!pNote || pNote->hostKey < 0 || pNote->hostKey >= 128) return; |
1867 |
|
|
1868 |
|
const bool& relative = itEvent->Param.NoteSynthParam.Relative; |
1869 |
|
|
1870 |
|
switch (itEvent->Param.NoteSynthParam.Type) { |
1871 |
|
case Event::synth_param_volume: |
1872 |
|
if (relative) |
1873 |
|
pNote->Override.Volume *= itEvent->Param.NoteSynthParam.Delta; |
1874 |
|
else |
1875 |
|
pNote->Override.Volume = itEvent->Param.NoteSynthParam.Delta; |
1876 |
|
itEvent->Param.NoteSynthParam.AbsValue = pNote->Override.Volume; |
1877 |
|
break; |
1878 |
|
case Event::synth_param_pitch: |
1879 |
|
if (relative) |
1880 |
|
pNote->Override.Pitch *= itEvent->Param.NoteSynthParam.Delta; |
1881 |
|
else |
1882 |
|
pNote->Override.Pitch = itEvent->Param.NoteSynthParam.Delta; |
1883 |
|
itEvent->Param.NoteSynthParam.AbsValue = pNote->Override.Pitch; |
1884 |
|
break; |
1885 |
|
case Event::synth_param_pan: |
1886 |
|
if (relative) { |
1887 |
|
pNote->Override.Pan = RTMath::RelativeSummedAvg(pNote->Override.Pan, itEvent->Param.NoteSynthParam.Delta, ++pNote->Override.PanSources); |
1888 |
|
} else { |
1889 |
|
pNote->Override.Pan = itEvent->Param.NoteSynthParam.Delta; |
1890 |
|
pNote->Override.PanSources = 1; // only relevant on subsequent change_pan() instrument script calls on same note with 'relative' argument being set |
1891 |
|
} |
1892 |
|
itEvent->Param.NoteSynthParam.AbsValue = pNote->Override.Pan; |
1893 |
|
break; |
1894 |
|
} |
1895 |
|
|
1896 |
|
// move note parameter event to its MIDI key |
1897 |
|
MidiKey* pKey = &pChannel->pMIDIKeyInfo[pNote->hostKey]; |
1898 |
|
itEvent.moveToEndOf(pKey->pEvents); |
1899 |
|
} |
1900 |
|
|
1901 |
|
/** |
1902 |
* 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 |
1903 |
* control and status variables. This method is protected by a mutex. |
* control and status variables. This method is protected by a mutex. |
1904 |
*/ |
*/ |