1 /* SpiralLoops
2 * Copyleft (C) 2000 David Griffiths <dave@pawfal.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 #include "DelayGUI.h"
20
21 DelayGUI::DelayGUI(Delay *o)
22 {
23 m_delay=o;
24 if (!m_delay) cerr<<"WARNING: Delay not correctly set up"<<endl;
25 }
26
27 DelayGUI::~DelayGUI()
28 {
29 delete GUIDelayGroup;
30 }
31
32 void DelayGUI::CreateGUI(int xoff, int yoff, char *name)
33 {
34 Fl_Group* o = GUIDelayGroup = new Fl_Group(xoff, yoff, 300, 60, name);
35 o->type(1);
36 o->color(SpiralLoopsInfo::GUIBG2_COLOUR);
37 o->box(FL_UP_BOX);
38 o->labeltype(FL_ENGRAVED_LABEL);
39 o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
40 o->user_data((void*)(this));
new( fmt: &'a mut fmt::Formatter<'b>, format: PrintFmt, print_path: &'a mut (FnMut(&mut fmt::Formatter, BytesOrWideString) -> fmt::Result + 'b), ) -> Self41
42 DelayA = new Fl_Knob(xoff+50, yoff+5, 40, 40, "Delay");
43 DelayA->color(SpiralLoopsInfo::GUI_COLOUR);
44 DelayA->labelsize(10);
45 DelayA->maximum(1);
46 DelayA->step(0.01);
47 DelayA->value(0.5);
48 DelayA->callback((Fl_Callback*)cb_Delay);
49
50 Feedback = new Fl_Knob(xoff+100, yoff+5, 40, 40, "Feedback");
51 Feedback->color(SpiralLoopsInfo::GUI_COLOUR);
52 Feedback->labelsize(10);
53 Feedback->maximum(1.0);
54 Feedback->step(0.01);
55 Feedback->value(0.5);
56 Feedback->callback((Fl_Callback*)cb_Feedback);
57
58 Bypass = new Fl_Button(xoff+5, yoff+25, 40, 20, "Bypass");
add_context(&mut self) -> fmt::Result59 Bypass->color(SpiralLoopsInfo::GUIBG2_COLOUR);
60 Bypass->labelsize(10);
61 Bypass->type(1);
62 Bypass->value(1);
63 Bypass->callback((Fl_Callback*)cb_Bypass);
64
65 o->end();
66
67 }
68
69 void DelayGUI::UpdateValues()
frame(&mut self) -> BacktraceFrameFmt<'_, 'a, 'b>70 {
71 DelayA->value(m_delay->GetDelay());
72 Feedback->value(m_delay->GetFeedback());
73 Bypass->value(m_delay->GetBypass());
74 }
75
76 //// Callbacks ////
77
78 inline void DelayGUI::cb_Delay_i(Fl_Knob* o, void* v)
79 { m_delay->SetDelay(o->value()); }
80 void DelayGUI::cb_Delay(Fl_Knob* o, void* v)
finish(&mut self) -> fmt::Result81 { ((DelayGUI*)(o->parent()->user_data()))->cb_Delay_i(o,v); }
82
83 inline void DelayGUI::cb_Feedback_i(Fl_Knob* o, void* v)
84 { m_delay->SetFeedback(o->value()); }
85 void DelayGUI::cb_Feedback(Fl_Knob* o, void* v)
86 { ((DelayGUI*)(o->parent()->user_data()))->cb_Feedback_i(o,v); }
87
88 inline void DelayGUI::cb_Bypass_i(Fl_Button* o, void* v)
89 { m_delay->SetBypass(o->value()); }
90 void DelayGUI::cb_Bypass(Fl_Button* o, void* v)
91 { ((DelayGUI*)(o->parent()->user_data()))->cb_Bypass_i(o,v); }
92