MCInputDevice Class Reference

MCInputDevice Class Referenceabstract

#include <mcapdev.h>

Class Description

See also
Class MCDeviceBinding, Class IMCapManager, Time Functions, Guidelines for Handling Character Strings.

Description:
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.
+ Inheritance diagram for MCInputDevice:

Public Member Functions

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

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Constructor & Destructor Documentation

virtual ~MCInputDevice ( )
inlinevirtual
Remarks
Destructor.
135 {}

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)
inlinevirtual
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:
{}
149 {}
virtual void UtilityStopped ( IMCapManager im)
inlinevirtual
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:
{}
156 {}
virtual void Cycle ( UINT  tick)
inlinevirtual
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:
{}
179 {}