git » fp-git.git » commit 0c922fa

sounds hooked

author ecalot
2006-02-19 16:07:18 UTC
committer ecalot
2006-02-19 16:07:18 UTC
parent 680bb268491f73da806862373b5d704b89173c9e

sounds hooked

PR/src/Makefile +5 -1
PR/src/include/sound.h +50 -0
PR/src/lib/object/sound/sound_common.c +60 -0

diff --git a/PR/src/Makefile b/PR/src/Makefile
index eca2f11..71b62bb 100644
--- a/PR/src/Makefile
+++ b/PR/src/Makefile
@@ -56,7 +56,7 @@ XML      = .parse.o .search.o .unknown.o .translate.o .tree.o
 COMPRESS = .lzg_compress.o .lzg_uncompress.o .rle_compress.o .rle_uncompress.o .rlec_uncompress.o 
 LAYERS   = .dat.o .memory.o .list.o .reslist.o .pallist.o .disk.o .idlist.o .autodetect.o .stringformat.o .resourcematch.o
 FORMAT   = .bmp.o .mid.o .pal.o .wav.o .plv.o
-OBJECT   = .object.o .pop1_4bit.o .image.o .binary.o
+OBJECT   = .object.o .pop1_4bit.o .image.o .binary.o .sounds.o
 CONSOLE  = .main.o .filedir.o
 MAIN     = .pr.o
 
@@ -154,6 +154,10 @@ $(XMLFILE): xml/resources.xml
 	$(INFO) Compiling resource list module...
 	$(CC) $(OPTIONS) -c lib/layers/reslist.c -o $@
 
+.sounds.o: lib/object/sound/sounds.c
+	$(INFO) Compiling sound list module...
+	$(CC) $(OPTIONS) -c lib/object/sound/sounds.c -o $@
+
 .pallist.o: lib/layers/pallist.c include/memory.h include/pallist.h
 	$(INFO) Compiling palette list module...
 	$(CC) $(OPTIONS) -c lib/layers/pallist.c -o $@
diff --git a/PR/src/include/sound.h b/PR/src/include/sound.h
new file mode 100644
index 0000000..96dacae
--- /dev/null
+++ b/PR/src/include/sound.h
@@ -0,0 +1,50 @@
+/*  Princed V3 - Prince of Persia Level Editor for PC Version
+    Copyright (C) 2003 Princed Development Team
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    The authors of this program may be contacted at http://forum.princed.com.ar
+*/
+
+/*
+sound.h: Princed Resources : 
+\xaf\xaf\xaf\xaf\xaf\xaf\xaf
+ Copyright 2006 Princed Development Team
+  Created: 19 Feb 2006
+
+  Author: Enrique Calot <ecalot.cod@princed.com.ar>
+
+ Note:
+  DO NOT remove this copyright notice
+*/
+
+#ifndef _SOUND_H_
+#define _SOUND_H_
+
+#include "binary.h"
+
+int objSoundWrite(void* o, const char* file, int write(const char* file,tBinary* data,int optionflag, const char* backupExtension), int optionflag, const char* backupExtension);
+void* objSoundCreate(unsigned char* data, int size, int *error);
+
+
+#define objWaveWrite(a,b,c,d) objSoundWrite(a,b,writeWav,c,d)
+#define objMidiWrite(a,b,c,d) objSoundWrite(a,b,writeMid,c,d)
+#define objPcspeakerWrite(a,b,c,d) objSoundWrite(a,b,writePcs,c,d)
+
+#define objWaveCreate(a,b,c) objSoundCreate(a,b,c)
+#define objMidiCreate(a,b,c) objSoundCreate(a,b,c)
+#define objPcspeakerCreate(a,b,c) objSoundCreate(a,b,c)
+
+#endif
diff --git a/PR/src/lib/object/sound/sound_common.c b/PR/src/lib/object/sound/sound_common.c
new file mode 100644
index 0000000..f03a214
--- /dev/null
+++ b/PR/src/lib/object/sound/sound_common.c
@@ -0,0 +1,60 @@
+/*  Princed V3 - Prince of Persia Level Editor for PC Version
+    Copyright (C) 2003 Princed Development Team
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    The authors of this program may be contacted at http://forum.princed.com.ar
+*/
+
+/*
+wave.c: Princed Resources : 
+\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf
+ Copyright 2006 Princed Development Team
+  Created: 19 Feb 2006
+
+  Author: Enrique Calot <ecalot.cod@princed.com.ar>
+  Version: 1.01 (2006-Feb-09)
+
+ Note:
+  DO NOT remove this copyright notice
+*/
+
+/***************************************************************\
+|                  I M P L E M E N T A T I O N                  |
+\***************************************************************/
+
+#include "binary.h" /* tBinary */
+#include "common.h"
+#include "wav.h" 
+#include <stdlib.h>
+
+/***************************************************************\
+|                         Binary Object                         |
+\***************************************************************/
+
+void* objSoundCreate(unsigned char* data, int size, int *error) { /* use get like main.c */
+	tBinary* r;
+	*error=PR_RESULT_SUCCESS;
+	
+	r=(tBinary*)malloc(sizeof(tBinary));
+	r->data=data+1;
+	r->size=size-1;
+	return (void*)r;
+}
+
+int objSoundWrite(void* o, const char* file, int write(const char* file,tBinary* data,int optionflag, const char* backupExtension), int optionflag, const char* backupExtension) {
+	return write(file,(tBinary*)o,optionflag,backupExtension);
+}
+