#ifndef _XAS_BANK_H #define _XAS_BANK_H #include #include #include #include #define XAS_BANK_PLAYER_DEFAULT_GAIN 1.0f #define XAS_BANK_PLAYER_NONE 0 #define XAS_BANK_PLAYER_LOOP (1 << 0) enum xas_bank_player_status { XAS_BANK_PLAYER_STOPPED, XAS_BANK_PLAYER_PLAYING, }; typedef struct _xas_bank_entry { size_t duration; } xas_bank_entry; typedef struct _xas_bank { xas_audio_format format; size_t entry_size, entry_count; } xas_bank; typedef struct _xas_bank_player { xas_object obj; xas_bank *bank; enum xas_bank_player_status status; int flags; float gain; size_t entry, index; } xas_bank_player; xas_bank *xas_bank_new(xas_audio_format format, size_t entry_size, size_t entry_count); void xas_bank_destroy(xas_bank *bank); void xas_bank_entry_duration(xas_bank *bank, size_t entry_index, struct timeval *tv); ssize_t xas_bank_record(xas_bank *bank, xas_audio_stream *input, size_t entry_index, size_t count); ssize_t xas_bank_load_file(xas_bank *bank, size_t entry_index, const char *path); xas_bank_player *xas_bank_player_new(xas_bank *bank); void xas_bank_player_destroy(xas_bank_player *player); void xas_bank_player_set_gain(xas_bank_player *player, float gain); int xas_bank_player_set_entry(xas_bank_player *player, size_t entry); int xas_bank_player_start(xas_bank_player *player); int xas_bank_player_stop(xas_bank_player *player); int xas_bank_player_set_flags(xas_bank_player *player, int flags); int xas_bank_player_playing(xas_bank_player *player); xas_audio_stream *xas_bank_player_stream_new(xas_bank_player *player); #endif /* _XAS_BANK_H */