[Scummvm-cvs-logs] CVS: scummvm/saga events.cpp,1.30,1.31 ihnm_introproc.cpp,1.27,1.28 sfuncs.cpp,1.42,1.43 sndres.cpp,1.29,1.30 sndres.h,1.14,1.15 sound.cpp,1.15,1.16 sound.h,1.12,1.13

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Fri Nov 26 05:29:06 CET 2004


Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14098

Modified Files:
	events.cpp ihnm_introproc.cpp sfuncs.cpp sndres.cpp sndres.h 
	sound.cpp sound.h 
Log Message:
Added looping background noise to the IHNM intro. I don't know if it's the
correct sound or the correct volume, but the small extension to allow the
engine to start looping sounds is worthwhile enough in itself, I think.


Index: events.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/events.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- events.cpp	20 Nov 2004 00:05:49 -0000	1.30
+++ events.cpp	26 Nov 2004 13:27:59 -0000	1.31
@@ -309,6 +309,11 @@
 		}
 
 		break;
+	case SOUND_EVENT:
+		_vm->_sound->stopSound();
+		if (event->op == EVENT_PLAY)
+			_vm->_sndRes->playSound(event->param, event->param2, event->param3 != 0);
+		break;
 	case VOICE_EVENT:
 		_vm->_sndRes->playVoice(event->param);
 		break;

Index: ihnm_introproc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/ihnm_introproc.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- ihnm_introproc.cpp	25 Nov 2004 12:54:03 -0000	1.27
+++ ihnm_introproc.cpp	26 Nov 2004 13:27:59 -0000	1.28
@@ -339,11 +339,30 @@
 
 		q_event = _vm->_events->queue(&event);
 
+		// Background sound
+		event.type = ONESHOT_EVENT;
+		event.code = SOUND_EVENT;
+		event.op = EVENT_PLAY;
+		event.param = 260;	// FIXME: Verify sound
+		event.param2 = 255;	// FIXME: Verify volume
+		event.param3 = SOUND_LOOP;
+		event.time = 0;
+
+		q_event = _vm->_events->queue(&event);
+
+		// End background sound after the voice has finished
+		event.type = ONESHOT_EVENT;
+		event.code = SOUND_EVENT;
+		event.op = EVENT_STOP;
+		event.time = _vm->_sndRes->getVoiceLength(0);
+
+		q_event = _vm->_events->chain(q_event, &event);
+
 		// End scene after the voice has finished
 		event.type = ONESHOT_EVENT;
 		event.code = SCENE_EVENT;
 		event.op = EVENT_END;
-		event.time = _vm->_sndRes->getVoiceLength(0);
+		event.time = 0;
 
 		q_event = _vm->_events->chain(q_event, &event);
 		break;

Index: sfuncs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sfuncs.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- sfuncs.cpp	12 Nov 2004 15:32:42 -0000	1.42
+++ sfuncs.cpp	26 Nov 2004 13:27:59 -0000	1.43
@@ -1156,7 +1156,7 @@
 	SDataWord_T param = thread->pop() - 13;
 
 	if (/* param >= 0 && */ param < ARRAYSIZE(sfxTable))
-		_vm->_sndRes->playSound(sfxTable[param].res, sfxTable[param].vol);
+		_vm->_sndRes->playSound(sfxTable[param].res, sfxTable[param].vol, false);
 	else
 		_vm->_sound->stopSound();
 

Index: sndres.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sndres.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- sndres.cpp	25 Nov 2004 07:15:08 -0000	1.29
+++ sndres.cpp	26 Nov 2004 13:28:00 -0000	1.30
@@ -53,7 +53,7 @@
 	_init = 1;
 }
 
-int SndRes::playSound(uint32 sound_rn, int volume) {
+int SndRes::playSound(uint32 sound_rn, int volume, bool loop) {
 	SOUNDBUFFER snd_buffer;
 
 	debug(0, "SndRes::playSound(%ld)", sound_rn);
@@ -63,7 +63,7 @@
 		return FAILURE;
 	}
 
-	_vm->_sound->playSound(&snd_buffer, volume);
+	_vm->_sound->playSound(&snd_buffer, volume, loop);
 
 	return SUCCESS;
 }

Index: sndres.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sndres.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- sndres.h	18 Nov 2004 17:34:54 -0000	1.14
+++ sndres.h	26 Nov 2004 13:28:00 -0000	1.15
@@ -67,7 +67,7 @@
 	SndRes(SagaEngine *vm);
 
 	int loadSound(uint32 sound_rn);
-	int playSound(uint32 sound_rn, int volume);
+	int playSound(uint32 sound_rn, int volume, bool loop);
 	int playVoice(uint32 voice_rn);
 	int getVoiceLength(uint32 voice_rn);
 

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sound.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- sound.cpp	15 Nov 2004 03:03:48 -0000	1.15
+++ sound.cpp	26 Nov 2004 13:28:00 -0000	1.16
@@ -190,8 +190,8 @@
 	return SUCCESS;
 }
 
-int Sound::playSound(SOUNDBUFFER *buf, int volume) {
-	return playSoundBuffer(&_effectHandle, buf, 2 * volume, false);
+int Sound::playSound(SOUNDBUFFER *buf, int volume, bool loop) {
+	return playSoundBuffer(&_effectHandle, buf, 2 * volume, loop);
 }
 
 int Sound::pauseSound() {

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sound.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- sound.h	15 Nov 2004 03:03:48 -0000	1.12
+++ sound.h	26 Nov 2004 13:28:00 -0000	1.13
@@ -32,6 +32,10 @@
 
 namespace Saga {
 
+enum SOUND_FLAGS {
+	SOUND_LOOP = 1
+};
+
 struct SOUNDBUFFER {
 	uint16 s_freq;
 	int s_samplebits;
@@ -48,7 +52,7 @@
 	Sound(SagaEngine *vm, SoundMixer *mixer, int enabled);
 	~Sound();
 
-	int playSound(SOUNDBUFFER *buf, int volume);
+	int playSound(SOUNDBUFFER *buf, int volume, bool loop);
 	int pauseSound();
 	int resumeSound();
 	int stopSound();





More information about the Scummvm-git-logs mailing list