mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
midifile: put some parsed data in the event
Put some of the data we parsed into the event.
This commit is contained in:
parent
5498483337
commit
3b1fc4acce
2 changed files with 13 additions and 1 deletions
|
|
@ -364,6 +364,9 @@ int midi_file_read_event(struct midi_file *mf, struct midi_event *event)
|
|||
if ((res = parse_varlen(mf, tr, &size)) < 0)
|
||||
return res;
|
||||
|
||||
event->meta.offset = tr->p - event->data;
|
||||
event->meta.size = size;
|
||||
|
||||
switch (meta) {
|
||||
case 0x2f:
|
||||
tr->eof = true;
|
||||
|
|
@ -373,7 +376,7 @@ int midi_file_read_event(struct midi_file *mf, struct midi_event *event)
|
|||
return -EINVAL;
|
||||
mf->tick_sec = event->sec;
|
||||
mf->tick_start = tr->tick;
|
||||
mf->tempo = (tr->p[0]<<16) | (tr->p[1]<<8) | tr->p[2];
|
||||
event->meta.parsed.tempo.uspqn = mf->tempo = (tr->p[0]<<16) | (tr->p[1]<<8) | tr->p[2];
|
||||
break;
|
||||
}
|
||||
size += tr->p - event->data;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,15 @@ struct midi_event {
|
|||
double sec;
|
||||
uint8_t *data;
|
||||
uint32_t size;
|
||||
struct {
|
||||
uint32_t offset;
|
||||
uint32_t size;
|
||||
union {
|
||||
struct {
|
||||
uint32_t uspqn; /* microseconds per quarter note */
|
||||
} tempo;
|
||||
} parsed;
|
||||
} meta;
|
||||
};
|
||||
|
||||
struct midi_file_info {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue