mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 23:05:04 +01:00
add Evoral::SMF::is_meta() to test for SMF meta events
These are not legal in "live" MIDI but are allowed in SMF files.
This commit is contained in:
parent
e703cf2d73
commit
785047bf47
2 changed files with 31 additions and 0 deletions
|
|
@ -413,6 +413,35 @@ SMF::read_event(uint32_t* delta_t, uint32_t* bufsize, uint8_t** buf, event_id_t*
|
|||
|
||||
void
|
||||
SMF::append_event_delta(uint32_t delta_t, uint32_t size, const uint8_t* buf, event_id_t note_id)
|
||||
bool
|
||||
SMF::is_meta (uint8_t const* buf, uint32_t size)
|
||||
{
|
||||
if (buf[0] == 0xff) {
|
||||
switch (buf[1]) {
|
||||
case 0x00: /* seq num */
|
||||
case 0x01: /* text */
|
||||
case 0x02: /* copyright */
|
||||
case 0x03: /* track name */
|
||||
case 0x04: /* instrument name */
|
||||
case 0x05: /* lyric */
|
||||
case 0x06: /* marker */
|
||||
case 0x07: /* cue point */
|
||||
case 0x20: /* channel prefix */
|
||||
case 0x2f: /* end of track */
|
||||
case 0x51: /* set tempo */
|
||||
case 0x54: /* smpte offset */
|
||||
case 0x58: /* time signature */
|
||||
case 0x59: /* key signaturey */
|
||||
case 0x7f: /* seq-specific */
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
Glib::Threads::Mutex::Lock lm (_smf_lock);
|
||||
|
||||
|
|
|
|||
|
|
@ -88,6 +88,8 @@ public:
|
|||
uint16_t ppqn() const;
|
||||
bool is_empty() const { return _empty; }
|
||||
|
||||
static bool is_meta (uint8_t const * buf, uint32_t size);
|
||||
|
||||
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 &);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue