-
Notifications
You must be signed in to change notification settings - Fork 0
/
samples.h
44 lines (33 loc) · 950 Bytes
/
samples.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef SAMPLES_H
#define SAMPLES_H
#include "output.h"
enum {
SAMPLE_TYPE_RAW,
SAMPLE_TYPE_WAV,
};
typedef struct sample_t {
short *samples;
unsigned int num_frames;
int num_channels;
} sample_t;
typedef struct fsample_t {
SAMPLETYPE *samples;
unsigned int num_frames;
int num_channels;
} fsample_t;
typedef struct sound_t {
sample_t *samples;
unsigned int num_samples;
} sound_t;
typedef struct fsound_t {
fsample_t *samples;
unsigned int num_samples;
} fsound_t;
sample_t alloc_sample(size_t filesize, int num_channels);
fsample_t alloc_fsample(size_t filesize, int num_channels);
// num_channels is used for raw
sound_t *load_sound(int sample_type, const char* filename_prefix, int num_channels);
fsound_t *load_fsound(int sample_type, const char* filename_prefix, int num_channels);
sample_t *get_sample(sound_t *s, int index);
fsample_t *get_fsample(fsound_t *s, int index);
#endif