1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-22 23:19:42 +02:00

Update Change Speed effect. Adds To/From time controls and a 'simple' speed multiplier.

Should also fix bugs 772 and 780.
This commit is contained in:
stevethefiddle@gmail.com 2014-11-22 19:12:57 +00:00
parent 5bffe9cecf
commit 07098fe324
2 changed files with 332 additions and 169 deletions

View File

@ -53,15 +53,20 @@ enum {
EffectChangeSpeed::EffectChangeSpeed()
{
// control values
m_PercentChange = 0.0;
mFromVinyl = kVinyl_33AndAThird;
mToVinyl = kVinyl_33AndAThird;
// Retrieve last used control values
gPrefs->Read(wxT("/Effects/ChangeSpeed/PercentChange"), &m_PercentChange, 0);
// default format "4" is the same as the Selection toolbar: "hh:mm:ss + milliseconds";
gPrefs->Read(wxT("/Effects/ChangeSpeed/TimeFormat"), &mTimeCtrlFormat, 4);
gPrefs->Read(wxT("/Effects/ChangeSpeed/VinylChoice"), &mFromVinyl, 0);
if (mFromVinyl == kVinyl_NA) {
mFromVinyl = kVinyl_33AndAThird;
}
}
wxString EffectChangeSpeed::GetEffectDescription() {
// Note: This is useful only after change amount has been set.
return wxString::Format(_("Applied effect: %s %.1f%%"),
return wxString::Format(_("Applied effect: %s %.3f%%"),
this->GetEffectName().c_str(),
m_PercentChange);
}
@ -76,7 +81,8 @@ bool EffectChangeSpeed::PromptUser()
ChangeSpeedDialog dlog(this, mParent);
dlog.m_PercentChange = m_PercentChange;
dlog.mFromVinyl = mFromVinyl;
dlog.mToVinyl = mToVinyl;
dlog.mFromLength = mFromLength;
dlog.mTimeCtrlFormat = mTimeCtrlFormat;
// Don't need to call TransferDataToWindow, although other
// Audacity dialogs (from which I derived this one) do it, because
// ShowModal calls stuff that eventually calls wxWindowBase::OnInitDialog,
@ -89,14 +95,19 @@ bool EffectChangeSpeed::PromptUser()
m_PercentChange = dlog.m_PercentChange;
mFromVinyl = dlog.mFromVinyl;
mToVinyl = dlog.mToVinyl;
mTimeCtrlFormat = dlog.mTimeCtrlFormat;
gPrefs->Write(wxT("/Effects/ChangeSpeed/PercentChange"), m_PercentChange);
gPrefs->Write(wxT("/Effects/ChangeSpeed/TimeFormat"), mTimeCtrlFormat);
gPrefs->Flush();
return true;
}
bool EffectChangeSpeed::TransferParameters(Shuttle& shuttle)
bool EffectChangeSpeed::Init()
{
shuttle.TransferDouble(wxT("Percentage"), m_PercentChange, 0.0);
// The selection might have changed since the last time EffectChangeSpeed
// was invoked, so recalculate the Length parameters.
mFromLength = mT1 - mT0;
return true;
}
@ -295,13 +306,17 @@ bool EffectChangeSpeed::ProcessOne(WaveTrack * track,
#define PERCENTCHANGE_MIN -99
#define PERCENTCHANGE_MAX 100 // warped above zero to actually go up to 400%
#define PERCENTCHANGE_MAX_TEXT 4900 // maximum allowed by text entry (= 50 times)
#define PERCENTCHANGE_SLIDER_WARP 1.30105 // warp power takes max from 100 to 400.
enum {
ID_TEXT_PERCENTCHANGE = 10001,
ID_TEXT_MULTIPLIER,
ID_SLIDER_PERCENTCHANGE,
ID_CHOICE_FROMVINYL,
ID_CHOICE_TOVINYL
ID_CHOICE_TOVINYL,
ID_TIMECTRL_FROMLENGTH,
ID_TIMECTRL_TOLENGTH
};
@ -309,9 +324,12 @@ enum {
BEGIN_EVENT_TABLE(ChangeSpeedDialog, EffectDialog)
EVT_TEXT(ID_TEXT_PERCENTCHANGE, ChangeSpeedDialog::OnText_PercentChange)
EVT_TEXT(ID_TEXT_MULTIPLIER, ChangeSpeedDialog::OnText_Multiplier)
EVT_SLIDER(ID_SLIDER_PERCENTCHANGE, ChangeSpeedDialog::OnSlider_PercentChange)
EVT_CHOICE(ID_CHOICE_FROMVINYL, ChangeSpeedDialog::OnChoice_FromVinyl)
EVT_CHOICE(ID_CHOICE_TOVINYL, ChangeSpeedDialog::OnChoice_ToVinyl)
EVT_CHOICE(ID_CHOICE_FROMVINYL, ChangeSpeedDialog::OnChoice_Vinyl)
EVT_CHOICE(ID_CHOICE_TOVINYL, ChangeSpeedDialog::OnChoice_Vinyl)
EVT_TEXT(ID_TIMECTRL_TOLENGTH, ChangeSpeedDialog::OnTimeCtrl_ToLength)
EVT_COMMAND(ID_TIMECTRL_TOLENGTH, EVT_TIMETEXTCTRL_UPDATED, ChangeSpeedDialog::OnTimeCtrlUpdate)
EVT_BUTTON(ID_EFFECT_PREVIEW, ChangeSpeedDialog::OnPreview)
END_EVENT_TABLE()
@ -325,18 +343,14 @@ ChangeSpeedDialog::ChangeSpeedDialog(EffectChangeSpeed *effect, wxWindow *parent
{
mbLoopDetect = false;
// NULL out these control members because there are some cases where the
// event table handlers get called during this method, and those handlers that
// can cause trouble check for NULL.
mpTextCtrl_PercentChange = NULL;
mpSlider_PercentChange = NULL;
mpChoice_FromVinyl = NULL;
mpChoice_ToVinyl = NULL;
// effect parameters
m_PercentChange = 0.0;
mFromVinyl = kVinyl_33AndAThird;
mToVinyl = kVinyl_33AndAThird;
mFromLength = 0.0;
mToLength = 0.0;
mFormat = wxT("");
mTimeCtrlFormat = 0;
Init();
}
@ -347,18 +361,23 @@ void ChangeSpeedDialog::PopulateOrExchange(ShuttleGui & S)
S.AddSpace(0, 5);
S.AddTitle(_("Change Speed, affecting both Tempo and Pitch"));
S.AddSpace(0, 10);
//
S.StartMultiColumn(2, wxCENTER);
// Speed multiplier and percent change controls.
S.StartMultiColumn(4, wxLEFT);
{
wxTextValidator validator(wxFILTER_NUMERIC);
mpTextCtrl_Multiplier =
S.Id(ID_TEXT_MULTIPLIER).AddTextBox(_("Speed Multiplier:"), wxT(""), 12);
mpTextCtrl_Multiplier->SetValidator(validator);
mpTextCtrl_PercentChange =
S.Id(ID_TEXT_PERCENTCHANGE).AddTextBox(_("Percent Change:"), wxT(""), 12);
wxTextValidator validator(wxFILTER_NUMERIC);
mpTextCtrl_PercentChange->SetValidator(validator);
}
S.EndMultiColumn();
//
// Percent change slider.
S.StartHorizontalLay(wxEXPAND);
{
S.SetStyle(wxSL_HORIZONTAL);
@ -368,9 +387,10 @@ void ChangeSpeedDialog::PopulateOrExchange(ShuttleGui & S)
}
S.EndHorizontalLay();
//
// Vinyl rpm controls.
S.StartMultiColumn(5, wxCENTER);
{
/* i18n-hint: "rpm" is an English abbreviation meaning "revolutions per minute". */
S.AddUnits(_("Standard Vinyl rpm:"));
wxArrayString rpmStrings;
@ -391,48 +411,78 @@ void ChangeSpeedDialog::PopulateOrExchange(ShuttleGui & S)
mpChoice_ToVinyl->SetSizeHints(100, -1);
}
S.EndMultiColumn();
// From/To time controls.
S.StartStatic(_("Selection Length"), 0);
{
S.StartMultiColumn(2, wxLEFT);
{
S.AddPrompt(_("Current Length") + wxString(wxT(":")));
mpFromLengthCtrl = new
NumericTextCtrl(NumericConverter::TIME, this,
ID_TIMECTRL_FROMLENGTH,
mFormat,
mFromLength,
mEffect->mProjectRate);
mpFromLengthCtrl->SetName(_("from"));
S.AddWindow(mpFromLengthCtrl);
#if wxUSE_TOOLTIPS
wxString tip(_("Current length of selection."));
mpFromLengthCtrl->SetToolTip(tip);
#endif
mpFromLengthCtrl->EnableMenu(false);
S.AddPrompt(_("New Length") + wxString(wxT(":")));
mpToLengthCtrl = new
NumericTextCtrl(NumericConverter::TIME, this,
ID_TIMECTRL_TOLENGTH,
mFormat,
mToLength,
mEffect->mProjectRate);
mpToLengthCtrl->SetName(_("to"));
S.AddWindow(mpToLengthCtrl);
mpToLengthCtrl->EnableMenu();
}
S.EndMultiColumn();
}
S.EndStatic();
}
bool ChangeSpeedDialog::TransferDataToWindow()
{
mbLoopDetect = true;
// percent change controls
this->Update_Text_PercentChange();
this->Update_Text_Multiplier();
this->Update_Slider_PercentChange();
this->Update_TimeCtrl_ToLength();
// from/to Vinyl controls
if (mpChoice_FromVinyl)
mpChoice_FromVinyl->SetSelection(mFromVinyl);
// Set from/to Vinyl controls - mFromVinyl must be set first.
mpChoice_FromVinyl->SetSelection(mFromVinyl);
// Then update to get correct mToVinyl.
this->Update_Vinyl();
// Then update ToVinyl control.
mpChoice_ToVinyl->SetSelection(mToVinyl);
if (mpChoice_ToVinyl)
mpChoice_ToVinyl->SetSelection(mToVinyl);
// Set From Length control.
// Set the format first so we can get sample accuracy.
mpFromLengthCtrl->SetFormatName(mFormat);
mpFromLengthCtrl->SetValue(mFromLength);
mbLoopDetect = false;
return true;
}
bool ChangeSpeedDialog::TransferDataFromWindow()
bool ChangeSpeedDialog::Validate()
{
// percent change
// Ignore mpSlider_PercentChange because mpTextCtrl_PercentChange
// always tracks it & is more precise (decimal points).
if (mpTextCtrl_PercentChange)
{
double newValue = 0;
wxString str = mpTextCtrl_PercentChange->GetValue();
str.ToDouble(&newValue);
m_PercentChange = newValue;
}
// from/to Vinyl controls
if (mpChoice_FromVinyl)
mFromVinyl = mpChoice_FromVinyl->GetSelection();
if (mpChoice_ToVinyl)
mToVinyl = mpChoice_ToVinyl->GetSelection();
TransferDataFromWindow();
m_PercentChange = TrapDouble(m_PercentChange, PERCENTCHANGE_MIN, PERCENTCHANGE_MAX_TEXT);
return true;
}
@ -444,19 +494,37 @@ void ChangeSpeedDialog::OnText_PercentChange(wxCommandEvent & WXUNUSED(event))
if (mbLoopDetect)
return;
if (mpTextCtrl_PercentChange) {
double newValue = 0;
wxString str = mpTextCtrl_PercentChange->GetValue();
str.ToDouble(&newValue);
m_PercentChange = newValue;
double newValue = 0;
wxString str = mpTextCtrl_PercentChange->GetValue();
str.ToDouble(&newValue);
m_PercentChange = newValue;
this->UpdateUI();
mbLoopDetect = true;
this->Update_Slider_PercentChange();
this->Update_Vinyl();
mbLoopDetect = false;
mbLoopDetect = true;
this->Update_Text_Multiplier();
this->Update_Slider_PercentChange();
this->Update_Vinyl();
this->Update_TimeCtrl_ToLength();
mbLoopDetect = false;
}
FindWindow(wxID_OK)->Enable(m_PercentChange > -100.0);
}
void ChangeSpeedDialog::OnText_Multiplier(wxCommandEvent & WXUNUSED(event))
{
if (mbLoopDetect)
return;
double newValue = 0;
wxString str = mpTextCtrl_Multiplier->GetValue();
str.ToDouble(&newValue);
m_PercentChange = 100 * (newValue - 1);
this->UpdateUI();
mbLoopDetect = true;
this->Update_Text_PercentChange();
this->Update_Slider_PercentChange();
this->Update_Vinyl();
this->Update_TimeCtrl_ToLength();
mbLoopDetect = false;
}
void ChangeSpeedDialog::OnSlider_PercentChange(wxCommandEvent & WXUNUSED(event))
@ -464,105 +532,32 @@ void ChangeSpeedDialog::OnSlider_PercentChange(wxCommandEvent & WXUNUSED(event))
if (mbLoopDetect)
return;
if (mpSlider_PercentChange) {
m_PercentChange = (double)(mpSlider_PercentChange->GetValue());
// Warp positive values to actually go up faster & further than negatives.
if (m_PercentChange > 0.0)
m_PercentChange = pow(m_PercentChange, PERCENTCHANGE_SLIDER_WARP);
m_PercentChange = (double)(mpSlider_PercentChange->GetValue());
// Warp positive values to actually go up faster & further than negatives.
if (m_PercentChange > 0.0)
m_PercentChange = pow(m_PercentChange, PERCENTCHANGE_SLIDER_WARP);
this->UpdateUI();
mbLoopDetect = true;
this->Update_Text_PercentChange();
this->Update_Vinyl();
mbLoopDetect = false;
}
mbLoopDetect = true;
this->Update_Text_PercentChange();
this->Update_Text_Multiplier();
this->Update_Vinyl();
this->Update_TimeCtrl_ToLength();
mbLoopDetect = false;
}
void ChangeSpeedDialog::OnChoice_FromVinyl(wxCommandEvent & WXUNUSED(event))
void ChangeSpeedDialog::OnChoice_Vinyl(wxCommandEvent & WXUNUSED(event))
{
if (mbLoopDetect)
return;
if (mpChoice_FromVinyl) {
mFromVinyl = mpChoice_FromVinyl->GetSelection();
mbLoopDetect = true;
this->Update_PercentChange();
mbLoopDetect = false;
// Treat mpChoice_FromVinyl and mpChoice_ToVinyl as one control since we need
// both to calculate Percent Change.
mFromVinyl = mpChoice_FromVinyl->GetSelection();
mToVinyl = mpChoice_ToVinyl->GetSelection();
// Use this as the 'preferred' choice.
if (mFromVinyl != kVinyl_NA) {
gPrefs->Write(wxT("/Effects/ChangeSpeed/VinylChoice"), mFromVinyl);
gPrefs->Flush();
}
}
void ChangeSpeedDialog::OnChoice_ToVinyl(wxCommandEvent & WXUNUSED(event))
{
if (mbLoopDetect)
return;
if (mpChoice_ToVinyl) {
mToVinyl = mpChoice_ToVinyl->GetSelection();
mbLoopDetect = true;
this->Update_PercentChange();
mbLoopDetect = false;
}
}
void ChangeSpeedDialog::OnPreview(wxCommandEvent & WXUNUSED(event))
{
TransferDataFromWindow();
// Save & restore parameters around Preview, because we didn't do OK.
double oldPercentChange = mEffect->m_PercentChange;
if( m_PercentChange < -99.0)
{
m_PercentChange = -99.0;
this->Update_Text_PercentChange();
}
mEffect->m_PercentChange = m_PercentChange;
mEffect->Preview();
mEffect->m_PercentChange = oldPercentChange;
}
// helper fns
void ChangeSpeedDialog::Update_Text_PercentChange()
{
if (mpTextCtrl_PercentChange) {
wxString str;
str.Printf(wxT("%.3f"), m_PercentChange);
mpTextCtrl_PercentChange->SetValue(str);
FindWindow(wxID_OK)->Enable(m_PercentChange > -100.0);
}
}
void ChangeSpeedDialog::Update_Slider_PercentChange()
{
if (mpSlider_PercentChange) {
double unwarped = m_PercentChange;
if (unwarped > 0.0)
// Un-warp values above zero to actually go up to PERCENTCHANGE_MAX.
unwarped = pow(m_PercentChange, (1.0 / PERCENTCHANGE_SLIDER_WARP));
// Add 0.5 to unwarped so trunc -> round.
mpSlider_PercentChange->SetValue((int)(unwarped + 0.5));
}
}
void ChangeSpeedDialog::Update_Vinyl()
// Update Vinyl controls for new percent change.
{
if (mpChoice_ToVinyl)
{
// Chances are so low that the slider will exactly match a
// standard ratio, just turn it "n/a" unless it's 0.0.
if ((m_PercentChange == 0.0) && mpChoice_FromVinyl)
mpChoice_ToVinyl->SetSelection(mpChoice_FromVinyl->GetSelection());
else
mpChoice_ToVinyl->SetSelection(kVinyl_NA);
}
}
void ChangeSpeedDialog::Update_PercentChange()
// Update percent change controls for new Vinyl values.
{
// If mFromVinyl & mToVinyl are set, then there's a new percent change.
if ((mFromVinyl != kVinyl_NA) && (mToVinyl != kVinyl_NA))
{
@ -581,9 +576,164 @@ void ChangeSpeedDialog::Update_PercentChange()
case kVinyl_78: toRPM = 78; break;
}
m_PercentChange = ((toRPM * 100.0) / fromRPM) - 100.0;
this->UpdateUI();
mbLoopDetect = true;
this->Update_Text_PercentChange();
this->Update_Text_Multiplier();
this->Update_Slider_PercentChange();
this->Update_TimeCtrl_ToLength();
}
mbLoopDetect = false;
}
void ChangeSpeedDialog::OnTimeCtrl_ToLength(wxCommandEvent & WXUNUSED(event))
{
if (mbLoopDetect)
return;
mToLength = mpToLengthCtrl->GetValue();
m_PercentChange = ((mFromLength * 100.0) / mToLength) - 100.0;
this->UpdateUI();
mbLoopDetect = true;
this->Update_Text_PercentChange();
this->Update_Text_Multiplier();
this->Update_Slider_PercentChange();
this->Update_Vinyl();
mbLoopDetect = false;
}
void ChangeSpeedDialog::OnTimeCtrlUpdate(wxCommandEvent &evt)
{
mTimeCtrlFormat = evt.GetInt();
mFormat = mpToLengthCtrl->GetBuiltinName(mTimeCtrlFormat);
mpFromLengthCtrl->SetFormatName(mFormat);
// Update From/To Length controls (precision has changed).
mpToLengthCtrl->SetValue(mToLength);
mpFromLengthCtrl->SetValue(mFromLength);
}
void ChangeSpeedDialog::OnPreview(wxCommandEvent & WXUNUSED(event))
{
TransferDataFromWindow();
// Save & restore parameters around Preview, because we didn't do OK.
double oldPercentChange = mEffect->m_PercentChange;
// bug 773 allows effects to bypass greyed out OK button,
// but validate() should now catch that.
wxASSERT((m_PercentChange >= PERCENTCHANGE_MIN) && (m_PercentChange <= PERCENTCHANGE_MAX_TEXT));
mEffect->m_PercentChange = m_PercentChange;
mEffect->Preview();
mEffect->m_PercentChange = oldPercentChange;
}
// helper functions
void ChangeSpeedDialog::Update_Text_PercentChange()
// Update Text Percent control from percent change.
{
wxString str;
str.Printf(wxT("%.3f"), m_PercentChange);
mpTextCtrl_PercentChange->SetValue(str);
}
void ChangeSpeedDialog::Update_Text_Multiplier()
// Update Multiplier control from percent change.
{
wxString str;
str.Printf(wxT("%.3f"), 1 + (m_PercentChange) / 100.0);
mpTextCtrl_Multiplier->SetValue(str);
}
void ChangeSpeedDialog::Update_Slider_PercentChange()
// Update Slider Percent control from percent change.
{
double unwarped = m_PercentChange;
if (unwarped > 0.0)
// Un-warp values above zero to actually go up to PERCENTCHANGE_MAX.
unwarped = pow(m_PercentChange, (1.0 / PERCENTCHANGE_SLIDER_WARP));
// Add 0.5 to unwarped so trunc -> round.
mpSlider_PercentChange->SetValue((int)(unwarped + 0.5));
}
void ChangeSpeedDialog::Update_Vinyl()
// Update Vinyl controls from percent change.
{
// Match Vinyl rpm when within 0.01% of a standard ratio.
// Ratios calculated as: ((toRPM / fromRPM) - 1) * 100 * 100
int ratio = wxRound(m_PercentChange * 100);
switch (ratio)
{
case 0: // toRPM is the same as fromRPM
if (mFromVinyl != kVinyl_NA) {
mpChoice_ToVinyl->SetSelection(mpChoice_FromVinyl->GetSelection());
} else {
// Use the last saved option.
gPrefs->Read(wxT("/Effects/ChangeSpeed/VinylChoice"), &mFromVinyl, 0);
mpChoice_FromVinyl->SetSelection(mFromVinyl);
mpChoice_ToVinyl->SetSelection(mFromVinyl);
}
break;
case 3500:
mpChoice_FromVinyl->SetSelection(kVinyl_33AndAThird);
mpChoice_ToVinyl->SetSelection(kVinyl_45);
break;
case 13400:
mpChoice_FromVinyl->SetSelection(kVinyl_33AndAThird);
mpChoice_ToVinyl->SetSelection(kVinyl_78);
break;
case -2593:
mpChoice_FromVinyl->SetSelection(kVinyl_45);
mpChoice_ToVinyl->SetSelection(kVinyl_33AndAThird);
break;
case 7333:
mpChoice_FromVinyl->SetSelection(kVinyl_45);
mpChoice_ToVinyl->SetSelection(kVinyl_78);
break;
case -5727:
mpChoice_FromVinyl->SetSelection(kVinyl_78);
mpChoice_ToVinyl->SetSelection(kVinyl_33AndAThird);
break;
case -4231:
mpChoice_FromVinyl->SetSelection(kVinyl_78);
mpChoice_ToVinyl->SetSelection(kVinyl_45);
break;
default:
mpChoice_ToVinyl->SetSelection(kVinyl_NA);
}
// and update variables.
mFromVinyl = mpChoice_FromVinyl->GetSelection();
mToVinyl = mpChoice_ToVinyl->GetSelection();
}
void ChangeSpeedDialog::Update_TimeCtrl_ToLength()
// Update ToLength control from percent change.
{
mToLength = (mFromLength * 100.0) / (100.0 + m_PercentChange);
// Set the format first so we can get sample accuracy.
mFormat = mpToLengthCtrl->GetBuiltinName(mTimeCtrlFormat);
mpToLengthCtrl->SetFormatName(mFormat);
// Negative times do not make sense.
// 359999 = 99h:59m:59s which is a little less disturbing than overflow characters
// though it may still look a bit strange with some formats.
mToLength = TrapDouble(mToLength, 0.0, 359999.0);
mpToLengthCtrl->SetValue(mToLength);
}
void ChangeSpeedDialog::UpdateUI()
// Disable OK and Preview if not in sensible range.
{
bool enabled = (m_PercentChange < PERCENTCHANGE_MIN ||
m_PercentChange > PERCENTCHANGE_MAX_TEXT)? false : true;
FindWindow(wxID_OK)->Enable(enabled);
FindWindow(ID_EFFECT_PREVIEW)->Enable(enabled);
}

View File

@ -22,6 +22,7 @@
#include <wx/slider.h>
#include <wx/string.h>
#include <wx/textctrl.h>
#include "../widgets/NumericTextCtrl.h"
class EffectChangeSpeed : public Effect
{
@ -52,8 +53,8 @@ class EffectChangeSpeed : public Effect
double CalcPreviewInputLength(double previewLength);
protected:
virtual bool Init();
virtual bool PromptUser();
virtual bool TransferParameters( Shuttle & shuttle );
virtual bool CheckWhetherSkipEffect() { return (m_PercentChange == 0.0); }
virtual bool Process();
@ -74,8 +75,9 @@ class EffectChangeSpeed : public Effect
// -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
int mToVinyl; // to standard vinyl speed (RPM) enum
double mFactor; // scale factor calculated from percent change
double mFromLength; // current selection length
int mTimeCtrlFormat; // time control format index number
friend class ChangeSpeedDialog;
};
@ -89,40 +91,52 @@ class ChangeSpeedDialog : public EffectDialog
void PopulateOrExchange(ShuttleGui& S);
bool TransferDataToWindow();
bool TransferDataFromWindow();
bool Validate();
private:
// handlers
void OnText_PercentChange(wxCommandEvent & event);
void OnText_Multiplier(wxCommandEvent & event);
void OnSlider_PercentChange(wxCommandEvent & event);
void OnChoice_FromVinyl(wxCommandEvent & event);
void OnChoice_ToVinyl(wxCommandEvent & event);
void OnChoice_Vinyl(wxCommandEvent & event);
void OnTimeCtrl_ToLength(wxCommandEvent & event);
void OnTimeCtrlUpdate(wxCommandEvent & event);
void OnPreview(wxCommandEvent &event);
// helper fns
// 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_PercentChange(); // Update percent change controls for new Vinyl values.
void Update_TimeCtrl_ToLength(); // Update target length controls for new percent change.
void UpdateUI(); // Enable / disable OK / preview.
private:
EffectChangeSpeed * mEffect;
bool mbLoopDetect;
// controls
wxTextCtrl * mpTextCtrl_PercentChange;
wxSlider * mpSlider_PercentChange;
wxChoice * mpChoice_FromVinyl;
wxChoice * mpChoice_ToVinyl;
wxTextCtrl * mpTextCtrl_PercentChange;
wxTextCtrl * mpTextCtrl_Multiplier;
wxSlider * mpSlider_PercentChange;
wxChoice * mpChoice_FromVinyl;
wxChoice * mpChoice_ToVinyl;
NumericTextCtrl * mpFromLengthCtrl;
NumericTextCtrl * mpToLengthCtrl;
double mRate;
public:
// effect parameters
double m_PercentChange; // percent change to apply to tempo
double m_PercentChange; // percent change to apply to tempo
// -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)
int mToVinyl; // to standard vinyl speed (RPM)
int mFromVinyl; // from standard vinyl speed (rpm)
int mToVinyl; // to standard vinyl speed (rpm)
double mFromLength; // current selection length
double mToLength; // target length of selection
wxString mFormat; // time control format
int mTimeCtrlFormat; // time control format index
private:
DECLARE_EVENT_TABLE()
@ -130,4 +144,3 @@ class ChangeSpeedDialog : public EffectDialog
#endif // __AUDACITY_EFFECT_CHANGESPEED__