#include <MIDIDevice.hxx>
Inherited by CLAM::ALSAMIDIDevice, CLAM::FileMIDIDevice, CLAM::PortMIDIDevice, and CLAM::TextFileMIDIDevice.
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
Definition at line 50 of file MIDIDevice.hxx.
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 | |
MIDIIn * | target [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 |
Classes | |
struct | TInfo |
This class is used to respond to device information request using the GetInfo method. More... |
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.
name | String with the name of object |
Definition at line 90 of file MIDIDevice.hxx.
References mIndex, mLastStatus, mLength, and mName.
virtual CLAM::MIDIDevice::~MIDIDevice | ( | ) | [inline, protected, virtual] |
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::MIDIOut::ConcreteStart(), CLAM::MIDIIn::ConcreteStart(), CLAM::MIDIClocker::ConcreteStart(), and 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().
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.
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.
Referenced by CLAM::MIDIOut::GetDeviceInfo(), CLAM::MIDIIn::GetDeviceInfo(), and CLAM::MIDIClocker::GetDeviceInfo().
virtual void CLAM::MIDIDevice::SetClock | ( | TControlData | val | ) | [inline, protected, virtual] |
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
virtual void CLAM::MIDIDevice::Write | ( | unsigned char * | msg, | |
int | size | |||
) | throw (Err) [protected, pure virtual] |
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().
bool MIDIDevice::Register | ( | MIDIManager * | mm, | |
MIDIOut & | out | |||
) | [protected] |
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().
void MIDIDevice::Unregister | ( | MIDIOut & | out | ) | [protected] |
bool MIDIDevice::Register | ( | MIDIManager * | mm, | |
MIDIClocker & | in | |||
) | [protected] |
void MIDIDevice::Unregister | ( | MIDIClocker & | in | ) | [protected] |
Definition at line 207 of file MIDIDevice.cxx.
References CLAM::MIDI::eSystem, CLAM::MIDI::GetMessageInfo(), mData, mLastStatus, CLAM::MIDI::StatusByteToMessage(), and CLAM::MIDI::StatusByteToSysMsg().
Referenced by HandleRawByte().
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
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(), CLAM::MIDIIn::Handle(), mData, mIndex, mLastStatus, mLength, and target.
friend class MIDIIn [friend] |
Definition at line 52 of file MIDIDevice.hxx.
friend class MIDIOut [friend] |
Definition at line 53 of file MIDIDevice.hxx.
friend class MIDIOutControl [friend] |
Definition at line 54 of file MIDIDevice.hxx.
friend class MIDIClocker [friend] |
Definition at line 55 of file MIDIDevice.hxx.
friend class MIDIManager [friend] |
Definition at line 56 of file MIDIDevice.hxx.
MIDIIn* CLAM::MIDIDevice::target[8][16][128] [protected] |
Definition at line 75 of file MIDIDevice.hxx.
Referenced by HandleRawByte(), Start(), and Unregister().
std::vector<MIDIIn*> CLAM::MIDIDevice::mInputs [protected] |
Definition at line 77 of file MIDIDevice.hxx.
Referenced by Register(), CLAM::MIDIManager::Start(), Start(), and Unregister().
std::vector<MIDIOut*> CLAM::MIDIDevice::mOutputs [protected] |
Definition at line 78 of file MIDIDevice.hxx.
Referenced by Register(), CLAM::MIDIManager::Start(), and Unregister().
std::string CLAM::MIDIDevice::mName [protected] |
unsigned char CLAM::MIDIDevice::mLastStatus [protected] |
Definition at line 82 of file MIDIDevice.hxx.
Referenced by GetMessageLength(), HandleRawByte(), and MIDIDevice().
int CLAM::MIDIDevice::mIndex [protected] |
int CLAM::MIDIDevice::mLength [protected] |
unsigned char CLAM::MIDIDevice::mData[256] [protected] |
Definition at line 85 of file MIDIDevice.hxx.
Referenced by GetMessageLength(), and HandleRawByte().