[mupen64plus-audio-sdl] 106/163: Use speex as resampler for mupen64plus

Sven Eckelmann ecsv-guest at moszumanska.debian.org
Thu Nov 26 05:53:25 UTC 2015


This is an automated email from the git hooks/post-receive script.

ecsv-guest pushed a commit to branch armhf_test
in repository mupen64plus-audio-sdl.

commit 9675566a3eff7e3cea8508c59bba2c2f72b26b66
Author: Sven Eckelmann <sven at narfation.org>
Date:   Sun Sep 23 23:23:44 2012 +0200

    Use speex as resampler for mupen64plus
---
 debian/changelog                     |   2 +
 debian/patches/series                |   1 +
 debian/patches/speex_resampler.patch | 101 +++++++++++++++++++++++++++++++++++
 3 files changed, 104 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 024db0f..1bbaad8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,8 @@
 mupen64plus-audio-sdl (1.99.5+4+761b386e52de-2) UNRELEASED; urgency=low
 
   * Upgraded to policy 3.9.4, no changes required
+  * debian/patches:
+    - Add speex_resampler.patch, Use speex as resampler for mupen64plus
 
  -- Sven Eckelmann <sven at narfation.org>  Wed, 19 Sep 2012 08:49:48 +0200
 
diff --git a/debian/patches/series b/debian/patches/series
index adc6372..13a427d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 disable_oss.patch
+speex_resampler.patch
diff --git a/debian/patches/speex_resampler.patch b/debian/patches/speex_resampler.patch
new file mode 100644
index 0000000..e9d81a9
--- /dev/null
+++ b/debian/patches/speex_resampler.patch
@@ -0,0 +1,101 @@
+Description: Use speex as resampler for mupen64plus
+Author: Sven Eckelmann <sven at narfation.org>
+
+---
+diff --git a/projects/unix/Makefile b/projects/unix/Makefile
+index ccf93cb4e661cfdc7078a70f6158b0aa17ea37e9..92112c865588757f990ecd9803d7b4b507927acf 100644
+--- a/projects/unix/Makefile
++++ b/projects/unix/Makefile
+@@ -166,16 +166,26 @@ ifeq ($(OS),LINUX)
+     LDLIBS += $(shell sdl-config --libs)
+ endif
+ 
+-# test for presence of libsamplerate
+-ifneq ($(strip $(shell pkg-config samplerate --modversion 2> /dev/null)),)
+-  ifneq ($(NO_RESAMP), 1)
+-    # set libsamplerate flags and libraries
+-    CFLAGS	+= $(shell pkg-config samplerate --cflags) -DUSE_SRC
+-    LDLIBS += $(shell pkg-config samplerate --libs)
++ifneq ($(NO_RESAMP), 1)
++  # test for presence of speexdsp
++  ifneq ($(strip $(shell pkg-config speexdsp --modversion 2> /dev/null)),)
++    # set speexdsp flags and libraries
++    CFLAGS += $(shell pkg-config speexdsp --cflags) -DUSE_SPEEX
++    LDLIBS += $(shell pkg-config speexdsp --libs)
++  else
++    # warn user
++    $(warning No libspeexdsp development libraries found.  Mupen64plus-sdl-audio will be tried to build against libsamplerate.)
++
++    # test for presence of libsamplerate
++    ifneq ($(strip $(shell pkg-config samplerate --modversion 2> /dev/null)),)
++      # set libsamplerate flags and libraries
++      CFLAGS += $(shell pkg-config samplerate --cflags) -DUSE_SRC
++      LDLIBS += $(shell pkg-config samplerate --libs)
++    else
++      # warn user
++      $(warning No libsamplerate development libraries found.  Mupen64plus-sdl-audio will be built without Best Quality SINC resampler.)
++    endif
+   endif
+-else
+-  # warn user
+-  $(warning No libsamplerate development libraries found.  Mupen64plus-sdl-audio will be built without Best Quality SINC resampler.)
+ endif
+ 
+ # set mupen64plus core API header path
+diff --git a/src/main.c b/src/main.c
+index 0f8bce5728be4e41d2e1e3ddc679d2604b516d7a..c85eb0224aca084f0cb9b1869094e4ede9e05e1d 100644
+--- a/src/main.c
++++ b/src/main.c
+@@ -32,6 +32,9 @@
+ #ifdef USE_SRC
+ #include <samplerate.h>
+ #endif
++#ifdef USE_SPEEX
++#include <speex/speex_resampler.h>
++#endif
+ 
+ #define M64P_PLUGIN_PROTOTYPES 1
+ #include "m64p_types.h"
+@@ -448,12 +451,42 @@ static int error;
+ static SRC_STATE *src_state;
+ static SRC_DATA src_data;
+ #endif
++#ifdef USE_SPEEX
++SpeexResamplerState* spx_state = NULL;
++static int error;
++#endif
+ 
+ static int resample(unsigned char *input, int input_avail, int oldsamplerate, unsigned char *output, int output_needed, int newsamplerate)
+ {
+     int *psrc = (int*)input;
+     int *pdest = (int*)output;
+     int i = 0, j = 0;
++
++#ifdef USE_SPEEX
++    spx_uint32_t in_len, out_len;
++    if(Resample == 2)
++    {
++        if(spx_state == NULL)
++        {
++            spx_state = speex_resampler_init(2, oldsamplerate, newsamplerate, SPEEX_RESAMPLER_QUALITY_DESKTOP,  &error);
++            if(spx_state == NULL)
++            {
++                memset(output, 0, output_needed);
++                return 0;
++            }
++        }
++        speex_resampler_set_rate(spx_state, oldsamplerate, newsamplerate);
++        in_len = input_avail / 4;
++        out_len = output_needed / 4;
++
++        if ((error = speex_resampler_process_interleaved_int(spx_state, (const spx_int16_t *)input, &in_len, (spx_int16_t *)output, &out_len)))
++        {
++            memset(output, 0, output_needed);
++            return input_avail;  // number of bytes consumed
++        }
++        return in_len * 4;
++    }
++#endif
+ #ifdef USE_SRC
+     if(Resample == 2)
+     {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mupen64plus-audio-sdl.git



More information about the Pkg-games-commits mailing list