[xiph-commits] r18442 - trunk/spectrum
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Tue Jul 3 19:23:37 PDT 2012
Author: xiphmont
Date: 2012-07-03 19:23:37 -0700 (Tue, 03 Jul 2012)
New Revision: 18442
Modified:
trunk/spectrum/version.h
trunk/spectrum/wave_process.c
Log:
Alter trigger code to always look for latest trigger, else it will get
increasingly behind (up to the depth of the block) with missed
updates.
Modified: trunk/spectrum/version.h
===================================================================
--- trunk/spectrum/version.h 2012-07-04 01:37:29 UTC (rev 18441)
+++ trunk/spectrum/version.h 2012-07-04 02:23:37 UTC (rev 18442)
@@ -1,2 +1,2 @@
#define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Tue Jul 3 21:04:57 EDT 2012] */
+/* DO NOT EDIT: Automated versioning hack [Tue Jul 3 22:17:12 EDT 2012] */
Modified: trunk/spectrum/wave_process.c
===================================================================
--- trunk/spectrum/wave_process.c 2012-07-04 01:37:29 UTC (rev 18441)
+++ trunk/spectrum/wave_process.c 2012-07-04 02:23:37 UTC (rev 18442)
@@ -226,7 +226,11 @@
/* returns location of trigger as number of seconds behind head of
blockbuffer, or <0 if none */
-static float trigger_search(triggerstate *t, float *blockbuffer, int bn, int triggertype){
+static float trigger_search(triggerstate *t, float *blockbuffer,
+ int bn, int triggertype){
+
+ float ret = -1;
+
if(t->lappos+t->sample_n>bn || t->lappos<0){
/* we got behind */
t->lappos=bn-t->sample_n;
@@ -236,7 +240,7 @@
while(1){
if(t->lapfill<2){
if(trigger_try_lap(t,blockbuffer, blocksize)){
- return -1; /* need more blockbuffer data */
+ return ret;
}
}else{
@@ -244,14 +248,14 @@
int span_begin = t->spansamples * t->oversample_factor;
if(t->triggersearch <= span_begin){
- return -1; /* need more blockbuffer data */
+ return ret;
}else{
/* distance back from logical head of the sample buffer to lap tail */
int overlap_end = (t->lappos + t->sample_n/2) * t->oversample_factor;
if(t->triggersearch <= overlap_end){
if(trigger_try_lap(t,blockbuffer,blocksize)){
- return -1; /* need more blockbuffer data */
+ return ret;
}
}else{
@@ -276,24 +280,20 @@
if(prev<=0 && *lap>0){
/* linear interpolation can further refine the result in most cases */
float x = *lap / (*lap-prev);
- float ret = (t->triggersearch+x)/
+ ret = (t->triggersearch+x)/
(t->rate*t->oversample_factor);
/* apply holdoff */
t->triggersearch -= t->rate*t->oversample_factor/t->holdoffd;
- /* return trigger */
- return ret;
}
break;
case 2: /* -0 */
if(prev>0 && *lap<=0){
/* linear interpolation can further refine the result in most cases */
float x = *lap / (*lap-prev);
- float ret = (t->triggersearch+x)/
+ ret = (t->triggersearch+x)/
(t->rate*t->oversample_factor);
/* apply holdoff */
t->triggersearch -= t->rate*t->oversample_factor/t->holdoffd;
- /* return trigger */
- return ret;
}
break;
}
More information about the commits
mailing list