src/audio/SDL_wave.h
author Sam Lantinga <slouken@libsdl.org>
Sat, 02 Jan 2016 10:10:34 -0800
changeset 9998 f67cf37e9cd4
parent 9619 b94b6d0bff0f
child 10737 3406a0f8b041
permissions -rw-r--r--
Updated copyright to 2016
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2016 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 WAVE_MONO       1
    42 #define WAVE_STEREO     2
    43 
    44 /* Normally, these three chunks come consecutively in a WAVE file */
    45 typedef struct WaveFMT
    46 {
    47 /* Not saved in the chunk we read:
    48     Uint32  FMTchunk;
    49     Uint32  fmtlen;
    50 */
    51     Uint16 encoding;
    52     Uint16 channels;            /* 1 = mono, 2 = stereo */
    53     Uint32 frequency;           /* One of 11025, 22050, or 44100 Hz */
    54     Uint32 byterate;            /* Average bytes per second */
    55     Uint16 blockalign;          /* Bytes per sample block */
    56     Uint16 bitspersample;       /* One of 8, 12, 16, or 4 for ADPCM */
    57 } WaveFMT;
    58 
    59 /* The general chunk found in the WAVE file */
    60 typedef struct Chunk
    61 {
    62     Uint32 magic;
    63     Uint32 length;
    64     Uint8 *data;
    65 } Chunk;
    66 
    67 /* vi: set ts=4 sw=4 expandtab: */