diff --git a/src/Menus.cpp b/src/Menus.cpp index 61e1ff52e..18c4bf000 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -4428,8 +4428,8 @@ void AudacityProject::OnPaste() wxASSERT( n && c ); if (c->GetKind() == Track::Wave && n->GetKind() == Track::Wave) { - bPastedSomething |= - ((WaveTrack*)n)->ClearAndPaste(t0, t1, (WaveTrack*)c, true, true); + bPastedSomething = true; + ((WaveTrack*)n)->ClearAndPaste(t0, t1, (WaveTrack*)c, true, true); } else if (c->GetKind() == Track::Label && n->GetKind() == Track::Label) @@ -4457,7 +4457,8 @@ void AudacityProject::OnPaste() n = iter.Next(); if (n->GetKind() == Track::Wave) { - bPastedSomething |= ((WaveTrack *)n)->ClearAndPaste(t0, t1, c, true, true); + bPastedSomething = true; + ((WaveTrack *)n)->ClearAndPaste(t0, t1, c, true, true); } else { @@ -4497,16 +4498,16 @@ void AudacityProject::OnPaste() if (n->GetSelected() && n->GetKind()==Track::Wave) { if (c) { wxASSERT(c->GetKind() == Track::Wave); - bPastedSomething |= - ((WaveTrack *)n)->ClearAndPaste(t0, t1, (WaveTrack *)c, true, true); + bPastedSomething = true; + ((WaveTrack *)n)->ClearAndPaste(t0, t1, (WaveTrack *)c, true, true); } else { auto tmp = mTrackFactory->NewWaveTrack( ((WaveTrack*)n)->GetSampleFormat(), ((WaveTrack*)n)->GetRate()); tmp->InsertSilence(0.0, msClipT1 - msClipT0); // MJS: Is this correct? tmp->Flush(); - bPastedSomething |= - ((WaveTrack *)n)->ClearAndPaste(t0, t1, tmp.get(), true, true); + bPastedSomething = true; + ((WaveTrack *)n)->ClearAndPaste(t0, t1, tmp.get(), true, true); } } else if (n->GetKind() == Track::Label && n->GetSelected()) @@ -4947,7 +4948,7 @@ void AudacityProject::OnCutLabels() if( gPrefs->Read( wxT( "/GUI/EnableCutLines" ), ( long )0 ) ) EditByLabel( &WaveTrack::ClearAndAddCutLine, true ); else - EditByLabel( &WaveTrack::Clear1, true ); + EditByLabel( &WaveTrack::Clear, true ); msClipProject = this; @@ -5001,7 +5002,7 @@ void AudacityProject::OnDeleteLabels() if( mViewInfo.selectedRegion.isPoint() ) return; - EditByLabel( &WaveTrack::Clear1, true ); + EditByLabel( &WaveTrack::Clear, true ); mViewInfo.selectedRegion.collapseToT0(); @@ -5035,7 +5036,7 @@ void AudacityProject::OnSilenceLabels() if( mViewInfo.selectedRegion.isPoint() ) return; - EditByLabel( &WaveTrack::Silence1, false ); + EditByLabel( &WaveTrack::Silence, false ); PushState( /* i18n-hint: (verb)*/ @@ -7237,8 +7238,7 @@ void AudacityProject::OnResample() // But the thrown exception will cause rollback in the application // level handler. - if (!((WaveTrack*)t)->Resample(newRate, &progress)) - break; + ((WaveTrack*)t)->Resample(newRate, &progress); // Each time a track is successfully, completely resampled, // commit that to the undo stack. The second and later times, diff --git a/src/Project.h b/src/Project.h index 971c92006..0c6c88b44 100644 --- a/src/Project.h +++ b/src/Project.h @@ -382,7 +382,7 @@ public: void SkipEnd(bool shift); - typedef bool (WaveTrack::* EditFunction)(double, double); + typedef void (WaveTrack::* EditFunction)(double, double); typedef std::unique_ptr (WaveTrack::* EditDestFunction)(double, double); void EditByLabel(EditFunction action, bool bSyncLockedTracks); diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index 14a71406e..8ccc83a28 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -6283,25 +6283,14 @@ bool TrackPanel::HandleTrackLocationMouseEvent(WaveTrack * track, const wxRect & // When user presses left button on cut line, expand the line again double cutlineStart = 0, cutlineEnd = 0; - if (track->ExpandCutLine(mCapturedTrackLocation.pos, &cutlineStart, &cutlineEnd)) + track->ExpandCutLine(mCapturedTrackLocation.pos, &cutlineStart, &cutlineEnd); { // Assume linked track is wave or null const auto linked = static_cast(track->GetLink()); - if (linked) { + if (linked) // Expand the cutline in the opposite channel if it is present. - - // PRL: Do NOT report that the event is not handled if the other - // channel doesn't also have a cutline to expand at the same time. - // Just ignore the return. Bug1310. - - /* bool success = */ - linked->ExpandCutLine(mCapturedTrackLocation.pos); - /* - if (!success) - return false; - */ - } + linked->ExpandCutLine(mCapturedTrackLocation.pos); mViewInfo->selectedRegion.setTimes(cutlineStart, cutlineEnd); DisplaySelection(); @@ -6311,8 +6300,7 @@ bool TrackPanel::HandleTrackLocationMouseEvent(WaveTrack * track, const wxRect & } else if (mCapturedTrackLocation.typ == WaveTrackLocation::locationMergePoint) { const double pos = mCapturedTrackLocation.pos; - if (!track->MergeClips(mCapturedTrackLocation.clipidx1, mCapturedTrackLocation.clipidx2)) - return false; + track->MergeClips(mCapturedTrackLocation.clipidx1, mCapturedTrackLocation.clipidx2); // Assume linked track is wave or null const auto linked = @@ -6322,8 +6310,7 @@ bool TrackPanel::HandleTrackLocationMouseEvent(WaveTrack * track, const wxRect & int idx = FindMergeLine(linked, pos); if (idx >= 0) { WaveTrack::Location location = linked->GetCachedLocations()[idx]; - if (!linked->MergeClips(location.clipidx1, location.clipidx2)) - return false; + linked->MergeClips(location.clipidx1, location.clipidx2); } } @@ -8338,16 +8325,12 @@ void TrackPanel::OnFormatChange(wxCommandEvent & event) if (newFormat == ((WaveTrack*)mPopupMenuTarget)->GetSampleFormat()) return; // Nothing to do. - bool bResult = ((WaveTrack*)mPopupMenuTarget)->ConvertToSampleFormat(newFormat); - wxASSERT(bResult); // TO DO: Actually handle this. + ((WaveTrack*)mPopupMenuTarget)->ConvertToSampleFormat(newFormat); // Assume linked track is wave or null const auto partner = static_cast(mPopupMenuTarget->GetLink()); if (partner) - { - bResult = partner->ConvertToSampleFormat(newFormat); - wxASSERT(bResult); // TO DO: Actually handle this. - } + partner->ConvertToSampleFormat(newFormat); MakeParentPushState(wxString::Format(_("Changed '%s' to %s"), mPopupMenuTarget->GetName(). diff --git a/src/WaveTrack.cpp b/src/WaveTrack.cpp index b5d864aab..b803273b9 100644 --- a/src/WaveTrack.cpp +++ b/src/WaveTrack.cpp @@ -501,13 +501,13 @@ float WaveTrack::GetChannelGain(int channel) const return right*mGain; } -bool WaveTrack::ConvertToSampleFormat(sampleFormat format) +void WaveTrack::ConvertToSampleFormat(sampleFormat format) +// WEAK-GUARANTEE +// might complete on only some tracks { for (const auto &clip : mClips) clip->ConvertToSampleFormat(format); mFormat = format; - - return true; } bool WaveTrack::IsEmpty(double t0, double t1) const @@ -551,9 +551,7 @@ Track::Holder WaveTrack::SplitCut(double t0, double t1) // SplitCut is the same as 'Copy', then 'SplitDelete' auto tmp = Copy(t0, t1); - if (!SplitDelete(t0, t1)) - //THROW_INCONSISTENCY_EXCEPTION - ; + SplitDelete(t0, t1); return tmp; } @@ -580,7 +578,7 @@ Track::Holder WaveTrack::CutAndAddCutLine(double t0, double t1) //Trim trims within a clip, rather than trimming everything. //If a bound is outside a clip, it trims everything. -bool WaveTrack::Trim (double t0, double t1) +void WaveTrack::Trim (double t0, double t1) { bool inside0 = false; bool inside1 = false; @@ -599,14 +597,14 @@ bool WaveTrack::Trim (double t0, double t1) if(t1 > clip->GetStartTime() && t1 < clip->GetEndTime()) { if (!clip->Clear(t1,clip->GetEndTime())) - return false; + return; inside1 = true; } if(t0 > clip->GetStartTime() && t0 < clip->GetEndTime()) { if (!clip->Clear(clip->GetStartTime(),t0)) - return false; + return; clip->SetOffset(t0); inside0 = true; } @@ -618,12 +616,7 @@ bool WaveTrack::Trim (double t0, double t1) Clear(t1,GetEndTime()); if(false == inside0) - { - if (!SplitDelete(0,t0)) - return false; - } - - return true; + SplitDelete(0,t0); } @@ -713,9 +706,9 @@ void WaveTrack::Clear(double t0, double t1) HandleClear(t0, t1, false, false); } -bool WaveTrack::ClearAndAddCutLine(double t0, double t1) +void WaveTrack::ClearAndAddCutLine(double t0, double t1) { - return HandleClear(t0, t1, true, false); + HandleClear(t0, t1, true, false); } const SpectrogramSettings &WaveTrack::GetSpectrogramSettings() const @@ -793,7 +786,7 @@ void WaveTrack::SetWaveformSettings(std::unique_ptr &&pSetting // be pasted with visible split lines. Normally, effects do not // want these extra lines, so they may be merged out. // -bool WaveTrack::ClearAndPaste(double t0, // Start of time to clear +void WaveTrack::ClearAndPaste(double t0, // Start of time to clear double t1, // End of time to clear const Track *src, // What to paste bool preserve, // Whether to reinsert splits/cuts @@ -808,7 +801,7 @@ bool WaveTrack::ClearAndPaste(double t0, // Start of time to clear // If duration is 0, then it's just a plain paste if (dur == 0.0) { Paste(t0, src); - return true; + return; } // If provided time warper was NULL, use a default one that does nothing @@ -860,7 +853,8 @@ bool WaveTrack::ClearAndPaste(double t0, // Start of time to clear const auto tolerance = 2.0 / GetRate(); // Now, clear the selection - if (HandleClear(t0, t1, false, false)) { + HandleClear(t0, t1, false, false); + { // And paste in the NEW data Paste(t0, src); @@ -882,11 +876,8 @@ bool WaveTrack::ClearAndPaste(double t0, // Start of time to clear // Merge this clip and the previous clip if the end time // falls within it and this isn't the first clip in the track. if (fabs(t1 - clip->GetStartTime()) < tolerance) { - if (prev) { - bool bResult = MergeClips(GetClipIndex(prev), GetClipIndex(clip)); - wxASSERT(bResult); // TO DO: Actually handle this. - wxUnusedVar(bResult); - } + if (prev) + MergeClips(GetClipIndex(prev), GetClipIndex(clip)); break; } prev = clip; @@ -902,9 +893,7 @@ bool WaveTrack::ClearAndPaste(double t0, // Start of time to clear WaveClip *prev = nullptr; for (const auto clip : clips) { if (prev) { - bool bResult = MergeClips(GetClipIndex(prev), GetClipIndex(clip)); - wxASSERT(bResult); // TO DO: Actually handle this. - wxUnusedVar(bResult); + MergeClips(GetClipIndex(prev), GetClipIndex(clip)); break; } if (fabs(t0 - clip->GetEndTime()) < tolerance) @@ -952,15 +941,13 @@ bool WaveTrack::ClearAndPaste(double t0, // Start of time to clear } } } - - return true; } -bool WaveTrack::SplitDelete(double t0, double t1) +void WaveTrack::SplitDelete(double t0, double t1) { bool addCutLines = false; bool split = true; - return HandleClear(t0, t1, addCutLines, split); + HandleClear(t0, t1, addCutLines, split); } namespace @@ -1018,11 +1005,12 @@ void WaveTrack::AddClip(movable_ptr &&clip) mClips.push_back(std::move(clip)); // transfer ownership } -bool WaveTrack::HandleClear(double t0, double t1, +void WaveTrack::HandleClear(double t0, double t1, bool addCutLines, bool split) { if (t1 < t0) - return false; + // THROW_INCONSISTENCY_EXCEPTION; // ? + return; bool editClipCanMove = true; gPrefs->Read(wxT("/GUI/EditClipCanMove"), &editClipCanMove); @@ -1057,8 +1045,7 @@ bool WaveTrack::HandleClear(double t0, double t1, // Clip data is affected by command if (addCutLines) { - if (!clip->ClearAndAddCutLine(t0,t1)) - return false; + clip->ClearAndAddCutLine(t0,t1); } else { @@ -1140,8 +1127,6 @@ bool WaveTrack::HandleClear(double t0, double t1, for (auto &clip: clipsToAdd) mClips.push_back(std::move(clip)); // transfer ownership - - return true; } void WaveTrack::SyncLockAdjust(double oldT1, double newT1) @@ -1412,7 +1397,7 @@ void WaveTrack::InsertSilence(double t, double len) //Performs the opposite of Join //Analyses selected region for possible Joined clips and disjoins them -bool WaveTrack::Disjoin(double t0, double t1) +void WaveTrack::Disjoin(double t0, double t1) { auto minSamples = TimeToLongSamples( WAVETRACK_MERGE_POINT_TOLERANCE ); const size_t maxAtOnce = 1048576; @@ -1487,11 +1472,9 @@ bool WaveTrack::Disjoin(double t0, double t1) const Region ®ion = regions.at(i); SplitDelete(region.start, region.end ); } - - return true; } -bool WaveTrack::Join(double t0, double t1) +void WaveTrack::Join(double t0, double t1) { // Merge all WaveClips overlapping selection into one @@ -1515,7 +1498,7 @@ bool WaveTrack::Join(double t0, double t1) //if there are no clips to DELETE, nothing to do if( clipsToDelete.size() == 0 ) - return true; + return; newClip = CreateClip(); double t = clipsToDelete[0]->GetOffset(); @@ -1528,9 +1511,7 @@ 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"); - bool bResult = newClip->InsertSilence(t, addedSilence); - wxASSERT(bResult); // TO DO: Actually handle this. - wxUnusedVar(bResult); + newClip->InsertSilence(t, addedSilence); t += addedSilence; } @@ -1543,29 +1524,26 @@ bool WaveTrack::Join(double t0, double t1) auto it = FindClip(mClips, clip); mClips.erase(it); // deletes the clip } - - return true; } -bool WaveTrack::Append(samplePtr buffer, sampleFormat format, +void WaveTrack::Append(samplePtr buffer, sampleFormat format, size_t len, unsigned int stride /* = 1 */, XMLWriter *blockFileLog /* = NULL */) { - return RightmostOrNewClip()->Append(buffer, format, len, stride, + RightmostOrNewClip()->Append(buffer, format, len, stride, blockFileLog); } -bool WaveTrack::AppendAlias(const wxString &fName, sampleCount start, +void WaveTrack::AppendAlias(const wxString &fName, sampleCount start, size_t len, int channel,bool useOD) { - return RightmostOrNewClip()->AppendAlias(fName, start, len, channel, useOD); + RightmostOrNewClip()->AppendAlias(fName, start, len, channel, useOD); } - -bool WaveTrack::AppendCoded(const wxString &fName, sampleCount start, +void WaveTrack::AppendCoded(const wxString &fName, sampleCount start, size_t len, int channel, int decodeType) { - return RightmostOrNewClip()->AppendCoded(fName, start, len, channel, decodeType); + RightmostOrNewClip()->AppendCoded(fName, start, len, channel, decodeType); } ///gets an int with OD flags so that we can determine which ODTasks should be run on this track after save/open, etc. @@ -1636,10 +1614,10 @@ size_t WaveTrack::GetIdealBlockSize() return NewestOrNewClip()->GetSequence()->GetIdealBlockSize(); } -bool WaveTrack::Flush() +void WaveTrack::Flush() { // After appending, presumably. Do this to the clip that gets appended. - return RightmostOrNewClip()->Flush(); + RightmostOrNewClip()->Flush(); } bool WaveTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs) @@ -2039,11 +2017,9 @@ bool WaveTrack::Get(samplePtr buffer, sampleFormat format, return result; } -bool WaveTrack::Set(samplePtr buffer, sampleFormat format, +void WaveTrack::Set(samplePtr buffer, sampleFormat format, sampleCount start, size_t len) { - bool result = true; - for (const auto &clip: mClips) { auto clipStart = clip->GetStartSample(); @@ -2080,13 +2056,11 @@ bool WaveTrack::Set(samplePtr buffer, sampleFormat format, format, inclipDelta, samplesToCopy.as_size_t() )) { wxASSERT(false); // should always work - return false; + return; } clip->MarkChanged(); } } - - return result; } void WaveTrack::GetEnvelopeValues(double *buffer, size_t bufferLen, @@ -2321,15 +2295,14 @@ bool WaveTrack::CanInsertClip(WaveClip* clip) return true; } -bool WaveTrack::Split( double t0, double t1 ) +void WaveTrack::Split( double t0, double t1 ) { - bool ret = SplitAt( t0 ); - if( ret && t0 != t1 ) - ret = SplitAt( t1 ); - return ret; + SplitAt( t0 ); + if( t0 != t1 ) + SplitAt( t1 ); } -bool WaveTrack::SplitAt(double t) +void WaveTrack::SplitAt(double t) { for (const auto &c : mClips) { @@ -2346,11 +2319,11 @@ bool WaveTrack::SplitAt(double t) auto newClip = make_movable( *c, mDirManager, true ); if (!c->Clear(t, c->GetEndTime())) { - return false; + return; } if (!newClip->Clear(c->GetStartTime(), t)) { - return false; + return; } //offset the NEW clip by the splitpoint (noting that it is already offset to c->GetStartTime()) @@ -2359,11 +2332,8 @@ bool WaveTrack::SplitAt(double t) // This could invalidate the iterators for the loop! But we return // at once so it's okay mClips.push_back(std::move(newClip)); // transfer ownership - return true; } } - - return true; } void WaveTrack::UpdateLocationsCache() const @@ -2433,7 +2403,7 @@ void WaveTrack::UpdateLocationsCache() const } // Expand cut line (that is, re-insert audio, then DELETE audio saved in cut line) -bool WaveTrack::ExpandCutLine(double cutLinePosition, double* cutlineStart, +void WaveTrack::ExpandCutLine(double cutLinePosition, double* cutlineStart, double* cutlineEnd) // STRONG-GUARANTEE { @@ -2465,7 +2435,7 @@ bool WaveTrack::ExpandCutLine(double cutLinePosition, double* cutlineStart, } if (!clip->ExpandCutLine(cutLinePosition)) - return false; + return; // STRONG-GUARANTEE provided that the following gives NOFAIL-GUARANTEE @@ -2482,12 +2452,8 @@ bool WaveTrack::ExpandCutLine(double cutLinePosition, double* cutlineStart, if (clip2->GetStartTime() > clip->GetStartTime()) clip2->Offset(end - start); } - - return true; } } - - return false; } bool WaveTrack::RemoveCutLine(double cutLinePosition) @@ -2499,26 +2465,26 @@ bool WaveTrack::RemoveCutLine(double cutLinePosition) return false; } -bool WaveTrack::MergeClips(int clipidx1, int clipidx2) +void WaveTrack::MergeClips(int clipidx1, int clipidx2) { WaveClip* clip1 = GetClipByIndex(clipidx1); WaveClip* clip2 = GetClipByIndex(clipidx2); if (!clip1 || !clip2) // Could happen if one track of a linked pair had a split and the other didn't. - return false; + return; // Don't throw, just do nothing. // Append data from second clip to first clip if (!clip1->Paste(clip1->GetEndTime(), clip2)) - return false; + return; // Delete second clip auto it = FindClip(mClips, clip2); mClips.erase(it); - - return true; } -bool WaveTrack::Resample(int rate, ProgressDialog *progress) +void WaveTrack::Resample(int rate, ProgressDialog *progress) +// WEAK-GUARANTEE +// Partial completion may leave clips at differing sample rates! { for (const auto &clip : mClips) if (!clip->Resample(rate, progress)) @@ -2530,8 +2496,6 @@ bool WaveTrack::Resample(int rate, ProgressDialog *progress) } mRate = rate; - - return true; } namespace { diff --git a/src/WaveTrack.h b/src/WaveTrack.h index c7b8f876d..5aa22d967 100644 --- a/src/WaveTrack.h +++ b/src/WaveTrack.h @@ -150,7 +150,7 @@ class AUDACITY_DLL_API WaveTrack final : public PlayableTrack { void SetVirtualState(bool state, bool half=false); #endif sampleFormat GetSampleFormat() const { return mFormat; } - bool ConvertToSampleFormat(sampleFormat format); + void ConvertToSampleFormat(sampleFormat format); const SpectrogramSettings &GetSpectrogramSettings() const; SpectrogramSettings &GetSpectrogramSettings(); @@ -176,31 +176,29 @@ class AUDACITY_DLL_API WaveTrack final : public PlayableTrack { Track::Holder CopyNonconst(double t0, double t1) /* not override */; void Clear(double t0, double t1) override; - bool Clear1(double t0, double t1) { Clear(t0, t1); return true; } void Paste(double t0, const Track *src) override; - bool ClearAndPaste(double t0, double t1, + void ClearAndPaste(double t0, double t1, const Track *src, bool preserve = true, bool merge = true, const TimeWarper *effectWarper = NULL) /* not override */; void Silence(double t0, double t1) override; - bool Silence1(double t0, double t1) { Silence(t0, t1); return true; } void InsertSilence(double t, double len) override; - bool SplitAt(double t) /* not override */; - bool Split(double t0, double t1) /* not override */; + void SplitAt(double t) /* not override */; + void Split(double t0, double t1) /* not override */; // Track::Holder CutAndAddCutLine(double t0, double t1) /* not override */; - bool ClearAndAddCutLine(double t0, double t1) /* not override */; + void ClearAndAddCutLine(double t0, double t1) /* not override */; Track::Holder SplitCut(double t0, double t1) /* not override */; - bool SplitDelete(double t0, double t1) /* not override */; - bool Join(double t0, double t1) /* not override */; - bool Disjoin(double t0, double t1) /* not override */; + void SplitDelete(double t0, double t1) /* not override */; + void Join(double t0, double t1) /* not override */; + void Disjoin(double t0, double t1) /* not override */; - bool Trim(double t0, double t1) /* not override */; + void Trim(double t0, double t1) /* not override */; - bool HandleClear(double t0, double t1, bool addCutLines, bool split); + void HandleClear(double t0, double t1, bool addCutLines, bool split); void SyncLockAdjust(double oldT1, double newT1) override; @@ -218,20 +216,20 @@ class AUDACITY_DLL_API WaveTrack final : public PlayableTrack { * appended to that clip. If there are no WaveClips in the track, then a NEW * one is created. */ - bool Append(samplePtr buffer, sampleFormat format, + void Append(samplePtr buffer, sampleFormat format, size_t len, unsigned int stride=1, XMLWriter* blockFileLog=NULL); /// Flush must be called after last Append - bool Flush(); + void Flush(); - bool AppendAlias(const wxString &fName, sampleCount start, + void AppendAlias(const wxString &fName, sampleCount start, size_t len, int channel,bool useOD); ///for use with On-Demand decoding of compressed files. ///decodeType should be an enum from ODDecodeTask that specifies what ///Type of encoded file this is, such as eODFLAC //vvv Why not use the ODTypeEnum typedef to enforce that for the parameter? - bool AppendCoded(const wxString &fName, sampleCount start, + void AppendCoded(const wxString &fName, sampleCount start, size_t len, int channel, int decodeType); ///gets an int with OD flags so that we can determine which ODTasks should be run on this track after save/open, etc. @@ -256,7 +254,7 @@ class AUDACITY_DLL_API WaveTrack final : public PlayableTrack { bool Get(samplePtr buffer, sampleFormat format, sampleCount start, size_t len, fillFormat fill = fillZero, bool mayThrow = true) const; - bool Set(samplePtr buffer, sampleFormat format, + void Set(samplePtr buffer, sampleFormat format, sampleCount start, size_t len); void GetEnvelopeValues(double *buffer, size_t bufferLen, double t0) const; @@ -488,7 +486,7 @@ class AUDACITY_DLL_API WaveTrack final : public PlayableTrack { // Merge two clips, that is append data from clip2 to clip1, // then remove clip2 from track. // clipidx1 and clipidx2 are indices into the clip list. - bool MergeClips(int clipidx1, int clipidx2); + void MergeClips(int clipidx1, int clipidx2); // Cache special locations (e.g. cut lines) for later speedy access void UpdateLocationsCache() const; @@ -497,7 +495,7 @@ class AUDACITY_DLL_API WaveTrack final : public PlayableTrack { const std::vector &GetCachedLocations() const { return mDisplayLocationsCache; } // Expand cut line (that is, re-insert audio, then DELETE audio saved in cut line) - bool ExpandCutLine(double cutLinePosition, double* cutlineStart = NULL, double* cutlineEnd = NULL); + void ExpandCutLine(double cutLinePosition, double* cutlineStart = NULL, double* cutlineEnd = NULL); // Remove cut line, without expanding the audio in it bool RemoveCutLine(double cutLinePosition); @@ -507,7 +505,7 @@ class AUDACITY_DLL_API WaveTrack final : public PlayableTrack { void Merge(const Track &orig) override; // Resample track (i.e. all clips in the track) - bool Resample(int rate, ProgressDialog *progress = NULL); + void Resample(int rate, ProgressDialog *progress = NULL); // // AutoSave related diff --git a/src/effects/ChangeSpeed.cpp b/src/effects/ChangeSpeed.cpp index 17fb84cfe..d764bbce4 100644 --- a/src/effects/ChangeSpeed.cpp +++ b/src/effects/ChangeSpeed.cpp @@ -539,7 +539,7 @@ bool EffectChangeSpeed::ProcessOne(WaveTrack * track, if (bResult) { LinearTimeWarper warper { mCurT0, mCurT0, mCurT1, mCurT0 + newLength }; - bResult = track->ClearAndPaste( + track->ClearAndPaste( mCurT0, mCurT1, outputTrack.get(), true, false, &warper); } diff --git a/src/effects/Generator.cpp b/src/effects/Generator.cpp index c366aed1e..48c025a2a 100644 --- a/src/effects/Generator.cpp +++ b/src/effects/Generator.cpp @@ -80,7 +80,7 @@ bool Generator::Process() tmp->Flush(); StepTimeWarper warper{ mT0+GetDuration(), GetDuration()-(mT1-mT0) }; - bGoodResult = track->ClearAndPaste( + track->ClearAndPaste( p->GetSel0(), p->GetSel1(), &*tmp, true, false, &warper); } diff --git a/src/effects/NoiseReduction.cpp b/src/effects/NoiseReduction.cpp index 647879780..01192b3be 100644 --- a/src/effects/NoiseReduction.cpp +++ b/src/effects/NoiseReduction.cpp @@ -1333,9 +1333,7 @@ bool EffectNoiseReduction::Worker::ProcessOne double tLen = outputTrack->LongSamplesToTime(len); // Filtering effects always end up with more data than they started with. Delete this 'tail'. outputTrack->HandleClear(tLen, outputTrack->GetEndTime(), false, false); - bool bResult = track->ClearAndPaste(t0, t0 + tLen, &*outputTrack, true, false); - wxASSERT(bResult); // TO DO: Actually handle this. - wxUnusedVar(bResult); + track->ClearAndPaste(t0, t0 + tLen, &*outputTrack, true, false); } return bLoopSuccess; diff --git a/src/effects/NoiseRemoval.cpp b/src/effects/NoiseRemoval.cpp index 761bf6098..5a12c0693 100644 --- a/src/effects/NoiseRemoval.cpp +++ b/src/effects/NoiseRemoval.cpp @@ -575,8 +575,7 @@ 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); - bool bResult = track->ClearAndPaste(t0, t0 + tLen, mOutputTrack.get(), true, false); - wxASSERT(bResult); // TO DO: Actually handle this. + track->ClearAndPaste(t0, t0 + tLen, mOutputTrack.get(), true, false); } } diff --git a/src/effects/SBSMSEffect.cpp b/src/effects/SBSMSEffect.cpp index 8278cd7ac..eb7336d49 100644 --- a/src/effects/SBSMSEffect.cpp +++ b/src/effects/SBSMSEffect.cpp @@ -440,19 +440,12 @@ bool EffectSBSMS::Process() if(rightTrack) rb.outputRightTrack->Flush(); - bool bResult = leftTrack->ClearAndPaste(mCurT0, mCurT1, rb.outputLeftTrack.get(), true, false, warper.get()); - wxASSERT(bResult); // TO DO: Actually handle this. - wxUnusedVar(bResult); if(rightTrack) - { - bResult = rightTrack->ClearAndPaste(mCurT0, mCurT1, rb.outputRightTrack.get(), true, false, warper.get()); - wxASSERT(bResult); // TO DO: Actually handle this. - } } } mCurTrackNum++; diff --git a/src/effects/StereoToMono.cpp b/src/effects/StereoToMono.cpp index 35cd7e2a7..6599f38f4 100644 --- a/src/effects/StereoToMono.cpp +++ b/src/effects/StereoToMono.cpp @@ -157,14 +157,14 @@ bool EffectStereoToMono::ProcessOne(int count) curMonoFrame = (curLeftFrame + curRightFrame) / 2.0; leftBuffer[i] = curMonoFrame; } - bResult &= mOutTrack->Append((samplePtr)leftBuffer.get(), floatSample, limit); + mOutTrack->Append((samplePtr)leftBuffer.get(), floatSample, limit); if (TrackProgress(count, 2.*(index.as_double() / (mEnd - mStart).as_double()))) return false; } double minStart = wxMin(mLeftTrack->GetStartTime(), mRightTrack->GetStartTime()); mLeftTrack->Clear(mLeftTrack->GetStartTime(), mLeftTrack->GetEndTime()); - bResult &= mOutTrack->Flush(); + mOutTrack->Flush(); mLeftTrack->Paste(minStart, mOutTrack.get()); mLeftTrack->SetLinked(false); mRightTrack->SetLinked(false); diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index 717c1a33e..9b4b2b275 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -1880,11 +1880,9 @@ int NyquistEffect::PutCallback(float *buffer, int channel, } } - if (mOutputTrack[channel]->Append((samplePtr)buffer, floatSample, len)) { - return 0; // success - } + mOutputTrack[channel]->Append((samplePtr)buffer, floatSample, len); - return -1; // failure + return 0; // success }, MakeSimpleGuard( -1 ) ); // translate all exceptions into failure }