2013-01-07 13:28:09 -05:00
|
|
|
/*
|
2019-08-03 08:34:29 -04:00
|
|
|
* Copyright (C) 2008-2015 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2013-01-07 13:28:09 -05:00
|
|
|
|
|
|
|
#include "pbd/failed_constructor.h"
|
|
|
|
#include "pbd/error.h"
|
2008-12-12 09:43:24 -05:00
|
|
|
|
2009-10-29 20:21:40 -04:00
|
|
|
#include "ardour/session.h"
|
2013-01-07 13:28:09 -05:00
|
|
|
#include "control_protocol/control_protocol.h"
|
2008-12-12 09:43:24 -05:00
|
|
|
|
2013-01-07 13:28:09 -05:00
|
|
|
#include "wiimote.h"
|
2008-12-12 09:43:24 -05:00
|
|
|
|
2013-01-07 13:28:09 -05:00
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace PBD;
|
2008-12-12 09:43:24 -05:00
|
|
|
|
2013-09-03 08:33:51 -04:00
|
|
|
static ControlProtocol*
|
2013-01-07 13:28:09 -05:00
|
|
|
new_wiimote_protocol (ControlProtocolDescriptor*, Session* s)
|
2008-12-12 09:43:24 -05:00
|
|
|
{
|
2013-01-07 13:28:09 -05:00
|
|
|
WiimoteControlProtocol* wmcp = new WiimoteControlProtocol (*s);
|
|
|
|
wmcp->set_active (true);
|
2008-12-12 09:43:24 -05:00
|
|
|
return wmcp;
|
|
|
|
}
|
|
|
|
|
2013-09-03 08:33:51 -04:00
|
|
|
static void
|
2013-01-07 13:28:09 -05:00
|
|
|
delete_wiimote_protocol (ControlProtocolDescriptor* /*descriptor*/, ControlProtocol* cp)
|
2008-12-12 09:43:24 -05:00
|
|
|
{
|
|
|
|
delete cp;
|
|
|
|
}
|
|
|
|
|
2013-09-03 08:33:51 -04:00
|
|
|
static bool
|
2013-01-07 13:28:09 -05:00
|
|
|
probe_wiimote_protocol (ControlProtocolDescriptor*)
|
2008-12-12 09:43:24 -05:00
|
|
|
{
|
|
|
|
return WiimoteControlProtocol::probe ();
|
|
|
|
}
|
2015-12-28 11:13:04 -05:00
|
|
|
static void*
|
|
|
|
wiimote_request_buffer_factory (uint32_t num_requests)
|
|
|
|
{
|
|
|
|
return WiimoteControlProtocol::request_factory (num_requests);
|
|
|
|
}
|
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
|
|
|
|
static ControlProtocolDescriptor wiimote_descriptor = {
|
|
|
|
name : "Wiimote",
|
|
|
|
id : "uri://ardour.org/surfaces/wiimote:0",
|
|
|
|
ptr : 0,
|
|
|
|
module : 0,
|
|
|
|
mandatory : 0,
|
|
|
|
supports_feedback : false,
|
|
|
|
probe : probe_wiimote_protocol,
|
|
|
|
initialize : new_wiimote_protocol,
|
2015-12-28 11:13:04 -05:00
|
|
|
destroy : delete_wiimote_protocol,
|
|
|
|
request_buffer_factory : wiimote_request_buffer_factory
|
2008-12-12 09:43:24 -05:00
|
|
|
};
|
2013-01-07 13:28:09 -05:00
|
|
|
|
2014-01-25 13:57:28 -05:00
|
|
|
extern "C" ARDOURSURFACE_API ControlProtocolDescriptor* protocol_descriptor () { return &wiimote_descriptor; }
|
2008-12-12 09:43:24 -05:00
|
|
|
|