[Scummvm-cvs-logs] scummvm master -> 21028131cfb64538b3311b4d807cbbec14cfdcd0
dreammaster
dreammaster at scummvm.org
Sat Aug 15 18:30:58 CEST 2015
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
21028131cf SHERLOCK: RT: Implemented setMusicVolume, cleanup of sound code
Commit: 21028131cfb64538b3311b4d807cbbec14cfdcd0
https://github.com/scummvm/scummvm/commit/21028131cfb64538b3311b4d807cbbec14cfdcd0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-08-15T12:30:04-04:00
Commit Message:
SHERLOCK: RT: Implemented setMusicVolume, cleanup of sound code
Changed paths:
engines/sherlock/music.cpp
engines/sherlock/music.h
engines/sherlock/sound.cpp
engines/sherlock/sound.h
engines/sherlock/tattoo/tattoo_map.cpp
engines/sherlock/tattoo/tattoo_scene.cpp
engines/sherlock/tattoo/widget_options.cpp
diff --git a/engines/sherlock/music.cpp b/engines/sherlock/music.cpp
index ccaa6a4..99f7b45 100644
--- a/engines/sherlock/music.cpp
+++ b/engines/sherlock/music.cpp
@@ -574,8 +574,9 @@ bool Music::waitUntilMSec(uint32 msecTarget, uint32 msecMax, uint32 additionalDe
}
}
-void Music::setMIDIVolume(int volume) {
- warning("TODO: Music::setMIDIVolume");
+void Music::setMusicVolume(int volume) {
+ _musicVolume = volume;
+ _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, volume);
}
} // End of namespace Sherlock
diff --git a/engines/sherlock/music.h b/engines/sherlock/music.h
index 6605705..ca203da 100644
--- a/engines/sherlock/music.h
+++ b/engines/sherlock/music.h
@@ -120,7 +120,7 @@ public:
/**
* Sets the volume of the MIDI music with a value ranging from 0 to 127
*/
- void setMIDIVolume(int volume);
+ void setMusicVolume(int volume);
};
} // End of namespace Sherlock
diff --git a/engines/sherlock/sound.cpp b/engines/sherlock/sound.cpp
index 72dbfde..fd51462 100644
--- a/engines/sherlock/sound.cpp
+++ b/engines/sherlock/sound.cpp
@@ -142,7 +142,7 @@ bool Sound::playSound(const Common::String &name, WaitType waitType, int priorit
}
Audio::SoundHandle soundHandle = (IS_SERRATED_SCALPEL) ? _scalpelEffectsHandle : getFreeSoundHandle();
- if (!playSoundResource(filename, libraryFilename, Audio::Mixer::kPlainSoundType, soundHandle, Audio::Mixer::kMaxChannelVolume))
+ if (!playSoundResource(filename, libraryFilename, Audio::Mixer::kSFXSoundType, soundHandle))
error("Could not find sound resource - %s", filename.c_str());
_soundPlaying = true;
@@ -194,11 +194,6 @@ void Sound::stopSound() {
}
}
-void Sound::stopSndFuncPtr(int v1, int v2) {
- // TODO
- warning("TODO: Sound::stopSndFuncPtr");
-}
-
void Sound::freeDigiSound() {
_soundPlaying = false;
}
@@ -240,7 +235,7 @@ void Sound::playSpeech(const Common::String &name) {
// Ensure the given library is in the cache
res.addToCache(libraryName);
- if (playSoundResource(name, libraryName, Audio::Mixer::kSpeechSoundType, _speechHandle, Audio::Mixer::kMaxChannelVolume))
+ if (playSoundResource(name, libraryName, Audio::Mixer::kSpeechSoundType, _speechHandle))
_speechPlaying = true;
}
@@ -255,7 +250,7 @@ bool Sound::isSpeechPlaying() {
}
bool Sound::playSoundResource(const Common::String &name, const Common::String &libFilename,
- Audio::Mixer::SoundType soundType, Audio::SoundHandle &handle, int volume) {
+ Audio::Mixer::SoundType soundType, Audio::SoundHandle &handle) {
Resources &res = *_vm->_res;
Common::SeekableReadStream *stream = libFilename.empty() ? res.load(name) : res.load(name, libFilename, true);
if (!stream)
@@ -300,7 +295,7 @@ bool Sound::playSoundResource(const Common::String &name, const Common::String &
if (!audioStream)
return false;
- _mixer->playStream(soundType, &handle, audioStream, -1, volume);
+ _mixer->playStream(soundType, &handle, audioStream, -1, Audio::Mixer::kMaxChannelVolume);
return true;
}
diff --git a/engines/sherlock/sound.h b/engines/sherlock/sound.h
index 5654c50..b2d1584 100644
--- a/engines/sherlock/sound.h
+++ b/engines/sherlock/sound.h
@@ -59,7 +59,7 @@ private:
* Handle playing a sound or speech
*/
bool playSoundResource(const Common::String &name, const Common::String &libFilename,
- Audio::Mixer::SoundType soundType, Audio::SoundHandle &handle, int volume);
+ Audio::Mixer::SoundType soundType, Audio::SoundHandle &handle);
public:
bool _digitized;
int _voices;
@@ -103,7 +103,6 @@ public:
*/
void stopSound();
- void stopSndFuncPtr(int v1, int v2);
void freeDigiSound();
Audio::SoundHandle getFreeSoundHandle();
diff --git a/engines/sherlock/tattoo/tattoo_map.cpp b/engines/sherlock/tattoo/tattoo_map.cpp
index 53a366b..95858ae 100644
--- a/engines/sherlock/tattoo/tattoo_map.cpp
+++ b/engines/sherlock/tattoo/tattoo_map.cpp
@@ -81,7 +81,6 @@ int TattooMap::show() {
song = "Cue7";
if (music.loadSong(song)) {
- music.setMIDIVolume(music._musicVolume);
if (music._musicOn)
music.startSong();
}
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp
index 9c76df0..78100eb 100644
--- a/engines/sherlock/tattoo/tattoo_scene.cpp
+++ b/engines/sherlock/tattoo/tattoo_scene.cpp
@@ -94,7 +94,6 @@ bool TattooScene::loadScene(const Common::String &filename) {
// If it's a new song, then start it up
if (music._currentSongName.compareToIgnoreCase(music._nextSongName)) {
if (music.loadSong(music._nextSongName)) {
- music.setMIDIVolume(music._musicVolume);
if (music._musicOn)
music.startSong();
}
diff --git a/engines/sherlock/tattoo/widget_options.cpp b/engines/sherlock/tattoo/widget_options.cpp
index 574f6a8..5dc6fc5 100644
--- a/engines/sherlock/tattoo/widget_options.cpp
+++ b/engines/sherlock/tattoo/widget_options.cpp
@@ -112,10 +112,9 @@ void WidgetOptions::handleEvents() {
if (_midiSliderX > _bounds.width() - _surface.widestChar())
_midiSliderX = _bounds.width() - _surface.widestChar();
- int temp = music._musicVolume;
- music._musicVolume = (_midiSliderX - _surface.widestChar()) * 255 / (_bounds.width() - _surface.widestChar() * 2);
- if (music._musicVolume != temp) {
- music.setMIDIVolume(music._musicVolume);
+ int newVolume = (_midiSliderX - _surface.widestChar()) * 255 / (_bounds.width() - _surface.widestChar() * 2);
+ if (newVolume != music._musicVolume) {
+ music.setMusicVolume(newVolume);
vm.saveConfig();
}
More information about the Scummvm-git-logs
mailing list