/[svn]/linuxsampler/trunk/src/engines/common/Note.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/common/Note.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2879 by schoenebeck, Tue Apr 19 14:07:53 2016 UTC revision 3188 by schoenebeck, Fri May 19 14:23:12 2017 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (c) 2016 Christian Schoenebeck   * Copyright (c) 2016 - 2017 Christian Schoenebeck
3   *   *
4   * http://www.linuxsampler.org   * http://www.linuxsampler.org
5   *   *
# Line 13  Line 13 
13  #include "../../common/Pool.h"  #include "../../common/Pool.h"
14  #include "Event.h"  #include "Event.h"
15    
16    #define DEFAULT_NOTE_VOLUME_TIME_S  0.013 /* 13ms */
17    #define DEFAULT_NOTE_PITCH_TIME_S   0.013 /* 13ms */
18    
19  namespace LinuxSampler {  namespace LinuxSampler {
20    
21      /**      /**
# Line 28  namespace LinuxSampler { Line 31  namespace LinuxSampler {
31          RTList<note_id_t>* pChildNotes; ///< Note ID list of "child" notes of this note. These are special notes that must be released once this note gets released.          RTList<note_id_t>* pChildNotes; ///< Note ID list of "child" notes of this note. These are special notes that must be released once this note gets released.
32          Event cause; ///< Copy of the original event (usually a note-on event) which caused this note.          Event cause; ///< Copy of the original event (usually a note-on event) which caused this note.
33          event_id_t eventID; ///< Unique ID of the actual original @c Event which caused this note.          event_id_t eventID; ///< Unique ID of the actual original @c Event which caused this note.
34            sched_time_t triggerSchedTime; ///< Engine's scheduler time when this note was launched.
35            /// Optional synthesis parameters that might be overridden (by calling real-time instrument script functions like change_vol(), change_pitch(), etc.).
36            struct  _Override {
37                float Volume;       ///< as linear amplification ratio (1.0 being neutral)
38                float VolumeTime;   ///< Transition duration (in seconds) for changes to @c Volume.
39                float Pitch;        ///< as linear frequency ratio (1.0 being neutral)
40                float PitchTime;    ///< Transition duration (in seconds) for changes to @c Pitch.
41                float Pan;          ///< between -1.0 (most left) and +1.0 (most right) and 0.0 being neutral.
42                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.
43                float Cutoff;       ///< between 0.0 and 1.0
44                float Resonance;    ///< between 0.0 and 1.0
45                float Attack;       ///< between 0.0 and 1.0
46                float Decay;        ///< between 0.0 and 1.0
47                float Release;      ///< between 0.0 and 1.0
48                float AmpLFODepth;  ///< between 0.0 and 1.0
49                float AmpLFOFreq;   ///< between 0.0 and 1.0
50                float PitchLFODepth; ///< between 0.0 and 1.0
51                float PitchLFOFreq; ///< between 0.0 and 1.0
52            } Override;
53          /// Sampler format specific informations and variables.          /// Sampler format specific informations and variables.
54          union _Format {          union _Format {
55              /// Gigasampler/GigaStudio format specifics.              /// Gigasampler/GigaStudio format specifics.
# Line 38  namespace LinuxSampler { Line 60  namespace LinuxSampler {
60          } Format;          } Format;
61      protected:      protected:
62          NoteBase() : hostKey(0), parentNoteID(0), pChildNotes(NULL) {          NoteBase() : hostKey(0), parentNoteID(0), pChildNotes(NULL) {
63              Format = (_Format) {};              Override.Volume     = 1.f;
64                Override.VolumeTime = DEFAULT_NOTE_VOLUME_TIME_S;
65                Override.Pitch      = 1.f;
66                Override.PitchTime  = DEFAULT_NOTE_PITCH_TIME_S;
67                Override.Pan        = 0.f;
68                Override.PanSources = 0;
69                Override.Cutoff     = 1.f;
70                Override.Resonance  = 1.f;
71                Override.Attack     = 1.f;
72                Override.Decay      = 1.f;
73                Override.Release    = 1.f;
74                Override.AmpLFODepth   = 1.f;
75                Override.AmpLFOFreq    = 1.f;
76                Override.PitchLFODepth = 1.f;
77                Override.PitchLFOFreq  = 1.f;
78    
79                Format = _Format();
80          }          }
81      };      };
82    
83      /**      /**
84       * Contains the voices caused by one specific note, as well as basic       * Contains the voices caused by one specific note, as well as basic
85       * informations about the note itself.       * information about the note itself. You can see a Note object as one
86         * specific event in time where one or more voices were spawned at the same
87         * time and all those voices due to the same cause.
88         *
89         * For example when you press down and hold the sustain pedal, and then
90         * trigger the same note on the keyboard multiple times, for each key
91         * strokes a separate Note instance is created. Assuming you have a layered
92         * sound with 4 layers, then for each note that is triggered 4 voices will
93         * be spawned and assigned to the same Note object. By grouping those voices
94         * to one specific Note object, it allows to control the synthesis paramters
95         * of those layered voices simultaniously.
96         *
97         * If your instrument contains a real-time instrument script, then that
98         * script might also trigger additional voices programmatically (by
99         * calling the built-in script function play_note()). Each time the script
100         * calls play_note() a new Note instance is created and the script may then
101         * further control the voices of specific notes independently from each
102         * other. For example for each key stroke on your keyboard the instrument
103         * script might trigger 3 additional notes programmatically and assign a
104         * different tuning filter parameters for each one of the 3 notes
105         * independently.
106       */       */
107      template<class V>      template<class V>
108      class Note : public NoteBase {      class Note : public NoteBase {
# Line 72  namespace LinuxSampler { Line 130  namespace LinuxSampler {
130                  pChildNotes->clear();                  pChildNotes->clear();
131              cause = Event();              cause = Event();
132              eventID = 0;              eventID = 0;
133              Format = (_Format) {};              Override.Volume     = 1.f;
134                Override.VolumeTime = DEFAULT_NOTE_VOLUME_TIME_S;
135                Override.Pitch      = 1.f;
136                Override.PitchTime  = DEFAULT_NOTE_PITCH_TIME_S;
137                Override.Pan        = 0.f;
138                Override.PanSources = 0;
139                Override.Cutoff     = 1.f;
140                Override.Resonance  = 1.f;
141                Override.Attack     = 1.f;
142                Override.Decay      = 1.f;
143                Override.Release    = 1.f;
144                Override.AmpLFODepth   = 1.f;
145                Override.AmpLFOFreq    = 1.f;
146                Override.PitchLFODepth = 1.f;
147                Override.PitchLFOFreq  = 1.f;
148                Format = _Format();
149              if (pActiveVoices) {              if (pActiveVoices) {
150                  typename RTList<V>::Iterator itVoice = pActiveVoices->first();                  typename RTList<V>::Iterator itVoice = pActiveVoices->first();
151                  typename RTList<V>::Iterator itVoicesEnd = pActiveVoices->end();                  typename RTList<V>::Iterator itVoicesEnd = pActiveVoices->end();

Legend:
Removed from v.2879  
changed lines
  Added in v.3188

  ViewVC Help
Powered by ViewVC