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

A class that decodes MIDI file data into a stream of MIDI events. More...

#include <omSoundMIDIDecoder.h>

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

Public Member Functions

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...
 
virtual Time getTimeRemaining () const
 Return the number of seconds remaining in the MIDI input stream. More...
 
virtual Time getTime () const
 Return the current position of the stream in seconds relative to the start of the stream. More...
 
- Public Member Functions inherited from om::sound::base::MIDIInputStream
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...
 
Bool hasTimeRemaining () const
 Return whether or not this MIDI input stream has any time remaining in the stream. More...
 

Protected Member Functions

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

Detailed Description

A class that decodes MIDI file data into a stream of MIDI events.

Member Function Documentation

virtual Bool om::sound::io::MIDIDecoder::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 from om::sound::base::MIDIInputStream.

virtual Bool om::sound::io::MIDIDecoder::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 from om::sound::base::MIDIInputStream.

virtual Time om::sound::io::MIDIDecoder::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 from om::sound::base::MIDIInputStream.

virtual Time om::sound::io::MIDIDecoder::getTimeRemaining ( ) const
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.

Implements om::sound::base::MIDIInputStream.

virtual Time om::sound::io::MIDIDecoder::getTime ( ) const
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.

Implements om::sound::base::MIDIInputStream.

virtual Size om::sound::io::MIDIDecoder::readEvents ( MIDIBuffer buffer,
const Time length 
)
protectedvirtual

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.

Implements om::sound::base::MIDIInputStream.


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