Mixer: Create unique OSC paths even when multiple instances of a module/plugin with the same name exist in a chain.
This commit is contained in:
parent
f9bbdb20c9
commit
18a1429b22
|
@ -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 )
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -200,6 +200,12 @@ Module::Port::generate_osc_path ()
|
|||
char *path;
|
||||
|
||||
// /mixer/strip/STRIPNAME/control/MODULENAME/CONTROLNAME
|
||||
|
||||
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 );
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -245,6 +245,8 @@ Module_Parameter_Editor::make_controls ( void )
|
|||
}
|
||||
|
||||
|
||||
w->tooltip( p->osc_path() );
|
||||
|
||||
Fl_Button *bound;
|
||||
|
||||
w->align(FL_ALIGN_TOP);
|
||||
|
|
Loading…
Reference in New Issue