--- linuxsampler/trunk/src/engines/common/Note.h 2016/04/19 15:49:34 2880 +++ linuxsampler/trunk/src/engines/common/Note.h 2016/07/17 17:54:04 2962 @@ -28,6 +28,19 @@ RTList* pChildNotes; ///< Note ID list of "child" notes of this note. These are special notes that must be released once this note gets released. Event cause; ///< Copy of the original event (usually a note-on event) which caused this note. event_id_t eventID; ///< Unique ID of the actual original @c Event which caused this note. + sched_time_t triggerSchedTime; ///< Engine's scheduler time when this note was launched. + /// Optional synthesis parameters that might be overridden (by calling real-time instrument script functions like change_vol(), change_pitch(), etc.). + struct _Override { + float Volume; ///< as linear amplification ratio (1.0 being neutral) + float Pitch; ///< as linear frequency ratio (1.0 being neutral) + float Pan; ///< between -1.0 (most left) and +1.0 (most right) and 0.0 being neutral. + int64_t PanSources; ///< Might be used for calculating an average pan value in differential way: amount of times the Pan value had been changed and shall be calculated relatively upon. + float Cutoff; ///< between 0.0 and 1.0 + float Resonance; ///< between 0.0 and 1.0 + float Attack; ///< between 0.0 and 1.0 + float Decay; ///< between 0.0 and 1.0 + float Release; ///< between 0.0 and 1.0 + } Override; /// Sampler format specific informations and variables. union _Format { /// Gigasampler/GigaStudio format specifics. @@ -38,13 +51,38 @@ } Format; protected: NoteBase() : hostKey(0), parentNoteID(0), pChildNotes(NULL) { + Override.Volume = 1.f; + Override.Pitch = 1.f; + Override.Pan = 0.f; + Override.PanSources = 0; + Override.Cutoff = 1.f; + Override.Resonance = 1.f; + Override.Attack = 1.f; + Override.Decay = 1.f; + Override.Release = 1.f; Format = _Format(); } }; /** * Contains the voices caused by one specific note, as well as basic - * informations about the note itself. + * informations about the note itself. You can see a Note object as one + * specific event in time where one or more voices were spawned at the same + * time and all those voices due to the same cause. + * + * For example when you press down and hold the sustain pedal, and then + * trigger the same note on the keyboard multiple times, for each key + * strokes a separate Note instance is created. + * + * If your instrument contains a real-time instrument script, then that + * script might also trigger additional voices programmatically (by + * calling the built-in script function play_note()). Each time the script + * calls play_note() a new Note instance is created and the script may then + * further control the voices of specific notes independently from each + * other. For example for each key stroke on your keyboard the instrument + * script might trigger 3 additional notes programmatically and assign a + * different tuning filter parameters for each one of the 3 notes + * independently. */ template class Note : public NoteBase { @@ -72,6 +110,15 @@ pChildNotes->clear(); cause = Event(); eventID = 0; + Override.Volume = 1.f; + Override.Pitch = 1.f; + Override.Pan = 0.f; + Override.PanSources = 0; + Override.Cutoff = 1.f; + Override.Resonance = 1.f; + Override.Attack = 1.f; + Override.Decay = 1.f; + Override.Release = 1.f; Format = _Format(); if (pActiveVoices) { typename RTList::Iterator itVoice = pActiveVoices->first();