summaryrefslogtreecommitdiff
path: root/audio.h
blob: 6e4b0c0ad956aeccf6075b393ecd91c1e51e80ef (plain)
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
#ifndef audio_h
#define audio_h

struct sound {
    struct string name;
    u8 *data;
    i32 channels;
    i32 freq;
    i32 bps;
    i32 size;
};

struct sound_node {
    struct sound *sound;
    struct sound_node *next;
    struct sound_node *prev;
};

struct sound_queue {
    i32 count;
    struct sound_node *first;
    struct sound_node *last;
};

#define max_sound_loaded 1
#define max_sound_playing 1

i32  load_vorbis(struct arena *arena, struct sound *sounds, struct string filename);
void play_sound(struct sound *sounds, struct sound_queue *queue, struct sound_node *nodes, i32 id);
i32  find_sound(struct sound *sounds, const char *name);
i32  load_sound(struct sound *sounds, struct sound new_sound);
i32  enqueue_sound(struct sound_queue *queue, struct sound_node *nodes, struct sound *sound);
struct sound *dequeue_sound(struct sound_queue *queue);

#endif