2010-01-23 19:44:49 +00:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
|
|
|
|
ChangeSpeed.h
|
|
|
|
|
|
|
|
Vaughan Johnson, Dominic Mazzoni
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2010-01-23 19:44:49 +00:00
|
|
|
Change Speed effect, that affects both pitch & tempo.
|
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
#ifndef __AUDACITY_EFFECT_CHANGESPEED__
|
|
|
|
#define __AUDACITY_EFFECT_CHANGESPEED__
|
|
|
|
|
|
|
|
#include <wx/choice.h>
|
2015-04-17 03:53:42 +00:00
|
|
|
#include <wx/event.h>
|
2010-01-23 19:44:49 +00:00
|
|
|
#include <wx/slider.h>
|
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/textctrl.h>
|
2015-04-17 03:53:42 +00:00
|
|
|
|
2014-11-22 19:12:57 +00:00
|
|
|
#include "../widgets/NumericTextCtrl.h"
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
#include "Effect.h"
|
|
|
|
|
2015-06-18 14:24:36 +00:00
|
|
|
class ShuttleGui;
|
|
|
|
|
2015-04-19 03:49:05 +00:00
|
|
|
#define CHANGESPEED_PLUGIN_SYMBOL XO("Change Speed")
|
2015-04-17 03:53:42 +00:00
|
|
|
|
2014-06-03 20:30:19 +00:00
|
|
|
class EffectChangeSpeed : public Effect
|
2010-08-26 22:05:52 +00:00
|
|
|
{
|
2015-04-17 03:53:42 +00:00
|
|
|
public:
|
2010-01-23 19:44:49 +00:00
|
|
|
EffectChangeSpeed();
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual ~EffectChangeSpeed();
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// IdentInterface implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual wxString GetSymbol();
|
|
|
|
virtual wxString GetDescription();
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// EffectIdentInterface implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual EffectType GetType();
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// EffectClientInterface implementation
|
2014-06-03 20:30:19 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual bool GetAutomationParameters(EffectAutomationParameters & parms);
|
|
|
|
virtual bool SetAutomationParameters(EffectAutomationParameters & parms);
|
2015-04-27 15:52:42 +00:00
|
|
|
virtual bool LoadFactoryDefaults();
|
2013-03-08 05:01:07 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// Effect implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual bool CheckWhetherSkipEffect();
|
|
|
|
virtual double CalcPreviewInputLength(double previewLength);
|
|
|
|
virtual bool Startup();
|
|
|
|
virtual bool Init();
|
2010-01-23 19:44:49 +00:00
|
|
|
virtual bool Process();
|
2015-04-17 03:53:42 +00:00
|
|
|
virtual void PopulateOrExchange(ShuttleGui & S);
|
|
|
|
virtual bool TransferDataFromWindow();
|
|
|
|
virtual bool TransferDataToWindow();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// EffectChangeSpeed implementation
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
bool ProcessOne(WaveTrack *t, sampleCount start, sampleCount end);
|
2010-01-23 19:44:49 +00:00
|
|
|
bool ProcessLabelTrack(Track *t);
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
// handlers
|
|
|
|
void OnText_PercentChange(wxCommandEvent & evt);
|
|
|
|
void OnText_Multiplier(wxCommandEvent & evt);
|
|
|
|
void OnSlider_PercentChange(wxCommandEvent & evt);
|
|
|
|
void OnChoice_Vinyl(wxCommandEvent & evt);
|
|
|
|
void OnTimeCtrl_ToLength(wxCommandEvent & evt);
|
|
|
|
void OnTimeCtrlUpdate(wxCommandEvent & evt);
|
|
|
|
|
|
|
|
// helper functions
|
|
|
|
void Update_Text_PercentChange(); // Update control per current m_PercentChange.
|
|
|
|
void Update_Text_Multiplier(); // Update control per current m_PercentChange.
|
|
|
|
void Update_Slider_PercentChange(); // Update control per current m_PercentChange.
|
|
|
|
void Update_Vinyl(); // Update Vinyl controls for new percent change.
|
|
|
|
void Update_TimeCtrl_ToLength(); // Update target length controls for new percent change.
|
|
|
|
void UpdateUI(); // Enable / disable OK / preview.
|
|
|
|
|
|
|
|
private:
|
2013-02-23 04:33:20 +00:00
|
|
|
// track related
|
2010-01-23 19:44:49 +00:00
|
|
|
int mCurTrackNum;
|
2010-08-26 22:05:52 +00:00
|
|
|
double mMaxNewLength;
|
2010-01-23 19:44:49 +00:00
|
|
|
double mCurT0;
|
|
|
|
double mCurT1;
|
|
|
|
|
2013-02-23 04:33:20 +00:00
|
|
|
// control values
|
2013-03-08 05:01:07 +00:00
|
|
|
double m_PercentChange; // percent change to apply to tempo
|
2013-02-23 04:33:20 +00:00
|
|
|
// -100% is meaningless, but sky's the upper limit.
|
|
|
|
// Slider is (-100, 200], but textCtrls can set higher.
|
|
|
|
int mFromVinyl; // from standard vinyl speed (RPM) enum
|
2010-08-26 22:05:52 +00:00
|
|
|
double mFactor; // scale factor calculated from percent change
|
2014-11-22 19:12:57 +00:00
|
|
|
double mFromLength; // current selection length
|
|
|
|
int mTimeCtrlFormat; // time control format index number
|
2015-04-17 03:53:42 +00:00
|
|
|
double mMultiplier;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2013-02-23 04:33:20 +00:00
|
|
|
bool mbLoopDetect;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
|
|
|
// controls
|
2014-11-22 19:12:57 +00:00
|
|
|
wxTextCtrl * mpTextCtrl_PercentChange;
|
|
|
|
wxTextCtrl * mpTextCtrl_Multiplier;
|
|
|
|
wxSlider * mpSlider_PercentChange;
|
|
|
|
wxChoice * mpChoice_FromVinyl;
|
|
|
|
wxChoice * mpChoice_ToVinyl;
|
|
|
|
NumericTextCtrl * mpFromLengthCtrl;
|
|
|
|
NumericTextCtrl * mpToLengthCtrl;
|
|
|
|
double mRate;
|
2010-01-23 19:44:49 +00:00
|
|
|
|
2014-11-25 03:09:54 +00:00
|
|
|
// private effect parameters
|
|
|
|
int mToVinyl; // to standard vinyl speed (rpm)
|
|
|
|
double mToLength; // target length of selection
|
|
|
|
wxString mFormat; // time control format
|
|
|
|
|
2015-04-17 03:53:42 +00:00
|
|
|
DECLARE_EVENT_TABLE();
|
2010-01-23 19:44:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __AUDACITY_EFFECT_CHANGESPEED__
|