NetBSD patch to use AUDIO_GETBUFINFO when available (contributed by jmcneill) SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Tue, 25 Sep 2012 20:45:31 -0700
branchSDL-1.2
changeset 6455 15c8ee21197b
parent 6411 ec7ccf5ee3dd
child 6460 2a971ffe1fad
NetBSD patch to use AUDIO_GETBUFINFO when available (contributed by jmcneill)
src/audio/sun/SDL_sunaudio.c
--- a/src/audio/sun/SDL_sunaudio.c	Sun Sep 02 16:05:29 2012 -0700
+++ b/src/audio/sun/SDL_sunaudio.c	Tue Sep 25 20:45:31 2012 -0700
@@ -47,6 +47,10 @@
 /* Open the audio device for playback, and don't block if busy */
 #define OPEN_FLAGS	(O_WRONLY|O_NONBLOCK)
 
+#if defined(AUDIO_GETINFO) && !defined(AUDIO_GETBUFINFO) 
+#define AUDIO_GETBUFINFO AUDIO_GETINFO
+#endif
+
 /* Audio driver functions */
 static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec);
 static void DSP_WaitAudio(_THIS);
@@ -119,11 +123,11 @@
 #ifdef DEBUG_AUDIO
 void CheckUnderflow(_THIS)
 {
-#ifdef AUDIO_GETINFO
+#ifdef AUDIO_GETBUFINFO
 	audio_info_t info;
 	int left;
 
-	ioctl(audio_fd, AUDIO_GETINFO, &info);
+	ioctl(audio_fd, AUDIO_GETBUFINFO, &info);
 	left = (written - info.play.samples);
 	if ( written && (left == 0) ) {
 		fprintf(stderr, "audio underflow!\n");
@@ -134,12 +138,12 @@
 
 void DSP_WaitAudio(_THIS)
 {
-#ifdef AUDIO_GETINFO
+#ifdef AUDIO_GETBUFINFO
 #define SLEEP_FUDGE	10		/* 10 ms scheduling fudge factor */
 	audio_info_t info;
 	Sint32 left;
 
-	ioctl(audio_fd, AUDIO_GETINFO, &info);
+	ioctl(audio_fd, AUDIO_GETBUFINFO, &info);
 	left = (written - info.play.samples);
 	if ( left > fragsize ) {
 		Sint32 sleepy;