Audacity 3.2.0
Paulstretch.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 Paulstretch.cpp
6
7 Nasca Octavian Paul (Paul Nasca)
8 Some GUI code was taken from the Echo effect
9
10**********************************************************************/
11#include "Paulstretch.h"
12#include "../widgets/valnum.h"
13#include "AudacityMessageBox.h"
14#include "EffectEditor.h"
15#include "LoadEffects.h"
16#include "ShuttleGui.h"
17#include <wx/valgen.h>
18
19//
20// PaulstretchBase
21//
22
24
25BEGIN_EVENT_TABLE(EffectPaulstretch, wxEvtHandler)
26 EVT_TEXT(wxID_ANY, EffectPaulstretch::OnText)
28
29std::unique_ptr<EffectEditor> EffectPaulstretch::PopulateOrExchange(
31 const EffectOutputs *)
32{
33 mUIParent = S.GetParent();
34 S.StartMultiColumn(2, wxALIGN_CENTER);
35 {
36 S
37 .Validator<FloatingPointValidator<float>>(
38 1, &mAmount, NumValidatorStyle::DEFAULT, Amount.min)
39 /* i18n-hint: This is how many times longer the sound will be, e.g. applying
40 * the effect to a 1-second sample, with the default Stretch Factor of 10.0
41 * will give an (approximately) 10 second sound
42 */
43 .AddTextBox(XXO("&Stretch Factor:"), wxT(""), 10);
44
45 S
46 .Validator<FloatingPointValidator<float>>(
47 3, &mTime_resolution, NumValidatorStyle::ONE_TRAILING_ZERO, Time.min)
48 .AddTextBox(XXO("&Time Resolution (seconds):"), L"", 10);
49 }
50 S.EndMultiColumn();
51 return nullptr;
52};
53
55{
56 if (!mUIParent->TransferDataToWindow())
57 {
58 return false;
59 }
60
61 return true;
62}
63
65{
66 if (!mUIParent->Validate() || !mUIParent->TransferDataFromWindow())
67 {
68 return false;
69 }
70
71 return true;
72}
73
74// EffectPaulstretch implementation
75
76void EffectPaulstretch::OnText(wxCommandEvent & WXUNUSED(evt))
77{
79 mUIParent, mUIParent->TransferDataFromWindow());
80}
wxT("CloseDown"))
END_EVENT_TABLE()
XXO("&Cut/Copy/Paste Toolbar")
#define S(N)
Definition: ToChars.cpp:64
static bool EnableApply(wxWindow *parent, bool enable=true)
Enable or disable the Apply button of the dialog that contains parent.
Performs effect computation.
Hold values to send to effect output meters.
bool TransferDataToWindow(const EffectSettings &settings) override
Definition: Paulstretch.cpp:54
bool TransferDataFromWindow(EffectSettings &settings) override
Definition: Paulstretch.cpp:64
wxWeakRef< wxWindow > mUIParent
Definition: Paulstretch.h:32
void OnText(wxCommandEvent &evt)
Definition: Paulstretch.cpp:76
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
BuiltinEffectsModule::Registration< EffectPaulstretch > reg
Definition: Paulstretch.cpp:23
STL namespace.
Externalized state of a plug-in.