forked from cyxx/f2bgl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmixer.h
49 lines (37 loc) · 940 Bytes
/
mixer.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
45
46
47
48
49
/*
* Fade To Black engine rewrite
* Copyright (C) 2006-2012 Gregory Montoir ([email protected])
*/
#ifndef MIXER_H__
#define MIXER_H__
#include "util.h"
enum {
kMaxSoundsCount = 32,
kMaxQueuesCount = 1
};
enum {
kDefaultVolume = 127,
kDefaultPan = 64
};
struct MixerSound;
struct MixerQueue;
struct Mixer {
int _rate;
MixerSound *_soundsTable[kMaxSoundsCount];
MixerQueue *_queue;
uint32_t _idsMap[kMaxSoundsCount];
void (*_lock)(int);
Mixer();
~Mixer();
void setFormat(int rate, int fmt);
int findIndexById(uint32_t id) const;
void playWav(FILE *, int dataSize, int volume, int pan, uint32_t id, bool compressed = true);
void stopWav(uint32_t);
bool isWavPlaying(uint32_t) const;
void playQueue(int preloadSize);
void appendToQueue(const uint8_t *buf, int size);
void stopQueue();
void mixBuf(int16_t *buf, int len);
static void mixCb(void *param, uint8_t *buf, int len);
};
#endif // MIXER_H__