forked from libretro/libretro-lutro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
audio.h
67 lines (53 loc) · 1.61 KB
/
audio.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef AUDIO_H
#define AUDIO_H
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include "runtime.h"
#include "sound.h"
#include "decoder.h"
#include "audio_mixer.h"
typedef enum
{
AUDIO_STOPPED = 0,
AUDIO_PAUSED,
AUDIO_PLAYING
} audio_source_state;
typedef struct
{
// only one of these should be non-null for a given source.
dec_WavData* wavData; // streaming from wav
dec_OggData* oggData; // streaming from ogg
snd_SoundData* sndta; // pre-decoded sound
int lua_ref_sndta; // (REGISTRY) ref to sndta is held as long as this object isn't disposed/__gc'd
intmax_t sndpos; // readpos in samples for pre-decoded sound only
bool loop;
float volume;
float pitch;
audio_source_state state;
} audio_Source;
void lutro_audio_init(lua_State* L);
void lutro_audio_deinit();
void lutro_audio_stop_all();
int lutro_audio_preload(lua_State *L);
void mixer_render(int16_t *buffer);
void mixer_unref_stopped_sounds(lua_State* L);
int audio_newSource(lua_State *L);
int audio_setVolume(lua_State *L);
int audio_getVolume(lua_State *L);
int audio_play(lua_State *L);
int audio_stop(lua_State *L);
int source_setLooping(lua_State *L);
int source_isLooping(lua_State *L);
int source_isStopped(lua_State *L);
int source_isPaused(lua_State *L);
int source_isPlaying(lua_State *L);
int source_getVolume(lua_State *L);
int source_setVolume(lua_State *L);
int source_tell(lua_State *L);
int source_seek(lua_State *L);
int source_getPitch(lua_State *L);
int source_setPitch(lua_State *L);
int source_gc(lua_State *L);
#endif // AUDIO_H