Message-ID: From: Shawn Hargreaves To: djgpp AT delorie DOT com Subject: Re: A couple of questions about MIDI's and Allegro Date: Wed, 8 Apr 1998 10:42:57 +0100 MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk D. Huizenga writes: > 1. Is it possible to tell how long a midi is, without > seeking through the whole thing until you get to the > end? Not easily: I think that repeated seeks will be the best way to do this (very ugly, but easy to code). The other possibility would be to scan through the MIDI data to measure exactly how long it is. You could use the load_patches() function (from midi.c) as a starting point for something like this, but it will be awkward to get the results in any usable format. It isn't enough just to measure the length in the raw format used by the MIDI file, because you will need to look at the playback speed (which may be changed at any point using the tempo meta-event), and check the number of beat divisions from the file header before you can get the length in a useful format. By the time you've done all that, you might as well just have scanned through the entire file with a seek operation... Shawn Hargreaves.