#include <cmath>
#include "midi++/port.h"
-#include "midi++/manager.h"
#include "ardour/automation_control.h"
#include "ardour/debug.h"
{
DEBUG_TRACE (DEBUG::MackieControl, "Surface::Surface init\n");
- _port = new SurfacePort (*this);
+ try {
+ _port = new SurfacePort (*this);
+ } catch (...) {
+ throw failed_constructor ();
+ }
/* only the first Surface object has global controls */
DEBUG_TRACE (DEBUG::MackieControl, "Surface::~Surface done\n");
}
+XMLNode&
+Surface::get_state()
+{
+ char buf[64];
+ snprintf (buf, sizeof (buf), X_("surface-%u"), _number);
+ XMLNode* node = new XMLNode (buf);
+
+ node->add_child_nocopy (_port->get_state());
+
+ return *node;
+}
+
+int
+Surface::set_state (const XMLNode& node, int version)
+{
+ char buf[64];
+ snprintf (buf, sizeof (buf), X_("surface-%u"), _number);
+ XMLNode* mynode = node.child (buf);
+
+ if (!mynode) {
+ return 0;
+ }
+
+ XMLNode* portnode = mynode->child (X_("Port"));
+ if (portnode) {
+ if (_port->set_state (*portnode, version)) {
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
const MidiByteArray&
Surface::sysex_hdr() const
{
}
}
-void
-Surface::handle_port_inactive (SurfacePort*)
-{
- _active = false;
-}
-
void
Surface::write_sysex (const MidiByteArray & mba)
{