2 /*******************************************************************************/
3 /* Copyright (C) 2009 Jonathan Moore Liles */
5 /* This program is free software; you can redistribute it and/or modify it */
6 /* under the terms of the GNU General Public License as published by the */
7 /* Free Software Foundation; either version 2 of the License, or (at your */
8 /* option) any later version. */
10 /* This program is distributed in the hope that it will be useful, but WITHOUT */
11 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
12 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
15 /* You should have received a copy of the GNU General Public License along */
16 /* with This program; see the file COPYING. If not,write to the Free Software */
17 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 /*******************************************************************************/
23 #include <FL/Fl_Pack.H>
24 #include <FL/Fl_Button.H>
27 #include "JACK/Port.H"
36 class Controller_Module;
38 class Chain : public Fl_Group, public Loggable {
40 Fl_Flip_Button *tab_button;
41 Fl_Flowpack *controls_pack;
43 Fl_Group *control_tab;
44 Fl_Pack *modules_pack;
49 std::list<Module*> process_queue;
51 std::vector <Module::Port> scratch_port;
55 Fl_Callback *_configure_outputs_callback;
56 void *_configure_outputs_userdata;
60 static void snapshot ( void *v );
61 void snapshot ( void );
63 void cb_handle(Fl_Widget*);
64 static void cb_handle(Fl_Widget*, void*);
66 void draw_connections ( Module *m );
67 void build_process_queue ( void );
68 void add_to_process_queue ( Module *m );
70 static void process ( nframes_t, void * );
71 void process ( nframes_t );
73 static void buffer_size ( nframes_t nframes, void *v );
74 void buffer_size ( nframes_t nframes );
78 void get ( Log_Entry &e ) const;
79 void set ( Log_Entry &e );
83 Chain ( int X, int Y, int W, int H, const char *L = 0 );
88 void resize ( int X, int Y, int W, int H );
90 Mixer_Strip *strip ( void ) const { return _strip; }
91 void strip ( Mixer_Strip *v );
92 const char *name ( void ) const { return _name; }
93 void name ( const char *name );
95 int get_module_instance_number ( Module *m );
97 void configure_ports ( void );
98 int required_buffers ( void );
100 bool can_support_input_channels ( int n );
102 int modules ( void ) const { return modules_pack->children(); }
103 Module *module ( int n ) const { return (Module*)modules_pack->child( n ); }
104 void remove ( Controller_Module *m );
105 void remove ( Module *m );
106 bool add ( Module *m );
107 bool add ( Controller_Module *m );
108 bool insert ( Module *m, Module *n );
109 void add_control ( Controller_Module *m );
111 bool do_export ( const char *filename );
113 void initialize_with_default ( void );
115 bool can_configure_outputs ( Module *m, int n ) const;
117 void configure_outputs_callback ( Fl_Callback *cb, void *v )
119 _configure_outputs_callback = cb;
120 _configure_outputs_userdata = v;
123 Fl_Callback * configure_outputs_callback ( void ) const { return _configure_outputs_callback; }
125 void log_children ( void );
127 static unsigned int maximum_name_length ( void );
129 Engine *engine ( void ) const { return _engine; }
131 LOG_CREATE_FUNC( Chain );