gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-


From: Sandro Santilli
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-2238-geef4c8f
Date: Wed, 16 Dec 2015 12:01:49 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  eef4c8f3008ae2efd63f2ba89cd59825417449c0 (commit)
      from  ad25f7cfce18e59cb71a8d95f6c8a3181f83bec3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=eef4c8f3008ae2efd63f2ba89cd59825417449c0


commit eef4c8f3008ae2efd63f2ba89cd59825417449c0
Author: Sandro Santilli <address@hidden>
Date:   Wed Dec 16 13:01:04 2015 +0100

    Remove duplicated audio mixing code
    
    NOTE: this is untested as it takes Amiga and Haiku to test

diff --git a/libsound/aos4/sound_handler_ahi.cpp 
b/libsound/aos4/sound_handler_ahi.cpp
index 70e866c..b355202 100644
--- a/libsound/aos4/sound_handler_ahi.cpp
+++ b/libsound/aos4/sound_handler_ahi.cpp
@@ -53,11 +53,6 @@
 // Mixing and decoding debugging
 //#define GNASH_DEBUG_MIXING
 
-/* The volume ranges from 0 - 128 */
-#define MIX_MAXVOLUME 128
-#define ADJUST_VOLUME(s, v)    (s = (s*v)/MIX_MAXVOLUME)
-#define ADJUST_VOLUME_U8(s, v) (s = (((s-128)*v)/MIX_MAXVOLUME)+128)
-
 int audioTaskID;
 
 static int
@@ -328,67 +323,12 @@ AOS4_sound_handler::fetchSamples(std::int16_t* to, 
unsigned int nSamples)
        }
 }
 
-void 
-AOS4_sound_handler::MixAudio (std::uint8_t *dst, const std::uint8_t *src, 
std::uint32_t len, int volume)
-{
-       std::uint16_t format;
-
-       if ( volume == 0 ) 
-       {
-               return;
-       }
-
-       format = AHIST_S16S;
-
-       /* Actually we have a fixed audio format */
-       switch (format) 
-       {
-               case AHIST_S16S:
-               {
-                       std::int16_t src1, src2;
-                       int dst_sample;
-                       const int max_audioval = ((1<<(16-1))-1);
-                       const int min_audioval = -(1<<(16-1));
-
-                       len /= 2;
-                       while ( len-- ) 
-                       {
-                               src1 = ((src[0])<<8|src[1]);
-                               ADJUST_VOLUME(src1, volume);
-                               src2 = ((dst[0])<<8|dst[1]);
-                               src += 2;
-                               dst_sample = src1+src2;
-                               if ( dst_sample > max_audioval ) 
-                               {
-                                       dst_sample = max_audioval;
-                               } 
-                               else
-                               if ( dst_sample < min_audioval ) 
-                               {
-                                       dst_sample = min_audioval;
-                               }
-                               dst[1] = dst_sample & 0xFF;
-                               dst_sample >>= 8;
-                               dst[0] = dst_sample & 0xFF;
-                               dst += 2;
-                       }
-               }
-               break;
-       }
-       
-}
-
 void
 AOS4_sound_handler::mix(std::int16_t* outSamples, std::int16_t* inSamples, 
unsigned int nSamples, float volume)
 {
        if (!_closing)
        {
-           unsigned int nBytes = nSamples*2;
-
-           std::uint8_t *out = reinterpret_cast<std::uint8_t*>(outSamples);
-       std::uint8_t* in = reinterpret_cast<std::uint8_t*>(inSamples);
-
-           MixAudio(out, in, nBytes, static_cast<int>(MIX_MAXVOLUME*volume));
+        sound_handler::mix(outSamples, inSamples, nSamples, volume);
        }
 }
 
diff --git a/libsound/aos4/sound_handler_ahi.h 
b/libsound/aos4/sound_handler_ahi.h
index d6fc079..8d6ec20 100644
--- a/libsound/aos4/sound_handler_ahi.h
+++ b/libsound/aos4/sound_handler_ahi.h
@@ -92,8 +92,6 @@ private:
     void mix(std::int16_t* outSamples, std::int16_t* inSamples,
                 unsigned int nSamples, float volume);
 
-       void MixAudio (std::uint8_t *dst, const std::uint8_t *src, 
std::uint32_t len, int volume);
-
 public:
 
     AOS4_sound_handler(media::MediaHandler* m);
diff --git a/libsound/mkit/sound_handler_mkit.cpp 
b/libsound/mkit/sound_handler_mkit.cpp
index ff17884..86235ee 100644
--- a/libsound/mkit/sound_handler_mkit.cpp
+++ b/libsound/mkit/sound_handler_mkit.cpp
@@ -37,12 +37,6 @@
 // Mixing and decoding debugging
 //#define GNASH_DEBUG_MIXING
 
-/* The volume ranges from 0 - 128 */
-#define MIX_MAXVOLUME 128
-#define ADJUST_VOLUME(s, v)    (s = (s*v)/MIX_MAXVOLUME)
-#define ADJUST_VOLUME_U8(s, v)    (s = (((s-128)*v)/MIX_MAXVOLUME)+128)
-
-
 namespace gnash {
 namespace sound {
 
@@ -228,70 +222,6 @@ Mkit_sound_handler::tell(int soundHandle)
     return sound_handler::tell(soundHandle);
 }
 
-void 
-Mkit_sound_handler::MixAudio (std::uint8_t *dst, const std::uint8_t *src, 
std::uint32_t len, int volume)
-{
-    //std::uint16_t format;
-
-    if ( volume == 0 ) 
-    {
-        return;
-    }
-
-    //format = AHIST_S16S;
-
-    /* Actually we have a fixed audio format */
-    //switch (format) 
-    {
-        //case AHIST_S16S:
-        {
-            std::int16_t src1, src2;
-            int dst_sample;
-            const int max_audioval = ((1<<(16-1))-1);
-            const int min_audioval = -(1<<(16-1));
-
-            len /= 2;
-            while ( len-- ) 
-            {
-                src1 = ((src[0])<<8|src[1]);
-                ADJUST_VOLUME(src1, volume);
-                src2 = ((dst[0])<<8|dst[1]);
-                src += 2;
-                dst_sample = src1+src2;
-                if ( dst_sample > max_audioval ) 
-                {
-                    dst_sample = max_audioval;
-                } 
-                else
-                if ( dst_sample < min_audioval ) 
-                {
-                    dst_sample = min_audioval;
-                }
-                dst[1] = dst_sample & 0xFF;
-                dst_sample >>= 8;
-                dst[0] = dst_sample & 0xFF;
-                dst += 2;
-            }
-        }
-        //break;
-    }
-    
-}
-
-void
-Mkit_sound_handler::mix(std::int16_t* outSamples, std::int16_t* inSamples, 
unsigned int nSamples, float volume)
-{
-    //if (!_closing)
-    {
-        unsigned int nBytes = nSamples*2;
-
-        std::uint8_t *out = reinterpret_cast<std::uint8_t*>(outSamples);
-        std::uint8_t* in = reinterpret_cast<std::uint8_t*>(inSamples);
-
-        MixAudio(out, in, nBytes, MIX_MAXVOLUME*volume);
-    }
-}
-
 void
 Mkit_sound_handler::plugInputStream(std::unique_ptr<InputStream> newStreamer)
 {
diff --git a/libsound/mkit/sound_handler_mkit.h 
b/libsound/mkit/sound_handler_mkit.h
index f77d844..9cad2ac 100644
--- a/libsound/mkit/sound_handler_mkit.h
+++ b/libsound/mkit/sound_handler_mkit.h
@@ -57,12 +57,6 @@ class Mkit_sound_handler : public sound_handler
     /// Mutex for making sure threads doesn't mess things up
     std::mutex _mutex;
 
-    // See dox in sound_handler.h
-    void mix(std::int16_t* outSamples, std::int16_t* inSamples,
-                unsigned int nSamples, float volume);
-
-    void MixAudio (std::uint8_t *dst, const std::uint8_t *src, std::uint32_t 
len, int volume);
-
 public:
     Mkit_sound_handler(media::MediaHandler* m);
 

-----------------------------------------------------------------------

Summary of changes:
 libsound/aos4/sound_handler_ahi.cpp  |   62 +-----------------------------
 libsound/aos4/sound_handler_ahi.h    |    2 -
 libsound/mkit/sound_handler_mkit.cpp |   70 ----------------------------------
 libsound/mkit/sound_handler_mkit.h   |    6 ---
 4 files changed, 1 insertions(+), 139 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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