Mixer: Teach modules how to serializer their input port settings.

This commit is contained in:
Jonathan Moore Liles 2009-12-25 18:22:56 -06:00
parent 07ae3f3ade
commit 20530efd3d
4 changed files with 39 additions and 2 deletions

View File

@ -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;
}
}
}

View File

@ -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; }

View File

@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#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 )
{

View File

@ -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 );