Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Protected Member Functions | List of all members
om::sound::base::MIDIInputStream Class Referenceabstract

A class that represents a streaming input source for MIDI data. More...

#include <omSoundMIDIInputStream.h>

Inheritance diagram for om::sound::base::MIDIInputStream:
om::sound::base::MIDI om::sound::io::MIDIDecoder

Public Member Functions

virtual ~MIDIInputStream ()
 Destroy this MIDI input stream and release any resources associated with it. More...
 
Size read (MIDIBuffer &buffer, const Time &length)
 Read MIDI events into the buffer for the next time interval of the specified length. More...
 
virtual Bool canSeek () const
 Return whether or not seeking is allowed in this input stream. More...
 
virtual Bool canSeek (const Time &timeOffset) const
 Return whether or not this stream's current position can be moved by the specified time offset. More...
 
virtual Time seek (const Time &timeOffset)
 Move the current position in the stream by the specified signed time offset in seconds. More...
 
Bool hasTimeRemaining () const
 Return whether or not this MIDI input stream has any time remaining in the stream. More...
 
virtual Time getTimeRemaining () const =0
 Return the number of seconds remaining in the MIDI input stream. More...
 
virtual Time getTime () const =0
 Return the current position of the stream in seconds relative to the start of the stream. More...
 

Protected Member Functions

virtual Size readEvents (MIDIBuffer &buffer, const Time &length)=0
 Read MIDI events into the buffer for the next time interval of the specified length. More...
 

Detailed Description

A class that represents a streaming input source for MIDI data.

Constructor & Destructor Documentation

virtual om::sound::base::MIDIInputStream::~MIDIInputStream ( )
virtual

Destroy this MIDI input stream and release any resources associated with it.

Member Function Documentation

Size om::sound::base::MIDIInputStream::read ( MIDIBuffer buffer,
const Time length 
)
inline

Read MIDI events into the buffer for the next time interval of the specified length.

This method attempts to read the specified number of MIDI events from the stream into the buffer and then returns the total number of events that were successfully read. The stream's current position is incremented by the return value.

The timestamps of the returned MIDI events are specified relative to the start of the time interval.

virtual Bool om::sound::base::MIDIInputStream::canSeek ( ) const
virtual

Return whether or not seeking is allowed in this input stream.

The defaut implementation returns FALSE, disabling seeking. Override the function to allow seeking of input streams.

Reimplemented in om::sound::base::MIDI, and om::sound::io::MIDIDecoder.

virtual Bool om::sound::base::MIDIInputStream::canSeek ( const Time timeOffset) const
virtual

Return whether or not this stream's current position can be moved by the specified time offset.

The defaut implementation returns FALSE, disabling seeking. Override the function to allow seeking of input streams.

Reimplemented in om::sound::base::MIDI, and om::sound::io::MIDIDecoder.

virtual Time om::sound::base::MIDIInputStream::seek ( const Time timeOffset)
virtual

Move the current position in the stream by the specified signed time offset in seconds.

This method attempts to seek the position in the stream by the specified time in seconds. The method returns the signed amount that the position in the stream was changed by. Thus, if seeking is not allowed, 0 is returned. Otherwise, the stream should seek as far as possible in the specified direction and return the actual change in position.

The defaut implementation returns 0, disabling seeking. Override the function to allow seeking of input streams.

Reimplemented in om::sound::base::MIDI, and om::sound::io::MIDIDecoder.

Bool om::sound::base::MIDIInputStream::hasTimeRemaining ( ) const
inline

Return whether or not this MIDI input stream has any time remaining in the stream.

virtual Time om::sound::base::MIDIInputStream::getTimeRemaining ( ) const
pure virtual

Return the number of seconds remaining in the MIDI input stream.

The value returned must only be a lower bound on the total time left in the stream. events in the stream. This behavior is allowed in order to support never-ending streams which might not have a defined endpoint.

Implemented in om::sound::io::MIDIDecoder, and om::sound::base::MIDI.

virtual Time om::sound::base::MIDIInputStream::getTime ( ) const
pure virtual

Return the current position of the stream in seconds relative to the start of the stream.

The returned value indicates the time offset of the current read position within the MIDI stream. For unbounded streams, this indicates the number of samples that have been read by the stream since it was opened.

Implemented in om::sound::io::MIDIDecoder, and om::sound::base::MIDI.

virtual Size om::sound::base::MIDIInputStream::readEvents ( MIDIBuffer buffer,
const Time length 
)
protectedpure virtual

Read MIDI events into the buffer for the next time interval of the specified length.

This method attempts to read events for the specified time interval from the stream into the buffer and then returns the total number of events that were successfully read. The stream's current position is incremented by the return value.

The timestamps of the returned MIDI events are specified relative to the start of the time interval.

Implemented in om::sound::io::MIDIDecoder, and om::sound::base::MIDI.


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