Mercurial > sdl-ios-xcode
view src/audio/SDL_audiotypecvt.c @ 2842:97ba0be8b565
Date: Sat, 06 Dec 2008 15:27:00 +0100
From: Couriersud
Subject: SDL: Relative mouse movements
The patch below will reenable processing of relative mouse movements.
The DirectFB drivers generates those in "grabbed" mode. These ensure,
that even in fullscreen mode relative movements are reported. SDLMAME
depends on this for games with trackballs.
Looking at the code I ask myself whether relative movements should be
handled in the drivers (x11, directfb). Both x11 and directfb are able
to report relative movements. This would leave it to the driver to use
the most appropriate method for relative movements when at the border of
a fullscreen window or being "grabbed".
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 06 Dec 2008 17:50:50 +0000 |
parents | b2b7154ce016 |
children | 99210400e8b9 |
line wrap: on
line source
/* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */ /* 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" #include "SDL_audio.h" #include "SDL_audio_c.h" /* *INDENT-OFF* */ #define DIVBY127 0.0078740157480315f #define DIVBY32767 3.05185094759972e-05f #define DIVBY2147483647 4.6566128752458e-10f static void SDLCALL SDL_Convert_U8_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; Sint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S8.\n"); #endif src = (const Uint8 *) cvt->buf; dst = (Sint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) { const Sint8 val = ((*src) ^ 0x80); *dst = ((Sint8) val); } format = AUDIO_S8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16LSB.\n"); #endif src = (const Uint8 *) (cvt->buf + cvt->len_cvt); dst = (Uint16 *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { const Uint16 val = (((Uint16) *src) << 8); *dst = SDL_SwapLE16(val); } cvt->len_cvt *= 2; format = AUDIO_U16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16LSB.\n"); #endif src = (const Uint8 *) (cvt->buf + cvt->len_cvt); dst = (Sint16 *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8); *dst = ((Sint16) SDL_SwapLE16(val)); } cvt->len_cvt *= 2; format = AUDIO_S16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16MSB.\n"); #endif src = (const Uint8 *) (cvt->buf + cvt->len_cvt); dst = (Uint16 *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { const Uint16 val = (((Uint16) *src) << 8); *dst = SDL_SwapBE16(val); } cvt->len_cvt *= 2; format = AUDIO_U16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16MSB.\n"); #endif src = (const Uint8 *) (cvt->buf + cvt->len_cvt); dst = (Sint16 *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8); *dst = ((Sint16) SDL_SwapBE16(val)); } cvt->len_cvt *= 2; format = AUDIO_S16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32LSB.\n"); #endif src = (const Uint8 *) (cvt->buf + cvt->len_cvt); dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 4); for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24); *dst = ((Sint32) SDL_SwapLE32(val)); } cvt->len_cvt *= 4; format = AUDIO_S32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32MSB.\n"); #endif src = (const Uint8 *) (cvt->buf + cvt->len_cvt); dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 4); for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24); *dst = ((Sint32) SDL_SwapBE32(val)); } cvt->len_cvt *= 4; format = AUDIO_S32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32LSB.\n"); #endif src = (const Uint8 *) (cvt->buf + cvt->len_cvt); dst = (float *) (cvt->buf + cvt->len_cvt * 4); for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { const float val = ((((float) *src) * DIVBY127) - 1.0f); *dst = SDL_SwapFloatLE(val); } cvt->len_cvt *= 4; format = AUDIO_F32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32MSB.\n"); #endif src = (const Uint8 *) (cvt->buf + cvt->len_cvt); dst = (float *) (cvt->buf + cvt->len_cvt * 4); for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { const float val = ((((float) *src) * DIVBY127) - 1.0f); *dst = SDL_SwapFloatBE(val); } cvt->len_cvt *= 4; format = AUDIO_F32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S8_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; Uint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U8.\n"); #endif src = (const Uint8 *) cvt->buf; dst = (Uint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) { const Uint8 val = ((((Sint8) *src)) ^ 0x80); *dst = val; } format = AUDIO_U8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16LSB.\n"); #endif src = (const Uint8 *) (cvt->buf + cvt->len_cvt); dst = (Uint16 *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8); *dst = SDL_SwapLE16(val); } cvt->len_cvt *= 2; format = AUDIO_U16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16LSB.\n"); #endif src = (const Uint8 *) (cvt->buf + cvt->len_cvt); dst = (Sint16 *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { const Sint16 val = (((Sint16) ((Sint8) *src)) << 8); *dst = ((Sint16) SDL_SwapLE16(val)); } cvt->len_cvt *= 2; format = AUDIO_S16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16MSB.\n"); #endif src = (const Uint8 *) (cvt->buf + cvt->len_cvt); dst = (Uint16 *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8); *dst = SDL_SwapBE16(val); } cvt->len_cvt *= 2; format = AUDIO_U16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16MSB.\n"); #endif src = (const Uint8 *) (cvt->buf + cvt->len_cvt); dst = (Sint16 *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { const Sint16 val = (((Sint16) ((Sint8) *src)) << 8); *dst = ((Sint16) SDL_SwapBE16(val)); } cvt->len_cvt *= 2; format = AUDIO_S16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32LSB.\n"); #endif src = (const Uint8 *) (cvt->buf + cvt->len_cvt); dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 4); for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { const Sint32 val = (((Sint32) ((Sint8) *src)) << 24); *dst = ((Sint32) SDL_SwapLE32(val)); } cvt->len_cvt *= 4; format = AUDIO_S32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32MSB.\n"); #endif src = (const Uint8 *) (cvt->buf + cvt->len_cvt); dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 4); for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { const Sint32 val = (((Sint32) ((Sint8) *src)) << 24); *dst = ((Sint32) SDL_SwapBE32(val)); } cvt->len_cvt *= 4; format = AUDIO_S32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32LSB.\n"); #endif src = (const Uint8 *) (cvt->buf + cvt->len_cvt); dst = (float *) (cvt->buf + cvt->len_cvt * 4); for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { const float val = (((float) ((Sint8) *src)) * DIVBY127); *dst = SDL_SwapFloatLE(val); } cvt->len_cvt *= 4; format = AUDIO_F32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint8 *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32MSB.\n"); #endif src = (const Uint8 *) (cvt->buf + cvt->len_cvt); dst = (float *) (cvt->buf + cvt->len_cvt * 4); for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { const float val = (((float) ((Sint8) *src)) * DIVBY127); *dst = SDL_SwapFloatBE(val); } cvt->len_cvt *= 4; format = AUDIO_F32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Uint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U8.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Uint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Uint8 val = ((Uint8) (SDL_SwapLE16(*src) >> 8)); *dst = val; } cvt->len_cvt /= 2; format = AUDIO_U8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S8.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Sint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Sint8 val = ((Sint8) (((SDL_SwapLE16(*src)) ^ 0x8000) >> 8)); *dst = ((Sint8) val); } cvt->len_cvt /= 2; format = AUDIO_S8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16LSB.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Sint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000); *dst = ((Sint16) SDL_SwapLE16(val)); } format = AUDIO_S16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U16MSB.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Uint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Uint16 val = SDL_SwapLE16(*src); *dst = SDL_SwapBE16(val); } format = AUDIO_U16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16MSB.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Sint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000); *dst = ((Sint16) SDL_SwapBE16(val)); } format = AUDIO_S16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32LSB.\n"); #endif src = (const Uint16 *) (cvt->buf + cvt->len_cvt); dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16); *dst = ((Sint32) SDL_SwapLE32(val)); } cvt->len_cvt *= 2; format = AUDIO_S32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32MSB.\n"); #endif src = (const Uint16 *) (cvt->buf + cvt->len_cvt); dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16); *dst = ((Sint32) SDL_SwapBE32(val)); } cvt->len_cvt *= 2; format = AUDIO_S32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32LSB.\n"); #endif src = (const Uint16 *) (cvt->buf + cvt->len_cvt); dst = (float *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f); *dst = SDL_SwapFloatLE(val); } cvt->len_cvt *= 2; format = AUDIO_F32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32MSB.\n"); #endif src = (const Uint16 *) (cvt->buf + cvt->len_cvt); dst = (float *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f); *dst = SDL_SwapFloatBE(val); } cvt->len_cvt *= 2; format = AUDIO_F32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Uint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U8.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Uint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000) >> 8)); *dst = val; } cvt->len_cvt /= 2; format = AUDIO_U8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S8.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Sint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Sint8 val = ((Sint8) (((Sint16) SDL_SwapLE16(*src)) >> 8)); *dst = ((Sint8) val); } cvt->len_cvt /= 2; format = AUDIO_S8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16LSB.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Uint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000); *dst = SDL_SwapLE16(val); } format = AUDIO_U16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16MSB.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Uint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000); *dst = SDL_SwapBE16(val); } format = AUDIO_U16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S16MSB.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Sint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Sint16 val = ((Sint16) SDL_SwapLE16(*src)); *dst = ((Sint16) SDL_SwapBE16(val)); } format = AUDIO_S16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32LSB.\n"); #endif src = (const Uint16 *) (cvt->buf + cvt->len_cvt); dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16); *dst = ((Sint32) SDL_SwapLE32(val)); } cvt->len_cvt *= 2; format = AUDIO_S32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32MSB.\n"); #endif src = (const Uint16 *) (cvt->buf + cvt->len_cvt); dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16); *dst = ((Sint32) SDL_SwapBE32(val)); } cvt->len_cvt *= 2; format = AUDIO_S32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32LSB.\n"); #endif src = (const Uint16 *) (cvt->buf + cvt->len_cvt); dst = (float *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767); *dst = SDL_SwapFloatLE(val); } cvt->len_cvt *= 2; format = AUDIO_F32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32MSB.\n"); #endif src = (const Uint16 *) (cvt->buf + cvt->len_cvt); dst = (float *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767); *dst = SDL_SwapFloatBE(val); } cvt->len_cvt *= 2; format = AUDIO_F32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Uint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U8.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Uint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Uint8 val = ((Uint8) (SDL_SwapBE16(*src) >> 8)); *dst = val; } cvt->len_cvt /= 2; format = AUDIO_U8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S8.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Sint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Sint8 val = ((Sint8) (((SDL_SwapBE16(*src)) ^ 0x8000) >> 8)); *dst = ((Sint8) val); } cvt->len_cvt /= 2; format = AUDIO_S8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U16LSB.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Uint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Uint16 val = SDL_SwapBE16(*src); *dst = SDL_SwapLE16(val); } format = AUDIO_U16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16LSB.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Sint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000); *dst = ((Sint16) SDL_SwapLE16(val)); } format = AUDIO_S16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16MSB.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Sint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000); *dst = ((Sint16) SDL_SwapBE16(val)); } format = AUDIO_S16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32LSB.\n"); #endif src = (const Uint16 *) (cvt->buf + cvt->len_cvt); dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16); *dst = ((Sint32) SDL_SwapLE32(val)); } cvt->len_cvt *= 2; format = AUDIO_S32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32MSB.\n"); #endif src = (const Uint16 *) (cvt->buf + cvt->len_cvt); dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16); *dst = ((Sint32) SDL_SwapBE32(val)); } cvt->len_cvt *= 2; format = AUDIO_S32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32LSB.\n"); #endif src = (const Uint16 *) (cvt->buf + cvt->len_cvt); dst = (float *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f); *dst = SDL_SwapFloatLE(val); } cvt->len_cvt *= 2; format = AUDIO_F32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_U16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32MSB.\n"); #endif src = (const Uint16 *) (cvt->buf + cvt->len_cvt); dst = (float *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f); *dst = SDL_SwapFloatBE(val); } cvt->len_cvt *= 2; format = AUDIO_F32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Uint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U8.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Uint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000) >> 8)); *dst = val; } cvt->len_cvt /= 2; format = AUDIO_U8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S8.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Sint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Sint8 val = ((Sint8) (((Sint16) SDL_SwapBE16(*src)) >> 8)); *dst = ((Sint8) val); } cvt->len_cvt /= 2; format = AUDIO_S8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16LSB.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Uint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000); *dst = SDL_SwapLE16(val); } format = AUDIO_U16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S16LSB.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Sint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Sint16 val = ((Sint16) SDL_SwapBE16(*src)); *dst = ((Sint16) SDL_SwapLE16(val)); } format = AUDIO_S16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16MSB.\n"); #endif src = (const Uint16 *) cvt->buf; dst = (Uint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000); *dst = SDL_SwapBE16(val); } format = AUDIO_U16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32LSB.\n"); #endif src = (const Uint16 *) (cvt->buf + cvt->len_cvt); dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16); *dst = ((Sint32) SDL_SwapLE32(val)); } cvt->len_cvt *= 2; format = AUDIO_S32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32MSB.\n"); #endif src = (const Uint16 *) (cvt->buf + cvt->len_cvt); dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16); *dst = ((Sint32) SDL_SwapBE32(val)); } cvt->len_cvt *= 2; format = AUDIO_S32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32LSB.\n"); #endif src = (const Uint16 *) (cvt->buf + cvt->len_cvt); dst = (float *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767); *dst = SDL_SwapFloatLE(val); } cvt->len_cvt *= 2; format = AUDIO_F32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint16 *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32MSB.\n"); #endif src = (const Uint16 *) (cvt->buf + cvt->len_cvt); dst = (float *) (cvt->buf + cvt->len_cvt * 2); for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767); *dst = SDL_SwapFloatBE(val); } cvt->len_cvt *= 2; format = AUDIO_F32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; Uint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U8.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (Uint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 24)); *dst = val; } cvt->len_cvt /= 4; format = AUDIO_U8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; Sint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S8.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (Sint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const Sint8 val = ((Sint8) (((Sint32) SDL_SwapLE32(*src)) >> 24)); *dst = ((Sint8) val); } cvt->len_cvt /= 4; format = AUDIO_S8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16LSB.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (Uint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16)); *dst = SDL_SwapLE16(val); } cvt->len_cvt /= 2; format = AUDIO_U16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16LSB.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (Sint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16)); *dst = ((Sint16) SDL_SwapLE16(val)); } cvt->len_cvt /= 2; format = AUDIO_S16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16MSB.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (Uint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16)); *dst = SDL_SwapBE16(val); } cvt->len_cvt /= 2; format = AUDIO_U16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16MSB.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (Sint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16)); *dst = ((Sint16) SDL_SwapBE16(val)); } cvt->len_cvt /= 2; format = AUDIO_S16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S32MSB.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (Sint32 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const Sint32 val = ((Sint32) SDL_SwapLE32(*src)); *dst = ((Sint32) SDL_SwapBE32(val)); } format = AUDIO_S32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32LSB.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (float *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647); *dst = SDL_SwapFloatLE(val); } format = AUDIO_F32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32MSB.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (float *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647); *dst = SDL_SwapFloatBE(val); } format = AUDIO_F32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; Uint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U8.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (Uint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 24)); *dst = val; } cvt->len_cvt /= 4; format = AUDIO_U8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; Sint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S8.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (Sint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const Sint8 val = ((Sint8) (((Sint32) SDL_SwapBE32(*src)) >> 24)); *dst = ((Sint8) val); } cvt->len_cvt /= 4; format = AUDIO_S8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16LSB.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (Uint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16)); *dst = SDL_SwapLE16(val); } cvt->len_cvt /= 2; format = AUDIO_U16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16LSB.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (Sint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16)); *dst = ((Sint16) SDL_SwapLE16(val)); } cvt->len_cvt /= 2; format = AUDIO_S16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16MSB.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (Uint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16)); *dst = SDL_SwapBE16(val); } cvt->len_cvt /= 2; format = AUDIO_U16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16MSB.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (Sint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16)); *dst = ((Sint16) SDL_SwapBE16(val)); } cvt->len_cvt /= 2; format = AUDIO_S16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S32LSB.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (Sint32 *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const Sint32 val = ((Sint32) SDL_SwapBE32(*src)); *dst = ((Sint32) SDL_SwapLE32(val)); } format = AUDIO_S32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32LSB.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (float *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647); *dst = SDL_SwapFloatLE(val); } format = AUDIO_F32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_S32MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const Uint32 *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32MSB.\n"); #endif src = (const Uint32 *) cvt->buf; dst = (float *) cvt->buf; for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647); *dst = SDL_SwapFloatBE(val); } format = AUDIO_F32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; Uint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U8.\n"); #endif src = (const float *) cvt->buf; dst = (Uint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const Uint8 val = ((Uint8) ((SDL_SwapFloatLE(*src) + 1.0f) * 127.0f)); *dst = val; } cvt->len_cvt /= 4; format = AUDIO_U8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; Sint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S8.\n"); #endif src = (const float *) cvt->buf; dst = (Sint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const Sint8 val = ((Sint8) (SDL_SwapFloatLE(*src) * 127.0f)); *dst = ((Sint8) val); } cvt->len_cvt /= 4; format = AUDIO_S8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16LSB.\n"); #endif src = (const float *) cvt->buf; dst = (Uint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f)); *dst = SDL_SwapLE16(val); } cvt->len_cvt /= 2; format = AUDIO_U16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16LSB.\n"); #endif src = (const float *) cvt->buf; dst = (Sint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f)); *dst = ((Sint16) SDL_SwapLE16(val)); } cvt->len_cvt /= 2; format = AUDIO_S16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16MSB.\n"); #endif src = (const float *) cvt->buf; dst = (Uint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f)); *dst = SDL_SwapBE16(val); } cvt->len_cvt /= 2; format = AUDIO_U16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16MSB.\n"); #endif src = (const float *) cvt->buf; dst = (Sint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f)); *dst = ((Sint16) SDL_SwapBE16(val)); } cvt->len_cvt /= 2; format = AUDIO_S16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32LSB.\n"); #endif src = (const float *) cvt->buf; dst = (Sint32 *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0)); *dst = ((Sint32) SDL_SwapLE32(val)); } format = AUDIO_S32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32MSB.\n"); #endif src = (const float *) cvt->buf; dst = (Sint32 *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0)); *dst = ((Sint32) SDL_SwapBE32(val)); } format = AUDIO_S32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_F32MSB.\n"); #endif src = (const float *) cvt->buf; dst = (float *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const float val = SDL_SwapFloatLE(*src); *dst = SDL_SwapFloatBE(val); } format = AUDIO_F32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; Uint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U8.\n"); #endif src = (const float *) cvt->buf; dst = (Uint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const Uint8 val = ((Uint8) ((SDL_SwapFloatBE(*src) + 1.0f) * 127.0f)); *dst = val; } cvt->len_cvt /= 4; format = AUDIO_U8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; Sint8 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S8.\n"); #endif src = (const float *) cvt->buf; dst = (Sint8 *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const Sint8 val = ((Sint8) (SDL_SwapFloatBE(*src) * 127.0f)); *dst = ((Sint8) val); } cvt->len_cvt /= 4; format = AUDIO_S8; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16LSB.\n"); #endif src = (const float *) cvt->buf; dst = (Uint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f)); *dst = SDL_SwapLE16(val); } cvt->len_cvt /= 2; format = AUDIO_U16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16LSB.\n"); #endif src = (const float *) cvt->buf; dst = (Sint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f)); *dst = ((Sint16) SDL_SwapLE16(val)); } cvt->len_cvt /= 2; format = AUDIO_S16LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; Uint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16MSB.\n"); #endif src = (const float *) cvt->buf; dst = (Uint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f)); *dst = SDL_SwapBE16(val); } cvt->len_cvt /= 2; format = AUDIO_U16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; Sint16 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16MSB.\n"); #endif src = (const float *) cvt->buf; dst = (Sint16 *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f)); *dst = ((Sint16) SDL_SwapBE16(val)); } cvt->len_cvt /= 2; format = AUDIO_S16MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32LSB.\n"); #endif src = (const float *) cvt->buf; dst = (Sint32 *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0)); *dst = ((Sint32) SDL_SwapLE32(val)); } format = AUDIO_S32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; Sint32 *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32MSB.\n"); #endif src = (const float *) cvt->buf; dst = (Sint32 *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0)); *dst = ((Sint32) SDL_SwapBE32(val)); } format = AUDIO_S32MSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } static void SDLCALL SDL_Convert_F32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; const float *src; float *dst; #ifdef DEBUG_CONVERT fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_F32LSB.\n"); #endif src = (const float *) cvt->buf; dst = (float *) cvt->buf; for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { const float val = SDL_SwapFloatBE(*src); *dst = SDL_SwapFloatLE(val); } format = AUDIO_F32LSB; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); } } const SDL_AudioTypeFilters sdl_audio_type_filters[] = { { AUDIO_U8, AUDIO_S8, SDL_Convert_U8_to_S8 }, { AUDIO_U8, AUDIO_U16LSB, SDL_Convert_U8_to_U16LSB }, { AUDIO_U8, AUDIO_S16LSB, SDL_Convert_U8_to_S16LSB }, { AUDIO_U8, AUDIO_U16MSB, SDL_Convert_U8_to_U16MSB }, { AUDIO_U8, AUDIO_S16MSB, SDL_Convert_U8_to_S16MSB }, { AUDIO_U8, AUDIO_S32LSB, SDL_Convert_U8_to_S32LSB }, { AUDIO_U8, AUDIO_S32MSB, SDL_Convert_U8_to_S32MSB }, { AUDIO_U8, AUDIO_F32LSB, SDL_Convert_U8_to_F32LSB }, { AUDIO_U8, AUDIO_F32MSB, SDL_Convert_U8_to_F32MSB }, { AUDIO_S8, AUDIO_U8, SDL_Convert_S8_to_U8 }, { AUDIO_S8, AUDIO_U16LSB, SDL_Convert_S8_to_U16LSB }, { AUDIO_S8, AUDIO_S16LSB, SDL_Convert_S8_to_S16LSB }, { AUDIO_S8, AUDIO_U16MSB, SDL_Convert_S8_to_U16MSB }, { AUDIO_S8, AUDIO_S16MSB, SDL_Convert_S8_to_S16MSB }, { AUDIO_S8, AUDIO_S32LSB, SDL_Convert_S8_to_S32LSB }, { AUDIO_S8, AUDIO_S32MSB, SDL_Convert_S8_to_S32MSB }, { AUDIO_S8, AUDIO_F32LSB, SDL_Convert_S8_to_F32LSB }, { AUDIO_S8, AUDIO_F32MSB, SDL_Convert_S8_to_F32MSB }, { AUDIO_U16LSB, AUDIO_U8, SDL_Convert_U16LSB_to_U8 }, { AUDIO_U16LSB, AUDIO_S8, SDL_Convert_U16LSB_to_S8 }, { AUDIO_U16LSB, AUDIO_S16LSB, SDL_Convert_U16LSB_to_S16LSB }, { AUDIO_U16LSB, AUDIO_U16MSB, SDL_Convert_U16LSB_to_U16MSB }, { AUDIO_U16LSB, AUDIO_S16MSB, SDL_Convert_U16LSB_to_S16MSB }, { AUDIO_U16LSB, AUDIO_S32LSB, SDL_Convert_U16LSB_to_S32LSB }, { AUDIO_U16LSB, AUDIO_S32MSB, SDL_Convert_U16LSB_to_S32MSB }, { AUDIO_U16LSB, AUDIO_F32LSB, SDL_Convert_U16LSB_to_F32LSB }, { AUDIO_U16LSB, AUDIO_F32MSB, SDL_Convert_U16LSB_to_F32MSB }, { AUDIO_S16LSB, AUDIO_U8, SDL_Convert_S16LSB_to_U8 }, { AUDIO_S16LSB, AUDIO_S8, SDL_Convert_S16LSB_to_S8 }, { AUDIO_S16LSB, AUDIO_U16LSB, SDL_Convert_S16LSB_to_U16LSB }, { AUDIO_S16LSB, AUDIO_U16MSB, SDL_Convert_S16LSB_to_U16MSB }, { AUDIO_S16LSB, AUDIO_S16MSB, SDL_Convert_S16LSB_to_S16MSB }, { AUDIO_S16LSB, AUDIO_S32LSB, SDL_Convert_S16LSB_to_S32LSB }, { AUDIO_S16LSB, AUDIO_S32MSB, SDL_Convert_S16LSB_to_S32MSB }, { AUDIO_S16LSB, AUDIO_F32LSB, SDL_Convert_S16LSB_to_F32LSB }, { AUDIO_S16LSB, AUDIO_F32MSB, SDL_Convert_S16LSB_to_F32MSB }, { AUDIO_U16MSB, AUDIO_U8, SDL_Convert_U16MSB_to_U8 }, { AUDIO_U16MSB, AUDIO_S8, SDL_Convert_U16MSB_to_S8 }, { AUDIO_U16MSB, AUDIO_U16LSB, SDL_Convert_U16MSB_to_U16LSB }, { AUDIO_U16MSB, AUDIO_S16LSB, SDL_Convert_U16MSB_to_S16LSB }, { AUDIO_U16MSB, AUDIO_S16MSB, SDL_Convert_U16MSB_to_S16MSB }, { AUDIO_U16MSB, AUDIO_S32LSB, SDL_Convert_U16MSB_to_S32LSB }, { AUDIO_U16MSB, AUDIO_S32MSB, SDL_Convert_U16MSB_to_S32MSB }, { AUDIO_U16MSB, AUDIO_F32LSB, SDL_Convert_U16MSB_to_F32LSB }, { AUDIO_U16MSB, AUDIO_F32MSB, SDL_Convert_U16MSB_to_F32MSB }, { AUDIO_S16MSB, AUDIO_U8, SDL_Convert_S16MSB_to_U8 }, { AUDIO_S16MSB, AUDIO_S8, SDL_Convert_S16MSB_to_S8 }, { AUDIO_S16MSB, AUDIO_U16LSB, SDL_Convert_S16MSB_to_U16LSB }, { AUDIO_S16MSB, AUDIO_S16LSB, SDL_Convert_S16MSB_to_S16LSB }, { AUDIO_S16MSB, AUDIO_U16MSB, SDL_Convert_S16MSB_to_U16MSB }, { AUDIO_S16MSB, AUDIO_S32LSB, SDL_Convert_S16MSB_to_S32LSB }, { AUDIO_S16MSB, AUDIO_S32MSB, SDL_Convert_S16MSB_to_S32MSB }, { AUDIO_S16MSB, AUDIO_F32LSB, SDL_Convert_S16MSB_to_F32LSB }, { AUDIO_S16MSB, AUDIO_F32MSB, SDL_Convert_S16MSB_to_F32MSB }, { AUDIO_S32LSB, AUDIO_U8, SDL_Convert_S32LSB_to_U8 }, { AUDIO_S32LSB, AUDIO_S8, SDL_Convert_S32LSB_to_S8 }, { AUDIO_S32LSB, AUDIO_U16LSB, SDL_Convert_S32LSB_to_U16LSB }, { AUDIO_S32LSB, AUDIO_S16LSB, SDL_Convert_S32LSB_to_S16LSB }, { AUDIO_S32LSB, AUDIO_U16MSB, SDL_Convert_S32LSB_to_U16MSB }, { AUDIO_S32LSB, AUDIO_S16MSB, SDL_Convert_S32LSB_to_S16MSB }, { AUDIO_S32LSB, AUDIO_S32MSB, SDL_Convert_S32LSB_to_S32MSB }, { AUDIO_S32LSB, AUDIO_F32LSB, SDL_Convert_S32LSB_to_F32LSB }, { AUDIO_S32LSB, AUDIO_F32MSB, SDL_Convert_S32LSB_to_F32MSB }, { AUDIO_S32MSB, AUDIO_U8, SDL_Convert_S32MSB_to_U8 }, { AUDIO_S32MSB, AUDIO_S8, SDL_Convert_S32MSB_to_S8 }, { AUDIO_S32MSB, AUDIO_U16LSB, SDL_Convert_S32MSB_to_U16LSB }, { AUDIO_S32MSB, AUDIO_S16LSB, SDL_Convert_S32MSB_to_S16LSB }, { AUDIO_S32MSB, AUDIO_U16MSB, SDL_Convert_S32MSB_to_U16MSB }, { AUDIO_S32MSB, AUDIO_S16MSB, SDL_Convert_S32MSB_to_S16MSB }, { AUDIO_S32MSB, AUDIO_S32LSB, SDL_Convert_S32MSB_to_S32LSB }, { AUDIO_S32MSB, AUDIO_F32LSB, SDL_Convert_S32MSB_to_F32LSB }, { AUDIO_S32MSB, AUDIO_F32MSB, SDL_Convert_S32MSB_to_F32MSB }, { AUDIO_F32LSB, AUDIO_U8, SDL_Convert_F32LSB_to_U8 }, { AUDIO_F32LSB, AUDIO_S8, SDL_Convert_F32LSB_to_S8 }, { AUDIO_F32LSB, AUDIO_U16LSB, SDL_Convert_F32LSB_to_U16LSB }, { AUDIO_F32LSB, AUDIO_S16LSB, SDL_Convert_F32LSB_to_S16LSB }, { AUDIO_F32LSB, AUDIO_U16MSB, SDL_Convert_F32LSB_to_U16MSB }, { AUDIO_F32LSB, AUDIO_S16MSB, SDL_Convert_F32LSB_to_S16MSB }, { AUDIO_F32LSB, AUDIO_S32LSB, SDL_Convert_F32LSB_to_S32LSB }, { AUDIO_F32LSB, AUDIO_S32MSB, SDL_Convert_F32LSB_to_S32MSB }, { AUDIO_F32LSB, AUDIO_F32MSB, SDL_Convert_F32LSB_to_F32MSB }, { AUDIO_F32MSB, AUDIO_U8, SDL_Convert_F32MSB_to_U8 }, { AUDIO_F32MSB, AUDIO_S8, SDL_Convert_F32MSB_to_S8 }, { AUDIO_F32MSB, AUDIO_U16LSB, SDL_Convert_F32MSB_to_U16LSB }, { AUDIO_F32MSB, AUDIO_S16LSB, SDL_Convert_F32MSB_to_S16LSB }, { AUDIO_F32MSB, AUDIO_U16MSB, SDL_Convert_F32MSB_to_U16MSB }, { AUDIO_F32MSB, AUDIO_S16MSB, SDL_Convert_F32MSB_to_S16MSB }, { AUDIO_F32MSB, AUDIO_S32LSB, SDL_Convert_F32MSB_to_S32LSB }, { AUDIO_F32MSB, AUDIO_S32MSB, SDL_Convert_F32MSB_to_S32MSB }, { AUDIO_F32MSB, AUDIO_F32LSB, SDL_Convert_F32MSB_to_F32LSB }, }; /* *INDENT-ON* */ /* vi: set ts=4 sw=4 expandtab: */