[Scummvm-cvs-logs] CVS: scummvm/saga sndres.cpp,1.2,1.3 sndres.h,1.2,1.3 syssound.cpp,1.1,1.2

Eugene Sandulenko sev at users.sourceforge.net
Wed Apr 28 15:22:05 CEST 2004


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

Modified Files:
	sndres.cpp sndres.h syssound.cpp 
Log Message:
code formatting insanity


Index: sndres.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sndres.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- sndres.cpp	25 Apr 2004 14:42:14 -0000	1.2
+++ sndres.cpp	28 Apr 2004 22:21:50 -0000	1.3
@@ -50,12 +50,10 @@
 
 R_SNDRES_MODULE SndModule;
 
-int SND_Init(void)
-{
+int SND_Init(void) {
 	int result;
 
-	/* Load sound module resource file contexts
-	 * \*------------------------------------------------------------- */
+	/* Load sound module resource file contexts */
 	result = GAME_GetFileContext(&SndModule.sfx_ctxt, R_GAME_SOUNDFILE, 0);
 	if (result != R_SUCCESS) {
 		return R_FAILURE;
@@ -67,8 +65,7 @@
 		return R_FAILURE;
 	}
 
-	/* Grab sound resource information for the current game
-	 * \*------------------------------------------------------------- */
+	/* Grab sound resource information for the current game */
 	GAME_GetSoundInfo(&SndModule.snd_info);
 
 	SndModule.init = 1;
@@ -76,8 +73,7 @@
 	return R_SUCCESS;
 }
 
-int SND_PlayVoice(ulong voice_rn)
-{
+int SND_PlayVoice(ulong voice_rn) {
 	R_SOUNDBUFFER snd_buffer;
 	int result;
 
@@ -91,10 +87,7 @@
 	return R_SUCCESS;
 }
 
-int
-SND_Load(R_RSCFILE_CONTEXT * snd_ctxt, ulong snd_rn, R_SOUNDBUFFER * snd_buf_i)
-{
-
+int SND_Load(R_RSCFILE_CONTEXT *snd_ctxt, ulong snd_rn, R_SOUNDBUFFER *snd_buf_i) {
 	uchar *snd_res;
 	size_t snd_res_len;
 
@@ -108,9 +101,7 @@
 	}
 
 	switch (SndModule.snd_info.res_type) {
-
 	case R_GAME_SOUND_PCM:
-
 		snd_buf_i->s_freq = SndModule.snd_info.freq;
 		snd_buf_i->s_samplebits = SndModule.snd_info.sample_size;
 		snd_buf_i->s_stereo = SndModule.snd_info.stereo;
@@ -126,7 +117,6 @@
 		break;
 
 	case R_GAME_SOUND_VOC:
-
 		if (LoadVocSound(snd_res, snd_res_len, snd_buf_i) != R_SUCCESS) {
 
 			RSC_FreeResource(snd_res);
@@ -138,7 +128,6 @@
 
 	default:
 		/* Unknown sound type */
-
 		RSC_FreeResource(snd_res);
 
 		return R_FAILURE;
@@ -148,11 +137,7 @@
 	return R_SUCCESS;
 }
 
-int
-LoadVocSound(const uchar * snd_res,
-    size_t snd_res_len, R_SOUNDBUFFER * snd_buf_i)
-{
-
+int LoadVocSound(const uchar *snd_res, size_t snd_res_len, R_SOUNDBUFFER *snd_buf_i) {
 	R_VOC_HEADER_BLOCK voc_hb;
 	R_VOC_GENBLOCK voc_gb;
 	R_VOC_BLOCK1 voc_b1;
@@ -174,7 +159,6 @@
 	read_len -= R_VOC_FILE_DESC_LEN;
 
 	if (memcmp(voc_hb.ft_desc, R_VOC_FILE_DESC, R_VOC_FILE_DESC_LEN) != 0) {
-
 		/* Voc file desc string not found */
 		return R_FAILURE;
 	}
@@ -184,7 +168,6 @@
 	voc_hb.voc_fileid = ys_read_u16_le(read_p, &read_p);
 
 	if (read_len < voc_hb.db_offset + R_VOC_GENBLOCK_LEN) {
-
 		return R_FAILURE;
 	}
 
@@ -192,9 +175,7 @@
 	read_len = snd_res_len - voc_hb.db_offset;
 
 	for (;;) {
-
-		/* Read generic block header
-		 * \*--------------------------------------------------------- */
+		/* Read generic block header */
 		if (read_len < R_VOC_GENBLOCK_LEN) {
 			return R_FAILURE;
 		}
@@ -208,12 +189,9 @@
 
 		read_len -= R_VOC_GENBLOCK_LEN;
 
-		/* Process block
-		 * \*--------------------------------------------------------- */
+		/* Process block */
 		switch (voc_gb.block_id) {
-
 		case 1:	/* Sound data block */
-
 			voc_b1.time_constant = ys_read_u8(read_p, &read_p);
 			voc_b1.pack_method = ys_read_u8(read_p, &read_p);
 			read_len -= 2;
@@ -243,7 +221,6 @@
 			break;
 
 		default:
-
 			read_p += voc_gb.block_len;
 			read_len -= voc_gb.block_len;
 			break;
@@ -253,9 +230,7 @@
 	return R_SUCCESS;
 }
 
-int SND_GetVoiceLength(ulong voice_rn)
-{
-
+int SND_GetVoiceLength(ulong voice_rn) {
 	ulong length;
 
 	double ms_f;
@@ -271,16 +246,13 @@
 	}
 
 	if (SndModule.snd_info.res_type == R_GAME_SOUND_PCM) {
-
 		ms_f = (double)length /
 		    (SndModule.snd_info.sample_size / CHAR_BIT) /
 		    (SndModule.snd_info.freq) * 1000.0;
 
 		ms_i = (int)ms_f;
 	} else if (SndModule.snd_info.res_type == R_GAME_SOUND_VOC) {
-
 		/* Rough hack, fix this to be accurate */
-
 		ms_f = (double)length / 14705 * 1000.0;
 		ms_i = (int)ms_f;
 	} else {
@@ -290,12 +262,8 @@
 	return ms_i;
 }
 
-int
-SND_ITEVOC_Resample(long src_freq,
-    long dst_freq,
-    uchar * src_buf,
-    size_t src_buf_len, uchar ** dst_buf, size_t * dst_buf_len)
-{
+int SND_ITEVOC_Resample(long src_freq, long dst_freq, uchar *src_buf, 
+						size_t src_buf_len, uchar **dst_buf, size_t *dst_buf_len) {
 	uchar *resamp_buf;
 	size_t resamp_len;
 
@@ -328,7 +296,6 @@
 	write_pc = resamp_buf + 2;
 
 	for (src_i = 0; src_i < src_buf_len / 2; src_i++) {
-
 		src_samp_a = *read_pa;
 		src_samp_b = *read_pb;
 

Index: sndres.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sndres.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- sndres.h	25 Apr 2004 14:42:14 -0000	1.2
+++ sndres.h	28 Apr 2004 22:21:51 -0000	1.3
@@ -40,52 +40,39 @@
 #define R_VOC_FILE_DESC "Creative Voice File\x1A"
 
 struct R_VOC_HEADER_BLOCK {
-
 	char ft_desc[20];	/* BYTE [20] */
 	uint db_offset;		/* WORD */
 	uint voc_version;	/* WORD */
 	uint voc_fileid;	/* WORD */
-
 };
 
 #define R_VOC_HEADER_BLOCK_LEN 26
 
 struct R_VOC_GENBLOCK {
-
 	int block_id;		/* BYTE */
 	ulong block_len;	/* BYTE[3] */
-
 };
 
 #define R_VOC_GENBLOCK_LEN 4
 
 struct R_VOC_BLOCK1 {
-
 	int block_id;		/* BYTE */
 	ulong block_len;	/* BYTE[3] */
 	uint time_constant;	/* BYTE */
 	int pack_method;	/* BYTE */
-
 };
 
 struct R_SNDRES_MODULE {
-
 	int init;
 
 	R_RSCFILE_CONTEXT *sfx_ctxt;
 	R_RSCFILE_CONTEXT *voice_ctxt;
 
 	R_GAME_SOUNDINFO snd_info;
-
 };
 
-int
-SND_Load(R_RSCFILE_CONTEXT * snd_ctxt,
-    ulong snd_rn, R_SOUNDBUFFER * snd_buf_i);
-
-int
-LoadVocSound(const uchar * snd_res,
-    size_t snd_res_len, R_SOUNDBUFFER * snd_buf_i);
+int SND_Load(R_RSCFILE_CONTEXT *snd_ctxt, ulong snd_rn, R_SOUNDBUFFER *snd_buf_i);
+int LoadVocSound(const uchar *snd_res, size_t snd_res_len, R_SOUNDBUFFER *snd_buf_i);
 
 } // End of namespace Saga
 

Index: syssound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/syssound.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- syssound.cpp	12 Apr 2004 21:40:48 -0000	1.1
+++ syssound.cpp	28 Apr 2004 22:21:51 -0000	1.2
@@ -41,13 +41,9 @@
 static R_RSCFILE_CONTEXT *SoundContext;
 static R_RSCFILE_CONTEXT *VoiceContext;
 
-int SYSSOUND_Init(int enabled)
-{
-
+int SYSSOUND_Init(int enabled) {
 	int result;
 
-	YS_IGNORE_PARAM(enabled);
-
 	if (SoundInitialized) {
 		return R_FAILURE;
 	}
@@ -64,12 +60,15 @@
 		return R_FAILURE;
 	}
 
+    /* Grab sound resource information for the current game
+    \*-------------------------------------------------------------*/
+    //GAME_GetSoundInfo(&SoundModule.snd_info);
+
 	SoundInitialized = 1;
 	return R_SUCCESS;
 }
 
-int SYSSOUND_Shutdown()
-{
+int SYSSOUND_Shutdown() {
 	if (!SoundInitialized) {
 		return R_FAILURE;
 	}
@@ -79,22 +78,22 @@
 	return R_SUCCESS;
 }
 
-int SYSSOUND_Play(int sound_rn, int channel)
-{
-
-	(void)sound_rn;
-	(void)channel;
+int SYSSOUND_Play(int sound_rn, int channel) {
+	int resource_size;
+	char *resource_data;
 
 	if (!SoundInitialized) {
 		return R_FAILURE;
 	}
 
+	if (channel > 3) {
+		return R_FAILURE;
+	}
+	
 	return R_SUCCESS;
 }
 
-int SYSSOUND_Pause(int channel)
-{
-
+int SYSSOUND_Pause(int channel) {
 	(void)channel;
 
 	if (!SoundInitialized) {
@@ -104,9 +103,7 @@
 	return R_SUCCESS;
 }
 
-int SYSSOUND_Resume(int channel)
-{
-
+int SYSSOUND_Resume(int channel) {
 	(void)channel;
 
 	if (!SoundInitialized) {
@@ -116,9 +113,7 @@
 	return R_SUCCESS;
 }
 
-int SYSSOUND_Stop(int channel)
-{
-
+int SYSSOUND_Stop(int channel) {
 	(void)channel;
 
 	if (!SoundInitialized) {
@@ -128,9 +123,7 @@
 	return R_SUCCESS;
 }
 
-int SYSSOUND_PlayVoice(R_SOUNDBUFFER * buf)
-{
-
+int SYSSOUND_PlayVoice(R_SOUNDBUFFER *buf) {
 	(void)buf;
 
 	if (!SoundInitialized) {
@@ -140,9 +133,7 @@
 	return R_SUCCESS;
 }
 
-int SYSSOUND_PauseVoice(void)
-{
-
+int SYSSOUND_PauseVoice(void) {
 	if (!SoundInitialized) {
 		return R_FAILURE;
 	}
@@ -150,9 +141,7 @@
 	return R_SUCCESS;
 }
 
-int SYSSOUND_ResumeVoice(void)
-{
-
+int SYSSOUND_ResumeVoice(void) {
 	if (!SoundInitialized) {
 		return R_FAILURE;
 	}
@@ -160,9 +149,7 @@
 	return R_SUCCESS;
 }
 
-int SYSSOUND_StopVoice(void)
-{
-
+int SYSSOUND_StopVoice(void) {
 	if (!SoundInitialized) {
 		return R_FAILURE;
 	}





More information about the Scummvm-git-logs mailing list