Inheritance diagram for MIDI_IO:
Public Types | |
Public type definitions and constants | |
enum | Io_mode { io_read = 1, io_write = 2, io_readwrite = 4 } |
Input/Output mode. More... | |
Public Member Functions | |
Constructors and destructors | |
virtual MIDI_IO * | clone (void) const =0 |
Virtual method that clones the current object and returns a pointer to it. | |
virtual MIDI_IO * | new_expr (void) const =0 |
Virtual method that creates a new object of current type. | |
MIDI_IO (const std::string &name="unknown", int mode=io_read) | |
Attribute functions | |
virtual int | supported_io_modes (void) const |
Returns info about supported I/O modes (bitwise-OR). | |
virtual bool | supports_nonblocking_mode (void) const |
Whether device supports non-blocking I/O mode. | |
Configuration | |
For setting and getting configuration parameters. | |
int | io_mode (void) const |
Returns info about the current I/O mode. | |
const std::string & | label (void) const |
Returns the current label. | |
void | io_mode (int mode) |
Set object input/output-mode. | |
void | label (const std::string &id_label) |
Sets object label. | |
void | toggle_nonblocking_mode (bool value) |
Enable/disbale nonblocking mode. | |
virtual std::string | parameter_names (void) const |
A comma-separated list of parameters names. | |
virtual void | set_parameter (int param, std::string value) |
Sets the parameter value. | |
virtual std::string | get_parameter (int param) const |
Get parameter value. | |
Main functionality | |
virtual long int | read_bytes (void *target_buffer, long int bytes)=0 |
Low-level routine for reading MIDI bytes. | |
virtual long int | write_bytes (void *target_buffer, long int bytes)=0 |
Low-level routine for writing MIDI bytes. | |
virtual void | open (void)=0 |
Opens the MIDI object (possibly in exclusive mode). | |
virtual void | close (void)=0 |
Closes the MIDI object. | |
Runtime information | |
virtual int | poll_descriptor (void) const |
Returns a file descriptor id suitable for poll() and select() system calls. | |
bool | is_open (void) const |
Has device been opened (with open())? | |
virtual bool | finished (void) const =0 |
Whether all data has been processed? If opened in mode 'io_read', this means that end of stream has been reached. | |
virtual bool | nonblocking_mode (void) const |
Is nonblocking mode is enabled? | |
virtual bool | readable (void) const |
Is the MIDI object ready for reading? | |
virtual bool | writable (void) const |
Is the MIDI object ready for writing? | |
Protected Member Functions | |
void | toggle_open_state (bool value) |
Sets device's state to enabled or disabled. |
|
Input/Output mode.
Object is opened for input. If opening a file, it must exist. io_write Object is opened for output. If opening a file and and output exists, it is first truncated. io_readwrite Object is opened for both reading and writing. If opening a file, a new file is created if needed. When switching from read to write or vica versa, position should be reset before using the device. |
|
Virtual method that clones the current object and returns a pointer to it. This must be implemented by all subclasses! Implements DYNAMIC_OBJECT< std::string >. Implemented in MIDI_IO_RAW. |
|
Closes the MIDI object. After calling this routine, all resources (ie. soundcard) must be freed (they can be used by other processes). ensure: readable() != true writable() != true Implemented in MIDI_IO_RAW. |
|
Whether all data has been processed? If opened in mode 'io_read', this means that end of stream has been reached. If opened in 'io_write' or 'io_readwrite' modes, finished status usually means that an error has occured (no space left, etc). After finished() has returned 'true', further calls to read() and/or write() won't process any data. Implemented in MIDI_IO_RAW. |
|
Get parameter value.
Implements DYNAMIC_PARAMETERS< std::string >. Reimplemented in MIDI_IO_RAW. |
|
Set object input/output-mode. If the requested mode isn't supported, the nearest supported mode is used. Because of this, it's wise to afterwards check whether the requested mode was accepted. require: is_open() != true |
|
Sets object label. Label is used to identify the object instance. Unlike ECA_OBJECT::name(), label() is not necessarily unique among different class instances. Device and file names are typical label values. require: is_open() != true |
|
Returns the current label. See documentation for label(const std::string&). |
|
Virtual method that creates a new object of current type. This must be implemented by all subclasses! Implements DYNAMIC_OBJECT< std::string >. Implemented in MIDI_IO_RAW. |
|
Opens the MIDI object (possibly in exclusive mode). This routine is meant for opening files and devices, loading libraries, etc. ensure: readable() == true || writable() == true Implemented in MIDI_IO_RAW. |
|
A comma-separated list of parameters names. Derived classes must implement this. Implements DYNAMIC_PARAMETERS< std::string >. Reimplemented in MIDI_IO_RAW. |
|
Returns a file descriptor id suitable for poll() and select() system calls. If polling is not supported, returns value of '-1'. Reimplemented in MIDI_IO_RAW. |
|
Low-level routine for reading MIDI bytes. Number of read bytes is returned. This must be implemented by all subclasses. Implemented in MIDI_IO_RAW. |
|
Sets the parameter value. Implementations should be able to handle arbitrary values of 'value'. Argument validity can be tested by a combination of set_parameter() and get_parameter() calls. Parameter value is valid, if get_parameter() returns it without changes.
Implements DYNAMIC_PARAMETERS< std::string >. Reimplemented in MIDI_IO_RAW. |
|
Returns info about supported I/O modes (bitwise-OR). By default, all I/O modes are supported. Reimplemented in MIDI_IO_RAW. |
|
Whether device supports non-blocking I/O mode. By default, nonblocking mode is not supported. Reimplemented in MIDI_IO_RAW. |
|
Enable/disbale nonblocking mode. require: is_open() != true |
|
Low-level routine for writing MIDI bytes. Number of bytes written is returned. This must be implemented by all subclasses. Implemented in MIDI_IO_RAW. |