This class takes care of all the creation of the registration of MIDIIn and MIDIOut objects, and the creation of MIDIDevice objects required. More...
#include <MIDIManager.hxx>
Public Types | |
typedef std::vector < MIDIDevice * > ::const_iterator | device_iterator |
typedef std::vector < MIDIDeviceList * > ::const_iterator | list_iterator |
Public Member Functions | |
MIDIManager () throw (Err) | |
Constructor of the class. | |
~MIDIManager () | |
Destructor of the class. | |
MIDIDevice * | FindDevice (const std::string &name) |
Find a created MIDIDevice, or NULL when not found. | |
MIDIDevice * | FindOrCreateDevice (const std::string &name) |
Find a created MIDIDevice, or create it when not found. | |
void | Start (void) throw (Err) |
This method starts the MIDIManager object. | |
void | Stop (void) throw (Err) |
This method stops the MIDIManager object. | |
void | Check (void) |
Checks all devices searching data to read. | |
MIDIDeviceList * | FindList (const std::string &arch="default") |
Retrieve the list of devices available for a given architecture. | |
list_iterator | lists_begin () const |
Global iterator interface for device lists. | |
list_iterator | lists_end () const |
Global iterator interface for device lists. | |
device_iterator | used_devices_begin () const |
Iterator interface for used midi devices. | |
device_iterator | used_devices_end () const |
Iterator interface for used midi devices. | |
Static Public Member Functions | |
static MIDIManager & | Current () |
Protected Member Functions | |
bool | Register (MIDIIn &in) |
Register an MIDIIn object. | |
bool | Register (MIDIClocker &cl) |
Register an MIDIClocker object. | |
bool | Register (MIDIOut &out) |
Register an MIDIOut object. | |
Protected Attributes | |
bool | mStarted |
Friends | |
class | MIDIIn |
class | MIDIClocker |
class | MIDIOut |
class | MIDIDeviceList |
This class takes care of all the creation of the registration of MIDIIn and MIDIOut objects, and the creation of MIDIDevice objects required.
It's a singleton class (only must be an instantiation of this class) because and unique object manages all the Devices, MIDIOut and MIDIIn objects provided by the system
Definition at line 45 of file MIDIManager.hxx.
typedef std::vector<MIDIDevice*>::const_iterator CLAM::MIDIManager::device_iterator |
Definition at line 75 of file MIDIManager.hxx.
typedef std::vector<MIDIDeviceList*>::const_iterator CLAM::MIDIManager::list_iterator |
Definition at line 76 of file MIDIManager.hxx.
CLAM::MIDIManager::MIDIManager | ( | ) | throw (Err) |
Constructor of the class.
Definition at line 35 of file MIDIManager.cxx.
CLAM::MIDIManager::~MIDIManager | ( | ) |
Destructor of the class.
Definition at line 41 of file MIDIManager.cxx.
void CLAM::MIDIManager::Check | ( | void | ) |
Checks all devices searching data to read.
Force all created devices to read data
Definition at line 117 of file MIDIManager.cxx.
References CLAM_DEBUG_ASSERT, and mStarted.
static MIDIManager& CLAM::MIDIManager::Current | ( | ) | [inline, static] |
Definition at line 84 of file MIDIManager.hxx.
Referenced by CLAM::MIDIOut::ConcreteConfigure(), CLAM::MIDIIn::ConcreteConfigure(), and CLAM::MIDIClocker::ConcreteConfigure().
MIDIDevice * CLAM::MIDIManager::FindDevice | ( | const std::string & | name | ) |
Find a created MIDIDevice, or NULL when not found.
name | The name of the MIDIDevice we want to get |
Definition at line 58 of file MIDIManager.cxx.
Referenced by FindOrCreateDevice().
MIDIDeviceList * CLAM::MIDIManager::FindList | ( | const std::string & | arch = "default" |
) |
Retrieve the list of devices available for a given architecture.
You can then use the AvailableDevices() method to retrieve a list of the available devices for each MIDIDeviceList.
arch | The name of architecture wich will be returned the devices. By default is set to "default" Valid values include 'portmidi' on all platforms or 'alsa' on Linux. |
Finding available devices for architecture arch
Definition at line 252 of file MIDIManager.cxx.
References DEFAULT_MIDI_ARCH.
Referenced by FindOrCreateDevice().
MIDIDevice * CLAM::MIDIManager::FindOrCreateDevice | ( | const std::string & | name | ) |
Find a created MIDIDevice, or create it when not found.
name | The name of the MIDIDevice we want to get |
Finding available devices for the architecture
Checking if the device is an avalaible device for the architecture
Verifing if the device is just created
Creating a new device
Definition at line 132 of file MIDIManager.cxx.
References CLAM::MIDIDeviceList::AvailableDevices(), CLAM::MIDIDeviceList::Create(), DEFAULT_MIDI_ARCH, CLAM::MIDIDeviceList::DefaultDevice(), FindDevice(), and FindList().
Referenced by Register().
list_iterator CLAM::MIDIManager::lists_begin | ( | ) | const [inline] |
Global iterator interface for device lists.
It can be used to obtain the device list for each existent architecture.
Definition at line 127 of file MIDIManager.hxx.
list_iterator CLAM::MIDIManager::lists_end | ( | ) | const [inline] |
Global iterator interface for device lists.
It can be used to obtain the device list for each existent architecture.
Definition at line 133 of file MIDIManager.hxx.
bool CLAM::MIDIManager::Register | ( | MIDIOut & | out | ) | [protected] |
Register an MIDIOut object.
This is done by the MIDIOut object itself
Definition at line 246 of file MIDIManager.cxx.
References FindOrCreateDevice(), CLAM::MIDIOut::mConfig, and CLAM::MIDIDevice::Register().
bool CLAM::MIDIManager::Register | ( | MIDIClocker & | cl | ) | [protected] |
Register an MIDIClocker object.
This is done by the MIDIClocker object itself
Getting the device for the MIDIIn object and registering the object as an input of the device
Definition at line 237 of file MIDIManager.cxx.
References FindOrCreateDevice(), CLAM::MIDIClocker::mConfig, and CLAM::MIDIDevice::Register().
bool CLAM::MIDIManager::Register | ( | MIDIIn & | in | ) | [protected] |
Register an MIDIIn object.
This is done by the MIDIIn object itself
Getting the device for the MIDIIn object and registering the object as an input of the device
Definition at line 228 of file MIDIManager.cxx.
References FindOrCreateDevice(), CLAM::MIDIIn::mConfig, and CLAM::MIDIDevice::Register().
Referenced by CLAM::MIDIOut::ConcreteConfigure(), CLAM::MIDIIn::ConcreteConfigure(), and CLAM::MIDIClocker::ConcreteConfigure().
void CLAM::MIDIManager::Start | ( | void | ) | throw (Err) |
This method starts the MIDIManager object.
Remove created but unused devices
Starting all the created devices
Definition at line 70 of file MIDIManager.cxx.
References CLAM::MIDIDevice::mInputs, CLAM::MIDIDevice::mOutputs, mStarted, and CLAM::MIDIDevice::Start().
void CLAM::MIDIManager::Stop | ( | void | ) | throw (Err) |
This method stops the MIDIManager object.
Stoping all the created devices
Definition at line 102 of file MIDIManager.cxx.
References mStarted.
device_iterator CLAM::MIDIManager::used_devices_begin | ( | ) | const [inline] |
Iterator interface for used midi devices.
It will iterate through the list of devices which have been registered.
Definition at line 139 of file MIDIManager.hxx.
device_iterator CLAM::MIDIManager::used_devices_end | ( | ) | const [inline] |
Iterator interface for used midi devices.
It will iterate through the list of devices which have been registered.
Definition at line 144 of file MIDIManager.hxx.
friend class MIDIClocker [friend] |
Definition at line 48 of file MIDIManager.hxx.
friend class MIDIDeviceList [friend] |
Definition at line 50 of file MIDIManager.hxx.
friend class MIDIIn [friend] |
Definition at line 47 of file MIDIManager.hxx.
friend class MIDIOut [friend] |
Definition at line 49 of file MIDIManager.hxx.
bool CLAM::MIDIManager::mStarted [protected] |
Definition at line 161 of file MIDIManager.hxx.