StormLib API Reference
SCompCompress
int WINAPI SCompCompress( void * pvOutBuffer, // Pointer to buffer where imploded data will be stored int * pcbOutBuffer, // Pointer to size of output buffer void * pvInBuffer, // Pointer to buffer with data to be imploded int cbInBuffer, // Size of the input data unsigned uCompressionMask, // Compression methods to use int nCmpType, // First parameter specific to compression method int nCmpLevel // Second parameter specific to compression method );
SCompCompress compresses a data buffer, using various compression methods.
When the function succeeds, it returns nonzero. On an error, the function returns FALSE and GetLastError gives the error code.
When the compression library was unable to compress the data, it will copy the input data to the output buffer. The caller can determine this by checking size of the output data against size of the input data. If cbOutData == cbInData, it means that the data haven't been compressed.
When compressing WAVE files using ADPCM compression, the first MPQ block of the WAVE file must be compressed by a data compression (e.g. MPQ_COMPRESSION_PKWARE). The nCmpLevel can be used to control quality of the WAVE files. The following table shows parameters for different WAVE qualities:
WAVE Quality | uCompressionMask | nCmpLevel |
---|---|---|
High quality, the worst compression | 0x08 (stereo) 0x08 (mono) |
(ignored) |
Medium quality, medium compression | 0x81 (stereo) 0x41 (mono) |
4 |
Low quality, the best compression | 0x81 (stereo) 0x41 (mono) |
2 |
Available in Storm.dll | Yes |
Ordinal number in Storm.dll 1.00 | N/A |
Ordinal number in Storm.dll 1.09 | 551 (0x227) |
Copyright (c) Ladislav Zezula 2003 - 2010