Merge pull request #11 from Kodest/master

Do not include zero-length delays in output
pull/14/head
Len Shustek 6 years ago committed by GitHub
commit 63cdd2f560
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      miditones.c

@ -1220,23 +1220,25 @@ This is not unlike multiway merging used for tape sorting algoritms in the 50's!
delta_time = earliest_time - timenow; delta_time = earliest_time - timenow;
if (delta_time) { if (delta_time) {
gen_stopnotes(); /* first check if any tone generators have "stop note" commands pending */
/* Convert ticks to milliseconds based on the current tempo */ /* Convert ticks to milliseconds based on the current tempo */
unsigned long long temp; unsigned long long temp;
temp = ((unsigned long long) delta_time * tempo) / ticks_per_beat; temp = ((unsigned long long) delta_time * tempo) / ticks_per_beat;
delta_msec = temp / 1000; // get around LCC compiler bug delta_msec = temp / 1000; // get around LCC compiler bug
if (loggen) if (delta_msec) {
fprintf (logfile, "->Delay %ld msec (%ld ticks)\n", delta_msec, delta_time); gen_stopnotes(); /* first check if any tone generators have "stop note" commands pending */
if (delta_msec > 0x7fff) if (loggen)
midi_error ("INTERNAL: time delta too big", trk->trkptr); fprintf (logfile, "->Delay %ld msec (%ld ticks)\n", delta_msec, delta_time);
/* output a 15-bit delay in big-endian format */ if (delta_msec > 0x7fff)
if (binaryoutput) { midi_error ("INTERNAL: time delta too big", trk->trkptr);
putc ((unsigned char) (delta_msec >> 8), outfile); /* output a 15-bit delay in big-endian format */
putc ((unsigned char) (delta_msec & 0xff), outfile); if (binaryoutput) {
outfile_bytecount += 2; putc ((unsigned char) (delta_msec >> 8), outfile);
} else { putc ((unsigned char) (delta_msec & 0xff), outfile);
fprintf (outfile, "%ld,%ld, ", delta_msec >> 8, delta_msec & 0xff); outfile_bytecount += 2;
outfile_items (2); } else {
fprintf (outfile, "%ld,%ld, ", delta_msec >> 8, delta_msec & 0xff);
outfile_items (2);
}
} }
} }
timenow = earliest_time; timenow = earliest_time;

Loading…
Cancel
Save