[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Hello!
I have just finished the ALSA driver for the new sound API and mixer
code written by Chris. It seems to work fine, both for streaming and
nonstreaming sources. It was a fun thing to do. More testing will be
necessary, of course.
You can download files at http://www.riteh.hr/~mmimica/allegro-alsa.zip
File list:
app.c - An example application of how the users code should look like
allegro.h - allegro header stub
alunix.h - unix specific defines
sound.h - user-included sound defines
internal.h - allegro-included sound defines
mutex.c, mutex.h - allegro's mutex code replacement
digi.c - platform independent sound code and mixer code
alsa.c - driver code
It shouldn't be hard to integrate it to allegro, but I'd rather wait
until we sort out vtables, headers visibility and other basic things.
Changes to the platform independent API are minor:
- I had to add AL_AUDIO_ENUM_LAST to AL_AUDIO_ENUM so that I can define
driver specific options (AL_ALSA_MIXER_DEVICE in this case)
- a function to get audio driver was kind a missing so I added
AL_AUDIO_DRIVER *al_get_audio_driver(int digi_driver);. Not saying that
it should be done this way, I did it just to have a clean example
application.
Currently, ALSA driver supports only one hardware voice. It shouldn't be
hard to rewrite it for multiple voices but I have no idea how to do
that. Multiple snd_pcm_open? I have an integrated sound card with stereo
speakers, so can't test multichannelness.
Yet to be done:
There are some lines marked with "TODO". Nothing special, mostly error
reporting code to be enabled when integrated into allegro.
Thread pthread_create/pthread_join functions should be replaced with
_al_thread_create/_al_thread_join.
The example app depends only on pthreads and alsa. Can be compiled like
this: gcc alsa.c app.c digi.c mutex.c -oapp -Wall -lasound -lpthread -g0 -O2
About other drivers, are we going to drop alsa5, arts, jack and esd? I
think only OSS would be interesting.
--
Milan Mimica
http://sparklet.sf.net