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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_ProjectItem.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
18class ProjectItem : public Selectable,
20 private juce::Timer,
21 private juce::AsyncUpdater
22{
23public:
24 //==============================================================================
25 enum class Category
26 {
27 none,
28 edit,
29 recorded,
30 exports,
31 archives,
32 imported,
33 rendered,
34 frozen,
35 video
36 };
37
38 enum class RenameMode
39 {
40 always,
41 local,
42 never
43 };
44
45 enum class SetNameMode
46 {
47 doDefault,
48 forceRename,
49 forceNoRename
50 };
51
54
55 //==============================================================================
58
59 //==============================================================================
62 const juce::String& name,
63 const juce::String& type,
64 const juce::String& desc,
65 const juce::String& file,
66 Category,
67 double length,
69
70 ~ProjectItem() override;
71
72 //==============================================================================
74 void selectionStatusChanged (bool isNowSelected) override;
75
76 //==============================================================================
77 ProjectItemID getID() const noexcept { return itemID; }
78
80
81 // checks whether it's been removed from its project
82 bool hasBeenDeleted() const;
83
84 static const char* waveItemType() noexcept { return "wave"; }
85 static const char* editItemType() noexcept { return "edit"; }
86 static const char* midiItemType() noexcept { return "midi"; }
87 static const char* videoItemType() noexcept { return "video"; }
88
89 const juce::String& getType() const;
90
91 bool isWave() const noexcept { return getType() == waveItemType(); }
92 bool isMidi() const noexcept { return getType() == midiItemType(); }
93 bool isEdit() const noexcept { return getType() == editItemType(); }
94 bool isVideo() const noexcept { return getType() == videoItemType(); }
95
96 const juce::String& getName() const;
97 void setName (const juce::String& name, SetNameMode mode);
98
99 Category getCategory() const;
100 void setCategory (Category cat);
101
102 // get/set a persistent string property with a name. Setting to empty removes it
103 juce::String getNamedProperty (const juce::String& name) const;
104 void setNamedProperty (const juce::String& name, const juce::String& value);
105
106 juce::String getDescription() const;
107 void setDescription (const juce::String& newDesc);
108
111 void setMarkedPoints (const juce::Array<TimePosition>& points);
112
114 void copyAllPropertiesFrom (const ProjectItem& other);
115
116 bool convertEditFile();
117
118 double getLength() const;
119 void setLength (double length);
120
123
126
129
130 //==============================================================================
131 juce::File getSourceFile();
132 juce::String getRawFileName() const { return file; }
133 juce::String getFileName() const;
134
135 enum class FileMode
136 {
137 absolute,
138 relative,
139 relativeIfWithinProject
140 };
141
142 void setSourceFile (const juce::File&, FileMode mode = FileMode::relativeIfWithinProject);
143 bool isForFile (const juce::File&);
144 bool isAbsolutePath() const;
145 void convertToRelativePath();
146 void convertToAbsolutePath();
147
150
152 Ptr createCopy();
153
154 void sendChange();
155
156 //==============================================================================
160 bool copySectionToNewFile (const juce::File& destFile,
161 juce::File& actualFileCreated,
162 double startTime,
163 double length);
164
165 bool deleteSourceFile();
166
168 void verifyLength();
169
171 void changeProjectId (int oldID, int newID);
172
173 //==============================================================================
174 void writeToStream (juce::OutputStream&) const;
175
180
183private:
184 friend class ProjectManager;
185 friend class Project;
186
187 ProjectItemID itemID;
188 juce::String type, objectName, description, file;
189 double length = 0;
190 juce::File sourceFile, newDstFile;
191
192 void timerCallback() override;
193 void handleAsyncUpdate() override;
194
195 juce::File getRelativeFile (const juce::String&) const;
196
198};
199
200}} // namespace tracktion { inline namespace engine
The Engine is the central class for all tracktion sessions.
An ID representing one of the items in a Project.
Represents a file-based resource that is used in a project.
void changeProjectId(int oldID, int newID)
used when moving to another project.
bool copySectionToNewFile(const juce::File &destFile, juce::File &actualFileCreated, double startTime, double length)
the actual file created may differ, e.g.
void renameSourceFile()
lets the user rename the file.
juce::File getEditPreviewFile() const
Returns the file that should be used as a preview for this Edit.
void verifyLength()
Updates the stored length value in this object.
juce::File getEditThumbnailFile() const
Returns the file that should be used as a visual preview for this Edit.
juce::String getProjectName() const
name of the project it's inside.
void selectionStatusChanged(bool isNowSelected) override
Can be overridden to tell this object that it has just been selected or deselected.
juce::StringArray getSearchTokens() const
Returns a list of search strings for this object, by chopping up the name and description into words.
juce::Array< TimePosition > getMarkedPoints() const
optional set of interesting time markers, for wave files
Ptr createCopy()
Creates a copy of this object and returns the copy.
void copyAllPropertiesFrom(const ProjectItem &other)
copies the full description, categories, properties, etc.
juce::String getSelectableDescription() override
Subclasses must return a description of what they are.
Engine & engine
The Engine instance this belongs to.
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)