tracktion-engine
3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications
« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_engine
model
export
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
11
namespace
tracktion
{
inline
namespace
engine
12
{
13
14
//==============================================================================
17
class
TracktionArchiveFile
18
{
19
public
:
20
TracktionArchiveFile
(
Engine
&,
const
juce::File
& file);
21
~TracktionArchiveFile
();
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
42
std::unique_ptr<juce::InputStream>
createStoredInputStream
(
int
index)
const
;
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
62
public
:
63
//==============================================================================
64
struct
IndexEntry
65
{
66
IndexEntry
() {}
67
IndexEntry
(
juce::InputStream
&);
68
~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
81
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR
(
IndexEntry
)
82
};
83
84
private
:
85
Engine
& engine;
86
juce::File
file;
87
int64_t
indexOffset = 8;
88
bool
valid =
false
, needToWriteIndex;
89
90
juce::OwnedArray<IndexEntry>
entries;
91
void
readIndex();
92
93
static
int
getOggQuality (CompressionType);
94
static
int
getMagicNumber();
95
96
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR
(
TracktionArchiveFile
)
97
};
98
99
}}
// namespace tracktion { inline namespace engine
juce::Array
juce::File
juce::InputStream
juce::OutputStream
juce::OwnedArray
juce::StringArray
juce::String
tracktion::engine::Engine
The Engine is the central class for all tracktion sessions.
Definition
tracktion_Engine.h:35
tracktion::engine::TracktionArchiveFile
Definition
tracktion_ArchiveFile.h:18
tracktion::engine::TracktionArchiveFile::createStoredInputStream
std::unique_ptr< juce::InputStream > createStoredInputStream(int index) const
Create a stream to read one of the archived objects.
Definition
tracktion_ArchiveFile.cpp:167
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
tracktion
Definition
tracktion_AudioReader.h:23
int64_t
typedef int64_t
tracktion::engine::TracktionArchiveFile::IndexEntry
Definition
tracktion_ArchiveFile.h:65
std::unique_ptr
« « « Anklang Documentation