Subentry of
Projects
Tue2Oct2007
AmbST stands for Ambient Star Trek, or Star Trek Ambiance Machine. Are you confused yet? This originally started as a project for testing OpenAL in PHP, so that my GTK apps could make noise. This application also ended up becoming a test for GtkStatusIcon when support first came into PHP-GTK.
So what does this do? All it really does is loop WAV files. However my selection of wave files allows to to choose between the engine drone as heard on the Enterprise D from 3 locations: the Bridge, Engineering, and Sickbay. I may be a dork but honestly the drone is nice and really sooths my sleeping, the fact it is the Enterprise D engine drone is just bonus points really.
However in it's current state, the OpenAL module requires a patch to the source code to make work, which I just have happen to have written.
Requirements:
GTK+ 2.10 or newer.
PHP-GTK2 Beta or newer.
PHP-OpenAL + My Patch.
Quick Tour of the Source
This is the main executable code: /usr/bin/ambst.
If you strip out all the GTK stuff, with my patch OpenAL in PHP actually works and works easy. When you load the library, dl('openal.so') OpenAL automatically initiates, and when the script ends it automatically shuts down. This fixes a segmentation fault where if you did not shut it down yourself... it would segmentation fault. One note though, you must stop and destroy all sound sources/buffers before your script ends. If i recall correctly that will still cause a segfault, but would be your fault anyway for not taking care of your program.
I wrote a class in PHP to wrap a sound object and give it methods to control the playback. That makes the code look a little more complex than it is. Once the module is loaded it works just like you would would expect it to using the C interface, no more tricks.
Download:
AmbST: ambst-2.1.tar.bz2
OpenAL Source Patch: openal-bob-1.1.diff