src/audio/SDL_wave.h
author Ryan C. Gordon
Tue, 28 Feb 2017 19:48:52 -0500
changeset 10922 5f4b80b748dd
parent 10894 748bedefb03f
child 11811 5d94cb6b24d3
permissions -rw-r--r--
raspberrypi: RPI_Destroy() should free the SDL_VideoDevice and its driverdata.
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 #include "../SDL_internal.h"
    22 
    23 /* WAVE files are little-endian */
    24 
    25 /*******************************************/
    26 /* Define values for Microsoft WAVE format */
    27 /*******************************************/
    28 #define RIFF            0x46464952      /* "RIFF" */
    29 #define WAVE            0x45564157      /* "WAVE" */
    30 #define FACT            0x74636166      /* "fact" */
    31 #define LIST            0x5453494c      /* "LIST" */
    32 #define BEXT            0x74786562      /* "bext" */
    33 #define JUNK            0x4B4E554A      /* "JUNK" */
    34 #define FMT             0x20746D66      /* "fmt " */
    35 #define DATA            0x61746164      /* "data" */
    36 #define PCM_CODE        0x0001
    37 #define MS_ADPCM_CODE   0x0002
    38 #define IEEE_FLOAT_CODE 0x0003
    39 #define IMA_ADPCM_CODE  0x0011
    40 #define MP3_CODE        0x0055
    41 #define EXTENSIBLE_CODE 0xFFFE
    42 #define WAVE_MONO       1
    43 #define WAVE_STEREO     2
    44 
    45 /* Normally, these three chunks come consecutively in a WAVE file */
    46 typedef struct WaveFMT
    47 {
    48 /* Not saved in the chunk we read:
    49     Uint32  FMTchunk;
    50     Uint32  fmtlen;
    51 */
    52     Uint16 encoding;
    53     Uint16 channels;            /* 1 = mono, 2 = stereo */
    54     Uint32 frequency;           /* One of 11025, 22050, or 44100 Hz */
    55     Uint32 byterate;            /* Average bytes per second */
    56     Uint16 blockalign;          /* Bytes per sample block */
    57     Uint16 bitspersample;       /* One of 8, 12, 16, or 4 for ADPCM */
    58 } WaveFMT;
    59 
    60 /* The general chunk found in the WAVE file */
    61 typedef struct Chunk
    62 {
    63     Uint32 magic;
    64     Uint32 length;
    65     Uint8 *data;
    66 } Chunk;
    67 
    68 typedef struct WaveExtensibleFMT
    69 {
    70     WaveFMT format;
    71     Uint16 size;
    72     Uint16 validbits;
    73     Uint32 channelmask;
    74     Uint8 subformat[16];  /* a GUID. */
    75 } WaveExtensibleFMT;
    76 
    77 /* vi: set ts=4 sw=4 expandtab: */