class MidiFileImport

MIDI file importer. More...

Full nameTSE3::MidiFileImport
Definition#include <MidiFile.h>
InheritsTSE3::Notifier [public ], TSE3::Playable [public ]
List of all Methods
Annotated List

Public Methods

Public Members

Detailed Description

Utility to import a MIDI file and convert it into a TSE3 Song.

There are two ways to play a standard MIDI file. One is to create a MidiFileImport object, use it to generate a Song and then play that. You will also be able to edit the Song and save it again.

The second way to play a MIDI file it to use the MidiFileImport class' Playable interface - this will generate a MidiFileImportIterator object. The advantage of this is that you do not have to delay for the import process (which for large MIDI files can be significant). On the other hand, the data will not be editable or modifiable.

If you only need to play the MIDI file, use the second method. If you need to modify the MIDI file data you need to use the load method to generate a Song.

See also: Song, MidiFileExport

 MidiFileImport (const std::string &filename, int verbose = 0, std::ostream &out = std::cout)


Creates a MidiFileImport object for the given MIDI file.

If the file fails to open, then a MidiFileImportError exception is thrown.

filenameFilename of MIDI file to import.
verboseLevel of diagnostic output to produce 0: none, 1: basic reporting at chunk level 2: Include meta information 3: list all MIDI commands
outostream to produce output on.

Throws: MidiFileImportError

 ~MidiFileImport ()


Song * load (Progress *progress = 0)


Performs the MIDI file import, and returns a pointer to a Song object holding the imported MIDI data.

This Song object has been newed by the MidiFileImport object; it is your responsability to delete it.

progressObject to call back to, or zero for no progress information

Returns: New imported Song - you must delete it

Throws: MidiFileImportError

PlayableIterator * iterator (Clock index)



Reimplemented from Playable for internal purposes..

Clock  lastClock ()


[const virtual]

Calling this is likely to take longer than for most other Playable objects since the entire MIDI file has to be scanned to determine the last clock time. This delay will probably not be noticeable for any but the largest MIDI files.

After you have done this once the result is cached for faster subsequent access.

Reimplemented from Playable for internal purposes..

friend class MidiFileImportIterator