[Swfdec] 2 commits - libswfdec/swfdec_audio_event.c libswfdec/swfdec_sound.c

Pekka Lampila medar at kemper.freedesktop.org
Sun Nov 18 07:54:20 PST 2007


 libswfdec/swfdec_audio_event.c |    8 ++++----
 libswfdec/swfdec_sound.c       |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 078390676de6ea85b6f36554ee8657c21b3dab64
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Sun Nov 18 17:50:07 2007 +0200

    Fix an oops in the sound envelop code

diff --git a/libswfdec/swfdec_audio_event.c b/libswfdec/swfdec_audio_event.c
index dbd6303..a0d1581 100644
--- a/libswfdec/swfdec_audio_event.c
+++ b/libswfdec/swfdec_audio_event.c
@@ -64,10 +64,10 @@ swfdec_audio_event_get_envelop_volume (SwfdecAudioEvent *event, guint pos,
     return 1;
 
   if (pos == 0)
-    return event->envelope[pos].volume[channel] / 32768;
+    return event->envelope[pos].volume[channel] / 32768.0;
 
   if (pos == event->n_envelopes)
-    return event->envelope[pos - 1].volume[channel] / 32768;
+    return event->envelope[pos - 1].volume[channel] / 32768.0;
 
   distance = event->envelope[pos].offset - event->envelope[pos - 1].offset;
   g_return_val_if_fail (offset >= event->envelope[pos - 1].offset, 1);
@@ -75,7 +75,7 @@ swfdec_audio_event_get_envelop_volume (SwfdecAudioEvent *event, guint pos,
   g_return_val_if_fail (offset < distance, 1);
 
   return (event->envelope[pos - 1].volume[channel] * (1 - offset / distance) +
-      event->envelope[pos].volume[channel] * (offset / distance)) / 32768;
+      event->envelope[pos].volume[channel] * (offset / distance)) / 32768.0;
 }
 
 static void
@@ -120,7 +120,7 @@ swfdec_audio_event_render (SwfdecAudio *audio, gint16* dest, guint start,
       pos++;
     if (channels == 1) {
       dest[i] *= swfdec_audio_event_get_envelop_volume (event, pos,
-	  global_offset + i, 0) * 0.5 +
+	  global_offset + (i / 2), 0) * 0.5 +
 	  swfdec_audio_event_get_envelop_volume (event, pos,
 	    global_offset + (i / 2), 1);
     } else {
commit 707a2b8769bd2503a836aaedcb9aae61e7177ed9
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Sun Nov 18 17:36:17 2007 +0200

    Add a SWFDEC_FIXME about too big envelope volumes

diff --git a/libswfdec/swfdec_sound.c b/libswfdec/swfdec_sound.c
index 830e40e..4b97df5 100644
--- a/libswfdec/swfdec_sound.c
+++ b/libswfdec/swfdec_sound.c
@@ -368,7 +368,7 @@ swfdec_sound_parse_chunk (SwfdecSwfDecoder *s, SwfdecBits *b, int id)
     for (j = 0; j < 2; j++) {
       chunk->envelope[i].volume[j] = swfdec_bits_get_u16 (b);
       if (chunk->envelope[i].volume[j] > 32768) {
-	SWFDEC_ERROR ("envelope volume too big: %u > 32768",
+	SWFDEC_FIXME ("too big envelope volumes (%u > 32768) not handled correctly",
 	    chunk->envelope[i].volume[j]);
 	chunk->envelope[i].volume[j] = 32768;
       }


More information about the Swfdec mailing list