Audacity  2.2.2
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 IdentInterfaceSymbol{ XO("Change Tempo") }
34 
35 class EffectChangeTempo final : public EffectSoundTouch
36 {
37 public:
39  virtual ~EffectChangeTempo();
40 
41  // IdentInterface implementation
42 
43  IdentInterfaceSymbol GetSymbol() override;
44  wxString GetDescription() override;
45  wxString ManualPage() override;
46 
47  // EffectDefinitionInterface implementation
48 
49  EffectType GetType() override;
50  bool SupportsAutomation() override;
51 
52  // EffectClientInterface implementation
53 
54  bool DefineParams( ShuttleParams & S ) override;
55  bool GetAutomationParameters(CommandParameters & parms) override;
56  bool SetAutomationParameters(CommandParameters & parms) override;
57 
58  // Effect implementation
59 
60  bool Init() override;
61  bool CheckWhetherSkipEffect() override;
62  bool Process() override;
63  double CalcPreviewInputLength(double previewLength) override;
64  void PopulateOrExchange(ShuttleGui & S) override;
65  bool TransferDataToWindow() override;
66  bool TransferDataFromWindow() override;
67 
68 private:
69  // EffectChangeTempo implementation
70 
71  // handlers
72  void OnText_PercentChange(wxCommandEvent & evt);
73  void OnSlider_PercentChange(wxCommandEvent & evt);
74  void OnText_FromBPM(wxCommandEvent & evt);
75  void OnText_ToBPM(wxCommandEvent & evt);
76  void OnText_ToLength(wxCommandEvent & evt);
77 
78  // helper fns
79  void Update_Text_PercentChange(); // Update control per current m_PercentChange.
80  void Update_Slider_PercentChange(); // Update control per current m_PercentChange.
81  void Update_Text_ToBPM(); // Use m_FromBPM & m_PercentChange to set NEW m_ToBPM & control.
82  void Update_Text_ToLength(); // Use m_FromLength & m_PercentChange to set NEW m_ToLength & control.
83 
84 private:
85  bool mUseSBSMS;
86  double m_PercentChange; // percent change to apply to tempo
87  // -100% is meaningless, but sky's the upper limit
88  double m_FromBPM; // user-set beats-per-minute. Zero means not yet set.
89  double m_ToBPM; // Zero value means not yet set.
90  double m_FromLength; // starting length of selection
91  double m_ToLength; // target length of selection
92 
93  bool m_bLoopDetect;
94 
95  // controls
96  wxTextCtrl * m_pTextCtrl_PercentChange;
97  wxSlider * m_pSlider_PercentChange;
98  wxTextCtrl * m_pTextCtrl_FromBPM;
99  wxTextCtrl * m_pTextCtrl_ToBPM;
100  wxTextCtrl * m_pTextCtrl_FromLength;
101  wxTextCtrl * m_pTextCtrl_ToLength;
102 
103 #if USE_SBSMS
104  wxCheckBox * mUseSBSMSCheckBox;
105 #endif
106 
107  DECLARE_EVENT_TABLE()
108 };
109 
110 #endif // __AUDACITY_EFFECT_CHANGETEMPO__
111 
112 #endif // USE_SOUNDTOUCH
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
Shuttle that deals with parameters. This is a base class with lots of virtual functions that do nothi...
Definition: Shuttle.h:60
An EffectSoundTouch provides speeding up or slowing down tempo without changing pitch.
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the Shuttle cla...
IdentInterfaceSymbol pairs a persistent string identifier used internally with an optional...
EffectType