#ifndef TWN_AUDIO_C_H #define TWN_AUDIO_C_H #include "twn_audio.h" #include #define STB_VORBIS_HEADER_ONLY #include #include #include #include #define AUDIO_FREQUENCY 48000 typedef enum AudioFileType { AUDIO_FILE_TYPE_OGG, AUDIO_FILE_TYPE_XM, AUDIO_FILE_TYPE_COUNT, AUDIO_FILE_TYPE_UNKNOWN, } AudioFileType; union AudioContext { struct { stb_vorbis *handle; unsigned char *data; int frequency; uint8_t channel_count; } vorbis; struct { xm_context_t *handle; } xm; }; typedef struct AudioChannel { AudioFileType file_type; union AudioContext context; /* interpreted by `file_type` value */ const char *path; const char *name; bool repeat; float volume; float panning; } AudioChannel; typedef struct AudioChannelItem { char *key; struct AudioChannel value; } AudioChannelItem; void audio_callback(void *userdata, uint8_t *stream, int len); #endif