[gegl/video-rejuvenation: 10/30] ff-load: fix audio sampling
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/video-rejuvenation: 10/30] ff-load: fix audio sampling
- Date: Tue, 27 Oct 2015 13:47:21 +0000 (UTC)
commit 551bfb7168f2017066bc440dff3a56fc4b8fb41e
Author: Øyvind Kolås <pippin gimp org>
Date: Wed Oct 7 19:56:34 2015 +0200
ff-load: fix audio sampling
operations/external/ff-load.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/operations/external/ff-load.c b/operations/external/ff-load.c
index 7745d81..1e9f50a 100644
--- a/operations/external/ff-load.c
+++ b/operations/external/ff-load.c
@@ -481,9 +481,9 @@ static void get_sample_data (Priv *p, long sample_no, float *left, float *right)
int16_t *data = (void*) af->buf;
if (p->audio_cursor_pos + af->len/4 > sample_no)
{
- int i = sample_no - no + af->len/4;
- *left = data[i*2+0] / 32768.0;
- *right = data[i*2+0] / 32768.0;
+ int i = sample_no - p->audio_cursor_pos;
+ *left = data[i*2+0] / 32767.0;
+ *right = data[i*2+1] / 32767.0;
return;
}
l = p->audio_cursor;
@@ -495,10 +495,9 @@ static void get_sample_data (Priv *p, long sample_no, float *left, float *right)
int16_t *data = (void*) af->buf;
if (no + af->len/4 > sample_no)
{
- int i = sample_no - no + af->len/4;
- *left = data[i*2+0] / 32768.0;
- *right = data[i*2+0] / 32768.0;
-
+ int i = sample_no - no;
+ *left = data[i*2+0] / 32767.0;
+ *right = data[i*2+1] / 32767.0;
p->audio_cursor = l;
p->audio_cursor_pos = no;
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]