View Issue Details

IDProjectCategoryView StatusLast Update
0001156FSSCPsoundpublic2006-11-26 18:12
Reporterjonas Assigned Totaylor  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionwon't fix 
Product Version3.6.9 
Summary0001156: No sound on MacOSX in current CVS (25/11)
DescriptionFreespace gives the following error in the log file:

SOUND: /Users/jonas/fs/fs2_open/projects/Xcode/../../code/sound/ds.cpp:1779 - OpenAL error = 'ALC Invalid Device'

I tried it on a Firewire 800 MDD PowerMac and a G4 PowerBook 15' with optical audio. Both running MacOSX 10.4.8.
The MDD does have PCI Revolution 5.1 card but I don't think it is causing any problems in this case as it is possible to reproduce the bug on the PowerBook to.

Additional InformationWhen debugging freespace, the function "alcOpenDevice()" seem to return a non NULL value, but thats where my knowledge ends.
TagsNo tags attached.

Activities

taylor

2006-11-26 03:21

administrator   ~0007174

This is known, but totally on Apple. They screwed up something in their OpenAL 1.1 implementation that was part of the 10.4.7 update. For some reason it never appears to reset error codes, so if an error is ever set then it can't be cleared and with the amount of error checking that we do, it will hit on errors that have never happened. I can't exactly remember if this affected just ALC or also standard AL errors though, but it might have been both. Accoding to spec, a call to get the current error should return said error and clear the current error code. The Apple version doesn't appear to do this, it returns the current code, but never clears it for the next call. Because of this there is always an error present when you check.

For OS X builds I've been doing I just manually change the code to not abort on such conditions and instead simply report the error instead. I am not going to commit code to CVS to fix some stupid Apple screw-up, so it will stay broken until Apple fixes their code.

It's pretty easy to fix on your own though. I'm not sure if it applies cleanly to current CVS, but here is a patch which doesn't execute error conditions on the OpenAL calls. This is a little dangerous though, since there is nothing to prevent it from acting on something by mistake. Since there isn't a way to determine if there has actually been an error on the current OpenAL call though, there is little choice in the matter.

2006-11-26 03:21

 

apple-ds_h-fix.diff (1,810 bytes)   
Index: code/sound/ds.h
===================================================================
RCS file: /home/fs2source/cvsroot/fs2_open/code/sound/ds.h,v
retrieving revision 2.18.2.2
diff -u -r2.18.2.2 ds.h
--- code/sound/ds.h	6 Jul 2006 21:56:18 -0000	2.18.2.2
+++ code/sound/ds.h	26 Nov 2006 03:19:26 -0000
@@ -254,6 +254,7 @@
 extern const char* openal_error_string(int get_alc = 0);
 
 // if an error occurs after executing 'x' then do 'y'
+#ifndef __APPLE__
 #define OpenAL_ErrorCheck( x, y )	do {	\
 	x;	\
 	const char *error_text = openal_error_string(0);	\
@@ -262,6 +263,17 @@
 		y;	\
 	}	\
 } while (0);
+#else
+// fscking Apple bastards...
+#define OpenAL_ErrorCheck( x, y )	do {	\
+	x;	\
+	const char *error_text = openal_error_string(0);	\
+	if ( error_text != NULL ) {	\
+		nprintf(("Warning", "SOUND: %s:%d - OpenAL error = '%s'\n", __FILE__, __LINE__, error_text));	\
+		/*y;*/	\
+	}	\
+} while (0);
+#endif
 
 // like OpenAL_ErrorCheck() except that it gives the error message from x but does nothing about it
 #define OpenAL_ErrorPrint( x )	do {	\
@@ -273,6 +285,7 @@
 } while (0);
 
 // same as the above two, but looks for ALC errors instead of standard AL errors
+#ifndef __APPLE__
 #define OpenAL_C_ErrorCheck( x, y )	do {	\
 	x;	\
 	const char *error_text = openal_error_string(1);	\
@@ -281,6 +294,17 @@
 		y;	\
 	}	\
 } while (0);
+#else
+// fscking Apple bastards...
+#define OpenAL_C_ErrorCheck( x, y )	do {	\
+	x;	\
+	const char *error_text = openal_error_string(1);	\
+	if ( error_text != NULL ) {	\
+		nprintf(("Warning", "SOUND: %s:%d - OpenAL error = '%s'\n", __FILE__, __LINE__, error_text));	\
+		/*y;*/	\
+	}	\
+} while (0);
+#endif
 
 // like OpenAL_ErrorCheck() except that it gives the error message from x but does nothing about it
 #define OpenAL_C_ErrorPrint( x )	do {	\
apple-ds_h-fix.diff (1,810 bytes)   

jonas

2006-11-26 16:17

reporter   ~0007178

Ok, thanks!

Worked with your patch applied.

taylor

2006-11-26 18:12

administrator   ~0007182

Waiting for Apple to fix this on their side.

Issue History

Date Modified Username Field Change
2006-11-26 03:00 jonas New Issue
2006-11-26 03:21 taylor Note Added: 0007174
2006-11-26 03:21 taylor File Added: apple-ds_h-fix.diff
2006-11-26 03:21 taylor Status new => assigned
2006-11-26 03:21 taylor Assigned To => taylor
2006-11-26 16:17 jonas Note Added: 0007178
2006-11-26 18:12 taylor Status assigned => resolved
2006-11-26 18:12 taylor Resolution open => won't fix
2006-11-26 18:12 taylor Note Added: 0007182