[xiph-commits] r18876 - trunk/squishyball

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Tue Mar 12 13:04:14 PDT 2013


Author: xiphmont
Date: 2013-03-12 13:04:14 -0700 (Tue, 12 Mar 2013)
New Revision: 18876

Modified:
   trunk/squishyball/audio.c
Log:
From: "Kyle J. McKay" <mackyle at gmail.com>
Subject: [PATCH 5/6] Do not distort short audio files during playback

Correct crosslap window setup for very short samples; rather than
trying to pad/extend, just reduce the wondow size.



Modified: trunk/squishyball/audio.c
===================================================================
--- trunk/squishyball/audio.c	2013-03-12 20:02:24 UTC (rev 18875)
+++ trunk/squishyball/audio.c	2013-03-12 20:04:14 UTC (rev 18876)
@@ -425,6 +425,12 @@
   int i;
   int fragsamples = pcm[0]->rate/10;  /* 100ms */
   float mul = (pcm[0]->bits==24 ? 8388608.f : 32768.f) * .0625;
+  int bps=(pcm[0]->bits+7)/8;
+  int ch=pcm[0]->ch;
+  int bpf=ch*bps;
+  int maxsamples = pcm[0]->size / bpf;
+  if (fragsamples * 3 > maxsamples)
+    fragsamples = maxsamples / 3;
   /* precompute the fades/beeps */
   float *fadewindow1 = *fw1 = calloc(fragsamples,sizeof(*fadewindow1));
   float *fadewindow2 = *fw2 = calloc(fragsamples,sizeof(*fadewindow2));



More information about the commits mailing list