diff options
| author | Thierry Crozat | 2017-09-05 21:17:00 +0100 |
|---|---|---|
| committer | Thierry Crozat | 2018-01-23 02:15:32 +0000 |
| commit | 86795f0fa2c60d322bececf133762b85ef44a23e (patch) | |
| tree | 795659ccb8764a2f6bb989477dc2739a1188f618 /engines | |
| parent | 696fcb6bb98a2e527ebba8c70548930fe3a6cb31 (diff) | |
| download | scummvm-rg350-86795f0fa2c60d322bececf133762b85ef44a23e.tar.gz scummvm-rg350-86795f0fa2c60d322bececf133762b85ef44a23e.tar.bz2 scummvm-rg350-86795f0fa2c60d322bececf133762b85ef44a23e.zip | |
SUPERNOVA: Fix clicks at start and end of audio samples
The sound samples start with a 6 bytes header (including the size of
the sample coded on a little endian 16 bits uint on bytes 2 and 3)
and end with 4 bytes set to null. Those were passed to the raw stream,
which resulted in the audible clicks.
Note that we could use the information from the header to load the
sound samples instead of keeping around an array of offset and size.
Diffstat (limited to 'engines')
| -rw-r--r-- | engines/supernova/supernova.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index 9526481fdf..e421d6f1b4 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -249,6 +249,11 @@ void SupernovaEngine::initData() { _images[i].init(i); // Sound + // Note: + // - samples start with a header of 6 bytes: 01 SS SS 00 AD 00 + // where SS SS (LE uint16) is the size of the sound sample + 2 + // - samples end with a footer of 4 bytes: 00 00 + // Skip those in the buffer Common::File file; for (int i = 0; i < kAudioNumSamples; ++i) { @@ -258,12 +263,12 @@ void SupernovaEngine::initData() { if (audioInfo[i]._offsetEnd == -1) { file.seek(0, SEEK_END); - _soundSamples[i]._length = file.pos() - audioInfo[i]._offsetStart; + _soundSamples[i]._length = file.pos() - audioInfo[i]._offsetStart - 10; } else { - _soundSamples[i]._length = audioInfo[i]._offsetEnd - audioInfo[i]._offsetStart; + _soundSamples[i]._length = audioInfo[i]._offsetEnd - audioInfo[i]._offsetStart - 10; } _soundSamples[i]._buffer = new byte[_soundSamples[i]._length]; - file.seek(audioInfo[i]._offsetStart); + file.seek(audioInfo[i]._offsetStart + 6); file.read(_soundSamples[i]._buffer, _soundSamples[i]._length); file.close(); } |
