#ifndef TWN_AUDIO_C_H #define TWN_AUDIO_C_H #include "twn_audio.h" #include #define STB_VORBIS_HEADER_ONLY #include #include #include #include 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 { PlayAudioArgs args; AudioFileType file_type; union AudioContext context; /* interpreted by `file_type` value */ const char *path; const char *name; } AudioChannel; typedef struct AudioChannelItem { char *key; struct AudioChannel value; } AudioChannelItem; void audio_callback(void *userdata, uint8_t *stream, int len); #endif