aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2005-05-08 12:33:25 +0000
committerMax Horn2005-05-08 12:33:25 +0000
commitbd8831487f9b1acb5f81986832e532f49544e5bd (patch)
tree8f598e7f5532c53c1c7907a2cd4d897fbc71e134
parent33cc1176a0305864139cc7f946f4ac580bf4c656 (diff)
downloadscummvm-rg350-bd8831487f9b1acb5f81986832e532f49544e5bd.tar.gz
scummvm-rg350-bd8831487f9b1acb5f81986832e532f49544e5bd.tar.bz2
scummvm-rg350-bd8831487f9b1acb5f81986832e532f49544e5bd.zip
Renamed variables to match our naming conventions; added Sound::isVoiceActive() method; made some more members of class Sound private
svn-id: r17958
-rw-r--r--simon/sound.cpp70
-rw-r--r--simon/sound.h19
-rw-r--r--simon/vga.cpp4
3 files changed, 49 insertions, 44 deletions
diff --git a/simon/sound.cpp b/simon/sound.cpp
index 344ff7e472..a712d828d1 100644
--- a/simon/sound.cpp
+++ b/simon/sound.cpp
@@ -238,12 +238,12 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer
_ambientPaused = false;
_filenums = 0;
- _last_voice_file = 0;
+ _lastVoiceFile = 0;
_offsets = 0;
- _effects_file = false;
- _voice_file = false;
- _ambient_playing = 0;
+ _hasEffectsFile = false;
+ _hasVoiceFile = false;
+ _ambientPlaying = 0;
// simon1cd32 uses separate speech files
if (!(_game & GF_TALKIE) || (_game == GAME_SIMON1CD32))
@@ -255,7 +255,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer
if (!_voice && gss->flac_filename && gss->flac_filename[0]) {
file->open(gss->flac_filename);
if (file->isOpen()) {
- _voice_file = true;
+ _hasVoiceFile = true;
_voice = new FlacSound(_mixer, file);
}
}
@@ -264,7 +264,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer
if (!_voice && gss->mp3_filename && gss->mp3_filename[0]) {
file->open(gss->mp3_filename);
if (file->isOpen()) {
- _voice_file = true;
+ _hasVoiceFile = true;
_voice = new MP3Sound(_mixer, file);
}
}
@@ -273,7 +273,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer
if (!_voice && gss->vorbis_filename && gss->vorbis_filename[0]) {
file->open(gss->vorbis_filename);
if (file->isOpen()) {
- _voice_file = true;
+ _hasVoiceFile = true;
_voice = new VorbisSound(_mixer, file);
}
}
@@ -292,20 +292,20 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer
_filenums[i] = file->readUint16BE();
_offsets[i] = file->readUint32BE();
}
- _voice_file = true;
+ _hasVoiceFile = true;
}
}
if (!_voice && gss->wav_filename && gss->wav_filename[0]) {
file->open(gss->wav_filename);
if (file->isOpen()) {
- _voice_file = true;
+ _hasVoiceFile = true;
_voice = new WavSound(_mixer, file);
}
}
if (!_voice && gss->voc_filename && gss->voc_filename[0]) {
file->open(gss->voc_filename);
if (file->isOpen()) {
- _voice_file = true;
+ _hasVoiceFile = true;
_voice = new VocSound(_mixer, file);
}
}
@@ -316,7 +316,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer
if (!_effects && gss->mp3_effects_filename && gss->mp3_effects_filename[0]) {
file->open(gss->mp3_effects_filename);
if (file->isOpen()) {
- _effects_file = true;
+ _hasEffectsFile = true;
_effects = new MP3Sound(_mixer, file);
}
}
@@ -325,7 +325,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer
if (!_effects && gss->vorbis_effects_filename && gss->vorbis_effects_filename[0]) {
file->open(gss->vorbis_effects_filename);
if (file->isOpen()) {
- _effects_file = true;
+ _hasEffectsFile = true;
_effects = new VorbisSound(_mixer, file);
}
}
@@ -334,7 +334,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer
if (!_effects && gss->flac_effects_filename && gss->flac_effects_filename[0]) {
file->open(gss->flac_effects_filename);
if (file->isOpen()) {
- _effects_file = true;
+ _hasEffectsFile = true;
_effects = new FlacSound(_mixer, file);
}
}
@@ -342,7 +342,7 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer
if (!_effects && gss->voc_effects_filename && gss->voc_effects_filename[0]) {
file->open(gss->voc_effects_filename);
if (file->isOpen()) {
- _effects_file = true;
+ _hasEffectsFile = true;
_effects = new VocSound(_mixer, file);
}
}
@@ -358,7 +358,7 @@ Sound::~Sound() {
}
void Sound::readSfxFile(const char *filename) {
- if (_effects_file)
+ if (_hasEffectsFile)
return;
stopAll();
@@ -421,11 +421,11 @@ void Sound::readVoiceFile(const char *filename) {
void Sound::playVoice(uint sound) {
if (_filenums) {
- if (_last_voice_file != _filenums[sound]) {
+ if (_lastVoiceFile != _filenums[sound]) {
stopAll();
char filename[16];
- _last_voice_file = _filenums[sound];
+ _lastVoiceFile = _filenums[sound];
sprintf(filename, "voices%d.dat", _filenums[sound]);
File *file = new File();
file->open(filename);
@@ -441,8 +441,8 @@ void Sound::playVoice(uint sound) {
if (!_voice)
return;
- _mixer->stopHandle(_voice_handle);
- _voice->playSound(sound, &_voice_handle, (_game == GAME_SIMON1CD32) ? 0 : SoundMixer::FLAG_UNSIGNED);
+ _mixer->stopHandle(_voiceHandle);
+ _voice->playSound(sound, &_voiceHandle, (_game == GAME_SIMON1CD32) ? 0 : SoundMixer::FLAG_UNSIGNED);
}
void Sound::playEffects(uint sound) {
@@ -452,36 +452,40 @@ void Sound::playEffects(uint sound) {
if (_effectsPaused)
return;
- _effects->playSound(sound, &_effects_handle, (_game == GAME_SIMON1CD32) ? 0 : SoundMixer::FLAG_UNSIGNED);
+ _effects->playSound(sound, &_effectsHandle, (_game == GAME_SIMON1CD32) ? 0 : SoundMixer::FLAG_UNSIGNED);
}
void Sound::playAmbient(uint sound) {
if (!_effects)
return;
- if (sound == _ambient_playing)
+ if (sound == _ambientPlaying)
return;
- _ambient_playing = sound;
+ _ambientPlaying = sound;
if (_ambientPaused)
return;
- _mixer->stopHandle(_ambient_handle);
- _effects->playSound(sound, &_ambient_handle, SoundMixer::FLAG_LOOP|SoundMixer::FLAG_UNSIGNED);
+ _mixer->stopHandle(_ambientHandle);
+ _effects->playSound(sound, &_ambientHandle, SoundMixer::FLAG_LOOP|SoundMixer::FLAG_UNSIGNED);
}
-bool Sound::hasVoice() {
- return _voice_file;
+bool Sound::hasVoice() const {
+ return _hasVoiceFile;
+}
+
+bool Sound::isVoiceActive() const {
+ return _mixer->isSoundHandleActive(_voiceHandle) ;
}
void Sound::stopVoice() {
- _mixer->stopHandle(_voice_handle);
+ _mixer->stopHandle(_voiceHandle);
}
void Sound::stopAll() {
_mixer->stopAll();
- _ambient_playing = 0;
+ _ambientPlaying = 0;
}
void Sound::effectsPause(bool b) {
@@ -491,11 +495,11 @@ void Sound::effectsPause(bool b) {
void Sound::ambientPause(bool b) {
_ambientPaused = b;
- if (_ambientPaused && _ambient_playing) {
- _mixer->stopHandle(_ambient_handle);
- } else if (_ambient_playing) {
- uint tmp = _ambient_playing;
- _ambient_playing = 0;
+ if (_ambientPaused && _ambientPlaying) {
+ _mixer->stopHandle(_ambientHandle);
+ } else if (_ambientPlaying) {
+ uint tmp = _ambientPlaying;
+ _ambientPlaying = 0;
playAmbient(tmp);
}
}
diff --git a/simon/sound.h b/simon/sound.h
index 69b5040f2d..ad0b535f5f 100644
--- a/simon/sound.h
+++ b/simon/sound.h
@@ -42,17 +42,17 @@ private:
uint16 *_filenums;
uint32 *_offsets;
- uint16 _last_voice_file;
+ uint16 _lastVoiceFile;
-public:
- SoundHandle _voice_handle;
- SoundHandle _effects_handle;
- SoundHandle _ambient_handle;
+ SoundHandle _voiceHandle;
+ SoundHandle _effectsHandle;
+ SoundHandle _ambientHandle;
- bool _effects_file;
- bool _voice_file;
- uint _ambient_playing;
+ bool _hasEffectsFile;
+ bool _hasVoiceFile;
+ uint _ambientPlaying;
+public:
Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer);
~Sound();
@@ -64,7 +64,8 @@ public:
void playEffects(uint sound);
void playAmbient(uint sound);
- bool hasVoice();
+ bool hasVoice() const;
+ bool isVoiceActive() const;
void stopVoice();
void stopAll();
void effectsPause(bool b);
diff --git a/simon/vga.cpp b/simon/vga.cpp
index 694412a66a..b72657f987 100644
--- a/simon/vga.cpp
+++ b/simon/vga.cpp
@@ -1564,7 +1564,7 @@ void SimonEngine::vc59() {
vc_kill_sprite(file, start);
} while (++start != end);
} else {
- if (!_mixer->isSoundHandleActive(_sound->_voice_handle))
+ if (!_sound->isVoiceActive())
vc_skip_next_instruction();
}
}
@@ -1743,7 +1743,7 @@ void SimonEngine::vc63_palette_thing_2() {
void SimonEngine::vc64_skipIfNoSpeech() {
// Simon2
- if (!_mixer->isSoundHandleActive(_sound->_voice_handle) || (_subtitles && _language != 20))
+ if (!_sound->isVoiceActive() || (_subtitles && _language != 20))
vc_skip_next_instruction();
}