Commit 303287a1 authored by Sam Lantinga's avatar Sam Lantinga

IRIX is not supported anymore. :)

parent 8706244c
...@@ -21628,74 +21628,6 @@ _ACEOF ...@@ -21628,74 +21628,6 @@ _ACEOF
fi fi
} }
CheckDMEDIA()
{
if test x$enable_audio = xyes; then
{ echo "$as_me:$LINENO: checking for dmedia audio support" >&5
echo $ECHO_N "checking for dmedia audio support... $ECHO_C" >&6; }
have_dmedia=no
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <dmedia/audio.h>
int
main ()
{
ALport audio_port;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
have_dmedia=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ echo "$as_me:$LINENO: result: $have_dmedia" >&5
echo "${ECHO_T}$have_dmedia" >&6; }
# Set up files for the audio library
if test x$have_dmedia = xyes; then
cat >>confdefs.h <<\_ACEOF
#define SDL_AUDIO_DRIVER_DMEDIA 1
_ACEOF
SOURCES="$SOURCES $srcdir/src/audio/dmedia/*.c"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laudio"
have_audio=yes
fi
fi
}
CheckMME() CheckMME()
{ {
case $ARCH in case $ARCH in
...@@ -22582,10 +22514,6 @@ echo $ECHO_N "checking for NAS audio support... $ECHO_C" >&6; } ...@@ -22582,10 +22514,6 @@ echo $ECHO_N "checking for NAS audio support... $ECHO_C" >&6; }
NAS_CFLAGS="-I/usr/X11R6/include/" NAS_CFLAGS="-I/usr/X11R6/include/"
NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt" NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
elif test -r /usr/freeware/include/nas/audiolib.h; then
have_nas=yes
NAS_LIBS="-lnas -lXt"
fi fi
{ echo "$as_me:$LINENO: result: $have_nas" >&5 { echo "$as_me:$LINENO: result: $have_nas" >&5
...@@ -24096,10 +24024,6 @@ fi ...@@ -24096,10 +24024,6 @@ fi
x11_lib='libX11.so' x11_lib='libX11.so'
x11ext_lib='libXext.so' x11ext_lib='libXext.so'
;; ;;
*-*-irix*) # IRIX 6.5 requires that we use /usr/lib32
x11_lib='libX11.so'
x11ext_lib='libXext.so'
;;
*) *)
x11_lib=`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` x11_lib=`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`
x11ext_lib=`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` x11ext_lib=`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`
...@@ -25834,10 +25758,6 @@ fi ...@@ -25834,10 +25758,6 @@ fi
pthread_cflags="-D_REENTRANT -Kthread" pthread_cflags="-D_REENTRANT -Kthread"
pthread_lib="" pthread_lib=""
;; ;;
*-*-irix*)
pthread_cflags="-D_SGI_MP_SOURCE"
pthread_lib="-lpthread"
;;
*-*-aix*) *-*-aix*)
pthread_cflags="-D_REENTRANT -mthreads" pthread_cflags="-D_REENTRANT -mthreads"
pthread_lib="-lpthread" pthread_lib="-lpthread"
...@@ -28322,7 +28242,7 @@ fi ...@@ -28322,7 +28242,7 @@ fi
} }
case "$host" in case "$host" in
*-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*|*-*-minix*) *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-osf*|*-*-minix*)
case "$host" in case "$host" in
*-*-linux*) ARCH=linux ;; *-*-linux*) ARCH=linux ;;
*-*-uclinux*) ARCH=linux ;; *-*-uclinux*) ARCH=linux ;;
...@@ -28338,7 +28258,6 @@ case "$host" in ...@@ -28338,7 +28258,6 @@ case "$host" in
*-*-sysv5*) ARCH=sysv5 ;; *-*-sysv5*) ARCH=sysv5 ;;
*-*-solaris*) ARCH=solaris ;; *-*-solaris*) ARCH=solaris ;;
*-*-hpux*) ARCH=hpux ;; *-*-hpux*) ARCH=hpux ;;
*-*-irix*) ARCH=irix ;;
*-*-aix*) ARCH=aix ;; *-*-aix*) ARCH=aix ;;
*-*-osf*) ARCH=osf ;; *-*-osf*) ARCH=osf ;;
*-*-minix*) ARCH=minix ;; *-*-minix*) ARCH=minix ;;
...@@ -28349,7 +28268,6 @@ case "$host" in ...@@ -28349,7 +28268,6 @@ case "$host" in
CheckDummyAudio CheckDummyAudio
CheckDLOPEN CheckDLOPEN
CheckOSS CheckOSS
CheckDMEDIA
CheckMME CheckMME
CheckALSA CheckALSA
CheckPulseAudio CheckPulseAudio
...@@ -28437,17 +28355,6 @@ _ACEOF ...@@ -28437,17 +28355,6 @@ _ACEOF
;; ;;
esac esac
fi fi
# Set up files for the thread library
if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
cat >>confdefs.h <<\_ACEOF
#define SDL_THREAD_SPROC 1
_ACEOF
SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
have_threads=yes
fi
# Set up files for the timer library # Set up files for the timer library
if test x$enable_timers = xyes; then if test x$enable_timers = xyes; then
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
...@@ -28950,7 +28857,7 @@ SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([^ ]*\\)/\\([^ ]*\\)\\.c,\\ ...@@ -28950,7 +28857,7 @@ SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([^ ]*\\)/\\([^ ]*\\)\\.c,\\
# Set runtime shared library paths as needed # Set runtime shared library paths as needed
if test "x$enable_rpath" = "xyes"; then if test "x$enable_rpath" = "xyes"; then
if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}" SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
fi fi
if test $ARCH = solaris; then if test $ARCH = solaris; then
......
...@@ -758,30 +758,6 @@ AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[de ...@@ -758,30 +758,6 @@ AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[de
fi fi
} }
dnl Check whether we want to use IRIX 6.5+ native audio or not
CheckDMEDIA()
{
if test x$enable_audio = xyes; then
AC_MSG_CHECKING(for dmedia audio support)
have_dmedia=no
AC_TRY_COMPILE([
#include <dmedia/audio.h>
],[
ALport audio_port;
],[
have_dmedia=yes
])
AC_MSG_RESULT($have_dmedia)
# Set up files for the audio library
if test x$have_dmedia = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_DMEDIA)
SOURCES="$SOURCES $srcdir/src/audio/dmedia/*.c"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laudio"
have_audio=yes
fi
fi
}
dnl Check whether we want to use Tru64 UNIX native audio or not dnl Check whether we want to use Tru64 UNIX native audio or not
CheckMME() CheckMME()
{ {
...@@ -973,12 +949,6 @@ AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]), ...@@ -973,12 +949,6 @@ AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
NAS_CFLAGS="-I/usr/X11R6/include/" NAS_CFLAGS="-I/usr/X11R6/include/"
NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt" NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
dnl On IRIX, the NAS includes are in a different directory,
dnl and libnas must be explicitly linked in
elif test -r /usr/freeware/include/nas/audiolib.h; then
have_nas=yes
NAS_LIBS="-lnas -lXt"
fi fi
AC_MSG_RESULT($have_nas) AC_MSG_RESULT($have_nas)
...@@ -1106,10 +1076,6 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma ...@@ -1106,10 +1076,6 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma
x11_lib='libX11.so' x11_lib='libX11.so'
x11ext_lib='libXext.so' x11ext_lib='libXext.so'
;; ;;
*-*-irix*) # IRIX 6.5 requires that we use /usr/lib32
x11_lib='libX11.so'
x11ext_lib='libXext.so'
;;
*) *)
x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
...@@ -1645,10 +1611,6 @@ AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]) ...@@ -1645,10 +1611,6 @@ AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]])
pthread_cflags="-D_REENTRANT -Kthread" pthread_cflags="-D_REENTRANT -Kthread"
pthread_lib="" pthread_lib=""
;; ;;
*-*-irix*)
pthread_cflags="-D_SGI_MP_SOURCE"
pthread_lib="-lpthread"
;;
*-*-aix*) *-*-aix*)
pthread_cflags="-D_REENTRANT -mthreads" pthread_cflags="-D_REENTRANT -mthreads"
pthread_lib="-lpthread" pthread_lib="-lpthread"
...@@ -2024,7 +1986,7 @@ AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]] ...@@ -2024,7 +1986,7 @@ AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]
dnl Set up the configuration based on the host platform! dnl Set up the configuration based on the host platform!
case "$host" in case "$host" in
*-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*|*-*-minix*) *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-osf*|*-*-minix*)
case "$host" in case "$host" in
*-*-linux*) ARCH=linux ;; *-*-linux*) ARCH=linux ;;
*-*-uclinux*) ARCH=linux ;; *-*-uclinux*) ARCH=linux ;;
...@@ -2040,7 +2002,6 @@ case "$host" in ...@@ -2040,7 +2002,6 @@ case "$host" in
*-*-sysv5*) ARCH=sysv5 ;; *-*-sysv5*) ARCH=sysv5 ;;
*-*-solaris*) ARCH=solaris ;; *-*-solaris*) ARCH=solaris ;;
*-*-hpux*) ARCH=hpux ;; *-*-hpux*) ARCH=hpux ;;
*-*-irix*) ARCH=irix ;;
*-*-aix*) ARCH=aix ;; *-*-aix*) ARCH=aix ;;
*-*-osf*) ARCH=osf ;; *-*-osf*) ARCH=osf ;;
*-*-minix*) ARCH=minix ;; *-*-minix*) ARCH=minix ;;
...@@ -2051,7 +2012,6 @@ case "$host" in ...@@ -2051,7 +2012,6 @@ case "$host" in
CheckDummyAudio CheckDummyAudio
CheckDLOPEN CheckDLOPEN
CheckOSS CheckOSS
CheckDMEDIA
CheckMME CheckMME
CheckALSA CheckALSA
CheckPulseAudio CheckPulseAudio
...@@ -2121,14 +2081,6 @@ case "$host" in ...@@ -2121,14 +2081,6 @@ case "$host" in
;; ;;
esac esac
fi fi
# Set up files for the thread library
if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
AC_DEFINE(SDL_THREAD_SPROC)
SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
have_threads=yes
fi
# Set up files for the timer library # Set up files for the timer library
if test x$enable_timers = xyes; then if test x$enable_timers = xyes; then
AC_DEFINE(SDL_TIMER_UNIX) AC_DEFINE(SDL_TIMER_UNIX)
...@@ -2508,7 +2460,7 @@ SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\. ...@@ -2508,7 +2460,7 @@ SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.
# Set runtime shared library paths as needed # Set runtime shared library paths as needed
if test "x$enable_rpath" = "xyes"; then if test "x$enable_rpath" = "xyes"; then
if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}" SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
fi fi
if test $ARCH = solaris; then if test $ARCH = solaris; then
......
...@@ -197,7 +197,6 @@ ...@@ -197,7 +197,6 @@
#undef SDL_AUDIO_DRIVER_COREAUDIO #undef SDL_AUDIO_DRIVER_COREAUDIO
#undef SDL_AUDIO_DRIVER_DISK #undef SDL_AUDIO_DRIVER_DISK
#undef SDL_AUDIO_DRIVER_DUMMY #undef SDL_AUDIO_DRIVER_DUMMY
#undef SDL_AUDIO_DRIVER_DMEDIA
#undef SDL_AUDIO_DRIVER_DSOUND #undef SDL_AUDIO_DRIVER_DSOUND
#undef SDL_AUDIO_DRIVER_ESD #undef SDL_AUDIO_DRIVER_ESD
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
......
...@@ -51,7 +51,6 @@ extern AudioBootStrap ALSA_bootstrap; ...@@ -51,7 +51,6 @@ extern AudioBootStrap ALSA_bootstrap;
extern AudioBootStrap PULSEAUDIO_bootstrap; extern AudioBootStrap PULSEAUDIO_bootstrap;
extern AudioBootStrap QSAAUDIO_bootstrap; extern AudioBootStrap QSAAUDIO_bootstrap;
extern AudioBootStrap SUNAUDIO_bootstrap; extern AudioBootStrap SUNAUDIO_bootstrap;
extern AudioBootStrap DMEDIA_bootstrap;
extern AudioBootStrap ARTS_bootstrap; extern AudioBootStrap ARTS_bootstrap;
extern AudioBootStrap ESD_bootstrap; extern AudioBootStrap ESD_bootstrap;
extern AudioBootStrap NAS_bootstrap; extern AudioBootStrap NAS_bootstrap;
...@@ -93,9 +92,6 @@ static const AudioBootStrap *const bootstrap[] = { ...@@ -93,9 +92,6 @@ static const AudioBootStrap *const bootstrap[] = {
#if SDL_AUDIO_DRIVER_SUNAUDIO #if SDL_AUDIO_DRIVER_SUNAUDIO
&SUNAUDIO_bootstrap, &SUNAUDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_DMEDIA
&DMEDIA_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_ARTS #if SDL_AUDIO_DRIVER_ARTS
&ARTS_bootstrap, &ARTS_bootstrap,
#endif #endif
......
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2011 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include <errno.h>
#include "SDL_config.h"
/* Allow access to a raw mixing buffer (For IRIX 6.5 and higher) */
/* patch for IRIX 5 by Georg Schwarz 18/07/2004 */
#include "SDL_timer.h"
#include "SDL_audio.h"
#include "../SDL_audiomem.h"
#include "../SDL_audio_c.h"
#include "SDL_irixaudio.h"
#ifndef AL_RESOURCE /* as a test whether we use the old IRIX audio libraries */
#define OLD_IRIX_AUDIO
#define alClosePort(x) ALcloseport(x)
#define alFreeConfig(x) ALfreeconfig(x)
#define alGetFillable(x) ALgetfillable(x)
#define alNewConfig() ALnewconfig()
#define alOpenPort(x,y,z) ALopenport(x,y,z)
#define alSetChannels(x,y) ALsetchannels(x,y)
#define alSetQueueSize(x,y) ALsetqueuesize(x,y)
#define alSetSampFmt(x,y) ALsetsampfmt(x,y)
#define alSetWidth(x,y) ALsetwidth(x,y)
#endif
void static
IRIXAUDIO_WaitDevice(_THIS)
{
Sint32 timeleft;
timeleft = this->spec.samples - alGetFillable(this->hidden->audio_port);
if (timeleft > 0) {
timeleft /= (this->spec.freq / 1000);
SDL_Delay((Uint32) timeleft);
}
}
static void
IRIXAUDIO_PlayDevice(_THIS)
{
/* Write the audio data out */
ALport port = this->hidden->audio_port;
Uint8 *mixbuf = this->hidden->mixbuf;
if (alWriteFrames(port, mixbuf, this->spec.samples) < 0) {
/* Assume fatal error, for now */
this->enabled = 0;
}
}
static Uint8 *
IRIXAUDIO_GetDeviceBuf(_THIS)
{
return (this->hidden->mixbuf);
}
static void
IRIXAUDIO_CloseDevice(_THIS)
{
if (this->hidden != NULL) {
if (this->hidden->mixbuf != NULL) {
SDL_FreeAudioMem(this->hidden->mixbuf);
this->hidden->mixbuf = NULL;
}
if (this->hidden->audio_port != NULL) {
alClosePort(this->hidden->audio_port);
this->hidden->audio_port = NULL;
}
SDL_free(this->hidden);
this->hidden = NULL;
}
}
static int
IRIXAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
{
SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
long width = 0;
long fmt = 0;
int valid = 0;
/* !!! FIXME: Handle multiple devices and capture? */
/* Initialize all variables that we clean on shutdown */
this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc((sizeof *this->hidden));
if (this->hidden == NULL) {
SDL_OutOfMemory();
return 0;
}
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
#ifdef OLD_IRIX_AUDIO
{
long audio_param[2];
audio_param[0] = AL_OUTPUT_RATE;
audio_param[1] = this->spec.freq;
valid = (ALsetparams(AL_DEFAULT_DEVICE, audio_param, 2) < 0);
}
#else
{
ALpv audio_param;
audio_param.param = AL_RATE;
audio_param.value.i = this->spec.freq;
valid = (alSetParams(AL_DEFAULT_OUTPUT, &audio_param, 1) < 0);
}
#endif
while ((!valid) && (test_format)) {
valid = 1;
this->spec.format = test_format;
switch (test_format) {
case AUDIO_S8:
width = AL_SAMPLE_8;
fmt = AL_SAMPFMT_TWOSCOMP;
break;
case AUDIO_S16SYS:
width = AL_SAMPLE_16;
fmt = AL_SAMPFMT_TWOSCOMP;
break;
case AUDIO_F32SYS:
width = 0; /* not used here... */
fmt = AL_SAMPFMT_FLOAT;
break;
/* Docs say there is int24, but not int32.... */
default:
valid = 0;
test_format = SDL_NextAudioFormat();
break;
}
if (valid) {
ALconfig audio_config = alNewConfig();
valid = 0;
if (audio_config) {
if (alSetChannels(audio_config, this->spec.channels) < 0) {
if (this->spec.channels > 2) { /* can't handle > stereo? */
this->spec.channels = 2; /* try again below. */
}
}
if ((alSetSampFmt(audio_config, fmt) >= 0) &&
((!width) || (alSetWidth(audio_config, width) >= 0)) &&
(alSetQueueSize(audio_config, this->spec.samples * 2) >=
0)
&& (alSetChannels(audio_config, this->spec.channels) >=
0)) {
this->hidden->audio_port = alOpenPort("SDL audio", "w",
audio_config);
if (this->hidden->audio_port == NULL) {
/* docs say AL_BAD_CHANNELS happens here, too. */
int err = oserror();
if (err == AL_BAD_CHANNELS) {
this->spec.channels = 2;
alSetChannels(audio_config, this->spec.channels);
this->hidden->audio_port =
alOpenPort("SDL audio", "w", audio_config);
}
}
if (this->hidden->audio_port != NULL) {
valid = 1;
}
}
alFreeConfig(audio_config);
}
}
}
if (!valid) {
IRIXAUDIO_CloseDevice(this);
SDL_SetError("Unsupported audio format");
return 0;
}
/* Update the fragment size as size in bytes */
SDL_CalculateAudioSpec(&this->spec);
/* Allocate mixing buffer */
this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->spec.size);
if (this->hidden->mixbuf == NULL) {
IRIXAUDIO_CloseDevice(this);
SDL_OutOfMemory();
return 0;
}
SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
/* We're ready to rock and roll. :-) */
return 1;
}
static int
IRIXAUDIO_Init(SDL_AudioDriverImpl * impl)
{
/* Set the function pointers */
impl->OpenDevice = DSP_OpenDevice;
impl->PlayDevice = DSP_PlayDevice;
impl->WaitDevice = DSP_WaitDevice;
impl->GetDeviceBuf = DSP_GetDeviceBuf;
impl->CloseDevice = DSP_CloseDevice;
impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: not true, I think. */
return 1; /* this audio target is available. */
}
AudioBootStrap IRIXAUDIO_bootstrap = {
"AL", "IRIX DMedia audio", IRIXAUDIO_Init, 0
};
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2011 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifndef _SDL_irixaudio_h
#define _SDL_irixaudio_h
#include <dmedia/audio.h>
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
ALport audio_port; /* The handle for the audio device */
Uint8 *mixbuf; /* The app mixing buffer */
};
#endif /* _SDL_irixaudio_h */
/* vi: set ts=4 sw=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment