1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-05 03:03:10 +01:00

Add some const qualifiers to BlockFile methods

This commit is contained in:
Paul Licameli
2016-04-10 19:49:28 -04:00
parent 7a1b4eb149
commit f94b3b3afa
23 changed files with 112 additions and 110 deletions

View File

@@ -51,21 +51,21 @@ class ODDecodeBlockFile final : public SimpleBlockFile
virtual ~ODDecodeBlockFile();
//checks to see if summary data has been computed and written to disk yet. Thread safe. Blocks if we are writing summary data.
bool IsSummaryAvailable() override;
bool IsSummaryAvailable() const override;
/// Returns TRUE if this block's complete data is ready to be accessed by Read()
bool IsDataAvailable() override;
bool IsDataAvailable() const override;
/// Returns TRUE if the summary has not yet been written, but is actively being computed and written to disk
bool IsSummaryBeingComputed() override { return false; }
//Calls that rely on summary files need to be overidden
wxLongLong GetSpaceUsage() override;
wxLongLong GetSpaceUsage() const override;
/// Gets extreme values for the specified region
void GetMinMax(sampleCount start, sampleCount len,
float *outMin, float *outMax, float *outRMS) override;
float *outMin, float *outMax, float *outRMS) const override;
/// Gets extreme values for the entire block
void GetMinMax(float *outMin, float *outMax, float *outRMS) override;
void GetMinMax(float *outMin, float *outMax, float *outRMS) const override;
/// Returns the 256 byte summary data block
bool Read256(float *buffer, sampleCount start, sampleCount len) override;
/// Returns the 64K summary data block
@@ -97,32 +97,32 @@ class ODDecodeBlockFile final : public SimpleBlockFile
void SetStart(sampleCount startSample){mStart = startSample;}
///Gets the value that indicates where the first sample in this block corresponds to the global sequence/clip. Only for display use.
sampleCount GetStart(){return mStart;}
sampleCount GetStart() const {return mStart;}
//returns the number of samples from the beginning of the track that this blockfile starts at
sampleCount GetGlobalStart(){return mClipOffset+mStart;}
sampleCount GetGlobalStart() const {return mClipOffset+mStart;}
//returns the number of samples from the beginning of the track that this blockfile ends at
sampleCount GetGlobalEnd(){return mClipOffset+mStart+GetLength();}
sampleCount GetGlobalEnd() const {return mClipOffset+mStart+GetLength();}
//Below calls are overrided just so we can take wxlog calls out, which are not threadsafe.
/// Reads the specified data from the aliased file using libsndfile
int ReadData(samplePtr data, sampleFormat format,
sampleCount start, sampleCount len) override;
sampleCount start, sampleCount len) const override;
/// Read the summary into a buffer
bool ReadSummary(void *data) override;
///Returns the type of audiofile this blockfile is loaded from.
unsigned int GetDecodeType() /* not override */ { return mType; }
unsigned int GetDecodeType() /* not override */ const { return mType; }
// void SetDecodeType(unsigned int type) /* not override */ { mType = type; }
///sets the amount of samples the clip associated with this blockfile is offset in the wavetrack (non effecting)
void SetClipOffset(sampleCount numSamples){mClipOffset= numSamples;}
///Gets the number of samples the clip associated with this blockfile is offset by.
sampleCount GetClipOffset(){return mClipOffset;}
sampleCount GetClipOffset() const {return mClipOffset;}
//OD TODO:set ISAlias to true while we have no data?
@@ -133,12 +133,12 @@ class ODDecodeBlockFile final : public SimpleBlockFile
///sets the file name the summary info will be saved in. threadsafe.
void SetFileName(wxFileName &name) override;
wxFileName GetFileName() override;
wxFileName GetFileName() const override;
/// Prevents a read on other threads of the encoded audio file.
void LockRead() override;
void LockRead() const override;
/// Allows reading of encoded file on other threads.
void UnlockRead() override;
void UnlockRead() const override;
///// Get the name of the file where the audio data for this block is
/// stored.
@@ -162,12 +162,12 @@ class ODDecodeBlockFile final : public SimpleBlockFile
///This lock is for the filename (string) of the blockfile that contains summary/audio data
///after decoding
ODLock mFileNameMutex;
mutable ODLock mFileNameMutex;
///The original file the audio came from.
wxFileName mAudioFileName;
ODLock mDataAvailableMutex;
mutable ODLock mDataAvailableMutex;
bool mDataAvailable;
bool mDataBeingComputed;
@@ -175,7 +175,7 @@ class ODDecodeBlockFile final : public SimpleBlockFile
ODLock mDecoderMutex;
///For accessing the audio file that will be decoded. Used by dir manager;
ODLock mReadDataMutex;
mutable ODLock mReadDataMutex;
///for reporting after task is complete. Only for display use.
sampleCount mStart;