diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-10-09 15:50:44 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-10-09 15:50:44 +0000 |
commit | 0d0f71ee92fb7ce53fbcb8c7b0cd93b1cdf3529f (patch) | |
tree | ae37075200040cbbd430b98ee3cbce59eaef51ca /libs/surfaces | |
parent | 8011cbf5f8e4181ac39e4140e681fcad531f4a7c (diff) |
fix abort-capture path, including many subtle issues with shared_ptr<>; remove old automation feedback code; make new automation feedback code slightly configurable ; fix zoom focus options for playhead + edit cursor ; prevent zoom < 2 samples per pixel to avoid crashes ; peak building now uses shared_ptr<Source> not Source*
git-svn-id: svn://localhost/ardour2/trunk@959 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/surfaces')
3 files changed, 49 insertions, 3 deletions
diff --git a/libs/surfaces/control_protocol/control_protocol/control_protocol.h b/libs/surfaces/control_protocol/control_protocol/control_protocol.h index 8be652b9df..3635b267ce 100644 --- a/libs/surfaces/control_protocol/control_protocol/control_protocol.h +++ b/libs/surfaces/control_protocol/control_protocol/control_protocol.h @@ -45,6 +45,10 @@ class ControlProtocol : public sigc::trackable, public Stateful, public BasicUI virtual int set_active (bool yn) = 0; bool get_active() const { return _active; } + virtual int set_feedback (bool yn) { return 0; } + virtual bool get_feedback () const { return false; } + virtual bool supports_feedback () const { return false; } + sigc::signal<void> ActiveChanged; /* signals that a control protocol can emit and other (presumably graphical) diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc index a8a5b6eace..8e8f707bab 100644 --- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc +++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc @@ -54,6 +54,7 @@ GenericMidiControlProtocol::GenericMidiControlProtocol (Session& s) throw failed_constructor(); } + do_feedback = false; _feedback_interval = 10000; // microseconds last_feedback_time = 0; @@ -82,6 +83,10 @@ GenericMidiControlProtocol::set_feedback_interval (microseconds_t ms) void GenericMidiControlProtocol::send_feedback () { + if (!do_feedback) { + return; + } + microseconds_t now = get_microseconds (); if (last_feedback_time != 0) { @@ -98,7 +103,7 @@ GenericMidiControlProtocol::send_feedback () void GenericMidiControlProtocol::_send_feedback () { - const int32_t bufsize = 16 * 1024; + const int32_t bufsize = 16 * 1024; /* XXX too big */ MIDI::byte buf[bufsize]; int32_t bsize = bufsize; MIDI::byte* end = buf; @@ -174,8 +179,12 @@ XMLNode& GenericMidiControlProtocol::get_state () { XMLNode* node = new XMLNode ("Protocol"); + char buf[32]; node->add_property (X_("name"), _name); + node->add_property (X_("feedback"), do_feedback ? "1" : "0"); + snprintf (buf, sizeof (buf), "%" PRIu64, _feedback_interval); + node->add_property (X_("feedback_interval"), buf); XMLNode* children = new XMLNode (X_("controls")); @@ -194,6 +203,22 @@ GenericMidiControlProtocol::set_state (const XMLNode& node) { XMLNodeList nlist; XMLNodeConstIterator niter; + const XMLProperty* prop; + + if ((prop = node.property ("feedback")) != 0) { + do_feedback = (bool) atoi (prop->value().c_str()); + } else { + do_feedback = false; + } + + if ((prop = node.property ("feedback_interval")) != 0) { + if (sscanf (prop->value().c_str(), "%" PRIu64, &_feedback_interval) != 1) { + _feedback_interval = 10000; + } + } else { + _feedback_interval = 10000; + } + Controllable* c; { @@ -215,8 +240,6 @@ GenericMidiControlProtocol::set_state (const XMLNode& node) for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - XMLProperty* prop; - if ((prop = (*niter)->property ("id")) != 0) { ID id = prop->value (); @@ -239,3 +262,17 @@ GenericMidiControlProtocol::set_state (const XMLNode& node) return 0; } + +int +GenericMidiControlProtocol::set_feedback (bool yn) +{ + do_feedback = yn; + last_feedback_time = 0; + return 0; +} + +bool +GenericMidiControlProtocol::get_feedback () const +{ + return do_feedback; +} diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.h b/libs/surfaces/generic_midi/generic_midi_control_protocol.h index 5f5a470b13..d008744727 100644 --- a/libs/surfaces/generic_midi/generic_midi_control_protocol.h +++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.h @@ -32,6 +32,10 @@ class GenericMidiControlProtocol : public ARDOUR::ControlProtocol { MIDI::Port* port () const { return _port; } void set_feedback_interval (ARDOUR::microseconds_t); + int set_feedback (bool yn); + bool get_feedback () const; + bool supports_feedback () const { return true; } + XMLNode& get_state (); int set_state (const XMLNode&); @@ -40,6 +44,7 @@ class GenericMidiControlProtocol : public ARDOUR::ControlProtocol { ARDOUR::microseconds_t _feedback_interval; ARDOUR::microseconds_t last_feedback_time; + bool do_feedback; void _send_feedback (); void send_feedback (); |