27#include "../ShuttleGui.h"
28#include "../widgets/valnum.h"
54{
wxT(
"Sliding Stretch"),
XO(
"Sliding Stretch") };
71 Parameters().Reset(*
this);
73 slideTypeRate = SlideLinearOutputRate;
74 slideTypePitch = SlideLinearOutputRate;
76 previewSelectedDuration = 0.0;
78 SetLinearEffectFlag(
true);
94 return XO(
"Allows continuous changes to the tempo and/or pitch");
99 return L
"Sliding_Stretch";
114 double inputLength =
settings.extra.GetDuration();
115 if(inputLength == 0.0) {
120 double tOut = previewLength/inputLength;
122 return t * inputLength;
159 S.StartMultiColumn(2, wxALIGN_CENTER);
162 S.StartStatic(
XO(
"Initial Tempo Change (%)"));
164 S.StartMultiColumn(1, wxCENTER);
167 .Validator<FloatingPointValidator<double>>(
169 NumValidatorStyle::NO_TRAILING_ZEROES,
171 .AddTextBox( {}, L
"", 12);
174 S.StartHorizontalLay(wxEXPAND, 0);
177 .Style(wxSL_HORIZONTAL)
180 S.EndHorizontalLay();
184 S.StartStatic(
XO(
"Final Tempo Change (%)"));
186 S.StartMultiColumn(1, wxCENTER);
189 .Validator<FloatingPointValidator<double>>(
191 NumValidatorStyle::NO_TRAILING_ZEROES,
193 .AddTextBox( {}, L
"", 12);
196 S.StartHorizontalLay(wxEXPAND, 0);
199 .Style(wxSL_HORIZONTAL)
202 S.EndHorizontalLay();
207 S.StartStatic(
XO(
"Initial Pitch Shift"));
209 S.StartMultiColumn(2, wxCENTER);
212 .Validator<FloatingPointValidator<double>>(
214 NumValidatorStyle::NO_TRAILING_ZEROES,
216 .AddTextBox(
XXO(
"(&semitones) [-12 to 12]:"), L
"", 12);
220 .Validator<FloatingPointValidator<double>>(
222 NumValidatorStyle::NO_TRAILING_ZEROES,
224 .AddTextBox(
XXO(
"(%) [-50 to 100]:"), L
"", 12);
231 S.StartStatic(
XO(
"Final Pitch Shift"));
233 S.StartMultiColumn(2, wxCENTER);
236 .Validator<FloatingPointValidator<double>>(
238 NumValidatorStyle::NO_TRAILING_ZEROES,
240 .AddTextBox(
XXO(
"(s&emitones) [-12 to 12]:"), L
"", 12);
243 .Validator<FloatingPointValidator<double>>(
245 NumValidatorStyle::NO_TRAILING_ZEROES,
247 .AddTextBox(
XXO(
"(%) [-50 to 100]:"), L
"", 12);
283 return 1.0 + percentChange / 100.0;
288 return 100.0 * (pow(2.0,halfSteps/12.0) - 1.0);
XXO("&Cut/Copy/Paste Toolbar")
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
Performs effect computation.
Hold values to send to effect output meters.
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
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
bool Process(EffectInstance &instance, EffectSettings &settings) override
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()
std::unique_ptr< EffectUIValidator > PopulateOrExchange(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) override
Add controls to effect panel; always succeeds.
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()
wxWeakRef< wxWindow > mUIParent
wxTextCtrl * m_pTextCtrl_PitchHalfStepsStart
double m_PitchPercentChangeEnd
void Update_Text_RatePercentChangeStart()
void OnText_RatePercentChangeStart(wxCommandEvent &evt)
double m_RatePercentChangeEnd
bool TransferDataFromWindow(EffectSettings &settings) override
Update the given settings from controls.
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
static bool EnableApply(wxWindow *parent, bool enable=true)
Enable or disable the Apply button of the dialog that contains parent.
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