2022-01-19 16:43:21 -06:00
|
|
|
#ifndef SOUND_H
|
|
|
|
#define SOUND_H
|
|
|
|
|
2022-06-22 20:39:18 -05:00
|
|
|
struct Mix_Chunk {
|
|
|
|
int i;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Mix_Music {
|
|
|
|
int i;
|
|
|
|
};
|
2022-01-19 16:43:21 -06:00
|
|
|
|
2022-06-23 02:34:51 -05:00
|
|
|
enum MUS {
|
|
|
|
MUS_STOP,
|
|
|
|
MUS_PLAY,
|
|
|
|
MUS_PAUSE
|
2022-01-19 16:43:21 -06:00
|
|
|
};
|
|
|
|
|
2022-06-23 02:34:51 -05:00
|
|
|
struct sound {
|
2022-07-03 00:43:42 -05:00
|
|
|
int sound;
|
2022-07-03 19:24:53 -05:00
|
|
|
int loop;
|
2022-07-05 15:12:48 -05:00
|
|
|
unsigned int ch;
|
2022-07-03 19:24:53 -05:00
|
|
|
int fin;
|
|
|
|
int frame;
|
|
|
|
int play;
|
2022-07-04 12:47:21 -05:00
|
|
|
struct wav *data;
|
2022-06-23 02:34:51 -05:00
|
|
|
enum MUS state;
|
2022-01-19 16:43:21 -06:00
|
|
|
unsigned char volume;
|
|
|
|
};
|
|
|
|
|
2022-07-03 19:24:53 -05:00
|
|
|
struct wav {
|
2022-07-05 15:12:48 -05:00
|
|
|
unsigned int ch;
|
|
|
|
unsigned int samplerate;
|
|
|
|
unsigned int frames;
|
2022-07-04 12:47:21 -05:00
|
|
|
double gain;
|
2022-07-03 19:24:53 -05:00
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
|
2022-01-19 16:43:21 -06:00
|
|
|
extern const char *audioDriver;
|
|
|
|
|
|
|
|
void sound_init();
|
|
|
|
void audio_open(const char *device);
|
|
|
|
void audio_close();
|
|
|
|
|
|
|
|
struct sound *make_sound(const char *wav);
|
2022-06-23 02:34:51 -05:00
|
|
|
struct sound *make_music(const char *ogg);
|
2022-01-19 16:43:21 -06:00
|
|
|
|
|
|
|
void play_sound(struct sound *sound);
|
|
|
|
|
|
|
|
const char *get_audio_driver();
|
|
|
|
|
|
|
|
void play_music(struct sound *music);
|
|
|
|
void music_set(struct sound *music);
|
|
|
|
int music_playing();
|
|
|
|
int music_paused();
|
|
|
|
void music_volume(unsigned char vol);
|
|
|
|
void music_resume();
|
|
|
|
void music_pause();
|
|
|
|
void music_stop();
|
|
|
|
|
2022-02-06 10:14:57 -06:00
|
|
|
void close_audio_device(int device);
|
|
|
|
void clear_raw(int device);
|
|
|
|
void play_raw(int device, void *data, int size);
|
|
|
|
int open_device(const char *adriver);
|
|
|
|
|
2022-01-19 16:43:21 -06:00
|
|
|
void audio_init();
|
|
|
|
|
2022-02-06 10:14:57 -06:00
|
|
|
#endif
|