X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Fpush2%2Fpush2.cc;h=67c97b14dd68bae6132ce829805d20ff42feed00;hb=e14694bfa3cc50f362fe2c7499782d13d055de3b;hp=9f1290ec094deeb0e30392310d55c9947d7509e9;hpb=1b830f2604f18149d88b3f2c34cb64660f46d7aa;p=ardour.git diff --git a/libs/surfaces/push2/push2.cc b/libs/surfaces/push2/push2.cc index 9f1290ec09..67c97b14dd 100644 --- a/libs/surfaces/push2/push2.cc +++ b/libs/surfaces/push2/push2.cc @@ -17,6 +17,7 @@ */ #include +#include #include "pbd/compose.h" #include "pbd/convert.h" @@ -27,8 +28,9 @@ #include "pbd/enumwriter.h" #include "midi++/parser.h" -#include "timecode/time.h" -#include "timecode/bbt_time.h" + +#include "temporal/time.h" +#include "temporal/bbt_time.h" #include "ardour/amp.h" #include "ardour/async_midi_port.h" @@ -39,11 +41,12 @@ #include "ardour/midi_port.h" #include "ardour/session.h" #include "ardour/tempo.h" +#include "ardour/types_convert.h" #include "gtkmm2ext/gui_thread.h" #include "gtkmm2ext/rgb_macros.h" -#include "canvas/colors.h" +#include "gtkmm2ext/colors.h" #include "canvas.h" #include "gui.h" @@ -66,6 +69,7 @@ using namespace std; using namespace PBD; using namespace Glib; using namespace ArdourSurface; +using namespace Gtkmm2ext; #include "pbd/abstract_ui.cc" // instantiate template @@ -105,8 +109,6 @@ Push2::Push2 (ARDOUR::Session& s) /* master cannot be removed, so no need to connect to going-away signal */ master = session->master_out (); - ControlProtocol::StripableSelectionChanged.connect (selection_connection, MISSING_INVALIDATOR, boost::bind (&Push2::stripable_selection_change, this, _1), this); - /* allocate graphics layouts, even though we're not using them yet */ _canvas = new Push2Canvas (*this, 960, 160); @@ -133,9 +135,13 @@ Push2::Push2 (ARDOUR::Session& s) Push2::~Push2 () { - selection_connection.disconnect (); + DEBUG_TRACE (DEBUG::Push2, "push2 control surface object being destroyed\n"); + + /* do this before stopping the event loop, so that we don't get any notifications */ + port_reg_connection.disconnect (); + port_connection.disconnect (); - stop_event_loop (); /* this will call stop_using_device () in Quit request handler */ + stop_using_device (); device_release (); ports_release (); @@ -150,8 +156,13 @@ Push2::~Push2 () scale_layout = 0; delete splash_layout; splash_layout = 0; + delete track_mix_layout; + track_mix_layout = 0; + + stop_event_loop (); } + void Push2::run_event_loop () { @@ -171,7 +182,7 @@ Push2::begin_using_device () { DEBUG_TRACE (DEBUG::Push2, "begin using device\n"); - /* set up periodic task used to push a frame buffer to the + /* set up periodic task used to push a sample buffer to the * device (25fps). The device can handle 60fps, but we don't * need that frame rate. */ @@ -188,10 +199,7 @@ Push2::begin_using_device () splash (); /* catch current selection, if any so that we can wire up the pads if appropriate */ - { - StripableNotificationListPtr sp (new StripableNotificationList (ControlProtocol::last_selected())); - stripable_selection_change (sp); - } + stripable_selection_changed (); request_pressure_mode (); @@ -287,8 +295,11 @@ Push2::ports_release () asp = dynamic_cast (_output_port); asp->drain (10000, 500000); - AudioEngine::instance()->unregister_port (_async_in); - AudioEngine::instance()->unregister_port (_async_out); + { + Glib::Threads::Mutex::Lock em (AudioEngine::instance()->process_lock()); + AudioEngine::instance()->unregister_port (_async_in); + AudioEngine::instance()->unregister_port (_async_out); + } _async_in.reset ((ARDOUR::Port*) 0); _async_out.reset ((ARDOUR::Port*) 0); @@ -354,7 +365,7 @@ Push2::strip_buttons_off () Lower1, Lower2, Lower3, Lower4, Lower5, Lower6, Lower7, Lower8, }; for (size_t n = 0; n < sizeof (strip_buttons) / sizeof (strip_buttons[0]); ++n) { - Button* b = id_button_map[strip_buttons[n]]; + boost::shared_ptr