diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bank.c | 29 |
1 files changed, 23 insertions, 6 deletions
@@ -118,6 +118,12 @@ error_riff_open_file: return -1; } +static int set_gain(xas_bank_player *player, float gain) { + xas_bank_player_set_gain(player, gain); + + return 0; +} + xas_bank_player *xas_bank_player_new(xas_bank *bank) { xas_bank_player *player; @@ -125,8 +131,9 @@ xas_bank_player *xas_bank_player_new(xas_bank *bank) { goto error_malloc_player; } - player->obj.start = (xas_object_start_callback)xas_bank_player_start; - player->obj.stop = (xas_object_stop_callback)xas_bank_player_stop; + player->obj.start = (xas_object_start_callback)xas_bank_player_start; + player->obj.stop = (xas_object_stop_callback)xas_bank_player_stop; + player->obj.set_gain = (xas_object_set_gain_callback)set_gain; player->bank = bank; player->status = XAS_BANK_PLAYER_STOPPED; @@ -144,13 +151,23 @@ void xas_bank_player_destroy(xas_bank_player *player) { free(player); } -int xas_bank_player_select(xas_bank_player *player, - size_t entry, - float gain) { +int xas_bank_player_set_entry(xas_bank_player *player, size_t entry) { + if (entry > player->bank->entry_count) { + errno = EINVAL; + + goto error_invalid_entry; + } + player->entry = entry; - player->gain = gain; return 0; + +error_invalid_entry: + return -1; +} + +void xas_bank_player_set_gain(xas_bank_player *player, float gain) { + player->gain = gain; } int xas_bank_player_start(xas_bank_player *player) { |