aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sfx
diff options
context:
space:
mode:
authorMartin Kiewitz2010-01-01 18:57:14 +0000
committerMartin Kiewitz2010-01-01 18:57:14 +0000
commit74159e12eb77dfc7c9fc47ecd962395aa8fbbbab (patch)
tree4be1352c8302b547d9553f36c627ba0079985d95 /engines/sci/sfx
parent64d484bd99f0fef9ed56f075fdab8856bfa5fb26 (diff)
downloadscummvm-rg350-74159e12eb77dfc7c9fc47ecd962395aa8fbbbab.tar.gz
scummvm-rg350-74159e12eb77dfc7c9fc47ecd962395aa8fbbbab.tar.bz2
scummvm-rg350-74159e12eb77dfc7c9fc47ecd962395aa8fbbbab.zip
SCI/newmusic: set speech soundtype for audio resources played by kDoSound, cmdVolume is supposed to set music and sfx volume only - this whole fixes volume issues in lb2cd and others
svn-id: r46842
Diffstat (limited to 'engines/sci/sfx')
-rw-r--r--engines/sci/sfx/music.cpp9
-rw-r--r--engines/sci/sfx/music.h2
-rw-r--r--engines/sci/sfx/soundcmd.cpp8
3 files changed, 13 insertions, 6 deletions
diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp
index 95d5af3f1b..2287151a89 100644
--- a/engines/sci/sfx/music.cpp
+++ b/engines/sci/sfx/music.cpp
@@ -333,10 +333,12 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) {
delete pSnd->pStreamAud;
pSnd->pStreamAud = Audio::makeLinearInputStream(channelData, track->digitalSampleSize, track->digitalSampleRate,
Audio::Mixer::FLAG_UNSIGNED, 0, 0);
+ pSnd->soundType = Audio::Mixer::kSFXSoundType;
pSnd->hCurrentAud = Audio::SoundHandle();
} else {
// play MIDI track
_mutex.lock();
+ pSnd->soundType = Audio::Mixer::kMusicSoundType;
if (pSnd->pMidiParser == NULL) {
pSnd->pMidiParser = new MidiParser_SCI();
pSnd->pMidiParser->setMidiDriver(_pMidiDrv);
@@ -385,7 +387,7 @@ void SciMusic::soundPlay(MusicEntry *pSnd) {
pSnd->pStreamAud->setNumLoops(loop);
else
pSnd->pStreamAud->setNumLoops(1);
- _pMixer->playInputStream(Audio::Mixer::kSFXSoundType, &pSnd->hCurrentAud,
+ _pMixer->playInputStream(pSnd->soundType, &pSnd->hCurrentAud,
pSnd->pStreamAud, -1, pSnd->volume, 0, false);
} else if (pSnd->pMidiParser) {
_mutex.lock();
@@ -486,10 +488,9 @@ uint16 SciMusic::soundGetMasterVolume() {
void SciMusic::soundSetMasterVolume(uint16 vol) {
vol = vol & 0xF; // 0..15
vol = vol * Audio::Mixer::kMaxMixerVolume / 0xF;
+ // "master volume" is music and SFX only, speech (audio resources) are supposed to be unaffected
_pMixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, vol);
_pMixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, vol);
- _pMixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, vol);
- _pMixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, vol);
}
void SciMusic::printPlayList(Console *con) {
@@ -528,6 +529,8 @@ MusicEntry::MusicEntry() {
status = kSoundStopped;
+ soundType = Audio::Mixer::kMusicSoundType;
+
pStreamAud = 0;
pMidiParser = 0;
}
diff --git a/engines/sci/sfx/music.h b/engines/sci/sfx/music.h
index 09c73b3890..a9ff38f688 100644
--- a/engines/sci/sfx/music.h
+++ b/engines/sci/sfx/music.h
@@ -92,6 +92,8 @@ public:
SoundStatus status;
+ Audio::Mixer::SoundType soundType;
+
#ifndef USE_OLD_MUSIC_FUNCTIONS
//protected:
#endif
diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp
index 1d02b422e9..5ebbfb1206 100644
--- a/engines/sci/sfx/soundcmd.cpp
+++ b/engines/sci/sfx/soundcmd.cpp
@@ -296,6 +296,7 @@ void SoundCommandParser::cmdInitHandle(reg_t obj, int16 value) {
// Found a relevant audio resource, play it
int sampleLen;
newSound->pStreamAud = _audio->getAudioStream(number, 65535, &sampleLen);
+ newSound->soundType = Audio::Mixer::kSpeechSoundType;
} else {
if (newSound->soundRes)
_music->soundInitSnd(newSound);
@@ -590,9 +591,10 @@ void SoundCommandParser::cmdVolume(reg_t obj, int16 value) {
_acc = make_reg(0, _state->sfx_getVolume());
#else
- if (value > 0)
- _music->soundSetMasterVolume(obj.toSint16());
- _acc = make_reg(0, _music->soundGetMasterVolume());
+ debugC(2, kDebugLevelSound, "cmdVolume: %d", value);
+ if (value > 0)
+ _music->soundSetMasterVolume(obj.toSint16());
+ _acc = make_reg(0, _music->soundGetMasterVolume());
#endif
}