From 20530efd3dafe67d21c140309efca35db9d6c937 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Fri, 25 Dec 2009 18:22:56 -0600 Subject: [PATCH] Mixer: Teach modules how to serializer their input port settings. --- Mixer/Chain.C | 8 ++++++++ Mixer/Meter_Indicator_Module.H | 4 ++-- Mixer/Module.C | 25 +++++++++++++++++++++++++ Mixer/Module.H | 4 ++++ 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/Mixer/Chain.C b/Mixer/Chain.C index d6f0f14..6216f8a 100644 --- a/Mixer/Chain.C +++ b/Mixer/Chain.C @@ -487,6 +487,14 @@ Chain::build_process_queue ( void ) DMESSAGE( "\t%s -->", (*i)->name() ); else if ( m->control_input.size() ) DMESSAGE( "\t%s <--", (*i)->name() ); + + { + char *s = m->describe_inputs(); + + DMESSAGE( "(%s)", s ); + + delete[] s; + } } } diff --git a/Mixer/Meter_Indicator_Module.H b/Mixer/Meter_Indicator_Module.H index 902010e..717ab63 100644 --- a/Mixer/Meter_Indicator_Module.H +++ b/Mixer/Meter_Indicator_Module.H @@ -44,8 +44,8 @@ public: const char *name ( void ) const { return "Meter Indicator"; } - int can_support_inputs ( int n ) { return 0; } - bool configure_inputs ( int n ) { return false; } + int can_support_inputs ( int ) { return 0; } + bool configure_inputs ( int ) { return false; } void pad ( bool v ) { _pad = v; } diff --git a/Mixer/Module.C b/Mixer/Module.C index d97d888..022e29f 100644 --- a/Mixer/Module.C +++ b/Mixer/Module.C @@ -22,6 +22,7 @@ #include #include +#include #include "Module_Parameter_Editor.H" @@ -46,6 +47,30 @@ Module::~Module ( ) +/* return a string serializing this module's parameter settings. The + format is 1.0:2.0:... Where 1.0 is the value of the first control + input, 2.0 is the value of the second control input etc. + */ +char * +Module::describe_inputs ( void ) const +{ + char *s = new char[1024]; + s[0] = 0; + char *sp = s; + + if ( control_input.size() ) + { + for ( unsigned int i = 0; i < control_input.size(); ++i ) + sp += snprintf( sp, 1024 - (sp - s),"%f:", control_input[i].control_value() ); + + *(sp - 1) = '\0'; + } + + return s; +} + + + void Module::draw_box ( void ) { diff --git a/Mixer/Module.H b/Mixer/Module.H index b74485a..0511694 100644 --- a/Mixer/Module.H +++ b/Mixer/Module.H @@ -289,6 +289,8 @@ public: Chain *chain ( void ) const { return _chain; } void chain ( Chain * v ) { _chain = v; } + char *describe_inputs ( void ) const; + virtual bool initialize ( void ) { return true; } /* for the given number of inputs, return how many outputs this @@ -312,6 +314,8 @@ public: virtual void handle_port_connection_change () {} + + protected: void draw_connections ( void );