3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 - 2017 Christian Schoenebeck * |
* Copyright (C) 2005 - 2019 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
197 |
synth_param_pitch_lfo_depth, |
synth_param_pitch_lfo_depth, |
198 |
synth_param_pitch_lfo_freq, |
synth_param_pitch_lfo_freq, |
199 |
}; |
}; |
200 |
|
enum class ValueScope : unsigned char { |
201 |
|
/** |
202 |
|
* The new synthesis parameter value should be applied |
203 |
|
* relatively to itself (as normalized value range), and then |
204 |
|
* applied relatively against other sources (i.e. LFOs, EGs) |
205 |
|
* for the same synthesis parameter. |
206 |
|
*/ |
207 |
|
SELF_RELATIVE, |
208 |
|
/** |
209 |
|
* The new synthesis paramater value of itself should be |
210 |
|
* replaced, and then applied relatively to other sources |
211 |
|
* (i.e. LFOs, EGs) for the same synthesis parameter. |
212 |
|
*/ |
213 |
|
RELATIVE, |
214 |
|
/** |
215 |
|
* The new synthesis parameter value should be applied |
216 |
|
* relatively to itself (as normalized value range), and then |
217 |
|
* applied directly (as normalized value range) as final value |
218 |
|
* of this synthesis chain, thus all other sources (i.e. LFOs, |
219 |
|
* EGs) should entirely be ignored. |
220 |
|
*/ |
221 |
|
FINAL_SELF_RELATIVE, |
222 |
|
/** |
223 |
|
* The new synthesis parameter value of itself should be |
224 |
|
* replaced, and then applied directly (as normalized value |
225 |
|
* range) as final value of this synthesis chain, thus all other |
226 |
|
* sources (i.e. LFOs, EGs) should entirely be ignored. |
227 |
|
*/ |
228 |
|
FINAL_NORM, |
229 |
|
/** |
230 |
|
* Same as @c FINAL_NORM, but this one is already in the native |
231 |
|
* unit (i.e. seconds, Hz) of this synthesis parameter. |
232 |
|
*/ |
233 |
|
FINAL_NATIVE, |
234 |
|
}; |
235 |
union { |
union { |
236 |
/// Note-on and note-off event specifics |
/// Note-on and note-off event specifics |
237 |
struct _Note { |
struct _Note { |
276 |
note_id_t NoteID; ///< ID of Note whose voices shall be modified. |
note_id_t NoteID; ///< ID of Note whose voices shall be modified. |
277 |
synth_param_t Type; ///< Synthesis parameter which is to be changed. |
synth_param_t Type; ///< Synthesis parameter which is to be changed. |
278 |
float Delta; ///< The value change that should be applied against the note's current synthesis parameter value. |
float Delta; ///< The value change that should be applied against the note's current synthesis parameter value. |
|
bool Relative; ///< Whether @c Delta should be applied relatively against the note's current synthesis parameter value (false means the paramter's current value is simply replaced by Delta). |
|
279 |
float AbsValue; ///< New current absolute value of synthesis parameter (that is after @c Delta being applied). |
float AbsValue; ///< New current absolute value of synthesis parameter (that is after @c Delta being applied). |
280 |
|
ValueScope Scope; ///< How @c Delta should be applied against @c AbsValue, and how @c AbsValue should then actually be applied to the synthesis chain. |
281 |
|
|
282 |
|
inline bool isFinal() const { return Scope >= ValueScope::FINAL_SELF_RELATIVE; } |
283 |
} NoteSynthParam; |
} NoteSynthParam; |
284 |
} Param; |
} Param; |
285 |
EngineChannel* pEngineChannel; ///< Pointer to the EngineChannel where this event occured on, NULL means Engine global event (e.g. SysEx message). |
EngineChannel* pEngineChannel; ///< Pointer to the EngineChannel where this event occured on, NULL means Engine global event (e.g. SysEx message). |
289 |
Param.Note.ID = 0; |
Param.Note.ID = 0; |
290 |
Param.Note.ParentNoteID = 0; |
Param.Note.ParentNoteID = 0; |
291 |
Param.NoteSynthParam.NoteID = 0; |
Param.NoteSynthParam.NoteID = 0; |
292 |
|
Param.NoteSynthParam.Scope = ValueScope::RELATIVE; |
293 |
} |
} |
294 |
inline int32_t FragmentPos() { |
inline int32_t FragmentPos() { |
295 |
if (iFragmentPos >= 0) return iFragmentPos; |
if (iFragmentPos >= 0) return iFragmentPos; |
307 |
inline sched_time_t SchedTime() { |
inline sched_time_t SchedTime() { |
308 |
return pEventGenerator->schedTimeAtCurrentFragmentStart() + FragmentPos(); |
return pEventGenerator->schedTimeAtCurrentFragmentStart() + FragmentPos(); |
309 |
} |
} |
310 |
|
inline static ValueScope scopeBy_FinalRelativeUnit(bool bFinal, bool bRelative, bool bNativeUnit) { |
311 |
|
if (!bFinal && bRelative) |
312 |
|
return ValueScope::SELF_RELATIVE; |
313 |
|
if (!bFinal) |
314 |
|
return ValueScope::RELATIVE; |
315 |
|
if (bRelative) |
316 |
|
return ValueScope::FINAL_SELF_RELATIVE; |
317 |
|
if (bNativeUnit) |
318 |
|
return ValueScope::FINAL_NATIVE; |
319 |
|
return ValueScope::FINAL_NORM; |
320 |
|
} |
321 |
protected: |
protected: |
322 |
typedef EventGenerator::time_stamp_t time_stamp_t; |
typedef EventGenerator::time_stamp_t time_stamp_t; |
323 |
Event(EventGenerator* pGenerator, EventGenerator::time_stamp_t Time); |
Event(EventGenerator* pGenerator, EventGenerator::time_stamp_t Time); |