diff options
Diffstat (limited to 'externals/grill')
31 files changed, 2094 insertions, 214 deletions
diff --git a/externals/grill/fftease/build-pd-bcc.bat b/externals/grill/fftease/build-pd-bcc.bat new file mode 100644 index 00000000..3dd21329 --- /dev/null +++ b/externals/grill/fftease/build-pd-bcc.bat @@ -0,0 +1,3 @@ +@echo --- Building with BorlandC++ --- + +make -f makefile.pd-bcc diff --git a/externals/grill/fftease/build-pd-darwin.sh b/externals/grill/fftease/build-pd-darwin.sh new file mode 100644 index 00000000..edd03207 --- /dev/null +++ b/externals/grill/fftease/build-pd-darwin.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +. config-pd-darwin.txt + +make -f makefile.pd-darwin && +{ + if [ $INSTPATH != "" ]; then + echo Now install as root + sudo make -f makefile.pd-darwin install + fi +} diff --git a/externals/grill/fftease/build-pd-linux.sh b/externals/grill/fftease/build-pd-linux.sh new file mode 100644 index 00000000..421cb6e1 --- /dev/null +++ b/externals/grill/fftease/build-pd-linux.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +. config-pd-linux.txt + +make -f makefile.pd-linux && +{ + if [ ${INSTPATH} != "" ]; then + echo Now install as root + su -c "make -f makefile.pd-linux install" + fi +} diff --git a/externals/grill/fftease/build-pd-msvc.bat b/externals/grill/fftease/build-pd-msvc.bat new file mode 100644 index 00000000..d6187f08 --- /dev/null +++ b/externals/grill/fftease/build-pd-msvc.bat @@ -0,0 +1,4 @@ +@echo --- Building with MS Visual C++ --- + +nmake -f makefile.pd-msvc clean +nmake -f makefile.pd-msvc diff --git a/externals/grill/fftease/config-pd-bcc.txt b/externals/grill/fftease/config-pd-bcc.txt new file mode 100644 index 00000000..4edcdf8d --- /dev/null +++ b/externals/grill/fftease/config-pd-bcc.txt @@ -0,0 +1,29 @@ +# FFTease - A set of Live Spectral Processors +# Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform +# +# This flext port is based on the jMax port of Christian Klippel +# +# Copyright (c)Thomas Grill (xovo@gmx.net) +# For information on usage and redistribution, and for a DISCLAIMER OF ALL +# WARRANTIES, see the file, "license.txt," in this distribution. +# + +# where is PD? +PDPATH=c:\programme\audio\pd + +# where do the flext libraries reside? +FLEXTPATH=$(PDPATH)\flext + +# where is BorlandC++? +BCCPATH=c:\programme\prog\bcc55 + + +# where should the external(s) be built? +OUTPATH=.\pd-bcc + +# should the external be installed? (yes/no) +INSTALL=yes + +# where should the external be installed? +INSTDIR=$(PDPATH)\extra + diff --git a/externals/grill/fftease/config-pd-darwin.txt b/externals/grill/fftease/config-pd-darwin.txt new file mode 100644 index 00000000..a58d7008 --- /dev/null +++ b/externals/grill/fftease/config-pd-darwin.txt @@ -0,0 +1,32 @@ +# FFTease - A set of Live Spectral Processors +# Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform +# +# This flext port is based on the jMax port of Christian Klippel +# +# Copyright (c)Thomas Grill (xovo@gmx.net) +# For information on usage and redistribution, and for a DISCLAIMER OF ALL +# WARRANTIES, see the file, "license.txt," in this distribution. +# + +# your c++ compiler (define only if not g++) +# CXX=g++ + +# where are the PD header files? +# leave it blank if it is a system directory (like /usr/local/include), +# since gcc 3.2 complains about it +PDPATH=/usr/local/pd/src + +# where is the PD executable? +PD=/usr/local/pd/bin/pd + +# where do the flext libraries reside? +FLEXTPATH=/usr/local/pd/flext + + +# where should flext libraries be built? +TARGDIR=./pd-darwin +# where should the external be installed? +# (leave blank to omit installation) +INSTPATH=/usr/local/pd/extra + + diff --git a/externals/grill/fftease/config-pd-linux.txt b/externals/grill/fftease/config-pd-linux.txt new file mode 100644 index 00000000..bbbf8da2 --- /dev/null +++ b/externals/grill/fftease/config-pd-linux.txt @@ -0,0 +1,31 @@ +# FFTease - A set of Live Spectral Processors +# Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform +# +# This flext port is based on the jMax port of Christian Klippel +# +# Copyright (c)Thomas Grill (xovo@gmx.net) +# For information on usage and redistribution, and for a DISCLAIMER OF ALL +# WARRANTIES, see the file, "license.txt," in this distribution. +# + + +# your c++ compiler (define only if not g++) +# CXX=g++ + +# where are the PD header files? +# leave it blank if it is a system directory (like /usr/local/include), +# since gcc 3.2 complains about it +PDPATH= + +# where do the flext libraries reside? +FLEXTPATH=/usr/local/lib/pd/flext + +# where should flext libraries be built? +TARGDIR=./pd-linux + +# where should the external be installed? +# (leave blank to omit installation) +INSTPATH=/usr/local/lib/pd/extra + + + diff --git a/externals/grill/fftease/config-pd-msvc.txt b/externals/grill/fftease/config-pd-msvc.txt new file mode 100644 index 00000000..a4e0015a --- /dev/null +++ b/externals/grill/fftease/config-pd-msvc.txt @@ -0,0 +1,27 @@ +# FFTease - A set of Live Spectral Processors +# Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform +# +# This flext port is based on the jMax port of Christian Klippel +# +# Copyright (c)Thomas Grill (xovo@gmx.net) +# For information on usage and redistribution, and for a DISCLAIMER OF ALL +# WARRANTIES, see the file, "license.txt," in this distribution. +# + + +# where is PD? +PDPATH=c:\programme\audio\pd + +# where do the flext libraries reside? +FLEXTPATH=$(PDPATH)\flext + +# where is MS VC++? +MSVCPATH=c:\programme\prog\microsoft visual studio\VC98 + + +# where should the external be built? +OUTPATH=pd-msvc + +# where should the external be installed? +# (leave blank to omit installation) +INSTDIR=$(PDPATH)\extra diff --git a/externals/grill/fftease/fftease.dsp b/externals/grill/fftease/fftease.dsp index 2b66b6d8..85b09613 100644 --- a/externals/grill/fftease/fftease.dsp +++ b/externals/grill/fftease/fftease.dsp @@ -142,6 +142,26 @@ SOURCE=.\src\unconvert.c SOURCE=.\src\burrow~.cpp # End Source File +# Begin Source File + +SOURCE=.\src\cross~.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\dentist~.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\disarray~.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\drown~.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\ether~.cpp +# End Source File # End Group # Begin Group "doc" @@ -159,229 +179,232 @@ SOURCE=.\license.txt SOURCE=.\readme.txt # End Source File # End Group -# Begin Group "Ori" +# Begin Group "ori.jmax" # PROP Default_Filter "" # Begin Source File -SOURCE=..\..\packs\FFTease\c\src\burrow~.c - -!IF "$(CFG)" == "fftease - Win32 Release" - -!ELSEIF "$(CFG)" == "fftease - Win32 Debug" - +SOURCE=.\ori.jmax\burrow~.c # PROP Exclude_From_Build 1 - -!ENDIF - # End Source File # Begin Source File -SOURCE=..\..\packs\FFTease\c\src\cross~.c - -!IF "$(CFG)" == "fftease - Win32 Release" - -!ELSEIF "$(CFG)" == "fftease - Win32 Debug" - +SOURCE=.\ori.jmax\cross~.c # PROP Exclude_From_Build 1 - -!ENDIF - # End Source File # Begin Source File -SOURCE=..\..\packs\FFTease\c\src\dentist~.c - -!IF "$(CFG)" == "fftease - Win32 Release" - -!ELSEIF "$(CFG)" == "fftease - Win32 Debug" - +SOURCE=.\ori.jmax\dentist~.c # PROP Exclude_From_Build 1 - -!ENDIF - # End Source File # Begin Source File -SOURCE=..\..\packs\FFTease\c\src\disarray~.c - -!IF "$(CFG)" == "fftease - Win32 Release" - -!ELSEIF "$(CFG)" == "fftease - Win32 Debug" - +SOURCE=.\ori.jmax\disarray~.c # PROP Exclude_From_Build 1 - -!ENDIF - # End Source File # Begin Source File -SOURCE=..\..\packs\FFTease\c\src\drown~.c - -!IF "$(CFG)" == "fftease - Win32 Release" - -!ELSEIF "$(CFG)" == "fftease - Win32 Debug" - +SOURCE=.\ori.jmax\drown~.c # PROP Exclude_From_Build 1 - -!ENDIF - # End Source File # Begin Source File -SOURCE=..\..\packs\FFTease\c\src\ether~.c - -!IF "$(CFG)" == "fftease - Win32 Release" - -!ELSEIF "$(CFG)" == "fftease - Win32 Debug" - +SOURCE=.\ori.jmax\ether~.c # PROP Exclude_From_Build 1 - -!ENDIF - # End Source File # Begin Source File -SOURCE=..\..\packs\FFTease\c\src\morphine~.c - -!IF "$(CFG)" == "fftease - Win32 Release" - -!ELSEIF "$(CFG)" == "fftease - Win32 Debug" - +SOURCE=.\ori.jmax\FFTease.c # PROP Exclude_From_Build 1 - -!ENDIF - # End Source File # Begin Source File -SOURCE=..\..\packs\FFTease\c\src\pvcompand~.c - -!IF "$(CFG)" == "fftease - Win32 Release" - -!ELSEIF "$(CFG)" == "fftease - Win32 Debug" - +SOURCE=.\ori.jmax\morphine~.c # PROP Exclude_From_Build 1 - -!ENDIF - # End Source File # Begin Source File -SOURCE=..\..\packs\FFTease\c\src\pvoc~.c - -!IF "$(CFG)" == "fftease - Win32 Release" - -!ELSEIF "$(CFG)" == "fftease - Win32 Debug" - +SOURCE=.\ori.jmax\pvcompand~.c # PROP Exclude_From_Build 1 - -!ENDIF - # End Source File # Begin Source File -SOURCE=..\..\packs\FFTease\c\src\scrape~.c - -!IF "$(CFG)" == "fftease - Win32 Release" - -!ELSEIF "$(CFG)" == "fftease - Win32 Debug" - +SOURCE=.\ori.jmax\pvoc~.c # PROP Exclude_From_Build 1 - -!ENDIF - # End Source File # Begin Source File -SOURCE=..\..\packs\FFTease\c\src\shapee~.c - -!IF "$(CFG)" == "fftease - Win32 Release" - -!ELSEIF "$(CFG)" == "fftease - Win32 Debug" - +SOURCE=.\ori.jmax\scrape~.c # PROP Exclude_From_Build 1 - -!ENDIF - # End Source File # Begin Source File -SOURCE=..\..\packs\FFTease\c\src\swinger~.c - -!IF "$(CFG)" == "fftease - Win32 Release" +SOURCE=.\ori.jmax\shapee~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File -!ELSEIF "$(CFG)" == "fftease - Win32 Debug" +SOURCE=.\ori.jmax\swinger~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File +SOURCE=.\ori.jmax\taint~.c # PROP Exclude_From_Build 1 +# End Source File +# Begin Source File -!ENDIF +SOURCE=.\ori.jmax\thresher~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File +SOURCE=.\ori.jmax\unconvert.c +# PROP Exclude_From_Build 1 # End Source File # Begin Source File -SOURCE=..\..\packs\FFTease\c\src\taint~.c +SOURCE=.\ori.jmax\vacancy~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File -!IF "$(CFG)" == "fftease - Win32 Release" +SOURCE=.\ori.jmax\xsyn~.c +# PROP Exclude_From_Build 1 +# End Source File +# End Group +# Begin Group "ori.maxmsp" -!ELSEIF "$(CFG)" == "fftease - Win32 Debug" +# PROP Default_Filter "" +# Begin Source File +SOURCE=.\ori.max\burrow~.c # PROP Exclude_From_Build 1 +# End Source File +# Begin Source File -!ENDIF - +SOURCE=".\ori.max\cross-opt~.c" +# PROP Exclude_From_Build 1 # End Source File # Begin Source File -SOURCE=..\..\packs\FFTease\c\src\thresher~.c +SOURCE=.\ori.max\dentist~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File -!IF "$(CFG)" == "fftease - Win32 Release" +SOURCE=.\ori.max\denude~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File -!ELSEIF "$(CFG)" == "fftease - Win32 Debug" +SOURCE=.\ori.max\disarray~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File +SOURCE=.\ori.max\ether~.c # PROP Exclude_From_Build 1 +# End Source File +# Begin Source File -!ENDIF +SOURCE=.\ori.max\fxsyn~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File +SOURCE=.\ori.max\morphine~.c +# PROP Exclude_From_Build 1 # End Source File # Begin Source File -SOURCE=..\..\packs\FFTease\c\src\unconvert.c +SOURCE=.\ori.max\multyQ_opt~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File -!IF "$(CFG)" == "fftease - Win32 Release" +SOURCE=.\ori.max\nacho_opt~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File -!ELSEIF "$(CFG)" == "fftease - Win32 Debug" +SOURCE=.\ori.max\pvcompand_opt~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File +SOURCE=.\ori.max\pvcompand~.c # PROP Exclude_From_Build 1 +# End Source File +# Begin Source File -!ENDIF +SOURCE=.\ori.max\pvharm~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File +SOURCE=.\ori.max\pvoc_opt~.c +# PROP Exclude_From_Build 1 # End Source File # Begin Source File -SOURCE=..\..\packs\FFTease\c\src\vacancy~.c +SOURCE=.\ori.max\pvoc~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File -!IF "$(CFG)" == "fftease - Win32 Release" +SOURCE=.\ori.max\residency~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File -!ELSEIF "$(CFG)" == "fftease - Win32 Debug" +SOURCE=.\ori.max\scrape_opt~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File +SOURCE=.\ori.max\scrape~.c # PROP Exclude_From_Build 1 +# End Source File +# Begin Source File -!ENDIF +SOURCE=.\ori.max\shapee_opt~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File +SOURCE=.\ori.max\swinger_opt~.c +# PROP Exclude_From_Build 1 # End Source File # Begin Source File -SOURCE=..\..\packs\FFTease\c\src\xsyn~.c +SOURCE=.\ori.max\swinger~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File -!IF "$(CFG)" == "fftease - Win32 Release" +SOURCE=.\ori.max\taint~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File -!ELSEIF "$(CFG)" == "fftease - Win32 Debug" +SOURCE=.\ori.max\thresher_opt~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File +SOURCE=.\ori.max\thresher~.c # PROP Exclude_From_Build 1 +# End Source File +# Begin Source File -!ENDIF +SOURCE=.\ori.max\vacancy~.c +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File +SOURCE=".\ori.max\xsyn-opt~.c" +# PROP Exclude_From_Build 1 # End Source File # End Group # Begin Source File diff --git a/externals/grill/fftease/make-files.txt b/externals/grill/fftease/make-files.txt new file mode 100644 index 00000000..567427b4 --- /dev/null +++ b/externals/grill/fftease/make-files.txt @@ -0,0 +1,10 @@ +# all the source files from the package +SRCS= \ + convert.c convert_new.c fft4.c fft.c fold.c \ + leanconvert.c leanunconvert.c makewindows.c overlapadd.c unconvert.c \ + main.cpp \ + burrow~.cpp cross~.cpp dentist~.cpp disarray~.cpp drown~.cpp ether~.cpp + +HDRS= \ + pv.h main.h + diff --git a/externals/grill/fftease/makefile.pd-bcc b/externals/grill/fftease/makefile.pd-bcc new file mode 100644 index 00000000..87d0185c --- /dev/null +++ b/externals/grill/fftease/makefile.pd-bcc @@ -0,0 +1,81 @@ +# FFTease - A set of Live Spectral Processors +# Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform +# +# This flext port is based on the jMax port of Christian Klippel +# +# Copyright (c)Thomas Grill (xovo@gmx.net) +# For information on usage and redistribution, and for a DISCLAIMER OF ALL +# WARRANTIES, see the file, "license.txt," in this distribution. +# +# +# Makefile for BorlandC++ +# +# usage: make -f makefile.pd-bcc +# +# --------------------------------------------- + +!include config-pd-bcc.txt + +NAME=fftease +SETUPFUNCTION=$(NAME)_setup + +# flext stuff +TARGET=pdwin + +# includes, libs +INCPATH=-I$(BCCPATH)\include -I$(PDPATH)\src -I$(FLEXTPATH) +LIBPATH=-L$(BCCPATH)\lib -L$(PDPATH)\lib +LIBS=cw32.lib import32.lib C0D32.OBJ + +# compiler definitions and flags +DEFS=-DPD +CFLAGS=-6 -O2 -OS -ff -tWD + + +# the rest can stay untouched +# ---------------------------------------------- + +# all the source files from the package +!include make-files.txt + +# default target +all: $(OUTPATH)\$(NAME).dll + +# remove build +clean: + -del /s /q $(OUTPATH) > nul + rmdir $(OUTPATH) + + +install: + cp $(OUTPATH)\$(NAME).dll $(INSTDIR) + +# ---------------------------------------------- + +OBJS= $(SRCS:.cpp=.obj) + +#.PATH.OBJ=$(OUTPATH) + +#$(SRCS): $(HDRS) +# -touch $< + +{source}.cpp.obj: + bcc32 -c $(CFLAGS) $(DEFS) $(INCPATH) -n$(OUTPATH) $< + +$(OUTPATH): + -@if not exist $< mkdir $< + +$(OUTPATH)\pd.lib: $(PDPATH)\bin\pd.dll + implib -a $< $** + +$(OUTPATH)\$(NAME).def: + @echo EXPORTS $(SETUPFUNCTION) = _$(SETUPFUNCTION) > $< + +$(OUTPATH)\$(NAME).dll :: $(OUTPATH) $(OUTPATH)\$(NAME).def $(OUTPATH)\pd.lib + +$(OUTPATH)\$(NAME).dll :: $(OBJS) + cd $(OUTPATH) + ilink32 -C -Tpd $(LIBPATH) $** ,..\$<,,$(LIBS) pd.lib $(FLEXTPATH)\flext-$(TARGET).lib ,$(NAME).def + cd .. + +
\ No newline at end of file diff --git a/externals/grill/fftease/makefile.pd-darwin b/externals/grill/fftease/makefile.pd-darwin new file mode 100644 index 00000000..e175d277 --- /dev/null +++ b/externals/grill/fftease/makefile.pd-darwin @@ -0,0 +1,77 @@ +# FFTease - A set of Live Spectral Processors +# Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform +# +# This flext port is based on the jMax port of Christian Klippel +# +# Copyright (c)Thomas Grill (xovo@gmx.net) +# For information on usage and redistribution, and for a DISCLAIMER OF ALL +# WARRANTIES, see the file, "license.txt," in this distribution. +# +# +# Makefile for gcc @ darwin (OSX) +# +# usage: +# to build run "make -f makefile.pd-darwin" +# to install (as root), do "make -f makefile.pd-darwin install" +# + +CONFIG=config-pd-darwin.txt + +include ${CONFIG} + +FLEXTLIB=${FLEXTPATH}/flext.a + +# compiler+linker stuff +INCLUDES=${PDPATH} ${FLEXTPATH} +LIBPATH= +FLAGS=-DPD -Dunix -DMACOSX +CFLAGS=-O6 -Wno-unused -Wno-parentheses -Wno-switch -Wstrict-prototypes # -maltivec +#CFLAGS=-g +LIBS=m +LDFLAGS=-bundle -bundle_loader ${PD} + +# --------------------------------------------- +# the rest can stay untouched +# ---------------------------------------------- +NAME=fftease + +# all the source files from the package +include make-files.txt + +DIR=src + +TARGET=$(TARGDIR)/$(NAME).pd_darwin +MAKEFILE=makefile.pd-darwin + +# default target +all: $(TARGDIR) $(TARGET) + +$(patsubst %,$(DIR)/%,$(SRCS)): $(patsubst %,$(DIR)/%,$(HDRS)) $(FLEXTLIB) $(MAKEFILE) $(CONFIG) + touch $@ + +$(TARGDIR): + mkdir $(TARGDIR) + +$(TARGDIR)/%.o : $(DIR)/%.cpp + $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES)) $< -o $@ + +$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) $(FLEXTLIB) + $(CXX) $(LDFLAGS) $^ $(patsubst %,-L%,$(LIBPATH)) $(patsubst %,-l%,$(LIBS)) -o $@ + chmod 755 $@ + +$(INSTPATH): + mkdir $(INSTPATH) + +install:: $(INSTPATH) + +install:: $(TARGET) + cp $^ $(INSTPATH) +# chown root.root $(patsubst %,$(INSTPATH)/%,$(notdir $^)) +# chmod 755 $(patsubst %,$(INSTPATH)/%,$(notdir $^)) + +.PHONY: clean + +clean: + rm -f $(TARGDIR)/*.o $(TARGET) + + diff --git a/externals/grill/fftease/makefile.pd-linux b/externals/grill/fftease/makefile.pd-linux new file mode 100644 index 00000000..cd9d8401 --- /dev/null +++ b/externals/grill/fftease/makefile.pd-linux @@ -0,0 +1,82 @@ +# FFTease - A set of Live Spectral Processors +# Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform +# +# This flext port is based on the jMax port of Christian Klippel +# +# Copyright (c)Thomas Grill (xovo@gmx.net) +# For information on usage and redistribution, and for a DISCLAIMER OF ALL +# WARRANTIES, see the file, "license.txt," in this distribution. +# +# +# Makefile for gcc @ linux +# +# usage: +# to build run "make -f makefile.pd-linux" +# to install (as root), do "make -f makefile.pd-linux install" +# + +CONFIG=config-pd-linux.txt + +include $(CONFIG) + +FLEXTLIB=$(FLEXTPATH)/flext.a + +# compiler+linker stuff +INCLUDES=$(PDPATH) +LIBPATH= +FLAGS=-DPD +CFLAGS=-O6 -mcpu=pentiumpro +#CFLAGS=-g +LIBS=m util + + +# --------------------------------------------- +# the rest can stay untouched +# ---------------------------------------------- + +NAME=fftease + +# all the source files from the package +include make-files.txt + +TARGET=$(TARGDIR)/$(NAME).pd_linux +DIR=src + +# default target +all: $(TARGDIR) $(TARGET) + +$(patsubst %,$(DIR)/%,$(SRCS)): $(patsubst %,$(DIR)/%,$(HDRS)) $(FLEXTLIB) $(CONFIG) + touch $@ + +$(TARGDIR): + mkdir $(TARGDIR) + +$(TARGDIR)/%.o : $(DIR)/%.cpp + $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@ + +$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) $(FLEXTLIB) + $(CXX) -shared $^ $(patsubst %,-L%,$(LIBPATH)) $(patsubst %,-l%,$(LIBS)) -o $@ + chmod 755 $@ + +$(INSTPATH): + mkdir $(INSTDIR) + +install:: $(INSTDIR) + +install:: $(TARGET) + cp $^ $(INSTPATH) + chown root.root $(patsubst %,$(INSTPATH)/%,$(notdir $^)) + chmod 755 $(patsubst %,$(INSTPATH)/%,$(notdir $^)) + +.PHONY: clean +clean: + rm -f $(TARGDIR)/*.o $(TARGET) + + + + + + + + + diff --git a/externals/grill/fftease/makefile.pd-msvc b/externals/grill/fftease/makefile.pd-msvc new file mode 100644 index 00000000..6345e7db --- /dev/null +++ b/externals/grill/fftease/makefile.pd-msvc @@ -0,0 +1,64 @@ +# FFTease - A set of Live Spectral Processors +# Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform +# +# This flext port is based on the jMax port of Christian Klippel +# +# Copyright (c)Thomas Grill (xovo@gmx.net) +# For information on usage and redistribution, and for a DISCLAIMER OF ALL +# WARRANTIES, see the file, "license.txt," in this distribution. +# +# +# Makefile for MSVC++ 6 +# +# usage: +# to build run "make -f makefile.pd-msvc" +# + +!include config-pd-msvc.txt + +# includes +INCPATH=/I"$(MSVCPATH)\include" /I"$(PDPATH)\src" /I"$(FLEXTPATH)" +LIBPATH=/LIBPATH:"$(MSVCPATH)\lib" /LIBPATH:"$(PDPATH)\bin" /LIBPATH:"$(FLEXTPATH)" +LIBS=pd.lib flext_t-pdwin.lib + +# compiler definitions and flags +DEFS=/DPD + +CFLAGS=/GR- /GX- /GD /G6 /Ox + +# the rest can stay untouched +# ---------------------------------------------- + +# all the source files from the package +!include make-files.txt + +# ----------------------------------------------- + +NAME=fftease +DIR=src + +all: $(OUTPATH) $(OUTPATH)\$(NAME).dll + +# remove build +clean: + -del /q $(OUTPATH) > nul + -rmdir $(OUTPATH) > nul + +OBJS= $(SRCS:.cpp=.obj) + +$(OUTPATH): + -mkdir $(OUTPATH) > nul + +{$(DIR)}.cpp{}.obj: + cl /c /LD $(CFLAGS) $(DEFS) $(INCPATH) $** /Fo$(OUTPATH)\$@ + +$(OUTPATH)\$(NAME).dll: $(OBJS) + cd $(OUTPATH) + link /DLL /out:$(NAME).dll /INCREMENTAL:NO $** $(LIBS) $(LIBPATH) + @-del *.exp + @-del *.lib + cd .. +!ifdef INSTPATH + @-if not exist $(INSTPATH) mkdir $(INSTPATH) + copy $@ $(INSTPATH) > nul +!endif diff --git a/externals/grill/fftease/readme.txt b/externals/grill/fftease/readme.txt index 7507ee56..3f2bda5b 100644 --- a/externals/grill/fftease/readme.txt +++ b/externals/grill/fftease/readme.txt @@ -55,3 +55,20 @@ You must have the following "Source Trees" defined: "MP SDK" - Pointing to the Multiprocessing SDK (for threading support) +---------------------------------------------------------------------------- + +PORTING NOTES: + +- cross: + - what about the class members for "correction"?! (superfluous) + +- dentist: + - tooth count ("teeth") is preserved and checked on every reshuffle + - different knee correction + +- disarray: + - different frequency correction + +- ether: + - possibility to change qual? + diff --git a/externals/grill/fftease/src/burrow~.cpp b/externals/grill/fftease/src/burrow~.cpp index ffb6c90a..aef5e7aa 100644 --- a/externals/grill/fftease/src/burrow~.cpp +++ b/externals/grill/fftease/src/burrow~.cpp @@ -3,8 +3,6 @@ FFTease - A set of Live Spectral Processors Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform -This flext port is based on the jMax port of Christian Klippel - Copyright (c)Thomas Grill (xovo@gmx.net) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -30,22 +28,23 @@ protected: I blsz; BL _invert; - I _inCount; - I *_bitshuffle; F _threshold,_multiplier; F _thresh_dB,_mult_dB; - F *_Wanal; - F *_Wsyn; - F *_inputOne,*_inputTwo; - F *_Hwin; - F *_bufferOne,*_bufferTwo; - F *_channelOne,*_channelTwo; + F *_input1,*_input2; + F *_buffer1,*_buffer2; + F *_channel1,*_channel2; F *_output; F *_trigland; + I *_bitshuffle; + F *_Wanal,*_Wsyn,*_Hwin; + + I _inCount; private: + enum { _MULT_ = 4 }; + V Clear(); V Delete(); @@ -103,8 +102,8 @@ burrow::burrow(I argc,const t_atom *argv): Clear(); - AddInSignal("Commands and original signal"); - AddInSignal("Modulating signal"); + AddInSignal("Messages and input signal"); + AddInSignal("Reference signal"); AddOutSignal("Transformed signal"); } @@ -117,11 +116,11 @@ V burrow::Clear() { _bitshuffle = NULL; _trigland = NULL; - _inputOne = _inputTwo = NULL; + _input1 = _input2 = NULL; _Hwin = NULL; _Wanal = _Wsyn = NULL; - _bufferOne = _bufferTwo = NULL; - _channelOne = _channelTwo = NULL; + _buffer1 = _buffer2 = NULL; + _channel1 = _channel2 = NULL; _output = NULL; } @@ -129,15 +128,15 @@ V burrow::Delete() { if(_bitshuffle) delete[] _bitshuffle; if(_trigland) delete[] _trigland; - if(_inputOne) delete[] _inputOne; - if(_inputTwo) delete[] _inputTwo; + if(_input1) delete[] _input1; + if(_input2) delete[] _input2; if(_Hwin) delete[] _Hwin; if(_Wanal) delete[] _Wanal; if(_Wsyn) delete[] _Wsyn; - if(_bufferOne) delete[] _bufferOne; - if(_bufferTwo) delete[] _bufferTwo; - if(_channelOne) delete[] _channelOne; - if(_channelTwo) delete[] _channelTwo; + if(_buffer1) delete[] _buffer1; + if(_buffer2) delete[] _buffer2; + if(_channel1) delete[] _channel1; + if(_channel2) delete[] _channel2; if(_output) delete[] _output; } @@ -152,23 +151,25 @@ V burrow::m_dsp(I n,S *const *in,S *const *out) Delete(); /* preset the objects data */ - const I _N = _D*4,_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; + const I _N = _D*_MULT_,_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; _inCount = -_Nw; /* assign memory to the buffers */ + _input1 = new F[_Nw]; + _input2 = new F[_Nw]; + _buffer1 = new F[_N]; + _buffer2 = new F[_N]; + _channel1 = new F[_N+2]; + _channel2 = new F[_N+2]; + _output = new F[_Nw]; + _bitshuffle = new I[_N*2]; _trigland = new F[_N*2]; - _inputOne = new F[_Nw]; - _inputTwo = new F[_Nw]; + _Hwin = new F[_Nw]; _Wanal = new F[_Nw]; _Wsyn = new F[_Nw]; - _bufferOne = new F[_N]; - _bufferTwo = new F[_N]; - _channelOne = new F[_N+2]; - _channelTwo = new F[_N+2]; - _output = new F[_Nw]; /* initialize pv-lib functions */ init_rdft( _N, _bitshuffle, _trigland); @@ -178,75 +179,75 @@ V burrow::m_dsp(I n,S *const *in,S *const *out) V burrow::m_signal(I n,S *const *in,S *const *out) { - const S *inOne = in[0],*inTwo = in[1]; - S *outOne = out[0]; - /* declare working variables */ I i, j; - const I _D = blsz,_N = _D*4,_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; + const I _D = blsz,_N = _D*_MULT_,_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; /* fill our retaining buffers */ _inCount += _D; for(i = 0; i < _N-_D ; i++ ) { - _inputOne[i] = _inputOne[i+_D]; - _inputTwo[i] = _inputTwo[i+_D]; + _input1[i] = _input1[i+_D]; + _input2[i] = _input2[i+_D]; } for(j = 0; i < _N; i++,j++) { - _inputOne[i] = inOne[j]; - _inputTwo[i] = inTwo[j]; + _input1[i] = in[0][j]; + _input2[i] = in[1][j]; } /* apply hamming window and fold our window buffer into the fft buffer */ - fold( _inputOne, _Wanal, _Nw, _bufferOne, _N, _inCount ); - fold( _inputTwo, _Wanal, _Nw, _bufferTwo, _N, _inCount ); + fold( _input1, _Wanal, _Nw, _buffer1, _N, _inCount ); + fold( _input2, _Wanal, _Nw, _buffer2, _N, _inCount ); /* do an fft */ - rdft( _N, 1, _bufferOne, _bitshuffle, _trigland ); - rdft( _N, 1, _bufferTwo, _bitshuffle, _trigland ); + rdft( _N, 1, _buffer1, _bitshuffle, _trigland ); + rdft( _N, 1, _buffer2, _bitshuffle, _trigland ); + + // ---- BEGIN -------------------------------- - /* convert to polar coordinates from complex values */ for ( i = 0; i <= _N2; i++ ) { const I even = i<<1,odd = even+1; + + /* convert to polar coordinates from complex values */ register F a,b; - a = ( i == _N2 ? _bufferOne[1] : _bufferOne[even] ); - b = ( i == 0 || i == _N2 ? 0. : _bufferOne[odd] ); + a = ( i == _N2 ? _buffer1[1] : _buffer1[even] ); + b = ( i == 0 || i == _N2 ? 0. : _buffer1[odd] ); - _channelOne[even] = hypot( a, b ); - _channelOne[odd] = -atan2( b, a ); + _channel1[even] = hypot( a, b ); + _channel1[odd] = -atan2( b, a ); - a = ( i == _N2 ? _bufferTwo[1] : _bufferTwo[even] ); - b = ( i == 0 || i == _N2 ? 0. : _bufferTwo[odd] ); + a = ( i == _N2 ? _buffer2[1] : _buffer2[even] ); + b = ( i == 0 || i == _N2 ? 0. : _buffer2[odd] ); - _channelTwo[even] = hypot( a, b ); + _channel2[even] = hypot( a, b ); /* use simple threshold from second signal to trigger filtering */ - if (_invert?(_channelTwo[even] < _threshold):(_channelTwo[even] > _threshold) ) - _channelOne[even] *= _multiplier; - } - - /* convert back to complex form, read for the inverse fft */ - for ( i = 0; i <= _N2; i++ ) { - const I even = i<<1,odd = even+1; + if (_invert?(_channel2[even] < _threshold):(_channel2[even] > _threshold) ) + _channel1[even] *= _multiplier; - _bufferOne[even] = _channelOne[even] * cos( _channelOne[odd] ); + /* convert back to complex form, read for the inverse fft */ + _buffer1[even] = _channel1[even] * cos( _channel1[odd] ); if ( i != _N2 ) - _bufferOne[odd] = -_channelOne[even] * sin( _channelOne[odd] ); + _buffer1[odd] = -_channel1[even] * sin( _channel1[odd] ); } + + // ---- END -------------------------------- + + /* do an inverse fft */ - rdft( _N, -1, _bufferOne, _bitshuffle, _trigland ); + rdft( _N, -1, _buffer1, _bitshuffle, _trigland ); /* dewindow our result */ - overlapadd( _bufferOne, _N, _Wsyn, _output, _Nw, _inCount); + overlapadd( _buffer1, _N, _Wsyn, _output, _Nw, _inCount); /* set our output and adjust our retaining output buffer */ - F mult = 1./_N; + const F mult = 1./_N; for ( j = 0; j < _D; j++ ) - outOne[j] = _output[j] * mult; + out[0][j] = _output[j] * mult; for ( j = 0; j < _N-_D; j++ ) _output[j] = _output[j+_D]; diff --git a/externals/grill/fftease/src/cross~.cpp b/externals/grill/fftease/src/cross~.cpp new file mode 100644 index 00000000..52874127 --- /dev/null +++ b/externals/grill/fftease/src/cross~.cpp @@ -0,0 +1,236 @@ +/* + +FFTease - A set of Live Spectral Processors +Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform + +Copyright (c)Thomas Grill (xovo@gmx.net) +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see the file, "license.txt," in this distribution. + +*/ + +#include "main.h" + + +class cross: + public flext_dsp +{ + FLEXT_HEADER_S(cross,flext_dsp,setup) + +public: + cross(I argc,const t_atom *argv); + ~cross(); + +protected: + + virtual V m_dsp(I n,S *const *in,S *const *out); + virtual V m_signal(I n,S *const *in,S *const *out); + + I blsz; + F smprt; + + F *_input1,*_input2; + F *_buffer1,*_buffer2; + F *_channel1,*_channel2; + F *_output; + F *_trigland; + I *_bitshuffle; + F *_Wanal,*_Wsyn,*_Hwin; + + I _inCount; + +private: + enum { _MULT_ = 2 }; + + V Clear(); + V Delete(); + + static V setup(t_classid c); +}; + +FLEXT_LIB_DSP_V("fftease, cross~",cross) + + +V cross::setup(t_classid c) +{ +} + + +cross::cross(I argc,const t_atom *argv): + blsz(0),smprt(0) +{ + Clear(); + + AddInSignal("Messages and driver signal"); + AddInSignal("Filter signal"); + AddInSignal("Threshold signal for cross synthesis"); + AddOutSignal("Transformed signal"); +} + +cross::~cross() +{ + Delete(); +} + +V cross::Clear() +{ + _input1 = _input2 = NULL; + _buffer1 = _buffer2 = NULL; + _channel1 = _channel2 = NULL; + _output = NULL; + + _bitshuffle = NULL; + _trigland = NULL; + + _Hwin = NULL; + _Wanal = _Wsyn = NULL; +} + +V cross::Delete() +{ + if(_input1) delete[] _input1; + if(_input2) delete[] _input2; + if(_buffer1) delete[] _buffer1; + if(_buffer2) delete[] _buffer2; + if(_channel1) delete[] _channel1; + if(_channel2) delete[] _channel2; + if(_output) delete[] _output; + + if(_bitshuffle) delete[] _bitshuffle; + if(_trigland) delete[] _trigland; + + if(_Wanal) delete[] _Wanal; + if(_Wsyn) delete[] _Wsyn; + if(_Hwin) delete[] _Hwin; + + // --------------------------------------------- + +#if 0 + // T.G. These are not used + if(c_lastphase_in1) delete[] c_lastphase_in1; + if(c_lastphase_in2) delete[] c_lastphase_in2; + if(c_lastphase_out) delete[] c_lastphase_out; +#endif +} + + + +V cross::m_dsp(I n,S *const *in,S *const *out) +{ + const I _D = Blocksize(); + const F _R = Samplerate(); + + if(_D != blsz || _R != smprt) { + blsz = _D; + smprt = _R; + + Delete(); + + const int _N = _D*_MULT_,_Nw = _N,_N2 = _N>>1,_Nw2 = _Nw>>1; + + _inCount = -_Nw; + + _input1 = new F[_Nw]; + _input2 = new F[_Nw]; + _buffer1 = new F[_N]; + _buffer2 = new F[_N]; + _channel1 = new F[_N+2]; + _channel2 = new F[_N+2]; + _output = new F[_Nw]; + + _bitshuffle = new I[_N*2]; + _trigland = new F[_N*2]; + + _Wanal = new F[_Nw]; + _Wsyn = new F[_Nw]; + _Hwin = new F[_Nw]; + + init_rdft( _N, _bitshuffle, _trigland); + + // makewindows( x->Hwin, x->Wanal, x->Wsyn, x->Nw, x->N, x->D, 0); + makehanning( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0,0); + + // --------------------------------------------- + +#if 0 + // T.G. These are not used + /* for convert */ + c_lastphase_in1 = new F[_N2+1]; + c_lastphase_in2 = new F[_N2+1]; + c_lastphase_out = new F[_N2+1]; + c_fundamental = _R/( _N2<<1 ); + c_factor_in = _R/(_D * __TWOPI); + c_factor_out = __TWOPI * _D/_R; +#endif + } +} + +V cross::m_signal(I n,S *const *in,S *const *out) +{ + /* declare working variables */ + I i, j; + const I _D = blsz,_N = _D*_MULT_,_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; + + _inCount += _D; + + for ( j = 0 ; j < _N-_D ; j++ ) { + _input1[j] = _input1[j+_D]; + _input2[j] = _input2[j+_D]; + } + for (i = 0; j < _N; j++,i++ ) { + _input1[j] = in[0][i]; + _input2[j] = in[1][i]; + } + + fold( _input1, _Wanal, _Nw, _buffer1, _N, _inCount ); + fold( _input2, _Wanal, _Nw, _buffer2, _N, _inCount ); + + rdft( _N, 1, _buffer1, _bitshuffle, _trigland ); + rdft( _N, 1, _buffer2, _bitshuffle, _trigland ); + + + // ---- BEGIN -------------------------------- + + // TG: filled only once per signal vector!! + float threshie = *in[2]; + + for ( i = 0; i <= _N2; i++ ) { + const I even = i<<1,odd = even+1; + + F a = ( i == _N2 ? _buffer1[1] : _buffer2[even] ); + F b = ( i == 0 || i == _N2 ? 0. : _buffer2[odd] ); + F gainer = hypot( a, b ) ; + + a = ( i == _N2 ? _buffer1[1] : _buffer1[even] ); + b = ( i == 0 || i == _N2 ? 0. : _buffer1[odd] ); + + if( gainer > threshie ) + _channel1[even] = hypot( a, b ) * gainer; + // else + // channel1[even] = hypot( a, b); + + _channel1[odd] = -atan2( b, a ); + _buffer1[even] = _channel1[even] * cos( _channel1[odd] ); + + if ( i != _N2 ) + _buffer1[odd] = -_channel1[even] * sin( _channel1[odd] ); + } + + // ---- END -------------------------------- + + rdft( _N, -1, _buffer1, _bitshuffle, _trigland ); + + overlapadd( _buffer1, _N, _Wsyn, _output, _Nw, _inCount); + + const F mult = 1./_N; + for ( j = 0; j < _D; j++ ) + out[0][j] = _output[j] * mult; + + for ( j = 0; j < _N-_D; j++ ) + _output[j] = _output[j+_D]; + for (; j < _N; j++ ) + _output[j] = 0.; +} + + + diff --git a/externals/grill/fftease/src/dentist~.cpp b/externals/grill/fftease/src/dentist~.cpp new file mode 100644 index 00000000..8c9a0379 --- /dev/null +++ b/externals/grill/fftease/src/dentist~.cpp @@ -0,0 +1,272 @@ +/* + +FFTease - A set of Live Spectral Processors +Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform + +Copyright (c)Thomas Grill (xovo@gmx.net) +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see the file, "license.txt," in this distribution. + +*/ + +#include "main.h" +#include <stdlib.h> + +class dentist: + public flext_dsp +{ + FLEXT_HEADER_S(dentist,flext_dsp,setup) + +public: + dentist(I argc,const t_atom *argv); + ~dentist(); + +protected: + + virtual V m_dsp(I n,S *const *in,S *const *out); + virtual V m_signal(I n,S *const *in,S *const *out); + + I blsz; + F smprt; + + F *_input1,*_input2; + F *_buffer1,*_buffer2; + F *_channel1,*_channel2; + F *_output; + F *_trigland; + I *_bitshuffle; + F *_Wanal,*_Wsyn,*_Hwin; + + I _inCount; + + // ----------------------------- + + I *_bin_selection; + I _tooth_count; + F _knee; + I _max_bin; // determined by _knee and fundamental frequency + + V reset_shuffle(); + +private: + enum { _MULT_ = 4 }; + + V Clear(); + V Delete(); + + V ms_knee(F knee); + V ms_teeth(I teeth) { _tooth_count = teeth; reset_shuffle(); } + + + static V setup(t_classid c); + + FLEXT_CALLBACK(reset_shuffle) + FLEXT_ATTRGET_F(_knee) + FLEXT_CALLSET_F(ms_knee) + FLEXT_ATTRGET_I(_tooth_count) + FLEXT_CALLSET_I(ms_teeth) +}; + +FLEXT_LIB_DSP_V("fftease, dentist~",dentist) + + +V dentist::setup(t_classid c) +{ + FLEXT_CADDBANG(c,0,reset_shuffle); + + FLEXT_CADDATTR_VAR(c,"knee",_knee,ms_knee); + FLEXT_CADDATTR_VAR(c,"teeth",_tooth_count,ms_teeth); +} + + +dentist::dentist(I argc,const t_atom *argv): + blsz(0),smprt(0), + _knee(500),_tooth_count(10) +{ + /* parse and set object's options given */ + if(argc >= 1) { + if(CanbeFloat(argv[0])) + _knee = GetAFloat(argv[0]); + else + post("%s - Knee must be a float value - set to %0f",thisName(),_knee); + } + if(argc >= 2) { + if(CanbeInt(argv[1])) + _tooth_count = GetAInt(argv[1]); + else + post("%s - Teeth must be an integer value - set to %0i",thisName(),_tooth_count); + } + + Clear(); + + AddInSignal("Messages and input signal"); + AddOutSignal("Transformed signal"); +} + +dentist::~dentist() +{ + Delete(); +} + +V dentist::Clear() +{ + _input1 = _input2 = NULL; + _buffer1 = _buffer2 = NULL; + _channel1 = _channel2 = NULL; + _output = NULL; + + _bitshuffle = NULL; + _trigland = NULL; + + _Hwin = NULL; + _Wanal = _Wsyn = NULL; + + // ----------------------------- + + _bin_selection = NULL; +} + +V dentist::Delete() +{ + if(_input1) delete[] _input1; + if(_buffer1) delete[] _buffer1; + if(_channel1) delete[] _channel1; +/* + if(_input2) delete[] _input2; + if(_buffer2) delete[] _buffer2; + if(_channel2) delete[] _channel2; +*/ + if(_output) delete[] _output; + + if(_bitshuffle) delete[] _bitshuffle; + if(_trigland) delete[] _trigland; + + if(_Wanal) delete[] _Wanal; + if(_Wsyn) delete[] _Wsyn; + if(_Hwin) delete[] _Hwin; + + // ----------------------------- + + if(_bin_selection) delete[] _bin_selection; +} + + +V dentist::ms_knee(F f) +{ + _knee = f; // store original + + const F funda = Samplerate()/(2*_MULT_*Blocksize()); + + // TG: This is a different, but steady correction than in original fftease + if( f < funda ) f = funda; + else if(f > funda/2) f = funda/2; + + _max_bin = 1; + for(F curfreq = 0; curfreq < f; curfreq += funda) ++_max_bin; +} + + +V dentist::m_dsp(I n,S *const *in,S *const *out) +{ + const I _D = Blocksize(); + const F _R = Samplerate(); + if(_D != blsz || _R != smprt) { + blsz = _D; + smprt = _R; + + Delete(); + // --------------------------------------------- + + const int _N = _D*_MULT_,_Nw = _N,_Nw2 = _Nw>>1,_N2 = _N>>1; + + _inCount = -_Nw; + + _input1 = new F[_Nw]; + _buffer1 = new F[_N]; + _channel1 = new F[_N+2]; + /* + _input2 = new F[_Nw]; + _buffer2 = new F[_N]; + _channel2 = new F[_N+2]; + */ + + _output = new F[_Nw]; + + _bitshuffle = new I[_N*2]; + _trigland = new F[_N*2]; + + _Wanal = new F[_Nw]; + _Wsyn = new F[_Nw]; + _Hwin = new F[_Nw]; + + init_rdft( _N, _bitshuffle, _trigland); + makewindows( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0); + + // --------------------------------------------- + + // calculation of _max_bin + ms_knee(_knee); + + _bin_selection = new I[_N2]; + reset_shuffle(); + } +} + +V dentist::m_signal(I n,S *const *in,S *const *out) +{ + /* declare working variables */ + I i, j; + const I _D = blsz,_N = _D*_MULT_,_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; + + _inCount += _D; + + for ( j = 0 ; j < _N-_D ; j++ ) + _input1[j] = _input1[j+_D]; + for (i = 0; j < _N; j++,i++ ) + _input1[j] = in[0][i]; + + fold( _input1, _Wanal, _Nw, _buffer1, _N, _inCount ); + rdft( _N, 1, _buffer1, _bitshuffle, _trigland ); + + // ---- BEGIN -------------------------------- + + leanconvert( _buffer1, _channel1, _N2 ); + + for( i = 0; i < _N2 ; i++){ + if( !_bin_selection[i] ) _channel1[i*2] = 0; + } + + leanunconvert( _channel1, _buffer1, _N2 ); + + // ---- END -------------------------------- + + rdft( _N, -1, _buffer1, _bitshuffle, _trigland ); + overlapadd( _buffer1, _N, _Wsyn, _output, _Nw, _inCount); + + const F mult = 1./_N; + for ( j = 0; j < _D; j++ ) + out[0][j] = _output[j] * mult; + + for ( j = 0; j < _N-_D; j++ ) + _output[j] = _output[j+_D]; + for (; j < _N; j++ ) + _output[j] = 0.; +} + + +V dentist::reset_shuffle() +{ + const I _N2 = Blocksize()*_MULT_/2; + I teeth = _tooth_count; + + // check number of teeth + if( teeth < 0 ) teeth = 0; + else if( teeth > _N2 ) teeth = _N2; + + // clear and set random bins + I i; + for( i = 0; i < _N2; i++ ) + _bin_selection[i] = 0; + for( i = 0; i < _tooth_count; i++ ) + _bin_selection[rand()%_max_bin] = 1; +} diff --git a/externals/grill/fftease/src/disarray~.cpp b/externals/grill/fftease/src/disarray~.cpp new file mode 100644 index 00000000..428fe2d6 --- /dev/null +++ b/externals/grill/fftease/src/disarray~.cpp @@ -0,0 +1,286 @@ +/* + +FFTease - A set of Live Spectral Processors +Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform + +Copyright (c)Thomas Grill (xovo@gmx.net) +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see the file, "license.txt," in this distribution. + +*/ + +#include "main.h" +#include <stdlib.h> + +class disarray: + public flext_dsp +{ + FLEXT_HEADER_S(disarray,flext_dsp,setup) + +public: + disarray(I argc,const t_atom *argv); + ~disarray(); + +protected: + + virtual V m_dsp(I n,S *const *in,S *const *out); + virtual V m_signal(I n,S *const *in,S *const *out); + + I blsz; + F smprt; + + F *_input1,*_input2; + F *_buffer1,*_buffer2; + F *_channel1,*_channel2; + F *_output; + F *_trigland; + I *_bitshuffle; + F *_Wanal,*_Wsyn,*_Hwin; + + I _inCount,_nmult; + + // ----------------------------- + + BL _qual; + I _shuffle_count,_max_bin; + F _freq; + I *_shuffle_in,*_shuffle_out; + + + V reset_shuffle(); + +private: + V Clear(); + V Delete(); + + V ms_freq(F f); + + static V setup(t_classid c); + + FLEXT_CALLBACK(reset_shuffle) + FLEXT_ATTRGET_F(_freq) + FLEXT_CALLSET_F(ms_freq) +}; + +FLEXT_LIB_DSP_V("fftease, disarray~",disarray) + + +V disarray::setup(t_classid c) +{ + FLEXT_CADDBANG(c,0,reset_shuffle); + + FLEXT_CADDATTR_VAR(c,"freq",_freq,ms_freq); +} + + +disarray::disarray(I argc,const t_atom *argv): + blsz(0),smprt(0), + _freq(1300),_qual(false),_shuffle_count(20) +{ + /* parse and set object's options given */ + if(argc >= 1) { + if(CanbeFloat(argv[0])) + _freq = GetAFloat(argv[0]); + else + post("%s - Freq must be a float value - set to %0f",thisName(),_freq); + } + if(argc >= 2) { + if(CanbeBool(argv[1])) + _qual = GetABool(argv[1]); + else + post("%s - Quality must be a boolean value - set to %0i",thisName(),_qual?1:0); + } + if(argc >= 3) { + if(CanbeInt(argv[2])) + _shuffle_count = GetAInt(argv[2]); + else + post("%s - Shufflecount must be an integer value - set to %0i",thisName(),_shuffle_count); + } + + _nmult = _qual?4:2; + + Clear(); + + AddInSignal("Messages and input signal"); + AddOutSignal("Transformed signal"); +} + +disarray::~disarray() +{ + Delete(); +} + +V disarray::Clear() +{ + _input1 = _input2 = NULL; + _buffer1 = _buffer2 = NULL; + _channel1 = _channel2 = NULL; + _output = NULL; + + _bitshuffle = NULL; + _trigland = NULL; + + _Hwin = NULL; + _Wanal = _Wsyn = NULL; + + // ----------------------------- + + _shuffle_in = _shuffle_out = NULL; +} + +V disarray::Delete() +{ + if(_input1) delete[] _input1; + if(_buffer1) delete[] _buffer1; + if(_channel1) delete[] _channel1; +/* + if(_input2) delete[] _input2; + if(_buffer2) delete[] _buffer2; + if(_channel2) delete[] _channel2; +*/ + if(_output) delete[] _output; + + if(_bitshuffle) delete[] _bitshuffle; + if(_trigland) delete[] _trigland; + + if(_Wanal) delete[] _Wanal; + if(_Wsyn) delete[] _Wsyn; + if(_Hwin) delete[] _Hwin; + + // ----------------------------- + + if(_shuffle_in) delete[] _shuffle_in; + if(_shuffle_out) delete[] _shuffle_out; +} + + +V disarray::ms_freq(F f) +{ + _freq = f; // store original + + const F funda = Samplerate()/(2*_nmult*Blocksize()); + + // TG: This is a different, but steady correction than in original fftease + if( f < funda ) f = funda; + else if(f > funda/2) f = funda/2; + + _max_bin = 1; + for(F curfreq = 0; curfreq < f; curfreq += funda) ++_max_bin; +} + + +V disarray::m_dsp(I n,S *const *in,S *const *out) +{ + const I _D = Blocksize(); + const F _R = Samplerate(); + + if(_D != blsz || _R != smprt) { + blsz = _D; + smprt = _R; + + Delete(); + // --------------------------------------------- + + const int _N = _D*_nmult,_Nw = _N,_Nw2 = _Nw>>1,_N2 = _N>>1; + + _inCount = -_Nw; + + _input1 = new F[_Nw]; + _buffer1 = new F[_N]; + _channel1 = new F[_N+2]; + /* + _input2 = new F[_Nw]; + _buffer2 = new F[_N]; + _channel2 = new F[_N+2]; + */ + + _output = new F[_Nw]; + + _bitshuffle = new I[_N*2]; + _trigland = new F[_N*2]; + + _Wanal = new F[_Nw]; + _Wsyn = new F[_Nw]; + _Hwin = new F[_Nw]; + + init_rdft( _N, _bitshuffle, _trigland); + + if(_qual) + makewindows( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0); + else + makehanning( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0,0); + + // --------------------------------------------- + + _shuffle_in = new I[_N2]; + _shuffle_out = new I[_N2]; + + // calculate _max_bin + ms_freq(_freq); + + reset_shuffle(); + } +} + +V disarray::m_signal(I n,S *const *in,S *const *out) +{ + /* declare working variables */ + I i, j; + const I _D = blsz,_N = _D*_nmult,_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; + + _inCount += _D; + + for ( j = 0 ; j < _N-_D ; j++ ) + _input1[j] = _input1[j+_D]; + for (i = 0; j < _N; j++,i++ ) + _input1[j] = in[0][i]; + + fold( _input1, _Wanal, _Nw, _buffer1, _N, _inCount ); + rdft( _N, 1, _buffer1, _bitshuffle, _trigland ); + + // ---- BEGIN -------------------------------- + + leanconvert( _buffer1, _channel1, _N2 ); + + for( i = 0; i < _shuffle_count ; i++){ + F tmp = _channel1[ _shuffle_in[ i ] * 2 ]; + _channel1[ _shuffle_in[ i ] * 2] = _channel1[ _shuffle_out[ i ] * 2]; + _channel1[ _shuffle_out[ i ] * 2] = tmp; + } + + leanunconvert( _channel1, _buffer1, _N2 ); + + // ---- END -------------------------------- + + rdft( _N, -1, _buffer1, _bitshuffle, _trigland ); + overlapadd( _buffer1, _N, _Wsyn, _output, _Nw, _inCount); + + const F mult = 1./_N; + for ( j = 0; j < _D; j++ ) + out[0][j] = _output[j] * mult; + + for ( j = 0; j < _N-_D; j++ ) + _output[j] = _output[j+_D]; + for (; j < _N; j++ ) + _output[j] = 0.; +} + + +V disarray::reset_shuffle() +{ + const I _N2 = Blocksize()*_nmult/2; + + I i; + for( i = 0; i < _N2; i++ ) + _shuffle_out[i] = _shuffle_in[i] = i ; + + for( i = 0; i < 10000; i++ ) { + int p1 = _shuffle_out[ rand()%_max_bin ]; + int p2 = _shuffle_out[ rand()%_max_bin ]; + int temp = _shuffle_out[ p1 ]; + _shuffle_out[ p1 ] = _shuffle_out[ p2 ]; + _shuffle_out[ p2 ] = temp; + } + +} + diff --git a/externals/grill/fftease/src/drown~.cpp b/externals/grill/fftease/src/drown~.cpp new file mode 100644 index 00000000..0e4ee4a8 --- /dev/null +++ b/externals/grill/fftease/src/drown~.cpp @@ -0,0 +1,227 @@ +/* + +FFTease - A set of Live Spectral Processors +Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform + +Copyright (c)Thomas Grill (xovo@gmx.net) +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see the file, "license.txt," in this distribution. + +*/ + +#include "main.h" +#include <stdlib.h> + +class drown: + public flext_dsp +{ + FLEXT_HEADER_S(drown,flext_dsp,setup) + +public: + drown(I argc,const t_atom *argv); + ~drown(); + +protected: + + virtual V m_dsp(I n,S *const *in,S *const *out); + virtual V m_signal(I n,S *const *in,S *const *out); + + I blsz; + F smprt; + + F *_input1,*_input2; + F *_buffer1,*_buffer2; + F *_channel1,*_channel2; + F *_output; +// F *_trigland; + // I *_bitshuffle; + F *_Wanal,*_Wsyn,*_Hwin; + + I _inCount,_nmult; + + // ----------------------------- + +private: + V Clear(); + V Delete(); + + static V setup(t_classid c); +}; + +FLEXT_LIB_DSP_V("fftease, drown~",drown) + + +V drown::setup(t_classid c) +{ +} + + +drown::drown(I argc,const t_atom *argv): + blsz(0),smprt(0),_nmult(4) +{ + Clear(); + + AddInSignal("Messages and input signal"); + AddInSignal("Threshold generator signal"); + AddInSignal("Multiplier signal for weak bins"); + AddOutSignal("Transformed signal"); +} + +drown::~drown() +{ + Delete(); +} + +V drown::Clear() +{ + _input1 = _input2 = NULL; + _buffer1 = _buffer2 = NULL; + _channel1 = _channel2 = NULL; + _output = NULL; +/* + _bitshuffle = NULL; + _trigland = NULL; +*/ + _Hwin = NULL; + _Wanal = _Wsyn = NULL; + + // ----------------------------- + +} + +V drown::Delete() +{ + if(_input1) delete[] _input1; + if(_buffer1) delete[] _buffer1; + if(_channel1) delete[] _channel1; +/* + if(_input2) delete[] _input2; + if(_buffer2) delete[] _buffer2; + if(_channel2) delete[] _channel2; +*/ + if(_output) delete[] _output; +/* + if(_bitshuffle) delete[] _bitshuffle; + if(_trigland) delete[] _trigland; +*/ + if(_Wanal) delete[] _Wanal; + if(_Wsyn) delete[] _Wsyn; + if(_Hwin) delete[] _Hwin; + + // ----------------------------- + +} + + +V drown::m_dsp(I n,S *const *in,S *const *out) +{ + const I _D = Blocksize(); + const F _R = Samplerate(); + + if(_D != blsz || _R != smprt) { + blsz = _D; + smprt = _R; + + Delete(); + // --------------------------------------------- + + const int _N = _D*_nmult,_Nw = _N,_Nw2 = _Nw>>1,_N2 = _N>>1; + + _inCount = -_Nw; + + _input1 = new F[_Nw]; + _buffer1 = new F[_N]; + _channel1 = new F[_N+2]; + /* + _input2 = new F[_Nw]; + _buffer2 = new F[_N]; + _channel2 = new F[_N+2]; + */ + + _output = new F[_Nw]; + + /* + _bitshuffle = new I[_N*2]; + _trigland = new F[_N*2]; + init_rdft( _N, _bitshuffle, _trigland); + */ + + _Wanal = new F[_Nw]; + _Wsyn = new F[_Nw]; + _Hwin = new F[_Nw]; + makewindows( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0); + } +} + + +/* helper function */ +static void nudist( float *_S, float *_C, float threshold, float fmult, int N2 ) +{ + int real, imag, amp, phase; + int i; + float maxamp = 1.; + for ( i = 0; i <= N2; i++ ) { + imag = phase = ( real = amp = i<<1 ) + 1; + F a = ( i == N2 ? _S[1] : _S[real] ); + F b = ( i == 0 || i == N2 ? 0. : _S[imag] ); + + _C[amp] = hypot( a, b ); + if( _C[amp] < threshold) _C[amp] *= fmult; + + _C[phase] = -atan2( b, a ); + } + + for ( i = 0; i <= N2; i++ ) { + imag = phase = ( real = amp = i<<1 ) + 1; + _S[real] = _C[amp] * cos( _C[phase] ); + if ( i != N2 ) + _S[imag] = -_C[amp] * sin( _C[phase] ); + } +} + + +V drown::m_signal(I n,S *const *in,S *const *out) +{ + /* declare working variables */ + I i, j; + const I _D = blsz,_N = _D*_nmult,_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; + + _inCount += _D; + + for ( j = 0 ; j < _N-_D ; j++ ) + _input1[j] = _input1[j+_D]; + for (i = 0; j < _N; j++,i++ ) + _input1[j] = in[0][i]; + + fold( _input1, _Wanal, _Nw, _buffer1, _N, _inCount ); + +// rdft( _N, 1, _buffer1, _bitshuffle, _trigland ); + rfft( _buffer1, _N2, 1); + + // ---- BEGIN -------------------------------- + + { + // only first value of the signal vectors + const F thresh = in[1][0],mult = in[2][0]; + + nudist( _buffer1, _channel1, thresh, mult, _N2 ); + } + + // ---- END -------------------------------- + + rfft( _buffer1, _N2, 0); +// rdft( _N, -1, _buffer1, _bitshuffle, _trigland ); + + overlapadd( _buffer1, _N, _Wsyn, _output, _Nw, _inCount); + + const F mult = 1./_N; + for ( j = 0; j < _D; j++ ) + out[0][j] = _output[j] * mult; + + for ( j = 0; j < _N-_D; j++ ) + _output[j] = _output[j+_D]; + for (; j < _N; j++ ) + _output[j] = 0.; +} + + diff --git a/externals/grill/fftease/src/ether~.cpp b/externals/grill/fftease/src/ether~.cpp new file mode 100644 index 00000000..16fbaaff --- /dev/null +++ b/externals/grill/fftease/src/ether~.cpp @@ -0,0 +1,251 @@ +/* + +FFTease - A set of Live Spectral Processors +Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform + +Copyright (c)Thomas Grill (xovo@gmx.net) +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see the file, "license.txt," in this distribution. + +*/ + +#include "main.h" +#include <stdlib.h> + +class ether: + public flext_dsp +{ + FLEXT_HEADER_S(ether,flext_dsp,setup) + +public: + ether(I argc,const t_atom *argv); + ~ether(); + +protected: + + virtual V m_dsp(I n,S *const *in,S *const *out); + virtual V m_signal(I n,S *const *in,S *const *out); + + I blsz; + F smprt; + + F *_input1,*_input2; + F *_buffer1,*_buffer2; + F *_channel1,*_channel2; + F *_output; + F *_trigland; + I *_bitshuffle; + F *_Wanal,*_Wsyn,*_Hwin; + + I _inCount,_nmult; + + // ----------------------------- + + BL _qual,_invert; + F _threshMult; + +private: + V Clear(); + V Delete(); + + static V setup(t_classid c); + + + FLEXT_ATTRVAR_B(_invert) + FLEXT_ATTRVAR_F(_threshMult) +}; + +FLEXT_LIB_DSP_V("fftease, ether~",ether) + + +V ether::setup(t_classid c) +{ + FLEXT_CADDATTR_VAR1(c,"invert",_invert); + FLEXT_CADDATTR_VAR1(c,"thresh",_threshMult); +} + + +ether::ether(I argc,const t_atom *argv): + blsz(0),smprt(0), + _qual(false),_threshMult(0),_invert(false) +{ + /* parse and set object's options given */ + if(argc >= 1) { + if(CanbeBool(argv[0])) + _qual = GetABool(argv[0]); + else + post("%s - Quality must be a boolean value - set to %0i",thisName(),_qual?1:0); + } + + _nmult = _qual?4:2; + + Clear(); + + AddInSignal("Messages and input signal"); + AddInSignal("Reference signal"); + AddOutSignal("Transformed signal"); +} + +ether::~ether() +{ + Delete(); +} + +V ether::Clear() +{ + _input1 = _input2 = NULL; + _buffer1 = _buffer2 = NULL; + _channel1 = _channel2 = NULL; + _output = NULL; + + _bitshuffle = NULL; + _trigland = NULL; + + _Hwin = NULL; + _Wanal = _Wsyn = NULL; + + // ----------------------------- +} + +V ether::Delete() +{ + if(_input1) delete[] _input1; + if(_buffer1) delete[] _buffer1; + if(_channel1) delete[] _channel1; + + if(_input2) delete[] _input2; + if(_buffer2) delete[] _buffer2; + if(_channel2) delete[] _channel2; + + if(_output) delete[] _output; + + if(_bitshuffle) delete[] _bitshuffle; + if(_trigland) delete[] _trigland; + + if(_Wanal) delete[] _Wanal; + if(_Wsyn) delete[] _Wsyn; + if(_Hwin) delete[] _Hwin; + + // ----------------------------- + +} + + +V ether::m_dsp(I n,S *const *in,S *const *out) +{ + const I _D = Blocksize(); + const F _R = Samplerate(); + + if(_D != blsz || _R != smprt) { + blsz = _D; + smprt = _R; + + Delete(); + // --------------------------------------------- + + const int _N = _D*_nmult,_Nw = _N,_Nw2 = _Nw>>1,_N2 = _N>>1; + + _inCount = -_Nw; + + _input1 = new F[_Nw]; + _buffer1 = new F[_N]; + _channel1 = new F[_N+2]; + + _input2 = new F[_Nw]; + _buffer2 = new F[_N]; + _channel2 = new F[_N+2]; + + _output = new F[_Nw]; + + _bitshuffle = new I[_N*2]; + _trigland = new F[_N*2]; + + _Wanal = new F[_Nw]; + _Wsyn = new F[_Nw]; + _Hwin = new F[_Nw]; + + init_rdft( _N, _bitshuffle, _trigland); + + if(_qual) + makewindows( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0); + else + makehanning( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0,0); + } +} + +V ether::m_signal(I n,S *const *in,S *const *out) +{ + /* declare working variables */ + I i, j; + const I _D = blsz,_N = _D*_nmult,_Nw = _N,_N2 = _N/2,_Nw2 = _Nw/2; + + _inCount += _D; + + for ( j = 0 ; j < _N-_D ; j++ ) { + _input1[j] = _input1[j+_D]; + _input2[j] = _input2[j+_D]; + } + for (i = 0; j < _N; j++,i++ ) { + _input1[j] = in[0][i]; + _input2[j] = in[1][i]; + } + + fold( _input1, _Wanal, _Nw, _buffer1, _N, _inCount ); + fold( _input2, _Wanal, _Nw, _buffer2, _N, _inCount ); + + rdft( _N, 1, _buffer1, _bitshuffle, _trigland ); + rdft( _N, 1, _buffer2, _bitshuffle, _trigland ); + + // ---- BEGIN -------------------------------- + + F threshMult = _threshMult; + if (threshMult == 0. ) threshMult = 1; + + for ( i = 0; i <= _N2; i++ ) { + int even = i<<1,odd = even + 1; + + /* convert to polar coordinates from complex values */ + register F a,b; + + a = ( i == _N2 ? _buffer1[1] : _buffer1[even] ); + b = ( i == 0 || i == _N2 ? 0. : _buffer1[odd] ); + + _channel1[even] = hypot( a, b ); + _channel1[odd] = -atan2( b, a ); + + a = ( i == _N2 ? _buffer2[1] : _buffer2[even] ); + b = ( i == 0 || i == _N2 ? 0. : _buffer2[odd] ); + + _channel2[even] = hypot( a, b ); + _channel2[odd] = -atan2( b, a ); + + /* use simple threshold for inverse compositing */ + + if(_invert?(_channel1[even] > _channel2[even]*threshMult):(_channel1[even] < _channel2[even]*threshMult) ) + _channel1[even] = _channel2[even]; + + if (_channel1[odd] == 0. ) _channel1[odd] = _channel2[odd]; + + + /* convert back to complex form, read for the inverse fft */ + _buffer1[even] = _channel1[even] * cos( _channel1[odd] ); + + if (i != _N2 ) + _buffer1[odd] = -_channel1[even] * sin( _channel1[odd] ); + } + + // ---- END -------------------------------- + + rdft( _N, -1, _buffer1, _bitshuffle, _trigland ); + overlapadd( _buffer1, _N, _Wsyn, _output, _Nw, _inCount); + + const F mult = 1./_N; + for ( j = 0; j < _D; j++ ) + out[0][j] = _output[j] * mult; + + for ( j = 0; j < _N-_D; j++ ) + _output[j] = _output[j+_D]; + for (; j < _N; j++ ) + _output[j] = 0.; +} + diff --git a/externals/grill/fftease/src/main.cpp b/externals/grill/fftease/src/main.cpp index 1d627cf2..914d1f43 100644 --- a/externals/grill/fftease/src/main.cpp +++ b/externals/grill/fftease/src/main.cpp @@ -3,8 +3,6 @@ FFTease - A set of Live Spectral Processors Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform -This flext port is based on the jMax port of Christian Klippel - Copyright (c)Thomas Grill (xovo@gmx.net) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -23,20 +21,18 @@ V lib_setup() post("Originally written by Eric Lyon and Christopher Penrose"); post("for the MAX/MSP platform."); post(""); - post("flext port done by Thomas Grill, (C)2003"); + post("flext port provided by Thomas Grill, (C)2003"); post("-------------------------------------------------------"); post(""); // call the objects' setup routines FLEXT_DSP_SETUP(burrow); - -/* FLEXT_DSP_SETUP(cross); FLEXT_DSP_SETUP(dentist); FLEXT_DSP_SETUP(disarray); FLEXT_DSP_SETUP(drown); FLEXT_DSP_SETUP(ether); - +/* FLEXT_DSP_SETUP(morphine); FLEXT_DSP_SETUP(pvcompand); FLEXT_DSP_SETUP(pvoc); @@ -51,7 +47,12 @@ V lib_setup() */ #if FLEXT_SYS == FLEXT_SYS_MAX -// finder_addclass((C *)"FFTease",(C *)"xxxxx"); + finder_addclass((C *)"FFTease",(C *)"burrow~"); + finder_addclass((C *)"FFTease",(C *)"cross~"); + finder_addclass((C *)"FFTease",(C *)"dentist~"); + finder_addclass((C *)"FFTease",(C *)"disarray~"); + finder_addclass((C *)"FFTease",(C *)"drown~"); + finder_addclass((C *)"FFTease",(C *)"ether~"); #endif } diff --git a/externals/grill/fftease/src/main.h b/externals/grill/fftease/src/main.h index c0fb56f8..6dbddf7e 100644 --- a/externals/grill/fftease/src/main.h +++ b/externals/grill/fftease/src/main.h @@ -3,8 +3,6 @@ FFTease - A set of Live Spectral Processors Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform -This flext port is based on the jMax port of Christian Klippel - Copyright (c)Thomas Grill (xovo@gmx.net) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -16,6 +14,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #define FFTEASE_VERSION "0.0.1" + #define FLEXT_ATTRIBUTES 1 #include <flext.h> @@ -24,6 +23,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #error You need at least flext version 0.4.1 #endif + #include "pv.h" // lazy me diff --git a/externals/grill/flext/flext.cw b/externals/grill/flext/flext.cw Binary files differindex a2cad0cb..c8f435c8 100644 --- a/externals/grill/flext/flext.cw +++ b/externals/grill/flext/flext.cw diff --git a/externals/grill/flext/source/flmsg.cpp b/externals/grill/flext/source/flmsg.cpp index 3041ea0b..95f9790a 100755 --- a/externals/grill/flext/source/flmsg.cpp +++ b/externals/grill/flext/source/flmsg.cpp @@ -47,7 +47,7 @@ bool flext_base::CallMeth(const methitem &m,int argc,const t_atom *argv) } #if FLEXT_SYS == FLEXT_SYS_PD case a_pointer: { - if(IsPointer(argv[ix])) aargs[ix].pt = GetPointer(argv[ix]); + if(IsPointer(argv[ix])) aargs[ix].pt = (t_gpointer *)GetPointer(argv[ix]); else ok = false; break; } diff --git a/externals/grill/flext/source/flprefix.h b/externals/grill/flext/source/flprefix.h index fc9846a9..c6e0a267 100755 --- a/externals/grill/flext/source/flprefix.h +++ b/externals/grill/flext/source/flprefix.h @@ -36,6 +36,15 @@ WARRANTIES, see the file, "license.txt," in this distribution. #define FLEXT_SYS FLEXT_SYS_PD #endif +#ifndef FLEXT_SYS_JMAX + #define FLEXT_SYS_JMAX 3 +#else + // already defined + #undef FLEXT_SYS_JMAX + #define FLEXT_SYS_JMAX 3 + #define FLEXT_SYS FLEXT_SYS_JMAX +#endif + // --- definitions for FLEXT_OS ---------------------- #define FLEXT_OS_UNKNOWN 0 #define FLEXT_OS_WIN 1 @@ -78,8 +87,9 @@ WARRANTIES, see the file, "license.txt," in this distribution. // Definition of supported real-time systems #if FLEXT_SYS == FLEXT_SYS_MAX #elif FLEXT_SYS == FLEXT_SYS_PD +#elif FLEXT_SYS == FLEXT_SYS_JMAX #else - #error "System must be defined by either FLEXT_SYS_MAX or FLEXT_SYS_PD" + #error "System must be defined by either FLEXT_SYS_MAX, FLEXT_SYS_PD or FLEXT_SYS_JMAX" #endif // Definition of OS/CPU diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp index ec3b5ef7..f8717d02 100644 --- a/externals/grill/flext/source/flsupport.cpp +++ b/externals/grill/flext/source/flsupport.cpp @@ -57,7 +57,11 @@ void flext::Setup() void *flext::operator new(size_t bytes) { bytes += sizeof(size_t); - char *blk = (char *)getbytes(bytes); +#if FLEXT_SYS == FLEXT_SYS_JMAX + char *blk = (char *)::fts_malloc(bytes); +#else + char *blk = (char *)::getbytes(bytes); +#endif *(size_t *)blk = bytes; return blk+sizeof(size_t); } @@ -66,7 +70,11 @@ void flext::operator delete(void *blk) { char *ori = (char *)blk-sizeof(size_t); size_t bytes = *(size_t *)ori; - freebytes(ori,bytes); +#if FLEXT_SYS == FLEXT_SYS_JMAX + ::fts_free(ori); +#else + ::freebytes(ori,bytes); +#endif } void *flext::NewAligned(size_t bytes,int bitalign) @@ -74,7 +82,11 @@ void *flext::NewAligned(size_t bytes,int bitalign) const size_t ovh = sizeof(size_t)+sizeof(char *); const unsigned long alignovh = bitalign/8-1; bytes += ovh+alignovh; - char *blk = (char *)getbytes(bytes); +#if FLEXT_SYS == FLEXT_SYS_JMAX + char *blk = (char *)::fts_malloc(bytes); +#else + char *blk = (char *)::getbytes(bytes); +#endif char *ablk = reinterpret_cast<char *>((reinterpret_cast<unsigned long>(blk)+ovh+alignovh) & ~alignovh); *(char **)(ablk-sizeof(size_t)-sizeof(char *)) = blk; *(size_t *)(ablk-sizeof(size_t)) = bytes; @@ -85,11 +97,17 @@ void flext::FreeAligned(void *blk) { char *ori = *(char **)((char *)blk-sizeof(size_t)-sizeof(char *)); size_t bytes = *(size_t *)((char *)blk-sizeof(size_t)); - freebytes(ori,bytes); + +#if FLEXT_SYS == FLEXT_SYS_JMAX + ::fts_free(ori); +#else + ::freebytes(ori,bytes); +#endif } // ------------------------------------------ +//! \todo there is probably also a shortcut for Max and jMax void flext::GetAString(const t_atom &a,char *buf,int szbuf) { #if FLEXT_SYS == FLEXT_SYS_PD diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index 0c0c62c9..fd3992f8 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -33,6 +33,18 @@ class FLEXT_SHARE flext { */ public: +// --- types ------------------------------------------------------- + +#if FLEXT_SYS == FLEXT_SYS_JMAX + typedef fts_symbol_t t_symbol; + typedef fts_atom_t t_atom; + typedef fts_class_t t_class; +#else +// typedef t_symbol t_symbol; +// typedef t_atom t_atom; +// typedef t_class t_class; +#endif + // --- memory ------------------------------------------------------- /*! \defgroup FLEXT_S_MEMORY Memory allocation functions @@ -202,21 +214,39 @@ public: static const t_symbol *sym_signal; #endif +#if FLEXT_SYS == FLEXT_SYS_JMAX //! Make a symbol from a string - static const t_symbol *MakeSymbol(const char *s) { return gensym(const_cast<char *>(s)); } - + static const t_symbol *MakeSymbol(const char *s) { return ::fts_new_symbol(s); } + //! Get symbol string + static const char *GetString(const t_symbol *s); // ** TODO ** +#else + //! Make a symbol from a string + static const t_symbol *MakeSymbol(const char *s) { return ::gensym(const_cast<char *>(s)); } //! Get symbol string static const char *GetString(const t_symbol *s) { return s->s_name; } +#endif //! Check for symbol and get string static const char *GetAString(const t_symbol *s,const char *def = "") { return s?GetString(s):def; } // --- atom stuff ---------------------------------------- //! Set atom from another atom - static int GetType(const t_atom &a) { return a.a_type; } + static void SetAtom(t_atom &a,const t_atom &b) { CopyAtom(&a,&b); } +#if FLEXT_SYS == FLEXT_SYS_JMAX //! Set atom from another atom - static void SetAtom(t_atom &a,const t_atom &b) { CopyAtom(&a,&b); } + static int GetType(const t_atom &a) // ** TODO ** + + //! Check whether the atom is nothing + static bool IsNothing(const t_atom &a) // ** TODO ** + //! Set the atom to represent nothing + static void SetNothing(t_atom &a) // ** TODO ** + + //! Check whether the atom is a float + static bool IsFloat(const t_atom &a) // ** TODO ** +#else + //! Set atom from another atom + static int GetType(const t_atom &a) { return a.a_type; } //! Check whether the atom is nothing static bool IsNothing(const t_atom &a) { return a.a_type == A_NULL; } @@ -225,8 +255,20 @@ public: //! Check whether the atom is a float static bool IsFloat(const t_atom &a) { return a.a_type == A_FLOAT; } +#endif + //! Check whether the atom can be represented as a float static bool CanbeFloat(const t_atom &a) { return IsFloat(a) || IsInt(a); } + +#if FLEXT_SYS == FLEXT_SYS_JMAX + //! Access the float value (without type check) + static float GetFloat(const t_atom &a); // ** TODO ** + //! Set the atom to represent a float + static void SetFloat(t_atom &a,float v) // ** TODO ** + + //! Check whether the atom is a symbol + static bool IsSymbol(const t_atom &a) // ** TODO ** +#else //! Access the float value (without type check) static float GetFloat(const t_atom &a) { return a.a_w.w_float; } //! Set the atom to represent a float @@ -234,16 +276,25 @@ public: //! Check whether the atom is a symbol static bool IsSymbol(const t_atom &a) { return a.a_type == A_SYMBOL; } +#endif + #if FLEXT_SYS == FLEXT_SYS_PD //! Access the symbol value (without type check) static t_symbol *GetSymbol(const t_atom &a) { return a.a_w.w_symbol; } //! Set the atom to represent a symbol static void SetSymbol(t_atom &a,const t_symbol *s) { a.a_type = A_SYMBOL; a.a_w.w_symbol = const_cast<t_symbol *>(s); } -#else +#elif FLEXT_SYS == FLEXT_SYS_MAX //! Access the symbol value (without type check) static t_symbol *GetSymbol(const t_atom &a) { return a.a_w.w_sym; } //! Set the atom to represent a symbol static void SetSymbol(t_atom &a,const t_symbol *s) { a.a_type = A_SYMBOL; a.a_w.w_sym = const_cast<t_symbol *>(s); } +#elif FLEXT_SYS == FLEXT_SYS_JMAX + //! Access the symbol value (without type check) + static t_symbol *GetSymbol(const t_atom &a); // ** TODO ** + //! Set the atom to represent a symbol + static void SetSymbol(t_atom &a,const t_symbol *s) { ::fts_set_symbol(&a,s); } +#else +#error #endif //! Check for a symbol and get its value static t_symbol *GetASymbol(const t_atom &a,t_symbol *def = NULL) { return IsSymbol(a)?GetSymbol(a):def; } // NULL or empty symbol? @@ -285,7 +336,7 @@ public: //! Check whether the atom can be a pointer static bool CanbePointer(const t_atom &a) { return IsPointer(a); } //! Access the pointer value (without type check) - static t_gpointer *GetPointer(const t_atom &a) { return a.a_w.w_gpointer; } + static void *GetPointer(const t_atom &a) { return a.a_w.w_gpointer; } //! Check for a pointer and get its value static void *GetAPointer(const t_atom &a,void *def = NULL) { return IsPointer(a)?GetPointer(a):def; } //! Set the atom to represent a pointer @@ -308,12 +359,37 @@ public: static bool IsPointer(const t_atom &) { return false; } //! Check whether the atom can be a pointer static bool CanbePointer(const t_atom &a) { return IsInt(a); } + //! Access the pointer value (without type check) + static void *GetPointer(const t_atom &a) { return NULL; } //! Check for a pointer and get its value static void *GetAPointer(const t_atom &a,void *def = NULL) { return IsInt(a)?(void *)GetInt(a):def; } //! Set the atom to represent a pointer static void SetPointer(t_atom &a,void *p) { SetInt(a,(int)p); } +#elif FLEXT_SYS == FLEXT_SYS_JMAX + //! Check for a float and get its value + static float GetAFloat(const t_atom &a,float def = 0) { return IsFloat(a)?GetFloat(a):(IsInt(a)?GetInt(a):def); } + + //! Check whether the atom is an int + static bool IsInt(const t_atom &a); // ** TODO ** + //! Access the integer value (without type check) + static int GetInt(const t_atom &a); // ** TODO ** + //! Check for an integer and get its value + static int GetAInt(const t_atom &a,int def = 0) { return IsInt(a)?GetInt(a):(IsFloat(a)?(int)GetFloat(a):def); } + //! Set the atom to represent an integer + static void SetInt(t_atom &a,int v) { ::fts_set_long(&a,v); } + + //! Check whether the atom strictly is a pointer + static bool IsPointer(const t_atom &); // ** TODO ** + //! Check whether the atom can be a pointer + static bool CanbePointer(const t_atom &a) { return IsPointer(a); } + //! Access the pointer value (without type check) + static void *GetPointer(const t_atom &a) { return ::fts_get_ptr(&a,NULL); } + //! Check for a pointer and get its value + static void *GetAPointer(const t_atom &a,void *def = NULL) { return ::fts_get_ptr(&a,def); } + //! Set the atom to represent a pointer + static void SetPointer(t_atom &a,void *p) { ::fts_set_ptr(&a,p); } #else -#error +#error "Platform not supported" #endif // --- atom list stuff ------------------------------------------- diff --git a/externals/grill/py/config-pd-darwin.txt b/externals/grill/py/config-pd-darwin.txt index ce0275ad..7f5dbbb8 100755 --- a/externals/grill/py/config-pd-darwin.txt +++ b/externals/grill/py/config-pd-darwin.txt @@ -1,8 +1,8 @@ # py/pyext - python script objects for PD and Max/MSP # Copyright (c) 2002 Thomas Grill (xovo@gmx.net) # -# your c++ compiler (normally g++) -CXX=g++ +# your c++ compiler (define only if not g++) +# CXX=g++ # where are the PD header files? # leave it blank if it is a system directory (like /usr/local/include), diff --git a/externals/grill/py/config-pd-linux.txt b/externals/grill/py/config-pd-linux.txt index e3f6ccdf..16f65f6e 100644 --- a/externals/grill/py/config-pd-linux.txt +++ b/externals/grill/py/config-pd-linux.txt @@ -2,8 +2,8 @@ # Copyright (c) 2002 Thomas Grill (xovo@gmx.net) # -# your c++ compiler (normally g++) -CXX=g++ +# your c++ compiler (define only if not g++) +# CXX=g++ # where are the PD header files? # leave it blank if it is a system directory (like /usr/local/include), diff --git a/externals/grill/vasp/vasp.cw b/externals/grill/vasp/vasp.cw Binary files differindex 34c30254..f45bff31 100644 --- a/externals/grill/vasp/vasp.cw +++ b/externals/grill/vasp/vasp.cw |