20 #ifndef EVORAL_SMF_HPP
21 #define EVORAL_SMF_HPP
23 #include <glibmm/threads.h>
35 #define THROW_FILE_ERROR throw(FileError)
44 FileError (std::string
const & n) : _file_name (n) {}
46 const char*
what()
const throw() {
return "Unknown SMF error"; }
47 std::string
file_name ()
const {
return _file_name; }
52 SMF() : _smf(0), _smf_track(0), _empty(true) {};
55 static bool test(
const std::string& path);
59 void close() THROW_FILE_ERROR;
61 void seek_to_start() const;
62 int seek_to_track(
int track);
64 int read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf,
event_id_t* note_id) const;
66 uint16_t num_tracks() const;
67 uint16_t ppqn() const;
68 bool is_empty()
const {
return _empty; }
71 void append_event_delta(uint32_t delta_t, uint32_t size,
const uint8_t* buf,
event_id_t note_id);
76 double round_to_file_precision (
double val)
const;
FileError(std::string const &n)
Glib::Threads::Mutex _smf_lock
std::string file_name() const
smf_track_struct smf_track_t
const char * what() const