Change sampleCount arguments, variables, return values to size_t...

... whenever they really describe the size of a buffer that fits in memory, or
of a block file (which is never now more than a megabyte and so could be fit in
memory all at once), or a part thereof.
This commit is contained in:
Paul Licameli 2016-09-06 09:19:27 -04:00
parent 078ff056e2
commit ad04187a41
106 changed files with 458 additions and 438 deletions

View File

@ -124,15 +124,15 @@ public:
virtual int GetMidiOutCount() = 0;
virtual void SetSampleRate(double rate) = 0;
virtual sampleCount SetBlockSize(sampleCount maxBlockSize) = 0;
virtual size_t SetBlockSize(size_t maxBlockSize) = 0;
virtual sampleCount GetLatency() = 0;
virtual sampleCount GetTailSize() = 0;
virtual size_t GetTailSize() = 0;
virtual bool IsReady() = 0;
virtual bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) = 0;
virtual bool ProcessFinalize() = 0;
virtual sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) = 0;
virtual size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) = 0;
virtual bool RealtimeInitialize() = 0;
virtual bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) = 0;
@ -140,7 +140,7 @@ public:
virtual bool RealtimeSuspend() = 0;
virtual bool RealtimeResume() = 0;
virtual bool RealtimeProcessStart() = 0;
virtual sampleCount RealtimeProcess(int group, float **inBuf, float **outBuf, sampleCount numSamples) = 0;
virtual size_t RealtimeProcess(int group, float **inBuf, float **outBuf, size_t numSamples) = 0;
virtual bool RealtimeProcessEnd() = 0;
virtual bool ShowInterface(wxWindow *parent, bool forceModal = false) = 0;

View File

@ -99,10 +99,10 @@ public:
ChannelName *channelMap) = 0;
// Accepts interleaved samples from the client.
virtual bool PutSamples(int stream, sampleCount numSamples, samplePtr inBuffer) = 0;
virtual bool PutSamples(int stream, size_t numSamples, samplePtr inBuffer) = 0;
// Accepts non-interleaved samples from the client.
virtual bool PutSamples(int stream, int channel, sampleCount numSamples, samplePtr inBuffer) = 0;
virtual bool PutSamples(int stream, int channel, size_t numSamples, samplePtr inBuffer) = 0;
// The client will call this as the import progresses.
virtual bool UpdateProgress(float current, float total) = 0;

View File

@ -1770,6 +1770,7 @@ int AudioIO::StartStream(const ConstWaveTrackArray &playbackTracks,
// mouse input, so make fillings more and shorter.
// What Audio thread produces for playback is then consumed by the PortAudio
// thread, in many smaller pieces.
wxASSERT( playbackTime >= 0 );
mPlaybackSamplesToCopy = playbackTime * mRate;
// Capacity of the playback buffer.
@ -1853,9 +1854,9 @@ int AudioIO::StartStream(const ConstWaveTrackArray &playbackTracks,
// Allocate output buffers. For every output track we allocate
// a ring buffer of five seconds
auto playbackBufferSize =
(sampleCount)lrint(mRate * mPlaybackRingBufferSecs);
(size_t)lrint(mRate * mPlaybackRingBufferSecs);
auto playbackMixBufferSize =
(sampleCount)mPlaybackSamplesToCopy;
mPlaybackSamplesToCopy;
mPlaybackBuffers = new RingBuffer* [mPlaybackTracks.size()];
mPlaybackMixers = new Mixer* [mPlaybackTracks.size()];
@ -1892,8 +1893,7 @@ int AudioIO::StartStream(const ConstWaveTrackArray &playbackTracks,
{
// Allocate input buffers. For every input track we allocate
// a ring buffer of five seconds
auto captureBufferSize =
(sampleCount)(mRate * mCaptureRingBufferSecs + 0.5);
auto captureBufferSize = (size_t)(mRate * mCaptureRingBufferSecs + 0.5);
// In the extraordinarily rare case that we can't even afford 100 samples, just give up.
if(captureBufferSize < 100)
@ -1931,10 +1931,8 @@ int AudioIO::StartStream(const ConstWaveTrackArray &playbackTracks,
bDone = false;
// In the extraordinarily rare case that we can't even afford 100 samples, just give up.
auto playbackBufferSize =
(sampleCount)lrint(mRate * mPlaybackRingBufferSecs);
auto playbackMixBufferSize =
(sampleCount)mPlaybackSamplesToCopy;
auto playbackBufferSize = (size_t)lrint(mRate * mPlaybackRingBufferSecs);
auto playbackMixBufferSize = mPlaybackSamplesToCopy;
if(playbackBufferSize < 100 || playbackMixBufferSize < 100)
{
StartStreamCleanup();

View File

@ -573,7 +573,7 @@ private:
double mSeek;
double mPlaybackRingBufferSecs;
double mCaptureRingBufferSecs;
long mPlaybackSamplesToCopy;
size_t mPlaybackSamplesToCopy;
double mMinCaptureSecsToCopy;
bool mPaused;
PaStream *mPortStreamV19;

View File

@ -70,7 +70,7 @@ out.
static const int headerTagLen = 20;
static char headerTag[headerTagLen + 1] = "AudacityBlockFile112";
SummaryInfo::SummaryInfo(sampleCount samples)
SummaryInfo::SummaryInfo(size_t samples)
{
format = floatSample;
@ -98,7 +98,7 @@ ArrayOf<char> BlockFile::fullSummary;
/// will store at least the summary data here.
///
/// @param samples The number of samples this BlockFile contains.
BlockFile::BlockFile(wxFileNameWrapper &&fileName, sampleCount samples):
BlockFile::BlockFile(wxFileNameWrapper &&fileName, size_t samples):
mLockCount(0),
mFileName(std::move(fileName)),
mLen(samples),
@ -177,7 +177,7 @@ bool BlockFile::IsLocked()
/// @param buffer A buffer containing the sample data to be analyzed
/// @param len The length of the sample data
/// @param format The format of the sample data.
void *BlockFile::CalcSummary(samplePtr buffer, sampleCount len,
void *BlockFile::CalcSummary(samplePtr buffer, size_t len,
sampleFormat format, ArrayOf<char> &cleanup)
{
// Caller has nothing to deallocate
@ -201,7 +201,7 @@ void *BlockFile::CalcSummary(samplePtr buffer, sampleCount len,
return fullSummary.get();
}
void BlockFile::CalcSummaryFromBuffer(const float *fbuffer, sampleCount len,
void BlockFile::CalcSummaryFromBuffer(const float *fbuffer, size_t len,
float *summary256, float *summary64K)
{
decltype(len) sumLen;
@ -375,7 +375,7 @@ void BlockFile::FixSummary(void *data)
/// should be stored
/// @param *outRMS A pointer to where the maximum RMS value for this
/// region should be stored.
void BlockFile::GetMinMax(sampleCount start, sampleCount len,
void BlockFile::GetMinMax(size_t start, size_t len,
float *outMin, float *outMax, float *outRMS) const
{
// TODO: actually use summaries
@ -429,12 +429,12 @@ void BlockFile::GetMinMax(float *outMin, float *outMax, float *outRMS) const
/// @param start The offset in 256-sample increments
/// @param len The number of 256-sample summary frames to read
bool BlockFile::Read256(float *buffer,
sampleCount start, sampleCount len)
size_t start, size_t len)
{
wxASSERT(start >= 0);
char *summary = new char[mSummaryInfo.totalSummaryBytes];
// FIXME: TRAP_ERR ReadSummay() could return fail.
// FIXME: TRAP_ERR ReadSummary() could return fail.
this->ReadSummary(summary);
start = std::min( start, mSummaryInfo.frames256 );
@ -468,12 +468,12 @@ bool BlockFile::Read256(float *buffer,
/// @param start The offset in 64K-sample increments
/// @param len The number of 64K-sample summary frames to read
bool BlockFile::Read64K(float *buffer,
sampleCount start, sampleCount len)
size_t start, size_t len)
{
wxASSERT(start >= 0);
char *summary = new char[mSummaryInfo.totalSummaryBytes];
// FIXME: TRAP_ERR ReadSummay() could return fail.
// FIXME: TRAP_ERR ReadSummary() could return fail.
this->ReadSummary(summary);
start = std::min( start, mSummaryInfo.frames64K );
@ -520,7 +520,7 @@ bool BlockFile::Read64K(float *buffer,
AliasBlockFile::AliasBlockFile(wxFileNameWrapper &&baseFileName,
wxFileNameWrapper &&aliasedFileName,
sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel):
size_t aliasLen, int aliasChannel):
BlockFile {
(baseFileName.SetExt(wxT("auf")), std::move(baseFileName)),
aliasLen
@ -535,7 +535,7 @@ AliasBlockFile::AliasBlockFile(wxFileNameWrapper &&baseFileName,
AliasBlockFile::AliasBlockFile(wxFileNameWrapper &&existingSummaryFileName,
wxFileNameWrapper &&aliasedFileName,
sampleCount aliasStart,
sampleCount aliasLen,
size_t aliasLen,
int aliasChannel,
float min, float max, float rms):
BlockFile{ std::move(existingSummaryFileName), aliasLen },

View File

@ -29,14 +29,14 @@
class SummaryInfo {
public:
SummaryInfo(sampleCount samples);
SummaryInfo(size_t samples);
int fields; /* Usually 3 for Min, Max, RMS */
sampleFormat format;
int bytesPerFrame;
sampleCount frames64K;
size_t frames64K;
int offset64K;
sampleCount frames256;
size_t frames256;
int offset256;
int totalSummaryBytes;
};
@ -58,7 +58,7 @@ class PROFILE_DLL_API BlockFile /* not final, abstract */ {
// Constructor / Destructor
/// Construct a BlockFile.
BlockFile(wxFileNameWrapper &&fileName, sampleCount samples);
BlockFile(wxFileNameWrapper &&fileName, size_t samples);
virtual ~BlockFile();
static unsigned long gBlockFileDestructionCount;
@ -66,8 +66,8 @@ class PROFILE_DLL_API BlockFile /* not final, abstract */ {
// Reading
/// Retrieves audio data from this BlockFile
virtual int ReadData(samplePtr data, sampleFormat format,
sampleCount start, sampleCount len) const = 0;
virtual size_t ReadData(samplePtr data, sampleFormat format,
size_t start, size_t len) const = 0;
// Other Properties
@ -105,8 +105,8 @@ class PROFILE_DLL_API BlockFile /* not final, abstract */ {
virtual GetFileNameResult GetFileName() const;
virtual void SetFileName(wxFileNameWrapper &&name);
sampleCount GetLength() const { return mLen; }
void SetLength(const sampleCount newLen) { mLen = newLen; }
size_t GetLength() const { return mLen; }
void SetLength(size_t newLen) { mLen = newLen; }
/// Locks this BlockFile, to prevent it from being moved
virtual void Lock();
@ -116,14 +116,14 @@ class PROFILE_DLL_API BlockFile /* not final, abstract */ {
virtual bool IsLocked();
/// Gets extreme values for the specified region
virtual void GetMinMax(sampleCount start, sampleCount len,
virtual void GetMinMax(size_t start, size_t len,
float *outMin, float *outMax, float *outRMS) const;
/// Gets extreme values for the entire block
virtual void GetMinMax(float *outMin, float *outMax, float *outRMS) const;
/// Returns the 256 byte summary data block
virtual bool Read256(float *buffer, sampleCount start, sampleCount len);
virtual bool Read256(float *buffer, size_t start, size_t len);
/// Returns the 64K summary data block
virtual bool Read64K(float *buffer, sampleCount start, sampleCount len);
virtual bool Read64K(float *buffer, size_t start, size_t len);
/// Returns TRUE if this block references another disk file
virtual bool IsAlias() const { return false; }
@ -170,12 +170,12 @@ class PROFILE_DLL_API BlockFile /* not final, abstract */ {
protected:
/// Calculate summary data for the given sample data
/// Overrides have differing details of memory management
virtual void *CalcSummary(samplePtr buffer, sampleCount len,
virtual void *CalcSummary(samplePtr buffer, size_t len,
sampleFormat format,
// This gets filled, if the caller needs to deallocate. Else it is null.
ArrayOf<char> &cleanup);
// Common, nonvirtual calculation routine for the use of the above
void CalcSummaryFromBuffer(const float *fbuffer, sampleCount len,
void CalcSummaryFromBuffer(const float *fbuffer, size_t len,
float *summary256, float *summary64K);
/// Read the summary section of the file. Derived classes implement.
@ -192,7 +192,7 @@ class PROFILE_DLL_API BlockFile /* not final, abstract */ {
protected:
wxFileNameWrapper mFileName;
sampleCount mLen;
size_t mLen;
SummaryInfo mSummaryInfo;
float mMin, mMax, mRMS;
mutable bool mSilentLog;
@ -216,10 +216,10 @@ class AliasBlockFile /* not final */ : public BlockFile
/// Constructs an AliasBlockFile
AliasBlockFile(wxFileNameWrapper &&baseFileName,
wxFileNameWrapper &&aliasedFileName, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel);
size_t aliasLen, int aliasChannel);
AliasBlockFile(wxFileNameWrapper &&existingSummaryFileName,
wxFileNameWrapper &&aliasedFileName, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel,
size_t aliasLen, int aliasChannel,
float min, float max, float RMS);
virtual ~AliasBlockFile();

View File

@ -38,7 +38,7 @@ CrossFader::~CrossFader()
bool CrossFader::GetSamples(samplePtr buffer, sampleFormat format,
sampleCount start, sampleCount len)
sampleCount start, size_t len)
{
switch (mType)
{
@ -57,7 +57,7 @@ bool CrossFader::GetSamples(samplePtr buffer, sampleFormat format,
}
bool CrossFader::CrossFadeMix(samplePtr buffer, sampleFormat format, sampleCount start, sampleCount len)
bool CrossFader::CrossFadeMix(samplePtr buffer, sampleFormat format, sampleCount start, size_t len)
{
std::cout << "Crossfading from " << start.as_long_long()

View File

@ -42,14 +42,14 @@ class CrossFader
void ClearClips();
//Produces samples according to crossfading rules.
bool GetSamples(samplePtr buffer, sampleFormat format,
sampleCount start, sampleCount len);
sampleCount start, size_t len);
protected:
WaveClipHolders mClips;
private:
bool CrossFadeMix(samplePtr buffer, sampleFormat format, sampleCount start, sampleCount len);
bool CrossFadeMix(samplePtr buffer, sampleFormat format, sampleCount start, size_t len);
FadeType mType;

View File

@ -345,7 +345,7 @@ DirManager::DirManager()
mLoadingTarget = NULL;
mLoadingTargetIdx = 0;
mMaxSamples = -1;
mMaxSamples = ~size_t(0);
// toplevel pool hash is fully populated to begin
{
@ -925,7 +925,7 @@ wxFileNameWrapper DirManager::MakeBlockFileName()
}
BlockFilePtr DirManager::NewSimpleBlockFile(
samplePtr sampleData, sampleCount sampleLen,
samplePtr sampleData, size_t sampleLen,
sampleFormat format,
bool allowDeferredWrite)
{
@ -942,7 +942,7 @@ BlockFilePtr DirManager::NewSimpleBlockFile(
BlockFilePtr DirManager::NewAliasBlockFile(
const wxString &aliasedFile, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel)
size_t aliasLen, int aliasChannel)
{
wxFileNameWrapper filePath{ MakeBlockFileName() };
const wxString fileName = filePath.GetName();
@ -959,7 +959,7 @@ BlockFilePtr DirManager::NewAliasBlockFile(
BlockFilePtr DirManager::NewODAliasBlockFile(
const wxString &aliasedFile, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel)
size_t aliasLen, int aliasChannel)
{
wxFileNameWrapper filePath{ MakeBlockFileName() };
const wxString fileName{ filePath.GetName() };
@ -976,7 +976,7 @@ BlockFilePtr DirManager::NewODAliasBlockFile(
BlockFilePtr DirManager::NewODDecodeBlockFile(
const wxString &aliasedFile, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel, int decodeType)
size_t aliasLen, int aliasChannel, int decodeType)
{
wxFileNameWrapper filePath{ MakeBlockFileName() };
const wxString fileName{ filePath.GetName() };
@ -1135,7 +1135,7 @@ bool DirManager::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
return false;
// Check the length here so we don't have to do it in each BuildFromXML method.
if ((mMaxSamples > -1) && // is initialized
if ((mMaxSamples != ~size_t(0)) && // is initialized
(pBlockFile->GetLength() > mMaxSamples))
{
// See http://bugzilla.audacityteam.org/show_bug.cgi?id=451#c13.

View File

@ -63,21 +63,21 @@ class PROFILE_DLL_API DirManager final : public XMLTagHandler {
BlockFilePtr
NewSimpleBlockFile(samplePtr sampleData,
sampleCount sampleLen,
size_t sampleLen,
sampleFormat format,
bool allowDeferredWrite = false);
BlockFilePtr
NewAliasBlockFile( const wxString &aliasedFile, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel);
size_t aliasLen, int aliasChannel);
BlockFilePtr
NewODAliasBlockFile( const wxString &aliasedFile, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel);
size_t aliasLen, int aliasChannel);
BlockFilePtr
NewODDecodeBlockFile( const wxString &aliasedFile, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel, int decodeType);
size_t aliasLen, int aliasChannel, int decodeType);
/// Returns true if the blockfile pointed to by b is contained by the DirManager
bool ContainsBlockFile(const BlockFile *b) const;
@ -108,10 +108,10 @@ class PROFILE_DLL_API DirManager final : public XMLTagHandler {
mLoadingTargetIdx = idx;
}
void SetLoadingFormat(sampleFormat format) { mLoadingFormat = format; }
void SetLoadingBlockLength(sampleCount len) { mLoadingBlockLen = len; }
void SetLoadingBlockLength(size_t len) { mLoadingBlockLen = len; }
// Note: following affects only the loading of block files when opening a project
void SetLoadingMaxSamples(sampleCount max) { mMaxSamples = max; }
void SetLoadingMaxSamples(size_t max) { mMaxSamples = max; }
bool HandleXMLTag(const wxChar *tag, const wxChar **attrs);
XMLTagHandler *HandleXMLChild(const wxChar * WXUNUSED(tag)) { return NULL; }
@ -204,9 +204,9 @@ class PROFILE_DLL_API DirManager final : public XMLTagHandler {
BlockArray *mLoadingTarget;
unsigned mLoadingTargetIdx;
sampleFormat mLoadingFormat;
sampleCount mLoadingBlockLen;
size_t mLoadingBlockLen;
sampleCount mMaxSamples; // max samples per block
size_t mMaxSamples; // max samples per block
unsigned long mLastBlockFileDestructionCount { 0 };

View File

@ -6216,7 +6216,7 @@ class ASAProgress final : public SAProgress {
long mixer_process(void *mixer, float **buffer, long n)
{
Mixer *mix = (Mixer *) mixer;
long frame_count = mix->Process(n);
long frame_count = mix->Process(std::max(0L, n));
*buffer = (float *) mix->GetBuffer();
return frame_count;
}
@ -6301,7 +6301,7 @@ void AudacityProject::OnScoreAlign()
0.0, // double startTime
endTime, // double stopTime
2, // int numOutChannels
44100, // int outBufferSize
44100u, // size_t outBufferSize
true, // bool outInterleaved
mRate, // double outRate
floatSample, // sampleFormat outFormat

View File

@ -241,7 +241,7 @@ Mixer::WarpOptions::WarpOptions(double min, double max)
Mixer::Mixer(const WaveTrackConstArray &inputTracks,
const WarpOptions &warpOptions,
double startTime, double stopTime,
unsigned numOutChannels, int outBufferSize, bool outInterleaved,
unsigned numOutChannels, size_t outBufferSize, bool outInterleaved,
double outRate, sampleFormat outFormat,
bool highQuality, MixerSpec *mixerSpec)
{
@ -405,7 +405,7 @@ void MixBuffers(unsigned numChannels, int *channelFlags, float *gains,
}
}
sampleCount Mixer::MixVariableRates(int *channelFlags, WaveTrackCache &cache,
size_t Mixer::MixVariableRates(int *channelFlags, WaveTrackCache &cache,
sampleCount *pos, float *queue,
int *queueStart, int *queueLen,
Resample * pResample)
@ -546,7 +546,7 @@ sampleCount Mixer::MixVariableRates(int *channelFlags, WaveTrackCache &cache,
return out;
}
sampleCount Mixer::MixSameRate(int *channelFlags, WaveTrackCache &cache,
size_t Mixer::MixSameRate(int *channelFlags, WaveTrackCache &cache,
sampleCount *pos)
{
const WaveTrack *const track = cache.GetTrack();
@ -601,7 +601,7 @@ sampleCount Mixer::MixSameRate(int *channelFlags, WaveTrackCache &cache,
return slen;
}
sampleCount Mixer::Process(sampleCount maxToProcess)
size_t Mixer::Process(size_t maxToProcess)
{
// MB: this is wrong! mT represented warped time, and mTime is too inaccurate to use
// it here. It's also unnecessary I think.

View File

@ -95,7 +95,7 @@ class AUDACITY_DLL_API Mixer {
Mixer(const WaveTrackConstArray &inputTracks,
const WarpOptions &warpOptions,
double startTime, double stopTime,
unsigned numOutChannels, int outBufferSize, bool outInterleaved,
unsigned numOutChannels, size_t outBufferSize, bool outInterleaved,
double outRate, sampleFormat outFormat,
bool highQuality = true, MixerSpec *mixerSpec = NULL);
@ -115,7 +115,7 @@ class AUDACITY_DLL_API Mixer {
/// a buffer which can be retrieved by calling GetBuffer().
/// Returns number of output samples, or 0, if there are no
/// more samples that must be processed.
sampleCount Process(sampleCount maxSamples);
size_t Process(size_t maxSamples);
/// Restart processing at beginning of buffer next time
/// Process() is called.
@ -141,10 +141,10 @@ class AUDACITY_DLL_API Mixer {
private:
void Clear();
sampleCount MixSameRate(int *channelFlags, WaveTrackCache &cache,
size_t MixSameRate(int *channelFlags, WaveTrackCache &cache,
sampleCount *pos);
sampleCount MixVariableRates(int *channelFlags, WaveTrackCache &cache,
size_t MixVariableRates(int *channelFlags, WaveTrackCache &cache,
sampleCount *pos, float *queue,
int *queueStart, int *queueLen,
Resample * pResample);
@ -167,16 +167,16 @@ class AUDACITY_DLL_API Mixer {
float **mSampleQueue;
int *mQueueStart;
int *mQueueLen;
int mQueueMaxLen;
int mProcessLen;
size_t mQueueMaxLen;
size_t mProcessLen;
MixerSpec *mMixerSpec;
// Output
int mMaxOut;
size_t mMaxOut;
unsigned mNumChannels;
unsigned mNumBuffers;
int mBufferSize;
int mInterleavedBufferSize;
size_t mBufferSize;
size_t mInterleavedBufferSize;
sampleFormat mFormat;
bool mInterleaved;
SampleBuffer *mBuffer;

View File

@ -27,7 +27,7 @@
RingBuffer::RingBuffer(sampleFormat format, size_t size)
: mFormat{ format }
, mBufferSize{ std::max<size_t>(size, 64) }
, mBuffer( mBufferSize, mFormat )
, mBuffer{ mBufferSize, mFormat }
{
}

View File

@ -74,7 +74,7 @@ const wxChar *GetSampleFormatStr(sampleFormat format)
return wxT("Unknown format"); // compiler food
}
AUDACITY_DLL_API samplePtr NewSamples(int count, sampleFormat format)
AUDACITY_DLL_API samplePtr NewSamples(size_t count, sampleFormat format)
{
return (samplePtr)malloc(count * SAMPLE_SIZE(format));
}

View File

@ -48,7 +48,7 @@ const wxChar *GetSampleFormatStr(sampleFormat format);
// Allocating/Freeing Samples
//
AUDACITY_DLL_API samplePtr NewSamples(int count, sampleFormat format);
AUDACITY_DLL_API samplePtr NewSamples(size_t count, sampleFormat format);
AUDACITY_DLL_API void DeleteSamples(samplePtr p);
// RAII version of above
@ -58,7 +58,7 @@ public:
SampleBuffer()
: mPtr(0)
{}
SampleBuffer(int count, sampleFormat format)
SampleBuffer(size_t count, sampleFormat format)
: mPtr(NewSamples(count, format))
{}
~SampleBuffer()
@ -67,7 +67,7 @@ public:
}
// WARNING! May not preserve contents.
SampleBuffer &Allocate(int count, sampleFormat format)
SampleBuffer &Allocate(size_t count, sampleFormat format)
{
Free();
mPtr = NewSamples(count, format);
@ -96,12 +96,12 @@ public:
, mCount(0)
{}
GrowableSampleBuffer(int count, sampleFormat format)
GrowableSampleBuffer(size_t count, sampleFormat format)
: SampleBuffer(count, format)
, mCount(count)
{}
GrowableSampleBuffer &Resize(int count, sampleFormat format)
GrowableSampleBuffer &Resize(size_t count, sampleFormat format)
{
if (!ptr() || mCount < count) {
Allocate(count, format);
@ -119,7 +119,7 @@ public:
using SampleBuffer::ptr;
private:
int mCount;
size_t mCount;
};
//

View File

@ -48,7 +48,7 @@
#include "blockfile/SimpleBlockFile.h"
#include "blockfile/SilentBlockFile.h"
int Sequence::sMaxDiskBlockSize = 1048576;
size_t Sequence::sMaxDiskBlockSize = 1048576;
// Sequence methods
Sequence::Sequence(const std::shared_ptr<DirManager> &projDirManager, sampleFormat format)
@ -77,12 +77,12 @@ Sequence::~Sequence()
{
}
sampleCount Sequence::GetMaxBlockSize() const
size_t Sequence::GetMaxBlockSize() const
{
return mMaxSamples;
}
sampleCount Sequence::GetIdealBlockSize() const
size_t Sequence::GetIdealBlockSize() const
{
return mMaxSamples;
}
@ -698,7 +698,7 @@ bool Sequence::InsertSilence(sampleCount s0, sampleCount len)
bool Sequence::AppendAlias(const wxString &fullPath,
sampleCount start,
sampleCount len, int channel, bool useOD)
size_t len, int channel, bool useOD)
{
// Quick check to make sure that it doesn't overflow
if (Overflows((mNumSamples.as_double()) + ((double)len)))
@ -717,7 +717,7 @@ bool Sequence::AppendAlias(const wxString &fullPath,
}
bool Sequence::AppendCoded(const wxString &fName, sampleCount start,
sampleCount len, int channel, int decodeType)
size_t len, int channel, int decodeType)
{
// Quick check to make sure that it doesn't overflow
if (Overflows((mNumSamples.as_double()) + ((double)len)))
@ -781,7 +781,7 @@ sampleCount Sequence::GetBlockStart(sampleCount position) const
return mBlock[b].start;
}
sampleCount Sequence::GetBestBlockSize(sampleCount start) const
size_t Sequence::GetBestBlockSize(sampleCount start) const
{
// This method returns a nice number of samples you should try to grab in
// one big chunk in order to land on a block boundary, based on the starting
@ -897,6 +897,8 @@ bool Sequence::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
mErrorOpening = true;
return false;
}
// nValue is now safe for size_t
mMaxSamples = nValue;
// PRL: Is the following really okay? DirManager might be shared across projects!
@ -1111,21 +1113,19 @@ int Sequence::FindBlock(sampleCount pos) const
}
bool Sequence::Read(samplePtr buffer, sampleFormat format,
const SeqBlock &b, sampleCount start, sampleCount len) const
const SeqBlock &b, size_t blockRelativeStart, size_t len)
const
{
const auto &f = b.f;
wxASSERT(start >= 0);
wxASSERT(start + len <= f->GetLength());
wxASSERT(blockRelativeStart + len <= f->GetLength());
int result = f->ReadData(buffer, format, start, len);
auto result = f->ReadData(buffer, format, blockRelativeStart, len);
if (result != len)
{
wxLogWarning(wxT("Expected to read %ld samples, got %d samples."),
(long long)len, result);
if (result < 0)
result = 0;
len, result);
ClearSamples(buffer, format, result, len-result);
}
@ -1134,7 +1134,7 @@ bool Sequence::Read(samplePtr buffer, sampleFormat format,
bool Sequence::CopyWrite(SampleBuffer &scratch,
samplePtr buffer, SeqBlock &b,
sampleCount start, sampleCount len)
size_t blockRelativeStart, size_t len)
{
// We don't ever write to an existing block; to support Undo,
// we copy the old block entirely into memory, dereference it,
@ -1142,13 +1142,13 @@ bool Sequence::CopyWrite(SampleBuffer &scratch,
const auto length = b.f->GetLength();
wxASSERT(length <= mMaxSamples);
wxASSERT(start + len <= length);
wxASSERT(start >= 0);
wxASSERT(blockRelativeStart + len <= length);
auto sampleSize = SAMPLE_SIZE(mSampleFormat);
Read(scratch.ptr(), mSampleFormat, b, 0, length);
memcpy(scratch.ptr() + start*sampleSize, buffer, len*sampleSize);
memcpy(scratch.ptr() +
blockRelativeStart * sampleSize, buffer, len*sampleSize);
b.f = mDirManager->NewSimpleBlockFile(scratch.ptr(), length, mSampleFormat);
@ -1156,7 +1156,7 @@ bool Sequence::CopyWrite(SampleBuffer &scratch,
}
bool Sequence::Get(samplePtr buffer, sampleFormat format,
sampleCount start, sampleCount len) const
sampleCount start, size_t len) const
{
if (start == mNumSamples) {
return len == 0;
@ -1171,7 +1171,7 @@ bool Sequence::Get(samplePtr buffer, sampleFormat format,
}
bool Sequence::Get(int b, samplePtr buffer, sampleFormat format,
sampleCount start, sampleCount len) const
sampleCount start, size_t len) const
{
while (len) {
const SeqBlock &block = mBlock[b];
@ -1497,7 +1497,7 @@ bool Sequence::GetWaveDisplay(float *min, float *max, float *rms, int* bl,
return true;
}
sampleCount Sequence::GetIdealAppendLen()
size_t Sequence::GetIdealAppendLen() const
{
int numBlocks = mBlock.size();
const auto max = GetMaxBlockSize();
@ -1513,7 +1513,7 @@ sampleCount Sequence::GetIdealAppendLen()
}
bool Sequence::Append(samplePtr buffer, sampleFormat format,
sampleCount len, XMLWriter* blockFileLog /*=NULL*/)
size_t len, XMLWriter* blockFileLog /*=NULL*/)
{
// Quick check to make sure that it doesn't overflow
if (Overflows(mNumSamples.as_double() + ((double)len)))
@ -1592,7 +1592,7 @@ bool Sequence::Append(samplePtr buffer, sampleFormat format,
return true;
}
void Sequence::Blockify(BlockArray &list, sampleCount start, samplePtr buffer, sampleCount len)
void Sequence::Blockify(BlockArray &list, sampleCount start, samplePtr buffer, size_t len)
{
if (len <= 0)
return;
@ -1846,12 +1846,12 @@ void Sequence::DebugPrintf(wxString *dest) const
}
// static
void Sequence::SetMaxDiskBlockSize(int bytes)
void Sequence::SetMaxDiskBlockSize(size_t bytes)
{
sMaxDiskBlockSize = bytes;
}
int Sequence::GetMaxDiskBlockSize()
size_t Sequence::GetMaxDiskBlockSize()
{
return sMaxDiskBlockSize;
}

View File

@ -59,8 +59,8 @@ class PROFILE_DLL_API Sequence final : public XMLTagHandler{
// Static methods
//
static void SetMaxDiskBlockSize(int bytes);
static int GetMaxDiskBlockSize();
static void SetMaxDiskBlockSize(size_t bytes);
static size_t GetMaxDiskBlockSize();
//
// Constructor / Destructor / Duplicator
@ -82,7 +82,10 @@ class PROFILE_DLL_API Sequence final : public XMLTagHandler{
sampleCount GetNumSamples() const { return mNumSamples; }
bool Get(samplePtr buffer, sampleFormat format,
sampleCount start, sampleCount len) const;
sampleCount start, size_t len) const;
// Note that len is not size_t, because nullptr may be passed for buffer, in
// which case, silence is inserted, possibly a large amount.
bool Set(samplePtr buffer, sampleFormat format,
sampleCount start, sampleCount len);
@ -99,16 +102,16 @@ class PROFILE_DLL_API Sequence final : public XMLTagHandler{
bool Copy(sampleCount s0, sampleCount s1, std::unique_ptr<Sequence> &dest) const;
bool Paste(sampleCount s0, const Sequence *src);
sampleCount GetIdealAppendLen();
bool Append(samplePtr buffer, sampleFormat format, sampleCount len,
size_t GetIdealAppendLen() const;
bool Append(samplePtr buffer, sampleFormat format, size_t len,
XMLWriter* blockFileLog=NULL);
bool Delete(sampleCount start, sampleCount len);
bool AppendAlias(const wxString &fullPath,
sampleCount start,
sampleCount len, int channel, bool useOD);
size_t len, int channel, bool useOD);
bool AppendCoded(const wxString &fName, sampleCount start,
sampleCount len, int channel, int decodeType);
size_t len, int channel, int decodeType);
///gets an int with OD flags so that we can determine which ODTasks should be run on this track after save/open, etc.
unsigned int GetODFlags();
@ -171,10 +174,13 @@ class PROFILE_DLL_API Sequence final : public XMLTagHandler{
// Getting block size and alignment information
//
// This returns a possibly large or negative value
sampleCount GetBlockStart(sampleCount position) const;
sampleCount GetBestBlockSize(sampleCount start) const;
sampleCount GetMaxBlockSize() const;
sampleCount GetIdealBlockSize() const;
// These return a nonnegative number of samples meant to size a memory buffer
size_t GetBestBlockSize(sampleCount start) const;
size_t GetMaxBlockSize() const;
size_t GetIdealBlockSize() const;
//
// This should only be used if you really, really know what
@ -208,7 +214,7 @@ class PROFILE_DLL_API Sequence final : public XMLTagHandler{
// Private static variables
//
static int sMaxDiskBlockSize;
static size_t sMaxDiskBlockSize;
//
// Private variables
@ -218,10 +224,12 @@ class PROFILE_DLL_API Sequence final : public XMLTagHandler{
BlockArray mBlock;
sampleFormat mSampleFormat;
// Not size_t! May need to be large:
sampleCount mNumSamples{ 0 };
sampleCount mMinSamples; // min samples per block
sampleCount mMaxSamples; // max samples per block
size_t mMinSamples; // min samples per block
size_t mMaxSamples; // max samples per block
bool mErrorOpening{ false };
@ -238,16 +246,16 @@ class PROFILE_DLL_API Sequence final : public XMLTagHandler{
bool Read(samplePtr buffer, sampleFormat format,
const SeqBlock &b,
sampleCount start, sampleCount len) const;
size_t blockRelativeStart, size_t len) const;
bool CopyWrite(SampleBuffer &scratch,
samplePtr buffer, SeqBlock &b,
sampleCount start, sampleCount len);
samplePtr buffer, SeqBlock &b,
size_t blockRelativeStart, size_t len);
void Blockify(BlockArray &list, sampleCount start, samplePtr buffer, sampleCount len);
void Blockify(BlockArray &list, sampleCount start, samplePtr buffer, size_t len);
bool Get(int b, samplePtr buffer, sampleFormat format,
sampleCount start, sampleCount len) const;
sampleCount start, size_t len) const;
public:

View File

@ -102,8 +102,8 @@ sampleCount VoiceKey::OnForward (WaveTrack & t, sampleCount start, sampleCount l
//Change the millisecond-based parameters into sample-based parameters
double rate = t.GetRate(); //Translates seconds to samples
unsigned int WindowSizeInt = (unsigned int)(rate * mWindowSize); //Size of window to examine
unsigned int SignalWindowSizeInt = (unsigned int)(rate * mSignalWindowSize); //This much signal is necessary to trip key
size_t WindowSizeInt = (rate * mWindowSize); //Size of window to examine
size_t SignalWindowSizeInt = (rate * mSignalWindowSize); //This much signal is necessary to trip key
auto samplesleft = len - WindowSizeInt; //Indexes the number of samples remaining in the selection
auto lastsubthresholdsample = start; //start this off at the selection start
@ -144,7 +144,7 @@ sampleCount VoiceKey::OnForward (WaveTrack & t, sampleCount start, sampleCount l
//Calculate how many to scan through--we only have to go through (at most)
//the first window + 1 samples--but we need another window samples to draw from.
auto remaining = 2*WindowSizeInt+1;
size_t remaining = 2*WindowSizeInt+1;
//To speed things up, create a local buffer to store things in, to avoid the costly t.Get();
//Only go through the first SignalWindowSizeInt samples, and choose the first that trips the key.
@ -249,7 +249,7 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le
//Change the millisecond-based parameters into sample-based parameters
double rate = t.GetRate(); //Translates seconds to samples
unsigned int WindowSizeInt = (unsigned int)(rate * mWindowSize); //Size of window to examine
size_t WindowSizeInt = (rate * mWindowSize); //Size of window to examine
//unsigned int SilentWindowSizeInt = (unsigned int)(rate * mSilentWindowSize); //This much signal is necessary to trip key
auto samplesleft = len - WindowSizeInt; //Indexes the number of samples remaining in the selection
@ -293,7 +293,7 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le
//Calculate how many to scan through--we only have to go through (at most)
//the first window + 1 samples--but we need another window samples to draw from.
auto remaining = 2*WindowSizeInt+1;
size_t remaining = 2*WindowSizeInt+1;
//To speed things up, create a local buffer to store things in, to avoid the costly t.Get();
//Only go through the first mSilentWindowSizeInt samples, and choose the first that trips the key.
@ -320,7 +320,7 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le
//Now, go through the sound again, sample by sample.
size_t i;
for(i = remaining - 1; i > WindowSizeInt; i--) {
for(i = remaining - 1; i > WindowSizeInt; i--) {
int tests = 0;
int testThreshold = 0;
//Update the test statistics
@ -428,7 +428,7 @@ sampleCount VoiceKey::OffForward (WaveTrack & t, sampleCount start, sampleCount
//Calculate how many to scan through--we only have to go through (at most)
//the first window + 1 samples--but we need another window samples to draw from.
auto remaining = 2*WindowSizeInt+1;
size_t remaining = 2*WindowSizeInt+1;
//To speed things up, create a local buffer to store things in, to avoid the costly t.Get();
//Only go through the first SilentWindowSizeInt samples, and choose the first that trips the key.
@ -564,7 +564,7 @@ sampleCount VoiceKey::OffBackward (WaveTrack & t, sampleCount end, sampleCount l
//Calculate how many to scan through--we only have to go through (at most)
//the first window + 1 samples--but we need another window samples to draw from.
auto remaining = 2*WindowSizeInt+1;
const size_t remaining = 2*WindowSizeInt+1;
//To speed things up, create a local buffer to store things in, to avoid the costly t.Get();
//Only go through the first SilentWindowSizeInt samples, and choose the first that trips the key.

View File

@ -350,13 +350,13 @@ void WaveClip::SetOffset(double offset)
}
bool WaveClip::GetSamples(samplePtr buffer, sampleFormat format,
sampleCount start, sampleCount len) const
sampleCount start, size_t len) const
{
return mSequence->Get(buffer, format, start, len);
}
bool WaveClip::SetSamples(samplePtr buffer, sampleFormat format,
sampleCount start, sampleCount len)
sampleCount start, size_t len)
{
bool bResult = mSequence->Set(buffer, format, start, len);
MarkChanged();
@ -1297,7 +1297,7 @@ void WaveClip::GetDisplayRect(wxRect* r)
}
bool WaveClip::Append(samplePtr buffer, sampleFormat format,
sampleCount len, unsigned int stride /* = 1 */,
size_t len, unsigned int stride /* = 1 */,
XMLWriter* blockFileLog /*=NULL*/)
{
//wxLogDebug(wxT("Append: len=%lli"), (long long) len);
@ -1348,7 +1348,7 @@ bool WaveClip::Append(samplePtr buffer, sampleFormat format,
}
bool WaveClip::AppendAlias(const wxString &fName, sampleCount start,
sampleCount len, int channel,bool useOD)
size_t len, int channel,bool useOD)
{
bool result = mSequence->AppendAlias(fName, start, len, channel,useOD);
if (result)
@ -1360,7 +1360,7 @@ bool WaveClip::AppendAlias(const wxString &fName, sampleCount start,
}
bool WaveClip::AppendCoded(const wxString &fName, sampleCount start,
sampleCount len, int channel, int decodeType)
size_t len, int channel, int decodeType)
{
bool result = mSequence->AppendCoded(fName, start, len, channel, decodeType);
if (result)
@ -1786,7 +1786,7 @@ bool WaveClip::Resample(int rate, ProgressDialog *progress)
double factor = (double)rate / (double)mRate;
::Resample resample(true, factor, factor); // constant rate resampling
int bufsize = 65536;
size_t bufsize = 65536;
float* inBuffer = new float[bufsize];
float* outBuffer = new float[bufsize];
sampleCount pos = 0;

View File

@ -119,7 +119,7 @@ public:
class SpecPxCache {
public:
SpecPxCache(int cacheLen)
SpecPxCache(size_t cacheLen)
{
len = cacheLen;
values = new float[len];
@ -134,7 +134,7 @@ public:
delete[] values;
}
sampleCount len;
size_t len;
float *values;
bool valid;
@ -250,9 +250,9 @@ public:
bool AfterClip(double t) const;
bool GetSamples(samplePtr buffer, sampleFormat format,
sampleCount start, sampleCount len) const;
sampleCount start, size_t len) const;
bool SetSamples(samplePtr buffer, sampleFormat format,
sampleCount start, sampleCount len);
sampleCount start, size_t len);
Envelope* GetEnvelope() { return mEnvelope.get(); }
const Envelope* GetEnvelope() const { return mEnvelope.get(); }
@ -295,16 +295,16 @@ public:
/// You must call Flush after the last Append
bool Append(samplePtr buffer, sampleFormat format,
sampleCount len, unsigned int stride=1,
size_t len, unsigned int stride=1,
XMLWriter* blockFileLog = NULL);
/// Flush must be called after last Append
bool Flush();
bool AppendAlias(const wxString &fName, sampleCount start,
sampleCount len, int channel,bool useOD);
size_t len, int channel,bool useOD);
bool AppendCoded(const wxString &fName, sampleCount start,
sampleCount len, int channel, int decodeType);
size_t len, int channel, int decodeType);
/// This name is consistent with WaveTrack::Clear. It performs a "Cut"
/// operation (but without putting the cutted audio to the clipboard)
@ -389,7 +389,7 @@ protected:
mutable ODLock mWaveCacheMutex;
mutable std::unique_ptr<SpecCache> mSpecCache;
SampleBuffer mAppendBuffer;
sampleCount mAppendBufferLen;
size_t mAppendBufferLen;
// Cut Lines are nothing more than ordinary wave clips, with the
// offset relative to the start of the clip.

View File

@ -1563,7 +1563,7 @@ bool WaveTrack::Join(double t0, double t1)
}
bool WaveTrack::Append(samplePtr buffer, sampleFormat format,
sampleCount len, unsigned int stride /* = 1 */,
size_t len, unsigned int stride /* = 1 */,
XMLWriter *blockFileLog /* = NULL */)
{
return RightmostOrNewClip()->Append(buffer, format, len, stride,
@ -1571,14 +1571,14 @@ bool WaveTrack::Append(samplePtr buffer, sampleFormat format,
}
bool WaveTrack::AppendAlias(const wxString &fName, sampleCount start,
sampleCount len, int channel,bool useOD)
size_t len, int channel,bool useOD)
{
return RightmostOrNewClip()->AppendAlias(fName, start, len, channel, useOD);
}
bool WaveTrack::AppendCoded(const wxString &fName, sampleCount start,
sampleCount len, int channel, int decodeType)
size_t len, int channel, int decodeType)
{
return RightmostOrNewClip()->AppendCoded(fName, start, len, channel, decodeType);
}
@ -1608,7 +1608,7 @@ sampleCount WaveTrack::GetBlockStart(sampleCount s) const
return -1;
}
sampleCount WaveTrack::GetBestBlockSize(sampleCount s) const
size_t WaveTrack::GetBestBlockSize(sampleCount s) const
{
auto bestBlockSize = GetMaxBlockSize();
@ -1626,7 +1626,7 @@ sampleCount WaveTrack::GetBestBlockSize(sampleCount s) const
return bestBlockSize;
}
sampleCount WaveTrack::GetMaxBlockSize() const
size_t WaveTrack::GetMaxBlockSize() const
{
decltype(GetMaxBlockSize()) maxblocksize = 0;
for (const auto &clip : mClips)
@ -1646,7 +1646,7 @@ sampleCount WaveTrack::GetMaxBlockSize() const
return maxblocksize;
}
sampleCount WaveTrack::GetIdealBlockSize()
size_t WaveTrack::GetIdealBlockSize()
{
return NewestOrNewClip()->GetSequence()->GetIdealBlockSize();
}
@ -1993,7 +1993,7 @@ bool WaveTrack::GetRMS(float *rms, double t0, double t1)
}
bool WaveTrack::Get(samplePtr buffer, sampleFormat format,
sampleCount start, sampleCount len, fillFormat fill ) const
sampleCount start, size_t len, fillFormat fill ) const
{
// Simple optimization: When this buffer is completely contained within one clip,
// don't clear anything (because we won't have to). Otherwise, just clear
@ -2071,7 +2071,7 @@ bool WaveTrack::Get(samplePtr buffer, sampleFormat format,
}
bool WaveTrack::Set(samplePtr buffer, sampleFormat format,
sampleCount start, sampleCount len)
sampleCount start, size_t len)
{
bool result = true;
@ -2648,7 +2648,7 @@ void WaveTrackCache::SetTrack(const WaveTrack *pTrack)
}
constSamplePtr WaveTrackCache::Get(sampleFormat format,
sampleCount start, sampleCount len)
sampleCount start, size_t len)
{
if (format == floatSample && len > 0) {
const auto end = start + len;

View File

@ -201,20 +201,20 @@ class AUDACITY_DLL_API WaveTrack final : public Track {
* one is created.
*/
bool Append(samplePtr buffer, sampleFormat format,
sampleCount len, unsigned int stride=1,
size_t len, unsigned int stride=1,
XMLWriter* blockFileLog=NULL);
/// Flush must be called after last Append
bool Flush();
bool AppendAlias(const wxString &fName, sampleCount start,
sampleCount len, int channel,bool useOD);
size_t len, int channel,bool useOD);
///for use with On-Demand decoding of compressed files.
///decodeType should be an enum from ODDecodeTask that specifies what
///Type of encoded file this is, such as eODFLAC
//vvv Why not use the ODTypeEnum typedef to enforce that for the parameter?
bool AppendCoded(const wxString &fName, sampleCount start,
sampleCount len, int channel, int decodeType);
size_t len, int channel, int decodeType);
///gets an int with OD flags so that we can determine which ODTasks should be run on this track after save/open, etc.
unsigned int GetODFlags();
@ -236,9 +236,9 @@ class AUDACITY_DLL_API WaveTrack final : public Track {
/// guaranteed that the same samples are affected.
///
bool Get(samplePtr buffer, sampleFormat format,
sampleCount start, sampleCount len, fillFormat fill=fillZero) const;
sampleCount start, size_t len, fillFormat fill=fillZero) const;
bool Set(samplePtr buffer, sampleFormat format,
sampleCount start, sampleCount len);
sampleCount start, size_t len);
void GetEnvelopeValues(double *buffer, size_t bufferLen,
double t0) const;
bool GetMinMax(float *min, float *max,
@ -262,11 +262,14 @@ class AUDACITY_DLL_API WaveTrack final : public Track {
// Getting information about the track's internal block sizes
// and alignment for efficiency
//
// This returns a possibly large or negative value
sampleCount GetBlockStart(sampleCount t) const;
sampleCount GetBestBlockSize(sampleCount t) const;
sampleCount GetMaxBlockSize() const;
sampleCount GetIdealBlockSize();
// These return a nonnegative number of samples meant to size a memory buffer
size_t GetBestBlockSize(sampleCount t) const;
size_t GetMaxBlockSize() const;
size_t GetIdealBlockSize();
//
// XMLTagHandler callback methods for loading and saving
@ -617,7 +620,7 @@ public:
// Returns null on failure
// Returned pointer may be invalidated if Get is called again
// Do not DELETE[] the pointer
constSamplePtr Get(sampleFormat format, sampleCount start, sampleCount len);
constSamplePtr Get(sampleFormat format, sampleCount start, size_t len);
private:
void Free();
@ -633,7 +636,7 @@ private:
};
const WaveTrack *mPTrack;
sampleCount mBufferSize;
size_t mBufferSize;
Buffer mBuffers[2];
GrowableSampleBuffer mOverlapBuffer;
int mNValidBuffers;

View File

@ -23,9 +23,9 @@
LegacyAliasBlockFile::LegacyAliasBlockFile(wxFileNameWrapper &&fileName,
wxFileNameWrapper &&aliasedFileName,
sampleCount aliasStart,
sampleCount aliasLen,
size_t aliasLen,
int aliasChannel,
sampleCount summaryLen,
size_t summaryLen,
bool noRMS)
: PCMAliasBlockFile{ std::move(fileName), std::move(aliasedFileName), aliasStart, aliasLen,
aliasChannel, 0.0, 0.0, 0.0 }

View File

@ -25,9 +25,9 @@ class LegacyAliasBlockFile final : public PCMAliasBlockFile
LegacyAliasBlockFile(wxFileNameWrapper &&fileName,
wxFileNameWrapper &&aliasedFileName,
sampleCount aliasStart,
sampleCount aliasLen,
size_t aliasLen,
int aliasChannel,
sampleCount summaryLen,
size_t summaryLen,
bool noRMS);
virtual ~LegacyAliasBlockFile();

View File

@ -128,8 +128,8 @@ void ComputeLegacySummaryInfo(const wxFileName &fileName,
/// @param existingFile The disk file this LegacyBlockFile should use.
LegacyBlockFile::LegacyBlockFile(wxFileNameWrapper &&existingFile,
sampleFormat format,
sampleCount summaryLen,
sampleCount len,
size_t summaryLen,
size_t len,
bool noRMS):
BlockFile{ std::move(existingFile), len },
mFormat(format)
@ -188,8 +188,8 @@ bool LegacyBlockFile::ReadSummary(void *data)
/// @param format The format the data will be stored in
/// @param start The offset in this block file
/// @param len The number of samples to read
int LegacyBlockFile::ReadData(samplePtr data, sampleFormat format,
sampleCount start, sampleCount len) const
size_t LegacyBlockFile::ReadData(samplePtr data, sampleFormat format,
size_t start, size_t len) const
{
SF_INFO info;
@ -246,7 +246,7 @@ int LegacyBlockFile::ReadData(samplePtr data, sampleFormat format,
SFCall<sf_count_t>(sf_seek, sf.get(), seekstart , SEEK_SET);
SampleBuffer buffer(len, floatSample);
int framesRead = 0;
size_t framesRead = 0;
// If both the src and dest formats are integer formats,
// read integers from the file (otherwise we would be
@ -295,7 +295,7 @@ void LegacyBlockFile::SaveXML(XMLWriter &xmlFile)
// as testing will be done in DirManager::ProjectFSCK().
/// static
BlockFilePtr LegacyBlockFile::BuildFromXML(const wxString &projDir, const wxChar **attrs,
sampleCount len, sampleFormat format)
size_t len, sampleFormat format)
{
wxFileNameWrapper fileName;
size_t summaryLen = 0;

View File

@ -40,8 +40,8 @@ class LegacyBlockFile final : public BlockFile {
/// Create the memory structure to refer to the given block file
LegacyBlockFile(wxFileNameWrapper &&existingFile,
sampleFormat format,
sampleCount summaryLen,
sampleCount len,
size_t summaryLen,
size_t len,
bool noRMS);
virtual ~LegacyBlockFile();
@ -50,8 +50,8 @@ class LegacyBlockFile final : public BlockFile {
/// Read the summary section of the disk file
bool ReadSummary(void *data) override;
/// Read the data section of the disk file
int ReadData(samplePtr data, sampleFormat format,
sampleCount start, sampleCount len) const override;
size_t ReadData(samplePtr data, sampleFormat format,
size_t start, size_t len) const override;
/// Create a NEW block file identical to this one
BlockFilePtr Copy(wxFileNameWrapper &&newFileName) override;
@ -61,7 +61,7 @@ class LegacyBlockFile final : public BlockFile {
void Recover() override;
static BlockFilePtr BuildFromXML(const wxString &dir, const wxChar **attrs,
sampleCount len,
size_t len,
sampleFormat format);
protected:

View File

@ -37,7 +37,7 @@ char bheaderTag[bheaderTagLen + 1] = "AudacityBlockFile112";
/// Create a disk file and write summary and sample data to it
ODDecodeBlockFile::ODDecodeBlockFile(wxFileNameWrapper &&baseFileName, wxFileNameWrapper &&audioFileName, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel,unsigned int decodeType):
size_t aliasLen, int aliasChannel,unsigned int decodeType):
SimpleBlockFile{ std::move(baseFileName),
NULL, aliasLen, floatSample, true, true },
//floatSample has no effect. last two bools - bypass writing of blockfile and cache
@ -54,7 +54,7 @@ ODDecodeBlockFile::ODDecodeBlockFile(wxFileNameWrapper &&baseFileName, wxFileNam
/// Create the memory structure to refer to the given block file
ODDecodeBlockFile::ODDecodeBlockFile(wxFileNameWrapper &&existingFile, wxFileNameWrapper &&audioFileName, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel, unsigned int decodeType,
size_t aliasLen, int aliasChannel, unsigned int decodeType,
float min, float max, float rms, bool dataAvailable):
SimpleBlockFile{ std::move(existingFile), aliasLen, min, max, rms },
@ -92,7 +92,7 @@ auto ODDecodeBlockFile::GetSpaceUsage() const -> DiskByteCount
/// Gets extreme values for the specified region
void ODDecodeBlockFile::GetMinMax(sampleCount start, sampleCount len,
void ODDecodeBlockFile::GetMinMax(size_t start, size_t len,
float *outMin, float *outMax, float *outRMS) const
{
if(IsSummaryAvailable())
@ -127,7 +127,7 @@ void ODDecodeBlockFile::GetMinMax(float *outMin, float *outMax, float *outRMS) c
}
/// Returns the 256 byte summary data block
bool ODDecodeBlockFile::Read256(float *buffer, sampleCount start, sampleCount len)
bool ODDecodeBlockFile::Read256(float *buffer, size_t start, size_t len)
{
if(IsSummaryAvailable())
{
@ -142,7 +142,7 @@ bool ODDecodeBlockFile::Read256(float *buffer, sampleCount start, sampleCount le
}
/// Returns the 64K summary data block
bool ODDecodeBlockFile::Read64K(float *buffer, sampleCount start, sampleCount len)
bool ODDecodeBlockFile::Read64K(float *buffer, size_t start, size_t len)
{
if(IsSummaryAvailable())
{
@ -228,7 +228,8 @@ BlockFilePtr ODDecodeBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr
{
wxFileNameWrapper summaryFileName;
wxFileNameWrapper audioFileName;
sampleCount aliasStart=0, aliasLen=0;
sampleCount aliasStart = 0;
size_t aliasLen = 0;
int aliasChannel=0;
long nValue;
long long nnValue;
@ -397,7 +398,7 @@ auto ODDecodeBlockFile::GetFileName() const -> GetFileNameResult
/// @param buffer A buffer containing the sample data to be analyzed
/// @param len The length of the sample data
/// @param format The format of the sample data.
void *ODDecodeBlockFile::CalcSummary(samplePtr buffer, sampleCount len,
void *ODDecodeBlockFile::CalcSummary(samplePtr buffer, size_t len,
sampleFormat format, ArrayOf<char> &cleanup)
{
cleanup.reinit(mSummaryInfo.totalSummaryBytes);
@ -442,19 +443,19 @@ void *ODDecodeBlockFile::CalcSummary(samplePtr buffer, sampleCount len,
/// @param format The format to convert the data into
/// @param start The offset within the block to begin reading
/// @param len The number of samples to read
int ODDecodeBlockFile::ReadData(samplePtr data, sampleFormat format,
sampleCount start, sampleCount len) const
size_t ODDecodeBlockFile::ReadData(samplePtr data, sampleFormat format,
size_t start, size_t len) const
{
int ret;
size_t ret;
LockRead();
if(IsSummaryAvailable())
ret= SimpleBlockFile::ReadData(data,format,start,len);
ret = SimpleBlockFile::ReadData(data,format,start,len);
else
{
//we should do an ODRequest to start processing the data here, and wait till it finishes. and just do a SimpleBlockFIle
//ReadData.
ClearSamples(data, format, 0, len);
ret= len;
ret = len;
}
UnlockRead();
return ret;

View File

@ -43,10 +43,10 @@ class ODDecodeBlockFile final : public SimpleBlockFile
/// Create a disk file and write summary and sample data to it
ODDecodeBlockFile(wxFileNameWrapper &&baseFileName, wxFileNameWrapper &&audioFileName, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel, unsigned int decodeType);
size_t aliasLen, int aliasChannel, unsigned int decodeType);
/// Create the memory structure to refer to the given block file
ODDecodeBlockFile(wxFileNameWrapper &&existingFile, wxFileNameWrapper &&audioFileName, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel, unsigned int decodeType,
size_t aliasLen, int aliasChannel, unsigned int decodeType,
float min, float max, float rms, bool dataAvailable);
virtual ~ODDecodeBlockFile();
@ -62,14 +62,14 @@ class ODDecodeBlockFile final : public SimpleBlockFile
//Calls that rely on summary files need to be overidden
DiskByteCount GetSpaceUsage() const override;
/// Gets extreme values for the specified region
void GetMinMax(sampleCount start, sampleCount len,
void GetMinMax(size_t start, size_t len,
float *outMin, float *outMax, float *outRMS) const override;
/// Gets extreme values for the entire block
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;
bool Read256(float *buffer, size_t start, size_t len) override;
/// Returns the 64K summary data block
bool Read64K(float *buffer, sampleCount start, sampleCount len) override;
bool Read64K(float *buffer, size_t start, size_t len) override;
/// returns true before decoding is complete, because it is linked to the encoded file until then.
/// returns false afterwards.
@ -108,8 +108,8 @@ class ODDecodeBlockFile final : public SimpleBlockFile
//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) const override;
size_t ReadData(samplePtr data, sampleFormat format,
size_t start, size_t len) const override;
/// Read the summary into a buffer
bool ReadSummary(void *data) override;
@ -155,7 +155,7 @@ class ODDecodeBlockFile final : public SimpleBlockFile
protected:
// void WriteSimpleBlockFile() override;
void *CalcSummary(samplePtr buffer, sampleCount len,
void *CalcSummary(samplePtr buffer, size_t len,
sampleFormat format, ArrayOf<char> &cleanup) override;
//The on demand type.
unsigned int mType;

View File

@ -48,7 +48,7 @@ ODPCMAliasBlockFile::ODPCMAliasBlockFile(
wxFileNameWrapper &&fileName,
wxFileNameWrapper &&aliasedFileName,
sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel)
size_t aliasLen, int aliasChannel)
: PCMAliasBlockFile { std::move(fileName), std::move(aliasedFileName),
aliasStart, aliasLen, aliasChannel, false }
{
@ -60,7 +60,7 @@ ODPCMAliasBlockFile::ODPCMAliasBlockFile(
wxFileNameWrapper &&existingSummaryFileName,
wxFileNameWrapper &&aliasedFileName,
sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel,
size_t aliasLen, int aliasChannel,
float min, float max, float rms, bool summaryAvailable)
: PCMAliasBlockFile(std::move(existingSummaryFileName), std::move(aliasedFileName),
aliasStart, aliasLen,
@ -121,7 +121,7 @@ void ODPCMAliasBlockFile::Unlock()
/// Gets extreme values for the specified region
void ODPCMAliasBlockFile::GetMinMax(sampleCount start, sampleCount len,
void ODPCMAliasBlockFile::GetMinMax(size_t start, size_t len,
float *outMin, float *outMax, float *outRMS) const
{
if(IsSummaryAvailable())
@ -156,7 +156,7 @@ void ODPCMAliasBlockFile::GetMinMax(float *outMin, float *outMax, float *outRMS)
}
/// Returns the 256 byte summary data block. Clients should check to see if the summary is available before trying to read it with this call.
bool ODPCMAliasBlockFile::Read256(float *buffer, sampleCount start, sampleCount len)
bool ODPCMAliasBlockFile::Read256(float *buffer, size_t start, size_t len)
{
if(IsSummaryAvailable())
{
@ -171,7 +171,7 @@ bool ODPCMAliasBlockFile::Read256(float *buffer, sampleCount start, sampleCount
}
/// Returns the 64K summary data block. Clients should check to see if the summary is available before trying to read it with this call.
bool ODPCMAliasBlockFile::Read64K(float *buffer, sampleCount start, sampleCount len)
bool ODPCMAliasBlockFile::Read64K(float *buffer, size_t start, size_t len)
{
if(IsSummaryAvailable())
{
@ -267,7 +267,8 @@ BlockFilePtr ODPCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **at
{
wxFileNameWrapper summaryFileName;
wxFileNameWrapper aliasFileName;
sampleCount aliasStart=0, aliasLen=0;
sampleCount aliasStart = 0;
size_t aliasLen = 0;
int aliasChannel=0;
long nValue;
long long nnValue;
@ -437,7 +438,7 @@ void ODPCMAliasBlockFile::WriteSummary()
/// @param buffer A buffer containing the sample data to be analyzed
/// @param len The length of the sample data
/// @param format The format of the sample data.
void *ODPCMAliasBlockFile::CalcSummary(samplePtr buffer, sampleCount len,
void *ODPCMAliasBlockFile::CalcSummary(samplePtr buffer, size_t len,
sampleFormat format, ArrayOf<char> &cleanup)
{
cleanup.reinit(mSummaryInfo.totalSummaryBytes);
@ -483,8 +484,8 @@ void *ODPCMAliasBlockFile::CalcSummary(samplePtr buffer, sampleCount len,
/// @param format The format to convert the data into
/// @param start The offset within the block to begin reading
/// @param len The number of samples to read
int ODPCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format,
sampleCount start, sampleCount len) const
size_t ODPCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format,
size_t start, size_t len) const
{
LockRead();
@ -537,7 +538,7 @@ int ODPCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format,
wxASSERT(info.channels >= 0);
SampleBuffer buffer(len * info.channels, floatSample);
int framesRead = 0;
size_t framesRead = 0;
if (format == int16Sample &&
!sf_subtype_more_than_16_bits(info.format)) {

View File

@ -49,10 +49,10 @@ class ODPCMAliasBlockFile final : public PCMAliasBlockFile
/// Constructs a PCMAliasBlockFile, writing the summary to disk
ODPCMAliasBlockFile(wxFileNameWrapper &&baseFileName,
wxFileNameWrapper &&aliasedFileName, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel);
size_t aliasLen, int aliasChannel);
ODPCMAliasBlockFile(wxFileNameWrapper &&existingSummaryFileName,
wxFileNameWrapper &&aliasedFileName, sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel,
size_t aliasLen, int aliasChannel,
float min, float max, float rms, bool summaryAvailable);
virtual ~ODPCMAliasBlockFile();
@ -65,14 +65,14 @@ class ODPCMAliasBlockFile final : public PCMAliasBlockFile
//Calls that rely on summary files need to be overidden
DiskByteCount GetSpaceUsage() const override;
/// Gets extreme values for the specified region
void GetMinMax(sampleCount start, sampleCount len,
void GetMinMax(size_t start, size_t len,
float *outMin, float *outMax, float *outRMS) const override;
/// Gets extreme values for the entire block
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;
bool Read256(float *buffer, size_t start, size_t len) override;
/// Returns the 64K summary data block
bool Read64K(float *buffer, sampleCount start, sampleCount len) override;
bool Read64K(float *buffer, size_t start, size_t len) override;
///Makes NEW ODPCMAliasBlockFile or PCMAliasBlockFile depending on summary availability
BlockFilePtr Copy(wxFileNameWrapper &&fileName) override;
@ -117,8 +117,8 @@ class ODPCMAliasBlockFile final : public PCMAliasBlockFile
//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) const override;
size_t ReadData(samplePtr data, sampleFormat format,
size_t start, size_t len) const override;
/// Read the summary into a buffer
bool ReadSummary(void *data) override;
@ -139,7 +139,7 @@ class ODPCMAliasBlockFile final : public PCMAliasBlockFile
protected:
void WriteSummary() override;
void *CalcSummary(samplePtr buffer, sampleCount len,
void *CalcSummary(samplePtr buffer, size_t len,
sampleFormat format, ArrayOf<char> &cleanup) override;
private:

View File

@ -31,7 +31,7 @@ PCMAliasBlockFile::PCMAliasBlockFile(
wxFileNameWrapper &&fileName,
wxFileNameWrapper &&aliasedFileName,
sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel)
size_t aliasLen, int aliasChannel)
: AliasBlockFile{ std::move(fileName), std::move(aliasedFileName),
aliasStart, aliasLen, aliasChannel }
{
@ -42,7 +42,7 @@ PCMAliasBlockFile::PCMAliasBlockFile(
wxFileNameWrapper&& fileName,
wxFileNameWrapper&& aliasedFileName,
sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel,bool writeSummary)
size_t aliasLen, int aliasChannel,bool writeSummary)
: AliasBlockFile{ std::move(fileName), std::move(aliasedFileName),
aliasStart, aliasLen, aliasChannel }
{
@ -54,7 +54,7 @@ PCMAliasBlockFile::PCMAliasBlockFile(
wxFileNameWrapper &&existingSummaryFileName,
wxFileNameWrapper &&aliasedFileName,
sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel,
size_t aliasLen, int aliasChannel,
float min, float max, float rms)
: AliasBlockFile{ std::move(existingSummaryFileName), std::move(aliasedFileName),
aliasStart, aliasLen,
@ -73,8 +73,8 @@ PCMAliasBlockFile::~PCMAliasBlockFile()
/// @param format The format to convert the data into
/// @param start The offset within the block to begin reading
/// @param len The number of samples to read
int PCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format,
sampleCount start, sampleCount len) const
size_t PCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format,
size_t start, size_t len) const
{
SF_INFO info;
@ -124,7 +124,7 @@ int PCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format,
wxASSERT(info.channels >= 0);
SampleBuffer buffer(len * info.channels, floatSample);
int framesRead = 0;
size_t framesRead = 0;
if (format == int16Sample &&
!sf_subtype_more_than_16_bits(info.format)) {

View File

@ -22,23 +22,23 @@ class PCMAliasBlockFile /* not final */ : public AliasBlockFile
PCMAliasBlockFile(wxFileNameWrapper &&baseFileName,
wxFileNameWrapper &&aliasedFileName,
sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel);
size_t aliasLen, int aliasChannel);
///Constructs a PCMAliasBlockFile with the option of not writing to disk
PCMAliasBlockFile(wxFileNameWrapper &&fileName,
wxFileNameWrapper &&aliasedFileName,
sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel,bool writeSummary);
size_t aliasLen, int aliasChannel,bool writeSummary);
PCMAliasBlockFile(wxFileNameWrapper &&existingSummaryFileName,
wxFileNameWrapper &&aliasedFileName,
sampleCount aliasStart,
sampleCount aliasLen, int aliasChannel,
size_t aliasLen, int aliasChannel,
float min, float max, float rms);
virtual ~PCMAliasBlockFile();
/// Reads the specified data from the aliased file using libsndfile
int ReadData(samplePtr data, sampleFormat format,
sampleCount start, sampleCount len) const override;
size_t ReadData(samplePtr data, sampleFormat format,
size_t start, size_t len) const override;
void SaveXML(XMLWriter &xmlFile) override;
BlockFilePtr Copy(wxFileNameWrapper &&fileName) override;

View File

@ -12,7 +12,7 @@
#include "SilentBlockFile.h"
#include "../FileFormats.h"
SilentBlockFile::SilentBlockFile(sampleCount sampleLen):
SilentBlockFile::SilentBlockFile(size_t sampleLen):
BlockFile{ wxFileNameWrapper{}, sampleLen }
{
mMin = 0.;
@ -30,8 +30,8 @@ bool SilentBlockFile::ReadSummary(void *data)
return true;
}
int SilentBlockFile::ReadData(samplePtr data, sampleFormat format,
sampleCount WXUNUSED(start), sampleCount len) const
size_t SilentBlockFile::ReadData(samplePtr data, sampleFormat format,
size_t WXUNUSED(start), size_t len) const
{
ClearSamples(data, format, 0, len);
@ -54,7 +54,7 @@ void SilentBlockFile::SaveXML(XMLWriter &xmlFile)
BlockFilePtr SilentBlockFile::BuildFromXML(DirManager & WXUNUSED(dm), const wxChar **attrs)
{
long nValue;
sampleCount len = 0;
size_t len = 0;
while(*attrs)
{

View File

@ -26,7 +26,7 @@ class SilentBlockFile final : public BlockFile {
// Constructor / Destructor
SilentBlockFile(sampleCount sampleLen);
SilentBlockFile(size_t sampleLen);
virtual ~SilentBlockFile();
@ -35,8 +35,8 @@ class SilentBlockFile final : public BlockFile {
/// Read the summary section of the disk file
bool ReadSummary(void *data) override;
/// Read the data section of the disk file
int ReadData(samplePtr data, sampleFormat format,
sampleCount start, sampleCount len) const override;
size_t ReadData(samplePtr data, sampleFormat format,
size_t start, size_t len) const override;
/// Create a NEW block file identical to this one
BlockFilePtr Copy(wxFileNameWrapper &&newFileName) override;

View File

@ -96,7 +96,7 @@ static wxUint32 SwapUintEndianess(wxUint32 in)
/// @param format The format of the given samples.
/// @param allowDeferredWrite Allow deferred write-caching
SimpleBlockFile::SimpleBlockFile(wxFileNameWrapper &&baseFileName,
samplePtr sampleData, sampleCount sampleLen,
samplePtr sampleData, size_t sampleLen,
sampleFormat format,
bool allowDeferredWrite /* = false */,
bool bypassCache /* = false */):
@ -139,7 +139,7 @@ SimpleBlockFile::SimpleBlockFile(wxFileNameWrapper &&baseFileName,
/// existing block file. This file must exist and be a valid block file.
///
/// @param existingFile The disk file this SimpleBlockFile should use.
SimpleBlockFile::SimpleBlockFile(wxFileNameWrapper &&existingFile, sampleCount len,
SimpleBlockFile::SimpleBlockFile(wxFileNameWrapper &&existingFile, size_t len,
float min, float max, float rms):
BlockFile{ std::move(existingFile), len }
{
@ -164,7 +164,7 @@ SimpleBlockFile::~SimpleBlockFile()
bool SimpleBlockFile::WriteSimpleBlockFile(
samplePtr sampleData,
sampleCount sampleLen,
size_t sampleLen,
sampleFormat format,
void* summaryData)
{
@ -388,8 +388,8 @@ bool SimpleBlockFile::ReadSummary(void *data)
/// @param format The format the data will be stored in
/// @param start The offset in this block file
/// @param len The number of samples to read
int SimpleBlockFile::ReadData(samplePtr data, sampleFormat format,
sampleCount start, sampleCount len) const
size_t SimpleBlockFile::ReadData(samplePtr data, sampleFormat format,
size_t start, size_t len) const
{
if (mCache.active)
{
@ -439,7 +439,7 @@ int SimpleBlockFile::ReadData(samplePtr data, sampleFormat format,
SFCall<sf_count_t>(sf_seek, sf.get(), start, SEEK_SET);
SampleBuffer buffer(len, floatSample);
int framesRead = 0;
size_t framesRead = 0;
// If both the src and dest formats are integer formats,
// read integers from the file (otherwise we would be
@ -495,7 +495,7 @@ BlockFilePtr SimpleBlockFile::BuildFromXML(DirManager &dm, const wxChar **attrs)
{
wxFileNameWrapper fileName;
float min = 0.0f, max = 0.0f, rms = 0.0f;
sampleCount len = 0;
size_t len = 0;
double dblValue;
long nValue;
@ -597,11 +597,11 @@ auto SimpleBlockFile::GetSpaceUsage() const -> DiskByteCount
file.Close();
}
return
return {
sizeof(auHeader) +
mSummaryInfo.totalSummaryBytes +
(GetLength() * SAMPLE_SIZE_DISK(mFormat))
;
};
}
void SimpleBlockFile::Recover(){

View File

@ -49,12 +49,12 @@ class PROFILE_DLL_API SimpleBlockFile /* not final */ : public BlockFile {
/// Create a disk file and write summary and sample data to it
SimpleBlockFile(wxFileNameWrapper &&baseFileName,
samplePtr sampleData, sampleCount sampleLen,
samplePtr sampleData, size_t sampleLen,
sampleFormat format,
bool allowDeferredWrite = false,
bool bypassCache = false );
/// Create the memory structure to refer to the given block file
SimpleBlockFile(wxFileNameWrapper &&existingFile, sampleCount len,
SimpleBlockFile(wxFileNameWrapper &&existingFile, size_t len,
float min, float max, float rms);
virtual ~SimpleBlockFile();
@ -64,8 +64,8 @@ class PROFILE_DLL_API SimpleBlockFile /* not final */ : public BlockFile {
/// Read the summary section of the disk file
bool ReadSummary(void *data) override;
/// Read the data section of the disk file
int ReadData(samplePtr data, sampleFormat format,
sampleCount start, sampleCount len) const override;
size_t ReadData(samplePtr data, sampleFormat format,
size_t start, size_t len) const override;
/// Create a NEW block file identical to this one
BlockFilePtr Copy(wxFileNameWrapper &&newFileName) override;
@ -85,7 +85,7 @@ class PROFILE_DLL_API SimpleBlockFile /* not final */ : public BlockFile {
protected:
bool WriteSimpleBlockFile(samplePtr sampleData, sampleCount sampleLen,
bool WriteSimpleBlockFile(samplePtr sampleData, size_t sampleLen,
sampleFormat format, void* summaryData);
static bool GetCache();
void ReadIntoCache();

View File

@ -109,7 +109,7 @@ unsigned EffectAmplify::GetAudioOutCount()
return 1;
}
sampleCount EffectAmplify::ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen)
size_t EffectAmplify::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
{
for (decltype(blockLen) i = 0; i < blockLen; i++)
{

View File

@ -46,7 +46,7 @@ public:
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;
bool LoadFactoryDefaults() override;

View File

@ -128,7 +128,7 @@ bool EffectBassTreble::ProcessInitialize(sampleCount WXUNUSED(totalLen), Channel
return true;
}
sampleCount EffectBassTreble::ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen)
size_t EffectBassTreble::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
{
return InstanceProcess(mMaster, inBlock, outBlock, blockLen);
}
@ -160,10 +160,10 @@ bool EffectBassTreble::RealtimeFinalize()
return true;
}
sampleCount EffectBassTreble::RealtimeProcess(int group,
size_t EffectBassTreble::RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples)
size_t numSamples)
{
return InstanceProcess(mSlaves[group], inbuf, outbuf, numSamples);
}
@ -335,10 +335,10 @@ void EffectBassTreble::InstanceInit(EffectBassTrebleState & data, float sampleRa
// EffectClientInterface implementation
sampleCount EffectBassTreble::InstanceProcess(EffectBassTrebleState & data,
size_t EffectBassTreble::InstanceProcess(EffectBassTrebleState & data,
float **inBlock,
float **outBlock,
sampleCount blockLen)
size_t blockLen)
{
float *ibuf = inBlock[0];
float *obuf = outBlock[0];

View File

@ -62,14 +62,14 @@ public:
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
bool RealtimeFinalize() override;
sampleCount RealtimeProcess(int group,
size_t RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples) override;
size_t numSamples) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;
@ -86,7 +86,7 @@ private:
// EffectBassTreble implementation
void InstanceInit(EffectBassTrebleState & data, float sampleRate);
sampleCount InstanceProcess(EffectBassTrebleState & data, float **inBlock, float **outBlock, sampleCount blockLen);
size_t InstanceProcess(EffectBassTrebleState & data, float **inBlock, float **outBlock, size_t blockLen);
void Coefficents(double hz, double slope, double gain, double samplerate, int type,
double& a0, double& a1, double& a2, double& b0, double& b1, double& b2);

View File

@ -488,8 +488,7 @@ bool EffectChangeSpeed::ProcessOne(WaveTrack * track,
float * inBuffer = new float[inBufferSize];
// mFactor is at most 100-fold so this shouldn't overflow size_t
auto outBufferSize =
(sampleCount)((mFactor * inBufferSize) + 10);
auto outBufferSize = size_t( mFactor * inBufferSize + 10 );
float * outBuffer = new float[outBufferSize];
// Set up the resampling stuff for this track.

View File

@ -255,7 +255,7 @@ bool EffectClickRemoval::ProcessOne(int count, WaveTrack * track, sampleCount st
return bResult;
}
bool EffectClickRemoval::RemoveClicks(sampleCount len, float *buffer)
bool EffectClickRemoval::RemoveClicks(int len, float *buffer)
{
bool bResult = false; // This effect usually does nothing.
int i;

View File

@ -61,7 +61,7 @@ private:
bool ProcessOne(int count, WaveTrack * track,
sampleCount start, sampleCount len);
bool RemoveClicks(sampleCount len, float *buffer);
bool RemoveClicks(int len, float *buffer);
void OnWidthText(wxCommandEvent & evt);
void OnThreshText(wxCommandEvent & evt);

View File

@ -370,7 +370,7 @@ bool EffectCompressor::InitPass1()
SelectedTrackListOfKindIterator iter(Track::Wave, mTracks);
WaveTrack *track = (WaveTrack *) iter.First();
while (track) {
maxlen = std::max<size_t>(maxlen, track->GetMaxBlockSize());
maxlen = std::max(maxlen, track->GetMaxBlockSize());
//Iterate to the next track
track = (WaveTrack *) iter.Next();
}
@ -402,7 +402,8 @@ bool EffectCompressor::InitPass2()
// Process the input with 2 buffers available at a time
// buffer1 will be written upon return
// buffer2 will be passed as buffer1 on the next call
bool EffectCompressor::TwoBufferProcessPass1(float *buffer1, sampleCount len1, float *buffer2, sampleCount len2)
bool EffectCompressor::TwoBufferProcessPass1
(float *buffer1, size_t len1, float *buffer2, size_t len2)
{
int i;
@ -448,7 +449,7 @@ bool EffectCompressor::TwoBufferProcessPass1(float *buffer1, sampleCount len1, f
return true;
}
bool EffectCompressor::ProcessPass2(float *buffer, sampleCount len)
bool EffectCompressor::ProcessPass2(float *buffer, size_t len)
{
if (mMax != 0)
{
@ -483,7 +484,7 @@ float EffectCompressor::AvgCircle(float value)
return level;
}
void EffectCompressor::Follow(float *buffer, float *env, int len, float *previous, int previous_len)
void EffectCompressor::Follow(float *buffer, float *env, size_t len, float *previous, size_t previous_len)
{
/*
@ -553,7 +554,7 @@ void EffectCompressor::Follow(float *buffer, float *env, int len, float *previou
// Next do the same process in reverse direction to get the requested attack rate
last = mLastLevel;
for(i=len-1; i>=0; i--) {
for(i = len; i--;) {
last *= mAttackInverseFactor;
if(last < mThreshold)
last = mThreshold;
@ -565,7 +566,7 @@ void EffectCompressor::Follow(float *buffer, float *env, int len, float *previou
if((previous != NULL) && (previous_len > 0)) {
// If the previous envelope was passed, propagate the rise back until we intersect
for(i=previous_len-1; i>0; i--) {
for(i = previous_len; i--;) {
last *= mAttackInverseFactor;
if(last < mThreshold)
last = mThreshold;

View File

@ -62,15 +62,16 @@ protected:
bool InitPass1() override;
bool InitPass2() override;
bool NewTrackPass1() override;
bool ProcessPass2(float *buffer, sampleCount len) override;
bool TwoBufferProcessPass1(float *buffer1, sampleCount len1, float *buffer2, sampleCount len2) override;
bool ProcessPass2(float *buffer, size_t len) override;
bool TwoBufferProcessPass1
(float *buffer1, size_t len1, float *buffer2, size_t len2) override;
private:
// EffectCompressor implementation
void FreshenCircle();
float AvgCircle(float x);
void Follow(float *buffer, float *env, int len, float *previous, int previous_len);
void Follow(float *buffer, float *env, size_t len, float *previous, size_t previous_len);
float DoCompression(float x, double env);
void OnSlider(wxCommandEvent & evt);
@ -101,7 +102,7 @@ private:
double mLastLevel;
float *mFollow1;
float *mFollow2;
sampleCount mFollowLen;
size_t mFollowLen;
double mMax; //MJS

View File

@ -224,7 +224,7 @@ bool EffectDistortion::ProcessInitialize(sampleCount WXUNUSED(totalLen), Channel
return true;
}
sampleCount EffectDistortion::ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen)
size_t EffectDistortion::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
{
return InstanceProcess(mMaster, inBlock, outBlock, blockLen);
}
@ -256,10 +256,10 @@ bool EffectDistortion::RealtimeFinalize()
return true;
}
sampleCount EffectDistortion::RealtimeProcess(int group,
size_t EffectDistortion::RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples)
size_t numSamples)
{
return InstanceProcess(mSlaves[group], inbuf, outbuf, numSamples);
@ -503,7 +503,7 @@ void EffectDistortion::InstanceInit(EffectDistortionState & data, float sampleRa
return;
}
sampleCount EffectDistortion::InstanceProcess(EffectDistortionState& data, float** inBlock, float** outBlock, sampleCount blockLen)
size_t EffectDistortion::InstanceProcess(EffectDistortionState& data, float** inBlock, float** outBlock, size_t blockLen)
{
float *ibuf = inBlock[0];
float *obuf = outBlock[0];

View File

@ -79,14 +79,14 @@ public:
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
bool RealtimeFinalize() override;
sampleCount RealtimeProcess(int group,
size_t RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples) override;
size_t numSamples) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;
wxArrayString GetFactoryPresets() override;
@ -113,10 +113,10 @@ private:
// EffectDistortion implementation
void InstanceInit(EffectDistortionState & data, float sampleRate);
sampleCount InstanceProcess(EffectDistortionState & data,
size_t InstanceProcess(EffectDistortionState & data,
float **inBlock,
float **outBlock,
sampleCount blockLen);
size_t blockLen);
// Control Handlers

View File

@ -150,7 +150,7 @@ bool EffectDtmf::ProcessInitialize(sampleCount WXUNUSED(totalLen), ChannelNames
return true;
}
sampleCount EffectDtmf::ProcessBlock(float **WXUNUSED(inbuf), float **outbuf, sampleCount size)
size_t EffectDtmf::ProcessBlock(float **WXUNUSED(inbuf), float **outbuf, size_t size)
{
float *buffer = outbuf[0];
decltype(size) processed = 0;
@ -429,7 +429,7 @@ void EffectDtmf::Recalculate()
}
}
bool EffectDtmf::MakeDtmfTone(float *buffer, sampleCount len, float fs, wxChar tone, sampleCount last, sampleCount total, float amplitude)
bool EffectDtmf::MakeDtmfTone(float *buffer, size_t len, float fs, wxChar tone, sampleCount last, sampleCount total, float amplitude)
{
/*
--------------------------------------------
@ -546,7 +546,7 @@ bool EffectDtmf::MakeDtmfTone(float *buffer, sampleCount len, float fs, wxChar t
// we are at the last buffer of 'len' size, so, offset is to
// backup 'A' samples, from 'len'
A = (fs / kFadeInOut);
auto offset = len - decltype(len)(fs / kFadeInOut);
auto offset = long(len) - long(fs / kFadeInOut);
// protect against negative offset, which can occur if too a
// small selection is made
if (offset >= 0) {

View File

@ -46,7 +46,7 @@ public:
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;
@ -61,7 +61,7 @@ public:
private:
// EffectDtmf implementation
bool MakeDtmfTone(float *buffer, sampleCount len, float fs,
bool MakeDtmfTone(float *buffer, size_t len, float fs,
wxChar tone, sampleCount last,
sampleCount total, float amplitude);
void Recalculate();

View File

@ -114,7 +114,7 @@ bool EffectEcho::ProcessFinalize()
return true;
}
sampleCount EffectEcho::ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen)
size_t EffectEcho::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
{
float *ibuf = inBlock[0];
float *obuf = outBlock[0];

View File

@ -43,7 +43,7 @@ public:
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
bool ProcessFinalize() override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;
@ -59,8 +59,8 @@ private:
double delay;
double decay;
float *history;
sampleCount histPos;
sampleCount histLen;
size_t histPos;
size_t histLen;
};
#endif // __AUDACITY_EFFECT_ECHO__

View File

@ -335,7 +335,7 @@ void Effect::SetSampleRate(double rate)
mSampleRate = rate;
}
sampleCount Effect::SetBlockSize(sampleCount maxBlockSize)
size_t Effect::SetBlockSize(size_t maxBlockSize)
{
if (mClient)
{
@ -357,7 +357,7 @@ sampleCount Effect::GetLatency()
return 0;
}
sampleCount Effect::GetTailSize()
size_t Effect::GetTailSize()
{
if (mClient)
{
@ -397,7 +397,7 @@ bool Effect::ProcessFinalize()
return true;
}
sampleCount Effect::ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen)
size_t Effect::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
{
if (mClient)
{
@ -494,10 +494,10 @@ bool Effect::RealtimeProcessStart()
return true;
}
sampleCount Effect::RealtimeProcess(int group,
size_t Effect::RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples)
size_t numSamples)
{
if (mClient)
{
@ -2355,11 +2355,11 @@ bool Effect::RealtimeAddProcessor(int group, unsigned chans, float rate)
// RealtimeAddProcessor and RealtimeProcess use the same method of
// determining the current processor group, so updates to one should
// be reflected in the other.
sampleCount Effect::RealtimeProcess(int group,
size_t Effect::RealtimeProcess(int group,
unsigned chans,
float **inbuf,
float **outbuf,
sampleCount numSamples)
size_t numSamples)
{
//
// The caller passes the number of channels to process and specifies

View File

@ -104,15 +104,15 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
int GetMidiOutCount() override;
sampleCount GetLatency() override;
sampleCount GetTailSize() override;
size_t GetTailSize() override;
void SetSampleRate(double rate) override;
sampleCount SetBlockSize(sampleCount maxBlockSize) override;
size_t SetBlockSize(size_t maxBlockSize) override;
bool IsReady() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
bool ProcessFinalize() override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
@ -120,10 +120,10 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
bool RealtimeSuspend() override;
bool RealtimeResume() override;
bool RealtimeProcessStart() override;
sampleCount RealtimeProcess(int group,
size_t RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples) override;
size_t numSamples) override;
bool RealtimeProcessEnd() override;
bool ShowInterface(wxWindow *parent, bool forceModal = false) override;
@ -243,11 +243,11 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
// Realtime Effect Processing
/* not virtual */ bool RealtimeAddProcessor(int group, unsigned chans, float rate);
/* not virtual */ sampleCount RealtimeProcess(int group,
/* not virtual */ size_t RealtimeProcess(int group,
unsigned chans,
float **inbuf,
float **outbuf,
sampleCount numSamples);
size_t numSamples);
/* not virtual */ bool IsRealtimeActive();
virtual bool IsHidden();
@ -510,8 +510,8 @@ private:
float **mInBufPos;
float **mOutBufPos;
sampleCount mBufferSize;
sampleCount mBlockSize;
size_t mBufferSize;
size_t mBlockSize;
unsigned mNumChannels;
wxArrayInt mGroupProcessor;

View File

@ -587,7 +587,7 @@ void EffectManager::RealtimeProcessStart()
//
// This will be called in a different thread than the main GUI thread.
//
sampleCount EffectManager::RealtimeProcess(int group, unsigned chans, float **buffers, sampleCount numSamples)
size_t EffectManager::RealtimeProcess(int group, unsigned chans, float **buffers, size_t numSamples)
{
// Protect ourselves from the main thread
mRealtimeLock.Enter();

View File

@ -108,7 +108,7 @@ public:
void RealtimeSuspend();
void RealtimeResume();
void RealtimeProcessStart();
sampleCount RealtimeProcess(int group, unsigned chans, float **buffers, sampleCount numSamples);
size_t RealtimeProcess(int group, unsigned chans, float **buffers, size_t numSamples);
void RealtimeProcessEnd();
int GetRealtimeLatency();

View File

@ -45,8 +45,8 @@ public:
float* mBufferSouce[__MAXBUFFERCOUNT];
float* mBufferDest[__MAXBUFFERCOUNT];
int mBufferLength;
sampleCount mFftWindowSize;
sampleCount mFftFilterSize;
size_t mFftWindowSize;
size_t mFftFilterSize;
float* mScratchBuffer;
int mContiguousBufferSize;
EQBufferStatus mBufferStatus;

View File

@ -75,7 +75,7 @@ bool EffectFade::ProcessInitialize(sampleCount WXUNUSED(totalLen), ChannelNames
return true;
}
sampleCount EffectFade::ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen)
size_t EffectFade::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
{
float *ibuf = inBlock[0];
float *obuf = outBlock[0];

View File

@ -39,7 +39,7 @@ public:
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
private:
// EffectFadeIn implementation

View File

@ -153,7 +153,7 @@ bool EffectFindClipping::ProcessOne(LabelTrack * lt,
sampleCount len)
{
bool bGoodResult = true;
auto blockSize = (sampleCount) (mStart * 1000);
size_t blockSize = (mStart * 1000);
if (len < mStart) {
return true;

View File

@ -66,7 +66,7 @@ protected:
// Postcondition: data[0..block) filled with generated samples
virtual void GenerateBlock(float *data,
const WaveTrack &track,
sampleCount block) = 0;
size_t block) = 0;
// Generate the track, one block at a time, & adding the results to tmp
bool GenerateTrack(WaveTrack *tmp, const WaveTrack &track, int ntrack) override;

View File

@ -64,7 +64,7 @@ unsigned EffectInvert::GetAudioOutCount()
return 1;
}
sampleCount EffectInvert::ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen)
size_t EffectInvert::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
{
float *ibuf = inBlock[0];
float *obuf = outBlock[0];

View File

@ -39,7 +39,7 @@ public:
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
};
#endif

View File

@ -102,7 +102,7 @@ unsigned EffectLeveller::GetAudioOutCount()
return 1;
}
sampleCount EffectLeveller::ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen)
size_t EffectLeveller::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
{
float *ibuf = inBlock[0];
float *obuf = outBlock[0];

View File

@ -39,7 +39,7 @@ public:
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;

View File

@ -92,7 +92,7 @@ unsigned EffectNoise::GetAudioOutCount()
return 1;
}
sampleCount EffectNoise::ProcessBlock(float **WXUNUSED(inbuf), float **outbuf, sampleCount size)
size_t EffectNoise::ProcessBlock(float **WXUNUSED(inbuf), float **outbuf, size_t size)
{
float *buffer = outbuf[0];

View File

@ -41,7 +41,7 @@ public:
// EffectClientInterface implementation
unsigned GetAudioOutCount() override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;

View File

@ -270,7 +270,7 @@ private:
void StartNewTrack();
void ProcessSamples(Statistics &statistics,
WaveTrack *outputTrack, sampleCount len, float *buffer);
WaveTrack *outputTrack, size_t len, float *buffer);
void FillFirstHistoryWindow();
void ApplyFreqSmoothing(FloatVector &gains);
void GatherStatistics(Statistics &statistics);
@ -911,10 +911,10 @@ void EffectNoiseReduction::Worker::StartNewTrack()
void EffectNoiseReduction::Worker::ProcessSamples
(Statistics &statistics, WaveTrack *outputTrack,
sampleCount len, float *buffer)
size_t len, float *buffer)
{
while (len && mOutStepCount * mStepSize < mInSampleCount) {
auto avail = std::min(len, sampleCount(mWindowSize - mInWavePos));
auto avail = std::min(len, mWindowSize - mInWavePos);
memmove(&mInWaveBuffer[mInWavePos], buffer, avail * sizeof(float));
buffer += avail;
len -= avail;

View File

@ -366,7 +366,7 @@ void EffectNoiseRemoval::StartNewTrack()
mOutSampleCount = -(int)((mWindowSize / 2) * (mHistoryLen - 1));
}
void EffectNoiseRemoval::ProcessSamples(sampleCount len, float *buffer)
void EffectNoiseRemoval::ProcessSamples(size_t len, float *buffer)
{
int i;

View File

@ -90,7 +90,7 @@ private:
void Initialize();
void StartNewTrack();
void ProcessSamples(sampleCount len, float *buffer);
void ProcessSamples(size_t len, float *buffer);
void FillFirstHistoryWindow();
void ApplyFreqSmoothing(float *spec);
void GetProfile();

View File

@ -480,14 +480,14 @@ bool EffectNormalize::ProcessOne(WaveTrack * track, const wxString &msg)
return rc;
}
void EffectNormalize::AnalyzeData(float *buffer, sampleCount len)
void EffectNormalize::AnalyzeData(float *buffer, size_t len)
{
for(decltype(len) i = 0; i < len; i++)
mSum += (double)buffer[i];
mCount += len;
}
void EffectNormalize::ProcessData(float *buffer, sampleCount len)
void EffectNormalize::ProcessData(float *buffer, size_t len)
{
for(decltype(len) i = 0; i < len; i++) {
float adjFrame = (buffer[i] + mOffset) * mMult;

View File

@ -58,9 +58,9 @@ private:
bool ProcessOne(WaveTrack * t, const wxString &msg);
void AnalyseTrack(WaveTrack * track, const wxString &msg);
void AnalyzeData(float *buffer, sampleCount len);
void AnalyzeData(float *buffer, size_t len);
bool AnalyseDC(WaveTrack * track, const wxString &msg);
void ProcessData(float *buffer, sampleCount len);
void ProcessData(float *buffer, size_t len);
void OnUpdateUI(wxCommandEvent & evt);
void UpdateUI();

View File

@ -151,7 +151,7 @@ bool EffectPhaser::ProcessInitialize(sampleCount WXUNUSED(totalLen), ChannelName
return true;
}
sampleCount EffectPhaser::ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen)
size_t EffectPhaser::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
{
return InstanceProcess(mMaster, inBlock, outBlock, blockLen);
}
@ -183,10 +183,10 @@ bool EffectPhaser::RealtimeFinalize()
return true;
}
sampleCount EffectPhaser::RealtimeProcess(int group,
size_t EffectPhaser::RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples)
size_t numSamples)
{
return InstanceProcess(mSlaves[group], inbuf, outbuf, numSamples);
@ -372,7 +372,7 @@ void EffectPhaser::InstanceInit(EffectPhaserState & data, float sampleRate)
return;
}
sampleCount EffectPhaser::InstanceProcess(EffectPhaserState & data, float **inBlock, float **outBlock, sampleCount blockLen)
size_t EffectPhaser::InstanceProcess(EffectPhaserState & data, float **inBlock, float **outBlock, size_t blockLen)
{
float *ibuf = inBlock[0];
float *obuf = outBlock[0];

View File

@ -67,14 +67,14 @@ public:
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
bool RealtimeFinalize() override;
sampleCount RealtimeProcess(int group,
size_t RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples) override;
size_t numSamples) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;
@ -88,7 +88,7 @@ private:
// EffectPhaser implementation
void InstanceInit(EffectPhaserState & data, float sampleRate);
sampleCount InstanceProcess(EffectPhaserState & data, float **inBlock, float **outBlock, sampleCount blockLen);
size_t InstanceProcess(EffectPhaserState & data, float **inBlock, float **outBlock, size_t blockLen);
void OnStagesSlider(wxCommandEvent & evt);
void OnDryWetSlider(wxCommandEvent & evt);

View File

@ -135,8 +135,8 @@ bool EffectRepair::Process()
bool EffectRepair::ProcessOne(int count, WaveTrack * track,
sampleCount start,
sampleCount len,
sampleCount repairStart, sampleCount repairLen)
size_t len,
size_t repairStart, size_t repairLen)
{
float *buffer = new float[len];
track->Get((samplePtr) buffer, floatSample, start, len);

View File

@ -44,8 +44,9 @@ private:
bool ProcessOne(int count, WaveTrack * track,
sampleCount start,
sampleCount len,
sampleCount repairStart, sampleCount repairLen);
size_t len,
size_t repairStart, // offset relative to start
size_t repairLen);
};
#endif // __AUDACITY_EFFECT_REPAIT__

View File

@ -159,7 +159,7 @@ unsigned EffectReverb::GetAudioOutCount()
return mParams.mStereoWidth ? 2 : 1;
}
#define BLOCK 16384
static size_t BLOCK = 16384;
bool EffectReverb::ProcessInitialize(sampleCount WXUNUSED(totalLen), ChannelNames chanMap)
{
@ -204,7 +204,7 @@ bool EffectReverb::ProcessFinalize()
return true;
}
sampleCount EffectReverb::ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen)
size_t EffectReverb::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
{
float *ichans[2] = {NULL, NULL};
float *ochans[2] = {NULL, NULL};

View File

@ -61,7 +61,7 @@ public:
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
bool ProcessFinalize() override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;
wxArrayString GetFactoryPresets() override;

View File

@ -54,8 +54,8 @@ public:
audio *buf;
double ratio;
sampleCount processed;
sampleCount blockSize;
sampleCount SBSMSBlockSize;
size_t blockSize;
long SBSMSBlockSize;
sampleCount offset;
sampleCount end;
float *leftBuffer;

View File

@ -228,7 +228,7 @@ bool EffectScienFilter::ProcessInitialize(sampleCount WXUNUSED(totalLen), Channe
return true;
}
sampleCount EffectScienFilter::ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen)
size_t EffectScienFilter::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
{
float *ibuf = inBlock[0];
for (int iPair = 0; iPair < (mOrder + 1) / 2; iPair++)

View File

@ -55,7 +55,7 @@ public:
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;

View File

@ -34,7 +34,7 @@ protected:
virtual bool NewTrackSimpleMono() = 0;
// Override this method to actually process audio
virtual bool ProcessSimpleMono(float *buffer, sampleCount len) = 0;
virtual bool ProcessSimpleMono(float *buffer, size_t len) = 0;
protected:
// Other useful information

View File

@ -155,7 +155,7 @@ bool EffectToneGen::ProcessInitialize(sampleCount WXUNUSED(totalLen), ChannelNam
return true;
}
sampleCount EffectToneGen::ProcessBlock(float **WXUNUSED(inBlock), float **outBlock, sampleCount blockLen)
size_t EffectToneGen::ProcessBlock(float **WXUNUSED(inBlock), float **outBlock, size_t blockLen)
{
float *buffer = outBlock[0];
double throwaway = 0; //passed to modf but never used

View File

@ -44,7 +44,7 @@ public:
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;

View File

@ -65,7 +65,7 @@ Param( Truncate, double, XO("Truncate"), 0.5, 0.0, 10000.0,
Param( Compress, double, XO("Compress"), 50.0, 0.0, 99.9, 1 );
Param( Independent, bool, XO("Independent"), false, false, true, 1 );
static const sampleCount DEF_BlendFrameCount = 100;
static const size_t DEF_BlendFrameCount = 100;
// Lower bound on the amount of silence to find at a time -- this avoids
// detecting silence repeatedly in low-frequency sounds.

View File

@ -104,7 +104,7 @@ private:
wxArrayString mDbChoices;
sampleCount mBlendFrameCount;
size_t mBlendFrameCount;
wxChoice *mTruncDbChoice;
wxChoice *mActionChoice;

View File

@ -41,16 +41,23 @@ protected:
virtual bool NewTrackPass2();
// Override this method to actually process audio
virtual bool ProcessPass1(float * WXUNUSED(buffer), sampleCount WXUNUSED(len)) { return false; }
virtual bool ProcessPass2(float * WXUNUSED(buffer), sampleCount WXUNUSED(len)) { return false; }
virtual bool ProcessPass1
(float * WXUNUSED(buffer), size_t WXUNUSED(len))
{ return false; }
virtual bool ProcessPass2
(float * WXUNUSED(buffer), size_t WXUNUSED(len))
{ return false; }
// Override this method to actually process audio with access to 2 sequential buffers at a time
// Either buffer1 or buffer2 may be modified as needed
// This allows implementation of processing with delays
// The default just calls the one-buffer-at-a-time method
virtual bool TwoBufferProcessPass1(float *buffer1, sampleCount len1, float * WXUNUSED(buffer2), sampleCount WXUNUSED(len2))
virtual bool TwoBufferProcessPass1
(float *buffer1, size_t len1, float * WXUNUSED(buffer2), size_t WXUNUSED(len2))
{ if(buffer1 != NULL) return ProcessPass1(buffer1, len1); else return true; }
virtual bool TwoBufferProcessPass2(float *buffer1, sampleCount len1, float * WXUNUSED(buffer2), sampleCount WXUNUSED(len2))
virtual bool TwoBufferProcessPass2
(float *buffer1, size_t len1, float * WXUNUSED(buffer2), size_t WXUNUSED(len2))
{ if(buffer1 != NULL) return ProcessPass2(buffer1, len1); else return true; }
// End of NEW virtuals

View File

@ -1326,7 +1326,7 @@ int VSTEffect::GetMidiOutCount()
return mMidiOuts;
}
sampleCount VSTEffect::SetBlockSize(sampleCount maxBlockSize)
size_t VSTEffect::SetBlockSize(size_t maxBlockSize)
{
mBlockSize = std::min((int)maxBlockSize, mUserBlockSize);
return mBlockSize;
@ -1350,7 +1350,7 @@ sampleCount VSTEffect::GetLatency()
return 0;
}
sampleCount VSTEffect::GetTailSize()
size_t VSTEffect::GetTailSize()
{
return 0;
}
@ -1395,7 +1395,7 @@ bool VSTEffect::ProcessFinalize()
return true;
}
sampleCount VSTEffect::ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen)
size_t VSTEffect::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
{
// Only call the effect if there's something to do...some do not like zero-length block
if (blockLen)
@ -1534,7 +1534,7 @@ bool VSTEffect::RealtimeProcessStart()
return true;
}
sampleCount VSTEffect::RealtimeProcess(int group, float **inbuf, float **outbuf, sampleCount numSamples)
size_t VSTEffect::RealtimeProcess(int group, float **inbuf, float **outbuf, size_t numSamples)
{
wxASSERT(numSamples <= mBlockSize);

View File

@ -106,15 +106,15 @@ class VSTEffect final : public wxEvtHandler,
int GetMidiOutCount() override;
sampleCount GetLatency() override;
sampleCount GetTailSize() override;
size_t GetTailSize() override;
void SetSampleRate(double rate) override;
sampleCount SetBlockSize(sampleCount maxBlockSize) override;
size_t SetBlockSize(size_t maxBlockSize) override;
bool IsReady() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
bool ProcessFinalize() override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
@ -122,10 +122,10 @@ class VSTEffect final : public wxEvtHandler,
bool RealtimeSuspend() override;
bool RealtimeResume() override;
bool RealtimeProcessStart() override;
sampleCount RealtimeProcess(int group,
size_t RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples) override;
size_t numSamples) override;
bool RealtimeProcessEnd() override;
bool ShowInterface(wxWindow *parent, bool forceModal = false) override;
@ -331,7 +331,7 @@ private:
unsigned mNumChannels;
float **mMasterIn;
float **mMasterOut;
sampleCount mNumSamples;
size_t mNumSamples;
// UI
wxDialog *mDialog;

View File

@ -143,7 +143,7 @@ bool EffectWahwah::ProcessInitialize(sampleCount WXUNUSED(totalLen), ChannelName
return true;
}
sampleCount EffectWahwah::ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen)
size_t EffectWahwah::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
{
return InstanceProcess(mMaster, inBlock, outBlock, blockLen);
}
@ -175,10 +175,10 @@ bool EffectWahwah::RealtimeFinalize()
return true;
}
sampleCount EffectWahwah::RealtimeProcess(int group,
size_t EffectWahwah::RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples)
size_t numSamples)
{
return InstanceProcess(mSlaves[group], inbuf, outbuf, numSamples);
@ -341,7 +341,7 @@ void EffectWahwah::InstanceInit(EffectWahwahState & data, float sampleRate)
data.outgain = DB_TO_LINEAR(mOutGain);
}
sampleCount EffectWahwah::InstanceProcess(EffectWahwahState & data, float **inBlock, float **outBlock, sampleCount blockLen)
size_t EffectWahwah::InstanceProcess(EffectWahwahState & data, float **inBlock, float **outBlock, size_t blockLen)
{
float *ibuf = inBlock[0];
float *obuf = outBlock[0];

View File

@ -64,14 +64,14 @@ public:
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
bool RealtimeFinalize() override;
sampleCount RealtimeProcess(int group,
size_t RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples) override;
size_t numSamples) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;
@ -85,7 +85,7 @@ private:
// EffectWahwah implementation
void InstanceInit(EffectWahwahState & data, float sampleRate);
sampleCount InstanceProcess(EffectWahwahState & data, float **inBlock, float **outBlock, sampleCount blockLen);
size_t InstanceProcess(EffectWahwahState & data, float **inBlock, float **outBlock, size_t blockLen);
void OnFreqSlider(wxCommandEvent & evt);
void OnPhaseSlider(wxCommandEvent & evt);

View File

@ -1192,7 +1192,7 @@ void AudioUnitEffect::SetSampleRate(double rate)
mSampleRate = rate;
}
sampleCount AudioUnitEffect::SetBlockSize(sampleCount maxBlockSize)
size_t AudioUnitEffect::SetBlockSize(size_t maxBlockSize)
{
return mBlockSize;
}
@ -1219,7 +1219,7 @@ sampleCount AudioUnitEffect::GetLatency()
return 0;
}
sampleCount AudioUnitEffect::GetTailSize()
size_t AudioUnitEffect::GetTailSize()
{
// Retrieve the tail time
Float64 tailTime = 0.0;
@ -1306,7 +1306,7 @@ bool AudioUnitEffect::ProcessFinalize()
return true;
}
sampleCount AudioUnitEffect::ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen)
size_t AudioUnitEffect::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
{
for (int i = 0; i < mAudioIns; i++)
{
@ -1431,10 +1431,10 @@ bool AudioUnitEffect::RealtimeProcessStart()
return true;
}
sampleCount AudioUnitEffect::RealtimeProcess(int group,
size_t AudioUnitEffect::RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples)
size_t numSamples)
{
wxASSERT(numSamples <= mBlockSize);

View File

@ -79,15 +79,15 @@ public:
int GetMidiOutCount() override;
void SetSampleRate(double rate) override;
sampleCount SetBlockSize(sampleCount maxBlockSize) override;
size_t SetBlockSize(size_t maxBlockSize) override;
sampleCount GetLatency() override;
sampleCount GetTailSize() override;
size_t GetTailSize() override;
bool IsReady() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
bool ProcessFinalize() override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
@ -95,10 +95,10 @@ public:
bool RealtimeSuspend() override;
bool RealtimeResume() override;
bool RealtimeProcessStart() override;
sampleCount RealtimeProcess(int group,
size_t RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples) override;
size_t numSamples) override;
bool RealtimeProcessEnd() override;
bool ShowInterface(wxWindow *parent, bool forceModal = false) override;
@ -208,7 +208,7 @@ private:
unsigned mNumChannels;
float **mMasterIn;
float **mMasterOut;
sampleCount mNumSamples;
size_t mNumSamples;
AUEventListenerRef mEventListenerRef;

View File

@ -891,7 +891,7 @@ void LadspaEffect::SetSampleRate(double rate)
mSampleRate = rate;
}
sampleCount LadspaEffect::SetBlockSize(sampleCount maxBlockSize)
size_t LadspaEffect::SetBlockSize(size_t maxBlockSize)
{
mBlockSize = maxBlockSize;
@ -909,7 +909,7 @@ sampleCount LadspaEffect::GetLatency()
return 0;
}
sampleCount LadspaEffect::GetTailSize()
size_t LadspaEffect::GetTailSize()
{
return 0;
}
@ -950,7 +950,7 @@ bool LadspaEffect::ProcessFinalize()
return true;
}
sampleCount LadspaEffect::ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen)
size_t LadspaEffect::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
{
for (int i = 0; i < mAudioIns; i++)
{
@ -1013,10 +1013,10 @@ bool LadspaEffect::RealtimeProcessStart()
return true;
}
sampleCount LadspaEffect::RealtimeProcess(int group,
size_t LadspaEffect::RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples)
size_t numSamples)
{
for (int i = 0; i < mAudioIns; i++)
{

View File

@ -74,15 +74,15 @@ public:
int GetMidiOutCount() override;
void SetSampleRate(double rate) override;
sampleCount SetBlockSize(sampleCount maxBlockSize) override;
size_t SetBlockSize(size_t maxBlockSize) override;
sampleCount GetLatency() override;
sampleCount GetTailSize() override;
size_t GetTailSize() override;
bool IsReady() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
bool ProcessFinalize() override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
@ -90,10 +90,10 @@ public:
bool RealtimeSuspend() override;
bool RealtimeResume() override;
bool RealtimeProcessStart() override;
sampleCount RealtimeProcess(int group,
size_t RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples) override;
size_t numSamples) override;
bool RealtimeProcessEnd() override;
bool ShowInterface(wxWindow *parent, bool forceModal = false) override;
@ -157,8 +157,8 @@ private:
LADSPA_Handle mMaster;
double mSampleRate;
sampleCount mBlockSize;
sampleCount mUserBlockSize;
size_t mBlockSize;
int mUserBlockSize;
bool mInteractive;

View File

@ -745,7 +745,7 @@ void LV2Effect::SetSampleRate(double rate)
}
}
sampleCount LV2Effect::SetBlockSize(sampleCount maxBlockSize)
size_t LV2Effect::SetBlockSize(size_t maxBlockSize)
{
mBlockSize = (int) maxBlockSize;
@ -780,7 +780,7 @@ sampleCount LV2Effect::GetLatency()
return 0;
}
sampleCount LV2Effect::GetTailSize()
size_t LV2Effect::GetTailSize()
{
return 0;
}
@ -818,7 +818,7 @@ bool LV2Effect::ProcessFinalize()
return true;
}
sampleCount LV2Effect::ProcessBlock(float **inbuf, float **outbuf, sampleCount size)
size_t LV2Effect::ProcessBlock(float **inbuf, float **outbuf, size_t size)
{
for (size_t p = 0, cnt = mAudioInputs.GetCount(); p < cnt; p++)
{
@ -905,10 +905,10 @@ bool LV2Effect::RealtimeProcessStart()
return true;
}
sampleCount LV2Effect::RealtimeProcess(int group,
size_t LV2Effect::RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples)
size_t numSamples)
{
wxASSERT(group >= 0 && group < (int) mSlaves.GetCount());
wxASSERT(numSamples <= mBlockSize);

View File

@ -129,15 +129,15 @@ public:
int GetMidiOutCount() override;
void SetSampleRate(double rate) override;
sampleCount SetBlockSize(sampleCount maxBlockSize) override;
size_t SetBlockSize(size_t maxBlockSize) override;
sampleCount GetLatency() override;
sampleCount GetTailSize() override;
size_t GetTailSize() override;
bool IsReady() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
bool ProcessFinalize() override;
sampleCount ProcessBlock(float **inbuf, float **outbuf, sampleCount size) override;
size_t ProcessBlock(float **inbuf, float **outbuf, size_t size) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
@ -145,10 +145,10 @@ public:
bool RealtimeSuspend() override;
bool RealtimeResume() override;
bool RealtimeProcessStart() override;
sampleCount RealtimeProcess(int group,
size_t RealtimeProcess(int group,
float **inbuf,
float **outbuf,
sampleCount numSamples) override;
size_t numSamples) override;
bool RealtimeProcessEnd() override;
bool ShowInterface(wxWindow *parent, bool forceModal = false) override;
@ -276,7 +276,7 @@ private:
float **mMasterIn;
float **mMasterOut;
sampleCount mNumSamples;
size_t mNumSamples;
double mLength;

View File

@ -375,7 +375,7 @@ int ExportCL::Export(AudacityProject *project,
// establish parameters
int rate = lrint(project->GetRate());
sampleCount maxBlockLen = 44100 * 5;
const size_t maxBlockLen = 44100 * 5;
unsigned long totalSamples = lrint((t1 - t0) * rate);
unsigned long sampleBytes = totalSamples * channels * SAMPLE_SIZE(int16Sample);

View File

@ -113,7 +113,7 @@ public:
void SetMetadata(const Tags *tags, const char *name, const wxChar *tag);
/// Encodes audio
bool EncodeAudioFrame(int16_t *pFrame, int frameSize);
bool EncodeAudioFrame(int16_t *pFrame, size_t frameSize);
/// Flushes audio encoder
bool Finalize();
@ -760,7 +760,7 @@ void ExportFFmpeg::FreeResources()
av_log_set_callback(av_log_default_callback);
}
bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, int frameSize)
bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
{
int nBytesToWrite = 0;
uint8_t *pRawSamples = NULL;

View File

@ -815,7 +815,7 @@ GStreamerImportFileHandle::OnNewSample(GStreamContext *c, GstSample *sample)
auto nChannels = c->mNumChannels;
sampleFormat fmt = c->mFmt;
samplePtr data = (samplePtr) info.data;
sampleCount samples = info.size / nChannels / SAMPLE_SIZE(fmt);
size_t samples = info.size / nChannels / SAMPLE_SIZE(fmt);
// Add sample data to tracks...depends on interleaved src data
for (int chn = 0; chn < nChannels; chn++)

Some files were not shown because too many files have changed in this diff Show More