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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_ParameterControlMappings.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
16 private juce::AsyncUpdater
17{
18public:
19 //==============================================================================
22
23 void loadFromEdit();
24 void saveToEdit();
25
26 static ParameterControlMappings* getCurrentlyFocusedMappings (Engine&);
27
28 //==============================================================================
29 void checkForDeletedParams();
30
31 //==============================================================================
33 void sendChange (int controllerID, float newValue, int channel);
34 bool isParameterMapped (AutomatableParameter& param) const { return parameters.contains (&param); }
35 bool getParameterMapping (AutomatableParameter&, int& channel, int& controllerID) const;
36 bool removeParameterMapping (AutomatableParameter&);
37
38 //==============================================================================
39 int getNumControllerIDs() const { return controllerIDs.size(); }
40 void showMappingsListForRow (int);
41 int getRowBeingListenedTo() const;
42 std::pair<juce::String, juce::String> getTextForRow (int rowNumber) const;
43
44 void listenToRow (int);
45 void setLearntParam (bool keepListening);
46
47 struct Mapping
48 {
49 Mapping (AutomatableParameter* p, int cont, int chan)
50 : parameter (p), controllerID (cont), channelID (chan) {}
51
52 AutomatableParameter* parameter = nullptr;
53 int controllerID = -1, channelID = -1;
54 };
55
56 Mapping getMappingForRow (int row) const;
57
58 void removeMapping (int index);
59
64
65private:
66 //==============================================================================
67 struct ParameterAndIndex
68 {
70 int index;
71 };
72
74 void addPluginToMenu (AutomatableParameterTree::TreeNode*, juce::PopupMenu&, juce::Array<ParameterAndIndex>& allParams, int& index, int addAllItemIndex);
75 void addPluginToMenu (Plugin::Ptr, juce::PopupMenu&, juce::Array<ParameterAndIndex>& allParams, int& index, int addAllItemIndex);
76 void savePreset (int index);
77 void loadPreset (int index);
78 void deletePreset (int index);
79 juce::StringArray getPresets() const;
80
81 Edit& edit;
82
83 juce::Array<int> controllerIDs, channelIDs;
85 juce::StringArray parameterFullNames;
86
87 int lastControllerID = 0;
88 float lastControllerValue = 0;
89 int lastControllerChannel = 0;
90 int listeningOnRow = -1;
91
93
94 void tellEditAboutChange();
95 int addMapping (int id, int channel, const AutomatableParameter::Ptr&);
96
97 void handleAsyncUpdate() override;
98};
99
100}} // namespace tracktion { inline namespace engine
int size() const noexcept
bool contains(const ObjectClass *objectToLookFor) const noexcept
The Tracktion Edit class!
The Engine is the central class for all tracktion sessions.
Controls the set of midi-controller-to-parameter mappings.
void sendChange(int controllerID, float newValue, int channel)
called by the midi input devices when they get moved.
void showMappingsEditor(juce::DialogWindow::LaunchOptions &)
This will put the surface in listen and assign mode, launching the given dialog window.