summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2009-09-06 21:01:44 -0700
committerKeith Packard <keithp@keithp.com>2009-09-06 21:01:44 -0700
commit9e660315e1bd2bf71ab1c0574e895e1f7608a58f (patch)
tree12567ba247b10fa8f1224a92f62f4ec27653f59e
parent932f1539b38567e565fd484171c13539b1467308 (diff)
Fix cc_period_make to not get stuck on samples with matching time
When two samples have matching times, step to the second one; otherwise, we'll get stuck forever. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--ao-tools/lib/cc-period.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ao-tools/lib/cc-period.c b/ao-tools/lib/cc-period.c
index 2a4e5952..844ac79e 100644
--- a/ao-tools/lib/cc-period.c
+++ b/ao-tools/lib/cc-period.c
@@ -35,7 +35,7 @@ cc_period_make(struct cc_timedata *td, double start_time, double stop_time)
j = 0;
for (i = 0; i < pd->num; i++) {
t = start_time + i * pd->step;
- while (j < td->num - 1 && fabs(t - td->data[j].time) > fabs(t - td->data[j+1].time))
+ while (j < td->num - 1 && fabs(t - td->data[j].time) >= fabs(t - td->data[j+1].time))
j++;
pd->data[i] = td->data[j].value;
}