CLAM::MIDIDevice Class Reference

This is the abstract base class for an midi device. More...

#include <MIDIDevice.hxx>

List of all members.

Classes

struct  TInfo
 This class is used to respond to device information request using the GetInfo method. More...

Protected Member Functions

 MIDIDevice (const std::string &name)
 Constructor of the class that sets the name of object to the string passed by parameter.
virtual ~MIDIDevice ()
 Destructor of class.
void Start (void)
 This method should be called to begin the use of this Device.
void Stop (void)
 This method must be called to end the use of this Device.
virtual void ConcreteStart (void)=0 throw (Err)
 This function is executed to start the concrete use of the devices.
virtual void ConcreteStop (void)=0 throw (Err)
 This function is executed to stop the concrete use of the devices.
void GetInfo (TInfo &)
 Getter for the Info of Device Object attached to this MIDIDevice instantiation.
virtual void SetClock (TControlData val)
virtual void Read (void)=0 throw (Err)
 Reads the information given by this Device and passes data to an Audio chunk.
virtual void Write (unsigned char *msg, int size)=0 throw (Err)
bool Register (MIDIManager *mm, MIDIIn &in)
bool Register (MIDIManager *mm, MIDIOut &out)
void Unregister (MIDIIn &in)
void Unregister (MIDIOut &out)
bool Register (MIDIManager *mm, MIDIClocker &in)
void Unregister (MIDIClocker &in)
int GetMessageLength (unsigned char byte)
void HandleRawByte (unsigned char byte)

Protected Attributes

MIDIIntarget [8][16][128]
std::vector< MIDIIn * > mInputs
std::vector< MIDIOut * > mOutputs
std::string mName
unsigned char mLastStatus
int mIndex
int mLength
unsigned char mData [256]

Friends

class MIDIIn
class MIDIOut
class MIDIOutControl
class MIDIClocker
class MIDIManager

Detailed Description

This is the abstract base class for an midi device.

With an midi device we refer to any kind of midi input/output. MIDIDevices are usually created by the MIDIManager. The interface for the user however, are the MIDIIn and MIDIOut classes.

Each MIDIIn and MIDIOut created is registered with the MIDIManager. When the MIDIManager is started, it will create the appropiate MIDIDevice or MIDIDevices, based on the number of inputs, outputs, operating system and MIDIInConfig of the MIDIIn objects

See also:
MIDIIn, MIDIOut, MIDIDeviceList, MIDIManager

Definition at line 49 of file MIDIDevice.hxx.


Constructor & Destructor Documentation

CLAM::MIDIDevice::MIDIDevice ( const std::string &  name  )  [inline, protected]

Constructor of the class that sets the name of object to the string passed by parameter.

Parameters:
name String with the name of object

Definition at line 89 of file MIDIDevice.hxx.

References mIndex, mLastStatus, mLength, and mName.

virtual CLAM::MIDIDevice::~MIDIDevice (  )  [inline, protected, virtual]

Destructor of class.

Definition at line 99 of file MIDIDevice.hxx.


Member Function Documentation

virtual void CLAM::MIDIDevice::ConcreteStart ( void   )  throw (Err) [protected, pure virtual]

This function is executed to start the concrete use of the devices.

Each implementation of MIDIDevice must define this method.

Referenced by Start().

virtual void CLAM::MIDIDevice::ConcreteStop ( void   )  throw (Err) [protected, pure virtual]

This function is executed to stop the concrete use of the devices.

Each implementation of MIDIDevice must define this method.

Referenced by Stop().

void MIDIDevice::GetInfo ( MIDIDevice::TInfo info  )  [protected]

Getter for the Info of Device Object attached to this MIDIDevice instantiation.

Parameters:
info TInfo object that method will modify with the values of Tinfo internal object

Definition at line 123 of file MIDIDevice.cxx.

References mName, and CLAM::MIDIDevice::TInfo::mName.

int MIDIDevice::GetMessageLength ( unsigned char  byte  )  [protected]
void MIDIDevice::HandleRawByte ( unsigned char  byte  )  [protected]

Filter Active Sensing

First message byte

Status byte

Data byte

First or second data byte

We have just receive all the bytes of the message

Extracting information form the status byte

Message type

Number of channel

Note On with velocity 0

Mapping Note On status

byte to a Note Off status

byte with the same channel

Getting the correspondence

MIDIIn object to this message

Definition at line 222 of file MIDIDevice.cxx.

References CLAM::MIDI::eNoteOff, CLAM::MIDI::eNoteOn, GetMessageLength(), mData, mIndex, mLastStatus, mLength, and target.

virtual void CLAM::MIDIDevice::Read ( void   )  throw (Err) [protected, pure virtual]

Reads the information given by this Device and passes data to an Audio chunk.

Must be implemented by any Device derived from this class. Not implemented yet

bool MIDIDevice::Register ( MIDIManager mm,
MIDIClocker in 
) [protected]

Definition at line 60 of file MIDIDevice.cxx.

References CLAM::MIDIClocker::mpDevice.

bool MIDIDevice::Register ( MIDIManager mm,
MIDIOut out 
) [protected]

Definition at line 67 of file MIDIDevice.cxx.

References mOutputs, and CLAM::MIDIOut::mpDevice.

bool MIDIDevice::Register ( MIDIManager mm,
MIDIIn in 
) [protected]

Register a MIDIIn object as a new input of the device

Definition at line 50 of file MIDIDevice.cxx.

References mInputs, and CLAM::MIDIIn::mpDevice.

Referenced by CLAM::MIDIManager::Register().

virtual void CLAM::MIDIDevice::SetClock ( TControlData  val  )  [inline, protected, virtual]

Definition at line 118 of file MIDIDevice.hxx.

Referenced by CLAM::MIDIClocker::DoClock().

void MIDIDevice::Start ( void   )  [protected]

This method should be called to begin the use of this Device.

Initialating the target table

Definition at line 170 of file MIDIDevice.cxx.

References ConcreteStart(), mInputs, and target.

Referenced by CLAM::MIDIManager::Start().

void MIDIDevice::Stop ( void   )  [protected]

This method must be called to end the use of this Device.

Definition at line 202 of file MIDIDevice.cxx.

References ConcreteStop().

void MIDIDevice::Unregister ( MIDIClocker in  )  [protected]

Definition at line 105 of file MIDIDevice.cxx.

References CLAM::MIDIClocker::mpDevice.

void MIDIDevice::Unregister ( MIDIOut out  )  [protected]

Definition at line 111 of file MIDIDevice.cxx.

References mOutputs, and CLAM::MIDIOut::mpDevice.

void MIDIDevice::Unregister ( MIDIIn in  )  [protected]

Unregistering the MIDIIn object from the target table

Definition at line 75 of file MIDIDevice.cxx.

References mInputs, CLAM::MIDIIn::mpDevice, and target.

Referenced by CLAM::MIDIClocker::~MIDIClocker(), CLAM::MIDIIn::~MIDIIn(), and CLAM::MIDIOut::~MIDIOut().

virtual void CLAM::MIDIDevice::Write ( unsigned char *  msg,
int  size 
) throw (Err) [protected, pure virtual]

Friends And Related Function Documentation

friend class MIDIClocker [friend]

Definition at line 54 of file MIDIDevice.hxx.

friend class MIDIIn [friend]

Definition at line 51 of file MIDIDevice.hxx.

friend class MIDIManager [friend]

Definition at line 55 of file MIDIDevice.hxx.

friend class MIDIOut [friend]

Definition at line 52 of file MIDIDevice.hxx.

friend class MIDIOutControl [friend]

Definition at line 53 of file MIDIDevice.hxx.


Member Data Documentation

unsigned char CLAM::MIDIDevice::mData[256] [protected]

Definition at line 84 of file MIDIDevice.hxx.

Referenced by GetMessageLength(), and HandleRawByte().

Definition at line 82 of file MIDIDevice.hxx.

Referenced by HandleRawByte(), and MIDIDevice().

std::vector<MIDIIn*> CLAM::MIDIDevice::mInputs [protected]

Definition at line 76 of file MIDIDevice.hxx.

Referenced by Register(), CLAM::MIDIManager::Start(), Start(), and Unregister().

Definition at line 81 of file MIDIDevice.hxx.

Referenced by GetMessageLength(), HandleRawByte(), and MIDIDevice().

Definition at line 83 of file MIDIDevice.hxx.

Referenced by HandleRawByte(), and MIDIDevice().

std::string CLAM::MIDIDevice::mName [protected]

Definition at line 79 of file MIDIDevice.hxx.

Referenced by GetInfo(), and MIDIDevice().

std::vector<MIDIOut*> CLAM::MIDIDevice::mOutputs [protected]

Definition at line 77 of file MIDIDevice.hxx.

Referenced by Register(), CLAM::MIDIManager::Start(), and Unregister().

MIDIIn* CLAM::MIDIDevice::target[8][16][128] [protected]

Definition at line 74 of file MIDIDevice.hxx.

Referenced by HandleRawByte(), Start(), and Unregister().


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.3