X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Ffaderport%2Ffaderport.cc;h=5da4ecdd3c8cae8cae34c12ff7bb8199c568999a;hb=2b9525c9918345feeae92c6b7df1ac2cb09242ba;hp=1f5352fdecdd19dd4cc697568488a1539a635ebe;hpb=d59739d728870843b39901a48216fe9109be6641;p=ardour.git diff --git a/libs/surfaces/faderport/faderport.cc b/libs/surfaces/faderport/faderport.cc index 1f5352fdec..5da4ecdd3c 100644 --- a/libs/surfaces/faderport/faderport.cc +++ b/libs/surfaces/faderport/faderport.cc @@ -26,7 +26,6 @@ #include #include -#include "pbd/controllable_descriptor.h" #include "pbd/error.h" #include "pbd/failed_constructor.h" #include "pbd/file_utils.h" @@ -40,6 +39,7 @@ #include "ardour/audioengine.h" #include "ardour/amp.h" #include "ardour/bundle.h" +#include "ardour/controllable_descriptor.h" #include "ardour/debug.h" #include "ardour/filesystem_paths.h" #include "ardour/midi_port.h" @@ -47,7 +47,8 @@ #include "ardour/monitor_processor.h" #include "ardour/profile.h" #include "ardour/rc_configuration.h" -#include "ardour/route.h" +#include "ardour/record_enable_control.h" +#include "ardour/stripable.h" #include "ardour/session.h" #include "ardour/session_configuration.h" #include "ardour/track.h" @@ -60,13 +61,13 @@ using namespace PBD; using namespace Glib; using namespace std; -#include "i18n.h" +#include "pbd/i18n.h" #include "pbd/abstract_ui.cc" // instantiate template FaderPort::FaderPort (Session& s) - : ControlProtocol (s, _("Faderport")) - , AbstractUI ("faderport") + : ControlProtocol (s, _("PreSonus FaderPort")) + , AbstractUI (name()) , gui (0) , connection_state (ConnectionState (0)) , _device_active (false) @@ -75,6 +76,7 @@ FaderPort::FaderPort (Session& s) , fader_is_touched (false) , button_state (ButtonState (0)) , blink_state (false) + , rec_enable_state (false) { last_encoder_time = 0; @@ -107,7 +109,7 @@ FaderPort::FaderPort (Session& s) ); - TrackSelectionChanged.connect (selection_connection, MISSING_INVALIDATOR, boost::bind (&FaderPort::gui_track_selection_changed, this, _1), this); + StripableSelectionChanged.connect (selection_connection, MISSING_INVALIDATOR, boost::bind (&FaderPort::gui_track_selection_changed, this, _1), this); /* Catch port connections and disconnections */ ARDOUR::AudioEngine::instance()->PortConnectedOrDisconnected.connect (port_connection, MISSING_INVALIDATOR, boost::bind (&FaderPort::connection_handler, this, _1, _2, _3, _4, _5), this); @@ -136,6 +138,7 @@ FaderPort::FaderPort (Session& s) buttons.insert (std::make_pair (Stop, Button (*this, _("Stop"), Stop, 2))); buttons.insert (std::make_pair (Play, Button (*this, _("Play"), Play, 1))); buttons.insert (std::make_pair (RecEnable, Button (*this, _("RecEnable"), RecEnable, 0))); + buttons.insert (std::make_pair (Footswitch, Button (*this, _("Footswitch"), Footswitch, -1))); buttons.insert (std::make_pair (FaderTouch, Button (*this, _("Fader (touch)"), FaderTouch, -1))); get_button (Shift).set_flash (true); @@ -152,8 +155,11 @@ FaderPort::FaderPort (Session& s) get_button (Undo).set_flash (true); get_button (FP_Read).set_action (boost::bind (&FaderPort::read, this), true); + get_button (FP_Read).set_action (boost::bind (&FaderPort::off, this), false, LongPress); get_button (FP_Write).set_action (boost::bind (&FaderPort::write, this), true); + get_button (FP_Write).set_action (boost::bind (&FaderPort::off, this), false, LongPress); get_button (FP_Touch).set_action (boost::bind (&FaderPort::touch, this), true); + get_button (FP_Touch).set_action (boost::bind (&FaderPort::off, this), false, LongPress); get_button (FP_Off).set_action (boost::bind (&FaderPort::off, this), true); get_button (Play).set_action (boost::bind (&BasicUI::transport_play, this, true), true); @@ -168,7 +174,7 @@ FaderPort::FaderPort (Session& s) /* See comments about Stop above .. */ get_button (Rewind).set_action (boost::bind (&BasicUI::rewind, this), true, RewindDown); get_button (Rewind).set_action (boost::bind (&BasicUI::goto_zero, this), true, ButtonState (RewindDown|StopDown)); - get_button (Rewind).set_action (boost::bind (&BasicUI::goto_start, this), true, ButtonState (RewindDown|ShiftDown)); + get_button (Rewind).set_action (boost::bind (&BasicUI::goto_start, this, false), true, ButtonState (RewindDown|ShiftDown)); get_button (Ffwd).set_action (boost::bind (&BasicUI::ffwd, this), true); get_button (Ffwd).set_action (boost::bind (&BasicUI::goto_end, this), true, ShiftDown); @@ -179,7 +185,7 @@ FaderPort::FaderPort (Session& s) get_button (Loop).set_action (boost::bind (&BasicUI::add_marker, this, string()), true, ShiftDown); get_button (Punch).set_action (boost::bind (&BasicUI::prev_marker, this), true, ShiftDown); - get_button (User).set_action (boost::bind (&BasicUI::next_marker, this), true, ShiftDown); + get_button (User).set_action (boost::bind (&BasicUI::next_marker, this), true, ButtonState(ShiftDown|UserDown)); get_button (Mute).set_action (boost::bind (&FaderPort::mute, this), true); get_button (Solo).set_action (boost::bind (&FaderPort::solo, this), true); @@ -191,6 +197,10 @@ FaderPort::FaderPort (Session& s) FaderPort::~FaderPort () { + cerr << "~FP\n"; + + all_lights_out (); + if (_input_port) { DEBUG_TRACE (DEBUG::FaderPort, string_compose ("unregistering input port %1\n", boost::shared_ptr(_input_port)->name())); AudioEngine::instance()->unregister_port (_input_port); @@ -198,13 +208,28 @@ FaderPort::~FaderPort () } if (_output_port) { -// _output_port->drain (10000); //ToDo: is this necessary? It hangs the shutdown, for me + _output_port->drain (10000, 250000); /* check every 10 msecs, wait up to 1/4 second for the port to drain */ DEBUG_TRACE (DEBUG::FaderPort, string_compose ("unregistering output port %1\n", boost::shared_ptr(_output_port)->name())); AudioEngine::instance()->unregister_port (_output_port); _output_port.reset (); } tear_down_gui (); + + /* stop event loop */ + DEBUG_TRACE (DEBUG::FaderPort, "BaseUI::quit ()\n"); + BaseUI::quit (); +} + +void* +FaderPort::request_factory (uint32_t num_requests) +{ + /* AbstractUI::request_buffer_factory() is a template method only + instantiated in this source module. To provide something visible for + use in the interface/descriptor, we have this static method that is + template-free. + */ + return request_buffer_factory (num_requests); } void @@ -224,7 +249,7 @@ FaderPort::start_midi_handling () * method, which will read the data, and invoke the parser. */ - _input_port->xthread().set_receive_handler (sigc::bind (sigc::mem_fun (this, &FaderPort::midi_input_handler), _input_port)); + _input_port->xthread().set_receive_handler (sigc::bind (sigc::mem_fun (this, &FaderPort::midi_input_handler), boost::weak_ptr (_input_port))); _input_port->xthread().attach (main_loop()->get_context()); } @@ -264,10 +289,10 @@ FaderPort::thread_init () { struct sched_param rtparam; - pthread_set_name (X_("FaderPort")); + pthread_set_name (event_loop_name().c_str()); - PBD::notify_gui_about_thread_creation (X_("gui"), pthread_self(), X_("FaderPort"), 2048); - ARDOUR::SessionEvent::create_per_thread_pool (X_("FaderPort"), 128); + PBD::notify_event_loops_about_thread_creation (pthread_self(), event_loop_name(), 2048); + ARDOUR::SessionEvent::create_per_thread_pool (event_loop_name(), 128); memset (&rtparam, 0, sizeof (rtparam)); rtparam.sched_priority = 9; /* XXX should be relative to audio (JACK) thread */ @@ -324,6 +349,8 @@ FaderPort::button_handler (MIDI::Parser &, MIDI::EventTwoBytes* tb) ButtonID id (ButtonID (tb->controller_number)); Button& button (get_button (id)); + DEBUG_TRACE (DEBUG::FaderPort, string_compose ("button event for ID %1 press ? %2\n", (int) tb->controller_number, (tb->value ? "yes" : "no"))); + if (tb->value) { buttons_down.insert (id); } else { @@ -335,10 +362,7 @@ FaderPort::button_handler (MIDI::Parser &, MIDI::EventTwoBytes* tb) switch (id) { case Shift: - /* set this bit on press, do NOT clear it on release */ - if (tb->value) { - bs = ShiftDown; - } + bs = ShiftDown; break; case Stop: bs = StopDown; @@ -351,8 +375,8 @@ FaderPort::button_handler (MIDI::Parser &, MIDI::EventTwoBytes* tb) break; case FaderTouch: fader_is_touched = tb->value; - if (_current_route) { - boost::shared_ptr gain = _current_route->gain_control (); + if (_current_stripable) { + boost::shared_ptr gain = _current_stripable->gain_control (); if (gain) { framepos_t now = session->engine().sample_time(); if (tb->value) { @@ -372,7 +396,7 @@ FaderPort::button_handler (MIDI::Parser &, MIDI::EventTwoBytes* tb) if (bs) { button_state = (tb->value ? ButtonState (button_state|bs) : ButtonState (button_state&~bs)); - DEBUG_TRACE (DEBUG::FaderPort, string_compose ("reset button state to %1%2 using %3%4\n", hex, button_state, bs, dec)); + DEBUG_TRACE (DEBUG::FaderPort, string_compose ("reset button state to %1 using %2\n", button_state, (int) bs)); } if (button.uses_flash()) { @@ -384,19 +408,9 @@ FaderPort::button_handler (MIDI::Parser &, MIDI::EventTwoBytes* tb) if (c == consumed.end()) { button.invoke (button_state, tb->value ? true : false); } else { + DEBUG_TRACE (DEBUG::FaderPort, "button was consumed, ignored\n"); consumed.erase (c); } - - if (!tb->value && (id != Shift)) { - /* non-shift key was released, clear shift modifier */ - button_state = ButtonState (button_state&~ShiftDown); - DEBUG_TRACE (DEBUG::FaderPort, "clear shift modifier\n"); - } - - if (!tb->value && (id != User)) { - consumed.insert (User); - DEBUG_TRACE (DEBUG::FaderPort, "clear user modifier\n"); - } } void @@ -432,7 +446,7 @@ FaderPort::encoder_handler (MIDI::Parser &, MIDI::pitchbend_t pb) last_good_encoder_delta = delta; } - if (_current_route) { + if (_current_stripable) { ButtonState trim_modifier; ButtonState width_modifier; @@ -446,7 +460,7 @@ FaderPort::encoder_handler (MIDI::Parser &, MIDI::pitchbend_t pb) } if ((button_state & trim_modifier) == trim_modifier ) { // mod+encoder = input trim - boost::shared_ptr trim = _current_route->trim()->gain_control (); + boost::shared_ptr trim = _current_stripable->trim_control (); if (trim) { float val = trim->get_user(); //for gain elements, the "user" value is in dB val += delta; @@ -487,12 +501,16 @@ FaderPort::fader_handler (MIDI::Parser &, MIDI::EventTwoBytes* tb) } if (was_fader) { - if (_current_route) { - boost::shared_ptr gain = _current_route->gain_control (); + if (_current_stripable) { + boost::shared_ptr gain = _current_stripable->gain_control (); if (gain) { int ival = (fader_msb << 7) | fader_lsb; float val = gain->interface_to_internal (ival/16384.0); - _current_route->set_gain (val, this); + /* even though the faderport only controls a + single stripable at a time, allow the fader to + modify the group, if appropriate. + */ + _current_stripable->gain_control()->set_value (val, Controllable::UseGroup); } } } @@ -501,6 +519,8 @@ FaderPort::fader_handler (MIDI::Parser &, MIDI::EventTwoBytes* tb) void FaderPort::sysex_handler (MIDI::Parser &p, MIDI::byte *buf, size_t sz) { + DEBUG_TRACE (DEBUG::FaderPort, string_compose ("sysex message received, size = %1\n", sz)); + if (sz < 17) { return; } @@ -535,6 +555,9 @@ FaderPort::sysex_handler (MIDI::Parser &p, MIDI::byte *buf, size_t sz) /* catch up on state */ + /* make sure that rec_enable_state is consistent with current device state */ + get_button (RecEnable).set_led_state (_output_port, rec_enable_state); + map_transport_state (); map_recenable_state (); } @@ -561,7 +584,7 @@ FaderPort::set_active (bool yn) blink_timeout->attach (main_loop()->get_context()); Glib::RefPtr periodic_timeout = Glib::TimeoutSource::create (100); // milliseconds - periodic_connection = blink_timeout->connect (sigc::mem_fun (*this, &FaderPort::periodic)); + periodic_connection = periodic_timeout->connect (sigc::mem_fun (*this, &FaderPort::periodic)); periodic_timeout->attach (main_loop()->get_context()); } else { @@ -581,11 +604,11 @@ FaderPort::set_active (bool yn) bool FaderPort::periodic () { - if (!_current_route) { + if (!_current_stripable) { return true; } - ARDOUR::AutoState gain_state = _current_route->gain_control()->automation_state(); + ARDOUR::AutoState gain_state = _current_stripable->gain_control()->automation_state(); if (gain_state == ARDOUR::Touch || gain_state == ARDOUR::Play) { map_gain (); @@ -617,6 +640,8 @@ FaderPort::blink () get_button(*b).set_led_state (_output_port, blink_state); } + map_recenable_state (); + return true; } @@ -630,27 +655,52 @@ FaderPort::close () port_connection.disconnect (); blink_connection.disconnect (); selection_connection.disconnect (); - route_connections.drop_connections (); + stripable_connections.drop_connections (); #if 0 - route_connections.drop_connections (); + stripable_connections.drop_connections (); #endif } void FaderPort::map_recenable_state () { + /* special case for RecEnable because its status can change as a + * confluence of unrelated parameters: (a) session rec-enable state (b) + * rec-enabled tracks. So we don't add the button to the blinkers list, + * we just call this: + * + * * from the blink callback + * * when the session tells us about a status change + * + * We do the last one so that the button changes state promptly rather + * than waiting for the next blink callback. The change in "blinking" + * based on having record-enabled tracks isn't urgent, and that happens + * during the blink callback. + */ + + bool onoff; + switch (session->record_status()) { case Session::Disabled: - stop_blinking (RecEnable); + onoff = false; break; case Session::Enabled: - start_blinking (RecEnable); + onoff = blink_state; break; case Session::Recording: - stop_blinking (RecEnable); + if (session->have_rec_enabled_track ()) { + onoff = true; + } else { + onoff = blink_state; + } break; } + + if (onoff != rec_enable_state) { + get_button(RecEnable).set_led_state (_output_port, onoff); + rec_enable_state = onoff; + } } void @@ -701,8 +751,14 @@ FaderPort::connect_session_signals() } bool -FaderPort::midi_input_handler (Glib::IOCondition ioc, boost::shared_ptr port) +FaderPort::midi_input_handler (Glib::IOCondition ioc, boost::weak_ptr wport) { + boost::shared_ptr port (wport.lock()); + + if (!port) { + return false; + } + DEBUG_TRACE (DEBUG::FaderPort, string_compose ("something happend on %1\n", boost::shared_ptr(port)->name())); if (ioc & ~IO_IN) { @@ -747,6 +803,7 @@ FaderPort::get_state () node.add_child_nocopy (get_button (Proj).get_state()); node.add_child_nocopy (get_button (Trns).get_state()); node.add_child_nocopy (get_button (User).get_state()); + node.add_child_nocopy (get_button (Footswitch).get_state()); return node; } @@ -831,6 +888,7 @@ FaderPort::connection_handler (boost::weak_ptr, std::string name1, */ g_usleep (100000); + DEBUG_TRACE (DEBUG::FaderPort, "device now connected for both input and output\n"); connected (); } else { @@ -848,7 +906,7 @@ FaderPort::connection_handler (boost::weak_ptr, std::string name1, void FaderPort::connected () { - DEBUG_TRACE (DEBUG::FaderPort, "connection status changed\n"); + DEBUG_TRACE (DEBUG::FaderPort, "sending device inquiry message...\n"); start_midi_handling (); @@ -875,12 +933,12 @@ FaderPort::Button::invoke (FaderPort::ButtonState bs, bool press) if (press) { if ((x = on_press.find (bs)) == on_press.end()) { - DEBUG_TRACE (DEBUG::FaderPort, string_compose ("no press action for button %1 state %2%3\%4\n", id, hex, bs, dec)); + DEBUG_TRACE (DEBUG::FaderPort, string_compose ("no press action for button %1 state %2 @ %3 in %4\n", id, bs, this, &on_press)); return; } } else { if ((x = on_release.find (bs)) == on_release.end()) { - DEBUG_TRACE (DEBUG::FaderPort, string_compose ("no release action for button %1 state %2%3\%4\n", id, hex, bs, dec)); + DEBUG_TRACE (DEBUG::FaderPort, string_compose ("no release action for button %1 state %2 @%3 in %4\n", id, bs, this, &on_release)); return; } } @@ -955,9 +1013,11 @@ FaderPort::Button::set_action (boost::function f, bool when_pressed, Fad todo.type = InternalFunction; if (when_pressed) { + DEBUG_TRACE (DEBUG::FaderPort, string_compose ("set button %1 (%2) @ %5 to some functor on press + %3 in %4\n", id, name, bs, &on_press, this)); todo.function = f; on_press[bs] = todo; } else { + DEBUG_TRACE (DEBUG::FaderPort, string_compose ("set button %1 (%2) @ %5 to some functor on release + %3\n", id, name, bs, this)); todo.function = f; on_release[bs] = todo; } @@ -998,9 +1058,6 @@ FaderPort::Button::set_state (XMLNode const& node) state_pairs.push_back (make_pair (string ("shift"), ShiftDown)); state_pairs.push_back (make_pair (string ("long"), LongPress)); - on_press.clear (); - on_release.clear (); - for (vector::const_iterator sp = state_pairs.begin(); sp != state_pairs.end(); ++sp) { string propname; @@ -1056,80 +1113,71 @@ FaderPort::Button::get_state () const } void -FaderPort::gui_track_selection_changed (RouteNotificationListPtr routes) +FaderPort::gui_track_selection_changed (StripableNotificationListPtr stripables) { - boost::shared_ptr r; - - if (!routes->empty()) { - r = routes->front().lock(); - } - - set_current_route (r); + set_current_stripable (ControlProtocol::first_selected_stripable()); } void -FaderPort::drop_current_route () +FaderPort::drop_current_stripable () { - if (_current_route) { - if (_current_route == session->monitor_out()) { - set_current_route (session->master_out()); + if (_current_stripable) { + if (_current_stripable == session->monitor_out()) { + set_current_stripable (session->master_out()); } else { - set_current_route (boost::shared_ptr()); + set_current_stripable (boost::shared_ptr()); } } } void -FaderPort::set_current_route (boost::shared_ptr r) +FaderPort::set_current_stripable (boost::shared_ptr r) { - route_connections.drop_connections (); + stripable_connections.drop_connections (); - _current_route = r; + _current_stripable = r; /* turn this off. It will be turned on back on in use_master() or use_monitor() as appropriate. */ get_button(Output).set_led_state (_output_port, false); - if (_current_route) { - _current_route->DropReferences.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::drop_current_route, this), this); + if (_current_stripable) { + _current_stripable->DropReferences.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::drop_current_stripable, this), this); - _current_route->mute_changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_mute, this, _1), this); - _current_route->solo_changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_solo, this, _1, _2, _3), this); - _current_route->listen_changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_listen, this, _1, _2), this); + _current_stripable->mute_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_mute, this), this); + _current_stripable->solo_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_solo, this), this); - boost::shared_ptr t = boost::dynamic_pointer_cast (_current_route); + boost::shared_ptr t = boost::dynamic_pointer_cast (_current_stripable); if (t) { - t->RecordEnableChanged.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_recenable, this), this); + t->rec_enable_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_recenable, this), this); } - boost::shared_ptr control = _current_route->gain_control (); + boost::shared_ptr control = _current_stripable->gain_control (); if (control) { - control->Changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_gain, this), this); - control->alist()->automation_state_changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_auto, this), this); + control->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_gain, this), this); + control->alist()->automation_state_changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_auto, this), this); } - boost::shared_ptr mp = _current_route->monitor_control(); + boost::shared_ptr mp = _current_stripable->monitor_control(); if (mp) { - mp->cut_control()->Changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_cut, this), this); + mp->cut_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_cut, this), this); } } //ToDo: subscribe to the fader automation modes so we can light the LEDs - map_route_state (); + map_stripable_state (); } void FaderPort::map_auto () { - /* December 14th 2015: setting the LED states of these buttons - interferes with fader operation. - */ - - return; + /* Under no circumstances send a message to "enable" the LED state of + * the Off button, because this will disable the fader. + */ - boost::shared_ptr control = _current_route->gain_control (); + boost::shared_ptr control = _current_stripable->gain_control (); const AutoState as = control->automation_state (); switch (as) { @@ -1137,25 +1185,21 @@ FaderPort::map_auto () get_button (FP_Read).set_led_state (_output_port, true); get_button (FP_Write).set_led_state (_output_port, false); get_button (FP_Touch).set_led_state (_output_port, false); - get_button (FP_Off).set_led_state (_output_port, false); break; case ARDOUR::Write: get_button (FP_Read).set_led_state (_output_port, false); get_button (FP_Write).set_led_state (_output_port, true); get_button (FP_Touch).set_led_state (_output_port, false); - get_button (FP_Off).set_led_state (_output_port, false); break; case ARDOUR::Touch: get_button (FP_Read).set_led_state (_output_port, false); get_button (FP_Write).set_led_state (_output_port, false); get_button (FP_Touch).set_led_state (_output_port, true); - get_button (FP_Off).set_led_state (_output_port, false); break; case ARDOUR::Off: get_button (FP_Read).set_led_state (_output_port, false); get_button (FP_Write).set_led_state (_output_port, false); get_button (FP_Touch).set_led_state (_output_port, false); - get_button (FP_Off).set_led_state (_output_port, true); break; } @@ -1165,7 +1209,7 @@ FaderPort::map_auto () void FaderPort::map_cut () { - boost::shared_ptr mp = _current_route->monitor_control(); + boost::shared_ptr mp = _current_stripable->monitor_control(); if (mp) { bool yn = mp->cut_all (); @@ -1180,13 +1224,13 @@ FaderPort::map_cut () } void -FaderPort::map_mute (void*) +FaderPort::map_mute () { - if (_current_route) { - if (_current_route->muted()) { + if (_current_stripable) { + if (_current_stripable->mute_control()->muted()) { stop_blinking (Mute); get_button (Mute).set_led_state (_output_port, true); - } else if (_current_route->muted_by_others()) { + } else if (_current_stripable->mute_control()->muted_by_others_soloing () || _current_stripable->mute_control()->muted_by_masters()) { start_blinking (Mute); } else { stop_blinking (Mute); @@ -1197,20 +1241,10 @@ FaderPort::map_mute (void*) } void -FaderPort::map_solo (bool, void*, bool) -{ - if (_current_route) { - get_button (Solo).set_led_state (_output_port, _current_route->soloed() || _current_route->listening_via_monitor()); - } else { - get_button (Solo).set_led_state (_output_port, false); - } -} - -void -FaderPort::map_listen (void*, bool) +FaderPort::map_solo () { - if (_current_route) { - get_button (Solo).set_led_state (_output_port, _current_route->listening_via_monitor()); + if (_current_stripable) { + get_button (Solo).set_led_state (_output_port, _current_stripable->solo_control()->soloed()); } else { get_button (Solo).set_led_state (_output_port, false); } @@ -1219,9 +1253,9 @@ FaderPort::map_listen (void*, bool) void FaderPort::map_recenable () { - boost::shared_ptr t = boost::dynamic_pointer_cast (_current_route); + boost::shared_ptr t = boost::dynamic_pointer_cast (_current_stripable); if (t) { - get_button (Rec).set_led_state (_output_port, t->record_enabled()); + get_button (Rec).set_led_state (_output_port, t->rec_enable_control()->get_value()); } else { get_button (Rec).set_led_state (_output_port, false); } @@ -1235,11 +1269,11 @@ FaderPort::map_gain () return; } - if (!_current_route) { + if (!_current_stripable) { return; } - boost::shared_ptr control = _current_route->gain_control (); + boost::shared_ptr control = _current_stripable->gain_control (); double val; if (!control) { @@ -1278,23 +1312,22 @@ FaderPort::map_gain () } void -FaderPort::map_route_state () +FaderPort::map_stripable_state () { - if (!_current_route) { + if (!_current_stripable) { stop_blinking (Mute); stop_blinking (Solo); get_button (Rec).set_led_state (_output_port, false); } else { - /* arguments to these map_*() methods are all ignored */ - map_solo (false, 0, false); + map_solo (); map_recenable (); map_gain (); map_auto (); - if (_current_route == session->monitor_out()) { + if (_current_stripable == session->monitor_out()) { map_cut (); } else { - map_mute (0); + map_mute (); } } }