#if defined (LINUX) || defined (SGI)
#include <dmedia/midi.h>
#endif
#include <maya/MIOStream.h>
#include <maya/MPxMidiInputDevice.h>
#include <maya/MDeviceState.h>
#include <maya/MDeviceChannel.h>
#include <maya/MString.h>
#include <maya/MFnPlugin.h>
#include <maya/MObject.h>
#define kVCRRewindButtonName "rewind"
#define kVCRRewindButtonIndex 0
#define kVCRForwardButtonName "forward"
#define kVCRForwardButtonIndex 1
#define kVCRStopButtonName "stop"
#define kVCRStopButtonIndex 2
#define kVCRPlayButtonName "play"
#define kVCRPlayButtonIndex 3
#define kVCRRecordButtonName "record"
#define kVCRRecordButtonIndex 4
#define kVCRLastButtonIndex 5
#define kVCRScrubWheelName "scrub"
#define kVCRScrubWheelIndex 0
#define kVCRLastAxisIndex 1
#define kVCRRewindUp 0x07
#define kVCRRewindDown 0x47
#define kVCRForwardUp 0x06
#define kVCRForwardDown 0x46
#define kVCRStopUp 0x05
#define kVCRStopDown 0x45
#define kVCRPlayUp 0x04
#define kVCRPlayDown 0x44
#define kVCRRecordUp 0x00
#define kVCRRecordDown 0x40
public:
jlcVcr();
virtual ~jlcVcr();
static void* creator();
protected:
#if defined (LINUX) || defined (SGI)
#endif
};
jlcVcr::jlcVcr()
{
setDegreesOfFreedom( kVCRLastAxisIndex );
setNumberOfButtons( kVCRLastButtonIndex );
}
jlcVcr::~jlcVcr() {}
void* jlcVcr::creator()
{
return new jlcVcr();
}
void jlcVcr::nameButtons()
{
name.
set(kVCRRewindButtonName);
setNamedButton(name, kVCRRewindButtonIndex);
name.
set(kVCRForwardButtonName);
setNamedButton(name, kVCRForwardButtonIndex);
name.
set(kVCRStopButtonName);
setNamedButton(name, kVCRStopButtonIndex);
name.
set(kVCRPlayButtonName);
setNamedButton(name, kVCRPlayButtonIndex);
name.
set(kVCRRecordButtonName);
setNamedButton(name, kVCRRecordButtonIndex);
}
void jlcVcr::nameAxes()
{
addChannel( *scrubChannel );
}
{
}
#if defined (LINUX) || defined (SGI)
{
if ( !device_state->
isNull() &&
(mde.msglen == 6) &&
(mde.sysexmsg[1] == 0x15) &&
(mde.sysexmsg[2] == 0x10)) {
if (mde.sysexmsg[3] == 0) {
switch (mde.sysexmsg[4]) {
case kVCRRewindUp:
break;
case kVCRRewindDown:
break;
case kVCRForwardUp:
break;
case kVCRForwardDown:
break;
case kVCRStopUp:
break;
case kVCRStopDown:
break;
case kVCRPlayUp:
break;
case kVCRPlayDown:
break;
case kVCRRecordUp:
break;
case kVCRRecordDown:
break;
}
} else {
int c = mde.sysexmsg[4];
if (c & 0x40) {
c = c - 128;
}
}
return device_state;
} else {
return NULL;
}
}
#endif
{
MFnPlugin plugin( obj, PLUGIN_COMPANY,
"3.0",
"Any");
status = plugin.registerDevice("jlcVcr", jlcVcr::creator );
if (!status) {
status.
perror(
"registerDevice");
return status;
}
return status;
}
{
status = plugin.deregisterDevice( "jlcVcr" );
if (!status) {
status.
perror(
"deregisterDevice");
return status;
}
return status;
}