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