aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/sound/soundmixer.cpp
diff options
context:
space:
mode:
authorSven Hesse2009-07-28 16:28:32 +0000
committerSven Hesse2009-07-28 16:28:32 +0000
commit550d9cf39de5fbbd1f4173d5b7bd955c7649995b (patch)
tree869ca4ccf769d286e5396990b7191563409f44d7 /engines/gob/sound/soundmixer.cpp
parentf5e9aa67c495a64117cc9d30596a34fbe21ef1d5 (diff)
downloadscummvm-rg350-550d9cf39de5fbbd1f4173d5b7bd955c7649995b.tar.gz
scummvm-rg350-550d9cf39de5fbbd1f4173d5b7bd955c7649995b.tar.bz2
scummvm-rg350-550d9cf39de5fbbd1f4173d5b7bd955c7649995b.zip
More alignment-related changes
svn-id: r42858
Diffstat (limited to 'engines/gob/sound/soundmixer.cpp')
-rw-r--r--engines/gob/sound/soundmixer.cpp25
1 files changed, 8 insertions, 17 deletions
diff --git a/engines/gob/sound/soundmixer.cpp b/engines/gob/sound/soundmixer.cpp
index 68a96d3b01..eb6d7882f0 100644
--- a/engines/gob/sound/soundmixer.cpp
+++ b/engines/gob/sound/soundmixer.cpp
@@ -33,8 +33,7 @@ SoundMixer::SoundMixer(Audio::Mixer &mixer, Audio::Mixer::SoundType type) : _mix
_rate = _mixer->getOutputRate();
_end = true;
- _data8 = 0;
- _data16 = 0;
+ _data = 0;
_length = 0;
_freq = 0;
_repCount = 0;
@@ -61,9 +60,9 @@ SoundMixer::~SoundMixer() {
inline int16 SoundMixer::getData(int offset) {
if (!_16bit)
- return (int16) _data8[offset];
+ return (int16) ((int8) _data[offset]);
else
- return (int16) FROM_LE_16(_data16[offset]);
+ return (int16) READ_LE_UINT16(_data + (offset * 2));
}
bool SoundMixer::isPlaying() const {
@@ -78,8 +77,7 @@ void SoundMixer::stop(int16 fadeLength) {
Common::StackLock slock(_mutex);
if (fadeLength <= 0) {
- _data8 = 0;
- _data16 = 0;
+ _data = 0;
_end = true;
_playingSound = 0;
return;
@@ -109,13 +107,7 @@ void SoundMixer::setSample(SoundDesc &sndDesc, int16 repCount, int16 frequency,
_16bit = (sndDesc._mixerFlags & Audio::Mixer::FLAG_16BITS) != 0;
- if (_16bit) {
- _data16 = (int16 *) sndDesc.getData();
- _shift = 0;
- } else {
- _data8 = (int8 *) sndDesc.getData();
- _shift = 8;
- }
+ _data = sndDesc.getData();
_length = sndDesc.size();
_freq = frequency;
@@ -171,7 +163,7 @@ int SoundMixer::readBuffer(int16 *buffer, const int numSamples) {
Common::StackLock slock(_mutex);
for (int i = 0; i < numSamples; i++) {
- if (!_data8 && !_data16)
+ if (!_data)
return i;
if (_end || (_offset >= _length))
checkEndSample();
@@ -181,7 +173,7 @@ int SoundMixer::readBuffer(int16 *buffer, const int numSamples) {
// Linear interpolation. See sound/rate.cpp
int16 val = (_last + (((_cur - _last) * _offsetFrac +
- FRAC_HALF) >> FRAC_BITS)) << _shift;
+ FRAC_HALF) >> FRAC_BITS)) << (_16bit ? 0 : 8);
*buffer++ = (val * _fadeVol) >> 16;
_offsetFrac += _offsetInc;
@@ -211,8 +203,7 @@ int SoundMixer::readBuffer(int16 *buffer, const int numSamples) {
void SoundMixer::endFade() {
if (_fadeVolStep > 0) {
- _data8 = 0;
- _data16 = 0;
+ _data = 0;
_end = true;
_playingSound = 0;
} else {