ardour/libs/surfaces/wiimote/interface.cc
Sampo Savolainen 43d868cde8 Wiimote control surface. Bind one wiimote by pressing 1+2 after the surface module is loaded. You need to bind every time you start ardour:
A Toggle play/stop
  D-pad:
    Up/Down: scroll tracks in the editor
    Left/Right: move playhead (nudge)
  +/- Zoom
  1 Arm selected track(s) for recording
  2 Toggle recording
  
As an extra, if you press down B and then A to stopp recording pass, Ardour scraps the recorded audio.

This is a work in progress. Please test.



git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4079 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-11-01 20:10:56 +00:00

73 lines
1.3 KiB
C++

#include <pbd/failed_constructor.h>
#include <control_protocol/control_protocol.h>
#include "wiimote.h"
#include <ardour/session.h>
using namespace ARDOUR;
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;
}
foo = wmcp;
return wmcp;
}
void
wiimote_control_protocol_cwiid_callback(cwiid_wiimote_t *wiimote, int mesg_count, union cwiid_mesg mesg[], struct timespec *t)
{
assert(foo != 0);
foo->wiimote_callback(wiimote,mesg_count,mesg,t);
}
void
delete_wiimote_protocol (ControlProtocolDescriptor* descriptor, ControlProtocol* cp)
{
foo = 0;
delete cp;
}
bool
probe_wiimote_protocol (ControlProtocolDescriptor* descriptor)
{
return WiimoteControlProtocol::probe ();
}
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,
destroy : delete_wiimote_protocol
};
extern "C" {
ControlProtocolDescriptor*
protocol_descriptor () {
return &wiimote_descriptor;
}
}