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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_ParameterChangeHandler.cpp
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
18
23
24//==============================================================================
26{
27 #if TRACKTION_ENABLE_AUTOMAP && TRACKTION_ENABLE_CONTROL_SURFACES
28 if (edit.shouldPlay())
29 if (auto na = edit.engine.getExternalControllerManager().getAutomap())
30 na->paramChanged (&parameter);
31 #endif
32
33 if (enabled
34 && ! fromAutomation
35 && (edit.engine.getMidiLearnState().isActive() || parameterLearnActive))
36 {
37 const juce::ScopedLock sl (eventLock);
38 pendingActionId = -1;
39 pendingParam = &parameter;
41 }
42}
43
45{
46 const juce::ScopedLock sl (eventLock);
47 return pendingParam != nullptr;
48}
49
51{
52 const juce::ScopedLock sl (eventLock);
53 AutomatableParameter::Ptr paramToReturn (pendingParam);
54
55 if (consumeEvent)
56 pendingParam = nullptr;
57
58 return paramToReturn;
59}
60
61//==============================================================================
63{
64 const juce::ScopedLock sl (eventLock);
65 pendingParam = nullptr;
66 pendingActionId = externalControllerID;
68}
69
71{
72 const juce::ScopedLock sl (eventLock);
73 return pendingActionId != -1;
74}
75
77{
78 const juce::ScopedLock sl (eventLock);
79 const juce::ScopedValueSetter<int> actionResetter (pendingActionId, pendingActionId,
80 consumeEvent ? -1 : pendingActionId);
81
82 if (consumeEvent)
83 sendChangeMessage();
84
85 return pendingActionId;
86}
87
88}} // namespace tracktion { inline namespace engine
The Tracktion Edit class!
bool shouldPlay() const noexcept
Returns true if this Edit should be played back (or false if it was just opened for inspection).
Engine & engine
A reference to the Engine.
ExternalControllerManager & getExternalControllerManager() const
Returns the ExternalControllerManager instance.
MidiLearnState & getMidiLearnState() const
Returns the MidiLearnState instance.
int getPendingActionFunctionId(bool consumeEvent) noexcept
Returns the pending action function waiting to be assigned or a nullptr if none has been.
bool isEventPending() const noexcept
Returns true if there is either a parameter or action waiting to be assigned.
ParameterChangeHandler(Edit &)
Creates a ParameterChangeHandler for a given Edit.
bool isActionFunctionPending() const noexcept
Returns true if there is an action function waiting to be assigned.
AutomatableParameter::Ptr getPendingParam(bool consumeEvent) noexcept
Returns the parameter waiting to be assigned if there is one, otherwise a nullptr.
bool isParameterPending() const noexcept
Returns true if there is an AutomatableParameter waiting to be assigned.
void parameterChanged(AutomatableParameter &parameter, bool fromAutomation)
Called by parameters when they are changed.
void actionFunctionTriggered(int externalControllerID)
Called by the accelerators when an assignable action is called.
void ignoreUnused(Types &&...) noexcept