diff options
| author | Paweł Kołodziejski | 2003-09-05 06:22:10 +0000 |
|---|---|---|
| committer | Paweł Kołodziejski | 2003-09-05 06:22:10 +0000 |
| commit | 7bc63a0ce33336684c8b690fea639e79ebbf5d32 (patch) | |
| tree | a0cc9100b579dfef69ba31ac7a1b43564a7efc50 /sound | |
| parent | fccc9a2abb3adfd5620f0f6ce5033c8c58210ad9 (diff) | |
| download | scummvm-rg350-7bc63a0ce33336684c8b690fea639e79ebbf5d32.tar.gz scummvm-rg350-7bc63a0ce33336684c8b690fea639e79ebbf5d32.tar.bz2 scummvm-rg350-7bc63a0ce33336684c8b690fea639e79ebbf5d32.zip | |
fixes for uninitialized pan and volume
svn-id: r9998
Diffstat (limited to 'sound')
| -rw-r--r-- | sound/mixer.cpp | 32 | ||||
| -rw-r--r-- | sound/mixer.h | 6 |
2 files changed, 22 insertions, 16 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp index b6b3a5d665..a032060eef 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -52,7 +52,7 @@ public: int _id; Channel(SoundMixer *mixer, PlayingSoundHandle *handle) - : _mixer(mixer), _handle(handle), _converter(0), _input(0), _paused(false), _id(-1) { + : _mixer(mixer), _handle(handle), _converter(0), _input(0), _volume(0), _pan(0), _paused(false), _id(-1) { assert(mixer); } virtual ~Channel(); @@ -97,13 +97,13 @@ public: #ifdef USE_MAD class ChannelMP3 : public Channel { public: - ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, uint size); + ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, uint size, byte volume, int8 pan); bool isMusicChannel() const { return false; } }; class ChannelMP3CDMusic : public Channel { public: - ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, mad_timer_t duration); + ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, mad_timer_t duration, byte volume, int8 pan); bool isMusicChannel() const { return true; } }; #endif // USE_MAD @@ -112,7 +112,7 @@ public: class ChannelVorbis : public Channel { bool _is_cd_track; public: - ChannelVorbis(SoundMixer *mixer, PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool is_cd_track); + ChannelVorbis(SoundMixer *mixer, PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool is_cd_track, byte volume, int8 pan); bool isMusicChannel() const { return _is_cd_track; } }; #endif // USE_VORBIS @@ -243,20 +243,20 @@ int SoundMixer::playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, ui } #ifdef USE_MAD -int SoundMixer::playMP3(PlayingSoundHandle *handle, File *file, uint32 size) { +int SoundMixer::playMP3(PlayingSoundHandle *handle, File *file, uint32 size, byte volume, int8 pan) { StackLock lock(_mutex); - return insertChannel(handle, new ChannelMP3(this, handle, file, size)); + return insertChannel(handle, new ChannelMP3(this, handle, file, size, volume, pan)); } -int SoundMixer::playMP3CDTrack(PlayingSoundHandle *handle, File *file, mad_timer_t duration) { +int SoundMixer::playMP3CDTrack(PlayingSoundHandle *handle, File *file, mad_timer_t duration, byte volume, int8 pan) { StackLock lock(_mutex); - return insertChannel(handle, new ChannelMP3CDMusic(this, handle, file, duration)); + return insertChannel(handle, new ChannelMP3CDMusic(this, handle, file, duration, volume, pan)); } #endif #ifdef USE_VORBIS -int SoundMixer::playVorbis(PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool is_cd_track) { +int SoundMixer::playVorbis(PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool is_cd_track, byte volume, int8 pan) { StackLock lock(_mutex); - return insertChannel(handle, new ChannelVorbis(this, handle, ov_file, duration, is_cd_track)); + return insertChannel(handle, new ChannelVorbis(this, handle, ov_file, duration, is_cd_track, volume, pan)); } #endif @@ -578,8 +578,10 @@ void ChannelStream::mix(int16 *data, uint len) { } #ifdef USE_MAD -ChannelMP3::ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, uint size) +ChannelMP3::ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, uint size, byte volume, int8 pan) : Channel(mixer, handle) { + _volume = volume; + _pan = pan; // Create the input stream _input = makeMP3Stream(file, mad_timer_zero, size); @@ -587,8 +589,10 @@ ChannelMP3::ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, File *file _converter = makeRateConverter(_input->getRate(), mixer->getOutputRate(), _input->isStereo()); } -ChannelMP3CDMusic::ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, mad_timer_t duration) +ChannelMP3CDMusic::ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, mad_timer_t duration, byte volume, int8 pan) : Channel(mixer, handle) { + _volume = volume; + _pan = pan; // Create the input stream _input = makeMP3Stream(file, duration, 0); @@ -598,8 +602,10 @@ ChannelMP3CDMusic::ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *hand #endif // USE_MAD #ifdef USE_VORBIS -ChannelVorbis::ChannelVorbis(SoundMixer *mixer, PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool is_cd_track) +ChannelVorbis::ChannelVorbis(SoundMixer *mixer, PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool is_cd_track, byte volume, int8 pan) : Channel(mixer, handle) { + _volume = volume; + _pan = pan; // Create the input stream _input = makeVorbisStream(ov_file, duration); diff --git a/sound/mixer.h b/sound/mixer.h index d139a2fcef..fba5917fd0 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -85,11 +85,11 @@ public: int playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, byte volume, int8 pan, int id = -1, uint32 loopStart = 0, uint32 loopEnd = 0); #ifdef USE_MAD - int playMP3(PlayingSoundHandle *handle, File *file, uint32 size); - int playMP3CDTrack(PlayingSoundHandle *handle, File *file, mad_timer_t duration); + int playMP3(PlayingSoundHandle *handle, File *file, uint32 size, byte volume, int8 pan); + int playMP3CDTrack(PlayingSoundHandle *handle, File *file, mad_timer_t duration, byte volume, int8 pan); #endif #ifdef USE_VORBIS - int playVorbis(PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool is_cd_track); + int playVorbis(PlayingSoundHandle *handle, OggVorbis_File *ov_file, int duration, bool is_cd_track, byte volume, int8 pan); #endif /** Premix procedure, useful when using fmopl adlib */ |
