-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaudioMixer.h
34 lines (27 loc) · 1.14 KB
/
audioMixer.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
// Playback sounds in real time, allowing multiple simultaneous wave files
// to be mixed together and played without jitter.
#ifndef AUDIO_MIXER_H
#define AUDIO_MIXER_H
typedef struct
{
int numSamples;
short *pData;
} wavedata_t;
#define AUDIOMIXER_MAX_VOLUME 100
// init() must be called before any other functions,
// cleanup() must be called last to stop playback threads and free memory.
void AudioMixer_init(void);
void AudioMixer_cleanup(void);
// Read the contents of a wave file into the pSound structure. Note that
// the pData pointer in this structure will be dynamically allocated in
// readWaveFileIntoMemory(), and is freed by calling freeWaveFileData().
void AudioMixer_readWaveFileIntoMemory(char *fileName, wavedata_t *pSound);
void AudioMixer_freeWaveFileData(wavedata_t *pSound);
// Queue up another sound bite to play as soon as possible.
void AudioMixer_queueSound(wavedata_t *pSound);
// Get/set the volume.
// setVolume() function posted by StackOverflow user "trenki" at:
// http://stackoverflow.com/questions/6787318/set-alsa-master-volume-from-c-code
int AudioMixer_getVolume();
void AudioMixer_setVolume(int newVolume);
#endif