You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@corinthia.apache.org by ja...@apache.org on 2015/03/23 17:18:58 UTC
[10/83] [abbrv] [partial] incubator-corinthia git commit: removed SDL2
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/d1484ae0/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/SDL_mixer.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/SDL_mixer.c b/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/SDL_mixer.c
deleted file mode 100644
index 42a1c68..0000000
--- a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/SDL_mixer.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2014 Sam Lantinga <sl...@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../SDL_internal.h"
-
-/* This provides the default mixing callback for the SDL audio routines */
-
-#include "SDL_cpuinfo.h"
-#include "SDL_timer.h"
-#include "SDL_audio.h"
-#include "SDL_sysaudio.h"
-
-/* This table is used to add two sound values together and pin
- * the value to avoid overflow. (used with permission from ARDI)
- * Changed to use 0xFE instead of 0xFF for better sound quality.
- */
-static const Uint8 mix8[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03,
- 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
- 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
- 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24,
- 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A,
- 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45,
- 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
- 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B,
- 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
- 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C,
- 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92,
- 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D,
- 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8,
- 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3,
- 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE,
- 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9,
- 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4,
- 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
- 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA,
- 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5,
- 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
- 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE
-};
-
-/* The volume ranges from 0 - 128 */
-#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)
-
-
-void
-SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format,
- Uint32 len, int volume)
-{
- if (volume == 0) {
- return;
- }
-
- switch (format) {
-
- case AUDIO_U8:
- {
-#if defined(__GNUC__) && defined(__M68000__) && !defined(__mcoldfire__) && defined(SDL_ASSEMBLY_ROUTINES)
- SDL_MixAudio_m68k_U8((char *) dst, (char *) src,
- (unsigned long) len, (long) volume,
- (char *) mix8);
-#else
- Uint8 src_sample;
-
- while (len--) {
- src_sample = *src;
- ADJUST_VOLUME_U8(src_sample, volume);
- *dst = mix8[*dst + src_sample];
- ++dst;
- ++src;
- }
-#endif
- }
- break;
-
- case AUDIO_S8:
- {
- Sint8 *dst8, *src8;
- Sint8 src_sample;
- int dst_sample;
- const int max_audioval = ((1 << (8 - 1)) - 1);
- const int min_audioval = -(1 << (8 - 1));
-
- src8 = (Sint8 *) src;
- dst8 = (Sint8 *) dst;
- while (len--) {
- src_sample = *src8;
- ADJUST_VOLUME(src_sample, volume);
- dst_sample = *dst8 + src_sample;
- if (dst_sample > max_audioval) {
- *dst8 = max_audioval;
- } else if (dst_sample < min_audioval) {
- *dst8 = min_audioval;
- } else {
- *dst8 = dst_sample;
- }
- ++dst8;
- ++src8;
- }
- }
- break;
-
- case AUDIO_S16LSB:
- {
- Sint16 src1, src2;
- int dst_sample;
- const int max_audioval = ((1 << (16 - 1)) - 1);
- const int min_audioval = -(1 << (16 - 1));
-
- len /= 2;
- while (len--) {
- src1 = ((src[1]) << 8 | src[0]);
- ADJUST_VOLUME(src1, volume);
- src2 = ((dst[1]) << 8 | dst[0]);
- src += 2;
- dst_sample = src1 + src2;
- if (dst_sample > max_audioval) {
- dst_sample = max_audioval;
- } else if (dst_sample < min_audioval) {
- dst_sample = min_audioval;
- }
- dst[0] = dst_sample & 0xFF;
- dst_sample >>= 8;
- dst[1] = dst_sample & 0xFF;
- dst += 2;
- }
- }
- break;
-
- case AUDIO_S16MSB:
- {
-#if defined(__GNUC__) && defined(__M68000__) && !defined(__mcoldfire__) && defined(SDL_ASSEMBLY_ROUTINES)
- SDL_MixAudio_m68k_S16MSB((short *) dst, (short *) src,
- (unsigned long) len, (long) volume);
-#else
- Sint16 src1, src2;
- int dst_sample;
- const int max_audioval = ((1 << (16 - 1)) - 1);
- const int min_audioval = -(1 << (16 - 1));
-
- len /= 2;
- while (len--) {
- src1 = ((src[0]) << 8 | src[1]);
- ADJUST_VOLUME(src1, volume);
- src2 = ((dst[0]) << 8 | dst[1]);
- src += 2;
- dst_sample = src1 + src2;
- if (dst_sample > max_audioval) {
- dst_sample = max_audioval;
- } else if (dst_sample < min_audioval) {
- dst_sample = min_audioval;
- }
- dst[1] = dst_sample & 0xFF;
- dst_sample >>= 8;
- dst[0] = dst_sample & 0xFF;
- dst += 2;
- }
-#endif
- }
- break;
-
- case AUDIO_S32LSB:
- {
- const Uint32 *src32 = (Uint32 *) src;
- Uint32 *dst32 = (Uint32 *) dst;
- Sint64 src1, src2;
- Sint64 dst_sample;
- const Sint64 max_audioval = ((((Sint64) 1) << (32 - 1)) - 1);
- const Sint64 min_audioval = -(((Sint64) 1) << (32 - 1));
-
- len /= 4;
- while (len--) {
- src1 = (Sint64) ((Sint32) SDL_SwapLE32(*src32));
- src32++;
- ADJUST_VOLUME(src1, volume);
- src2 = (Sint64) ((Sint32) SDL_SwapLE32(*dst32));
- dst_sample = src1 + src2;
- if (dst_sample > max_audioval) {
- dst_sample = max_audioval;
- } else if (dst_sample < min_audioval) {
- dst_sample = min_audioval;
- }
- *(dst32++) = SDL_SwapLE32((Uint32) ((Sint32) dst_sample));
- }
- }
- break;
-
- case AUDIO_S32MSB:
- {
- const Uint32 *src32 = (Uint32 *) src;
- Uint32 *dst32 = (Uint32 *) dst;
- Sint64 src1, src2;
- Sint64 dst_sample;
- const Sint64 max_audioval = ((((Sint64) 1) << (32 - 1)) - 1);
- const Sint64 min_audioval = -(((Sint64) 1) << (32 - 1));
-
- len /= 4;
- while (len--) {
- src1 = (Sint64) ((Sint32) SDL_SwapBE32(*src32));
- src32++;
- ADJUST_VOLUME(src1, volume);
- src2 = (Sint64) ((Sint32) SDL_SwapBE32(*dst32));
- dst_sample = src1 + src2;
- if (dst_sample > max_audioval) {
- dst_sample = max_audioval;
- } else if (dst_sample < min_audioval) {
- dst_sample = min_audioval;
- }
- *(dst32++) = SDL_SwapBE32((Uint32) ((Sint32) dst_sample));
- }
- }
- break;
-
- case AUDIO_F32LSB:
- {
- const float fmaxvolume = 1.0f / ((float) SDL_MIX_MAXVOLUME);
- const float fvolume = (float) volume;
- const float *src32 = (float *) src;
- float *dst32 = (float *) dst;
- float src1, src2;
- double dst_sample;
- /* !!! FIXME: are these right? */
- const double max_audioval = 3.402823466e+38F;
- const double min_audioval = -3.402823466e+38F;
-
- len /= 4;
- while (len--) {
- src1 = ((SDL_SwapFloatLE(*src32) * fvolume) * fmaxvolume);
- src2 = SDL_SwapFloatLE(*dst32);
- src32++;
-
- dst_sample = ((double) src1) + ((double) src2);
- if (dst_sample > max_audioval) {
- dst_sample = max_audioval;
- } else if (dst_sample < min_audioval) {
- dst_sample = min_audioval;
- }
- *(dst32++) = SDL_SwapFloatLE((float) dst_sample);
- }
- }
- break;
-
- case AUDIO_F32MSB:
- {
- const float fmaxvolume = 1.0f / ((float) SDL_MIX_MAXVOLUME);
- const float fvolume = (float) volume;
- const float *src32 = (float *) src;
- float *dst32 = (float *) dst;
- float src1, src2;
- double dst_sample;
- /* !!! FIXME: are these right? */
- const double max_audioval = 3.402823466e+38F;
- const double min_audioval = -3.402823466e+38F;
-
- len /= 4;
- while (len--) {
- src1 = ((SDL_SwapFloatBE(*src32) * fvolume) * fmaxvolume);
- src2 = SDL_SwapFloatBE(*dst32);
- src32++;
-
- dst_sample = ((double) src1) + ((double) src2);
- if (dst_sample > max_audioval) {
- dst_sample = max_audioval;
- } else if (dst_sample < min_audioval) {
- dst_sample = min_audioval;
- }
- *(dst32++) = SDL_SwapFloatBE((float) dst_sample);
- }
- }
- break;
-
- default: /* If this happens... FIXME! */
- SDL_SetError("SDL_MixAudio(): unknown audio format");
- return;
- }
-}
-
-/* vi: set ts=4 sw=4 expandtab: */
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/d1484ae0/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/SDL_sysaudio.h
----------------------------------------------------------------------
diff --git a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/SDL_sysaudio.h b/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/SDL_sysaudio.h
deleted file mode 100644
index 9fe31c8..0000000
--- a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/SDL_sysaudio.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2014 Sam Lantinga <sl...@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../SDL_internal.h"
-
-#ifndef _SDL_sysaudio_h
-#define _SDL_sysaudio_h
-
-#include "SDL_mutex.h"
-#include "SDL_thread.h"
-
-/* The SDL audio driver */
-typedef struct SDL_AudioDevice SDL_AudioDevice;
-#define _THIS SDL_AudioDevice *_this
-
-/* Used by audio targets during DetectDevices() */
-typedef void (*SDL_AddAudioDevice)(const char *name);
-
-typedef struct SDL_AudioDriverImpl
-{
- void (*DetectDevices) (int iscapture, SDL_AddAudioDevice addfn);
- 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);
-
- /* !!! FIXME: add pause(), so we can optimize instead of mixing silence. */
-
- /* Some flags to push duplicate code into the core and reduce #ifdefs. */
- int ProvidesOwnCallbackThread;
- int SkipMixerLock; /* !!! FIXME: do we need this anymore? */
- int HasCaptureSupport;
- int OnlyHasDefaultOutputDevice;
- int OnlyHasDefaultInputDevice;
-} SDL_AudioDriverImpl;
-
-
-typedef struct SDL_AudioDriver
-{
- /* * * */
- /* The name of this audio driver */
- const char *name;
-
- /* * * */
- /* The description of this audio driver */
- const char *desc;
-
- SDL_AudioDriverImpl impl;
-
- char **outputDevices;
- int outputDeviceCount;
-
- char **inputDevices;
- int inputDeviceCount;
-} SDL_AudioDriver;
-
-
-/* Streamer */
-typedef struct
-{
- Uint8 *buffer;
- int max_len; /* the maximum length in bytes */
- int read_pos, write_pos; /* the position of the write and read heads in bytes */
-} SDL_AudioStreamer;
-
-
-/* Define the SDL audio driver structure */
-struct SDL_AudioDevice
-{
- /* * * */
- /* Data common to all devices */
-
- /* The current audio specification (shared with audio thread) */
- SDL_AudioSpec spec;
-
- /* An audio conversion block for audio format emulation */
- SDL_AudioCVT convert;
-
- /* The streamer, if sample rate conversion necessitates it */
- int use_streamer;
- SDL_AudioStreamer streamer;
-
- /* Current state flags */
- int iscapture;
- int enabled;
- int paused;
- int opened;
-
- /* Fake audio buffer for when the audio hardware is busy */
- Uint8 *fake_stream;
-
- /* A semaphore for locking the mixing buffers */
- SDL_mutex *mixer_lock;
-
- /* A thread to feed the audio device */
- SDL_Thread *thread;
- SDL_threadID threadid;
-
- /* * * */
- /* Data private to this driver */
- struct SDL_PrivateAudioData *hidden;
-};
-#undef _THIS
-
-typedef struct AudioBootStrap
-{
- const char *name;
- const char *desc;
- int (*init) (SDL_AudioDriverImpl * impl);
- int demand_only; /* 1==request explicitly, or it won't be available. */
-} AudioBootStrap;
-
-#endif /* _SDL_sysaudio_h */
-
-/* vi: set ts=4 sw=4 expandtab: */
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/d1484ae0/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/SDL_wave.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/SDL_wave.c b/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/SDL_wave.c
deleted file mode 100644
index 903264c..0000000
--- a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/SDL_wave.c
+++ /dev/null
@@ -1,623 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2014 Sam Lantinga <sl...@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../SDL_internal.h"
-
-/* Microsoft WAVE file loading routines */
-
-#include "SDL_audio.h"
-#include "SDL_wave.h"
-
-
-static int ReadChunk(SDL_RWops * src, Chunk * chunk);
-
-struct MS_ADPCM_decodestate
-{
- Uint8 hPredictor;
- Uint16 iDelta;
- Sint16 iSamp1;
- Sint16 iSamp2;
-};
-static struct MS_ADPCM_decoder
-{
- WaveFMT wavefmt;
- Uint16 wSamplesPerBlock;
- Uint16 wNumCoef;
- Sint16 aCoeff[7][2];
- /* * * */
- struct MS_ADPCM_decodestate state[2];
-} MS_ADPCM_state;
-
-static int
-InitMS_ADPCM(WaveFMT * format)
-{
- Uint8 *rogue_feel;
- int i;
-
- /* Set the rogue pointer to the MS_ADPCM specific data */
- MS_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding);
- MS_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels);
- MS_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency);
- MS_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate);
- MS_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign);
- MS_ADPCM_state.wavefmt.bitspersample =
- SDL_SwapLE16(format->bitspersample);
- rogue_feel = (Uint8 *) format + sizeof(*format);
- if (sizeof(*format) == 16) {
- /* const Uint16 extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]); */
- rogue_feel += sizeof(Uint16);
- }
- MS_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1] << 8) | rogue_feel[0]);
- rogue_feel += sizeof(Uint16);
- MS_ADPCM_state.wNumCoef = ((rogue_feel[1] << 8) | rogue_feel[0]);
- rogue_feel += sizeof(Uint16);
- if (MS_ADPCM_state.wNumCoef != 7) {
- SDL_SetError("Unknown set of MS_ADPCM coefficients");
- return (-1);
- }
- for (i = 0; i < MS_ADPCM_state.wNumCoef; ++i) {
- MS_ADPCM_state.aCoeff[i][0] = ((rogue_feel[1] << 8) | rogue_feel[0]);
- rogue_feel += sizeof(Uint16);
- MS_ADPCM_state.aCoeff[i][1] = ((rogue_feel[1] << 8) | rogue_feel[0]);
- rogue_feel += sizeof(Uint16);
- }
- return (0);
-}
-
-static Sint32
-MS_ADPCM_nibble(struct MS_ADPCM_decodestate *state,
- Uint8 nybble, Sint16 * coeff)
-{
- const Sint32 max_audioval = ((1 << (16 - 1)) - 1);
- const Sint32 min_audioval = -(1 << (16 - 1));
- const Sint32 adaptive[] = {
- 230, 230, 230, 230, 307, 409, 512, 614,
- 768, 614, 512, 409, 307, 230, 230, 230
- };
- Sint32 new_sample, delta;
-
- new_sample = ((state->iSamp1 * coeff[0]) +
- (state->iSamp2 * coeff[1])) / 256;
- if (nybble & 0x08) {
- new_sample += state->iDelta * (nybble - 0x10);
- } else {
- new_sample += state->iDelta * nybble;
- }
- if (new_sample < min_audioval) {
- new_sample = min_audioval;
- } else if (new_sample > max_audioval) {
- new_sample = max_audioval;
- }
- delta = ((Sint32) state->iDelta * adaptive[nybble]) / 256;
- if (delta < 16) {
- delta = 16;
- }
- state->iDelta = (Uint16) delta;
- state->iSamp2 = state->iSamp1;
- state->iSamp1 = (Sint16) new_sample;
- return (new_sample);
-}
-
-static int
-MS_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len)
-{
- struct MS_ADPCM_decodestate *state[2];
- Uint8 *freeable, *encoded, *decoded;
- Sint32 encoded_len, samplesleft;
- Sint8 nybble, stereo;
- Sint16 *coeff[2];
- Sint32 new_sample;
-
- /* Allocate the proper sized output buffer */
- encoded_len = *audio_len;
- encoded = *audio_buf;
- freeable = *audio_buf;
- *audio_len = (encoded_len / MS_ADPCM_state.wavefmt.blockalign) *
- MS_ADPCM_state.wSamplesPerBlock *
- MS_ADPCM_state.wavefmt.channels * sizeof(Sint16);
- *audio_buf = (Uint8 *) SDL_malloc(*audio_len);
- if (*audio_buf == NULL) {
- return SDL_OutOfMemory();
- }
- decoded = *audio_buf;
-
- /* Get ready... Go! */
- stereo = (MS_ADPCM_state.wavefmt.channels == 2);
- state[0] = &MS_ADPCM_state.state[0];
- state[1] = &MS_ADPCM_state.state[stereo];
- while (encoded_len >= MS_ADPCM_state.wavefmt.blockalign) {
- /* Grab the initial information for this block */
- state[0]->hPredictor = *encoded++;
- if (stereo) {
- state[1]->hPredictor = *encoded++;
- }
- state[0]->iDelta = ((encoded[1] << 8) | encoded[0]);
- encoded += sizeof(Sint16);
- if (stereo) {
- state[1]->iDelta = ((encoded[1] << 8) | encoded[0]);
- encoded += sizeof(Sint16);
- }
- state[0]->iSamp1 = ((encoded[1] << 8) | encoded[0]);
- encoded += sizeof(Sint16);
- if (stereo) {
- state[1]->iSamp1 = ((encoded[1] << 8) | encoded[0]);
- encoded += sizeof(Sint16);
- }
- state[0]->iSamp2 = ((encoded[1] << 8) | encoded[0]);
- encoded += sizeof(Sint16);
- if (stereo) {
- state[1]->iSamp2 = ((encoded[1] << 8) | encoded[0]);
- encoded += sizeof(Sint16);
- }
- coeff[0] = MS_ADPCM_state.aCoeff[state[0]->hPredictor];
- coeff[1] = MS_ADPCM_state.aCoeff[state[1]->hPredictor];
-
- /* Store the two initial samples we start with */
- decoded[0] = state[0]->iSamp2 & 0xFF;
- decoded[1] = state[0]->iSamp2 >> 8;
- decoded += 2;
- if (stereo) {
- decoded[0] = state[1]->iSamp2 & 0xFF;
- decoded[1] = state[1]->iSamp2 >> 8;
- decoded += 2;
- }
- decoded[0] = state[0]->iSamp1 & 0xFF;
- decoded[1] = state[0]->iSamp1 >> 8;
- decoded += 2;
- if (stereo) {
- decoded[0] = state[1]->iSamp1 & 0xFF;
- decoded[1] = state[1]->iSamp1 >> 8;
- decoded += 2;
- }
-
- /* Decode and store the other samples in this block */
- samplesleft = (MS_ADPCM_state.wSamplesPerBlock - 2) *
- MS_ADPCM_state.wavefmt.channels;
- while (samplesleft > 0) {
- nybble = (*encoded) >> 4;
- new_sample = MS_ADPCM_nibble(state[0], nybble, coeff[0]);
- decoded[0] = new_sample & 0xFF;
- new_sample >>= 8;
- decoded[1] = new_sample & 0xFF;
- decoded += 2;
-
- nybble = (*encoded) & 0x0F;
- new_sample = MS_ADPCM_nibble(state[1], nybble, coeff[1]);
- decoded[0] = new_sample & 0xFF;
- new_sample >>= 8;
- decoded[1] = new_sample & 0xFF;
- decoded += 2;
-
- ++encoded;
- samplesleft -= 2;
- }
- encoded_len -= MS_ADPCM_state.wavefmt.blockalign;
- }
- SDL_free(freeable);
- return (0);
-}
-
-struct IMA_ADPCM_decodestate
-{
- Sint32 sample;
- Sint8 index;
-};
-static struct IMA_ADPCM_decoder
-{
- WaveFMT wavefmt;
- Uint16 wSamplesPerBlock;
- /* * * */
- struct IMA_ADPCM_decodestate state[2];
-} IMA_ADPCM_state;
-
-static int
-InitIMA_ADPCM(WaveFMT * format)
-{
- Uint8 *rogue_feel;
-
- /* Set the rogue pointer to the IMA_ADPCM specific data */
- IMA_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding);
- IMA_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels);
- IMA_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency);
- IMA_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate);
- IMA_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign);
- IMA_ADPCM_state.wavefmt.bitspersample =
- SDL_SwapLE16(format->bitspersample);
- rogue_feel = (Uint8 *) format + sizeof(*format);
- if (sizeof(*format) == 16) {
- /* const Uint16 extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]); */
- rogue_feel += sizeof(Uint16);
- }
- IMA_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1] << 8) | rogue_feel[0]);
- return (0);
-}
-
-static Sint32
-IMA_ADPCM_nibble(struct IMA_ADPCM_decodestate *state, Uint8 nybble)
-{
- const Sint32 max_audioval = ((1 << (16 - 1)) - 1);
- const Sint32 min_audioval = -(1 << (16 - 1));
- const int index_table[16] = {
- -1, -1, -1, -1,
- 2, 4, 6, 8,
- -1, -1, -1, -1,
- 2, 4, 6, 8
- };
- const Sint32 step_table[89] = {
- 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31,
- 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130,
- 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408,
- 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282,
- 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327,
- 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630,
- 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350,
- 22385, 24623, 27086, 29794, 32767
- };
- Sint32 delta, step;
-
- /* Compute difference and new sample value */
- if (state->index > 88) {
- state->index = 88;
- } else if (state->index < 0) {
- state->index = 0;
- }
- step = step_table[state->index];
- delta = step >> 3;
- if (nybble & 0x04)
- delta += step;
- if (nybble & 0x02)
- delta += (step >> 1);
- if (nybble & 0x01)
- delta += (step >> 2);
- if (nybble & 0x08)
- delta = -delta;
- state->sample += delta;
-
- /* Update index value */
- state->index += index_table[nybble];
-
- /* Clamp output sample */
- if (state->sample > max_audioval) {
- state->sample = max_audioval;
- } else if (state->sample < min_audioval) {
- state->sample = min_audioval;
- }
- return (state->sample);
-}
-
-/* Fill the decode buffer with a channel block of data (8 samples) */
-static void
-Fill_IMA_ADPCM_block(Uint8 * decoded, Uint8 * encoded,
- int channel, int numchannels,
- struct IMA_ADPCM_decodestate *state)
-{
- int i;
- Sint8 nybble;
- Sint32 new_sample;
-
- decoded += (channel * 2);
- for (i = 0; i < 4; ++i) {
- nybble = (*encoded) & 0x0F;
- new_sample = IMA_ADPCM_nibble(state, nybble);
- decoded[0] = new_sample & 0xFF;
- new_sample >>= 8;
- decoded[1] = new_sample & 0xFF;
- decoded += 2 * numchannels;
-
- nybble = (*encoded) >> 4;
- new_sample = IMA_ADPCM_nibble(state, nybble);
- decoded[0] = new_sample & 0xFF;
- new_sample >>= 8;
- decoded[1] = new_sample & 0xFF;
- decoded += 2 * numchannels;
-
- ++encoded;
- }
-}
-
-static int
-IMA_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len)
-{
- struct IMA_ADPCM_decodestate *state;
- Uint8 *freeable, *encoded, *decoded;
- Sint32 encoded_len, samplesleft;
- unsigned int c, channels;
-
- /* Check to make sure we have enough variables in the state array */
- channels = IMA_ADPCM_state.wavefmt.channels;
- if (channels > SDL_arraysize(IMA_ADPCM_state.state)) {
- SDL_SetError("IMA ADPCM decoder can only handle %d channels",
- SDL_arraysize(IMA_ADPCM_state.state));
- return (-1);
- }
- state = IMA_ADPCM_state.state;
-
- /* Allocate the proper sized output buffer */
- encoded_len = *audio_len;
- encoded = *audio_buf;
- freeable = *audio_buf;
- *audio_len = (encoded_len / IMA_ADPCM_state.wavefmt.blockalign) *
- IMA_ADPCM_state.wSamplesPerBlock *
- IMA_ADPCM_state.wavefmt.channels * sizeof(Sint16);
- *audio_buf = (Uint8 *) SDL_malloc(*audio_len);
- if (*audio_buf == NULL) {
- return SDL_OutOfMemory();
- }
- decoded = *audio_buf;
-
- /* Get ready... Go! */
- while (encoded_len >= IMA_ADPCM_state.wavefmt.blockalign) {
- /* Grab the initial information for this block */
- for (c = 0; c < channels; ++c) {
- /* Fill the state information for this block */
- state[c].sample = ((encoded[1] << 8) | encoded[0]);
- encoded += 2;
- if (state[c].sample & 0x8000) {
- state[c].sample -= 0x10000;
- }
- state[c].index = *encoded++;
- /* Reserved byte in buffer header, should be 0 */
- if (*encoded++ != 0) {
- /* Uh oh, corrupt data? Buggy code? */ ;
- }
-
- /* Store the initial sample we start with */
- decoded[0] = (Uint8) (state[c].sample & 0xFF);
- decoded[1] = (Uint8) (state[c].sample >> 8);
- decoded += 2;
- }
-
- /* Decode and store the other samples in this block */
- samplesleft = (IMA_ADPCM_state.wSamplesPerBlock - 1) * channels;
- while (samplesleft > 0) {
- for (c = 0; c < channels; ++c) {
- Fill_IMA_ADPCM_block(decoded, encoded,
- c, channels, &state[c]);
- encoded += 4;
- samplesleft -= 8;
- }
- decoded += (channels * 8 * 2);
- }
- encoded_len -= IMA_ADPCM_state.wavefmt.blockalign;
- }
- SDL_free(freeable);
- return (0);
-}
-
-SDL_AudioSpec *
-SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
- SDL_AudioSpec * spec, Uint8 ** audio_buf, Uint32 * audio_len)
-{
- int was_error;
- Chunk chunk;
- int lenread;
- int IEEE_float_encoded, MS_ADPCM_encoded, IMA_ADPCM_encoded;
- int samplesize;
-
- /* WAV magic header */
- Uint32 RIFFchunk;
- Uint32 wavelen = 0;
- Uint32 WAVEmagic;
- Uint32 headerDiff = 0;
-
- /* FMT chunk */
- WaveFMT *format = NULL;
-
- SDL_zero(chunk);
-
- /* Make sure we are passed a valid data source */
- was_error = 0;
- if (src == NULL) {
- was_error = 1;
- goto done;
- }
-
- /* Check the magic header */
- RIFFchunk = SDL_ReadLE32(src);
- wavelen = SDL_ReadLE32(src);
- if (wavelen == WAVE) { /* The RIFFchunk has already been read */
- WAVEmagic = wavelen;
- wavelen = RIFFchunk;
- RIFFchunk = RIFF;
- } else {
- WAVEmagic = SDL_ReadLE32(src);
- }
- if ((RIFFchunk != RIFF) || (WAVEmagic != WAVE)) {
- SDL_SetError("Unrecognized file type (not WAVE)");
- was_error = 1;
- goto done;
- }
- headerDiff += sizeof(Uint32); /* for WAVE */
-
- /* Read the audio data format chunk */
- chunk.data = NULL;
- do {
- SDL_free(chunk.data);
- chunk.data = NULL;
- lenread = ReadChunk(src, &chunk);
- if (lenread < 0) {
- was_error = 1;
- goto done;
- }
- /* 2 Uint32's for chunk header+len, plus the lenread */
- headerDiff += lenread + 2 * sizeof(Uint32);
- } while ((chunk.magic == FACT) || (chunk.magic == LIST));
-
- /* Decode the audio data format */
- format = (WaveFMT *) chunk.data;
- if (chunk.magic != FMT) {
- SDL_SetError("Complex WAVE files not supported");
- was_error = 1;
- goto done;
- }
- IEEE_float_encoded = MS_ADPCM_encoded = IMA_ADPCM_encoded = 0;
- switch (SDL_SwapLE16(format->encoding)) {
- case PCM_CODE:
- /* We can understand this */
- break;
- case IEEE_FLOAT_CODE:
- IEEE_float_encoded = 1;
- /* We can understand this */
- break;
- case MS_ADPCM_CODE:
- /* Try to understand this */
- if (InitMS_ADPCM(format) < 0) {
- was_error = 1;
- goto done;
- }
- MS_ADPCM_encoded = 1;
- break;
- case IMA_ADPCM_CODE:
- /* Try to understand this */
- if (InitIMA_ADPCM(format) < 0) {
- was_error = 1;
- goto done;
- }
- IMA_ADPCM_encoded = 1;
- break;
- case MP3_CODE:
- SDL_SetError("MPEG Layer 3 data not supported",
- SDL_SwapLE16(format->encoding));
- was_error = 1;
- goto done;
- default:
- SDL_SetError("Unknown WAVE data format: 0x%.4x",
- SDL_SwapLE16(format->encoding));
- was_error = 1;
- goto done;
- }
- SDL_memset(spec, 0, (sizeof *spec));
- spec->freq = SDL_SwapLE32(format->frequency);
-
- if (IEEE_float_encoded) {
- if ((SDL_SwapLE16(format->bitspersample)) != 32) {
- was_error = 1;
- } else {
- spec->format = AUDIO_F32;
- }
- } else {
- switch (SDL_SwapLE16(format->bitspersample)) {
- case 4:
- if (MS_ADPCM_encoded || IMA_ADPCM_encoded) {
- spec->format = AUDIO_S16;
- } else {
- was_error = 1;
- }
- break;
- case 8:
- spec->format = AUDIO_U8;
- break;
- case 16:
- spec->format = AUDIO_S16;
- break;
- case 32:
- spec->format = AUDIO_S32;
- break;
- default:
- was_error = 1;
- break;
- }
- }
-
- if (was_error) {
- SDL_SetError("Unknown %d-bit PCM data format",
- SDL_SwapLE16(format->bitspersample));
- goto done;
- }
- spec->channels = (Uint8) SDL_SwapLE16(format->channels);
- spec->samples = 4096; /* Good default buffer size */
-
- /* Read the audio data chunk */
- *audio_buf = NULL;
- do {
- SDL_free(*audio_buf);
- *audio_buf = NULL;
- lenread = ReadChunk(src, &chunk);
- if (lenread < 0) {
- was_error = 1;
- goto done;
- }
- *audio_len = lenread;
- *audio_buf = chunk.data;
- if (chunk.magic != DATA)
- headerDiff += lenread + 2 * sizeof(Uint32);
- } while (chunk.magic != DATA);
- headerDiff += 2 * sizeof(Uint32); /* for the data chunk and len */
-
- if (MS_ADPCM_encoded) {
- if (MS_ADPCM_decode(audio_buf, audio_len) < 0) {
- was_error = 1;
- goto done;
- }
- }
- if (IMA_ADPCM_encoded) {
- if (IMA_ADPCM_decode(audio_buf, audio_len) < 0) {
- was_error = 1;
- goto done;
- }
- }
-
- /* Don't return a buffer that isn't a multiple of samplesize */
- samplesize = ((SDL_AUDIO_BITSIZE(spec->format)) / 8) * spec->channels;
- *audio_len &= ~(samplesize - 1);
-
- done:
- SDL_free(format);
- if (src) {
- if (freesrc) {
- SDL_RWclose(src);
- } else {
- /* seek to the end of the file (given by the RIFF chunk) */
- SDL_RWseek(src, wavelen - chunk.length - headerDiff, RW_SEEK_CUR);
- }
- }
- if (was_error) {
- spec = NULL;
- }
- return (spec);
-}
-
-/* Since the WAV memory is allocated in the shared library, it must also
- be freed here. (Necessary under Win32, VC++)
- */
-void
-SDL_FreeWAV(Uint8 * audio_buf)
-{
- SDL_free(audio_buf);
-}
-
-static int
-ReadChunk(SDL_RWops * src, Chunk * chunk)
-{
- chunk->magic = SDL_ReadLE32(src);
- chunk->length = SDL_ReadLE32(src);
- chunk->data = (Uint8 *) SDL_malloc(chunk->length);
- if (chunk->data == NULL) {
- return SDL_OutOfMemory();
- }
- if (SDL_RWread(src, chunk->data, chunk->length, 1) != 1) {
- SDL_free(chunk->data);
- chunk->data = NULL;
- return SDL_Error(SDL_EFREAD);
- }
- return (chunk->length);
-}
-
-/* vi: set ts=4 sw=4 expandtab: */
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/d1484ae0/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/SDL_wave.h
----------------------------------------------------------------------
diff --git a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/SDL_wave.h b/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/SDL_wave.h
deleted file mode 100644
index c53ad59..0000000
--- a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/SDL_wave.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2014 Sam Lantinga <sl...@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../SDL_internal.h"
-
-/* WAVE files are little-endian */
-
-/*******************************************/
-/* Define values for Microsoft WAVE format */
-/*******************************************/
-#define RIFF 0x46464952 /* "RIFF" */
-#define WAVE 0x45564157 /* "WAVE" */
-#define FACT 0x74636166 /* "fact" */
-#define LIST 0x5453494c /* "LIST" */
-#define FMT 0x20746D66 /* "fmt " */
-#define DATA 0x61746164 /* "data" */
-#define PCM_CODE 0x0001
-#define MS_ADPCM_CODE 0x0002
-#define IEEE_FLOAT_CODE 0x0003
-#define IMA_ADPCM_CODE 0x0011
-#define MP3_CODE 0x0055
-#define WAVE_MONO 1
-#define WAVE_STEREO 2
-
-/* Normally, these three chunks come consecutively in a WAVE file */
-typedef struct WaveFMT
-{
-/* Not saved in the chunk we read:
- Uint32 FMTchunk;
- Uint32 fmtlen;
-*/
- Uint16 encoding;
- Uint16 channels; /* 1 = mono, 2 = stereo */
- Uint32 frequency; /* One of 11025, 22050, or 44100 Hz */
- Uint32 byterate; /* Average bytes per second */
- Uint16 blockalign; /* Bytes per sample block */
- Uint16 bitspersample; /* One of 8, 12, 16, or 4 for ADPCM */
-} WaveFMT;
-
-/* The general chunk found in the WAVE file */
-typedef struct Chunk
-{
- Uint32 magic;
- Uint32 length;
- Uint8 *data;
-} Chunk;
-
-/* vi: set ts=4 sw=4 expandtab: */
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/d1484ae0/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/alsa/SDL_alsa_audio.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/alsa/SDL_alsa_audio.c b/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/alsa/SDL_alsa_audio.c
deleted file mode 100644
index 1f3def3..0000000
--- a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/alsa/SDL_alsa_audio.c
+++ /dev/null
@@ -1,685 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2014 Sam Lantinga <sl...@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../../SDL_internal.h"
-
-#if SDL_AUDIO_DRIVER_ALSA
-
-/* Allow access to a raw mixing buffer */
-
-#include <sys/types.h>
-#include <signal.h> /* For kill() */
-#include <errno.h>
-#include <string.h>
-
-#include "SDL_timer.h"
-#include "SDL_audio.h"
-#include "../SDL_audiomem.h"
-#include "../SDL_audio_c.h"
-#include "SDL_alsa_audio.h"
-
-#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
-#include "SDL_loadso.h"
-#endif
-
-static int (*ALSA_snd_pcm_open)
- (snd_pcm_t **, const char *, snd_pcm_stream_t, int);
-static int (*ALSA_snd_pcm_close) (snd_pcm_t * pcm);
-static snd_pcm_sframes_t(*ALSA_snd_pcm_writei)
- (snd_pcm_t *, const void *, snd_pcm_uframes_t);
-static int (*ALSA_snd_pcm_recover) (snd_pcm_t *, int, int);
-static int (*ALSA_snd_pcm_prepare) (snd_pcm_t *);
-static int (*ALSA_snd_pcm_drain) (snd_pcm_t *);
-static const char *(*ALSA_snd_strerror) (int);
-static size_t(*ALSA_snd_pcm_hw_params_sizeof) (void);
-static size_t(*ALSA_snd_pcm_sw_params_sizeof) (void);
-static void (*ALSA_snd_pcm_hw_params_copy)
- (snd_pcm_hw_params_t *, const snd_pcm_hw_params_t *);
-static int (*ALSA_snd_pcm_hw_params_any) (snd_pcm_t *, snd_pcm_hw_params_t *);
-static int (*ALSA_snd_pcm_hw_params_set_access)
- (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_access_t);
-static int (*ALSA_snd_pcm_hw_params_set_format)
- (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_format_t);
-static int (*ALSA_snd_pcm_hw_params_set_channels)
- (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int);
-static int (*ALSA_snd_pcm_hw_params_get_channels)
- (const snd_pcm_hw_params_t *, unsigned int *);
-static int (*ALSA_snd_pcm_hw_params_set_rate_near)
- (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int *, int *);
-static int (*ALSA_snd_pcm_hw_params_set_period_size_near)
- (snd_pcm_t *, snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *);
-static int (*ALSA_snd_pcm_hw_params_get_period_size)
- (const snd_pcm_hw_params_t *, snd_pcm_uframes_t *, int *);
-static int (*ALSA_snd_pcm_hw_params_set_periods_near)
- (snd_pcm_t *, snd_pcm_hw_params_t *, unsigned int *, int *);
-static int (*ALSA_snd_pcm_hw_params_get_periods)
- (const snd_pcm_hw_params_t *, unsigned int *, int *);
-static int (*ALSA_snd_pcm_hw_params_set_buffer_size_near)
- (snd_pcm_t *pcm, snd_pcm_hw_params_t *, snd_pcm_uframes_t *);
-static int (*ALSA_snd_pcm_hw_params_get_buffer_size)
- (const snd_pcm_hw_params_t *, snd_pcm_uframes_t *);
-static int (*ALSA_snd_pcm_hw_params) (snd_pcm_t *, snd_pcm_hw_params_t *);
-static int (*ALSA_snd_pcm_sw_params_current) (snd_pcm_t *,
- snd_pcm_sw_params_t *);
-static int (*ALSA_snd_pcm_sw_params_set_start_threshold)
- (snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t);
-static int (*ALSA_snd_pcm_sw_params) (snd_pcm_t *, snd_pcm_sw_params_t *);
-static int (*ALSA_snd_pcm_nonblock) (snd_pcm_t *, int);
-static int (*ALSA_snd_pcm_wait)(snd_pcm_t *, int);
-static int (*ALSA_snd_pcm_sw_params_set_avail_min)
- (snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t);
-
-#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
-#define snd_pcm_hw_params_sizeof ALSA_snd_pcm_hw_params_sizeof
-#define snd_pcm_sw_params_sizeof ALSA_snd_pcm_sw_params_sizeof
-
-static const char *alsa_library = SDL_AUDIO_DRIVER_ALSA_DYNAMIC;
-static void *alsa_handle = NULL;
-
-static int
-load_alsa_sym(const char *fn, void **addr)
-{
- *addr = SDL_LoadFunction(alsa_handle, fn);
- if (*addr == NULL) {
- /* Don't call SDL_SetError(): SDL_LoadFunction already did. */
- return 0;
- }
-
- return 1;
-}
-
-/* cast funcs to char* first, to please GCC's strict aliasing rules. */
-#define SDL_ALSA_SYM(x) \
- if (!load_alsa_sym(#x, (void **) (char *) &ALSA_##x)) return -1
-#else
-#define SDL_ALSA_SYM(x) ALSA_##x = x
-#endif
-
-static int
-load_alsa_syms(void)
-{
- SDL_ALSA_SYM(snd_pcm_open);
- SDL_ALSA_SYM(snd_pcm_close);
- SDL_ALSA_SYM(snd_pcm_writei);
- SDL_ALSA_SYM(snd_pcm_recover);
- SDL_ALSA_SYM(snd_pcm_prepare);
- SDL_ALSA_SYM(snd_pcm_drain);
- SDL_ALSA_SYM(snd_strerror);
- SDL_ALSA_SYM(snd_pcm_hw_params_sizeof);
- SDL_ALSA_SYM(snd_pcm_sw_params_sizeof);
- SDL_ALSA_SYM(snd_pcm_hw_params_copy);
- SDL_ALSA_SYM(snd_pcm_hw_params_any);
- SDL_ALSA_SYM(snd_pcm_hw_params_set_access);
- SDL_ALSA_SYM(snd_pcm_hw_params_set_format);
- SDL_ALSA_SYM(snd_pcm_hw_params_set_channels);
- SDL_ALSA_SYM(snd_pcm_hw_params_get_channels);
- SDL_ALSA_SYM(snd_pcm_hw_params_set_rate_near);
- SDL_ALSA_SYM(snd_pcm_hw_params_set_period_size_near);
- SDL_ALSA_SYM(snd_pcm_hw_params_get_period_size);
- SDL_ALSA_SYM(snd_pcm_hw_params_set_periods_near);
- SDL_ALSA_SYM(snd_pcm_hw_params_get_periods);
- SDL_ALSA_SYM(snd_pcm_hw_params_set_buffer_size_near);
- SDL_ALSA_SYM(snd_pcm_hw_params_get_buffer_size);
- SDL_ALSA_SYM(snd_pcm_hw_params);
- SDL_ALSA_SYM(snd_pcm_sw_params_current);
- SDL_ALSA_SYM(snd_pcm_sw_params_set_start_threshold);
- SDL_ALSA_SYM(snd_pcm_sw_params);
- SDL_ALSA_SYM(snd_pcm_nonblock);
- SDL_ALSA_SYM(snd_pcm_wait);
- SDL_ALSA_SYM(snd_pcm_sw_params_set_avail_min);
- return 0;
-}
-
-#undef SDL_ALSA_SYM
-
-#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
-
-static void
-UnloadALSALibrary(void)
-{
- if (alsa_handle != NULL) {
- SDL_UnloadObject(alsa_handle);
- alsa_handle = NULL;
- }
-}
-
-static int
-LoadALSALibrary(void)
-{
- int retval = 0;
- if (alsa_handle == NULL) {
- alsa_handle = SDL_LoadObject(alsa_library);
- if (alsa_handle == NULL) {
- retval = -1;
- /* Don't call SDL_SetError(): SDL_LoadObject already did. */
- } else {
- retval = load_alsa_syms();
- if (retval < 0) {
- UnloadALSALibrary();
- }
- }
- }
- return retval;
-}
-
-#else
-
-static void
-UnloadALSALibrary(void)
-{
-}
-
-static int
-LoadALSALibrary(void)
-{
- load_alsa_syms();
- return 0;
-}
-
-#endif /* SDL_AUDIO_DRIVER_ALSA_DYNAMIC */
-
-static const char *
-get_audio_device(int channels)
-{
- const char *device;
-
- device = SDL_getenv("AUDIODEV"); /* Is there a standard variable name? */
- if (device == NULL) {
- switch (channels) {
- case 6:
- device = "plug:surround51";
- break;
- case 4:
- device = "plug:surround40";
- break;
- default:
- device = "default";
- break;
- }
- }
- return device;
-}
-
-
-/* This function waits until it is possible to write a full sound buffer */
-static void
-ALSA_WaitDevice(_THIS)
-{
- /* We're in blocking mode, so there's nothing to do here */
-}
-
-
-/* !!! FIXME: is there a channel swizzler in alsalib instead? */
-/*
- * http://bugzilla.libsdl.org/show_bug.cgi?id=110
- * "For Linux ALSA, this is FL-FR-RL-RR-C-LFE
- * and for Windows DirectX [and CoreAudio], this is FL-FR-C-LFE-RL-RR"
- */
-#define SWIZ6(T) \
- T *ptr = (T *) this->hidden->mixbuf; \
- Uint32 i; \
- for (i = 0; i < this->spec.samples; i++, ptr += 6) { \
- T tmp; \
- tmp = ptr[2]; ptr[2] = ptr[4]; ptr[4] = tmp; \
- tmp = ptr[3]; ptr[3] = ptr[5]; ptr[5] = tmp; \
- }
-
-static SDL_INLINE void
-swizzle_alsa_channels_6_64bit(_THIS)
-{
- SWIZ6(Uint64);
-}
-
-static SDL_INLINE void
-swizzle_alsa_channels_6_32bit(_THIS)
-{
- SWIZ6(Uint32);
-}
-
-static SDL_INLINE void
-swizzle_alsa_channels_6_16bit(_THIS)
-{
- SWIZ6(Uint16);
-}
-
-static SDL_INLINE void
-swizzle_alsa_channels_6_8bit(_THIS)
-{
- SWIZ6(Uint8);
-}
-
-#undef SWIZ6
-
-
-/*
- * Called right before feeding this->hidden->mixbuf to the hardware. Swizzle
- * channels from Windows/Mac order to the format alsalib will want.
- */
-static SDL_INLINE void
-swizzle_alsa_channels(_THIS)
-{
- if (this->spec.channels == 6) {
- const Uint16 fmtsize = (this->spec.format & 0xFF); /* bits/channel. */
- if (fmtsize == 16)
- swizzle_alsa_channels_6_16bit(this);
- else if (fmtsize == 8)
- swizzle_alsa_channels_6_8bit(this);
- else if (fmtsize == 32)
- swizzle_alsa_channels_6_32bit(this);
- else if (fmtsize == 64)
- swizzle_alsa_channels_6_64bit(this);
- }
-
- /* !!! FIXME: update this for 7.1 if needed, later. */
-}
-
-
-static void
-ALSA_PlayDevice(_THIS)
-{
- int status;
- const Uint8 *sample_buf = (const Uint8 *) this->hidden->mixbuf;
- const int frame_size = (((int) (this->spec.format & 0xFF)) / 8) *
- this->spec.channels;
- snd_pcm_uframes_t frames_left = ((snd_pcm_uframes_t) this->spec.samples);
-
- swizzle_alsa_channels(this);
-
- while ( frames_left > 0 && this->enabled ) {
- /* !!! FIXME: This works, but needs more testing before going live */
- /* ALSA_snd_pcm_wait(this->hidden->pcm_handle, -1); */
- status = ALSA_snd_pcm_writei(this->hidden->pcm_handle,
- sample_buf, frames_left);
-
- if (status < 0) {
- if (status == -EAGAIN) {
- /* Apparently snd_pcm_recover() doesn't handle this case -
- does it assume snd_pcm_wait() above? */
- SDL_Delay(1);
- continue;
- }
- status = ALSA_snd_pcm_recover(this->hidden->pcm_handle, status, 0);
- if (status < 0) {
- /* Hmm, not much we can do - abort */
- fprintf(stderr, "ALSA write failed (unrecoverable): %s\n",
- ALSA_snd_strerror(status));
- this->enabled = 0;
- return;
- }
- continue;
- }
- sample_buf += status * frame_size;
- frames_left -= status;
- }
-}
-
-static Uint8 *
-ALSA_GetDeviceBuf(_THIS)
-{
- return (this->hidden->mixbuf);
-}
-
-static void
-ALSA_CloseDevice(_THIS)
-{
- if (this->hidden != NULL) {
- SDL_FreeAudioMem(this->hidden->mixbuf);
- this->hidden->mixbuf = NULL;
- if (this->hidden->pcm_handle) {
- ALSA_snd_pcm_drain(this->hidden->pcm_handle);
- ALSA_snd_pcm_close(this->hidden->pcm_handle);
- this->hidden->pcm_handle = NULL;
- }
- SDL_free(this->hidden);
- this->hidden = NULL;
- }
-}
-
-static int
-ALSA_finalize_hardware(_THIS, snd_pcm_hw_params_t *hwparams, int override)
-{
- int status;
- snd_pcm_uframes_t bufsize;
-
- /* "set" the hardware with the desired parameters */
- status = ALSA_snd_pcm_hw_params(this->hidden->pcm_handle, hwparams);
- if ( status < 0 ) {
- return(-1);
- }
-
- /* Get samples for the actual buffer size */
- status = ALSA_snd_pcm_hw_params_get_buffer_size(hwparams, &bufsize);
- if ( status < 0 ) {
- return(-1);
- }
- if ( !override && bufsize != this->spec.samples * 2 ) {
- return(-1);
- }
-
- /* !!! FIXME: Is this safe to do? */
- this->spec.samples = bufsize / 2;
-
- /* This is useful for debugging */
- if ( SDL_getenv("SDL_AUDIO_ALSA_DEBUG") ) {
- snd_pcm_uframes_t persize = 0;
- unsigned int periods = 0;
-
- ALSA_snd_pcm_hw_params_get_period_size(hwparams, &persize, NULL);
- ALSA_snd_pcm_hw_params_get_periods(hwparams, &periods, NULL);
-
- fprintf(stderr,
- "ALSA: period size = %ld, periods = %u, buffer size = %lu\n",
- persize, periods, bufsize);
- }
-
- return(0);
-}
-
-static int
-ALSA_set_period_size(_THIS, snd_pcm_hw_params_t *params, int override)
-{
- const char *env;
- int status;
- snd_pcm_hw_params_t *hwparams;
- snd_pcm_uframes_t frames;
- unsigned int periods;
-
- /* Copy the hardware parameters for this setup */
- snd_pcm_hw_params_alloca(&hwparams);
- ALSA_snd_pcm_hw_params_copy(hwparams, params);
-
- if ( !override ) {
- env = SDL_getenv("SDL_AUDIO_ALSA_SET_PERIOD_SIZE");
- if ( env ) {
- override = SDL_atoi(env);
- if ( override == 0 ) {
- return(-1);
- }
- }
- }
-
- frames = this->spec.samples;
- status = ALSA_snd_pcm_hw_params_set_period_size_near(
- this->hidden->pcm_handle, hwparams, &frames, NULL);
- if ( status < 0 ) {
- return(-1);
- }
-
- periods = 2;
- status = ALSA_snd_pcm_hw_params_set_periods_near(
- this->hidden->pcm_handle, hwparams, &periods, NULL);
- if ( status < 0 ) {
- return(-1);
- }
-
- return ALSA_finalize_hardware(this, hwparams, override);
-}
-
-static int
-ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params, int override)
-{
- const char *env;
- int status;
- snd_pcm_hw_params_t *hwparams;
- snd_pcm_uframes_t frames;
-
- /* Copy the hardware parameters for this setup */
- snd_pcm_hw_params_alloca(&hwparams);
- ALSA_snd_pcm_hw_params_copy(hwparams, params);
-
- if ( !override ) {
- env = SDL_getenv("SDL_AUDIO_ALSA_SET_BUFFER_SIZE");
- if ( env ) {
- override = SDL_atoi(env);
- if ( override == 0 ) {
- return(-1);
- }
- }
- }
-
- frames = this->spec.samples * 2;
- status = ALSA_snd_pcm_hw_params_set_buffer_size_near(
- this->hidden->pcm_handle, hwparams, &frames);
- if ( status < 0 ) {
- return(-1);
- }
-
- return ALSA_finalize_hardware(this, hwparams, override);
-}
-
-static int
-ALSA_OpenDevice(_THIS, const char *devname, int iscapture)
-{
- int status = 0;
- snd_pcm_t *pcm_handle = NULL;
- snd_pcm_hw_params_t *hwparams = NULL;
- snd_pcm_sw_params_t *swparams = NULL;
- snd_pcm_format_t format = 0;
- SDL_AudioFormat test_format = 0;
- unsigned int rate = 0;
- unsigned int channels = 0;
-
- /* Initialize all variables that we clean on shutdown */
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- if (this->hidden == NULL) {
- return SDL_OutOfMemory();
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-
- /* Open the audio device */
- /* Name of device should depend on # channels in spec */
- status = ALSA_snd_pcm_open(&pcm_handle,
- get_audio_device(this->spec.channels),
- SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
-
- if (status < 0) {
- ALSA_CloseDevice(this);
- return SDL_SetError("ALSA: Couldn't open audio device: %s",
- ALSA_snd_strerror(status));
- }
-
- this->hidden->pcm_handle = pcm_handle;
-
- /* Figure out what the hardware is capable of */
- snd_pcm_hw_params_alloca(&hwparams);
- status = ALSA_snd_pcm_hw_params_any(pcm_handle, hwparams);
- if (status < 0) {
- ALSA_CloseDevice(this);
- return SDL_SetError("ALSA: Couldn't get hardware config: %s",
- ALSA_snd_strerror(status));
- }
-
- /* SDL only uses interleaved sample output */
- status = ALSA_snd_pcm_hw_params_set_access(pcm_handle, hwparams,
- SND_PCM_ACCESS_RW_INTERLEAVED);
- if (status < 0) {
- ALSA_CloseDevice(this);
- return SDL_SetError("ALSA: Couldn't set interleaved access: %s",
- ALSA_snd_strerror(status));
- }
-
- /* Try for a closest match on audio format */
- status = -1;
- for (test_format = SDL_FirstAudioFormat(this->spec.format);
- test_format && (status < 0);) {
- status = 0; /* if we can't support a format, it'll become -1. */
- switch (test_format) {
- case AUDIO_U8:
- format = SND_PCM_FORMAT_U8;
- break;
- case AUDIO_S8:
- format = SND_PCM_FORMAT_S8;
- break;
- case AUDIO_S16LSB:
- format = SND_PCM_FORMAT_S16_LE;
- break;
- case AUDIO_S16MSB:
- format = SND_PCM_FORMAT_S16_BE;
- break;
- case AUDIO_U16LSB:
- format = SND_PCM_FORMAT_U16_LE;
- break;
- case AUDIO_U16MSB:
- format = SND_PCM_FORMAT_U16_BE;
- break;
- case AUDIO_S32LSB:
- format = SND_PCM_FORMAT_S32_LE;
- break;
- case AUDIO_S32MSB:
- format = SND_PCM_FORMAT_S32_BE;
- break;
- case AUDIO_F32LSB:
- format = SND_PCM_FORMAT_FLOAT_LE;
- break;
- case AUDIO_F32MSB:
- format = SND_PCM_FORMAT_FLOAT_BE;
- break;
- default:
- status = -1;
- break;
- }
- if (status >= 0) {
- status = ALSA_snd_pcm_hw_params_set_format(pcm_handle,
- hwparams, format);
- }
- if (status < 0) {
- test_format = SDL_NextAudioFormat();
- }
- }
- if (status < 0) {
- ALSA_CloseDevice(this);
- return SDL_SetError("ALSA: Couldn't find any hardware audio formats");
- }
- this->spec.format = test_format;
-
- /* Set the number of channels */
- status = ALSA_snd_pcm_hw_params_set_channels(pcm_handle, hwparams,
- this->spec.channels);
- channels = this->spec.channels;
- if (status < 0) {
- status = ALSA_snd_pcm_hw_params_get_channels(hwparams, &channels);
- if (status < 0) {
- ALSA_CloseDevice(this);
- return SDL_SetError("ALSA: Couldn't set audio channels");
- }
- this->spec.channels = channels;
- }
-
- /* Set the audio rate */
- rate = this->spec.freq;
- status = ALSA_snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams,
- &rate, NULL);
- if (status < 0) {
- ALSA_CloseDevice(this);
- return SDL_SetError("ALSA: Couldn't set audio frequency: %s",
- ALSA_snd_strerror(status));
- }
- this->spec.freq = rate;
-
- /* Set the buffer size, in samples */
- if ( ALSA_set_period_size(this, hwparams, 0) < 0 &&
- ALSA_set_buffer_size(this, hwparams, 0) < 0 ) {
- /* Failed to set desired buffer size, do the best you can... */
- if ( ALSA_set_period_size(this, hwparams, 1) < 0 ) {
- ALSA_CloseDevice(this);
- return SDL_SetError("Couldn't set hardware audio parameters: %s", ALSA_snd_strerror(status));
- }
- }
- /* Set the software parameters */
- snd_pcm_sw_params_alloca(&swparams);
- status = ALSA_snd_pcm_sw_params_current(pcm_handle, swparams);
- if (status < 0) {
- ALSA_CloseDevice(this);
- return SDL_SetError("ALSA: Couldn't get software config: %s",
- ALSA_snd_strerror(status));
- }
- status = ALSA_snd_pcm_sw_params_set_avail_min(pcm_handle, swparams, this->spec.samples);
- if (status < 0) {
- ALSA_CloseDevice(this);
- return SDL_SetError("Couldn't set minimum available samples: %s",
- ALSA_snd_strerror(status));
- }
- status =
- ALSA_snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, 1);
- if (status < 0) {
- ALSA_CloseDevice(this);
- return SDL_SetError("ALSA: Couldn't set start threshold: %s",
- ALSA_snd_strerror(status));
- }
- status = ALSA_snd_pcm_sw_params(pcm_handle, swparams);
- if (status < 0) {
- ALSA_CloseDevice(this);
- return SDL_SetError("Couldn't set software audio parameters: %s",
- ALSA_snd_strerror(status));
- }
-
- /* Calculate the final parameters for this audio specification */
- SDL_CalculateAudioSpec(&this->spec);
-
- /* Allocate mixing buffer */
- this->hidden->mixlen = this->spec.size;
- this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
- if (this->hidden->mixbuf == NULL) {
- ALSA_CloseDevice(this);
- return SDL_OutOfMemory();
- }
- SDL_memset(this->hidden->mixbuf, this->spec.silence, this->hidden->mixlen);
-
- /* Switch to blocking mode for playback */
- ALSA_snd_pcm_nonblock(pcm_handle, 0);
-
- /* We're ready to rock and roll. :-) */
- return 0;
-}
-
-static void
-ALSA_Deinitialize(void)
-{
- UnloadALSALibrary();
-}
-
-static int
-ALSA_Init(SDL_AudioDriverImpl * impl)
-{
- if (LoadALSALibrary() < 0) {
- return 0;
- }
-
- /* Set the function pointers */
- impl->OpenDevice = ALSA_OpenDevice;
- impl->WaitDevice = ALSA_WaitDevice;
- impl->GetDeviceBuf = ALSA_GetDeviceBuf;
- impl->PlayDevice = ALSA_PlayDevice;
- impl->CloseDevice = ALSA_CloseDevice;
- impl->Deinitialize = ALSA_Deinitialize;
- impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: Add device enum! */
-
- return 1; /* this audio target is available. */
-}
-
-
-AudioBootStrap ALSA_bootstrap = {
- "alsa", "ALSA PCM audio", ALSA_Init, 0
-};
-
-#endif /* SDL_AUDIO_DRIVER_ALSA */
-
-/* vi: set ts=4 sw=4 expandtab: */
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/d1484ae0/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/alsa/SDL_alsa_audio.h
----------------------------------------------------------------------
diff --git a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/alsa/SDL_alsa_audio.h b/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/alsa/SDL_alsa_audio.h
deleted file mode 100644
index 4535388..0000000
--- a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/alsa/SDL_alsa_audio.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2014 Sam Lantinga <sl...@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../../SDL_internal.h"
-
-#ifndef _SDL_ALSA_audio_h
-#define _SDL_ALSA_audio_h
-
-#include <alsa/asoundlib.h>
-
-#include "../SDL_sysaudio.h"
-
-/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
-
-struct SDL_PrivateAudioData
-{
- /* The audio device handle */
- snd_pcm_t *pcm_handle;
-
- /* Raw mixing buffer */
- Uint8 *mixbuf;
- int mixlen;
-};
-
-#endif /* _SDL_ALSA_audio_h */
-
-/* vi: set ts=4 sw=4 expandtab: */
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/d1484ae0/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/android/SDL_androidaudio.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/android/SDL_androidaudio.c b/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/android/SDL_androidaudio.c
deleted file mode 100644
index 0c85b83..0000000
--- a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/android/SDL_androidaudio.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2014 Sam Lantinga <sl...@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../../SDL_internal.h"
-
-#if SDL_AUDIO_DRIVER_ANDROID
-
-/* Output audio to Android */
-
-#include "SDL_audio.h"
-#include "../SDL_audio_c.h"
-#include "SDL_androidaudio.h"
-
-#include "../../core/android/SDL_android.h"
-
-#include <android/log.h>
-
-static void * audioDevice;
-
-static int
-AndroidAUD_OpenDevice(_THIS, const char *devname, int iscapture)
-{
- SDL_AudioFormat test_format;
-
- if (iscapture) {
- /* TODO: implement capture */
- return SDL_SetError("Capture not supported on Android");
- }
-
- if (audioDevice != NULL) {
- return SDL_SetError("Only one audio device at a time please!");
- }
-
- audioDevice = this;
-
- test_format = SDL_FirstAudioFormat(this->spec.format);
- while (test_format != 0) { /* no "UNKNOWN" constant */
- if ((test_format == AUDIO_U8) || (test_format == AUDIO_S16LSB)) {
- this->spec.format = test_format;
- break;
- }
- test_format = SDL_NextAudioFormat();
- }
-
- if (test_format == 0) {
- /* Didn't find a compatible format :( */
- return SDL_SetError("No compatible audio format!");
- }
-
- if (this->spec.channels > 1) {
- this->spec.channels = 2;
- } else {
- this->spec.channels = 1;
- }
-
- if (this->spec.freq < 8000) {
- this->spec.freq = 8000;
- }
- if (this->spec.freq > 48000) {
- this->spec.freq = 48000;
- }
-
- /* TODO: pass in/return a (Java) device ID, also whether we're opening for input or output */
- this->spec.samples = Android_JNI_OpenAudioDevice(this->spec.freq, this->spec.format == AUDIO_U8 ? 0 : 1, this->spec.channels, this->spec.samples);
- SDL_CalculateAudioSpec(&this->spec);
-
- if (this->spec.samples == 0) {
- /* Init failed? */
- return SDL_SetError("Java-side initialization failed!");
- }
-
- return 0;
-}
-
-static void
-AndroidAUD_PlayDevice(_THIS)
-{
- Android_JNI_WriteAudioBuffer();
-}
-
-static Uint8 *
-AndroidAUD_GetDeviceBuf(_THIS)
-{
- return Android_JNI_GetAudioBuffer();
-}
-
-static void
-AndroidAUD_CloseDevice(_THIS)
-{
- /* At this point SDL_CloseAudioDevice via close_audio_device took care of terminating the audio thread
- so it's safe to terminate the Java side buffer and AudioTrack
- */
- Android_JNI_CloseAudioDevice();
-
- if (audioDevice == this) {
- audioDevice = NULL;
- }
-}
-
-static int
-AndroidAUD_Init(SDL_AudioDriverImpl * impl)
-{
- /* Set the function pointers */
- impl->OpenDevice = AndroidAUD_OpenDevice;
- impl->PlayDevice = AndroidAUD_PlayDevice;
- impl->GetDeviceBuf = AndroidAUD_GetDeviceBuf;
- impl->CloseDevice = AndroidAUD_CloseDevice;
-
- /* and the capabilities */
- impl->HasCaptureSupport = 0; /* TODO */
- impl->OnlyHasDefaultOutputDevice = 1;
- impl->OnlyHasDefaultInputDevice = 1;
-
- return 1; /* this audio target is available. */
-}
-
-AudioBootStrap ANDROIDAUD_bootstrap = {
- "android", "SDL Android audio driver", AndroidAUD_Init, 0
-};
-
-#endif /* SDL_AUDIO_DRIVER_ANDROID */
-
-/* vi: set ts=4 sw=4 expandtab: */
-
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/d1484ae0/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/android/SDL_androidaudio.h
----------------------------------------------------------------------
diff --git a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/android/SDL_androidaudio.h b/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/android/SDL_androidaudio.h
deleted file mode 100644
index ab49f00..0000000
--- a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/android/SDL_androidaudio.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2014 Sam Lantinga <sl...@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../../SDL_internal.h"
-
-#ifndef _SDL_androidaudio_h
-#define _SDL_androidaudio_h
-
-#include "../SDL_sysaudio.h"
-
-/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
-
-struct SDL_PrivateAudioData
-{
-};
-
-static void AndroidAUD_CloseDevice(_THIS);
-
-#endif /* _SDL_androidaudio_h */
-
-/* vi: set ts=4 sw=4 expandtab: */
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/d1484ae0/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/arts/SDL_artsaudio.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/arts/SDL_artsaudio.c b/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/arts/SDL_artsaudio.c
deleted file mode 100644
index 72fba70..0000000
--- a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/arts/SDL_artsaudio.c
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2014 Sam Lantinga <sl...@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../../SDL_internal.h"
-
-#if SDL_AUDIO_DRIVER_ARTS
-
-/* Allow access to a raw mixing buffer */
-
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#include <unistd.h>
-#include <errno.h>
-
-#include "SDL_timer.h"
-#include "SDL_audio.h"
-#include "../SDL_audiomem.h"
-#include "../SDL_audio_c.h"
-#include "SDL_artsaudio.h"
-
-#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
-#include "SDL_name.h"
-#include "SDL_loadso.h"
-#else
-#define SDL_NAME(X) X
-#endif
-
-#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
-
-static const char *arts_library = SDL_AUDIO_DRIVER_ARTS_DYNAMIC;
-static void *arts_handle = NULL;
-
-/* !!! FIXME: I hate this SDL_NAME clutter...it makes everything so messy! */
-static int (*SDL_NAME(arts_init)) (void);
-static void (*SDL_NAME(arts_free)) (void);
-static arts_stream_t(*SDL_NAME(arts_play_stream)) (int rate, int bits,
- int channels,
- const char *name);
-static int (*SDL_NAME(arts_stream_set)) (arts_stream_t s,
- arts_parameter_t param, int value);
-static int (*SDL_NAME(arts_stream_get)) (arts_stream_t s,
- arts_parameter_t param);
-static int (*SDL_NAME(arts_write)) (arts_stream_t s, const void *buffer,
- int count);
-static void (*SDL_NAME(arts_close_stream)) (arts_stream_t s);
-static int (*SDL_NAME(arts_suspend))(void);
-static int (*SDL_NAME(arts_suspended)) (void);
-static const char *(*SDL_NAME(arts_error_text)) (int errorcode);
-
-#define SDL_ARTS_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) }
-static struct
-{
- const char *name;
- void **func;
-} arts_functions[] = {
-/* *INDENT-OFF* */
- SDL_ARTS_SYM(arts_init),
- SDL_ARTS_SYM(arts_free),
- SDL_ARTS_SYM(arts_play_stream),
- SDL_ARTS_SYM(arts_stream_set),
- SDL_ARTS_SYM(arts_stream_get),
- SDL_ARTS_SYM(arts_write),
- SDL_ARTS_SYM(arts_close_stream),
- SDL_ARTS_SYM(arts_suspend),
- SDL_ARTS_SYM(arts_suspended),
- SDL_ARTS_SYM(arts_error_text),
-/* *INDENT-ON* */
-};
-
-#undef SDL_ARTS_SYM
-
-static void
-UnloadARTSLibrary()
-{
- if (arts_handle != NULL) {
- SDL_UnloadObject(arts_handle);
- arts_handle = NULL;
- }
-}
-
-static int
-LoadARTSLibrary(void)
-{
- int i, retval = -1;
-
- if (arts_handle == NULL) {
- arts_handle = SDL_LoadObject(arts_library);
- if (arts_handle != NULL) {
- retval = 0;
- for (i = 0; i < SDL_arraysize(arts_functions); ++i) {
- *arts_functions[i].func =
- SDL_LoadFunction(arts_handle, arts_functions[i].name);
- if (!*arts_functions[i].func) {
- retval = -1;
- UnloadARTSLibrary();
- break;
- }
- }
- }
- }
-
- return retval;
-}
-
-#else
-
-static void
-UnloadARTSLibrary()
-{
- return;
-}
-
-static int
-LoadARTSLibrary(void)
-{
- return 0;
-}
-
-#endif /* SDL_AUDIO_DRIVER_ARTS_DYNAMIC */
-
-/* This function waits until it is possible to write a full sound buffer */
-static void
-ARTS_WaitDevice(_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
- that use a different process id for each thread.
- */
- /* Check every 10 loops */
- if (this->hidden->parent && (((++cnt) % 10) == 0)) {
- if (kill(this->hidden->parent, 0) < 0 && errno == ESRCH) {
- this->enabled = 0;
- }
- }
- }
-
- /* Use timer for general audio synchronization */
- ticks =
- ((Sint32) (this->hidden->next_frame - SDL_GetTicks())) - FUDGE_TICKS;
- if (ticks > 0) {
- SDL_Delay(ticks);
- }
-}
-
-static void
-ARTS_PlayDevice(_THIS)
-{
- /* Write the audio data */
- int written = SDL_NAME(arts_write) (this->hidden->stream,
- this->hidden->mixbuf,
- this->hidden->mixlen);
-
- /* If timer synchronization is enabled, set the next write frame */
- if (this->hidden->frame_ticks) {
- this->hidden->next_frame += this->hidden->frame_ticks;
- }
-
- /* If we couldn't write, assume fatal error for now */
- if (written < 0) {
- this->enabled = 0;
- }
-#ifdef DEBUG_AUDIO
- fprintf(stderr, "Wrote %d bytes of audio data\n", written);
-#endif
-}
-
-static void
-ARTS_WaitDone(_THIS)
-{
- /* !!! FIXME: camp here until buffer drains... SDL_Delay(???); */
-}
-
-
-static Uint8 *
-ARTS_GetDeviceBuf(_THIS)
-{
- return (this->hidden->mixbuf);
-}
-
-
-static void
-ARTS_CloseDevice(_THIS)
-{
- if (this->hidden != NULL) {
- SDL_FreeAudioMem(this->hidden->mixbuf);
- this->hidden->mixbuf = NULL;
- if (this->hidden->stream) {
- SDL_NAME(arts_close_stream) (this->hidden->stream);
- this->hidden->stream = 0;
- }
- SDL_NAME(arts_free) ();
- SDL_free(this->hidden);
- this->hidden = NULL;
- }
-}
-
-static int
-ARTS_Suspend(void)
-{
- const Uint32 abortms = SDL_GetTicks() + 3000; /* give up after 3 secs */
- while ( (!SDL_NAME(arts_suspended)()) && !SDL_TICKS_PASSED(SDL_GetTicks(), abortms) ) {
- if ( SDL_NAME(arts_suspend)() ) {
- break;
- }
- }
- return SDL_NAME(arts_suspended)();
-}
-
-static int
-ARTS_OpenDevice(_THIS, const char *devname, int iscapture)
-{
- int rc = 0;
- int bits = 0, frag_spec = 0;
- SDL_AudioFormat test_format = 0, format = 0;
-
- /* Initialize all variables that we clean on shutdown */
- this->hidden = (struct SDL_PrivateAudioData *)
- SDL_malloc((sizeof *this->hidden));
- if (this->hidden == NULL) {
- return SDL_OutOfMemory();
- }
- SDL_memset(this->hidden, 0, (sizeof *this->hidden));
-
- /* Try for a closest match on audio format */
- for (test_format = SDL_FirstAudioFormat(this->spec.format);
- !format && test_format;) {
-#ifdef DEBUG_AUDIO
- fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
-#endif
- switch (test_format) {
- case AUDIO_U8:
- bits = 8;
- format = 1;
- break;
- case AUDIO_S16LSB:
- bits = 16;
- format = 1;
- break;
- default:
- format = 0;
- break;
- }
- if (!format) {
- test_format = SDL_NextAudioFormat();
- }
- }
- if (format == 0) {
- ARTS_CloseDevice(this);
- return SDL_SetError("Couldn't find any hardware audio formats");
- }
- this->spec.format = test_format;
-
- if ((rc = SDL_NAME(arts_init) ()) != 0) {
- ARTS_CloseDevice(this);
- return SDL_SetError("Unable to initialize ARTS: %s",
- SDL_NAME(arts_error_text) (rc));
- }
-
- if (!ARTS_Suspend()) {
- ARTS_CloseDevice(this);
- return SDL_SetError("ARTS can not open audio device");
- }
-
- this->hidden->stream = SDL_NAME(arts_play_stream) (this->spec.freq,
- bits,
- this->spec.channels,
- "SDL");
-
- /* Play nothing so we have at least one write (server bug workaround). */
- SDL_NAME(arts_write) (this->hidden->stream, "", 0);
-
- /* Calculate the final parameters for this audio specification */
- SDL_CalculateAudioSpec(&this->spec);
-
- /* Determine the power of two of the fragment size */
- for (frag_spec = 0; (0x01 << frag_spec) < this->spec.size; ++frag_spec);
- if ((0x01 << frag_spec) != this->spec.size) {
- ARTS_CloseDevice(this);
- return SDL_SetError("Fragment size must be a power of two");
- }
- frag_spec |= 0x00020000; /* two fragments, for low latency */
-
-#ifdef ARTS_P_PACKET_SETTINGS
- SDL_NAME(arts_stream_set) (this->hidden->stream,
- ARTS_P_PACKET_SETTINGS, frag_spec);
-#else
- SDL_NAME(arts_stream_set) (this->hidden->stream, ARTS_P_PACKET_SIZE,
- frag_spec & 0xffff);
- SDL_NAME(arts_stream_set) (this->hidden->stream, ARTS_P_PACKET_COUNT,
- frag_spec >> 16);
-#endif
- this->spec.size = SDL_NAME(arts_stream_get) (this->hidden->stream,
- ARTS_P_PACKET_SIZE);
-
- /* Allocate mixing buffer */
- this->hidden->mixlen = this->spec.size;
- this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
- if (this->hidden->mixbuf == NULL) {
- ARTS_CloseDevice(this);
- return SDL_OutOfMemory();
- }
- SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size);
-
- /* Get the parent process id (we're the parent of the audio thread) */
- this->hidden->parent = getpid();
-
- /* We're ready to rock and roll. :-) */
- return 0;
-}
-
-
-static void
-ARTS_Deinitialize(void)
-{
- UnloadARTSLibrary();
-}
-
-
-static int
-ARTS_Init(SDL_AudioDriverImpl * impl)
-{
- if (LoadARTSLibrary() < 0) {
- return 0;
- } else {
- if (SDL_NAME(arts_init) () != 0) {
- UnloadARTSLibrary();
- SDL_SetError("ARTS: arts_init failed (no audio server?)");
- return 0;
- }
-
- /* Play a stream so aRts doesn't crash */
- if (ARTS_Suspend()) {
- arts_stream_t stream;
- stream = SDL_NAME(arts_play_stream) (44100, 16, 2, "SDL");
- SDL_NAME(arts_write) (stream, "", 0);
- SDL_NAME(arts_close_stream) (stream);
- }
-
- SDL_NAME(arts_free) ();
- }
-
- /* Set the function pointers */
- impl->OpenDevice = ARTS_OpenDevice;
- impl->PlayDevice = ARTS_PlayDevice;
- impl->WaitDevice = ARTS_WaitDevice;
- impl->GetDeviceBuf = ARTS_GetDeviceBuf;
- impl->CloseDevice = ARTS_CloseDevice;
- impl->WaitDone = ARTS_WaitDone;
- impl->Deinitialize = ARTS_Deinitialize;
- impl->OnlyHasDefaultOutputDevice = 1;
-
- return 1; /* this audio target is available. */
-}
-
-
-AudioBootStrap ARTS_bootstrap = {
- "arts", "Analog RealTime Synthesizer", ARTS_Init, 0
-};
-
-#endif /* SDL_AUDIO_DRIVER_ARTS */
-
-/* vi: set ts=4 sw=4 expandtab: */
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/d1484ae0/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/arts/SDL_artsaudio.h
----------------------------------------------------------------------
diff --git a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/arts/SDL_artsaudio.h b/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/arts/SDL_artsaudio.h
deleted file mode 100644
index fb7706f..0000000
--- a/DocFormats/platform/3rdparty/SDL2-2.0.3/src/audio/arts/SDL_artsaudio.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2014 Sam Lantinga <sl...@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../../SDL_internal.h"
-
-#ifndef _SDL_artscaudio_h
-#define _SDL_artscaudio_h
-
-#include <artsc.h>
-
-#include "../SDL_sysaudio.h"
-
-/* Hidden "this" pointer for the audio functions */
-#define _THIS SDL_AudioDevice *this
-
-struct SDL_PrivateAudioData
-{
- /* The stream descriptor for the audio device */
- arts_stream_t stream;
-
- /* The parent process id, to detect when application quits */
- pid_t parent;
-
- /* Raw mixing buffer */
- 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 */
-
-#endif /* _SDL_artscaudio_h */
-/* vi: set ts=4 sw=4 expandtab: */