scons --> make
[aftubes.git] / wavefile.h
blobee3107dda2b7897a3ab2d65a6a0757d1a097b33d
1 #ifndef WAVEFILE_H
2 #define WAVEFILE_H
4 #include "aformat.h"
5 #include "stdio.h"
6 #include "sys/types.h"
7 #include "errors.h"
9 enum {
10 EFOPEN = ERR_GROUP(8), // fopen failed
11 EFREAD, // fread failed
12 EFORMAT, // invalid file format
13 EWAVE_EOF, // read beyond the end of the wave file
16 struct waveformat {
17 int srate;
18 int bits;
19 int channels;
22 struct wavefile
24 const char *filename;
25 FILE *f;
26 struct waveformat format;
27 long length; // length, in samples
28 off_t pcm_start; // file offset to start of actual audio data
31 err_t wavefile_open(struct wavefile *wav, const char *filename);
32 err_t wavefile_read_at(struct wavefile *wav, off_t sample_start, void *buf, size_t n_samples);
34 #endif