diff options
Diffstat (limited to 'src/crossfade.c')
-rw-r--r-- | src/crossfade.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/crossfade.c b/src/crossfade.c index 27a1c3642..a65d304e8 100644 --- a/src/crossfade.c +++ b/src/crossfade.c @@ -58,9 +58,9 @@ void cross_fade_apply(struct music_chunk *a, const struct music_chunk *b, assert(current_chunk <= num_chunks); - size = b->chunkSize > a->chunkSize - ? a->chunkSize - : b->chunkSize; + size = b->length > a->length + ? a->length + : b->length; pcm_mix(a->data, b->data, @@ -68,14 +68,14 @@ void cross_fade_apply(struct music_chunk *a, const struct music_chunk *b, format, ((float)current_chunk) / num_chunks); - if (b->chunkSize > a->chunkSize) { + if (b->length > a->length) { /* the second buffer is larger than the first one: there is unmixed rest at the end. Copy it over. The output buffer API guarantees that there is enough room in a->data. */ - memcpy(a->data + a->chunkSize, - b->data + a->chunkSize, - b->chunkSize - a->chunkSize); - a->chunkSize = b->chunkSize; + memcpy(a->data + a->length, + b->data + a->length, + b->length - a->length); + a->length = b->length; } } |