📄 phaser.cpp
字号:
void PhaserDialog::OnFeedbackSlider(wxCommandEvent & event){ wxString str; long fb = GetFeedbackSlider()->GetValue(); if (fb > 0) // round to nearest multiple of 10 fb = ((fb + 5) / 10) * 10; else fb = ((fb - 5) / 10) * 10; str.Printf(wxT("%ld"), fb); GetFeedbackText()->SetValue(str);}void PhaserDialog::OnDepthSlider(wxCommandEvent & event){ wxString str; long depth = GetDepthSlider()->GetValue(); str.Printf(wxT("%ld"), depth); GetDepthText()->SetValue(str);}void PhaserDialog::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 PhaserDialog::OnFreqSlider(wxCommandEvent & event){ wxString str; long freq = GetFreqSlider()->GetValue(); str.Printf(wxT("%.1f"), freq / 10.0); GetFreqText()->SetValue(str);}void PhaserDialog::OnFeedbackText(wxCommandEvent & event){ wxTextCtrl *c = GetFeedbackText(); if (c) { long fb; c->GetValue().ToLong(&fb); fb = TrapLong(fb, FB_MIN, FB_MAX); wxSlider *slider = GetFeedbackSlider(); if (slider) slider->SetValue(fb); }}void PhaserDialog::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 PhaserDialog::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 PhaserDialog::OnFreqText(wxCommandEvent & 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 PhaserDialog::OnPreview(wxCommandEvent &event){ TransferDataFromWindow(); // Save & restore parameters around Preview, because we didn't do OK. float old_freq = m_pEffect->freq; float old_startphase = m_pEffect->startphase; float old_fb = m_pEffect->fb; int old_depth = m_pEffect->depth; int old_stages = m_pEffect->stages; int old_drywet = m_pEffect->drywet; m_pEffect->freq = freq; m_pEffect->startphase = startphase * M_PI / 180; m_pEffect->fb = fb; m_pEffect->depth = depth; m_pEffect->stages = stages; m_pEffect->drywet = drywet; m_pEffect->Preview(); m_pEffect->freq = old_freq; m_pEffect->startphase = old_startphase; m_pEffect->fb = old_fb; m_pEffect->depth = old_depth; m_pEffect->stages = old_stages; m_pEffect->drywet = old_drywet;}void PhaserDialog::OnOk(wxCommandEvent & event){ TransferDataFromWindow(); if (Validate()) EndModal(true); else { event.Skip(); }}void PhaserDialog::OnCancel(wxCommandEvent & event){ EndModal(false);}// Implement window functionswxSizer *CreatePhaserDialog(wxWindow * parent, bool call_fit, bool set_sizer){ wxBoxSizer *item0 = new wxBoxSizer(wxVERTICAL); wxStaticText *item1 = new wxStaticText(parent, -1, _("Phaser by Nasca Octavian Paul"), wxDefaultPosition, wxDefaultSize, 0); item0->Add(item1, 0, wxALIGN_CENTRE | wxALL, 5); wxBoxSizer *item2 = new wxBoxSizer(wxHORIZONTAL); wxStaticText *item3 = new wxStaticText(parent, -1, _("Stages:"), wxDefaultPosition, wxDefaultSize, 0); item2->Add(item3, 0, wxALIGN_CENTRE | wxALL, 5); wxSpinCtrl *item4 = new wxSpinCtrl(parent, ID_STAGES, wxT("2"), wxDefaultPosition, wxSize(80, -1), 0, 2, 24, 2); item2->Add(item4, 0, wxALIGN_CENTRE | wxALL, 5); wxBoxSizer *item5 = new wxBoxSizer(wxVERTICAL); wxSlider *item6 = new wxSlider(parent, ID_DRYWET, 0, DRYWET_MIN, DRYWET_MAX, wxDefaultPosition, wxSize(100, -1), wxSL_HORIZONTAL); item5->Add(item6, 1, wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxTOP, 5); wxBoxSizer *item7 = new wxBoxSizer(wxHORIZONTAL); wxStaticText *item8 = new wxStaticText(parent, -1, _("DRY"), wxDefaultPosition, wxDefaultSize, 0); item7->Add(item8, 0, wxALIGN_CENTRE | wxALL, 5); item7->Add(10, 10, 1, wxALIGN_CENTRE | wxLEFT | wxRIGHT | wxTOP, 5); wxStaticText *item9 = new wxStaticText(parent, -1, _("WET"), wxDefaultPosition, wxDefaultSize, 0); item7->Add(item9, 0, wxALIGN_CENTRE | wxALL, 5); item5->Add(item7, 1, wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); item2->Add(item5, 1, wxALIGN_CENTRE | wxALL, 5); item0->Add(item2, 0, wxGROW | wxALIGN_CENTER_VERTICAL | 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, _("Feedback (%):"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); item10->Add(item20, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 5); wxTextCtrl *item21 = new wxTextCtrl(parent, ID_FEEDBACKTEXT, wxT(""), wxDefaultPosition, wxSize(40, -1), 0); item10->Add(item21, 0, wxALIGN_CENTRE | wxALL, 5); wxSlider *item22 = new wxSlider(parent, ID_FEEDBACKSLIDER, 0, FB_MIN, FB_MAX, wxDefaultPosition, wxSize(100, -1), wxSL_HORIZONTAL); item10->Add(item22, 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: 7021285f-5534-4e79-bc47-c60cf4bd0f87
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -