non/Mixer/Chain.H

108 lines
3.4 KiB
C++

/*******************************************************************************/
/* Copyright (C) 2009 Jonathan Moore Liles */
/* */
/* This program is free software; you can redistribute it and/or modify it */
/* under the terms of the GNU General Public License as published by the */
/* Free Software Foundation; either version 2 of the License, or (at your */
/* option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, but WITHOUT */
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
/* more details. */
/* */
/* You should have received a copy of the GNU General Public License along */
/* with This program; see the file COPYING. If not,write to the Free Software */
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*******************************************************************************/
#include <FL/Fl.H>
#include <FL/Fl_Pack.H>
#include <FL/Fl_Button.H>
#include "Module.H"
#include "JACK/Port.H"
#include <vector>
#include <list>
class Fl_Flowpack;
class Fl_Tabs;
class Chain : public Fl_Group {
Fl_Pack *modules_pack;
Fl_Flowpack *controls_pack;
Fl_Tabs *tabs;
void cb_handle(Fl_Widget*);
static void cb_handle(Fl_Widget*, void*);
int _ins;
int _outs;
// sample_t **_buffer;
// int _nbuffers;
Fl_Callback *_configure_outputs_callback;
void *_configure_outputs_userdata;
const char *_name;
void draw_connections ( Module *m );
std::list<Module*> process_queue;
void build_process_queue ( void );
void add_to_process_queue ( Module *m );
static std::vector <Module::Port> port;
static std::list <Chain*> chain;
public:
const char *name ( void ) const { return _name; }
void name ( const char *name );
void configure_ports ( void );
int required_buffers ( void );
Chain ( int X, int Y, int W, int H, const char *L = 0 );
virtual ~Chain ( );
bool can_support_input_channels ( int n );
void ins ( int i ) { _ins = i; }
void outs ( int i ) { _outs = i; }
int ins ( void ) const { return _ins; }
int outs ( void ) const { return _outs; }
int modules ( void ) const { return modules_pack->children(); }
Module *module ( int n ) const { return (Module*)modules_pack->child( n ); }
void remove ( Module *m );
bool insert ( Module *m, Module *n );
void add_control ( Module *m );
void initialize_with_default ( void );
bool can_configure_outputs ( Module *m, int n ) const;
void configure_outputs_callback ( Fl_Callback *cb, void *v )
{
_configure_outputs_callback = cb;
_configure_outputs_userdata = v;
}
Fl_Callback * configure_outputs_callback ( void ) const { return _configure_outputs_callback; }
void process ( nframes_t );
protected:
int handle ( int m );
void draw ( void );
void resize ( int X, int Y, int W, int H );
};