Index: code/sound/openal.cpp
===================================================================
--- code/sound/openal.cpp    (revision 8970)
+++ code/sound/openal.cpp    (working copy)
@@ -197,19 +197,21 @@ static void find_playback_device()
 		// check how many sources we can create
 		static const int MIN_SOURCES = 48;	// MAX_CHANNELS + 16 spare
 		int si = 0;
+		ALuint source_id[MIN_SOURCES] = {0};
 
-		for (si = 0; si < MIN_SOURCES; si++) {
-			ALuint source_id = 0;
-			alGenSources(1, &source_id);
+		for (si = 1; si <= MIN_SOURCES; si++) {
+			alGenSources(si, &source_id[0]);
 
-			if (alGetError() != AL_NO_ERROR) {
+			const char *error_text = openal_error_string(0);
+			if ( error_text != NULL ) {
+				mprintf(("OpenAL error \"%s\" when creating %i sources with device: %s\n",error_text,si,pdev->device_name.c_str()));
 				break;
 			}
 
-			alDeleteSources(1, &source_id);
+			alDeleteSources(si, &source_id[0]);
 		}
 
-		if (si == MIN_SOURCES) {
+		if (si == MIN_SOURCES+1) {
 			// ok, it supports our minimum requirements
 			pdev->usable = true;
 
