Skip to content

Commit

Permalink
added enum _event_type:ev_null (for bug #192)
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed May 15, 2018
1 parent 2abc1bd commit 34508c2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions include/internal_midi.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct _note {
struct _mdi;

enum _event_type {
ev_null = -1,
ev_midi_divisions,
ev_note_off,
ev_note_on,
Expand Down
4 changes: 2 additions & 2 deletions src/f_midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ _WM_Event2Midi(struct _mdi *mdi, uint8_t **out, uint32_t *outsize) {
(*out)[track_start - 2] = (track_size >> 8) & 0xff;
(*out)[track_start - 1] = track_size & 0xff;

if (event[1].do_event != NULL) {
if (event[1].evtype != ev_null) {
(*out)[out_ofs++] = 'M';
(*out)[out_ofs++] = 'T';
(*out)[out_ofs++] = 'r';
Expand Down Expand Up @@ -967,7 +967,7 @@ _WM_Event2Midi(struct _mdi *mdi, uint8_t **out, uint32_t *outsize) {
(*out)[out_ofs++] = (value & 0x7f);
NEXT_EVENT:
event++;
} while (event->do_event != NULL);
} while (event->ev_type != ev_null);

if ((_WM_MixerOptions & WM_MO_SAVEASTYPE0) || (!mdi->is_type2)) {
/* Write end of track marker */
Expand Down
1 change: 1 addition & 0 deletions src/internal_midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,7 @@ void _WM_ResetToStart(struct _mdi *mdi) {

/* Ensure last event is NULL */
_WM_CheckEventMemoryPool(mdi);
mdi->events[mdi->event_count].evtype = ev_null;
mdi->events[mdi->event_count].do_event = NULL;
mdi->events[mdi->event_count].event_data.channel = 0;
mdi->events[mdi->event_count].event_data.data.value = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/wildmidi_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1873,10 +1873,10 @@ WM_SYMBOL int WildMidi_SongSeek (midi * handle, int8_t nextsong) {

} else if (nextsong == 1) {
/* goto start of next song */
while (event->do_event != NULL) {
while (event->evtype != ev_null) {
if (event->evtype == ev_meta_endoftrack) {
event++;
if (event->do_event == NULL) {
if (event->evtype == ev_null) {
event--;
goto START_THIS_SONG;
} else {
Expand Down

0 comments on commit 34508c2

Please sign in to comment.