fix compilation breakages from the last commit

git-svn-id: svn://localhost/ardour2/branches/3.0@6347 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis
2009-12-11 03:18:17 +00:00
parent 2983f8de97
commit 53bbac4eb6
8 changed files with 53 additions and 44 deletions

View 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)
{
}

View 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)
{

View 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)
{
}

View 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) {

View 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; }
};
}

View 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);
}

View File

@@ -28,12 +28,13 @@
#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 = 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"));
}
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"));
return node;
return *node;
}

View 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);