28#include "../ShuttleGui.h"
29#include "../widgets/valnum.h"
55{ wxT(
"Sliding Stretch"),
XO(
"Sliding Stretch") };
72 Parameters().Reset(*
this);
74 slideTypeRate = SlideLinearOutputRate;
75 slideTypePitch = SlideLinearOutputRate;
77 previewSelectedDuration = 0.0;
79 SetLinearEffectFlag(
true);
95 return XO(
"Allows continuous changes to the tempo and/or pitch");
100 return L
"Sliding_Stretch";
115 double inputLength =
settings.extra.GetDuration();
116 if(inputLength == 0.0) {
121 double tOut = previewLength/inputLength;
123 return t * inputLength;
158 S.StartMultiColumn(2, wxALIGN_CENTER);
161 S.StartStatic(
XO(
"Initial Tempo Change (%)"));
163 S.StartMultiColumn(1, wxCENTER);
166 .Validator<FloatingPointValidator<double>>(
168 NumValidatorStyle::NO_TRAILING_ZEROES,
170 .AddTextBox( {}, L
"", 12);
173 S.StartHorizontalLay(wxEXPAND, 0);
176 .Style(wxSL_HORIZONTAL)
179 S.EndHorizontalLay();
183 S.StartStatic(
XO(
"Final Tempo Change (%)"));
185 S.StartMultiColumn(1, wxCENTER);
188 .Validator<FloatingPointValidator<double>>(
190 NumValidatorStyle::NO_TRAILING_ZEROES,
192 .AddTextBox( {}, L
"", 12);
195 S.StartHorizontalLay(wxEXPAND, 0);
198 .Style(wxSL_HORIZONTAL)
201 S.EndHorizontalLay();
206 S.StartStatic(
XO(
"Initial Pitch Shift"));
208 S.StartMultiColumn(2, wxCENTER);
211 .Validator<FloatingPointValidator<double>>(
213 NumValidatorStyle::NO_TRAILING_ZEROES,
215 .AddTextBox(
XXO(
"(&semitones) [-12 to 12]:"), L
"", 12);
219 .Validator<FloatingPointValidator<double>>(
221 NumValidatorStyle::NO_TRAILING_ZEROES,
223 .AddTextBox(
XXO(
"(%) [-50 to 100]:"), L
"", 12);
230 S.StartStatic(
XO(
"Final Pitch Shift"));
232 S.StartMultiColumn(2, wxCENTER);
235 .Validator<FloatingPointValidator<double>>(
237 NumValidatorStyle::NO_TRAILING_ZEROES,
239 .AddTextBox(
XXO(
"(s&emitones) [-12 to 12]:"), L
"", 12);
242 .Validator<FloatingPointValidator<double>>(
244 NumValidatorStyle::NO_TRAILING_ZEROES,
246 .AddTextBox(
XXO(
"(%) [-50 to 100]:"), L
"", 12);
267 return 1.0 + percentChange / 100.0;
272 return 100.0 * (pow(2.0,halfSteps/12.0) - 1.0);
ValueRestorer< T > valueRestorer(T &var)
inline functions provide convenient parameter type deduction
@ ID_RatePercentChangeEnd
@ ID_RatePercentChangeStart
@ ID_PitchPercentChangeEnd
@ ID_PitchPercentChangeStart
static Settings & settings()
Generates EffectParameterMethods overrides from variadic template arguments.
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
void Preview(EffectSettingsAccess &access, bool dryOnly) override
bool EnableApply(bool enable=true)
Performs effect computation.
Interface for manipulations of an Effect's settings.
void setParameters(double rateStart, double rateEnd, double pitchStart, double pitchEnd, SlideType rateSlideType, SlideType pitchSlideType, bool bLinkRatePitch, bool bRateReferenceInput, bool bPitchReferenceInput)
static double getInvertedStretchedTime(double rateStart, double rateEnd, SlideType slideType, double outputTime)
bool Process(EffectInstance &instance, EffectSettings &settings) override
Actually do the effect here.
static double getRate(double rateStart, double rateEnd, SlideType slideType, double t)
virtual const EffectSettings & Get()=0
An EffectTimeScale does high quality sliding time scaling/pitch shifting.
static double PercentChangeToHalfSteps(double percentChange)
TranslatableString GetDescription() const override
double m_PitchPercentChangeStart
wxTextCtrl * m_pTextCtrl_PitchHalfStepsEnd
void Update_Slider_RatePercentChangeEnd()
double CalcPreviewInputLength(const EffectSettings &settings, double previewLength) const override
Default implementation returns previewLength
std::unique_ptr< EffectUIValidator > PopulateOrExchange(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access) override
Add controls to effect panel; always succeeds.
bool Process(EffectInstance &instance, EffectSettings &settings) override
Actually do the effect here.
void OnSlider_RatePercentChangeStart(wxCommandEvent &evt)
wxSlider * m_pSlider_RatePercentChangeStart
static constexpr EffectParameter RatePercentEnd
static constexpr EffectParameter RatePercentStart
void Update_Text_PitchHalfStepsEnd()
void Update_Text_PitchHalfStepsStart()
static double HalfStepsToPercentChange(double halfSteps)
wxTextCtrl * m_pTextCtrl_RatePercentChangeStart
void OnText_PitchPercentChangeEnd(wxCommandEvent &evt)
wxTextCtrl * m_pTextCtrl_RatePercentChangeEnd
void Preview(EffectSettingsAccess &access, bool dryOnly) override
void OnText_PitchHalfStepsStart(wxCommandEvent &evt)
static constexpr EffectParameter HalfStepsEnd
void OnText_PitchPercentChangeStart(wxCommandEvent &evt)
void Update_Slider_RatePercentChangeStart()
double previewSelectedDuration
static constexpr EffectParameter PitchPercentEnd
void OnSlider_RatePercentChangeEnd(wxCommandEvent &evt)
EffectType GetType() const override
Type determines how it behaves.
double m_PitchHalfStepsEnd
static const ComponentInterfaceSymbol Symbol
double m_PitchHalfStepsStart
void OnText_PitchHalfStepsEnd(wxCommandEvent &evt)
static double PercentChangeToRatio(double percentChange)
void Update_Text_PitchPercentChangeStart()
wxSlider * m_pSlider_RatePercentChangeEnd
void Update_Text_RatePercentChangeEnd()
wxTextCtrl * m_pTextCtrl_PitchHalfStepsStart
double m_PitchPercentChangeEnd
void Update_Text_RatePercentChangeStart()
void OnText_RatePercentChangeStart(wxCommandEvent &evt)
double m_RatePercentChangeEnd
void Update_Text_PitchPercentChangeEnd()
bool TransferDataToWindow(const EffectSettings &settings) override
Update controls for the settings.
const EffectParameterMethods & Parameters() const override
double m_RatePercentChangeStart
static constexpr EffectParameter PitchPercentStart
wxTextCtrl * m_pTextCtrl_PitchPercentChangeStart
virtual ~EffectTimeScale()
static constexpr EffectParameter HalfStepsStart
ManualPageID ManualPage() const override
Name of a page in the Audacity alpha manual, default is empty.
void OnText_RatePercentChangeEnd(wxCommandEvent &evt)
ComponentInterfaceSymbol GetSymbol() const override
wxTextCtrl * m_pTextCtrl_PitchPercentChangeEnd
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Holds a msgid for the translation catalog; may also bind format arguments.
BuiltinEffectsModule::Registration< EffectTimeScale > reg
const Type def
Default value.
const Type min
Minimum value.
const Type max
Maximum value.
Externalized state of a plug-in.
EffectSettingsExtra extra