JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_AudioThumbnail.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29//==============================================================================
50class JUCE_API AudioThumbnail : public AudioThumbnailBase
51{
52public:
53 //==============================================================================
65 AudioThumbnail (int sourceSamplesPerThumbnailSample,
66 AudioFormatManager& formatManagerToUse,
67 AudioThumbnailCache& cacheToUse);
68
70 ~AudioThumbnail() override;
71
72 //==============================================================================
74 void clear() override;
75
88 bool setSource (InputSource* newSource) override;
89
100 void setReader (AudioFormatReader* newReader, int64 hashCode) override;
101
109 void setSource (const AudioBuffer<float>* newSource, double sampleRate, int64 hashCode);
110
112 void setSource (const AudioBuffer<int>* newSource, double sampleRate, int64 hashCode);
113
118 void reset (int numChannels, double sampleRate, int64 totalSamplesInSource = 0) override;
119
123 void addBlock (int64 sampleNumberInSource, const AudioBuffer<float>& newData,
124 int startOffsetInBuffer, int numSamples) override;
125
126 //==============================================================================
133 bool loadFrom (InputStream& input) override;
134
140 void saveTo (OutputStream& output) const override;
141
142 //==============================================================================
144 int getNumChannels() const noexcept override;
145
147 double getTotalLength() const noexcept override;
148
159 void drawChannel (Graphics& g,
160 const Rectangle<int>& area,
161 double startTimeSeconds,
162 double endTimeSeconds,
163 int channelNum,
164 float verticalZoomFactor) override;
165
173 void drawChannels (Graphics& g,
174 const Rectangle<int>& area,
175 double startTimeSeconds,
176 double endTimeSeconds,
177 float verticalZoomFactor) override;
178
180 bool isFullyLoaded() const noexcept override;
181
183 double getProportionComplete() const noexcept;
184
186 int64 getNumSamplesFinished() const noexcept override;
187
192 float getApproximatePeak() const override;
193
199 void getApproximateMinMax (double startTime, double endTime, int channelIndex,
200 float& minValue, float& maxValue) const noexcept override;
201
203 int64 getHashCode() const override;
204
205private:
206 //==============================================================================
207 AudioFormatManager& formatManagerToUse;
208 AudioThumbnailCache& cache;
209
210 class LevelDataSource;
211 struct MinMaxValue;
212 class ThumbData;
213 class CachedWindow;
214
217 OwnedArray<ThumbData> channels;
218
219 int32 samplesPerThumbSample = 0;
220 int64 totalSamples { 0 };
221 int64 numSamplesFinished = 0;
222 int32 numChannels = 0;
223 double sampleRate = 0;
224 CriticalSection lock;
225
226 void clearChannelData();
227 bool setDataSource (LevelDataSource* newSource);
228 void setLevels (const MinMaxValue* const* values, int thumbIndex, int numChans, int numValues);
229 void createChannels (int length);
230
232};
233
234} // namespace juce
A multi-channel buffer containing floating point audio samples.
A class for keeping a list of available audio formats, and for deciding which one to use to open a gi...
Reads samples from an audio file stream.
Provides a base for classes that can store and draw scaled views of an audio waveform.
An instance of this class is used to manage multiple AudioThumbnail objects.
Makes it easy to quickly draw scaled views of the waveform shape of an audio file.
A graphics context, used for drawing a component or image.
A lightweight object that can create a stream to read some kind of resource.
The base class for streams that read data.
The base class for streams that write data to some kind of destination.
An array designed for holding objects.
Manages a rectangle and allows geometric operations to be performed on it.
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
JUCE Namespace.
signed int int32
A platform-independent 32-bit signed integer type.
long long int64
A platform-independent 64-bit integer type.