1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
.TH ALLEGRO_AUDIO_STREAM 3 "" "Allegro reference manual"
.SH NAME
.PP
ALLEGRO_AUDIO_STREAM \- Allegro 5 API
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <allegro5/allegro_audio.h>
typedef\ struct\ ALLEGRO_AUDIO_STREAM\ ALLEGRO_AUDIO_STREAM;
\f[]
.fi
.SH DESCRIPTION
.PP
An ALLEGRO_AUDIO_STREAM object is used to stream generated audio to the
sound device, in real\-time.
This is done by reading from a buffer, which is split into a number of
fragments.
Whenever a fragment has finished playing, the user can refill it with
new data.
.PP
As with ALLEGRO_SAMPLE_INSTANCE(3) objects, streams store information
necessary for playback, so you may not play the same stream multiple
times simultaneously.
Streams also need to be attached to an ALLEGRO_VOICE(3) object, or to an
ALLEGRO_MIXER(3) object which, eventually, reaches an ALLEGRO_VOICE
object.
.PP
While playing, you must periodically fill fragments with new audio data.
To know when a new fragment is ready to be filled, you can either
directly check with al_get_available_audio_stream_fragments(3), or
listen to events from the stream.
.PP
You can register an audio stream event source to an event queue; see
al_get_audio_stream_event_source(3).
An ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT event is generated whenever a new
fragment is ready.
When you receive an event, use al_get_audio_stream_fragment(3) to obtain
a pointer to the fragment to be filled.
The size and format are determined by the parameters passed to
al_create_audio_stream(3).
.PP
If you\[aq]re late with supplying new data, the stream will be silent
until new data is provided.
You must call al_drain_audio_stream(3) when you\[aq]re finished with
supplying data to the stream.
.PP
If the stream is created by al_load_audio_stream(3) then it can also
generate an ALLEGRO_EVENT_AUDIO_STREAM_FINISHED event if it reaches the
end of the file and is not set to loop.
|