22 #ifndef EVORAL_SMF_HPP
23 #define EVORAL_SMF_HPP
25 #include <glibmm/threads.h>
63 FileError (std::string
const & n) : _file_name (n) {}
65 const char*
what()
const throw() {
return "Unknown SMF error"; }
66 std::string
file_name ()
const {
return _file_name; }
76 static bool test(
const std::string& path);
77 int open (
const std::string& path,
int track = 1,
bool scan =
true);
79 int create(
const std::string& path,
int track=1, uint16_t ppqn=19200);
127 , microseconds_per_quarter_note (-1)
130 , clocks_per_click (-1)
131 , notes_per_note (-1) {}
135 return 60.0 * (1000000.0 / (double) microseconds_per_quarter_note);
145 MarkerAt (std::string
const & txt,
size_t tp) : text (txt), time_pulses (tp) {}
152 std::shared_ptr<Temporal::TempoMap>
tempo_map (
bool& provided)
const;
smf_tempo_struct smf_tempo_t
smf_track_struct smf_track_t
std::string file_name() const
FileError(std::string const &n)
const char * what() const
uint64_t n_note_on_events() const
void end_write(std::string const &)
uint16_t num_tracks() const
void append_event_delta(uint32_t delta_t, uint32_t size, const uint8_t *buf, event_id_t note_id)
double round_to_file_precision(double val) const
std::bitset< 16 > UsedChannels
Glib::Threads::Mutex _smf_lock
void instrument_names(std::vector< std::string > &) const
UsedChannels const & used_channels() const
int read_event(uint32_t *delta_t, uint32_t *size, uint8_t **buf, event_id_t *note_id) const
void set_used_channels(UsedChannels used)
void set_length(Temporal::Beats const &)
void track_names(std::vector< std::string > &) const
UsedChannels _used_channels
bool _empty
true iff file contains(non-empty) events
std::shared_ptr< Temporal::TempoMap > tempo_map(bool &provided) const
static bool test(const std::string &path)
int seek_to_track(int track)
uint64_t _n_note_on_events
void seek_to_start() const
Markers const & markers() const
int create(const std::string &path, int track=1, uint16_t ppqn=19200)
Temporal::Beats file_duration() const
std::vector< MarkerAt > Markers
bool has_pgm_change() const
Tempo * nth_tempo(size_t n) const
virtual Temporal::Beats duration() const
int open(const std::string &path, int track=1, bool scan=true)
MarkerAt(std::string const &txt, size_t tp)
int microseconds_per_quarter_note
static Temporal::Beats max()