diff --git a/mixer/src/Chain.C b/mixer/src/Chain.C index eac7427..a9f7d94 100644 --- a/mixer/src/Chain.C +++ b/mixer/src/Chain.C @@ -840,7 +840,7 @@ Chain::buffer_size ( nframes_t nframes ) int Chain::sample_rate_change ( nframes_t nframes, void *v ) { - ((Chain*)v)->sample_rate_change( nframes ); + return ((Chain*)v)->sample_rate_change( nframes ); } int diff --git a/mixer/src/JACK_Module.C b/mixer/src/JACK_Module.C index 50e87b1..4c36505 100644 --- a/mixer/src/JACK_Module.C +++ b/mixer/src/JACK_Module.C @@ -380,6 +380,8 @@ JACK_Module::add_jack_output ( const char *prefix, int n ) } delete po; + + return true; } bool diff --git a/mixer/src/JACK_Module.H b/mixer/src/JACK_Module.H index 8697698..3012121 100644 --- a/mixer/src/JACK_Module.H +++ b/mixer/src/JACK_Module.H @@ -59,7 +59,7 @@ protected: protected: - int _connection_handle_outputs[2][2]; + unsigned int _connection_handle_outputs[2][2]; public: diff --git a/mixer/src/Mixer.C b/mixer/src/Mixer.C index de9806b..a8ac877 100644 --- a/mixer/src/Mixer.C +++ b/mixer/src/Mixer.C @@ -309,7 +309,7 @@ void Mixer::cb_menu(Fl_Widget* o) { } else if ( ! strcmp( picked, "&Remote Control/Clear All Mappings" ) ) { - if ( 1 == fl_ask( "This will remove all mappings, are you sure?") ) + if ( 1 == fl_choice( "This will remove all mappings, are you sure?", "No", "Yes", NULL ) ) { command_clear_mappings(); } diff --git a/mixer/src/Module.C b/mixer/src/Module.C index 71a546c..6f238e0 100644 --- a/mixer/src/Module.C +++ b/mixer/src/Module.C @@ -306,20 +306,14 @@ Module::handle_control_changed ( Port *p ) p->send_feedback(); } -bool -Module::Port::connected_osc ( void ) const -{ - if ( _scaled_signal ) - return _scaled_signal->connected(); - else - return false; -} - -void -Module::Port::learn_osc ( void ) -{ - _scaled_signal->learn_connection(); -} +/* bool */ +/* Module::Port::connected_osc ( void ) const */ +/* { */ +/* if ( _scaled_signal ) */ +/* return _scaled_signal->connected(); */ +/* else */ +/* return false; */ +/* } */ char * Module::Port::generate_osc_path () @@ -639,7 +633,7 @@ Module::draw_box ( int tx, int ty, int tw, int th ) { fl_draw_box( FL_ROUNDED_BOX, tx + 4, ty + 4, 5, 5, is_being_controlled() ? FL_YELLOW : fl_inactive( FL_YELLOW ) ); - fl_draw_box( FL_ROUNDED_BOX, tx + 4, ty + th - 8, 5, 5, is_being_controlled_osc() ? FL_YELLOW : fl_inactive( FL_YELLOW ) ); + /* fl_draw_box( FL_ROUNDED_BOX, tx + 4, ty + th - 8, 5, 5, is_being_controlled_osc() ? FL_YELLOW : fl_inactive( FL_YELLOW ) ); */ } if ( control_output.size() ) diff --git a/mixer/src/Module.H b/mixer/src/Module.H index aae87a2..6db21c4 100644 --- a/mixer/src/Module.H +++ b/mixer/src/Module.H @@ -123,8 +123,6 @@ public: static int osc_control_change_exact ( float v, void *user_data ); static int osc_control_change_cv ( float v, void *user_data ); - void learn_osc ( void ); - Hints hints; Port ( Module *module, Direction direction, Type type, const char *name = 0 ) @@ -334,14 +332,14 @@ public: return false; } - bool - is_being_controlled_osc ( void ) const - { - for ( nframes_t i = control_input.size(); i--; ) - if ( control_input[i].connected_osc() ) - return true; - return false; - } + /* bool */ + /* is_being_controlled_osc ( void ) const */ + /* { */ + /* for ( nframes_t i = control_input.size(); i--; ) */ + /* if ( control_input[i].connected_osc() ) */ + /* return true; */ + /* return false; */ + /* } */ virtual const char *name ( void ) const = 0; virtual const char *basename ( void ) const { return "Module"; } diff --git a/mixer/src/Module_Parameter_Editor.C b/mixer/src/Module_Parameter_Editor.C index 945f1c6..74f2582 100644 --- a/mixer/src/Module_Parameter_Editor.C +++ b/mixer/src/Module_Parameter_Editor.C @@ -410,8 +410,6 @@ Module_Parameter_Editor::bind_control ( int i ) { Module::Port *p = &_module->control_input[i]; - /* p->learn_osc(); */ - if ( p->connected() ) /* can only bind once */ return; diff --git a/nonlib/OSC/Endpoint.C b/nonlib/OSC/Endpoint.C index 64651d2..81fa418 100644 --- a/nonlib/OSC/Endpoint.C +++ b/nonlib/OSC/Endpoint.C @@ -110,36 +110,11 @@ namespace OSC _path = new_path; } - bool - Signal::is_connected_to ( const OSC::Signal *s ) const - { - for ( std::list::const_iterator i = _outgoing.begin(); - i != _outgoing.end(); - ++i ) - { - /* if ( (*i)->_peer == s->_peer && */ - /* (*i)->id() == s->id() ) */ - /* return true; */ - } - - return false; - } - void Signal::value ( float f ) { if ( f == _value ) return; - - - /* for ( std::list::const_iterator i = _outgoing.begin(); */ - /* i != _outgoing.end(); */ - /* ++i ) */ - /* { */ - /* /\* FIXME: won't work for loopback *\/ */ - /* if ( (*i)->_value != f ) */ - /* { */ - /* (*i)->_value = f; */ _value = f; @@ -156,55 +131,49 @@ namespace OSC // free(s); } - else if ( direction() == Input ) - { - DMESSAGE( "Sending value feedback for signal %s...", path() ); - for ( std::list::iterator i = _incoming.begin(); - i != _incoming.end(); - ++i ) - { - DMESSAGE( "Sending value feedback to %s %s %f", lo_address_get_url( (*i)->_peer->addr), (*i)->path() , f); - _endpoint->send( (*i)->_peer->addr, - (*i)->path(), - f ); - } - } + /* else if ( direction() == Input ) */ + /* { */ + /* DMESSAGE( "Sending value feedback for signal %s...", path() ); */ + /* for ( std::list::iterator i = _incoming.begin(); */ + /* i != _incoming.end(); */ + /* ++i ) */ + /* { */ + /* DMESSAGE( "Sending value feedback to %s %s %f", lo_address_get_url( (*i)->_peer->addr), (*i)->path() , f); */ + /* _endpoint->send( (*i)->_peer->addr, */ + /* (*i)->path(), */ + /* f ); */ + /* } */ + /* } */ } - void - Signal::learn_connection ( void ) - { - _endpoint->_learn_signal = this; - } + /* char * */ + /* Signal::get_output_connection_peer_name_and_path ( int n ) */ + /* { */ + /* Signal *t = NULL; */ - char * - Signal::get_output_connection_peer_name_and_path ( int n ) - { - Signal *t = NULL; + /* int j = 0; */ + /* for ( std::list::const_iterator i = _outgoing.begin(); */ + /* i != _outgoing.end(); */ + /* ++i, ++j ) */ + /* { */ + /* if ( j == n ) */ + /* { */ + /* t = *i; */ + /* break; */ + /* } */ + /* } */ - int j = 0; - for ( std::list::const_iterator i = _outgoing.begin(); - i != _outgoing.end(); - ++i, ++j ) - { - if ( j == n ) - { - t = *i; - break; - } - } - - if ( t ) - { - char *r; - asprintf( &r, "%s%s", t->_peer->name, t->path() ); - - return r; - } - else - return NULL; - } + /* if ( t ) */ + /* { */ + /* char *r; */ + /* asprintf( &r, "%s%s", t->_peer->name, t->path() ); */ + /* return r; */ + /* } */ + /* else */ + /* return NULL; */ + /* } */ + /* */ void @@ -222,7 +191,6 @@ namespace OSC _peer_scan_complete_userdata = 0; _server = 0; _name = 0; - _learn_signal = 0; owner = 0; } @@ -402,8 +370,6 @@ namespace OSC if ( s->_direction == Signal::Input ) { - /* s->_incoming.remove( ps ); */ - DMESSAGE( "Peer %s has disconnected from signal %s", our_name, their_name ); ep->del_translation( their_name ); @@ -456,14 +422,6 @@ namespace OSC Endpoint *ep = (Endpoint*)user_data; - /* Peer *p = ep->find_peer_by_address( lo_message_get_source( msg ) ); */ - - /* if ( ! p ) */ - /* { */ - /* WARNING( "Got signal remove notification from unknown peer." ); */ - /* return 0; */ - /* } */ - Signal *o = ep->find_signal_by_path( name ); if ( ! o ) @@ -474,34 +432,6 @@ namespace OSC DMESSAGE( "Signal %s:%s was removed", o->_peer->name, o->path() ); - /* /\* disconnect it *\/ */ - /* if ( o->_outgoing.size() ) */ - /* { */ - /* for ( std::list::iterator i = o->_outgoing.begin(); */ - /* i != o->_outgoing.end(); */ - /* ) */ - /* { */ - /* Signal *s = *i; */ - /* /\* avoid messing up iterator *\/ */ - /* ++i; */ - - /* ep->disconnect_signal( o, s ); */ - /* } */ - /* } */ - - /* if ( o->_incoming.size() ) */ - /* { */ - /* for ( std::list::iterator i = o->_incoming.begin(); */ - /* i != o->_incoming.end(); */ - /* ) */ - /* { */ - /* Signal *s = *i; */ - /* /\* avoid messing up iterator *\/ */ - /* ++i; */ - - /* ep->disconnect_signal( s, o ); */ - /* } */ - /* } */ if ( ep->_peer_signal_notification_callback ) ep->_peer_signal_notification_callback( o, Signal::Removed, ep->_peer_signal_notification_userdata ); @@ -596,13 +526,11 @@ namespace OSC { Signal *o; float f = 0.0; - Endpoint *ep = NULL; if ( ! strcmp( types, "f" ) ) { /* accept a value for signal named in path */ o = (Signal*)user_data; - ep = o->_endpoint; f = argv[0]->f; } else if ( ! types || 0 == types[0] ) @@ -895,78 +823,25 @@ namespace OSC return NULL; } - bool - Endpoint::disconnect_signal ( OSC::Signal *s, OSC::Signal *d ) - { - /* if ( ! s->is_connected_to( d ) ) */ - /* return false; */ - - if ( d->_peer ) - { - MESSAGE( "Disconnecting signal output \"%s\" from %s:%s", s->path(), d->_peer->name, d->_path ); - - /* send( d->_peer->addr, "/signal/disconnect", */ - /* s->_id, /\* our signal id *\/ */ - /* d->_id /\* their signal id *\/ ); */ - } - else - { - /* MESSAGE( "Disconnecting signal output \"%s\" to (unknown):%i", s->path(), d->_id ); */ - } - - s->_outgoing.remove( d ); - d->_incoming.remove( s ); - - return true; - } - bool Endpoint::disconnect_signal ( OSC::Signal *s, const char *signal_path ) { if ( s->_direction == Signal::Output ) { - /* Peer *p = find_peer_by_name( peer_name ); */ - - /* if ( ! p ) */ - /* return false; */ - - Signal *ps = find_signal_by_path( signal_path ); - - if ( ! ps ) - return false; - - if ( ! s->is_connected_to( ps ) ) - return false; - - return disconnect_signal( s, ps ); + for ( std::list::iterator i = _peers.begin(); + i != _peers.end(); + ++i ) + { + send( (*i)->addr, "/signal/disconnect", + s->path(), + signal_path); + } + + return true; } return false; } - - - /* bool */ - /* Endpoint::connect_signal ( OSC::Signal *s, OSC::Signal *d ) */ - /* { */ - /* /\* if ( s->is_connected_to( d ) ) *\/ */ - /* /\* { *\/ */ - /* /\* return false; *\/ */ - /* /\* } *\/ */ - - /* MESSAGE( "Connecting signal output \"%s\" to %s:%s", s->path(), d->_peer->name, d->path() ); */ - - /* s->_outgoing.push_back( d ); */ - - /* /\* make a record of it ourselves *\/ */ - /* d->_incoming.push_back( s ); */ - - /* send( d->_peer->addr, "/signal/connect", */ - /* s->path(), */ - /* d->path() ); */ - - /* return true; */ - /* } */ - bool Endpoint::connect_signal( OSC::Signal *s, const char *signal_path ) @@ -1163,37 +1038,6 @@ namespace OSC o->path() ); } - Endpoint *ep = this; - - /* /\* disconnect it *\/ */ - /* if ( o->_outgoing.size() ) */ - /* { */ - /* for ( std::list::iterator i = o->_outgoing.begin(); */ - /* i != o->_outgoing.end(); */ - /* ) */ - /* { */ - /* Signal *s = *i; */ - /* /\* avoid messing up iterator *\/ */ - /* ++i; */ - - /* ep->disconnect_signal( o, s ); */ - /* } */ - /* } */ - - /* if ( o->_incoming.size() ) */ - /* { */ - /* for ( std::list::iterator i = o->_incoming.begin(); */ - /* i != o->_incoming.end(); */ - /* ) */ - /* { */ - /* Signal *s = *i; */ - /* /\* avoid messing up iterator *\/ */ - /* ++i; */ - - /* ep->disconnect_signal( s, o ); */ - /* } */ - /* } */ - /* FIXME: clear loopback connections first! */ _signals.remove( o ); diff --git a/nonlib/OSC/Endpoint.H b/nonlib/OSC/Endpoint.H index 58080fa..4e56960 100644 --- a/nonlib/OSC/Endpoint.H +++ b/nonlib/OSC/Endpoint.H @@ -157,9 +157,6 @@ namespace OSC float _value; - std::list _outgoing; - std::list _incoming; - Direction _direction; signal_handler _handler; @@ -178,12 +175,6 @@ namespace OSC Signal ( const char *path, Direction dir ); ~Signal ( ); - int noutput_connections() { return _outgoing.size(); } - bool connected ( void ) const { return _outgoing.size() + _incoming.size(); } - - char * get_output_connection_peer_name_and_path ( int n ); - - Direction direction ( void ) const { return _direction; } void parameter_limits ( float min, float max, float default_value ) @@ -214,8 +205,6 @@ namespace OSC bool is_connected_to ( const Signal *s ) const; - void learn_connection ( void ); - friend class Endpoint; }; @@ -242,7 +231,6 @@ namespace OSC Thread _thread; friend class Signal; - Signal *_learn_signal; // lo_server_thread _st; lo_server _server; diff --git a/timeline/src/Control_Sequence.C b/timeline/src/Control_Sequence.C index e71206a..e76f39c 100644 --- a/timeline/src/Control_Sequence.C +++ b/timeline/src/Control_Sequence.C @@ -266,21 +266,21 @@ Control_Sequence::get_unjournaled ( Log_Entry &e ) const { e.add( ":interpolation", _interpolation ); - if ( _osc_output() && _osc_output()->connected() ) - { - DMESSAGE( "OSC Output connections: %i", _osc_output()->noutput_connections() ); + /* if ( _osc_output() && _osc_output()->connected() ) */ + /* { */ + /* DMESSAGE( "OSC Output connections: %i", _osc_output()->noutput_connections() ); */ - for ( int i = 0; i < _osc_output()->noutput_connections(); ++i ) - { - char *s; + /* for ( int i = 0; i < _osc_output()->noutput_connections(); ++i ) */ + /* { */ + /* char *s; */ - s = _osc_output()->get_output_connection_peer_name_and_path(i); + /* s = _osc_output()->get_output_connection_peer_name_and_path(i); */ - e.add( ":osc-output", s ); + /* e.add( ":osc-output", s ); */ - free( s ); - } - } + /* free( s ); */ + /* } */ + /* } */ e.add( ":mode", mode() ); } @@ -537,30 +537,30 @@ Control_Sequence::menu_cb ( const Fl_Menu_ *m ) const char *path = ((OSC::Signal*)m->mvalue()->user_data())->path(); - if ( ! _osc_output()->is_connected_to( ((OSC::Signal*)m->mvalue()->user_data()) ) ) + /* if ( ! _osc_output()->is_connected_to( ((OSC::Signal*)m->mvalue()->user_data()) ) ) */ { _persistent_osc_connections.push_back( strdup(path) ); connect_osc(); } - else - { - timeline->osc->disconnect_signal( _osc_output(), path ); + /* else */ + /* { */ + /* timeline->osc->disconnect_signal( _osc_output(), path ); */ - for ( std::list::iterator i = _persistent_osc_connections.begin(); - i != _persistent_osc_connections.end(); - ++i ) - { - if ( !strcmp( *i, path ) ) - { - free( *i ); - i = _persistent_osc_connections.erase( i ); - break; - } - } + /* for ( std::list::iterator i = _persistent_osc_connections.begin(); */ + /* i != _persistent_osc_connections.end(); */ + /* ++i ) */ + /* { */ + /* if ( !strcmp( *i, path ) ) */ + /* { */ + /* free( *i ); */ + /* i = _persistent_osc_connections.erase( i ); */ + /* break; */ + /* } */ + /* } */ - //free( path ); - } + /* //free( path ); */ + /* } */ } else if ( ! strcmp( picked, "Interpolation/Linear" ) ) @@ -618,7 +618,7 @@ Control_Sequence::connect_osc ( void ) } } - header()->outputs_indicator->value( _osc_output() && _osc_output()->connected() ); + /* header()->outputs_indicator->value( _osc_output() && _osc_output()->connected() ); */ timeline->osc_thread->unlock(); } @@ -644,7 +644,7 @@ static const char *peer_prefix; void Control_Sequence::update_osc_connection_state ( void ) { - header()->outputs_indicator->value( _osc_output() && _osc_output()->connected() ); + /* header()->outputs_indicator->value( _osc_output() && _osc_output()->connected() ); */ } void