Patches to help build for rdar://problem/5943453 ...
authorRyan C. Gordon <icculus@icculus.org>
Sat, 17 May 2008 01:23:51 +0000
changeset 87 2adddb19fe58
parent 86 72008f43823c
child 88 eef6b0b69408
Patches to help build for rdar://problem/5943453 ...
osx/test/test.c
osx/test/testcapture.c
--- a/osx/test/test.c	Sat May 17 01:03:30 2008 +0000
+++ b/osx/test/test.c	Sat May 17 01:23:51 2008 +0000
@@ -3,8 +3,8 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include "AL/al.h"
-#include "AL/alc.h"
+#include "al.h"
+#include "alc.h"
 
 
 #define LOAD_VORBIS 0
--- a/osx/test/testcapture.c	Sat May 17 01:03:30 2008 +0000
+++ b/osx/test/testcapture.c	Sat May 17 01:23:51 2008 +0000
@@ -10,17 +10,17 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include "AL/al.h"
-#include "AL/alc.h"
+#include "al.h"
+#include "alc.h"
 
 
-static ALCdevice* (*alcCaptureOpenDevice)(const ALubyte *deviceName,
+static ALCdevice* (*palcCaptureOpenDevice)(const ALubyte *deviceName,
                                      ALuint freq, ALenum fmt,
                                      ALsizei bufsize);
-static ALvoid (*alcCaptureCloseDevice)(ALCdevice *device);
-static ALvoid (*alcCaptureStart)(ALCdevice *device);
-static ALvoid (*alcCaptureStop)(ALCdevice *device);
-static ALvoid (*alcCaptureSamples)(ALCdevice *device, ALvoid *buf,
+static ALvoid (*palcCaptureCloseDevice)(ALCdevice *device);
+static ALvoid (*palcCaptureStart)(ALCdevice *device);
+static ALvoid (*palcCaptureStop)(ALCdevice *device);
+static ALvoid (*palcCaptureSamples)(ALCdevice *device, ALvoid *buf,
                                    ALsizei samps);
 
 ALenum _AL_FORMAT_MONO_FLOAT32 = 0;
@@ -38,7 +38,7 @@
     ALint samples = 0;
     ALenum capture_samples = alcGetEnumValue(in, "ALC_CAPTURE_SAMPLES");
     printf("recording...\n");
-    alcCaptureStart(in);
+    palcCaptureStart(in);
 
     while (samples < SAMPS)
     {
@@ -46,8 +46,8 @@
         usleep(10000);
     } // while
 
-    alcCaptureSamples(in, buf, SAMPS);
-    alcCaptureStop(in);
+    palcCaptureSamples(in, buf, SAMPS);
+    palcCaptureStop(in);
     return(buf);  // buf has SAMPS samples of FMT audio at FREQ.
 } // recordSomething
 
@@ -60,18 +60,21 @@
     ALint state = AL_PLAYING;
 
     if (!alcIsExtensionPresent(NULL, "ALC_EXT_capture"))
-    {
-        fprintf(stderr, "No ALC_EXT_capture support.\n");
-        return(42);
-    } // if
+        fprintf(stderr, "No ALC_EXT_capture support reported.\n");
 
-    #define GET_PROC(x) x = alcGetProcAddress(NULL, (ALubyte *) #x)
+    #define GET_PROC(x) p##x = alcGetProcAddress(NULL, (ALubyte *) #x)
     GET_PROC(alcCaptureOpenDevice);
     GET_PROC(alcCaptureCloseDevice);
     GET_PROC(alcCaptureStart);
     GET_PROC(alcCaptureStop);
     GET_PROC(alcCaptureSamples);
 
+    if (palcCaptureOpenDevice == NULL)
+    {
+        fprintf(stderr, "entry points missing, extension really doesn't exist.\n");
+        return 42;   // it really doesn't exist, bail.
+    } // if
+
     // these may not exist, depending on the implementation.
     _AL_FORMAT_MONO_FLOAT32 = alGetEnumValue((ALubyte *) "AL_FORMAT_MONO_FLOAT32");
     _AL_FORMAT_STEREO_FLOAT32 = alGetEnumValue((ALubyte *) "AL_FORMAT_STEREO_FLOAT32");
@@ -98,7 +101,7 @@
     } // else
 
     alutInit(&argc, argv);
-    in = alcCaptureOpenDevice(NULL, FREQ, FMT, SAMPS);
+    in = palcCaptureOpenDevice(NULL, FREQ, FMT, SAMPS);
     if (in == NULL)
     {
         fprintf(stderr, "Couldn't open capture device.\n");
@@ -108,7 +111,7 @@
 
     recordSomething();
 
-    alcCaptureCloseDevice(in);
+    palcCaptureCloseDevice(in);
 
     alGenSources(1, &sid);
     alGenBuffers(1, &bid);