From 7e3fbf63bd5658a5a8d2d2b292f56da56582115a Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sun, 25 Apr 2010 20:10:09 +0000 Subject: updated to latest Makefile template version and added files needed to 'make dist' svn path=/trunk/externals/earplug~/; revision=13472 --- LICENSE.txt | 2 ++ Makefile | 82 ++++++++++++++++++++++++++++++++++++++++---------------- README.txt | 14 ++++++++++ earplug~-meta.pd | 2 +- earplug~.c | 1 + 5 files changed, 77 insertions(+), 24 deletions(-) create mode 100644 LICENSE.txt create mode 100644 README.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..a223c7c --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,2 @@ +The license of this code is unknown. Hans-Christoph Steiner's contributions +are public domain. diff --git a/Makefile b/Makefile index 5668261..7af3f28 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,10 @@ -# To use this Makefile for your project, first put the name of your library in -# LIBRARY_NAME variable. The folder for your project should have the same name -# as your library. +## Pd library template version 1.0 +# For instructions on how to use this template, see: +# http://puredata.info/docs/developer/MakefileTemplate LIBRARY_NAME = earplug~ -LIBRARY_VERSION = 0.2 -# Next, add your .c source files to the SOURCES variable. The help files will -# be included automatically +# add your .c source files to the SOURCES variable, help files will be +# included automatically SOURCES = earplug~.c # For objects that only build on certain platforms, add those to the SOURCES @@ -21,10 +20,18 @@ SOURCES_windows = # be included automatically PDOBJECTS = +# example patches and related files, in the 'examples' subfolder +EXAMPLES = + +# manuals and related files, in the 'manual' subfolder +MANUAL = + # if you want to include any other files in the source and binary tarballs, -# list them here. This can be anything from header files, READMEs, example -# patches, documentation, etc. -EXTRA_DIST = earplug~.h earplug_data.txt +# list them here. This can be anything from header files, example patches, +# documentation, etc. README.txt and LICENSE.txt are required and therefore +# automatically included +EXTRA_DIST = earplug~.h earplug_data.txt parse-to-h.pl + #------------------------------------------------------------------------------# @@ -33,6 +40,9 @@ EXTRA_DIST = earplug~.h earplug_data.txt # #------------------------------------------------------------------------------# +# get library version from meta file +LIBRARY_VERSION = $(shell sed -n 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' $(LIBRARY_NAME)-meta.pd) + # where Pd lives PD_PATH = ../../pd # where to install the library @@ -56,7 +66,7 @@ UNAME := $(shell uname -s) ifeq ($(UNAME),Darwin) CPU := $(shell uname -p) ifeq ($(CPU),arm) # iPhone/iPod Touch - SOURCES += $(SOURCES_macosx) + SOURCES += $(SOURCES_iphoneos) EXTENSION = pd_darwin OS = iphoneos IPHONE_BASE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin @@ -78,7 +88,13 @@ ifeq ($(UNAME),Darwin) EXTENSION = pd_darwin OS = macosx OPT_CFLAGS = -ftree-vectorize -ftree-vectorizer-verbose=2 -fast - FAT_FLAGS = -arch i386 -arch ppc -mmacosx-version-min=10.4 +# build universal 32-bit on 10.4 and 32/64 on newer + ifeq ($(shell uname -r | sed 's|\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*|\1|'), 8) + FAT_FLAGS = -arch ppc -arch i386 -mmacosx-version-min=10.4 + else + FAT_FLAGS = -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=10.4 + SOURCES += $(SOURCES_iphoneos) + endif CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include \ -I/Applications/Pd-extended.app/Contents/Resources/include LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup -L/sw/lib @@ -119,8 +135,7 @@ ifeq (MINGW,$(findstring MINGW,$(UNAME))) EXTENSION = dll OS = windows OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer -march=i686 -mtune=pentium4 - WINDOWS_HACKS = -D'O_NONBLOCK=1' - CFLAGS += -mms-bitfields $(WINDOWS_HACKS) + CFLAGS += -mms-bitfields LDFLAGS += -s -shared -Wl,--enable-auto-import LIBS += -L$(PD_PATH)/src -L$(PD_PATH)/bin -L$(PD_PATH)/obj -lpd -lwsock32 -lkernel32 -luser32 -lgdi32 STRIP = strip --strip-unneeded -R .note -R .comment @@ -131,7 +146,7 @@ endif CFLAGS += $(OPT_CFLAGS) -.PHONY = install libdir_install single_install install-doc install-exec install-examples clean dist etags +.PHONY = install libdir_install single_install install-doc install-exec install-examples install-manual clean dist etags all: $(SOURCES:.c=.$(EXTENSION)) @@ -152,7 +167,7 @@ install: libdir_install # The meta and help files are explicitly installed to make sure they are # actually there. Those files are not optional, then need to be there. -libdir_install: $(SOURCES:.c=.$(EXTENSION)) install-doc install-examples +libdir_install: $(SOURCES:.c=.$(EXTENSION)) install-doc install-examples install-manual $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd \ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) @@ -177,20 +192,28 @@ install-doc: test -z "$(strip $(PDOBJECTS))" || \ $(INSTALL_FILE) $(PDOBJECTS:.pd=-help.pd) \ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) -# this is the only bit not really handled well... -# $(INSTALL_FILE) README $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/README.txt -# $(INSTALL_FILE) VERSION $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/VERSION.txt -# $(INSTALL_FILE) CHANGES $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/CHANGES.txt + $(INSTALL_FILE) README.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/README.txt + $(INSTALL_FILE) LICENSE.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/LICENSE.txt install-examples: - test ! -d examples || (\ + test -z "$(strip $(EXAMPLES))" || \ $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples && \ - $(INSTALL_FILE) examples/*.* $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples) + for file in $(EXAMPLES); do \ + $(INSTALL_FILE) examples/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples; \ + done + +install-manual: + test -z "$(strip $(MANUAL))" || \ + $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual && \ + for file in $(MANUAL); do \ + $(INSTALL_FILE) manual/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual; \ + done clean: -rm -f -- $(SOURCES:.c=.o) -rm -f -- $(SOURCES:.c=.$(EXTENSION)) + -rm -f -- $(LIBRARY_NAME).o -rm -f -- $(LIBRARY_NAME).$(EXTENSION) distclean: clean @@ -216,6 +239,8 @@ $(DISTDIR): dist: $(DISTDIR) $(INSTALL_FILE) Makefile $(DISTDIR) + $(INSTALL_FILE) README.txt $(DISTDIR) + $(INSTALL_FILE) LICENSE.txt $(DISTDIR) $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd $(DISTDIR) test -z "$(strip $(ALLSOURCES))" || \ $(INSTALL_FILE) $(ALLSOURCES) $(DISTDIR) @@ -227,18 +252,29 @@ dist: $(DISTDIR) $(INSTALL_FILE) $(PDOBJECTS:.pd=-help.pd) $(DISTDIR) test -z "$(strip $(EXTRA_DIST))" || \ $(INSTALL_FILE) $(EXTRA_DIST) $(DISTDIR) + test -z "$(strip $(EXAMPLES))" || \ + $(INSTALL_DIR) $(DISTDIR)/examples && \ + for file in $(EXAMPLES); do \ + $(INSTALL_FILE) examples/$$file $(DISTDIR)/examples; \ + done + test -z "$(strip $(MANUAL))" || \ + $(INSTALL_DIR) $(DISTDIR)/manual && \ + for file in $(MANUAL); do \ + $(INSTALL_FILE) manual/$$file $(DISTDIR)/manual; \ + done tar --exclude-vcs -czpf $(DISTDIR).tar.gz $(DISTDIR) etags: etags *.h $(SOURCES) ../../pd/src/*.[ch] /usr/include/*.h /usr/include/*/*.h -showpaths: +showsetup: @echo "PD_PATH: $(PD_PATH)" @echo "objectsdir: $(objectsdir)" @echo "LIBRARY_NAME: $(LIBRARY_NAME)" + @echo "LIBRARY_VERSION: $(LIBRARY_VERSION)" @echo "SOURCES: $(SOURCES)" + @echo "PDOBJECTS: $(PDOBJECTS)" @echo "ALLSOURCES: $(ALLSOURCES)" @echo "UNAME: $(UNAME)" @echo "CPU: $(CPU)" - diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..d88b353 --- /dev/null +++ b/README.txt @@ -0,0 +1,14 @@ +/* RT binaural filter: earplug~ */ +/* based on KEMAR impulse measurement */ +/* Pei Xiang, summer 2004 */ +/* Revised in Fall 2006 by Jorge Castellanos */ +/* Revised in Spring 2009 by Hans-Christoph Steiner to compile in the data file */ + +http://markmail.org/message/sxfauaymftshbgwz +http://lists.puredata.info/pipermail/pd-list/2005-02/025764.html + +actually i've just written one external that handles this , [earplug~] http://crca.ucsd.edu/~pxiang/research.htm it basically takes the KEMAR data set, and interpolates 366 locations where HRTF measurement exists in a spherical surface. you get azimuth control 0-360 and elevation -40 - 90. + +now i'm still trying to clean it up a little bit, but probably have to use by copy the data.txt file into the default search dir of Pd, for the moment. + +cheers, Pei diff --git a/earplug~-meta.pd b/earplug~-meta.pd index 0b04fe6..13a7cbe 100644 --- a/earplug~-meta.pd +++ b/earplug~-meta.pd @@ -5,5 +5,5 @@ #X text 10 50 AUTHOR Pei Xiang; #X text 10 70 DESCRIPTION filters for binaural audio spatialization based on KEMAR impulse measurement; #X text 10 90 LICENSE ; -#X text 10 110 VERSION ; +#X text 10 110 VERSION 0.2; #X restore 10 10 pd META; diff --git a/earplug~.c b/earplug~.c index d70c786..a0b704c 100644 --- a/earplug~.c +++ b/earplug~.c @@ -2,6 +2,7 @@ /* based on KEMAR impulse measurement */ /* Pei Xiang, summer 2004 */ /* Revised in Fall 2006 by Jorge Castellanos */ +/* Revised in Spring 2009 by Hans-Christoph Steiner to compile in the data file */ #include #include -- cgit v1.2.1