[Scummvm-devel] Streaming sounds in Scumm games
Max Horn
max at quendi.de
Thu Aug 6 10:42:07 CEST 2009
Am 06.08.2009 um 01:41 schrieb Travis Howell:
> Lack of memory for large sounds has been a known issues in Nintendo DS
> port for years now, have you forgotten the similar issue with
> introduction in Simon the Sorcerer 1? which still uses a hack to work
> around the problem.
>
> I actually opened a feature request in the past (See
> https://sourceforge.net/tracker/?func=detail&aid=1832977&group_id=37116&atid=418823
> ), so the issue wouldn't be forgotten.
>
> There has been no progress on the issue though, since streaming sound
> data directly could have a negative effect on ports (DC and PS2) which
> load files directly from the CD.
>
> So there seems to be a requirement to make sound streaming optional in
> ports, keeping the current option of loading sound files/segments into
> memory too.
Well, it will be trivial to make the streaming optional, luckily. In
fact it is easy to do it with runtime checks or during compile time;
or to do it locally (in the engine) or globally (in the makeStream*
functions).
The simple "trick" is to add a few lines of code that take the given
ReadStream, read all its data and store that into a MemoryReadStream.
For efficiency, one could add a check whether the given stream is
already a memory stream.
Of course this is something you only want to do on a platform with
enough RAM. But if the input stream is a File, this approach wouldn't
use more memory than we currently use.
An alternative would be to wrap the ReadStream into a
BufferedReadStream, with a sufficiently large buffer. That way, reads
happen only occasionally.
Finally, the backend could (should?) potentially do this buffering,
too, meaning no changes are necessary at all in the common part. This
requires some testing. Anyway, I am quite hopeful that streaming audio
from a file can be done on the DC and PS2, too, with sufficient care.
But of course this is nothing we can achieve in 4 days. Hence, if we
put in the changes to the VOC (and WAVE?) code, we should probably
make it so that in 1.0.0rc1, it is only activated on select platforms;
but enable it for all in trunk. With some effort, we might even be
able to activate it fully for the final 1.0.0.
Cheers,
Max
More information about the Scummvm-devel
mailing list