Browse Source

Mixer: Create unique OSC paths even when multiple instances of a module/plugin with the same name exist in a chain.

tags/non-daw-v1.1.0
Jonathan Moore Liles 13 years ago
parent
commit
18a1429b22
5 changed files with 34 additions and 1 deletions
  1. +17
    -0
      mixer/src/Chain.C
  2. +2
    -0
      mixer/src/Chain.H
  3. +8
    -1
      mixer/src/Module.C
  4. +5
    -0
      mixer/src/Module.H
  5. +2
    -0
      mixer/src/Module_Parameter_Editor.C

+ 17
- 0
mixer/src/Chain.C View File

@@ -357,6 +357,23 @@ Chain::configure_ports ( void )
parent()->redraw();
}

int
Chain::get_module_instance_number ( Module *m )
{
int n = 0;

for ( int i = 0; i < modules(); ++i )
{
if ( module(i) == m )
break;

if ( ! strcmp( module(i)->name(), m->name() ) )
n++;
}

return n;
}

/* calculate the minimum number of buffers required to satisfy this chain */
int
Chain::required_buffers ( void )


+ 2
- 0
mixer/src/Chain.H View File

@@ -89,6 +89,8 @@ public:
const char *name ( void ) const { return _name; }
void name ( const char *name );

int get_module_instance_number ( Module *m );

void configure_ports ( void );
int required_buffers ( void );



+ 8
- 1
mixer/src/Module.C View File

@@ -200,7 +200,13 @@ Module::Port::generate_osc_path ()
char *path;

// /mixer/strip/STRIPNAME/control/MODULENAME/CONTROLNAME
asprintf( &path, "/mixer/strip/%s/control/%s/%s", module()->chain()->name(), p->module()->label(), p->name() );

int n = module()->chain()->get_module_instance_number( module() );

if ( n > 0 )
asprintf( &path, "/mixer/strip/%s/control/%s.%i/%s", module()->chain()->name(), p->module()->label(), n, p->name() );
else
asprintf( &path, "/mixer/strip/%s/control/%s/%s", module()->chain()->name(), p->module()->label(), p->name() );

// asprintf( &path, "/mixer/strip/control/%s/%s", p->module()->label(), p->name() );

@@ -220,6 +226,7 @@ Module::Port::change_osc_path ( char *path )
if ( _osc_path )
{
mixer->osc_endpoint->del_method( _osc_path, "f" );
mixer->osc_endpoint->del_method( _osc_path_cv, "f" );

free( _osc_path );
free( _osc_path_cv );


+ 5
- 0
mixer/src/Module.H View File

@@ -158,6 +158,11 @@ public:
void buffer ( void *buf, nframes_t nframes ) { _buf = buf; _nframes = nframes; };
void *buffer ( void ) const { return _buf; }

const char *osc_path ( )
{
return _osc_path;
}

void update_osc_port ( )
{
if ( INPUT == _direction )


+ 2
- 0
mixer/src/Module_Parameter_Editor.C View File

@@ -245,6 +245,8 @@ Module_Parameter_Editor::make_controls ( void )
}


w->tooltip( p->osc_path() );

Fl_Button *bound;

w->align(FL_ALIGN_TOP);


Loading…
Cancel
Save