LMMS
Loading...
Searching...
No Matches
SFZEG.h
Go to the documentation of this file.
1/*************************************************************************************
2 * Original code copyright (C) 2012 Steve Folta
3 * Converted to Juce module (C) 2016 Leo Olivers
4 * Forked from https://github.com/stevefolta/SFZero
5 * For license info please see the LICENSE file distributed with this source code
6 *************************************************************************************/
7#ifndef SFZEG_H_INCLUDED
8#define SFZEG_H_INCLUDED
9
10#include "SFZRegion.h"
11
12#include "CarlaJuceUtils.hpp"
13
14namespace sfzero
15{
16class EG
17{
18public:
19 EG();
20 virtual ~EG() {}
21
22 void setExponentialDecay(bool newExponentialDecay);
23 void startNote(const EGParameters *parameters, float floatVelocity, double sampleRate, const EGParameters *velMod = nullptr);
24 void nextSegment();
25 void noteOff();
26 void fastRelease();
27 bool isDone() { return (segment_ == Done); }
28 bool isReleasing() { return (segment_ == Release); }
29 int segmentIndex() { return static_cast<int>(segment_); }
30 float getLevel() const { return level_; }
31 void setLevel(float v) { level_ = v; }
32 float getSlope() const { return slope_; }
33 void setSlope(float v) { slope_ = v; }
38
39private:
50
51 void startDelay();
52 void startAttack();
53 void startHold();
54 void startDecay();
55 void startSustain();
56 void startRelease();
57
62 float level_;
63 float slope_;
66 static const float BottomLevel;
67 CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(EG)
68};
69}
70
71#endif // SFZEG_H_INCLUDED
void setSamplesUntilNextSegment(int v)
Definition SFZEG.h:35
void startRelease()
Definition SFZEG.cpp:192
void setSlope(float v)
Definition SFZEG.h:33
int segmentIndex()
Definition SFZEG.h:29
void noteOff()
Definition SFZEG.cpp:78
bool segmentIsExponential_
Definition SFZEG.h:65
void startNote(const EGParameters *parameters, float floatVelocity, double sampleRate, const EGParameters *velMod=nullptr)
Definition SFZEG.cpp:21
int getSamplesUntilNextSegment() const
Definition SFZEG.h:34
float slope_
Definition SFZEG.h:63
void startSustain()
Definition SFZEG.cpp:176
EG()
Definition SFZEG.cpp:14
bool getSegmentIsExponential() const
Definition SFZEG.h:36
virtual ~EG()
Definition SFZEG.h:20
void startDecay()
Definition SFZEG.cpp:137
Segment segment_
Definition SFZEG.h:58
void setExponentialDecay(bool newExponentialDecay)
Definition SFZEG.cpp:19
void setSegmentIsExponential(bool v)
Definition SFZEG.h:37
EGParameters parameters_
Definition SFZEG.h:59
void startHold()
Definition SFZEG.cpp:120
bool isReleasing()
Definition SFZEG.h:28
void startDelay()
Definition SFZEG.cpp:88
void startAttack()
Definition SFZEG.cpp:104
Segment
Definition SFZEG.h:41
@ Sustain
Definition SFZEG.h:46
@ Attack
Definition SFZEG.h:43
@ Release
Definition SFZEG.h:47
@ Done
Definition SFZEG.h:48
@ Delay
Definition SFZEG.h:42
@ Decay
Definition SFZEG.h:45
@ Hold
Definition SFZEG.h:44
void setLevel(float v)
Definition SFZEG.h:31
float getSlope() const
Definition SFZEG.h:32
int samplesUntilNextSegment_
Definition SFZEG.h:64
bool exponentialDecay_
Definition SFZEG.h:61
double sampleRate_
Definition SFZEG.h:60
bool isDone()
Definition SFZEG.h:27
static const float BottomLevel
Definition SFZEG.h:66
void fastRelease()
Definition SFZEG.cpp:80
float level_
Definition SFZEG.h:62
void nextSegment()
Definition SFZEG.cpp:47
float getLevel() const
Definition SFZEG.h:30
unsigned v[N_MAX]
Definition inflate.c:1584
Definition SFZDebug.cpp:11
Definition SFZRegion.h:22