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 |
/** |
/** |
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 |
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; |
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 |
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; |