Public Member Functions

MCInputDevice Class Reference

Search for all occurrences

Detailed Description

See also:
Class MCDeviceBinding, Class IMCapManager, Time, Character Strings.

Description:
This class is available in release 2.0 and later only.

This is the base class for an input device plug-in. All methods of this class are virtual.

In terms of the motion capture system, the basic item that is plug-able is the motion capture device. This is something like a mouse, joystick, or midi device. Developers implement two classes, this one, MCInputDevice, and MCDeviceBinding. There is usually only one instance of MCInputDevice. This is like the virtual mouse, or the joystick. This represents the actual device. An instance of the device binding represents an instance where a motion capture controller has been bound to a device, i.e. the user has picked the device and assigned it to a parameter. Thus there may be many instances of the device binding. The device binding is part of the reference hierarchy. The device itself doesn't usually have any parameters for the user to adjust -- these are rather part of the device binding.

Some simple sample code for the mouse motion capture device is available in /MAXSDK/SAMPLES/MOCAP/MCDEVICE.CPP.

#include <mcapdev.h>

Inheritance diagram for MCInputDevice:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual  ~MCInputDevice ()
virtual MSTR  DeviceName ()=0
virtual MCDeviceBinding CreateBinding ()=0
virtual void  UtilityStarted (IMCapManager *im)
virtual void  UtilityStopped (IMCapManager *im)
virtual void  Cycle (UINT tick)

Constructor & Destructor Documentation

virtual ~MCInputDevice ( ) [inline, virtual]
Remarks:
Destructor.
{}

Member Function Documentation

virtual MSTR DeviceName ( ) [pure virtual]
Remarks:
Returns the name for the input device.
virtual MCDeviceBinding* CreateBinding ( ) [pure virtual]
Remarks:
The motion capture utility creates a list of all the MCInputDevices in the system. When the user wants to pick one it will call this method. It returns a new instance of the MCDeviceBinding class.
virtual void UtilityStarted ( IMCapManager im ) [inline, virtual]
Remarks:
This method is called when the user enters the utility.
Parameters:
IMCapManager *im

This is an interface into the motion capture manager.
Default Implementation:
{}
{}
virtual void UtilityStopped ( IMCapManager im ) [inline, virtual]
Remarks:
This method is called when the user leaves the utility.
Parameters:
IMCapManager *im

This is an interface into the motion capture manager.
Default Implementation:
{}
{}
virtual void Cycle ( UINT  tick ) [inline, virtual]
Remarks:
This method is called when the user is in 'Record' (capture) mode or 'Test' mode. It is called once per millisecond. For instance the joystick device uses this method. To understand this method consider the following example:

With MIDI you don't call a function to see if a key has been pressed or not -- rather it is a message based system where you're notified if something happens. In contrast to this is the joystick. If the user moves the joystick the program is not notified. Rather a developer must poll the joystick to get its current position. During motion capture one could poll the joystick at every frame to get its current position. However this approach leads to jittering (aliasing). The problem is that, on average, the joystick is providing a smooth series of values, but instantaneously, the values jump around a bit. So, the joystick motion capture plug-in implements this method to stores the values returned at every millisecond. Then later, when needing to sample the joystick at a certain time, the stored table of values can be averaged and this provides a level of smoothing.
Parameters:
UINT tick

The time of this call in milliseconds.
Default Implementation:
{}
{}      

MCInputDevice MCInputDevice MCInputDevice MCInputDevice MCInputDevice MCInputDevice MCInputDevice MCInputDevice MCInputDevice MCInputDevice
MCInputDevice MCInputDevice MCInputDevice MCInputDevice MCInputDevice MCInputDevice MCInputDevice MCInputDevice MCInputDevice MCInputDevice