1ALLEGRO_AUDIO_STREAM(3)    Library Functions Manual    ALLEGRO_AUDIO_STREAM(3)
2
3
4

NAME

6       ALLEGRO_AUDIO_STREAM
7

SYNOPSIS

9              #include <allegro5/allegro_audio.h>
10
11              typedef struct ALLEGRO_AUDIO_STREAM ALLEGRO_AUDIO_STREAM;
12

DESCRIPTION

14       An ALLEGRO_AUDIO_STREAM object is used to stream generated audio to the
15       sound device, in real-time.  This is done by  reading  from  a  buffer,
16       which  is  split  into  a number of fragments.  Whenever a fragment has
17       finished playing, the user can refill it with new data.
18
19       As with ALLEGRO_SAMPLE_INSTANCE(3) objects, streams  store  information
20       necessary  for  playback,  so you may not play the same stream multiple
21       times simultaneously.  Streams also need to be  attached  to  an  ALLE‐
22       GRO_VOICE(3)  object,  or  to an ALLEGRO_MIXER(3) object which, eventu‐
23       ally, reaches an ALLEGRO_VOICE object.
24
25       While playing, you must periodically  fill  fragments  with  new  audio
26       data.   To  know  when  a  new  fragment is ready to be filled, you can
27       either directly check with  al_get_available_audio_stream_fragments(3),
28       or listen to events from the stream.
29
30       You  can  register  an audio stream event source to an event queue; see
31       al_get_audio_stream_event_source(3).              An              ALLE‐
32       GRO_EVENT_AUDIO_STREAM_FRAGMENT event is generated whenever a new frag‐
33       ment    is    ready.     When    you    receive    an    event,     use
34       al_get_audio_stream_fragment(3)  to obtain a pointer to the fragment to
35       be filled.  The size and format are determined by the parameters passed
36       to al_create_audio_stream(3).
37
38       If you're late with supplying new data, the stream will be silent until
39       new data is provided.   You  must  call  al_drain_audio_stream(3)  when
40       you're finished with supplying data to the stream.
41
42       If  the  stream  is created by al_load_audio_stream(3) then it can also
43       generate an ALLEGRO_EVENT_AUDIO_STREAM_FINISHED event if it reaches the
44       end of the file and is not set to loop.
45
46
47
48Allegro reference manual                               ALLEGRO_AUDIO_STREAM(3)
Impressum