[AD] acodec proposal

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Okay, here it goes. Create an acodec addon that:

* has al_load_sample, al_load_sample_f, al_load_sample_type, etc...
* has no explicit load/save functions (e.g., no al_load_wav)
* has native support for wav
* has (optional) dynamic support for ogg, flac, mod
* no need to init the acodec addon, but you must link against it***
* remove the need for allegro_flac, allegro_ogg, allegro_modaudio

If you choose to build the acodec add-on (default option), every
supported file format will *always* be registered (ogg, flac, it, mod,
xm, s3m, wav). If you don't have the third party libraries at Allegro
compile time, then they will be loaded dynamically on demand at run
time. Obviously if the DLL is not found at that point, the NULL sample
is returned.

Thus, there is no way to disable support for any singular audio codec.
If you have, e.g. dumb.dll or flac.dll, it will always work with
allegro_acodec.dll.

If possible it would be nice to not even require that the header files
be present. I was able to accomplish that with libdumb with minimal
effort.

*** Acodec could be part of audio. Obviously it depends on it.
However, there is a clear cut line between acodec's and audio's
functionality. Personally, I think they should remain separate.

~~~
User code looks like:
#include <allegro5/allegro.h>
#include <allegro5/allegro_audio.h>
#include <allegro5/allegro_acodec.h>

al_init();
al_install_audio();
ALLEGRO_SAMPLE *s = al_load_sample("foo.mod"); // libdumb is
dynamically at this point, if needed
~~~

This adds the following system driver functions:

void *al_open_library(const char *filename);
void *al_import_symbol(void *library, cont char *symbol);
void al_close_library(void *library);

The way the above could work, is:

* "foo" autodetect full name => "libfoo.so" (UNIX) or "foo.dll" or
"libfoo.dll" (Windows)
* "foo.dll" only try foo.dll, since the extension is present.


Attached is a work-in-progress diff that is an implementation of this
for Windows and libdumb. There's no need to try to apply it, but it
might help make the above proposal more clear. The code isn't supposed
to be production ready, so you can ignore any obvious minor problems
with it.

(You can ignore anything regarding images in the diff... I decided to
(re)start with acodec.)

--
Matthew Leverton

Attachment: acodec.tar.gz
Description: GNU Zip compressed data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/