Conrads announcement just reminded me, but a freind of mine sugessted this
for Linux months ago (I think he nicked it off the way Amigas
filetype-drivers did generic file i/o) and I've been meaning to post about
it ever since.
The Idea
Have .so files (similar to LADSPA plugins, but different API) that contain
functions that can be called to inspect audio files on disk to determine
if they understand them or not. If they do a second function is called to
stream the audio from the file (in a single standard format, eg. IEEE
float or double).
These .so files would just be thin wrappers over existing libraries,
libsndfile, libfishsound, libFLAC etc. you could even wrap up General MIDI
file renderers as an extreme example.
The same could be done for writing, but thats probably less useful, and
harder.
The Motivation
It means that if your app only cares about audio i/o a little it can have
a single, simple .so file handling routine that scans the installed
plugins offfering them all the file, pick one that recognises the filetype
and asks it for the data.
If you need anything complex - like extracting loop points from metadata
streams then you will still have to use a library directly, but for simple
"get me this audio" tasks this should be fine.
Users can just install new plugins in a global directory and all the apps
that use this scheme will then be able to read the new filetype.
The API
The functions would be something like:
"get metadata" -- pass a fd, FILE * or filename and get back a struct
describing the contents of the file (length, no. of channels
etc.), or NULL if its not recognised by this plugin
"get data" -- pass the file reference, some preallocated float buffers,
and a frame count and they will be filled. returns how many frames
were actually written
I havent actually written any code, so you might need more API cruft than
that, but this is the basic idea.
- Steve