Commit 0089ba6c authored by Ryan C. Gordon's avatar Ryan C. Gordon

Merged SDL-ryan-multiple-audio-device branch r2803:2871 into the trunk.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402195
parent c500a063
...@@ -511,9 +511,17 @@ CheckNAS() ...@@ -511,9 +511,17 @@ CheckNAS()
AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]), AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
, enable_nas=yes) , enable_nas=yes)
if test x$enable_audio = xyes -a x$enable_nas = xyes; then if test x$enable_audio = xyes -a x$enable_nas = xyes; then
AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
AC_MSG_CHECKING(for NAS audio support) AC_MSG_CHECKING(for NAS audio support)
have_nas=no have_nas=no
if test -r /usr/X11R6/include/audio/audiolib.h; then
if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
have_nas=yes
NAS_LIBS="-laudio"
elif test -r /usr/X11R6/include/audio/audiolib.h; then
have_nas=yes have_nas=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"
...@@ -525,12 +533,40 @@ AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]), ...@@ -525,12 +533,40 @@ AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
have_nas=yes have_nas=yes
NAS_LIBS="-lnas -lXt" NAS_LIBS="-lnas -lXt"
fi fi
AC_MSG_RESULT($have_nas) AC_MSG_RESULT($have_nas)
if test x$have_nas = xyes; then if test x$have_nas = xyes; then
AC_ARG_ENABLE(nas-shared,
AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
, enable_nas_shared=yes)
if test "x`echo $NAS_LIBS | grep -- -L`" = "x"; then
if test "x`ls /lib/libaudio.so.* 2> /dev/null`" != "x"; then
NAS_LIBS="-L/lib $NAS_LIBS"
elif test "x`ls /usr/lib/libaudio.so.* 2> /dev/null`" != "x"; then
NAS_LIBS="-L/usr/lib $NAS_LIBS"
elif test "x`ls /usr/local/lib/libaudio.so.* 2> /dev/null`" != "x"; then
NAS_LIBS="-L/usr/local/lib $NAS_LIBS"
fi
fi
nas_lib_spec=`echo $NAS_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libaudio.so.*/'`
nas_lib=`ls -- $nas_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
echo "-- $nas_lib_spec -> $nas_lib"
if test x$have_loadso != xyes && \
test x$enable_nas_shared = xyes; then
AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
fi
if test x$have_loadso = xyes && \
test x$enable_nas_shared = xyes && test x$alsa_lib != x; then
AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib")
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
fi
AC_DEFINE(SDL_AUDIO_DRIVER_NAS) AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
SOURCES="$SOURCES $srcdir/src/audio/nas/*.c" SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
have_audio=yes have_audio=yes
fi fi
fi fi
...@@ -2006,7 +2042,7 @@ case "$host" in ...@@ -2006,7 +2042,7 @@ case "$host" in
have_audio=yes have_audio=yes
;; ;;
aix) aix)
AC_DEFINE(SDL_AUDIO_DRIVER_PAUD) AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO)
SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c" SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
have_audio=yes have_audio=yes
;; ;;
...@@ -2206,7 +2242,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau ...@@ -2206,7 +2242,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
CheckBeGL CheckBeGL
# Set up files for the audio library # Set up files for the audio library
if test x$enable_audio = xyes; then if test x$enable_audio = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_BAUDIO) AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO)
SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc" SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
have_audio=yes have_audio=yes
fi fi
...@@ -2323,7 +2359,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau ...@@ -2323,7 +2359,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
# If either the audio or CD driver is used, add the AudioUnit framework # If either the audio or CD driver is used, add the AudioUnit framework
if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -framework,AudioToolbox -Wl,-framework,AudioUnit"
fi fi
;; ;;
*-*-mint*) *-*-mint*)
......
...@@ -153,7 +153,7 @@ typedef struct SDL_AudioCVT ...@@ -153,7 +153,7 @@ typedef struct SDL_AudioCVT
/* Function prototypes */ /* Function prototypes */
/* These functions return the list of built in video drivers, in the /* These functions return the list of built in audio drivers, in the
* order that they are normally initialized by default. * order that they are normally initialized by default.
*/ */
extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void); extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void);
...@@ -212,7 +212,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void); ...@@ -212,7 +212,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
* may modify the requested size of the audio buffer, you should allocate * may modify the requested size of the audio buffer, you should allocate
* any local mixing buffers after you open the audio device. * any local mixing buffers after you open the audio device.
*/ */
extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired, extern DECLSPEC int SDLCALL SDL_OpenAudio(const SDL_AudioSpec * desired,
SDL_AudioSpec * obtained); SDL_AudioSpec * obtained);
/* /*
...@@ -228,6 +228,13 @@ typedef Uint32 SDL_AudioDeviceID; ...@@ -228,6 +228,13 @@ typedef Uint32 SDL_AudioDeviceID;
/* /*
* Get the number of available devices exposed by the current driver. * Get the number of available devices exposed by the current driver.
* Only valid after a successfully initializing the audio subsystem. * Only valid after a successfully initializing the audio subsystem.
* Returns -1 if an explicit list of devices can't be determined; this is
* not an error. For example, if SDL is set up to talk to a remote audio
* server, it can't list every one available on the Internet, but it will
* still allow a specific host to be specified to SDL_OpenAudioDevice().
* In many common cases, when this function returns a value <= 0, it can still
* successfully open the default device (NULL for first argument of
* SDL_OpenAudioDevice()).
*/ */
extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture); extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
...@@ -235,15 +242,28 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture); ...@@ -235,15 +242,28 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
* Get the human-readable name of a specific audio device. * Get the human-readable name of a specific audio device.
* Must be a value between 0 and (number of audio devices-1). * Must be a value between 0 and (number of audio devices-1).
* Only valid after a successfully initializing the audio subsystem. * Only valid after a successfully initializing the audio subsystem.
* The values returned by this function reflect the latest call to
* SDL_GetNumAudioDevices(); recall that function to redetect available
* hardware.
*
* The string returned by this function is UTF-8 encoded, read-only, and
* managed internally. You are not to free it. If you need to keep the
* string for any length of time, you should make your own copy of it, as it
* will be invalid next time any of several other SDL functions is called.
*/ */
extern DECLSPEC const char *SDLCALL SDL_GetAudioDevice(int index, extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
int iscapture); int iscapture);
/* /*
* Open a specific audio device. Passing in a device name of NULL is * Open a specific audio device. Passing in a device name of NULL requests
* equivalent to SDL_OpenAudio(). Returns 0 on error, a valid device ID * the most reasonable default (and is equivalent to calling SDL_OpenAudio()).
* on success. * The device name is a UTF-8 string reported by SDL_GetAudioDevice(), but
* some drivers allow arbitrary and driver-specific strings, such as a
* hostname/IP address for a remote audio server, or a filename in the
* diskaudio driver.
* Returns 0 on error, a valid device ID that is >= 2 on success.
* SDL_OpenAudio(), unlike this function, always acts on device ID 1.
*/ */
extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char
*device, *device,
......
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
#undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
#undef SDL_AUDIO_DRIVER_ARTS #undef SDL_AUDIO_DRIVER_ARTS
#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
#undef SDL_AUDIO_DRIVER_BAUDIO #undef SDL_AUDIO_DRIVER_BEOSAUDIO
#undef SDL_AUDIO_DRIVER_BSD #undef SDL_AUDIO_DRIVER_BSD
#undef SDL_AUDIO_DRIVER_COREAUDIO #undef SDL_AUDIO_DRIVER_COREAUDIO
#undef SDL_AUDIO_DRIVER_DART #undef SDL_AUDIO_DRIVER_DART
...@@ -168,9 +168,10 @@ ...@@ -168,9 +168,10 @@
#undef SDL_AUDIO_DRIVER_MINT #undef SDL_AUDIO_DRIVER_MINT
#undef SDL_AUDIO_DRIVER_MMEAUDIO #undef SDL_AUDIO_DRIVER_MMEAUDIO
#undef SDL_AUDIO_DRIVER_NAS #undef SDL_AUDIO_DRIVER_NAS
#undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
#undef SDL_AUDIO_DRIVER_OSS #undef SDL_AUDIO_DRIVER_OSS
#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
#undef SDL_AUDIO_DRIVER_PAUD #undef SDL_AUDIO_DRIVER_PAUDIO
#undef SDL_AUDIO_DRIVER_QNXNTO #undef SDL_AUDIO_DRIVER_QNXNTO
#undef SDL_AUDIO_DRIVER_SNDMGR #undef SDL_AUDIO_DRIVER_SNDMGR
#undef SDL_AUDIO_DRIVER_SUNAUDIO #undef SDL_AUDIO_DRIVER_SUNAUDIO
......
...@@ -91,7 +91,7 @@ typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned, ...@@ -91,7 +91,7 @@ typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code); typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
#endif #endif
extern DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(int (*fn) (void *), extern DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(int (SDLCALL * f) (void *),
void *data, void *data,
pfnSDL_CurrentBeginThread pfnSDL_CurrentBeginThread
pfnBeginThread, pfnBeginThread,
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
/* Routine to get the thread-specific error variable */ /* Routine to get the thread-specific error variable */
#if SDL_THREADS_DISABLED #if SDL_THREADS_DISABLED
/* !!! FIXME: what does this comment mean? Victim of Search and Replace? */
/* The SDL_arraysize(The ),default (non-thread-safe) global error variable */ /* The SDL_arraysize(The ),default (non-thread-safe) global error variable */
static SDL_error SDL_global_error; static SDL_error SDL_global_error;
#define SDL_GetErrBuf() (&SDL_global_error) #define SDL_GetErrBuf() (&SDL_global_error)
......
This diff is collapsed.
...@@ -159,21 +159,19 @@ SDL_ConvertMono(SDL_AudioCVT * cvt, SDL_AudioFormat format) ...@@ -159,21 +159,19 @@ SDL_ConvertMono(SDL_AudioCVT * cvt, SDL_AudioFormat format)
float *dst = (float *) cvt->buf; float *dst = (float *) cvt->buf;
if (SDL_AUDIO_ISBIGENDIAN(format)) { if (SDL_AUDIO_ISBIGENDIAN(format)) {
for (i = cvt->len_cvt / 8; i; --i, src += 2) { for (i = cvt->len_cvt / 8; i; --i, src += 2) {
float src1, src2; const float src1 = SDL_SwapFloatBE(src[0]);
src1 = SDL_SwapFloatBE(src[0]); const float src2 = SDL_SwapFloatBE(src[1]);
src2 = SDL_SwapFloatBE(src[1]);
const double added = ((double) src1) + ((double) src2); const double added = ((double) src1) + ((double) src2);
src1 = (float) (added * 0.5); const float halved = (float) (added * 0.5);
*(dst++) = SDL_SwapFloatBE(src1); *(dst++) = SDL_SwapFloatBE(halved);
} }
} else { } else {
for (i = cvt->len_cvt / 8; i; --i, src += 2) { for (i = cvt->len_cvt / 8; i; --i, src += 2) {
float src1, src2; const float src1 = SDL_SwapFloatLE(src[0]);
src1 = SDL_SwapFloatLE(src[0]); const float src2 = SDL_SwapFloatLE(src[1]);
src2 = SDL_SwapFloatLE(src[1]);
const double added = ((double) src1) + ((double) src2); const double added = ((double) src1) + ((double) src2);
src1 = (float) (added * 0.5); const float halved = (float) (added * 0.5);
*(dst++) = SDL_SwapFloatLE(src1); *(dst++) = SDL_SwapFloatLE(halved);
} }
} }
} }
......
...@@ -46,14 +46,63 @@ ...@@ -46,14 +46,63 @@
#define _PATH_DEV_AUDIO "/dev/audio" #define _PATH_DEV_AUDIO "/dev/audio"
#endif #endif
static inline void
test_device(const char *fname, int flags, int (*test)(int fd),
char ***devices, int *devCount)
{
struct stat sb;
if ( (stat(fname, &sb) == 0) && (S_ISCHR(sb.st_mode)) ) {
int audio_fd = open(fname, flags, 0);
if ( (audio_fd >= 0) && (test(audio_fd)) ) {
void *p = SDL_realloc(*devices, ((*devCount)+1) * sizeof (char *));
if (p != NULL) {
size_t len = strlen(fname) + 1;
char *str = (char *) SDL_malloc(len);
*devices = (char **) p;
if (str != NULL) {
SDL_strlcpy(str, fname, len);
(*devices)[(*devCount)++] = str;
}
}
close(audio_fd);
}
}
}
int void
SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic) SDL_FreeUnixAudioDevices(char ***devices, int *devCount)
{
int i = *devCount;
if ((i > 0) && (*devices != NULL)) {
while (i--) {
SDL_free( (*devices)[*devCount] );
}
}
if (*devices != NULL) {
SDL_free(*devices);
}
*devices = NULL;
*devCount = 0;
}
static int
test_stub(int fd)
{
return 1;
}
void
SDL_EnumUnixAudioDevices(int flags, int classic, int (*test)(int fd),
char ***devices, int *devCount)
{ {
const char *audiodev; const char *audiodev;
int audio_fd;
char audiopath[1024]; char audiopath[1024];
if (test == NULL)
test = test_stub;
/* Figure out what our audio device is */ /* Figure out what our audio device is */
if (((audiodev = SDL_getenv("SDL_PATH_DSP")) == NULL) && if (((audiodev = SDL_getenv("SDL_PATH_DSP")) == NULL) &&
((audiodev = SDL_getenv("AUDIODEV")) == NULL)) { ((audiodev = SDL_getenv("AUDIODEV")) == NULL)) {
...@@ -72,111 +121,16 @@ SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic) ...@@ -72,111 +121,16 @@ SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic)
} }
} }
} }
audio_fd = open(audiodev, flags, 0); test_device(audiodev, flags, test, devices, devCount);
/* If the first open fails, look for other devices */
if ((audio_fd < 0) && (SDL_strlen(audiodev) < (sizeof(audiopath) - 3))) {
int exists, instance;
struct stat sb;
instance = 1; if (SDL_strlen(audiodev) < (sizeof(audiopath) - 3)) {
do { /* Don't use errno ENOENT - it may not be thread-safe */ int instance = 0;
while (instance++ <= 64) {
SDL_snprintf(audiopath, SDL_arraysize(audiopath), SDL_snprintf(audiopath, SDL_arraysize(audiopath),
"%s%d", audiodev, instance++); "%s%d", audiodev, instance);
exists = 0; test_device(audiopath, flags, test, devices, devCount);
if (stat(audiopath, &sb) == 0) {
exists = 1;
audio_fd = open(audiopath, flags, 0);
}
}
while (exists && (audio_fd < 0));
audiodev = audiopath;
}
if (path != NULL) {
SDL_strlcpy(path, audiodev, maxlen);
path[maxlen - 1] = '\0';
}
return (audio_fd);
}
#elif SDL_AUDIO_DRIVER_PAUD
/* Get the name of the audio device we use for output */
#include <sys/types.h>
#include <sys/stat.h>
#include "SDL_stdinc.h"
#include "SDL_audiodev_c.h"
#ifndef _PATH_DEV_DSP
#define _PATH_DEV_DSP "/dev/%caud%c/%c"
#endif
char devsettings[][3] = {
{'p', '0', '1'}, {'p', '0', '2'}, {'p', '0', '3'}, {'p', '0', '4'},
{'p', '1', '1'}, {'p', '1', '2'}, {'p', '1', '3'}, {'p', '1', '4'},
{'p', '2', '1'}, {'p', '2', '2'}, {'p', '2', '3'}, {'p', '2', '4'},
{'p', '3', '1'}, {'p', '3', '2'}, {'p', '3', '3'}, {'p', '3', '4'},
{'b', '0', '1'}, {'b', '0', '2'}, {'b', '0', '3'}, {'b', '0', '4'},
{'b', '1', '1'}, {'b', '1', '2'}, {'b', '1', '3'}, {'b', '1', '4'},
{'b', '2', '1'}, {'b', '2', '2'}, {'b', '2', '3'}, {'b', '2', '4'},
{'b', '3', '1'}, {'b', '3', '2'}, {'b', '3', '3'}, {'b', '3', '4'},
{'\0', '\0', '\0'}
};
static int
OpenUserDefinedDevice(char *path, int maxlen, int flags)
{
const char *audiodev;
int audio_fd;
/* Figure out what our audio device is */
if ((audiodev = SDL_getenv("SDL_PATH_DSP")) == NULL) {
audiodev = SDL_getenv("AUDIODEV");
}
if (audiodev == NULL) {
return -1;
}
audio_fd = open(audiodev, flags, 0);
if (path != NULL) {
SDL_strlcpy(path, audiodev, maxlen);
path[maxlen - 1] = '\0';
}
return audio_fd;
}
int
SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic)
{
struct stat sb;
int audio_fd;
char audiopath[1024];
int cycle;
audio_fd = OpenUserDefinedDevice(path, maxlen, flags);
if (audio_fd != -1) {
return audio_fd;
}
cycle = 0;
while (devsettings[cycle][0] != '\0') {
SDL_snprintf(audiopath, SDL_arraysize(audiopath),
_PATH_DEV_DSP,
devsettings[cycle][0],
devsettings[cycle][1], devsettings[cycle][2]);
if (stat(audiopath, &sb) == 0) {
audio_fd = open(audiopath, flags, 0);
if (audio_fd > 0) {
if (path != NULL) {
SDL_strlcpy(path, audiopath, maxlen);
}
return audio_fd;
}
} }
} }
return -1;
} }
#endif /* Audio driver selection */ #endif /* Audio driver selection */
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
/* Open the audio device, storing the pathname in 'path' */ void SDL_EnumUnixAudioDevices(int flags, int classic, int (*test)(int fd),
extern int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic); char ***devs, int *count);
void SDL_FreeUnixAudioDevices(char ***devices, int *devCount);
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -89,21 +89,6 @@ static const Uint8 mix8[] = { ...@@ -89,21 +89,6 @@ static const Uint8 mix8[] = {
#define ADJUST_VOLUME(s, v) (s = (s*v)/SDL_MIX_MAXVOLUME) #define ADJUST_VOLUME(s, v) (s = (s*v)/SDL_MIX_MAXVOLUME)
#define ADJUST_VOLUME_U8(s, v) (s = (((s-128)*v)/SDL_MIX_MAXVOLUME)+128) #define ADJUST_VOLUME_U8(s, v) (s = (((s-128)*v)/SDL_MIX_MAXVOLUME)+128)
void
SDL_MixAudio(Uint8 * dst, const Uint8 * src, Uint32 len, int volume)
{
/* Mix the user-level audio format */
if (current_audio) {
SDL_AudioFormat format;
if (current_audio->convert.needed) {
format = current_audio->convert.src_format;
} else {
format = current_audio->spec.format;
}
SDL_MixAudioFormat(dst, src, format, len, volume);
}
}
void void
SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format,
......
...@@ -29,13 +29,33 @@ ...@@ -29,13 +29,33 @@
/* The SDL audio driver */ /* The SDL audio driver */
typedef struct SDL_AudioDevice SDL_AudioDevice; typedef struct SDL_AudioDevice SDL_AudioDevice;
/* Define the SDL audio driver structure */
#define _THIS SDL_AudioDevice *_this #define _THIS SDL_AudioDevice *_this
#ifndef _STATUS
#define _STATUS SDL_status *status typedef struct SDL_AudioDriverImpl
#endif {
struct SDL_AudioDevice int (*DetectDevices)(int iscapture);
const char *(*GetDeviceName)(int index, int iscapture);
int (*OpenDevice) (_THIS, const char *devname, int iscapture);
void (*ThreadInit) (_THIS); /* Called by audio thread at start */
void (*WaitDevice) (_THIS);
void (*PlayDevice) (_THIS);
Uint8 *(*GetDeviceBuf) (_THIS);
void (*WaitDone) (_THIS);
void (*CloseDevice) (_THIS);
void (*LockDevice) (_THIS);
void (*UnlockDevice) (_THIS);
void (*Deinitialize) (void);
/* Some flags to push duplicate code into the core and reduce #ifdefs. */
int ProvidesOwnCallbackThread:1;
int SkipMixerLock:1;
int HasCaptureSupport:1;
int OnlyHasDefaultOutputDevice:1;
int OnlyHasDefaultInputDevice:1;
} SDL_AudioDriverImpl;
typedef struct SDL_AudioDriver
{ {
/* * * */ /* * * */
/* The name of this audio driver */ /* The name of this audio driver */
...@@ -45,21 +65,13 @@ struct SDL_AudioDevice ...@@ -45,21 +65,13 @@ struct SDL_AudioDevice
/* The description of this audio driver */ /* The description of this audio driver */
const char *desc; const char *desc;
/* * * */ SDL_AudioDriverImpl impl;
/* Public driver functions */ } SDL_AudioDriver;
int (*OpenAudio) (_THIS, SDL_AudioSpec * spec);
void (*ThreadInit) (_THIS); /* Called by audio thread at start */
void (*WaitAudio) (_THIS);
void (*PlayAudio) (_THIS);
Uint8 *(*GetAudioBuf) (_THIS);
void (*WaitDone) (_THIS);
void (*CloseAudio) (_THIS);
/* * * */
/* Lock / Unlock functions added for the Mac port */
void (*LockAudio) (_THIS);
void (*UnlockAudio) (_THIS);
/* Define the SDL audio driver structure */
struct SDL_AudioDevice
{
/* * * */ /* * * */
/* Data common to all devices */ /* Data common to all devices */
...@@ -70,6 +82,7 @@ struct SDL_AudioDevice ...@@ -70,6 +82,7 @@ struct SDL_AudioDevice
SDL_AudioCVT convert; SDL_AudioCVT convert;
/* Current state flags */ /* Current state flags */
int iscapture;
int enabled; int enabled;
int paused; int paused;
int opened; int opened;
...@@ -87,10 +100,6 @@ struct SDL_AudioDevice ...@@ -87,10 +100,6 @@ struct SDL_AudioDevice
/* * * */ /* * * */
/* Data private to this driver */ /* Data private to this driver */
struct SDL_PrivateAudioData *hidden; struct SDL_PrivateAudioData *hidden;
/* * * */
/* The function used to dispose of this structure */
void (*free) (_THIS);
}; };
#undef _THIS #undef _THIS
...@@ -98,84 +107,10 @@ typedef struct AudioBootStrap ...@@ -98,84 +107,10 @@ typedef struct AudioBootStrap
{ {
const char *name; const char *name;
const char *desc; const char *desc;
int (*available) (void); int (*init) (SDL_AudioDriverImpl *impl);
SDL_AudioDevice *(*create) (int devindex); int demand_only:1; /* 1==request explicitly, or it won't be available. */
} AudioBootStrap; } AudioBootStrap;
#if SDL_AUDIO_DRIVER_BSD
extern AudioBootStrap BSD_AUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_OSS
extern AudioBootStrap DSP_bootstrap;
extern AudioBootStrap DMA_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_ALSA
extern AudioBootStrap ALSA_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_QNXNTO
extern AudioBootStrap QNXNTOAUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_SUNAUDIO
extern AudioBootStrap SUNAUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_DMEDIA
extern AudioBootStrap DMEDIA_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_ARTS
extern AudioBootStrap ARTS_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_ESD
extern AudioBootStrap ESD_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_NAS
extern AudioBootStrap NAS_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_DSOUND
extern AudioBootStrap DSOUND_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_WAVEOUT
extern AudioBootStrap WAVEOUT_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_PAUD
extern AudioBootStrap Paud_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_BAUDIO
extern AudioBootStrap BAUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_COREAUDIO
extern AudioBootStrap COREAUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_SNDMGR
extern AudioBootStrap SNDMGR_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_AHI
extern AudioBootStrap AHI_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_MINT
extern AudioBootStrap MINTAUDIO_GSXB_bootstrap;
extern AudioBootStrap MINTAUDIO_MCSN_bootstrap;
extern AudioBootStrap MINTAUDIO_STFA_bootstrap;
extern AudioBootStrap MINTAUDIO_XBIOS_bootstrap;
extern AudioBootStrap MINTAUDIO_DMA8_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_DISK
extern AudioBootStrap DISKAUD_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_DUMMY
extern AudioBootStrap DUMMYAUD_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_DC
extern AudioBootStrap DCAUD_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_MMEAUDIO
extern AudioBootStrap MMEAUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_DART
extern AudioBootStrap DART_bootstrap;
#endif
/* This is the current audio device */
extern SDL_AudioDevice *current_audio;
#endif /* _SDL_sysaudio_h */ #endif /* _SDL_sysaudio_h */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
This diff is collapsed.
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "../SDL_sysaudio.h" #include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the video functions */ /* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this #define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData struct SDL_PrivateAudioData
...@@ -46,11 +46,5 @@ struct SDL_PrivateAudioData ...@@ -46,11 +46,5 @@ struct SDL_PrivateAudioData
int mixlen; int mixlen;
}; };
/* Old variable names */
#define pcm_handle (this->hidden->pcm_handle)
#define parent (this->hidden->parent)
#define mixbuf (this->hidden->mixbuf)
#define mixlen (this->hidden->mixlen)
#endif /* _ALSA_PCM_audio_h */ #endif /* _ALSA_PCM_audio_h */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
This diff is collapsed.
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 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_ahiaudio_h
#define _SDL_ahiaudio_h
#include <exec/exec.h>
#include <dos/dos.h>
#ifdef __SASC
#include <proto/exec.h>
#else
#include <inline/exec.h>
#endif
#include <devices/ahi.h>
#include "mydebug.h"
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
/* The handle for the audio device */
struct AHIRequest *audio_req[2];
struct MsgPort *audio_port;
Sint32 freq, type, bytespersample, size;
Uint8 *mixbuf[2]; /* The app mixing buffer */
int current_buffer;
Uint32 playing;
};
/* Old variable names */
#define audio_port (this->hidden->audio_port)
#define audio_req (this->hidden->audio_req)
#define mixbuf (this->hidden->mixbuf)
#define current_buffer (this->hidden->current_buffer)
#define playing (this->hidden->playing)
#endif /* _SDL_ahiaudio_h */
/* vi: set ts=4 sw=4 expandtab: */
This diff is collapsed.
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "../SDL_sysaudio.h" #include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the video functions */ /* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this #define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData struct SDL_PrivateAudioData
...@@ -49,13 +49,5 @@ struct SDL_PrivateAudioData ...@@ -49,13 +49,5 @@ struct SDL_PrivateAudioData
}; };
#define FUDGE_TICKS 10 /* The scheduler overhead ticks per 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)
#endif /* _SDL_artscaudio_h */ #endif /* _SDL_artscaudio_h */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -36,138 +36,81 @@ extern "C" ...@@ -36,138 +36,81 @@ extern "C"
#include "../../thread/beos/SDL_systhread_c.h" #include "../../thread/beos/SDL_systhread_c.h"
#include "SDL_beaudio.h" #include "SDL_beaudio.h"
}
/* Audio driver functions */
static int BE_OpenAudio(_THIS, SDL_AudioSpec * spec);
static void BE_WaitAudio(_THIS);
static void BE_PlayAudio(_THIS);
static Uint8 *BE_GetAudioBuf(_THIS);
static void BE_CloseAudio(_THIS);
/* Audio driver bootstrap functions */ /* !!! FIXME: have the callback call the higher level to avoid code dupe. */
/* The BeOS callback for handling the audio buffer */
static int Audio_Available(void) static void
{ FillSound(void *device, void *stream, size_t len,
return (1); const media_raw_audio_format & format)
} {
SDL_AudioDevice *audio = (SDL_AudioDevice *) device;
static void Audio_DeleteDevice(SDL_AudioDevice * device)
{
SDL_free(device->hidden);
SDL_free(device);
}
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
{
SDL_AudioDevice *device;
/* Initialize all variables that we clean on shutdown */
device = (SDL_AudioDevice *) SDL_malloc(sizeof(SDL_AudioDevice));
if (device) {
SDL_memset(device, 0, (sizeof *device));
device->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc((sizeof *device->hidden));
}
if ((device == NULL) || (device->hidden == NULL)) {
SDL_OutOfMemory();
if (device) {
SDL_free(device);
}
return (0);
}
SDL_memset(device->hidden, 0, (sizeof *device->hidden));
/* Set the function pointers */
device->OpenAudio = BE_OpenAudio;
device->WaitAudio = BE_WaitAudio;
device->PlayAudio = BE_PlayAudio;
device->GetAudioBuf = BE_GetAudioBuf;
device->CloseAudio = BE_CloseAudio;
device->free = Audio_DeleteDevice;
return device; /* Silence the buffer, since it's ours */
} SDL_memset(stream, audio->spec.silence, len);
AudioBootStrap BAUDIO_bootstrap = { /* Only do soemthing if audio is enabled */
"baudio", "BeOS BSoundPlayer", if (!audio->enabled)
Audio_Available, Audio_CreateDevice return;
};
/* The BeOS callback for handling the audio buffer */ if (!audio->paused) {
static void FillSound(void *device, void *stream, size_t len, if (audio->convert.needed) {
const media_raw_audio_format & format) SDL_mutexP(audio->mixer_lock);
{ (*audio->spec.callback) (audio->spec.userdata,
SDL_AudioDevice *audio = (SDL_AudioDevice *) device;
/* Silence the buffer, since it's ours */
SDL_memset(stream, audio->spec.silence, len);
/* Only do soemthing if audio is enabled */
if (!audio->enabled)
return;
if (!audio->paused) {
if (audio->convert.needed) {
SDL_mutexP(audio->mixer_lock);
(*audio->spec.callback) (audio->spec.userdata,
(Uint8 *) audio->convert.buf, (Uint8 *) audio->convert.buf,
audio->convert.len); audio->convert.len);
SDL_mutexV(audio->mixer_lock); SDL_mutexV(audio->mixer_lock);
SDL_ConvertAudio(&audio->convert); SDL_ConvertAudio(&audio->convert);
SDL_memcpy(stream, audio->convert.buf, SDL_memcpy(stream, audio->convert.buf, audio->convert.len_cvt);
audio->convert.len_cvt); } else {
} else { SDL_mutexP(audio->mixer_lock);
SDL_mutexP(audio->mixer_lock); (*audio->spec.callback) (audio->spec.userdata,
(*audio->spec.callback) (audio->spec.userdata, (Uint8 *) stream, len);
(Uint8 *) stream, len); SDL_mutexV(audio->mixer_lock);
SDL_mutexV(audio->mixer_lock);
}
} }
return;
} }
}
/* Dummy functions -- we don't use thread-based audio */ static void
void BE_WaitAudio(_THIS) BEOSAUDIO_CloseDevice(_THIS)
{ {
return; if (_this->hidden != NULL) {
} if (_this->hidden->audio_obj) {
void BE_PlayAudio(_THIS) _this->hidden->audio_obj->Stop();
{ delete _this->hidden->audio_obj;
return; _this->hidden->audio_obj = NULL;
}
Uint8 *BE_GetAudioBuf(_THIS)
{
return (NULL);
}
void BE_CloseAudio(_THIS)
{
if (audio_obj) {
audio_obj->Stop();
delete audio_obj;
audio_obj = NULL;
} }
/* Quit the Be Application, if there's nothing left to do */ delete _this->hidden;
SDL_QuitBeApp(); _this->hidden = NULL;
} }
}
int BE_OpenAudio(_THIS, SDL_AudioSpec * spec) static int
{ BEOSAUDIO_OpenDevice(_THIS, const char *devname, int iscapture)
int valid_datatype = 0; {
media_raw_audio_format format; int valid_datatype = 0;
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format); media_raw_audio_format format;
SDL_AudioFormat test_format = SDL_FirstAudioFormat(_this->spec.format);
/* Parse the audio format and fill the Be raw audio format */
memset(&format, '\0', sizeof(media_raw_audio_format)); /* Initialize all variables that we clean on shutdown */
format.byte_order = B_MEDIA_LITTLE_ENDIAN; _this->hidden = new SDL_PrivateAudioData;
format.frame_rate = (float) spec->freq; if (_this->hidden == NULL) {
format.channel_count = spec->channels; /* !!! FIXME: support > 2? */ SDL_OutOfMemory();
while ((!valid_datatype) && (test_format)) { return 0;
valid_datatype = 1; }
spec->format = test_format; SDL_memset(_this->hidden, 0, (sizeof *_this->hidden));
switch (test_format) {
/* Parse the audio format and fill the Be raw audio format */
SDL_memset(&format, '\0', sizeof(media_raw_audio_format));
format.byte_order = B_MEDIA_LITTLE_ENDIAN;
format.frame_rate = (float) _this->spec.freq;
format.channel_count = _this->spec.channels; /* !!! FIXME: support > 2? */
while ((!valid_datatype) && (test_format)) {
valid_datatype = 1;
_this->spec.format = test_format;
switch (test_format) {
case AUDIO_S8: case AUDIO_S8:
format.format = media_raw_audio_format::B_AUDIO_CHAR; format.format = media_raw_audio_format::B_AUDIO_CHAR;
break; break;
...@@ -207,43 +150,67 @@ extern "C" ...@@ -207,43 +150,67 @@ extern "C"
valid_datatype = 0; valid_datatype = 0;
test_format = SDL_NextAudioFormat(); test_format = SDL_NextAudioFormat();
break; break;
}
} }
}
format.buffer_size = spec->samples; format.buffer_size = _this->spec.samples;
if (!valid_datatype) { /* shouldn't happen, but just in case... */ if (!valid_datatype) { /* shouldn't happen, but just in case... */
SDL_SetError("Unsupported audio format"); BEOSAUDIO_CloseDevice(_this);
return (-1); SDL_SetError("Unsupported audio format");
} return 0;
}
/* Initialize the Be Application, if it's not already started */ /* Calculate the final parameters for this audio specification */
if (SDL_InitBeApp() < 0) { SDL_CalculateAudioSpec(&_this->spec);
return (-1);
} /* Subscribe to the audio stream (creates a new thread) */
sigset_t omask;
SDL_MaskSignals(&omask);
_this->hidden->audio_obj = new BSoundPlayer(&format, "SDL Audio",
FillSound, NULL, _this);
SDL_UnmaskSignals(&omask);
if (_this->hidden->audio_obj->Start() == B_NO_ERROR) {
_this->hidden->audio_obj->SetHasData(true);
} else {
BEOSAUDIO_CloseDevice(_this);
SDL_SetError("Unable to start Be audio");
return 0;
}
/* Calculate the final parameters for this audio specification */ /* We're running! */
SDL_CalculateAudioSpec(spec); return 1;
}
/* Subscribe to the audio stream (creates a new thread) */ static void
{ BEOSAUDIO_Deinitialize(void)
sigset_t omask; {
SDL_MaskSignals(&omask); SDL_QuitBeApp();
audio_obj = new BSoundPlayer(&format, "SDL Audio", FillSound, }
NULL, _this);
SDL_UnmaskSignals(&omask);
}
if (audio_obj->Start() == B_NO_ERROR) {
audio_obj->SetHasData(true);
} else {
SDL_SetError("Unable to start Be audio");
return (-1);
}
/* We're running! */ static int
return (1); BEOSAUDIO_Init(SDL_AudioDriverImpl *impl)
{
/* Initialize the Be Application, if it's not already started */
if (SDL_InitBeApp() < 0) {
return 0;
} }
}; /* Extern C */ /* Set the function pointers */
impl->OpenDevice = BEOSAUDIO_OpenDevice;
impl->CloseDevice = BEOSAUDIO_CloseDevice;
impl->Deinitialize = BEOSAUDIO_Deinitialize;
impl->ProvidesOwnCallbackThread = 1;
impl->OnlyHasDefaultOutputDevice = 1;
return 1;
}
extern "C" { extern AudioBootStrap BEOSAUDIO_bootstrap; }
AudioBootStrap BEOSAUDIO_bootstrap = {
"baudio", "BeOS BSoundPlayer", BEOSAUDIO_Init, 0
};
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -21,12 +21,12 @@ ...@@ -21,12 +21,12 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#ifndef _SDL_lowaudio_h #ifndef _SDL_beaudio_h
#define _SDL_lowaudio_h #define _SDL_beaudio_h
#include "../SDL_sysaudio.h" #include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the video functions */ /* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *_this #define _THIS SDL_AudioDevice *_this
struct SDL_PrivateAudioData struct SDL_PrivateAudioData
...@@ -34,8 +34,6 @@ struct SDL_PrivateAudioData ...@@ -34,8 +34,6 @@ struct SDL_PrivateAudioData
BSoundPlayer *audio_obj; BSoundPlayer *audio_obj;
}; };
/* Old variable names */ #endif /* _SDL_beaudio_h */
#define audio_obj (_this->hidden->audio_obj)
#endif /* _SDL_lowaudio_h */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
This diff is collapsed.
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#ifndef _SDL_openbsdaudio_h #ifndef _SDL_bsdaudio_h
#define _SDL_openbsdaudio_h #define _SDL_bsdaudio_h
#include "../SDL_sysaudio.h" #include "../SDL_sysaudio.h"
...@@ -47,13 +47,6 @@ struct SDL_PrivateAudioData ...@@ -47,13 +47,6 @@ struct SDL_PrivateAudioData
#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ #define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
/* Old variable names */ #endif /* _SDL_bsdaudio_h */
#define audio_fd (this->hidden->audio_fd)
#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)
#endif /* _SDL_openbsdaudio_h */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
This diff is collapsed.
...@@ -21,14 +21,15 @@ ...@@ -21,14 +21,15 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#ifndef _SDL_lowaudio_h #ifndef _SDL_dart_h
#define _SDL_lowaudio_h #define _SDL_dart_h
#define INCL_TYPES #define INCL_TYPES
#define INCL_DOSSEMAPHORES #define INCL_DOSSEMAPHORES
#define INCL_DOSRESOURCES #define INCL_DOSRESOURCES
#define INCL_DOSMISC #define INCL_DOSMISC
#define INCL_DOSERRORS #define INCL_DOSERRORS
#define INCL_DOSPROCESS
#define INCL_OS2MM #define INCL_OS2MM
#define INCL_MMIOOS2 #define INCL_MMIOOS2
...@@ -60,5 +61,6 @@ struct SDL_PrivateAudioData ...@@ -60,5 +61,6 @@ struct SDL_PrivateAudioData
HEV hevAudioBufferPlayed; // Event semaphore to indicate that an audio buffer has been played by DART HEV hevAudioBufferPlayed; // Event semaphore to indicate that an audio buffer has been played by DART
}; };
#endif /* _SDL_lowaudio_h */ #endif /* _SDL_dart_h */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
This diff is collapsed.
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h" #include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the video functions */ /* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this #define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData struct SDL_PrivateAudioData
......
This diff is collapsed.
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "SDL_rwops.h" #include "SDL_rwops.h"
#include "../SDL_sysaudio.h" #include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the video functions */ /* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this #define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData struct SDL_PrivateAudioData
......
This diff is collapsed.
...@@ -21,12 +21,12 @@ ...@@ -21,12 +21,12 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#ifndef _SDL_dspaudio_h #ifndef _SDL_dmaaudio_h
#define _SDL_dspaudio_h #define _SDL_dmaaudio_h
#include "../SDL_sysaudio.h" #include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the video functions */ /* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this #define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData struct SDL_PrivateAudioData
...@@ -49,6 +49,7 @@ struct SDL_PrivateAudioData ...@@ -49,6 +49,7 @@ struct SDL_PrivateAudioData
#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ #define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */
/* Old variable names */ /* Old variable names */
/* !!! FIXME: remove these. */
#define audio_fd (this->hidden->audio_fd) #define audio_fd (this->hidden->audio_fd)
#define parent (this->hidden->parent) #define parent (this->hidden->parent)
#define dma_buf (this->hidden->dma_buf) #define dma_buf (this->hidden->dma_buf)
...@@ -57,5 +58,6 @@ struct SDL_PrivateAudioData ...@@ -57,5 +58,6 @@ struct SDL_PrivateAudioData
#define frame_ticks (this->hidden->frame_ticks) #define frame_ticks (this->hidden->frame_ticks)
#define next_frame (this->hidden->next_frame) #define next_frame (this->hidden->next_frame)
#endif /* _SDL_dspaudio_h */ #endif /* _SDL_dmaaudio_h */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "../SDL_sysaudio.h" #include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the video functions */ /* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this #define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData struct SDL_PrivateAudioData
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "../SDL_sysaudio.h" #include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the video functions */ /* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this #define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData struct SDL_PrivateAudioData
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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