cub3d/audio/audio.h
2025-06-04 17:51:45 +02:00

37 lines
816 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);
void audio_destroy(void);
void audio_play(t_sound sound);
// typedef struct s_audio {
// ma_engine_config config; // Configuration for the audio engine
// ma_engine engine; // The audio engine instance
// } t_audio;