ardour
|
#include <OldSMF.hpp>
Classes | |
class | FileError |
Public Member Functions | |
SMF () | |
virtual | ~SMF () |
void | seek_to_start () const |
uint16_t | ppqn () const |
bool | is_empty () const |
bool | eof () const |
Time | last_event_time () const |
void | begin_write () |
void | append_event_delta (uint32_t delta_t, const Event< Time > &ev) |
void | end_write () THROW_FILE_ERROR |
void | flush () |
int | flush_header () |
int | flush_footer () |
SMF () | |
virtual | ~SMF () |
int | open (const std::string &path, int track=1) THROW_FILE_ERROR |
int | create (const std::string &path, int track=1, uint16_t ppqn=19200) THROW_FILE_ERROR |
void | close () THROW_FILE_ERROR |
void | seek_to_start () const |
int | seek_to_track (int track) |
int | read_event (uint32_t *delta_t, uint32_t *size, uint8_t **buf, event_id_t *note_id) const |
uint16_t | num_tracks () const |
uint16_t | ppqn () const |
bool | is_empty () const |
void | begin_write () |
void | append_event_delta (uint32_t delta_t, uint32_t size, const uint8_t *buf, event_id_t note_id) |
void | end_write (std::string const &) THROW_FILE_ERROR |
void | flush () |
double | round_to_file_precision (double val) const |
Static Public Member Functions | |
static bool | test (const std::string &path) |
Protected Member Functions | |
int | open (const std::string &path) THROW_FILE_ERROR |
void | close () THROW_FILE_ERROR |
int | read_event (uint32_t *delta_t, uint32_t *size, uint8_t **buf) const |
Private Member Functions | |
void | seek_to_footer_position () |
void | write_footer () |
void | write_chunk_header (const char id[4], uint32_t length) |
void | write_chunk (const char id[4], uint32_t length, void *data) |
size_t | write_var_len (uint32_t val) |
uint32_t | read_var_len () const |
Private Attributes | |
FILE * | _fd |
Time | _last_ev_time |
last frame time written, relative to source start More... | |
uint32_t | _track_size |
uint32_t | _header_size |
size of SMF header, including MTrk chunk header More... | |
bool | _empty |
true iff file contains(non-empty) events More... | |
smf_t * | _smf |
smf_track_t * | _smf_track |
Glib::Threads::Mutex | _smf_lock |
Static Private Attributes | |
static const uint16_t | _ppqn = 19200 |
Standard Midi File (Type 0)
Standard Midi File. Currently only tempo-based time of a given PPQN is supported.
Definition at line 31 of file OldSMF.hpp.
Evoral::SMF< Time >::SMF | ( | ) |
Definition at line 36 of file OldSMF.cpp.
|
virtual |
Definition at line 46 of file OldSMF.cpp.
|
inline |
|
virtual |
void Evoral::SMF< Time >::append_event_delta | ( | uint32_t | delta_t, |
const Event< Time > & | ev | ||
) |
Definition at line 284 of file OldSMF.cpp.
void Evoral::SMF< Time >::append_event_delta | ( | uint32_t | delta_t, |
uint32_t | size, | ||
const uint8_t * | buf, | ||
event_id_t | note_id | ||
) |
void Evoral::SMF< Time >::begin_write | ( | ) |
Definition at line 307 of file OldSMF.cpp.
void Evoral::SMF< Time >::begin_write | ( | ) |
|
protected |
Definition at line 96 of file OldSMF.cpp.
void Evoral::SMF< Time >::close | ( | ) |
int Evoral::SMF< Time >::create | ( | const std::string & | path, |
int | track = 1 , |
||
uint16_t | ppqn = 19200 |
||
) |
void Evoral::SMF< Time >::end_write | ( | ) |
Definition at line 315 of file OldSMF.cpp.
void Evoral::SMF< Time >::end_write | ( | std::string const & | ) |
|
inline |
Definition at line 40 of file OldSMF.hpp.
void Evoral::SMF< Time >::flush | ( | ) |
Definition at line 138 of file OldSMF.cpp.
|
inline |
int Evoral::SMF< Time >::flush_footer | ( | ) |
Definition at line 175 of file OldSMF.cpp.
int Evoral::SMF< Time >::flush_header | ( | ) |
Definition at line 145 of file OldSMF.cpp.
|
inline |
Definition at line 39 of file OldSMF.hpp.
|
inline |
|
inline |
Definition at line 42 of file OldSMF.hpp.
uint16_t Evoral::SMF< Time >::num_tracks | ( | ) | const |
|
protected |
Attempt to open the SMF file for reading and writing.
Currently SMF is always read/write.
Definition at line 60 of file OldSMF.cpp.
int Evoral::SMF< Time >::open | ( | const std::string & | path, |
int | track = 1 |
||
) |
|
inline |
Definition at line 38 of file OldSMF.hpp.
uint16_t Evoral::SMF< Time >::ppqn | ( | ) | const |
|
protected |
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, in SMF tempo-based ticks, using the rate given by ppqn() (it is the caller's responsibility to calculate a real time).
size should be the capacity of buf. If it is not large enough, buf will be freed and a new buffer allocated in its place, the size of which will be placed in size.
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).
Definition at line 212 of file OldSMF.cpp.
int Evoral::SMF< Time >::read_event | ( | uint32_t * | delta_t, |
uint32_t * | size, | ||
uint8_t ** | buf, | ||
event_id_t * | note_id | ||
) | const |
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, in SMF tempo-based ticks, using the rate given by ppqn() (it is the caller's responsibility to calculate a real time).
buf must be a pointer to a buffer allocated with malloc, or a pointer to NULL. size must be the capacity of buf. If it is not large enough, buf will be reallocated and *size will be set to the new size of buf.
if the event is a meta-event and is an Evoral Note ID, then note_id will be set to the value of the NoteID; otherwise, meta-events will set note_id to -1.
|
private |
double Evoral::SMF< Time >::round_to_file_precision | ( | double | val | ) | const |
|
private |
Used by flush_footer() to find the position to write the footer
Definition at line 115 of file OldSMF.cpp.
void Evoral::SMF< Time >::seek_to_start | ( | ) | const |
Definition at line 108 of file OldSMF.cpp.
void Evoral::SMF< Time >::seek_to_start | ( | ) | const |
int Evoral::SMF< Time >::seek_to_track | ( | int | track | ) |
|
static |
|
private |
Definition at line 333 of file OldSMF.cpp.
|
private |
Definition at line 323 of file OldSMF.cpp.
|
private |
Write the track footer at the current seek position
Definition at line 187 of file OldSMF.cpp.
|
private |
Returns the size (in bytes) of the value written.
Definition at line 343 of file OldSMF.cpp.
|
private |
true iff file contains(non-empty) events
Definition at line 76 of file OldSMF.hpp.
|
private |
Definition at line 72 of file OldSMF.hpp.
|
private |
size of SMF header, including MTrk chunk header
Definition at line 75 of file OldSMF.hpp.
|
private |
last frame time written, relative to source start
Definition at line 73 of file OldSMF.hpp.
|
staticprivate |
Definition at line 70 of file OldSMF.hpp.
|
private |
|
mutableprivate |
|
private |
|
private |
Definition at line 74 of file OldSMF.hpp.