diff options
author | Strangerke | 2017-01-02 14:49:49 -0800 |
---|---|---|
committer | Eugene Sandulenko | 2017-01-25 22:42:20 +0100 |
commit | c667702f2c6f9e4adc301eb0a11f4c3c327076ad (patch) | |
tree | 59abb4cb13356a159fbf37acea7b110ba0d0f398 /engines/cryo/cryolib.cpp | |
parent | 448fe6303b0f4a5c33862ddaac0f8556b33d2f37 (diff) | |
download | scummvm-rg350-c667702f2c6f9e4adc301eb0a11f4c3c327076ad.tar.gz scummvm-rg350-c667702f2c6f9e4adc301eb0a11f4c3c327076ad.tar.bz2 scummvm-rg350-c667702f2c6f9e4adc301eb0a11f4c3c327076ad.zip |
CRYO: Change soundchannel_t into a class
Diffstat (limited to 'engines/cryo/cryolib.cpp')
-rw-r--r-- | engines/cryo/cryolib.cpp | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/engines/cryo/cryolib.cpp b/engines/cryo/cryolib.cpp index dbc279f969..3aa6e997d6 100644 --- a/engines/cryo/cryolib.cpp +++ b/engines/cryo/cryolib.cpp @@ -358,52 +358,48 @@ void CLSound_SetLength(sound_t *sound, int length) { ///// CLSoundChannel /// sound output device that plays queue of sounds -soundchannel_t *CLSoundChannel_New(int arg1) { - soundchannel_t *ch = (soundchannel_t *)malloc(sizeof(*ch)); - if (!ch) - return nullptr; - - ch->_volumeLeft = ch->_volumeRight = 255; - ch->_numSounds = 0; +soundchannel_t::soundchannel_t(int arg1) { + _volumeLeft = _volumeRight = 255; + _numSounds = 0; for (int16 i = 0; i < kCryoMaxChSounds; i++) - ch->_sounds[i] = nullptr; - - return ch; + _sounds[i] = nullptr; } -void CLSoundChannel_Free(soundchannel_t *ch) { - free(ch); +soundchannel_t::~soundchannel_t() { } -void CLSoundChannel_Stop(soundchannel_t *ch) { - // _vm->_mixer->stopHandle(ch->ch); +void soundchannel_t::stop() { + // _vm->_mixer->stopHandle(this); } -void CLSoundChannel_Play(soundchannel_t *ch, sound_t *sound) { +void soundchannel_t::play(sound_t *sound) { } -int16 CLSoundChannel_GetVolume(soundchannel_t *ch) { - return (ch->_volumeLeft + ch->_volumeRight) / 2; +int16 soundchannel_t::getVolume() { + return (_volumeLeft + _volumeRight) / 2; } -void CLSoundChannel_SetVolume(soundchannel_t *ch, int16 volume) { +void soundchannel_t::setVolume(int16 volume) { if (volume < 0 || volume > 255) return; - ch->_volumeLeft = volume; - ch->_volumeRight = volume; + + _volumeLeft = volume; + _volumeRight = volume; } -void CLSoundChannel_SetVolumeRight(soundchannel_t *ch, int16 volume) { +void soundchannel_t::setVolumeRight(int16 volume) { if (volume < 0 || volume > 255) return; - ch->_volumeRight = volume; + + _volumeRight = volume; } -void CLSoundChannel_SetVolumeLeft(soundchannel_t *ch, int16 volume) { +void soundchannel_t::setVolumeLeft(int16 volume) { if (volume < 0 || volume > 255) return; - ch->_volumeLeft = volume; + + _volumeLeft = volume; } ///// CLTimer |