diff options
author | Retro-Junk | 2017-01-23 02:13:32 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2017-01-25 22:42:25 +0100 |
commit | 963409192551f847d9222c570e7193982ab96bd4 (patch) | |
tree | 65e5620c3472296b8409bfbf3fd4d7d1785bea84 /engines/cryo/video.cpp | |
parent | d23bb8860bf7d561e09f503d12c17b6255fe5670 (diff) | |
download | scummvm-rg350-963409192551f847d9222c570e7193982ab96bd4.tar.gz scummvm-rg350-963409192551f847d9222c570e7193982ab96bd4.tar.bz2 scummvm-rg350-963409192551f847d9222c570e7193982ab96bd4.zip |
CRYO: Add sound playback to HNM files (buggy yet)
Diffstat (limited to 'engines/cryo/video.cpp')
-rw-r--r-- | engines/cryo/video.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/engines/cryo/video.cpp b/engines/cryo/video.cpp index cb8a00122d..88326e647e 100644 --- a/engines/cryo/video.cpp +++ b/engines/cryo/video.cpp @@ -32,9 +32,8 @@ HnmPlayer::HnmPlayer(CryoEngine *vm) : _vm(vm) { _expectedFrameTime = 0.0; _rate = 0.0; _useSoundSync = false; - _useSound = false; + _useSound = true; _soundChannel = nullptr; - _soundGroup = nullptr; _prevRight = _prevLeft = 0; _useAdpcm = false; _customChunkHandler = nullptr; @@ -89,6 +88,7 @@ void HnmPlayer::reset() { void HnmPlayer::init() { _customChunkHandler = nullptr; _preserveColor0 = false; + _useSound = true; } // Original name: CLHNM_SetForceZero2Black @@ -112,9 +112,8 @@ void HnmPlayer::wantsSound(bool sound) { } // Original name: CLHNM_SetupSound -void HnmPlayer::setupSound(int16 numSounds, int16 length, int16 sampleSize, float rate, int16 mode) { - _soundChannel = new SoundChannel(mode); - _soundGroup = new SoundGroup(_vm, numSounds, length, sampleSize, rate, mode); +void HnmPlayer::setupSound(unsigned int rate, bool stereo, bool is16bits) { + _soundChannel = new CSoundChannel(_vm->_mixer, rate, stereo, is16bits); } // Original name: CLHNM_CloseSound @@ -124,11 +123,6 @@ void HnmPlayer::closeSound() { delete(_soundChannel); _soundChannel = nullptr; } - - if (_soundGroup) { - delete(_soundGroup); - _soundGroup = nullptr; - } } // Original name: CLHNM_LoadDecompTable @@ -484,8 +478,7 @@ bool HnmPlayer::nextElement() { } if (!_soundStarted) { - for (int16 i = 0; i < _pendingSounds; i++) - _soundGroup->playNextSample(_soundChannel); + _soundChannel->play(); _soundStarted = true; } @@ -510,12 +503,10 @@ bool HnmPlayer::nextElement() { if (!h6) { int sound_size = sz - 8; if (!_useAdpcm) { - _soundGroup->setDatas(_dataPtr, sound_size - 2, false); - if (_soundStarted) - _soundGroup->playNextSample(_soundChannel); - else - _pendingSounds++; + _soundChannel->queueBuffer(_dataPtr, sound_size - 2, false, _soundStarted); } else { +#if 0 + // Not used in Lost Eden int16 *sound_buffer = (int16 *)_soundGroup->getNextBuffer(); if (!_pendingSounds) { const int kDecompTableSize = 256 * sizeof(int16); @@ -529,6 +520,7 @@ bool HnmPlayer::nextElement() { _pendingSounds++; if (_soundStarted) _soundGroup->playNextSample(_soundChannel); +#endif } } else error("nextElement - unexpected flag"); @@ -545,7 +537,7 @@ bool HnmPlayer::nextElement() { } // Original name: CLHNM_GetSoundChannel -SoundChannel *HnmPlayer::getSoundChannel() { +CSoundChannel *HnmPlayer::getSoundChannel() { return _soundChannel; } |