Update of /cvsroot/audacity/audacity-src/src/effects
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv18903/src/effects

Modified Files:
        DtmfGen.cpp DtmfGen.h Generator.h 
Log Message:
Move DTMF generator parameter-remembering into an Init method so that it is
done at the right time.

(Note when testing that it may have the zero duration still stored)



Index: Generator.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/Generator.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Generator.h 25 Mar 2009 04:14:44 -0000      1.1
+++ Generator.h 18 Jul 2009 19:21:21 -0000      1.2
@@ -37,6 +37,8 @@
                               const WaveTrack &track,
                               int ntrack) = 0;
 
+   virtual bool Init() { return true; }
+
    // Actions to perform at the respective points in the generation process
    virtual void BeforeGenerate() { };
    virtual void BeforeTrack(const WaveTrack &track) { };

Index: DtmfGen.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/DtmfGen.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- DtmfGen.cpp 25 Mar 2009 04:14:43 -0000      1.30
+++ DtmfGen.cpp 18 Jul 2009 19:21:21 -0000      1.31
@@ -51,11 +51,8 @@
 // EffectDtmf
 //
 
-bool EffectDtmf::PromptUser()
+bool EffectDtmf::Init()
 {
-   DtmfDialog dlog(this, mParent, _("DTMF Tone Generator"));
-
-
    // dialog will be passed values from effect
    // Effect retrieves values from saved config
    // Dialog will take care of using them to initialize controls
@@ -66,11 +63,11 @@
    if (mT1 > mT0) {
       // there is a selection: let's fit in there...
       mDuration = mT1 - mT0;
-      dlog.dIsSelection = true;
+      mIsSelection = true;
    } else {
       // retrieve last used values
       gPrefs->Read(wxT("/CsPresets/DtmfGen_SequenceDuration"), &mDuration, 1L);
-      dlog.dIsSelection = false;
+      mIsSelection = false;
    }
    /// \todo this code shouldn't be using /CsPresets - need to review its use
    gPrefs->Read(wxT("/CsPresets/DtmfGen_String"), &dtmfString, 
wxT("audacity"));
@@ -79,7 +76,17 @@
 
    dtmfNTones = wxStrlen(dtmfString);
 
+   return true;
+}
+
+bool EffectDtmf::PromptUser()
+{
+   DtmfDialog dlog(this, mParent, _("DTMF Tone Generator"));
+
+   Init();
+
    // Initialize dialog locals
+   dlog.dIsSelection = mIsSelection;
    dlog.dString = dtmfString;
    dlog.dDutyCycle = dtmfDutyCycle;
    dlog.dDuration = mDuration;

Index: DtmfGen.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/DtmfGen.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- DtmfGen.h   20 May 2009 06:22:49 -0000      1.13
+++ DtmfGen.h   18 Jul 2009 19:21:21 -0000      1.14
@@ -32,7 +32,7 @@
 class EffectDtmf : public Generator {
 
  public:
-   EffectDtmf() {
+   EffectDtmf() : mIsSelection(false) {
       SetEffectFlags(BUILTIN_EFFECT | INSERT_EFFECT);
    }
 
@@ -58,6 +58,7 @@
       return wxString(_("Generating DTMF tones"));
    }
 
+   virtual bool Init();
    virtual bool PromptUser();
    virtual bool TransferParameters( Shuttle & shuttle );
 
@@ -70,6 +71,7 @@
    double dtmfSilence;        // duration of silence between tones in ms
    double dtmfDutyCycle;      // ratio of dtmfTone/(dtmfTone+dtmfSilence)
    double dtmfAmplitude;      // amplitude of dtmf tone sequence, restricted 
to (0-1)
+   bool mIsSelection;
 
  protected:
    virtual bool MakeDtmfTone(float *buffer, sampleCount len, float fs,


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Audacity-cvs mailing list
Audacity-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to