1 /*  SpiralSynth
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 <FL/Fl.H>
20 #include <FL/Fl_Window.H>
21 #include <FL/Fl_Group.H>
22 #include "Widgets/Fl_Knob.H"
23 #include <FL/Fl_Button.H>
24 #include <FL/Fl_Slider.H>
25 
26 #include "GUIBase.h"
27 #include "../SpiralSound/Output.h"
28 
29 #ifndef ROUTEGUI
30 #define ROUTEGUI
31 
32 class RouteGUI : public GUIBase
33 {
34 public:
35 	enum ROUTE
36 	{
37 		OSC1FREQ = 0x0001,
38 		OSC1PW   = 0x0002,
39 		OSC2FREQ = 0x0004,
40 		OSC2PW   = 0x0008,
41 		FILTERC  = 0x0010,
42 		FILTERR  = 0x0020,
43 		LAST = FILTERR
44 	};
45 
46 
47 	RouteGUI();
48 
49 	virtual void CreateGUI(int xoff, int yoff, char *name);
50 	virtual void UpdateValues();
GetOutput()51 	int GetOutput() {return m_Button;}
Query(ROUTE r)52 	bool Query(ROUTE r) {return (r & m_Button);}
53 	void Randomise();
54 
55 private:
56 
57 	int m_Button;
58 
59 	Fl_Group *m_RoutingGroup;
60 
61 	Fl_Button *m_Osc1Freq;
62 	Fl_Button *m_Osc1PW;
63 	Fl_Button *m_Osc2Freq;
64 	Fl_Button *m_Osc2PW;
65 	Fl_Button *m_FilterC;
66 	Fl_Button *m_FilterR;
67 
68 	//// Callbacks ////
69 	inline void cb_Osc1Freq_i(Fl_Knob* o, void* v);
70 	static void cb_Osc1Freq(Fl_Knob* o, void* v);
71 	inline void cb_Osc1PW_i(Fl_Knob* o, void* v);
72 	static void cb_Osc1PW(Fl_Knob* o, void* v);
73 	inline void cb_Osc2Freq_i(Fl_Knob* o, void* v);
74 	static void cb_Osc2Freq(Fl_Knob* o, void* v);
75 	inline void cb_Osc2PW_i(Fl_Knob* o, void* v);
76 	static void cb_Osc2PW(Fl_Knob* o, void* v);
77 	inline void cb_FilterC_i(Fl_Knob* o, void* v);
78 	static void cb_FilterC(Fl_Knob* o, void* v);
79 	inline void cb_FilterR_i(Fl_Knob* o, void* v);
80 	static void cb_FilterR(Fl_Knob* o, void* v);
81 
82 	friend istream &operator>>(istream &s, RouteGUI &o);
83 	friend ostream &operator<<(ostream &s, RouteGUI &o);
84 };
85 
86 istream &operator>>(istream &s, RouteGUI &o);
87 ostream &operator<<(ostream &s, RouteGUI &o);
88 
89 #endif
90