libdragon
Loading...
Searching...
No Matches
wav64_internal.h
Go to the documentation of this file.
1
5#ifndef __LIBDRAGON_WAV64_INTERNAL_H
6#define __LIBDRAGON_WAV64_INTERNAL_H
7
8#define WAV64_ID "WV64"
9#define WAV64_FILE_VERSION 2
10#define WAV64_FORMAT_RAW 0
11#define WAV64_FORMAT_VADPCM 1
12#define WAV64_FORMAT_OPUS 3
13#define WAV64_NUM_FORMATS 4
14
16typedef struct wav64_s wav64_t;
17typedef struct samplebuffer_s samplebuffer_t;
19
21typedef struct __attribute__((packed)) {
22 char id[4];
23 int8_t version;
24 int8_t format;
25 int8_t channels;
26 int8_t nbits;
27 int32_t freq;
28 int32_t len;
29 int32_t loop_len;
30 int32_t start_offset;
32
33_Static_assert(sizeof(wav64_header_t) == 24, "invalid wav64_header size");
34
36typedef struct __attribute__((aligned(8))) {
37 int16_t v[8];
39
41typedef struct __attribute__((packed, aligned(8))) {
42 int8_t npredictors;
43 int8_t order;
44 uint16_t padding;
45 uint32_t padding1;
46 wav64_vadpcm_vector_t loop_state[2];
50
52typedef struct {
54 void (*init)(wav64_t *wav);
56 void (*close)(wav64_t *wav);
58 int (*get_bitrate)(wav64_t *wav);
60
66void raw_waveform_read(samplebuffer_t *sbuf, int fd, int wpos, int wlen, int bps);
67
74void raw_waveform_read_address(samplebuffer_t *sbuf, int rom_addr, int wpos, int wlen, int bps);
75#endif
Definition samplebuffer.h:82
WAV64 pluggable compression algorithm.
Definition wav64_internal.h:52
int close(int fildes)
Close a file.
Definition system.c:577
WAV64 structure.
Definition wav64.h:32
uint32_t padding1
padding1
Definition wav64_internal.h:45
int8_t channels
Number of interleaved channels.
Definition wav64_internal.h:25
int8_t version
Version of the file (WAV64_FILE_VERSION)
Definition wav64_internal.h:23
int8_t format
Format of the file (WAV64_FORMAT_RAW)
Definition wav64_internal.h:24
int8_t nbits
Width of sample in bits (8 or 16)
Definition wav64_internal.h:26
int32_t freq
Default playback frequency.
Definition wav64_internal.h:27
uint16_t padding
padding
Definition wav64_internal.h:44
int32_t start_offset
Offset of the first sample in the file.
Definition wav64_internal.h:30
int8_t npredictors
Number of predictors.
Definition wav64_internal.h:42
int32_t len
Length of the file (in samples)
Definition wav64_internal.h:28
int8_t order
Order of the predictors.
Definition wav64_internal.h:43
void raw_waveform_read(samplebuffer_t *sbuf, int fd, int wpos, int wlen, int bps)
Utility function to help implementing WaveformRead for uncompressed (raw) samples.
Definition wav64.c:59
int32_t loop_len
Length of the loop since file end (or 0 if no loop)
Definition wav64_internal.h:29
void raw_waveform_read_address(samplebuffer_t *sbuf, int rom_addr, int wpos, int wlen, int bps)
Utility function to help implementing WaveformRead for uncompressed (raw) samples.
Definition wav64.c:69
Header of a WAV64 file.
Definition wav64_internal.h:21
Extended header for a WAV64 file with VADPCM compression.
Definition wav64_internal.h:41
A vector of audio samples.
Definition wav64_internal.h:36