gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash backend/sound_handler_sdl.cpp ChangeLog


From: Martin Guy
Subject: [Gnash-commit] gnash backend/sound_handler_sdl.cpp ChangeLog
Date: Mon, 30 Apr 2007 19:13:04 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Martin Guy <martinwguy> 07/04/30 19:13:03

Modified files:
        backend        : sound_handler_sdl.cpp 
        .              : ChangeLog 

Log message:
                * backend/sound_handler_sdl.cpp: Fix volume scaling in 8->16 bit
                  raw data conversion (closes bug #19747)
                  and convert cascaded ifs to a case.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_sdl.cpp?cvsroot=gnash&r1=1.52&r2=1.53
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3048&r2=1.3049

Patches:
Index: backend/sound_handler_sdl.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_sdl.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- backend/sound_handler_sdl.cpp       18 Apr 2007 20:56:39 -0000      1.52
+++ backend/sound_handler_sdl.cpp       30 Apr 2007 19:13:03 -0000      1.53
@@ -18,7 +18,7 @@
 // Based on sound_handler_sdl.cpp by Thatcher Ulrich http://tulrich.com 2003
 // which has been donated to the Public Domain.
 
-// $Id: sound_handler_sdl.cpp,v 1.52 2007/04/18 20:56:39 martinwguy Exp $
+// $Id: sound_handler_sdl.cpp,v 1.53 2007/04/30 19:13:03 martinwguy Exp $
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -160,7 +160,8 @@
        sound_data* sounddata = m_sound_data[handle_id];
 
        // Handling of the sound data
-       if (sounddata->format == FORMAT_NATIVE16)
+       switch (sounddata->format) {
+       case FORMAT_NATIVE16:
        {
                int16_t*        adjusted_data = 0;
                int     adjusted_size = 0;
@@ -191,8 +192,11 @@
                        sound->position = sounddata->data_size;
                        sound->set_raw_data(sounddata->data);
                }
-       } else if (sounddata->format == FORMAT_MP3) {
+           }
+           break;
 
+       case FORMAT_MP3:
+           {
                // Reallocate the required memory.
                Uint8* tmp_data = new Uint8[data_bytes + sounddata->data_size];
                memcpy(tmp_data, sounddata->data, sounddata->data_size);
@@ -211,7 +215,10 @@
                        sound->data_size = sounddata->data_size;
                }
 
-       } else {
+           }
+           break;
+
+       default:
                gnash::log_error(_("Behavior for this audio codec %d is 
unknown.  Please send this SWF to the developers"), (int)(sounddata->format));
        }
 
@@ -556,14 +563,14 @@
 
        if (sample_size == 1)
        {
-               // Expand from 8 bit to 16 bit.
+               // Expand from 8 bit unsigned to 16 bit signed.
                uint8_t*        in = (uint8_t*) data;
                for (int i = 0; i < output_sample_count; i += dup)
                {
                        uint8_t val = *in;
                        for (int j = 0; j < dup; j++)
                        {
-                               *out_data++ = (int(val) - 128);
+                               *out_data++ = (int(val) - 128) * 256 ;
                        }
                        in += inc;
                }

Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3048
retrieving revision 1.3049
diff -u -b -r1.3048 -r1.3049
--- ChangeLog   30 Apr 2007 18:53:25 -0000      1.3048
+++ ChangeLog   30 Apr 2007 19:13:03 -0000      1.3049
@@ -1,3 +1,9 @@
+2007-04-30 Martin Guy <address@hidden>
+
+       * backend/sound_handler_sdl.cpp: Fix volume scaling in 8->16 bit
+         raw data conversion (closes bug #19747)
+         and convert cascaded ifs to a case.
+
 2007-04-30 Sandro Santilli <address@hidden>
 
        * Makefile.am: don't put 'po' in EXTRA_DIST, as it's already




reply via email to

[Prev in Thread] Current Thread [Next in Thread]