tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_RandomModifier.h
Go to the documentation of this file.
1 /*
2 ,--. ,--. ,--. ,--.
3 ,-' '-.,--.--.,--,--.,---.| |,-.,-' '-.`--' ,---. ,--,--, Copyright 2024
4 '-. .-'| .--' ,-. | .--'| /'-. .-',--.| .-. || \ Tracktion Software
5 | | | | \ '-' \ `--.| \ \ | | | |' '-' '| || | Corporation
6 `---' `--' `--`--'`---'`--'`--' `---' `--' `---' `--''--' www.tracktion.com
7
8 Tracktion Engine uses a GPL/commercial licence - see LICENCE.md for details.
9*/
10
11namespace tracktion { inline namespace engine
12{
13
15class RandomModifier : public Modifier,
17{
18public:
19 //==============================================================================
21 ~RandomModifier() override;
22
25
27 void initialise() override;
28 juce::String getName() const override { return TRANS("Random Modifier"); }
29
30 //==============================================================================
34 float getCurrentValue() override;
35
37 float getCurrentPhase() const noexcept;
38
40
42 void applyToBuffer (const PluginRenderContext&) override;
43
44 //==============================================================================
46 {
48
49 bool isForModifierSource (const ModifierSource&) const override;
51
52 const EditItemID randomModifierID;
53
55 };
56
57 //==============================================================================
58 juce::String getSelectableDescription() override { return getName(); }
59
60 //==============================================================================
61 enum Type
62 {
63 random = 0,
64 noise = 1
65 };
66
67 static juce::StringArray getTypeNames();
68
69 juce::CachedValue<float> type, shape, syncType, rate, rateType, depth, stepDepth, smooth, bipolar;
70
71 AutomatableParameter::Ptr typeParam, shapeParam, syncTypeParam, rateParam, rateTypeParam, depthParam, stepDepthParam, smoothParam, bipolarParam;
72
73private:
74 struct RandomModifierTimer;
76
77 juce::Random rand;
78 LambdaTimer changedTimer;
79 std::atomic<float> currentPhase { 1.0f }, currentValue { 0.0f };
80 float previousRandom = 0.0f, currentRandom = 0.0f, randomDifference = 0.0f;
81
82 void setPhase (float newPhase);
83 void valueTreeChanged() override;
84};
85
86}} // namespace tracktion { inline namespace engine
The Tracktion Edit class!
float getCurrentValue() override
Returns the current value of the LFO.
void applyToBuffer(const PluginRenderContext &) override
Sub classes should implement this to process the Modifier.
AutomatableParameter::ModifierAssignment * createAssignment(const juce::ValueTree &) override
Must return a new ModifierAssignment for a given state.
juce::String getSelectableDescription() override
Subclasses must return a description of what they are.
float getCurrentPhase() const noexcept
Returns the current phase between 0 & 1.
void initialise() override
Call this once after construction to connect it to the audio graph.
ProcessingPosition getProcessingPosition() override
Should return the position in the plugin chain that this Modifier should be processed.
#define TRANS(stringLiteral)
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Connects a modifier source to an AutomatableParameter.
ID for objects of type EditElement - e.g.
Bass class for parameter Modifiers.
virtual void initialise()=0
Call this once after construction to connect it to the audio graph.
ProcessingPosition
Determines the position in the FX chain where the modifier should be processed.
@ preFX
The Modifier is processed before the plugn chain.
The context passed to plugin render methods to provide it with buffers to fill.