From 0042d8e531e850bd47b73fda816b9abb935390ed Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sat, 16 Jan 2010 21:51:14 -0600 Subject: [PATCH] Cleanup. --- Mixer/Chain.C | 64 +++++++++++-------------------------------- Mixer/Chain.H | 1 - Mixer/Plugin_Module.C | 2 ++ Mixer/makefile.inc | 2 +- nonlib/JACK/Port.C | 5 +++- 5 files changed, 23 insertions(+), 51 deletions(-) diff --git a/Mixer/Chain.C b/Mixer/Chain.C index 12f7787..4176ca6 100644 --- a/Mixer/Chain.C +++ b/Mixer/Chain.C @@ -46,6 +46,8 @@ * optimized out. */ +#include "const.h" + #include "Chain.H" #include "Module.H" @@ -77,12 +79,6 @@ #include -#include "const.h" - - - -std::list Chain::chain; - void @@ -190,8 +186,6 @@ Chain::Chain ( ) : Fl_Group( 0, 0, 100, 100, "") end(); - chain.push_back( this ); - log_create(); } @@ -199,10 +193,10 @@ Chain::~Chain ( ) { DMESSAGE( "Destroying chain" ); - chain.remove( this ); - log_destroy(); + engine()->lock(); + /* if we leave this up to FLTK, it will happen after we've already destroyed the engine */ modules_pack->clear(); @@ -266,7 +260,7 @@ Chain::initialize_with_default ( void ) void Chain::cb_handle(Fl_Widget* o) { - if ( o = tab_button ) + if ( o == tab_button ) { Fl_Flip_Button *fb = (Fl_Flip_Button*)o; @@ -326,7 +320,6 @@ Chain::remove ( Module *m ) void Chain::configure_ports ( void ) { -/* int old_outs = outs(); */ int nouts = 0; engine()->lock(); @@ -337,15 +330,7 @@ Chain::configure_ports ( void ) nouts = module( i )->noutputs(); } -/* outs( nouts ); */ - - int req_buffers = required_buffers(); - -/* if ( outs() != old_outs ) */ -/* { */ -/* if ( configure_outputs_callback() ) */ -/* configure_outputs_callback()( this, _configure_outputs_userdata ); */ -/* } */ + unsigned int req_buffers = required_buffers(); DMESSAGE( "required_buffers = %i", req_buffers ); @@ -366,15 +351,6 @@ Chain::configure_ports ( void ) build_process_queue(); - /* let the other chains know we mess with their buffers */ - for ( std::list::iterator i = chain.begin(); - i != chain.end(); - ++i ) - { - if ( *i != this ) - (*i)->build_process_queue(); - } - engine()->unlock(); parent()->redraw(); @@ -425,31 +401,23 @@ Chain::can_configure_outputs ( Module *m, int n ) const return true; } -/* return true if this chain can be converted to support /n/ input channels */ -bool -Chain::can_support_input_channels ( int n ) -{ - /* FIXME: implement */ - return true; -} - /* rename chain... we have to let our modules know our name has * changed so they can take the appropriate action (in particular the * JACK module). */ void Chain::name ( const char *name ) { - char ename[512]; snprintf( ename, sizeof(ename), "%s/%s", APP_NAME, name ); + DMESSAGE( "Renaming JACK client" ); + _name = engine()->name( ename ); /* FIXME: discarding the name jack picked is technically wrong! */ _name = name; - for ( int i = 0; i < modules(); ++i ) module( i )->handle_chain_name_changed(); } @@ -645,9 +613,9 @@ Chain::build_process_queue ( void ) /* DMESSAGE( "Process queue looks like:" ); */ - for ( std::list::const_iterator i = process_queue.begin(); i != process_queue.end(); ++i ) - { - const Module* m = *i; +/* for ( std::list::const_iterator i = process_queue.begin(); i != process_queue.end(); ++i ) */ +/* { */ +/* const Module* m = *i; */ /* if ( m->audio_input.size() || m->audio_output.size() ) */ /* DMESSAGE( "\t%s", (*i)->name() ); */ @@ -656,14 +624,14 @@ Chain::build_process_queue ( void ) /* else if ( m->control_input.size() ) */ /* DMESSAGE( "\t%s <--", (*i)->name() ); */ - { - char *s = m->get_parameters(); +/* { */ +/* char *s = m->get_parameters(); */ /* DMESSAGE( "(%s)", s ); */ - delete[] s; - } - } +/* delete[] s; */ +/* } */ +/* } */ } void diff --git a/Mixer/Chain.H b/Mixer/Chain.H index e725038..cc216d6 100644 --- a/Mixer/Chain.H +++ b/Mixer/Chain.H @@ -68,7 +68,6 @@ class Chain : public Fl_Group, public Loggable { void add_to_process_queue ( Module *m ); std::vector scratch_port; - static std::list chain; Engine *_engine; diff --git a/Mixer/Plugin_Module.C b/Mixer/Plugin_Module.C index f2b9132..280e992 100644 --- a/Mixer/Plugin_Module.C +++ b/Mixer/Plugin_Module.C @@ -20,6 +20,8 @@ /* Filter module. Can host LADPSA Plugins, or can be inherited from to make internal modules with special features and appearance. */ +#include "const.h" + #include "Plugin_Module.H" #include diff --git a/Mixer/makefile.inc b/Mixer/makefile.inc index a927e73..7e6501f 100644 --- a/Mixer/makefile.inc +++ b/Mixer/makefile.inc @@ -11,7 +11,7 @@ Mixer_OBJS:=$(Mixer_SRCS:.C=.o) Mixer_LIBS := $(FLTK_LIBS) $(JACK_LIBS) $(LASH_LIBS) -llrdf -Mixer/mixer: $(Mixer_OBJS) FL +Mixer/mixer: $(Mixer_OBJS) FL nonlib @ echo -n Linking mixer... @ $(CXX) $(CXXFLAGS) $(Mixer_LIBS) $(Mixer_OBJS) -o $@ -LFL -lfl_widgets -Lnonlib -lnonlib && echo $(DONE) diff --git a/nonlib/JACK/Port.C b/nonlib/JACK/Port.C index abdd71b..30cae49 100644 --- a/nonlib/JACK/Port.C +++ b/nonlib/JACK/Port.C @@ -53,11 +53,12 @@ namespace JACK _freezer = NULL; _client = client; _port = port; - _name = strdup( jack_port_name( _port ) ); + _name = strdup( jack_port_name( port ) ); } Port::Port ( JACK::Client *client, const char *name, type_e dir ) { + _name = NULL; _freezer = NULL; _client = client; activate( name, dir ); @@ -65,6 +66,7 @@ namespace JACK Port::Port ( JACK::Client *client, type_e dir, const char *base, int n, const char *type ) { + _name = NULL; _freezer = NULL; _client = client; @@ -75,6 +77,7 @@ namespace JACK Port::Port ( JACK::Client *client, type_e dir, int n, const char *type ) { + _name = NULL; _freezer = NULL; _client = client;