From 532f6aad4ac79ca15d69deccd18fca90e444c437 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 9 Jan 2007 23:24:54 +0000 Subject: Merged with trunk R1283. NOTE: Compiles, but broken (crash on adding MIDI track). git-svn-id: svn://localhost/ardour2/branches/midi@1292 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/surfaces/generic_midi/midicontrollable.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'libs/surfaces/generic_midi/midicontrollable.cc') diff --git a/libs/surfaces/generic_midi/midicontrollable.cc b/libs/surfaces/generic_midi/midicontrollable.cc index 6dc9bde8ad..75b5699f18 100644 --- a/libs/surfaces/generic_midi/midicontrollable.cc +++ b/libs/surfaces/generic_midi/midicontrollable.cc @@ -32,8 +32,6 @@ using namespace MIDI; using namespace PBD; using namespace ARDOUR; -bool MIDIControllable::_send_feedback = false; - MIDIControllable::MIDIControllable (Port& p, Controllable& c, bool is_bistate) : controllable (c), _port (p), bistate (is_bistate) { @@ -288,7 +286,7 @@ MIDIControllable::send_feedback () { byte msg[3]; - if (setting || !_send_feedback || control_type == none) { + if (setting || !feedback || control_type == none) { return; } @@ -302,7 +300,7 @@ MIDIControllable::send_feedback () MIDI::byte* MIDIControllable::write_feedback (MIDI::byte* buf, int32_t& bufsize, bool force) { - if (control_type != none &&_send_feedback && bufsize > 2) { + if (control_type != none && feedback && bufsize > 2) { MIDI::byte gm = (MIDI::byte) (controllable.get_value() * 127.0); @@ -345,6 +343,12 @@ MIDIControllable::set_state (const XMLNode& node) return -1; } + if ((prop = node.property ("feedback")) != 0) { + feedback = (prop->value() == "yes"); + } else { + feedback = true; // default + } + bind_midi (control_channel, control_type, control_additional); return 0; @@ -362,6 +366,7 @@ MIDIControllable::get_state () 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; } -- cgit v1.2.3