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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_RecordingThumbnailManager.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
18{
19public:
20 RecordingThumbnailManager (Engine& e) : engine (e) {}
21
27 {
29
33 const HashCode hash;
38 {
39 TRACKTION_ASSERT_MESSAGE_THREAD
40 engine.getRecordingThumbnailManager().thumbs.removeAllInstancesOf (this);
41 }
42
44 void reset (int numChannels, double sampleRate)
45 {
46 thumb->reset (numChannels, sampleRate, 0);
47 nextSampleNum = 0;
48 }
49
53 void addBlock (const juce::AudioBuffer<float>& incoming, int startOffsetInBuffer, int numSamples)
54 {
55 thumb->addBlock (nextSampleNum, incoming, startOffsetInBuffer, numSamples);
56 nextSampleNum += numSamples;
57 }
58
59 private:
60 friend class RecordingThumbnailManager;
61 std::atomic<int64_t> nextSampleNum { 0 };
62
63 Thumbnail (Engine& e, const juce::File& f)
64 : engine (e),
65 thumb (engine.getUIBehaviour().createAudioThumbnail (1024, engine.getAudioFileFormatManager().readFormatManager,
66 engine.getAudioFileManager().getAudioThumbnailCache())),
67 file (f), hash (f.hashCode64())
68 {
69 TRACKTION_ASSERT_MESSAGE_THREAD
70 engine.getRecordingThumbnailManager().thumbs.addIfNotAlreadyThere (this);
71 }
72
74 };
75
76 //==============================================================================
81 {
82 TRACKTION_ASSERT_MESSAGE_THREAD
83
84 for (auto t : thumbs)
85 if (t->file == f)
86 return *t;
87
88 return *new Thumbnail (engine, f);
89 }
90
91private:
92 Engine& engine;
94
96};
97
98}} // namespace tracktion { inline namespace engine
The Engine is the central class for all tracktion sessions.
RecordingThumbnailManager & getRecordingThumbnailManager() const
Returns the RecordingThumbnailManager instance.
Holds a pool of Thumbnails that are populated whilst recording.
Thumbnail::Ptr getThumbnailFor(const juce::File &f)
Returns the Thumbnail for a given audio file.
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
T reset(T... args)
Represents a position in real-life time.
void reset(int numChannels, double sampleRate)
Destructor.
TimePosition punchInTime
The time the start of this thumbnail represents.
const HashCode hash
A hash uniquely identifying this thumbnail.
const std::unique_ptr< juce::AudioThumbnailBase > thumb
The thumbnail.
void addBlock(const juce::AudioBuffer< float > &incoming, int startOffsetInBuffer, int numSamples)
Adss a block of recorded data to the thumbnail.