aboutsummaryrefslogtreecommitdiff
path: root/src/wav.h
blob: 859b5350b6aba63e0ab6b767a10224169c0ef81c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* Minimal RIFF/WAVE reader for the command line tool: uncompressed 16-bit PCM
 * only, first channel extracted. The library itself never touches files. */

#ifndef PYSEG_WAV_H
#define PYSEG_WAV_H

#include <stddef.h>
#include <stdint.h>

typedef struct {
    int16_t *samples; /* mono, first channel of the source */
    size_t count;
    int sample_rate;
    int channels;
} wav_t;

/* Returns 0 on success. On failure returns non-zero and, when err is
 * non-NULL, writes a short reason there. */
int wav_read_mono_s16(const char *path, wav_t *out, const char **err);
void wav_free(wav_t *w);

#endif /* PYSEG_WAV_H */