another DEBUG_TRACE for mackie control x-thread requests
[ardour.git] / libs / surfaces / osc / osc_controllable.cc
index b5252c73c9cb39e83ac28bfaa7744f2e190abfd5..2cd4c310808c115df9d7cbd98d5851109cee0ec2 100644 (file)
@@ -1,6 +1,6 @@
 /*
     Copyright (C) 2009 Paul Davis
+
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
 using namespace sigc;
 using namespace PBD;
 using namespace ARDOUR;
+using namespace ArdourSurface;
 
 OSCControllable::OSCControllable (lo_address a, const std::string& p, boost::shared_ptr<Controllable> c)
        : controllable (c)
-       , addr (a)
        , path (p)
 {
+       addr = lo_address_new (lo_address_get_hostname(a) , lo_address_get_port(a));
        c->Changed.connect (changed_connection, MISSING_INVALIDATOR, boost::bind (&OSCControllable::send_change_message, this), OSC::instance());
 }
 
 OSCControllable::~OSCControllable ()
 {
+       changed_connection.disconnect();
        lo_address_free (addr);
 }
 
@@ -61,7 +63,7 @@ void
 OSCControllable::send_change_message ()
 {
        lo_message msg = lo_message_new ();
-       
+
        lo_message_add_float (msg, (float) controllable->get_value());
 
        /* XXX thread issues */
@@ -70,9 +72,9 @@ OSCControllable::send_change_message ()
        lo_message_free (msg);
 }
 
-/*------------------------------------------------------------*/       
+/*------------------------------------------------------------*/
 
-OSCRouteControllable::OSCRouteControllable (lo_address a, const std::string& p, 
+OSCRouteControllable::OSCRouteControllable (lo_address a, const std::string& p,
                                            boost::shared_ptr<Controllable> c, boost::shared_ptr<Route> r)
        : OSCControllable (a, p, c)
        , _route (r)
@@ -93,7 +95,8 @@ OSCRouteControllable::send_change_message ()
 
        /* XXX thread issues */
 
-       std::cerr << "ORC: send " << path << " = " << controllable->get_value() << std::endl;
+       //std::cerr << "ORC: send " << path << " = " << controllable->get_value() << std::endl;
+
        lo_send_message (addr, path.c_str(), msg);
        lo_message_free (msg);
 }