#ifndef AO_PLAYASYNC_H
#define AO_PLAYASYNC_H

#ifdef _WINDOWS
#ifdef AOPLAYASYNC_LIBRARY
#define AOPLAYASYNC_EXPORT __declspec(dllexport)
#else
#define AOPLAYASYNC_EXPORT __declspec(dllimport)
#endif
#else
#define AOPLAYASYNC_EXPORT extern
#endif

#define VERSION 2

typedef enum {
    ao = 1,
    flac = 2,
    mpg123 = 3,
    ao_ogg = 4
} BufferType_t;

typedef struct {
    BufferType_t type;
    int          sample_bits;
    int          sample_rate;
    int          channels;
    int          endiannes;
} BufferInfo_t;

AOPLAYASYNC_EXPORT int ao_async_version(void);
AOPLAYASYNC_EXPORT void *ao_create_async(int bits, int rate, int channels, int byte_format);
AOPLAYASYNC_EXPORT void ao_stop_async(void *handle);
AOPLAYASYNC_EXPORT void ao_play_async(void *handle, int music_id, double at_second, double music_duration, int buf_size, void *mem, BufferInfo_t info);
AOPLAYASYNC_EXPORT void ao_clear_async(void *handle);

AOPLAYASYNC_EXPORT double ao_is_at_second_async(void *handle);
AOPLAYASYNC_EXPORT int ao_is_at_music_id_async(void *handle);
AOPLAYASYNC_EXPORT double ao_music_duration_async(void *handle);

AOPLAYASYNC_EXPORT void ao_pause_async(void *ao_handle, int paused);

AOPLAYASYNC_EXPORT void ao_set_volume_async(void *ao_handle, double percentage);
AOPLAYASYNC_EXPORT double ao_volume_async(void *ao_handle);

AOPLAYASYNC_EXPORT int ao_bufsize_async(void *handle);

#endif // AO_PLAYASYNC_H
