13
0

MCP: make BasicUI::rewind() behave symmetrically to BasicUI::ffwd(); basics of route locking and an API to put the master/monitor on a strip

git-svn-id: svn://localhost/ardour2/branches/3.0@11915 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-04-11 20:10:10 +00:00
parent c0bdc7f31e
commit b2cd8b004c
5 changed files with 68 additions and 4 deletions

View File

@ -100,7 +100,7 @@ BasicUI::add_marker ()
void
BasicUI::rewind ()
{
session->request_transport_speed (session->transport_speed() * 1.5);
session->request_transport_speed (session->transport_speed() - 1.5);
}
void

View File

@ -1095,3 +1095,33 @@ MackieControlProtocol::set_view_mode (ViewMode m)
}
}
void
MackieControlProtocol::set_master_on_surface_strip (uint32_t surface, uint32_t strip_number)
{
force_special_route_to_strip (session->master_out(), surface, strip_number);
}
void
MackieControlProtocol::set_monitor_on_surface_strip (uint32_t surface, uint32_t strip_number)
{
force_special_route_to_strip (session->monitor_out(), surface, strip_number);
}
void
MackieControlProtocol::force_special_route_to_strip (boost::shared_ptr<Route> r, uint32_t surface, uint32_t strip_number)
{
if (!r) {
return;
}
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
if ((*s)->number() == surface) {
Strip* strip = (*s)->nth_strip (strip_number);
if (strip) {
strip->set_route (session->master_out());
strip->lock_route ();
}
}
}
}

View File

@ -129,6 +129,9 @@ class MackieControlProtocol
std::list<boost::shared_ptr<ARDOUR::Bundle> > bundles ();
void set_master_on_surface_strip (uint32_t surface, uint32_t strip);
void set_monitor_on_surface_strip (uint32_t surface, uint32_t strip);
uint32_t n_strips () const;
bool has_editor () const { return true; }
@ -267,6 +270,12 @@ class MackieControlProtocol
bool midi_input_handler (Glib::IOCondition ioc, MIDI::Port* port);
void clear_ports ();
std::vector<std::string> _f_actions;
void force_special_route_to_strip (boost::shared_ptr<ARDOUR::Route> r, uint32_t surface, uint32_t strip_number);
/* BUTTON HANDLING */
struct ButtonHandlers {
Mackie::LedState (MackieControlProtocol::*press) (Mackie::Button&);
Mackie::LedState (MackieControlProtocol::*release) (Mackie::Button&);
@ -282,8 +291,6 @@ class MackieControlProtocol
void build_button_map ();
std::vector<std::string> _f_actions;
/* implemented button handlers */
Mackie::LedState frm_left_press(Mackie::Button &);
Mackie::LedState frm_left_release(Mackie::Button &);

View File

@ -69,6 +69,7 @@ Strip::Strip (Surface& s, const std::string& name, int index, StripControlDefini
, _gain (0)
, _index (index)
, _surface (&s)
, _route_locked (false)
{
/* build the controls for this track, which will automatically add them
to the Group
@ -250,6 +251,10 @@ std::ostream & Mackie::operator << (std::ostream & os, const Strip & strip)
void
Strip::set_route (boost::shared_ptr<Route> r)
{
if (_route_locked) {
return;
}
route_connections.drop_connections ();
_route = r;
@ -466,7 +471,13 @@ Strip::handle_button (Button& button, ButtonState bs)
} else if (button.id() >= Button::select_base_id &&
button.id() < Button::select_base_id + 8) {
_surface->mcp().select_track (_route);
int lock_mod = (MackieControlProtocol::MODIFIER_CONTROL|MackieControlProtocol::MODIFIER_SHIFT);
if ((_surface->mcp().modifier_state() & lock_mod) == lock_mod) {
_route_locked = !_route_locked;
} else {
_surface->mcp().select_track (_route);
}
} else if (button.id() >= Button::vselect_base_id &&
button.id() < Button::vselect_base_id + 8) {
@ -651,3 +662,15 @@ Strip::display (uint32_t line_number, const std::string& line)
return retval;
}
void
Strip::lock_route ()
{
_route_locked = true;
}
void
Strip::unlock_route ()
{
_route_locked = false;
}

View File

@ -87,6 +87,9 @@ public:
MidiByteArray blank_display (uint32_t line_number);
MidiByteArray zero ();
void lock_route ();
void unlock_route ();
private:
Button* _solo;
Button* _recenable;
@ -99,6 +102,7 @@ private:
Meter* _meter;
int _index;
Surface* _surface;
bool _route_locked;
boost::shared_ptr<ARDOUR::Route> _route;
PBD::ScopedConnectionList route_connections;