libdragon
Loading...
Searching...
No Matches
wav64internal.h
1#ifndef __LIBDRAGON_WAV64_INTERNAL_H
2#define __LIBDRAGON_WAV64_INTERNAL_H
3
4#define WAV64_ID "WV64"
5#define WAV64_FILE_VERSION 2
6#define WAV64_FORMAT_RAW 0
7#define WAV64_FORMAT_VADPCM 1
8
10typedef struct __attribute__((packed)) {
11 char id[4];
12 int8_t version;
13 int8_t format;
14 int8_t channels;
15 int8_t nbits;
16 int32_t freq;
17 int32_t len;
18 int32_t loop_len;
19 int32_t start_offset;
21
22_Static_assert(sizeof(wav64_header_t) == 24, "invalid wav64_header size");
23
25typedef struct __attribute__((aligned(8))) {
26 int16_t v[8];
28
30typedef struct __attribute__((packed, aligned(8))) {
31 int8_t npredictors;
32 int8_t order;
33 int16_t padding;
35 wav64_vadpcm_vector_t loop_state[2];
39
40typedef struct samplebuffer_s samplebuffer_t;
41
47void raw_waveform_read(samplebuffer_t *sbuf, int base_rom_addr, int wpos, int wlen, int bps);
48
49#endif
Definition samplebuffer.h:82
Header of a WAV64 file.
Definition wav64internal.h:10
int8_t channels
Number of interleaved channels.
Definition wav64internal.h:14
int8_t version
Version of the file (WAV64_FILE_VERSION)
Definition wav64internal.h:12
int8_t format
Format of the file (WAV64_FORMAT_RAW)
Definition wav64internal.h:13
int8_t nbits
Width of sample in bits (8 or 16)
Definition wav64internal.h:15
int32_t freq
Default playback frequency.
Definition wav64internal.h:16
int32_t start_offset
Offset of the first sample in the file.
Definition wav64internal.h:19
int32_t len
Length of the file (in samples)
Definition wav64internal.h:17
int32_t loop_len
Length of the loop since file end (or 0 if no loop)
Definition wav64internal.h:18
Extended header for a WAV64 file with VADPCM compression.
Definition wav64internal.h:30
uint32_t current_rom_addr
Current address in ROM.
Definition wav64internal.h:34
int8_t npredictors
Number of predictors.
Definition wav64internal.h:31
int8_t order
Order of the predictors.
Definition wav64internal.h:32
int16_t padding
Padding
Definition wav64internal.h:33
A vector of audio samples.
Definition wav64internal.h:25
void raw_waveform_read(samplebuffer_t *sbuf, int base_rom_addr, int wpos, int wlen, int bps)
Utility function to help implementing WaveformRead for uncompressed (raw) samples.
Definition wav64.c:150