Soundcache: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Categorised)
(Updated, thanks Yahn)
Line 5: Line 5:
*.cache files can be viewed with Game Extractor [http://www.watto.org/extract/]
*.cache files can be viewed with Game Extractor [http://www.watto.org/extract/]
*.manifest files can be viewed with any text editor
*.manifest files can be viewed with any text editor
==Caches==
*<code>_sharedprecache.cache</code>: contains data for sounds common to over 50% of maps.
*<code>_other.cache</code>: contains the file header, but no data, for any sound files that were not encountered in any other precache lists. Sounds in this cache do not cause I/O-related hitches as they play back fully asynchronously, that is, only once the sound is completely loaded.
*<code><mapname>.cache</code>: Contains the remaining files that are precached but not already a part of <code>_sharedprecache.cache</code>.
==Creation==
==Creation==
Sound caches are created automatically if they do not already exist before a map is loaded. A manifest is first written listing every file used, then it ''appears'' to be compared against the <code>_sharedprecache</code> cache, and the first second of any files that are not in the shared cache are written to the map cache.
Sound caches are created automatically if they do not already exist before a map is loaded. A manifest is first written listing every file used, then each cache is created using the rules above, with the first second of each file written to the relavant cache.


*<code>snd_writemanifest</code>
*<code>snd_writemanifest</code>
:Writes the .manifest file. Buggy.
:Writes the .manifest file. Buggy.
*<code>snd_rebuildaudiocache</code>
*<code>snd_rebuildaudiocache</code>
:Writes the .cache file, containing soundfile snippets. Untested.
:Writes the .cache file, containing soundfile snippets. Appears to have no effect.
==Limitations & Bugs==
==Limitations & Bugs==
Soundcaches are very buggy. Each cache and manifest, whether generated from your own work or shipped with Half-Life 2, will contain many sound files that are not needed, and won't contain many that are. There is no known solution at this time.
There is no known way to manually select the contents of each cache.


[[Category:Sound System]]
[[Category:Sound System]]
[[Category:Technical]]
[[Category:Technical]]

Revision as of 08:40, 30 November 2005

Outline

A Soundcache is a file with contains the first second of each sound required in a map. Source loads the soundcache instead of the sounds themselves to save time and memory: during gameplay the soundcache snippet is played while the full sound loads on-demand from the hard drive. There is enough data loaded by the time the sound snippet finishes playing to begin streaming to hardware. Each soundcache has an accompanying .manifest, which contains a list of files needed by the map.

Extraction

  • .cache files can be viewed with Game Extractor [1]
  • .manifest files can be viewed with any text editor

Caches

  • _sharedprecache.cache: contains data for sounds common to over 50% of maps.
  • _other.cache: contains the file header, but no data, for any sound files that were not encountered in any other precache lists. Sounds in this cache do not cause I/O-related hitches as they play back fully asynchronously, that is, only once the sound is completely loaded.
  • <mapname>.cache: Contains the remaining files that are precached but not already a part of _sharedprecache.cache.

Creation

Sound caches are created automatically if they do not already exist before a map is loaded. A manifest is first written listing every file used, then each cache is created using the rules above, with the first second of each file written to the relavant cache.

  • snd_writemanifest
Writes the .manifest file. Buggy.
  • snd_rebuildaudiocache
Writes the .cache file, containing soundfile snippets. Appears to have no effect.

Limitations & Bugs

There is no known way to manually select the contents of each cache.