From 904e54660f359f47c67f3935d1c0e68c70aa941b Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 14 Feb 2013 17:56:15 +0000 Subject: [PATCH] Minor docs change, and addition to AudioThumbnail. --- .../juce_audio_processors/processors/juce_AudioPlayHead.h | 3 +++ modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp | 5 +++++ modules/juce_audio_utils/gui/juce_AudioThumbnail.h | 3 +++ 3 files changed, 11 insertions(+) diff --git a/modules/juce_audio_processors/processors/juce_AudioPlayHead.h b/modules/juce_audio_processors/processors/juce_AudioPlayHead.h index 5c9c39a7f0..9d38984fe8 100644 --- a/modules/juce_audio_processors/processors/juce_AudioPlayHead.h +++ b/modules/juce_audio_processors/processors/juce_AudioPlayHead.h @@ -133,6 +133,9 @@ public: //============================================================================== /** Fills-in the given structure with details about the transport's position at the start of the current processing block. + + This method must ONLY be called from within your AudioProcessor::processBlock() + method. Calling it at any other time will probably cause a nasty crash. */ virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0; }; diff --git a/modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp b/modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp index d29e29563a..61d29673d0 100644 --- a/modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp +++ b/modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp @@ -740,6 +740,11 @@ bool AudioThumbnail::isFullyLoaded() const noexcept return numSamplesFinished >= totalSamples - samplesPerThumbSample; } +double AudioThumbnail::getProportionComplete() const noexcept +{ + return jlimit (0.0, 1.0, numSamplesFinished / (double) totalSamples); +} + int64 AudioThumbnail::getNumSamplesFinished() const noexcept { return numSamplesFinished; diff --git a/modules/juce_audio_utils/gui/juce_AudioThumbnail.h b/modules/juce_audio_utils/gui/juce_AudioThumbnail.h index 0b78d4a08a..a2a40e13c0 100644 --- a/modules/juce_audio_utils/gui/juce_AudioThumbnail.h +++ b/modules/juce_audio_utils/gui/juce_AudioThumbnail.h @@ -168,6 +168,9 @@ public: /** Returns true if the low res preview is fully generated. */ bool isFullyLoaded() const noexcept; + /** Returns a value between 0 and 1 to indicate the progress towards loading the entire file. */ + double getProportionComplete() const noexcept; + /** Returns the number of samples that have been set in the thumbnail. */ int64 getNumSamplesFinished() const noexcept;