On Tue, Jan 20, 2009 at 10:24:47AM +0000, Jacob Meuser wrote: *sigh*
there was a chunk missing from that diff. -- jake...@sdf.lonestar.org SDF Public Access UNIX System - http://sdf.lonestar.org Index: Makefile =================================================================== RCS file: /cvs/ports/devel/sdl/Makefile,v retrieving revision 1.71 diff -u -r1.71 Makefile --- Makefile 8 Jan 2009 20:38:11 -0000 1.71 +++ Makefile 20 Jan 2009 12:18:37 -0000 @@ -4,7 +4,7 @@ VERSION= 1.2.13 DISTNAME= SDL-${VERSION} -PKGNAME= ${DISTNAME:L}p10 +PKGNAME= ${DISTNAME:L}p11 CATEGORIES= devel HOMEPAGE= http://www.libsdl.org/ @@ -40,7 +40,7 @@ CONFIGURE_ENV+= X11BASE="${X11BASE}" \ CFLAGS="${CFLAGS} -I${LOCALBASE}/include" \ LDFLAGS="-L${LOCALBASE}/lib" \ - WITH_LIBSNDIO="Yes" + WITH_SNDIO="Yes" # in case devel/usb is installed, don't pick it up. CONFIGURE_ENV+= ac_cv_lib_usb_hid_init=no \ Index: files/SDL_libsndioaudio.c =================================================================== RCS file: /cvs/ports/devel/sdl/files/SDL_libsndioaudio.c,v retrieving revision 1.4 diff -u -r1.4 SDL_libsndioaudio.c --- files/SDL_libsndioaudio.c 8 Jan 2009 20:10:46 -0000 1.4 +++ files/SDL_libsndioaudio.c 20 Jan 2009 12:18:37 -0000 @@ -32,14 +32,14 @@ #include "SDL_libsndioaudio.h" /* The tag name used by libsndio audio */ -#define LIBSNDIO_DRIVER_NAME "libsndio" +#define SNDIO_DRIVER_NAME "sndio" /* Audio driver functions */ -static int LIBSNDIO_OpenAudio(_THIS, SDL_AudioSpec *spec); -static void LIBSNDIO_WaitAudio(_THIS); -static void LIBSNDIO_PlayAudio(_THIS); -static Uint8 *LIBSNDIO_GetAudioBuf(_THIS); -static void LIBSNDIO_CloseAudio(_THIS); +static int SNDIO_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void SNDIO_WaitAudio(_THIS); +static void SNDIO_PlayAudio(_THIS); +static Uint8 *SNDIO_GetAudioBuf(_THIS); +static void SNDIO_CloseAudio(_THIS); /* Audio driver bootstrap functions */ @@ -83,11 +83,11 @@ SDL_memset(this->hidden, 0, (sizeof *this->hidden)); /* Set the function pointers */ - this->OpenAudio = LIBSNDIO_OpenAudio; - this->WaitAudio = LIBSNDIO_WaitAudio; - this->PlayAudio = LIBSNDIO_PlayAudio; - this->GetAudioBuf = LIBSNDIO_GetAudioBuf; - this->CloseAudio = LIBSNDIO_CloseAudio; + this->OpenAudio = SNDIO_OpenAudio; + this->WaitAudio = SNDIO_WaitAudio; + this->PlayAudio = SNDIO_PlayAudio; + this->GetAudioBuf = SNDIO_GetAudioBuf; + this->CloseAudio = SNDIO_CloseAudio; this->free = Audio_DeleteDevice; @@ -96,18 +96,16 @@ return this; } -AudioBootStrap LIBSNDIO_bootstrap = { - LIBSNDIO_DRIVER_NAME, "libsndio", +AudioBootStrap SNDIO_bootstrap = { + SNDIO_DRIVER_NAME, "sndio", Audio_Available, Audio_CreateDevice }; /* This function waits until it is possible to write a full sound buffer */ -static void LIBSNDIO_WaitAudio(_THIS) +static void SNDIO_WaitAudio(_THIS) { - Sint32 ticks; - /* Check to see if the thread-parent process is still alive */ { static int cnt = 0; /* Note that this only works with thread implementations @@ -119,26 +117,15 @@ } } } - - /* Use timer for general audio synchronization */ - ticks = ((Sint32)(next_frame - SDL_GetTicks()))-FUDGE_TICKS; - if ( ticks > 0 ) { - SDL_Delay(ticks); - } } -static void LIBSNDIO_PlayAudio(_THIS) +static void SNDIO_PlayAudio(_THIS) { int written; /* Write the audio data */ written = sio_write(hdl, mixbuf, mixlen); - /* If timer synchronization is enabled, set the next write frame */ - if ( frame_ticks ) { - next_frame += frame_ticks; - } - /* If we couldn't write, assume fatal error for now */ if ( written == 0 ) { this->enabled = 0; @@ -148,12 +135,12 @@ #endif } -static Uint8 *LIBSNDIO_GetAudioBuf(_THIS) +static Uint8 *SNDIO_GetAudioBuf(_THIS) { return(mixbuf); } -static void LIBSNDIO_CloseAudio(_THIS) +static void SNDIO_CloseAudio(_THIS) { if ( mixbuf != NULL ) { SDL_FreeAudioMem(mixbuf); @@ -165,14 +152,10 @@ } } -static int LIBSNDIO_OpenAudio(_THIS, SDL_AudioSpec *spec) +static int SNDIO_OpenAudio(_THIS, SDL_AudioSpec *spec) { struct sio_par par; - /* Reset the timer synchronization flag */ - frame_ticks = 0.0; - next_frame = 0; - mixbuf = NULL; if ((hdl = sio_open(NULL, SIO_PLAY, 0)) == NULL) { @@ -212,19 +195,14 @@ par.sig = 0; break; default: - SDL_SetError("LIBSNDIO unknown format"); + SDL_SetError("SNDIO unknown format"); return(-1); } par.rate = spec->freq; par.pchan = spec->channels; - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(spec); - - /* bufsz is in frames, size is in bytes. they both are counts - of the total buffer size (total latency desired) */ - par.appbufsz = spec->size / par.pchan / (par.bits / 8); + par.round = spec->samples; + par.appbufsz = par.round * 2; if (sio_setpar(hdl, &par) == 0) { SDL_SetError("sio_setpar() failed"); @@ -269,19 +247,15 @@ } else if (par.bits == 8) { spec->format = par.sig ? AUDIO_S8 : AUDIO_U8; } else { - SDL_SetError("LIBSNDIO couldn't configure a suitable format"); + SDL_SetError("SNDIO couldn't configure a suitable format"); return(-1); } spec->freq = par.rate; spec->channels = par.pchan; + spec->samples = par.round; - /* tell SDL we want to write in par.round sized blocks */ - /* this is problematic for some applications, don't do it now. - maybe in SDL-1.3. - spec->size = par.bufsz * par.pchan * par.bps; - frame_ticks = (float)par.bufsz / par.rate; - */ + SDL_CalculateAudioSpec(spec); /* Allocate mixing buffer */ mixlen = spec->size; Index: files/SDL_libsndioaudio.h =================================================================== RCS file: /cvs/ports/devel/sdl/files/SDL_libsndioaudio.h,v retrieving revision 1.2 diff -u -r1.2 SDL_libsndioaudio.h --- files/SDL_libsndioaudio.h 13 Nov 2008 22:09:59 -0000 1.2 +++ files/SDL_libsndioaudio.h 20 Jan 2009 12:18:37 -0000 @@ -38,19 +38,13 @@ Uint8 *mixbuf; int mixlen; - /* Support for audio timing using a timer, in addition to select() */ - float frame_ticks; - float next_frame; }; -#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ /* Old variable names */ #define stream (this->hidden->stream) #define parent (this->hidden->parent) #define mixbuf (this->hidden->mixbuf) #define mixlen (this->hidden->mixlen) -#define frame_ticks (this->hidden->frame_ticks) -#define next_frame (this->hidden->next_frame) #define hdl (this->hidden->hdl) #endif /* _SDL_libsaaudio_h */ Index: patches/patch-configure =================================================================== RCS file: /cvs/ports/devel/sdl/patches/patch-configure,v retrieving revision 1.19 diff -u -r1.19 patch-configure --- patches/patch-configure 30 Dec 2008 02:15:20 -0000 1.19 +++ patches/patch-configure 20 Jan 2009 12:18:37 -0000 @@ -6,12 +6,12 @@ } + -+CheckLibsndio() ++CheckSndio() +{ -+ if [ x"$WITH_LIBSNDIO" = x"Yes" ]; then ++ if [ x"$WITH_SNDIO" = x"Yes" ]; then + + cat >>confdefs.h <<\_ACEOF -+#define SDL_AUDIO_DRIVER_LIBSNDIO 1 ++#define SDL_AUDIO_DRIVER_SNDIO 1 +_ACEOF + SOURCES="$SOURCES $srcdir/src/audio/libsndio/*.c" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lsndio" @@ -36,7 +36,7 @@ CheckALSA CheckARTSC CheckESD -+ CheckLibsndio ++ CheckSndio CheckPulseAudio CheckNAS CheckX11 Index: patches/patch-include_SDL_config_h_in =================================================================== RCS file: /cvs/ports/devel/sdl/patches/patch-include_SDL_config_h_in,v retrieving revision 1.1 diff -u -r1.1 patch-include_SDL_config_h_in --- patches/patch-include_SDL_config_h_in 2 Nov 2008 14:53:51 -0000 1.1 +++ patches/patch-include_SDL_config_h_in 20 Jan 2009 12:18:37 -0000 @@ -5,7 +5,7 @@ #undef SDL_AUDIO_DRIVER_QNXNTO #undef SDL_AUDIO_DRIVER_SNDMGR #undef SDL_AUDIO_DRIVER_SUNAUDIO -+#undef SDL_AUDIO_DRIVER_LIBSNDIO ++#undef SDL_AUDIO_DRIVER_SNDIO #undef SDL_AUDIO_DRIVER_WAVEOUT /* Enable various cdrom drivers */ Index: patches/patch-src_audio_SDL_audio_c =================================================================== RCS file: /cvs/ports/devel/sdl/patches/patch-src_audio_SDL_audio_c,v retrieving revision 1.15 diff -u -r1.15 patch-src_audio_SDL_audio_c --- patches/patch-src_audio_SDL_audio_c 30 Dec 2008 02:15:20 -0000 1.15 +++ patches/patch-src_audio_SDL_audio_c 20 Jan 2009 12:18:37 -0000 @@ -5,8 +5,8 @@ /* Available audio drivers */ static AudioBootStrap *bootstrap[] = { -+#if SDL_AUDIO_DRIVER_LIBSNDIO -+ &LIBSNDIO_bootstrap, ++#if SDL_AUDIO_DRIVER_SNDIO ++ &SNDIO_bootstrap, +#endif #if SDL_AUDIO_DRIVER_BSD &BSD_AUDIO_bootstrap, Index: patches/patch-src_audio_SDL_sysaudio_h =================================================================== RCS file: /cvs/ports/devel/sdl/patches/patch-src_audio_SDL_sysaudio_h,v retrieving revision 1.4 diff -u -r1.4 patch-src_audio_SDL_sysaudio_h --- patches/patch-src_audio_SDL_sysaudio_h 2 Nov 2008 14:53:51 -0000 1.4 +++ patches/patch-src_audio_SDL_sysaudio_h 20 Jan 2009 12:18:37 -0000 @@ -5,8 +5,8 @@ #if SDL_AUDIO_DRIVER_BSD extern AudioBootStrap BSD_AUDIO_bootstrap; #endif -+#if SDL_AUDIO_DRIVER_LIBSNDIO -+extern AudioBootStrap LIBSNDIO_bootstrap; ++#if SDL_AUDIO_DRIVER_SNDIO ++extern AudioBootStrap SNDIO_bootstrap; +#endif #if SDL_AUDIO_DRIVER_PULSE extern AudioBootStrap PULSE_bootstrap;