summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXANTRONIX Development2022-03-07 20:49:46 -0500
committerXANTRONIX Development2022-03-07 20:51:22 -0500
commitac0defb30297d38a032104ae3c953a5d3c5ada60 (patch)
treea08494532bfef806bf389acf1151294645eb1c72 /src
parent46c6f809e842ec50a8073a7ef7f94594955f4fe7 (diff)
downloadxas-ac0defb30297d38a032104ae3c953a5d3c5ada60.tar.gz
xas-ac0defb30297d38a032104ae3c953a5d3c5ada60.tar.bz2
xas-ac0defb30297d38a032104ae3c953a5d3c5ada60.zip
xas_bank_entry_duration(): use struct timeval
Diffstat (limited to 'src')
-rw-r--r--src/bank.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/bank.c b/src/bank.c
index 698cbfb..53f1a61 100644
--- a/src/bank.c
+++ b/src/bank.c
@@ -162,10 +162,14 @@ void xas_bank_player_destroy(xas_bank_player *player) {
free(player);
}
-size_t xas_bank_entry_duration(xas_bank *bank, size_t entry_index) {
+void xas_bank_entry_duration(xas_bank *bank,
+ size_t entry_index,
+ struct timeval *tv) {
xas_bank_entry *entry = entry_by_index(bank, entry_index);
+ size_t count = entry->duration;
- return entry->duration;
+ tv->tv_sec = count / bank->format.sample_rate;
+ tv->tv_usec = (count % bank->format.sample_rate) * 1000000;
}
int xas_bank_player_set_entry(xas_bank_player *player, size_t entry) {