push2: fix up issues with object lifetimes and signals during shutdown
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <sigc++/trackable.h>
|
||||
|
||||
#include <cairomm/refptr.h>
|
||||
|
||||
namespace ARDOUR {
|
||||
@@ -35,7 +37,7 @@ namespace ArdourSurface {
|
||||
|
||||
class Push2;
|
||||
|
||||
class Push2Layout
|
||||
class Push2Layout : public sigc::trackable
|
||||
{
|
||||
public:
|
||||
Push2Layout (Push2& p, ARDOUR::Session& s);
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
|
||||
#include "canvas/colors.h"
|
||||
|
||||
#include "gtkmm2ext/gui_thread.h"
|
||||
|
||||
#include "mix.h"
|
||||
#include "knob.h"
|
||||
#include "push2.h"
|
||||
@@ -111,8 +113,8 @@ MixLayout::MixLayout (Push2& p, Session& s, Cairo::RefPtr<Cairo::Context> contex
|
||||
|
||||
mode_button = p2.button_by_id (Push2::Upper1);
|
||||
|
||||
session.RouteAdded.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&MixLayout::stripables_added, this), &p2);
|
||||
session.vca_manager().VCAAdded.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&MixLayout::stripables_added, this), &p2);
|
||||
session.RouteAdded.connect (session_connections, invalidator(*this), boost::bind (&MixLayout::stripables_added, this), &p2);
|
||||
session.vca_manager().VCAAdded.connect (session_connections, invalidator (*this), boost::bind (&MixLayout::stripables_added, this), &p2);
|
||||
}
|
||||
|
||||
MixLayout::~MixLayout ()
|
||||
@@ -515,8 +517,8 @@ MixLayout::switch_bank (uint32_t base)
|
||||
|
||||
/* stripable goes away? refill the bank, starting at the same point */
|
||||
|
||||
stripable[n]->DropReferences.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&MixLayout::switch_bank, this, bank_start), &p2);
|
||||
stripable[n]->presentation_info().PropertyChanged.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&MixLayout::stripable_property_change, this, _1, n), &p2);
|
||||
stripable[n]->DropReferences.connect (stripable_connections, invalidator (*this), boost::bind (&MixLayout::switch_bank, this, bank_start), &p2);
|
||||
stripable[n]->presentation_info().PropertyChanged.connect (stripable_connections, invalidator (*this), boost::bind (&MixLayout::stripable_property_change, this, _1, n), &p2);
|
||||
|
||||
Push2::Button* b;
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "ardour/session.h"
|
||||
#include "ardour/tempo.h"
|
||||
|
||||
#include "gtkmm2ext/gui_thread.h"
|
||||
#include "gtkmm2ext/rgb_macros.h"
|
||||
|
||||
#include "canvas/colors.h"
|
||||
@@ -141,8 +142,6 @@ Push2::Push2 (ARDOUR::Session& s)
|
||||
, octave_shift (0)
|
||||
, percussion (false)
|
||||
{
|
||||
cerr << "new push2 @ " << this << "\n";
|
||||
|
||||
context = Cairo::Context::create (frame_buffer);
|
||||
|
||||
build_maps ();
|
||||
@@ -176,15 +175,16 @@ Push2::Push2 (ARDOUR::Session& s)
|
||||
|
||||
Push2::~Push2 ()
|
||||
{
|
||||
cerr << "push2 deleted\n";
|
||||
stop ();
|
||||
|
||||
delete track_mix_layout;
|
||||
delete mix_layout;
|
||||
delete scale_layout;
|
||||
}
|
||||
|
||||
void
|
||||
Push2::port_registration_handler ()
|
||||
{
|
||||
cerr << "preg for " << this << endl;
|
||||
|
||||
if (!_async_in && !_async_out) {
|
||||
/* ports not registered yet */
|
||||
return;
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "ardour/session.h"
|
||||
#include "ardour/tempo.h"
|
||||
|
||||
#include "gtkmm2ext/gui_thread.h"
|
||||
#include "gtkmm2ext/rgb_macros.h"
|
||||
|
||||
#include "knob.h"
|
||||
@@ -66,42 +67,50 @@ TrackMixLayout::TrackMixLayout (Push2& p, Session& s, Cairo::RefPtr<Cairo::Conte
|
||||
upper_layout[n] = Pango::Layout::create (context);
|
||||
upper_layout[n]->set_font_description (fd2);
|
||||
|
||||
lower_layout[n] = Pango::Layout::create (context);
|
||||
lower_layout[n]->set_font_description (fd2);
|
||||
|
||||
switch (n) {
|
||||
case 0:
|
||||
upper_layout[n]->set_text (_("TRACK VOLUME"));
|
||||
lower_layout[n]->set_text (_("MUTE"));
|
||||
break;
|
||||
case 1:
|
||||
upper_layout[n]->set_text (_("TRACK PAN"));
|
||||
lower_layout[n]->set_text (_("SOLO"));
|
||||
break;
|
||||
case 2:
|
||||
upper_layout[n]->set_text (_("TRACK WIDTH"));
|
||||
lower_layout[n]->set_text (_("REC-ENABLE"));
|
||||
break;
|
||||
case 3:
|
||||
upper_layout[n]->set_text (_("TRACK TRIM"));
|
||||
lower_layout[n]->set_text (_("IN"));
|
||||
break;
|
||||
case 4:
|
||||
upper_layout[n]->set_text (_(""));
|
||||
lower_layout[n]->set_text (_("DISK"));
|
||||
break;
|
||||
case 5:
|
||||
upper_layout[n]->set_text (_(""));
|
||||
lower_layout[n]->set_text (_("SOLO ISO"));
|
||||
break;
|
||||
case 6:
|
||||
upper_layout[n]->set_text (_(""));
|
||||
lower_layout[n]->set_text (_("SOLO LOCK"));
|
||||
break;
|
||||
case 7:
|
||||
upper_layout[n]->set_text (_(""));
|
||||
lower_layout[n]->set_text (_(""));
|
||||
break;
|
||||
}
|
||||
|
||||
lower_layout[n] = Pango::Layout::create (context);
|
||||
lower_layout[n]->set_font_description (fd2);
|
||||
|
||||
knobs[n] = new Push2Knob (p2, context);
|
||||
knobs[n]->set_position (60 + (120*n), 95);
|
||||
knobs[n]->set_radius (25);
|
||||
}
|
||||
|
||||
ControlProtocol::StripableSelectionChanged.connect (selection_connection, MISSING_INVALIDATOR, boost::bind (&TrackMixLayout::selection_changed, this), &p2);
|
||||
ControlProtocol::StripableSelectionChanged.connect (selection_connection, invalidator (*this), boost::bind (&TrackMixLayout::selection_changed, this), &p2);
|
||||
}
|
||||
|
||||
TrackMixLayout::~TrackMixLayout ()
|
||||
@@ -147,17 +156,23 @@ TrackMixLayout::redraw (Cairo::RefPtr<Cairo::Context> context, bool force) const
|
||||
|
||||
for (int n = 0; n < 8; ++n) {
|
||||
|
||||
if (upper_layout[n]->get_text().empty()) {
|
||||
continue;
|
||||
if (!upper_layout[n]->get_text().empty()) {
|
||||
|
||||
/* Draw highlight box */
|
||||
|
||||
uint32_t color = p2.get_color (Push2::ParameterName);
|
||||
set_source_rgb (context, color);
|
||||
|
||||
context->move_to (10 + (n*120), 2);
|
||||
upper_layout[n]->update_from_cairo_context (context);
|
||||
upper_layout[n]->show_in_cairo_context (context);
|
||||
}
|
||||
|
||||
/* Draw highlight box */
|
||||
|
||||
uint32_t color = p2.get_color (Push2::ParameterName);
|
||||
set_source_rgb (context, color);
|
||||
context->move_to (10 + (n*120), 2);
|
||||
upper_layout[n]->update_from_cairo_context (context);
|
||||
upper_layout[n]->show_in_cairo_context (context);
|
||||
if (!lower_layout[n]->get_text().empty()) {
|
||||
context->move_to (10 + (n*120), 140);
|
||||
lower_layout[n]->update_from_cairo_context (context);
|
||||
lower_layout[n]->show_in_cairo_context (context);
|
||||
}
|
||||
}
|
||||
|
||||
context->move_to (0, 22.5);
|
||||
@@ -191,10 +206,10 @@ TrackMixLayout::set_stripable (boost::shared_ptr<Stripable> s)
|
||||
|
||||
if (stripable) {
|
||||
|
||||
stripable->DropReferences.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&TrackMixLayout::drop_stripable, this), &p2);
|
||||
stripable->DropReferences.connect (stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::drop_stripable, this), &p2);
|
||||
|
||||
stripable->PropertyChanged.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&TrackMixLayout::stripable_property_change, this, _1), &p2);
|
||||
stripable->presentation_info().PropertyChanged.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&TrackMixLayout::stripable_property_change, this, _1), &p2);
|
||||
stripable->PropertyChanged.connect (stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::stripable_property_change, this, _1), &p2);
|
||||
stripable->presentation_info().PropertyChanged.connect (stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::stripable_property_change, this, _1), &p2);
|
||||
|
||||
knobs[0]->set_controllable (stripable->gain_control());
|
||||
knobs[1]->set_controllable (stripable->pan_azimuth_control());
|
||||
|
||||
@@ -42,7 +42,7 @@ def build(bld):
|
||||
obj.includes = [ '.', './push2']
|
||||
obj.name = 'libardour_push2'
|
||||
obj.target = 'ardour_push2'
|
||||
obj.uselib = 'CAIROMM PANGOMM USB GTKMM'
|
||||
obj.uselib = 'CAIROMM PANGOMM USB GTKMM SIGCPP'
|
||||
obj.use = 'libardour libardour_cp libgtkmm2ext libpbd libevoral libcanvas libtimecode'
|
||||
obj.install_path = os.path.join(bld.env['LIBDIR'], 'surfaces')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user