📄 wahwah.cpp
字号:
// WDR: handler implementations for WahwahDialogvoid WahwahDialog::OnResonanceSlider(wxCommandEvent & event){ wxString str; long res = GetResonanceSlider()->GetValue(); str.Printf(wxT("%.1f"), res / 10.0); GetResonanceText()->SetValue(str);}void WahwahDialog::OnDepthSlider(wxCommandEvent & event){ wxString str; long depth = GetDepthSlider()->GetValue(); str.Printf(wxT("%ld"), depth); GetDepthText()->SetValue(str);}void WahwahDialog::OnPhaseSlider(wxCommandEvent & event){ wxString str; long phase = GetPhaseSlider()->GetValue(); phase = ((phase + 5) / 10) * 10; // round to nearest multiple of 10 str.Printf(wxT("%ld"), phase); GetPhaseText()->SetValue(str);}void WahwahDialog::OnFreqSlider(wxCommandEvent & event){ wxString str; long freql = GetFreqSlider()->GetValue(); str.Printf(wxT("%.1f"), freql / 10.0); GetFreqText()->SetValue(str);}void WahwahDialog::OnFreqOffSlider(wxCommandEvent & event){ wxString str; long freqoff = GetFreqOffSlider()->GetValue(); str.Printf(wxT("%d"), (int) freqoff); GetFreqOffText()->SetValue(str);}void WahwahDialog::OnResonanceText(wxCommandEvent & 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)(res * 10)); }}void WahwahDialog::OnDepthText(wxCommandEvent & event){ wxTextCtrl *c = GetDepthText(); if (c) { long depth; c->GetValue().ToLong(&depth); depth = TrapLong(depth, DEPTH_MIN, DEPTH_MAX); wxSlider *slider = GetDepthSlider(); if (slider) slider->SetValue(depth); }}void WahwahDialog::OnPhaseText(wxCommandEvent & event){ wxTextCtrl *c = GetPhaseText(); if (c) { long phase; c->GetValue().ToLong(&phase); phase = TrapLong(phase, PHASE_MIN, PHASE_MAX); wxSlider *slider = GetPhaseSlider(); if (slider) slider->SetValue(phase); }}void WahwahDialog::OnFreqText(wxCommandEvent & event){ wxTextCtrl *c = GetFreqText(); if (c) { long freql; double freqd; c->GetValue().ToDouble(&freqd); freq = freqd; freql = TrapLong(((long) (freq * 10)), FREQ_MIN, FREQ_MAX); wxSlider *slider = GetFreqSlider(); if (slider) slider->SetValue(freql); }}void WahwahDialog::OnFreqOffText(wxCommandEvent & 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 WahwahDialog::OnPreview(wxCommandEvent &event){ TransferDataFromWindow(); // Save & restore parameters around Preview, because we didn't do OK. float old_freq = m_pEffect->freq; float old_freqofs = m_pEffect->freqofs; float old_startphase = m_pEffect->startphase; float old_res = m_pEffect->res; float old_depth = m_pEffect->depth; m_pEffect->freq = freq; m_pEffect->freqofs = freqoff / 100; m_pEffect->startphase = startphase * M_PI / 180; m_pEffect->res = res; m_pEffect->depth = depth / 100; m_pEffect->Preview(); m_pEffect->freq = old_freq; m_pEffect->freqofs = old_freqofs; m_pEffect->startphase = old_startphase; m_pEffect->res = old_res; m_pEffect->depth = old_depth;}void WahwahDialog::OnOk(wxCommandEvent & event){ TransferDataFromWindow(); if (Validate()) EndModal(true); else { event.Skip(); }}void WahwahDialog::OnCancel(wxCommandEvent & event){ EndModal(false);}// Implement window functionswxSizer *CreateWahwahDialog(wxWindow * parent, bool call_fit, bool set_sizer){ wxBoxSizer *item0 = new wxBoxSizer(wxVERTICAL); wxStaticText *item1 = new wxStaticText(parent, -1, _("Wahwah by Nasca Octavian Paul"), wxDefaultPosition, wxDefaultSize, 0); item0->Add(item1, 0, wxALIGN_CENTRE | wxALL, 5); wxFlexGridSizer *item10 = new wxFlexGridSizer(3, 0, 0); wxStaticText *item11 = new wxStaticText(parent, -1, _("LFO Frequency (Hz):"), wxDefaultPosition, wxDefaultSize, 0); item10->Add(item11, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 5); wxTextCtrl *item12 = new wxTextCtrl(parent, ID_FREQTEXT, wxT(""), wxDefaultPosition, wxSize(40, -1), 0); item10->Add(item12, 0, wxALIGN_CENTRE | wxALL, 5); wxSlider *item13 = new wxSlider(parent, ID_FREQSLIDER, 100, FREQ_MIN, FREQ_MAX, wxDefaultPosition, wxSize(100, -1), wxSL_HORIZONTAL); item10->Add(item13, 0, wxALIGN_CENTRE | wxALL, 5); wxStaticText *item14 = new wxStaticText(parent, -1, _("LFO Start Phase (deg.):"), wxDefaultPosition, wxDefaultSize, 0); item10->Add(item14, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 5); wxTextCtrl *item15 = new wxTextCtrl(parent, ID_PHASETEXT, wxT(""), wxDefaultPosition, wxSize(40, -1), 0); item10->Add(item15, 0, wxALIGN_CENTRE | wxALL, 5); wxSlider *item16 = new wxSlider(parent, ID_PHASESLIDER, 0, PHASE_MIN, PHASE_MAX, wxDefaultPosition, wxSize(100, -1), wxSL_HORIZONTAL); item10->Add(item16, 0, wxALIGN_CENTRE | wxALL, 5); wxStaticText *item17 = new wxStaticText(parent, -1, _("Depth (%):"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); item10->Add(item17, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 5); wxTextCtrl *item18 = new wxTextCtrl(parent, ID_DEPTHTEXT, wxT(""), wxDefaultPosition, wxSize(40, -1), 0); item10->Add(item18, 0, wxALIGN_CENTRE | wxALL, 5); wxSlider *item19 = new wxSlider(parent, ID_DEPTHSLIDER, 0, DEPTH_MIN, DEPTH_MAX, wxDefaultPosition, wxSize(100, -1), wxSL_HORIZONTAL); item10->Add(item19, 0, wxALIGN_CENTRE | wxALL, 5); wxStaticText *item20 = new wxStaticText(parent, -1, _("Resonance:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); item10->Add(item20, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 5); wxTextCtrl *item21 = new wxTextCtrl(parent, ID_RESONANCETEXT, wxT(""), wxDefaultPosition, wxSize(40, -1), 0); item10->Add(item21, 0, wxALIGN_CENTRE | wxALL, 5); wxSlider *item22 = new wxSlider(parent, ID_RESONANCESLIDER, 0, RES_MIN, RES_MAX, wxDefaultPosition, wxSize(100, -1), wxSL_HORIZONTAL); item10->Add(item22, 0, wxALIGN_CENTRE | wxALL, 5); wxStaticText *item30 = new wxStaticText(parent, -1, _("Wah Frequency Offset (%):"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); item10->Add(item30, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 5); wxTextCtrl *item31 = new wxTextCtrl(parent, ID_FREQOFFTEXT, wxT(""), wxDefaultPosition, wxSize(40, -1), 0); item10->Add(item31, 0, wxALIGN_CENTRE | wxALL, 5); wxSlider *item32 = new wxSlider(parent, ID_FREQOFFSLIDER, 0, FREQOFF_MIN, FREQOFF_MAX, wxDefaultPosition, wxSize(100, -1), wxSL_HORIZONTAL); item10->Add(item32, 0, wxALIGN_CENTRE | wxALL, 5); item0->Add(item10, 0, wxALIGN_CENTRE | wxALL, 5); wxBoxSizer *item23 = new wxBoxSizer(wxHORIZONTAL); wxButton * pButton_Preview = new wxButton(parent, ID_BUTTON_PREVIEW, _("Preview")); //v Should be m_pEffect->GetPreviewName(). item23->Add(pButton_Preview, 0, wxALIGN_CENTER | wxALL, 5); item23->Add(20, 10); // horizontal spacer wxButton *item25 = new wxButton(parent, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0); item23->Add(item25, 0, wxALIGN_CENTRE | wxALL, 5); wxButton *item24 = new wxButton(parent, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0); item24->SetDefault(); item24->SetFocus(); item23->Add(item24, 0, wxALIGN_CENTRE | wxALL, 5); item0->Add(item23, 0, wxALIGN_CENTRE | wxALL, 5); if (set_sizer) { parent->SetAutoLayout(TRUE); parent->SetSizer(item0); if (call_fit) { item0->Fit(parent); item0->SetSizeHints(parent); } } return item0;}// Indentation settings for Vim and Emacs and unique identifier for Arch, a// version control system. Please do not modify past this point.//// Local Variables:// c-basic-offset: 3// indent-tabs-mode: nil// End://// vim: et sts=3 sw=3// arch-tag: b4101b5b-1a18-4f35-9e85-29cc6c1f7f4c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -