X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Fwiimote%2Finterface.cc;h=8695facb8dd4a584901e74442b9a0f01400850be;hb=6fc1f270137a06115a79c6089004174c5cab5ed7;hp=0ef301dd6c6ba6c1e4a9dc94ac8f0b637a1d2713;hpb=bc89fe0147c04b67141936d109c00dfd4d69cc4b;p=ardour.git diff --git a/libs/surfaces/wiimote/interface.cc b/libs/surfaces/wiimote/interface.cc index 0ef301dd6c..8695facb8d 100644 --- a/libs/surfaces/wiimote/interface.cc +++ b/libs/surfaces/wiimote/interface.cc @@ -1,52 +1,50 @@ -#include +/* + Copyright (C) 2009-2013 Paul Davis + Authors: Sampo Savolainen, Jannis Pohlmann -#include -#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 + 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; } -bool -probe_wiimote_protocol (ControlProtocolDescriptor* descriptor) +static bool +probe_wiimote_protocol (ControlProtocolDescriptor*) { return WiimoteControlProtocol::probe (); } @@ -62,12 +60,6 @@ static ControlProtocolDescriptor wiimote_descriptor = { initialize : new_wiimote_protocol, destroy : delete_wiimote_protocol }; - -extern "C" { -ControlProtocolDescriptor* -protocol_descriptor () { - return &wiimote_descriptor; -} -} +extern "C" LIBCONTROLCP_API ControlProtocolDescriptor* protocol_descriptor () { return &wiimote_descriptor; }