summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libaf/af.c2
-rw-r--r--libaf/af_channels.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/libaf/af.c b/libaf/af.c
index 35e2a925a5..9313dffd27 100644
--- a/libaf/af.c
+++ b/libaf/af.c
@@ -370,7 +370,7 @@ af_data_t* af_play(af_stream_t* s, af_data_t* data)
needed */
inline int af_lencalc(frac_t mul, af_data_t* d){
register int t = d->bps*d->nch;
- return t*(((d->len/t)*mul.n + 1)/mul.d);
+ return t*(((d->len/t)*mul.n)/mul.d + 1);
}
/* Calculate how long the output from the filters will be given the
diff --git a/libaf/af_channels.c b/libaf/af_channels.c
index 042023f49f..fe2a05f231 100644
--- a/libaf/af_channels.c
+++ b/libaf/af_channels.c
@@ -122,7 +122,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
// Reset unused channels if nch in < nch out
if(af->mul.n > af->mul.d)
- memset(l->audio,0,af_lencalc(af->mul, c));
+ memset(l->audio,0,(c->len*af->mul.n)/af->mul.d);
// Special case always output L & R
if(c->nch == 1){
@@ -143,7 +143,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
// Set output data
c->audio = l->audio;
- c->len = af_lencalc(af->mul, c);
+ c->len = (c->len*af->mul.n)/af->mul.d;
c->nch = l->nch;
return c;