mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-21 06:40:08 +02:00
SAMPLE_SIZE macro returns size_t
This commit is contained in:
parent
c9bff2f0f4
commit
b093a8e406
@ -126,7 +126,7 @@ void FindDependencies(AudacityProject *project,
|
||||
continue;
|
||||
|
||||
const wxString &fileNameStr = fileName.GetFullPath();
|
||||
int blockBytes = (SAMPLE_SIZE(format) *
|
||||
auto blockBytes = (SAMPLE_SIZE(format) *
|
||||
aliasBlockFile->GetLength());
|
||||
if (aliasedFileHash.count(fileNameStr) > 0)
|
||||
// Already put this AliasBlockFile in aliasedFileHash.
|
||||
|
@ -414,7 +414,7 @@ sampleCount Mixer::MixVariableRates(int *channelFlags, WaveTrackCache &cache,
|
||||
const double trackRate = track->GetRate();
|
||||
const double initialWarp = mRate / mSpeed / trackRate;
|
||||
const double tstep = 1.0 / trackRate;
|
||||
int sampleSize = SAMPLE_SIZE(floatSample);
|
||||
auto sampleSize = SAMPLE_SIZE(floatSample);
|
||||
|
||||
decltype(mMaxOut) out = 0;
|
||||
|
||||
|
@ -88,17 +88,17 @@ AUDACITY_DLL_API void DeleteSamples(samplePtr p)
|
||||
void ClearSamples(samplePtr src, sampleFormat format,
|
||||
int start, int len)
|
||||
{
|
||||
int size = SAMPLE_SIZE(format);
|
||||
auto size = SAMPLE_SIZE(format);
|
||||
memset(src + start*size, 0, len*size);
|
||||
}
|
||||
|
||||
void ReverseSamples(samplePtr src, sampleFormat format,
|
||||
int start, int len)
|
||||
{
|
||||
int size = SAMPLE_SIZE(format);
|
||||
auto size = SAMPLE_SIZE(format);
|
||||
samplePtr first = src + start * size;
|
||||
samplePtr last = src + (start + len - 1) * size;
|
||||
enum { fixedSize = SAMPLE_SIZE(floatSample) };
|
||||
enum : size_t { fixedSize = SAMPLE_SIZE(floatSample) };
|
||||
wxASSERT(size <= fixedSize);
|
||||
char temp[fixedSize];
|
||||
while (first < last) {
|
||||
|
@ -29,7 +29,7 @@ typedef enum {
|
||||
} sampleFormat;
|
||||
|
||||
/** \brief Return the size (in memory) of one sample (bytes) */
|
||||
#define SAMPLE_SIZE(SampleFormat) (SampleFormat >> 16)
|
||||
#define SAMPLE_SIZE(SampleFormat) ( size_t{ (SampleFormat) >> 16 } )
|
||||
#endif
|
||||
|
||||
// Used to determine how to fill in empty areas of audio.
|
||||
@ -39,8 +39,8 @@ typedef enum {
|
||||
}fillFormat;
|
||||
|
||||
/** \brief Return the size on disk of one uncompressed sample (bytes) */
|
||||
#define SAMPLE_SIZE_DISK(SampleFormat) ((SampleFormat == int24Sample) ? \
|
||||
3 : SAMPLE_SIZE(SampleFormat) )
|
||||
#define SAMPLE_SIZE_DISK(SampleFormat) (((SampleFormat) == int24Sample) ? \
|
||||
size_t{ 3 } : SAMPLE_SIZE(SampleFormat) )
|
||||
|
||||
const wxChar *GetSampleFormatStr(sampleFormat format);
|
||||
|
||||
|
@ -480,7 +480,7 @@ bool Sequence::Paste(sampleCount s, const Sequence *src)
|
||||
const BlockArray &srcBlock = src->mBlock;
|
||||
auto addedLen = src->mNumSamples;
|
||||
const unsigned int srcNumBlocks = srcBlock.size();
|
||||
int sampleSize = SAMPLE_SIZE(mSampleFormat);
|
||||
auto sampleSize = SAMPLE_SIZE(mSampleFormat);
|
||||
|
||||
if (addedLen == 0 || srcNumBlocks == 0)
|
||||
return true;
|
||||
@ -1116,7 +1116,7 @@ bool Sequence::CopyWrite(SampleBuffer &scratch,
|
||||
wxASSERT(start + len <= length);
|
||||
wxASSERT(start >= 0);
|
||||
|
||||
int sampleSize = SAMPLE_SIZE(mSampleFormat);
|
||||
auto sampleSize = SAMPLE_SIZE(mSampleFormat);
|
||||
|
||||
Read(scratch.ptr(), mSampleFormat, b, 0, length);
|
||||
memcpy(scratch.ptr() + start*sampleSize, buffer, len*sampleSize);
|
||||
@ -1590,7 +1590,7 @@ bool Sequence::Delete(sampleCount start, sampleCount len)
|
||||
const unsigned int b0 = FindBlock(start);
|
||||
unsigned int b1 = FindBlock(start + len - 1);
|
||||
|
||||
int sampleSize = SAMPLE_SIZE(mSampleFormat);
|
||||
auto sampleSize = SAMPLE_SIZE(mSampleFormat);
|
||||
|
||||
// Special case: if the samples to DELETE are all within a single
|
||||
// block and the resulting length is not too small, perform the
|
||||
|
@ -123,9 +123,9 @@ SimpleBlockFile::SimpleBlockFile(wxFileNameWrapper &&baseFileName,
|
||||
mCache.active = true;
|
||||
mCache.needWrite = true;
|
||||
mCache.format = format;
|
||||
mCache.sampleData = new char[sampleLen * SAMPLE_SIZE(format)];
|
||||
memcpy(mCache.sampleData,
|
||||
sampleData, sampleLen * SAMPLE_SIZE(format));
|
||||
const auto sampleDataSize = sampleLen * SAMPLE_SIZE(format);
|
||||
mCache.sampleData = new char[sampleDataSize];
|
||||
memcpy(mCache.sampleData, sampleData, sampleDataSize);
|
||||
ArrayOf<char> cleanup;
|
||||
void* summaryData = BlockFile::CalcSummary(sampleData, sampleLen,
|
||||
format, cleanup);
|
||||
@ -269,7 +269,7 @@ bool SimpleBlockFile::WriteSimpleBlockFile(
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void SimpleBlockFile::FillCache()
|
||||
|
Loading…
x
Reference in New Issue
Block a user