projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bug fixes for Canvas::Box
[ardour.git]
/
libs
/
surfaces
/
wiimote
/
interface.cc
diff --git
a/libs/surfaces/wiimote/interface.cc
b/libs/surfaces/wiimote/interface.cc
index 5f622d5c09d5f29a10af2a81af6d4969d3dc0468..69983743e6ebd2d60bc2e54f6b35d1efb6ad8981 100644
(file)
--- a/
libs/surfaces/wiimote/interface.cc
+++ b/
libs/surfaces/wiimote/interface.cc
@@
-1,55
+1,59
@@
-#include <pbd/failed_constructor.h>
+/*
+ Copyright (C) 2009-2013 Paul Davis
+ Authors: Sampo Savolainen, Jannis Pohlmann
-#include "control_protocol/control_protocol.h"
-#include "wiimote.h"
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-#include "ardour/session.h"
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-using namespace ARDOUR;
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-static WiimoteControlProtocol *foo;
+*/
-ControlProtocol*
-new_wiimote_protocol (ControlProtocolDescriptor* descriptor, Session* s)
-{
- WiimoteControlProtocol* wmcp;
-
- try {
- wmcp = new WiimoteControlProtocol (*s);
- } catch (failed_constructor& err) {
- return 0;
- }
-
- if (wmcp-> set_active (true)) {
- delete wmcp;
- return 0;
- }
+#include "pbd/failed_constructor.h"
+#include "pbd/error.h"
- foo = wmcp;
+#include "ardour/session.h"
+#include "control_protocol/control_protocol.h"
- return wmcp;
-}
+#include "wiimote.h"
-void
-wiimote_control_protocol_cwiid_callback(cwiid_wiimote_t *wiimote, int mesg_count, union cwiid_mesg mesg[], struct timespec *t)
-{
- assert(foo != 0);
+using namespace ARDOUR;
+using namespace PBD;
- foo->wiimote_callback(wiimote,mesg_count,mesg,t);
+static ControlProtocol*
+new_wiimote_protocol (ControlProtocolDescriptor*, Session* s)
+{
+ WiimoteControlProtocol* wmcp = new WiimoteControlProtocol (*s);
+ wmcp->set_active (true);
+ return wmcp;
}
}
-void
-delete_wiimote_protocol (ControlProtocolDescriptor*
descriptor
, ControlProtocol* cp)
+
static
void
+delete_wiimote_protocol (ControlProtocolDescriptor*
/*descriptor*/
, ControlProtocol* cp)
{
{
- foo = 0;
delete cp;
}
delete cp;
}
-bool
-probe_wiimote_protocol (ControlProtocolDescriptor*
descriptor
)
+
static
bool
+probe_wiimote_protocol (ControlProtocolDescriptor*)
{
return WiimoteControlProtocol::probe ();
}
{
return WiimoteControlProtocol::probe ();
}
+static void*
+wiimote_request_buffer_factory (uint32_t num_requests)
+{
+ return WiimoteControlProtocol::request_factory (num_requests);
+}
+
static ControlProtocolDescriptor wiimote_descriptor = {
name : "Wiimote",
static ControlProtocolDescriptor wiimote_descriptor = {
name : "Wiimote",
@@
-60,14
+64,9
@@
static ControlProtocolDescriptor wiimote_descriptor = {
supports_feedback : false,
probe : probe_wiimote_protocol,
initialize : new_wiimote_protocol,
supports_feedback : false,
probe : probe_wiimote_protocol,
initialize : new_wiimote_protocol,
- destroy : delete_wiimote_protocol
+ destroy : delete_wiimote_protocol,
+ request_buffer_factory : wiimote_request_buffer_factory
};
};
-
-extern "C" {
-ControlProtocolDescriptor*
-protocol_descriptor () {
- return &wiimote_descriptor;
-}
-}
+extern "C" ARDOURSURFACE_API ControlProtocolDescriptor* protocol_descriptor () { return &wiimote_descriptor; }