[Scummvm-cvs-logs] CVS: scummvm/simon sound.cpp,1.82,1.83 sound.h,1.22,1.23 vga.cpp,1.128,1.129
Max Horn
fingolfin at users.sourceforge.net
Sun May 8 05:34:40 CEST 2005
Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1404
Modified Files:
sound.cpp sound.h vga.cpp
Log Message:
Renamed variables to match our naming conventions; added Sound::isVoiceActive() method; made some more members of class Sound private
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.cpp,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- sound.cpp 8 May 2005 05:56:09 -0000 1.82
+++ sound.cpp 8 May 2005 12:33:25 -0000 1.83
@@ -238,12 +238,12 @@
_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 @@
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 @@
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 @@
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 @@
_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 @@
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 @@
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 @@
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 @@
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 @@
}
void Sound::readSfxFile(const char *filename) {
- if (_effects_file)
+ if (_hasEffectsFile)
return;
stopAll();
@@ -421,11 +421,11 @@
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 @@
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 @@
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::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);
}
}
Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- sound.h 8 May 2005 05:23:31 -0000 1.22
+++ sound.h 8 May 2005 12:33:25 -0000 1.23
@@ -42,17 +42,17 @@
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 @@
void playEffects(uint sound);
void playAmbient(uint sound);
- bool hasVoice();
+ bool hasVoice() const;
+ bool isVoiceActive() const;
void stopVoice();
void stopAll();
void effectsPause(bool b);
Index: vga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/vga.cpp,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -d -r1.128 -r1.129
--- vga.cpp 6 May 2005 13:22:48 -0000 1.128
+++ vga.cpp 8 May 2005 12:33:25 -0000 1.129
@@ -1564,7 +1564,7 @@
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::vc64_skipIfNoSpeech() {
// Simon2
- if (!_mixer->isSoundHandleActive(_sound->_voice_handle) || (_subtitles && _language != 20))
+ if (!_sound->isVoiceActive() || (_subtitles && _language != 20))
vc_skip_next_instruction();
}
More information about the Scummvm-git-logs
mailing list