Defines | Functions

wiimote.cpp File Reference

#include "wiimote.h"
#include <setupapi.h>
#include <hidsdi.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <process.h>
#include <math.h>
#include <mmreg.h>
#include <mmsystem.h>

Go to the source code of this file.

Defines

#define min(a, b)   (((a) < (b)) ? (a) : (b))
#define ARRAY_ENTRIES(array)   (sizeof(array)/sizeof(array[0]))
#define PREFIX   _T("WiiYourself! : ")
#define TRACE
#define DEEP_TRACE
#define WARN
#define TYPE2NAME(_type)   (type==_type)? _T(#_type)
#define DOT(x1, y1, z1, x2, y2, z2)   ((x1*x2) + (y1*y2) + (z1*z2))
#define IF_TYPE(id)
#define READ(data)
#define READ_SIZE(ptr, size)

Functions

template<class T >
sign (const T &val)
template<class T >
square (const T &val)
static void _cdecl _TRACE (const TCHAR *fmt,...)

Define Documentation

#define ARRAY_ENTRIES (   array )    (sizeof(array)/sizeof(array[0]))

Definition at line 51 of file wiimote.cpp.

Referenced by _TRACE(), and wiimote::Load16bitMonoSampleWAV().

#define DEEP_TRACE

Definition at line 80 of file wiimote.cpp.

Referenced by wiimote::Connect().

#define DOT (   x1,
  y1,
  z1,
  x2,
  y2,
  z2 
)    ((x1*x2) + (y1*y2) + (z1*z2))
#define IF_TYPE (   id )
Value:
if(type == id) { \
                                                                        /* sometimes it comes in more than once */ \
                                                                        if(Internal.ExtensionType == wiimote_state::id)\
                                                                                break; \
                                                                        Internal.ExtensionType = wiimote_state::id;
#define min (   a,
 
)    (((a) < (b)) ? (a) : (b))

Definition at line 44 of file wiimote.cpp.

Referenced by mitk::OdfVtkMapper2D< TPixelType, NrOdfDirections >::AdaptOdfScalingToImageSpacing(), QmitkRenderWindow::AdjustRenderWindowMenuVisibility(), annSpread(), mitk::ExtrudedContour::BuildGeometry(), mitk::CalculateGrayValueStatisticsTool::CalculateMinMax(), mitk::PlanarPolygon::CheckForLineIntersection(), itk::BrainMaskExtractionImageFilter< TOutputImagePixelType >::ComputeHistogram(), QwtScaleDiv::contains(), QmitkPropertyDelegate::createEditor(), mitk::CutImageWithOutputTypeSelect(), mitk::BoundingObjectToSegmentationFilter::GenerateData(), GenerateRandomNumber(), GenerateRandomPoint(), mitk::PropertyManager::GetDefaultLimits(), mitk::SimpleHistogram::GetMin(), mitk::RenderingManager::InitializeViews(), mitk::MaskImageFilter::InternalComputeMask(), mitk::CalculateGrayValueStatisticsTool::ITKHistogramming(), QmitkRegionGrowingView::ItkImageProcessing(), QuadProgPP::min(), itk::OrientationDistributionFunction< TComponent, NOdfDirections >::MinMaxNormalize(), mitk::VectorImageMapper2D::Paint(), mitk::MeshMapper2D::Paint(), QxtItemDelegatePrivate::paintProgress(), QuadProgPP::r_min(), mitk::LevelWindow::SetAuto(), mitk::LevelWindowManager::SetAutoTopMostImage(), QwtPlot::setAxisScale(), QmitkSliderNavigatorWidget::SetLabelValues(), QmitkTransferFunctionCanvas::SetMin(), mitk::Stepper::SetRange(), sl_fair_split(), sl_midpt_split(), QmitkBasicImageProcessing::StartButtonClicked(), QmitkImageCropper::SurroundingCheck(), QuadProgPP::svd(), QxtSpanSliderPrivate::triggerAction(), and QxtBaseSpinBox::validate().

#define PREFIX   _T("WiiYourself! : ")

Definition at line 56 of file wiimote.cpp.

#define READ (   data )
Value:
if(fread(&data, sizeof(data), 1, file) != 1) { \
                                                                        TRACE(_T(".wav file corrupt"));                    \
                                                                        fclose(file);                                                      \
                                                                        return false;                                                      \
                                                                        }

Referenced by wiimote::Load16bitMonoSampleWAV().

#define READ_SIZE (   ptr,
  size 
)
Value:
if(fread(ptr, size, 1, file) != 1) {               \
                                                                        TRACE(_T(".wav file corrupt"));                    \
                                                                        fclose(file);                                                      \
                                                                        return false;                                                      \
                                                                        }

Referenced by wiimote::Load16bitMonoSampleWAV().

#define TRACE
#define TYPE2NAME (   _type )    (type==_type)? _T(#_type)

Referenced by wiimote::SetReportType().

#define WARN

Function Documentation

static void _cdecl _TRACE ( const TCHAR *  fmt,
  ... 
) [static]

Definition at line 86 of file wiimote.cpp.

References ARRAY_ENTRIES.

        {
        static TCHAR buffer[256];
        if (!fmt) return;

        va_list  argptr;
        va_start (argptr, fmt);
#if (_MSC_VER >= 1400) // VC 2005+
        _vsntprintf_s(buffer, ARRAY_ENTRIES(buffer), _TRUNCATE, fmt, argptr);
#else
        _vsntprintf  (buffer, ARRAY_ENTRIES(buffer),                     fmt, argptr);
#endif
        va_end (argptr);

        OutputDebugString(buffer);
        }
template<class T >
T sign ( const T &  val ) [inline]

Definition at line 49 of file wiimote.cpp.

Referenced by QwtScaleArithmetic::ceil125(), QwtWheel::drawWheel(), QwtScaleArithmetic::floor125(), and mitk::RenderingManager::InitializeViews().

{ return (val<0)? T(-1) : T(1); }
template<class T >
T square ( const T &  val ) [inline]

Definition at line 50 of file wiimote.cpp.

{ return val*val; }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines