Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
global_effectable_for_clip.h
1/*
2 * Copyright © 2016-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 "dsp/stereo_sample.h"
22#include "model/global_effectable/global_effectable.h"
23#include "model/sample/sample_recorder.h"
24
26class TimelineCounter;
27class Output;
28class Clip;
29class ModelStack;
32
33class GlobalEffectableForClip : public GlobalEffectable {
34public:
35 GlobalEffectableForClip();
36
37 int32_t getSidechainVolumeAmountAsPatchCableDepth(ParamManager* paramManager);
38 void modButtonAction(uint8_t whichModButton, bool on, ParamManagerForTimeline* paramManager) final;
39 bool modEncoderButtonAction(uint8_t whichModEncoder, bool on, ModelStackWithThreeMainThings* modelStack) final;
40 virtual Output* toOutput() = 0;
41 void getThingWithMostReverb(Clip* activeClip, Sound** soundWithMostReverb,
42 ParamManager** paramManagerWithMostReverb,
43 GlobalEffectableForClip** globalEffectableWithMostReverb,
44 int32_t* highestReverbAmountFound);
45
46 [[gnu::always_inline]] q31_t saturate(q31_t data, uint32_t* workingValue) {
47 // Clipping
48 if (clippingAmount != 0u) {
49 int32_t shiftAmount = (clippingAmount >= 3) ? (clippingAmount - 3) : 0;
50 //*data = getTanHUnknown(*data, 5 + clippingAmount) << (shiftAmount);
51 return getTanHAntialiased(data, workingValue, 3 + clippingAmount) << (shiftAmount);
52 }
53 return data;
54 }
55
56 std::array<uint32_t, 2> lastSaturationTanHWorkingValue = {2147483648u, 2147483648u};
57
58protected:
59 int32_t getParameterFromKnob(int32_t whichModEncoder) final;
60 void renderOutput(ModelStackWithTimelineCounter* modelStack, ParamManager* paramManagerForClip,
61 std::span<StereoSample> output, int32_t* reverbBuffer, int32_t reverbAmountAdjust,
62 int32_t sideChainHitPending, bool shouldLimitDelayFeedback, bool isClipActive,
63 OutputType outputType, SampleRecorder* recorder);
64
65 virtual bool renderGlobalEffectableForClip(ModelStackWithTimelineCounter* modelStack,
66 std::span<StereoSample> globalEffectableBuffer,
67 int32_t* bufferToTransferTo, int32_t* reverbBuffer,
68 int32_t reverbAmountAdjust, int32_t sideChainHitPending,
69 bool shouldLimitDelayFeedback, bool isClipActive, int32_t pitchAdjust,
70 int32_t amplitudeAtStart, int32_t amplitudeAtEnd) = 0;
71
72 virtual bool willRenderAsOneChannelOnlyWhichWillNeedCopying() { return false; }
73
74private:
75 bool renderedLastTime = false;
76};
Definition clip.h:46
Definition model_stack.h:231
Definition model_stack.h:129
Definition model_stack.h:123
Definition output.h:81
Definition param_manager.h:174
Definition param_manager.h:45
Definition sample_recorder.h:49
Definition sound.h:71
Definition timeline_counter.h:28