1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-06 23:29:24 +02:00

Fix some problems with asserts in 11308. Further wording corrections.

This commit is contained in:
v.audacity 2011-11-18 03:47:43 +00:00
parent e275189f1e
commit 458152070e
13 changed files with 76 additions and 44 deletions

View File

@ -1751,10 +1751,12 @@ void AudioIO::StopStream()
}
if( appendRecord )
{ // append-recording
bool bResult = true;
if (recordingOffset < 0)
track->Clear(mT0, mT0 - recordingOffset); // cut the latency out
bResult = track->Clear(mT0, mT0 - recordingOffset); // cut the latency out
else
wxASSERT(track->InsertSilence(mT0, recordingOffset)); // put silence in
bResult = track->InsertSilence(mT0, recordingOffset); // put silence in
wxASSERT(bResult); // TO DO: Actually handle this.
}
else
{ // recording into a new track

View File

@ -3465,7 +3465,8 @@ void AudacityProject::OnPaste()
}else{
WaveTrack *tmp;
tmp = mTrackFactory->NewWaveTrack( ((WaveTrack*)n)->GetSampleFormat(), ((WaveTrack*)n)->GetRate());
wxASSERT(tmp->InsertSilence(0.0, msClipT1 - msClipT0)); // MJS: Is this correct?
bool bResult = tmp->InsertSilence(0.0, msClipT1 - msClipT0); // MJS: Is this correct?
wxASSERT(bResult); // TO DO: Actually handle this.
tmp->Flush();
bPastedSomething |=
@ -3599,7 +3600,8 @@ bool AudacityProject::HandlePasteNothingSelected()
pNewTrack->SetChannel(pClip->GetChannel());
pNewTrack->SetName(pClip->GetName());
wxASSERT(pNewTrack->Paste(0.0, pClip));
bool bResult = pNewTrack->Paste(0.0, pClip);
wxASSERT(bResult); // TO DO: Actually handle this.
mTracks->Add(pNewTrack);
pNewTrack->SetSelected(true);

View File

@ -4192,7 +4192,8 @@ void AudacityProject::EditClipboardByLabel( WaveTrack::EditDestFunction action )
regions.Item(i+1)->start - regions.Item(i)->end);
}
wxASSERT(merged->Paste( 0.0 , dest ));
bool bResult = merged->Paste( 0.0 , dest );
wxASSERT(bResult); // TO DO: Actually handle this.
delete dest;
}
}

View File

@ -80,7 +80,8 @@ Sequence::Sequence(const Sequence &orig, DirManager *projDirManager)
mBlock = new BlockArray();
wxASSERT(Paste(0, &orig));
bool bResult = Paste(0, &orig);
wxASSERT(bResult); // TO DO: Actually handle this.
}
Sequence::~Sequence()

View File

@ -4885,7 +4885,10 @@ bool TrackPanel::HandleTrackLocationMouseEvent(WaveTrack * track, wxRect &r, wxM
{
WaveTrack* linked = (WaveTrack*)mTracks->GetLink(track);
if (linked)
wxASSERT(linked->ExpandCutLine(mCapturedTrackLocation.pos));
{
bool bResult = linked->ExpandCutLine(mCapturedTrackLocation.pos);
wxASSERT(bResult); // TO DO: Actually handle this.
}
mViewInfo->sel0 = cutlineStart;
mViewInfo->sel1 = cutlineEnd;
DisplaySelection();
@ -4894,10 +4897,14 @@ bool TrackPanel::HandleTrackLocationMouseEvent(WaveTrack * track, wxRect &r, wxM
}
} else if (mCapturedTrackLocation.typ == WaveTrack::locationMergePoint)
{
wxASSERT(track->MergeClips(mCapturedTrackLocation.clipidx1, mCapturedTrackLocation.clipidx2));
bool bResult = track->MergeClips(mCapturedTrackLocation.clipidx1, mCapturedTrackLocation.clipidx2);
wxASSERT(bResult); // TO DO: Actually handle this.
WaveTrack* linked = (WaveTrack*)mTracks->GetLink(track);
if (linked)
wxASSERT(linked->MergeClips(mCapturedTrackLocation.clipidx1, mCapturedTrackLocation.clipidx2));
{
bResult = linked->MergeClips(mCapturedTrackLocation.clipidx1, mCapturedTrackLocation.clipidx2);
wxASSERT(bResult); // TO DO: Actually handle this.
}
MakeParentPushState(_("Merged Clips"),_("Merge"), PUSH_CONSOLIDATE|PUSH_CALC_SPACE);
handled = true;
}
@ -7094,10 +7101,14 @@ void TrackPanel::OnFormatChange(wxCommandEvent & event)
break;
}
wxASSERT(((WaveTrack*)mPopupMenuTarget)->ConvertToSampleFormat(newFormat));
bool bResult = ((WaveTrack*)mPopupMenuTarget)->ConvertToSampleFormat(newFormat);
wxASSERT(bResult); // TO DO: Actually handle this.
Track *partner = mTracks->GetLink(mPopupMenuTarget);
if (partner)
wxASSERT(((WaveTrack *) partner)->ConvertToSampleFormat(newFormat));
{
bResult = ((WaveTrack*)partner)->ConvertToSampleFormat(newFormat);
wxASSERT(bResult); // TO DO: Actually handle this.
}
MakeParentPushState(wxString::Format(_("Changed '%s' to %s"),
mPopupMenuTarget->GetName().

View File

@ -576,7 +576,8 @@ bool WaveTrack::ClearAndPaste(double t0, // Start of time to clear
// falls within it and this isn't the first clip in the track.
if (fabs(t1 - clip->GetStartTime()) < WAVETRACK_MERGE_POINT_TOLERANCE) {
if (i > 0) {
wxASSERT(MergeClips(GetClipIndex(clips[i - 1]), GetClipIndex(clip)));
bool bResult = MergeClips(GetClipIndex(clips[i - 1]), GetClipIndex(clip));
wxASSERT(bResult); // TO DO: Actually handle this.
}
break;
}
@ -594,7 +595,8 @@ bool WaveTrack::ClearAndPaste(double t0, // Start of time to clear
// falls within it and this isn't the last clip in the track.
if (fabs(t0 - clip->GetEndTime()) < WAVETRACK_MERGE_POINT_TOLERANCE) {
if (i < clips.GetCount() - 1) {
wxASSERT(MergeClips(GetClipIndex(clip), GetClipIndex(clips[i + 1])));
bool bResult = MergeClips(GetClipIndex(clip), GetClipIndex(clips[i + 1]));
wxASSERT(bResult); // TO DO: Actually handle this.
}
break;
}
@ -829,9 +831,11 @@ bool WaveTrack::SyncLockAdjust(double oldT1, double newT1)
if (!f) return false;
WaveTrack *tmp = f->NewWaveTrack(GetSampleFormat(), GetRate());
wxASSERT(tmp->InsertSilence(0.0, newT1 - oldT1));
bool bResult = tmp->InsertSilence(0.0, newT1 - oldT1);
wxASSERT(bResult); // TO DO: Actually handle this.
tmp->Flush();
wxASSERT(Paste(oldT1, tmp));
bResult = Paste(oldT1, tmp);
wxASSERT(bResult); // TO DO: Actually handle this.
delete tmp;
}
}
@ -898,7 +902,8 @@ bool WaveTrack::Paste(double t0, Track *src)
if (!IsEmpty(t0, GetEndTime())) {
Track *tmp = NULL;
Cut(t0, GetEndTime()+1.0/mRate, &tmp);
wxASSERT(Paste(t0 + insertDuration, tmp));
bool bResult = Paste(t0 + insertDuration, tmp);
wxASSERT(bResult); // TO DO: Actually handle this.
delete tmp;
}
} else
@ -1202,12 +1207,14 @@ bool WaveTrack::Join(double t0, double t1)
if (clip->GetOffset() - t > (1.0 / mRate)) {
double addedSilence = (clip->GetOffset() - t);
//printf("Adding %.6f seconds of silence\n");
wxASSERT(newClip->InsertSilence(t, addedSilence));
bool bResult = newClip->InsertSilence(t, addedSilence);
wxASSERT(bResult); // TO DO: Actually handle this.
t += addedSilence;
}
//printf("Pasting at %.6f\n", t);
wxASSERT(newClip->Paste(t, clip));
bool bResult = newClip->Paste(t, clip);
wxASSERT(bResult); // TO DO: Actually handle this.
t = newClip->GetEndTime();
mClips.DeleteObject(clip);

View File

@ -213,7 +213,7 @@ bool EffectChangeSpeed::ProcessOne(WaveTrack * track,
//Go through the track one buffer at a time. samplePos counts which
//sample the current buffer starts at.
bool bLoopSuccess = true;
bool bResult = true;
sampleCount blockSize;
sampleCount samplePos = start;
while (samplePos < end) {
@ -236,7 +236,7 @@ bool EffectChangeSpeed::ProcessOne(WaveTrack * track,
outBuffer,
outBufferSize);
if (outgen < 0) {
bLoopSuccess = false;
bResult = false;
break;
}
@ -249,7 +249,7 @@ bool EffectChangeSpeed::ProcessOne(WaveTrack * track,
// Update the Progress meter
if (TrackProgress(mCurTrackNum, (samplePos - start) / len)) {
bLoopSuccess = false;
bResult = false;
break;
}
}
@ -264,10 +264,10 @@ bool EffectChangeSpeed::ProcessOne(WaveTrack * track,
// Take the output track and insert it in place of the original
// sample data
double newLength = outputTrack->GetEndTime();
if (bLoopSuccess)
if (bResult)
{
SetTimeWarper(new LinearTimeWarper(mCurT0, mCurT0, mCurT1, mCurT0 + newLength));
wxASSERT(track->ClearAndPaste(mCurT0, mCurT1, outputTrack, true, false, GetTimeWarper()));
bResult = track->ClearAndPaste(mCurT0, mCurT1, outputTrack, true, false, GetTimeWarper());
}
if (newLength > mMaxNewLength)
@ -276,7 +276,7 @@ bool EffectChangeSpeed::ProcessOne(WaveTrack * track,
// Delete the outputTrack now that its data is inserted in place
delete outputTrack;
return bLoopSuccess;
return bResult;
}

View File

@ -189,7 +189,8 @@ void Effect::GetSamples(WaveTrack *track, sampleCount *start, sampleCount *len)
t1 = t0 + mLength;
if (mT0 == mT1) {
// Not really part of the calculation, but convenient to put here
wxASSERT(track->InsertSilence(t0, t1));
bool bResult = track->InsertSilence(t0, t1);
wxASSERT(bResult); // TO DO: Actually handle this.
}
}

View File

@ -531,7 +531,8 @@ bool EffectEqualization::ProcessOne(int count, WaveTrack * t,
if(toClipOutput)
{
//put the processed audio in
wxASSERT(t->Paste(clipStartEndTimes[i].first,toClipOutput));
bool bResult = t->Paste(clipStartEndTimes[i].first, toClipOutput);
wxASSERT(bResult); // TO DO: Actually handle this.
//if the clip was only partially selected, the Paste will have created a split line. Join is needed to take care of this
//This is not true when the selection is fully contained within one clip (second half of conditional)
if( (clipRealStartEndTimes[i].first != clipStartEndTimes[i].first ||
@ -1020,7 +1021,7 @@ void EqualizationDialog::LoadCurves(wxString fileName, bool append)
{
// Inform user of load failure
wxMessageBox( reader.GetErrorStr(),
_("ErrorLoading EQ Curve"),
_("Error Loading EQ Curve"),
wxOK | wxCENTRE,
this );
}

View File

@ -708,7 +708,8 @@ bool EffectNoiseRemoval::ProcessOne(int count, WaveTrack * track,
double tLen = mOutputTrack->LongSamplesToTime(len);
// Filtering effects always end up with more data than they started with. Delete this 'tail'.
mOutputTrack->HandleClear(tLen, mOutputTrack->GetEndTime(), false, false);
wxASSERT(track->ClearAndPaste(t0, t0 + tLen, mOutputTrack, true, false));
bool bResult = track->ClearAndPaste(t0, t0 + tLen, mOutputTrack, true, false);
wxASSERT(bResult); // TO DO: Actually handle this.
}
// Delete the outputTrack now that its data is inserted in place

View File

@ -362,15 +362,19 @@ bool EffectSBSMS::Process()
rb.outputLeftTrack->Flush();
if(rightTrack)
rb.outputRightTrack->Flush();
wxASSERT(leftTrack->ClearAndPaste(
mCurT0, mCurT1, rb.outputLeftTrack,
true, false, GetTimeWarper()));
bool bResult =
leftTrack->ClearAndPaste(mCurT0, mCurT1, rb.outputLeftTrack,
true, false, GetTimeWarper());
wxASSERT(bResult); // TO DO: Actually handle this.
if(rightTrack)
wxASSERT(rightTrack->ClearAndPaste(
mCurT0, mCurT1, rb.outputRightTrack,
true, false, GetTimeWarper()));
{
bResult =
rightTrack->ClearAndPaste(mCurT0, mCurT1, rb.outputRightTrack,
true, false, GetTimeWarper());
wxASSERT(bResult); // TO DO: Actually handle this.
}
}
mCurTrackNum++;
}

View File

@ -72,11 +72,11 @@ bool EffectStereoToMono::ProcessOne(int count)
sampleCount index = mStart;
float *leftBuffer = new float[idealBlockLen];
float *rightBuffer = new float[idealBlockLen];
bool rc;
bool bResult = true;
while (index < mEnd) {
rc = mLeftTrack->Get((samplePtr)leftBuffer, floatSample, index, idealBlockLen);
rc = mRightTrack->Get((samplePtr)rightBuffer, floatSample, index, idealBlockLen);
bResult &= mLeftTrack->Get((samplePtr)leftBuffer, floatSample, index, idealBlockLen);
bResult &= mRightTrack->Get((samplePtr)rightBuffer, floatSample, index, idealBlockLen);
sampleCount limit = idealBlockLen;
if ((index + idealBlockLen) > mEnd) {
limit = mEnd - index;
@ -88,15 +88,15 @@ bool EffectStereoToMono::ProcessOne(int count)
curMonoFrame = (curLeftFrame + curRightFrame) / 2.0;
leftBuffer[i] = curMonoFrame;
}
rc = mOutTrack->Append((samplePtr)leftBuffer, floatSample, limit);
bResult &= mOutTrack->Append((samplePtr)leftBuffer, floatSample, limit);
if (TrackProgress(count, 2.*((double)index / (double)(mEnd - mStart))))
return false;
}
double minStart = wxMin(mLeftTrack->GetStartTime(), mRightTrack->GetStartTime());
mLeftTrack->Clear(mLeftTrack->GetStartTime(), mLeftTrack->GetEndTime());
mOutTrack->Flush();
wxASSERT(mLeftTrack->Paste(minStart, mOutTrack));
bResult &= mLeftTrack->Clear(mLeftTrack->GetStartTime(), mLeftTrack->GetEndTime());
bResult &= mOutTrack->Flush();
bResult &= mLeftTrack->Paste(minStart, mOutTrack);
mLeftTrack->SetLinked(false);
mRightTrack->SetLinked(false);
mLeftTrack->SetChannel(Track::MonoChannel);
@ -106,7 +106,7 @@ bool EffectStereoToMono::ProcessOne(int count)
delete [] leftBuffer;
delete [] rightBuffer;
return true;
return bResult;
}
bool EffectStereoToMono::Process()

View File

@ -856,7 +856,8 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
newTrack->InsertSilence(0.0, t0 - t1);
newTrack->Flush();
wt->Clear(t1, t0);
wxASSERT(wt->Paste(t1, newTrack));
bool bResult = wt->Paste(t1, newTrack);
wxASSERT(bResult); // TO DO: Actually handle this.
delete newTrack;
}
newRecordingTracks.Add(wt);