/[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 2953 by schoenebeck, Sat Jul 16 11:24:39 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.).          /// Optional synthesis parameters that might be overridden (by calling real-time instrument script functions like change_vol(), change_pitch(), etc.).
36          struct  _Override {          struct  _Override {
37              float Volume;       ///< as linear amplification ratio (1.0 being neutral)              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)              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.              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.              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              float Cutoff;       ///< between 0.0 and 1.0
# Line 39  namespace LinuxSampler { Line 45  namespace LinuxSampler {
45              float Attack;       ///< between 0.0 and 1.0              float Attack;       ///< between 0.0 and 1.0
46              float Decay;        ///< between 0.0 and 1.0              float Decay;        ///< between 0.0 and 1.0
47              float Release;      ///< between 0.0 and 1.0              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;          } Override;
53          /// Sampler format specific informations and variables.          /// Sampler format specific informations and variables.
54          union _Format {          union _Format {
# Line 51  namespace LinuxSampler { Line 61  namespace LinuxSampler {
61      protected:      protected:
62          NoteBase() : hostKey(0), parentNoteID(0), pChildNotes(NULL) {          NoteBase() : hostKey(0), parentNoteID(0), pChildNotes(NULL) {
63              Override.Volume     = 1.f;              Override.Volume     = 1.f;
64                Override.VolumeTime = DEFAULT_NOTE_VOLUME_TIME_S;
65              Override.Pitch      = 1.f;              Override.Pitch      = 1.f;
66                Override.PitchTime  = DEFAULT_NOTE_PITCH_TIME_S;
67              Override.Pan        = 0.f;              Override.Pan        = 0.f;
68              Override.PanSources = 0;              Override.PanSources = 0;
69              Override.Cutoff     = 1.f;              Override.Cutoff     = 1.f;
# Line 59  namespace LinuxSampler { Line 71  namespace LinuxSampler {
71              Override.Attack     = 1.f;              Override.Attack     = 1.f;
72              Override.Decay      = 1.f;              Override.Decay      = 1.f;
73              Override.Release    = 1.f;              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();              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. You can see a Note object as one       * 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       * 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.       * 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       * 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       * trigger the same note on the keyboard multiple times, for each key
91       * strokes a separate Note instance is created.       * 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       * If your instrument contains a real-time instrument script, then that
98       * script might also trigger additional voices programmatically (by       * script might also trigger additional voices programmatically (by
# Line 110  namespace LinuxSampler { Line 131  namespace LinuxSampler {
131              cause = Event();              cause = Event();
132              eventID = 0;              eventID = 0;
133              Override.Volume     = 1.f;              Override.Volume     = 1.f;
134                Override.VolumeTime = DEFAULT_NOTE_VOLUME_TIME_S;
135              Override.Pitch      = 1.f;              Override.Pitch      = 1.f;
136                Override.PitchTime  = DEFAULT_NOTE_PITCH_TIME_S;
137              Override.Pan        = 0.f;              Override.Pan        = 0.f;
138              Override.PanSources = 0;              Override.PanSources = 0;
139              Override.Cutoff     = 1.f;              Override.Cutoff     = 1.f;
# Line 118  namespace LinuxSampler { Line 141  namespace LinuxSampler {
141              Override.Attack     = 1.f;              Override.Attack     = 1.f;
142              Override.Decay      = 1.f;              Override.Decay      = 1.f;
143              Override.Release    = 1.f;              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();              Format = _Format();
149              if (pActiveVoices) {              if (pActiveVoices) {
150                  typename RTList<V>::Iterator itVoice = pActiveVoices->first();                  typename RTList<V>::Iterator itVoice = pActiveVoices->first();

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

  ViewVC Help
Powered by ViewVC