1get_midi_length(3)              Allegro manual              get_midi_length(3)
2
3
4

NAME

6       get_midi_length  - Determines the total playing time of a midi, in sec‐
7       onds. Allegro game programming library.
8

SYNOPSIS

10       #include <allegro.h>
11
12
13       int get_midi_length(MIDI *midi);
14

DESCRIPTION

16       This function will simulate playing the given MIDI, from start to  end,
17       to  determine  how  long it takes to play. After calling this function,
18       midi_pos will contain the negative number of beats, and  midi_time  the
19       length of the midi, in seconds.
20
21       Note  that  any  currently  playing  midi is stopped when you call this
22       function.  Usually you would call  it  before  play_midi,  to  get  the
23       length of the midi to be played, like in this example:
24
25          length = get_midi_length(my_midi);
26          play_midi(my_midi);
27          do {
28             pos = midi_time;
29             textprintf_ex(screen, font, 0, 0, c, -1, "%d:%02d / %d:%02d\n",
30                pos / 60, pos % 60, length / 60, length % 60);
31             rest(100);
32          } while(pos <= length);
33

RETURN VALUE

35       Returns the value of midi_time, the length of the midi.
36
37

SEE ALSO

39       load_midi(3), midi_time(3), midi_pos(3), exmidi(3)
40
41
42
43Allegro                          version 4.4.2              get_midi_length(3)
Impressum