main
wave.h
1/*
2 Copyright 2013 Michael Pavone
3 This file is part of BlastEm.
4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
5*/
6#ifndef WAVE_H_
7#define WAVE_H_
8
9#include <stdint.h>
10#include <stdio.h>
11
12#pragma pack(push, 1)
13
14typedef struct {
15 char id[4];
16 uint32_t size;
17 char format[4];
18} riff_chunk;
19
20typedef struct {
21 char id[4];
22 uint32_t size;
23} riff_sub_chunk;
24
25typedef struct {
26 riff_chunk chunk;
27 riff_sub_chunk format_header;
28 uint16_t audio_format;
29 uint16_t num_channels;
30 uint32_t sample_rate;
31 uint32_t byte_rate;
32 uint16_t block_align;
33 uint16_t bits_per_sample;
34 riff_sub_chunk data_header;
35} wave_header;
36
37#pragma pack(pop)
38
39int wave_init(FILE * f, uint32_t sample_rate, uint16_t bits_per_sample, uint16_t num_channels);
40int wave_finalize(FILE * f);
41
42#endif //WAVE_H_
43