mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-05 14:18:53 +02:00
More various small preliminary fixes relating to sampleCount
Comment more cases of bad sampleCount truncation, and even worse... Fix progress indicator again: must do a floating-point division... A little more type agnosticism Remove more unnecessary casts to sampleCount Fix more narrowings of sampleCount
This commit is contained in:
commit
1324d1342a
@ -3528,7 +3528,8 @@ void AudioIO::FillBuffers()
|
||||
// The mixer here isn't actually mixing: it's just doing
|
||||
// resampling, format conversion, and possibly time track
|
||||
// warping
|
||||
int processed = 0;
|
||||
decltype(mPlaybackMixers[i]->Process(frames))
|
||||
processed = 0;
|
||||
samplePtr warpedSamples;
|
||||
//don't do anything if we have no length. In particular, Process() will fail an wxAssert
|
||||
//that causes a crash since this is not the GUI thread and wxASSERT is a GUI call.
|
||||
|
@ -400,7 +400,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
|
||||
// as we're about to do).
|
||||
t->GetEndTime();
|
||||
|
||||
if (t->GetClipByIndex(0)->GetSequence()->GetNumSamples() != (sampleCount)nChunks * chunkSize) {
|
||||
if (t->GetClipByIndex(0)->GetSequence()->GetNumSamples() != nChunks * chunkSize) {
|
||||
Printf(wxT("Expected len %d, track len %lld.\n"), nChunks * chunkSize,
|
||||
(long long) t->GetClipByIndex(0)->GetSequence()->GetNumSamples());
|
||||
goto fail;
|
||||
@ -437,7 +437,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (t->GetClipByIndex(0)->GetSequence()->GetNumSamples() != (sampleCount) nChunks * chunkSize) {
|
||||
if (t->GetClipByIndex(0)->GetSequence()->GetNumSamples() != nChunks * chunkSize) {
|
||||
Printf(wxT("Trial %d\n"), z);
|
||||
Printf(wxT("Expected len %d, track len %lld.\n"), nChunks * chunkSize,
|
||||
(long long) t->GetClipByIndex(0)->GetSequence()->GetNumSamples());
|
||||
|
@ -124,6 +124,7 @@ bool CrossFader::CrossFadeMix(samplePtr buffer, sampleFormat format, sampleCount
|
||||
|
||||
//Copy the sequences over to the NEW vector, casting as you go.
|
||||
for(int i = 0; i < numclips; i++)
|
||||
// PRL: what the ... ? This cast is just wrong!
|
||||
shortSeq.push_back((short*)tmpSequence[i]);
|
||||
|
||||
|
||||
@ -141,6 +142,8 @@ bool CrossFader::CrossFadeMix(samplePtr buffer, sampleFormat format, sampleCount
|
||||
if(j + clipStart[i] >= 0 &&
|
||||
clipStart[i]+len < clipLength[i])//only copy if we are within the clip
|
||||
{
|
||||
// UNSAFE_SAMPLE_COUNT_TRUNCATION
|
||||
// -- but class CrossFader is not used as of this writing
|
||||
f += shortSeq[i][j+ clipStart[i]];
|
||||
clips++;
|
||||
}
|
||||
@ -171,6 +174,8 @@ bool CrossFader::CrossFadeMix(samplePtr buffer, sampleFormat format, sampleCount
|
||||
|
||||
//Copy the sequences over to the NEW vector, casting as you go.
|
||||
for(int i = 0; i < numclips; i++)
|
||||
// Murder most foul! As in the best it is,
|
||||
// But this most foul, strange, and unnatural.
|
||||
intSeq.push_back((int*)tmpSequence[i]);
|
||||
|
||||
int clips=0;
|
||||
@ -187,6 +192,8 @@ bool CrossFader::CrossFadeMix(samplePtr buffer, sampleFormat format, sampleCount
|
||||
//only copy if we are within the clip
|
||||
if(j + clipStart[i] >= 0 && clipStart[i] + len < clipLength[i])
|
||||
{
|
||||
// UNSAFE_SAMPLE_COUNT_TRUNCATION
|
||||
// -- but class CrossFader is not used as of this writing
|
||||
f+= intSeq[i][j+clipStart[i]];
|
||||
clips++;
|
||||
}
|
||||
@ -231,6 +238,11 @@ bool CrossFader::CrossFadeMix(samplePtr buffer, sampleFormat format, sampleCount
|
||||
if(j + clipStart[i] >= 0 &&
|
||||
clipStart[i] + j < clipLength[i])//only copy if we are within the clip
|
||||
{
|
||||
// UNSAFE_SAMPLE_COUNT_TRUNCATION
|
||||
// -- but class CrossFader is not used as of this writing
|
||||
// -- hey wait, you never even tried to initialize floatSeq,
|
||||
// not even with bad casts!!!
|
||||
// Subscripts out of bounds, bombs away!!!
|
||||
f += floatSeq[i][j + clipStart[i]];
|
||||
clips++;
|
||||
}
|
||||
|
@ -4383,7 +4383,7 @@ void TrackPanel::HandleSampleEditingClick( wxMouseEvent & event )
|
||||
|
||||
//Get a sample from the track to do some tricks on.
|
||||
mDrawingTrack->Get((samplePtr)sampleRegion, floatSample,
|
||||
(int)mDrawingStartSample - SMOOTHING_KERNEL_RADIUS - SMOOTHING_BRUSH_RADIUS,
|
||||
mDrawingStartSample - SMOOTHING_KERNEL_RADIUS - SMOOTHING_BRUSH_RADIUS,
|
||||
sampleRegionSize);
|
||||
int i, j;
|
||||
|
||||
|
@ -426,7 +426,7 @@ void WaveClip::ClearWaveCache()
|
||||
}
|
||||
|
||||
///Adds an invalid region to the wavecache so it redraws that portion only.
|
||||
void WaveClip::AddInvalidRegion(long startSample, long endSample)
|
||||
void WaveClip::AddInvalidRegion(sampleCount startSample, sampleCount endSample)
|
||||
{
|
||||
ODLocker locker(&mWaveCacheMutex);
|
||||
if(mWaveCache!=NULL)
|
||||
|
@ -360,7 +360,7 @@ public:
|
||||
void ClearWaveCache();
|
||||
|
||||
///Adds an invalid region to the wavecache so it redraws that portion only.
|
||||
void AddInvalidRegion(long startSample, long endSample);
|
||||
void AddInvalidRegion(sampleCount startSample, sampleCount endSample);
|
||||
|
||||
//
|
||||
// XMLTagHandler callback methods for loading and saving
|
||||
|
@ -125,7 +125,9 @@ bool CompareAudioCommand::Apply(CommandExecutionContext context)
|
||||
}
|
||||
|
||||
position += block;
|
||||
Progress((position - s0) / length);
|
||||
Progress(
|
||||
double(position - s0) / double(length)
|
||||
);
|
||||
}
|
||||
|
||||
delete [] buff0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user