SDL
2.0
SDL_wave.h
Go to the documentation of this file.
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: */
WaveFMT
Definition:
SDL_wave.h:46
WaveFMT::blockalign
Uint16 blockalign
Definition:
SDL_wave.h:56
WaveExtensibleFMT::validbits
Uint16 validbits
Definition:
SDL_wave.h:72
Chunk
Definition:
SDL_wave.h:61
Chunk::length
Uint32 length
Definition:
SDL_wave.h:64
WaveExtensibleFMT::channelmask
Uint32 channelmask
Definition:
SDL_wave.h:73
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition:
SDL_stdinc.h:169
WaveFMT::encoding
Uint16 encoding
Definition:
SDL_wave.h:52
WaveExtensibleFMT::size
Uint16 size
Definition:
SDL_wave.h:71
WaveFMT::channels
Uint16 channels
Definition:
SDL_wave.h:53
WaveExtensibleFMT::format
WaveFMT format
Definition:
SDL_wave.h:70
WaveExtensibleFMT
Definition:
SDL_wave.h:68
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition:
SDL_stdinc.h:153
Chunk::data
Uint8 * data
Definition:
SDL_wave.h:65
Chunk::magic
Uint32 magic
Definition:
SDL_wave.h:63
Uint16
uint16_t Uint16
An unsigned 16-bit integer type.
Definition:
SDL_stdinc.h:161
WaveFMT::frequency
Uint32 frequency
Definition:
SDL_wave.h:54
WaveFMT::bitspersample
Uint16 bitspersample
Definition:
SDL_wave.h:57
WaveFMT::byterate
Uint32 byterate
Definition:
SDL_wave.h:55
src
audio
SDL_wave.h
Generated by
1.8.13