[Scummvm-devel] Streaming sounds in Scumm games
max at quendi.de
Thu Aug 6 10:36:15 CEST 2009
Am 06.08.2009 um 08:51 schrieb Filippos Karapetis:
> Er, I've already put a #if defined(ENABLE_SAGA2) safeguard which
> affects both shorten.h and .cpp. And the Shorten code is only used
> in the WIP SAGA2 engine, not the whole SAGA engine.
Awesome! Sorry, I overlooked that.
> As for the sound code in SAGA: I've written it to load samples in
> memory, as it simplified the overall code in that part, as the SAGA
> engine has to deal with a variety of different encodings (PCM, VOC,
> VOX, WAV, VOC, AIFF and Shorten). The whole sound effect/speech code
> in SAGA should be changed to play samples from disk directly, rather
> than loading them in memory, but I believe that this is not possible
> for VOC, WAV and AIFF files with the current common code.
To be pedantic: no audio code can ever play directly from disk, it
always has to load the data into RAM -- the main difference is whether
it loads all, or only parts. The current VOC/WAV/AIFF code will always
load all into memory; while the MP3/OGG/FLAC code is capable of
"streaming", i.e. only loading parts from disk into memory, use them
up, then load more.
Now, the SAGA engine already always loads the *whole* VOC/WAV/AIFF
data into memory. Thus, changing it from using the load* functions to
the makeStream* functions would not cause a major difference. *But*
this change would make it automatically benefit from any improvements
we may make to the makeStream* functions.
And I see no problem with changing SAGA to use makeStream for VOC/WAV/
AIFF. It can do it for MP3/OGG/FLAC; it should be a matter of
replicating that code, more or less. In fact, with some care, the
current code duplication in the MP3/OGG/FLAC handling code could be
The resulting code should be simpler than the current code, too.
More information about the Scummvm-devel