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