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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_MIDITrackerModifier.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
17{
18public:
19 //==============================================================================
21 ~MIDITrackerModifier() override;
22
25
27 void initialise() override;
28 juce::String getName() const override { return TRANS("MIDI Tracker Modifier"); }
29
30 //==============================================================================
32 float getCurrentValue() override;
33
35 int getCurrentMIDIValue() const noexcept;
36
38
41
42 void applyToBuffer (const PluginRenderContext&) override;
43
44 //==============================================================================
46 {
48
49 bool isForModifierSource (const ModifierSource&) const override;
50 juce::ReferenceCountedObjectPtr<MIDITrackerModifier> getMIDITrackerModifier() const;
51
52 const EditItemID midiTrackerModifierID;
53
55 };
56
57 //==============================================================================
58 juce::String getSelectableDescription() override { return getName(); }
59
60 //==============================================================================
61 enum Type
62 {
63 pitch = 0,
64 velocity = 1
65 };
66
67 static juce::StringArray getTypeNames();
68
69 enum Mode
70 {
71 absolute = 0,
72 relative = 1
73 };
74
75 static juce::StringArray getModeNames();
76
80 juce::ValueTree getNodeState() const { return nodeState; }
81
82 juce::CachedValue<float> type, mode, relativeRoot, relativeSpread;
83
84 AutomatableParameter::Ptr typeParam, modeParam, relativeRootParam, relativeSpreadParam;
85
86private:
87 juce::ValueTree nodeState;
88
89 LambdaTimer changedTimer;
90 std::atomic<float> currentModifierValue { 0.0f };
91 std::atomic<int> currentMIDIValue { 0 };
92
93 struct Map { std::pair<int, float> node[5]; } currentMap;
94 const juce::SpinLock mapLock;
95
96 void refreshCurrentValue();
97 void updateMapFromTree();
98 void updateValueFromMap (int);
99
100 void midiEvent (const juce::MidiMessage&);
101
102 void valueTreeChanged() override;
103 void valueTreePropertyChanged (juce::ValueTree&, const juce::Identifier&) override;
104};
105
106}} // namespace tracktion { inline namespace engine
The Tracktion Edit class!
AutomatableParameter::ModifierAssignment * createAssignment(const juce::ValueTree &) override
Must return a new ModifierAssignment for a given state.
int getCurrentMIDIValue() const noexcept
Returns the MIDI value, either a pitch or velocity.
ProcessingPosition getProcessingPosition() override
Should return the position in the plugin chain that this Modifier should be processed.
juce::StringArray getMidiInputNames() override
Can return an array of names represeting MIDI inputs.
juce::String getSelectableDescription() override
Subclasses must return a description of what they are.
void applyToBuffer(const PluginRenderContext &) override
Sub classes should implement this to process the Modifier.
void initialise() override
Call this once after construction to connect it to the audio graph.
float getCurrentValue() override
Returns the current value of the modifier.
juce::ValueTree getNodeState() const
Returns a ValueTree representing the absolute nodes of the map.
#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.