diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-30 16:48:58 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-30 16:48:58 +0000 |
commit | 74933f58659051f6d4ef52d1103b2b7ba4643883 (patch) | |
tree | 93069fda3163dce2e97b61a845863b68b300200d /libs/surfaces | |
parent | 8a17b0fb9073bb21ef2c718113f9e41359faf4fe (diff) |
restore excess calls to sync-order stuff (for now); allow MIDI controllers to use the same non-linear fader response as the gui; add various flags to PBD::Controllable and remove URI from that class
git-svn-id: svn://localhost/ardour2/branches/3.0@6414 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/surfaces')
-rw-r--r-- | libs/surfaces/generic_midi/generic_midi_control_protocol.cc | 27 | ||||
-rw-r--r-- | libs/surfaces/generic_midi/midicontrollable.cc | 14 | ||||
-rw-r--r-- | libs/surfaces/generic_midi/midicontrollable.h | 1 |
3 files changed, 27 insertions, 15 deletions
diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc index 6a29c27684..42c5358816 100644 --- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc +++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc @@ -274,7 +274,6 @@ GenericMidiControlProtocol::start_learning (Controllable* c) return false; } - Glib::Mutex::Lock lm (pending_lock); Glib::Mutex::Lock lm2 (controllables_lock); MIDIControllables::iterator tmp; @@ -288,20 +287,23 @@ GenericMidiControlProtocol::start_learning (Controllable* c) i = tmp; } - MIDIPendingControllables::iterator ptmp; - for (MIDIPendingControllables::iterator i = pending_controllables.begin(); i != pending_controllables.end(); ) { - ptmp = i; - ++ptmp; - if (((*i)->first)->get_controllable() == c) { - (*i)->second.disconnect(); - delete (*i)->first; - delete *i; - pending_controllables.erase (i); + { + Glib::Mutex::Lock lm (pending_lock); + + MIDIPendingControllables::iterator ptmp; + for (MIDIPendingControllables::iterator i = pending_controllables.begin(); i != pending_controllables.end(); ) { + ptmp = i; + ++ptmp; + if (((*i)->first)->get_controllable() == c) { + (*i)->second.disconnect(); + delete (*i)->first; + delete *i; + pending_controllables.erase (i); + } + i = ptmp; } - i = ptmp; } - MIDIControllable* mc = 0; for (MIDIControllables::iterator i = controllables.begin(); i != controllables.end(); ++i) { @@ -702,6 +704,7 @@ GenericMidiControlProtocol::create_binding (const XMLNode& node) void GenericMidiControlProtocol::reset_controllables () { + cerr << "GM::RC\n"; Glib::Mutex::Lock lm2 (controllables_lock); for (MIDIControllables::iterator iter = controllables.begin(); iter != controllables.end(); ++iter) { diff --git a/libs/surfaces/generic_midi/midicontrollable.cc b/libs/surfaces/generic_midi/midicontrollable.cc index 0cebabd80b..5c23628a64 100644 --- a/libs/surfaces/generic_midi/midicontrollable.cc +++ b/libs/surfaces/generic_midi/midicontrollable.cc @@ -30,6 +30,7 @@ #include "midi++/channel.h" #include "ardour/automation_control.h" +#include "ardour/utils.h" #include "midicontrollable.h" @@ -196,10 +197,14 @@ MIDIControllable::midi_to_control(float val) control_max = ac->parameter().max(); } - const float control_range = control_max - control_min; const float midi_range = 127.0f; // TODO: NRPN etc. - return val / midi_range * control_range + control_min; + if (ac->is_gain_like()) { + return slider_position_to_gain (val/midi_range); + } + + const float control_range = control_max - control_min; + return val / midi_range * control_range + control_min; } void @@ -459,8 +464,11 @@ MIDIControllable::get_state () XMLNode* node = new XMLNode ("MIDIControllable"); + if (!_current_uri.empty()) { + node->add_property ("uri", _current_uri); + } + 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); diff --git a/libs/surfaces/generic_midi/midicontrollable.h b/libs/surfaces/generic_midi/midicontrollable.h index b5aa115fee..a635eaea10 100644 --- a/libs/surfaces/generic_midi/midicontrollable.h +++ b/libs/surfaces/generic_midi/midicontrollable.h @@ -91,6 +91,7 @@ class MIDIControllable : public PBD::Stateful bool setting; MIDI::byte last_value; bool bistate; + bool _is_gain_controller; bool _learned; int midi_msg_id; /* controller ID or note number */ PBD::ScopedConnection midi_sense_connection[2]; |