[mupen64plus-audio-sdl] 120/163: Imported Upstream version 1.99.5+24+691319870467
Sven Eckelmann
ecsv-guest at moszumanska.debian.org
Thu Nov 26 05:53:31 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 31aed631f4b614d7de6e657c532ad0607c0b934d
Author: Sven Eckelmann <sven at narfation.org>
Date: Fri Feb 8 09:22:56 2013 +0100
Imported Upstream version 1.99.5+24+691319870467
---
projects/unix/Makefile | 95 ++++++++++++++++++++++++++++++++++----------------
src/main.c | 5 +++
2 files changed, 70 insertions(+), 30 deletions(-)
diff --git a/projects/unix/Makefile b/projects/unix/Makefile
index 539d925..129fb8d 100644
--- a/projects/unix/Makefile
+++ b/projects/unix/Makefile
@@ -22,7 +22,7 @@
# Makefile for SDL Audio plugin in Mupen64plus
# detect operation system
-UNAME = $(shell uname -s)
+UNAME ?= $(shell uname -s)
OS := NONE
ifeq ("$(UNAME)","Linux")
OS = LINUX
@@ -60,6 +60,13 @@ ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
SHARED = -shared
SO_EXTENSION = so
endif
+ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW")
+ OS = MINGW
+ SHARED = -shared
+ SO_EXTENSION = dll
+ PIC = 0
+ NO_OSS = 1
+endif
ifeq ("$(OS)","NONE")
$(error OS type "$(UNAME)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
endif
@@ -111,9 +118,14 @@ endif
# base CFLAGS, LDLIBS, and LDFLAGS
OPTFLAGS ?= -O3
-CFLAGS += $(OPTFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src
+WARNFLAGS ?= -Wall
+CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src
LDFLAGS += $(SHARED)
+# default configuration programs
+SDL_CONFIG = $(CROSS_COMPILE)sdl-config
+PKG_CONFIG = $(CROSS_COMPILE)pkg-config
+
# Since we are building a shared library, we must compile with -fPIC on some architectures
# On 32-bit x86 systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch
ifeq ($(PIC), 1)
@@ -142,13 +154,25 @@ ifeq ($(OS), LINUX)
LDLIBS += -ldl
endif
ifeq ($(OS), OSX)
+ # Select the proper SDK
+ # Also, SDKs are stored in a different location since XCode 4.3
+ OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .)
+ OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .)
+ OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .)
+ OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`")
+ ifeq ($(OSX_XCODEGE43), 11)
+ OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
+ else
+ OSX_SYSROOT := /Developer/SDKs
+ endif
+
ifeq ($(CPU), X86)
ifeq ($(ARCH_DETECTED), 64BITS)
- CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
+ CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk
LDFLAGS += -arch x86_64
LDLIBS += -ldl
else
- CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
+ CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk
LDFLAGS += -arch i686
LDLIBS += -ldl -read_only_relocs suppress
endif
@@ -156,30 +180,32 @@ ifeq ($(OS), OSX)
endif
# test for presence of SDL
-ifeq ($(shell which sdl-config 2>/dev/null),)
+ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),)
$(error No SDL development libraries found!)
endif
ifeq ($(OS),FREEBSD)
- CFLAGS += $(shell sdl-config --cflags)
- LDLIBS += $(shell sdl-config --libs)
+ CFLAGS += $(shell $(SDL_CONFIG) --cflags)
+ LDLIBS += $(shell $(SDL_CONFIG) --libs)
endif
ifeq ($(OS),OSX)
- CFLAGS += $(shell sdl-config --cflags)
- # sdl-config on mac screws up when we're trying to build a library and not an executable
- # SDL 1.3 is supposed to fix that, if it's ever released
- LDLIBS += -L/usr/local/lib -lSDL -Wl,-framework,Cocoa
+ CFLAGS += $(shell $(SDL_CONFIG) --cflags)
+ LDLIBS += $(shell $(SDL_CONFIG) --libs)
endif
ifeq ($(OS),LINUX)
- CFLAGS += $(shell sdl-config --cflags)
- LDLIBS += $(shell sdl-config --libs)
+ CFLAGS += $(shell $(SDL_CONFIG) --cflags)
+ LDLIBS += $(shell $(SDL_CONFIG) --libs)
+endif
+ifeq ($(OS),MINGW)
+ CFLAGS += $(shell $(SDL_CONFIG) --cflags)
+ LDLIBS += $(shell $(SDL_CONFIG) --libs)
endif
# test for presence of speexdsp
-ifneq ($(strip $(shell pkg-config speexdsp --modversion 2> /dev/null)),)
+ifneq ($(strip $(shell $(PKG_CONFIG) speexdsp --modversion 2> /dev/null)),)
ifneq ($(NO_SPEEX), 1)
# set speexdsp flags and libraries
- CFLAGS += $(shell pkg-config speexdsp --cflags) -DUSE_SPEEX
- LDLIBS += $(shell pkg-config speexdsp --libs)
+ CFLAGS += $(shell $(PKG_CONFIG) speexdsp --cflags) -DUSE_SPEEX
+ LDLIBS += $(shell $(PKG_CONFIG) speexdsp --libs)
endif
else
# warn user
@@ -187,11 +213,11 @@ else
endif
# test for presence of libsamplerate
-ifneq ($(strip $(shell pkg-config samplerate --modversion 2> /dev/null)),)
+ifneq ($(strip $(shell $(PKG_CONFIG) samplerate --modversion 2> /dev/null)),)
ifneq ($(NO_SRC), 1)
# set libsamplerate flags and libraries
- CFLAGS += $(shell pkg-config samplerate --cflags) -DUSE_SRC
- LDLIBS += $(shell pkg-config samplerate --libs)
+ CFLAGS += $(shell $(PKG_CONFIG) samplerate --cflags) -DUSE_SRC
+ LDLIBS += $(shell $(PKG_CONFIG) samplerate --libs)
endif
else
# warn user
@@ -236,7 +262,7 @@ endif
endif
# set base program pointers and flags
-CC ?= gcc
+CC = $(CROSS_COMPILE)gcc
RM ?= rm -f
INSTALL ?= install
MKDIR ?= mkdir -p
@@ -248,7 +274,9 @@ ifeq ($(DEBUG),1)
CFLAGS += -g
INSTALL_STRIP_FLAG ?=
else
- INSTALL_STRIP_FLAG ?= -s
+ ifneq ($(OS),OSX)
+ INSTALL_STRIP_FLAG ?= -s
+ endif
endif
# set installation options
@@ -263,25 +291,26 @@ ifeq ($(PLUGINDIR),)
endif
SRCDIR = ../../src
-OBJDIR = _obj
+OBJDIR = _obj$(POSTFIX)
# list of source files to compile
SOURCE = \
$(SRCDIR)/main.c \
- $(SRCDIR)/volume.c \
- $(SRCDIR)/osal_dynamiclib_unix.c
+ $(SRCDIR)/volume.c
+
+ifeq ($(OS),MINGW)
+SOURCE += $(SRCDIR)/osal_dynamiclib_win32.c
+else
+SOURCE += $(SRCDIR)/osal_dynamiclib_unix.c
+endif
# generate a list of object files build, make a temporary directory for them
OBJECTS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(filter %.c, $(SOURCE)))
OBJDIRS = $(dir $(OBJECTS))
$(shell $(MKDIR) $(OBJDIRS))
-# build dependency files
-CFLAGS += -MD
--include $(OBJECTS:.o=.d)
-
# build targets
-TARGET = mupen64plus-audio-sdl.$(SO_EXTENSION)
+TARGET = mupen64plus-audio-sdl$(POSTFIX).$(SO_EXTENSION)
targets:
@echo "Mupen64Plus-audio-sdl makefile. "
@@ -295,10 +324,12 @@ targets:
@echo " BITS=32 == build 32-bit binaries on 64-bit machine"
@echo " APIDIR=path == path to find Mupen64Plus Core headers"
@echo " OPTFLAGS=flag == compiler optimization (default: -O3)"
+ @echo " WARNFLAGS=flag == compiler warning levels (default: -Wall)"
@echo " PIC=(1|0) == Force enable/disable of position independent code"
@echo " NO_SRC=1 == build without libsamplerate; disables src-* high-quality audio resampling"
@echo " NO_SPEEX=1 == build without libspeexdsp; disables speex-* high-quality audio resampling"
@echo " NO_OSS=1 == build without OSS; disables Open Sound System support"
+ @echo " POSTFIX=name == String added to the name of the the build (default: '')"
@echo " Install Options:"
@echo " PREFIX=path == install/uninstall prefix (default: /usr/local)"
@echo " LIBDIR=path == library prefix (default: PREFIX/lib)"
@@ -320,10 +351,14 @@ uninstall:
$(RM) "$(DESTDIR)$(PLUGINDIR)/$(TARGET)"
clean:
- $(RM) -r ./_obj $(TARGET)
+ $(RM) -r $(OBJDIR) $(TARGET)
rebuild: clean all
+# build dependency files
+CFLAGS += -MD
+-include $(OBJECTS:.o=.d)
+
ifeq ($(LTO), 1)
CFLAGS += -flto
LDFLAGS += -fuse-linker-plugin $(CFLAGS)
diff --git a/src/main.c b/src/main.c
index c23c660..ef59dd9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -597,8 +597,13 @@ static void my_audio_callback(void *userdata, unsigned char *stream, int len)
else
#endif
{
+#if SDL_VERSION_ATLEAST(1,3,0)
+#warning Mixing disabled with SDL >= 1.3 because it creates distorted audio
+ input_used = resample(primaryBuffer, buffer_pos, oldsamplerate, stream, len, newsamplerate);
+#else
input_used = resample(primaryBuffer, buffer_pos, oldsamplerate, mixBuffer, len, newsamplerate);
SDL_MixAudio(stream, mixBuffer, len, VolSDL);
+#endif
}
memmove(primaryBuffer, &primaryBuffer[input_used], buffer_pos - input_used);
buffer_pos -= input_used;
--
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