src/audio/SDL_audiotypecvt.c
author Ryan C. Gordon
Fri, 02 Jan 2009 07:34:01 +0000
changeset 2955 2692999d5271
parent 2859 99210400e8b9
child 2956 1210d5a28e16
permissions -rw-r--r--
Avoid unnecessary assignment in generated audio type converters.
slouken@1985
     1
/* DO NOT EDIT!  This file is generated by sdlgenaudiocvt.pl */
icculus@1982
     2
/*
icculus@1982
     3
    SDL - Simple DirectMedia Layer
slouken@2859
     4
    Copyright (C) 1997-2009 Sam Lantinga
icculus@1982
     5
icculus@1982
     6
    This library is free software; you can redistribute it and/or
icculus@1982
     7
    modify it under the terms of the GNU Lesser General Public
icculus@1982
     8
    License as published by the Free Software Foundation; either
icculus@1982
     9
    version 2.1 of the License, or (at your option) any later version.
icculus@1982
    10
icculus@1982
    11
    This library is distributed in the hope that it will be useful,
icculus@1982
    12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
icculus@1982
    13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
icculus@1982
    14
    Lesser General Public License for more details.
icculus@1982
    15
icculus@1982
    16
    You should have received a copy of the GNU Lesser General Public
icculus@1982
    17
    License along with this library; if not, write to the Free Software
icculus@1982
    18
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
icculus@1982
    19
icculus@1982
    20
    Sam Lantinga
icculus@1982
    21
    slouken@libsdl.org
icculus@1982
    22
*/
icculus@1982
    23
icculus@1982
    24
#include "SDL_config.h"
icculus@1982
    25
#include "SDL_audio.h"
icculus@1982
    26
#include "SDL_audio_c.h"
icculus@1982
    27
slouken@1985
    28
/* *INDENT-OFF* */
icculus@1982
    29
icculus@1982
    30
#define DIVBY127 0.0078740157480315f
icculus@1982
    31
#define DIVBY32767 3.05185094759972e-05f
icculus@1982
    32
#define DIVBY2147483647 4.6566128752458e-10f
icculus@1982
    33
icculus@1982
    34
static void SDLCALL
icculus@1982
    35
SDL_Convert_U8_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
    36
{
icculus@1982
    37
    int i;
icculus@1982
    38
    const Uint8 *src;
icculus@1982
    39
    Sint8 *dst;
icculus@1982
    40
icculus@1982
    41
#ifdef DEBUG_CONVERT
icculus@1982
    42
    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S8.\n");
icculus@1982
    43
#endif
icculus@1982
    44
icculus@1982
    45
    src = (const Uint8 *) cvt->buf;
icculus@1982
    46
    dst = (Sint8 *) cvt->buf;
icculus@1982
    47
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) {
icculus@1982
    48
        const Sint8 val = ((*src) ^ 0x80);
icculus@1982
    49
        *dst = ((Sint8) val);
icculus@1982
    50
    }
icculus@1982
    51
icculus@1982
    52
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
    53
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
icculus@1982
    54
    }
icculus@1982
    55
}
icculus@1982
    56
icculus@1982
    57
static void SDLCALL
icculus@1982
    58
SDL_Convert_U8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
    59
{
icculus@1982
    60
    int i;
icculus@1982
    61
    const Uint8 *src;
icculus@1982
    62
    Uint16 *dst;
icculus@1982
    63
icculus@1982
    64
#ifdef DEBUG_CONVERT
icculus@1982
    65
    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16LSB.\n");
icculus@1982
    66
#endif
icculus@1982
    67
icculus@1982
    68
    src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
icculus@1982
    69
    dst = (Uint16 *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
    70
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
icculus@1982
    71
        const Uint16 val = (((Uint16) *src) << 8);
icculus@1982
    72
        *dst = SDL_SwapLE16(val);
icculus@1982
    73
    }
icculus@1982
    74
icculus@1982
    75
    cvt->len_cvt *= 2;
icculus@1982
    76
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
    77
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
icculus@1982
    78
    }
icculus@1982
    79
}
icculus@1982
    80
icculus@1982
    81
static void SDLCALL
icculus@1982
    82
SDL_Convert_U8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
    83
{
icculus@1982
    84
    int i;
icculus@1982
    85
    const Uint8 *src;
icculus@1982
    86
    Sint16 *dst;
icculus@1982
    87
icculus@1982
    88
#ifdef DEBUG_CONVERT
icculus@1982
    89
    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16LSB.\n");
icculus@1982
    90
#endif
icculus@1982
    91
icculus@1982
    92
    src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
icculus@1982
    93
    dst = (Sint16 *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
    94
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
icculus@1982
    95
        const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8);
icculus@1982
    96
        *dst = ((Sint16) SDL_SwapLE16(val));
icculus@1982
    97
    }
icculus@1982
    98
icculus@1982
    99
    cvt->len_cvt *= 2;
icculus@1982
   100
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   101
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
icculus@1982
   102
    }
icculus@1982
   103
}
icculus@1982
   104
icculus@1982
   105
static void SDLCALL
icculus@1982
   106
SDL_Convert_U8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   107
{
icculus@1982
   108
    int i;
icculus@1982
   109
    const Uint8 *src;
icculus@1982
   110
    Uint16 *dst;
icculus@1982
   111
icculus@1982
   112
#ifdef DEBUG_CONVERT
icculus@1982
   113
    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16MSB.\n");
icculus@1982
   114
#endif
icculus@1982
   115
icculus@1982
   116
    src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   117
    dst = (Uint16 *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
   118
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
icculus@1982
   119
        const Uint16 val = (((Uint16) *src) << 8);
icculus@1982
   120
        *dst = SDL_SwapBE16(val);
icculus@1982
   121
    }
icculus@1982
   122
icculus@1982
   123
    cvt->len_cvt *= 2;
icculus@1982
   124
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   125
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
icculus@1982
   126
    }
icculus@1982
   127
}
icculus@1982
   128
icculus@1982
   129
static void SDLCALL
icculus@1982
   130
SDL_Convert_U8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   131
{
icculus@1982
   132
    int i;
icculus@1982
   133
    const Uint8 *src;
icculus@1982
   134
    Sint16 *dst;
icculus@1982
   135
icculus@1982
   136
#ifdef DEBUG_CONVERT
icculus@1982
   137
    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16MSB.\n");
icculus@1982
   138
#endif
icculus@1982
   139
icculus@1982
   140
    src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   141
    dst = (Sint16 *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
   142
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
icculus@1982
   143
        const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8);
icculus@1982
   144
        *dst = ((Sint16) SDL_SwapBE16(val));
icculus@1982
   145
    }
icculus@1982
   146
icculus@1982
   147
    cvt->len_cvt *= 2;
icculus@1982
   148
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   149
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
icculus@1982
   150
    }
icculus@1982
   151
}
icculus@1982
   152
icculus@1982
   153
static void SDLCALL
icculus@1982
   154
SDL_Convert_U8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   155
{
icculus@1982
   156
    int i;
icculus@1982
   157
    const Uint8 *src;
icculus@1982
   158
    Sint32 *dst;
icculus@1982
   159
icculus@1982
   160
#ifdef DEBUG_CONVERT
icculus@1982
   161
    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32LSB.\n");
icculus@1982
   162
#endif
icculus@1982
   163
icculus@1982
   164
    src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   165
    dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 4);
icculus@1982
   166
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
icculus@1982
   167
        const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24);
icculus@1982
   168
        *dst = ((Sint32) SDL_SwapLE32(val));
icculus@1982
   169
    }
icculus@1982
   170
icculus@1982
   171
    cvt->len_cvt *= 4;
icculus@1982
   172
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   173
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
icculus@1982
   174
    }
icculus@1982
   175
}
icculus@1982
   176
icculus@1982
   177
static void SDLCALL
icculus@1982
   178
SDL_Convert_U8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   179
{
icculus@1982
   180
    int i;
icculus@1982
   181
    const Uint8 *src;
icculus@1982
   182
    Sint32 *dst;
icculus@1982
   183
icculus@1982
   184
#ifdef DEBUG_CONVERT
icculus@1982
   185
    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32MSB.\n");
icculus@1982
   186
#endif
icculus@1982
   187
icculus@1982
   188
    src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   189
    dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 4);
icculus@1982
   190
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
icculus@1982
   191
        const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24);
icculus@1982
   192
        *dst = ((Sint32) SDL_SwapBE32(val));
icculus@1982
   193
    }
icculus@1982
   194
icculus@1982
   195
    cvt->len_cvt *= 4;
icculus@1982
   196
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   197
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
icculus@1982
   198
    }
icculus@1982
   199
}
icculus@1982
   200
icculus@1982
   201
static void SDLCALL
icculus@1982
   202
SDL_Convert_U8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   203
{
icculus@1982
   204
    int i;
icculus@1982
   205
    const Uint8 *src;
icculus@1982
   206
    float *dst;
icculus@1982
   207
icculus@1982
   208
#ifdef DEBUG_CONVERT
icculus@1982
   209
    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32LSB.\n");
icculus@1982
   210
#endif
icculus@1982
   211
icculus@1982
   212
    src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   213
    dst = (float *) (cvt->buf + cvt->len_cvt * 4);
icculus@1982
   214
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
icculus@2011
   215
        const float val = ((((float) *src) * DIVBY127) - 1.0f);
icculus@1982
   216
        *dst = SDL_SwapFloatLE(val);
icculus@1982
   217
    }
icculus@1982
   218
icculus@1982
   219
    cvt->len_cvt *= 4;
icculus@1982
   220
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   221
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
icculus@1982
   222
    }
icculus@1982
   223
}
icculus@1982
   224
icculus@1982
   225
static void SDLCALL
icculus@1982
   226
SDL_Convert_U8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   227
{
icculus@1982
   228
    int i;
icculus@1982
   229
    const Uint8 *src;
icculus@1982
   230
    float *dst;
icculus@1982
   231
icculus@1982
   232
#ifdef DEBUG_CONVERT
icculus@1982
   233
    fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32MSB.\n");
icculus@1982
   234
#endif
icculus@1982
   235
icculus@1982
   236
    src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   237
    dst = (float *) (cvt->buf + cvt->len_cvt * 4);
icculus@1982
   238
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
icculus@2011
   239
        const float val = ((((float) *src) * DIVBY127) - 1.0f);
icculus@1982
   240
        *dst = SDL_SwapFloatBE(val);
icculus@1982
   241
    }
icculus@1982
   242
icculus@1982
   243
    cvt->len_cvt *= 4;
icculus@1982
   244
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   245
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
icculus@1982
   246
    }
icculus@1982
   247
}
icculus@1982
   248
icculus@1982
   249
static void SDLCALL
icculus@1982
   250
SDL_Convert_S8_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   251
{
icculus@1982
   252
    int i;
icculus@1982
   253
    const Uint8 *src;
icculus@1982
   254
    Uint8 *dst;
icculus@1982
   255
icculus@1982
   256
#ifdef DEBUG_CONVERT
icculus@1982
   257
    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U8.\n");
icculus@1982
   258
#endif
icculus@1982
   259
icculus@1982
   260
    src = (const Uint8 *) cvt->buf;
icculus@1982
   261
    dst = (Uint8 *) cvt->buf;
icculus@1982
   262
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) {
icculus@1982
   263
        const Uint8 val = ((((Sint8) *src)) ^ 0x80);
icculus@1982
   264
        *dst = val;
icculus@1982
   265
    }
icculus@1982
   266
icculus@1982
   267
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   268
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
icculus@1982
   269
    }
icculus@1982
   270
}
icculus@1982
   271
icculus@1982
   272
static void SDLCALL
icculus@1982
   273
SDL_Convert_S8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   274
{
icculus@1982
   275
    int i;
icculus@1982
   276
    const Uint8 *src;
icculus@1982
   277
    Uint16 *dst;
icculus@1982
   278
icculus@1982
   279
#ifdef DEBUG_CONVERT
icculus@1982
   280
    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16LSB.\n");
icculus@1982
   281
#endif
icculus@1982
   282
icculus@1982
   283
    src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   284
    dst = (Uint16 *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
   285
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
icculus@1982
   286
        const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8);
icculus@1982
   287
        *dst = SDL_SwapLE16(val);
icculus@1982
   288
    }
icculus@1982
   289
icculus@1982
   290
    cvt->len_cvt *= 2;
icculus@1982
   291
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   292
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
icculus@1982
   293
    }
icculus@1982
   294
}
icculus@1982
   295
icculus@1982
   296
static void SDLCALL
icculus@1982
   297
SDL_Convert_S8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   298
{
icculus@1982
   299
    int i;
icculus@1982
   300
    const Uint8 *src;
icculus@1982
   301
    Sint16 *dst;
icculus@1982
   302
icculus@1982
   303
#ifdef DEBUG_CONVERT
icculus@1982
   304
    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16LSB.\n");
icculus@1982
   305
#endif
icculus@1982
   306
icculus@1982
   307
    src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   308
    dst = (Sint16 *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
   309
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
icculus@1982
   310
        const Sint16 val = (((Sint16) ((Sint8) *src)) << 8);
icculus@1982
   311
        *dst = ((Sint16) SDL_SwapLE16(val));
icculus@1982
   312
    }
icculus@1982
   313
icculus@1982
   314
    cvt->len_cvt *= 2;
icculus@1982
   315
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   316
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
icculus@1982
   317
    }
icculus@1982
   318
}
icculus@1982
   319
icculus@1982
   320
static void SDLCALL
icculus@1982
   321
SDL_Convert_S8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   322
{
icculus@1982
   323
    int i;
icculus@1982
   324
    const Uint8 *src;
icculus@1982
   325
    Uint16 *dst;
icculus@1982
   326
icculus@1982
   327
#ifdef DEBUG_CONVERT
icculus@1982
   328
    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16MSB.\n");
icculus@1982
   329
#endif
icculus@1982
   330
icculus@1982
   331
    src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   332
    dst = (Uint16 *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
   333
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
icculus@1982
   334
        const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8);
icculus@1982
   335
        *dst = SDL_SwapBE16(val);
icculus@1982
   336
    }
icculus@1982
   337
icculus@1982
   338
    cvt->len_cvt *= 2;
icculus@1982
   339
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   340
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
icculus@1982
   341
    }
icculus@1982
   342
}
icculus@1982
   343
icculus@1982
   344
static void SDLCALL
icculus@1982
   345
SDL_Convert_S8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   346
{
icculus@1982
   347
    int i;
icculus@1982
   348
    const Uint8 *src;
icculus@1982
   349
    Sint16 *dst;
icculus@1982
   350
icculus@1982
   351
#ifdef DEBUG_CONVERT
icculus@1982
   352
    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16MSB.\n");
icculus@1982
   353
#endif
icculus@1982
   354
icculus@1982
   355
    src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   356
    dst = (Sint16 *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
   357
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
icculus@1982
   358
        const Sint16 val = (((Sint16) ((Sint8) *src)) << 8);
icculus@1982
   359
        *dst = ((Sint16) SDL_SwapBE16(val));
icculus@1982
   360
    }
icculus@1982
   361
icculus@1982
   362
    cvt->len_cvt *= 2;
icculus@1982
   363
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   364
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
icculus@1982
   365
    }
icculus@1982
   366
}
icculus@1982
   367
icculus@1982
   368
static void SDLCALL
icculus@1982
   369
SDL_Convert_S8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   370
{
icculus@1982
   371
    int i;
icculus@1982
   372
    const Uint8 *src;
icculus@1982
   373
    Sint32 *dst;
icculus@1982
   374
icculus@1982
   375
#ifdef DEBUG_CONVERT
icculus@1982
   376
    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32LSB.\n");
icculus@1982
   377
#endif
icculus@1982
   378
icculus@1982
   379
    src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   380
    dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 4);
icculus@1982
   381
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
icculus@1982
   382
        const Sint32 val = (((Sint32) ((Sint8) *src)) << 24);
icculus@1982
   383
        *dst = ((Sint32) SDL_SwapLE32(val));
icculus@1982
   384
    }
icculus@1982
   385
icculus@1982
   386
    cvt->len_cvt *= 4;
icculus@1982
   387
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   388
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
icculus@1982
   389
    }
icculus@1982
   390
}
icculus@1982
   391
icculus@1982
   392
static void SDLCALL
icculus@1982
   393
SDL_Convert_S8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   394
{
icculus@1982
   395
    int i;
icculus@1982
   396
    const Uint8 *src;
icculus@1982
   397
    Sint32 *dst;
icculus@1982
   398
icculus@1982
   399
#ifdef DEBUG_CONVERT
icculus@1982
   400
    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32MSB.\n");
icculus@1982
   401
#endif
icculus@1982
   402
icculus@1982
   403
    src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   404
    dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 4);
icculus@1982
   405
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
icculus@1982
   406
        const Sint32 val = (((Sint32) ((Sint8) *src)) << 24);
icculus@1982
   407
        *dst = ((Sint32) SDL_SwapBE32(val));
icculus@1982
   408
    }
icculus@1982
   409
icculus@1982
   410
    cvt->len_cvt *= 4;
icculus@1982
   411
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   412
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
icculus@1982
   413
    }
icculus@1982
   414
}
icculus@1982
   415
icculus@1982
   416
static void SDLCALL
icculus@1982
   417
SDL_Convert_S8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   418
{
icculus@1982
   419
    int i;
icculus@1982
   420
    const Uint8 *src;
icculus@1982
   421
    float *dst;
icculus@1982
   422
icculus@1982
   423
#ifdef DEBUG_CONVERT
icculus@1982
   424
    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32LSB.\n");
icculus@1982
   425
#endif
icculus@1982
   426
icculus@1982
   427
    src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   428
    dst = (float *) (cvt->buf + cvt->len_cvt * 4);
icculus@1982
   429
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
icculus@1982
   430
        const float val = (((float) ((Sint8) *src)) * DIVBY127);
icculus@1982
   431
        *dst = SDL_SwapFloatLE(val);
icculus@1982
   432
    }
icculus@1982
   433
icculus@1982
   434
    cvt->len_cvt *= 4;
icculus@1982
   435
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   436
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
icculus@1982
   437
    }
icculus@1982
   438
}
icculus@1982
   439
icculus@1982
   440
static void SDLCALL
icculus@1982
   441
SDL_Convert_S8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   442
{
icculus@1982
   443
    int i;
icculus@1982
   444
    const Uint8 *src;
icculus@1982
   445
    float *dst;
icculus@1982
   446
icculus@1982
   447
#ifdef DEBUG_CONVERT
icculus@1982
   448
    fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32MSB.\n");
icculus@1982
   449
#endif
icculus@1982
   450
icculus@1982
   451
    src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   452
    dst = (float *) (cvt->buf + cvt->len_cvt * 4);
icculus@1982
   453
    for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
icculus@1982
   454
        const float val = (((float) ((Sint8) *src)) * DIVBY127);
icculus@1982
   455
        *dst = SDL_SwapFloatBE(val);
icculus@1982
   456
    }
icculus@1982
   457
icculus@1982
   458
    cvt->len_cvt *= 4;
icculus@1982
   459
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   460
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
icculus@1982
   461
    }
icculus@1982
   462
}
icculus@1982
   463
icculus@1982
   464
static void SDLCALL
icculus@1982
   465
SDL_Convert_U16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   466
{
icculus@1982
   467
    int i;
icculus@1982
   468
    const Uint16 *src;
icculus@1982
   469
    Uint8 *dst;
icculus@1982
   470
icculus@1982
   471
#ifdef DEBUG_CONVERT
icculus@1982
   472
    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U8.\n");
icculus@1982
   473
#endif
icculus@1982
   474
icculus@1982
   475
    src = (const Uint16 *) cvt->buf;
icculus@1982
   476
    dst = (Uint8 *) cvt->buf;
icculus@1982
   477
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
   478
        const Uint8 val = ((Uint8) (SDL_SwapLE16(*src) >> 8));
icculus@1982
   479
        *dst = val;
icculus@1982
   480
    }
icculus@1982
   481
icculus@1982
   482
    cvt->len_cvt /= 2;
icculus@1982
   483
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   484
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
icculus@1982
   485
    }
icculus@1982
   486
}
icculus@1982
   487
icculus@1982
   488
static void SDLCALL
icculus@1982
   489
SDL_Convert_U16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   490
{
icculus@1982
   491
    int i;
icculus@1982
   492
    const Uint16 *src;
icculus@1982
   493
    Sint8 *dst;
icculus@1982
   494
icculus@1982
   495
#ifdef DEBUG_CONVERT
icculus@1982
   496
    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S8.\n");
icculus@1982
   497
#endif
icculus@1982
   498
icculus@1982
   499
    src = (const Uint16 *) cvt->buf;
icculus@1982
   500
    dst = (Sint8 *) cvt->buf;
icculus@1982
   501
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
   502
        const Sint8 val = ((Sint8) (((SDL_SwapLE16(*src)) ^ 0x8000) >> 8));
icculus@1982
   503
        *dst = ((Sint8) val);
icculus@1982
   504
    }
icculus@1982
   505
icculus@1982
   506
    cvt->len_cvt /= 2;
icculus@1982
   507
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   508
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
icculus@1982
   509
    }
icculus@1982
   510
}
icculus@1982
   511
icculus@1982
   512
static void SDLCALL
icculus@1982
   513
SDL_Convert_U16LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   514
{
icculus@1982
   515
    int i;
icculus@1982
   516
    const Uint16 *src;
icculus@1982
   517
    Sint16 *dst;
icculus@1982
   518
icculus@1982
   519
#ifdef DEBUG_CONVERT
icculus@1982
   520
    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16LSB.\n");
icculus@1982
   521
#endif
icculus@1982
   522
icculus@1982
   523
    src = (const Uint16 *) cvt->buf;
icculus@1982
   524
    dst = (Sint16 *) cvt->buf;
icculus@1982
   525
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
   526
        const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000);
icculus@1982
   527
        *dst = ((Sint16) SDL_SwapLE16(val));
icculus@1982
   528
    }
icculus@1982
   529
icculus@1982
   530
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   531
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
icculus@1982
   532
    }
icculus@1982
   533
}
icculus@1982
   534
icculus@1982
   535
static void SDLCALL
icculus@1982
   536
SDL_Convert_U16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   537
{
icculus@1982
   538
    int i;
icculus@1982
   539
    const Uint16 *src;
icculus@1982
   540
    Uint16 *dst;
icculus@1982
   541
icculus@1982
   542
#ifdef DEBUG_CONVERT
icculus@1982
   543
    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U16MSB.\n");
icculus@1982
   544
#endif
icculus@1982
   545
icculus@1982
   546
    src = (const Uint16 *) cvt->buf;
icculus@1982
   547
    dst = (Uint16 *) cvt->buf;
icculus@1982
   548
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
   549
        const Uint16 val = SDL_SwapLE16(*src);
icculus@1982
   550
        *dst = SDL_SwapBE16(val);
icculus@1982
   551
    }
icculus@1982
   552
icculus@1982
   553
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   554
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
icculus@1982
   555
    }
icculus@1982
   556
}
icculus@1982
   557
icculus@1982
   558
static void SDLCALL
icculus@1982
   559
SDL_Convert_U16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   560
{
icculus@1982
   561
    int i;
icculus@1982
   562
    const Uint16 *src;
icculus@1982
   563
    Sint16 *dst;
icculus@1982
   564
icculus@1982
   565
#ifdef DEBUG_CONVERT
icculus@1982
   566
    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16MSB.\n");
icculus@1982
   567
#endif
icculus@1982
   568
icculus@1982
   569
    src = (const Uint16 *) cvt->buf;
icculus@1982
   570
    dst = (Sint16 *) cvt->buf;
icculus@1982
   571
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
   572
        const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000);
icculus@1982
   573
        *dst = ((Sint16) SDL_SwapBE16(val));
icculus@1982
   574
    }
icculus@1982
   575
icculus@1982
   576
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   577
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
icculus@1982
   578
    }
icculus@1982
   579
}
icculus@1982
   580
icculus@1982
   581
static void SDLCALL
icculus@1982
   582
SDL_Convert_U16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   583
{
icculus@1982
   584
    int i;
icculus@1982
   585
    const Uint16 *src;
icculus@1982
   586
    Sint32 *dst;
icculus@1982
   587
icculus@1982
   588
#ifdef DEBUG_CONVERT
icculus@1982
   589
    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32LSB.\n");
icculus@1982
   590
#endif
icculus@1982
   591
icculus@1982
   592
    src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   593
    dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
   594
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
icculus@1982
   595
        const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16);
icculus@1982
   596
        *dst = ((Sint32) SDL_SwapLE32(val));
icculus@1982
   597
    }
icculus@1982
   598
icculus@1982
   599
    cvt->len_cvt *= 2;
icculus@1982
   600
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   601
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
icculus@1982
   602
    }
icculus@1982
   603
}
icculus@1982
   604
icculus@1982
   605
static void SDLCALL
icculus@1982
   606
SDL_Convert_U16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   607
{
icculus@1982
   608
    int i;
icculus@1982
   609
    const Uint16 *src;
icculus@1982
   610
    Sint32 *dst;
icculus@1982
   611
icculus@1982
   612
#ifdef DEBUG_CONVERT
icculus@1982
   613
    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32MSB.\n");
icculus@1982
   614
#endif
icculus@1982
   615
icculus@1982
   616
    src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   617
    dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
   618
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
icculus@1982
   619
        const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16);
icculus@1982
   620
        *dst = ((Sint32) SDL_SwapBE32(val));
icculus@1982
   621
    }
icculus@1982
   622
icculus@1982
   623
    cvt->len_cvt *= 2;
icculus@1982
   624
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   625
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
icculus@1982
   626
    }
icculus@1982
   627
}
icculus@1982
   628
icculus@1982
   629
static void SDLCALL
icculus@1982
   630
SDL_Convert_U16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   631
{
icculus@1982
   632
    int i;
icculus@1982
   633
    const Uint16 *src;
icculus@1982
   634
    float *dst;
icculus@1982
   635
icculus@1982
   636
#ifdef DEBUG_CONVERT
icculus@1982
   637
    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32LSB.\n");
icculus@1982
   638
#endif
icculus@1982
   639
icculus@1982
   640
    src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   641
    dst = (float *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
   642
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
icculus@2011
   643
        const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f);
icculus@1982
   644
        *dst = SDL_SwapFloatLE(val);
icculus@1982
   645
    }
icculus@1982
   646
icculus@1982
   647
    cvt->len_cvt *= 2;
icculus@1982
   648
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   649
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
icculus@1982
   650
    }
icculus@1982
   651
}
icculus@1982
   652
icculus@1982
   653
static void SDLCALL
icculus@1982
   654
SDL_Convert_U16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   655
{
icculus@1982
   656
    int i;
icculus@1982
   657
    const Uint16 *src;
icculus@1982
   658
    float *dst;
icculus@1982
   659
icculus@1982
   660
#ifdef DEBUG_CONVERT
icculus@1982
   661
    fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32MSB.\n");
icculus@1982
   662
#endif
icculus@1982
   663
icculus@1982
   664
    src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   665
    dst = (float *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
   666
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
icculus@2011
   667
        const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f);
icculus@1982
   668
        *dst = SDL_SwapFloatBE(val);
icculus@1982
   669
    }
icculus@1982
   670
icculus@1982
   671
    cvt->len_cvt *= 2;
icculus@1982
   672
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   673
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
icculus@1982
   674
    }
icculus@1982
   675
}
icculus@1982
   676
icculus@1982
   677
static void SDLCALL
icculus@1982
   678
SDL_Convert_S16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   679
{
icculus@1982
   680
    int i;
icculus@1982
   681
    const Uint16 *src;
icculus@1982
   682
    Uint8 *dst;
icculus@1982
   683
icculus@1982
   684
#ifdef DEBUG_CONVERT
icculus@1982
   685
    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U8.\n");
icculus@1982
   686
#endif
icculus@1982
   687
icculus@1982
   688
    src = (const Uint16 *) cvt->buf;
icculus@1982
   689
    dst = (Uint8 *) cvt->buf;
icculus@1982
   690
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
   691
        const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000) >> 8));
icculus@1982
   692
        *dst = val;
icculus@1982
   693
    }
icculus@1982
   694
icculus@1982
   695
    cvt->len_cvt /= 2;
icculus@1982
   696
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   697
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
icculus@1982
   698
    }
icculus@1982
   699
}
icculus@1982
   700
icculus@1982
   701
static void SDLCALL
icculus@1982
   702
SDL_Convert_S16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   703
{
icculus@1982
   704
    int i;
icculus@1982
   705
    const Uint16 *src;
icculus@1982
   706
    Sint8 *dst;
icculus@1982
   707
icculus@1982
   708
#ifdef DEBUG_CONVERT
icculus@1982
   709
    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S8.\n");
icculus@1982
   710
#endif
icculus@1982
   711
icculus@1982
   712
    src = (const Uint16 *) cvt->buf;
icculus@1982
   713
    dst = (Sint8 *) cvt->buf;
icculus@1982
   714
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
   715
        const Sint8 val = ((Sint8) (((Sint16) SDL_SwapLE16(*src)) >> 8));
icculus@1982
   716
        *dst = ((Sint8) val);
icculus@1982
   717
    }
icculus@1982
   718
icculus@1982
   719
    cvt->len_cvt /= 2;
icculus@1982
   720
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   721
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
icculus@1982
   722
    }
icculus@1982
   723
}
icculus@1982
   724
icculus@1982
   725
static void SDLCALL
icculus@1982
   726
SDL_Convert_S16LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   727
{
icculus@1982
   728
    int i;
icculus@1982
   729
    const Uint16 *src;
icculus@1982
   730
    Uint16 *dst;
icculus@1982
   731
icculus@1982
   732
#ifdef DEBUG_CONVERT
icculus@1982
   733
    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16LSB.\n");
icculus@1982
   734
#endif
icculus@1982
   735
icculus@1982
   736
    src = (const Uint16 *) cvt->buf;
icculus@1982
   737
    dst = (Uint16 *) cvt->buf;
icculus@1982
   738
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
   739
        const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000);
icculus@1982
   740
        *dst = SDL_SwapLE16(val);
icculus@1982
   741
    }
icculus@1982
   742
icculus@1982
   743
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   744
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
icculus@1982
   745
    }
icculus@1982
   746
}
icculus@1982
   747
icculus@1982
   748
static void SDLCALL
icculus@1982
   749
SDL_Convert_S16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   750
{
icculus@1982
   751
    int i;
icculus@1982
   752
    const Uint16 *src;
icculus@1982
   753
    Uint16 *dst;
icculus@1982
   754
icculus@1982
   755
#ifdef DEBUG_CONVERT
icculus@1982
   756
    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16MSB.\n");
icculus@1982
   757
#endif
icculus@1982
   758
icculus@1982
   759
    src = (const Uint16 *) cvt->buf;
icculus@1982
   760
    dst = (Uint16 *) cvt->buf;
icculus@1982
   761
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
   762
        const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000);
icculus@1982
   763
        *dst = SDL_SwapBE16(val);
icculus@1982
   764
    }
icculus@1982
   765
icculus@1982
   766
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   767
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
icculus@1982
   768
    }
icculus@1982
   769
}
icculus@1982
   770
icculus@1982
   771
static void SDLCALL
icculus@1982
   772
SDL_Convert_S16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   773
{
icculus@1982
   774
    int i;
icculus@1982
   775
    const Uint16 *src;
icculus@1982
   776
    Sint16 *dst;
icculus@1982
   777
icculus@1982
   778
#ifdef DEBUG_CONVERT
icculus@1982
   779
    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S16MSB.\n");
icculus@1982
   780
#endif
icculus@1982
   781
icculus@1982
   782
    src = (const Uint16 *) cvt->buf;
icculus@1982
   783
    dst = (Sint16 *) cvt->buf;
icculus@1982
   784
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
   785
        const Sint16 val = ((Sint16) SDL_SwapLE16(*src));
icculus@1982
   786
        *dst = ((Sint16) SDL_SwapBE16(val));
icculus@1982
   787
    }
icculus@1982
   788
icculus@1982
   789
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   790
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
icculus@1982
   791
    }
icculus@1982
   792
}
icculus@1982
   793
icculus@1982
   794
static void SDLCALL
icculus@1982
   795
SDL_Convert_S16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   796
{
icculus@1982
   797
    int i;
icculus@1982
   798
    const Uint16 *src;
icculus@1982
   799
    Sint32 *dst;
icculus@1982
   800
icculus@1982
   801
#ifdef DEBUG_CONVERT
icculus@1982
   802
    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32LSB.\n");
icculus@1982
   803
#endif
icculus@1982
   804
icculus@1982
   805
    src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   806
    dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
   807
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
icculus@1982
   808
        const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16);
icculus@1982
   809
        *dst = ((Sint32) SDL_SwapLE32(val));
icculus@1982
   810
    }
icculus@1982
   811
icculus@1982
   812
    cvt->len_cvt *= 2;
icculus@1982
   813
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   814
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
icculus@1982
   815
    }
icculus@1982
   816
}
icculus@1982
   817
icculus@1982
   818
static void SDLCALL
icculus@1982
   819
SDL_Convert_S16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   820
{
icculus@1982
   821
    int i;
icculus@1982
   822
    const Uint16 *src;
icculus@1982
   823
    Sint32 *dst;
icculus@1982
   824
icculus@1982
   825
#ifdef DEBUG_CONVERT
icculus@1982
   826
    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32MSB.\n");
icculus@1982
   827
#endif
icculus@1982
   828
icculus@1982
   829
    src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   830
    dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
   831
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
icculus@1982
   832
        const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16);
icculus@1982
   833
        *dst = ((Sint32) SDL_SwapBE32(val));
icculus@1982
   834
    }
icculus@1982
   835
icculus@1982
   836
    cvt->len_cvt *= 2;
icculus@1982
   837
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   838
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
icculus@1982
   839
    }
icculus@1982
   840
}
icculus@1982
   841
icculus@1982
   842
static void SDLCALL
icculus@1982
   843
SDL_Convert_S16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   844
{
icculus@1982
   845
    int i;
icculus@1982
   846
    const Uint16 *src;
icculus@1982
   847
    float *dst;
icculus@1982
   848
icculus@1982
   849
#ifdef DEBUG_CONVERT
icculus@1982
   850
    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32LSB.\n");
icculus@1982
   851
#endif
icculus@1982
   852
icculus@1982
   853
    src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   854
    dst = (float *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
   855
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
icculus@1982
   856
        const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767);
icculus@1982
   857
        *dst = SDL_SwapFloatLE(val);
icculus@1982
   858
    }
icculus@1982
   859
icculus@1982
   860
    cvt->len_cvt *= 2;
icculus@1982
   861
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   862
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
icculus@1982
   863
    }
icculus@1982
   864
}
icculus@1982
   865
icculus@1982
   866
static void SDLCALL
icculus@1982
   867
SDL_Convert_S16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   868
{
icculus@1982
   869
    int i;
icculus@1982
   870
    const Uint16 *src;
icculus@1982
   871
    float *dst;
icculus@1982
   872
icculus@1982
   873
#ifdef DEBUG_CONVERT
icculus@1982
   874
    fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32MSB.\n");
icculus@1982
   875
#endif
icculus@1982
   876
icculus@1982
   877
    src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
icculus@1982
   878
    dst = (float *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
   879
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
icculus@1982
   880
        const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767);
icculus@1982
   881
        *dst = SDL_SwapFloatBE(val);
icculus@1982
   882
    }
icculus@1982
   883
icculus@1982
   884
    cvt->len_cvt *= 2;
icculus@1982
   885
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   886
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
icculus@1982
   887
    }
icculus@1982
   888
}
icculus@1982
   889
icculus@1982
   890
static void SDLCALL
icculus@1982
   891
SDL_Convert_U16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   892
{
icculus@1982
   893
    int i;
icculus@1982
   894
    const Uint16 *src;
icculus@1982
   895
    Uint8 *dst;
icculus@1982
   896
icculus@1982
   897
#ifdef DEBUG_CONVERT
icculus@1982
   898
    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U8.\n");
icculus@1982
   899
#endif
icculus@1982
   900
icculus@1982
   901
    src = (const Uint16 *) cvt->buf;
icculus@1982
   902
    dst = (Uint8 *) cvt->buf;
icculus@1982
   903
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
   904
        const Uint8 val = ((Uint8) (SDL_SwapBE16(*src) >> 8));
icculus@1982
   905
        *dst = val;
icculus@1982
   906
    }
icculus@1982
   907
icculus@1982
   908
    cvt->len_cvt /= 2;
icculus@1982
   909
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   910
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
icculus@1982
   911
    }
icculus@1982
   912
}
icculus@1982
   913
icculus@1982
   914
static void SDLCALL
icculus@1982
   915
SDL_Convert_U16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   916
{
icculus@1982
   917
    int i;
icculus@1982
   918
    const Uint16 *src;
icculus@1982
   919
    Sint8 *dst;
icculus@1982
   920
icculus@1982
   921
#ifdef DEBUG_CONVERT
icculus@1982
   922
    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S8.\n");
icculus@1982
   923
#endif
icculus@1982
   924
icculus@1982
   925
    src = (const Uint16 *) cvt->buf;
icculus@1982
   926
    dst = (Sint8 *) cvt->buf;
icculus@1982
   927
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
   928
        const Sint8 val = ((Sint8) (((SDL_SwapBE16(*src)) ^ 0x8000) >> 8));
icculus@1982
   929
        *dst = ((Sint8) val);
icculus@1982
   930
    }
icculus@1982
   931
icculus@1982
   932
    cvt->len_cvt /= 2;
icculus@1982
   933
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   934
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
icculus@1982
   935
    }
icculus@1982
   936
}
icculus@1982
   937
icculus@1982
   938
static void SDLCALL
icculus@1982
   939
SDL_Convert_U16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   940
{
icculus@1982
   941
    int i;
icculus@1982
   942
    const Uint16 *src;
icculus@1982
   943
    Uint16 *dst;
icculus@1982
   944
icculus@1982
   945
#ifdef DEBUG_CONVERT
icculus@1982
   946
    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U16LSB.\n");
icculus@1982
   947
#endif
icculus@1982
   948
icculus@1982
   949
    src = (const Uint16 *) cvt->buf;
icculus@1982
   950
    dst = (Uint16 *) cvt->buf;
icculus@1982
   951
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
   952
        const Uint16 val = SDL_SwapBE16(*src);
icculus@1982
   953
        *dst = SDL_SwapLE16(val);
icculus@1982
   954
    }
icculus@1982
   955
icculus@1982
   956
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   957
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
icculus@1982
   958
    }
icculus@1982
   959
}
icculus@1982
   960
icculus@1982
   961
static void SDLCALL
icculus@1982
   962
SDL_Convert_U16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   963
{
icculus@1982
   964
    int i;
icculus@1982
   965
    const Uint16 *src;
icculus@1982
   966
    Sint16 *dst;
icculus@1982
   967
icculus@1982
   968
#ifdef DEBUG_CONVERT
icculus@1982
   969
    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16LSB.\n");
icculus@1982
   970
#endif
icculus@1982
   971
icculus@1982
   972
    src = (const Uint16 *) cvt->buf;
icculus@1982
   973
    dst = (Sint16 *) cvt->buf;
icculus@1982
   974
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
   975
        const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000);
icculus@1982
   976
        *dst = ((Sint16) SDL_SwapLE16(val));
icculus@1982
   977
    }
icculus@1982
   978
icculus@1982
   979
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
   980
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
icculus@1982
   981
    }
icculus@1982
   982
}
icculus@1982
   983
icculus@1982
   984
static void SDLCALL
icculus@1982
   985
SDL_Convert_U16MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
   986
{
icculus@1982
   987
    int i;
icculus@1982
   988
    const Uint16 *src;
icculus@1982
   989
    Sint16 *dst;
icculus@1982
   990
icculus@1982
   991
#ifdef DEBUG_CONVERT
icculus@1982
   992
    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16MSB.\n");
icculus@1982
   993
#endif
icculus@1982
   994
icculus@1982
   995
    src = (const Uint16 *) cvt->buf;
icculus@1982
   996
    dst = (Sint16 *) cvt->buf;
icculus@1982
   997
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
   998
        const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000);
icculus@1982
   999
        *dst = ((Sint16) SDL_SwapBE16(val));
icculus@1982
  1000
    }
icculus@1982
  1001
icculus@1982
  1002
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1003
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
icculus@1982
  1004
    }
icculus@1982
  1005
}
icculus@1982
  1006
icculus@1982
  1007
static void SDLCALL
icculus@1982
  1008
SDL_Convert_U16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1009
{
icculus@1982
  1010
    int i;
icculus@1982
  1011
    const Uint16 *src;
icculus@1982
  1012
    Sint32 *dst;
icculus@1982
  1013
icculus@1982
  1014
#ifdef DEBUG_CONVERT
icculus@1982
  1015
    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32LSB.\n");
icculus@1982
  1016
#endif
icculus@1982
  1017
icculus@1982
  1018
    src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
icculus@1982
  1019
    dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
  1020
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
icculus@1982
  1021
        const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16);
icculus@1982
  1022
        *dst = ((Sint32) SDL_SwapLE32(val));
icculus@1982
  1023
    }
icculus@1982
  1024
icculus@1982
  1025
    cvt->len_cvt *= 2;
icculus@1982
  1026
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1027
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
icculus@1982
  1028
    }
icculus@1982
  1029
}
icculus@1982
  1030
icculus@1982
  1031
static void SDLCALL
icculus@1982
  1032
SDL_Convert_U16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1033
{
icculus@1982
  1034
    int i;
icculus@1982
  1035
    const Uint16 *src;
icculus@1982
  1036
    Sint32 *dst;
icculus@1982
  1037
icculus@1982
  1038
#ifdef DEBUG_CONVERT
icculus@1982
  1039
    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32MSB.\n");
icculus@1982
  1040
#endif
icculus@1982
  1041
icculus@1982
  1042
    src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
icculus@1982
  1043
    dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
  1044
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
icculus@1982
  1045
        const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16);
icculus@1982
  1046
        *dst = ((Sint32) SDL_SwapBE32(val));
icculus@1982
  1047
    }
icculus@1982
  1048
icculus@1982
  1049
    cvt->len_cvt *= 2;
icculus@1982
  1050
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1051
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
icculus@1982
  1052
    }
icculus@1982
  1053
}
icculus@1982
  1054
icculus@1982
  1055
static void SDLCALL
icculus@1982
  1056
SDL_Convert_U16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1057
{
icculus@1982
  1058
    int i;
icculus@1982
  1059
    const Uint16 *src;
icculus@1982
  1060
    float *dst;
icculus@1982
  1061
icculus@1982
  1062
#ifdef DEBUG_CONVERT
icculus@1982
  1063
    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32LSB.\n");
icculus@1982
  1064
#endif
icculus@1982
  1065
icculus@1982
  1066
    src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
icculus@1982
  1067
    dst = (float *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
  1068
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
icculus@2011
  1069
        const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f);
icculus@1982
  1070
        *dst = SDL_SwapFloatLE(val);
icculus@1982
  1071
    }
icculus@1982
  1072
icculus@1982
  1073
    cvt->len_cvt *= 2;
icculus@1982
  1074
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1075
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
icculus@1982
  1076
    }
icculus@1982
  1077
}
icculus@1982
  1078
icculus@1982
  1079
static void SDLCALL
icculus@1982
  1080
SDL_Convert_U16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1081
{
icculus@1982
  1082
    int i;
icculus@1982
  1083
    const Uint16 *src;
icculus@1982
  1084
    float *dst;
icculus@1982
  1085
icculus@1982
  1086
#ifdef DEBUG_CONVERT
icculus@1982
  1087
    fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32MSB.\n");
icculus@1982
  1088
#endif
icculus@1982
  1089
icculus@1982
  1090
    src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
icculus@1982
  1091
    dst = (float *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
  1092
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
icculus@2011
  1093
        const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f);
icculus@1982
  1094
        *dst = SDL_SwapFloatBE(val);
icculus@1982
  1095
    }
icculus@1982
  1096
icculus@1982
  1097
    cvt->len_cvt *= 2;
icculus@1982
  1098
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1099
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
icculus@1982
  1100
    }
icculus@1982
  1101
}
icculus@1982
  1102
icculus@1982
  1103
static void SDLCALL
icculus@1982
  1104
SDL_Convert_S16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1105
{
icculus@1982
  1106
    int i;
icculus@1982
  1107
    const Uint16 *src;
icculus@1982
  1108
    Uint8 *dst;
icculus@1982
  1109
icculus@1982
  1110
#ifdef DEBUG_CONVERT
icculus@1982
  1111
    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U8.\n");
icculus@1982
  1112
#endif
icculus@1982
  1113
icculus@1982
  1114
    src = (const Uint16 *) cvt->buf;
icculus@1982
  1115
    dst = (Uint8 *) cvt->buf;
icculus@1982
  1116
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
  1117
        const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000) >> 8));
icculus@1982
  1118
        *dst = val;
icculus@1982
  1119
    }
icculus@1982
  1120
icculus@1982
  1121
    cvt->len_cvt /= 2;
icculus@1982
  1122
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1123
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
icculus@1982
  1124
    }
icculus@1982
  1125
}
icculus@1982
  1126
icculus@1982
  1127
static void SDLCALL
icculus@1982
  1128
SDL_Convert_S16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1129
{
icculus@1982
  1130
    int i;
icculus@1982
  1131
    const Uint16 *src;
icculus@1982
  1132
    Sint8 *dst;
icculus@1982
  1133
icculus@1982
  1134
#ifdef DEBUG_CONVERT
icculus@1982
  1135
    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S8.\n");
icculus@1982
  1136
#endif
icculus@1982
  1137
icculus@1982
  1138
    src = (const Uint16 *) cvt->buf;
icculus@1982
  1139
    dst = (Sint8 *) cvt->buf;
icculus@1982
  1140
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
  1141
        const Sint8 val = ((Sint8) (((Sint16) SDL_SwapBE16(*src)) >> 8));
icculus@1982
  1142
        *dst = ((Sint8) val);
icculus@1982
  1143
    }
icculus@1982
  1144
icculus@1982
  1145
    cvt->len_cvt /= 2;
icculus@1982
  1146
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1147
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
icculus@1982
  1148
    }
icculus@1982
  1149
}
icculus@1982
  1150
icculus@1982
  1151
static void SDLCALL
icculus@1982
  1152
SDL_Convert_S16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1153
{
icculus@1982
  1154
    int i;
icculus@1982
  1155
    const Uint16 *src;
icculus@1982
  1156
    Uint16 *dst;
icculus@1982
  1157
icculus@1982
  1158
#ifdef DEBUG_CONVERT
icculus@1982
  1159
    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16LSB.\n");
icculus@1982
  1160
#endif
icculus@1982
  1161
icculus@1982
  1162
    src = (const Uint16 *) cvt->buf;
icculus@1982
  1163
    dst = (Uint16 *) cvt->buf;
icculus@1982
  1164
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
  1165
        const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000);
icculus@1982
  1166
        *dst = SDL_SwapLE16(val);
icculus@1982
  1167
    }
icculus@1982
  1168
icculus@1982
  1169
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1170
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
icculus@1982
  1171
    }
icculus@1982
  1172
}
icculus@1982
  1173
icculus@1982
  1174
static void SDLCALL
icculus@1982
  1175
SDL_Convert_S16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1176
{
icculus@1982
  1177
    int i;
icculus@1982
  1178
    const Uint16 *src;
icculus@1982
  1179
    Sint16 *dst;
icculus@1982
  1180
icculus@1982
  1181
#ifdef DEBUG_CONVERT
icculus@1982
  1182
    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S16LSB.\n");
icculus@1982
  1183
#endif
icculus@1982
  1184
icculus@1982
  1185
    src = (const Uint16 *) cvt->buf;
icculus@1982
  1186
    dst = (Sint16 *) cvt->buf;
icculus@1982
  1187
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
  1188
        const Sint16 val = ((Sint16) SDL_SwapBE16(*src));
icculus@1982
  1189
        *dst = ((Sint16) SDL_SwapLE16(val));
icculus@1982
  1190
    }
icculus@1982
  1191
icculus@1982
  1192
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1193
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
icculus@1982
  1194
    }
icculus@1982
  1195
}
icculus@1982
  1196
icculus@1982
  1197
static void SDLCALL
icculus@1982
  1198
SDL_Convert_S16MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1199
{
icculus@1982
  1200
    int i;
icculus@1982
  1201
    const Uint16 *src;
icculus@1982
  1202
    Uint16 *dst;
icculus@1982
  1203
icculus@1982
  1204
#ifdef DEBUG_CONVERT
icculus@1982
  1205
    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16MSB.\n");
icculus@1982
  1206
#endif
icculus@1982
  1207
icculus@1982
  1208
    src = (const Uint16 *) cvt->buf;
icculus@1982
  1209
    dst = (Uint16 *) cvt->buf;
icculus@1982
  1210
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
icculus@1982
  1211
        const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000);
icculus@1982
  1212
        *dst = SDL_SwapBE16(val);
icculus@1982
  1213
    }
icculus@1982
  1214
icculus@1982
  1215
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1216
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
icculus@1982
  1217
    }
icculus@1982
  1218
}
icculus@1982
  1219
icculus@1982
  1220
static void SDLCALL
icculus@1982
  1221
SDL_Convert_S16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1222
{
icculus@1982
  1223
    int i;
icculus@1982
  1224
    const Uint16 *src;
icculus@1982
  1225
    Sint32 *dst;
icculus@1982
  1226
icculus@1982
  1227
#ifdef DEBUG_CONVERT
icculus@1982
  1228
    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32LSB.\n");
icculus@1982
  1229
#endif
icculus@1982
  1230
icculus@1982
  1231
    src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
icculus@1982
  1232
    dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
  1233
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
icculus@1982
  1234
        const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16);
icculus@1982
  1235
        *dst = ((Sint32) SDL_SwapLE32(val));
icculus@1982
  1236
    }
icculus@1982
  1237
icculus@1982
  1238
    cvt->len_cvt *= 2;
icculus@1982
  1239
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1240
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
icculus@1982
  1241
    }
icculus@1982
  1242
}
icculus@1982
  1243
icculus@1982
  1244
static void SDLCALL
icculus@1982
  1245
SDL_Convert_S16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1246
{
icculus@1982
  1247
    int i;
icculus@1982
  1248
    const Uint16 *src;
icculus@1982
  1249
    Sint32 *dst;
icculus@1982
  1250
icculus@1982
  1251
#ifdef DEBUG_CONVERT
icculus@1982
  1252
    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32MSB.\n");
icculus@1982
  1253
#endif
icculus@1982
  1254
icculus@1982
  1255
    src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
icculus@1982
  1256
    dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
  1257
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
icculus@1982
  1258
        const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16);
icculus@1982
  1259
        *dst = ((Sint32) SDL_SwapBE32(val));
icculus@1982
  1260
    }
icculus@1982
  1261
icculus@1982
  1262
    cvt->len_cvt *= 2;
icculus@1982
  1263
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1264
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
icculus@1982
  1265
    }
icculus@1982
  1266
}
icculus@1982
  1267
icculus@1982
  1268
static void SDLCALL
icculus@1982
  1269
SDL_Convert_S16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1270
{
icculus@1982
  1271
    int i;
icculus@1982
  1272
    const Uint16 *src;
icculus@1982
  1273
    float *dst;
icculus@1982
  1274
icculus@1982
  1275
#ifdef DEBUG_CONVERT
icculus@1982
  1276
    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32LSB.\n");
icculus@1982
  1277
#endif
icculus@1982
  1278
icculus@1982
  1279
    src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
icculus@1982
  1280
    dst = (float *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
  1281
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
icculus@1982
  1282
        const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767);
icculus@1982
  1283
        *dst = SDL_SwapFloatLE(val);
icculus@1982
  1284
    }
icculus@1982
  1285
icculus@1982
  1286
    cvt->len_cvt *= 2;
icculus@1982
  1287
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1288
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
icculus@1982
  1289
    }
icculus@1982
  1290
}
icculus@1982
  1291
icculus@1982
  1292
static void SDLCALL
icculus@1982
  1293
SDL_Convert_S16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1294
{
icculus@1982
  1295
    int i;
icculus@1982
  1296
    const Uint16 *src;
icculus@1982
  1297
    float *dst;
icculus@1982
  1298
icculus@1982
  1299
#ifdef DEBUG_CONVERT
icculus@1982
  1300
    fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32MSB.\n");
icculus@1982
  1301
#endif
icculus@1982
  1302
icculus@1982
  1303
    src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
icculus@1982
  1304
    dst = (float *) (cvt->buf + cvt->len_cvt * 2);
icculus@1982
  1305
    for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
icculus@1982
  1306
        const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767);
icculus@1982
  1307
        *dst = SDL_SwapFloatBE(val);
icculus@1982
  1308
    }
icculus@1982
  1309
icculus@1982
  1310
    cvt->len_cvt *= 2;
icculus@1982
  1311
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1312
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
icculus@1982
  1313
    }
icculus@1982
  1314
}
icculus@1982
  1315
icculus@1982
  1316
static void SDLCALL
icculus@1982
  1317
SDL_Convert_S32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1318
{
icculus@1982
  1319
    int i;
icculus@1982
  1320
    const Uint32 *src;
icculus@1982
  1321
    Uint8 *dst;
icculus@1982
  1322
icculus@1982
  1323
#ifdef DEBUG_CONVERT
icculus@1982
  1324
    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U8.\n");
icculus@1982
  1325
#endif
icculus@1982
  1326
icculus@1982
  1327
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1328
    dst = (Uint8 *) cvt->buf;
icculus@1982
  1329
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1330
        const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 24));
icculus@1982
  1331
        *dst = val;
icculus@1982
  1332
    }
icculus@1982
  1333
icculus@1982
  1334
    cvt->len_cvt /= 4;
icculus@1982
  1335
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1336
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
icculus@1982
  1337
    }
icculus@1982
  1338
}
icculus@1982
  1339
icculus@1982
  1340
static void SDLCALL
icculus@1982
  1341
SDL_Convert_S32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1342
{
icculus@1982
  1343
    int i;
icculus@1982
  1344
    const Uint32 *src;
icculus@1982
  1345
    Sint8 *dst;
icculus@1982
  1346
icculus@1982
  1347
#ifdef DEBUG_CONVERT
icculus@1982
  1348
    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S8.\n");
icculus@1982
  1349
#endif
icculus@1982
  1350
icculus@1982
  1351
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1352
    dst = (Sint8 *) cvt->buf;
icculus@1982
  1353
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1354
        const Sint8 val = ((Sint8) (((Sint32) SDL_SwapLE32(*src)) >> 24));
icculus@1982
  1355
        *dst = ((Sint8) val);
icculus@1982
  1356
    }
icculus@1982
  1357
icculus@1982
  1358
    cvt->len_cvt /= 4;
icculus@1982
  1359
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1360
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
icculus@1982
  1361
    }
icculus@1982
  1362
}
icculus@1982
  1363
icculus@1982
  1364
static void SDLCALL
icculus@1982
  1365
SDL_Convert_S32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1366
{
icculus@1982
  1367
    int i;
icculus@1982
  1368
    const Uint32 *src;
icculus@1982
  1369
    Uint16 *dst;
icculus@1982
  1370
icculus@1982
  1371
#ifdef DEBUG_CONVERT
icculus@1982
  1372
    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16LSB.\n");
icculus@1982
  1373
#endif
icculus@1982
  1374
icculus@1982
  1375
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1376
    dst = (Uint16 *) cvt->buf;
icculus@1982
  1377
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1378
        const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16));
icculus@1982
  1379
        *dst = SDL_SwapLE16(val);
icculus@1982
  1380
    }
icculus@1982
  1381
icculus@1982
  1382
    cvt->len_cvt /= 2;
icculus@1982
  1383
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1384
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
icculus@1982
  1385
    }
icculus@1982
  1386
}
icculus@1982
  1387
icculus@1982
  1388
static void SDLCALL
icculus@1982
  1389
SDL_Convert_S32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1390
{
icculus@1982
  1391
    int i;
icculus@1982
  1392
    const Uint32 *src;
icculus@1982
  1393
    Sint16 *dst;
icculus@1982
  1394
icculus@1982
  1395
#ifdef DEBUG_CONVERT
icculus@1982
  1396
    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16LSB.\n");
icculus@1982
  1397
#endif
icculus@1982
  1398
icculus@1982
  1399
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1400
    dst = (Sint16 *) cvt->buf;
icculus@1982
  1401
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1402
        const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16));
icculus@1982
  1403
        *dst = ((Sint16) SDL_SwapLE16(val));
icculus@1982
  1404
    }
icculus@1982
  1405
icculus@1982
  1406
    cvt->len_cvt /= 2;
icculus@1982
  1407
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1408
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
icculus@1982
  1409
    }
icculus@1982
  1410
}
icculus@1982
  1411
icculus@1982
  1412
static void SDLCALL
icculus@1982
  1413
SDL_Convert_S32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1414
{
icculus@1982
  1415
    int i;
icculus@1982
  1416
    const Uint32 *src;
icculus@1982
  1417
    Uint16 *dst;
icculus@1982
  1418
icculus@1982
  1419
#ifdef DEBUG_CONVERT
icculus@1982
  1420
    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16MSB.\n");
icculus@1982
  1421
#endif
icculus@1982
  1422
icculus@1982
  1423
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1424
    dst = (Uint16 *) cvt->buf;
icculus@1982
  1425
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1426
        const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16));
icculus@1982
  1427
        *dst = SDL_SwapBE16(val);
icculus@1982
  1428
    }
icculus@1982
  1429
icculus@1982
  1430
    cvt->len_cvt /= 2;
icculus@1982
  1431
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1432
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
icculus@1982
  1433
    }
icculus@1982
  1434
}
icculus@1982
  1435
icculus@1982
  1436
static void SDLCALL
icculus@1982
  1437
SDL_Convert_S32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1438
{
icculus@1982
  1439
    int i;
icculus@1982
  1440
    const Uint32 *src;
icculus@1982
  1441
    Sint16 *dst;
icculus@1982
  1442
icculus@1982
  1443
#ifdef DEBUG_CONVERT
icculus@1982
  1444
    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16MSB.\n");
icculus@1982
  1445
#endif
icculus@1982
  1446
icculus@1982
  1447
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1448
    dst = (Sint16 *) cvt->buf;
icculus@1982
  1449
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1450
        const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16));
icculus@1982
  1451
        *dst = ((Sint16) SDL_SwapBE16(val));
icculus@1982
  1452
    }
icculus@1982
  1453
icculus@1982
  1454
    cvt->len_cvt /= 2;
icculus@1982
  1455
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1456
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
icculus@1982
  1457
    }
icculus@1982
  1458
}
icculus@1982
  1459
icculus@1982
  1460
static void SDLCALL
icculus@1982
  1461
SDL_Convert_S32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1462
{
icculus@1982
  1463
    int i;
icculus@1982
  1464
    const Uint32 *src;
icculus@1982
  1465
    Sint32 *dst;
icculus@1982
  1466
icculus@1982
  1467
#ifdef DEBUG_CONVERT
icculus@1982
  1468
    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S32MSB.\n");
icculus@1982
  1469
#endif
icculus@1982
  1470
icculus@1982
  1471
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1472
    dst = (Sint32 *) cvt->buf;
icculus@1982
  1473
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1474
        const Sint32 val = ((Sint32) SDL_SwapLE32(*src));
icculus@1982
  1475
        *dst = ((Sint32) SDL_SwapBE32(val));
icculus@1982
  1476
    }
icculus@1982
  1477
icculus@1982
  1478
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1479
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
icculus@1982
  1480
    }
icculus@1982
  1481
}
icculus@1982
  1482
icculus@1982
  1483
static void SDLCALL
icculus@1982
  1484
SDL_Convert_S32LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1485
{
icculus@1982
  1486
    int i;
icculus@1982
  1487
    const Uint32 *src;
icculus@1982
  1488
    float *dst;
icculus@1982
  1489
icculus@1982
  1490
#ifdef DEBUG_CONVERT
icculus@1982
  1491
    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32LSB.\n");
icculus@1982
  1492
#endif
icculus@1982
  1493
icculus@1982
  1494
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1495
    dst = (float *) cvt->buf;
icculus@1982
  1496
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1497
        const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647);
icculus@1982
  1498
        *dst = SDL_SwapFloatLE(val);
icculus@1982
  1499
    }
icculus@1982
  1500
icculus@1982
  1501
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1502
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
icculus@1982
  1503
    }
icculus@1982
  1504
}
icculus@1982
  1505
icculus@1982
  1506
static void SDLCALL
icculus@1982
  1507
SDL_Convert_S32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1508
{
icculus@1982
  1509
    int i;
icculus@1982
  1510
    const Uint32 *src;
icculus@1982
  1511
    float *dst;
icculus@1982
  1512
icculus@1982
  1513
#ifdef DEBUG_CONVERT
icculus@1982
  1514
    fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32MSB.\n");
icculus@1982
  1515
#endif
icculus@1982
  1516
icculus@1982
  1517
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1518
    dst = (float *) cvt->buf;
icculus@1982
  1519
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1520
        const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647);
icculus@1982
  1521
        *dst = SDL_SwapFloatBE(val);
icculus@1982
  1522
    }
icculus@1982
  1523
icculus@1982
  1524
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1525
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
icculus@1982
  1526
    }
icculus@1982
  1527
}
icculus@1982
  1528
icculus@1982
  1529
static void SDLCALL
icculus@1982
  1530
SDL_Convert_S32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1531
{
icculus@1982
  1532
    int i;
icculus@1982
  1533
    const Uint32 *src;
icculus@1982
  1534
    Uint8 *dst;
icculus@1982
  1535
icculus@1982
  1536
#ifdef DEBUG_CONVERT
icculus@1982
  1537
    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U8.\n");
icculus@1982
  1538
#endif
icculus@1982
  1539
icculus@1982
  1540
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1541
    dst = (Uint8 *) cvt->buf;
icculus@1982
  1542
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1543
        const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 24));
icculus@1982
  1544
        *dst = val;
icculus@1982
  1545
    }
icculus@1982
  1546
icculus@1982
  1547
    cvt->len_cvt /= 4;
icculus@1982
  1548
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1549
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
icculus@1982
  1550
    }
icculus@1982
  1551
}
icculus@1982
  1552
icculus@1982
  1553
static void SDLCALL
icculus@1982
  1554
SDL_Convert_S32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1555
{
icculus@1982
  1556
    int i;
icculus@1982
  1557
    const Uint32 *src;
icculus@1982
  1558
    Sint8 *dst;
icculus@1982
  1559
icculus@1982
  1560
#ifdef DEBUG_CONVERT
icculus@1982
  1561
    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S8.\n");
icculus@1982
  1562
#endif
icculus@1982
  1563
icculus@1982
  1564
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1565
    dst = (Sint8 *) cvt->buf;
icculus@1982
  1566
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1567
        const Sint8 val = ((Sint8) (((Sint32) SDL_SwapBE32(*src)) >> 24));
icculus@1982
  1568
        *dst = ((Sint8) val);
icculus@1982
  1569
    }
icculus@1982
  1570
icculus@1982
  1571
    cvt->len_cvt /= 4;
icculus@1982
  1572
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1573
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
icculus@1982
  1574
    }
icculus@1982
  1575
}
icculus@1982
  1576
icculus@1982
  1577
static void SDLCALL
icculus@1982
  1578
SDL_Convert_S32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1579
{
icculus@1982
  1580
    int i;
icculus@1982
  1581
    const Uint32 *src;
icculus@1982
  1582
    Uint16 *dst;
icculus@1982
  1583
icculus@1982
  1584
#ifdef DEBUG_CONVERT
icculus@1982
  1585
    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16LSB.\n");
icculus@1982
  1586
#endif
icculus@1982
  1587
icculus@1982
  1588
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1589
    dst = (Uint16 *) cvt->buf;
icculus@1982
  1590
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1591
        const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16));
icculus@1982
  1592
        *dst = SDL_SwapLE16(val);
icculus@1982
  1593
    }
icculus@1982
  1594
icculus@1982
  1595
    cvt->len_cvt /= 2;
icculus@1982
  1596
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1597
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
icculus@1982
  1598
    }
icculus@1982
  1599
}
icculus@1982
  1600
icculus@1982
  1601
static void SDLCALL
icculus@1982
  1602
SDL_Convert_S32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1603
{
icculus@1982
  1604
    int i;
icculus@1982
  1605
    const Uint32 *src;
icculus@1982
  1606
    Sint16 *dst;
icculus@1982
  1607
icculus@1982
  1608
#ifdef DEBUG_CONVERT
icculus@1982
  1609
    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16LSB.\n");
icculus@1982
  1610
#endif
icculus@1982
  1611
icculus@1982
  1612
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1613
    dst = (Sint16 *) cvt->buf;
icculus@1982
  1614
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1615
        const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16));
icculus@1982
  1616
        *dst = ((Sint16) SDL_SwapLE16(val));
icculus@1982
  1617
    }
icculus@1982
  1618
icculus@1982
  1619
    cvt->len_cvt /= 2;
icculus@1982
  1620
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1621
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
icculus@1982
  1622
    }
icculus@1982
  1623
}
icculus@1982
  1624
icculus@1982
  1625
static void SDLCALL
icculus@1982
  1626
SDL_Convert_S32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1627
{
icculus@1982
  1628
    int i;
icculus@1982
  1629
    const Uint32 *src;
icculus@1982
  1630
    Uint16 *dst;
icculus@1982
  1631
icculus@1982
  1632
#ifdef DEBUG_CONVERT
icculus@1982
  1633
    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16MSB.\n");
icculus@1982
  1634
#endif
icculus@1982
  1635
icculus@1982
  1636
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1637
    dst = (Uint16 *) cvt->buf;
icculus@1982
  1638
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1639
        const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16));
icculus@1982
  1640
        *dst = SDL_SwapBE16(val);
icculus@1982
  1641
    }
icculus@1982
  1642
icculus@1982
  1643
    cvt->len_cvt /= 2;
icculus@1982
  1644
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1645
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
icculus@1982
  1646
    }
icculus@1982
  1647
}
icculus@1982
  1648
icculus@1982
  1649
static void SDLCALL
icculus@1982
  1650
SDL_Convert_S32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1651
{
icculus@1982
  1652
    int i;
icculus@1982
  1653
    const Uint32 *src;
icculus@1982
  1654
    Sint16 *dst;
icculus@1982
  1655
icculus@1982
  1656
#ifdef DEBUG_CONVERT
icculus@1982
  1657
    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16MSB.\n");
icculus@1982
  1658
#endif
icculus@1982
  1659
icculus@1982
  1660
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1661
    dst = (Sint16 *) cvt->buf;
icculus@1982
  1662
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1663
        const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16));
icculus@1982
  1664
        *dst = ((Sint16) SDL_SwapBE16(val));
icculus@1982
  1665
    }
icculus@1982
  1666
icculus@1982
  1667
    cvt->len_cvt /= 2;
icculus@1982
  1668
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1669
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
icculus@1982
  1670
    }
icculus@1982
  1671
}
icculus@1982
  1672
icculus@1982
  1673
static void SDLCALL
icculus@1982
  1674
SDL_Convert_S32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1675
{
icculus@1982
  1676
    int i;
icculus@1982
  1677
    const Uint32 *src;
icculus@1982
  1678
    Sint32 *dst;
icculus@1982
  1679
icculus@1982
  1680
#ifdef DEBUG_CONVERT
icculus@1982
  1681
    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S32LSB.\n");
icculus@1982
  1682
#endif
icculus@1982
  1683
icculus@1982
  1684
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1685
    dst = (Sint32 *) cvt->buf;
icculus@1982
  1686
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1687
        const Sint32 val = ((Sint32) SDL_SwapBE32(*src));
icculus@1982
  1688
        *dst = ((Sint32) SDL_SwapLE32(val));
icculus@1982
  1689
    }
icculus@1982
  1690
icculus@1982
  1691
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1692
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
icculus@1982
  1693
    }
icculus@1982
  1694
}
icculus@1982
  1695
icculus@1982
  1696
static void SDLCALL
icculus@1982
  1697
SDL_Convert_S32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1698
{
icculus@1982
  1699
    int i;
icculus@1982
  1700
    const Uint32 *src;
icculus@1982
  1701
    float *dst;
icculus@1982
  1702
icculus@1982
  1703
#ifdef DEBUG_CONVERT
icculus@1982
  1704
    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32LSB.\n");
icculus@1982
  1705
#endif
icculus@1982
  1706
icculus@1982
  1707
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1708
    dst = (float *) cvt->buf;
icculus@1982
  1709
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1710
        const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647);
icculus@1982
  1711
        *dst = SDL_SwapFloatLE(val);
icculus@1982
  1712
    }
icculus@1982
  1713
icculus@1982
  1714
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1715
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
icculus@1982
  1716
    }
icculus@1982
  1717
}
icculus@1982
  1718
icculus@1982
  1719
static void SDLCALL
icculus@1982
  1720
SDL_Convert_S32MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1721
{
icculus@1982
  1722
    int i;
icculus@1982
  1723
    const Uint32 *src;
icculus@1982
  1724
    float *dst;
icculus@1982
  1725
icculus@1982
  1726
#ifdef DEBUG_CONVERT
icculus@1982
  1727
    fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32MSB.\n");
icculus@1982
  1728
#endif
icculus@1982
  1729
icculus@1982
  1730
    src = (const Uint32 *) cvt->buf;
icculus@1982
  1731
    dst = (float *) cvt->buf;
icculus@1982
  1732
    for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
icculus@1982
  1733
        const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647);
icculus@1982
  1734
        *dst = SDL_SwapFloatBE(val);
icculus@1982
  1735
    }
icculus@1982
  1736
icculus@1982
  1737
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1738
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
icculus@1982
  1739
    }
icculus@1982
  1740
}
icculus@1982
  1741
icculus@1982
  1742
static void SDLCALL
icculus@1982
  1743
SDL_Convert_F32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1744
{
icculus@1982
  1745
    int i;
icculus@1982
  1746
    const float *src;
icculus@1982
  1747
    Uint8 *dst;
icculus@1982
  1748
icculus@1982
  1749
#ifdef DEBUG_CONVERT
icculus@1982
  1750
    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U8.\n");
icculus@1982
  1751
#endif
icculus@1982
  1752
icculus@1982
  1753
    src = (const float *) cvt->buf;
icculus@1982
  1754
    dst = (Uint8 *) cvt->buf;
icculus@1982
  1755
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@2011
  1756
        const Uint8 val = ((Uint8) ((SDL_SwapFloatLE(*src) + 1.0f) * 127.0f));
icculus@1982
  1757
        *dst = val;
icculus@1982
  1758
    }
icculus@1982
  1759
icculus@1982
  1760
    cvt->len_cvt /= 4;
icculus@1982
  1761
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1762
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
icculus@1982
  1763
    }
icculus@1982
  1764
}
icculus@1982
  1765
icculus@1982
  1766
static void SDLCALL
icculus@1982
  1767
SDL_Convert_F32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1768
{
icculus@1982
  1769
    int i;
icculus@1982
  1770
    const float *src;
icculus@1982
  1771
    Sint8 *dst;
icculus@1982
  1772
icculus@1982
  1773
#ifdef DEBUG_CONVERT
icculus@1982
  1774
    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S8.\n");
icculus@1982
  1775
#endif
icculus@1982
  1776
icculus@1982
  1777
    src = (const float *) cvt->buf;
icculus@1982
  1778
    dst = (Sint8 *) cvt->buf;
icculus@1982
  1779
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@1982
  1780
        const Sint8 val = ((Sint8) (SDL_SwapFloatLE(*src) * 127.0f));
icculus@1982
  1781
        *dst = ((Sint8) val);
icculus@1982
  1782
    }
icculus@1982
  1783
icculus@1982
  1784
    cvt->len_cvt /= 4;
icculus@1982
  1785
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1786
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
icculus@1982
  1787
    }
icculus@1982
  1788
}
icculus@1982
  1789
icculus@1982
  1790
static void SDLCALL
icculus@1982
  1791
SDL_Convert_F32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1792
{
icculus@1982
  1793
    int i;
icculus@1982
  1794
    const float *src;
icculus@1982
  1795
    Uint16 *dst;
icculus@1982
  1796
icculus@1982
  1797
#ifdef DEBUG_CONVERT
icculus@1982
  1798
    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16LSB.\n");
icculus@1982
  1799
#endif
icculus@1982
  1800
icculus@1982
  1801
    src = (const float *) cvt->buf;
icculus@1982
  1802
    dst = (Uint16 *) cvt->buf;
icculus@1982
  1803
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@2011
  1804
        const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f));
icculus@1982
  1805
        *dst = SDL_SwapLE16(val);
icculus@1982
  1806
    }
icculus@1982
  1807
icculus@1982
  1808
    cvt->len_cvt /= 2;
icculus@1982
  1809
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1810
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
icculus@1982
  1811
    }
icculus@1982
  1812
}
icculus@1982
  1813
icculus@1982
  1814
static void SDLCALL
icculus@1982
  1815
SDL_Convert_F32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1816
{
icculus@1982
  1817
    int i;
icculus@1982
  1818
    const float *src;
icculus@1982
  1819
    Sint16 *dst;
icculus@1982
  1820
icculus@1982
  1821
#ifdef DEBUG_CONVERT
icculus@1982
  1822
    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16LSB.\n");
icculus@1982
  1823
#endif
icculus@1982
  1824
icculus@1982
  1825
    src = (const float *) cvt->buf;
icculus@1982
  1826
    dst = (Sint16 *) cvt->buf;
icculus@1982
  1827
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@1982
  1828
        const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f));
icculus@1982
  1829
        *dst = ((Sint16) SDL_SwapLE16(val));
icculus@1982
  1830
    }
icculus@1982
  1831
icculus@1982
  1832
    cvt->len_cvt /= 2;
icculus@1982
  1833
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1834
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
icculus@1982
  1835
    }
icculus@1982
  1836
}
icculus@1982
  1837
icculus@1982
  1838
static void SDLCALL
icculus@1982
  1839
SDL_Convert_F32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1840
{
icculus@1982
  1841
    int i;
icculus@1982
  1842
    const float *src;
icculus@1982
  1843
    Uint16 *dst;
icculus@1982
  1844
icculus@1982
  1845
#ifdef DEBUG_CONVERT
icculus@1982
  1846
    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16MSB.\n");
icculus@1982
  1847
#endif
icculus@1982
  1848
icculus@1982
  1849
    src = (const float *) cvt->buf;
icculus@1982
  1850
    dst = (Uint16 *) cvt->buf;
icculus@1982
  1851
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@2011
  1852
        const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f));
icculus@1982
  1853
        *dst = SDL_SwapBE16(val);
icculus@1982
  1854
    }
icculus@1982
  1855
icculus@1982
  1856
    cvt->len_cvt /= 2;
icculus@1982
  1857
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1858
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
icculus@1982
  1859
    }
icculus@1982
  1860
}
icculus@1982
  1861
icculus@1982
  1862
static void SDLCALL
icculus@1982
  1863
SDL_Convert_F32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1864
{
icculus@1982
  1865
    int i;
icculus@1982
  1866
    const float *src;
icculus@1982
  1867
    Sint16 *dst;
icculus@1982
  1868
icculus@1982
  1869
#ifdef DEBUG_CONVERT
icculus@1982
  1870
    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16MSB.\n");
icculus@1982
  1871
#endif
icculus@1982
  1872
icculus@1982
  1873
    src = (const float *) cvt->buf;
icculus@1982
  1874
    dst = (Sint16 *) cvt->buf;
icculus@1982
  1875
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@1982
  1876
        const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f));
icculus@1982
  1877
        *dst = ((Sint16) SDL_SwapBE16(val));
icculus@1982
  1878
    }
icculus@1982
  1879
icculus@1982
  1880
    cvt->len_cvt /= 2;
icculus@1982
  1881
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1882
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
icculus@1982
  1883
    }
icculus@1982
  1884
}
icculus@1982
  1885
icculus@1982
  1886
static void SDLCALL
icculus@1982
  1887
SDL_Convert_F32LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1888
{
icculus@1982
  1889
    int i;
icculus@1982
  1890
    const float *src;
icculus@1982
  1891
    Sint32 *dst;
icculus@1982
  1892
icculus@1982
  1893
#ifdef DEBUG_CONVERT
icculus@1982
  1894
    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32LSB.\n");
icculus@1982
  1895
#endif
icculus@1982
  1896
icculus@1982
  1897
    src = (const float *) cvt->buf;
icculus@1982
  1898
    dst = (Sint32 *) cvt->buf;
icculus@1982
  1899
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@1982
  1900
        const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0));
icculus@1982
  1901
        *dst = ((Sint32) SDL_SwapLE32(val));
icculus@1982
  1902
    }
icculus@1982
  1903
icculus@1982
  1904
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1905
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
icculus@1982
  1906
    }
icculus@1982
  1907
}
icculus@1982
  1908
icculus@1982
  1909
static void SDLCALL
icculus@1982
  1910
SDL_Convert_F32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1911
{
icculus@1982
  1912
    int i;
icculus@1982
  1913
    const float *src;
icculus@1982
  1914
    Sint32 *dst;
icculus@1982
  1915
icculus@1982
  1916
#ifdef DEBUG_CONVERT
icculus@1982
  1917
    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32MSB.\n");
icculus@1982
  1918
#endif
icculus@1982
  1919
icculus@1982
  1920
    src = (const float *) cvt->buf;
icculus@1982
  1921
    dst = (Sint32 *) cvt->buf;
icculus@1982
  1922
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@1982
  1923
        const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0));
icculus@1982
  1924
        *dst = ((Sint32) SDL_SwapBE32(val));
icculus@1982
  1925
    }
icculus@1982
  1926
icculus@1982
  1927
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1928
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
icculus@1982
  1929
    }
icculus@1982
  1930
}
icculus@1982
  1931
icculus@1982
  1932
static void SDLCALL
icculus@1982
  1933
SDL_Convert_F32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1934
{
icculus@1982
  1935
    int i;
icculus@1982
  1936
    const float *src;
icculus@1982
  1937
    float *dst;
icculus@1982
  1938
icculus@1982
  1939
#ifdef DEBUG_CONVERT
icculus@1982
  1940
    fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_F32MSB.\n");
icculus@1982
  1941
#endif
icculus@1982
  1942
icculus@1982
  1943
    src = (const float *) cvt->buf;
icculus@1982
  1944
    dst = (float *) cvt->buf;
icculus@1982
  1945
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@1982
  1946
        const float val = SDL_SwapFloatLE(*src);
icculus@1982
  1947
        *dst = SDL_SwapFloatBE(val);
icculus@1982
  1948
    }
icculus@1982
  1949
icculus@1982
  1950
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1951
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
icculus@1982
  1952
    }
icculus@1982
  1953
}
icculus@1982
  1954
icculus@1982
  1955
static void SDLCALL
icculus@1982
  1956
SDL_Convert_F32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1957
{
icculus@1982
  1958
    int i;
icculus@1982
  1959
    const float *src;
icculus@1982
  1960
    Uint8 *dst;
icculus@1982
  1961
icculus@1982
  1962
#ifdef DEBUG_CONVERT
icculus@1982
  1963
    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U8.\n");
icculus@1982
  1964
#endif
icculus@1982
  1965
icculus@1982
  1966
    src = (const float *) cvt->buf;
icculus@1982
  1967
    dst = (Uint8 *) cvt->buf;
icculus@1982
  1968
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@2011
  1969
        const Uint8 val = ((Uint8) ((SDL_SwapFloatBE(*src) + 1.0f) * 127.0f));
icculus@1982
  1970
        *dst = val;
icculus@1982
  1971
    }
icculus@1982
  1972
icculus@1982
  1973
    cvt->len_cvt /= 4;
icculus@1982
  1974
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1975
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
icculus@1982
  1976
    }
icculus@1982
  1977
}
icculus@1982
  1978
icculus@1982
  1979
static void SDLCALL
icculus@1982
  1980
SDL_Convert_F32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  1981
{
icculus@1982
  1982
    int i;
icculus@1982
  1983
    const float *src;
icculus@1982
  1984
    Sint8 *dst;
icculus@1982
  1985
icculus@1982
  1986
#ifdef DEBUG_CONVERT
icculus@1982
  1987
    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S8.\n");
icculus@1982
  1988
#endif
icculus@1982
  1989
icculus@1982
  1990
    src = (const float *) cvt->buf;
icculus@1982
  1991
    dst = (Sint8 *) cvt->buf;
icculus@1982
  1992
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@1982
  1993
        const Sint8 val = ((Sint8) (SDL_SwapFloatBE(*src) * 127.0f));
icculus@1982
  1994
        *dst = ((Sint8) val);
icculus@1982
  1995
    }
icculus@1982
  1996
icculus@1982
  1997
    cvt->len_cvt /= 4;
icculus@1982
  1998
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  1999
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
icculus@1982
  2000
    }
icculus@1982
  2001
}
icculus@1982
  2002
icculus@1982
  2003
static void SDLCALL
icculus@1982
  2004
SDL_Convert_F32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  2005
{
icculus@1982
  2006
    int i;
icculus@1982
  2007
    const float *src;
icculus@1982
  2008
    Uint16 *dst;
icculus@1982
  2009
icculus@1982
  2010
#ifdef DEBUG_CONVERT
icculus@1982
  2011
    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16LSB.\n");
icculus@1982
  2012
#endif
icculus@1982
  2013
icculus@1982
  2014
    src = (const float *) cvt->buf;
icculus@1982
  2015
    dst = (Uint16 *) cvt->buf;
icculus@1982
  2016
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@2011
  2017
        const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f));
icculus@1982
  2018
        *dst = SDL_SwapLE16(val);
icculus@1982
  2019
    }
icculus@1982
  2020
icculus@1982
  2021
    cvt->len_cvt /= 2;
icculus@1982
  2022
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  2023
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
icculus@1982
  2024
    }
icculus@1982
  2025
}
icculus@1982
  2026
icculus@1982
  2027
static void SDLCALL
icculus@1982
  2028
SDL_Convert_F32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  2029
{
icculus@1982
  2030
    int i;
icculus@1982
  2031
    const float *src;
icculus@1982
  2032
    Sint16 *dst;
icculus@1982
  2033
icculus@1982
  2034
#ifdef DEBUG_CONVERT
icculus@1982
  2035
    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16LSB.\n");
icculus@1982
  2036
#endif
icculus@1982
  2037
icculus@1982
  2038
    src = (const float *) cvt->buf;
icculus@1982
  2039
    dst = (Sint16 *) cvt->buf;
icculus@1982
  2040
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@1982
  2041
        const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f));
icculus@1982
  2042
        *dst = ((Sint16) SDL_SwapLE16(val));
icculus@1982
  2043
    }
icculus@1982
  2044
icculus@1982
  2045
    cvt->len_cvt /= 2;
icculus@1982
  2046
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  2047
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
icculus@1982
  2048
    }
icculus@1982
  2049
}
icculus@1982
  2050
icculus@1982
  2051
static void SDLCALL
icculus@1982
  2052
SDL_Convert_F32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  2053
{
icculus@1982
  2054
    int i;
icculus@1982
  2055
    const float *src;
icculus@1982
  2056
    Uint16 *dst;
icculus@1982
  2057
icculus@1982
  2058
#ifdef DEBUG_CONVERT
icculus@1982
  2059
    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16MSB.\n");
icculus@1982
  2060
#endif
icculus@1982
  2061
icculus@1982
  2062
    src = (const float *) cvt->buf;
icculus@1982
  2063
    dst = (Uint16 *) cvt->buf;
icculus@1982
  2064
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@2011
  2065
        const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f));
icculus@1982
  2066
        *dst = SDL_SwapBE16(val);
icculus@1982
  2067
    }
icculus@1982
  2068
icculus@1982
  2069
    cvt->len_cvt /= 2;
icculus@1982
  2070
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  2071
        cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
icculus@1982
  2072
    }
icculus@1982
  2073
}
icculus@1982
  2074
icculus@1982
  2075
static void SDLCALL
icculus@1982
  2076
SDL_Convert_F32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  2077
{
icculus@1982
  2078
    int i;
icculus@1982
  2079
    const float *src;
icculus@1982
  2080
    Sint16 *dst;
icculus@1982
  2081
icculus@1982
  2082
#ifdef DEBUG_CONVERT
icculus@1982
  2083
    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16MSB.\n");
icculus@1982
  2084
#endif
icculus@1982
  2085
icculus@1982
  2086
    src = (const float *) cvt->buf;
icculus@1982
  2087
    dst = (Sint16 *) cvt->buf;
icculus@1982
  2088
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@1982
  2089
        const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f));
icculus@1982
  2090
        *dst = ((Sint16) SDL_SwapBE16(val));
icculus@1982
  2091
    }
icculus@1982
  2092
icculus@1982
  2093
    cvt->len_cvt /= 2;
icculus@1982
  2094
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  2095
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
icculus@1982
  2096
    }
icculus@1982
  2097
}
icculus@1982
  2098
icculus@1982
  2099
static void SDLCALL
icculus@1982
  2100
SDL_Convert_F32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  2101
{
icculus@1982
  2102
    int i;
icculus@1982
  2103
    const float *src;
icculus@1982
  2104
    Sint32 *dst;
icculus@1982
  2105
icculus@1982
  2106
#ifdef DEBUG_CONVERT
icculus@1982
  2107
    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32LSB.\n");
icculus@1982
  2108
#endif
icculus@1982
  2109
icculus@1982
  2110
    src = (const float *) cvt->buf;
icculus@1982
  2111
    dst = (Sint32 *) cvt->buf;
icculus@1982
  2112
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@1982
  2113
        const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0));
icculus@1982
  2114
        *dst = ((Sint32) SDL_SwapLE32(val));
icculus@1982
  2115
    }
icculus@1982
  2116
icculus@1982
  2117
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  2118
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
icculus@1982
  2119
    }
icculus@1982
  2120
}
icculus@1982
  2121
icculus@1982
  2122
static void SDLCALL
icculus@1982
  2123
SDL_Convert_F32MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  2124
{
icculus@1982
  2125
    int i;
icculus@1982
  2126
    const float *src;
icculus@1982
  2127
    Sint32 *dst;
icculus@1982
  2128
icculus@1982
  2129
#ifdef DEBUG_CONVERT
icculus@1982
  2130
    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32MSB.\n");
icculus@1982
  2131
#endif
icculus@1982
  2132
icculus@1982
  2133
    src = (const float *) cvt->buf;
icculus@1982
  2134
    dst = (Sint32 *) cvt->buf;
icculus@1982
  2135
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@1982
  2136
        const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0));
icculus@1982
  2137
        *dst = ((Sint32) SDL_SwapBE32(val));
icculus@1982
  2138
    }
icculus@1982
  2139
icculus@1982
  2140
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  2141
        cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
icculus@1982
  2142
    }
icculus@1982
  2143
}
icculus@1982
  2144
icculus@1982
  2145
static void SDLCALL
icculus@1982
  2146
SDL_Convert_F32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
icculus@1982
  2147
{
icculus@1982
  2148
    int i;
icculus@1982
  2149
    const float *src;
icculus@1982
  2150
    float *dst;
icculus@1982
  2151
icculus@1982
  2152
#ifdef DEBUG_CONVERT
icculus@1982
  2153
    fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_F32LSB.\n");
icculus@1982
  2154
#endif
icculus@1982
  2155
icculus@1982
  2156
    src = (const float *) cvt->buf;
icculus@1982
  2157
    dst = (float *) cvt->buf;
icculus@1982
  2158
    for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
icculus@1982
  2159
        const float val = SDL_SwapFloatBE(*src);
icculus@1982
  2160
        *dst = SDL_SwapFloatLE(val);
icculus@1982
  2161
    }
icculus@1982
  2162
icculus@1982
  2163
    if (cvt->filters[++cvt->filter_index]) {
icculus@2955
  2164
        cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
icculus@1982
  2165
    }
icculus@1982
  2166
}
icculus@1982
  2167
icculus@1982
  2168
const SDL_AudioTypeFilters sdl_audio_type_filters[] =
icculus@1982
  2169
{
icculus@1982
  2170
    { AUDIO_U8, AUDIO_S8, SDL_Convert_U8_to_S8 },
icculus@1982
  2171
    { AUDIO_U8, AUDIO_U16LSB, SDL_Convert_U8_to_U16LSB },
icculus@1982
  2172
    { AUDIO_U8, AUDIO_S16LSB, SDL_Convert_U8_to_S16LSB },
icculus@1982
  2173
    { AUDIO_U8, AUDIO_U16MSB, SDL_Convert_U8_to_U16MSB },
icculus@1982
  2174
    { AUDIO_U8, AUDIO_S16MSB, SDL_Convert_U8_to_S16MSB },
icculus@1982
  2175
    { AUDIO_U8, AUDIO_S32LSB, SDL_Convert_U8_to_S32LSB },
icculus@1982
  2176
    { AUDIO_U8, AUDIO_S32MSB, SDL_Convert_U8_to_S32MSB },
icculus@1982
  2177
    { AUDIO_U8, AUDIO_F32LSB, SDL_Convert_U8_to_F32LSB },
icculus@1982
  2178
    { AUDIO_U8, AUDIO_F32MSB, SDL_Convert_U8_to_F32MSB },
icculus@1982
  2179
    { AUDIO_S8, AUDIO_U8, SDL_Convert_S8_to_U8 },
icculus@1982
  2180
    { AUDIO_S8, AUDIO_U16LSB, SDL_Convert_S8_to_U16LSB },
icculus@1982
  2181
    { AUDIO_S8, AUDIO_S16LSB, SDL_Convert_S8_to_S16LSB },
icculus@1982
  2182
    { AUDIO_S8, AUDIO_U16MSB, SDL_Convert_S8_to_U16MSB },
icculus@1982
  2183
    { AUDIO_S8, AUDIO_S16MSB, SDL_Convert_S8_to_S16MSB },
icculus@1982
  2184
    { AUDIO_S8, AUDIO_S32LSB, SDL_Convert_S8_to_S32LSB },
icculus@1982
  2185
    { AUDIO_S8, AUDIO_S32MSB, SDL_Convert_S8_to_S32MSB },
icculus@1982
  2186
    { AUDIO_S8, AUDIO_F32LSB, SDL_Convert_S8_to_F32LSB },
icculus@1982
  2187
    { AUDIO_S8, AUDIO_F32MSB, SDL_Convert_S8_to_F32MSB },
icculus@1982
  2188
    { AUDIO_U16LSB, AUDIO_U8, SDL_Convert_U16LSB_to_U8 },
icculus@1982
  2189
    { AUDIO_U16LSB, AUDIO_S8, SDL_Convert_U16LSB_to_S8 },
icculus@1982
  2190
    { AUDIO_U16LSB, AUDIO_S16LSB, SDL_Convert_U16LSB_to_S16LSB },
icculus@1982
  2191
    { AUDIO_U16LSB, AUDIO_U16MSB, SDL_Convert_U16LSB_to_U16MSB },
icculus@1982
  2192
    { AUDIO_U16LSB, AUDIO_S16MSB, SDL_Convert_U16LSB_to_S16MSB },
icculus@1982
  2193
    { AUDIO_U16LSB, AUDIO_S32LSB, SDL_Convert_U16LSB_to_S32LSB },
icculus@1982
  2194
    { AUDIO_U16LSB, AUDIO_S32MSB, SDL_Convert_U16LSB_to_S32MSB },
icculus@1982
  2195
    { AUDIO_U16LSB, AUDIO_F32LSB, SDL_Convert_U16LSB_to_F32LSB },
icculus@1982
  2196
    { AUDIO_U16LSB, AUDIO_F32MSB, SDL_Convert_U16LSB_to_F32MSB },
icculus@1982
  2197
    { AUDIO_S16LSB, AUDIO_U8, SDL_Convert_S16LSB_to_U8 },
icculus@1982
  2198
    { AUDIO_S16LSB, AUDIO_S8, SDL_Convert_S16LSB_to_S8 },
icculus@1982
  2199
    { AUDIO_S16LSB, AUDIO_U16LSB, SDL_Convert_S16LSB_to_U16LSB },
icculus@1982
  2200
    { AUDIO_S16LSB, AUDIO_U16MSB, SDL_Convert_S16LSB_to_U16MSB },
icculus@1982
  2201
    { AUDIO_S16LSB, AUDIO_S16MSB, SDL_Convert_S16LSB_to_S16MSB },
icculus@1982
  2202
    { AUDIO_S16LSB, AUDIO_S32LSB, SDL_Convert_S16LSB_to_S32LSB },
icculus@1982
  2203
    { AUDIO_S16LSB, AUDIO_S32MSB, SDL_Convert_S16LSB_to_S32MSB },
icculus@1982
  2204
    { AUDIO_S16LSB, AUDIO_F32LSB, SDL_Convert_S16LSB_to_F32LSB },
icculus@1982
  2205
    { AUDIO_S16LSB, AUDIO_F32MSB, SDL_Convert_S16LSB_to_F32MSB },
icculus@1982
  2206
    { AUDIO_U16MSB, AUDIO_U8, SDL_Convert_U16MSB_to_U8 },
icculus@1982
  2207
    { AUDIO_U16MSB, AUDIO_S8, SDL_Convert_U16MSB_to_S8 },
icculus@1982
  2208
    { AUDIO_U16MSB, AUDIO_U16LSB, SDL_Convert_U16MSB_to_U16LSB },
icculus@1982
  2209
    { AUDIO_U16MSB, AUDIO_S16LSB, SDL_Convert_U16MSB_to_S16LSB },
icculus@1982
  2210
    { AUDIO_U16MSB, AUDIO_S16MSB, SDL_Convert_U16MSB_to_S16MSB },
icculus@1982
  2211
    { AUDIO_U16MSB, AUDIO_S32LSB, SDL_Convert_U16MSB_to_S32LSB },
icculus@1982
  2212
    { AUDIO_U16MSB, AUDIO_S32MSB, SDL_Convert_U16MSB_to_S32MSB },
icculus@1982
  2213
    { AUDIO_U16MSB, AUDIO_F32LSB, SDL_Convert_U16MSB_to_F32LSB },
icculus@1982
  2214
    { AUDIO_U16MSB, AUDIO_F32MSB, SDL_Convert_U16MSB_to_F32MSB },
icculus@1982
  2215
    { AUDIO_S16MSB, AUDIO_U8, SDL_Convert_S16MSB_to_U8 },
icculus@1982
  2216
    { AUDIO_S16MSB, AUDIO_S8, SDL_Convert_S16MSB_to_S8 },
icculus@1982
  2217
    { AUDIO_S16MSB, AUDIO_U16LSB, SDL_Convert_S16MSB_to_U16LSB },
icculus@1982
  2218
    { AUDIO_S16MSB, AUDIO_S16LSB, SDL_Convert_S16MSB_to_S16LSB },
icculus@1982
  2219
    { AUDIO_S16MSB, AUDIO_U16MSB, SDL_Convert_S16MSB_to_U16MSB },
icculus@1982
  2220
    { AUDIO_S16MSB, AUDIO_S32LSB, SDL_Convert_S16MSB_to_S32LSB },
icculus@1982
  2221
    { AUDIO_S16MSB, AUDIO_S32MSB, SDL_Convert_S16MSB_to_S32MSB },
icculus@1982
  2222
    { AUDIO_S16MSB, AUDIO_F32LSB, SDL_Convert_S16MSB_to_F32LSB },
icculus@1982
  2223
    { AUDIO_S16MSB, AUDIO_F32MSB, SDL_Convert_S16MSB_to_F32MSB },
icculus@1982
  2224
    { AUDIO_S32LSB, AUDIO_U8, SDL_Convert_S32LSB_to_U8 },
icculus@1982
  2225
    { AUDIO_S32LSB, AUDIO_S8, SDL_Convert_S32LSB_to_S8 },
icculus@1982
  2226
    { AUDIO_S32LSB, AUDIO_U16LSB, SDL_Convert_S32LSB_to_U16LSB },
icculus@1982
  2227
    { AUDIO_S32LSB, AUDIO_S16LSB, SDL_Convert_S32LSB_to_S16LSB },
icculus@1982
  2228
    { AUDIO_S32LSB, AUDIO_U16MSB, SDL_Convert_S32LSB_to_U16MSB },
icculus@1982
  2229
    { AUDIO_S32LSB, AUDIO_S16MSB, SDL_Convert_S32LSB_to_S16MSB },
icculus@1982
  2230
    { AUDIO_S32LSB, AUDIO_S32MSB, SDL_Convert_S32LSB_to_S32MSB },
icculus@1982
  2231
    { AUDIO_S32LSB, AUDIO_F32LSB, SDL_Convert_S32LSB_to_F32LSB },
icculus@1982
  2232
    { AUDIO_S32LSB, AUDIO_F32MSB, SDL_Convert_S32LSB_to_F32MSB },
icculus@1982
  2233
    { AUDIO_S32MSB, AUDIO_U8, SDL_Convert_S32MSB_to_U8 },
icculus@1982
  2234
    { AUDIO_S32MSB, AUDIO_S8, SDL_Convert_S32MSB_to_S8 },
icculus@1982
  2235
    { AUDIO_S32MSB, AUDIO_U16LSB, SDL_Convert_S32MSB_to_U16LSB },
icculus@1982
  2236
    { AUDIO_S32MSB, AUDIO_S16LSB, SDL_Convert_S32MSB_to_S16LSB },
icculus@1982
  2237
    { AUDIO_S32MSB, AUDIO_U16MSB, SDL_Convert_S32MSB_to_U16MSB },
icculus@1982
  2238
    { AUDIO_S32MSB, AUDIO_S16MSB, SDL_Convert_S32MSB_to_S16MSB },
icculus@1982
  2239
    { AUDIO_S32MSB, AUDIO_S32LSB, SDL_Convert_S32MSB_to_S32LSB },
icculus@1982
  2240
    { AUDIO_S32MSB, AUDIO_F32LSB, SDL_Convert_S32MSB_to_F32LSB },
icculus@1982
  2241
    { AUDIO_S32MSB, AUDIO_F32MSB, SDL_Convert_S32MSB_to_F32MSB },
icculus@1982
  2242
    { AUDIO_F32LSB, AUDIO_U8, SDL_Convert_F32LSB_to_U8 },
icculus@1982
  2243
    { AUDIO_F32LSB, AUDIO_S8, SDL_Convert_F32LSB_to_S8 },
icculus@1982
  2244
    { AUDIO_F32LSB, AUDIO_U16LSB, SDL_Convert_F32LSB_to_U16LSB },
icculus@1982
  2245
    { AUDIO_F32LSB, AUDIO_S16LSB, SDL_Convert_F32LSB_to_S16LSB },
icculus@1982
  2246
    { AUDIO_F32LSB, AUDIO_U16MSB, SDL_Convert_F32LSB_to_U16MSB },
icculus@1982
  2247
    { AUDIO_F32LSB, AUDIO_S16MSB, SDL_Convert_F32LSB_to_S16MSB },
icculus@1982
  2248
    { AUDIO_F32LSB, AUDIO_S32LSB, SDL_Convert_F32LSB_to_S32LSB },
icculus@1982
  2249
    { AUDIO_F32LSB, AUDIO_S32MSB, SDL_Convert_F32LSB_to_S32MSB },
icculus@1982
  2250
    { AUDIO_F32LSB, AUDIO_F32MSB, SDL_Convert_F32LSB_to_F32MSB },
icculus@1982
  2251
    { AUDIO_F32MSB, AUDIO_U8, SDL_Convert_F32MSB_to_U8 },
icculus@1982
  2252
    { AUDIO_F32MSB, AUDIO_S8, SDL_Convert_F32MSB_to_S8 },
icculus@1982
  2253
    { AUDIO_F32MSB, AUDIO_U16LSB, SDL_Convert_F32MSB_to_U16LSB },
icculus@1982
  2254
    { AUDIO_F32MSB, AUDIO_S16LSB, SDL_Convert_F32MSB_to_S16LSB },
icculus@1982
  2255
    { AUDIO_F32MSB, AUDIO_U16MSB, SDL_Convert_F32MSB_to_U16MSB },
icculus@1982
  2256
    { AUDIO_F32MSB, AUDIO_S16MSB, SDL_Convert_F32MSB_to_S16MSB },
icculus@1982
  2257
    { AUDIO_F32MSB, AUDIO_S32LSB, SDL_Convert_F32MSB_to_S32LSB },
icculus@1982
  2258
    { AUDIO_F32MSB, AUDIO_S32MSB, SDL_Convert_F32MSB_to_S32MSB },
icculus@1982
  2259
    { AUDIO_F32MSB, AUDIO_F32LSB, SDL_Convert_F32MSB_to_F32LSB },
icculus@1982
  2260
};
icculus@1982
  2261
icculus@1982
  2262
slouken@1985
  2263
/* *INDENT-ON* */
slouken@1985
  2264
slouken@1985
  2265
/* vi: set ts=4 sw=4 expandtab: */