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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_ArchiveFile.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
14//==============================================================================
18{
19public:
22
23 bool isValidArchive() const;
24 juce::File getFile() const;
25
26 enum class CompressionType
27 {
28 none = 0,
29 zip = 1,
30 lossless = 2,
31 lossyGoodQuality = 3,
32 lossyMediumQuality = 4,
33 lossyLowQuality = 5
34 };
35
36 int getNumFiles() const;
37 juce::String getOriginalFileName (int index) const;
38
39 int indexOfFile (const juce::String& name) const;
40
43
44 bool extractFile (int index, const juce::File& destDirectory,
45 juce::File& fileCreated, bool askBeforeOverwriting);
46 bool extractAll (const juce::File& destDirectory,
47 juce::Array<juce::File>& filesCreated);
48 bool extractAllAsTask (const juce::File& destDirectory,
49 bool warnAboutOverwrite,
50 juce::Array<juce::File>& filesCreated,
51 bool& wasAborted);
52
53 bool addFile (const juce::File&, const juce::File& rootDirectory, CompressionType);
54 bool addFile (const juce::File&, const juce::String& filenameToUse, CompressionType);
55
56 void addFileInfo (const juce::String& filename,
57 const juce::String& itemName,
58 const juce::String& itemValue);
59
60 void flush();
61
62public:
63 //==============================================================================
65 {
66 IndexEntry() {}
69
70 void write (juce::OutputStream&);
71
72 // original name - name of the file that went in
73 // stored name - name of the compressed file that's stored
74 // length = length of the stored object
75 // offset - offset from start of file of the stored object
76 juce::String originalName, storedName;
77 int64_t offset = 0, length = 0;
78 // extra names and values - for extra metadata
79 juce::StringArray extraNames, extraValues;
80
82 };
83
84private:
85 Engine& engine;
86 juce::File file;
87 int64_t indexOffset = 8;
88 bool valid = false, needToWriteIndex;
89
91 void readIndex();
92
93 static int getOggQuality (CompressionType);
94 static int getMagicNumber();
95
97};
98
99}} // namespace tracktion { inline namespace engine
The Engine is the central class for all tracktion sessions.
std::unique_ptr< juce::InputStream > createStoredInputStream(int index) const
Create a stream to read one of the archived objects.
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
typedef int64_t