[ scummvm-Patches-2834001 ] Streaming for VOC files in ScummVM

SourceForge.net noreply at sourceforge.net
Sat Aug 8 03:31:45 CEST 2009


Patches item #2834001, was opened at 2009-08-08 01:31
Message generated for change (Tracker Item Submitted) made by agent-q
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418822&aid=2834001&group_id=37116

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: agent-q (agent-q)
Assigned to: Nobody/Anonymous (nobody)
Summary: Streaming for VOC files in ScummVM

Initial Comment:
The following patch enables VOC streams created with makeVOCStream() to stream audio a chunk at a time from disk rather than loading the whole sample into memory.  This massively reduces the memory requirements of a VOC stream.

A new class, LinearDiskStream, takes an array of positions and sizes within a stream and plays them as if they were appended together as one sample.  This is needed for VOC files because they can (and do) contain more than one block of sample data non-contiguous in a file.

New code in voc.cpp parses the VOC format and creates the sample block data which is used by LinearDiskStream.  There is a certain amount of duplication of code here, but I couldn't find a way to avoid it.

It is anticipated that LinearDiskStream could be used to stream WAVs or any other file format containing uncompressed data.  All that is needed is a function to create a block list (perhaps of only one block for WAV file format) specifying where the same data is in the stream.

The preprocessor symbol STREAM_AUDIO_FROM_DISK must be added to enable the new streaming functionality (currently used only for VOC files), without it everything runs as before.  I added it to common/scummsys.h

This is tested in the Scumm engine and the Kyra engine, and there are no problems.  I'll be testing others as I do my normal testing.

A small change is needed (included in this patch) to the Kyra engine to prevent it from deleting the stream object after creating the audio stream.  This may be needed for other engines too.

Looping is not yet supported, mainly because it seems to never be used, at least for VOC files.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418822&aid=2834001&group_id=37116




More information about the Scummvm-tracker mailing list