diff options
author | Paul Gilbert | 2018-12-08 20:22:31 -0800 |
---|---|---|
committer | Paul Gilbert | 2018-12-08 20:22:31 -0800 |
commit | 867adc6dcac3969863f933435bf98012e52c90aa (patch) | |
tree | f9b7346ba494a0c0a497ed67ed55d1fe0da662ca /engines/glk/sound.cpp | |
parent | 34d01af00482cde23de2913e383c409fd82d96c7 (diff) | |
download | scummvm-rg350-867adc6dcac3969863f933435bf98012e52c90aa.tar.gz scummvm-rg350-867adc6dcac3969863f933435bf98012e52c90aa.tar.bz2 scummvm-rg350-867adc6dcac3969863f933435bf98012e52c90aa.zip |
GLK: Sound volume and pausing methods
Diffstat (limited to 'engines/glk/sound.cpp')
-rw-r--r-- | engines/glk/sound.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/engines/glk/sound.cpp b/engines/glk/sound.cpp index 02fb7f9253..0e3fbf48ee 100644 --- a/engines/glk/sound.cpp +++ b/engines/glk/sound.cpp @@ -144,10 +144,29 @@ void SoundChannel::stop() { } void SoundChannel::poll() { - if (!g_vm->_mixer->isSoundHandleActive(_handle) && _notify != 0) - g_vm->_events->store(evtype_SoundNotify, 0, - _soundNum, _notify); + if (!g_vm->_mixer->isSoundHandleActive(_handle) && _notify != 0) { + glui32 notify = _notify; + _notify = 0; + g_vm->_events->store(evtype_SoundNotify, nullptr, _soundNum, notify); + } +} + +void SoundChannel::setVolume(uint volume, uint duration, uint notify) { + uint newVol = volume * 255 / 0x10000; + g_vm->_mixer->setChannelVolume(_handle, newVol); + + if (notify) { + warning("TODO: Gradual volume change"); + g_vm->_events->store(evtype_VolumeNotify, nullptr, 0, notify); + } +} + +void SoundChannel::pause() { + g_vm->_mixer->pauseHandle(_handle, true); +} +void SoundChannel::unpause() { + g_vm->_mixer->pauseHandle(_handle, false); } } // End of namespace Glk |