downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

openal_buffer_create> <Utilisation
[edit] Last updated: Mon, 01 Nov 2010

view this page in

CVII. Gestion Audio OpenAL

Introduction

Plate-forme indépendante pour la gestion de l'audio. Requière la bilibothèque OpenAL.

Installation

Cette extension PECL n'est pas intégrée à PHP.

Des informations sur l'installation de ces extensions PECL peuvent être trouvées dans le chapitre du manuel intitulé Installation des extensions PECL. D'autres informations comme les notes sur les nouvelles versions, les téléchargements, les sources des fichiers, les informations concernant les mainteneurs ainsi qu'un CHANGELOG, peuvent être trouvées ici : http://pecl.php.net/package/openal.

Vous pouvez télécharger ces bibliothèques DLL pour ces extensions PECL depuis la page de téléchargement de PHP sous sur la page http://snaps.php.net/.

Configuration à l'exécution

Cette extension ne définit aucune directive de configuration.

Types de ressources

Cette extension définie quatre types de ressource : Open AL(Device) - Retournée par openal_device_open(), Open AL(Context) - Retournée par openal_context_create(), Open AL(Buffer) - Retournée par openal_buffer_create(), and Open AL(Source) - Retournée par openal_source_create().

Constantes pré-définies

Ces constantes sont définies par cette extension, et ne sont disponibles que si cette extension a été compilée avec PHP, ou bien chargée au moment de l'exécution.

ALC_FREQUENCY (entier)

Attribut de contexte

ALC_REFRESH (entier)

Attribut de contexte

ALC_SYNC (entier)

Attribut de contexte

AL_FREQUENCY (entier)

Configuration du buffer

AL_BITS (entier)

Configuration du buffer

AL_CHANNELS (entier)

Configuration du buffer

AL_SIZE (entier)

Configuration du buffer

AL_BUFFER (entier)

Configuration de la source/de l'écoute (Entier)

AL_SOURCE_RELATIVE (entier)

Configuration de la source/de l'écoute (Entier)

AL_SOURCE_STATE (entier)

Configuration de la source/de l'écoute (Entier)

AL_PITCH (entier)

Configuration de la source/de l'écoute (Nombre à virgule flottante)

AL_GAIN (entier)

Configuration de la source/de l'écoute (Nombre à virgule flottante)

AL_MIN_GAIN (entier)

Configuration de la source/de l'écoute (Nombre à virgule flottante)

AL_MAX_GAIN (entier)

Configuration de la source/de l'écoute (Nombre à virgule flottante)

AL_MAX_DISTANCE (entier)

Configuration de la source/de l'écoute (Nombre à virgule flottante)

AL_ROLLOFF_FACTOR (entier)

Configuration de la source/de l'écoute (Nombre à virgule flottante)

AL_CONE_OUTER_GAIN (entier)

Configuration de la source/de l'écoute (Nombre à virgule flottante)

AL_CONE_INNER_ANGLE (entier)

Configuration de la source/de l'écoute (Nombre à virgule flottante)

AL_CONE_OUTER_ANGLE (entier)

Configuration de la source/de l'écoute (Nombre à virgule flottante)

AL_REFERENCE_DISTANCE (entier)

Configuration de la source/de l'écoute (Nombre à virgule flottante)

AL_POSITION (entier)

Configuration de la source/de l'écoute (Nombre vectoriel à virgule flottante)

AL_VELOCITY (entier)

Configuration de la source/de l'écoute (Nombre vectoriel à virgule flottante)

AL_DIRECTION (entier)

Configuration de la source/de l'écoute (Nombre vectoriel à virgule flottante)

AL_ORIENTATION (entier)

Configuration de la source/de l'écoute (Nombre vectoriel à virgule flottante)

AL_FORMAT_MONO8 (entier)

Format PCM

AL_FORMAT_MONO16 (entier)

Format PCM

AL_FORMAT_STEREO8 (entier)

Format PCM

AL_FORMAT_STEREO16 (entier)

Format PCM

AL_INITIAL (entier)

État de la Source

AL_PLAYING (entier)

État de la Source

AL_PAUSED (entier)

État de la Source

AL_STOPPED (entier)

État de la Source

AL_LOOPING (entier)

État de la Source

AL_TRUE (entier)

Valeur booléen reconnue par OpenAL

AL_FALSE (entier)

Valeur booléen reconnue par OpenAL

Table des matières
openal_buffer_create --  Génère un buffer OpenAL
openal_buffer_data --  Charge un buffer avec des données
openal_buffer_destroy --  Détruit un buffer OpenAL
openal_buffer_get --  Récupère les propriétés du buffer OpenAL
openal_buffer_loadwav --  Charge un fichier .wav dans le buffer
openal_context_create --  Crée un contexte de traitement audio
openal_context_current --  Rend courant le contexte spécifié
openal_context_destroy --  Détruit un contexte
openal_context_process --  Traite le contexte spécifié
openal_context_suspend --  Suspend le contexte spécifié
openal_device_close --  Ferme un périphérique OpenAL
openal_device_open --  Initialise une interface audio OpenAL
openal_listener_get --  Récupère une propriété d'auditeur
openal_listener_set --  Définie une propriété d'auditeur
openal_source_create --  Génère une ressource de source
openal_source_destroy --  Détruit une ressource de source
openal_source_get --  Récupère une propriété de source OpenAL
openal_source_pause --  Marque une pause dans la source
openal_source_play --  Démarre la lecture de la source
openal_source_rewind --  Revient en arrière dans la source
openal_source_set --  Définie une propriété de la source
openal_source_stop --  Arrête la lecture de la source
openal_stream --  Démarre le streaming d'une source


openal_buffer_create> <Utilisation
[edit] Last updated: Mon, 01 Nov 2010
 
add a note add a note User Contributed Notes Gestion Audio OpenAL
Tjeerd 02-Feb-2007 08:37
OpenAL aims to provide a standardized API for something called '3D' sound, just like OpenGL does for '3D' video rendering.

The fun part of OpenAL is that it does all the DSP for you, so you don't need to know a lot about audio. Since OpenAL comes from Creative Labs, it supports hardware rendering of audio with most if not all SoundBlaster audio controllers. They come with chips from EMU-systems and are specifically designed to mix down multichannel audio with DSP effects like reverb and chorus, which could consume a lot CPU speed.

The downside of OpenAL is that (at this time of writing) it is focus on games only. It doesn't do MIDI at all, it doesn't record anything, it doesn't work like a synthesizer. The only thing you can do with OpenAL is play sounds in a simulated 3D environment.
It probably doesn't work on the web.

To use OpenAL you need to read the documentation about OpenAL.

Note concerning audio users: there's no such thing as '3D' audio with speakers. Technically, when people have only two ears, they really can't distinguish sound from above or below, even in front or from behind. To achieve this people merely hear volume, the brightness of sound and the phase difference. One should be able to hear more '3D' sound with only two quality-class speakers than with a consumer class 5.1-set.
cweiske at cweiske dot de 06-Sep-2006 01:31
I made a PHP-Gtk2 OpenAL demo which allows you to define as many sound sources as you like and position them relative to the listener by drag and drop: http://gnope.org/p/Tools_OpenALdemo
cweiske at cweiske dot de 21-Jul-2006 11:29
Playing a wav file:
<?php
function printok($b) {
    echo
$b ? " ok\n" : " error\n";
}

echo
"Opening device";
$device = openal_device_open();
printok($device);

echo
"Creating context";
$context = openal_context_create($device);
printok($context);
echo
"Making context the current";
printok(openal_context_current($context));

//where we are
//echo "Setting listener position";
//printok(openal_listener_set(AL_POSITION, array(0, 0, 0)));
//echo "Setting listener orientation";
//printok(openal_listener_set(AL_ORIENTATION, array(0=>0,1 => 1, 2=>0, 3=> 0, 4=>4, 5=>5)));

echo "Creating buffer";
$buffer = openal_buffer_create();
echo
"Loading wav";
printok(openal_buffer_loadwav($buffer, '/data/shared/vmware/newmessage.wav'));
echo
"buffer stats\n";
echo
" Frequency: " . openal_buffer_get($buffer, AL_FREQUENCY) . "\n";
echo
" Bits     : " . openal_buffer_get($buffer, AL_BITS) . "\n";
echo
" Channels : " . openal_buffer_get($buffer, AL_CHANNELS) . "\n";
echo
" Size     : " . openal_buffer_get($buffer, AL_SIZE) . "\n";

echo
"Creating source";
$source = openal_source_create();

echo
"Setting source buffer";
printok(openal_source_set($source, AL_BUFFER, $buffer));
//echo "Setting source position";
//printok(openal_source_set($source, AL_POSITION, array(1, 0, 0)));

echo "Playing source";
printok(openal_source_play($source));

echo
"sleeping\n";
//sleep(1);
//we wait 300msecs beause the sound
// has no time to be played otherwise
//since playing sound is done concurrently
// to the script
usleep(300000);

echo
"Destroying source";
printok(openal_source_destroy($source));
echo
"Destroying buffer";
printok(openal_buffer_destroy($buffer));
echo
"Destroying context";
printok(openal_context_destroy($context));
echo
"Closing device";
printok(openal_device_close($device));
?>

 
show source | credits | sitemap | contact | advertising | mirror sites