Audacity  2.2.0
ChangeTempo.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  ChangeTempo.h
6 
7  Vaughan Johnson, Dominic Mazzoni
8 
9  Change Tempo effect provides speeding up or
10  slowing down tempo without changing pitch.
11 
12 **********************************************************************/
13 
14 #if USE_SOUNDTOUCH
15 
16 #ifndef __AUDACITY_EFFECT_CHANGETEMPO__
17 #define __AUDACITY_EFFECT_CHANGETEMPO__
18 
19 #if USE_SBSMS
20 #include "SBSMSEffect.h"
21 #include <wx/checkbox.h>
22 #endif
23 
24 #include <wx/event.h>
25 #include <wx/slider.h>
26 #include <wx/string.h>
27 #include <wx/textctrl.h>
28 
29 #include "SoundTouchEffect.h"
30 
31 class ShuttleGui;
32 
33 #define CHANGETEMPO_PLUGIN_SYMBOL XO("Change Tempo")
34 
35 class EffectChangeTempo final : public EffectSoundTouch
36 {
37 public:
39  virtual ~EffectChangeTempo();
40 
41  // IdentInterface implementation
42 
43  wxString GetSymbol() override;
44  wxString GetDescription() override;
45  wxString ManualPage() override;
46 
47  // EffectIdentInterface implementation
48 
49  EffectType GetType() override;
50  bool SupportsAutomation() override;
51 
52  // EffectClientInterface implementation
53 
54  bool GetAutomationParameters(EffectAutomationParameters & parms) override;
55  bool SetAutomationParameters(EffectAutomationParameters & parms) override;
56 
57  // Effect implementation
58 
59  bool Init() override;
60  bool CheckWhetherSkipEffect() override;
61  bool Process() override;
62  double CalcPreviewInputLength(double previewLength) override;
63  void PopulateOrExchange(ShuttleGui & S) override;
64  bool TransferDataToWindow() override;
65  bool TransferDataFromWindow() override;
66 
67 private:
68  // EffectChangeTempo implementation
69 
70  // handlers
71  void OnText_PercentChange(wxCommandEvent & evt);
72  void OnSlider_PercentChange(wxCommandEvent & evt);
73  void OnText_FromBPM(wxCommandEvent & evt);
74  void OnText_ToBPM(wxCommandEvent & evt);
75  void OnText_ToLength(wxCommandEvent & evt);
76 
77  // helper fns
78  void Update_Text_PercentChange(); // Update control per current m_PercentChange.
79  void Update_Slider_PercentChange(); // Update control per current m_PercentChange.
80  void Update_Text_ToBPM(); // Use m_FromBPM & m_PercentChange to set NEW m_ToBPM & control.
81  void Update_Text_ToLength(); // Use m_FromLength & m_PercentChange to set NEW m_ToLength & control.
82 
83 private:
84  bool mUseSBSMS;
85  double m_PercentChange; // percent change to apply to tempo
86  // -100% is meaningless, but sky's the upper limit
87  double m_FromBPM; // user-set beats-per-minute. Zero means not yet set.
88  double m_ToBPM; // Zero value means not yet set.
89  double m_FromLength; // starting length of selection
90  double m_ToLength; // target length of selection
91 
92  bool m_bLoopDetect;
93 
94  // controls
95  wxTextCtrl * m_pTextCtrl_PercentChange;
96  wxSlider * m_pSlider_PercentChange;
97  wxTextCtrl * m_pTextCtrl_FromBPM;
98  wxTextCtrl * m_pTextCtrl_ToBPM;
99  wxTextCtrl * m_pTextCtrl_FromLength;
100  wxTextCtrl * m_pTextCtrl_ToLength;
101 
102 #if USE_SBSMS
103  wxCheckBox * mUseSBSMSCheckBox;
104 #endif
105 
106  DECLARE_EVENT_TABLE()
107 };
108 
109 #endif // __AUDACITY_EFFECT_CHANGETEMPO__
110 
111 #endif // USE_SOUNDTOUCH
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:369
An EffectSoundTouch provides speeding up or slowing down tempo without changing pitch.