summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bank.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/bank.c b/src/bank.c
index 6070714..d38822f 100644
--- a/src/bank.c
+++ b/src/bank.c
@@ -98,7 +98,7 @@ error_audio_stream_read:
}
static ssize_t stream_fill(xas_bank *bank,
- int16_t *samples,
+ int16_t *dest,
size_t count,
xas_audio_stream *stream) {
size_t index_o = 0,
@@ -109,12 +109,16 @@ static ssize_t stream_fill(xas_bank *bank,
xas_bank_entry *entry =
&((xas_bank_entry *)(bank + 1))[bank->entry];
+ int16_t *src = (int16_t *)(entry + 1);
+
size_t remaining = entry->duration - bank->index,
amount = remaining < left? remaining: left;
- memcpy(ptr(stream, samples, index_o),
- ptr(stream, entry + 1, bank->index),
- amount * stream->channels * stream->sample_size);
+ size_t i;
+
+ for (i=0; i<amount; i++) {
+ dest[index_o + i] = bank->force * src[bank->index + i];
+ }
left -= amount;
bank->index += amount;
@@ -124,7 +128,7 @@ static ssize_t stream_fill(xas_bank *bank,
xas_bank_stop(bank);
}
} else {
- memset(ptr(stream, samples, index_o),
+ memset(ptr(stream, dest, index_o),
'\0',
left * stream->channels * stream->sample_size);