GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  AL_CREATE_AUDIO_STREAM (3)

NAME

al_create_audio_stream - Allegro 5 API

CONTENTS

Synopsis
Description

SYNOPSIS

C]
#include <allegro5/allegro_audio.h>

ALLEGRO_AUDIO_STREAM *al_create_audio_stream(size_t fragment_count, unsigned int frag_samples, unsigned int freq, ALLEGRO_AUDIO_DEPTH depth, ALLEGRO_CHANNEL_CONF chan_conf) ]

DESCRIPTION

Creates an ALLEGRO_AUDIO_STREAM(3). The stream will be set to play by default. It will feed audio data from a buffer, which is split into a number of fragments.

Parameters:
[bu] fragment_count - How many fragments to use for the audio stream. Usually only two fragments are required - splitting the audio buffer in two halves. But it means that the only time when new data can be supplied is whenever one half has finished playing. When using many fragments, you usually will use fewer samples for one, so there always will be (small) fragments available to be filled with new data.
[bu] frag_samples - The size of a fragment in samples. See note below.
[bu] freq - The frequency, in Hertz.
[bu] depth - Must be one of the values listed for ALLEGRO_AUDIO_DEPTH(3).
[bu] chan_conf - Must be one of the values listed for ALLEGRO_CHANNEL_CONF(3).
The choice of I]fragment_count], I]frag_samples] and I]freq] directly influences the audio delay. The delay in seconds can be expressed as:
C]
delay = fragment_count * frag_samples / freq
]

This is only the delay due to Allegro[aq]s streaming, there may be additional delay caused by sound drivers and/or hardware.
 

I]Note:] If you know the fragment size in bytes, you can get the size in samples like this:
C]
sample_size = al_get_channel_count(chan_conf) * al_get_audio_depth_size(depth);
samples = bytes_per_fragment / sample_size;
]

The size of the complete buffer is:
C]
buffer_size = bytes_per_fragment * fragment_count
]

I]Note:] unlike many Allegro objects, audio streams are not implicitly destroyed when Allegro is shut down. You must destroy them manually with al_destroy_audio_stream(3) before the audio system is shut down.

Search for    or go to Top of page |  Section 3 |  Main Index


Allegro reference manual AL_CREATE_AUDIO_STREAM (3)

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.