void AmplifyDialog::OnAmpSlider(wxCommandEvent & event) { if (mLoopDetect) return; mLoopDetect = true; wxString str; double dB = GetAmpSlider()->GetValue() / 10.0; ratio = pow(10.0,TrapDouble(dB, AMP_MIN, AMP_MAX)/20.0); double dB2 = (GetAmpSlider()->GetValue()-1) / 10.0; double ratio2 = pow(10.0,TrapDouble(dB2, AMP_MIN, AMP_MAX)/20.0); if (!GetClipCheckBox()->GetValue() && ratio * peak > 1.0 && ratio2 * peak < 1.0) ratio = 1.0 / peak; str.Printf(wxT("%.1f"), 20*log10(ratio)); GetAmpText()->SetValue(str); str.Printf(wxT("%.1f"), 20*log10(ratio*peak)); GetPeakText()->SetValue(str); mLoopDetect = false; CheckClip(); }
bool ToneGenDialog::TransferDataFromWindow() { wxTextCtrl *t; t = GetAmpText(); if (t) { double d; t->GetValue().ToDouble(&d); amplitude = TrapDouble(d, AMP_MIN, AMP_MAX); } t = GetFreqText(); if (t) { double d; t->GetValue().ToDouble(&d); frequency = TrapDouble(d, FREQ_MIN, FREQ_MAX); } wxChoice *c = GetWaveformChoice(); if (c) waveform = TrapLong(c->GetSelection(), WAVEFORM_MIN, WAVEFORM_MAX); wxCheckBox *cb = GetMixChoice(); if (cb) mix = cb->GetValue(); return TRUE; }
bool ToneGenDialog::TransferDataFromWindow() { ShuttleGui S( this, eIsGettingFromDialog ); PopulateOrExchange( S ); amplitude[0] = TrapDouble(amplitude[0], AMP_MIN, AMP_MAX); frequency[0] = TrapDouble(frequency[0], FREQ_MIN, FREQ_MAX); amplitude[1] = TrapDouble(amplitude[1], AMP_MIN, AMP_MAX); frequency[1] = TrapDouble(frequency[1], FREQ_MIN, FREQ_MAX); return true; }
bool ToneGenDialog::TransferDataFromWindow() { EffectDialog::TransferDataFromWindow(); amplitude[0] = TrapDouble(amplitude[0], AMP_MIN, AMP_MAX); frequency[0] = TrapDouble(frequency[0], FREQ_MIN, (float)(GetActiveProject()->GetRate())/2.); amplitude[1] = TrapDouble(amplitude[1], AMP_MIN, AMP_MAX); frequency[1] = TrapDouble(frequency[1], FREQ_MIN, (float)(GetActiveProject()->GetRate())/2.); // Must handle this ourselves since ShuttleGui doesn't know about it mDuration = mToneDurationT->GetTimeValue(); return true; }
bool AmplifyDialog::TransferDataToWindow() { wxSlider *slider; // limit range of gain double dB = TrapDouble(200*log10(ratio), AMP_MIN, AMP_MAX)/10.0; ratio = pow(10.0, dB/20.0); slider = GetAmpSlider(); if (slider) slider->SetValue((int)(200*log10(ratio)+0.5)); mLoopDetect = true; wxTextCtrl *text = GetAmpText(); if (text) { wxString str; str.Printf(wxT("%.1f"), 20*log10(ratio)); text->SetValue(str); } text = GetPeakText(); if (text) { wxString str; str.Printf(wxT("%.1f"), 20*log10(ratio*peak)); text->SetValue(str); } mLoopDetect = false; return TRUE; }
void AmplifyDialog::OnAmpText(wxCommandEvent & event) { if (mLoopDetect) return; wxTextCtrl *c = GetAmpText(); if (c) { double r; mLoopDetect = true; wxString val = c->GetValue(); val.ToDouble(&r); ratio = pow(10.0,TrapDouble(r*10, AMP_MIN, AMP_MAX)/200.0); wxSlider *slider = GetAmpSlider(); if (slider) slider->SetValue((int)(200*log10(ratio)+0.5)); wxString str; if( ratio*peak > 0.0 ) str.Printf(wxT("%.1f"), 20*log10(ratio*peak)); else str = _("-Infinity"); // the case when the waveform is all zero GetPeakText()->SetValue(str); mLoopDetect = false; } CheckClip(); }
bool EffectToneGen::SetAutomationParameters(EffectAutomationParameters & parms) { ReadAndVerifyEnum(Waveform, mWaveforms); ReadAndVerifyEnum(Interp, mInterpolations); if (mChirp) { ReadAndVerifyDouble(StartFreq); ReadAndVerifyDouble(EndFreq); ReadAndVerifyDouble(StartAmp); ReadAndVerifyDouble(EndAmp); mFrequency[0] = StartFreq; mFrequency[1] = EndFreq; mAmplitude[0] = StartAmp; mAmplitude[1] = EndAmp; } else { ReadAndVerifyDouble(Frequency); ReadAndVerifyDouble(Amplitude); mFrequency[0] = Frequency; mFrequency[1] = Frequency; mAmplitude[0] = Amplitude; mAmplitude[1] = Amplitude; } mWaveform = Waveform; mInterpolation = Interp; double freqMax = (GetActiveProject() ? GetActiveProject()->GetRate() : 44100.0) / 2.0; mFrequency[1] = TrapDouble(mFrequency[1], MIN_EndFreq, freqMax); return true; }
void AmplifyDialog::OnPeakText(wxCommandEvent & event) { if (mLoopDetect) return; wxTextCtrl *c = GetPeakText(); if (c) { double r; mLoopDetect = true; wxString val = c->GetValue(); val.ToDouble(&r); ratio = pow(10.0, r/20.0) / peak; double dB = TrapDouble(200*log10(ratio), AMP_MIN, AMP_MAX)/10.0; ratio = pow(10.0, dB/20.0); wxSlider *slider = GetAmpSlider(); if (slider) slider->SetValue((int)(10*dB+0.5)); wxString str; str.Printf(wxT("%.1f"), dB); GetAmpText()->SetValue(str); mLoopDetect = false; } CheckClip(); }
void AmplifyDialog::OnAmpText(wxCommandEvent & event) { if (mLoopDetect) return; wxTextCtrl *c = GetAmpText(); if (c) { double r; mLoopDetect = true; wxString val = c->GetValue(); val.ToDouble(&r); ratio = pow(10,TrapDouble(r*10, AMP_MIN, AMP_MAX)/200.0); wxSlider *slider = GetAmpSlider(); if (slider) slider->SetValue((int)(200*log10(ratio)+0.5)); wxString str; str.Printf("%.1f", 20*log10(ratio*peak)); GetPeakText()->SetValue(str); mLoopDetect = false; } CheckClip(); }
void BassTrebleDialog::OnLevelText(wxCommandEvent & WXUNUSED(event)) { double val; mLevelT->GetValue().ToDouble(&val); int newval = floor(val / 0.1 + 0.5); mLevelS->SetValue(TrapDouble(newval, LEVEL_MIN, LEVEL_MAX)); UpdateUI(); }
bool NoiseDialog::TransferDataFromWindow() { ShuttleGui S( this, eIsGettingFromDialog ); PopulateOrExchange( S ); nAmplitude = TrapDouble(nAmplitude, AMP_MIN, AMP_MAX); return true; }
bool DtmfDialog::TransferDataFromWindow() { EffectDialog::TransferDataFromWindow(); dAmplitude = TrapDouble(dAmplitude, AMP_MIN, AMP_MAX); // recalculate to make sure all values are up-to-date. This is especially // important if the user did not change any values in the dialog Recalculate(); return true; }
bool NoiseDialog::TransferDataFromWindow() { EffectDialog::TransferDataFromWindow(); nAmplitude = TrapDouble(nAmplitude, AMP_MIN, AMP_MAX); // Must handle this ourselves since ShuttleGui doesn't know about it nDuration = mNoiseDurationT->GetTimeValue(); return true; }
bool AmplifyDialog::TransferDataFromWindow() { wxString val = mAmpT->GetValue(); double r; val.ToDouble(&r); ratio = pow(10.0,TrapDouble(r*10, AMP_MIN, AMP_MAX)/200.0); noclip = !mClip->GetValue(); return true; }
void EffectAmplify::OnAmpSlider(wxCommandEvent & evt) { double dB = evt.GetInt() / SCL_Amp; mRatio = DB_TO_LINEAR(TrapDouble(dB, MIN_Amp, MAX_Amp)); double dB2 = (evt.GetInt() - 1) / SCL_Amp; double ratio2 = DB_TO_LINEAR(TrapDouble(dB2, MIN_Amp, MAX_Amp)); if (!mClip->GetValue() && mRatio * mPeak > 1.0 && ratio2 * mPeak < 1.0) { mRatio = 1.0 / mPeak; } mAmp = LINEAR_TO_DB(mRatio); mAmpT->GetValidator()->TransferToWindow(); mNewPeak = LINEAR_TO_DB(mRatio * mPeak); mNewPeakT->GetValidator()->TransferToWindow(); CheckClip(); }
bool WahwahDialog::TransferDataFromWindow() { wxTextCtrl *c; long x; c = GetFreqText(); if (c) { double d; c->GetValue().ToDouble(&d); freq = TrapDouble(d * 10, FREQ_MIN, FREQ_MAX) / 10; } c = GetFreqOffText(); if (c) { double d; c->GetValue().ToDouble(&d); freqoff = TrapDouble(d, FREQOFF_MIN, FREQOFF_MAX); } c = GetPhaseText(); if (c) { c->GetValue().ToLong(&x); startphase = TrapLong(x, PHASE_MIN, PHASE_MAX); } c = GetDepthText(); if (c) { c->GetValue().ToLong(&x); depth = TrapLong(x, DEPTH_MIN, DEPTH_MAX); } c = GetResonanceText(); if (c) { double d; c->GetValue().ToDouble(&d); res = TrapDouble(d * 10, RES_MIN, RES_MAX) / 10; } return TRUE; }
void EffectChangeSpeed::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. 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); }
bool AmplifyDialog::TransferDataFromWindow() { wxTextCtrl *c = GetAmpText(); if (c) { double r; wxString val = c->GetValue(); val.ToDouble(&r); ratio = pow(10,TrapDouble(r*10, AMP_MIN, AMP_MAX)/100.0); } return TRUE; }
void WahwahDialog::OnFreqOffText(wxCommandEvent & WXUNUSED(event)) { wxTextCtrl *c = GetFreqOffText(); if (c) { double freqoff; c->GetValue().ToDouble(&freqoff); freqoff = TrapDouble(freqoff, FREQOFF_MIN, FREQOFF_MAX); wxSlider *slider = GetFreqOffSlider(); if (slider) slider->SetValue((int)freqoff); } }
void PhaserDialog::OnFreqText(wxCommandEvent & WXUNUSED(event)) { wxTextCtrl *c = GetFreqText(); if (c) { double freq; c->GetValue().ToDouble(&freq); freq = TrapDouble(freq * 10, FREQ_MIN, FREQ_MAX); wxSlider *slider = GetFreqSlider(); if (slider) slider->SetValue((int)freq); } }
void WahwahDialog::OnResonanceText(wxCommandEvent & event) { wxTextCtrl *c = GetResonanceText(); if (c) { double resd = Internat::ToDouble(c->GetValue()); res = resd; res = TrapDouble(resd * 10, RES_MIN, RES_MAX) / 10.0; wxSlider *slider = GetResonanceSlider(); if (slider) slider->SetValue((int)(res * 10)); } }
void AmplifyDialog::OnAmpSlider(wxCommandEvent & event) { wxString str; double dB = mAmpS->GetValue() / 10.0; ratio = pow(10.0,TrapDouble(dB, AMP_MIN, AMP_MAX)/20.0); double dB2 = (mAmpS->GetValue()-1) / 10.0; double ratio2 = pow(10.0,TrapDouble(dB2, AMP_MIN, AMP_MAX)/20.0); if (!mClip->GetValue() && ratio * peak > 1.0 && ratio2 * peak < 1.0) ratio = 1.0 / peak; str.Printf(wxT("%.1f"), 20*log10(ratio)); mAmpT->ChangeValue(str); if (ratio*peak > 0.0) str.Printf(wxT("%.1f"), 20*log10(ratio*peak)); else str = _("-Infinity"); // the case when the waveform is all zero mPeakT->ChangeValue(str); CheckClip(); }
void WahwahDialog::OnResonanceText(wxCommandEvent & WXUNUSED(event)) { wxTextCtrl *c = GetResonanceText(); if (c) { double resd; c->GetValue().ToDouble(&resd); res = resd; res = TrapDouble(resd * 10, RES_MIN, RES_MAX) / 10.0; wxSlider *slider = GetResonanceSlider(); if (slider) slider->SetValue((int)floor(res * 10 + .5)); } }
bool AmplifyDialog::TransferDataFromWindow() { wxTextCtrl *c = GetAmpText(); if (c) { double r = 0; wxString val = c->GetValue(); val.ToDouble(&r); ratio = pow(10.0,TrapDouble(r*10, AMP_MIN, AMP_MAX)/200.0); } noclip = !GetClipCheckBox()->GetValue(); return TRUE; }
bool PhaserDialog::TransferDataFromWindow() { wxTextCtrl *c; long x; c = GetFreqText(); if (c) { double d; c->GetValue().ToDouble(&d); freq = TrapDouble(d * 10, FREQ_MIN, FREQ_MAX) / 10; } c = GetPhaseText(); if (c) { c->GetValue().ToLong(&x); startphase = TrapLong(x, PHASE_MIN, PHASE_MAX); } c = GetDepthText(); if (c) { c->GetValue().ToLong(&x); depth = TrapLong(x, DEPTH_MIN, DEPTH_MAX); } c = GetFeedbackText(); if (c) { c->GetValue().ToLong(&x); fb = TrapLong(x, FB_MIN, FB_MAX); } c = GetStagesText(); if (c) { c->GetValue().ToLong(&x); stages = TrapLong(x, STAGES_MIN, STAGES_MAX); if ((stages % 2) == 1) // must be even stages = TrapLong(stages - 1, STAGES_MIN, STAGES_MAX); } c = GetDryWetText(); if (c) { c->GetValue().ToLong(&x); drywet = TrapLong(x, DRYWET_MIN, DRYWET_MAX); } return TRUE; }
void EffectAmplify::OnAmpText(wxCommandEvent & WXUNUSED(evt)) { if (!mAmpT->GetValidator()->TransferFromWindow()) { EnableApply(false); return; } mRatio = DB_TO_LINEAR(TrapDouble(mAmp * SCL_Amp, MIN_Amp * SCL_Amp, MAX_Amp * SCL_Amp) / SCL_Amp); mAmpS->SetValue((int) (LINEAR_TO_DB(mRatio) * SCL_Amp + 0.5)); mNewPeak = LINEAR_TO_DB(mRatio * mPeak); mNewPeakT->GetValidator()->TransferToWindow(); CheckClip(); }
bool EffectAmplify::TransferDataFromWindow() { if (!mUIParent->Validate() || !mUIParent->TransferDataFromWindow()) { return false; } mRatio = DB_TO_LINEAR(TrapDouble(mAmp * SCL_Amp, MIN_Amp * SCL_Amp, MAX_Amp * SCL_Amp) / SCL_Amp); mCanClip = mClip->GetValue(); if (!mCanClip && mRatio * mPeak > 1.0) { mRatio = 1.0 / mPeak; } return true; }
void AmplifyDialog::OnPeakText(wxCommandEvent & event) { wxString val = mPeakT->GetValue(); double r; val.ToDouble(&r); ratio = pow(10.0, r/20.0) / peak; double dB = TrapDouble(200*log10(ratio), AMP_MIN, AMP_MAX)/10.0; ratio = pow(10.0, dB/20.0); mAmpS->SetValue((int)(10*dB+0.5)); val.Printf(wxT("%.1f"), dB); mAmpT->ChangeValue(val); CheckClip(); }
void AmplifyDialog::OnAmpText(wxCommandEvent & event) { wxString val = mAmpT->GetValue(); double r; val.ToDouble(&r); ratio = pow(10.0,TrapDouble(r*10, AMP_MIN, AMP_MAX)/200.0); mAmpS->SetValue((int)(200*log10(ratio)+0.5)); if( ratio*peak > 0.0 ) val.Printf(wxT("%.1f"), 20*log10(ratio*peak)); else val = _("-Infinity"); // the case when the waveform is all zero mPeakT->ChangeValue(val); CheckClip(); }
bool AmplifyDialog::TransferDataToWindow() { // limit range of gain double dB = TrapDouble(200*log10(ratio), AMP_MIN, AMP_MAX)/10.0; ratio = pow(10.0, dB/20.0); mAmpS->SetValue((int)(200*log10(ratio)+0.5)); mAmpT->ChangeValue(wxString::Format(wxT("%.1f"), 20*log10(ratio))); wxString str; if( ratio*peak > 0.0 ) str.Printf(wxT("%.1f"), 20*log10(ratio*peak)); else str = _("-Infinity"); // the case when the waveform is all zero mPeakT->ChangeValue(str); return true; }