mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-17 16:50:26 +02:00
incremental changes related to bug 309 based on Steve's off-list patch
This commit is contained in:
parent
fc0cb41356
commit
16e1958501
@ -462,9 +462,11 @@ bool ChangePitchDialog::TransferDataFromWindow()
|
|||||||
|
|
||||||
// calculations
|
// calculations
|
||||||
|
|
||||||
void ChangePitchDialog::Calc_ToFrequency()
|
void ChangePitchDialog::Calc_FromPitchIndex()
|
||||||
{
|
{
|
||||||
m_ToFrequency = (m_FromFrequency * (100.0 + m_PercentChange)) / 100.0;
|
m_FromPitchIndex = (int)(m_ToPitchIndex - m_SemitonesChange) % 12;
|
||||||
|
if (m_FromPitchIndex < 0)
|
||||||
|
m_FromPitchIndex += 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChangePitchDialog::Calc_ToPitchIndex()
|
void ChangePitchDialog::Calc_ToPitchIndex()
|
||||||
@ -488,6 +490,11 @@ void ChangePitchDialog::Calc_SemitonesChange_fromPercentChange()
|
|||||||
m_SemitonesChange = (12.0 * log((100.0 + m_PercentChange) / 100.0)) / log(2.0);
|
m_SemitonesChange = (12.0 * log((100.0 + m_PercentChange) / 100.0)) / log(2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChangePitchDialog::Calc_ToFrequency()
|
||||||
|
{
|
||||||
|
m_ToFrequency = (m_FromFrequency * (100.0 + m_PercentChange)) / 100.0;
|
||||||
|
}
|
||||||
|
|
||||||
void ChangePitchDialog::Calc_PercentChange()
|
void ChangePitchDialog::Calc_PercentChange()
|
||||||
{
|
{
|
||||||
m_PercentChange = 100.0 * (pow(2.0, (m_SemitonesChange / 12.0)) - 1.0);
|
m_PercentChange = 100.0 * (pow(2.0, (m_SemitonesChange / 12.0)) - 1.0);
|
||||||
@ -593,8 +600,16 @@ void ChangePitchDialog::OnText_FromFrequency(wxCommandEvent & WXUNUSED(event))
|
|||||||
this->Calc_ToFrequency();
|
this->Calc_ToFrequency();
|
||||||
this->Calc_ToPitchIndex();
|
this->Calc_ToPitchIndex();
|
||||||
|
|
||||||
|
// This is Steve's incremental fix for cross-updating issues related to bug 309.
|
||||||
|
// It's weird that in prior code (3 lines above this), we set m_FromPitchIndex,
|
||||||
|
// then call 2 Calc methods for the other members, and then this call to
|
||||||
|
// recalculate m_FromPitchIndex. Something's wrong there, but I want to figure
|
||||||
|
// out the overall best scheme, and this is an incremental fix.
|
||||||
|
this->Calc_FromPitchIndex();
|
||||||
|
|
||||||
m_bLoopDetect = true;
|
m_bLoopDetect = true;
|
||||||
this->Update_Choice_ToPitch();
|
this->Update_Choice_ToPitch();
|
||||||
|
this->Update_Choice_FromPitch();
|
||||||
this->Update_Text_ToFrequency();
|
this->Update_Text_ToFrequency();
|
||||||
m_bLoopDetect = false;
|
m_bLoopDetect = false;
|
||||||
|
|
||||||
@ -723,7 +738,13 @@ void ChangePitchDialog::OnPreview(wxCommandEvent & WXUNUSED(event))
|
|||||||
mEffect->m_SemitonesChange = oldSemitonesChange;
|
mEffect->m_SemitonesChange = oldSemitonesChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper fns
|
// helper fns for controls
|
||||||
|
|
||||||
|
void ChangePitchDialog::Update_Choice_FromPitch()
|
||||||
|
{
|
||||||
|
if (m_pChoice_FromPitch)
|
||||||
|
m_pChoice_FromPitch->SetSelection(m_FromPitchIndex);
|
||||||
|
}
|
||||||
|
|
||||||
void ChangePitchDialog::Update_Choice_ToPitch()
|
void ChangePitchDialog::Update_Choice_ToPitch()
|
||||||
{
|
{
|
||||||
@ -731,7 +752,6 @@ void ChangePitchDialog::Update_Choice_ToPitch()
|
|||||||
m_pChoice_ToPitch->SetSelection(m_ToPitchIndex);
|
m_pChoice_ToPitch->SetSelection(m_ToPitchIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ChangePitchDialog::Update_Text_SemitonesChange()
|
void ChangePitchDialog::Update_Text_SemitonesChange()
|
||||||
{
|
{
|
||||||
if (m_pTextCtrl_SemitonesChange) {
|
if (m_pTextCtrl_SemitonesChange) {
|
||||||
|
@ -95,10 +95,11 @@ class ChangePitchDialog:public EffectDialog {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// calculations
|
// calculations
|
||||||
void Calc_ToFrequency(); // Update m_ToFrequency from m_FromFrequency & m_PercentChange.
|
void Calc_FromPitchIndex(); // Update m_FromPitchIndex from new m_ToPitchIndex.
|
||||||
void Calc_ToPitchIndex(); // Update m_ToPitchIndex from new m_SemitonesChange.
|
void Calc_ToPitchIndex(); // Update m_ToPitchIndex from new m_SemitonesChange.
|
||||||
void Calc_SemitonesChange_fromPitches(); // Update m_SemitonesChange from new m_*PitchIndex-es.
|
void Calc_SemitonesChange_fromPitches(); // Update m_SemitonesChange from new m_*PitchIndex-es.
|
||||||
void Calc_SemitonesChange_fromPercentChange(); // Update m_SemitonesChange from new m_PercentChange.
|
void Calc_SemitonesChange_fromPercentChange(); // Update m_SemitonesChange from new m_PercentChange.
|
||||||
|
void Calc_ToFrequency(); // Update m_ToFrequency from m_FromFrequency & m_PercentChange.
|
||||||
void Calc_PercentChange(); // Update m_PercentChange based on new m_SemitonesChange.
|
void Calc_PercentChange(); // Update m_PercentChange based on new m_SemitonesChange.
|
||||||
|
|
||||||
// handlers
|
// handlers
|
||||||
@ -116,6 +117,7 @@ class ChangePitchDialog:public EffectDialog {
|
|||||||
void OnPreview( wxCommandEvent &event );
|
void OnPreview( wxCommandEvent &event );
|
||||||
|
|
||||||
// helper fns for controls
|
// helper fns for controls
|
||||||
|
void Update_Choice_FromPitch();
|
||||||
void Update_Choice_ToPitch();
|
void Update_Choice_ToPitch();
|
||||||
|
|
||||||
void Update_Text_SemitonesChange();
|
void Update_Text_SemitonesChange();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user