From 835000d916c3a4c3221f532a50a35492fa3d762d Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Fri, 17 Apr 2015 22:52:34 -0500 Subject: [PATCH] Should fix the invalid initial duration for generator effects --- src/effects/DtmfGen.cpp | 1 - src/effects/Effect.cpp | 9 ++++----- src/effects/Generator.h | 5 +---- src/effects/Silence.cpp | 1 - src/effects/ToneGen.cpp | 1 - 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/effects/DtmfGen.cpp b/src/effects/DtmfGen.cpp index 067bceae6..1dab498ea 100644 --- a/src/effects/DtmfGen.cpp +++ b/src/effects/DtmfGen.cpp @@ -62,7 +62,6 @@ EffectDtmf::EffectDtmf() dtmfDutyCycle = DEF_DutyCycle; dtmfAmplitude = DEF_Amplitude; dtmfString = DEF_Sequence; - mDuration = GetDefaultDuration(); dtmfTone = 0.0; dtmfSilence = 0.0; } diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index 75bb92bb6..501aba03c 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -961,9 +961,7 @@ bool Effect::DoEffect(wxWindow *parent, SelectedRegion *selectedRegion, bool shouldPrompt /* = true */) { - double t0 = selectedRegion->t0(); - double t1 = selectedRegion->t1(); - wxASSERT(t0 <= t1); + wxASSERT(selectedRegion->duration() >= 0.0); if (mOutputTracks) { @@ -975,8 +973,9 @@ bool Effect::DoEffect(wxWindow *parent, mProjectRate = projectRate; mParent = parent; mTracks = list; - mT0 = t0; - mT1 = t1; + mT0 = selectedRegion->t0(); + mT1 = selectedRegion->t1(); + mDuration = GetDuration(); #ifdef EXPERIMENTAL_SPECTRAL_EDITING mF0 = selectedRegion->f0(); mF1 = selectedRegion->f1(); diff --git a/src/effects/Generator.h b/src/effects/Generator.h index c18e27267..2083bbf07 100644 --- a/src/effects/Generator.h +++ b/src/effects/Generator.h @@ -24,12 +24,9 @@ class Generator : public Effect { public: - Generator() : mDuration(GetDefaultDuration()) { } + Generator() { } protected: - // Amount of time to generate, in seconds - double mDuration; - // [ GenerateTrack() must be overridden by the actual generator class ] // Precondition: mDuration > 0.0 // Postcondition: is filled with the data intended for diff --git a/src/effects/Silence.cpp b/src/effects/Silence.cpp index f9db05690..8daea7b71 100644 --- a/src/effects/Silence.cpp +++ b/src/effects/Silence.cpp @@ -21,7 +21,6 @@ EffectSilence::EffectSilence() { - mDuration = GetDuration(); } EffectSilence::~EffectSilence() diff --git a/src/effects/ToneGen.cpp b/src/effects/ToneGen.cpp index 69254ba7f..6016d1ea7 100644 --- a/src/effects/ToneGen.cpp +++ b/src/effects/ToneGen.cpp @@ -94,7 +94,6 @@ EffectToneGen::EffectToneGen(bool isChirp) mAmplitude[0] = DEF_StartAmp; mAmplitude[1] = DEF_EndAmp; mInterpolation = DEF_Interp; - mDuration = GetDuration(); for (int i = 0; i < kNumWaveforms; i++) {