Revision: 10494 http://pure-data.svn.sourceforge.net/pure-data/?rev=10494&view=rev Author: aschix Date: 2009-01-09 17:23:55 +0000 (Fri, 09 Jan 2009)
Log Message: -----------
Added Paths: ----------- trunk/externals/algocomp/ trunk/externals/algocomp/.cdtproject trunk/externals/algocomp/.cproject trunk/externals/algocomp/.project trunk/externals/algocomp/Makefile trunk/externals/algocomp/Makefile.advanced trunk/externals/algocomp/Makefile.bak trunk/externals/algocomp/algocomp-help-patches/ trunk/externals/algocomp/algocomp-help-patches/delnote.pd trunk/externals/algocomp/algocomp-help-patches/dnote.pd trunk/externals/algocomp/algocomp-help-patches/help-algocomp.pd trunk/externals/algocomp/algocomp-help-patches/help-chaosgame.pd trunk/externals/algocomp/algocomp-help-patches/help-eca.pd trunk/externals/algocomp/algocomp-help-patches/help-genetic.pd trunk/externals/algocomp/algocomp-help-patches/help-henon.pd trunk/externals/algocomp/algocomp-help-patches/help-ifs.pd trunk/externals/algocomp/algocomp-help-patches/help-ifsmusic.pd trunk/externals/algocomp/algocomp-help-patches/help-logistic.pd trunk/externals/algocomp/algocomp-help-patches/help-lorenz.pd trunk/externals/algocomp/algocomp-help-patches/help-map.pd trunk/externals/algocomp/algocomp-help-patches/help-oneoverf.pd trunk/externals/algocomp/algocomp-help-patches/help-selfsimilar.pd trunk/externals/algocomp/algocomp.c trunk/externals/algocomp/chaotic.c trunk/externals/algocomp/distribute.c trunk/externals/algocomp/elementaryca.c trunk/externals/algocomp/fractal.c trunk/externals/algocomp/gauss_tilde.c trunk/externals/algocomp/genetic.c trunk/externals/algocomp/helpers.c trunk/externals/algocomp/ifs.c trunk/externals/algocomp/ifs.c.old trunk/externals/algocomp/ifsmusic.c trunk/externals/algocomp/logistictilde.c trunk/externals/algocomp/m_pd.h trunk/externals/algocomp/neural.c trunk/externals/algocomp/selfsimilar.c trunk/externals/algocomp/stochastic.c trunk/externals/algocomp/utils.c
Added: trunk/externals/algocomp/.cdtproject =================================================================== --- trunk/externals/algocomp/.cdtproject (rev 0) +++ trunk/externals/algocomp/.cdtproject 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse-cdt version="2.0"?> + +<cdtproject id="org.eclipse.cdt.make.core.make"> +<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> +<extension id="org.eclipse.cdt.core.domsourceindexer" point="org.eclipse.cdt.core.CIndexer"/> +<data> +<item id="scannerConfiguration"> +<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="false" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="false"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="false" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="false"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> +<buildOutputProvider> +<openAction enabled="false" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="makefileGenerator"> +<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> +<parser enabled="false"/> +</scannerInfoProvider> +</profile> +</item> +<item id="org.eclipse.cdt.core.pathentry"> +<pathentry kind="src" path=""/> +<pathentry kind="out" path=""/> +<pathentry kind="con" path="org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"/> +</item> +</data> +</cdtproject>
Property changes on: trunk/externals/algocomp/.cdtproject ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/.cproject =================================================================== --- trunk/externals/algocomp/.cproject (rev 0) +++ trunk/externals/algocomp/.cproject 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?fileVersion 4.0.0?> + +<cproject> +<storageModule moduleId="org.eclipse.cdt.core.settings"> +<cconfiguration id="converted.config.111355161"> +<storageModule moduleId="scannerConfiguration"> +<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="true" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="true"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="false" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="false"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> +<buildOutputProvider> +<openAction enabled="false" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="specsFile"> +<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> +<parser enabled="false"/> +</scannerInfoProvider> +</profile> +<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> +<buildOutputProvider> +<openAction enabled="false" filePath=""/> +<parser enabled="true"/> +</buildOutputProvider> +<scannerInfoProvider id="makefileGenerator"> +<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> +<parser enabled="false"/> +</scannerInfoProvider> +</profile> +</storageModule> +<storageModule moduleId="org.eclipse.cdt.core.pathentry"> +<pathentry kind="src" path=""/> +<pathentry kind="out" path=""/> +<pathentry kind="con" path="org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"/> +</storageModule> +<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="converted.config.111355161" moduleId="org.eclipse.cdt.core.settings" name="convertedConfig"> +<externalSettings/> +<extensions> +<extension id="org.eclipse.cdt.core.domsourceindexer" point="org.eclipse.cdt.core.CIndexer"/> +<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> +</extensions> +</storageModule> +</cconfiguration> +</storageModule> +</cproject>
Added: trunk/externals/algocomp/.project =================================================================== --- trunk/externals/algocomp/.project (rev 0) +++ trunk/externals/algocomp/.project 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>algocomp</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.cdt.make.core.makeBuilder</name> + <triggers>clean,full,incremental,</triggers> + <arguments> + <dictionary> + <key>org.eclipse.cdt.make.core.build.arguments</key> + <value></value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.core.errorOutputParser</key> + <value>org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.VCErrorParser;</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.enableAutoBuild</key> + <value>false</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.environment</key> + <value></value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.enableFullBuild</key> + <value>true</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.build.target.inc</key> + <value>all</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key> + <value>true</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.build.target.clean</key> + <value>clean</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.build.command</key> + <value>make</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.enableCleanBuild</key> + <value>true</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.append_environment</key> + <value>true</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.build.target.full</key> + <value>clean all</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key> + <value>true</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.build.target.auto</key> + <value>all</value> + </dictionary> + <dictionary> + <key>org.eclipse.cdt.make.core.stopOnError</key> + <value>false</value> + </dictionary> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.cdt.make.core.ScannerConfigBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.cdt.core.cnature</nature> + <nature>org.eclipse.cdt.make.core.makeNature</nature> + <nature>org.eclipse.cdt.make.core.ScannerConfigNature</nature> + </natures> +</projectDescription>
Property changes on: trunk/externals/algocomp/.project ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/Makefile =================================================================== --- trunk/externals/algocomp/Makefile (rev 0) +++ trunk/externals/algocomp/Makefile 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,85 @@ +# set Name and system + +NAME=algocomp +#SYSTEM = nt +SYSTEM = linux +# set paths for windows + +# where is VC++ ??? +VC="C:\Programme\Microsoft Visual C++ Toolkit 2003" +VCLINK="C:\Programme\Microsoft Visual C++ Toolkit 2003\bin\link" +# where is pd +#PDPATH="E:\Program Files\pd-0.38-3" +PDPATH=C:\Programme\pd-0.38-3 +LIBPATH="$(PDPATH)/bin" + +install: install_$(SYSTEM) + +all: $(SYSTEM) +#all: pd_linux install_linux + +# ----------------------- LINUX i386 ----------------------- + +linux: $(NAME).pd_linux + +.SUFFIXES: .pd_linux + +LINUXCFLAGS = -DPD -DUNIX -O2 -funroll-loops -fomit-frame-pointer \ + -Wall -W -Wshadow -Wstrict-prototypes -Werror \ + -Wno-unused -Wno-parentheses -Wno-switch + +# where is your m_pd.h ??? +LINUXINCLUDE = -I../../src + +.c.pd_linux: + cc -O2 -Wall -DPD -fPIC $(LINUXCFLAGS) $(LINUXINCLUDE) -c $*.c + ld -export_dynamic -shared -o $*.pd_linux $*.o -lc + strip --strip-unneeded $*.pd_linux + +install_linux: + sudo cp *.pd_linux /usr/lib/pd/extra/ + cp *.pd_linux ../../download + +# ----------------------- NT ----------------------- + +nt: $(NAME).dll + +.SUFFIXES: .dll + +PDNTCFLAGS = /W3 /WX /O2 /G6 /DNT /DPD /nologo +PDNTINCLUDE = /I. /I$(PDPATH)\tcl\include /I$(PDPATH)\src /I$(VC)\include /Iinclude +PDNTLDIR = "C:\Programme\Microsoft Visual C++ Toolkit 2003\Lib" + +PDNTLIB = "C:\Programme\Microsoft Visual C++ Toolkit 2003\Lib\libc.lib" \ + "C:\Programme\Microsoft Visual C++ Toolkit 2003\Lib\oldnames.lib" \ + "C:\Programme\Microsoft Visual C++ Toolkit 2003\Lib\kernel32.lib" \ + "$(PDPATH)\bin\pd.lib" + + +.c.dll: algocomp.c chaotic.c ifs.c selfsimilar.c chaossignals.c pan.c + cl /W3 /WX /O2 /G6 /DNT /DPD /nologo /I. /I"C:\Programme\flextbuild\pd\tcl\include" /I"C:\Programme\flextbuild\pd\src" /I"C:\Programme\Microsoft Visual C++ Toolkit 2003\include" /Iinclude /c $(NAME).c + link /dll /export:$(NAME)_setup $*.obj $(PDNTLIB) + +#.c.dll: +# cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c +# link /dll /export:$(CSYM)_setup $*.obj $(PDNTLIB) + +install_nt: + cp $(NAME).dll $(PDPATH)\externs +# -------------------------- XP -------------------------- + +# $(CXX) $(LDFLAGS) -shared $(patsubst %,-L%,$(LIBPATH)) $^ $(patsubst %,-l%,$(LIBS)) -o $@ + +pd_xp: + gcc -O2 -Wall -DPD -L$(LIBPATH) -c $(NAME).c + ld -export_dynamic -shared -o $(NAME).dll -lc + + +install_xp: +# copy $(NAME).dll $(PDPATH)/externs + cp $(NAME).dll $(PDPATH)/externs + +clean: + rm -f *.o *.dll *.exp *.obj *.lib + rm -f *.o *.pd_* *.dll so_locations +
Property changes on: trunk/externals/algocomp/Makefile ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/Makefile.advanced =================================================================== --- trunk/externals/algocomp/Makefile.advanced (rev 0) +++ trunk/externals/algocomp/Makefile.advanced 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,104 @@ +NAME=patcher~ +CSYM=patcher_tilde + +current: pd_nt pd_linux pd_darwin + +# ----------------------- NT ----------------------- + +pd_nt: $(NAME).dll + +.SUFFIXES: .dll + +PDNTCFLAGS = /W3 /WX /O2 /G6 /DNT /DPD /nologo + +# where is VC++ ??? +VC="C:\Programme\Microsoft Visual Studio\VC98" + +# where is your m_pd.h ??? +PDNTINCLUDE = /I. /Ic:\pd\tcl\include /Ic:\pd\src /I$(VC)\include /Iinclude + +PDNTLDIR = $(VC)\Lib +PDNTLIB = $(PDNTLDIR)\libc.lib \ + $(PDNTLDIR)\oldnames.lib \ + $(PDNTLDIR)\kernel32.lib \ + $(PDNTLDIR)\user32.lib \ + $(PDNTLDIR)\uuid.lib \ + c:\pd\bin\pd.lib + +.c.dll: + cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c + link /dll /export:$(CSYM)_setup $*.obj $(PDNTLIB) + +# ----------------------- IRIX 5.x ----------------------- + +pd_irix5: $(NAME).pd_irix5 + +.SUFFIXES: .pd_irix5 + +SGICFLAGS5 = -o32 -DPD -DUNIX -DIRIX -O2 + +SGIINCLUDE = -I../../src + +.c.pd_irix5: + cc $(SGICFLAGS5) $(SGIINCLUDE) -o $*.o -c $*.c + ld -elf -shared -rdata_shared -o $*.pd_irix5 $*.o + rm $*.o + +# ----------------------- IRIX 6.x ----------------------- + +pd_irix6: $(NAME).pd_irix6 + +.SUFFIXES: .pd_irix6 + +SGICFLAGS6 = -n32 -DPD -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \ + -OPT:roundoff=3 -OPT:IEEE_arithmetic=3 -OPT:cray_ivdep=true \ + -Ofast=ip32 + +.c.pd_irix6: + cc $(SGICFLAGS6) $(SGIINCLUDE) -o $*.o -c $*.c + ld -n32 -IPA -shared -rdata_shared -o $*.pd_irix6 $*.o + rm $*.o + +# ----------------------- MAX OS X ----------------------- + +pd_darwin: $(NAME).pd_darwin + +.SUFFIXES: .pd_darwin + +DARWINCFLAGS = -DPD -DUNIX -O2 -DMACOSX \ + -Wall -W -Wshadow -Wstrict-prototypes \ + -Wno-unused -Wno-parentheses -Wno-switch + +DARWININCLUDE = -I../../src + +.c.pd_darwin: + cc $(DARWINCFLAGS) $(DARWININCLUDE) -o $*.o -c $*.c + cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o + rm -f $*.o ../$*.pd_darwin + ln -s $*/$*.pd_darwin .. + +# ----------------------- LINUX i386 ----------------------- + +pd_linux: $(NAME).pd_linux + +.SUFFIXES: .pd_linux + +LINUXCFLAGS = -DPD -DUNIX -O2 -funroll-loops -fomit-frame-pointer \ + -Wall -W -Wshadow -Wstrict-prototypes -Werror \ + -Wno-unused -Wno-parentheses -Wno-switch + +# where is your m_pd.h ??? +LINUXINCLUDE = -I../../src + +.c.pd_linux: + cc -O2 -Wall -DPD -fPIC $(LINUXCFLAGS) $(LINUXINCLUDE) -c $*.c + ld -export_dynamic -shared -o $*.pd_linux $*.o -lc + strip --strip-unneeded $*.pd_linux + +# ---------------------------------------------------------- + +install: + cp help-*.pd ../../doc/5.reference + +clean: + rm -f *.o *.pd_* so_locations \ No newline at end of file
Property changes on: trunk/externals/algocomp/Makefile.advanced ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/Makefile.bak =================================================================== --- trunk/externals/algocomp/Makefile.bak (rev 0) +++ trunk/externals/algocomp/Makefile.bak 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,9 @@ +all: test + +test: test.o + gcc test.c -o test.o + +clean: + rm test.o + +
Property changes on: trunk/externals/algocomp/Makefile.bak ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/algocomp-help-patches/delnote.pd =================================================================== --- trunk/externals/algocomp/algocomp-help-patches/delnote.pd (rev 0) +++ trunk/externals/algocomp/algocomp-help-patches/delnote.pd 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,42 @@ +#N canvas 88 99 482 332 12; +#X obj 25 70 del; +#X obj 29 157 unpack 0 0; +#X floatatom 111 186 5 0 0 0 - - -; +#X floatatom 161 187 5 0 0 0 - - -; +#X obj 29 130 pack 0 0; +#X obj 29 106 f; +#X obj 76 14 inlet; +#X obj 126 15 inlet; +#X obj 31 207 f; +#X obj 61 207 t b f; +#X obj 31 237 makenote 60 100 100; +#X obj 25 14 inlet; +#X obj 193 215 outlet; +#X obj 25 40 t b f; +#X obj 29 267 noteout; +#X obj 255 212 s note; +#X obj 252 182 pack 0 0 0 0 0 0 0 0; +#X floatatom 312 154 5 0 0 0 - - -; +#X connect 0 0 5 0; +#X connect 1 0 2 0; +#X connect 1 0 8 1; +#X connect 1 0 16 1; +#X connect 1 1 3 0; +#X connect 1 1 9 0; +#X connect 4 0 1 0; +#X connect 5 0 4 0; +#X connect 6 0 5 1; +#X connect 7 0 4 1; +#X connect 8 0 10 0; +#X connect 8 0 16 0; +#X connect 9 0 8 0; +#X connect 9 1 10 2; +#X connect 9 1 12 0; +#X connect 9 1 16 2; +#X connect 10 0 14 0; +#X connect 10 1 14 1; +#X connect 11 0 13 0; +#X connect 13 0 0 0; +#X connect 13 1 0 1; +#X connect 16 0 15 0; +#X connect 17 0 16 3;
Property changes on: trunk/externals/algocomp/algocomp-help-patches/delnote.pd ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/algocomp-help-patches/dnote.pd =================================================================== --- trunk/externals/algocomp/algocomp-help-patches/dnote.pd (rev 0) +++ trunk/externals/algocomp/algocomp-help-patches/dnote.pd 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,42 @@ +#N canvas 88 99 482 332 12; +#X obj 25 70 del; +#X obj 29 157 unpack 0 0; +#X floatatom 111 186 5 0 0 0 - - -; +#X floatatom 161 187 5 0 0 0 - - -; +#X obj 29 130 pack 0 0; +#X obj 29 106 f; +#X obj 76 14 inlet; +#X obj 126 15 inlet; +#X obj 31 207 f; +#X obj 61 207 t b f; +#X obj 31 237 makenote 60 100 100; +#X obj 25 14 inlet; +#X obj 100 269 outlet; +#X obj 25 40 t b f; +#X obj 29 267 noteout; +#X obj 240 270 s note; +#X obj 237 240 pack 0 0 0 0 0 0 0 0; +#X floatatom 297 212 5 0 0 0 - - -; +#X connect 0 0 5 0; +#X connect 1 0 2 0; +#X connect 1 0 8 1; +#X connect 1 0 16 1; +#X connect 1 1 3 0; +#X connect 1 1 9 0; +#X connect 4 0 1 0; +#X connect 5 0 4 0; +#X connect 6 0 5 1; +#X connect 7 0 4 1; +#X connect 8 0 10 0; +#X connect 8 0 16 0; +#X connect 9 0 8 0; +#X connect 9 1 10 2; +#X connect 9 1 12 0; +#X connect 9 1 16 2; +#X connect 10 0 14 0; +#X connect 10 1 14 1; +#X connect 11 0 13 0; +#X connect 13 0 0 0; +#X connect 13 1 0 1; +#X connect 16 0 15 0; +#X connect 17 0 16 3;
Property changes on: trunk/externals/algocomp/algocomp-help-patches/dnote.pd ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/algocomp-help-patches/help-algocomp.pd =================================================================== --- trunk/externals/algocomp/algocomp-help-patches/help-algocomp.pd (rev 0) +++ trunk/externals/algocomp/algocomp-help-patches/help-algocomp.pd 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,16 @@ +#N canvas 493 243 450 300 10; +#X obj 169 33 help-oneoverf; +#X obj 66 132 help-eca; +#X obj 57 58 help-henon; +#X obj 50 81 help-lorenz; +#X text 24 12 chaos functions; +#X obj 36 34 help-logistic; +#X text 165 13 fractal; +#X obj 169 56 help-ifs; +#X text 32 113 elementary CA; +#X obj 272 33 help-selfsimilar; +#X obj 272 56 help-ifsmusic; +#X obj 65 210 help-map; +#X obj 166 134 help-genetic; +#X text 164 113 genetic algorithm; +#X text 23 187 linear mapping;
Property changes on: trunk/externals/algocomp/algocomp-help-patches/help-algocomp.pd ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/algocomp-help-patches/help-chaosgame.pd =================================================================== --- trunk/externals/algocomp/algocomp-help-patches/help-chaosgame.pd (rev 0) +++ trunk/externals/algocomp/algocomp-help-patches/help-chaosgame.pd 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,70 @@ +#N canvas 540 1 452 619 12; +#X obj 33 83 chaosgame; +#X obj 30 17 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 53 13 stop; +#X obj 15 203 gemhead; +#X obj 14 237 translateXYZ; +#X obj 128 340 loadbang; +#X obj 32 467 gemwin; +#X msg 182 423 1; +#X msg 176 448 0; +#X msg 82 403 create; +#X msg 83 430 destroy; +#N canvas 95 194 342 231 Gem.init 0; +#X obj 118 18 loadbang; +#X msg 201 78 reset; +#X obj 118 113 outlet; +#X obj 118 45 t b b; +#X msg 22 77 buffer 1; +#X connect 0 0 3 0; +#X connect 1 0 2 0; +#X connect 3 0 4 0; +#X connect 3 1 1 0; +#X connect 4 0 2 0; +#X restore 24 350 pd Gem.init; +#X obj 128 367 t b b b; +#X obj 39 401 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 16 173 t b f; +#X obj 12 266 colorRGB 1 1 1; +#X obj 14 293 sphere 0.02; +#X floatatom 157 146 5 0 0 0 - - -; +#X floatatom 176 124 5 0 0 0 - - -; +#X obj 174 281 noteout; +#X obj 295 178 noteout; +#X obj 161 214 map -2 2 52 88; +#X obj 290 108 map -2 2 64 100; +#X obj 32 44 metro 100; +#X obj 165 250 makenote 100 150; +#X obj 294 145 makenote 100 250; +#X connect 0 0 14 0; +#X connect 0 0 17 0; +#X connect 0 1 4 2; +#X connect 0 1 18 0; +#X connect 1 0 23 0; +#X connect 2 0 23 0; +#X connect 3 0 4 0; +#X connect 4 0 15 0; +#X connect 5 0 12 0; +#X connect 7 0 6 0; +#X connect 8 0 6 0; +#X connect 9 0 6 0; +#X connect 10 0 6 0; +#X connect 11 0 6 0; +#X connect 12 0 6 0; +#X connect 12 1 7 0; +#X connect 12 2 9 0; +#X connect 13 0 6 0; +#X connect 14 0 3 0; +#X connect 14 1 4 1; +#X connect 15 0 16 0; +#X connect 17 0 21 0; +#X connect 18 0 22 0; +#X connect 21 0 24 0; +#X connect 22 0 25 0; +#X connect 23 0 0 0; +#X connect 24 0 19 0; +#X connect 24 1 19 1; +#X connect 25 0 20 0; +#X connect 25 1 20 1;
Property changes on: trunk/externals/algocomp/algocomp-help-patches/help-chaosgame.pd ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/algocomp-help-patches/help-eca.pd =================================================================== --- trunk/externals/algocomp/algocomp-help-patches/help-eca.pd (rev 0) +++ trunk/externals/algocomp/algocomp-help-patches/help-eca.pd 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,30 @@ +#N canvas 385 55 466 361 12; +#X msg 128 59 randomize; +#X msg 128 36 init; +#X floatatom 129 82 5 0 0 0 - - -; +#X obj 26 276 makenote 100 125; +#X obj 26 304 noteout 10; +#X obj 26 28 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 26 104 eca 110 9 1; +#X obj 26 157 unpack 0 0 0 0 0 0 0 0 0; +#X obj 26 128 map 0 9 34 42; +#X obj 26 48 metro 200; +#X connect 0 0 6 0; +#X connect 1 0 6 0; +#X connect 2 0 6 1; +#X connect 3 0 4 0; +#X connect 3 1 4 1; +#X connect 5 0 9 0; +#X connect 6 0 8 0; +#X connect 7 0 3 0; +#X connect 7 1 3 0; +#X connect 7 2 3 0; +#X connect 7 3 3 0; +#X connect 7 4 3 0; +#X connect 7 5 3 0; +#X connect 7 6 3 0; +#X connect 7 7 3 0; +#X connect 7 8 3 0; +#X connect 8 0 7 0; +#X connect 9 0 6 0;
Property changes on: trunk/externals/algocomp/algocomp-help-patches/help-eca.pd ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/algocomp-help-patches/help-genetic.pd =================================================================== --- trunk/externals/algocomp/algocomp-help-patches/help-genetic.pd (rev 0) +++ trunk/externals/algocomp/algocomp-help-patches/help-genetic.pd 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,146 @@ +#N canvas 0 21 995 664 12; +#X obj 432 142 unpack 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; +#X obj 8 115 map 0 32 52 84; +#X obj 8 408 t b f; +#X msg 8 432 0; +#X obj 834 486 t b f; +#X obj 834 513 del; +#X obj 8 92 genetic 128 80 5; +#X obj 432 118 map 0 64 0 1000; +#X msg 147 23 0 7 4 2 11 12 6 4 12 7 12 11 2 7 12; +#X obj 432 94 genetic 128 96 6; +#X msg 571 24 16 32 16 16 16 16 32 16 32 7 7 7 32 16 16 32; +#X obj 430 171 s d1; +#X obj 454 197 s d2; +#X obj 473 171 s d3; +#X obj 495 197 s d4; +#X obj 515 170 s d5; +#X obj 539 196 s d6; +#X obj 558 170 s d7; +#X obj 580 196 s d8; +#X obj 598 171 s d9; +#X obj 622 197 s d10; +#X obj 641 171 s d11; +#X obj 675 197 s d12; +#X obj 693 171 s d13; +#X obj 745 172 s d15; +#X obj 780 197 s d16; +#X obj 728 197 s d14; +#X obj 834 538 s retrigger; +#X obj 47 433 r d1; +#X obj 95 433 r d2; +#X obj 149 433 r d3; +#X obj 205 433 r d4; +#X obj 255 433 r d5; +#X obj 307 435 r d6; +#X obj 360 435 r d7; +#X obj 411 436 r d8; +#X obj 462 437 r d9; +#X obj 519 439 r d10; +#X obj 579 438 r d11; +#X obj 633 436 r d12; +#X obj 8 138 unpack 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; +#X obj 693 436 r d13; +#X obj 802 437 r d15; +#X obj 748 436 r d14; +#X obj 853 434 r d16; +#X obj 287 460 dnote; +#X obj 295 48 bng 15 250 50 0 empty retrigger empty 0 -6 0 8 -262144 +-1 -1; +#X obj 8 457 dnote; +#X obj 68 458 dnote; +#X obj 126 458 dnote; +#X obj 182 459 dnote; +#X obj 233 459 dnote; +#X obj 338 461 dnote; +#X obj 390 461 dnote; +#X obj 445 461 dnote; +#X obj 499 461 dnote; +#X obj 556 461 dnote; +#X obj 613 461 dnote; +#X obj 671 461 dnote; +#X obj 727 461 dnote; +#X obj 781 461 dnote; +#X obj 833 462 dnote; +#X msg 8 56 randomize; +#X msg 432 63 randomize; +#X connect 0 0 11 0; +#X connect 0 1 12 0; +#X connect 0 2 13 0; +#X connect 0 3 14 0; +#X connect 0 4 15 0; +#X connect 0 5 16 0; +#X connect 0 6 17 0; +#X connect 0 7 18 0; +#X connect 0 8 19 0; +#X connect 0 9 20 0; +#X connect 0 10 21 0; +#X connect 0 11 22 0; +#X connect 0 12 23 0; +#X connect 0 13 26 0; +#X connect 0 14 24 0; +#X connect 0 15 25 0; +#X connect 1 0 40 0; +#X connect 2 0 3 0; +#X connect 2 1 47 1; +#X connect 3 0 47 0; +#X connect 4 0 5 0; +#X connect 4 1 5 1; +#X connect 5 0 27 0; +#X connect 6 0 1 0; +#X connect 7 0 0 0; +#X connect 8 0 6 1; +#X connect 9 0 7 0; +#X connect 10 0 9 1; +#X connect 28 0 47 2; +#X connect 29 0 48 2; +#X connect 30 0 49 2; +#X connect 31 0 50 2; +#X connect 32 0 51 2; +#X connect 33 0 45 2; +#X connect 34 0 52 2; +#X connect 35 0 53 2; +#X connect 36 0 54 2; +#X connect 37 0 55 2; +#X connect 38 0 56 2; +#X connect 39 0 57 2; +#X connect 40 0 2 0; +#X connect 40 1 48 1; +#X connect 40 2 49 1; +#X connect 40 3 50 1; +#X connect 40 4 51 1; +#X connect 40 5 45 1; +#X connect 40 6 52 1; +#X connect 40 7 53 1; +#X connect 40 8 54 1; +#X connect 40 9 55 1; +#X connect 40 10 56 1; +#X connect 40 11 57 1; +#X connect 40 12 58 1; +#X connect 40 13 59 1; +#X connect 40 14 60 1; +#X connect 40 15 61 1; +#X connect 41 0 58 2; +#X connect 42 0 60 2; +#X connect 43 0 59 2; +#X connect 44 0 61 2; +#X connect 45 0 52 0; +#X connect 46 0 9 0; +#X connect 46 0 6 0; +#X connect 47 0 48 0; +#X connect 48 0 49 0; +#X connect 49 0 50 0; +#X connect 50 0 51 0; +#X connect 51 0 45 0; +#X connect 52 0 53 0; +#X connect 53 0 54 0; +#X connect 54 0 55 0; +#X connect 55 0 56 0; +#X connect 56 0 57 0; +#X connect 57 0 58 0; +#X connect 58 0 59 0; +#X connect 59 0 60 0; +#X connect 60 0 61 0; +#X connect 61 0 4 0; +#X connect 62 0 6 0; +#X connect 63 0 9 0;
Property changes on: trunk/externals/algocomp/algocomp-help-patches/help-genetic.pd ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/algocomp-help-patches/help-henon.pd =================================================================== --- trunk/externals/algocomp/algocomp-help-patches/help-henon.pd (rev 0) +++ trunk/externals/algocomp/algocomp-help-patches/help-henon.pd 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,57 @@ +#N canvas 614 4 408 558 12; +#X floatatom 112 45 5 0 0 0 - - -; +#X floatatom 159 44 5 0 0 0 - - -; +#X obj 15 203 gemhead; +#X obj 14 237 translateXYZ; +#X obj 32 467 gemwin; +#X msg 157 432 1; +#X msg 158 459 0; +#X msg 82 403 create; +#X msg 81 430 destroy; +#N canvas 95 194 338 227 Gem.init 0; +#X obj 118 18 loadbang; +#X msg 201 78 reset; +#X obj 118 113 outlet; +#X obj 118 45 t b b; +#X msg 22 77 buffer 1; +#X connect 0 0 3 0; +#X connect 1 0 2 0; +#X connect 3 0 4 0; +#X connect 3 1 1 0; +#X connect 4 0 2 0; +#X restore 25 375 pd Gem.init; +#X obj 63 403 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 74 121 * 2; +#X obj 35 119 * 2; +#X obj 16 173 t b f; +#X floatatom 122 189 5 0 0 0 - - -; +#X floatatom 125 153 5 0 0 0 - - -; +#X obj 12 266 colorRGB 1 1 1; +#X obj 14 293 sphere 0.02; +#X obj 32 44 metro 50; +#X obj 37 79 henon 2 0.3; +#X obj 32 22 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X connect 0 0 19 1; +#X connect 1 0 19 2; +#X connect 2 0 3 0; +#X connect 3 0 16 0; +#X connect 5 0 4 0; +#X connect 6 0 4 0; +#X connect 7 0 4 0; +#X connect 8 0 4 0; +#X connect 9 0 4 0; +#X connect 10 0 4 0; +#X connect 11 0 3 2; +#X connect 11 0 15 0; +#X connect 12 0 13 0; +#X connect 13 0 2 0; +#X connect 13 1 3 1; +#X connect 13 1 14 0; +#X connect 16 0 17 0; +#X connect 18 0 19 0; +#X connect 19 0 12 0; +#X connect 19 1 11 0; +#X connect 20 0 18 0; +#X coords 0 0 0.00123609 0.0020202 200 140 0;
Property changes on: trunk/externals/algocomp/algocomp-help-patches/help-henon.pd ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/algocomp-help-patches/help-ifs.pd =================================================================== --- trunk/externals/algocomp/algocomp-help-patches/help-ifs.pd (rev 0) +++ trunk/externals/algocomp/algocomp-help-patches/help-ifs.pd 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,77 @@ +#N canvas 275 21 646 602 12; +#X obj 31 272 gemhead; +#X obj 31 296 translateXYZ; +#X obj 32 467 gemwin; +#X msg 170 433 1; +#X msg 170 456 0; +#X msg 82 403 create; +#X msg 83 430 destroy; +#N canvas 95 194 342 231 Gem.init 0; +#X obj 118 18 loadbang; +#X msg 201 78 reset; +#X obj 118 113 outlet; +#X obj 118 45 t b b; +#X msg 22 77 buffer 1; +#X connect 0 0 3 0; +#X connect 1 0 2 0; +#X connect 3 0 4 0; +#X connect 3 1 1 0; +#X connect 4 0 2 0; +#X restore 32 376 pd Gem.init; +#X obj 59 403 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 31 249 t b f; +#X obj 31 320 colorRGB 1 1 1; +#X obj 31 344 sphere 0.02; +#X obj 198 267 makenote 64 250; +#X obj 198 293 noteout; +#X obj 345 295 noteout; +#X msg 15 3 0.5 0.5 0 0 1 0.5 0.5 0.5 0 1 0.5 0.5 0.25 0.5 1; +#X msg 50 26 0.5 0.5 0 0 1 1 0.5 0.5 0.5 1 0.5 0.5 0 1 1; +#X msg 74 50 0.5 0.5 0.25 0 1 0.5 0.25 1 0.5 1 1 0.5 0 0.5 1; +#X obj 100 272 * 2; +#X obj 67 222 t b f; +#X obj 31 223 f; +#X obj 31 198 * 2; +#X obj 198 170 ifs; +#X msg 86 74 0.333 0.1 0 0 1 0.667 0.333 0 0.667 1 0.333 0.667 0.667 +0 1; +#X obj 198 215 map 0 2 52 88; +#X obj 345 214 map 0 2 52 88; +#X obj 345 268 makenote 64 100 250; +#X obj 198 147 metro 250; +#X obj 198 127 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X connect 0 0 1 0; +#X connect 1 0 10 0; +#X connect 3 0 2 0; +#X connect 4 0 2 0; +#X connect 5 0 2 0; +#X connect 6 0 2 0; +#X connect 7 0 2 0; +#X connect 8 0 2 0; +#X connect 9 0 0 0; +#X connect 9 1 1 1; +#X connect 10 0 11 0; +#X connect 12 0 13 0; +#X connect 12 1 13 1; +#X connect 15 0 22 0; +#X connect 16 0 22 0; +#X connect 17 0 22 0; +#X connect 18 0 1 2; +#X connect 19 0 20 0; +#X connect 19 1 18 0; +#X connect 20 0 9 0; +#X connect 21 0 20 1; +#X connect 22 0 21 0; +#X connect 22 0 24 0; +#X connect 22 1 19 0; +#X connect 22 1 25 0; +#X connect 23 0 22 0; +#X connect 24 0 12 0; +#X connect 25 0 26 0; +#X connect 26 0 14 0; +#X connect 26 1 14 1; +#X connect 27 0 22 0; +#X connect 28 0 27 0; +#X coords 0 0 0.00123609 0.0020202 200 140 0;
Property changes on: trunk/externals/algocomp/algocomp-help-patches/help-ifs.pd ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/algocomp-help-patches/help-ifsmusic.pd =================================================================== --- trunk/externals/algocomp/algocomp-help-patches/help-ifsmusic.pd (rev 0) +++ trunk/externals/algocomp/algocomp-help-patches/help-ifsmusic.pd 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,13 @@ +#N canvas 0 0 482 332 12; +#X obj 22 109 makenote 64; +#X obj 22 134 noteout; +#X obj 22 5 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1; +#X obj 22 24 metro 250; +#X msg 52 50 1 0 -1 1 -1 0 1 1; +#X obj 22 83 ifsmusic 66 82 54 75 71; +#X connect 0 0 1 0; +#X connect 0 1 1 1; +#X connect 2 0 3 0; +#X connect 3 0 5 0; +#X connect 4 0 5 0; +#X connect 5 0 0 0;
Property changes on: trunk/externals/algocomp/algocomp-help-patches/help-ifsmusic.pd ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/algocomp-help-patches/help-logistic.pd =================================================================== --- trunk/externals/algocomp/algocomp-help-patches/help-logistic.pd (rev 0) +++ trunk/externals/algocomp/algocomp-help-patches/help-logistic.pd 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,32 @@ +#N canvas 136 94 652 298 12; +#X obj 140 84 tabwrite logistic; +#N canvas 0 0 450 300 graph1 0; +#X array logistic 96 float 2; +#X coords 0 1 95 0 200 180 1; +#X restore 315 16 graph; +#X obj 14 132 noteout; +#X floatatom 118 41 5 0 0 0 - - -; +#X obj 235 59 + 1; +#X obj 181 63 float; +#X msg 181 41 0; +#X obj 14 85 map 0 1 52 76; +#X obj 14 40 metro 250; +#X obj 223 41 select 96; +#X obj 14 63 logistic 3.59; +#X obj 15 20 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 14 107 makenote 100 250 500; +#X connect 3 0 10 1; +#X connect 4 0 5 1; +#X connect 4 0 0 1; +#X connect 4 0 9 0; +#X connect 5 0 4 0; +#X connect 6 0 5 0; +#X connect 7 0 12 0; +#X connect 8 0 5 0; +#X connect 8 0 10 0; +#X connect 10 0 0 0; +#X connect 10 0 7 0; +#X connect 11 0 8 0; +#X connect 12 0 2 0; +#X connect 12 1 2 1;
Property changes on: trunk/externals/algocomp/algocomp-help-patches/help-logistic.pd ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/algocomp-help-patches/help-lorenz.pd =================================================================== --- trunk/externals/algocomp/algocomp-help-patches/help-lorenz.pd (rev 0) +++ trunk/externals/algocomp/algocomp-help-patches/help-lorenz.pd 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,64 @@ +#N canvas 529 21 335 453 12; +#X floatatom 68 86 5 0 0 0 - - -; +#X floatatom 120 86 5 0 0 0 - - -; +#X obj 16 198 gemhead; +#X obj 16 223 translateXYZ; +#X obj 23 394 gemwin; +#X msg 154 358 1; +#X msg 156 381 0; +#X msg 73 330 create; +#X msg 74 357 destroy; +#N canvas 95 194 338 227 Gem.init 0; +#X obj 118 18 loadbang; +#X msg 201 78 reset; +#X obj 118 113 outlet; +#X obj 118 45 t b b; +#X msg 22 77 buffer 1; +#X connect 0 0 3 0; +#X connect 1 0 2 0; +#X connect 3 0 4 0; +#X connect 3 1 1 0; +#X connect 4 0 2 0; +#X restore 16 305 pd Gem.init; +#X obj 49 331 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 16 173 t b f; +#X obj 16 248 colorRGB 1 1 1; +#X floatatom 173 87 5 0 0 0 - - -; +#X obj 16 108 lorenz 10 28 2.666; +#X obj 16 148 / 20; +#X obj 84 198 / 20; +#X obj 126 198 / 20; +#X floatatom 25 129 5 0 0 0 - - -; +#X floatatom 102 131 5 0 0 0 - - -; +#X floatatom 175 132 5 0 0 0 - - -; +#X obj 16 273 sphere 0.01; +#X obj 16 65 metro 10; +#X obj 17 43 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X connect 0 0 14 1; +#X connect 1 0 14 2; +#X connect 2 0 3 0; +#X connect 3 0 12 0; +#X connect 5 0 4 0; +#X connect 6 0 4 0; +#X connect 7 0 4 0; +#X connect 8 0 4 0; +#X connect 9 0 4 0; +#X connect 10 0 4 0; +#X connect 11 0 2 0; +#X connect 11 1 3 1; +#X connect 12 0 21 0; +#X connect 13 0 14 3; +#X connect 14 0 15 0; +#X connect 14 0 18 0; +#X connect 14 1 16 0; +#X connect 14 1 19 0; +#X connect 14 2 17 0; +#X connect 14 2 20 0; +#X connect 15 0 11 0; +#X connect 16 0 3 2; +#X connect 17 0 3 3; +#X connect 22 0 14 0; +#X connect 23 0 22 0; +#X coords 0 0 0.00123609 0.0020202 200 140 0;
Property changes on: trunk/externals/algocomp/algocomp-help-patches/help-lorenz.pd ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/algocomp-help-patches/help-map.pd =================================================================== --- trunk/externals/algocomp/algocomp-help-patches/help-map.pd (rev 0) +++ trunk/externals/algocomp/algocomp-help-patches/help-map.pd 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,10 @@ +#N canvas 0 0 450 300 10; +#X obj 21 44 map 0 5 0 100; +#X floatatom 21 23 5 0 0 0 - - -; +#X floatatom 21 67 5 0 0 0 - - -; +#X msg 64 22 3 2 0.2 1.4; +#X text 155 21 rescale to the desired range arguments: float or list +of floats; +#X connect 0 0 2 0; +#X connect 1 0 0 0; +#X connect 3 0 0 0;
Property changes on: trunk/externals/algocomp/algocomp-help-patches/help-map.pd ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/algocomp-help-patches/help-oneoverf.pd =================================================================== --- trunk/externals/algocomp/algocomp-help-patches/help-oneoverf.pd (rev 0) +++ trunk/externals/algocomp/algocomp-help-patches/help-oneoverf.pd 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,31 @@ +#N canvas 41 117 658 266 12; +#X obj 14 35 metro 100; +#X obj 120 91 + 1; +#X obj 156 91 select 100; +#X msg 120 38 0; +#N canvas 0 0 450 300 graph1 0; +#X array oneoverf 100 float 0; +#X coords 0 1 99 0 300 140 1; +#X restore 328 16 graph; +#X obj 30 118 tabwrite oneoverf; +#X obj 14 199 noteout; +#X obj 14 148 map 0 1 0 127; +#X obj 14 63 oneoverf 8; +#X obj 14 15 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 14 173 makenote 100 100 100; +#X obj 120 65 f; +#X connect 0 0 8 0; +#X connect 0 0 11 0; +#X connect 1 0 2 0; +#X connect 1 0 5 1; +#X connect 1 0 11 1; +#X connect 2 0 3 0; +#X connect 3 0 11 0; +#X connect 7 0 10 0; +#X connect 8 0 5 0; +#X connect 8 0 7 0; +#X connect 9 0 0 0; +#X connect 10 0 6 0; +#X connect 10 1 6 1; +#X connect 11 0 1 0;
Property changes on: trunk/externals/algocomp/algocomp-help-patches/help-oneoverf.pd ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/algocomp-help-patches/help-selfsimilar.pd =================================================================== --- trunk/externals/algocomp/algocomp-help-patches/help-selfsimilar.pd (rev 0) +++ trunk/externals/algocomp/algocomp-help-patches/help-selfsimilar.pd 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,28 @@ +#N canvas 51 221 474 392 12; +#X obj 31 10 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X obj 31 114 s n_out; +#X obj 269 113 s n_out; +#X obj 150 112 s n_out; +#X obj 31 238 noteout; +#X obj 31 161 r n_out; +#X obj 31 212 makenote 60 100 250; +#X obj 31 186 unpack; +#X obj 31 61 selfsimilar 3 7 48 52 59 55; +#X obj 31 32 metro 250; +#X obj 31 88 pack 0 125; +#X obj 150 87 pack 0 400; +#X obj 269 87 pack 0 1000; +#X connect 0 0 9 0; +#X connect 5 0 7 0; +#X connect 6 0 4 0; +#X connect 6 1 4 1; +#X connect 7 0 6 0; +#X connect 7 1 6 2; +#X connect 8 0 10 0; +#X connect 8 1 11 0; +#X connect 8 2 12 0; +#X connect 9 0 8 0; +#X connect 10 0 1 0; +#X connect 11 0 3 0; +#X connect 12 0 2 0;
Property changes on: trunk/externals/algocomp/algocomp-help-patches/help-selfsimilar.pd ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/algocomp.c =================================================================== --- trunk/externals/algocomp/algocomp.c (rev 0) +++ trunk/externals/algocomp/algocomp.c 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,132 @@ +/* +* Main library file +*/ + +#include "m_pd.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include "helpers.c" +#include "chaotic.c" +#include "fractal.c" +#include "ifs.c" +#include "ifsmusic.c" +#include "selfsimilar.c" +#include "logistictilde.c" +#include "gauss_tilde.c" +#include "utils.c" +#include "elementaryca.c" +#include "genetic.c" +#include "neural.c" +#include "distribute.c" + + +void algocomp_setup(void) { + logistic_class = class_new(gensym("logistic"), + (t_newmethod)logistic_new, + 0, sizeof(t_logistic), + CLASS_DEFAULT, A_DEFFLOAT,0); + class_addbang(logistic_class, logistic_bang); + henon_class = class_new(gensym("henon"), + (t_newmethod)henon_new, + 0, sizeof(t_henon), + CLASS_DEFAULT, A_DEFFLOAT,A_DEFFLOAT,0); + class_addbang(henon_class, henon_bang); + lorenz_class = class_new(gensym("lorenz"), + (t_newmethod)lorenz_new, + 0, sizeof(t_lorenz), + CLASS_DEFAULT, A_DEFFLOAT, A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); + class_addbang(lorenz_class, lorenz_bang); + chaosgame_class = class_new(gensym("chaosgame"), + (t_newmethod)chaosgame_new, + 0, sizeof(t_chaosgame), + CLASS_DEFAULT, A_DEFFLOAT,0); + class_addbang(chaosgame_class, chaosgame_bang); + selfsimilar_class = class_new(gensym("selfsimilar"), + (t_newmethod)selfsimilar_new, + 0, sizeof(t_selfsimilar), + CLASS_DEFAULT, A_GIMME,0); + class_addbang(selfsimilar_class, selfsimilar_bang); + selfsimilarrhythm_class = class_new(gensym("selfsimilarrhythm"), + (t_newmethod)selfsimilarrhythm_new, + 0, sizeof(t_selfsimilarrhythm), + CLASS_DEFAULT, A_DEFFLOAT,0); + class_addbang(selfsimilarrhythm_class, selfsimilarrhythm_bang); + ifs_class = class_new(gensym("ifs"), + (t_newmethod)ifs_new, + 0, sizeof(t_ifs), + CLASS_DEFAULT, 0); + class_addbang(ifs_class, ifs_bang); + class_addmethod(ifs_class,(t_method)ifs_setFunctions,gensym("list"), A_GIMME,0); + distribute_class = class_new(gensym("distribute"), + (t_newmethod)distribute_new, + 0, sizeof(t_distribute), + CLASS_DEFAULT, A_DEFFLOAT, 0); + class_addmethod(distribute_class,(t_method)distribute_float,gensym("float"), A_FLOAT,0); + + + ifsmusic_class = class_new(gensym("ifsmusic"), + (t_newmethod)ifsmusic_new, + 0, sizeof(t_ifsmusic), + CLASS_DEFAULT, A_GIMME, 0); + class_addbang(ifsmusic_class, ifsmusic_bang); + class_addmethod(ifsmusic_class,(t_method)ifsmusic_setFunctions,gensym("list"), A_GIMME,0); + class_addmethod(ifsmusic_class,(t_method)ifsmusic_setNotes,gensym("notes"), A_GIMME,0); + class_addmethod(ifsmusic_class,(t_method)ifsmusic_outputSerie,gensym("serie"), 0); + eca_class = class_new(gensym("eca"), + (t_newmethod)eca_new, + 0, sizeof(t_eca), + CLASS_DEFAULT,A_DEFFLOAT, A_DEFFLOAT,A_DEFFLOAT,0); + class_addbang(eca_class, eca_bang); + class_addmethod(eca_class,(t_method)eca_randomize,gensym("randomize"), 0); + class_addmethod(eca_class,(t_method)eca_activateMiddleCell,gensym("init"), 0); + genetic_class = class_new(gensym("genetic"), + (t_newmethod)genetic_new, + 0, sizeof(t_genetic), + CLASS_DEFAULT,A_DEFFLOAT, A_DEFFLOAT,A_DEFFLOAT,0); + class_addbang(genetic_class, genetic_bang); + class_addmethod(genetic_class,(t_method)genetic_randomize,gensym("randomize"), 0); + class_addmethod(genetic_class,(t_method)genetic_setTarget,gensym("target"), A_GIMME,0); + //void class_addlist(t_class *c, t_method fn); + mlp_class = class_new(gensym("mlp"), + (t_newmethod)mlp_new, + 0, sizeof(t_mlp), + CLASS_DEFAULT,0); + class_addbang(mlp_class, mlp_bang); + class_addmethod(mlp_class,(t_method)mlp_inputed,gensym("list"), A_GIMME, 0); + class_addmethod(mlp_class,(t_method)mlp_train,gensym("train"), 0); + class_addmethod(mlp_class,(t_method)mlp_setTarget,gensym("target"), A_GIMME,0); + oneoverf_class = class_new(gensym("oneoverf"), + (t_newmethod)oneoverf_new, + 0, sizeof(t_oneoverf), + CLASS_DEFAULT,A_DEFFLOAT, 0); + class_addbang(oneoverf_class, oneoverf_bang); + logistic_tilde_class = class_new(gensym("logistic~"), + (t_newmethod)logistic_tilde_new, + 0, sizeof(t_logistic_tilde), + CLASS_DEFAULT, + A_DEFFLOAT, + 0); + class_addmethod(logistic_tilde_class, + (t_method)logistic_tilde_dsp, gensym("dsp"), 0); + // CLASS_MAINSIGNALIN(logistic_tilde_class, t_logistic_tilde, f); + gauss_tilde_class = class_new(gensym("gauss~"), + (t_newmethod)gauss_tilde_new, 0, + sizeof(t_gauss_tilde), + 0, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addmethod(gauss_tilde_class, (t_method)gauss_tilde_dsp, + gensym("dsp"), 0); + // class_addbang(rand_gauss_class, rand_gauss_bang); + map_class = class_new(gensym("map"), + (t_newmethod)map_new, + 0, sizeof(t_map), + CLASS_DEFAULT, + A_DEFFLOAT, A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); + + class_addfloat(map_class, map_float); + class_addmethod(map_class,(t_method)map_list,gensym("list"), A_GIMME, 0); + + post("AlgoComp library loaded - v_0.20060116"); + +} +
Property changes on: trunk/externals/algocomp/algocomp.c ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/chaotic.c =================================================================== --- trunk/externals/algocomp/chaotic.c (rev 0) +++ trunk/externals/algocomp/chaotic.c 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,108 @@ +/* +* Chaotic function objects +*/ + +#include "m_pd.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +static t_class *logistic_class; +static t_class *henon_class; +static t_class *lorenz_class; + + +typedef struct _logistic { + t_object x_obj; + t_float x; + t_float a; + t_outlet *note_out; +} t_logistic; + +void logistic_bang(t_logistic *x) +{ +if (x->a > 4) x->a = 4; +if (x->a <= 0) x->a = 0.01; +outlet_float(x->note_out, x->x); +x->x = x->a*x->x*(1-x->x); +} + +void *logistic_new(t_floatarg f) +{ + t_logistic *x = (t_logistic *)pd_new(logistic_class); + x->a = f; + x->x = 0.5; + x->note_out = outlet_new(&x->x_obj,&s_float); + floatinlet_new(&x->x_obj, &x->a); + return (void *)x; +} + +typedef struct _henon { + t_object x_obj; + t_float x,y,B,A; + t_outlet *x_out, *y_out; +} t_henon; + +void henon_bang(t_henon *x) +{ +outlet_float(x->x_out, x->x); +outlet_float(x->y_out, x->y); +x->x = x->y+1-x->A*x->x*x->x; +x->y = x->B*x->x; +} + +void *henon_new(t_floatarg f1,t_floatarg f2) +{ + t_henon *x = (t_henon *)pd_new(henon_class); + x->A = f1; + x->B = f2; + x->x = 0; + x->y = 0; + x->x_out = outlet_new(&x->x_obj,&s_float); + x->y_out = outlet_new(&x->x_obj,&s_float); + + floatinlet_new(&x->x_obj, &x->A); + floatinlet_new(&x->x_obj, &x->B); + + return (void *)x; +} + +typedef struct _lorenz { + t_object x_obj; + t_float x,y,z,B,R,S,xdot,ydot,zdot,dt; + t_outlet *x_out, *y_out, *z_out; +} t_lorenz; + +void lorenz_bang(t_lorenz *x) +{ +outlet_float(x->x_out, x->x); +outlet_float(x->y_out, x->y); +outlet_float(x->z_out, x->z); +x->xdot = x->S * (x->y - x->x); +x->ydot = x->R * x->x - x->y - (x->x * x->z); +x->zdot = x->x * x->y - x->B * x->z; +x->x = x->x + x->xdot * x->dt; +x->y = x->y + x->ydot * x->dt; +x->z = x->z + x->zdot * x->dt; + +} + +void *lorenz_new(t_floatarg f1,t_floatarg f2,t_floatarg f3,t_floatarg f4) +{ + t_lorenz *x = (t_lorenz *)pd_new(lorenz_class); + x->S = f1; + x->R = f2; + x->B = f3; + x->x = 0.1; + x->y = 0.1; + x->z = 0.1; + x->dt = 0.01; + if (f4 != 0) x->dt = f4; + x->x_out = outlet_new(&x->x_obj,&s_float); + x->y_out = outlet_new(&x->x_obj,&s_float); + x->z_out = outlet_new(&x->x_obj,&s_float); + floatinlet_new(&x->x_obj, &x->S); + floatinlet_new(&x->x_obj, &x->R); + floatinlet_new(&x->x_obj, &x->B); + return (void *)x; +}
Property changes on: trunk/externals/algocomp/chaotic.c ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/distribute.c =================================================================== --- trunk/externals/algocomp/distribute.c (rev 0) +++ trunk/externals/algocomp/distribute.c 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,35 @@ +#include "m_pd.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +static t_class *distribute_class; + +typedef struct _distribute { + t_object x_obj; + t_int counter; + t_int max; + t_outlet *out[128];//,*r_out,*n_out; +} t_distribute; + +void distribute_float(t_distribute *x,t_float in) +{ +outlet_float(x->out[x->counter],in); +x->counter++; +if (x->counter == x->max) +x->counter = 0; +//x->out[x->counter] = in; +} + +void *distribute_new(t_floatarg f1) +{ + int i; + t_distribute *x = (t_distribute *)pd_new(distribute_class); + x->counter = 0; + if ((f1>0) && (f1<128)) + x->max = (t_int) f1; + else x->max = 8; + for (i=0;i<x->max;i++) + x->out[i] = outlet_new(&x->x_obj,&s_float); + return (void *)x; +}
Property changes on: trunk/externals/algocomp/distribute.c ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/elementaryca.c =================================================================== --- trunk/externals/algocomp/elementaryca.c (rev 0) +++ trunk/externals/algocomp/elementaryca.c 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,132 @@ +#include "m_pd.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +#define TRUE 1 +#define FALSE 0 +#define MAX_ARRAY_SIZE 256 + +//Already defined elsewhere ?? +//typedef short boolean; + +static t_class *eca_class; + + +typedef struct _eca { + t_object x_obj; + t_int counter; + boolean cells[256]; + t_int size; + //t_int offset; + t_outlet *on_cells; + //t_outlet *firstcell; + t_atom oncells[256]; + boolean ruletable[8]; + t_int rule; + t_float inrule; +} t_eca; + +void randomizeCells(t_eca *x) { + int i; + for (i=0;i<x->size;i++) { + x->cells[i] = ((t_float) rand())/RAND_MAX*2; + } +} + +void eca_activateMiddleCell(t_eca *x) { + int i; + post("activate middle cell"); + for (i=0;i<x->size;i++) { + x->cells[i] = FALSE; + } + x->cells[x->size/2] = TRUE; +} + +void calculateCellStates(t_eca *x) { + + int i; + + boolean newstates[MAX_ARRAY_SIZE]; + newstates[0] = x->ruletable[x->cells[x->size-1]*4+x->cells[0]*2+x->cells[1]]; + newstates[x->size-1] = x->ruletable[x->cells[x->size-2]*4+x->cells[x->size-1]*2+x->cells[0]]; + for (i=1;i<x->size-1;i++) { + newstates[i] = x->ruletable[x->cells[i-1]*4+x->cells[i]*2+x->cells[i+1]]; + } + for (i=0;i<x->size;i++) { + x->cells[i] = newstates[i]; + } +} + +void eca_randomize(t_eca *x) { +post("Randomize called"); +randomizeCells(x); +} + +void createRuleTable(t_eca *x,unsigned short decimalcode) { + + int i; + post("Rule changed to %d",x->rule); + //decimalcode to binary + fast_d2b(decimalcode,x->ruletable); + //for (i=0;i<8;i++) + //post("%d",x->ruletable[i]); +} + +void eca_bang(t_eca *x) +{ +t_atom *y; +int i; +int k = 0; +if ((t_int) x->inrule != x->rule) { +x->rule = (t_int) x->inrule/1; +createRuleTable(x,(unsigned short) x->rule); +} +//startpost("%d",x->counter); +for (i=0;i<x->size;i++) { + if (x->cells[i]==TRUE) + { + //startpost("& $\bullet$ "); + SETFLOAT(&x->oncells[k],i); +// SETFLOAT(&x->oncells[k],i+x->offset); +// oncells[k] = y; + k++; + } + //else startpost("& "); + + +} +//post("\tabularnewline"); +x->counter++; +//randomizeCells(x); +outlet_list(x->on_cells,&s_list, k, &x->oncells[0]); +calculateCellStates(x); // calculate for next step +//outlet_float(x->firstcell,x->cells[0]); +} + + + +/* + * take argument rule, size, init (0=random), (1=middlecell active) + */ +void *eca_new(t_floatarg rule,t_floatarg size,t_floatarg init) +{ + + t_eca *x = (t_eca *)pd_new(eca_class); + //inlet_new(&x->x_obj, &x->x_obj.ob_pd,gensym("list"), gensym("randomize")); + if (size != 0) + x->size = size; + else (size = 16); + //x->offset = offset; + + if (init == 0) randomizeCells(x); + else if (init == 1) eca_activateMiddleCell(x); + x->rule = rule; + x->inrule = rule; + x->counter = 1; + createRuleTable(x,(unsigned short) rule); + x->on_cells = outlet_new(&x->x_obj,&s_list); + //x->firstcell = outlet_new(&x->x_obj,&s_float); + floatinlet_new(&x->x_obj, &x->inrule); + return (void *)x; +}
Property changes on: trunk/externals/algocomp/elementaryca.c ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/fractal.c =================================================================== --- trunk/externals/algocomp/fractal.c (rev 0) +++ trunk/externals/algocomp/fractal.c 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,118 @@ +#include "m_pd.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +static t_class *oneoverf_class; +static t_class *chaosgame_class; + + +/* + * Implementation of 1/f noise sequences + */ + +typedef struct _oneoverf { + t_object x_obj; +// t_int nrp; + t_int nrbits; + t_float bits; + t_float output; + t_float rans[32]; +// t_int count[16]; + t_int counter; +// t_float avg[16]; + t_outlet *note_out;//,*r_out,*n_out; +} t_oneoverf; + +void oneoverf_bang(t_oneoverf *x) +{ +if ((t_int) x->bits != x->nrbits) { +post("Changed number of bits"); +x->nrbits = (t_int) x->bits; +x->counter = 0; +} +int i; +outlet_float(x->note_out, x->output); +//outlet_float(x->r_out, x->nrp); +//outlet_float(x->n_out, x->nrp); +x->output = 0; // ((t_float) rand())/RAND_MAX/x->nrbits; +x->counter++; +for (i=x->nrbits-1;i>=0;i--) { +// x->avg[i] = ((t_float) (x->avg[i]*(x->count[i]-1)+x->old))/x->count[i]; + + if (x->counter%((int) pow(2,i)) == 0) { + if (i == x->nrbits-1) x->counter = 0; +// x->count[i] = 1; +// x->avg[i] = 0; + x->rans[i] = ((t_float) rand())/RAND_MAX/x->nrbits; + post("Changing value of %d, counter: %d",i,x->counter); + i = -1; // break + } +} +for (i=0;i<x->nrbits;i++) { + x->output += x->rans[i]; +} +} + +void *oneoverf_new(t_floatarg f1) +{ + t_oneoverf *x = (t_oneoverf *)pd_new(oneoverf_class); + int i; + x->bits = f1; + x->nrbits = (t_int) f1; + if (f1 < 1) x->nrbits = 1; + else if (f1 > 32) x->nrbits = 32; + x->output = 0; + x->counter = 0; + for (i=0;i<x->nrbits;i++) { + x->rans[i] = (((t_float) rand())/RAND_MAX)/x->nrbits; + // x->count[i] = 1; +// x->avg[i] = 0; + x->output += x->rans[i]; + post("Random generators: %d", x->nrbits); + } + x->note_out = outlet_new(&x->x_obj,&s_float); + floatinlet_new(&x->x_obj, &x->bits); + //x->r_out = outlet_new(&x->x_obj,&s_float); + //x->n_out = outlet_new(&x->x_obj,&s_float); + return (void *)x; +} + +/* + * Implementation of the chaos game! + */ +typedef struct _chaosgame { + t_object x_obj; + t_float x,y; + t_float px[3],py[3]; + t_outlet *x_out,*y_out; +} t_chaosgame; + + +void chaosgame_bang(t_chaosgame *x) +{ +int i; +outlet_float(x->x_out, x->x); +outlet_float(x->y_out, x->y); +i = 3*rand()/32765; +x->x = (x->x + x->px[i])/2; +x->y = (x->y + x->py[i])/2; +} + +void *chaosgame_new(t_floatarg f1) +{ + t_chaosgame *x = (t_chaosgame *)pd_new(chaosgame_class); + x->px[0] = -1; + x->py[0] = -1; + x->px[1] = 0; + x->py[1] = 1; + x->px[2] = 1; + x->py[2] = -1; + + x->x = rand()/RAND_MAX; + x->y = rand()/RAND_MAX; + + x->x_out = outlet_new(&x->x_obj,&s_float); + x->y_out = outlet_new(&x->x_obj,&s_float); + return (void *)x; +}
Property changes on: trunk/externals/algocomp/fractal.c ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/gauss_tilde.c =================================================================== --- trunk/externals/algocomp/gauss_tilde.c (rev 0) +++ trunk/externals/algocomp/gauss_tilde.c 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,65 @@ +#include "m_pd.h" + + +#define fran() (t_float)rand()/(t_float)RAND_MAX + +static char *version = "gauss v0.1, generates a Gaussian distributed random variable\n" + " with mean 'mu' and standard deviation 'sigma',\n" + " written by Olaf Matthes olaf.matthes@gmx.de"; + +/* -------------------------- rand_gauss ------------------------------ */ + +static t_class *gauss_tilde_class; + +typedef struct _gauss_tilde +{ + t_object x_obj; + t_float x_sigma; + t_float x_mu; +} t_gauss_tilde; + + + +t_int *gauss_tilde_perform(t_int *w) +{ + t_gauss_tilde *x = (t_gauss_tilde *)(w[1]); + t_sample *out = (t_sample *)(w[2]); + int n = (int)(w[3]); + t_float u, halfN = 6.0, sum = 0, scale; + t_int k, N = 12; + scale = 1/sqrt(N/12); + while (n--){ + sum = 0; + for(k = 1; k <= N; k++) + sum += fran(); + *out++ = x->x_sigma*scale*(sum-halfN)+x->x_mu; + } + return (w+4); +} + +void gauss_tilde_dsp(t_gauss_tilde *x, t_signal **sp) +{ +dsp_add(gauss_tilde_perform, 3, x, +sp[0]->s_vec, +sp[0]->s_n); +} + + +void *gauss_tilde_new(t_floatarg fs, t_floatarg fm) +{ + t_gauss_tilde *x = (t_gauss_tilde *)pd_new(gauss_tilde_class); + + floatinlet_new(&x->x_obj, &x->x_sigma); + floatinlet_new(&x->x_obj, &x->x_mu); + outlet_new(&x->x_obj, &s_signal); + x->x_sigma = fs; + x->x_mu = fm; + return (x); +} + + + + + + +
Property changes on: trunk/externals/algocomp/gauss_tilde.c ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/genetic.c =================================================================== --- trunk/externals/algocomp/genetic.c (rev 0) +++ trunk/externals/algocomp/genetic.c 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,218 @@ +#include "m_pd.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +#define TRUE 1 +#define FALSE 0 +#define MAX_ARRAY_SIZE 256 +//typedef short boolean; + +static t_class *genetic_class; + +typedef struct _individual { + boolean genes[MAX_ARRAY_SIZE]; + float fitness; + t_int length; +} t_individual; + +typedef struct _genetic { + t_object x_obj; + float cumulativeprobability; + t_int individuallength; + t_individual population[MAX_ARRAY_SIZE]; + t_int populationsize; + t_individual targetindividual; + t_atom out[MAX_ARRAY_SIZE]; + t_int chunksize; + t_outlet *outlist; +} t_genetic; + +void randomizeIndividuals(t_genetic *x) { + int i,k; + for (k=0;k<x->populationsize;k++) { + for (i=0;i<x->individuallength;i++) { + x->population[k].genes[i] = ((t_float) rand())/RAND_MAX*2; + } + x->population[k].length = x->individuallength; + } +// x->population[0].genes[0] = 1; +// x->population[0].genes[1] = 0; +} + +void printTarget(t_genetic *x) { + unsigned int out[MAX_ARRAY_SIZE]; + int i; + for (i=0;i< x->targetindividual.length/x->chunksize;i++) { + fast_b2short(&out[i],&x->targetindividual.genes[i*x->chunksize],x->chunksize); + SETFLOAT(&x->out[i],out[i]); + } + outlet_list(x->outlist,&s_list, i, &x->out[0]); +} + + +void randomTargetIndividual(t_genetic *x) { + int i; + for (i=0;i<x->individuallength;i++) { + x->targetindividual.genes[i] = ((t_float) rand())/RAND_MAX*2; + } + x->targetindividual.length = x->individuallength; + //printTarget(&x->targetindividual,x); +} + +/*float evaluateFitness(t_genetic *x,int index) { + int fitness = 0; + int i; +// post("Fitness eval"); + for (i=0;i<x->individuallength;i++) { + //if (x->targetindividual.genes[i] == x->population[index].genes[i]) + //if (x->population[index].genes[i] == TRUE) + fitness += x->population[0].genes[0]; + //fitness++; + } + return fitness/x->individuallength; + //return 1; +} +*/ +void startReproduction(t_genetic *x) { + int selectedIndividuals[MAX_ARRAY_SIZE]; + int count = 0; + int i; + float r; + t_individual childs[MAX_ARRAY_SIZE]; + int childindex = 0; + for (count =0; count < x->populationsize/4; count++) { + float sum = 0; + i = 0; + r = ((t_float) rand())/RAND_MAX * x->cumulativeprobability; + while (r > sum) { + sum += x->population[i].fitness; + i++; + } + selectedIndividuals[count] = i; + } + post("parents: %d",count); + i=0; + while (i<count) { + int k = 0; + for (k=0;k<8;k++) { + int l; + r = ((t_float) rand())/RAND_MAX * x->individuallength; + for (l=0;l<x->individuallength;l++) { + if (l<r) childs[childindex].genes[l] = x->population[selectedIndividuals[i]].genes[l]; + else childs[childindex].genes[l] = x->population[selectedIndividuals[i+1]].genes[l]; + } + // mutation + r = ((t_float) rand())/RAND_MAX * x->individuallength; + childs[childindex].genes[(int)r] = 1-childs[childindex].genes[(int)r]; + childindex++; + } + i+=2; + } + for (i=0;i<childindex;i++) { + x->population[i] = childs[i]; + } + post("New childs: %d",childindex); + +} + + +int evaluatePopulation(t_genetic *x) { + int i,k; + int f; + int highestfitnessindex = 0; + float highestfitness = 0; + float mean; + x->cumulativeprobability = 0; + for (k=0; k < x->populationsize; k++) { + float fitness = 0; + for (i=0;i<x->individuallength;i++) { + //x->population[k].genes[i] = 0; + if (x->targetindividual.genes[i] == x->population[k].genes[i]) + fitness++; +// fitness += x->population[k].genes[i]; + } + x->population[k].fitness = fitness/x->individuallength; + x->population[k].fitness = (fitness/x->individuallength)*(fitness/x->individuallength); + + if (x->population[k].fitness > highestfitness) { + // post("fitness of %d: %f",k,fitness); + highestfitness = x->population[k].fitness; + highestfitnessindex = k; + } + x->cumulativeprobability+=x->population[k].fitness; + } + //recalculate + mean = x->cumulativeprobability/x->populationsize; + x->cumulativeprobability = 0; + for (k=0;k < x->populationsize; k++) { + if (x->population[k].fitness < mean) + x->population[k].fitness = 0; + else x->cumulativeprobability += x->population[k].fitness; + } + post("Highest fitness: %f",highestfitness); + return highestfitnessindex; +} + + +void genetic_setTarget(t_genetic *x,t_symbol *s, int argc, t_atom *argv) { +int i; +post("target called: %d",argc); + for (i=0;i< x->individuallength/x->chunksize;i++) { + if (i >= argc) break; + fast_d2bl(atom_getint(&argv[i]),&x->targetindividual.genes[i*x->chunksize],x->chunksize); + + } + printTarget(x); +} + +void genetic_randomize(t_genetic *x) { +post("Randomize called"); +randomizeIndividuals(x); +} + +void genetic_bang(t_genetic *x) +{ + int selected = 1; + unsigned int out[MAX_ARRAY_SIZE]; + int i; + selected = evaluatePopulation(x); + //post("Selected individual: %d",selected); + for (i=0;i< x->individuallength/x->chunksize;i++) { + //out[i] = ((t_float) rand())/RAND_MAX*2; + fast_b2short(&out[i],&x->population[selected].genes[i*x->chunksize],x->chunksize); + //fast_b2short8(&out[i],&x->population[selected].genes[i*8]); + SETFLOAT(&x->out[i],out[i]); + } + // fast_b2d(&out,&x->population[0].genes[0]); +// fast_b2short(&out,&x->population[0].genes[0]); +// fast_b2d(&out,&test[0]); +// out = 100; +// SETFLOAT(&x->out[1],out); + outlet_list(x->outlist,&s_list, i, &x->out[0]); + startReproduction(x); +} + + +/* + * take argument rule, size, and offset + */ +void *genetic_new(t_float popsize,t_float indsize, t_float chunksize) +{ + t_genetic *x = (t_genetic *)pd_new(genetic_class); + //inlet_new(&x->x_obj, &x->x_obj.ob_pd,gensym("list"), gensym("randomize")); + if ((popsize > 0) && (popsize <= 256)) + x->populationsize = popsize; + else x->populationsize = 256; + if ((indsize > 0) && (indsize <= 256)) + x->individuallength = indsize; + else x->individuallength = 256; + if ((chunksize <= 16) && (chunksize > 0)) + x->chunksize = (int) chunksize; + else x->chunksize = 8; + randomizeIndividuals(x); + randomTargetIndividual(x); + inlet_new(&x->x_obj, &x->x_obj.ob_pd,gensym("list"), gensym("target")); + x->outlist = outlet_new(&x->x_obj,&s_list); + return (void *)x; +}
Property changes on: trunk/externals/algocomp/genetic.c ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/helpers.c =================================================================== --- trunk/externals/algocomp/helpers.c (rev 0) +++ trunk/externals/algocomp/helpers.c 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,42 @@ +void fast_d2bl(int x, short *c, short length) { + int i; + for (i=0;i<length;i++) + *(c++) = (x >> i) & 0x1; +} + +void fast_d2b(unsigned short x, short *c) { + int i; + for (i=0;i<8;i++) + *(c++) = (x >> i) & 0x1; +} + + +void fast_b2d(unsigned long int *n, short *c) { +int i = 32; +*n = 0; +while(i--) { +*n <<=1; +*n+= *(c+i); +} +} + +void fast_b2short8(unsigned short *n, short *c) { +int i = 8; +*n = 0; +while(i--) { +*n <<=1; +*n+= *(c+i); +} +} + +void fast_b2short(unsigned int *n, short *c,short length) { +int i; +if ((length <= 16) && (length > 0)) +i = length; +else i = 8; +*n = 0; +while(i--) { +*n <<=1; +*n+= *(c+i); +} +}
Property changes on: trunk/externals/algocomp/helpers.c ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/ifs.c =================================================================== --- trunk/externals/algocomp/ifs.c (rev 0) +++ trunk/externals/algocomp/ifs.c 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,105 @@ +#include "m_pd.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +static t_class *ifs_class; + + +/* + * An interated function system music example + * a more general approach is needed. + */ +typedef struct _ifs { + t_object x_obj; + t_int nr_functions; + t_float R1,R2; + t_float T1[6],T2[6],S1[6],S2[6]; + t_float A[6], B[6]; + t_float C[6], D[6], P[6]; + t_float x,y; + t_outlet *x_out,*y_out, *i_out; +} t_ifs; + + +void ifs_bang(t_ifs *x) +{ +float r = ((float) rand())/RAND_MAX; +int i = 0; +while (r > x->P[i]) +i++; +//post("Applying function nr: %d",i); +//x->x = x->A[i]*x->x + x->B[i]*x->y + x->T1[i]; +//x->y = x->C[i]*x->x + x->D[i]*x->y + x->T2[i]; +x->x = x->S1[i]*x->x + x->T1[i]; +x->y = x->S2[i]*x->y + x->T2[i]; +outlet_float(x->x_out,x->x); +outlet_float(x->y_out,x->y); +//outlet_float(x->i_out,r); +} + +void ifs_setFunctions(t_ifs *x,t_symbol *s, int argc, t_atom *argv) { +int i; +float p = 0; +x->nr_functions = argc/5; +post("%d new function set!",x->nr_functions); + +for (i=0;i<x->nr_functions;i++) { + x->S1[i] = atom_getfloat(&argv[i*5]); + x->S2[i] = atom_getfloat(&argv[i*5+1]); + x->T1[i] = atom_getfloat(&argv[i*5+2]); + x->T2[i] = atom_getfloat(&argv[i*5+3]); + x->P[i] = p+atom_getfloat(&argv[i*5+4]); + p = x->P[i]; +} + +if (p != 1.0) { + float scale = 1.0/p; + post("%d new function set. Scale probabilities by %f",x->nr_functions,scale); + for (i=0;i<x->nr_functions;i++) { + x->P[i] = scale*x->P[i]; + startpost("p for %d: %f; ",i,x->P[i]); + } +} + +} + +void *ifs_new(t_floatarg f1) +{ + t_ifs *x = (t_ifs *)pd_new(ifs_class); + t_float p; + t_float R1[6],R2[6],S1[6],S2[6]; + t_int i; + x->nr_functions = 3; + p = 1.0/x->nr_functions; + //R1[0]=R1[1]=R1[2]=R1[3]=R1[4]=R1[5]= 1; + //R2[0]=R2[1]=R2[2]=R2[3]=R2[4]=R2[5]= 0; + //S1[0]=S1[1]=S1[2]=S1[3]=S1[4]=S1[5]= 0.5;//0.33333; + //S2[0]=S2[1]=S2[2]=S2[3]=S2[4]=S2[5]= 1;//0.33333; + + x->S1[0]=0.333; + x->S2[0]=0.333; + x->S1[1]=0.667; + x->S2[1]=0.333; + x->S1[2]=0.333; + x->S2[2]=0.333; + x->T1[0] = 0; + x->T2[0] = 0; + x->T1[1] = 0.333; + x->T2[1] = 0.333; + x->T1[2] = 0; + x->T2[2] = 0.667; + + for (i = 0;i<x->nr_functions;i++) { + x->P[i] = p*(i+1); + post("prob %d: %f",i,x->P[i]); + } + x->x = 0; + x->y = 0; + x->x_out = outlet_new(&x->x_obj,&s_float); + x->y_out = outlet_new(&x->x_obj,&s_float); + //x->i_out = outlet_new(&x->x_obj,&s_float); + post("ifs initialized"); + return (void *)x; +} +
Property changes on: trunk/externals/algocomp/ifs.c ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/ifs.c.old =================================================================== --- trunk/externals/algocomp/ifs.c.old (rev 0) +++ trunk/externals/algocomp/ifs.c.old 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,77 @@ +#include "m_pd.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +static t_class *ifs_class; + + +/* + * An interated function system music example + * a more general approach is needed. + */ +typedef struct _ifs { + t_object x_obj; + t_float R1,R2,S1,S2; + t_float T1[6],T2[6]; + t_float A[6], B[6]; + t_float C[6], D[6],P[6]; + t_float x,y; + t_outlet *x_out,*y_out, *i_out; +} t_ifs; + + +void ifs_bang(t_ifs *x) +{ +float r = ((float) rand())/RAND_MAX; +int i = 0; +while (r > x->P[i]) +i++; +x->x = x->A[i]*x->x + x->B[i]*x->y + x->T1[i]; +x->y = x->C[i]*x->x + x->D[i]*x->y + x->T2[i]; +outlet_float(x->x_out,x->x); +outlet_float(x->y_out,x->y); +outlet_float(x->i_out,r); +} + + + +void *ifs_new(t_floatarg f1) +{ + x->nr_functions = 3; + t_float R1[6],R2[6],S1[6],S2[6]; + t_ifs *x = (t_ifs *)pd_new(ifs_class); + t_int i; + t_float p = 1/x->nr_functions; + R1[0]=R1[1]=R1[2]=R1[3]=R1[4]=R1[5]= 1; + R2[0]=R2[1]=R2[2]=R2[3]=R2[4]=R2[5]= 0; + S1[0]=S1[1]=S1[2]=S1[3]=S1[4]=S1[5]= 0.5;//0.33333; + S2[0]=S2[1]=S2[2]=S2[3]=S2[4]=S2[5]= 1;//0.33333; + x->T1[0] = 0; + x->T2[0] = 2; + x->T1[1] = 1.5; + x->T2[1] = 1; + x->T1[2] = 1.5; + x->T2[2] = -1; + x->T1[3] = 0; + x->T2[3] = -2; + x->T1[4] = -1.5; + x->T2[4] = -1; + x->T1[5] = -1.5; + x->T2[5] = 1; + for (i = 0;i<6;i++) { + x->A[i] = S1[i]*cos(R1[i]); + x->B[i] = -S2[i]*sin(R2[i]); + x->C[i] = S1[i]*sin(R1[i]); + x->D[i] = S2[i]*cos(R2[i]); + x->P[i] = p*(i+1); + } + x->x = 0; + x->y = 0; + x->x_out = outlet_new(&x->x_obj,&s_float); + x->y_out = outlet_new(&x->x_obj,&s_float); + x->i_out = outlet_new(&x->x_obj,&s_float); + post("ifs initialized"); + return (void *)x; +} +
Property changes on: trunk/externals/algocomp/ifs.c.old ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/ifsmusic.c =================================================================== --- trunk/externals/algocomp/ifsmusic.c (rev 0) +++ trunk/externals/algocomp/ifsmusic.c 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,151 @@ +#include "m_pd.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +static t_class *ifsmusic_class; + +/* + * An interated function system music example + */ +typedef struct _ifsmusic { + t_object x_obj; + t_int nr_notes; + t_int nr_functions; +// t_int melodylength; + t_float T[16]; + t_float S[16]; + t_float P[16]; + t_int R[16]; + t_int count; + t_float note[16]; + t_atom notesout[16]; + t_outlet *x_out; +} t_ifsmusic; + + + + +void nextSerie(t_ifsmusic *x) { +int i; +if (x->count == x->nr_notes) { +t_float ra = rand(); +t_float r = ra/RAND_MAX; +int k = 0; +t_float noten[16]; +x->count = 0; +while (r>x->P[k]) k++; +post("Selected function %d, r=%f",k,r); +for (i=1;i<x->nr_notes;i++) { +x->note[i] = ((x->note[i] - x->note[0])*x->S[k]) + x->note[0]; +} + +for (i=0;i<x->nr_notes;i++) { +x->note[i] = x->note[i] + x->T[k]; +} +if (x->R[k] == -1) { +for (i=0;i<x->nr_notes;i++) +noten[x->nr_notes-1-i]=x->note[i]; +for (i=0;i<x->nr_notes;i++) +x->note[i]=noten[i]; +} +} +} + +void ifsmusic_outputSerie(t_ifsmusic *x) +{ + int i; + for (i=0;i< x->nr_notes;i++) { + //x->notesout[i] = x->note[i]; + SETFLOAT(&x->notesout[i],x->note[i]); + } + +outlet_list(x->x_out,&s_list, x->nr_notes, &x->notesout[0]); +x->count = x->nr_notes; +nextSerie(x); +} + +void ifsmusic_bang(t_ifsmusic *x) +{ +outlet_float(x->x_out,x->note[x->count]); +x->count++; +nextSerie(x); +} + +void ifsmusic_setNotes(t_ifsmusic *x,t_symbol *s, int argc, t_atom *argv) { +int i; +x->nr_notes = argc; +post("%d new notes set!",x->nr_notes); +for (i=0;i<x->nr_notes;i++) { + x->note[i] = atom_getfloat(&argv[i]); +} +} + +void ifsmusic_setFunctions(t_ifsmusic *x,t_symbol *s, int argc, t_atom *argv) { +int i; +float p = 0; +x->nr_functions = argc/4; +post("%d new function set!",x->nr_functions); + +for (i=0;i<x->nr_functions;i++) { + x->S[i] = atom_getfloat(&argv[i*4]); + x->T[i] = atom_getfloat(&argv[i*4+1]); +// x->T2[i] = atom_getfloat(&argv[i*5+2]); + x->P[i] = p+atom_getfloat(&argv[i*4+3]); + x->R[i] = (t_int) atom_getfloat(&argv[i*4+2]); + p = x->P[i]; + post("function %d: %f %f %d %f",i,x->S[i],x->T[i],x->R[i],x->P[i]); +} + +if (p != 1.0) { + float scale = 1.0/p; + // post("%d new function set. Scale probabilities by %f",x->nr_functions,scale); + for (i=0;i<x->nr_functions;i++) { + x->P[i] = scale*x->P[i]; + // startpost("p for %d: %f; ",i,x->P[i]); + } +} + +} + + +void ifsmusic_initDummyNoteSequence(t_ifsmusic *x) { + x->nr_notes = 3; + x->note[0] = 66; + x->note[1] = 70; + x->note[2] = 63; +} + +void ifsmusic_initDummyFunctions(t_ifsmusic *x) { + int i; + x->T[0] = 0; + x->T[1] = 0; + x->T[2] = 0; + x->S[0] = 1; + x->S[1] = 1; + x->S[2] = 1; + x->R[0] = 1; + x->R[1] = 1; + x->R[2] = 1; + x->nr_functions = 3; + for (i=0;i<x->nr_functions;i++) x->P[i] = (t_float) (i+1)/x->nr_functions; +} + + +void *ifsmusic_new(t_symbol *s, int argc, t_atom *argv) +{ + t_ifsmusic *x = (t_ifsmusic *)pd_new(ifsmusic_class); + x->count = 0; + x->x_out = outlet_new(&x->x_obj,&s_float); + //x->mapped_out = outlet_new(&x->x_obj,&s_float); + if (argc == 0) ifsmusic_initDummyNoteSequence(x); + else { + int i; + x->nr_notes = argc; + for (i=0;i<argc;i++) + x->note[i] = atom_getfloat(argv+i); + } + ifsmusic_initDummyFunctions(x); + post("Ifsmusic initialised with sequence length: %d",x->nr_notes); + return (void *)x; +}
Property changes on: trunk/externals/algocomp/ifsmusic.c ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/logistictilde.c =================================================================== --- trunk/externals/algocomp/logistictilde.c (rev 0) +++ trunk/externals/algocomp/logistictilde.c 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,59 @@ +/* +* Trying logistic function for audio processing +*/ + +#include "m_pd.h" + +static t_class *logistic_tilde_class; + +typedef struct _logistic_tilde { +t_object x_obj; +t_sample f_logistic; +t_sample f; +t_float a; +} t_logistic_tilde; + +t_sample logistic(t_sample x,t_float a) { + return a*x*(1-x); +} + +t_int *logistic_tilde_perform(t_int *w) +{ +t_logistic_tilde *x = (t_logistic_tilde *)(w[1]); +//t_sample *in1 = (t_sample *)(w[2]); +//t_sample *in2 = (t_sample *)(w[3]); +t_sample *out = (t_sample *)(w[2]); +int n = (int)(w[3]); +//t_sample f_logistic = (x->f_logistic<0)?0.0:(x->f_logistic>1)?1.0:x->f_logistic; +while (n--){ + x->f_logistic = logistic(x->f_logistic,x->a); + *out++ = x->f_logistic - 0.5; + } + +return (w+4); +} + + + +void logistic_tilde_dsp(t_logistic_tilde *x, t_signal **sp) +{ +dsp_add(logistic_tilde_perform, 3, x, +sp[0]->s_vec, +//sp[1]->s_vec, +//sp[2]->s_vec, +sp[0]->s_n); +} + +void *logistic_tilde_new(t_floatarg f) +{ +t_logistic_tilde *x = (t_logistic_tilde *)pd_new(logistic_tilde_class); +x->f_logistic = 0.5; +x->a = 3.7; +if (x->a < 0) x->a = 1; +if (x->a > 4) x->a = 4; +//inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); +floatinlet_new (&x->x_obj, &x->a); +outlet_new(&x->x_obj, &s_signal); +return (void *)x; +} +
Property changes on: trunk/externals/algocomp/logistictilde.c ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/m_pd.h =================================================================== --- trunk/externals/algocomp/m_pd.h (rev 0) +++ trunk/externals/algocomp/m_pd.h 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,635 @@ +/* Copyright (c) 1997-1999 Miller Puckette. +* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __m_pd_h_ + +#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) +extern "C" { +#endif + +#define PD_MAJOR_VERSION 0 +#define PD_MINOR_VERSION 38 + +/* old name for "MSW" flag -- we have to take it for the sake of many old +"nmakefiles" for externs, which will define NT and not MSW */ +#if defined(NT) && !defined(MSW) +#define MSW +#endif + +#ifdef MSW +/* #pragma warning( disable : 4091 ) */ +#pragma warning( disable : 4305 ) /* uncast const double to float */ +#pragma warning( disable : 4244 ) /* uncast float/int conversion etc. */ +#pragma warning( disable : 4101 ) /* unused automatic variables */ +#endif /* MSW */ + + /* the external storage class is "extern" in UNIX; in MSW it's ugly. */ +#ifdef MSW +#ifdef PD_INTERNAL +#define EXTERN __declspec(dllexport) extern +#else +#define EXTERN __declspec(dllimport) extern +#endif /* PD_INTERNAL */ +#else +#define EXTERN extern +#endif /* MSW */ + + /* and depending on the compiler, hidden data structures are + declared differently: */ +#if defined( __GNUC__) || defined( __BORLANDC__ ) || defined( __MWERKS__ ) +#define EXTERN_STRUCT struct +#else +#define EXTERN_STRUCT extern struct +#endif + + +#if !defined(_SIZE_T) && !defined(_SIZE_T_) +#include <stddef.h> /* just for size_t -- how lame! */ +#endif + +#define MAXPDSTRING 1000 /* use this for anything you want */ +#define MAXPDARG 5 /* max number of args we can typecheck today */ + +/* signed and unsigned integer types the size of a pointer: */ +/* GG: long is the size of a pointer */ +typedef long t_int; + +typedef float t_float; /* a floating-point number at most the same size */ +typedef float t_floatarg; /* floating-point type for function calls */ + +typedef struct _symbol +{ + char *s_name; + struct _class **s_thing; + struct _symbol *s_next; +} t_symbol; + +EXTERN_STRUCT _array; +#define t_array struct _array /* g_canvas.h */ + +/* pointers to glist and array elements go through a "stub" which sticks +around after the glist or array is freed. The stub itself is deleted when +both the glist/array is gone and the refcount is zero, ensuring that no +gpointers are pointing here. */ + +#define GP_NONE 0 /* the stub points nowhere (has been cut off) */ +#define GP_GLIST 1 /* the stub points to a glist element */ +#define GP_ARRAY 2 /* ... or array */ + +typedef struct _gstub +{ + union + { + struct _glist *gs_glist; /* glist we're in */ + struct _array *gs_array; /* array we're in */ + } gs_un; + int gs_which; /* GP_GLIST/GP_ARRAY */ + int gs_refcount; /* number of gpointers pointing here */ +} t_gstub; + +typedef struct _gpointer /* pointer to a gobj in a glist */ +{ + union + { + struct _scalar *gp_scalar; /* scalar we're in (if glist) */ + union word *gp_w; /* raw data (if array) */ + } gp_un; + int gp_valid; /* number which must match gpointee */ + t_gstub *gp_stub; /* stub which points to glist/array */ +} t_gpointer; + +typedef union word +{ + t_float w_float; + t_symbol *w_symbol; + t_gpointer *w_gpointer; + t_array *w_array; + struct _glist *w_list; + int w_index; +} t_word; + +typedef enum +{ + A_NULL, + A_FLOAT, + A_SYMBOL, + A_POINTER, + A_SEMI, + A_COMMA, + A_DEFFLOAT, + A_DEFSYM, + A_DOLLAR, + A_DOLLSYM, + A_GIMME, + A_CANT +} t_atomtype; + +#define A_DEFSYMBOL A_DEFSYM /* better name for this */ + +typedef struct _atom +{ + t_atomtype a_type; + union word a_w; +} t_atom; + +EXTERN_STRUCT _class; +#define t_class struct _class + +EXTERN_STRUCT _outlet; +#define t_outlet struct _outlet + +EXTERN_STRUCT _inlet; +#define t_inlet struct _inlet + +EXTERN_STRUCT _binbuf; +#define t_binbuf struct _binbuf + +EXTERN_STRUCT _clock; +#define t_clock struct _clock + +EXTERN_STRUCT _outconnect; +#define t_outconnect struct _outconnect + +EXTERN_STRUCT _glist; +#define t_glist struct _glist +#define t_canvas struct _glist /* LATER lose this */ + +typedef t_class *t_pd; /* pure datum: nothing but a class pointer */ + +typedef struct _gobj /* a graphical object */ +{ + t_pd g_pd; /* pure datum header (class) */ + struct _gobj *g_next; /* next in list */ +} t_gobj; + +typedef struct _scalar /* a graphical object holding data */ +{ + t_gobj sc_gobj; /* header for graphical object */ + t_symbol *sc_template; /* template name (LATER replace with pointer) */ + t_word sc_vec[1]; /* indeterminate-length array of words */ +} t_scalar; + +typedef struct _text /* patchable object - graphical, with text */ +{ + t_gobj te_g; /* header for graphical object */ + t_binbuf *te_binbuf; /* holder for the text */ + t_outlet *te_outlet; /* linked list of outlets */ + t_inlet *te_inlet; /* linked list of inlets */ + short te_xpix; /* x&y location (within the toplevel) */ + short te_ypix; + short te_width; /* requested width in chars, 0 if auto */ + unsigned int te_type:2; /* from defs below */ +} t_text; + +#define T_TEXT 0 /* just a textual comment */ +#define T_OBJECT 1 /* a MAX style patchable object */ +#define T_MESSAGE 2 /* a MAX stype message */ +#define T_ATOM 3 /* a cell to display a number or symbol */ + +#define te_pd te_g.g_pd + + /* t_object is synonym for t_text (LATER unify them) */ + +typedef struct _text t_object; + +#define ob_outlet te_outlet +#define ob_inlet te_inlet +#define ob_binbuf te_binbuf +#define ob_pd te_g.g_pd +#define ob_g te_g + +typedef void (*t_method)(void); +typedef void *(*t_newmethod)( void); +typedef void (*t_gotfn)(void *x, ...); + +/* ---------------- pre-defined objects and symbols --------------*/ +EXTERN t_pd pd_objectmaker; /* factory for creating "object" boxes */ +EXTERN t_pd pd_canvasmaker; /* factory for creating canvases */ +EXTERN t_symbol s_pointer; +EXTERN t_symbol s_float; +EXTERN t_symbol s_symbol; +EXTERN t_symbol s_bang; +EXTERN t_symbol s_list; +EXTERN t_symbol s_anything; +EXTERN t_symbol s_signal; +EXTERN t_symbol s__N; +EXTERN t_symbol s__X; +EXTERN t_symbol s_x; +EXTERN t_symbol s_y; +EXTERN t_symbol s_; + +/* --------- prototypes from the central message system ----------- */ +EXTERN void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv); +EXTERN void pd_forwardmess(t_pd *x, int argc, t_atom *argv); +EXTERN t_symbol *gensym(char *s); +EXTERN t_gotfn getfn(t_pd *x, t_symbol *s); +EXTERN t_gotfn zgetfn(t_pd *x, t_symbol *s); +EXTERN void nullfn(void); +EXTERN void pd_vmess(t_pd *x, t_symbol *s, char *fmt, ...); +#define mess0(x, s) ((*getfn((x), (s)))((x))) +#define mess1(x, s, a) ((*getfn((x), (s)))((x), (a))) +#define mess2(x, s, a,b) ((*getfn((x), (s)))((x), (a),(b))) +#define mess3(x, s, a,b,c) ((*getfn((x), (s)))((x), (a),(b),(c))) +#define mess4(x, s, a,b,c,d) ((*getfn((x), (s)))((x), (a),(b),(c),(d))) +#define mess5(x, s, a,b,c,d,e) ((*getfn((x), (s)))((x), (a),(b),(c),(d),(e))) +EXTERN void obj_list(t_object *x, t_symbol *s, int argc, t_atom *argv); +EXTERN t_pd *pd_newest(void); + +/* --------------- memory management -------------------- */ +EXTERN void *getbytes(size_t nbytes); +EXTERN void *getzbytes(size_t nbytes); +EXTERN void *copybytes(void *src, size_t nbytes); +EXTERN void freebytes(void *x, size_t nbytes); +EXTERN void *resizebytes(void *x, size_t oldsize, size_t newsize); + +/* -------------------- atoms ----------------------------- */ + +#define SETSEMI(atom) ((atom)->a_type = A_SEMI, (atom)->a_w.w_index = 0) +#define SETCOMMA(atom) ((atom)->a_type = A_COMMA, (atom)->a_w.w_index = 0) +#define SETPOINTER(atom, gp) ((atom)->a_type = A_POINTER, \ + (atom)->a_w.w_gpointer = (gp)) +#define SETFLOAT(atom, f) ((atom)->a_type = A_FLOAT, (atom)->a_w.w_float = (f)) +#define SETSYMBOL(atom, s) ((atom)->a_type = A_SYMBOL, \ + (atom)->a_w.w_symbol = (s)) +#define SETDOLLAR(atom, n) ((atom)->a_type = A_DOLLAR, \ + (atom)->a_w.w_index = (n)) +#define SETDOLLSYM(atom, s) ((atom)->a_type = A_DOLLSYM, \ + (atom)->a_w.w_symbol= (s)) + +EXTERN t_float atom_getfloat(t_atom *a); +EXTERN t_int atom_getint(t_atom *a); +EXTERN t_symbol *atom_getsymbol(t_atom *a); +EXTERN t_symbol *atom_gensym(t_atom *a); +EXTERN t_float atom_getfloatarg(int which, int argc, t_atom *argv); +EXTERN t_int atom_getintarg(int which, int argc, t_atom *argv); +EXTERN t_symbol *atom_getsymbolarg(int which, int argc, t_atom *argv); + +EXTERN void atom_string(t_atom *a, char *buf, unsigned int bufsize); + +/* ------------------ binbufs --------------- */ + +EXTERN t_binbuf *binbuf_new(void); +EXTERN void binbuf_free(t_binbuf *x); +EXTERN t_binbuf *binbuf_duplicate(t_binbuf *y); + +EXTERN void binbuf_text(t_binbuf *x, char *text, size_t size); +EXTERN void binbuf_gettext(t_binbuf *x, char **bufp, int *lengthp); +EXTERN void binbuf_clear(t_binbuf *x); +EXTERN void binbuf_add(t_binbuf *x, int argc, t_atom *argv); +EXTERN void binbuf_addv(t_binbuf *x, char *fmt, ...); +EXTERN void binbuf_addbinbuf(t_binbuf *x, t_binbuf *y); +EXTERN void binbuf_addsemi(t_binbuf *x); +EXTERN void binbuf_restore(t_binbuf *x, int argc, t_atom *argv); +EXTERN void binbuf_print(t_binbuf *x); +EXTERN int binbuf_getnatom(t_binbuf *x); +EXTERN t_atom *binbuf_getvec(t_binbuf *x); +EXTERN void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv); +EXTERN int binbuf_read(t_binbuf *b, char *filename, char *dirname, + int crflag); +EXTERN int binbuf_read_via_path(t_binbuf *b, char *filename, char *dirname, + int crflag); +EXTERN int binbuf_write(t_binbuf *x, char *filename, char *dir, + int crflag); +EXTERN void binbuf_evalfile(t_symbol *name, t_symbol *dir); +EXTERN t_symbol *binbuf_realizedollsym(t_symbol *s, int ac, t_atom *av, + int tonew); + +/* ------------------ clocks --------------- */ + +EXTERN t_clock *clock_new(void *owner, t_method fn); +EXTERN void clock_set(t_clock *x, double systime); +EXTERN void clock_delay(t_clock *x, double delaytime); +EXTERN void clock_unset(t_clock *x); +EXTERN double clock_getlogicaltime(void); +EXTERN double clock_getsystime(void); /* OBSOLETE; use clock_getlogicaltime() */ +EXTERN double clock_gettimesince(double prevsystime); +EXTERN double clock_getsystimeafter(double delaytime); +EXTERN void clock_free(t_clock *x); + +/* ----------------- pure data ---------------- */ +EXTERN t_pd *pd_new(t_class *cls); +EXTERN void pd_free(t_pd *x); +EXTERN void pd_bind(t_pd *x, t_symbol *s); +EXTERN void pd_unbind(t_pd *x, t_symbol *s); +EXTERN t_pd *pd_findbyclass(t_symbol *s, t_class *c); +EXTERN void pd_pushsym(t_pd *x); +EXTERN void pd_popsym(t_pd *x); +EXTERN t_symbol *pd_getfilename(void); +EXTERN t_symbol *pd_getdirname(void); +EXTERN void pd_bang(t_pd *x); +EXTERN void pd_pointer(t_pd *x, t_gpointer *gp); +EXTERN void pd_float(t_pd *x, t_float f); +EXTERN void pd_symbol(t_pd *x, t_symbol *s); +EXTERN void pd_list(t_pd *x, t_symbol *s, int argc, t_atom *argv); +EXTERN void pd_anything(t_pd *x, t_symbol *s, int argc, t_atom *argv); +#define pd_class(x) (*(x)) + +/* ----------------- pointers ---------------- */ +EXTERN void gpointer_init(t_gpointer *gp); +EXTERN void gpointer_copy(const t_gpointer *gpfrom, t_gpointer *gpto); +EXTERN void gpointer_unset(t_gpointer *gp); +EXTERN int gpointer_check(const t_gpointer *gp, int headok); + +/* ----------------- patchable "objects" -------------- */ +EXTERN t_inlet *inlet_new(t_object *owner, t_pd *dest, t_symbol *s1, + t_symbol *s2); +EXTERN t_inlet *pointerinlet_new(t_object *owner, t_gpointer *gp); +EXTERN t_inlet *floatinlet_new(t_object *owner, t_float *fp); +EXTERN t_inlet *symbolinlet_new(t_object *owner, t_symbol **sp); +EXTERN void inlet_free(t_inlet *x); + +EXTERN t_outlet *outlet_new(t_object *owner, t_symbol *s); +EXTERN void outlet_bang(t_outlet *x); +EXTERN void outlet_pointer(t_outlet *x, t_gpointer *gp); +EXTERN void outlet_float(t_outlet *x, t_float f); +EXTERN void outlet_symbol(t_outlet *x, t_symbol *s); +EXTERN void outlet_list(t_outlet *x, t_symbol *s, int argc, t_atom *argv); +EXTERN void outlet_anything(t_outlet *x, t_symbol *s, int argc, t_atom *argv); +EXTERN t_symbol *outlet_getsymbol(t_outlet *x); +EXTERN void outlet_free(t_outlet *x); +EXTERN t_object *pd_checkobject(t_pd *x); + + +/* -------------------- canvases -------------- */ + +EXTERN void glob_setfilename(void *dummy, t_symbol *name, t_symbol *dir); + +EXTERN void canvas_setargs(int argc, t_atom *argv); +EXTERN void canvas_getargs(int *argcp, t_atom **argvp); +EXTERN t_symbol *canvas_getcurrentdir(void); +EXTERN t_glist *canvas_getcurrent(void); +EXTERN void canvas_makefilename(t_glist *c, char *file, + char *result,int resultsize); +EXTERN t_symbol *canvas_getdir(t_glist *x); +EXTERN int sys_fontwidth(int fontsize); +EXTERN int sys_fontheight(int fontsize); +EXTERN void canvas_dataproperties(t_glist *x, t_scalar *sc, t_binbuf *b); + +/* ---------------- widget behaviors ---------------------- */ + +EXTERN_STRUCT _widgetbehavior; +#define t_widgetbehavior struct _widgetbehavior + +EXTERN_STRUCT _parentwidgetbehavior; +#define t_parentwidgetbehavior struct _parentwidgetbehavior +EXTERN t_parentwidgetbehavior *pd_getparentwidget(t_pd *x); + +/* -------------------- classes -------------- */ + +#define CLASS_DEFAULT 0 /* flags for new classes below */ +#define CLASS_PD 1 +#define CLASS_GOBJ 2 +#define CLASS_PATCHABLE 3 +#define CLASS_NOINLET 8 + +#define CLASS_TYPEMASK 3 + + +EXTERN t_class *class_new(t_symbol *name, t_newmethod newmethod, + t_method freemethod, size_t size, int flags, t_atomtype arg1, ...); +EXTERN void class_addcreator(t_newmethod newmethod, t_symbol *s, + t_atomtype type1, ...); +EXTERN void class_addmethod(t_class *c, t_method fn, t_symbol *sel, + t_atomtype arg1, ...); +EXTERN void class_addbang(t_class *c, t_method fn); +EXTERN void class_addpointer(t_class *c, t_method fn); +EXTERN void class_doaddfloat(t_class *c, t_method fn); +EXTERN void class_addsymbol(t_class *c, t_method fn); +EXTERN void class_addlist(t_class *c, t_method fn); +EXTERN void class_addanything(t_class *c, t_method fn); +EXTERN void class_sethelpsymbol(t_class *c, t_symbol *s); +EXTERN void class_setwidget(t_class *c, t_widgetbehavior *w); +EXTERN void class_setparentwidget(t_class *c, t_parentwidgetbehavior *w); +EXTERN t_parentwidgetbehavior *class_parentwidget(t_class *c); +EXTERN char *class_getname(t_class *c); +EXTERN char *class_gethelpname(t_class *c); +EXTERN void class_setdrawcommand(t_class *c); +EXTERN int class_isdrawcommand(t_class *c); +EXTERN void class_domainsignalin(t_class *c, int onset); +#define CLASS_MAINSIGNALIN(c, type, field) \ + class_domainsignalin(c, (char *)(&((type *)0)->field) - (char *)0) + + /* prototype for functions to save Pd's to a binbuf */ +typedef void (*t_savefn)(t_gobj *x, t_binbuf *b); +EXTERN void class_setsavefn(t_class *c, t_savefn f); +EXTERN t_savefn class_getsavefn(t_class *c); + /* prototype for functions to open properties dialogs */ +typedef void (*t_propertiesfn)(t_gobj *x, struct _glist *glist); +EXTERN void class_setpropertiesfn(t_class *c, t_propertiesfn f); +EXTERN t_propertiesfn class_getpropertiesfn(t_class *c); + +#ifndef PD_CLASS_DEF +#define class_addbang(x, y) class_addbang((x), (t_method)(y)) +#define class_addpointer(x, y) class_addpointer((x), (t_method)(y)) +#define class_addfloat(x, y) class_doaddfloat((x), (t_method)(y)) +#define class_addsymbol(x, y) class_addsymbol((x), (t_method)(y)) +#define class_addlist(x, y) class_addlist((x), (t_method)(y)) +#define class_addanything(x, y) class_addanything((x), (t_method)(y)) +#endif + +/* ------------ printing --------------------------------- */ +EXTERN void post(const char *fmt, ...); +EXTERN void startpost(const char *fmt, ...); +EXTERN void poststring(const char *s); +EXTERN void postfloat(float f); +EXTERN void postatom(int argc, t_atom *argv); +EXTERN void endpost(void); +EXTERN void error(const char *fmt, ...); +EXTERN void bug(const char *fmt, ...); +EXTERN void pd_error(void *object, const char *fmt, ...); +EXTERN void sys_logerror(const char *object, const char *s); +EXTERN void sys_unixerror(const char *object); +EXTERN void sys_ouch(void); + + +/* ------------ system interface routines ------------------- */ +EXTERN int sys_isreadablefile(const char *name); +EXTERN void sys_bashfilename(const char *from, char *to); +EXTERN void sys_unbashfilename(const char *from, char *to); +EXTERN int open_via_path(const char *name, const char *ext, const char *dir, + char *dirresult, char **nameresult, unsigned int size, int bin); +EXTERN int sched_geteventno(void); +EXTERN double sys_getrealtime(void); +EXTERN int (*sys_idlehook)(void); /* hook to add idle time computation */ + + +/* ------------ threading ------------------- */ +/* T.Grill - see m_sched.c */ + +EXTERN void sys_lock(void); +EXTERN void sys_unlock(void); +EXTERN int sys_trylock(void); + + +/* --------------- signals ----------------------------------- */ + +typedef float t_sample; +#define MAXLOGSIG 32 +#define MAXSIGSIZE (1 << MAXLOGSIG) + +typedef struct _signal +{ + int s_n; /* number of points in the array */ + t_sample *s_vec; /* the array */ + float s_sr; /* sample rate */ + int s_refcount; /* number of times used */ + int s_isborrowed; /* whether we're going to borrow our array */ + struct _signal *s_borrowedfrom; /* signal to borrow it from */ + struct _signal *s_nextfree; /* next in freelist */ + struct _signal *s_nextused; /* next in used list */ +} t_signal; + + +typedef t_int *(*t_perfroutine)(t_int *args); + +EXTERN t_int *plus_perform(t_int *args); +EXTERN t_int *zero_perform(t_int *args); +EXTERN t_int *copy_perform(t_int *args); + +EXTERN void dsp_add_plus(t_sample *in1, t_sample *in2, t_sample *out, int n); +EXTERN void dsp_add_copy(t_sample *in, t_sample *out, int n); +EXTERN void dsp_add_scalarcopy(t_sample *in, t_sample *out, int n); +EXTERN void dsp_add_zero(t_sample *out, int n); + +EXTERN int sys_getblksize(void); +EXTERN float sys_getsr(void); +EXTERN int sys_get_inchannels(void); +EXTERN int sys_get_outchannels(void); + +EXTERN void dsp_add(t_perfroutine f, int n, ...); +EXTERN void dsp_addv(t_perfroutine f, int n, t_int *vec); +EXTERN void pd_fft(float *buf, int npoints, int inverse); +EXTERN int ilog2(int n); + +EXTERN void mayer_fht(float *fz, int n); +EXTERN void mayer_fft(int n, float *real, float *imag); +EXTERN void mayer_ifft(int n, float *real, float *imag); +EXTERN void mayer_realfft(int n, float *real); +EXTERN void mayer_realifft(int n, float *real); + +EXTERN float *cos_table; +#define LOGCOSTABSIZE 9 +#define COSTABSIZE (1<<LOGCOSTABSIZE) + +EXTERN int canvas_suspend_dsp(void); +EXTERN void canvas_resume_dsp(int oldstate); +EXTERN void canvas_update_dsp(void); + +/* IOhannes { (up/downsampling) */ +typedef struct _resample +{ + int method; /* up/downsampling method ID */ + + t_int downsample; /* downsampling factor */ + t_int upsample; /* upsampling factor */ + + t_float *s_vec; /* here we hold the resampled data */ + int s_n; + + t_float *coeffs; /* coefficients for filtering... */ + int coefsize; + + t_float *buffer; /* buffer for filtering */ + int bufsize; +} t_resample; + +EXTERN void resample_init(t_resample *x); +EXTERN void resample_free(t_resample *x); + +EXTERN void resample_dsp(t_resample *x, t_sample *in, int insize, t_sample *out, int outsize, int method); +EXTERN void resamplefrom_dsp(t_resample *x, t_sample *in, int insize, int outsize, int method); +EXTERN void resampleto_dsp(t_resample *x, t_sample *out, int insize, int outsize, int method); +/* } IOhannes */ + +/* ----------------------- utility functions for signals -------------- */ +EXTERN float mtof(float); +EXTERN float ftom(float); +EXTERN float rmstodb(float); +EXTERN float powtodb(float); +EXTERN float dbtorms(float); +EXTERN float dbtopow(float); + +EXTERN float q8_sqrt(float); +EXTERN float q8_rsqrt(float); +#ifndef N32 +EXTERN float qsqrt(float); /* old names kept for extern compatibility */ +EXTERN float qrsqrt(float); +#endif +/* --------------------- data --------------------------------- */ + + /* graphical arrays */ +EXTERN_STRUCT _garray; +#define t_garray struct _garray + +EXTERN t_class *garray_class; +EXTERN int garray_getfloatarray(t_garray *x, int *size, t_float **vec); +EXTERN float garray_get(t_garray *x, t_symbol *s, t_int indx); +EXTERN void garray_redraw(t_garray *x); +EXTERN int garray_npoints(t_garray *x); +EXTERN char *garray_vec(t_garray *x); +EXTERN void garray_resize(t_garray *x, t_floatarg f); +EXTERN void garray_usedindsp(t_garray *x); +EXTERN void garray_setsaveit(t_garray *x, int saveit); +EXTERN t_class *scalar_class; + +EXTERN t_float *value_get(t_symbol *s); +EXTERN void value_release(t_symbol *s); +EXTERN int value_getfloat(t_symbol *s, t_float *f); +EXTERN int value_setfloat(t_symbol *s, t_float f); + +/* ------- GUI interface - functions to send strings to TK --------- */ +typedef void (*t_guicallbackfn)(t_gobj *client, t_glist *glist); + +EXTERN void sys_vgui(char *fmt, ...); +EXTERN void sys_gui(char *s); +EXTERN void sys_pretendguibytes(int n); +EXTERN void sys_queuegui(void *client, t_glist *glist, t_guicallbackfn f); +EXTERN void sys_unqueuegui(void *client); + /* dialog window creation and destruction */ +EXTERN void gfxstub_new(t_pd *owner, void *key, const char *cmd); +EXTERN void gfxstub_deleteforkey(void *key); + +extern t_class *glob_pdobject; /* object to send "pd" messages */ + +/*------------- Max 0.26 compatibility --------------------*/ + +/* the following reflects the new way classes are laid out, with the class + pointing to the messlist and not vice versa. Externs shouldn't feel it. */ +typedef t_class *t_externclass; + +EXTERN void c_extern(t_externclass *cls, t_newmethod newroutine, + t_method freeroutine, t_symbol *name, size_t size, int tiny, \ + t_atomtype arg1, ...); +EXTERN void c_addmess(t_method fn, t_symbol *sel, t_atomtype arg1, ...); + +#define t_getbytes getbytes +#define t_freebytes freebytes +#define t_resizebytes resizebytes +#define typedmess pd_typedmess +#define vmess pd_vmess + +/* A definition to help gui objects straddle 0.34-0.35 changes. If this is +defined, there is a "te_xpix" field in objects, not a "te_xpos" as before: */ + +#define PD_USE_TE_XPIX + + +#ifdef __i386__ +/* a test for NANs and denormals. Should only be necessary on i386. */ +#define PD_BADFLOAT(f) ((((*(unsigned int*)&(f))&0x7f800000)==0) || \ + (((*(unsigned int*)&(f))&0x7f800000)==0x7f800000)) +/* more stringent test: anything not between 1e-19 and 1e19 in absolute val */ +#define PD_BIGORSMALL(f) ((((*(unsigned int*)&(f))&0x60000000)==0) || \ + (((*(unsigned int*)&(f))&0x60000000)==0x60000000)) +#else +#define PD_BADFLOAT(f) 0 +#define PD_BIGORSMALL(f) 0 +#endif + +#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) +} +#endif + +#define __m_pd_h_ +#endif /* __m_pd_h_ */
Property changes on: trunk/externals/algocomp/m_pd.h ___________________________________________________________________ Added: svn:executable + *
Added: trunk/externals/algocomp/neural.c =================================================================== --- trunk/externals/algocomp/neural.c (rev 0) +++ trunk/externals/algocomp/neural.c 2009-01-09 17:23:55 UTC (rev 10494) @@ -0,0 +1,157 @@ +#include "m_pd.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +#define MAX_LAYERS 3 +#define MAX_UNITS 3 + + +static t_class *mlp_class; + + +typedef struct _mlp { + t_object x_obj; + int nr_inputunits; + int nr_hiddenunits; + int nr_outunits; + int nr_layers; + t_float weights[2][MAX_UNITS][MAX_UNITS]; + t_float output[3][MAX_UNITS]; + t_float bias[2][MAX_UNITS]; + t_float input[MAX_UNITS]; + t_float target[MAX_UNITS]; + float eta; + t_outlet *out,*error_out; +} t_mlp; + + +void calculateOutput(t_mlp *x) { + int i,k,l; + for (k=0;k<x->nr_hiddenunits;k++) { + x->output[1][k] = x->bias[0][k]; + for (l=0;l<x->nr_inputunits;l++) { + x->output[1][k] += x->output[0][l]*x->weights[0][l][k]; + } + x->output[1][k] = 1.0/(1.0-exp(-x->output[1][k])); + } + for (k=0;k<x->nr_outunits;k++) { + x->output[2][k] = x->bias[1][k]; + for (l=0;l<x->nr_hiddenunits;l++) { + x->output[2][k] += x->output[1][l]*x->weights[1][l][k]; + } + x->output[2][k] = 1.0/(1.0-exp(-x->output[2][k])); + } +} + +void measureError(t_mlp *x) { +//post("Measuring Error"); +int i,k,j; +float Error = 0.0; +float SumDOW[MAX_UNITS]; +float DeltaH[MAX_UNITS]; +float DeltaO[MAX_UNITS]; +float DeltaWeightIH[MAX_UNITS][MAX_UNITS]; +float DeltaWeightHO[MAX_UNITS][MAX_UNITS]; + + for(k=0 ;k<x->nr_outunits;k++) { + Error +=0.5*(x->target[k]-x->output[2][k])*(x->target[k]-x->output[2][k]); + DeltaO[k] = (x->target[k]-x->output[2][k]);//*x->output[2][k] * (1 - x->output[2][k]); + } + + post("Target: %f Error: %f Delta: %f", x->target[0], Error, DeltaO[0]); + outlet_float(x->error_out, Error); + for(j=0;j<x->nr_hiddenunits;j++) { /* 'back-propagate' errors to hidden layer */ + SumDOW[j] = 0.0 ; + for(k=0 ; k<=x->nr_outunits; k++ ) { + SumDOW[j] += x->weights[1][j][k]*DeltaO[k] ; + } + DeltaH[j] = SumDOW[j] * x->output[1][j]* (1.0 - x->output[1][j]); + } + for(j = 0 ;j<x->nr_hiddenunits; j++) { /* update weights WeightIH */ + //DeltaWeightIH[0][j] = + x->alpha*DeltaWeightIH[0][j]; + x->bias[0][j] += x->eta*DeltaH[j]; + for(i = 0; i < x->nr_inputunits ; i++ ) { + DeltaWeightIH[i][j] = x->eta * x->output[0][i] * DeltaH[j];// + x->alpha * DeltaWeightIH[i][j]; + x->weights[0][i][j] += DeltaWeightIH[i][j]; + } + } + for( k = 0; k < x->nr_outunits; k++) { /* update weights WeightHO */ + x->bias[1][k] += x->eta*DeltaO[k]; +// DeltaWeightHO[0][k] = x->eta * DeltaO[k] + x->alpha * DeltaWeightHO[0][k] ; +// x->weights[1][0][k] += DeltaWeightHO[0][k]; + for(j = 0; j < x->nr_hiddenunits; j++ ) { + DeltaWeightHO[j][k] = x->eta * x->output[1][j] * DeltaO[k];// + x->alpha * DeltaWeightHO[j][k] ; + x->weights[1][j][k] += DeltaWeightHO[j][k]; + } +} +} + + +void mlp_bang(t_mlp *x) +{ + calculateOutput(x); + outlet_float(x->out, x->output[2][0]); +} + +void mlp_inputed(t_mlp *x,t_symbol *s, int argc, t_atom *argv) { +int i; +post("inputed called"); +for (i=0;i<argc;i++) { + if (i > x->nr_inputunits) break; + x->output[0][i] = atom_getfloat(&argv[i]); +} +mlp_bang(x); +} + +void mlp_setTarget(t_mlp *x,t_symbol *s, int argc, t_atom *argv) { +int i; +//post("target called: %d",argc); +for (i=0;i<argc-1;i++) { + if (i > x->nr_inputunits) break; + x->output[0][i] = atom_getfloat(&argv[i]); +} +post("set targetto: %f",atom_getfloat(&argv[argc-1])); +x->target[0] = atom_getfloat(&argv[argc-1]); +mlp_bang(x); +measureError(x); +} + + +void initializeWeights(t_mlp *x) { + int i,k,l; + for (k=0;k<x->nr_hiddenunits;k++) { + x->bias[0][k] = 0;//((t_float) rand())/RAND_MAX;
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.