2009-12-25 01:59:39 +01:00
|
|
|
|
|
|
|
/*******************************************************************************/
|
|
|
|
/* 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. */
|
|
|
|
/*******************************************************************************/
|
|
|
|
|
2009-12-28 06:25:28 +01:00
|
|
|
#pragma once
|
|
|
|
|
2009-12-25 01:59:39 +01:00
|
|
|
#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>
|
2009-12-28 06:25:28 +01:00
|
|
|
#include "Loggable.H"
|
2009-12-25 01:59:39 +01:00
|
|
|
|
2009-12-28 06:25:28 +01:00
|
|
|
class Mixer_Strip;
|
2009-12-25 01:59:39 +01:00
|
|
|
class Fl_Flowpack;
|
2010-01-12 06:23:40 +01:00
|
|
|
class Fl_Flip_Button;
|
2010-01-16 09:00:47 +01:00
|
|
|
class Engine;
|
2010-01-21 07:50:12 +01:00
|
|
|
class Controller_Module;
|
2009-12-25 01:59:39 +01:00
|
|
|
|
2009-12-28 06:25:28 +01:00
|
|
|
class Chain : public Fl_Group, public Loggable {
|
2009-12-25 01:59:39 +01:00
|
|
|
|
2010-01-12 06:23:40 +01:00
|
|
|
Fl_Flip_Button *tab_button;
|
2010-01-25 03:12:10 +01:00
|
|
|
Fl_Flowpack *controls_pack;
|
2010-01-12 06:23:40 +01:00
|
|
|
Fl_Group *chain_tab;
|
|
|
|
Fl_Group *control_tab;
|
2010-01-25 03:12:10 +01:00
|
|
|
Fl_Pack *modules_pack;
|
2009-12-25 01:59:39 +01:00
|
|
|
|
2010-01-25 03:12:10 +01:00
|
|
|
Mixer_Strip *_strip;
|
|
|
|
const char *_name;
|
2009-12-25 01:59:39 +01:00
|
|
|
|
2010-01-25 03:12:10 +01:00
|
|
|
std::list<Module*> process_queue;
|
2009-12-28 06:25:28 +01:00
|
|
|
|
2010-01-25 03:12:10 +01:00
|
|
|
std::vector <Module::Port> scratch_port;
|
2009-12-25 01:59:39 +01:00
|
|
|
|
2010-01-25 03:12:10 +01:00
|
|
|
Engine *_engine;
|
2009-12-25 01:59:39 +01:00
|
|
|
|
|
|
|
Fl_Callback *_configure_outputs_callback;
|
|
|
|
void *_configure_outputs_userdata;
|
2013-05-03 05:02:17 +02:00
|
|
|
|
|
|
|
bool _deleting;
|
2009-12-25 01:59:39 +01:00
|
|
|
|
2010-01-25 03:12:10 +01:00
|
|
|
private:
|
2009-12-25 01:59:39 +01:00
|
|
|
|
2010-01-31 19:51:55 +01:00
|
|
|
static void snapshot ( void *v );
|
|
|
|
void snapshot ( void );
|
|
|
|
|
2010-01-25 03:12:10 +01:00
|
|
|
void cb_handle(Fl_Widget*);
|
|
|
|
static void cb_handle(Fl_Widget*, void*);
|
2009-12-25 01:59:39 +01:00
|
|
|
|
2010-01-25 03:12:10 +01:00
|
|
|
void draw_connections ( Module *m );
|
2009-12-25 01:59:39 +01:00
|
|
|
void build_process_queue ( void );
|
|
|
|
void add_to_process_queue ( Module *m );
|
|
|
|
|
2010-01-16 09:00:47 +01:00
|
|
|
static void process ( nframes_t, void * );
|
|
|
|
void process ( nframes_t );
|
|
|
|
|
2010-01-30 09:35:32 +01:00
|
|
|
static void buffer_size ( nframes_t nframes, void *v );
|
|
|
|
void buffer_size ( nframes_t nframes );
|
2013-06-16 02:51:50 +02:00
|
|
|
static int sample_rate_change ( nframes_t nframes, void *v );
|
|
|
|
int sample_rate_change ( nframes_t nframes );
|
2010-01-30 09:35:32 +01:00
|
|
|
|
2013-04-22 08:14:52 +02:00
|
|
|
|
|
|
|
static void port_connect ( jack_port_id_t a, jack_port_id_t b, int connect, void *v );
|
|
|
|
void port_connect ( jack_port_id_t a, jack_port_id_t b, int connect );
|
|
|
|
|
|
|
|
static void update_connection_status ( void *v );
|
|
|
|
void update_connection_status ( void );
|
|
|
|
|
2009-12-28 06:25:28 +01:00
|
|
|
protected:
|
|
|
|
|
|
|
|
void get ( Log_Entry &e ) const;
|
|
|
|
void set ( Log_Entry &e );
|
|
|
|
|
2009-12-25 01:59:39 +01:00
|
|
|
public:
|
|
|
|
|
2010-01-25 03:12:10 +01:00
|
|
|
Chain ( int X, int Y, int W, int H, const char *L = 0 );
|
|
|
|
Chain ( );
|
|
|
|
virtual ~Chain ( );
|
|
|
|
|
2013-06-18 04:26:04 +02:00
|
|
|
void update ( void );
|
2010-01-25 03:12:10 +01:00
|
|
|
void draw ( void );
|
2009-12-28 06:25:28 +01:00
|
|
|
void resize ( int X, int Y, int W, int H );
|
2009-12-25 01:59:39 +01:00
|
|
|
|
2009-12-28 06:25:28 +01:00
|
|
|
Mixer_Strip *strip ( void ) const { return _strip; }
|
|
|
|
void strip ( Mixer_Strip *v );
|
2009-12-25 01:59:39 +01:00
|
|
|
const char *name ( void ) const { return _name; }
|
|
|
|
void name ( const char *name );
|
|
|
|
|
2013-06-06 01:26:36 +02:00
|
|
|
void send_feedback ( void );
|
|
|
|
|
2012-02-09 09:19:00 +01:00
|
|
|
int get_module_instance_number ( Module *m );
|
|
|
|
|
2009-12-25 01:59:39 +01:00
|
|
|
void configure_ports ( void );
|
|
|
|
int required_buffers ( void );
|
|
|
|
|
|
|
|
bool can_support_input_channels ( int n );
|
|
|
|
|
|
|
|
int modules ( void ) const { return modules_pack->children(); }
|
|
|
|
Module *module ( int n ) const { return (Module*)modules_pack->child( n ); }
|
2012-05-21 00:08:38 +02:00
|
|
|
void remove ( Controller_Module *m );
|
2009-12-25 01:59:39 +01:00
|
|
|
void remove ( Module *m );
|
2009-12-28 06:25:28 +01:00
|
|
|
bool add ( Module *m );
|
2010-01-21 07:50:12 +01:00
|
|
|
bool add ( Controller_Module *m );
|
2009-12-25 01:59:39 +01:00
|
|
|
bool insert ( Module *m, Module *n );
|
2010-01-21 07:50:12 +01:00
|
|
|
void add_control ( Controller_Module *m );
|
2009-12-25 01:59:39 +01:00
|
|
|
|
2010-01-31 19:51:55 +01:00
|
|
|
bool do_export ( const char *filename );
|
|
|
|
|
2009-12-25 01:59:39 +01:00
|
|
|
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; }
|
|
|
|
|
2012-11-06 08:50:28 +01:00
|
|
|
virtual void log_children ( void ) const;
|
2009-12-25 01:59:39 +01:00
|
|
|
|
2010-02-01 07:23:01 +01:00
|
|
|
static unsigned int maximum_name_length ( void );
|
2010-01-31 20:34:18 +01:00
|
|
|
|
2010-01-16 09:00:47 +01:00
|
|
|
Engine *engine ( void ) const { return _engine; }
|
|
|
|
|
2009-12-28 06:25:28 +01:00
|
|
|
LOG_CREATE_FUNC( Chain );
|
2009-12-25 01:59:39 +01:00
|
|
|
};
|