11namespace tracktion {
inline namespace engine
62 bool isOutOfDate() const noexcept {
return thumbnailIsInvalid; }
67 TimeRange,
int channelNum,
float verticalZoomFactor);
71 TimeRange,
float verticalZoomFactor);
78 void clear() override;
80 bool setSource (
juce::InputSource*) override;
82 void setReader (
juce::AudioFormatReader*,
juce::int64 hashCode) override;
84 bool loadFrom (
juce::InputStream&) override;
86 void saveTo (
juce::OutputStream&) const override;
88 int getNumChannels() const noexcept override;
90 double getTotalLength() const noexcept override;
92 bool isFullyLoaded() const noexcept override;
94 juce::int64 getNumSamplesFinished() const noexcept override;
96 float getApproximatePeak() const override;
98 void getApproximateMinMax (
double startTime,
double endTime,
int channelIndex,
99 float& minValue,
float& maxValue) const noexcept override;
101 juce::int64 getHashCode() const override;
103 void reset (
int numChannels,
double sampleRate,
juce::int64 totalSamplesInSource) override;
105 void addBlock (
juce::int64 sampleNumberInSource, const
juce::AudioBuffer<
float>&,
106 int startOffsetInBuffer,
int numSamples) override;
110 void audioFileChanged();
117 Edit* const edit =
nullptr;
121 std::unique_ptr<
juce::AudioThumbnailBase> thumbnail;
122 juce::Component& component;
123 bool wasGeneratingProxy = false;
124 std::atomic<
bool> thumbnailIsInvalid {
true };
125 float lastProgress = 0.0f;
127 void timerCallback()
override;
128 void fileWasChanged();
129 void createThumbnailReader();
136 double startTimeSeconds,
137 double endTimeSeconds,
139 float verticalZoomFactor)
override;
143 double startTimeSeconds,
144 double endTimeSeconds,
145 float verticalZoomFactor)
override;
The Tracktion Edit class!
The Engine is the central class for all tracktion sessions.
SmartThumnail automatically tracks changes to an AudioFile and will update its cache if the file chan...
double getProportionComplete() const noexcept
Returns the proportion of the thumbnail that has been generated.
static void setEnabled(bool e)
Enable/disable all smart thumbnail generation.
static bool areThumbnailsFullyLoaded(Engine &)
Returns true if any thumbnails are currently being generated for the given Edit.
bool isGeneratingProxy() const noexcept
Returns true if this is a proxy file being generated by the AudioProxyGenerator.
void drawChannels(juce::Graphics &, juce::Rectangle< int >, TimeRange, float verticalZoomFactor)
Draws all of the channels, optionally using a hi-res algorithm.
void drawChannel(juce::Graphics &, juce::Rectangle< int >, TimeRange, int channelNum, float verticalZoomFactor)
Draws one of the channels, optionally using a hi-res algorithm.
float getProxyProgress() const noexcept
Returns the progress of the current proxy file creation.
~SmartThumbnail() override
Destructor.
void setNewFile(const AudioFile &)
Sets a new file to display.
bool isOutOfDate() const noexcept
Returns true if the file has been changed and a new thumbnail has not yet been generated.
#define JUCE_DECLARE_WEAK_REFERENCEABLE(Class)