aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/sound.cpp25
-rw-r--r--sky/intro.cpp6
-rw-r--r--sky/sound.cpp8
-rw-r--r--sound/mixer.cpp4
-rw-r--r--sound/mixer.h2
-rw-r--r--sword2/driver/d_sound.cpp10
6 files changed, 29 insertions, 26 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 0dca559117..6998877947 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -214,7 +214,7 @@ void Sound::playSound(int soundID) {
// Allocate a sound buffer, copy the data into it, and play
sound = (char *)malloc(size);
memcpy(sound, ptr, size);
- _scumm->_mixer->playRaw(NULL, sound, size, rate, flags, 255, 0, soundID);
+ _scumm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID);
return;
}
// Support for Putt-Putt sounds - very hackish, too 8-)
@@ -232,7 +232,7 @@ void Sound::playSound(int soundID) {
// Allocate a sound buffer, copy the data into it, and play
sound = (char *)malloc(size);
memcpy(sound, ptr + 8, size);
- _scumm->_mixer->playRaw(NULL, sound, size, rate, flags, 255, 0, soundID);
+ _scumm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID);
return;
}
else if (READ_UINT32(ptr) == MKID('MRAW')) {
@@ -249,7 +249,7 @@ void Sound::playSound(int soundID) {
// Allocate a sound buffer, copy the data into it, and play
sound = (char *)malloc(size);
memcpy(sound, ptr + 8, size);
- _scumm->_mixer->playRaw(NULL, sound, size, rate, flags, 255, 0, soundID);
+ _scumm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID);
return;
}
@@ -318,7 +318,7 @@ void Sound::playSound(int soundID) {
// Allocate a sound buffer, copy the data into it, and play
sound = (char *)malloc(size);
memcpy(sound, ptr + 33, size);
- _scumm->_mixer->playRaw(NULL, sound, size, rate, flags, 255, 0, soundID);
+ _scumm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID);
return;
} else if (_scumm->_features & GF_FMTOWNS) {
size = READ_LE_UINT32(ptr);
@@ -361,7 +361,7 @@ void Sound::playSound(int soundID) {
}
}
- _scumm->_mixer->playRaw(NULL, sound, waveSize, rate, flags, 255, 0, soundID, loopStart, loopEnd);
+ _scumm->_mixer->playRaw(NULL, sound, waveSize, rate, flags, soundID, 255, 0, loopStart, loopEnd);
}
break;
}
@@ -446,11 +446,12 @@ void Sound::playSound(int soundID) {
if ((_scumm->_features & GF_AMIGA) && (READ_BE_UINT16(ptr + 16) || READ_BE_UINT16(ptr + 6))) {
// the first check is for pitch-bending looped sounds (i.e. "pouring liquid", "biplane dive", etc.)
// the second check is for simple looped sounds
+ int loopStart = READ_BE_UINT16(ptr + 10) - READ_BE_UINT16(ptr + 8);
+ int loopEnd = READ_BE_UINT16(ptr + 14);
_scumm->_mixer->playRaw(NULL, sound, size, rate,
- SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_LOOP, vol, 0, soundID,
- READ_BE_UINT16(ptr + 10) - READ_BE_UINT16(ptr + 8), READ_BE_UINT16(ptr + 14));
+ SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_LOOP, soundID, vol, 0, loopStart, loopEnd);
} else {
- _scumm->_mixer->playRaw(NULL, sound, size, rate, SoundMixer::FLAG_AUTOFREE, vol, 0, soundID);
+ _scumm->_mixer->playRaw(NULL, sound, size, rate, SoundMixer::FLAG_AUTOFREE, soundID, vol, 0);
}
return;
}
@@ -477,10 +478,10 @@ void Sound::playSound(int soundID) {
// Experimental sound looping support
if (start == 108 || start == 106)
_scumm->_mixer->playRaw(NULL, sound, size, rate,
- SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_LOOP, vol, 0, soundID,
+ SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_LOOP, soundID, vol, 0,
start, size);
else
- _scumm->_mixer->playRaw(NULL, sound, size, rate, SoundMixer::FLAG_AUTOFREE, vol, 0, soundID);
+ _scumm->_mixer->playRaw(NULL, sound, size, rate, SoundMixer::FLAG_AUTOFREE, soundID, vol, 0);
return;
}
}
@@ -1376,12 +1377,12 @@ void Sound::playBundleSound(char *sound, PlayingSoundHandle *handle) {
_scumm->_mixer->stopHandle(*handle);
if (bits == 8) {
- _scumm->_mixer->playRaw(handle, final, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE, 255, pan);
+ _scumm->_mixer->playRaw(handle, final, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE, -1, 255, pan);
} else if (bits == 16) {
// FIXME: For some weird reasons, sometimes we get an odd size, even though
// the data is supposed to be in 16 bit format... that makes no sense...
size &= ~1;
- _scumm->_mixer->playRaw(handle, final, size, rate, SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE, 255, pan);
+ _scumm->_mixer->playRaw(handle, final, size, rate, SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE, -1, 255, pan);
} else {
warning("Sound::playBundleSound() to do more options to playRaw...");
}
diff --git a/sky/intro.cpp b/sky/intro.cpp
index 5c4ab9968f..4ed7bf7fa3 100644
--- a/sky/intro.cpp
+++ b/sky/intro.cpp
@@ -718,7 +718,7 @@ bool SkyIntro::nextPart(uint16 *&data) {
// directly, but this will have to do for now.
memset(vData, 127, sizeof(struct dataFileHeader));
_mixer->playRaw(&_voice, vData, _skyDisk->_lastLoadedFileSize, 11025,
- SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED, 255, 0, SOUND_VOICE);
+ SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED, SOUND_VOICE);
return true;
case WAITVOICE:
while (_voice)
@@ -735,12 +735,12 @@ bool SkyIntro::nextPart(uint16 *&data) {
case LOOPBG:
_mixer->stopID(SOUND_BG);
_mixer->playRaw(&_bgSfx, _bgBuf + 256, _bgSize - 768, 11025,
- SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_LOOP, 255, 0, SOUND_BG);
+ SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_LOOP, SOUND_BG);
return true;
case PLAYBG:
_mixer->stopID(SOUND_BG);
_mixer->playRaw(&_bgSfx, _bgBuf + 256, _bgSize - 768, 11025,
- SoundMixer::FLAG_UNSIGNED, 255, 0, SOUND_BG);
+ SoundMixer::FLAG_UNSIGNED, SOUND_BG);
return true;
case STOPBG:
_mixer->stopID(SOUND_BG);
diff --git a/sky/sound.cpp b/sky/sound.cpp
index 50de6293b3..0488557506 100644
--- a/sky/sound.cpp
+++ b/sky/sound.cpp
@@ -1054,7 +1054,7 @@ int SkySound::playSound(uint32 id, byte *sound, uint32 size, PlayingSoundHandle
memcpy(buffer, sound+sizeof(struct dataFileHeader), size);
_mixer->stopID(id);
- return _mixer->playRaw(handle, buffer, size, 11025, flags, 255, 0, id);
+ return _mixer->playRaw(handle, buffer, size, 11025, flags, id);
}
void SkySound::loadSection(uint8 pSection) {
@@ -1130,9 +1130,9 @@ void SkySound::playSound(uint16 sound, uint16 volume, uint8 channel) {
_mixer->setVolume(volume);
if (channel == 0)
- _mixer->playRaw(&_ingameSound0, _soundData + dataOfs, dataSize, sampleRate, flags, 255, 0, SOUND_CH0, loopSta, loopEnd);
+ _mixer->playRaw(&_ingameSound0, _soundData + dataOfs, dataSize, sampleRate, flags, SOUND_CH0, loopSta, loopEnd);
else
- _mixer->playRaw(&_ingameSound1, _soundData + dataOfs, dataSize, sampleRate, flags, 255, 0, SOUND_CH1, loopSta, loopEnd);
+ _mixer->playRaw(&_ingameSound1, _soundData + dataOfs, dataSize, sampleRate, flags, SOUND_CH1, loopSta, loopEnd);
}
void SkySound::fnStartFx(uint32 sound, uint8 channel) {
@@ -1251,6 +1251,6 @@ bool SkySound::startSpeech(uint16 textNum) {
free(speechData);
_mixer->stopID(SOUND_SPEECH);
- _mixer->playRaw(&_ingameSpeech, playBuffer, speechSize, 11025, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE, 255, 0, SOUND_SPEECH);
+ _mixer->playRaw(&_ingameSpeech, playBuffer, speechSize, 11025, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE, SOUND_SPEECH);
return true;
}
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index 04c931238e..fe9c43a65c 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 {
@@ -246,7 +248,7 @@ int SoundMixer::insertChannel(PlayingSoundHandle *handle, Channel *chan) {
return index;
}
-int SoundMixer::playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, byte volume, int8 pan, int id, uint32 loopStart, uint32 loopEnd) {
+int SoundMixer::playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, int id, byte volume, int8 pan, uint32 loopStart, uint32 loopEnd) {
StackLock lock(_mutex);
// Prevent duplicate sounds
diff --git a/sound/mixer.h b/sound/mixer.h
index 415c73b9b1..8fd7883418 100644
--- a/sound/mixer.h
+++ b/sound/mixer.h
@@ -90,7 +90,7 @@ public:
// start playing a raw sound
int playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags,
- byte volume = 255, int8 pan = 0, int id = -1, uint32 loopStart = 0, uint32 loopEnd = 0);
+ int id = -1, byte volume = 255, int8 pan = 0, uint32 loopStart = 0, uint32 loopEnd = 0);
#ifdef USE_MAD
int playMP3(PlayingSoundHandle *handle, File *file, uint32 size, byte volume = 255, int8 pan = 0);
int playMP3CDTrack(PlayingSoundHandle *handle, File *file, mad_timer_t duration, byte volume = 255, int8 pan = 0);
diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp
index fc03cdf8ca..750d81bb7b 100644
--- a/sword2/driver/d_sound.cpp
+++ b/sword2/driver/d_sound.cpp
@@ -564,7 +564,7 @@ int32 Sword2Sound::PlayCompSpeech(const char *filename, uint32 speechid, uint8 v
for (uint j = 0; j < (bufferSize / 2); j++)
data16[j] = TO_BE_16(data16[j]);
- _mixer->playRaw(&soundHandleSpeech, data16, bufferSize, 22050, flags, volume, pan);
+ _mixer->playRaw(&soundHandleSpeech, data16, bufferSize, 22050, flags, -1, volume, pan);
speechStatus = 1;
}
@@ -755,7 +755,7 @@ int32 Sword2Sound::PlayFx(int32 id, uint8 *data, uint8 vol, int8 pan, uint8 type
} else {
volume = musicVolTable[volMusic[0]];
}
- g_engine->_mixer->playRaw(&soundHandleFx[i], bufferFx[i], bufferSizeFx[i], fxRate[i], flagsFx[i], volume, 0);
+ g_engine->_mixer->playRaw(&soundHandleFx[i], bufferFx[i], bufferSizeFx[i], fxRate[i], flagsFx[i], -1, volume, 0);
} else {
i = GetFxIndex(id);
if (i == MAXFX) {
@@ -779,7 +779,7 @@ int32 Sword2Sound::PlayFx(int32 id, uint8 *data, uint8 vol, int8 pan, uint8 type
}
p = panTable[pan + 16];
- g_engine->_mixer->playRaw(&soundHandleFx[i], bufferFx[i], bufferSizeFx[i], fxRate[i], flagsFx[i], volume, p);
+ g_engine->_mixer->playRaw(&soundHandleFx[i], bufferFx[i], bufferSizeFx[i], fxRate[i], flagsFx[i], -1, volume, p);
}
} else {
if (type == RDSE_FXLEADIN) {
@@ -801,7 +801,7 @@ int32 Sword2Sound::PlayFx(int32 id, uint8 *data, uint8 vol, int8 pan, uint8 type
} else {
volume = musicVolTable[volMusic[0]];
}
- g_engine->_mixer->playRaw(&soundHandleFx[i], bufferFx[i], bufferSizeFx[i], fxRate[i], flagsFx[i], volume, 0);
+ g_engine->_mixer->playRaw(&soundHandleFx[i], bufferFx[i], bufferSizeFx[i], fxRate[i], flagsFx[i], -1, volume, 0);
} else {
hr = OpenFx(id, data);
if (hr != RD_OK) {
@@ -828,7 +828,7 @@ int32 Sword2Sound::PlayFx(int32 id, uint8 *data, uint8 vol, int8 pan, uint8 type
volume = vol * fxVol;
}
p = panTable[pan + 16];
- g_engine->_mixer->playRaw(&soundHandleFx[i], bufferFx[i], bufferSizeFx[i], fxRate[i], flagsFx[i], volume, p);
+ g_engine->_mixer->playRaw(&soundHandleFx[i], bufferFx[i], bufferSizeFx[i], fxRate[i], flagsFx[i], -1, volume, p);
}
}
}