[Scummvm-devel] Unifiying MP3/Vorbis playback code some more

Max Horn max at quendi.de
Mon Dec 1 11:02:03 CET 2003


Yo folks,

was thinking about unifying some of the MP3/Vorbis code.

Right now, both scumm and simon can convert the native data files into 
special MP3/Vorbis formats, unique to ScummVM. To this end we have 
tools which convert the data files of each game engine to an 
appropriate custom container format which contains the sound, MP3/Ogg 
Vorbis encoded. And both engines have code to load those files and then 
play sound from them.

In both cases, the datafiles essentially contains lots of MP3/Vorbis 
files glued together, with an offset table added in. In theory, it 
should be possible to unify much of the code for that, and the data 
format could be the same, too (in fact I think it already is, but I 
didn't check on that). The API needed roughly has to:
* load a given container file
* fetch/play the sound data for a given sound ID

I am not aware of any other need ATM, but of course we can add more 
functionality as needed.

Right now I am not sure what queen needs for its MP3/Vorbis code. Maybe 
we could make an API which satisfies queen, too.

At this point you may be wondering why exactly I want to unify the 
code. Well besides the obvious (we only have to maintain & fix the code 
in one place), this also makes future development easier. E.g. right 
now simon only support MP3, with this it would get Ogg Vorbis support 
"for free". And if we decide to add support for FLAC (a lossless audio 
codec), all engines using that API would gain support for it 
automatically. And we could switch to a new/better container format 
with ease, too (something which I am thinking about, too, as the 
current format is extremely limited).



Thoughts? Opinions? Is this really worthwhile? Could we find a solution 
which is useful for the queen module, too? What about sky/sword2, could 
they benefit from MP3/Vorbis compression at all?


Cheers,

Max





More information about the Scummvm-devel mailing list