13
0

MCP: different meter debug trace; initial support for track selection

git-svn-id: svn://localhost/ardour2/branches/3.0@11852 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-04-09 16:15:55 +00:00
parent e2d62d9af4
commit 57a046804c
7 changed files with 29 additions and 5 deletions

View File

@ -713,6 +713,7 @@ Editor::Editor ()
ControlProtocol::Redo.connect (*this, invalidator (*this), boost::bind (&Editor::redo, this, true), gui_context());
ControlProtocol::ScrollTimeline.connect (*this, invalidator (*this), ui_bind (&Editor::control_scroll, this, _1), gui_context());
ControlProtocol::SelectByRID.connect (*this, invalidator (*this), ui_bind (&Editor::control_select, this, _1), gui_context());
ControlProtocol::UnselectTrack.connect (*this, invalidator (*this), ui_bind (&Editor::control_unselect, this), gui_context());
BasicUI::AccessAction.connect (*this, invalidator (*this), ui_bind (&Editor::access_action, this, _1, _2), gui_context());
/* problematic: has to return a value and thus cannot be x-thread */
@ -921,6 +922,12 @@ Editor::zoom_adjustment_changed ()
temporal_zoom (fpu);
}
void
Editor::control_unselect ()
{
selection->clear_tracks ();
}
void
Editor::control_select (uint32_t rid)
{

View File

@ -989,6 +989,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void control_scroll (float);
void control_select (uint32_t rid);
void control_unselect ();
void access_action (std::string,std::string);
bool deferred_control_scroll (framepos_t);
sigc::connection control_scroll_connection;

View File

@ -39,6 +39,7 @@ Signal0<void> ControlProtocol::Undo;
Signal0<void> ControlProtocol::Redo;
Signal1<void,float> ControlProtocol::ScrollTimeline;
Signal1<void,uint32_t> ControlProtocol::SelectByRID;
Signal0<void> ControlProtocol::UnselectTrack;
ControlProtocol::ControlProtocol (Session& s, string str, EventLoop* evloop)
: BasicUI (s),

View File

@ -64,6 +64,7 @@ class ControlProtocol : virtual public sigc::trackable, public PBD::Stateful, pu
static PBD::Signal0<void> Redo;
static PBD::Signal1<void,float> ScrollTimeline;
static PBD::Signal1<void,uint32_t> SelectByRID;
static PBD::Signal0<void> UnselectTrack;
/* the model here is as follows:

View File

@ -101,6 +101,7 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
, _output_bundle (new ARDOUR::Bundle (_("Mackie Control Out"), false))
, _gui (0)
, _zoom_mode (false)
, _current_selected_track (-1)
{
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::MackieControlProtocol\n");
@ -286,6 +287,8 @@ MackieControlProtocol::switch_banks (int initial)
}
_current_initial_bank = initial;
_current_selected_track = -1;
clear_route_signals();
// now set the signals for new routes
@ -474,8 +477,19 @@ MackieControlProtocol::handle_strip_button (SurfacePort & port, Control & contro
state = !route->soloed();
route->set_solo (state, this);
} else if (control.name() == "select") {
// TODO make the track selected. Whatever that means.
//state = default_button_press (dynamic_cast<Button&> (control));
Strip* strip = const_cast<Strip*>(dynamic_cast<const Strip*>(&control.group()));
if (strip) {
if (strip->index() < route_table.size()) {
boost::shared_ptr<Route> r = route_table[strip->index()];
if (r->remote_control_id() == _current_selected_track) {
UnselectTrack (); /* EMIT SIGNAL */
_current_selected_track = -1;
} else {
SelectByRID (r->remote_control_id()); /* EMIT SIGNAL */
_current_selected_track = r->remote_control_id();;
}
}
}
} else if (control.name() == "vselect") {
// TODO could be used to select different things to apply the pot to?
//state = default_button_press (dynamic_cast<Button&> (control));

View File

@ -428,6 +428,7 @@ class MackieControlProtocol
void* _gui;
bool _zoom_mode;
int _current_selected_track;
};
#endif // ardour_mackie_control_protocol_h

View File

@ -44,6 +44,8 @@ MidiByteArray
Meter::update_message (float dB)
{
float def = 0.0f; /* Meter deflection %age */
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Meter ID %1 dB %2\n", raw_id(), dB));
if (dB < -70.0f) {
def = 0.0f;
@ -88,10 +90,7 @@ Meter::update_message (float dB)
if (last_segment_value_sent != segment) {
last_segment_value_sent = segment;
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Meter ID %1 to use segment %2\n", raw_id(), segment));
msg << MidiByteArray (2, 0xD0, (raw_id()<<4) | segment);
} else {
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Meter ID %1 not sent (same as last)\n", raw_id()));
}
return msg;