39 lines
990 B
C
39 lines
990 B
C
#include "miniaudio.h"
|
|
|
|
#define SND_SIZE 8
|
|
#define SUCCESS 1
|
|
#define FAILURE 0
|
|
|
|
typedef enum s_sound {
|
|
SND_WALK,
|
|
SND_FLASH,
|
|
SND_DAMAGE,
|
|
SND_DEATH,
|
|
SND_ENEMY,
|
|
SND_PICKUP,
|
|
SND_HUM,
|
|
SND_NOISE
|
|
} t_sound;
|
|
|
|
typedef struct s_audio {
|
|
ma_engine engine; // The audio engine instance
|
|
ma_sound sounds[SND_SIZE]; // Array of sounds
|
|
char play_queue[SND_SIZE]; // Queue for playing sounds
|
|
char stop_queue[SND_SIZE]; // Queue for stopping sounds
|
|
char is_playing[SND_SIZE]; // Array to check if sounds are playing
|
|
|
|
} t_audio;
|
|
|
|
t_audio *audio_init(void);
|
|
int audio_load_sounds(t_audio *audio);
|
|
int audio_stop(t_audio *audio, t_sound sound);
|
|
int audio_is_playing(t_audio *audio, t_sound sound);
|
|
int audio_loop(t_audio *audio, t_sound sound, int loop);
|
|
int audio_handle_queues(t_audio *audio);
|
|
void audio_uninit(t_audio *audio);
|
|
|
|
// typedef struct s_audio {
|
|
// ma_engine_config config; // Configuration for the audio engine
|
|
// ma_engine engine; // The audio engine instance
|
|
|
|
// } t_audio;
|