aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMax Horn2003-08-05 18:17:26 +0000
committerMax Horn2003-08-05 18:17:26 +0000
commit7ff88ea392f430ccc78fdd0503136d8ed1aac036 (patch)
tree80e484586a99c0b55849c2be14929576771dba27 /sound
parent79fd7ee44117f762b4253bc0e9521c38cdafbb08 (diff)
downloadscummvm-rg350-7ff88ea392f430ccc78fdd0503136d8ed1aac036.tar.gz
scummvm-rg350-7ff88ea392f430ccc78fdd0503136d8ed1aac036.tar.bz2
scummvm-rg350-7ff88ea392f430ccc78fdd0503136d8ed1aac036.zip
more cleanup
svn-id: r9513
Diffstat (limited to 'sound')
-rw-r--r--sound/audiostream.cpp7
-rw-r--r--sound/mixer.cpp22
2 files changed, 11 insertions, 18 deletions
diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp
index 5a25d61468..3c2405a0b9 100644
--- a/sound/audiostream.cpp
+++ b/sound/audiostream.cpp
@@ -207,7 +207,6 @@ class MP3InputStream : public MusicStream {
int _curChannel;
File *_file;
byte *_ptr;
- int _rate;
bool init();
void refill(bool first = false);
@@ -222,7 +221,7 @@ public:
bool eos() const { return eosIntern(); }
bool isStereo() const { return _isStereo; }
- int getRate() const { return _rate; }
+ int getRate() const { return _frame.header.samplerate; }
};
@@ -251,7 +250,6 @@ MP3InputStream::MP3InputStream(File *file, mad_timer_t duration, uint size) {
_curChannel = 0;
_file = file;
_ptr = (byte *)malloc(_bufferSize + MAD_BUFFER_GUARD);
- _rate = 0;
init();
@@ -303,9 +301,6 @@ bool MP3InputStream::init() {
return false;
}
- // Determine the sample rate
- _rate = _frame.header.samplerate;
-
return true;
}
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index 1cd63ea5b2..ea19bbe4eb 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -67,12 +67,7 @@ public:
const int volume = isMusicChannel() ? _mixer->getMusicVolume() : _mixer->getVolume();
_converter->flow(*_input, data, len, volume);
}
- void destroy() {
- for (int i = 0; i != SoundMixer::NUM_CHANNELS; i++)
- if (_mixer->_channels[i] == this)
- _mixer->_channels[i] = 0;
- delete this;
- }
+ void destroy();
virtual bool isMusicChannel() const = 0;
};
@@ -140,12 +135,7 @@ public:
16 bits, for a total of 40 bytes.
*/
virtual void mix(int16 *data, uint len) = 0;
- void destroy() {
- for (int i = 0; i != SoundMixer::NUM_CHANNELS; i++)
- if (_mixer->_channels[i] == this)
- _mixer->_channels[i] = 0;
- delete this;
- }
+ void destroy();
virtual bool isMusicChannel() const = 0;
};
@@ -244,6 +234,13 @@ public:
#endif
+void Channel::destroy() {
+ for (int i = 0; i != SoundMixer::NUM_CHANNELS; i++)
+ if (_mixer->_channels[i] == this)
+ _mixer->_channels[i] = 0;
+ delete this;
+}
+
SoundMixer::SoundMixer() {
_syst = 0;
_mutex = 0;
@@ -365,6 +362,7 @@ void SoundMixer::mix(int16 *buf, uint len) {
if (_premixProc && !_paused) {
int i;
_premixProc(_premixParam, buf, len);
+ // Convert mono data from the premix proc to stereo
for (i = (len - 1); i >= 0; i--) {
buf[2 * i] = buf[2 * i + 1] = buf[i];
}