Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | List of all members
om::sound::devices::MIDIDevice Class Reference

A class that represents a system MIDI device. More...

#include <omSoundMIDIDevice.h>

Public Member Functions

 MIDIDevice (const MIDIDeviceID &newDeviceID)
 Create a MIDIDevice for the specified MIDIDeviceID. More...
 
 MIDIDevice (const MIDIDevice &other)
 Create a copy of the specified MIDIDevice object. More...
 
 ~MIDIDevice ()
 Destroy a MIDIDevice object, stopping the input/output of any MIDI. More...
 
MIDIDeviceoperator= (const MIDIDevice &other)
 Assign the state from one MIDIDevice to this object. More...
 
Bool start ()
 Start sending/receiving MIDI events to/from the device. More...
 
void stop ()
 Stop sending/receiving MIDI events to/from the device. More...
 
Bool isRunning () const
 Return whether or not the device is currently sending/receiving MIDI. More...
 
Bool write (const MIDIEvent &event)
 Send the specified MIDI event to the output of this MIDI device. More...
 
Bool write (const MIDIBuffer &messageBuffer)
 Send the specified MIDI message buffer to the output of this MIDI device. More...
 
const UTF8String & getName () const
 Get a string representing the name of this device. More...
 
const UTF8String & getManufacturer () const
 Get a string representing the name of this device's manufacturer. More...
 
const MIDIDeviceDelegategetDelegate () const
 Return a reference to the delegate object that is responding to events for this device. More...
 
void setDelegate (const MIDIDeviceDelegate &newDelegate)
 Replace the delegate object that is responding to events for this device. More...
 
MIDIDeviceID getID () const
 Return an object that uniquely identifies this MIDI device. More...
 
Bool isValid () const
 Return whether or not this device represents a valid device. More...
 
Bool isInput () const
 Return whether or not this MIDI device is a valid input device. More...
 
Bool isOutput () const
 Return whether or not this MIDI device is a valid output device. More...
 

Detailed Description

A class that represents a system MIDI device.

The class allows the user to send and recieve MIDI events to/from MIDI hardware ports.

Constructor & Destructor Documentation

om::sound::devices::MIDIDevice::MIDIDevice ( const MIDIDeviceID newDeviceID)

Create a MIDIDevice for the specified MIDIDeviceID.

om::sound::devices::MIDIDevice::MIDIDevice ( const MIDIDevice other)

Create a copy of the specified MIDIDevice object.

om::sound::devices::MIDIDevice::~MIDIDevice ( )

Destroy a MIDIDevice object, stopping the input/output of any MIDI.

Member Function Documentation

MIDIDevice& om::sound::devices::MIDIDevice::operator= ( const MIDIDevice other)

Assign the state from one MIDIDevice to this object.

Bool om::sound::devices::MIDIDevice::start ( )

Start sending/receiving MIDI events to/from the device.

If the device is invalid or if an error occurs, FALSE is returned indicating that the method had no effect. If TRUE is returned, the device was started successfully

This method should be called before sending any messages to a MIDI output device.

void om::sound::devices::MIDIDevice::stop ( )

Stop sending/receiving MIDI events to/from the device.

If the device is currently receiving MIDI, the input of further MIDI events is stopped. Otherwise, the method has no effect. If the device is invalid, this method has no effect.

This method has the effect of stopping the MIDI thread that was started in the start() method.

Bool om::sound::devices::MIDIDevice::isRunning ( ) const

Return whether or not the device is currently sending/receiving MIDI.

If MIDI is currently being received and sent to the device, TRUE is returned. Otherwise, FALSE is returned. If the device is invalid, FALSE is always returned.

Returns
whether or not the device IO is currently running.
Bool om::sound::devices::MIDIDevice::write ( const MIDIEvent event)

Send the specified MIDI event to the output of this MIDI device.

If the method fails or if the device is not an output, FALSE is returned. Otherwise, the method succeeds and TRUE is returned.

Bool om::sound::devices::MIDIDevice::write ( const MIDIBuffer messageBuffer)

Send the specified MIDI message buffer to the output of this MIDI device.

If the method fails or if the device is not an output, FALSE is returned. Otherwise, the method succeeds and TRUE is returned.

const UTF8String& om::sound::devices::MIDIDevice::getName ( ) const
inline

Get a string representing the name of this device.

This name is usually specified by the hardware driver as a human-readable identifier for the device. If the device is not valid, the empty string is returned.

Returns
the name of this device.
const UTF8String& om::sound::devices::MIDIDevice::getManufacturer ( ) const
inline

Get a string representing the name of this device's manufacturer.

This name is usually specified by the hardware driver as a human-readable identifier for the device's manufacturer. If the device is not valid, the empty string is returned.

Returns
the name of this device's manufacturer.
const MIDIDeviceDelegate& om::sound::devices::MIDIDevice::getDelegate ( ) const
inline

Return a reference to the delegate object that is responding to events for this device.

void om::sound::devices::MIDIDevice::setDelegate ( const MIDIDeviceDelegate newDelegate)

Replace the delegate object that is responding to events for this device.

MIDIDeviceID om::sound::devices::MIDIDevice::getID ( ) const
inline

Return an object that uniquely identifies this MIDI device.

If the device is not valid, MIDIDeviceID::INVALID_DEVICE is returned.

Bool om::sound::devices::MIDIDevice::isValid ( ) const
inline

Return whether or not this device represents a valid device.

If a MIDIDevice is created with a MIDIDeviceID that does not represent a valid system audio device or if a device is removed after it is created, the MIDIDevice is marked as invalid and this method will return FALSE. Otherwise, if the device is valid, the method returns TRUE.

If a device is invalid, the output callback method will not be called anymore and the application should switch to a different device. The application should periodically check the return value of this function to see if the device has been removed.

Bool om::sound::devices::MIDIDevice::isInput ( ) const
inline

Return whether or not this MIDI device is a valid input device.

If the device is not valid, FALSE is returned. Otherwise, if the MIDI device is an input device, TRUE is returned.

Bool om::sound::devices::MIDIDevice::isOutput ( ) const
inline

Return whether or not this MIDI device is a valid output device.

If the device is not valid, FALSE is returned. Otherwise, if the MIDI device is an output device, TRUE is returned.


The documentation for this class was generated from the following file: