Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
envelope.h
1/*
2 * Copyright © 2014-2023 Synthstrom Audible Limited
3 *
4 * This file is part of The Synthstrom Audible Deluge Firmware.
5 *
6 * The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software Foundation,
8 * either version 3 of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along with this program.
15 * If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20#include "definitions_cxx.hpp"
21#include <cstdint>
22
23class Sound;
24class Voice;
26constexpr uint32_t SOFT_CULL_INCREMENT = 65536;
27class Envelope {
28public:
29 Envelope();
30
31 uint32_t pos;
32 EnvelopeStage state; // You may not set this directly, even from this class. Call setState()
33 int32_t lastValue;
34 int32_t lastValuePreCurrentStage;
35 uint32_t timeEnteredState;
36 bool ignoredNoteOff;
37 uint32_t fastReleaseIncrement{1024};
38 int32_t noteOn(bool directlyToDecay);
39 int32_t noteOn(uint8_t envelopeIndex, Sound* sound, Voice* voice);
40 void noteOff(uint8_t envelopeIndex, Sound* sound, ParamManagerForTimeline* paramManager);
41 int32_t render(uint32_t numSamples, uint32_t attack, uint32_t decay, uint32_t sustain, uint32_t release,
42 const uint16_t* releaseTable);
43 void unconditionalRelease(EnvelopeStage typeOfRelease = EnvelopeStage::RELEASE,
44 uint32_t newFastReleaseIncrement = 4096);
45 void unconditionalOff();
46 void resumeAttack(int32_t oldLastValue);
47 void resetTimeEntered();
48
49private:
50 void setState(EnvelopeStage newState);
51 int32_t smoothedSustain{0};
52};
void resetTimeEntered()
resets time to give drone notes a lower likelihood of being culled, since they'll stay in sustain as ...
Definition envelope.cpp:151
Definition param_manager.h:174
Definition sound.h:71
Definition voice.h:35