-new openal api for setting sound position
authorkoda
Fri, 03 Jul 2009 22:00:32 +0000
changeset 2220 110266ba2ef7
parent 2219 07f5345ecae7
child 2221 ef52dae4130b
-new openal api for setting sound position -updates to INSTALL
INSTALL
hedgewars/GSHandlers.inc
openalbridge/loaders.c
openalbridge/openalwrap.c
openalbridge/openalwrap.h
tools/CMakeLists.txt
--- a/INSTALL	Thu Jul 02 14:59:27 2009 +0000
+++ b/INSTALL	Fri Jul 03 22:00:32 2009 +0000
@@ -1,9 +1,9 @@
 To compile and install you need:
  - Qt >= 4.4
  - FreePascal >= 2.2.0
+ - OpenAL >= 1.0
  - SDL >= 1.2.5
  - SDL_net >= 1.2.5
- - SDL_mixer >= 1.2
  - SDL_image >= 1.2
  - SDL_ttf >= 2.0
  - CMake >= 2.6.0
@@ -15,9 +15,13 @@
 1. Configure:
 $ cmake .
 or
-$ cmake -DCMAKE_CXX_FLAGS="flags" -DCMAKE_INSTALL_PREFIX="install prefix" -DDATA_INSTALL_DIR="data dir" .
+$ cmake -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="install_prefix" -DDATA_INSTALL_DIR="data_dir" .
+
+add -DWITH_SERVER=1 to compile net server; to create a relocatable bundle under Mac OS X you can do
 
-add -DWITH_SERVER=1 to compile net server
+$ cmake -DCMAKE_BUILD_TYPE="Release" -DBUNDLE=1 .
+
+if you have QT installed but it is not found you can set it up with -DQT_QMAKE_EXECUTABLE="path_to_qmake"
 
 2. Compile:
 $ make
@@ -25,4 +29,5 @@
 3. Install:
 # make install
 
+
 That's all! Enjoy!
--- a/hedgewars/GSHandlers.inc	Thu Jul 02 14:59:27 2009 +0000
+++ b/hedgewars/GSHandlers.inc	Fri Jul 03 22:00:32 2009 +0000
@@ -470,7 +470,7 @@
 HHGear:=PHedgehog(Gear^.Hedgehog)^.Gear;
 HHGear^.State:= HHGear^.State or gstNotKickable;
 HedgehogChAngle(HHGear);
-if not cLaserSighting then // game doesn't have default laser sight. turn it on and give them a chance to aim
+if not cLaserSighting then // game does not have default laser sight. turn it on and give them a chance to aim
     begin
     cLaserSighting:= true;
     HHGear^.Message:= 0;
--- a/openalbridge/loaders.c	Thu Jul 02 14:59:27 2009 +0000
+++ b/openalbridge/loaders.c	Fri Jul 03 22:00:32 2009 +0000
@@ -155,7 +155,7 @@
 		fprintf(stderr, "Bitrate Lower: %ld\n", vorbisInfo->bitrate_lower);
 		fprintf(stderr, "Bitrate Windows: %ld\n", vorbisInfo->bitrate_window);
 		fprintf(stderr, "Vendor: %s\n", vorbisComment->vendor);
-		fprintf(stderr, "PCM data size: %ld\n", pcm_length);
+		fprintf(stderr, "PCM data size: %lld\n", pcm_length);
 		fprintf(stderr, "# comment: %d\n", vorbisComment->comments);
 		for (i = 0; i < vorbisComment->comments; i++)
 			fprintf(stderr, "\tComment %d: %s\n", i, vorbisComment->user_comments[i]);
--- a/openalbridge/openalwrap.c	Thu Jul 02 14:59:27 2009 +0000
+++ b/openalbridge/openalwrap.c	Fri Jul 03 22:00:32 2009 +0000
@@ -386,9 +386,24 @@
 	}
 
 	
+	ALint openal_setposition(uint32_t index, float x, float y, float z) {
+		if(openalReady == AL_FALSE)	{
+			fprintf(stderr, "ERROR: OpenAL not initialized\n");
+			return AL_FALSE;
+		}
+		if (index >= globalindex) {
+			fprintf(stderr, "ERROR: index out of bounds (got %d, max %d)\n", index, globalindex);
+			return AL_FALSE;
+		}
+		
+		alSource3f(Sources[index], AL_POSITION, x, y, z);
+		if (AlGetError("ERROR %d: setting position for last sound\n") != AL_TRUE)
+			return AL_FALSE;
+		
+		return AL_TRUE;
+	}
 	ALint openal_playsound(uint32_t index){
-		if(openalReady == AL_FALSE)
-		{
+		if(openalReady == AL_FALSE)	{
 			fprintf(stderr, "ERROR: OpenAL not initialized\n");
 			return AL_FALSE;
 		}
--- a/openalbridge/openalwrap.h	Thu Jul 02 14:59:27 2009 +0000
+++ b/openalbridge/openalwrap.h	Fri Jul 03 22:00:32 2009 +0000
@@ -28,6 +28,7 @@
 	int openal_close			(void);
 	int openal_loadfile			(const char *filename);
 	int openal_toggleloop		(unsigned int index);
+	int openal_setposition		(unsigned int index, float x, float y, float z);
 	int openal_setvolume		(unsigned int index, unsigned char percentage);
 	int openal_setglobalvolume	(unsigned char percentage);
 	int openal_togglemute		(void);
--- a/tools/CMakeLists.txt	Thu Jul 02 14:59:27 2009 +0000
+++ b/tools/CMakeLists.txt	Fri Jul 03 22:00:32 2009 +0000
@@ -6,13 +6,8 @@
 	message(FATAL_ERROR "The utility macdeployqt is required to create the bundle!")
 endif()
 
-#if(HAVE_NETSERVER)
+#dummy target, we're interested in the postscript
 add_custom_target(bundle)
-#set(deps_list hedgewars "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}")
-#else(HAVE_NETSERVER)
-#add_custom_target(bundle )
-#set(deps_list hedgewars "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}")
-#endif(HAVE_NETSERVER)
 
 set_target_properties(bundle PROPERTIES POST_INSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/CreateMacBundle.cmake)