WSS File Format – Talk

From Bohemia Interactive Community
Revision as of 09:04, 22 October 2011 by Mikero (talk | contribs) (→‎compression types: new section)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

decompression

this appears to be simply a cut 'n paste of an unrelated (but relevent) example decoder. It is a little difficult to follow what is input and output because the names are not related to as-described in the header. Also, there is no definition of input length or output length making it problematic how to use it in existing wss files.

Mikero (nee Ook?) 09:27, 27 January 2010 (CET)

The soundData array contains the raw bytes. If <compression> == 0 then 2 bytes are one sample of the PCMData (PCMData contains samples of the continuous analog signal of the sound). If <compression> == 8 one byte of the soundData array is a compressed sample that needs to be expanded to a normal 16 Bit PCM sample. So the decoder basically goes through all bytes of soundData and expands them. So input size is soundData.Length and output size is PCMData.Length (which is the double of soundData.Length obvisously). Basically you could write an expand function that takes one byte and outputs a short but the decoder also needs the previous calculated PCM sample value, because the saved data is just the difference and not the real value. So you would need to pass the previous PCM sample value. So an example function signature could be:

short expand(byte compressedByte, short previousPCM)

I have to admit that this article isn't written well. It's just a starting point for your edits ;) --T_D 12:44, 27 January 2010 (CET)

compression types

baf and pmc files are type 4 (even in the lite versions)

presumably meaning some sort of encryption


Mikero (nee Ook?)