MCPcopy Create free account
hub / github.com/LabSound/LabSound / ADSRNode

Class ADSRNode

include/LabSound/extended/ADSRNode.h:15–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14
15class ADSRNode : public AudioNode
16{
17 class ADSRNodeImpl;
18 ADSRNodeImpl * adsr_impl;
19
20public:
21 ADSRNode(AudioContext &);
22 virtual ~ADSRNode();
23
24 static const char* static_name() { return "ADSR"; }
25 virtual const char* name() const override { return static_name(); }
26 static AudioNodeDescriptor * desc();
27
28 // This function will return true after the release period (only if a noteOff has been issued).
29 bool finished(ContextRenderLock &);
30
31 void set(float attack_time, float attack_level, float decay_time, float sustain_time, float sustain_level, float release_time);
32
33 virtual void process(ContextRenderLock& r, int bufferSize) override;
34 virtual void reset(ContextRenderLock&) override;
35 virtual double tailTime(ContextRenderLock& r) const override { return 0.; }
36 virtual double latencyTime(ContextRenderLock& r) const override { return 0.f; }
37
38 // gate is a two state signal. Changing the gate signal to one means that the attack/decay segment will start
39 // If oneShot is false, sustainTime is ignored, and sustain is held until gain goes to zero.
40 // If oneShot is true, transitioning the gate to zero has no effect.
41 std::shared_ptr<AudioParam> gate() const; // gate signal
42 std::shared_ptr<AudioSetting> oneShot() const; // If false, gate controls attack and sustain, else sustainTime controls sustain
43
44 std::shared_ptr<AudioSetting> attackTime() const; // Duration in seconds
45 std::shared_ptr<AudioSetting> attackLevel() const; // Level
46 std::shared_ptr<AudioSetting> decayTime() const; // Duration in seconds
47 std::shared_ptr<AudioSetting> sustainTime() const; // Duration in seconds
48 std::shared_ptr<AudioSetting> sustainLevel() const; // Level
49 std::shared_ptr<AudioSetting> releaseTime() const; // Duration in seconds
50};
51
52}
53

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected