mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-13 14:13:32 +02:00
Remove many mentions of sampleCount with auto and decltype...
... This makes much code agnostic about how other things (functions and arguments) are typed. Many of these neeed to become size_t instead of sampleCount.
This commit is contained in:
@@ -603,9 +603,10 @@ int FFmpegImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
WaveTrack *t = stream[c].get();
|
||||
odTask->AddWaveTrack(t);
|
||||
|
||||
sampleCount maxBlockSize = t->GetMaxBlockSize();
|
||||
auto maxBlockSize = t->GetMaxBlockSize();
|
||||
//use the maximum blockfile size to divide the sections (about 11secs per blockfile at 44.1khz)
|
||||
for (sampleCount i = 0; i < sampleDuration; i += maxBlockSize) {
|
||||
|
||||
for (decltype(sampleDuration) i = 0; i < sampleDuration; i += maxBlockSize) {
|
||||
const auto blockLen =
|
||||
limitSampleBufferSize( maxBlockSize, sampleDuration - i );
|
||||
|
||||
|
@@ -487,9 +487,9 @@ int FLACImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
//add the task to the ODManager
|
||||
if(useOD)
|
||||
{
|
||||
sampleCount fileTotalFrames = (sampleCount)mNumSamples;
|
||||
sampleCount maxBlockSize = mChannels.begin()->get()->GetMaxBlockSize();
|
||||
for (sampleCount i = 0; i < fileTotalFrames; i += maxBlockSize) {
|
||||
auto fileTotalFrames = (sampleCount)mNumSamples;
|
||||
auto maxBlockSize = mChannels.begin()->get()->GetMaxBlockSize();
|
||||
for (decltype(fileTotalFrames) i = 0; i < fileTotalFrames; i += maxBlockSize) {
|
||||
const auto blockLen =
|
||||
limitSampleBufferSize( maxBlockSize, fileTotalFrames - i );
|
||||
|
||||
|
@@ -456,13 +456,12 @@ enum mad_flow output_cb(void *_data,
|
||||
struct mad_pcm *pcm)
|
||||
{
|
||||
int channels, samplerate;
|
||||
sampleCount samples;
|
||||
struct private_data *data = (struct private_data *)_data;
|
||||
int smpl;
|
||||
|
||||
samplerate= pcm->samplerate;
|
||||
channels = pcm->channels;
|
||||
samples = pcm->length;
|
||||
const auto samples = pcm->length;
|
||||
|
||||
/* If this is the first run, we need to create the WaveTracks that
|
||||
* will hold the data. We do this now because now is the first
|
||||
|
@@ -367,8 +367,8 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
channels.begin()->get()->SetLinked(true);
|
||||
}
|
||||
|
||||
sampleCount fileTotalFrames = (sampleCount)mInfo.frames;
|
||||
sampleCount maxBlockSize = channels.begin()->get()->GetMaxBlockSize();
|
||||
auto fileTotalFrames = (sampleCount)mInfo.frames;
|
||||
auto maxBlockSize = channels.begin()->get()->GetMaxBlockSize();
|
||||
int updateResult = false;
|
||||
|
||||
// If the format is not seekable, we must use 'copy' mode,
|
||||
@@ -387,7 +387,8 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
bool useOD =fileTotalFrames>kMinimumODFileSampleSize;
|
||||
int updateCounter = 0;
|
||||
|
||||
for (sampleCount i = 0; i < fileTotalFrames; i += maxBlockSize) {
|
||||
for (decltype(fileTotalFrames) i = 0; i < fileTotalFrames; i += maxBlockSize) {
|
||||
|
||||
const auto blockLen =
|
||||
limitSampleBufferSize( maxBlockSize, fileTotalFrames - i );
|
||||
|
||||
@@ -429,9 +430,10 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
// samples in the tracks.
|
||||
|
||||
// PRL: guard against excessive memory buffer allocation in case of many channels
|
||||
sampleCount maxBlock = std::min(maxBlockSize,
|
||||
sampleCount(std::numeric_limits<int>::max() /
|
||||
(mInfo.channels * SAMPLE_SIZE(mFormat)))
|
||||
using type = decltype(maxBlockSize);
|
||||
auto maxBlock = std::min(maxBlockSize,
|
||||
std::numeric_limits<type>::max() /
|
||||
(mInfo.channels * SAMPLE_SIZE(mFormat))
|
||||
);
|
||||
if (maxBlock < 1)
|
||||
return eProgressFailed;
|
||||
|
@@ -233,8 +233,8 @@ int QTImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
OSErr err = noErr;
|
||||
MovieAudioExtractionRef maer = NULL;
|
||||
int updateResult = eProgressSuccess;
|
||||
sampleCount totSamples = (sampleCount) GetMovieDuration(mMovie);
|
||||
sampleCount numSamples = 0;
|
||||
auto totSamples = (sampleCount) GetMovieDuration(mMovie);
|
||||
decltype(totSamples) numSamples = 0;
|
||||
Boolean discrete = true;
|
||||
UInt32 quality = kQTAudioRenderQuality_Max;
|
||||
AudioStreamBasicDescription desc;
|
||||
|
@@ -100,7 +100,6 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
|
||||
int encoding = 0; // Guess Format
|
||||
sampleFormat format;
|
||||
sf_count_t offset = 0;
|
||||
sampleCount totalFrames;
|
||||
double rate = 44100.0;
|
||||
double percent = 100.0;
|
||||
TrackHolders channels;
|
||||
@@ -176,7 +175,7 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
|
||||
|
||||
SFCall<sf_count_t>(sf_seek, sndFile.get(), 0, SEEK_SET);
|
||||
|
||||
totalFrames = (sampleCount)(sndInfo.frames * percent / 100.0);
|
||||
auto totalFrames = (sampleCount)(sndInfo.frames * percent / 100.0);
|
||||
|
||||
//
|
||||
// Sample format:
|
||||
@@ -218,12 +217,12 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
|
||||
firstChannel->SetLinked(true);
|
||||
}
|
||||
|
||||
sampleCount maxBlockSize = firstChannel->GetMaxBlockSize();
|
||||
auto maxBlockSize = firstChannel->GetMaxBlockSize();
|
||||
|
||||
SampleBuffer srcbuffer(maxBlockSize * numChannels, format);
|
||||
SampleBuffer buffer(maxBlockSize, format);
|
||||
|
||||
sampleCount framescompleted = 0;
|
||||
decltype(totalFrames) framescompleted = 0;
|
||||
if (totalFrames < 0) {
|
||||
wxASSERT(false);
|
||||
totalFrames = 0;
|
||||
|
Reference in New Issue
Block a user