fix compilation breakages from the last commit
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 11 Dec 2009 03:18:17 +0000 (03:18 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 11 Dec 2009 03:18:17 +0000 (03:18 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6347 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour_ui.cc
libs/ardour/automation_control.cc
libs/ardour/track.cc
libs/pbd/controllable.cc
libs/pbd/pbd/controllable.h
libs/surfaces/generic_midi/generic_midi_control_protocol.cc
libs/surfaces/generic_midi/midicontrollable.cc
libs/surfaces/generic_midi/midicontrollable.h

index 89abd1d3cc652198ea12f30433ae400693ed9424..e687be6474b7b261e7812f474c313206d00b99b3 100644 (file)
@@ -3411,7 +3411,7 @@ ARDOUR_UI::store_clock_modes ()
 
 
 ARDOUR_UI::TransportControllable::TransportControllable (std::string name, ARDOUR_UI& u, ToggleType tp)
-       : Controllable (name), ui (u), type(tp)
+       : Controllable (name,  string() /* missing URI */), ui (u), type(tp)
 {
 
 }
index 1460c42c7bd75420089b5f37c21657a5cf810e97..cad3ef57e88ae0a936e33ccc277cb201a4c1f933 100644 (file)
@@ -34,7 +34,7 @@ AutomationControl::AutomationControl(
                const Evoral::Parameter& parameter,
                boost::shared_ptr<ARDOUR::AutomationList> list,
                const string& name)
-       : Controllable((name != "") ? name : EventTypeMap::instance().to_symbol(parameter))
+       : Controllable((name != "") ? name : EventTypeMap::instance().to_symbol(parameter), string("") /* XXX missing URI */)
        , Evoral::Control(parameter, list)
        , _session(session)
 {
index 373829413ceaa336003f3741c1ffa77c32910f60..acfc9258b4e076cabc6a7b897d99fef0175e9762 100644 (file)
@@ -127,7 +127,7 @@ Track::freeze_state() const
 }
 
 Track::RecEnableControllable::RecEnableControllable (Track& s)
-       : Controllable (X_("recenable")), track (s)
+       : Controllable (X_("recenable"), string() /* XXX missing URI */), track (s)
 {
 }
 
index fbbb4d6f254a51d44d59952e5cddb5fd0ec89c3a..35f760554189d09d59195343f0a4100fff4ee780 100644 (file)
@@ -24,6 +24,7 @@
 #include "i18n.h"
 
 using namespace PBD;
+using namespace std;
 
 sigc::signal<void,Controllable*> Controllable::Destroyed;
 sigc::signal<bool,Controllable*> Controllable::StartLearning;
@@ -35,7 +36,7 @@ Glib::StaticRWLock Controllable::registry_lock = GLIBMM_STATIC_RW_LOCK_INIT;
 Controllable::Controllables Controllable::registry;
 Controllable::ControllablesByURI Controllable::registry_by_uri;
 
-Controllable::Controllable (const std::string& name, const std::string& uri)
+Controllable::Controllable (const string& name, const string& uri)
        : _name (name)
        , _uri (uri)
        , _touching (false)
@@ -46,7 +47,7 @@ Controllable::Controllable (const std::string& name, const std::string& uri)
 void
 Controllable::add ()
 {
-       Glib::RWLock::WriterLock lm (*registry_lock);
+       Glib::RWLock::WriterLock lm (registry_lock);
        registry.insert (this);
 
        if (!_uri.empty()) {
@@ -62,7 +63,7 @@ Controllable::add ()
 void
 Controllable::remove ()
 {
-       Glib::RWLock::WriterLock lm (*registry_lock);
+       Glib::RWLock::WriterLock lm (registry_lock);
 
        for (Controllables::iterator i = registry.begin(); i != registry.end(); ++i) {
                if ((*i) == this) {
@@ -71,7 +72,7 @@ Controllable::remove ()
                }
        }
 
-       if (_uri) {
+       if (!_uri.empty()) {
                ControllablesByURI::iterator i = registry_by_uri.find (_uri);
                if (i != registry_by_uri.end()) {
                        registry_by_uri.erase (i);
@@ -82,11 +83,11 @@ Controllable::remove ()
 }
 
 void
-Controllable::set_uri (const std::string& new_uri)
+Controllable::set_uri (const string& new_uri)
 {
-       Glib::RWLock::WriterLock lm (*registry_lock);
+       Glib::RWLock::WriterLock lm (registry_lock);
 
-       if (_uri) {
+       if (!_uri.empty()) {
                ControllablesByURI::iterator i = registry_by_uri.find (_uri);
                if (i != registry_by_uri.end()) {
                        registry_by_uri.erase (i);
@@ -106,7 +107,7 @@ Controllable::set_uri (const std::string& new_uri)
 Controllable*
 Controllable::by_id (const ID& id)
 {
-       Glib::RWLock::ReaderLock lm (*registry_lock);
+       Glib::RWLock::ReaderLock lm (registry_lock);
 
        for (Controllables::iterator i = registry.begin(); i != registry.end(); ++i) {
                if ((*i)->id() == id) {
@@ -119,19 +120,19 @@ Controllable::by_id (const ID& id)
 Controllable*
 Controllable::by_uri (const string& uri)
 {
-       Glib::RWLock::ReaderLock lm (*registry_lock);
+       Glib::RWLock::ReaderLock lm (registry_lock);
        ControllablesByURI::iterator i;
 
-       if ((i = registry_by_ui.find (uri)) != registry_by_uri.end()) {
+       if ((i = registry_by_uri.find (uri)) != registry_by_uri.end()) {
                return i->second;
        }
        return 0;
 }
 
 Controllable*
-Controllable::by_name (const std::string& str)
+Controllable::by_name (const string& str)
 {
-       Glib::RWLock::ReaderLock lm (*registry_lock);
+       Glib::RWLock::ReaderLock lm (registry_lock);
 
        for (Controllables::iterator i = registry.begin(); i != registry.end(); ++i) {
                if ((*i)->_name == str) {
index 76202d7bdb5fa2363ec37ca86a681c8f38d2408b..9750ebe56ed1c66faccbc5d1f2fd934150bd035f 100644 (file)
@@ -22,9 +22,11 @@ v    it under the terms of the GNU General Public License as published by
 
 #include <string>
 #include <set>
+#include <map>
 
 #include <sigc++/trackable.h>
 #include <sigc++/signal.h>
+#include <glibmm/thread.h>
 
 #include "pbd/statefuldestructible.h"
 
@@ -34,7 +36,7 @@ namespace PBD {
 
 class Controllable : public PBD::StatefulDestructible {
   public:
-       Controllable (std::string name, const std::string& uri);
+       Controllable (const std::string& name, const std::string& uri);
        virtual ~Controllable() { Destroyed (this); }
 
        void set_uri (const std::string&);
@@ -88,11 +90,11 @@ class Controllable : public PBD::StatefulDestructible {
 class IgnorableControllable : public Controllable 
 {
   public: 
-    IgnorableControllable () : PBD::Controllable ("ignoreMe") {}
-    ~IgnorableControllable () {}
+       IgnorableControllable () : PBD::Controllable ("ignoreMe", std::string()) {}
+       ~IgnorableControllable () {}
     
-    void set_value (float /*v*/) {}
-    float get_value () const { return 0.0; }
+       void set_value (float /*v*/) {}
+       float get_value () const { return 0.0; }
 };
 
 }
index 86bf90ee3f948f78dc8c343a561860beb7c6f76e..097dbc3aec845657841bc4ab4cb426684a1ce044 100644 (file)
@@ -139,7 +139,7 @@ GenericMidiControlProtocol::start_learning (Controllable* c)
        for (MIDIControllables::iterator i = controllables.begin(); i != controllables.end(); ) {
                tmp = i;
                ++tmp;
-               if (&(*i)->get_controllable() == c) {
+               if ((*i)->get_controllable() == c) {
                        delete (*i);
                        controllables.erase (i);
                }
@@ -150,7 +150,7 @@ GenericMidiControlProtocol::start_learning (Controllable* c)
        for (MIDIPendingControllables::iterator i = pending_controllables.begin(); i != pending_controllables.end(); ) {
                ptmp = i;
                ++ptmp;
-               if (&((*i).first)->get_controllable() == c) {
+               if (((*i).first)->get_controllable() == c) {
                        (*i).second.disconnect();
                        delete (*i).first;
                        pending_controllables.erase (i);
@@ -162,7 +162,7 @@ GenericMidiControlProtocol::start_learning (Controllable* c)
        MIDIControllable* mc = 0;
 
        for (MIDIControllables::iterator i = controllables.begin(); i != controllables.end(); ++i) {
-               if ((*i)->get_controllable().id() == c->id()) {
+               if ((*i)->get_controllable()->id() == c->id()) {
                        mc = *i;
                        break;
                }
@@ -221,7 +221,7 @@ GenericMidiControlProtocol::stop_learning (Controllable* c)
        */
 
        for (MIDIPendingControllables::iterator i = pending_controllables.begin(); i != pending_controllables.end(); ++i) {
-               if (&((*i).first)->get_controllable() == c) {
+               if (((*i).first)->get_controllable() == c) {
                        (*i).first->stop_learning ();
                        dptr = (*i).first;
                        (*i).second.disconnect();
@@ -243,7 +243,7 @@ GenericMidiControlProtocol::delete_binding (PBD::Controllable* control)
                for (MIDIControllables::iterator iter = controllables.begin(); iter != controllables.end(); ++iter) {
                        MIDIControllable* existingBinding = (*iter);
                        
-                       if (control == &(existingBinding->get_controllable())) {
+                       if (control == (existingBinding->get_controllable())) {
                                delete existingBinding;
                                controllables.erase (iter);
                        }
index 8b2077fb5bb813cf50a4292c5fb18387dd4b4ad9..124ef95615754603afbb89204eb883d33803279d 100644 (file)
 #include "midicontrollable.h"
 
 using namespace sigc;
+using namespace std;
 using namespace MIDI;
 using namespace PBD;
 using namespace ARDOUR;
 
 MIDIControllable::MIDIControllable (Port& p, const string& c, bool is_bistate)
-       : controllable (0), _port (p), bistate (is_bistate)
+       : controllable (0), _current_uri (c), _port (p), bistate (is_bistate)
 {
        init ();
 }
@@ -88,7 +89,11 @@ MIDIControllable::midi_forget ()
 void
 MIDIControllable::reacquire_controllable ()
 {
-       _controllable = Controllable::controllable_by_uri (current_uri);
+       if (!_current_uri.empty()) {
+               controllable = Controllable::by_uri (_current_uri);
+       } else {
+               controllable = 0;
+       }
 }
 
 void
@@ -136,7 +141,7 @@ MIDIControllable::control_to_midi(float val)
 {
        float control_min = 0.0f;
        float control_max = 1.0f;
-       ARDOUR::AutomationControl* ac = dynamic_cast<ARDOUR::AutomationControl*>(&controllable);
+       ARDOUR::AutomationControl* ac = dynamic_cast<ARDOUR::AutomationControl*>(controllable);
        if (ac) {
                control_min = ac->parameter().min();
                control_max = ac->parameter().max();
@@ -153,7 +158,7 @@ MIDIControllable::midi_to_control(float val)
 {
        float control_min = 0.0f;
        float control_max = 1.0f;
-       ARDOUR::AutomationControl* ac = dynamic_cast<ARDOUR::AutomationControl*>(&controllable);
+       ARDOUR::AutomationControl* ac = dynamic_cast<ARDOUR::AutomationControl*>(controllable);
        if (ac) {
                control_min = ac->parameter().min();
                control_max = ac->parameter().max();
@@ -194,7 +199,7 @@ MIDIControllable::midi_sense_note (Parser &, EventTwoBytes *msg, bool is_on)
                */
 
                if (msg->note_number == control_additional) {
-                       controllable.set_value (is_on ? 1 : 0);
+                       controllable->set_value (is_on ? 1 : 0);
                }
        }
 
@@ -434,21 +439,21 @@ MIDIControllable::set_state (const XMLNode& node, int /*version*/)
 XMLNode&
 MIDIControllable::get_state ()
 {
-       if (!controllable) {
-               return XXX !what!;
-       }
-
        char buf[32];
-       XMLNode& node (controllable->get_state ());
 
-       snprintf (buf, sizeof(buf), "0x%x", (int) control_type);
-       node.add_property ("event", buf);
-       snprintf (buf, sizeof(buf), "%d", (int) control_channel);
-       node.add_property ("channel", buf);
-       snprintf (buf, sizeof(buf), "0x%x", (int) control_additional);
-       node.add_property ("additional", buf);
-       node.add_property ("feedback", (feedback ? "yes" : "no"));
+       XMLNode* node = new XMLNode ("MIDIControllable");
+
+       if (controllable) {
+               node->add_property ("uri", controllable->uri());
+               snprintf (buf, sizeof(buf), "0x%x", (int) control_type);
+               node->add_property ("event", buf);
+               snprintf (buf, sizeof(buf), "%d", (int) control_channel);
+               node->add_property ("channel", buf);
+               snprintf (buf, sizeof(buf), "0x%x", (int) control_additional);
+               node->add_property ("additional", buf);
+               node->add_property ("feedback", (feedback ? "yes" : "no"));
+       }
 
-       return node;
+       return *node;
 }
 
index 7b84c9b60acd37cec46c369d99b41c2bccecd54e..a9a40944d8e99390bec9d507d2f48a710a484640 100644 (file)
@@ -91,6 +91,7 @@ class MIDIControllable : public PBD::Stateful
        std::string     _control_description;
        bool             feedback;
 
+       void init ();
        void reacquire_controllable ();
        
        void midi_receiver (MIDI::Parser &p, MIDI::byte *, size_t);