18 #ifndef RAUL_SMF_READER_HPP 19 #define RAUL_SMF_READER_HPP 24 #include "raul/TimeStamp.hpp" 36 class PrematureEOF :
public std::exception {
37 const char* what()
const throw() {
return "Unexpected end of file"; }
39 class CorruptFile :
public std::exception {
40 const char* what()
const throw() {
return "Corrupted file"; }
42 class UnsupportedTime :
public std::exception {
43 const char* what()
const throw() {
return "Unsupported time stamp type (SMPTE)"; }
46 explicit SMFReader(
const std::string filename=
"");
49 bool open(
const std::string& filename)
throw (std::logic_error, UnsupportedTime);
53 uint16_t type()
const {
return _type; }
54 uint16_t ppqn()
const {
return _ppqn; }
55 size_t num_tracks() {
return _num_tracks; }
60 uint32_t* ev_delta_time)
61 throw (std::logic_error, PrematureEOF, CorruptFile);
65 static uint32_t read_var_len(FILE* fd)
throw (PrematureEOF);
71 std::string _filename;
83 #endif // RAUL_SMF_READER_HPP bool seek_to_track(unsigned track)
Seek to the start of a given track, starting from 1.
Definition: SMFReader.cpp:151
int read_event(size_t buf_len, uint8_t *buf, uint32_t *ev_size, uint32_t *ev_delta_time)
Read an event from the current position in file.
Definition: SMFReader.cpp:209
Standard Midi File (Type 0) Reader.
Definition: SMFReader.hpp:34
static const uint32_t HEADER_SIZE
size of SMF header, including MTrk chunk header
Definition: SMFReader.hpp:69