Audacity  3.2.0
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
EffectTimeScale Class Referencefinal

An EffectTimeScale does high quality sliding time scaling/pitch shifting. More...

#include <TimeScale.h>

Inheritance diagram for EffectTimeScale:
[legend]
Collaboration diagram for EffectTimeScale:
[legend]

Public Member Functions

 EffectTimeScale ()
 
virtual ~EffectTimeScale ()
 
ComponentInterfaceSymbol GetSymbol () override
 
TranslatableString GetDescription () override
 
ManualPageID ManualPage () override
 Name of a page in the Audacity alpha manual, default is empty. More...
 
EffectType GetType () override
 Type determines how it behaves. More...
 
bool GetAutomationParameters (CommandParameters &parms) override
 Save current settings into parms. More...
 
bool SetAutomationParameters (CommandParameters &parms) override
 Change settings to those stored in parms. More...
 
bool DefineParams (ShuttleParams &S) override
 
bool Init () override
 
void Preview (bool dryOnly) override
 
bool Process () override
 
void PopulateOrExchange (ShuttleGui &S) override
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
double CalcPreviewInputLength (double previewLength) override
 
- Public Member Functions inherited from EffectSBSMS
void setParameters (double rateStart, double rateEnd, double pitchStart, double pitchEnd, SlideType rateSlideType, SlideType pitchSlideType, bool bLinkRatePitch, bool bRateReferenceInput, bool bPitchReferenceInput)
 
void setParameters (double tempoRatio, double pitchRatio)
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
PluginPath GetPath () override
 
VendorSymbol GetVendor () override
 
wxString GetVersion () override
 
EffectFamilySymbol GetFamily () override
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () override
 Whether the effect sorts "above the line" in the menus. More...
 
bool IsLegacy () override
 
bool SupportsRealtime () override
 Whether the effect supports realtime previewing (while audio is playing). More...
 
bool SupportsAutomation () override
 Whether the effect can be used without the UI, in a macro. More...
 
bool LoadUserPreset (const RegistryPath &name) override
 Change settings to a user-named preset. More...
 
bool SaveUserPreset (const RegistryPath &name) override
 Save current settings as a user-named preset. More...
 
RegistryPaths GetFactoryPresets () override
 Report names of factory presets. More...
 
bool LoadFactoryPreset (int id) override
 Change settings to the preset whose name is GetFactoryPresets()[id] More...
 
bool LoadFactoryDefaults () override
 Change settings back to "factory default". More...
 
bool SetHost (EffectHostInterface *host) override
 
unsigned GetAudioInCount () override
 
unsigned GetAudioOutCount () override
 
int GetMidiInCount () override
 
int GetMidiOutCount () override
 
sampleCount GetLatency () override
 Called for destructive, non-realtime effect computation. More...
 
size_t GetTailSize () override
 
void SetSampleRate (double rate) override
 
size_t SetBlockSize (size_t maxBlockSize) override
 
size_t GetBlockSize () const override
 
bool ProcessInitialize (sampleCount totalLen, ChannelNames chanMap=NULL) override
 Called for destructive, non-realtime effect computation. More...
 
bool ProcessFinalize () override
 Called for destructive, non-realtime effect computation. More...
 
size_t ProcessBlock (float **inBlock, float **outBlock, size_t blockLen) override
 Called for destructive, non-realtime effect computation. More...
 
bool RealtimeInitialize () override
 
bool RealtimeAddProcessor (unsigned numChannels, float sampleRate) override
 
bool RealtimeFinalize () override
 
bool RealtimeSuspend () override
 
bool RealtimeResume () noexcept override
 
bool RealtimeProcessStart () override
 
size_t RealtimeProcess (int group, float **inbuf, float **outbuf, size_t numSamples) override
 
bool RealtimeProcessEnd () noexcept override
 
int ShowClientInterface (wxWindow &parent, wxDialog &dialog, bool forceModal=false) override
 
bool PopulateUI (ShuttleGui &S) final
 Adds controls to a panel that is given as the parent window of S More...
 
bool IsGraphicalUI () override
 
bool ValidateUI () override
 
bool HideUI () override
 
bool CloseUI () override
 
bool CanExportPresets () override
 
void ExportPresets () override
 
void ImportPresets () override
 
bool HasOptions () override
 
void ShowOptions () override
 
EffectDefinitionInterfaceGetDefinition () override
 
double GetDuration () override
 
NumericFormatSymbol GetDurationFormat () override
 
virtual NumericFormatSymbol GetSelectionFormat ()
 
void SetDuration (double duration) override
 
RegistryPath GetUserPresetsGroup (const RegistryPath &name) override
 
RegistryPath GetCurrentSettingsGroup () override
 
RegistryPath GetFactoryDefaultsGroup () override
 
virtual wxString GetSavedStateGroup ()
 
int ShowHostInterface (wxWindow &parent, const EffectDialogFactory &factory, bool forceModal=false) override
 
unsigned TestUIFlags (unsigned mask)
 
void SetPresetParameters (const wxArrayString *Names, const wxArrayString *Values)
 
virtual bool Startup (EffectUIClientInterface *client)
 
virtual bool GetAutomationParametersAsString (wxString &parms)
 
virtual bool SetAutomationParametersFromString (const wxString &parms)
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
bool DoEffect (double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, wxWindow *pParent=nullptr, const EffectDialogFactory &dialogFactory={})
 
bool Delegate (Effect &delegate, wxWindow &parent, const EffectDialogFactory &factory)
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
virtual bool Startup ()
 
- Public Member Functions inherited from EffectUIClientInterface
virtual ~EffectUIClientInterface ()
 
- Public Member Functions inherited from EffectProcessor
virtual ~EffectProcessor ()
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetClassification ()
 Determines which menu it appears in; default same as GetType(). More...
 
virtual bool EnablesDebug ()
 Whether the effect dialog should have a Debug button; default, always false. More...
 
virtual FilePath HelpPage ()
 Fully qualified local help file name, default is empty. More...
 
virtual bool IsHiddenFromMenus ()
 Default is false. More...
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
TranslatableString GetName ()
 
virtual bool DefineParams (ShuttleParams &WXUNUSED(S))
 
- Public Member Functions inherited from EffectUIHostInterface
virtual ~EffectUIHostInterface ()
 
- Public Member Functions inherited from EffectHostInterface
virtual ~EffectHostInterface ()
 

Static Public Attributes

static const ComponentInterfaceSymbol Symbol { wxT("Sliding Stretch"), XO("Sliding Stretch") }
 
- Static Public Attributes inherited from Effect
static const wxString kUserPresetIdent = wxT("User Preset:")
 
static const wxString kFactoryPresetIdent = wxT("Factory Preset:")
 
static const wxString kCurrentSettingsIdent = wxT("<Current Settings>")
 
static const wxString kFactoryDefaultsIdent = wxT("<Factory Defaults>")
 

Private Member Functions

double PercentChangeToRatio (double percentChange)
 
double HalfStepsToPercentChange (double halfSteps)
 
double PercentChangeToHalfSteps (double percentChange)
 
void OnText_RatePercentChangeStart (wxCommandEvent &evt)
 
void OnText_RatePercentChangeEnd (wxCommandEvent &evt)
 
void OnText_PitchPercentChangeStart (wxCommandEvent &evt)
 
void OnText_PitchPercentChangeEnd (wxCommandEvent &evt)
 
void OnText_PitchHalfStepsStart (wxCommandEvent &evt)
 
void OnText_PitchHalfStepsEnd (wxCommandEvent &evt)
 
void OnSlider_RatePercentChangeStart (wxCommandEvent &evt)
 
void OnSlider_RatePercentChangeEnd (wxCommandEvent &evt)
 
void OnCheckBox_PreAnalyze (wxCommandEvent &evt)
 
void Update_Text_RatePercentChangeStart ()
 
void Update_Text_RatePercentChangeEnd ()
 
void Update_Text_PitchPercentChangeStart ()
 
void Update_Text_PitchPercentChangeEnd ()
 
void Update_Text_PitchHalfStepsStart ()
 
void Update_Text_PitchHalfStepsEnd ()
 
void Update_Slider_RatePercentChangeStart ()
 
void Update_Slider_RatePercentChangeEnd ()
 

Private Attributes

bool bPreview
 
double previewSelectedDuration
 
SlideType slideTypeRate
 
SlideType slideTypePitch
 
double m_RatePercentChangeStart
 
double m_RatePercentChangeEnd
 
double m_PitchHalfStepsStart
 
double m_PitchHalfStepsEnd
 
double m_PitchPercentChangeStart
 
double m_PitchPercentChangeEnd
 
wxTextCtrl * m_pTextCtrl_RatePercentChangeStart
 
wxTextCtrl * m_pTextCtrl_RatePercentChangeEnd
 
wxSlider * m_pSlider_RatePercentChangeStart
 
wxSlider * m_pSlider_RatePercentChangeEnd
 
wxTextCtrl * m_pTextCtrl_PitchHalfStepsStart
 
wxTextCtrl * m_pTextCtrl_PitchHalfStepsEnd
 
wxTextCtrl * m_pTextCtrl_PitchPercentChangeStart
 
wxTextCtrl * m_pTextCtrl_PitchPercentChangeEnd
 

Additional Inherited Members

- Public Types inherited from Effect
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Static Public Member Functions inherited from EffectSBSMS
static double getInvertedStretchedTime (double rateStart, double rateEnd, SlideType slideType, double outputTime)
 
static double getRate (double rateStart, double rateEnd, SlideType slideType, double t)
 
- Static Public Member Functions inherited from Effect
static void IncEffectCounter ()
 
- Static Public Member Functions inherited from EffectDefinitionInterface
static Identifier GetSquashedName (const Identifier &ident)
 A utility that strips spaces and CamelCases a name. More...
 
- Protected Member Functions inherited from Effect
bool EnableApply (bool enable=true)
 
bool EnablePreview (bool enable=true)
 
virtual bool CheckWhetherSkipEffect ()
 
virtual bool ProcessPass ()
 
virtual bool InitPass1 ()
 
virtual bool InitPass2 ()
 
virtual void End ()
 
bool TotalProgress (double frac, const TranslatableString &={})
 
bool TrackProgress (int whichTrack, double frac, const TranslatableString &={})
 
bool TrackGroupProgress (int whichGroup, double frac, const TranslatableString &={})
 
int GetNumWaveTracks ()
 
int GetNumWaveGroups ()
 
void GetBounds (const WaveTrack &track, const WaveTrack *pRight, sampleCount *start, sampleCount *len)
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing ()
 
void IncludeNotSelectedPreviewTracks (bool includeNotSelected)
 
void CopyInputTracks (bool allSyncLockSelected=false)
 
std::shared_ptr< AddedAnalysisTrackAddAnalysisTrack (const wxString &name=wxString())
 
ModifiedAnalysisTrack ModifyAnalysisTrack (const LabelTrack *pOrigTrack, const wxString &name=wxString())
 
void ReplaceProcessedTracks (const bool bGoodResult)
 
TrackAddToOutputTracks (const std::shared_ptr< Track > &t)
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () const
 
- Protected Attributes inherited from EffectSBSMS
TranslatableString mProxyEffectName { XO("SBSMS Time / Pitch Stretch") }
 
- Protected Attributes inherited from Effect
BasicUI::ProgressDialogmProgress = nullptr
 
double mProjectRate
 
double mSampleRate
 
WaveTrackFactorymFactory
 
std::shared_ptr< TrackListmOutputTracks
 
double mT0
 
double mT1
 
wxArrayString mPresetNames
 
wxArrayString mPresetValues
 
int mPass
 
wxWeakRef< wxDialog > mHostUIDialog
 This smart pointer tracks the lifetime of the dialog. More...
 
wxWeakRef< wxDialog > mUIDialog
 This weak pointer may be the same as the above, or null. More...
 
wxWindow * mUIParent
 
unsigned mUIFlags { 0 }
 
sampleCount mSampleCnt
 
- Static Protected Attributes inherited from Effect
static int nEffectsDone =0
 

Detailed Description

An EffectTimeScale does high quality sliding time scaling/pitch shifting.

Definition at line 24 of file TimeScale.h.

Constructor & Destructor Documentation

◆ EffectTimeScale()

EffectTimeScale::EffectTimeScale ( )

Definition at line 71 of file TimeScale.cpp.

72 {
73  m_RatePercentChangeStart = DEF_RatePercentStart;
74  m_RatePercentChangeEnd = DEF_RatePercentEnd;
75  m_PitchHalfStepsStart = DEF_HalfStepsStart;
76  m_PitchHalfStepsEnd = DEF_HalfStepsEnd;
77  m_PitchPercentChangeStart = DEF_PitchPercentStart;
78  m_PitchPercentChangeEnd = DEF_PitchPercentEnd;
79 
80  slideTypeRate = SlideLinearOutputRate;
81  slideTypePitch = SlideLinearOutputRate;
82  bPreview = false;
84 
85  SetLinearEffectFlag(true);
86 }

◆ ~EffectTimeScale()

EffectTimeScale::~EffectTimeScale ( )
virtual

Definition at line 88 of file TimeScale.cpp.

89 {
90 }

Member Function Documentation

◆ CalcPreviewInputLength()

double EffectTimeScale::CalcPreviewInputLength ( double  previewLength)
overridevirtual

Reimplemented from Effect.

Definition at line 165 of file TimeScale.cpp.

166 {
167  double inputLength = Effect::GetDuration();
168  if(inputLength == 0.0) {
169  return 0.0;
170  } else {
171  double rateStart1 = PercentChangeToRatio(m_RatePercentChangeStart);
172  double rateEnd1 = PercentChangeToRatio(m_RatePercentChangeEnd);
173  double tOut = previewLength/inputLength;
174  double t = EffectSBSMS::getInvertedStretchedTime(rateStart1,rateEnd1,slideTypeRate,tOut);
175  return t * inputLength;
176  }
177 }

References Effect::GetDuration(), EffectSBSMS::getInvertedStretchedTime(), m_RatePercentChangeEnd, m_RatePercentChangeStart, PercentChangeToRatio(), and slideTypeRate.

Here is the call graph for this function:

◆ DefineParams()

bool EffectTimeScale::DefineParams ( ShuttleParams S)
override

Definition at line 117 of file TimeScale.cpp.

117  {
118  S.SHUTTLE_PARAM( m_RatePercentChangeStart, RatePercentStart );
119  S.SHUTTLE_PARAM( m_RatePercentChangeEnd, RatePercentEnd );
120  S.SHUTTLE_PARAM( m_PitchHalfStepsStart, HalfStepsStart );
121  S.SHUTTLE_PARAM( m_PitchHalfStepsEnd, HalfStepsEnd );
122  S.SHUTTLE_PARAM( m_PitchPercentChangeStart, PitchPercentStart );
123  S.SHUTTLE_PARAM( m_PitchPercentChangeEnd, PitchPercentEnd );
124  return true;
125 }

References m_PitchHalfStepsEnd, m_PitchHalfStepsStart, m_PitchPercentChangeEnd, m_PitchPercentChangeStart, m_RatePercentChangeEnd, m_RatePercentChangeStart, and S.

◆ GetAutomationParameters()

bool EffectTimeScale::GetAutomationParameters ( CommandParameters parms)
overridevirtual

Save current settings into parms.

Reimplemented from Effect.

Definition at line 127 of file TimeScale.cpp.

128 {
129  parms.Write(KEY_RatePercentStart, m_RatePercentChangeStart);
130  parms.Write(KEY_RatePercentEnd, m_RatePercentChangeEnd);
131  parms.Write(KEY_HalfStepsStart, m_PitchHalfStepsStart);
132  parms.Write(KEY_HalfStepsEnd, m_PitchHalfStepsEnd);
133  parms.Write(KEY_PitchPercentStart, m_PitchPercentChangeStart);
134  parms.Write(KEY_PitchPercentEnd, m_PitchPercentChangeEnd);
135 
136  return true;
137 }

References m_PitchHalfStepsEnd, m_PitchHalfStepsStart, m_PitchPercentChangeEnd, m_PitchPercentChangeStart, m_RatePercentChangeEnd, and m_RatePercentChangeStart.

◆ GetDescription()

TranslatableString EffectTimeScale::GetDescription ( )
overridevirtual

Reimplemented from Effect.

Definition at line 99 of file TimeScale.cpp.

100 {
101  return XO("Allows continuous changes to the tempo and/or pitch");
102 }

References XO.

◆ GetSymbol()

ComponentInterfaceSymbol EffectTimeScale::GetSymbol ( )
overridevirtual

Reimplemented from EffectSBSMS.

Definition at line 94 of file TimeScale.cpp.

95 {
96  return Symbol;
97 }

References Symbol.

◆ GetType()

EffectType EffectTimeScale::GetType ( )
overridevirtual

Type determines how it behaves.

Reimplemented from Effect.

Definition at line 111 of file TimeScale.cpp.

112 {
113  return EffectTypeProcess;
114 }

References EffectTypeProcess.

◆ HalfStepsToPercentChange()

double EffectTimeScale::HalfStepsToPercentChange ( double  halfSteps)
inlineprivate

Definition at line 340 of file TimeScale.cpp.

341 {
342  return 100.0 * (pow(2.0,halfSteps/12.0) - 1.0);
343 }

Referenced by OnText_PitchHalfStepsEnd(), and OnText_PitchHalfStepsStart().

Here is the caller graph for this function:

◆ Init()

bool EffectTimeScale::Init ( )
overridevirtual

Reimplemented from Effect.

Definition at line 160 of file TimeScale.cpp.

161 {
162  return true;
163 }

◆ ManualPage()

ManualPageID EffectTimeScale::ManualPage ( )
overridevirtual

Name of a page in the Audacity alpha manual, default is empty.

Reimplemented from EffectDefinitionInterface.

Definition at line 104 of file TimeScale.cpp.

105 {
106  return L"Sliding_Stretch";
107 }

◆ OnCheckBox_PreAnalyze()

void EffectTimeScale::OnCheckBox_PreAnalyze ( wxCommandEvent &  evt)
private

◆ OnSlider_RatePercentChangeEnd()

void EffectTimeScale::OnSlider_RatePercentChangeEnd ( wxCommandEvent &  evt)
private

Definition at line 417 of file TimeScale.cpp.

418 {
419  m_RatePercentChangeEnd = (double) evt.GetInt();
420 
422 }

References m_RatePercentChangeEnd, and Update_Text_RatePercentChangeEnd().

Here is the call graph for this function:

◆ OnSlider_RatePercentChangeStart()

void EffectTimeScale::OnSlider_RatePercentChangeStart ( wxCommandEvent &  evt)
private

Definition at line 410 of file TimeScale.cpp.

411 {
412  m_RatePercentChangeStart = (double) evt.GetInt();
413 
415 }

References m_RatePercentChangeStart, and Update_Text_RatePercentChangeStart().

Here is the call graph for this function:

◆ OnText_PitchHalfStepsEnd()

void EffectTimeScale::OnText_PitchHalfStepsEnd ( wxCommandEvent &  evt)
private

Definition at line 435 of file TimeScale.cpp.

436 {
437  if (!EnableApply(mUIParent->TransferDataFromWindow()))
438  {
439  return;
440  }
441 
444 }

References Effect::EnableApply(), HalfStepsToPercentChange(), m_PitchHalfStepsEnd, m_PitchPercentChangeEnd, Effect::mUIParent, and Update_Text_PitchPercentChangeEnd().

Here is the call graph for this function:

◆ OnText_PitchHalfStepsStart()

void EffectTimeScale::OnText_PitchHalfStepsStart ( wxCommandEvent &  evt)
private

Definition at line 424 of file TimeScale.cpp.

425 {
426  if (!EnableApply(mUIParent->TransferDataFromWindow()))
427  {
428  return;
429  }
430 
433 }

References Effect::EnableApply(), HalfStepsToPercentChange(), m_PitchHalfStepsStart, m_PitchPercentChangeStart, Effect::mUIParent, and Update_Text_PitchPercentChangeStart().

Here is the call graph for this function:

◆ OnText_PitchPercentChangeEnd()

void EffectTimeScale::OnText_PitchPercentChangeEnd ( wxCommandEvent &  evt)
private

Definition at line 457 of file TimeScale.cpp.

458 {
459  if (!EnableApply(mUIParent->TransferDataFromWindow()))
460  {
461  return;
462  }
463 
466 }

References Effect::EnableApply(), m_PitchHalfStepsEnd, m_PitchPercentChangeEnd, Effect::mUIParent, PercentChangeToHalfSteps(), and Update_Text_PitchHalfStepsEnd().

Here is the call graph for this function:

◆ OnText_PitchPercentChangeStart()

void EffectTimeScale::OnText_PitchPercentChangeStart ( wxCommandEvent &  evt)
private

Definition at line 446 of file TimeScale.cpp.

447 {
448  if (!EnableApply(mUIParent->TransferDataFromWindow()))
449  {
450  return;
451  }
452 
455 }

References Effect::EnableApply(), m_PitchHalfStepsStart, m_PitchPercentChangeStart, Effect::mUIParent, PercentChangeToHalfSteps(), and Update_Text_PitchHalfStepsStart().

Here is the call graph for this function:

◆ OnText_RatePercentChangeEnd()

void EffectTimeScale::OnText_RatePercentChangeEnd ( wxCommandEvent &  evt)
private

Definition at line 400 of file TimeScale.cpp.

401 {
402  if (!EnableApply(mUIParent->TransferDataFromWindow()))
403  {
404  return;
405  }
406 
408 }

References Effect::EnableApply(), Effect::mUIParent, and Update_Slider_RatePercentChangeEnd().

Here is the call graph for this function:

◆ OnText_RatePercentChangeStart()

void EffectTimeScale::OnText_RatePercentChangeStart ( wxCommandEvent &  evt)
private

Definition at line 390 of file TimeScale.cpp.

391 {
392  if (!EnableApply(mUIParent->TransferDataFromWindow()))
393  {
394  return;
395  }
396 
398 }

References Effect::EnableApply(), Effect::mUIParent, and Update_Slider_RatePercentChangeStart().

Here is the call graph for this function:

◆ PercentChangeToHalfSteps()

double EffectTimeScale::PercentChangeToHalfSteps ( double  percentChange)
inlineprivate

Definition at line 345 of file TimeScale.cpp.

346 {
347  return 12.0 * log2(PercentChangeToRatio(percentChange));
348 }

References PercentChangeToRatio().

Referenced by OnText_PitchPercentChangeEnd(), and OnText_PitchPercentChangeStart().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PercentChangeToRatio()

double EffectTimeScale::PercentChangeToRatio ( double  percentChange)
inlineprivate

Definition at line 335 of file TimeScale.cpp.

336 {
337  return 1.0 + percentChange / 100.0;
338 }

Referenced by CalcPreviewInputLength(), PercentChangeToHalfSteps(), and Process().

Here is the caller graph for this function:

◆ PopulateOrExchange()

void EffectTimeScale::PopulateOrExchange ( ShuttleGui S)
overridevirtual

Reimplemented from Effect.

Definition at line 203 of file TimeScale.cpp.

204 {
205  S.SetBorder(5);
206  S.AddSpace(0, 5);
207 
208  S.StartMultiColumn(2, wxALIGN_CENTER);
209  {
210  // Rate Start
211  S.StartStatic(XO("Initial Tempo Change (%)"));
212  {
213  S.StartMultiColumn(1, wxCENTER);
214  {
216  .Validator<FloatingPointValidator<double>>(
218  NumValidatorStyle::NO_TRAILING_ZEROES,
219  MIN_RatePercentStart, MAX_RatePercentStart
220  )
221  .AddTextBox( {}, wxT(""), 12);
222  }
223  S.EndMultiColumn();
224  S.StartHorizontalLay(wxEXPAND, 0);
225  {
227  .Style(wxSL_HORIZONTAL)
228  .AddSlider( {}, DEF_RatePercentStart, MAX_RatePercentStart, MIN_RatePercentStart);
229  }
230  S.EndHorizontalLay();
231  }
232  S.EndStatic();
233 
234  S.StartStatic(XO("Final Tempo Change (%)"));
235  {
236  S.StartMultiColumn(1, wxCENTER);
237  {
239  .Validator<FloatingPointValidator<double>>(
241  NumValidatorStyle::NO_TRAILING_ZEROES,
242  MIN_RatePercentEnd, MAX_RatePercentEnd
243  )
244  .AddTextBox( {}, wxT(""), 12);
245  }
246  S.EndMultiColumn();
247  S.StartHorizontalLay(wxEXPAND, 0);
248  {
250  .Style(wxSL_HORIZONTAL)
251  .AddSlider( {}, DEF_RatePercentEnd, MAX_RatePercentEnd, MIN_RatePercentEnd);
252  }
253  S.EndHorizontalLay();
254  }
255  S.EndStatic();
256 
257  // Pitch Start
258  S.StartStatic(XO("Initial Pitch Shift"));
259  {
260  S.StartMultiColumn(2, wxCENTER);
261  {
263  .Validator<FloatingPointValidator<double>>(
265  NumValidatorStyle::NO_TRAILING_ZEROES,
266  MIN_HalfStepsStart, MAX_HalfStepsStart
267  )
268  .AddTextBox(XXO("(&semitones) [-12 to 12]:"), wxT(""), 12);
269 
270 
272  .Validator<FloatingPointValidator<double>>(
274  NumValidatorStyle::NO_TRAILING_ZEROES,
275  MIN_PitchPercentStart, MAX_PitchPercentStart
276  )
277  .AddTextBox(XXO("(%) [-50 to 100]:"), wxT(""), 12);
278  }
279  S.EndMultiColumn();
280  }
281  S.EndStatic();
282 
283  // Pitch End
284  S.StartStatic(XO("Final Pitch Shift"));
285  {
286  S.StartMultiColumn(2, wxCENTER);
287  {
289  .Validator<FloatingPointValidator<double>>(
291  NumValidatorStyle::NO_TRAILING_ZEROES,
292  MIN_HalfStepsEnd, MAX_HalfStepsEnd
293  )
294  .AddTextBox(XXO("(s&emitones) [-12 to 12]:"), wxT(""), 12);
295 
297  .Validator<FloatingPointValidator<double>>(
299  NumValidatorStyle::NO_TRAILING_ZEROES,
300  MIN_PitchPercentStart, MAX_PitchPercentStart)
301  .AddTextBox(XXO("(%) [-50 to 100]:"), wxT(""), 12);
302  }
303  S.EndMultiColumn();
304  }
305  S.EndStatic();
306  }
307  S.EndMultiColumn();
308 
309  return;
310 }

References ID_PitchHalfStepsEnd, ID_PitchHalfStepsStart, ID_PitchPercentChangeEnd, ID_PitchPercentChangeStart, ID_RatePercentChangeEnd, ID_RatePercentChangeStart, m_PitchHalfStepsEnd, m_PitchHalfStepsStart, m_PitchPercentChangeEnd, m_PitchPercentChangeStart, m_pSlider_RatePercentChangeEnd, m_pSlider_RatePercentChangeStart, m_pTextCtrl_PitchHalfStepsEnd, m_pTextCtrl_PitchHalfStepsStart, m_pTextCtrl_PitchPercentChangeEnd, m_pTextCtrl_PitchPercentChangeStart, m_pTextCtrl_RatePercentChangeEnd, m_pTextCtrl_RatePercentChangeStart, m_RatePercentChangeEnd, m_RatePercentChangeStart, S, XO, and XXO.

◆ Preview()

void EffectTimeScale::Preview ( bool  dryOnly)
overridevirtual

Reimplemented from Effect.

Definition at line 179 of file TimeScale.cpp.

180 {
182  auto cleanup = valueRestorer( bPreview, true );
183  Effect::Preview(dryOnly);
184 }

References bPreview, Effect::GetDuration(), Effect::Preview(), previewSelectedDuration, and valueRestorer().

Here is the call graph for this function:

◆ Process()

bool EffectTimeScale::Process ( )
overridevirtual

If Process() is not overridden, it uses ProcessInitialize(), ProcessBlock(), and ProcessFinalize() methods of EffectProcessor, and also GetLatency() to determine how many leading output samples to discard and how many extra samples to produce.

Reimplemented from EffectSBSMS.

Definition at line 186 of file TimeScale.cpp.

187 {
188  double pitchStart1 = PercentChangeToRatio(m_PitchPercentChangeStart);
189  double pitchEnd1 = PercentChangeToRatio(m_PitchPercentChangeEnd);
190  double rateStart1 = PercentChangeToRatio(m_RatePercentChangeStart);
191  double rateEnd1 = PercentChangeToRatio(m_RatePercentChangeEnd);
192 
193  if(bPreview) {
194  double t = (mT1-mT0) / previewSelectedDuration;
195  rateEnd1 = EffectSBSMS::getRate(rateStart1,rateEnd1,slideTypeRate,t);
196  pitchEnd1 = EffectSBSMS::getRate(pitchStart1,pitchEnd1,slideTypePitch,t);
197  }
198 
199  EffectSBSMS::setParameters(rateStart1,rateEnd1,pitchStart1,pitchEnd1,slideTypeRate,slideTypePitch,false,false,false);
200  return EffectSBSMS::Process();
201 }

References bPreview, EffectSBSMS::getRate(), m_PitchPercentChangeEnd, m_PitchPercentChangeStart, m_RatePercentChangeEnd, m_RatePercentChangeStart, Effect::mT0, Effect::mT1, PercentChangeToRatio(), previewSelectedDuration, EffectSBSMS::Process(), EffectSBSMS::setParameters(), slideTypePitch, and slideTypeRate.

Here is the call graph for this function:

◆ SetAutomationParameters()

bool EffectTimeScale::SetAutomationParameters ( CommandParameters parms)
overridevirtual

Change settings to those stored in parms.

Reimplemented from Effect.

Definition at line 139 of file TimeScale.cpp.

140 {
141  ReadAndVerifyDouble(RatePercentStart);
142  ReadAndVerifyDouble(RatePercentEnd);
143  ReadAndVerifyDouble(HalfStepsStart);
144  ReadAndVerifyDouble(HalfStepsEnd);
145  ReadAndVerifyDouble(PitchPercentStart);
146  ReadAndVerifyDouble(PitchPercentEnd);
147 
148  m_RatePercentChangeStart = RatePercentStart;
149  m_RatePercentChangeEnd = RatePercentEnd;
150  m_PitchHalfStepsStart = HalfStepsStart;
151  m_PitchHalfStepsEnd = HalfStepsEnd;
152  m_PitchPercentChangeStart = PitchPercentStart;
153  m_PitchPercentChangeEnd = PitchPercentEnd;
154 
155  return true;
156 }

References m_PitchHalfStepsEnd, m_PitchHalfStepsStart, m_PitchPercentChangeEnd, m_PitchPercentChangeStart, m_RatePercentChangeEnd, m_RatePercentChangeStart, and ReadAndVerifyDouble.

◆ TransferDataFromWindow()

bool EffectTimeScale::TransferDataFromWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 325 of file TimeScale.cpp.

326 {
327  if (!mUIParent->Validate() || !mUIParent->TransferDataFromWindow())
328  {
329  return false;
330  }
331 
332  return true;
333 }

References Effect::mUIParent.

◆ TransferDataToWindow()

bool EffectTimeScale::TransferDataToWindow ( )
overridevirtual

Reimplemented from Effect.

Definition at line 312 of file TimeScale.cpp.

313 {
314  if (!mUIParent->TransferDataToWindow())
315  {
316  return false;
317  }
318 
321 
322  return true;
323 }

References Effect::mUIParent, Update_Slider_RatePercentChangeEnd(), and Update_Slider_RatePercentChangeStart().

Here is the call graph for this function:

◆ Update_Slider_RatePercentChangeEnd()

void EffectTimeScale::Update_Slider_RatePercentChangeEnd ( )
private

Definition at line 365 of file TimeScale.cpp.

366 {
368 }

References m_pSlider_RatePercentChangeEnd, and m_RatePercentChangeEnd.

Referenced by OnText_RatePercentChangeEnd(), and TransferDataToWindow().

Here is the caller graph for this function:

◆ Update_Slider_RatePercentChangeStart()

void EffectTimeScale::Update_Slider_RatePercentChangeStart ( )
private

Definition at line 360 of file TimeScale.cpp.

361 {
363 }

References m_pSlider_RatePercentChangeStart, and m_RatePercentChangeStart.

Referenced by OnText_RatePercentChangeStart(), and TransferDataToWindow().

Here is the caller graph for this function:

◆ Update_Text_PitchHalfStepsEnd()

void EffectTimeScale::Update_Text_PitchHalfStepsEnd ( )
private

Definition at line 375 of file TimeScale.cpp.

376 {
377  m_pTextCtrl_PitchHalfStepsEnd->GetValidator()->TransferToWindow();
378 }

References m_pTextCtrl_PitchHalfStepsEnd.

Referenced by OnText_PitchPercentChangeEnd().

Here is the caller graph for this function:

◆ Update_Text_PitchHalfStepsStart()

void EffectTimeScale::Update_Text_PitchHalfStepsStart ( )
private

Definition at line 370 of file TimeScale.cpp.

371 {
372  m_pTextCtrl_PitchHalfStepsStart->GetValidator()->TransferToWindow();
373 }

References m_pTextCtrl_PitchHalfStepsStart.

Referenced by OnText_PitchPercentChangeStart().

Here is the caller graph for this function:

◆ Update_Text_PitchPercentChangeEnd()

void EffectTimeScale::Update_Text_PitchPercentChangeEnd ( )
private

Definition at line 385 of file TimeScale.cpp.

386 {
387  m_pTextCtrl_PitchPercentChangeEnd->GetValidator()->TransferToWindow();
388 }

References m_pTextCtrl_PitchPercentChangeEnd.

Referenced by OnText_PitchHalfStepsEnd().

Here is the caller graph for this function:

◆ Update_Text_PitchPercentChangeStart()

void EffectTimeScale::Update_Text_PitchPercentChangeStart ( )
private

Definition at line 380 of file TimeScale.cpp.

381 {
382  m_pTextCtrl_PitchPercentChangeStart->GetValidator()->TransferToWindow();
383 }

References m_pTextCtrl_PitchPercentChangeStart.

Referenced by OnText_PitchHalfStepsStart().

Here is the caller graph for this function:

◆ Update_Text_RatePercentChangeEnd()

void EffectTimeScale::Update_Text_RatePercentChangeEnd ( )
private

Definition at line 355 of file TimeScale.cpp.

356 {
357  m_pTextCtrl_RatePercentChangeEnd->GetValidator()->TransferToWindow();
358 }

References m_pTextCtrl_RatePercentChangeEnd.

Referenced by OnSlider_RatePercentChangeEnd().

Here is the caller graph for this function:

◆ Update_Text_RatePercentChangeStart()

void EffectTimeScale::Update_Text_RatePercentChangeStart ( )
private

Definition at line 350 of file TimeScale.cpp.

351 {
352  m_pTextCtrl_RatePercentChangeStart->GetValidator()->TransferToWindow();
353 }

References m_pTextCtrl_RatePercentChangeStart.

Referenced by OnSlider_RatePercentChangeStart().

Here is the caller graph for this function:

Member Data Documentation

◆ bPreview

bool EffectTimeScale::bPreview
private

Definition at line 85 of file TimeScale.h.

Referenced by Preview(), and Process().

◆ m_PitchHalfStepsEnd

double EffectTimeScale::m_PitchHalfStepsEnd
private

◆ m_PitchHalfStepsStart

double EffectTimeScale::m_PitchHalfStepsStart
private

◆ m_PitchPercentChangeEnd

double EffectTimeScale::m_PitchPercentChangeEnd
private

◆ m_PitchPercentChangeStart

double EffectTimeScale::m_PitchPercentChangeStart
private

◆ m_pSlider_RatePercentChangeEnd

wxSlider* EffectTimeScale::m_pSlider_RatePercentChangeEnd
private

Definition at line 99 of file TimeScale.h.

Referenced by PopulateOrExchange(), and Update_Slider_RatePercentChangeEnd().

◆ m_pSlider_RatePercentChangeStart

wxSlider* EffectTimeScale::m_pSlider_RatePercentChangeStart
private

Definition at line 98 of file TimeScale.h.

Referenced by PopulateOrExchange(), and Update_Slider_RatePercentChangeStart().

◆ m_pTextCtrl_PitchHalfStepsEnd

wxTextCtrl* EffectTimeScale::m_pTextCtrl_PitchHalfStepsEnd
private

Definition at line 101 of file TimeScale.h.

Referenced by PopulateOrExchange(), and Update_Text_PitchHalfStepsEnd().

◆ m_pTextCtrl_PitchHalfStepsStart

wxTextCtrl* EffectTimeScale::m_pTextCtrl_PitchHalfStepsStart
private

Definition at line 100 of file TimeScale.h.

Referenced by PopulateOrExchange(), and Update_Text_PitchHalfStepsStart().

◆ m_pTextCtrl_PitchPercentChangeEnd

wxTextCtrl* EffectTimeScale::m_pTextCtrl_PitchPercentChangeEnd
private

Definition at line 103 of file TimeScale.h.

Referenced by PopulateOrExchange(), and Update_Text_PitchPercentChangeEnd().

◆ m_pTextCtrl_PitchPercentChangeStart

wxTextCtrl* EffectTimeScale::m_pTextCtrl_PitchPercentChangeStart
private

Definition at line 102 of file TimeScale.h.

Referenced by PopulateOrExchange(), and Update_Text_PitchPercentChangeStart().

◆ m_pTextCtrl_RatePercentChangeEnd

wxTextCtrl* EffectTimeScale::m_pTextCtrl_RatePercentChangeEnd
private

Definition at line 97 of file TimeScale.h.

Referenced by PopulateOrExchange(), and Update_Text_RatePercentChangeEnd().

◆ m_pTextCtrl_RatePercentChangeStart

wxTextCtrl* EffectTimeScale::m_pTextCtrl_RatePercentChangeStart
private

Definition at line 96 of file TimeScale.h.

Referenced by PopulateOrExchange(), and Update_Text_RatePercentChangeStart().

◆ m_RatePercentChangeEnd

double EffectTimeScale::m_RatePercentChangeEnd
private

◆ m_RatePercentChangeStart

double EffectTimeScale::m_RatePercentChangeStart
private

◆ previewSelectedDuration

double EffectTimeScale::previewSelectedDuration
private

Definition at line 86 of file TimeScale.h.

Referenced by Preview(), and Process().

◆ slideTypePitch

SlideType EffectTimeScale::slideTypePitch
private

Definition at line 88 of file TimeScale.h.

Referenced by Process().

◆ slideTypeRate

SlideType EffectTimeScale::slideTypeRate
private

Definition at line 87 of file TimeScale.h.

Referenced by CalcPreviewInputLength(), and Process().

◆ Symbol

const ComponentInterfaceSymbol EffectTimeScale::Symbol { wxT("Sliding Stretch"), XO("Sliding Stretch") }
static

Definition at line 27 of file TimeScale.h.

Referenced by GetSymbol().


The documentation for this class was generated from the following files:
ID_PitchHalfStepsEnd
@ ID_PitchHalfStepsEnd
Definition: TimeScale.cpp:36
valueRestorer
ValueRestorer< T > valueRestorer(T &var)
inline functions provide convenient parameter type deduction
Definition: MemoryX.h:226
Effect::GetDuration
double GetDuration() override
Definition: Effect.cpp:769
EffectTypeProcess
@ EffectTypeProcess
Definition: EffectInterface.h:56
Effect::SetLinearEffectFlag
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: Effect.cpp:1764
EffectTimeScale::Update_Text_PitchHalfStepsStart
void Update_Text_PitchHalfStepsStart()
Definition: TimeScale.cpp:370
Effect::EnableApply
bool EnableApply(bool enable=true)
Definition: Effect.cpp:1694
S
#define S(N)
Definition: ToChars.cpp:64
EffectTimeScale::Update_Text_PitchHalfStepsEnd
void Update_Text_PitchHalfStepsEnd()
Definition: TimeScale.cpp:375
ID_PitchPercentChangeStart
@ ID_PitchPercentChangeStart
Definition: TimeScale.cpp:37
EffectTimeScale::m_pTextCtrl_RatePercentChangeEnd
wxTextCtrl * m_pTextCtrl_RatePercentChangeEnd
Definition: TimeScale.h:97
ID_PitchPercentChangeEnd
@ ID_PitchPercentChangeEnd
Definition: TimeScale.cpp:38
Effect::mT1
double mT1
Definition: Effect.h:424
XO
#define XO(s)
Definition: Internat.h:31
EffectTimeScale::m_pTextCtrl_PitchHalfStepsEnd
wxTextCtrl * m_pTextCtrl_PitchHalfStepsEnd
Definition: TimeScale.h:101
EffectTimeScale::previewSelectedDuration
double previewSelectedDuration
Definition: TimeScale.h:86
EffectTimeScale::PercentChangeToRatio
double PercentChangeToRatio(double percentChange)
Definition: TimeScale.cpp:335
EffectTimeScale::m_pSlider_RatePercentChangeStart
wxSlider * m_pSlider_RatePercentChangeStart
Definition: TimeScale.h:98
XXO
#define XXO(s)
Definition: Internat.h:44
Effect::mT0
double mT0
Definition: Effect.h:423
EffectTimeScale::m_PitchHalfStepsEnd
double m_PitchHalfStepsEnd
Definition: TimeScale.h:92
EffectTimeScale::m_PitchPercentChangeStart
double m_PitchPercentChangeStart
Definition: TimeScale.h:93
EffectTimeScale::Update_Text_PitchPercentChangeStart
void Update_Text_PitchPercentChangeStart()
Definition: TimeScale.cpp:380
ID_RatePercentChangeEnd
@ ID_RatePercentChangeEnd
Definition: TimeScale.cpp:34
EffectTimeScale::m_PitchHalfStepsStart
double m_PitchHalfStepsStart
Definition: TimeScale.h:91
ReadAndVerifyDouble
#define ReadAndVerifyDouble(name)
Definition: Effect.h:592
Effect::Preview
virtual void Preview(bool dryOnly)
Definition: Effect.cpp:2053
ID_RatePercentChangeStart
@ ID_RatePercentChangeStart
Definition: TimeScale.cpp:33
EffectSBSMS::getRate
static double getRate(double rateStart, double rateEnd, SlideType slideType, double t)
Definition: SBSMSEffect.cpp:207
EffectTimeScale::Update_Text_RatePercentChangeStart
void Update_Text_RatePercentChangeStart()
Definition: TimeScale.cpp:350
EffectTimeScale::m_pTextCtrl_PitchPercentChangeStart
wxTextCtrl * m_pTextCtrl_PitchPercentChangeStart
Definition: TimeScale.h:102
EffectSBSMS::getInvertedStretchedTime
static double getInvertedStretchedTime(double rateStart, double rateEnd, SlideType slideType, double outputTime)
Definition: SBSMSEffect.cpp:201
EffectTimeScale::Update_Slider_RatePercentChangeEnd
void Update_Slider_RatePercentChangeEnd()
Definition: TimeScale.cpp:365
EffectTimeScale::slideTypeRate
SlideType slideTypeRate
Definition: TimeScale.h:87
Effect::mUIParent
wxWindow * mUIParent
Definition: Effect.h:438
EffectTimeScale::slideTypePitch
SlideType slideTypePitch
Definition: TimeScale.h:88
EffectTimeScale::m_RatePercentChangeEnd
double m_RatePercentChangeEnd
Definition: TimeScale.h:90
EffectTimeScale::m_pTextCtrl_PitchHalfStepsStart
wxTextCtrl * m_pTextCtrl_PitchHalfStepsStart
Definition: TimeScale.h:100
EffectTimeScale::PercentChangeToHalfSteps
double PercentChangeToHalfSteps(double percentChange)
Definition: TimeScale.cpp:345
EffectTimeScale::m_RatePercentChangeStart
double m_RatePercentChangeStart
Definition: TimeScale.h:89
EffectTimeScale::m_pTextCtrl_PitchPercentChangeEnd
wxTextCtrl * m_pTextCtrl_PitchPercentChangeEnd
Definition: TimeScale.h:103
EffectTimeScale::m_pSlider_RatePercentChangeEnd
wxSlider * m_pSlider_RatePercentChangeEnd
Definition: TimeScale.h:99
EffectTimeScale::m_PitchPercentChangeEnd
double m_PitchPercentChangeEnd
Definition: TimeScale.h:94
EffectTimeScale::Update_Text_RatePercentChangeEnd
void Update_Text_RatePercentChangeEnd()
Definition: TimeScale.cpp:355
ID_PitchHalfStepsStart
@ ID_PitchHalfStepsStart
Definition: TimeScale.cpp:35
EffectTimeScale::bPreview
bool bPreview
Definition: TimeScale.h:85
EffectTimeScale::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: TimeScale.h:27
EffectTimeScale::HalfStepsToPercentChange
double HalfStepsToPercentChange(double halfSteps)
Definition: TimeScale.cpp:340
EffectTimeScale::Update_Text_PitchPercentChangeEnd
void Update_Text_PitchPercentChangeEnd()
Definition: TimeScale.cpp:385
EffectTimeScale::Update_Slider_RatePercentChangeStart
void Update_Slider_RatePercentChangeStart()
Definition: TimeScale.cpp:360
EffectTimeScale::m_pTextCtrl_RatePercentChangeStart
wxTextCtrl * m_pTextCtrl_RatePercentChangeStart
Definition: TimeScale.h:96
EffectSBSMS::setParameters
void setParameters(double rateStart, double rateEnd, double pitchStart, double pitchEnd, SlideType rateSlideType, SlideType pitchSlideType, bool bLinkRatePitch, bool bRateReferenceInput, bool bPitchReferenceInput)
Definition: SBSMSEffect.cpp:148
EffectSBSMS::Process
bool Process() override
Definition: SBSMSEffect.cpp:213