midifile

changeset 1:abfe7b19079a tip

leftover changes from 10 years ago
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 17 Jun 2022 01:12:24 +0300
parents 3658e56b3a8a
children
files src/midi.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/src/midi.c	Thu Jan 26 00:31:39 2012 +0200
     1.2 +++ b/src/midi.c	Fri Jun 17 01:12:24 2022 +0300
     1.3 @@ -137,7 +137,7 @@
     1.4  	}
     1.5  	midi->num_tracks = 0;
     1.6  
     1.7 -	while((chunk = skip_chunk(chunk))) {
     1.8 +	while((chunk = skip_chunk(chunk)) && ((char*)chunk < mem + size)) {
     1.9  		if(ischunk(chunk, "MTrk")) {
    1.10  			if(read_track(midi, chunk) == -1) {
    1.11  				fprintf(stderr, "failed to read track\n");
    1.12 @@ -232,6 +232,7 @@
    1.13  	/* if we did actually add any events ... */
    1.14  	if(trk.num_ev) {
    1.15  		midi->tracks[midi->num_tracks++] = trk;
    1.16 +		printf("loaded track with %d events\n", midi->num_tracks);
    1.17  	}
    1.18  	return 0;
    1.19  }