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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_ExternalControllerManager.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{
17 juce::Colour colour;
18 Track& firstTrack;
19 Track& lastTrack;
20 int firstScene;
21 int lastScene;
22
23 bool contains (ClipSlot&) const;
24 bool isLeft (ClipSlot&) const;
25 bool isRight (ClipSlot&) const;
26 bool isTop (ClipSlot&) const;
27 bool isBottom (ClipSlot&) const;
28};
29
35 private juce::Timer
36{
37public:
38 //==============================================================================
40
41 void initialise();
42 void shutdown();
43
44 //==============================================================================
47
53
56
59
62
65
68
71
74
75 //==============================================================================
76 void setCurrentEdit (Edit*, SelectionManager*);
77 void detachFromEdit (Edit*);
78 void detachFromSelectionManager (SelectionManager*);
79 bool isAttachedToEdit (const Edit*) const noexcept;
80 bool isAttachedToEdit (const Edit&) const noexcept;
81 SelectionManager* getSelectionManager() const noexcept;
82
83 //==============================================================================
84 const juce::OwnedArray<ExternalController>& getControllers() const noexcept { return devices; }
85
86 juce::StringArray getAllControllerNames();
87
88 // Returns the first available custom controler to use for assignments.
89 ExternalController* getActiveCustomController();
90
91 void midiInOutDevicesChanged();
92
93 enum Protocol
94 {
95 midi,
96 osc
97 };
98
99 bool createCustomController (const juce::String& name, Protocol);
100 ExternalController* addController (ControlSurface*);
101 void deleteController (ExternalController*);
102
103 //==============================================================================
104 // these get called by stuff in the application to make the controllers react
105 // appropriately..
106
107 // channels are virtual - i.e. not restricted to physical chans
108 void moveFader (int channelNum, float newSliderPos);
109 void moveMasterFader (float newPos);
110 void movePanPot (int channelNum, float newPan);
111 void moveMasterPanPot (float newPan);
112 void playStateChanged (bool isPlaying);
113 void recordStateChanged (bool isRecording);
114 void automationModeChanged (bool isReading, bool isWriting);
115 void channelLevelChanged (int channel, float l, float r);
116 void masterLevelsChanged (float leftLevel, float rightLevel);
117 void timecodeChanged (int barsOrHours, int beatsOrMinutes, int ticksOrSeconds,
118 int millisecs, bool isBarsBeats, bool isFrames);
119 void editPositionChanged (Edit*, TimePosition newCursorPosition);
120 void updateVolumePlugin (VolumeAndPanPlugin&);
121 void updateVCAPlugin (VCAPlugin& vca);
122 void snapChanged (bool isOn);
123 void loopChanged (bool isOn);
124 void clickChanged (bool isOn);
125 void auxSendLevelsChanged();
126
127 void updateMuteSoloLights (bool onlyUpdateFlashingLights);
128 void soloCountChanged (bool);
129
130 void changeListenerCallback (ChangeBroadcaster*) override;
131
132 bool shouldTrackBeColoured (int channelNum);
133 juce::Colour getTrackColour (int channelNum);
134
135 std::vector<ColourArea> getColouredArea (const Edit&);
136
137 bool shouldPluginBeColoured (Plugin*);
138 juce::Colour getPluginColour (Plugin*);
139
140 void updateAllDevices();
141 void updateParameters();
142 void updateMarkers();
143 void updateTrackRecordLights();
144 void updatePunchLights();
145 void updateScrollLights();
146 void updateUndoLights();
147 void updatePadColours();
148
149 int getNumChannelTracks() const;
150 Track* getChannelTrack (int channel) const;
151 int mapTrackNumToChannelNum (int channelNum) const;
152
153 //==============================================================================
154 int getXTCount (const juce::String& controller);
155 void setXTCount (const juce::String& controller, int);
156 void refreshXTOrder();
157
158 //==============================================================================
159 // these are called back by the controller to make the app respond
160 void userMovedFader (int channelNum, float newSliderPos, bool delta);
161 void userMovedMasterFader (Edit*, float newLevel, bool delta);
162 void userMovedMasterPanPot (Edit*, float newLevel, bool delta);
163 void userMovedPanPot (int channelNum, float newPan, bool delta);
164 void userPressedSolo (int channelNum);
165 void userPressedSoloIsolate (int channelNum);
166 void userPressedMute (int channelNum, bool muteVolumeControl);
167 void userSelectedTrack (int channelNum);
168 void userSelectedOneTrack (int channelNum);
169 void userSelectedClipInTrack (int channelNum);
170 void userSelectedPluginInTrack (int channelNum);
171 void userMovedAux (int channelNum, int auxNum, AuxPosition ap, float newPosition, bool delta);
172 void userPressedAux (int channelNum, int auxNum);
173 void userMovedQuickParam (float newLevel);
174 void userLaunchedClip (int channelNum, int clip);
175 void userStoppedClip (int channelNum);
176 void userLaunchedScene (int scene);
177
178 void updateDeviceState();
179
180 void repaintTrack (int channelNum);
181 void repaintPlugin (Plugin&);
182 void repaintSlots (int channelNum);
183
184 #if TRACKTION_ENABLE_CONTROL_SURFACES
185 NovationAutomap* getAutomap() const noexcept { return automap; }
186 #endif
187
188 Engine& engine;
189
190private:
191 std::shared_ptr<LaunchHandle> getLaunchHandle (int channelNum, int sceneNum);
192
193 friend class Engine;
194 ExternalControllerManager (Engine&);
195
196 struct EditTreeWatcher;
197 std::unique_ptr<EditTreeWatcher> editTreeWatcher;
199
200 NovationAutomap* automap = nullptr;
201
202 uint32_t lastUpdate = 0;
203 Edit* currentEdit = nullptr;
204 SelectionManager* currentSelectionManager = nullptr;
205
206 struct BlinkTimer : private Timer
207 {
208 BlinkTimer (ExternalControllerManager&);
209 void timerCallback() override;
210 ExternalControllerManager& ecm;
211 bool isBright = false;
212 };
213
215
216 LambdaTimer masterLevelsTimer;
217
218 ExternalController* addNewController (ControlSurface*);
219
220 juce::Array<ExternalController*> getActiveDevices() const;
221 void blinkNow();
222 void timerCallback() override;
223
224 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ExternalControllerManager)
225};
226
227}} // namespace tracktion { inline namespace engine
ChangeBroadcaster() noexcept
Represents a slot on a track that a Clip can live in to be played as a launched clip.
Base class for types of control surface.
The Tracktion Edit class!
Keeps a list of external controllers and keeps them connected to the right MIDI in/out devices.
std::function< bool(Edit &)> isScrollingEnabled
Callback that can be set allow surfaces to show the scroll status of an Edit.
std::function< void(Edit &, bool)> setScrollingEnabled
Callback that can be set allow surfaces to set the scroll status of an Edit.
std::function< void(Edit &, int)> launchScene
Launch scene by index.
std::function< void(Edit &, Track &, int)> launchClip
Launch clip by track and index.
std::function< int(Edit &, int)> mapEditTrackNumToControlSurfaceChannelNum
Optional callback that can be set to map an Edit track number to a control surface channel number.
std::function< void(Edit &, Track *)> stopClip
Stop all clips on track.
std::function< bool(const Track &)> isVisibleOnControlSurface
Callback that can be set to determine if a track is visible on a controller or not.
std::function< void(FolderTrack &, bool)> setFolderTrackOpen
Callback that can be set allow surfaces to open/close folders.
std::function< bool(FolderTrack &)> isFolderTrackOpen
Callback that can be set allow surfaces to show the open/close status of folders.
Acts as a holder for a ControlSurface object.
Manages a list of items that are currently selected.
Base class for tracks which contain clips and plugins and can be added to Edit[s].
The VCA plugin sits on a folder track to control the overall level of all the volume/pan plugins in i...
The built-in Tracktion volume/pan plugin.
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
typedef int
bool isRecording(EditPlaybackContext &epc)
Returns true if any inputs are currently recording.
typedef uint32_t
Represents a position in real-life time.
An area of the edit currently control by a control surface.