1/* 2 * Copyright (c) 2003, Marcus Overhagen 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without modification, 6 * are permitted provided that the following conditions are met: 7 * 8 * * Redistributions of source code must retain the above copyright notice, 9 * this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 23 * OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25#ifndef _WAV_H 26#define _WAV_H 27 28struct riff_struct 29{ 30 uint32 riff_id; // 'RIFF' 31 uint32 len; 32 uint32 wave_id; // 'WAVE' 33}; 34 35struct chunk_struct 36{ 37 uint32 fourcc; 38 uint32 len; 39}; 40 41struct format_struct 42{ 43 uint16 format_tag; 44 uint16 channels; 45 uint32 samples_per_sec; 46 uint32 avg_bytes_per_sec; 47 uint16 block_align; 48 uint16 bits_per_sample; 49}; 50 51struct wave_format_ex { 52 uint16 format_tag; 53 uint16 channels; 54 uint32 samples_per_sec; 55 uint32 avg_bytes_per_sec; 56 uint16 block_align; 57 uint16 bits_per_sample; 58 uint16 extra_size; 59 uint8 extra_data[64]; // allow for 64 bytes of extra data 60}; 61 62struct mpeg3_wav_format { 63 uint16 format_tag; 64 uint16 channels; 65 uint32 samples_per_sec; 66 uint32 avg_bytes_per_sec; 67 uint16 block_align; 68 uint16 bits_per_sample; 69 uint16 extra_size; 70 uint16 id; 71 uint32 flags; 72 uint16 block_size; 73 uint16 frames_per_block; 74 uint16 codec_delay; 75}; 76 77struct mpeg1_wav_format { 78 uint16 format_tag; 79 uint16 channels; 80 uint32 samples_per_sec; 81 uint32 avg_bytes_per_sec; 82 uint16 block_align; 83 uint16 bits_per_sample; 84 uint16 extra_size; 85 uint16 head_layer; 86 uint32 head_bitrate; 87 uint16 head_mode; 88 uint16 head_mode_ext; 89 uint16 head_emphasis; 90 uint16 head_flags; 91 uint32 pts_low; 92 uint32 pts_high; 93}; 94 95struct format_struct_extensible 96{ 97 uint16 format_tag; // 0xfffe for extensible format 98 uint16 channels; 99 uint32 samples_per_sec; 100 uint32 avg_bytes_per_sec; 101 uint16 block_align; 102 uint16 bits_per_sample; 103 uint16 ext_size; 104 uint16 valid_bits_per_sample; 105 uint32 channel_mask; 106 uint8 guid[16]; // first two bytes are format code 107}; 108 109struct fact_struct 110{ 111 uint32 sample_length; 112}; 113 114#endif 115