ardour
|
#include <SMFReader.hpp>
Classes | |
class | CorruptFile |
class | PrematureEOF |
class | UnsupportedTime |
Public Member Functions | |
SMFReader (const std::string &filename="") | |
~SMFReader () | |
bool | open (const std::string &filename) throw (std::logic_error, UnsupportedTime) |
bool | seek_to_track (unsigned track) throw (std::logic_error) |
const std::string & | filename () const |
uint16_t | type () const |
uint16_t | ppqn () const |
uint16_t | num_tracks () const |
int | read_event (size_t buf_len, uint8_t *buf, uint32_t *ev_size, uint32_t *ev_delta_time) throw (std::logic_error, PrematureEOF, CorruptFile) |
void | close () |
Static Public Member Functions | |
static uint32_t | read_var_len (FILE *fd) throw (PrematureEOF) |
Protected Attributes | |
std::string | _filename |
FILE * | _fd |
uint16_t | _type |
uint16_t | _ppqn |
uint16_t | _num_tracks |
uint32_t | _track |
uint32_t | _track_size |
Static Protected Attributes | |
static const uint32_t | HEADER_SIZE = 22 |
Standard MIDI File (Type 0) Reader
Currently this only reads SMF files with tempo-based timing.
Definition at line 36 of file SMFReader.hpp.
Evoral::SMFReader::SMFReader | ( | const std::string & | filename = "" | ) |
Definition at line 33 of file SMFReader.cpp.
Evoral::SMFReader::~SMFReader | ( | ) |
Definition at line 45 of file SMFReader.cpp.
void Evoral::SMFReader::close | ( | ) |
Definition at line 251 of file SMFReader.cpp.
|
inline |
Definition at line 55 of file SMFReader.hpp.
|
inline |
Definition at line 59 of file SMFReader.hpp.
bool Evoral::SMFReader::open | ( | const std::string & | filename | ) | |
throw | ( | std::logic_error, | |||
UnsupportedTime | |||||
) |
Definition at line 53 of file SMFReader.cpp.
|
inline |
Definition at line 58 of file SMFReader.hpp.
int Evoral::SMFReader::read_event | ( | size_t | buf_len, |
uint8_t * | buf, | ||
uint32_t * | ev_size, | ||
uint32_t * | delta_time | ||
) | |||
throw | ( | std::logic_error, | |
PrematureEOF, | |||
CorruptFile | |||
) |
Read an event from the current position in file.
File position MUST be at the beginning of a delta time, or this will die very messily. ev.buffer must be of size ev.size, and large enough for the event. The returned event will have it's time field set to it's delta time (so it's the caller's responsibility to keep track of delta time, even for ignored events).
Returns event length (including status byte) on success, 0 if event was skipped (eg a meta event), or -1 on EOF (or end of track).
If buf is not large enough to hold the event, 0 will be returned, but ev_size set to the actual size of the event.
Definition at line 166 of file SMFReader.cpp.
|
static |
Definition at line 261 of file SMFReader.cpp.
bool Evoral::SMFReader::seek_to_track | ( | unsigned | track | ) | |
throw | ( | std::logic_error | |||
) |
Seek to the start of a given track, starting from 1. Returns true if specified track was found.
Definition at line 108 of file SMFReader.cpp.
|
inline |
Definition at line 57 of file SMFReader.hpp.
|
protected |
Definition at line 76 of file SMFReader.hpp.
|
protected |
Definition at line 75 of file SMFReader.hpp.
|
protected |
Definition at line 79 of file SMFReader.hpp.
|
protected |
Definition at line 78 of file SMFReader.hpp.
|
protected |
Definition at line 80 of file SMFReader.hpp.
|
protected |
Definition at line 81 of file SMFReader.hpp.
|
protected |
Definition at line 77 of file SMFReader.hpp.
|
staticprotected |
size of SMF header, including MTrk chunk header
Definition at line 73 of file SMFReader.hpp.