https://github.com/ponup/php-openal
OpenAL audio library bindings for PHP
https://github.com/ponup/php-openal
audio extension openal php
Last synced: 16 days ago
JSON representation
OpenAL audio library bindings for PHP
- Host: GitHub
- URL: https://github.com/ponup/php-openal
- Owner: Ponup
- License: mit
- Created: 2019-05-18T16:59:07.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-01-21T22:24:27.000Z (about 4 years ago)
- Last Synced: 2025-05-06T19:06:57.606Z (10 months ago)
- Topics: audio, extension, openal, php
- Language: C
- Homepage: http://pecl.php.net/package/openal
- Size: 4.95 MB
- Stars: 7
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/Ponup/php-openal)
# PHP-OpenAL
**OpenAL** bindings for PHP.
```php
$device = openal_device_open(null);
$context = openal_context_create($device);
openal_context_current($context);
$source = openal_source_create();
$buffer = openal_buffer_create();
openal_buffer_data($buffer, AL_FORMAT_STEREO16, $wavData, $wavSampleRate);
openal_source_set($source, AL_BUFFER, $buffer);
openal_source_set($source, AL_LOOPING, true);
openal_source_play($source);
sleep($wavLength);
openal_source_stop($source);
openal_context_destroy($context);
openal_device_close($device);
```
## Requirements
- PHP8.1
- OpenAL library and headers
## Documentation
https://www.php.net/manual/en/book.openal.php
## Docker
```sh
docker build -t php-openal .
docker run -it --device /dev/snd -e PULSE_SERVER=/tmp/pulse-native -e PULSE_COOKIE=/tmp/pulse-cookie -v $XDG_RUNTIME_DIR/pulse/native:/tmp/pulse-native -v ~/.config/pulse/cookie:/tmp/pulse-cookie --group-add audio --entrypoint php php-openal examples/example.php
```
## Building
```sh
phpize
./configure --with-openal=/usr/local/Cellar/openal-soft/1.19.1 # Adjust path accordingly
make
sudo make install
```
## Packaging
```sh
pear package # This will generate an openal-X.X.X.tgz to push to pecl.php.net
```