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 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 * |
28 |
|
|
29 |
#include "../../common/global.h" |
#include "../../common/global.h" |
30 |
#include "../../common/RTMath.h" |
#include "../../common/RTMath.h" |
31 |
#include "../../common/RTELMemoryPool.h" |
#include "../../common/Pool.h" |
32 |
#include "../common/Event.h" |
#include "../common/Event.h" |
33 |
#include "Manipulator.h" |
#include "Manipulator.h" |
34 |
#include "Engine.h" |
#include "Engine.h" |
35 |
|
|
|
#define EG_ENVELOPE_LIMIT 0.001 |
|
|
#define EG_MIN_RELEASE_TIME 0.005 |
|
|
|
|
36 |
namespace LinuxSampler { namespace gig { |
namespace LinuxSampler { namespace gig { |
37 |
|
|
38 |
/** |
/** |
51 |
stage_decay2, |
stage_decay2, |
52 |
stage_sustain, |
stage_sustain, |
53 |
stage_release, |
stage_release, |
54 |
|
stage_fadeout, |
55 |
stage_end |
stage_end |
56 |
}; |
}; |
57 |
|
|
58 |
EGADSR(gig::Engine* pEngine, Event::destination_t ModulationDestination); |
EGADSR(gig::Engine* pEngine, Event::destination_t ModulationDestination); |
59 |
void Process(uint TotalSamples, RTEList<Event>* pEvents, Event* pTriggerEvent, double SamplePos, double CurrentPitch, Event* pKillEvent = NULL); |
void Process(uint TotalSamples, RTList<Event>* pEvents, RTList<Event>::Iterator itTriggerEvent, double SamplePos, double CurrentPitch, RTList<Event>::Iterator itKillEvent = RTList<Event>::Iterator()); |
60 |
void Trigger(uint PreAttack, double AttackTime, bool HoldAttack, long LoopStart, double Decay1Time, double Decay2Time, bool InfiniteSustain, uint SustainLevel, double ReleaseTime, uint Delay); |
void Trigger(uint PreAttack, double AttackTime, bool HoldAttack, long LoopStart, double Decay1Time, double Decay2Time, bool InfiniteSustain, uint SustainLevel, double ReleaseTime, uint Delay); |
61 |
inline EGADSR::stage_t GetStage() { return Stage; } |
inline EGADSR::stage_t GetStage() { return Stage; } |
62 |
protected: |
protected: |
77 |
float ReleaseCoeff; |
float ReleaseCoeff; |
78 |
long ReleaseStepsLeft; ///< number of sample points til end of release stage |
long ReleaseStepsLeft; ///< number of sample points til end of release stage |
79 |
bool ReleasePostponed; ///< If a "release" event occured in the previous audio fragment, but wasn't processed yet. |
bool ReleasePostponed; ///< If a "release" event occured in the previous audio fragment, but wasn't processed yet. |
80 |
const static float EndCoeff; |
const static float FadeOutCoeff; |
81 |
private: |
private: |
82 |
static float CalculateEndCoeff(); |
static float CalculateFadeOutCoeff(); |
83 |
}; |
}; |
84 |
|
|
85 |
}} // namespace LinuxSampler::gig |
}} // namespace LinuxSampler::gig |