diff options
author | Max Horn | 2003-09-05 20:48:32 +0000 |
---|---|---|
committer | Max Horn | 2003-09-05 20:48:32 +0000 |
commit | 11193b0746b0ac2962c98255663dd1beef3fc2a1 (patch) | |
tree | e35e14acbfe673dc1db661ab17cbd7d37aa89274 /sound/mixer.cpp | |
parent | 5f2b0b697735652f91a88ed6e4d038d600412c95 (diff) | |
download | scummvm-rg350-11193b0746b0ac2962c98255663dd1beef3fc2a1.tar.gz scummvm-rg350-11193b0746b0ac2962c98255663dd1beef3fc2a1.tar.bz2 scummvm-rg350-11193b0746b0ac2962c98255663dd1beef3fc2a1.zip |
cleaned up sound/mixer.h a bit; renamed some mixer methods for consistency
svn-id: r10018
Diffstat (limited to 'sound/mixer.cpp')
-rw-r--r-- | sound/mixer.cpp | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp index a032060eef..34ccdad7b1 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -68,6 +68,8 @@ public: _volume = volume; } virtual void setChannelPan(const int8 pan) { + if (pan != 0) + printf("Pan set to %d\n", pan); _pan = pan; } virtual int getVolume() const { @@ -151,6 +153,23 @@ SoundMixer::~SoundMixer() { _syst->delete_mutex(_mutex); } +bool SoundMixer::bindToSystem(OSystem *syst) { + _syst = syst; + _mutex = _syst->create_mutex(); + _outputRate = (uint) syst->property(OSystem::PROP_GET_SAMPLE_RATE, 0); + + if (_outputRate == 0) + error("OSystem returned invalid sample rate"); + + return syst->set_sound_proc(mixCallback, this, OSystem::SOUND_16BIT); +} + +void SoundMixer::setupPremix(void *param, PremixProc *proc) { + StackLock lock(_mutex); + _premixParam = param; + _premixProc = proc; +} + int SoundMixer::newStream(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, uint32 buffer_size, byte volume, int8 pan) { StackLock lock(_mutex); return insertChannel(handle, new ChannelStream(this, handle, sound, size, rate, flags, buffer_size, volume, pan)); @@ -291,17 +310,6 @@ void SoundMixer::mixCallback(void *s, byte *samples, int len) { ((SoundMixer *)s)->mix((int16 *)samples, len >> 2); } -bool SoundMixer::bindToSystem(OSystem *syst) { - _syst = syst; - _mutex = _syst->create_mutex(); - _outputRate = (uint) syst->property(OSystem::PROP_GET_SAMPLE_RATE, 0); - - if (_outputRate == 0) - error("OSystem returned invalid sample rate"); - - return syst->set_sound_proc(mixCallback, this, OSystem::SOUND_16BIT); -} - void SoundMixer::stopAll() { StackLock lock(_mutex); for (int i = 0; i != NUM_CHANNELS; i++) @@ -382,11 +390,14 @@ void SoundMixer::setChannelPan(PlayingSoundHandle handle, int8 pan) { _channels[index]->setChannelPan(pan); } -void SoundMixer::pause(bool paused) { +void SoundMixer::pauseMixer(bool paused) { + // TODO/FIXME: This is only used by scumm/sound.cpp, and + // even there it can probably be replaced by a call to pauseAll. + // Research that, and if possible remove this method. _paused = paused; } -void SoundMixer::pauseChannels(bool paused) { +void SoundMixer::pauseAll(bool paused) { _channelsPaused = paused; } @@ -441,12 +452,6 @@ bool SoundMixer::hasActiveSFXChannel() { return false; } -void SoundMixer::setupPremix(void *param, PremixProc *proc) { - StackLock lock(_mutex); - _premixParam = param; - _premixProc = proc; -} - void SoundMixer::setVolume(int volume) { // Check range if (volume > 256) |