lists@iem
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
List overview
Download
Pd-cvs
November 2005
----- 2025 -----
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
pd-cvs@lists.iem.at
17 participants
497 discussions
Start a n
N
ew thread
pd/src desire.tk,1.1.2.121,1.1.2.122
by chunlee
15 Nov '05
15 Nov '05
Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1887 Modified Files: Tag: devel_0_39 desire.tk Log Message: bang rendering code fixed, class hierarchy might not be entirely correct and there might be some duped code. will Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.121 retrieving revision 1.1.2.122 diff -C2 -d -r1.1.2.121
…
[View More]
-r1.1.2.122 *** desire.tk 12 Nov 2005 19:46:33 -0000 1.1.2.121 --- desire.tk 15 Nov 2005 03:25:46 -0000 1.1.2.122 *************** *** 689,694 **** # in the future, one view may have several canvases. (??) # this would mean that the following proc will have to die. ! def view canvas {} {return $@canvas} ! def view canvas= {c} {set @canvas $c} #-----------------------------------------------------------------------------------# --- 689,694 ---- # in the future, one view may have several canvases. (??) # this would mean that the following proc will have to die. ! def* view canvas {} {return $@canvas} ! def* view canvas= {c} {set @canvas $c} #-----------------------------------------------------------------------------------# *************** *** 743,747 **** {Comment {pd %W text 0} "Ctrl+5"} {} ! {Bang {bang_new} "Alt+b"} {Toggle {pd %W toggle 0} "Alt+t"} {Number2 {pd %W numbox 0} "Alt+n"} --- 743,747 ---- {Comment {pd %W text 0} "Ctrl+5"} {} ! {Bang {pd %W bng %X %Y} "Alt+b"} {Toggle {pd %W toggle 0} "Alt+t"} {Number2 {pd %W numbox 0} "Alt+n"} *************** *** 1013,1017 **** # wow. what is this for? ! # to switch between edit/run mode with ctrl+1 -chun def canvas editmodeswitch {args} { set name .$self --- 1013,1017 ---- # wow. what is this for? ! # to switch between edit/run mode with ctrl+e -chun def canvas editmodeswitch {args} { set name .$self *************** *** 1081,1084 **** --- 1081,1086 ---- set cmd $accels(alt+$key) regsub -all %W $cmd $topname cmd + regsub -all %X $cmd $@current_x cmd + regsub -all %Y $cmd $@current_y cmd puts $cmd eval $cmd *************** *** 1158,1162 **** } ! def textbox draw {} { # TEXT = the text label # text = the input text field --- 1160,1164 ---- } ! def* textbox draw {} { # TEXT = the text label # text = the input text field *************** *** 1947,1951 **** #-----------------------------------------------------------------------------------# class_new box {view} ! class_new wire {view} def* box init {args} { --- 1949,1953 ---- #-----------------------------------------------------------------------------------# class_new box {view} ! def* box init {args} { *************** *** 1961,1964 **** --- 1963,1995 ---- } + def* box draw {} { + + } + + def box bbox {} { + mset {x y} [$self xy] + list $x $y [expr $x+$@xs] [expr $y+$@ys] + } + + # type is i or o + def box hilite_io {type x y} { + global look + mset {cx cy} [$self xy] + set c .$(a)canvas.c + set ports 0; catch {switch $type {i {set ports $@ninlets} o {set ports $@noutlets}}} + if {$ports==0} return + set port [expr int(($x-$cx)*$ports/$@xs)] + if {$port >= $ports} {set port [expr $ports-1]} + set p ${self}${type}${port} + #if {![llength $@wire_from]} {} + set outline [switch $type {i {list $look(outletfg)} o {list $look(inletfg)}}] + $c create rectangle [l+ [$c coords $p] {-4 -4 +4 +4}] -outline $outline -width 1 -tags ${p}b + switch $type {i {set tip "inlet $port"} o {set tip "outlet $port"}} + $@canvas show_tooltip $x $y $tip + return $port + } + #-----------------------------------------------------------------------------------# + class_new wire {view} + def* wire init {children from outno to inno} { super *************** *** 2100,2105 **** obj {set i 4; set class [lindex $d 4]} } - puts "class = $class" - if {![info exists _($x:_class)]} { # new object --- 2131,2134 ---- *************** *** 2119,2123 **** set _($x:_class) objectbox } ! $x init #puts "_($x:_class)=$_($x:_class)" --- 2148,2152 ---- set _($x:_class) objectbox } ! #puts "+++++++ class:$_($x:_class) ++++++" $x init #puts "_($x:_class)=$_($x:_class)" *************** *** 2220,2225 **** } ! class_new bluebox {labeled view} ! def bluebox draw {x1 y1 xs ys ins outs} { global look set x2 [expr $x1+$xs] --- 2249,2256 ---- } ! class_new bluebox {box} ! #class_new bluebox {labeled view} ! ! def* bluebox makebox {x1 y1 xs ys ins outs} { global look set x2 [expr $x1+$xs] *************** *** 2234,2238 **** io_draw $self if {[$self selected?]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)} ! $@canvas itemconfigure ${self}BASE -outline $frcol } --- 2265,2273 ---- io_draw $self if {[$self selected?]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)} ! .$(a)canvas.c itemconfigure ${self}BASE -outline $frcol ! } ! ! def bluebox motionedit {args} { ! #puts "motions in $self in edit mode" } *************** *** 2520,2527 **** #-----------------------------------------------------------------------------------# ! class_new bang {view} ! def bang init {} { super ! puts "init bang!!!!!!!" } --- 2555,2566 ---- #-----------------------------------------------------------------------------------# ! #class_new bang {view} ! class_new bang {bluebox} ! def* bang init {args} { ! puts "!!!!!! args:$args" super ! set @w 15 ! set @xs $@w ! set @ys $@w } *************** *** 2531,2554 **** def bang noutlets {} {return $@noutlets} ! def bang draw {} { mset {x1 y1} [$self xy] ! set @ninlets [expr [string compare $@rcv empty]==0] ! set @noutlets [expr [string compare $@snd empty]==0] set colour [parse_color $@bcol] #super set xs $@w; set x2 [expr $x1+$xs] set ys $@w; set y2 [expr $y1+$ys] $self item BUT oval \ [list [expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2]] \ ! -fill [bluify $colour] -tags ${self}BUT } def bang click {x y b f} { ! pd x$self click $x $y 0 0 0 } def bang bang {} { ! $canvas itemconfigure ${self}BUT -fill [bluify [parse_color $@fcol]] ! after 100 [list $@canvas itemconfigure ${self}BUT -fill [bluify [parse_color $@bcol]]] } --- 2570,2614 ---- def bang noutlets {} {return $@noutlets} ! def* bang draw {} { mset {x1 y1} [$self xy] ! #set @ninlets [expr [string compare $@rcv empty]==0] ! #set @noutlets [expr [string compare $@snd empty]==0] set colour [parse_color $@bcol] #super set xs $@w; set x2 [expr $x1+$xs] set ys $@w; set y2 [expr $y1+$ys] + $self makebox $x1 $y1 $@w $@w $@ninlets $@noutlets $self item BUT oval \ [list [expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2]] \ ! -fill [bluify $colour] -tags "${self}BUT $self" ! } ! ! def* bang clickedit {x y butt key in_selection selection} { ! global _ ! #handles the shift click ! #if {($f&1) && !$already} {post "add to selection?"; return} ! if {($key&1) && $selection>0} { ! puts "add $self to selection...." ! } ! #if clicked obj is part of the $@selection, than.... ! if {$in_selection && [llength $selection]>1} { ! set _($@canvas:action) move ! } { ! $@canvas deselect_all ! set _($@canvas:selection) $self ! set _($@canvas:action) move ! } ! ! } def bang click {x y b f} { ! pd $self click $x $y 0 0 0 ! $self bang } def bang bang {} { ! .$(a)canvas.c itemconfigure ${self}BUT -fill [bluify [parse_color $@fcol]] ! after 100 [list .$(a)canvas.c itemconfigure ${self}BUT -fill [bluify [parse_color $@bcol]]] }
[View Less]
1
0
0
0
externals/build/win makefile.nmake, NONE, 1.1 makefile, 1.10, 1.11 m_pd.h, 1.2, NONE
by Hans-Christoph Steiner
15 Nov '05
15 Nov '05
Update of /cvsroot/pure-data/externals/build/win In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28623 Modified Files: makefile Added Files: makefile.nmake Removed Files: m_pd.h Log Message: got basically everything building with MinGW, now got to get things linking dynamically instead of statically --- NEW FILE: makefile.nmake --- # ----------------------- NT ----------------------- EXTERNALS=\ #!IF ![f exist filelist.inc del filelist.inc & for %i in (*.c) do @echo %i \>
…
[View More]
> filelist.inc] !INCLUDE filelist.inc #!ENDIF all: filelist.inc link.stamp $(EXTERNALS:.c=.dll) .SUFFIXES: .dll PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo VC="C:\Program Files\Microsoft Visual Studio\Vc98" SRCPATH=..\src PDNTINCLUDE = /I. /I.. /I..\..\..\pd\src /I$(VC)\include PDNTLDIR = $(VC)\lib PDNTLIB = $(PDNTLDIR)\libc.lib \ $(PDNTLDIR)\oldnames.lib \ $(PDNTLDIR)\kernel32.lib \ $(PDNTLDIR)\wsock32.lib \ ..\..\..\pd\bin\pd.lib .c.dll: cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c link /dll /export:$(*:~=_tilde)_setup $(*).obj $(PDNTLIB) del $*.obj $*.lib $*.exp filelist.inc: if exist filelist.inc del filelist.inc # for %i in ($(SRCPATH)\*.c) do @echo %~ni%~xi \>> filelist.inc for %i in ($(SRCPATH)\*.c) do @echo %~ni%~xi \>> filelist.inc transfer: copy $(SRCPATH)\*.c . link.stamp: filelist.inc copy $(SRCPATH)\*.c . copy /y nul link.stamp nmake clean: # don't delete filelist.inc at the moment, as some externals can't be compiled # on win32 -del link.stamp -del *.c -del *.obj -del *.lib -del *.exp -del *.dll --- m_pd.h DELETED --- Index: makefile =================================================================== RCS file: /cvsroot/pure-data/externals/build/win/makefile,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** makefile 22 May 2005 13:59:31 -0000 1.10 --- makefile 15 Nov 2005 02:42:34 -0000 1.11 *************** *** 2,14 **** # Adapt the PDPATH if your pd is not installed in the standard place ! PDPATH="$(PROGRAMFILES)/pd" ! ! ! EXTERNALS = $(shell ls ../src) ! all: ! make -k externals externals: $(EXTERNALS:.c=.dll) --- 2,13 ---- # Adapt the PDPATH if your pd is not installed in the standard place ! # path for compiling against an installed version of Pd ! #PDPATH="$(PROGRAMFILES)/pd" ! # path for compiling from CVS with the standard developer layout ! PDPATH=../../../pd EXTERNALS = $(shell ls ../src) ! all: externals externals: $(EXTERNALS:.c=.dll) *************** *** 16,33 **** .SUFFIXES: .dll ! DEFINES = -DPD -DNT ! CFLAGS = -Wall -W -Wshadow -Wstrict-prototypes \ ! -Wno-unused -Wno-parentheses -Wno-switch INCLUDE = -I. -I.. -I$(PDPATH)/src %.dll: ../src/%.c ! $(CC) -mms-bitfields $(CFLAGS) $(DEFINES) $(INCLUDE) -o "$*.o" -c "../src/$*.c" gcc -shared -o "$*.dll" "$*.o" $(PDPATH)/bin/pd.dll \ ! `test -f $*.libs && cat $*.libs` `test -f ../src/$*.libs && cat ../src/$*.libs` clean: ! -rm *.a *.def *.dll *.o install-doc: --- 15,63 ---- .SUFFIXES: .dll ! # these are little macros for remapping things on Windows ! WINDOWS_COMPAT_DEFINES = \ ! -D'drand48()=((double)rand()/RAND_MAX)' \ ! -D'srand48(n)=srand((n))' \ ! # -D'bzero(p,n)=memset(p,0,n)' \ ! # -D'PROT_READ=1' \ ! # -D'MAP_PRIVATE=2' \ ! # -D'O_NONBLOCK=1' \ ! # -D'O_NDELAY=O_NONBLOCK' ! ! DEFINES = -DPD -DNT $(WINDOWS_COMPAT_DEFINES) ! ! ! # Generic x86 (tune for 686, since that's most common these days) ! OPTIM_FLAGS = -O2 -march=i686 -mfpmath=sse -msse ! # Pentium MMX ! #OPTIM_FLAGS = -O3 -march=pentium-mmx -mmmx ! # Pentium Pro ! #OPTIM_FLAGS = -O3 -march=pentiumpro -mmmx ! # Pentium II/Celeron ! #OPTIM_FLAGS = -O3 -mfpmath=sse -mmmx -msse -march=pentium2 ! # Pentium III/Celeron2 ! #OPTIM_FLAGS = -O3 -mfpmath=sse -mmmx -msse -march=pentium3 ! # Pentium 4 ! #OPTIM_FLAGS = -O3 -mfpmath=sse -mmmx -msse -msse2 -march=pentium4 ! ! # AMD Athlon XP K7 ! #OPTIM_FLAGS = -O3 -march=athlon-xp -m3dnow -msse -mfpmath=sse ! ! CFLAGS = -Wall -W -Wshadow -Wstrict-prototypes -Wno-unused -Wno-parentheses \ ! -Wno-switch $(OPTIM_FLAGS) INCLUDE = -I. -I.. -I$(PDPATH)/src + DLLWRAP_FLAGS = --as=$(AS) --export-all --driver-name $(CC) -s %.dll: ../src/%.c ! $(CC) -mms-bitfields $(CFLAGS) $(DEFINES) $(INCLUDE) \ ! -o "$*.o" -c "../src/$*.c" gcc -shared -o "$*.dll" "$*.o" $(PDPATH)/bin/pd.dll \ ! `test -f $*.libs && cat $*.libs` \ ! `test -f ../src/$*.libs && cat ../src/$*.libs` clean: ! -rm *.a *.def *.dll *.o *.obj install-doc:
[View Less]
1
0
0
0
externals/build/src ENV.c, 1.1, 1.2 bdiag~.c, 1.2, 1.3 bfft~.c, 1.1, 1.2 diag~.c, 1.2, 1.3 getenv.c, 1.1, 1.2 ibfft~.c, 1.1, 1.2 ifeel.c, 1.3, 1.4 junction~.c, 1.1, 1.2
by Hans-Christoph Steiner
15 Nov '05
15 Nov '05
Update of /cvsroot/pure-data/externals/build/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27817 Modified Files: ENV.c bdiag~.c bfft~.c diag~.c getenv.c ibfft~.c ifeel.c junction~.c Log Message: various fixes to get things compiling on Windows/MinGW Index: junction~.c =================================================================== RCS file: /cvsroot/pure-data/externals/build/src/junction~.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 ***
…
[View More]
junction~.c 20 Mar 2003 19:06:26 -0000 1.1 --- junction~.c 15 Nov 2005 02:36:32 -0000 1.2 *************** *** 1 **** --- 1,2 ---- + #include "../../../pd/src/d_mayer_fft.c" #include "../../creb/modules/junction.c" Index: bdiag~.c =================================================================== RCS file: /cvsroot/pure-data/externals/build/src/bdiag~.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** bdiag~.c 7 Nov 2005 03:15:18 -0000 1.2 --- bdiag~.c 15 Nov 2005 02:36:32 -0000 1.3 *************** *** 1,7 **** #ifndef __i386__ #define IS_DENORMAL(f) f #endif ! /* this doesn't work on Mac OS X now <hans(a)eds.org> */ ! #ifndef __APPLE__ #include "../../creb/modules/bdiag.c" - #endif --- 1,7 ---- #ifndef __i386__ #define IS_DENORMAL(f) f + #else + #include "../../creb/include/extlib_util.h" #endif ! #include "../../../pd/src/d_mayer_fft.c" #include "../../creb/modules/bdiag.c" Index: diag~.c =================================================================== RCS file: /cvsroot/pure-data/externals/build/src/diag~.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** diag~.c 7 Nov 2005 03:15:18 -0000 1.2 --- diag~.c 15 Nov 2005 02:36:32 -0000 1.3 *************** *** 1,2 **** --- 1,7 ---- + #ifndef __i386__ + #define IS_DENORMAL(f) f + #else + #include "../../creb/include/extlib_util.h" + #endif #ifndef __APPLE__ #include "../../creb/modules/diag.c" Index: getenv.c =================================================================== RCS file: /cvsroot/pure-data/externals/build/src/getenv.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** getenv.c 10 Jun 2003 20:27:24 -0000 1.1 --- getenv.c 15 Nov 2005 02:36:32 -0000 1.2 *************** *** 1 **** --- 1,4 ---- + #ifdef WIN32 + #define setenv(a,b,c) _putenv(a) + #endif #include "../../motex/getenv.c" Index: ENV.c =================================================================== RCS file: /cvsroot/pure-data/externals/build/src/ENV.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ENV.c 8 Jul 2003 07:31:37 -0000 1.1 --- ENV.c 15 Nov 2005 02:36:32 -0000 1.2 *************** *** 1 **** --- 1,4 ---- + #ifdef WIN32 + #define setenv(a,b,c) _putenv(a) + #endif #include "../../cxc/ENV.c" Index: ibfft~.c =================================================================== RCS file: /cvsroot/pure-data/externals/build/src/ibfft~.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ibfft~.c 8 Jul 2003 07:31:37 -0000 1.1 --- ibfft~.c 15 Nov 2005 02:36:32 -0000 1.2 *************** *** 1 **** --- 1,2 ---- + #include "../../../pd/src/d_mayer_fft.c" #include "../../creb/modules/bfft.c" Index: ifeel.c =================================================================== RCS file: /cvsroot/pure-data/externals/build/src/ifeel.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ifeel.c 14 Apr 2004 23:49:58 -0000 1.3 --- ifeel.c 15 Nov 2005 02:36:32 -0000 1.4 *************** *** 1 **** --- 1,3 ---- + #ifndef NT #include "../../hcs/ifeel.c" + #endif Index: bfft~.c =================================================================== RCS file: /cvsroot/pure-data/externals/build/src/bfft~.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** bfft~.c 20 Mar 2003 19:06:19 -0000 1.1 --- bfft~.c 15 Nov 2005 02:36:32 -0000 1.2 *************** *** 1 **** --- 1,2 ---- + #include "../../../pd/src/d_mayer_fft.c" #include "../../creb/modules/bfft.c"
[View Less]
1
0
0
0
externals/aenv~ aenv~-help.pd, NONE, 1.1 aenv~.c, 1.2, 1.3 help-aenv~.pd, 1.1.1.1, NONE
by Hans-Christoph Steiner
15 Nov '05
15 Nov '05
Update of /cvsroot/pure-data/externals/aenv~ In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6490 Modified Files: aenv~.c Added Files: aenv~-help.pd Removed Files: help-aenv~.pd Log Message: cleaned up for the build system: made pragmas for MSVC only, and renamed helpfile to standard name --- NEW FILE: aenv~-help.pd --- #N canvas 10 20 762 475 10; #X floatatom 238 150 5 0 0; #X floatatom 281 150 5 0 0; #X floatatom 324 150 5 0 0; #X floatatom 367 150 5 0 0; #X msg 8 115 1; #X msg
…
[View More]
50 115 0; #N canvas 0 0 450 300 graph1 0; #X array env 88200 float 0; #X coords 0 1 88199 0 300 140 1; #X restore 455 327 graph; #X msg 20 250 bang; #X obj 142 353 tabwrite~ env; #X obj 291 335 *~; #X obj 312 444 dac~; #X obj 318 410 *~; #X obj 364 395 vsl 8 64 0 1 0 1 empty empty empty 0 -8 0 8 -262144 -1 -1 4900 1; #X obj 170 211 aenv~ 100 200 0.6 500; #X obj 430 222 phasor~ 100; #X obj 430 266 lop~ 1000; #X obj 430 244 -~ 0.5; #X obj 238 75 vsl 8 64 10 2000 0 1 empty empty attack 0 -8 0 8 -262144 -1 -1 600 1; #X obj 281 75 vsl 8 64 10 2000 0 1 empty empty decay 0 -8 0 8 -262144 -1 -1 800 1; #X obj 367 75 vsl 8 64 10 2000 0 1 empty empty release 0 -8 0 8 -262144 -1 -1 2600 1; #X obj 324 75 vsl 8 64 0 1 0 1 empty empty sustain 0 -8 0 8 -262144 -1 -1 4400 1; #X obj 430 146 notein 1; #X obj 430 196 mtof; #X text 42 206 nonzero -> attack; #X text 484 81 Ben Saylor <bsaylor(a)macalester.edu>; #X text 500 97
http://www.macalester.edu/~bsaylor
; #X obj 8 20 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1 ; #X text 27 17 <- click here; #X obj 20 70 del 800; #X text 452 6 aenv~: asymptotic ADSR envelope generator; #X msg 198 73 lina; #X msg 198 104 loga; #X text 104 73 linear attack; #X text 120 105 log attack; #X msg 198 133 zero; #X text 77 219 0 -> release; #X connect 0 0 13 1; #X connect 1 0 13 2; #X connect 2 0 13 3; #X connect 3 0 13 4; #X connect 4 0 7 0; #X connect 4 0 13 0; #X connect 5 0 13 0; #X connect 7 0 8 0; #X connect 9 0 11 0; #X connect 11 0 10 0; #X connect 11 0 10 1; #X connect 12 0 11 1; #X connect 13 0 8 0; #X connect 13 0 9 0; #X connect 14 0 16 0; #X connect 15 0 9 1; #X connect 16 0 15 0; #X connect 17 0 0 0; #X connect 18 0 1 0; #X connect 19 0 3 0; #X connect 20 0 2 0; #X connect 21 0 22 0; #X connect 21 1 13 0; #X connect 22 0 14 0; #X connect 26 0 4 0; #X connect 26 0 28 0; #X connect 28 0 5 0; #X connect 30 0 13 0; #X connect 31 0 13 0; #X connect 34 0 13 0; --- help-aenv~.pd DELETED --- Index: aenv~.c =================================================================== RCS file: /cvsroot/pure-data/externals/aenv~/aenv~.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** aenv~.c 21 Jul 2003 09:46:51 -0000 1.2 --- aenv~.c 15 Nov 2005 00:21:15 -0000 1.3 *************** *** 18,22 **** #include "m_pd.h" ! #ifdef NT #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) --- 18,22 ---- #include "m_pd.h" ! #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 )
[View Less]
1
0
0
0
externals/zexy/src zexy.h,1.9,1.10
by Hans-Christoph Steiner
15 Nov '05
15 Nov '05
Update of /cvsroot/pure-data/externals/zexy/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23666 Modified Files: zexy.h Log Message: these pragmas are only used for MSVC, not MinGW or Cygwin, therefore changing the define from NT to _MSC_VER Index: zexy.h =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/zexy.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** zexy.h 27 Oct 2005 11:56:
…
[View More]
51 -0000 1.9 --- zexy.h 14 Nov 2005 23:00:35 -0000 1.10 *************** *** 32,37 **** #ifdef __WIN32__ ! # define NT ! # define MSW #endif --- 32,41 ---- #ifdef __WIN32__ ! # ifndef NT ! # define NT ! # endif ! # ifndef MSW ! # define MSW ! # endif #endif *************** *** 41,49 **** #define VERSION "2.1" ! ! #ifdef __WIN32__ # pragma warning( disable : 4018 ) # pragma warning( disable : 4244 ) # pragma warning( disable : 4305 ) # define HEARTSYMBOL 3 # define STATIC_INLINE --- 45,56 ---- #define VERSION "2.1" ! /* these pragmas are only used for MSVC, not MinGW or Cygwin */ ! #ifdef _MSC_VER # pragma warning( disable : 4018 ) # pragma warning( disable : 4244 ) # pragma warning( disable : 4305 ) + #endif + + #ifdef __WIN32__ # define HEARTSYMBOL 3 # define STATIC_INLINE
[View Less]
1
0
0
0
[PD-cvs] externals/ggee/signal sfwrite~.c, 1.3, 1.4 streamin~.c, 1.6, 1.7
by Hans-Christoph Steiner
14 Nov '05
14 Nov '05
Update of /cvsroot/pure-data/externals/ggee/signal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8684/signal Modified Files: sfwrite~.c streamin~.c Log Message: these pragmas are only used for MSVC, not MinGW or Cygwin, therefore changing the define from NT to _MSC_VER Index: sfwrite~.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/signal/sfwrite~.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -
…
[View More]
r1.4 *** sfwrite~.c 24 Feb 2005 15:21:56 -0000 1.3 --- sfwrite~.c 14 Nov 2005 21:59:09 -0000 1.4 *************** *** 3,7 **** #include <m_pd.h> ! #ifdef NT #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) --- 3,7 ---- #include <m_pd.h> ! #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) Index: streamin~.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/signal/streamin~.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** streamin~.c 12 Aug 2004 08:21:15 -0000 1.6 --- streamin~.c 14 Nov 2005 21:59:09 -0000 1.7 *************** *** 24,28 **** ! #ifdef NT #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) --- 24,28 ---- ! #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 )
[View Less]
1
0
0
0
externals/ggee/other messages.c, 1.1.1.1, 1.2 vbap.c, 1.1.1.1, 1.2
by Hans-Christoph Steiner
14 Nov '05
14 Nov '05
Update of /cvsroot/pure-data/externals/ggee/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8684/other Modified Files: messages.c vbap.c Log Message: these pragmas are only used for MSVC, not MinGW or Cygwin, therefore changing the define from NT to _MSC_VER Index: vbap.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/other/vbap.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 ***
…
[View More]
vbap.c 17 Jun 2002 10:13:56 -0000 1.1.1.1 --- vbap.c 14 Nov 2005 21:59:09 -0000 1.2 *************** *** 1,298 **** ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! /* ! (C) Guenter Geiger ! ! ! based on code by: ! (c) Ville Pulkki 2.2.1999 ! Helsinki University of Technology ! Laboratory of Acoustics and Audio Signal Processing ! */ ! ! #include <m_pd.h> ! #ifdef NT ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! ! ! #include <math.h> ! #include <stdio.h> ! #include <malloc.h> ! #include <string.h> /* strtok */ ! ! #define MAX_TRIPLET_AMOUNT 64 ! ! /* this is related to the number of ls .. ! ! and shoud be 3**(MAX_LS_AMOUNT / 4) ! ! */ ! ! #define MAX_LS_AMOUNT 16 ! #define MAX_DIM_SQUARE 9 ! ! ! /* ------------------------ vbap ----------------------------- */ ! ! static t_class *vbap_class; ! ! ! typedef struct _vbap ! { ! t_object x_ob; ! t_outlet* x_out2; ! t_outlet* x_out3; ! t_float lsm[MAX_TRIPLET_AMOUNT][MAX_LS_AMOUNT+1]; /* loudspeaker triplet matrices */ ! int lstripl[MAX_TRIPLET_AMOUNT][3]; /* loudspeaker triplet ldspeaker numbers */ ! int lasttrip[3]; ! int triplet_amount; ! int dimension; ! int opened; ! } t_vbap; ! ! ! ! ! t_float *angle_to_cart(t_float azi, t_float ele); ! void vbap(t_vbap* x,t_float g[3], int ls[3], t_float azi, t_float ele) ; ! int read_ls_conf(t_vbap* x,FILE *fp ); ! ! ! void vbap_list(t_vbap *x,t_symbol* s,t_int argc,t_atom* argv) ! { ! t_float azi,ele; ! t_float g[3]; ! int ls[3]; ! t_atom a[2]; ! ! if (argc != 2) ! post("vbap: list message <azimuth> <elevation> required %d",argc); ! else { ! int i; ! azi = atom_getfloat(argv++); ! ele = atom_getfloat(argv++); ! ! vbap(x,g,ls,azi,ele); ! ! for (i=0;i<x->dimension;i++) { ! if (x->lasttrip[i] != ls[i]) { ! SETFLOAT(a,(t_float)x->lasttrip[i]); ! SETFLOAT(a+1,0.0f); ! outlet_list(x->x_ob.ob_outlet, &s_list,2 ,(t_atom*)&a); ! x->lasttrip[i] = ls[i]; ! } ! } ! ! for (i=0;i<x->dimension;i++) { ! SETFLOAT(a,(t_float)ls[i]); ! SETFLOAT(a+1,g[i]); ! outlet_list(x->x_ob.ob_outlet, &s_list,2 ,(t_atom*)&a); ! ! } ! } ! ! } ! ! ! void vbap_bang(t_vbap *x) ! { ! post("vbap: bang"); ! } ! ! ! ! static void *vbap_new(t_symbol* s) ! { ! FILE *fp; ! t_vbap *x = (t_vbap *)pd_new(vbap_class); ! char fname[MAXPDSTRING]; ! ! if (s == &s_) { ! post("vbap: Using default loudspeaker setup"); ! s = gensym("ls_setup"); ! } ! ! /* opening the loudspeaker matrix file*/ ! ! canvas_makefilename(canvas_getcurrent(),s->s_name, ! fname,MAXPDSTRING); ! ! if((fp=fopen(fname,"r"))==NULL){ ! post("vbap: Could not open loudspeaker data file %s\n",fname); ! x->opened = 0; ! } ! else { ! if (!read_ls_conf(x,fp)) ! return NULL; ! x->opened = 1; ! fclose(fp); ! } ! ! x->lasttrip[0] = 0; ! x->lasttrip[1] = 1; ! x->lasttrip[2] = 2; ! ! outlet_new(&x->x_ob, &s_list); ! ! return (x); ! } ! ! void vbap_setup(void) ! { ! vbap_class = class_new(gensym("vbap"), (t_newmethod)vbap_new, 0, ! sizeof(t_vbap), 0,A_DEFSYM,0); ! /* class_addbang(vbap_class,vbap_bang);*/ ! class_addlist(vbap_class,vbap_list); ! } ! ! ! ! ! t_float *angle_to_cart(t_float azi, t_float ele) ! { ! t_float *res; ! t_float atorad = (2 * 3.1415927 / 360) ; ! res = (t_float *) malloc(3*sizeof(t_float)); ! res[0] = (float) (cos((t_float) (azi * atorad)) * cos((t_float) (ele * atorad))); ! res[1] = (float) (sin((t_float) (azi * atorad)) * cos((t_float) (ele * atorad))); ! res[2] = (float) (sin((t_float) (ele * atorad))); ! return res; ! } ! ! ! void vbap(t_vbap* x,t_float g[3], int ls[3], float azi, float ele) ! { ! /* calculates gain factors using loudspeaker setup and given direction */ ! t_float *cartdir; ! t_float power; ! int i,j,k; ! t_float small_g; ! t_float big_sm_g, gtmp[3]; ! int winner_triplet; ! ! cartdir=angle_to_cart(azi,ele); ! big_sm_g = -100000.0; ! for(i=0;i<x->triplet_amount;i++){ ! small_g = 10000000.0; ! for(j=0;j<x->dimension;j++){ ! gtmp[j]=0.0; ! for(k=0;k<x->dimension;k++) ! gtmp[j]+=cartdir[k]*x->lsm[i][k+j*x->dimension]; ! if(gtmp[j] < small_g) ! small_g = gtmp[j]; ! } ! if(small_g > big_sm_g){ ! big_sm_g = small_g; ! winner_triplet=i; ! g[0]=gtmp[0]; g[1]=gtmp[1]; ! ls[0]=x->lstripl[i][0]; ls[1]=x->lstripl[i][1]; ! if(x->dimension==3){ ! g[2]=gtmp[2]; ! ls[2]=x->lstripl[i][2]; ! } else { ! g[2]=0.0; ! ls[2]=0; ! } ! } ! } ! ! /* this should probably be optimized somehow */ ! ! power=sqrt(g[0]*g[0] + g[1]*g[1] + g[2]*g[2]); ! /* power=g[0]+g[1];*/ ! ! g[0] /= power; ! g[1] /= power; ! g[2] /= power; ! ! ! free(cartdir); ! } ! ! int read_ls_conf(t_vbap* x,FILE *fp ){ ! /* reads from specified file the loudspeaker triplet setup */ ! int amount,i,j,a,b,d=0; ! char *toke; ! char c[1000]; ! t_float mx[MAX_DIM_SQUARE]; ! fgets(c,1000,fp); ! toke = (char *) strtok(c, " "); ! toke = (char *) strtok(NULL, " "); ! toke = (char *) strtok(NULL, " "); ! if((toke = (char *) strtok(NULL, " "))==NULL){ ! fprintf(stderr,"Wrong ls matrix file?\n"); ! return 0; ! } ! sscanf(toke, "%d",&amount); ! toke = (char *) strtok(NULL, " "); ! toke = (char *) strtok(NULL, " "); ! if((toke = (char *) strtok(NULL, " "))==NULL){ ! fprintf(stderr,"Wrong ls matrix file?\n"); ! return 0; ! } ! sscanf(toke, "%d",&x->dimension); ! ! x->triplet_amount = amount; ! ! for(i=0;i<amount;i++){ ! fgets(c,1000,fp); ! toke = (char *) strtok(c, " "); ! if(strncmp(toke,"Trip",4)!=0 && x->dimension==3){ ! fprintf(stderr,"Something wrong in ls matrix file\n"); ! return 0; ! } ! if(strncmp(toke,"Pair",4)!=0 && x->dimension==2){ ! fprintf(stderr,"Something wrong in ls matrix file\n"); ! return 0; ! } ! toke = (char *) strtok(NULL, " "); ! toke = (char *) strtok(NULL, " "); toke = (char *) strtok(NULL, " "); ! sscanf(toke, "%d",&a); ! x->lstripl[i][0]=a; ! toke = (char *) strtok(NULL, " "); ! sscanf(toke, "%d",&b); ! x->lstripl[i][1]=b; ! if (x->dimension==3){ ! toke = (char *) strtok(NULL, " "); ! sscanf(toke, "%d",&d); ! x->lstripl[i][2]=d; ! } ! ! ! toke = (char *) strtok(NULL, " "); ! for(j=0;j<(x->dimension*x->dimension);j++){ ! toke = (char *) strtok(NULL, " "); ! sscanf(toke, "%f",&(mx[j])); ! x->lsm[i][j]=mx[j]; ! } ! ! } ! return 1; ! } ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! --- 1,298 ---- ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! /* ! (C) Guenter Geiger ! ! ! based on code by: ! (c) Ville Pulkki 2.2.1999 ! Helsinki University of Technology ! Laboratory of Acoustics and Audio Signal Processing ! */ ! ! #include <m_pd.h> ! #ifdef _MSC_VER ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! ! ! #include <math.h> ! #include <stdio.h> ! #include <malloc.h> ! #include <string.h> /* strtok */ ! ! #define MAX_TRIPLET_AMOUNT 64 ! ! /* this is related to the number of ls .. ! ! and shoud be 3**(MAX_LS_AMOUNT / 4) ! ! */ ! ! #define MAX_LS_AMOUNT 16 ! #define MAX_DIM_SQUARE 9 ! ! ! /* ------------------------ vbap ----------------------------- */ ! ! static t_class *vbap_class; ! ! ! typedef struct _vbap ! { ! t_object x_ob; ! t_outlet* x_out2; ! t_outlet* x_out3; ! t_float lsm[MAX_TRIPLET_AMOUNT][MAX_LS_AMOUNT+1]; /* loudspeaker triplet matrices */ ! int lstripl[MAX_TRIPLET_AMOUNT][3]; /* loudspeaker triplet ldspeaker numbers */ ! int lasttrip[3]; ! int triplet_amount; ! int dimension; ! int opened; ! } t_vbap; ! ! ! ! ! t_float *angle_to_cart(t_float azi, t_float ele); ! void vbap(t_vbap* x,t_float g[3], int ls[3], t_float azi, t_float ele) ; ! int read_ls_conf(t_vbap* x,FILE *fp ); ! ! ! void vbap_list(t_vbap *x,t_symbol* s,t_int argc,t_atom* argv) ! { ! t_float azi,ele; ! t_float g[3]; ! int ls[3]; ! t_atom a[2]; ! ! if (argc != 2) ! post("vbap: list message <azimuth> <elevation> required %d",argc); ! else { ! int i; ! azi = atom_getfloat(argv++); ! ele = atom_getfloat(argv++); ! ! vbap(x,g,ls,azi,ele); ! ! for (i=0;i<x->dimension;i++) { ! if (x->lasttrip[i] != ls[i]) { ! SETFLOAT(a,(t_float)x->lasttrip[i]); ! SETFLOAT(a+1,0.0f); ! outlet_list(x->x_ob.ob_outlet, &s_list,2 ,(t_atom*)&a); ! x->lasttrip[i] = ls[i]; ! } ! } ! ! for (i=0;i<x->dimension;i++) { ! SETFLOAT(a,(t_float)ls[i]); ! SETFLOAT(a+1,g[i]); ! outlet_list(x->x_ob.ob_outlet, &s_list,2 ,(t_atom*)&a); ! ! } ! } ! ! } ! ! ! void vbap_bang(t_vbap *x) ! { ! post("vbap: bang"); ! } ! ! ! ! static void *vbap_new(t_symbol* s) ! { ! FILE *fp; ! t_vbap *x = (t_vbap *)pd_new(vbap_class); ! char fname[MAXPDSTRING]; ! ! if (s == &s_) { ! post("vbap: Using default loudspeaker setup"); ! s = gensym("ls_setup"); ! } ! ! /* opening the loudspeaker matrix file*/ ! ! canvas_makefilename(canvas_getcurrent(),s->s_name, ! fname,MAXPDSTRING); ! ! if((fp=fopen(fname,"r"))==NULL){ ! post("vbap: Could not open loudspeaker data file %s\n",fname); ! x->opened = 0; ! } ! else { ! if (!read_ls_conf(x,fp)) ! return NULL; ! x->opened = 1; ! fclose(fp); ! } ! ! x->lasttrip[0] = 0; ! x->lasttrip[1] = 1; ! x->lasttrip[2] = 2; ! ! outlet_new(&x->x_ob, &s_list); ! ! return (x); ! } ! ! void vbap_setup(void) ! { ! vbap_class = class_new(gensym("vbap"), (t_newmethod)vbap_new, 0, ! sizeof(t_vbap), 0,A_DEFSYM,0); ! /* class_addbang(vbap_class,vbap_bang);*/ ! class_addlist(vbap_class,vbap_list); ! } ! ! ! ! ! t_float *angle_to_cart(t_float azi, t_float ele) ! { ! t_float *res; ! t_float atorad = (2 * 3.1415927 / 360) ; ! res = (t_float *) malloc(3*sizeof(t_float)); ! res[0] = (float) (cos((t_float) (azi * atorad)) * cos((t_float) (ele * atorad))); ! res[1] = (float) (sin((t_float) (azi * atorad)) * cos((t_float) (ele * atorad))); ! res[2] = (float) (sin((t_float) (ele * atorad))); ! return res; ! } ! ! ! void vbap(t_vbap* x,t_float g[3], int ls[3], float azi, float ele) ! { ! /* calculates gain factors using loudspeaker setup and given direction */ ! t_float *cartdir; ! t_float power; ! int i,j,k; ! t_float small_g; ! t_float big_sm_g, gtmp[3]; ! int winner_triplet; ! ! cartdir=angle_to_cart(azi,ele); ! big_sm_g = -100000.0; ! for(i=0;i<x->triplet_amount;i++){ ! small_g = 10000000.0; ! for(j=0;j<x->dimension;j++){ ! gtmp[j]=0.0; ! for(k=0;k<x->dimension;k++) ! gtmp[j]+=cartdir[k]*x->lsm[i][k+j*x->dimension]; ! if(gtmp[j] < small_g) ! small_g = gtmp[j]; ! } ! if(small_g > big_sm_g){ ! big_sm_g = small_g; ! winner_triplet=i; ! g[0]=gtmp[0]; g[1]=gtmp[1]; ! ls[0]=x->lstripl[i][0]; ls[1]=x->lstripl[i][1]; ! if(x->dimension==3){ ! g[2]=gtmp[2]; ! ls[2]=x->lstripl[i][2]; ! } else { ! g[2]=0.0; ! ls[2]=0; ! } ! } ! } ! ! /* this should probably be optimized somehow */ ! ! power=sqrt(g[0]*g[0] + g[1]*g[1] + g[2]*g[2]); ! /* power=g[0]+g[1];*/ ! ! g[0] /= power; ! g[1] /= power; ! g[2] /= power; ! ! ! free(cartdir); ! } ! ! int read_ls_conf(t_vbap* x,FILE *fp ){ ! /* reads from specified file the loudspeaker triplet setup */ ! int amount,i,j,a,b,d=0; ! char *toke; ! char c[1000]; ! t_float mx[MAX_DIM_SQUARE]; ! fgets(c,1000,fp); ! toke = (char *) strtok(c, " "); ! toke = (char *) strtok(NULL, " "); ! toke = (char *) strtok(NULL, " "); ! if((toke = (char *) strtok(NULL, " "))==NULL){ ! fprintf(stderr,"Wrong ls matrix file?\n"); ! return 0; ! } ! sscanf(toke, "%d",&amount); ! toke = (char *) strtok(NULL, " "); ! toke = (char *) strtok(NULL, " "); ! if((toke = (char *) strtok(NULL, " "))==NULL){ ! fprintf(stderr,"Wrong ls matrix file?\n"); ! return 0; ! } ! sscanf(toke, "%d",&x->dimension); ! ! x->triplet_amount = amount; ! ! for(i=0;i<amount;i++){ ! fgets(c,1000,fp); ! toke = (char *) strtok(c, " "); ! if(strncmp(toke,"Trip",4)!=0 && x->dimension==3){ ! fprintf(stderr,"Something wrong in ls matrix file\n"); ! return 0; ! } ! if(strncmp(toke,"Pair",4)!=0 && x->dimension==2){ ! fprintf(stderr,"Something wrong in ls matrix file\n"); ! return 0; ! } ! toke = (char *) strtok(NULL, " "); ! toke = (char *) strtok(NULL, " "); toke = (char *) strtok(NULL, " "); ! sscanf(toke, "%d",&a); ! x->lstripl[i][0]=a; ! toke = (char *) strtok(NULL, " "); ! sscanf(toke, "%d",&b); ! x->lstripl[i][1]=b; ! if (x->dimension==3){ ! toke = (char *) strtok(NULL, " "); ! sscanf(toke, "%d",&d); ! x->lstripl[i][2]=d; ! } ! ! ! toke = (char *) strtok(NULL, " "); ! for(j=0;j<(x->dimension*x->dimension);j++){ ! toke = (char *) strtok(NULL, " "); ! sscanf(toke, "%f",&(mx[j])); ! x->lsm[i][j]=mx[j]; ! } ! ! } ! return 1; ! } ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Index: messages.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/other/messages.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** messages.c 17 Jun 2002 10:13:56 -0000 1.1.1.1 --- messages.c 14 Nov 2005 21:59:09 -0000 1.2 *************** *** 1,40 **** ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! #include <m_pd.h> ! #ifdef NT ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! ! /* ------------------------ messages ----------------------------- */ ! ! static t_class *messages_class; ! ! ! typedef struct _messages ! { ! t_object x_obj; ! } t_messages; ! ! ! void messages_bang(t_messages *x) ! { ! post("bang"); ! } ! ! static void *messages_new() ! { ! t_messages *x = (t_messages *)pd_new(messages_class); ! outlet_new(&x->x_obj, &s_float); ! return (x); ! } ! ! void messages_setup(void) ! { ! messages_class = class_new(gensym("messages"), (t_newmethod)messages_new, 0, ! sizeof(t_messages), 0,0); ! class_addbang(messages_class,messages_bang); ! } ! ! --- 1,40 ---- ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! #include <m_pd.h> ! #ifdef _MSC_VER ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! ! /* ------------------------ messages ----------------------------- */ ! ! static t_class *messages_class; ! ! ! typedef struct _messages ! { ! t_object x_obj; ! } t_messages; ! ! ! void messages_bang(t_messages *x) ! { ! post("bang"); ! } ! ! static void *messages_new() ! { ! t_messages *x = (t_messages *)pd_new(messages_class); ! outlet_new(&x->x_obj, &s_float); ! return (x); ! } ! ! void messages_setup(void) ! { ! messages_class = class_new(gensym("messages"), (t_newmethod)messages_new, 0, ! sizeof(t_messages), 0,0); ! class_addbang(messages_class,messages_bang); ! } ! !
[View Less]
1
0
0
0
externals/ggee/gui button.c, 1.15, 1.16 image.c, 1.8, 1.9 sliderh.c, 1.6, 1.7 state.c, 1.6, 1.7 ticker.c, 1.8, 1.9 toddle.c, 1.4, 1.5
by Hans-Christoph Steiner
14 Nov '05
14 Nov '05
Update of /cvsroot/pure-data/externals/ggee/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8684/gui Modified Files: button.c image.c sliderh.c state.c ticker.c toddle.c Log Message: these pragmas are only used for MSVC, not MinGW or Cygwin, therefore changing the define from NT to _MSC_VER Index: ticker.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/gui/ticker.c,v retrieving revision 1.8 retrieving revision 1.9
…
[View More]
diff -C2 -d -r1.8 -r1.9 *** ticker.c 25 Jul 2004 15:01:14 -0000 1.8 --- ticker.c 14 Nov 2005 21:59:09 -0000 1.9 *************** *** 2,6 **** #include "g_canvas.h" ! #ifdef NT #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) --- 2,6 ---- #include "g_canvas.h" ! #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) Index: state.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/gui/state.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** state.c 17 Sep 2003 07:26:12 -0000 1.6 --- state.c 14 Nov 2005 21:59:09 -0000 1.7 *************** *** 5,9 **** #include <stdio.h> #include <string.h> ! #ifdef NT #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) --- 5,9 ---- #include <stdio.h> #include <string.h> ! #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) Index: toddle.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/gui/toddle.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** toddle.c 25 Jul 2004 15:01:14 -0000 1.4 --- toddle.c 14 Nov 2005 21:59:09 -0000 1.5 *************** *** 5,9 **** #include "g_canvas.h" ! #ifdef NT #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) --- 5,9 ---- #include "g_canvas.h" ! #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) Index: image.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/gui/image.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** image.c 6 Feb 2004 17:03:34 -0000 1.8 --- image.c 14 Nov 2005 21:59:09 -0000 1.9 *************** *** 2,6 **** #include "g_canvas.h" ! #ifdef NT #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) --- 2,6 ---- #include "g_canvas.h" ! #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) Index: sliderh.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/gui/sliderh.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sliderh.c 1 Jul 2005 07:51:03 -0000 1.6 --- sliderh.c 14 Nov 2005 21:59:09 -0000 1.7 *************** *** 3,7 **** ! #ifdef NT #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) --- 3,7 ---- ! #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) Index: button.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/gui/button.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** button.c 17 Oct 2004 21:31:31 -0000 1.15 --- button.c 14 Nov 2005 21:59:09 -0000 1.16 *************** *** 6,10 **** ! #ifdef NT #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) --- 6,10 ---- ! #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 )
[View Less]
1
0
0
0
[PD-cvs] externals/ggee/filters bandpass.c, 1.1.1.1, 1.2 equalizer.c, 1.2, 1.3 highpass.c, 1.1.1.1, 1.2 highshelf.c, 1.1.1.1, 1.2 hlshelf.c, 1.1.1.1, 1.2 lowpass.c, 1.1.1.1, 1.2 lowshelf.c, 1.1.1.1, 1.2 moog~.c, 1.2, 1.3 notch.c, 1.1.1.1, 1.2
by Hans-Christoph Steiner
14 Nov '05
14 Nov '05
Update of /cvsroot/pure-data/externals/ggee/filters In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8684/filters Modified Files: bandpass.c equalizer.c highpass.c highshelf.c hlshelf.c lowpass.c lowshelf.c moog~.c notch.c Log Message: these pragmas are only used for MSVC, not MinGW or Cygwin, therefore changing the define from NT to _MSC_VER Index: equalizer.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/filters/
…
[View More]
equalizer.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** equalizer.c 26 Nov 2002 09:06:36 -0000 1.2 --- equalizer.c 14 Nov 2005 21:59:08 -0000 1.3 *************** *** 1,89 **** ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! /* ! ! These filter coefficients computations are taken from !
http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
! ! written by Robert Bristow-Johnson ! ! */ ! ! #include <m_pd.h> ! #ifdef NT ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! #include <math.h> ! #include "filters.h" ! ! ! ! /* ------------------- equ ----------------------------*/ ! static t_class *equ_class; ! ! void equ_bang(t_rbjfilter *x) ! { ! t_atom at[5]; ! t_float omega = e_omega(x->x_freq,x->x_rate); ! t_float alpha = e_alpha(x->x_bw*0.01,omega); ! t_float b0 = 1 + alpha*e_A(x->x_gain); ! t_float b1 = -2.*cos(omega); ! t_float b2 = 1 - alpha*e_A(x->x_gain); ! t_float a0 = 1 + alpha/e_A(x->x_gain); ! t_float a1 = -2.*cos(omega); ! t_float a2 = 1 - alpha/e_A(x->x_gain); ! ! /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw);*/ ! ! if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { ! post("equ: filter unstable -> resetting"); ! a0=1.;a1=0.;a2=0.; ! b0=1.;b1=0.;b2=0.; ! } ! ! SETFLOAT(at,-a1/a0); ! SETFLOAT(at+1,-a2/a0); ! SETFLOAT(at+2,b0/a0); ! SETFLOAT(at+3,b1/a0); ! SETFLOAT(at+4,b2/a0); ! ! outlet_list(x->x_obj.ob_outlet,&s_list,5,at); ! } ! ! ! void equ_float(t_rbjfilter *x,t_floatarg f) ! { ! x->x_freq = f; ! equ_bang(x); ! } ! ! ! static void *equ_new(t_floatarg f,t_floatarg g,t_floatarg bw) ! { ! t_rbjfilter *x = (t_rbjfilter *)pd_new(equ_class); ! ! x->x_rate = 44100.0; ! outlet_new(&x->x_obj,&s_float); ! floatinlet_new(&x->x_obj, &x->x_gain); ! floatinlet_new(&x->x_obj, &x->x_bw); ! if (f > 0.) x->x_freq = f; ! if (bw > 0.) x->x_bw = bw; ! if (g != 0.) x->x_gain = g; ! return (x); ! } ! ! ! void equalizer_setup(void) ! { ! equ_class = class_new(gensym("equalizer"), (t_newmethod)equ_new, 0, ! sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addbang(equ_class,equ_bang); ! class_addfloat(equ_class,equ_float); ! } ! ! ! ! ! --- 1,89 ---- ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! /* ! ! These filter coefficients computations are taken from !
http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
! ! written by Robert Bristow-Johnson ! ! */ ! ! #include <m_pd.h> ! #ifdef _MSC_VER ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! #include <math.h> ! #include "filters.h" ! ! ! ! /* ------------------- equ ----------------------------*/ ! static t_class *equ_class; ! ! void equ_bang(t_rbjfilter *x) ! { ! t_atom at[5]; ! t_float omega = e_omega(x->x_freq,x->x_rate); ! t_float alpha = e_alpha(x->x_bw*0.01,omega); ! t_float b0 = 1 + alpha*e_A(x->x_gain); ! t_float b1 = -2.*cos(omega); ! t_float b2 = 1 - alpha*e_A(x->x_gain); ! t_float a0 = 1 + alpha/e_A(x->x_gain); ! t_float a1 = -2.*cos(omega); ! t_float a2 = 1 - alpha/e_A(x->x_gain); ! ! /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw);*/ ! ! if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { ! post("equ: filter unstable -> resetting"); ! a0=1.;a1=0.;a2=0.; ! b0=1.;b1=0.;b2=0.; ! } ! ! SETFLOAT(at,-a1/a0); ! SETFLOAT(at+1,-a2/a0); ! SETFLOAT(at+2,b0/a0); ! SETFLOAT(at+3,b1/a0); ! SETFLOAT(at+4,b2/a0); ! ! outlet_list(x->x_obj.ob_outlet,&s_list,5,at); ! } ! ! ! void equ_float(t_rbjfilter *x,t_floatarg f) ! { ! x->x_freq = f; ! equ_bang(x); ! } ! ! ! static void *equ_new(t_floatarg f,t_floatarg g,t_floatarg bw) ! { ! t_rbjfilter *x = (t_rbjfilter *)pd_new(equ_class); ! ! x->x_rate = 44100.0; ! outlet_new(&x->x_obj,&s_float); ! floatinlet_new(&x->x_obj, &x->x_gain); ! floatinlet_new(&x->x_obj, &x->x_bw); ! if (f > 0.) x->x_freq = f; ! if (bw > 0.) x->x_bw = bw; ! if (g != 0.) x->x_gain = g; ! return (x); ! } ! ! ! void equalizer_setup(void) ! { ! equ_class = class_new(gensym("equalizer"), (t_newmethod)equ_new, 0, ! sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addbang(equ_class,equ_bang); ! class_addfloat(equ_class,equ_float); ! } ! ! ! ! ! Index: lowshelf.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/filters/lowshelf.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** lowshelf.c 17 Jun 2002 10:13:54 -0000 1.1.1.1 --- lowshelf.c 14 Nov 2005 21:59:08 -0000 1.2 *************** *** 1,91 **** ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! /* ! ! These filter coefficients computations are taken from !
http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
! ! written by Robert Bristow-Johnson ! ! */ ! ! #include <m_pd.h> ! #ifdef NT ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! #include <math.h> ! #include "filters.h" ! ! ! ! /* ------------------- lowshelf ----------------------------*/ ! ! static t_class *lowshelf_class; ! ! void lowshelf_bang(t_rbjfilter *x) ! { ! t_atom at[5]; ! t_float omega = e_omega(x->x_freq,x->x_rate); ! t_float A = e_A(x->x_gain); ! t_float cs = cos(omega); ! t_float sn = sin(omega); ! t_float beta = e_beta(A,x->x_bw*0.01); ! ! t_float b0 = A*((A+1) - (A-1)*cs + beta*sn); ! t_float b1 = 2.*A*((A-1) - (A+1)*cs); ! t_float b2 = A*((A+1) - (A-1)*cs - beta*sn); ! t_float a0 = ((A+1) + (A-1)*cs + beta*sn); ! t_float a1 = -2.*((A-1) + (A+1)*cs); ! t_float a2 = ((A+1) + (A-1)*cs - beta*sn); ! ! /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ ! ! if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { ! post("lowshelf: filter unstable -> resetting"); ! a0=1.;a1=0.;a2=0.; ! b0=1.;b1=0.;b2=0.; ! } ! ! SETFLOAT(at,-a1/a0); ! SETFLOAT(at+1,-a2/a0); ! SETFLOAT(at+2,b0/a0); ! SETFLOAT(at+3,b1/a0); ! SETFLOAT(at+4,b2/a0); ! ! outlet_list(x->x_obj.ob_outlet,&s_list,5,at); ! } ! ! ! void lowshelf_float(t_rbjfilter *x,t_floatarg f) ! { ! x->x_freq = f; ! lowshelf_bang(x); ! } ! ! ! static void *lowshelf_new(t_floatarg f,t_floatarg g,t_floatarg bw) ! { ! t_rbjfilter *x = (t_rbjfilter *)pd_new(lowshelf_class); ! ! x->x_rate = 44100.0; ! outlet_new(&x->x_obj,&s_float); ! floatinlet_new(&x->x_obj, &x->x_gain); ! floatinlet_new(&x->x_obj, &x->x_bw); ! if (f > 0.) x->x_freq = f; ! if (bw > 0.) x->x_bw = bw; ! if (g != 0.) x->x_gain = g; ! return (x); ! } ! ! ! void lowshelf_setup(void) ! { ! lowshelf_class = class_new(gensym("lowshelf"), (t_newmethod)lowshelf_new, 0, ! sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addbang(lowshelf_class,lowshelf_bang); ! class_addfloat(lowshelf_class,lowshelf_float); ! } ! ! --- 1,91 ---- ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! /* ! ! These filter coefficients computations are taken from !
http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
! ! written by Robert Bristow-Johnson ! ! */ ! ! #include <m_pd.h> ! #ifdef _MSC_VER ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! #include <math.h> ! #include "filters.h" ! ! ! ! /* ------------------- lowshelf ----------------------------*/ ! ! static t_class *lowshelf_class; ! ! void lowshelf_bang(t_rbjfilter *x) ! { ! t_atom at[5]; ! t_float omega = e_omega(x->x_freq,x->x_rate); ! t_float A = e_A(x->x_gain); ! t_float cs = cos(omega); ! t_float sn = sin(omega); ! t_float beta = e_beta(A,x->x_bw*0.01); ! ! t_float b0 = A*((A+1) - (A-1)*cs + beta*sn); ! t_float b1 = 2.*A*((A-1) - (A+1)*cs); ! t_float b2 = A*((A+1) - (A-1)*cs - beta*sn); ! t_float a0 = ((A+1) + (A-1)*cs + beta*sn); ! t_float a1 = -2.*((A-1) + (A+1)*cs); ! t_float a2 = ((A+1) + (A-1)*cs - beta*sn); ! ! /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ ! ! if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { ! post("lowshelf: filter unstable -> resetting"); ! a0=1.;a1=0.;a2=0.; ! b0=1.;b1=0.;b2=0.; ! } ! ! SETFLOAT(at,-a1/a0); ! SETFLOAT(at+1,-a2/a0); ! SETFLOAT(at+2,b0/a0); ! SETFLOAT(at+3,b1/a0); ! SETFLOAT(at+4,b2/a0); ! ! outlet_list(x->x_obj.ob_outlet,&s_list,5,at); ! } ! ! ! void lowshelf_float(t_rbjfilter *x,t_floatarg f) ! { ! x->x_freq = f; ! lowshelf_bang(x); ! } ! ! ! static void *lowshelf_new(t_floatarg f,t_floatarg g,t_floatarg bw) ! { ! t_rbjfilter *x = (t_rbjfilter *)pd_new(lowshelf_class); ! ! x->x_rate = 44100.0; ! outlet_new(&x->x_obj,&s_float); ! floatinlet_new(&x->x_obj, &x->x_gain); ! floatinlet_new(&x->x_obj, &x->x_bw); ! if (f > 0.) x->x_freq = f; ! if (bw > 0.) x->x_bw = bw; ! if (g != 0.) x->x_gain = g; ! return (x); ! } ! ! ! void lowshelf_setup(void) ! { ! lowshelf_class = class_new(gensym("lowshelf"), (t_newmethod)lowshelf_new, 0, ! sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addbang(lowshelf_class,lowshelf_bang); ! class_addfloat(lowshelf_class,lowshelf_float); ! } ! ! Index: bandpass.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/filters/bandpass.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** bandpass.c 17 Jun 2002 10:13:54 -0000 1.1.1.1 --- bandpass.c 14 Nov 2005 21:59:08 -0000 1.2 *************** *** 1,86 **** ! ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! /* ! ! These filter coefficients computations are taken from !
http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
! ! written by Robert Bristow-Johnson ! ! */ ! ! #include <m_pd.h> ! #ifdef NT ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! #include <math.h> ! #include "filters.h" ! ! /* ------------------- bandpass ----------------------------*/ ! ! static t_class *bandpass_class; ! ! void bandpass_bang(t_rbjfilter *x) ! { ! t_atom at[5]; ! t_float omega = e_omega(x->x_freq,x->x_rate); ! t_float alpha = e_alpha(x->x_bw* 0.01,omega); ! t_float b1 = 0.; ! t_float b0 = alpha; ! t_float b2 = -alpha; ! t_float a0 = 1 + alpha; ! t_float a1 = -2.*cos(omega); ! t_float a2 = 1 - alpha; ! ! /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ ! ! if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { ! post("bandpass: filter unstable -> resetting"); ! a0=1.;a1=0.;a2=0.; ! b0=1.;b1=0.;b2=0.; ! } ! ! SETFLOAT(at,-a1/a0); ! SETFLOAT(at+1,-a2/a0); ! SETFLOAT(at+2,b0/a0); ! SETFLOAT(at+3,b1/a0); ! SETFLOAT(at+4,b2/a0); ! ! outlet_list(x->x_obj.ob_outlet,&s_list,5,at); ! } ! ! ! void bandpass_float(t_rbjfilter *x,t_floatarg f) ! { ! x->x_freq = f; ! bandpass_bang(x); ! } ! ! ! static void *bandpass_new(t_floatarg f,t_floatarg bw) ! { ! t_rbjfilter *x = (t_rbjfilter *)pd_new(bandpass_class); ! ! x->x_rate = 44100.0; ! outlet_new(&x->x_obj,&s_float); ! /* floatinlet_new(&x->x_obj, &x->x_gain); */ ! floatinlet_new(&x->x_obj, &x->x_bw); ! if (f > 0.) x->x_freq = f; ! if (bw > 0.) x->x_bw = bw; ! return (x); ! } ! ! ! void bandpass_setup(void) ! { ! bandpass_class = class_new(gensym("bandpass"), (t_newmethod)bandpass_new, 0, ! sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addbang(bandpass_class,bandpass_bang); ! class_addfloat(bandpass_class,bandpass_float); ! } ! ! ! --- 1,86 ---- ! ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! /* ! ! These filter coefficients computations are taken from !
http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
! ! written by Robert Bristow-Johnson ! ! */ ! ! #include <m_pd.h> ! #ifdef _MSC_VER ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! #include <math.h> ! #include "filters.h" ! ! /* ------------------- bandpass ----------------------------*/ ! ! static t_class *bandpass_class; ! ! void bandpass_bang(t_rbjfilter *x) ! { ! t_atom at[5]; ! t_float omega = e_omega(x->x_freq,x->x_rate); ! t_float alpha = e_alpha(x->x_bw* 0.01,omega); ! t_float b1 = 0.; ! t_float b0 = alpha; ! t_float b2 = -alpha; ! t_float a0 = 1 + alpha; ! t_float a1 = -2.*cos(omega); ! t_float a2 = 1 - alpha; ! ! /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ ! ! if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { ! post("bandpass: filter unstable -> resetting"); ! a0=1.;a1=0.;a2=0.; ! b0=1.;b1=0.;b2=0.; ! } ! ! SETFLOAT(at,-a1/a0); ! SETFLOAT(at+1,-a2/a0); ! SETFLOAT(at+2,b0/a0); ! SETFLOAT(at+3,b1/a0); ! SETFLOAT(at+4,b2/a0); ! ! outlet_list(x->x_obj.ob_outlet,&s_list,5,at); ! } ! ! ! void bandpass_float(t_rbjfilter *x,t_floatarg f) ! { ! x->x_freq = f; ! bandpass_bang(x); ! } ! ! ! static void *bandpass_new(t_floatarg f,t_floatarg bw) ! { ! t_rbjfilter *x = (t_rbjfilter *)pd_new(bandpass_class); ! ! x->x_rate = 44100.0; ! outlet_new(&x->x_obj,&s_float); ! /* floatinlet_new(&x->x_obj, &x->x_gain); */ ! floatinlet_new(&x->x_obj, &x->x_bw); ! if (f > 0.) x->x_freq = f; ! if (bw > 0.) x->x_bw = bw; ! return (x); ! } ! ! ! void bandpass_setup(void) ! { ! bandpass_class = class_new(gensym("bandpass"), (t_newmethod)bandpass_new, 0, ! sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addbang(bandpass_class,bandpass_bang); ! class_addfloat(bandpass_class,bandpass_float); ! } ! ! ! Index: hlshelf.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/filters/hlshelf.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** hlshelf.c 17 Jun 2002 10:13:54 -0000 1.1.1.1 --- hlshelf.c 14 Nov 2005 21:59:08 -0000 1.2 *************** *** 1,226 **** ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! #include <m_pd.h> ! #include <math.h> ! ! #ifdef NT ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! ! /* ------------------------ hlshelf ----------------------------- */ ! ! ! #ifndef M_PI ! #define M_PI 3.141593f ! #endif ! ! #define SRATE 44100.0 ! #define MAX_GAIN 120.0f ! ! static t_class *hlshelf_class; ! ! ! typedef struct _hlshelf ! { ! t_object x_obj; ! float s_rate; ! float s_gain0; ! float s_gain1; ! float s_gain2; ! float s_ltransfq; ! float s_htransfq; ! float s_lradians; ! float s_hradians; ! } t_hlshelf; ! ! ! int hlshelf_check_stability(t_float fb1, ! t_float fb2, ! t_float ff1, ! t_float ff2, ! t_float ff3) ! { ! float discriminant = fb1 * fb1 + 4 * fb2; ! ! if (discriminant < 0) /* imaginary roots -- resonant filter */ ! { ! /* they're conjugates so we just check that the product ! is less than one */ ! if (fb2 >= -1.0f) goto stable; ! } ! else /* real roots */ ! { ! /* check that the parabola 1 - fb1 x - fb2 x^2 has a ! vertex between -1 and 1, and that it's nonnegative ! at both ends, which implies both roots are in [1-,1]. */ ! if (fb1 <= 2.0f && fb1 >= -2.0f && ! 1.0f - fb1 -fb2 >= 0 && 1.0f + fb1 - fb2 >= 0) ! goto stable; ! } ! return 0; ! stable: ! return 1; ! } ! ! ! void hlshelf_check(t_hlshelf *x) ! { ! ! if(x->s_gain0 - x->s_gain1 > MAX_GAIN) { ! x->s_gain0 = x->s_gain1 + MAX_GAIN; ! post("setting gain0 to %f",x->s_gain0); ! } ! ! ! if(x->s_gain1 > MAX_GAIN) { ! x->s_gain1 = MAX_GAIN; ! post("setting gain1 to %f",x->s_gain1); ! } ! ! if(x->s_gain2 - x->s_gain1 > MAX_GAIN) { ! x->s_gain2 = x->s_gain1 + MAX_GAIN; ! post("setting gain2 to %f",x->s_gain2); ! } ! ! /* constrain: 0 <= x->s_ltransfq < x->s_htransfq. */ ! x->s_ltransfq = (x->s_ltransfq < x->s_htransfq) ? x->s_ltransfq : x->s_htransfq - 0.5f; ! ! if (x->s_ltransfq < 0) x->s_ltransfq = 0.0f; ! ! x->s_lradians = M_PI * x->s_ltransfq / x->s_rate; ! x->s_hradians= M_PI * (0.5f - (x->s_htransfq / x->s_rate)); ! ! } ! ! ! void hlshelf_bang(t_hlshelf *x) ! { ! t_atom at[6]; ! float c0, c1, c2, d0, d1, d2; /* output coefs */ ! float a1, a2, b1, b2, g1, g2; /* temp coefs */ ! double xf; ! ! hlshelf_check(x); ! ! /* low shelf */ ! xf = 0.5 * 0.115129255 * (double)(x->s_gain0 - x->s_gain1); /* ln(10) / 20 = 0.115129255 */ ! if(xf < -200.) /* exp(x) -> 0 */ ! { ! a1 = 1.0f; ! b1 = -1.0f; ! g1 = 0.0f; ! } ! else ! { ! double t = tan(x->s_lradians); ! double e = exp(xf); ! double r = t / e; ! double kr = t * e; ! ! a1 = (r - 1) / (r + 1); ! b1 = (kr - 1) / (kr + 1); ! g1 = (kr + 1) / (r + 1); ! } ! ! /* high shelf */ ! xf = 0.5 * 0.115129255 * (double)(x->s_gain2 - x->s_gain1); /* ln(10) / 20 = 0.115129255 */ ! if(xf < -200.) /* exp(x) -> 0 */ ! { ! a2 = -1.0f; ! b2 = 1.0f; ! g2 = 0.0f; ! } ! else ! { ! double t = tan(x->s_hradians); ! double e = exp(xf); ! double r = t / e; ! double kr = t * e; ! ! a2 = (1 - r) / (1 + r); ! b2 = (1 - kr) / (1 + kr); ! g2 = (1 + kr) / (1 + r); ! } ! ! /* form product */ ! c0 = g1 * g2 * (float)(exp((double)(x->s_gain1) * 0.05f * 2.302585093f)); ; ! c1 = a1 + a2; ! c2 = a1 * a2; ! d0 = 1.0f; ! d1 = b1 + b2; ! d2 = b1 * b2; ! ! if (!hlshelf_check_stability(-c1/d0,-c2/d0,d0/d0,d1/d0,d2/d0)) { ! post("hlshelf: filter unstable -> resetting"); ! c0=1.;c1=0.;c2=0.; ! d0=1.;d1=0.;d2=0.; ! } ! ! SETFLOAT(at,-c1/d0); ! SETFLOAT(at+1,-c2/d0); ! SETFLOAT(at+2,d0/d0); ! SETFLOAT(at+3,d1/d0); ! SETFLOAT(at+4,d2/d0); ! ! outlet_list(x->x_obj.ob_outlet,&s_list,5,at); ! } ! ! void hlshelf_float(t_hlshelf *x,t_floatarg f) ! { ! x->s_gain0 = f; ! hlshelf_bang(x); ! } ! ! ! static void *hlshelf_new(t_symbol* s,t_int argc, t_atom* at) ! { ! t_hlshelf *x = (t_hlshelf *)pd_new(hlshelf_class); ! t_float k0 = atom_getfloat(at); ! t_float k1 = atom_getfloat(at+1); ! t_float k2 = atom_getfloat(at+2); ! t_float f1 = atom_getfloat(at+3); ! t_float f2 = atom_getfloat(at+4); ! ! ! f1 = atom_getfloat(at); ! f2 = atom_getfloat(at); ! ! if ((f1 == 0.0f && f2 == 0.0f) || f1 > f2){ /* all gains = 0db */ ! f1 = 150.0f; ! f2 = 5000.0f; ! } ! ! if (f1 < 0) f1 = 0.0f; ! if (f2 > SRATE) f2 = .5f*SRATE; ! ! x->s_rate = SRATE; /* srate default */ ! x->s_gain0 = k0; ! x->s_gain1 = k1; ! x->s_gain2 = k2; ! ! x->s_ltransfq = 0.0f; ! x->s_htransfq = SRATE/2; ! ! x->s_lradians = M_PI * x->s_ltransfq / x->s_rate; ! x->s_hradians= M_PI * (0.5f - (x->s_htransfq / x->s_rate)); ! ! floatinlet_new(&x->x_obj, &x->s_gain1); ! floatinlet_new(&x->x_obj, &x->s_gain2); ! floatinlet_new(&x->x_obj, &x->s_ltransfq); ! floatinlet_new(&x->x_obj, &x->s_htransfq); ! outlet_new(&x->x_obj, &s_list); ! ! return (x); ! } ! ! void hlshelf_setup(void) ! { ! hlshelf_class = class_new(gensym("hlshelf"), (t_newmethod)hlshelf_new, 0, ! sizeof(t_hlshelf), 0, A_GIMME, 0); ! class_addbang(hlshelf_class,hlshelf_bang); ! class_addfloat(hlshelf_class,hlshelf_float); ! } ! ! --- 1,226 ---- ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! #include <m_pd.h> ! #include <math.h> ! ! #ifdef _MSC_VER ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! ! /* ------------------------ hlshelf ----------------------------- */ ! ! ! #ifndef M_PI ! #define M_PI 3.141593f ! #endif ! ! #define SRATE 44100.0 ! #define MAX_GAIN 120.0f ! ! static t_class *hlshelf_class; ! ! ! typedef struct _hlshelf ! { ! t_object x_obj; ! float s_rate; ! float s_gain0; ! float s_gain1; ! float s_gain2; ! float s_ltransfq; ! float s_htransfq; ! float s_lradians; ! float s_hradians; ! } t_hlshelf; ! ! ! int hlshelf_check_stability(t_float fb1, ! t_float fb2, ! t_float ff1, ! t_float ff2, ! t_float ff3) ! { ! float discriminant = fb1 * fb1 + 4 * fb2; ! ! if (discriminant < 0) /* imaginary roots -- resonant filter */ ! { ! /* they're conjugates so we just check that the product ! is less than one */ ! if (fb2 >= -1.0f) goto stable; ! } ! else /* real roots */ ! { ! /* check that the parabola 1 - fb1 x - fb2 x^2 has a ! vertex between -1 and 1, and that it's nonnegative ! at both ends, which implies both roots are in [1-,1]. */ ! if (fb1 <= 2.0f && fb1 >= -2.0f && ! 1.0f - fb1 -fb2 >= 0 && 1.0f + fb1 - fb2 >= 0) ! goto stable; ! } ! return 0; ! stable: ! return 1; ! } ! ! ! void hlshelf_check(t_hlshelf *x) ! { ! ! if(x->s_gain0 - x->s_gain1 > MAX_GAIN) { ! x->s_gain0 = x->s_gain1 + MAX_GAIN; ! post("setting gain0 to %f",x->s_gain0); ! } ! ! ! if(x->s_gain1 > MAX_GAIN) { ! x->s_gain1 = MAX_GAIN; ! post("setting gain1 to %f",x->s_gain1); ! } ! ! if(x->s_gain2 - x->s_gain1 > MAX_GAIN) { ! x->s_gain2 = x->s_gain1 + MAX_GAIN; ! post("setting gain2 to %f",x->s_gain2); ! } ! ! /* constrain: 0 <= x->s_ltransfq < x->s_htransfq. */ ! x->s_ltransfq = (x->s_ltransfq < x->s_htransfq) ? x->s_ltransfq : x->s_htransfq - 0.5f; ! ! if (x->s_ltransfq < 0) x->s_ltransfq = 0.0f; ! ! x->s_lradians = M_PI * x->s_ltransfq / x->s_rate; ! x->s_hradians= M_PI * (0.5f - (x->s_htransfq / x->s_rate)); ! ! } ! ! ! void hlshelf_bang(t_hlshelf *x) ! { ! t_atom at[6]; ! float c0, c1, c2, d0, d1, d2; /* output coefs */ ! float a1, a2, b1, b2, g1, g2; /* temp coefs */ ! double xf; ! ! hlshelf_check(x); ! ! /* low shelf */ ! xf = 0.5 * 0.115129255 * (double)(x->s_gain0 - x->s_gain1); /* ln(10) / 20 = 0.115129255 */ ! if(xf < -200.) /* exp(x) -> 0 */ ! { ! a1 = 1.0f; ! b1 = -1.0f; ! g1 = 0.0f; ! } ! else ! { ! double t = tan(x->s_lradians); ! double e = exp(xf); ! double r = t / e; ! double kr = t * e; ! ! a1 = (r - 1) / (r + 1); ! b1 = (kr - 1) / (kr + 1); ! g1 = (kr + 1) / (r + 1); ! } ! ! /* high shelf */ ! xf = 0.5 * 0.115129255 * (double)(x->s_gain2 - x->s_gain1); /* ln(10) / 20 = 0.115129255 */ ! if(xf < -200.) /* exp(x) -> 0 */ ! { ! a2 = -1.0f; ! b2 = 1.0f; ! g2 = 0.0f; ! } ! else ! { ! double t = tan(x->s_hradians); ! double e = exp(xf); ! double r = t / e; ! double kr = t * e; ! ! a2 = (1 - r) / (1 + r); ! b2 = (1 - kr) / (1 + kr); ! g2 = (1 + kr) / (1 + r); ! } ! ! /* form product */ ! c0 = g1 * g2 * (float)(exp((double)(x->s_gain1) * 0.05f * 2.302585093f)); ; ! c1 = a1 + a2; ! c2 = a1 * a2; ! d0 = 1.0f; ! d1 = b1 + b2; ! d2 = b1 * b2; ! ! if (!hlshelf_check_stability(-c1/d0,-c2/d0,d0/d0,d1/d0,d2/d0)) { ! post("hlshelf: filter unstable -> resetting"); ! c0=1.;c1=0.;c2=0.; ! d0=1.;d1=0.;d2=0.; ! } ! ! SETFLOAT(at,-c1/d0); ! SETFLOAT(at+1,-c2/d0); ! SETFLOAT(at+2,d0/d0); ! SETFLOAT(at+3,d1/d0); ! SETFLOAT(at+4,d2/d0); ! ! outlet_list(x->x_obj.ob_outlet,&s_list,5,at); ! } ! ! void hlshelf_float(t_hlshelf *x,t_floatarg f) ! { ! x->s_gain0 = f; ! hlshelf_bang(x); ! } ! ! ! static void *hlshelf_new(t_symbol* s,t_int argc, t_atom* at) ! { ! t_hlshelf *x = (t_hlshelf *)pd_new(hlshelf_class); ! t_float k0 = atom_getfloat(at); ! t_float k1 = atom_getfloat(at+1); ! t_float k2 = atom_getfloat(at+2); ! t_float f1 = atom_getfloat(at+3); ! t_float f2 = atom_getfloat(at+4); ! ! ! f1 = atom_getfloat(at); ! f2 = atom_getfloat(at); ! ! if ((f1 == 0.0f && f2 == 0.0f) || f1 > f2){ /* all gains = 0db */ ! f1 = 150.0f; ! f2 = 5000.0f; ! } ! ! if (f1 < 0) f1 = 0.0f; ! if (f2 > SRATE) f2 = .5f*SRATE; ! ! x->s_rate = SRATE; /* srate default */ ! x->s_gain0 = k0; ! x->s_gain1 = k1; ! x->s_gain2 = k2; ! ! x->s_ltransfq = 0.0f; ! x->s_htransfq = SRATE/2; ! ! x->s_lradians = M_PI * x->s_ltransfq / x->s_rate; ! x->s_hradians= M_PI * (0.5f - (x->s_htransfq / x->s_rate)); ! ! floatinlet_new(&x->x_obj, &x->s_gain1); ! floatinlet_new(&x->x_obj, &x->s_gain2); ! floatinlet_new(&x->x_obj, &x->s_ltransfq); ! floatinlet_new(&x->x_obj, &x->s_htransfq); ! outlet_new(&x->x_obj, &s_list); ! ! return (x); ! } ! ! void hlshelf_setup(void) ! { ! hlshelf_class = class_new(gensym("hlshelf"), (t_newmethod)hlshelf_new, 0, ! sizeof(t_hlshelf), 0, A_GIMME, 0); ! class_addbang(hlshelf_class,hlshelf_bang); ! class_addfloat(hlshelf_class,hlshelf_float); ! } ! ! Index: highpass.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/filters/highpass.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** highpass.c 17 Jun 2002 10:13:54 -0000 1.1.1.1 --- highpass.c 14 Nov 2005 21:59:08 -0000 1.2 *************** *** 1,87 **** ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! /* ! ! These filter coefficients computations are taken from !
http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
! ! written by Robert Bristow-Johnson ! ! */ ! ! #include <m_pd.h> ! #ifdef NT ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! #include <math.h> ! #include "filters.h" ! ! ! /* ------------------- highpass ----------------------------*/ ! ! static t_class *highpass_class; ! ! void highpass_bang(t_rbjfilter *x) ! { ! t_atom at[5]; ! t_float omega = e_omega(x->x_freq,x->x_rate); ! t_float alpha = e_alpha(x->x_bw* 0.01,omega); ! t_float b1 = -(1 + cos(omega)); ! t_float b0 = -b1/2.; ! t_float b2 = b0; ! t_float a0 = 1 + alpha; ! t_float a1 = -2.*cos(omega); ! t_float a2 = 1 - alpha; ! ! /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ ! ! if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { ! post("highpass: filter unstable -> resetting"); ! a0=1.;a1=0.;a2=0.; ! b0=1.;b1=0.;b2=0.; ! } ! ! SETFLOAT(at,-a1/a0); ! SETFLOAT(at+1,-a2/a0); ! SETFLOAT(at+2,b0/a0); ! SETFLOAT(at+3,b1/a0); ! SETFLOAT(at+4,b2/a0); ! ! outlet_list(x->x_obj.ob_outlet,&s_list,5,at); ! } ! ! ! void highpass_float(t_rbjfilter *x,t_floatarg f) ! { ! x->x_freq = f; ! highpass_bang(x); ! } ! ! ! static void *highpass_new(t_floatarg f,t_floatarg bw) ! { ! t_rbjfilter *x = (t_rbjfilter *)pd_new(highpass_class); ! ! x->x_rate = 44100.0; ! outlet_new(&x->x_obj,&s_float); ! /* floatinlet_new(&x->x_obj, &x->x_gain); */ ! floatinlet_new(&x->x_obj, &x->x_bw); ! if (f > 0.) x->x_freq = f; ! if (bw > 0.) x->x_bw = bw; ! return (x); ! } ! ! ! void highpass_setup(void) ! { ! highpass_class = class_new(gensym("highpass"), (t_newmethod)highpass_new, 0, ! sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addbang(highpass_class,highpass_bang); ! class_addfloat(highpass_class,highpass_float); ! } ! ! ! ! --- 1,87 ---- ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! /* ! ! These filter coefficients computations are taken from !
http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
! ! written by Robert Bristow-Johnson ! ! */ ! ! #include <m_pd.h> ! #ifdef _MSC_VER ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! #include <math.h> ! #include "filters.h" ! ! ! /* ------------------- highpass ----------------------------*/ ! ! static t_class *highpass_class; ! ! void highpass_bang(t_rbjfilter *x) ! { ! t_atom at[5]; ! t_float omega = e_omega(x->x_freq,x->x_rate); ! t_float alpha = e_alpha(x->x_bw* 0.01,omega); ! t_float b1 = -(1 + cos(omega)); ! t_float b0 = -b1/2.; ! t_float b2 = b0; ! t_float a0 = 1 + alpha; ! t_float a1 = -2.*cos(omega); ! t_float a2 = 1 - alpha; ! ! /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ ! ! if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { ! post("highpass: filter unstable -> resetting"); ! a0=1.;a1=0.;a2=0.; ! b0=1.;b1=0.;b2=0.; ! } ! ! SETFLOAT(at,-a1/a0); ! SETFLOAT(at+1,-a2/a0); ! SETFLOAT(at+2,b0/a0); ! SETFLOAT(at+3,b1/a0); ! SETFLOAT(at+4,b2/a0); ! ! outlet_list(x->x_obj.ob_outlet,&s_list,5,at); ! } ! ! ! void highpass_float(t_rbjfilter *x,t_floatarg f) ! { ! x->x_freq = f; ! highpass_bang(x); ! } ! ! ! static void *highpass_new(t_floatarg f,t_floatarg bw) ! { ! t_rbjfilter *x = (t_rbjfilter *)pd_new(highpass_class); ! ! x->x_rate = 44100.0; ! outlet_new(&x->x_obj,&s_float); ! /* floatinlet_new(&x->x_obj, &x->x_gain); */ ! floatinlet_new(&x->x_obj, &x->x_bw); ! if (f > 0.) x->x_freq = f; ! if (bw > 0.) x->x_bw = bw; ! return (x); ! } ! ! ! void highpass_setup(void) ! { ! highpass_class = class_new(gensym("highpass"), (t_newmethod)highpass_new, 0, ! sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addbang(highpass_class,highpass_bang); ! class_addfloat(highpass_class,highpass_float); ! } ! ! ! ! Index: highshelf.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/filters/highshelf.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** highshelf.c 17 Jun 2002 10:13:54 -0000 1.1.1.1 --- highshelf.c 14 Nov 2005 21:59:08 -0000 1.2 *************** *** 1,90 **** ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! /* ! ! These filter coefficients computations are taken from !
http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
! ! written by Robert Bristow-Johnson ! ! */ ! ! #include <m_pd.h> ! #ifdef NT ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! #include <math.h> ! #include "filters.h" ! ! ! /* ------------------- highshelf ----------------------------*/ ! ! static t_class *highshelf_class; ! ! void highshelf_bang(t_rbjfilter *x) ! { ! t_atom at[5]; ! t_float omega = e_omega(x->x_freq,x->x_rate); ! t_float A = e_A(x->x_gain); ! t_float cs = cos(omega); ! t_float sn = sin(omega); ! t_float beta = e_beta(A,x->x_bw* 0.01); ! ! t_float b0 = A*((A+1) + (A-1)*cs + beta*sn); ! t_float b1 =-2.*A*((A-1) + (A+1)*cs); ! t_float b2 = A*((A+1) + (A-1)*cs - beta*sn); ! t_float a0 = ((A+1) - (A-1)*cs + beta*sn); ! t_float a1 = 2.*((A-1) - (A+1)*cs); ! t_float a2 = ((A+1) - (A-1)*cs - beta*sn); ! ! /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw);*/ ! ! if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { ! post("highshelf: filter unstable -> resetting"); ! a0=1.;a1=0.;a2=0.; ! b0=1.;b1=0.;b2=0.; ! } ! ! SETFLOAT(at,-a1/a0); ! SETFLOAT(at+1,-a2/a0); ! SETFLOAT(at+2,b0/a0); ! SETFLOAT(at+3,b1/a0); ! SETFLOAT(at+4,b2/a0); ! ! outlet_list(x->x_obj.ob_outlet,&s_list,5,at); ! } ! ! ! void highshelf_float(t_rbjfilter *x,t_floatarg f) ! { ! x->x_freq = f; ! highshelf_bang(x); ! } ! ! ! static void *highshelf_new(t_floatarg f,t_floatarg g,t_floatarg bw) ! { ! t_rbjfilter *x = (t_rbjfilter *)pd_new(highshelf_class); ! ! x->x_rate = 44100.0; ! outlet_new(&x->x_obj,&s_float); ! floatinlet_new(&x->x_obj, &x->x_gain); ! floatinlet_new(&x->x_obj, &x->x_bw); ! if (f > 0.) x->x_freq = f; ! if (bw > 0.) x->x_bw = bw; ! if (g != 0.) x->x_gain = g; ! return (x); ! } ! ! ! void highshelf_setup(void) ! { ! highshelf_class = class_new(gensym("highshelf"), (t_newmethod)highshelf_new, 0, ! sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addbang(highshelf_class,highshelf_bang); ! class_addfloat(highshelf_class,highshelf_float); ! } ! ! --- 1,90 ---- ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! /* ! ! These filter coefficients computations are taken from !
http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
! ! written by Robert Bristow-Johnson ! ! */ ! ! #include <m_pd.h> ! #ifdef _MSC_VER ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! #include <math.h> ! #include "filters.h" ! ! ! /* ------------------- highshelf ----------------------------*/ ! ! static t_class *highshelf_class; ! ! void highshelf_bang(t_rbjfilter *x) ! { ! t_atom at[5]; ! t_float omega = e_omega(x->x_freq,x->x_rate); ! t_float A = e_A(x->x_gain); ! t_float cs = cos(omega); ! t_float sn = sin(omega); ! t_float beta = e_beta(A,x->x_bw* 0.01); ! ! t_float b0 = A*((A+1) + (A-1)*cs + beta*sn); ! t_float b1 =-2.*A*((A-1) + (A+1)*cs); ! t_float b2 = A*((A+1) + (A-1)*cs - beta*sn); ! t_float a0 = ((A+1) - (A-1)*cs + beta*sn); ! t_float a1 = 2.*((A-1) - (A+1)*cs); ! t_float a2 = ((A+1) - (A-1)*cs - beta*sn); ! ! /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw);*/ ! ! if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { ! post("highshelf: filter unstable -> resetting"); ! a0=1.;a1=0.;a2=0.; ! b0=1.;b1=0.;b2=0.; ! } ! ! SETFLOAT(at,-a1/a0); ! SETFLOAT(at+1,-a2/a0); ! SETFLOAT(at+2,b0/a0); ! SETFLOAT(at+3,b1/a0); ! SETFLOAT(at+4,b2/a0); ! ! outlet_list(x->x_obj.ob_outlet,&s_list,5,at); ! } ! ! ! void highshelf_float(t_rbjfilter *x,t_floatarg f) ! { ! x->x_freq = f; ! highshelf_bang(x); ! } ! ! ! static void *highshelf_new(t_floatarg f,t_floatarg g,t_floatarg bw) ! { ! t_rbjfilter *x = (t_rbjfilter *)pd_new(highshelf_class); ! ! x->x_rate = 44100.0; ! outlet_new(&x->x_obj,&s_float); ! floatinlet_new(&x->x_obj, &x->x_gain); ! floatinlet_new(&x->x_obj, &x->x_bw); ! if (f > 0.) x->x_freq = f; ! if (bw > 0.) x->x_bw = bw; ! if (g != 0.) x->x_gain = g; ! return (x); ! } ! ! ! void highshelf_setup(void) ! { ! highshelf_class = class_new(gensym("highshelf"), (t_newmethod)highshelf_new, 0, ! sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addbang(highshelf_class,highshelf_bang); ! class_addfloat(highshelf_class,highshelf_float); ! } ! ! Index: moog~.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/filters/moog~.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** moog~.c 26 Nov 2002 12:35:23 -0000 1.2 --- moog~.c 14 Nov 2005 21:59:08 -0000 1.3 *************** *** 1,182 **** ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! #include "math.h" ! #include <m_pd.h> ! ! /* ----------------------------- moog ----------------------------- */ ! static t_class *moog_class; ! ! ! typedef struct _moog ! { ! t_object x_obj; ! t_pd in2; ! t_float x_1,x_2,x_3,x_4; ! t_float y_1,y_2,y_3,y_4; ! } t_moog; ! ! static void moog_reset(t_moog *x) ! { ! x->x_1 = x->x_2 = x->x_3 = x->x_4 = 0.0; ! x->y_1 = x->y_2 = x->y_3 = x->y_4 = 0.0; ! ! } ! ! ! ! static void *moog_new(t_symbol *s, int argc, t_atom *argv) ! { ! if (argc > 1) post("moog~: extra arguments ignored"); ! { ! t_moog *x = (t_moog *)pd_new(moog_class); ! outlet_new(&x->x_obj, &s_signal); ! inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); ! inlet_new(&x->x_obj, &x->in2, &s_signal, &s_signal); ! moog_reset(x); ! return (x); ! } ! ! ! } ! ! ! ! static t_float calc_k(t_float f,t_float k) { ! if (k>4.) k =4.; ! if (k < 0.) k = 0.; ! if (f <= 3800) return k; ! k = k - 0.5*((f-3800)/4300); ! return k; ! } ! ! t_int *moog_perform(t_int *w) ! { ! t_moog* x = (t_moog*) (w[1]); ! t_float *in1 = (t_float *)(w[2]); ! t_float *p = (t_float *)(w[3]); ! t_float *k = (t_float *)(w[4]); ! ! t_float *out = (t_float *)(w[5]); ! int n = (int)(w[6]); ! float in; ! float pt,pt1; ! ! float x1 = x->x_1; ! float x2 = x->x_2; ! float x3 = x->x_3; ! float x4 = x->x_4; ! float ys1 = x->y_1; ! float ys2 = x->y_2; ! float ys3 = x->y_3; ! float ys4 = x->y_4; ! ! ! while (n--) { ! if (*p > 8140) *p = 8140.; ! *k = calc_k(*p,*k); ! pt =*p; ! pt1=(pt+1)*0.76923077; ! in = *in1++ - *k*ys4; ! ys1 = (pt1)*in + 0.3*x1 - pt*ys1; ! x1 = in; ! ys2 = (pt1)*ys1 + 0.3*x2 - pt*ys2; ! x2 = ys1; ! ys3 = (pt1)*ys2 + 0.3 *x3 - pt*ys3; ! x3 = ys2; ! ys4 = (pt1)*ys3 + 0.3*x4 - pt*ys4; ! x4 = ys3; ! *out++ = ys4; ! } ! ! ! x->y_1 = ys1; ! x->y_2 = ys2; ! x->y_3 = ys3; ! x->y_4 = ys4; ! x->x_1 = x1; ! x->x_2 = x2; ! x->x_3 = x3; ! x->x_4 = x4; ! ! return (w+7); ! } ! ! ! #define CLIP(x) x = ((x) > 1.0 ? (1.0) : (x)) ! ! t_int *moog_perf8(t_int *w) ! { ! t_moog* x = (t_moog*) (w[1]); ! t_float *in1 = (t_float *)(w[2]); ! t_float *p = (t_float *)(w[3]); ! t_float *k = (t_float *)(w[4]); ! t_float *out = (t_float *)(w[5]); ! int n = (int)(w[6]); ! ! t_float x1 = x->x_1; ! t_float x2 = x->x_2; ! t_float x3 = x->x_3; ! t_float x4 = x->x_4; ! t_float ys1 = x->y_1; ! t_float ys2 = x->y_2; ! t_float ys3 = x->y_3; ! t_float ys4 = x->y_4; ! t_float temp,temp2; ! t_float pt,pt1; ! t_float in; ! ! while (n--) { ! if (*p > 8140.) *p = 8140.; ! *k = calc_k(*p,*k); ! ! pt =*p* 0.01*0.0140845 - 0.9999999f; ! pt1=(pt+1.0)*0.76923077; ! in = *in1++ - *k*ys4; ! ys1 = pt1*(in + 0.3*x1) - pt*ys1; ! x1 = in; ! ys2 = pt1*(ys1 + 0.3*x2) - pt*ys2; ! x2 = ys1; ! ys3 = pt1*(ys2 + 0.3*x3) - pt*ys3; ! x3 = ys2; ! ys4 = pt1*(ys3 + 0.3*x4) - pt*ys4; ! x4 = ys3; ! *out++ = ys4; ! ! p++;k++; ! } ! ! x->y_1 = ys1; ! x->y_2 = ys2; ! x->y_3 = ys3; ! x->y_4 = ys4; ! x->x_1 = x1; ! x->x_2 = x2; ! x->x_3 = x3; ! x->x_4 = x4; ! ! return (w+7); ! } ! ! void dsp_add_moog(t_moog *x, t_sample *in1, t_sample *in2, t_sample *in3, t_sample *out, int n) ! { ! if (n&7) ! dsp_add(moog_perform, 6,(t_int)x, in1,in2,in3, out, n); ! else ! dsp_add(moog_perf8, 6,(t_int) x, in1, in2, in3, out, n); ! } ! ! static void moog_dsp(t_moog *x, t_signal **sp) ! { ! dsp_add_moog(x,sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec,sp[0]->s_n); ! } ! ! ! void moog_tilde_setup(void) ! { ! moog_class = class_new(gensym("moog~"), (t_newmethod)moog_new, 0, ! sizeof(t_moog), 0, A_GIMME, 0); ! class_addmethod(moog_class, nullfn, gensym("signal"), 0); ! class_addmethod(moog_class, (t_method)moog_reset, gensym("reset"), 0); ! class_addmethod(moog_class, (t_method)moog_dsp, gensym("dsp"), A_NULL); ! } --- 1,182 ---- ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! #include "math.h" ! #include <m_pd.h> ! ! /* ----------------------------- moog ----------------------------- */ ! static t_class *moog_class; ! ! ! typedef struct _moog ! { ! t_object x_obj; ! t_pd in2; ! t_float x_1,x_2,x_3,x_4; ! t_float y_1,y_2,y_3,y_4; ! } t_moog; ! ! static void moog_reset(t_moog *x) ! { ! x->x_1 = x->x_2 = x->x_3 = x->x_4 = 0.0; ! x->y_1 = x->y_2 = x->y_3 = x->y_4 = 0.0; ! ! } ! ! ! ! static void *moog_new(t_symbol *s, int argc, t_atom *argv) ! { ! if (argc > 1) post("moog~: extra arguments ignored"); ! { ! t_moog *x = (t_moog *)pd_new(moog_class); ! outlet_new(&x->x_obj, &s_signal); ! inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); ! inlet_new(&x->x_obj, &x->in2, &s_signal, &s_signal); ! moog_reset(x); ! return (x); ! } ! ! ! } ! ! ! ! static t_float calc_k(t_float f,t_float k) { ! if (k>4.) k =4.; ! if (k < 0.) k = 0.; ! if (f <= 3800) return k; ! k = k - 0.5*((f-3800)/4300); ! return k; ! } ! ! t_int *moog_perform(t_int *w) ! { ! t_moog* x = (t_moog*) (w[1]); ! t_float *in1 = (t_float *)(w[2]); ! t_float *p = (t_float *)(w[3]); ! t_float *k = (t_float *)(w[4]); ! ! t_float *out = (t_float *)(w[5]); ! int n = (int)(w[6]); ! float in; ! float pt,pt1; ! ! float x1 = x->x_1; ! float x2 = x->x_2; ! float x3 = x->x_3; ! float x4 = x->x_4; ! float ys1 = x->y_1; ! float ys2 = x->y_2; ! float ys3 = x->y_3; ! float ys4 = x->y_4; ! ! ! while (n--) { ! if (*p > 8140) *p = 8140.; ! *k = calc_k(*p,*k); ! pt =*p; ! pt1=(pt+1)*0.76923077; ! in = *in1++ - *k*ys4; ! ys1 = (pt1)*in + 0.3*x1 - pt*ys1; ! x1 = in; ! ys2 = (pt1)*ys1 + 0.3*x2 - pt*ys2; ! x2 = ys1; ! ys3 = (pt1)*ys2 + 0.3 *x3 - pt*ys3; ! x3 = ys2; ! ys4 = (pt1)*ys3 + 0.3*x4 - pt*ys4; ! x4 = ys3; ! *out++ = ys4; ! } ! ! ! x->y_1 = ys1; ! x->y_2 = ys2; ! x->y_3 = ys3; ! x->y_4 = ys4; ! x->x_1 = x1; ! x->x_2 = x2; ! x->x_3 = x3; ! x->x_4 = x4; ! ! return (w+7); ! } ! ! ! #define CLIP(x) x = ((x) > 1.0 ? (1.0) : (x)) ! ! t_int *moog_perf8(t_int *w) ! { ! t_moog* x = (t_moog*) (w[1]); ! t_float *in1 = (t_float *)(w[2]); ! t_float *p = (t_float *)(w[3]); ! t_float *k = (t_float *)(w[4]); ! t_float *out = (t_float *)(w[5]); ! int n = (int)(w[6]); ! ! t_float x1 = x->x_1; ! t_float x2 = x->x_2; ! t_float x3 = x->x_3; ! t_float x4 = x->x_4; ! t_float ys1 = x->y_1; ! t_float ys2 = x->y_2; ! t_float ys3 = x->y_3; ! t_float ys4 = x->y_4; ! t_float temp,temp2; ! t_float pt,pt1; ! t_float in; ! ! while (n--) { ! if (*p > 8140.) *p = 8140.; ! *k = calc_k(*p,*k); ! ! pt =*p* 0.01*0.0140845 - 0.9999999f; ! pt1=(pt+1.0)*0.76923077; ! in = *in1++ - *k*ys4; ! ys1 = pt1*(in + 0.3*x1) - pt*ys1; ! x1 = in; ! ys2 = pt1*(ys1 + 0.3*x2) - pt*ys2; ! x2 = ys1; ! ys3 = pt1*(ys2 + 0.3*x3) - pt*ys3; ! x3 = ys2; ! ys4 = pt1*(ys3 + 0.3*x4) - pt*ys4; ! x4 = ys3; ! *out++ = ys4; ! ! p++;k++; ! } ! ! x->y_1 = ys1; ! x->y_2 = ys2; ! x->y_3 = ys3; ! x->y_4 = ys4; ! x->x_1 = x1; ! x->x_2 = x2; ! x->x_3 = x3; ! x->x_4 = x4; ! ! return (w+7); ! } ! ! void dsp_add_moog(t_moog *x, t_sample *in1, t_sample *in2, t_sample *in3, t_sample *out, int n) ! { ! if (n&7) ! dsp_add(moog_perform, 6,(t_int)x, in1,in2,in3, out, n); ! else ! dsp_add(moog_perf8, 6,(t_int) x, in1, in2, in3, out, n); ! } ! ! static void moog_dsp(t_moog *x, t_signal **sp) ! { ! dsp_add_moog(x,sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec,sp[0]->s_n); ! } ! ! ! void moog_tilde_setup(void) ! { ! moog_class = class_new(gensym("moog~"), (t_newmethod)moog_new, 0, ! sizeof(t_moog), 0, A_GIMME, 0); ! class_addmethod(moog_class, nullfn, gensym("signal"), 0); ! class_addmethod(moog_class, (t_method)moog_reset, gensym("reset"), 0); ! class_addmethod(moog_class, (t_method)moog_dsp, gensym("dsp"), A_NULL); ! } Index: notch.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/filters/notch.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** notch.c 17 Jun 2002 10:13:55 -0000 1.1.1.1 --- notch.c 14 Nov 2005 21:59:08 -0000 1.2 *************** *** 1,89 **** ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! /* ! ! These filter coefficients computations are taken from !
http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
! ! written by Robert Bristow-Johnson ! ! */ ! ! #include <m_pd.h> ! #ifdef NT ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! #include <math.h> ! #include "filters.h" ! ! ! ! /* ------------------- notch ----------------------------*/ ! ! static t_class *notch_class; ! ! void notch_bang(t_rbjfilter *x) ! { ! t_atom at[5]; ! t_float omega = e_omega(x->x_freq,x->x_rate); ! t_float alpha = e_alpha(x->x_bw* 0.01,omega); ! t_float b1 = -2.*cos(omega); ! t_float b0 = 1; ! t_float b2 = b0; ! t_float a0 = 1 + alpha; ! t_float a1 = -2.*cos(omega); ! t_float a2 = 1 - alpha; ! ! /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ ! ! if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { ! post("notch: filter unstable -> resetting"); ! a0=1.;a1=0.;a2=0.; ! b0=1.;b1=0.;b2=0.; ! } ! ! SETFLOAT(at,-a1/a0); ! SETFLOAT(at+1,-a2/a0); ! SETFLOAT(at+2,b0/a0); ! SETFLOAT(at+3,b1/a0); ! SETFLOAT(at+4,b2/a0); ! ! outlet_list(x->x_obj.ob_outlet,&s_list,5,at); ! } ! ! ! void notch_float(t_rbjfilter *x,t_floatarg f) ! { ! x->x_freq = f; ! notch_bang(x); ! } ! ! ! static void *notch_new(t_floatarg f,t_floatarg bw) ! { ! t_rbjfilter *x = (t_rbjfilter *)pd_new(notch_class); ! ! x->x_rate = 44100.0; ! outlet_new(&x->x_obj,&s_float); ! /* floatinlet_new(&x->x_obj, &x->x_gain); */ ! floatinlet_new(&x->x_obj, &x->x_bw); ! if (f > 0.) x->x_freq = f; ! if (bw > 0.) x->x_bw = bw; ! return (x); ! } ! ! ! void notch_setup(void) ! { ! notch_class = class_new(gensym("notch"), (t_newmethod)notch_new, 0, ! sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addbang(notch_class,notch_bang); ! class_addfloat(notch_class,notch_float); ! } ! ! ! ! ! --- 1,89 ---- ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! /* ! ! These filter coefficients computations are taken from !
http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
! ! written by Robert Bristow-Johnson ! ! */ ! ! #include <m_pd.h> ! #ifdef _MSC_VER ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! #include <math.h> ! #include "filters.h" ! ! ! ! /* ------------------- notch ----------------------------*/ ! ! static t_class *notch_class; ! ! void notch_bang(t_rbjfilter *x) ! { ! t_atom at[5]; ! t_float omega = e_omega(x->x_freq,x->x_rate); ! t_float alpha = e_alpha(x->x_bw* 0.01,omega); ! t_float b1 = -2.*cos(omega); ! t_float b0 = 1; ! t_float b2 = b0; ! t_float a0 = 1 + alpha; ! t_float a1 = -2.*cos(omega); ! t_float a2 = 1 - alpha; ! ! /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ ! ! if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { ! post("notch: filter unstable -> resetting"); ! a0=1.;a1=0.;a2=0.; ! b0=1.;b1=0.;b2=0.; ! } ! ! SETFLOAT(at,-a1/a0); ! SETFLOAT(at+1,-a2/a0); ! SETFLOAT(at+2,b0/a0); ! SETFLOAT(at+3,b1/a0); ! SETFLOAT(at+4,b2/a0); ! ! outlet_list(x->x_obj.ob_outlet,&s_list,5,at); ! } ! ! ! void notch_float(t_rbjfilter *x,t_floatarg f) ! { ! x->x_freq = f; ! notch_bang(x); ! } ! ! ! static void *notch_new(t_floatarg f,t_floatarg bw) ! { ! t_rbjfilter *x = (t_rbjfilter *)pd_new(notch_class); ! ! x->x_rate = 44100.0; ! outlet_new(&x->x_obj,&s_float); ! /* floatinlet_new(&x->x_obj, &x->x_gain); */ ! floatinlet_new(&x->x_obj, &x->x_bw); ! if (f > 0.) x->x_freq = f; ! if (bw > 0.) x->x_bw = bw; ! return (x); ! } ! ! ! void notch_setup(void) ! { ! notch_class = class_new(gensym("notch"), (t_newmethod)notch_new, 0, ! sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addbang(notch_class,notch_bang); ! class_addfloat(notch_class,notch_float); ! } ! ! ! ! ! Index: lowpass.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/filters/lowpass.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** lowpass.c 17 Jun 2002 10:13:54 -0000 1.1.1.1 --- lowpass.c 14 Nov 2005 21:59:08 -0000 1.2 *************** *** 1,89 **** ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! /* ! ! These filter coefficients computations are taken from !
http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
! ! written by Robert Bristow-Johnson ! ! */ ! ! #include <m_pd.h> ! #ifdef NT ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! #include <math.h> ! #include "filters.h" ! ! ! ! /* ------------------- lowpass ----------------------------*/ ! ! static t_class *lowpass_class; ! ! void lowpass_bang(t_rbjfilter *x) ! { ! t_atom at[5]; ! t_float omega = e_omega(x->x_freq,x->x_rate); ! t_float alpha = e_alpha(x->x_bw*0.01,omega); ! t_float b1 = 1 - cos(omega); ! t_float b0 = b1/2.; ! t_float b2 = b0; ! t_float a0 = 1 + alpha; ! t_float a1 = -2.*cos(omega); ! t_float a2 = 1 - alpha; ! ! /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ ! ! if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { ! post("lowpass: filter unstable -> resetting"); ! a0=1.;a1=0.;a2=0.; ! b0=1.;b1=0.;b2=0.; ! } ! ! SETFLOAT(at,-a1/a0); ! SETFLOAT(at+1,-a2/a0); ! SETFLOAT(at+2,b0/a0); ! SETFLOAT(at+3,b1/a0); ! SETFLOAT(at+4,b2/a0); ! ! outlet_list(x->x_obj.ob_outlet,&s_list,5,at); ! } ! ! ! void lowpass_float(t_rbjfilter *x,t_floatarg f) ! { ! x->x_freq = f; ! lowpass_bang(x); ! } ! ! ! static void *lowpass_new(t_floatarg f,t_floatarg bw) ! { ! t_rbjfilter *x = (t_rbjfilter *)pd_new(lowpass_class); ! ! x->x_rate = 44100.0; ! outlet_new(&x->x_obj,&s_float); ! /* floatinlet_new(&x->x_obj, &x->x_gain); */ ! floatinlet_new(&x->x_obj, &x->x_bw); ! ! if (f > 0.) x->x_freq = f; ! if (bw > 0.) x->x_bw = bw; ! return (x); ! } ! ! ! void lowpass_setup(void) ! { ! lowpass_class = class_new(gensym("lowpass"), (t_newmethod)lowpass_new, 0, ! sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addbang(lowpass_class,lowpass_bang); ! class_addfloat(lowpass_class,lowpass_float); ! } ! ! ! ! --- 1,89 ---- ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! /* ! ! These filter coefficients computations are taken from !
http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
! ! written by Robert Bristow-Johnson ! ! */ ! ! #include <m_pd.h> ! #ifdef _MSC_VER ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! #include <math.h> ! #include "filters.h" ! ! ! ! /* ------------------- lowpass ----------------------------*/ ! ! static t_class *lowpass_class; ! ! void lowpass_bang(t_rbjfilter *x) ! { ! t_atom at[5]; ! t_float omega = e_omega(x->x_freq,x->x_rate); ! t_float alpha = e_alpha(x->x_bw*0.01,omega); ! t_float b1 = 1 - cos(omega); ! t_float b0 = b1/2.; ! t_float b2 = b0; ! t_float a0 = 1 + alpha; ! t_float a1 = -2.*cos(omega); ! t_float a2 = 1 - alpha; ! ! /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ ! ! if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { ! post("lowpass: filter unstable -> resetting"); ! a0=1.;a1=0.;a2=0.; ! b0=1.;b1=0.;b2=0.; ! } ! ! SETFLOAT(at,-a1/a0); ! SETFLOAT(at+1,-a2/a0); ! SETFLOAT(at+2,b0/a0); ! SETFLOAT(at+3,b1/a0); ! SETFLOAT(at+4,b2/a0); ! ! outlet_list(x->x_obj.ob_outlet,&s_list,5,at); ! } ! ! ! void lowpass_float(t_rbjfilter *x,t_floatarg f) ! { ! x->x_freq = f; ! lowpass_bang(x); ! } ! ! ! static void *lowpass_new(t_floatarg f,t_floatarg bw) ! { ! t_rbjfilter *x = (t_rbjfilter *)pd_new(lowpass_class); ! ! x->x_rate = 44100.0; ! outlet_new(&x->x_obj,&s_float); ! /* floatinlet_new(&x->x_obj, &x->x_gain); */ ! floatinlet_new(&x->x_obj, &x->x_bw); ! ! if (f > 0.) x->x_freq = f; ! if (bw > 0.) x->x_bw = bw; ! return (x); ! } ! ! ! void lowpass_setup(void) ! { ! lowpass_class = class_new(gensym("lowpass"), (t_newmethod)lowpass_new, 0, ! sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addbang(lowpass_class,lowpass_bang); ! class_addfloat(lowpass_class,lowpass_float); ! } ! ! ! !
[View Less]
1
0
0
0
externals/ggee/experimental fofsynth~.c, 1.1.1.1, 1.2 pvocfreq.c, 1.1.1.1, 1.2
by Hans-Christoph Steiner
14 Nov '05
14 Nov '05
Update of /cvsroot/pure-data/externals/ggee/experimental In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8684/experimental Modified Files: fofsynth~.c pvocfreq.c Log Message: these pragmas are only used for MSVC, not MinGW or Cygwin, therefore changing the define from NT to _MSC_VER Index: pvocfreq.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/experimental/pvocfreq.c,v retrieving revision 1.1.1.1 retrieving revision 1.
…
[View More]
2 diff -C2 -d -r1.1.1.1 -r1.2 *** pvocfreq.c 17 Jun 2002 10:13:54 -0000 1.1.1.1 --- pvocfreq.c 14 Nov 2005 21:59:08 -0000 1.2 *************** *** 1,114 **** ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! #include <m_pd.h> ! #ifdef NT ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! ! /* ------------------------ shuffle ----------------------------- */ ! ! static t_class *shuffle_class; ! ! ! typedef struct _shuffle ! { ! t_object x_obj; ! t_float x; ! } t_shuffle; ! ! ! void shuffle_float(t_shuffle *x, t_floatarg f) ! { ! post("float %f",f); ! x->x = f; ! } ! ! ! ! static t_int *shuffle_perform(t_int *w) ! { ! t_shuffle* x = (t_shuffle*)(w[1]); ! t_float* in1 = (t_float*) w[2]; ! t_float* in2 = (t_float*) w[3]; ! t_float* out = (t_float*) w[4]; ! int n = w[5]; ! ! if (x->x <= 0) { ! while (n--) { ! *out++ = *in1++; ! } ! return w+6; ! } ! ! if (x->x < 0.5) { ! t_int index = 1/x->x; ! while (n--) { ! if (n%index){ ! *out++ = *in1++; ! in2++; ! } ! else { ! *out++ = *in2++; ! in1++; ! } ! } ! return w+6; ! } ! ! if (x->x > 1.0) { ! while (n--) { ! *out++ = *in2++; ! } ! return w+6; ! } ! ! if (x->x >= 0.5) { ! t_int index = 1/(1.0- x->x); ! while (n--) { ! if (n%index) { ! *out++ = *in2++; ! in1++; ! } ! else { ! *out++ = *in1++; ! in2++; ! } ! } ! } ! ! return w+6; ! } ! ! ! static void shuffle_dsp(t_shuffle *x, t_signal **sp) ! { ! dsp_add(shuffle_perform, 5, x, sp[0]->s_vec, ! sp[1]->s_vec,sp[2]->s_vec, sp[0]->s_n); ! ! } ! ! static void *shuffle_new() ! { ! t_shuffle *x = (t_shuffle *)pd_new(shuffle_class); ! ! inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); ! ! ! outlet_new(&x->x_obj, gensym("signal")); ! return (x); ! } ! ! void shuffle_setup(void) ! { ! shuffle_class = class_new(gensym("shuffle~"), (t_newmethod)shuffle_new, 0, ! sizeof(t_shuffle), 0,0); ! ! class_addmethod(shuffle_class, nullfn, gensym("signal"), 0); ! class_addmethod(shuffle_class, (t_method) shuffle_dsp, gensym("dsp"), 0); ! ! class_addfloat(shuffle_class,shuffle_float); ! } ! ! --- 1,114 ---- ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! #include <m_pd.h> ! #ifdef _MSC_VER ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! ! /* ------------------------ shuffle ----------------------------- */ ! ! static t_class *shuffle_class; ! ! ! typedef struct _shuffle ! { ! t_object x_obj; ! t_float x; ! } t_shuffle; ! ! ! void shuffle_float(t_shuffle *x, t_floatarg f) ! { ! post("float %f",f); ! x->x = f; ! } ! ! ! ! static t_int *shuffle_perform(t_int *w) ! { ! t_shuffle* x = (t_shuffle*)(w[1]); ! t_float* in1 = (t_float*) w[2]; ! t_float* in2 = (t_float*) w[3]; ! t_float* out = (t_float*) w[4]; ! int n = w[5]; ! ! if (x->x <= 0) { ! while (n--) { ! *out++ = *in1++; ! } ! return w+6; ! } ! ! if (x->x < 0.5) { ! t_int index = 1/x->x; ! while (n--) { ! if (n%index){ ! *out++ = *in1++; ! in2++; ! } ! else { ! *out++ = *in2++; ! in1++; ! } ! } ! return w+6; ! } ! ! if (x->x > 1.0) { ! while (n--) { ! *out++ = *in2++; ! } ! return w+6; ! } ! ! if (x->x >= 0.5) { ! t_int index = 1/(1.0- x->x); ! while (n--) { ! if (n%index) { ! *out++ = *in2++; ! in1++; ! } ! else { ! *out++ = *in1++; ! in2++; ! } ! } ! } ! ! return w+6; ! } ! ! ! static void shuffle_dsp(t_shuffle *x, t_signal **sp) ! { ! dsp_add(shuffle_perform, 5, x, sp[0]->s_vec, ! sp[1]->s_vec,sp[2]->s_vec, sp[0]->s_n); ! ! } ! ! static void *shuffle_new() ! { ! t_shuffle *x = (t_shuffle *)pd_new(shuffle_class); ! ! inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); ! ! ! outlet_new(&x->x_obj, gensym("signal")); ! return (x); ! } ! ! void shuffle_setup(void) ! { ! shuffle_class = class_new(gensym("shuffle~"), (t_newmethod)shuffle_new, 0, ! sizeof(t_shuffle), 0,0); ! ! class_addmethod(shuffle_class, nullfn, gensym("signal"), 0); ! class_addmethod(shuffle_class, (t_method) shuffle_dsp, gensym("dsp"), 0); ! ! class_addfloat(shuffle_class,shuffle_float); ! } ! ! Index: fofsynth~.c =================================================================== RCS file: /cvsroot/pure-data/externals/ggee/experimental/fofsynth~.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** fofsynth~.c 17 Jun 2002 10:13:54 -0000 1.1.1.1 --- fofsynth~.c 14 Nov 2005 21:59:08 -0000 1.2 *************** *** 1,354 **** ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! #include <m_pd.h> ! #include <math.h> ! #ifdef NT ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! ! /* ------------------------ fofsynth~ ----------------------------- */ ! ! #ifndef NT ! void garray_usedindsp(t_garray *x); ! #endif ! ! #define DEBUG(a,b) if (x->debug) post(a,b); ! ! #define MAXGRAINS 1000 ! #define PD_PI 3.14159 ! ! static float* cos_table; ! static float* halfcos_table; ! static float* exp_table; ! ! static void cos_maketable(void) ! { ! int i; ! float *fp, phase, phsinc = (2. * PD_PI) / COSTABSIZE; ! ! if (cos_table) return; ! cos_table = (float *)getbytes(sizeof(float) * (COSTABSIZE+1)); ! ! for (i = COSTABSIZE + 1, fp = cos_table, phase = 0; i--; ! fp++, phase += phsinc) ! *fp = cos(phase); ! ! } ! ! static void halfcos_maketable(void) ! { ! int i; ! float *fp, phase, phsinc = (PD_PI) / COSTABSIZE; ! ! if (halfcos_table) return; ! halfcos_table = (float *)getbytes(sizeof(float) * (COSTABSIZE+1)); ! ! for (i = COSTABSIZE + 1, fp = halfcos_table, phase = PD_PI; i--; ! fp++, phase += phsinc) ! *fp = 0.5*(cos(phase) + 1.0); ! } ! ! ! static void exp_maketable(void) ! { ! int i; ! float *fp, phase, phsinc = (2 * PD_PI) / COSTABSIZE; ! ! if (exp_table) return; ! exp_table = (float *)getbytes(sizeof(float) * (COSTABSIZE+1)); ! ! for (i = COSTABSIZE + 1, fp = exp_table, phase = 0; i--; ! fp++, phase += phsinc) ! *fp = exp(-phase); ! } ! ! ! static t_class *fofsynth_class; ! ! typedef struct _grain ! { ! struct _grain *next; ! t_float formph; /* 0 ... 1 */ ! t_float formphinc; ! t_float envph; ! int falling; ! } t_grain; ! ! ! typedef struct _fofsynth ! { ! t_object x_obj; ! ! /* it is possible to use 2 array, prob change this one ! int the future */ ! ! t_symbol* x_arrayname; ! ! /* template */ ! ! int x_npoints; ! t_float *x_vec; ! ! /* fof */ ! int debug; ! ! int maxgrains; ! int numgrains; ! ! float* x_envelope; ! ! /* the queue of grains */ ! ! t_grain* grainbase; ! t_grain* grainstart; ! t_grain* grainend; ! ! ! t_float fundph; /* 0 to 1; if 1 -> add a new grain */ ! ! t_float fundfreq; /* input parameter 1 */ ! t_float formfreq; /* input paramter 2 */ ! t_float risedur; /* input parameter 3 ( in % of total duration )*/ ! t_float falldur; /* input parameter 5 ( in % of total duration */ ! ! /* other */ ! int neednewgrain; ! } t_fofsynth; ! ! ! ! ! /* build a cyclic list */ ! static t_grain* grain_makecyclic(t_grain* base,int num) ! { ! t_grain* cur = base; ! while (--num) { ! cur->next = cur+1; ! cur++; ! } ! cur->next = base; ! return base; ! } ! ! ! ! ! ! static t_int *fofsynth_perform(t_int *w) ! { ! t_fofsynth* x = (t_fofsynth*) (w[1]); ! t_float *in = (t_float *)(w[2]); ! t_float *out = (t_float *)(w[3]); ! int n = (int)(w[4]); ! ! float totaldur = (x->risedur+ x->falldur)*0.01/ *in; ! ! float srate = 44100.0; /*((t_signal*)w[2])->s_sr;*/ ! float israte = 1.0/srate; ! ! float fundphase = x->fundph; ! float numperiods = totaldur*x->formfreq; ! float formphinc = (x->formfreq/srate); ! ! float risinc; ! float fallinc; ! ! t_grain* cur; ! ! risinc = (x->risedur == 0) ? 1.0 : 1.0/ (srate*totaldur*0.01*x->risedur); ! fallinc = (x->falldur == 0.0) ? 1.0 :1.0/ (srate*totaldur*0.01*x->falldur); ! ! DEBUG(" fundph %3.2f",x->fundph); ! DEBUG(" fundfreq %3.2f",x->fundfreq); ! DEBUG(" formfreq %3.2f",x->formfreq); ! DEBUG(" risedur %3.2f %",x->risedur); ! DEBUG(" falldur %3.2f %",x->falldur); ! DEBUG(" totaldur %3.2f s",totaldur); ! DEBUG(" risinc %0.6f",risinc); ! DEBUG(" fallinc %0.6f",fallinc); ! DEBUG(" formant increase %3.2f",formphinc); ! DEBUG(" numgrains %d",x->numgrains); ! ! while (n--) ! { ! fundphase+=*++in*israte; ! *out = 0.0; ! ! if (x->neednewgrain) { /* new grain, they are deleted separetely */ ! t_grain* newgrain = x->grainend; ! /* DEBUG("new grain created",0); */ ! if (newgrain->next == x->grainstart) { ! post("fof: grain overflow"); ! x->neednewgrain = 0; ! } ! else { ! x->numgrains++; ! x->grainend = newgrain->next; ! newgrain->formphinc = formphinc; ! newgrain->falling = 0; ! newgrain->formph = newgrain->envph = 0.0; ! x->neednewgrain = 0; ! } ! } ! ! cur = x->grainstart; ! while (cur != x->grainend) { ! float formphase = cur->formph; ! float envelope; ! ! float tph = (formphase - (float)((int) formphase)); ! float val = *(x->x_vec + (int) (tph * x->x_npoints)); ! ! /* Apply the envelope */ ! ! if (!cur->falling && (cur->envph <= 1.0)) { ! envelope = *(halfcos_table + (int) (cur->envph * COSTABSIZE)); ! cur->envph+=risinc; ! val *= envelope; ! } ! else if (!cur->falling) ! { ! cur->falling = 1; ! cur->envph = 0; ! } ! ! ! if (cur->falling) { ! envelope = *(exp_table + (int) (cur->envph * COSTABSIZE)); ! cur->envph+=fallinc; ! val *= envelope; ! } ! ! /* end of envelope code */ ! ! ! formphase+=cur->formphinc; ! cur->formph = formphase; ! ! if (formphase >= numperiods) { /* dead */ ! DEBUG("grain died",0); ! x->grainstart = cur->next; ! x->numgrains--;/* not needed */ ! } ! ! cur = cur->next; ! *out += val; ! } ! ! ! if (fundphase > 1.0) { ! fundphase -= 1.0; ! x->neednewgrain=1; ! } ! out++; ! } ! ! x->fundph=fundphase; ! x->debug = 0; ! ! ! return (w+5); ! } ! ! void fofsynth_usearray(t_symbol* s,int* points,t_float** vec) ! { ! t_garray *a; ! if (!(a = (t_garray *)pd_findbyclass(s, garray_class))) ! error("%s: no such array", s->s_name); ! else if (!garray_getfloatarray(a,points,vec)) ! error("%s: bad template for fof~", s->s_name); ! else ! garray_usedindsp(a); ! } ! ! static void fofsynth_dsp(t_fofsynth *x, t_signal **sp) ! { ! ! if (x->x_arrayname) ! fofsynth_usearray(x->x_arrayname,&x->x_npoints, &x->x_vec); ! else { ! x->x_npoints=COSTABSIZE; ! x->x_vec = cos_table; ! } ! ! dsp_add(fofsynth_perform, 4, x, ! sp[0]->s_vec,sp[1]->s_vec, sp[0]->s_n); ! } ! ! ! static void fofsynth_free(t_fofsynth *x) ! { ! freebytes(x->grainbase,sizeof(t_grain)*x->maxgrains); ! } ! ! ! static void fofsynth_debug(t_fofsynth* x) ! { ! x->debug = 1; ! } ! ! ! static void fofsynth_float(t_fofsynth* x,t_float f) ! { ! x->fundfreq = f > 0.0 ? f : -f; ! } ! ! ! static void *fofsynth_new(t_symbol* s,t_float a,t_float b,t_float c,t_float d) ! { ! int maxgrains = MAXGRAINS; ! t_fofsynth *x = (t_fofsynth *)pd_new(fofsynth_class); ! ! x->debug = 0; ! x->x_arrayname = s; ! ! if (s == &s_) ! x->x_arrayname = NULL; ! ! /* setup the grain queue */ ! ! x->grainbase = getbytes(sizeof(t_grain)*maxgrains); ! x->maxgrains = maxgrains; ! grain_makecyclic(x->grainbase,maxgrains); ! x->grainstart = x->grainbase; ! x->grainend = x->grainbase; ! x->numgrains = 0; ! ! /* some of them could be signals too */ ! ! floatinlet_new(&x->x_obj, &x->formfreq); ! floatinlet_new(&x->x_obj, &x->risedur); ! floatinlet_new(&x->x_obj, &x->falldur); ! ! x->fundph = 0.0; ! x->fundfreq = 200.0; ! x->formfreq = 600.0; ! x->risedur = 5.0; ! x->falldur = 140.0; ! ! if (a) x->fundfreq = a; ! if (b) x->formfreq = b; ! if (c) x->risedur = c; ! if (d) x->falldur = d; ! ! outlet_new(&x->x_obj, &s_signal); ! return (x); ! } ! ! void fofsynth_tilde_setup(void) ! { ! cos_table = NULL; ! halfcos_table = NULL; ! fofsynth_class = class_new(gensym("fof~"), (t_newmethod) fofsynth_new,(t_method) fofsynth_free, ! sizeof(t_fofsynth), 0,A_DEFSYM, A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addcreator((t_newmethod)fofsynth_new,gensym("fofsynth~"),A_DEFSYM, A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addmethod(fofsynth_class, nullfn, gensym("signal"), 0); ! class_addmethod(fofsynth_class, (t_method) fofsynth_dsp, gensym("dsp"), 0); ! class_addfloat(fofsynth_class, (t_method) fofsynth_float); ! class_addmethod(fofsynth_class,(t_method) fofsynth_debug, gensym("debug"),0); ! cos_maketable(); ! halfcos_maketable(); ! exp_maketable(); ! } --- 1,354 ---- ! /* (C) Guenter Geiger <geiger(a)epy.co.at> */ ! ! ! #include <m_pd.h> ! #include <math.h> ! #ifdef _MSC_VER ! #pragma warning( disable : 4244 ) ! #pragma warning( disable : 4305 ) ! #endif ! ! /* ------------------------ fofsynth~ ----------------------------- */ ! ! #ifndef NT ! void garray_usedindsp(t_garray *x); ! #endif ! ! #define DEBUG(a,b) if (x->debug) post(a,b); ! ! #define MAXGRAINS 1000 ! #define PD_PI 3.14159 ! ! static float* cos_table; ! static float* halfcos_table; ! static float* exp_table; ! ! static void cos_maketable(void) ! { ! int i; ! float *fp, phase, phsinc = (2. * PD_PI) / COSTABSIZE; ! ! if (cos_table) return; ! cos_table = (float *)getbytes(sizeof(float) * (COSTABSIZE+1)); ! ! for (i = COSTABSIZE + 1, fp = cos_table, phase = 0; i--; ! fp++, phase += phsinc) ! *fp = cos(phase); ! ! } ! ! static void halfcos_maketable(void) ! { ! int i; ! float *fp, phase, phsinc = (PD_PI) / COSTABSIZE; ! ! if (halfcos_table) return; ! halfcos_table = (float *)getbytes(sizeof(float) * (COSTABSIZE+1)); ! ! for (i = COSTABSIZE + 1, fp = halfcos_table, phase = PD_PI; i--; ! fp++, phase += phsinc) ! *fp = 0.5*(cos(phase) + 1.0); ! } ! ! ! static void exp_maketable(void) ! { ! int i; ! float *fp, phase, phsinc = (2 * PD_PI) / COSTABSIZE; ! ! if (exp_table) return; ! exp_table = (float *)getbytes(sizeof(float) * (COSTABSIZE+1)); ! ! for (i = COSTABSIZE + 1, fp = exp_table, phase = 0; i--; ! fp++, phase += phsinc) ! *fp = exp(-phase); ! } ! ! ! static t_class *fofsynth_class; ! ! typedef struct _grain ! { ! struct _grain *next; ! t_float formph; /* 0 ... 1 */ ! t_float formphinc; ! t_float envph; ! int falling; ! } t_grain; ! ! ! typedef struct _fofsynth ! { ! t_object x_obj; ! ! /* it is possible to use 2 array, prob change this one ! int the future */ ! ! t_symbol* x_arrayname; ! ! /* template */ ! ! int x_npoints; ! t_float *x_vec; ! ! /* fof */ ! int debug; ! ! int maxgrains; ! int numgrains; ! ! float* x_envelope; ! ! /* the queue of grains */ ! ! t_grain* grainbase; ! t_grain* grainstart; ! t_grain* grainend; ! ! ! t_float fundph; /* 0 to 1; if 1 -> add a new grain */ ! ! t_float fundfreq; /* input parameter 1 */ ! t_float formfreq; /* input paramter 2 */ ! t_float risedur; /* input parameter 3 ( in % of total duration )*/ ! t_float falldur; /* input parameter 5 ( in % of total duration */ ! ! /* other */ ! int neednewgrain; ! } t_fofsynth; ! ! ! ! ! /* build a cyclic list */ ! static t_grain* grain_makecyclic(t_grain* base,int num) ! { ! t_grain* cur = base; ! while (--num) { ! cur->next = cur+1; ! cur++; ! } ! cur->next = base; ! return base; ! } ! ! ! ! ! ! static t_int *fofsynth_perform(t_int *w) ! { ! t_fofsynth* x = (t_fofsynth*) (w[1]); ! t_float *in = (t_float *)(w[2]); ! t_float *out = (t_float *)(w[3]); ! int n = (int)(w[4]); ! ! float totaldur = (x->risedur+ x->falldur)*0.01/ *in; ! ! float srate = 44100.0; /*((t_signal*)w[2])->s_sr;*/ ! float israte = 1.0/srate; ! ! float fundphase = x->fundph; ! float numperiods = totaldur*x->formfreq; ! float formphinc = (x->formfreq/srate); ! ! float risinc; ! float fallinc; ! ! t_grain* cur; ! ! risinc = (x->risedur == 0) ? 1.0 : 1.0/ (srate*totaldur*0.01*x->risedur); ! fallinc = (x->falldur == 0.0) ? 1.0 :1.0/ (srate*totaldur*0.01*x->falldur); ! ! DEBUG(" fundph %3.2f",x->fundph); ! DEBUG(" fundfreq %3.2f",x->fundfreq); ! DEBUG(" formfreq %3.2f",x->formfreq); ! DEBUG(" risedur %3.2f %",x->risedur); ! DEBUG(" falldur %3.2f %",x->falldur); ! DEBUG(" totaldur %3.2f s",totaldur); ! DEBUG(" risinc %0.6f",risinc); ! DEBUG(" fallinc %0.6f",fallinc); ! DEBUG(" formant increase %3.2f",formphinc); ! DEBUG(" numgrains %d",x->numgrains); ! ! while (n--) ! { ! fundphase+=*++in*israte; ! *out = 0.0; ! ! if (x->neednewgrain) { /* new grain, they are deleted separetely */ ! t_grain* newgrain = x->grainend; ! /* DEBUG("new grain created",0); */ ! if (newgrain->next == x->grainstart) { ! post("fof: grain overflow"); ! x->neednewgrain = 0; ! } ! else { ! x->numgrains++; ! x->grainend = newgrain->next; ! newgrain->formphinc = formphinc; ! newgrain->falling = 0; ! newgrain->formph = newgrain->envph = 0.0; ! x->neednewgrain = 0; ! } ! } ! ! cur = x->grainstart; ! while (cur != x->grainend) { ! float formphase = cur->formph; ! float envelope; ! ! float tph = (formphase - (float)((int) formphase)); ! float val = *(x->x_vec + (int) (tph * x->x_npoints)); ! ! /* Apply the envelope */ ! ! if (!cur->falling && (cur->envph <= 1.0)) { ! envelope = *(halfcos_table + (int) (cur->envph * COSTABSIZE)); ! cur->envph+=risinc; ! val *= envelope; ! } ! else if (!cur->falling) ! { ! cur->falling = 1; ! cur->envph = 0; ! } ! ! ! if (cur->falling) { ! envelope = *(exp_table + (int) (cur->envph * COSTABSIZE)); ! cur->envph+=fallinc; ! val *= envelope; ! } ! ! /* end of envelope code */ ! ! ! formphase+=cur->formphinc; ! cur->formph = formphase; ! ! if (formphase >= numperiods) { /* dead */ ! DEBUG("grain died",0); ! x->grainstart = cur->next; ! x->numgrains--;/* not needed */ ! } ! ! cur = cur->next; ! *out += val; ! } ! ! ! if (fundphase > 1.0) { ! fundphase -= 1.0; ! x->neednewgrain=1; ! } ! out++; ! } ! ! x->fundph=fundphase; ! x->debug = 0; ! ! ! return (w+5); ! } ! ! void fofsynth_usearray(t_symbol* s,int* points,t_float** vec) ! { ! t_garray *a; ! if (!(a = (t_garray *)pd_findbyclass(s, garray_class))) ! error("%s: no such array", s->s_name); ! else if (!garray_getfloatarray(a,points,vec)) ! error("%s: bad template for fof~", s->s_name); ! else ! garray_usedindsp(a); ! } ! ! static void fofsynth_dsp(t_fofsynth *x, t_signal **sp) ! { ! ! if (x->x_arrayname) ! fofsynth_usearray(x->x_arrayname,&x->x_npoints, &x->x_vec); ! else { ! x->x_npoints=COSTABSIZE; ! x->x_vec = cos_table; ! } ! ! dsp_add(fofsynth_perform, 4, x, ! sp[0]->s_vec,sp[1]->s_vec, sp[0]->s_n); ! } ! ! ! static void fofsynth_free(t_fofsynth *x) ! { ! freebytes(x->grainbase,sizeof(t_grain)*x->maxgrains); ! } ! ! ! static void fofsynth_debug(t_fofsynth* x) ! { ! x->debug = 1; ! } ! ! ! static void fofsynth_float(t_fofsynth* x,t_float f) ! { ! x->fundfreq = f > 0.0 ? f : -f; ! } ! ! ! static void *fofsynth_new(t_symbol* s,t_float a,t_float b,t_float c,t_float d) ! { ! int maxgrains = MAXGRAINS; ! t_fofsynth *x = (t_fofsynth *)pd_new(fofsynth_class); ! ! x->debug = 0; ! x->x_arrayname = s; ! ! if (s == &s_) ! x->x_arrayname = NULL; ! ! /* setup the grain queue */ ! ! x->grainbase = getbytes(sizeof(t_grain)*maxgrains); ! x->maxgrains = maxgrains; ! grain_makecyclic(x->grainbase,maxgrains); ! x->grainstart = x->grainbase; ! x->grainend = x->grainbase; ! x->numgrains = 0; ! ! /* some of them could be signals too */ ! ! floatinlet_new(&x->x_obj, &x->formfreq); ! floatinlet_new(&x->x_obj, &x->risedur); ! floatinlet_new(&x->x_obj, &x->falldur); ! ! x->fundph = 0.0; ! x->fundfreq = 200.0; ! x->formfreq = 600.0; ! x->risedur = 5.0; ! x->falldur = 140.0; ! ! if (a) x->fundfreq = a; ! if (b) x->formfreq = b; ! if (c) x->risedur = c; ! if (d) x->falldur = d; ! ! outlet_new(&x->x_obj, &s_signal); ! return (x); ! } ! ! void fofsynth_tilde_setup(void) ! { ! cos_table = NULL; ! halfcos_table = NULL; ! fofsynth_class = class_new(gensym("fof~"), (t_newmethod) fofsynth_new,(t_method) fofsynth_free, ! sizeof(t_fofsynth), 0,A_DEFSYM, A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addcreator((t_newmethod)fofsynth_new,gensym("fofsynth~"),A_DEFSYM, A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); ! class_addmethod(fofsynth_class, nullfn, gensym("signal"), 0); ! class_addmethod(fofsynth_class, (t_method) fofsynth_dsp, gensym("dsp"), 0); ! class_addfloat(fofsynth_class, (t_method) fofsynth_float); ! class_addmethod(fofsynth_class,(t_method) fofsynth_debug, gensym("debug"),0); ! cos_maketable(); ! halfcos_maketable(); ! exp_maketable(); ! }
[View Less]
1
0
0
0
← Newer
1
...
34
35
36
37
38
39
40
...
50
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Results per page:
10
25
50
100
200