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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_Scene.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
14class SceneList;
15
16//==============================================================================
22class Scene : public Selectable,
24{
25public:
28
30 ~Scene() override;
31
32 int getIndex();
33
34 juce::ValueTree state;
35 Edit& edit;
36
39
40 SceneList& sceneList;
41
44
45private:
46 void valueTreePropertyChanged (juce::ValueTree&, const juce::Identifier&) override;
47};
48
49//==============================================================================
50//==============================================================================
55 private juce::Timer
56{
57public:
62 SceneWatcher (const juce::ValueTree& scenesState, Edit&);
63
65 struct Listener
66 {
68 virtual ~Listener() = default;
69
71 virtual void slotUpdated (int audioTrackIndex, int slotIndex) = 0;
72 };
73
75 void addListener (Listener*);
76
79
80private:
81 juce::ValueTree scenesState;
82 Edit& edit;
83 uint32_t callback = 0;
84
85 enum class RecordingState
86 {
87 none,
88 pending,
89 recording,
90 };
91
92 struct Value
93 {
94 uint32_t lastSeen = 0;
95 LaunchHandle::PlayState playState;
97 RecordingState recordingState = RecordingState::none;
98 };
99
100 std::map<std::pair<int, int>, Value> lastStates;
101
103
104 void checkForScenes();
105 RecordingState getRecordingState (ClipSlot& slot);
106
107 void timerCallback() override;
108
109 void valueTreeChildAdded (juce::ValueTree&, juce::ValueTree&) override;
110 void valueTreeChildRemoved (juce::ValueTree&, juce::ValueTree&, int) override;
111
113};
114
115//==============================================================================
116//==============================================================================
120class SceneList : private ValueTreeObjectList<Scene>
121{
122public:
124 SceneList (const juce::ValueTree&, Edit&);
125
127 ~SceneList() override;
128
130 int getNumScenes() { return size(); }
131
134
135 //==============================================================================
140 void ensureNumberOfScenes (int numScenes);
141
145 Scene* insertScene (int index);
146
148 void deleteScene (Scene&);
149
155
156private:
157 //==============================================================================
159 bool isSuitableType (const juce::ValueTree&) const override;
161 Scene* createNewObject (const juce::ValueTree&) override;
163 void deleteObject (Scene*) override;
164
166 void newObjectAdded (Scene*) override;
168 void objectRemoved (Scene*) override;
170 void objectOrderChanged() override;
171};
172
173}} // namespace tracktion { inline namespace engine
Represents a slot on a track that a Clip can live in to be played as a launched clip.
The Tracktion Edit class!
Represents the Scenes in an Edit.
void deleteScene(Scene &)
Deletes a specific Scene.
juce::Array< Scene * > getScenes()
Returns the Scenes in the Edit.
void ensureNumberOfScenes(int numScenes)
Adds Scenes to ensure numScenes are preset in the list.
SceneWatcher sceneWatcher
A SceneWatcher you can listen to in order to be notified of changes to Slots.
Scene * insertScene(int index)
Inserts a new scene with the given index.
Edit & edit
The Edit this SceneList belongs to.
~SceneList() override
Destructor.
juce::ValueTree state
The state of this SceneList.
int getNumScenes()
Returns the number of Scenes in the Edit.
Notifies UI components of changes to the scenes and clips.
void removeListener(Listener *)
Removes a previously added Listener.
void addListener(Listener *)
Adds a Listener.
A Scene is a collection of ClipSlots across tracks.
~Scene() override
Destructor.
juce::String getSelectableDescription() override
Subclasses must return a description of what they are.
Base class for things that can be selected, and whose properties can appear in the properties panel.
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
typedef uint32_t
virtual void slotUpdated(int audioTrackIndex, int slotIndex)=0
Destructor.
virtual ~Listener()=default
Destructor.