don't actually use a method from libardourcp inside libardour; use a PBD::Signal to avoid linker issues

This commit is contained in:
Paul Davis 2017-05-12 17:49:09 +01:00
parent 38285d0e54
commit 7021d02782
4 changed files with 13 additions and 2 deletions

View file

@ -84,6 +84,7 @@ class LIBARDOUR_API ControlProtocolManager : public PBD::Stateful, public ARDOUR
PBD::Signal1<void,ControlProtocolInfo*> ProtocolStatusChange;
void stripable_selection_changed (ARDOUR::StripableNotificationListPtr);
static PBD::Signal1<void,ARDOUR::StripableNotificationListPtr> StripableSelectionChanged;
private:
ControlProtocolManager ();

View file

@ -42,7 +42,7 @@ using namespace PBD;
ControlProtocolManager* ControlProtocolManager::_instance = 0;
const string ControlProtocolManager::state_node_name = X_("ControlProtocols");
PBD::Signal1<void,StripableNotificationListPtr> ControlProtocolManager::StripableSelectionChanged;
ControlProtocolInfo::~ControlProtocolInfo ()
{
@ -566,7 +566,7 @@ ControlProtocolManager::stripable_selection_changed (StripableNotificationListPt
*/
DEBUG_TRACE (DEBUG::Selection, string_compose ("Surface manager: selection changed, now %1 stripables\n", sp ? sp->size() : -1));
ControlProtocol::notify_stripable_selection_changed (sp);
StripableSelectionChanged (sp); /* EMIT SIGNAL */
/* now give each protocol the chance to respond to the selection change
*/

View file

@ -21,6 +21,7 @@
#include "pbd/convert.h"
#include "pbd/error.h"
#include "ardour/control_protocol_manager.h"
#include "ardour/gain_control.h"
#include "ardour/session.h"
#include "ardour/record_enable_control.h"
@ -60,6 +61,8 @@ Glib::Threads::Mutex ControlProtocol::special_stripable_mutex;
boost::weak_ptr<Stripable> ControlProtocol::_first_selected_stripable;
boost::weak_ptr<Stripable> ControlProtocol::_leftmost_mixer_stripable;
StripableNotificationList ControlProtocol::_last_selected;
PBD::ScopedConnection ControlProtocol::selection_connection;
bool ControlProtocol::selection_connected = false;
const std::string ControlProtocol::state_node_name ("Protocol");
@ -68,6 +71,11 @@ ControlProtocol::ControlProtocol (Session& s, string str)
, _name (str)
, _active (false)
{
if (!selection_connected) {
/* this is all static, connect it only once (and early), for all ControlProtocols */
ControlProtocolManager::StripableSelectionChanged.connect_same_thread (selection_connection, boost::bind (&ControlProtocol::notify_stripable_selection_changed, _1));
selection_connected = true;
}
}
ControlProtocol::~ControlProtocol ()

View file

@ -158,6 +158,8 @@ class LIBCONTROLCP_API ControlProtocol : public PBD::Stateful, public PBD::Scope
static boost::weak_ptr<ARDOUR::Stripable> _leftmost_mixer_stripable;
static boost::weak_ptr<ARDOUR::Stripable> _first_selected_stripable;
static StripableNotificationList _last_selected;
static PBD::ScopedConnection selection_connection;
static bool selection_connected;
};
extern "C" {