[Scummvm-cvs-logs] CVS: scummvm/simon simon.cpp,1.66,1.67 simon.h,1.12,1.13
Oliver Kiehl
olki at users.sourceforge.net
Sun Nov 10 08:26:01 CET 2002
Update of /cvsroot/scummvm/scummvm/simon
In directory usw-pr-cvs1:/tmp/cvs-serv25708
Modified Files:
simon.cpp simon.h
Log Message:
added ambient effects (rest of vc_52)
Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- simon.cpp 10 Nov 2002 15:24:17 -0000 1.66
+++ simon.cpp 10 Nov 2002 16:25:02 -0000 1.67
@@ -147,6 +147,7 @@
_effects_sound = 0;
_voice_sound = 0;
+ _ambient_sound = 0;
}
SimonState::~SimonState()
@@ -4840,7 +4841,7 @@
#ifdef USE_MAD
-void SimonState::playMP3(File *sound_file, uint32 *offsets, uint sound, PlayingSoundHandle *sound_handle)
+void SimonState::playMP3(File *sound_file, uint32 *offsets, uint sound, PlayingSoundHandle *sound_handle, byte flags)
{
sound_file->seek(offsets[sound], SEEK_SET);
@@ -4849,11 +4850,11 @@
byte *buffer = (byte *)malloc(size);
sound_file->read(buffer, size);
- _mixer->playMP3(sound_handle, buffer, size, SoundMixer::FLAG_AUTOFREE);
+ _mixer->playMP3(sound_handle, buffer, size, flags);
}
#endif
-void SimonState::playVoc(File *sound_file, uint32 *offsets, uint sound, PlayingSoundHandle *sound_handle)
+void SimonState::playVoc(File *sound_file, uint32 *offsets, uint sound, PlayingSoundHandle *sound_handle, byte flags)
{
VocHeader voc_hdr;
VocBlockHeader voc_block_hdr;
@@ -4875,11 +4876,10 @@
byte *buffer = (byte *)malloc(size);
sound_file->read(buffer, size);
- _mixer->playRaw(sound_handle, buffer, size, samples_per_sec,
- SoundMixer::FLAG_UNSIGNED|SoundMixer::FLAG_AUTOFREE);
+ _mixer->playRaw(sound_handle, buffer, size, samples_per_sec, flags);
}
-void SimonState::playWav(File *sound_file, uint32 *offsets, uint sound, PlayingSoundHandle *sound_handle)
+void SimonState::playWav(File *sound_file, uint32 *offsets, uint sound, PlayingSoundHandle *sound_handle, byte flags)
{
WaveHeader wave_hdr;
uint32 data[2];
@@ -4908,8 +4908,7 @@
byte *buffer = (byte *)malloc(data[1]);
sound_file->read(buffer, data[1]);
- _mixer->playRaw(sound_handle, buffer, data[1], READ_LE_UINT32(&wave_hdr.samples_per_sec),
- SoundMixer::FLAG_UNSIGNED|SoundMixer::FLAG_AUTOFREE);
+ _mixer->playRaw(sound_handle, buffer, data[1], READ_LE_UINT32(&wave_hdr.samples_per_sec), flags);
}
void SimonState::playVoice(uint voice)
@@ -4922,13 +4921,13 @@
#ifdef USE_MAD
if (_voice_type == FORMAT_MP3) {
- playMP3(_voice_file, _voice_offsets, voice, &_voice_sound);
+ playMP3(_voice_file, _voice_offsets, voice, &_voice_sound, SoundMixer::FLAG_AUTOFREE);
} else {
#endif
if (_voice_type == FORMAT_WAV) { /* WAVE audio */
- playWav(_voice_file, _voice_offsets, voice, &_voice_sound);
+ playWav(_voice_file, _voice_offsets, voice, &_voice_sound, SoundMixer::FLAG_UNSIGNED|SoundMixer::FLAG_AUTOFREE);
} else if (_voice_type == FORMAT_VOC) { /* VOC audio */
- playVoc(_voice_file, _voice_offsets, voice, &_voice_sound);
+ playVoc(_voice_file, _voice_offsets, voice, &_voice_sound, SoundMixer::FLAG_UNSIGNED|SoundMixer::FLAG_AUTOFREE);
}
#ifdef USE_MAD
}
@@ -4943,21 +4942,35 @@
if (_game == GAME_SIMON1TALKIE) { /* simon 1 talkie */
#ifdef USE_MAD
if (_effects_type == FORMAT_MP3) {
- playMP3(_effects_file, _effects_offsets, sound, &_effects_sound);
+ playMP3(_effects_file, _effects_offsets, sound, &_effects_sound, SoundMixer::FLAG_AUTOFREE);
} else {
#endif
- playVoc(_effects_file, _effects_offsets, sound, &_effects_sound);
+ playVoc(_effects_file, _effects_offsets, sound, &_effects_sound, SoundMixer::FLAG_UNSIGNED|SoundMixer::FLAG_AUTOFREE);
#ifdef USE_MAD
}
#endif
} else if (_game == GAME_SIMON1WIN){ /* simon 1 win */
- playWav(_effects_file, _effects_offsets, sound, &_effects_sound);
+ playWav(_effects_file, _effects_offsets, sound, &_effects_sound, SoundMixer::FLAG_UNSIGNED|SoundMixer::FLAG_AUTOFREE);
} else if (_game == GAME_SIMON2WIN) { /* simon 2 win */
- playWav(_game_file, _effects_offsets, sound, &_effects_sound);
+ playWav(_game_file, _effects_offsets, sound, &_effects_sound, SoundMixer::FLAG_UNSIGNED|SoundMixer::FLAG_AUTOFREE);
} else if (_game & GAME_SIMON2) { /* simon 2 dos / talkie */
- playVoc(_game_file, _effects_offsets, sound, &_effects_sound);
+ playVoc(_game_file, _effects_offsets, sound, &_effects_sound, SoundMixer::FLAG_UNSIGNED|SoundMixer::FLAG_AUTOFREE);
} else { /* simon 1 dos */
warning("playSound(%d)", sound);
+ }
+}
+
+void SimonState::playAmbient(uint sound)
+{
+ if (_effects_sound != 0)
+ _mixer->stop(_ambient_sound);
+
+ if (_game & GAME_WIN) {
+ playWav(_game_file, _effects_offsets, sound, &_ambient_sound,
+ SoundMixer::FLAG_LOOP|SoundMixer::FLAG_UNSIGNED|SoundMixer::FLAG_AUTOFREE);
+ } else {
+ playVoc(_game_file, _effects_offsets, sound, &_ambient_sound,
+ SoundMixer::FLAG_LOOP|SoundMixer::FLAG_UNSIGNED|SoundMixer::FLAG_AUTOFREE);
}
}
Index: simon.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- simon.h 10 Nov 2002 15:24:17 -0000 1.12
+++ simon.h 10 Nov 2002 16:25:03 -0000 1.13
@@ -337,6 +337,7 @@
PlayingSoundHandle _effects_sound;
PlayingSoundHandle _voice_sound;
+ PlayingSoundHandle _ambient_sound;
int _timer_id;
@@ -775,10 +776,11 @@
void initSound();
void playVoice(uint voice);
void playSound(uint sound);
+ void playAmbient(uint sound);
- void playVoc(File *sound_file, uint32 *offsets, uint sound, PlayingSoundHandle *sound_handle);
- void playWav(File *sound_file, uint32 *offsets, uint sound, PlayingSoundHandle *sound_handle);
- void playMP3(File *sound_file, uint32 *offsets, uint sound, PlayingSoundHandle *sound_handle);
+ void playVoc(File *sound_file, uint32 *offsets, uint sound, PlayingSoundHandle *sound_handle, byte flags);
+ void playWav(File *sound_file, uint32 *offsets, uint sound, PlayingSoundHandle *sound_handle, byte flags);
+ void playMP3(File *sound_file, uint32 *offsets, uint sound, PlayingSoundHandle *sound_handle, byte flags);
void playMusic(uint music);
void checkTimerCallback();
More information about the Scummvm-git-logs
mailing list