diff options
author | Max Horn | 2003-07-29 00:05:36 +0000 |
---|---|---|
committer | Max Horn | 2003-07-29 00:05:36 +0000 |
commit | 4e7c115681c1bf21de45027278decb0e52a644c1 (patch) | |
tree | 3a75937f0642e7284c9c03da8daad693cc8200ea /sound | |
parent | c62b74a08fa055b0c9bdd9e9719a54edeff98b12 (diff) | |
download | scummvm-rg350-4e7c115681c1bf21de45027278decb0e52a644c1.tar.gz scummvm-rg350-4e7c115681c1bf21de45027278decb0e52a644c1.tar.bz2 scummvm-rg350-4e7c115681c1bf21de45027278decb0e52a644c1.zip |
cleanup
svn-id: r9266
Diffstat (limited to 'sound')
-rw-r--r-- | sound/mixer.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp index 8d8fe35308..e52c615a8f 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -130,7 +130,7 @@ protected: uint32 _size; public: - ChannelMP3Common(SoundMixer *mixer, PlayingSoundHandle *handle, uint32 rate); + ChannelMP3Common(SoundMixer *mixer, PlayingSoundHandle *handle); ~ChannelMP3Common(); }; @@ -139,7 +139,7 @@ class ChannelMP3 : public ChannelMP3Common { uint32 _position; public: - ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, uint32 rate, void *sound, uint size, byte flags); + ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, void *sound, uint size, byte flags); void mix(int16 *data, uint len); bool isMusicChannel() { return false; } @@ -151,9 +151,8 @@ class ChannelMP3CDMusic : public ChannelMP3Common { File *_file; bool _initialized; - public: - ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *handle, uint32 rate, File *file, mad_timer_t duration); + ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, mad_timer_t duration); void mix(int16 *data, uint len); bool isActive(); @@ -280,11 +279,11 @@ int SoundMixer::playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, ui #ifdef USE_MAD int SoundMixer::playMP3(PlayingSoundHandle *handle, void *sound, uint32 size, byte flags) { StackLock lock(_mutex); - return insertChannel(handle, new ChannelMP3(this, handle, _syst->property(OSystem::PROP_GET_SAMPLE_RATE, 0), sound, size, flags)); + return insertChannel(handle, new ChannelMP3(this, handle, sound, size, flags)); } int SoundMixer::playMP3CDTrack(PlayingSoundHandle *handle, File *file, mad_timer_t duration) { StackLock lock(_mutex); - return insertChannel(handle, new ChannelMP3CDMusic(this, handle, _syst->property(OSystem::PROP_GET_SAMPLE_RATE, 0), file, duration)); + return insertChannel(handle, new ChannelMP3CDMusic(this, handle, file, duration)); } #endif @@ -919,12 +918,12 @@ void ChannelStream::mix(int16 *data, uint len) { #ifdef USE_MAD -ChannelMP3Common::ChannelMP3Common(SoundMixer *mixer, PlayingSoundHandle *handle, uint32 rate) +ChannelMP3Common::ChannelMP3Common(SoundMixer *mixer, PlayingSoundHandle *handle) : Channel(mixer, handle) { mad_stream_init(&_stream); #ifdef _WIN32_WCE // Lower sample rate to 11 kHz on WinCE if necessary - if (rate != 22050) + if (_syst->property(OSystem::PROP_GET_SAMPLE_RATE, 0) != 22050) mad_stream_options(&_stream, MAD_OPTION_HALFSAMPLERATE); #endif mad_frame_init(&_frame); @@ -939,8 +938,8 @@ ChannelMP3Common::~ChannelMP3Common() { mad_stream_finish(&_stream); } -ChannelMP3::ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, uint32 rate, void *sound, uint size, byte flags) - : ChannelMP3Common(mixer, handle, rate) { +ChannelMP3::ChannelMP3(SoundMixer *mixer, PlayingSoundHandle *handle, void *sound, uint size, byte flags) + : ChannelMP3Common(mixer, handle) { _posInFrame = 0xFFFFFFFF; _position = 0; _size = size; @@ -967,7 +966,7 @@ static inline int scale_sample(mad_fixed_t sample) { sample += (1L << (MAD_F_FRACBITS - 16)); /* clip */ - if (sample >= MAD_F_ONE) + if (sample > MAD_F_ONE - 1) sample = MAD_F_ONE - 1; else if (sample < -MAD_F_ONE) sample = -MAD_F_ONE; @@ -1029,8 +1028,8 @@ void ChannelMP3::mix(int16 *data, uint len) { #define MP3CD_BUFFERING_SIZE 131072 -ChannelMP3CDMusic::ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *handle, uint32 rate, File *file, mad_timer_t duration) - : ChannelMP3Common(mixer, handle, rate) { +ChannelMP3CDMusic::ChannelMP3CDMusic(SoundMixer *mixer, PlayingSoundHandle *handle, File *file, mad_timer_t duration) + : ChannelMP3Common(mixer, handle) { _file = file; _duration = duration; _initialized = false; |