/*
- Copyright (C) 2006 Paul Davis
+ Copyright (C) 2006 Paul Davis
This program is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser
#include <string>
#include <vector>
#include <list>
+
#include <boost/shared_ptr.hpp>
-#include <sigc++/sigc++.h>
-#include <pbd/stateful.h>
-#include <control_protocol/basic_ui.h>
+
+#include "pbd/stateful.h"
+#include "pbd/signals.h"
+
+#include "control_protocol/visibility.h"
+#include "control_protocol/basic_ui.h"
+#include "control_protocol/types.h"
namespace ARDOUR {
class Route;
class Session;
+class Bundle;
-class ControlProtocol : public sigc::trackable, public PBD::Stateful, public BasicUI {
+class LIBCONTROLCP_API ControlProtocol : public PBD::Stateful, public PBD::ScopedConnectionList, public BasicUI
+{
public:
ControlProtocol (Session&, std::string name);
virtual ~ControlProtocol();
std::string name() const { return _name; }
- virtual int set_active (bool yn) = 0;
- bool get_active() const { return _active; }
+ virtual int set_active (bool yn);
+ bool active() const { return _active; }
virtual int set_feedback (bool /*yn*/) { return 0; }
virtual bool get_feedback () const { return false; }
- virtual void route_list_changed () {}
+ virtual void midi_connectivity_established () {}
- sigc::signal<void> ActiveChanged;
+ PBD::Signal0<void> ActiveChanged;
/* signals that a control protocol can emit and other (presumably graphical)
user interfaces can respond to
*/
- static sigc::signal<void> ZoomToSession;
- static sigc::signal<void> ZoomIn;
- static sigc::signal<void> ZoomOut;
- static sigc::signal<void> Enter;
- static sigc::signal<void,float> ScrollTimeline;
+ static PBD::Signal0<void> ZoomToSession;
+ static PBD::Signal0<void> ZoomIn;
+ static PBD::Signal0<void> ZoomOut;
+ static PBD::Signal0<void> Enter;
+ static PBD::Signal0<void> Undo;
+ static PBD::Signal0<void> Redo;
+ static PBD::Signal1<void,float> ScrollTimeline;
+ static PBD::Signal1<void,uint32_t> GotoView;
+ static PBD::Signal0<void> CloseDialog;
+ static PBD::Signal0<void> VerticalZoomInAll;
+ static PBD::Signal0<void> VerticalZoomOutAll;
+ static PBD::Signal0<void> VerticalZoomInSelected;
+ static PBD::Signal0<void> VerticalZoomOutSelected;
+ static PBD::Signal0<void> StepTracksDown;
+ static PBD::Signal0<void> StepTracksUp;
+
+ static PBD::Signal1<void,uint64_t> AddRouteToSelection;
+ static PBD::Signal1<void,uint64_t> SetRouteSelection;
+ static PBD::Signal1<void,uint64_t> ToggleRouteSelection;
+ static PBD::Signal1<void,uint64_t> RemoveRouteFromSelection;
+ static PBD::Signal0<void> ClearRouteSelection;
+
+ /* signals that one UI (e.g. the GUI) can emit to get all other UI's to
+ respond. Typically this will always be GUI->"others" - the GUI pays
+ no attention to these signals.
+ */
+
+ static PBD::Signal1<void,RouteNotificationListPtr> TrackSelectionChanged;
/* the model here is as follows:
we imagine most control surfaces being able to control
from 1 to N tracks at a time, with a session that may
contain 1 to M tracks, where M may be smaller, larger or
- equal to N.
+ equal to N.
the control surface has a fixed set of physical controllers
which can potentially be mapped onto different tracks/busses
std::string route_get_name (uint32_t table_index);
+ virtual std::list<boost::shared_ptr<ARDOUR::Bundle> > bundles ();
+
+ virtual bool has_editor () const { return false; }
+ virtual void* get_gui() const { return 0; }
+ virtual void tear_down_gui() { }
+
+ XMLNode& get_state ();
+ int set_state (XMLNode const &, int version);
+
+ static const std::string state_node_name;
+
protected:
std::vector<boost::shared_ptr<ARDOUR::Route> > route_table;
std::string _name;
- bool _active;
-
- void add_strip (std::list<boost::shared_ptr<ARDOUR::Route> >);
void next_track (uint32_t initial_id);
void prev_track (uint32_t initial_id);
+
+ private:
+ LIBCONTROLCP_LOCAL ControlProtocol (const ControlProtocol&); /* noncopyable */
+ bool _active;
};
extern "C" {
- struct ControlProtocolDescriptor {
- const char* name; /* descriptive */
- const char* id; /* unique and version-specific */
- void* ptr; /* protocol can store a value here */
- void* module; /* not for public access */
- int mandatory; /* if non-zero, always load and do not make optional */
- bool supports_feedback; /* if true, protocol has toggleable feedback mechanism */
- bool (*probe)(ControlProtocolDescriptor*);
- ControlProtocol* (*initialize)(ControlProtocolDescriptor*,Session*);
- void (*destroy)(ControlProtocolDescriptor*,ControlProtocol*);
-
+ class ControlProtocolDescriptor {
+ public:
+ const char* name; /* descriptive */
+ const char* id; /* unique and version-specific */
+ void* ptr; /* protocol can store a value here */
+ void* module; /* not for public access */
+ int mandatory; /* if non-zero, always load and do not make optional */
+ bool supports_feedback; /* if true, protocol has toggleable feedback mechanism */
+ bool (*probe)(ControlProtocolDescriptor*);
+ ControlProtocol* (*initialize)(ControlProtocolDescriptor*,Session*);
+ void (*destroy)(ControlProtocolDescriptor*,ControlProtocol*);
+ /* this is required if the control protocol connects to signals
+ from libardour. they all do. It should allocate a
+ type-specific request buffer for the calling thread, and
+ store it in a thread-local location that will be used to
+ find it when sending the event loop a message
+ (e.g. call_slot()). It should also return the allocated
+ buffer as a void*.
+ */
+ void* (*request_buffer_factory)(uint32_t);
};
}