From 086e6b358ad45bda0e6a948cfb7ea2d33ab7da5a Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 10 Feb 2010 00:34:05 +0000 Subject: re-arranged into libdir and setup with the template Makefile+debian stuff. renabled vv+ and vv- as vvplus and vvminus svn path=/trunk/externals/smlib/; revision=13158 --- source/SMLib.c | 234 -------------------------------------------- source/SMLib.dsp | 275 ---------------------------------------------------- source/SMLib.dsw | 29 ------ source/SMLib.opt | Bin 48640 -> 0 bytes source/SMLib.plg | 153 ----------------------------- source/bp.c | 123 ----------------------- source/decimator.c | 66 ------------- source/defines.h | 18 ---- source/deltas.c | 181 ---------------------------------- source/hip.c | 77 --------------- source/hist.c | 155 ----------------------------- source/itov.c | 86 ---------------- source/lavg.c | 55 ----------- source/lhist.c | 174 --------------------------------- source/lhisti.c | 174 --------------------------------- source/linspace.c | 74 -------------- source/lmax.c | 57 ----------- source/lmin.c | 57 ----------- source/lrange.c | 60 ------------ source/lstd.c | 60 ------------ source/prevl.c | 161 ------------------------------ source/threshold.c | 112 --------------------- source/vabs.c | 48 --------- source/vclip.c | 58 ----------- source/vcog.c | 43 -------- source/vdbtorms.c | 56 ----------- source/vdelta.c | 75 -------------- source/vfmod.c | 57 ----------- source/vftom.c | 49 ---------- source/vlavg.c | 86 ---------------- source/vlmax.c | 86 ---------------- source/vlmin.c | 86 ---------------- source/vlrange.c | 99 ------------------- source/vmax.c | 52 ---------- source/vmin.c | 52 ---------- source/vmtof.c | 51 ---------- source/vnmax.c | 55 ----------- source/vpow.c | 60 ------------ source/vrms.c | 41 -------- source/vrmstodb.c | 54 ----------- source/vstd.c | 45 --------- source/vsum.c | 40 -------- source/vthreshold.c | 106 -------------------- source/vvconv.c | 151 ----------------------------- source/vvminus.c | 142 --------------------------- source/vvplus.c | 142 --------------------------- 46 files changed, 4115 deletions(-) delete mode 100644 source/SMLib.c delete mode 100755 source/SMLib.dsp delete mode 100755 source/SMLib.dsw delete mode 100755 source/SMLib.opt delete mode 100755 source/SMLib.plg delete mode 100644 source/bp.c delete mode 100644 source/decimator.c delete mode 100644 source/defines.h delete mode 100644 source/deltas.c delete mode 100644 source/hip.c delete mode 100644 source/hist.c delete mode 100644 source/itov.c delete mode 100644 source/lavg.c delete mode 100644 source/lhist.c delete mode 100644 source/lhisti.c delete mode 100644 source/linspace.c delete mode 100644 source/lmax.c delete mode 100644 source/lmin.c delete mode 100644 source/lrange.c delete mode 100644 source/lstd.c delete mode 100644 source/prevl.c delete mode 100644 source/threshold.c delete mode 100644 source/vabs.c delete mode 100644 source/vclip.c delete mode 100644 source/vcog.c delete mode 100644 source/vdbtorms.c delete mode 100644 source/vdelta.c delete mode 100644 source/vfmod.c delete mode 100644 source/vftom.c delete mode 100644 source/vlavg.c delete mode 100644 source/vlmax.c delete mode 100644 source/vlmin.c delete mode 100644 source/vlrange.c delete mode 100644 source/vmax.c delete mode 100644 source/vmin.c delete mode 100644 source/vmtof.c delete mode 100644 source/vnmax.c delete mode 100644 source/vpow.c delete mode 100644 source/vrms.c delete mode 100644 source/vrmstodb.c delete mode 100644 source/vstd.c delete mode 100644 source/vsum.c delete mode 100644 source/vthreshold.c delete mode 100644 source/vvconv.c delete mode 100644 source/vvminus.c delete mode 100644 source/vvplus.c (limited to 'source') diff --git a/source/SMLib.c b/source/SMLib.c deleted file mode 100644 index baf4c8a..0000000 --- a/source/SMLib.c +++ /dev/null @@ -1,234 +0,0 @@ -/* --------------------- SMLib ----------------------------- */ -/* - - Signal processing for Mapping - objects: - - float stream - - pid controller? - - deltas (generate difference vector between current values and values of the past) - vector - - vquant (quantizer with hysteresis) - - vv/ - - vv> - - vv< - - s2v (stream to vector, incl ola) - - v2s (vector to stream, incl ola) - - vector math - - vreverse - - - delread - - delwrite - - upsample - - fir - - autorescale -*/ - -#include "defines.h" - - -// in alphabetical order -extern void bp_setup(); -extern void decimator_setup(); -extern void deltas_setup(); -extern void hip_setup(); -extern void hist_setup(); -extern void itov_setup(); -extern void lavg_setup(); -extern void lhist_setup(); -extern void lhisti_setup(); -extern void linspace_setup(); -extern void lmax_setup(); -extern void lmin_setup(); -extern void lrange_setup(); -extern void lstd_setup(); -extern void prevl_setup(); -extern void threshold_setup(); -extern void vabs_setup(); -extern void vclip_setup(); -extern void vcog_setup(); -extern void vdbtorms_setup(); -extern void vdelta_setup(); -extern void vfmod_setup(); -extern void vftom_setup(); -extern void vlavg_setup(); -extern void vlmax_setup(); -extern void vlmin_setup(); -extern void vlrange_setup(); -extern void vmax_setup(); -extern void vmin_setup(); -extern void vmtof_setup(); -extern void vpow_setup(); -extern void vrms_setup(); -extern void vrmstodb_setup(); -extern void vstd_setup(); -extern void vsum_setup(); -extern void vthreshold_setup(); -extern void vvconv_setup(); -extern void vvminus_setup(); -extern void vvplus_setup(); - -static t_class *SMLib_class; - -typedef struct _lstd -{ - t_object x_obj; -} t_SMLib; - -static void SMLib_help(t_SMLib *x) -{ - /* - */ - post(""); - post(""); - post(" .........................................................."); - post(" . SMLib ."); - post(" . Signal processing for Mapping ."); - post(" . v0.12 24/11/2002 ."); - post(" .........................................................."); - post(" . processing stream of floats (context) (float output) ."); - post(" . ."); - post(" . lavg leaky average ."); - post(" . lmax leaky maximum ."); - post(" . lmin leaky minimum ."); - post(" . lrange leaky range ."); - post(" u lstd leaky standard deviation ."); - post(" u decimator passes 1 in n input values ."); - post(" . threshold detection with hysteresis ."); - post(" . hip first order high-pass filter ."); - post(" . bp second order (resonant) high-pass filter ."); - post(" .........................................................."); - post(" . analyzing stream of floats (vector output) ."); - post(" . ."); - post(" . hist histogram ."); - post(" . lhist leaky histogram, clips samples ."); - post(" . lhisti leaky histogram, ignore samples ."); - post(" . outside bins ."); - post(" . itov bin index to value (for the histograms ."); - post(" . prevl previous floats in a list ."); - post(" . deltas difference between last float and ."); - post(" . previous floats ."); -// post(" o filterbank lineairly spaced set of bandpass filters ."); - post(" .........................................................."); - post(" . immediate vector analysis (float output) ."); - post(" . ."); - post(" . vsum sum of vector elements ."); - post(" . vcog center of gravity ."); - post(" . vmax maximum and its location ."); - post(" . vmin minimum and its location ."); - post(" . vrms root mean square ."); - post(" . vstd standard deviation ."); - post(" .........................................................."); - post(" . vector processors (vector output) ."); - post(" . ."); - post(" . vv+ vector addition ."); - post(" . vv- vector substraction ."); - post(" . vvconv vector convolution ."); - post(" . vclip clip elements ."); - post(" . vfmod floating point modulo ."); - post(" . vpow power ."); - post(" . vthreshold detections with hysteresises ."); - post(" . ."); - post(" . unit conversions on vectors ."); - post(" . ."); - post(" . vftom frequency to midi ."); - post(" . vmtof midi to frequency ."); - post(" . vdbtorms dB to rms ."); - post(" . vrmstodb rms to dB ."); - post(" .........................................................."); - post(" . vector synthesis (vector output) ."); - post(" . ."); - post(" . linspace linearly spaced vector ."); -// post(" o logspace logarithmically spaced vector ."); -// post(" o rand uniformly distributed random vector ."); -// post(" o randn normally distributed random vector ."); - post(" .........................................................."); - post(" . vector stream processing (vector output) (context) ."); - post(" . ."); - post(" . vlavg leaky averages ."); - post(" . vlmax leaky maxima ."); - post(" . vlmin leaky minima ."); - post(" . vlrange leaky ranges ."); - post(" . vdelta difference between successive vectors ."); - post(" .........................................................."); -// post(" . o = future additions ."); -// post(" . e = experimental ."); - post(" . u = undocumented ."); - post(" . j#|@ = johannes.taelman@rug.ac.be ."); - post(" .........................................................."); - post(""); - post(""); -} - -static void *SMLib_new() -{ - t_SMLib *x=(t_SMLib *)pd_new(SMLib_class); - return (void *)x; -} - -#ifdef WIN32 -__declspec(dllexport) void __cdecl SMLib_setup( void) -#else -void SMLib_setup( void) -#endif -{ - // dummy object for help-system - SMLib_class = class_new(gensym("SMLib"), - (t_newmethod)SMLib_new, 0, - sizeof(t_SMLib), - CLASS_DEFAULT, - 0); - class_addbang(SMLib_class, (t_method)SMLib_help); - class_addmethod(SMLib_class, (t_method)SMLib_help, gensym("help"),0); - - // real objects in alphabetical order - bp_setup(); - decimator_setup(); - deltas_setup(); - hip_setup(); - hist_setup(); - itov_setup(); - lavg_setup(); - lhist_setup(); - lhisti_setup(); - linspace_setup(); - lmax_setup(); - lmin_setup(); - lrange_setup(); - lstd_setup(); - prevl_setup(); - threshold_setup(); - vabs_setup(); - vclip_setup(); - vcog_setup(); - vdbtorms_setup(); - vdelta_setup(); - vfmod_setup(); - vftom_setup(); - vlavg_setup(); - vlmax_setup(); - vlmin_setup(); - vlrange_setup(); - vmax_setup(); - vmin_setup(); - vmtof_setup(); - vpow_setup(); - vrms_setup(); - vrmstodb_setup(); - vstd_setup(); - vsum_setup(); - vthreshold_setup(); - vvconv_setup(); - vvminus_setup(); - vvplus_setup(); - - post(""); - post(" .........................................................."); - post(" . SMLib ."); - post(" . Signal processing for Mapping ."); - post(" . v0.12 24/11/2002 ."); - post(" .........................................................."); - post(""); - -} diff --git a/source/SMLib.dsp b/source/SMLib.dsp deleted file mode 100755 index 35c2ab8..0000000 --- a/source/SMLib.dsp +++ /dev/null @@ -1,275 +0,0 @@ -# Microsoft Developer Studio Project File - Name="SMLib" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=SMLib - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "SMLib.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "SMLib.mak" CFG="SMLib - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "SMLib - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "SMLib - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "SMLib - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SMLIB_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SMLIB_EXPORTS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x813 /d "NDEBUG" -# ADD RSC /l 0x813 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib pd.lib /nologo /dll /machine:I386 - -!ELSEIF "$(CFG)" == "SMLib - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SMLIB_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SMLIB_EXPORTS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x813 /d "_DEBUG" -# ADD RSC /l 0x813 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib pd.lib /nologo /dll /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "SMLib - Win32 Release" -# Name "SMLib - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\bp.c -# End Source File -# Begin Source File - -SOURCE=.\decimator.c -# End Source File -# Begin Source File - -SOURCE=.\deltas.c -# End Source File -# Begin Source File - -SOURCE=.\hip.c -# End Source File -# Begin Source File - -SOURCE=.\hist.c -# End Source File -# Begin Source File - -SOURCE=.\itov.c -# End Source File -# Begin Source File - -SOURCE=.\lavg.c -# End Source File -# Begin Source File - -SOURCE=.\lhist.c -# End Source File -# Begin Source File - -SOURCE=.\lhisti.c -# End Source File -# Begin Source File - -SOURCE=.\linspace.c -# End Source File -# Begin Source File - -SOURCE=.\lmax.c -# End Source File -# Begin Source File - -SOURCE=.\lmin.c -# End Source File -# Begin Source File - -SOURCE=.\lrange.c -# End Source File -# Begin Source File - -SOURCE=.\lstd.c -# End Source File -# Begin Source File - -SOURCE=.\prevl.c -# End Source File -# Begin Source File - -SOURCE=.\SMLib.c -# End Source File -# Begin Source File - -SOURCE=.\threshold.c -# End Source File -# Begin Source File - -SOURCE=.\vabs.c -# End Source File -# Begin Source File - -SOURCE=.\vclip.c -# End Source File -# Begin Source File - -SOURCE=.\vcog.c -# End Source File -# Begin Source File - -SOURCE=.\vdbtorms.c -# End Source File -# Begin Source File - -SOURCE=.\vdelta.c -# End Source File -# Begin Source File - -SOURCE=.\vfmod.c -# End Source File -# Begin Source File - -SOURCE=.\vftom.c -# End Source File -# Begin Source File - -SOURCE=.\vlavg.c -# End Source File -# Begin Source File - -SOURCE=.\vlmax.c -# End Source File -# Begin Source File - -SOURCE=.\vlmin.c -# End Source File -# Begin Source File - -SOURCE=.\vlrange.c -# End Source File -# Begin Source File - -SOURCE=.\vmax.c -# End Source File -# Begin Source File - -SOURCE=.\vmin.c -# End Source File -# Begin Source File - -SOURCE=.\vmtof.c -# End Source File -# Begin Source File - -SOURCE=.\vnmax.c -# End Source File -# Begin Source File - -SOURCE=.\vpow.c -# End Source File -# Begin Source File - -SOURCE=.\vrms.c -# End Source File -# Begin Source File - -SOURCE=.\vrmstodb.c -# End Source File -# Begin Source File - -SOURCE=.\vstd.c -# End Source File -# Begin Source File - -SOURCE=.\vsum.c -# End Source File -# Begin Source File - -SOURCE=.\vthreshold.c -# End Source File -# Begin Source File - -SOURCE=.\vvconv.c -# End Source File -# Begin Source File - -SOURCE=.\vvminus.c -# End Source File -# Begin Source File - -SOURCE=.\vvplus.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\defines.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# Begin Source File - -SOURCE=.\readme.txt -# End Source File -# End Target -# End Project diff --git a/source/SMLib.dsw b/source/SMLib.dsw deleted file mode 100755 index 0428bd3..0000000 --- a/source/SMLib.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "SMLib"=.\SMLib.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/source/SMLib.opt b/source/SMLib.opt deleted file mode 100755 index 685315a..0000000 Binary files a/source/SMLib.opt and /dev/null differ diff --git a/source/SMLib.plg b/source/SMLib.plg deleted file mode 100755 index c75a641..0000000 --- a/source/SMLib.plg +++ /dev/null @@ -1,153 +0,0 @@ - - -
-

Build Log

-

---------------------Configuration: SMLib - Win32 Release-------------------- -

-

Command Lines

-Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP6B.tmp" with contents -[ -/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SMLIB_EXPORTS" /Fp"Release/SMLib.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c -"D:\devel\SMLib\bp.c" -"D:\devel\SMLib\decimator.c" -"D:\devel\SMLib\deltas.c" -"D:\devel\SMLib\hip.c" -"D:\devel\SMLib\hist.c" -"D:\devel\SMLib\itov.c" -"D:\devel\SMLib\lavg.c" -"D:\devel\SMLib\lhist.c" -"D:\devel\SMLib\lhisti.c" -"D:\devel\SMLib\linspace.c" -"D:\devel\SMLib\lmax.c" -"D:\devel\SMLib\lmin.c" -"D:\devel\SMLib\lrange.c" -"D:\devel\SMLib\lstd.c" -"D:\devel\SMLib\prevl.c" -"D:\devel\SMLib\SMLib.c" -"D:\devel\SMLib\threshold.c" -"D:\devel\SMLib\vabs.c" -"D:\devel\SMLib\vclip.c" -"D:\devel\SMLib\vcog.c" -"D:\devel\SMLib\vdbtorms.c" -"D:\devel\SMLib\vdelta.c" -"D:\devel\SMLib\vfmod.c" -"D:\devel\SMLib\vftom.c" -"D:\devel\SMLib\vlavg.c" -"D:\devel\SMLib\vlmax.c" -"D:\devel\SMLib\vlmin.c" -"D:\devel\SMLib\vlrange.c" -"D:\devel\SMLib\vmax.c" -"D:\devel\SMLib\vmin.c" -"D:\devel\SMLib\vmtof.c" -"D:\devel\SMLib\vnmax.c" -"D:\devel\SMLib\vpow.c" -"D:\devel\SMLib\vrms.c" -"D:\devel\SMLib\vrmstodb.c" -"D:\devel\SMLib\vstd.c" -"D:\devel\SMLib\vsum.c" -"D:\devel\SMLib\vthreshold.c" -"D:\devel\SMLib\vvconv.c" -"D:\devel\SMLib\vvminus.c" -"D:\devel\SMLib\vvplus.c" -] -Creating command line "cl.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP6B.tmp" -Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP6C.tmp" with contents -[ -kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib pd.lib /nologo /dll /incremental:no /pdb:"Release/SMLib.pdb" /machine:I386 /out:"Release/SMLib.dll" /implib:"Release/SMLib.lib" -.\Release\bp.obj -.\Release\decimator.obj -.\Release\deltas.obj -.\Release\hip.obj -.\Release\hist.obj -.\Release\itov.obj -.\Release\lavg.obj -.\Release\lhist.obj -.\Release\lhisti.obj -.\Release\linspace.obj -.\Release\lmax.obj -.\Release\lmin.obj -.\Release\lrange.obj -.\Release\lstd.obj -.\Release\prevl.obj -.\Release\SMLib.obj -.\Release\threshold.obj -.\Release\vabs.obj -.\Release\vclip.obj -.\Release\vcog.obj -.\Release\vdbtorms.obj -.\Release\vdelta.obj -.\Release\vfmod.obj -.\Release\vftom.obj -.\Release\vlavg.obj -.\Release\vlmax.obj -.\Release\vlmin.obj -.\Release\vlrange.obj -.\Release\vmax.obj -.\Release\vmin.obj -.\Release\vmtof.obj -.\Release\vnmax.obj -.\Release\vpow.obj -.\Release\vrms.obj -.\Release\vrmstodb.obj -.\Release\vstd.obj -.\Release\vsum.obj -.\Release\vthreshold.obj -.\Release\vvconv.obj -.\Release\vvminus.obj -.\Release\vvplus.obj -] -Creating command line "link.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP6C.tmp" -

Output Window

-Compiling... -bp.c -decimator.c -deltas.c -hip.c -hist.c -itov.c -lavg.c -lhist.c -lhisti.c -linspace.c -lmax.c -lmin.c -lrange.c -lstd.c -prevl.c -SMLib.c -threshold.c -vabs.c -vclip.c -vcog.c -vdbtorms.c -vdelta.c -vfmod.c -vftom.c -vlavg.c -vlmax.c -vlmin.c -vlrange.c -vmax.c -vmin.c -vmtof.c -vnmax.c -vpow.c -vrms.c -vrmstodb.c -vstd.c -vsum.c -vthreshold.c -vvconv.c -vvminus.c -vvplus.c -Linking... - Creating library Release/SMLib.lib and object Release/SMLib.exp - - - -

Results

-SMLib.dll - 0 error(s), 0 warning(s) -
- - diff --git a/source/bp.c b/source/bp.c deleted file mode 100644 index d21bc19..0000000 --- a/source/bp.c +++ /dev/null @@ -1,123 +0,0 @@ -#include "defines.h" - -/*--------------- bp ---------------*/ - -typedef struct bpctl -{ - float c_x1; - float c_x2; - float c_coef1; - float c_coef2; - float c_gain; -} t_bpctl; - -typedef struct bp -{ - t_object x_obj; - float x_freq; - float x_q; - t_bpctl x_cspace; - t_bpctl *x_ctl; - float x_f; -} t_bp; - -t_class *bp_class; - -static void bp_docoef(t_bp *x, t_floatarg f, t_floatarg q); - -static void *bp_new(t_floatarg f, t_floatarg q) -{ - t_bp *x = (t_bp *)pd_new(bp_class); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("ft1")); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("ft2")); - outlet_new(&x->x_obj, gensym("float")); - x->x_ctl = &x->x_cspace; - x->x_cspace.c_x1 = 0; - x->x_cspace.c_x2 = 0; - bp_docoef(x, f, q); - x->x_f = 0; - return (x); -} - -static float bp_qcos(float f) -{ - if (f >= -(0.5f*3.14159f) && f <= 0.5f*3.14159f) - { - float g = f*f; - return (((g*g*g * (-1.0f/720.0f) + g*g*(1.0f/24.0f)) - g*0.5f) + 1); - } - else return (0); -} - -static void bp_docoef(t_bp *x, t_floatarg f, t_floatarg q) -{ - float r, oneminusr, omega; - if (f < 0.0001f) f = 0.0001f; - if (q < 0) q = 0; - x->x_freq = f; - x->x_q = q; - omega = f * (2.0f * 3.14159f); - if (q < 0.001) oneminusr = 1.0f; - else oneminusr = omega/q; - if (oneminusr > 1.0f) oneminusr = 1.0f; - r = 1.0f - oneminusr; - x->x_ctl->c_coef1 = 2.0f * bp_qcos(omega) * r; - x->x_ctl->c_coef2 = - r * r; - x->x_ctl->c_gain = 2 * oneminusr * (oneminusr + r * omega); - /* post("r %f, omega %f, coef1 %f, coef2 %f", - r, omega, x->x_ctl->c_coef1, x->x_ctl->c_coef2); */ -} - -static void bp_ft1(t_bp *x, t_floatarg f) -{ - bp_docoef(x, f, x->x_q); -} - -static void bp_ft2(t_bp *x, t_floatarg q) -{ - bp_docoef(x, x->x_freq, q); -} - -static void bp_clear(t_bp *x, t_floatarg q) -{ - x->x_ctl->c_x1 = x->x_ctl->c_x2 = 0; -} - -static void bp_perform(t_bp *x, t_float in) -{ - float out; - t_bpctl *c = x->x_ctl; - float last = c->c_x1; - float prev = c->c_x2; - float coef1 = c->c_coef1; - float coef2 = c->c_coef2; - float gain = c->c_gain; - - float output = in + coef1 * last + coef2 * prev; - out = gain * output; - - prev = last; - last = output; - - /* NAN protect */ - if (!((last <= 0) || (last >= 0))) - last = 0; - if (!((prev <= 0) || (prev >= 0))) - prev = 0; - c->c_x1 = last; - c->c_x2 = prev; - - outlet_float(x->x_obj.ob_outlet, out); -} - -void bp_setup(void) -{ - bp_class = class_new(gensym("bp"), (t_newmethod)bp_new, 0, - sizeof(t_bp), 0, A_DEFFLOAT, A_DEFFLOAT, 0); - class_addfloat(bp_class, (t_method)bp_perform); - class_addmethod(bp_class, (t_method)bp_ft1, - gensym("ft1"), A_FLOAT, 0); - class_addmethod(bp_class, (t_method)bp_ft2, - gensym("ft2"), A_FLOAT, 0); - class_addmethod(bp_class, (t_method)bp_clear, gensym("clear"), 0); -} diff --git a/source/decimator.c b/source/decimator.c deleted file mode 100644 index d7f93f3..0000000 --- a/source/decimator.c +++ /dev/null @@ -1,66 +0,0 @@ -#include "defines.h" - -/*--------------- decimator ---------------*/ - -static t_class *decimator_class; - -typedef struct _decimator -{ - t_object x_obj; - int m_state; - int m_factor; -} t_decimator; - -static void decimator_perform(t_decimator *x, t_float in) -{ - if (!x->m_state) - { - outlet_float(x->x_obj.ob_outlet, in); - x->m_state=x->m_factor; - } - else - { - x->m_state--; - } - -} - -static void decimator_setFactor(t_decimator *x, t_float factor) -{ - x->m_factor=(int)factor - 1; -} - -static void decimator_clear(t_decimator *x) -{ - x->m_state=0; -} - - -static void *decimator_new(t_float factor) -{ - - t_decimator *x=(t_decimator *)pd_new(decimator_class); - outlet_new(&x->x_obj, gensym("float")); - - if (factor<1) factor=2; - - decimator_setFactor(x, factor); - decimator_clear(x); - return (void *)x; -} - - -void decimator_setup(void) -{ - decimator_class = class_new(gensym("decimator"), - (t_newmethod)decimator_new, 0, - sizeof(t_decimator), - CLASS_DEFAULT, - A_DEFFLOAT, 0); - class_addfloat(decimator_class, (t_method)decimator_perform); - class_addmethod(decimator_class, (t_method)decimator_clear, - gensym("clear"), A_GIMME, NULL); - class_addmethod(decimator_class, (t_method)decimator_setFactor, - gensym("factor"), A_DEFFLOAT, NULL); -} - diff --git a/source/defines.h b/source/defines.h deleted file mode 100644 index ecc208b..0000000 --- a/source/defines.h +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include "m_imp.h" -#include -#define MAXFLOAT 1e18f; -#define LOGTEN 2.302585092994 - -/* NT and OSX don't appear to have single-precision ANSI math */ -#if defined(WIN32) || defined(__APPLE__) -#define sinf sin -#define cosf cos -#define atanf atan -#define atan2f atan2 -#define sqrtf sqrt -#define logf log -#define expf exp -#define fabsf fabs -#define powf pow -#endif diff --git a/source/deltas.c b/source/deltas.c deleted file mode 100644 index edc3cb0..0000000 --- a/source/deltas.c +++ /dev/null @@ -1,181 +0,0 @@ -#include "defines.h" - -/*--------------- deltas ---------------*/ - -static t_class *deltas_class; - -typedef struct _deltas -{ - t_object x_obj; - float m_lo; - float m_hi; - int m_buffer_size; - int m_buffer_index; - float *m_buffer; // circular buffer -} t_deltas; - - -static void deltas_perform_float(t_deltas *x, t_float f) -{ - int index; - index=x->m_buffer_index+1; - index=(index==x->m_buffer_size)?0:index; - x->m_buffer_index=index; - x->m_buffer[index]=f; -} - -static void deltas_bang(t_deltas *x) -{ - int lo,hi,n,index,size; - t_atom *ap,*app; - float last; - float *buffer, *bp; - - lo=(int)x->m_lo; - hi=(int)x->m_hi; - - n=hi-lo; - size=x->m_buffer_size; - index=x->m_buffer_index; - ap = (t_atom *)getbytes(sizeof(t_atom)*n); - app=ap; - buffer=x->m_buffer; - last=buffer[index]; - bp=buffer+index-lo; - bp=(bp>=buffer)?bp:bp+size; // wrap - - if (bp-buffer>=n) - { // no wrap-around needed - index=n; - while(index--){ - SETFLOAT(app, last-*bp--); - app++; - } -// post("not wrapped, app-ap=%i",app-ap); - } - else // need to wrap - { - int ps, nn; - ps = bp-buffer; - nn=n; -// post(" nn=%i",nn); - for(;ps>=0;ps--) // don't we miss one sample in signal??? - { -// post("ps=%i",ps); - SETFLOAT(app, last-buffer[ps]); - app++; - nn--; - } - ps=size-1; -// post(" nn=%i",nn); - for(;nn>0;nn--) - { -// post("ps=%i",ps); - SETFLOAT(app, last-buffer[ps--]); - app++; - } - -/* - int i2; - index=bp-buffer; - i2=index; - post("first part %i",index); - while(index--){ - SETFLOAT(app, last-*bp--); - app++; - } - index=n-i2; - post("2nd part %i",index); - bp=buffer+size-1; - while(index--){ - SETFLOAT(app, last-*bp--); - app++; - } -*/ -// post("wrapped, app-ap=%i",app-ap); - } - - outlet_list(x->x_obj.ob_outlet,gensym("list"),n,ap); - freebytes(ap, sizeof(t_atom)*n); -} - -static void deltas_clear(t_deltas *x) -{ - int i,s; - float *f; - f=x->m_buffer; - s=x->m_buffer_size; - for (i=0;isize) - { - post("deltas: higher bound cannot be higher than the buffer size..."); - hi=size; - } - if (lo<0) - { - post("deltas: lower bound cannot be negative..."); - lo=0; - } - if (hi<1) - { - post("deltas: higher bound cannot be smaller than one..."); - hi=1; - } - if (hi<=lo) - { - post("deltas: higher bound must be higher than lower bound..."); - lo=hi-1.0f; - } - - freebytes(x->m_buffer, x->m_buffer_size); - - x->m_hi=(float)((int)hi); - x->m_lo=(float)((int)lo); - x->m_buffer_size=(int)size; - x->m_buffer = (float*)getbytes(sizeof(float)*x->m_buffer_size); - deltas_clear(x); - x->m_buffer_index=0; -} - -static void *deltas_new(t_float lo, t_float hi, t_float size) -{ - t_deltas *x=(t_deltas *)pd_new(deltas_class); - outlet_new(&x->x_obj, gensym("list")); - x->m_buffer_size=0; - x->m_buffer=0; - deltas_set(x, lo, hi, size); - - floatinlet_new(&x->x_obj, &x->m_lo); - floatinlet_new(&x->x_obj, &x->m_hi); - - return (void *)x; -} - -static void deltas_free(t_deltas *x) -{ - freebytes(x->m_buffer, x->m_buffer_size); -} - -void deltas_setup(void) -{ - deltas_class = class_new(gensym("deltas"), - (t_newmethod)deltas_new, (t_method)deltas_free, - sizeof(t_deltas), - CLASS_DEFAULT, - A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT,0); - - class_addmethod(deltas_class, (t_method)deltas_clear, gensym("clear"),0); - class_addfloat(deltas_class, (t_method)deltas_perform_float); - class_addbang(deltas_class, (t_method)deltas_bang); -} - diff --git a/source/hip.c b/source/hip.c deleted file mode 100644 index b1425c1..0000000 --- a/source/hip.c +++ /dev/null @@ -1,77 +0,0 @@ -#include "defines.h" - -/*--------------- hip ---------------*/ - -typedef struct hipctl -{ - float c_x; - float c_coef; -} t_hipctl; - -typedef struct hip -{ - t_object x_obj; - float x_sr; - float x_hz; - t_hipctl x_cspace; - t_hipctl *x_ctl; - float x_f; -} t_hip; - -t_class *hip_class; - -static void hip_ft1(t_hip *x, t_floatarg f); - -static void *hip_new(t_floatarg f) -{ - t_hip *x = (t_hip *)pd_new(hip_class); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("ft1")); - outlet_new(&x->x_obj, gensym("float")); - x->x_ctl = &x->x_cspace; - x->x_cspace.c_x = 0; - hip_ft1(x, f); - x->x_f = 0; - return (x); -} - -static void hip_ft1(t_hip *x, t_floatarg f) -{ - if (f < 0.001) f = 10; - x->x_hz = f; - x->x_ctl->c_coef = 1 - f * (2 * 3.14159f); - if (x->x_ctl->c_coef < 0) x->x_ctl->c_coef = 0; -} - -static void hip_perform(t_hip *x, t_float in) -{ - t_hipctl *c = x->x_ctl; - float last = c->c_x; - float coef = c->c_coef; - float out; - - float new = in + coef * last; - out = new - last; - last = new; - - /* NAN protect */ - if (!((last <= 0) || (last >= 0))) - last = 0; - c->c_x = last; - - outlet_float(x->x_obj.ob_outlet, out); -} - -static void hip_clear(t_hip *x, t_floatarg q) -{ - x->x_cspace.c_x = 0; -} - -void hip_setup(void) -{ - hip_class = class_new(gensym("hip"), (t_newmethod)hip_new, 0, - sizeof(t_hip), 0, A_DEFFLOAT, 0); - class_addfloat(hip_class, (t_method)hip_perform); - class_addmethod(hip_class, (t_method)hip_ft1, - gensym("ft1"), A_FLOAT, 0); - class_addmethod(hip_class, (t_method)hip_clear, gensym("clear"), 0); -} \ No newline at end of file diff --git a/source/hist.c b/source/hist.c deleted file mode 100644 index ba492f2..0000000 --- a/source/hist.c +++ /dev/null @@ -1,155 +0,0 @@ -#include "defines.h" - -/*--------------- hist ---------------*/ - - -static t_class *hist_class; - -typedef struct _hist -{ - t_object x_obj; - float m_lo; - float m_hi; - float m_scale; - int m_nbins; - int m_n_observations; - float *m_hist; -} t_hist; - - -static void hist_perform_float(t_hist *x, t_float f) -{ - int j; - j=(int)(.5+(f-x->m_lo)*x->m_scale); - j=(j>0)?(jm_nbins?j:x->m_nbins-1):0; // limit without IF - x->m_hist[j]++; - x->m_n_observations++; -} - -static void hist_perform_list(t_hist *x, t_symbol *s, int argc, t_atom *argv) -{ - int i,j; - for (i = 0; i < argc; i++) - { - j=(int)(.5f+(atom_getfloat(&argv[i])-x->m_lo)*x->m_scale); - j=(j>0)?(jm_nbins?j:x->m_nbins-1):0; // limit without IF - x->m_hist[j]++; - } - x->m_n_observations+=argc; -} - -static void hist_bang(t_hist *x) -{ - int i,n; - float *f; - t_atom *ap,*app; - - n=x->m_nbins; - ap = (t_atom *)getbytes(sizeof(t_atom)*n); - app=ap; - - i=x->m_nbins; - f=x->m_hist; - - while(i--){ - SETFLOAT(app, *f); - f++; - app++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),n,ap); - freebytes(ap, sizeof(t_atom)*n); -} - -static void hist_relative(t_hist *x) -{ - int i,n; - float *f; - float invn; - t_atom *ap,*app; - n=x->m_nbins; - ap = (t_atom *)getbytes(sizeof(t_atom)*n); - app=ap; - - invn=1.0f/(1e-10f+x->m_n_observations); - - i=n; - f=x->m_hist; - - while(i--){ - SETFLOAT(app, (*f*invn)); - f++; - app++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),n,ap); - freebytes(ap, sizeof(t_atom)*n); -} - -static void hist_clear(t_hist *x) -{ - int i; - float *f; - f=x->m_hist; - for (i=0;im_nbins;i++) - *f++=0.0f; - x->m_n_observations=0; -} - - -static void hist_set(t_hist *x, t_float lo, t_float hi, t_float nbins) -{ - if (nbins<1) - { - nbins=1; - post("hist: number of bins is minimum 1..."); - } - if (hi<=lo) - { - post("hist: higher bound must be higher than lower bound..."); - hi=lo+1.0f; - } - - freebytes(x->m_hist, x->m_nbins); - - x->m_hi=hi; - x->m_lo=lo; - x->m_nbins=(int)nbins; - x->m_scale=(float)x->m_nbins/(hi-lo); - x->m_hist = (float*)getbytes(sizeof(float)*x->m_nbins); - - hist_clear(x); -} - -static void *hist_new(t_float lo, t_float hi, t_float nbins) -{ - t_hist *x=(t_hist *)pd_new(hist_class); - outlet_new(&x->x_obj, gensym("list")); - x->m_hist=0; - x->m_nbins=0; - hist_set(x, lo, hi, nbins); - return (void *)x; -} - -static void hist_free(t_hist *x) -{ - freebytes(x->m_hist, x->m_nbins); -} - -void hist_setup(void) -{ - hist_class = class_new(gensym("hist"), - (t_newmethod)hist_new, (t_method)hist_free, - sizeof(t_hist), - CLASS_DEFAULT, - A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT,0); - - class_addmethod(hist_class, (t_method)hist_clear, gensym("clear"),0); - class_addmethod(hist_class, (t_method)hist_bang, gensym("absolute"),0); - class_addmethod(hist_class, (t_method)hist_relative, gensym("relative"),0); - - class_addmethod(hist_class, (t_method)hist_set, gensym("set"),A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT,0); - - class_addlist(hist_class, (t_method)hist_perform_list); - class_addfloat(hist_class, (t_method)hist_perform_float); - class_addbang(hist_class, (t_method)hist_bang); -} - diff --git a/source/itov.c b/source/itov.c deleted file mode 100644 index fa68a90..0000000 --- a/source/itov.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "defines.h" - -/*--------------- itov ---------------*/ - - -static t_class *itov_class; - -typedef struct _itov -{ - t_object x_obj; - t_outlet *f_out1; - t_outlet *f_out2; - t_outlet *f_out3; - float m_lo; - float m_hi; - float m_scale; - int m_nbins; -} t_itov; - - -static void itov_perform_float(t_itov *x, t_float j) -{ - float i; - j-=1.0f; - j=(j>0)?(jm_nbins?j:x->m_nbins-1):0; // limit without IF - -// j=(int)((f-x->m_lo)*x->m_scale); - i=(j/x->m_scale)-x->m_lo; - - outlet_float(x->f_out2, i); - -} - -static void itov_perform_list(t_itov *x, t_symbol *s, int argc, t_atom *argv) -{ - - -} - -static void itov_set(t_itov *x, t_float lo, t_float hi, t_float nbins) -{ - if (nbins<1) - { - nbins=1; - post("itov: number of bins is minimum 1..."); - } - if (hi<=lo) - { - post("itov: higher bound must be higher than lower bound..."); - hi=lo+1.0f; - } - - x->m_hi=hi; - x->m_lo=lo; - x->m_nbins=(int)nbins; - x->m_scale=(float)x->m_nbins/(hi-lo); -} - -static void *itov_new(t_float lo, t_float hi, t_float nbins) -{ - t_itov *x=(t_itov *)pd_new(itov_class); - x->f_out1=outlet_new(&x->x_obj, gensym("float")); - x->f_out2=outlet_new(&x->x_obj, gensym("float")); - x->f_out3=outlet_new(&x->x_obj, gensym("float")); - - x->m_nbins=0; - itov_set(x, lo, hi, nbins); - return (void *)x; -} - -static void itov_free(t_itov *x) -{ -} - -void itov_setup(void) -{ - itov_class = class_new(gensym("itov"), - (t_newmethod)itov_new, (t_method)itov_free, - sizeof(t_itov), - CLASS_DEFAULT, - A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT,0); - -// class_addlist(itov_class, (t_method)itov_perform_list); - class_addfloat(itov_class, (t_method)itov_perform_float); -} - diff --git a/source/lavg.c b/source/lavg.c deleted file mode 100644 index fce0015..0000000 --- a/source/lavg.c +++ /dev/null @@ -1,55 +0,0 @@ -#include "defines.h" - -/*--------------- lavg ---------------*/ - -static t_class *lavg_class; - -typedef struct _lavg -{ - t_object x_obj; - float m_avg; - float m_c_leak; - float m_leak; -} t_lavg; - - -static void lavg_perform(t_lavg *x, t_float in) -{ - x->m_avg= x->m_avg * x->m_c_leak + in * x->m_leak; - outlet_float(x->x_obj.ob_outlet, x->m_avg); -} - -static void lavg_clear(t_lavg *x) -{ - x->m_avg=0.0f; -} - -static void lavg_setHalfDecay(t_lavg *x, t_float halfDecayTime) -{ - x->m_c_leak=(float)powf(.5,(1.0f/halfDecayTime)); - x->m_leak=1.0f-x->m_c_leak; -} - -static void *lavg_new( t_float halfDecayTime) -{ - t_lavg *x=(t_lavg *)pd_new(lavg_class); - outlet_new(&x->x_obj, gensym("float")); - - lavg_setHalfDecay(x, halfDecayTime); - return (void *)x; -} - -void lavg_setup(void) -{ - lavg_class = class_new(gensym("lavg"), - (t_newmethod)lavg_new, 0, - sizeof(t_lavg), - CLASS_DEFAULT, - A_DEFFLOAT, 0); - class_addfloat(lavg_class, (t_method)lavg_perform); - class_addmethod(lavg_class, (t_method)lavg_setHalfDecay, - gensym("decay"), A_DEFFLOAT, NULL); - class_addmethod(lavg_class, (t_method)lavg_clear, - gensym("clear"), 0); -} - diff --git a/source/lhist.c b/source/lhist.c deleted file mode 100644 index ea20edc..0000000 --- a/source/lhist.c +++ /dev/null @@ -1,174 +0,0 @@ -#include "defines.h" - -/*--------------- lhist ---------------*/ - -static t_class *lhist_class; - -typedef struct _lhist -{ - t_object x_obj; - float m_lo; - float m_hi; - float m_scale; - float m_c_leak; - float m_leak; - int m_nbins; -// int m_n_observations; - float *m_lhist; -} t_lhist; - -static void lhist_setHalfDecay(t_lhist *x, t_float halfDecayTime) -{ - x->m_c_leak=(float)powf(.5,(1.0f/halfDecayTime)); - x->m_leak=1.0f-x->m_c_leak; -} - -static void lhist_perform_float(t_lhist *x, t_float f) -{ - int j; - j=(int)(.5+(f-x->m_lo)*x->m_scale); - j=(j>0)?(jm_nbins?j:x->m_nbins-1):0; // limit without IF - x->m_lhist[j]++; -// x->m_n_observations++; -} - -static void lhist_perform_list(t_lhist *x, t_symbol *s, int argc, t_atom *argv) -{ - int i,j; - for (i = 0; i < argc; i++) - { - j=(int)(.5f+(atom_getfloat(&argv[i])-x->m_lo)*x->m_scale); - j=(j>0)?(jm_nbins?j:x->m_nbins-1):0; // limit without IF - x->m_lhist[j]++; - } -// x->m_n_observations+=argc; -} - -static void lhist_leak(t_lhist *x) -{ - int i; - float *f; - float sc; - f=x->m_lhist; - sc=x->m_c_leak; - i=x->m_nbins; - while(i--) - *f++*=sc; -} - -static void lhist_bang(t_lhist *x) -{ - int i,n; - float *f; - t_atom *ap,*app; - n=x->m_nbins; - ap = (t_atom *)getbytes(sizeof(t_atom)*n); - app=ap; - i=n; - f=x->m_lhist; - - while(i--){ - SETFLOAT(app, *f); - f++; - app++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),n,ap); - freebytes(ap,n); -} - -static void lhist_relative(t_lhist *x) -{ - int i,n; - float *f; - float invn,sum; - t_atom *ap,*app; - - n=x->m_nbins; - ap = (t_atom *)getbytes(sizeof(t_atom)*n); - app=ap; - i=x->m_nbins; - f=x->m_lhist; - sum=0.0f; - while(i--) sum+=*f++; - invn=1.0f/(1e-10f+sum); - - i=x->m_nbins; - f=x->m_lhist; - - while(i--){ - SETFLOAT(app, (*f*invn)); - f++; - app++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),n,ap); - freebytes(ap,n); -} - -static void lhist_clear(t_lhist *x) -{ - int i; - float *f; - f=x->m_lhist; - for (i=0;im_nbins;i++) - *f++=0.0f; -// x->m_n_observations=0; -} - -static void lhist_set(t_lhist *x, t_float lo, t_float hi, t_float nbins) -{ - if (nbins<1) - { - nbins=1; - post("lhist: number of bins is minimum 1..."); - } - if (hi<=lo) - { - post("lhist: higher bound must be higher than lower bound..."); - hi=lo+1.0f; - } - freebytes(x->m_lhist, x->m_nbins); - x->m_hi=hi; - x->m_lo=lo; - x->m_nbins=(int)nbins; - x->m_scale=(float)x->m_nbins/(hi-lo); - x->m_lhist = (float*)getbytes(sizeof(float)*x->m_nbins); - - lhist_clear(x); -} - -static void *lhist_new(t_float lo, t_float hi, t_float nbins, t_float decay) -{ - t_lhist *x=(t_lhist *)pd_new(lhist_class); - outlet_new(&x->x_obj, gensym("list")); - lhist_setHalfDecay(x,decay); - x->m_nbins=0; - x->m_lhist=0; - lhist_set(x, lo, hi, nbins); - return (void *)x; -} - -static void lhist_free(t_lhist *x) -{ - freebytes(x->m_lhist, x->m_nbins); -} - -void lhist_setup(void) -{ - lhist_class = class_new(gensym("lhist"), - (t_newmethod)lhist_new, (t_method)lhist_free, - sizeof(t_lhist), - CLASS_DEFAULT, - A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT,A_DEFFLOAT,0); - - class_addmethod(lhist_class, (t_method)lhist_clear, gensym("clear"),0); - class_addmethod(lhist_class, (t_method)lhist_bang, gensym("absolute"),0); - class_addmethod(lhist_class, (t_method)lhist_relative, gensym("relative"),0); - class_addmethod(lhist_class, (t_method)lhist_leak, gensym("leak"),0); - class_addmethod(lhist_class, (t_method)lhist_setHalfDecay, - gensym("decay"), A_DEFFLOAT, NULL); - - class_addlist(lhist_class, (t_method)lhist_perform_list); - class_addfloat(lhist_class, (t_method)lhist_perform_float); - class_addbang(lhist_class, (t_method)lhist_bang); -} - diff --git a/source/lhisti.c b/source/lhisti.c deleted file mode 100644 index 826cce4..0000000 --- a/source/lhisti.c +++ /dev/null @@ -1,174 +0,0 @@ -#include "defines.h" - -/*--------------- lhisti ---------------*/ -// ignores samples outside bins - -static t_class *lhisti_class; - -typedef struct _lhisti -{ - t_object x_obj; - float m_lo; - float m_hi; - float m_scale; - float m_c_leak; - float m_leak; - int m_nbins; -// int m_n_observations; - float *m_lhisti; -} t_lhisti; - -static void lhisti_setHalfDecay(t_lhisti *x, t_float halfDecayTime) -{ - x->m_c_leak=(float)powf(.5,(1.0f/halfDecayTime)); - x->m_leak=1.0f-x->m_c_leak; -} - -static void lhisti_perform_float(t_lhisti *x, t_float f) -{ - int j; - j=(int)(.5+(f-x->m_lo)*x->m_scale); - if ((j>=0)&&(jm_nbins)) - x->m_lhisti[j]++; -} - -static void lhisti_perform_list(t_lhisti *x, t_symbol *s, int argc, t_atom *argv) -{ - int i,j; - for (i = 0; i < argc; i++) - { - j=(int)(.5f+(atom_getfloat(&argv[i])-x->m_lo)*x->m_scale); - if ((j>=0)&&(jm_nbins)) - x->m_lhisti[j]++; - } -// x->m_n_observations+=argc; -} - -static void lhisti_leak(t_lhisti *x) -{ - int i; - float *f; - float sc; - f=x->m_lhisti; - sc=x->m_c_leak; - i=x->m_nbins; - while(i--) - *f++*=sc; -} - -static void lhisti_bang(t_lhisti *x) -{ - int i,n; - float *f; - t_atom *ap,*app; - n=x->m_nbins; - ap = (t_atom *)getbytes(sizeof(t_atom)*n); - app=ap; - i=n; - f=x->m_lhisti; - - while(i--){ - SETFLOAT(app, *f); - f++; - app++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),n,ap); - freebytes(ap,n); -} - -static void lhisti_relative(t_lhisti *x) -{ - int i,n; - float *f; - float invn,sum; - t_atom *ap,*app; - - n=x->m_nbins; - ap = (t_atom *)getbytes(sizeof(t_atom)*n); - app=ap; - i=x->m_nbins; - f=x->m_lhisti; - sum=0.0f; - while(i--) sum+=*f++; - invn=1.0f/(1e-10f+sum); - - i=x->m_nbins; - f=x->m_lhisti; - - while(i--){ - SETFLOAT(app, (*f*invn)); - f++; - app++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),n,ap); - freebytes(ap,n); -} - -static void lhisti_clear(t_lhisti *x) -{ - int i; - float *f; - f=x->m_lhisti; - for (i=0;im_nbins;i++) - *f++=0.0f; -// x->m_n_observations=0; -} - -static void lhisti_set(t_lhisti *x, t_float lo, t_float hi, t_float nbins) -{ - if (nbins<1) - { - nbins=1; - post("lhisti: number of bins is minimum 1..."); - } - if (hi<=lo) - { - post("lhisti: higher bound must be higher than lower bound..."); - hi=lo+1.0f; - } - freebytes(x->m_lhisti, x->m_nbins); - x->m_hi=hi; - x->m_lo=lo; - x->m_nbins=(int)nbins; - x->m_scale=(float)x->m_nbins/(hi-lo); - x->m_lhisti = (float*)getbytes(sizeof(float)*x->m_nbins); - - lhisti_clear(x); -} - -static void *lhisti_new(t_float lo, t_float hi, t_float nbins, t_float decay) -{ - t_lhisti *x=(t_lhisti *)pd_new(lhisti_class); - outlet_new(&x->x_obj, gensym("list")); - lhisti_setHalfDecay(x,decay); - x->m_nbins=0; - x->m_lhisti=0; - lhisti_set(x, lo, hi, nbins); - return (void *)x; -} - -static void lhisti_free(t_lhisti *x) -{ - freebytes(x->m_lhisti, x->m_nbins); -} - -void lhisti_setup(void) -{ - lhisti_class = class_new(gensym("lhisti"), - (t_newmethod)lhisti_new, (t_method)lhisti_free, - sizeof(t_lhisti), - CLASS_DEFAULT, - A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT,A_DEFFLOAT,0); - - class_addmethod(lhisti_class, (t_method)lhisti_clear, gensym("clear"),0); - class_addmethod(lhisti_class, (t_method)lhisti_bang, gensym("absolute"),0); - class_addmethod(lhisti_class, (t_method)lhisti_relative, gensym("relative"),0); - class_addmethod(lhisti_class, (t_method)lhisti_leak, gensym("leak"),0); - class_addmethod(lhisti_class, (t_method)lhisti_setHalfDecay, - gensym("decay"), A_DEFFLOAT, NULL); - - class_addlist(lhisti_class, (t_method)lhisti_perform_list); - class_addfloat(lhisti_class, (t_method)lhisti_perform_float); - class_addbang(lhisti_class, (t_method)lhisti_bang); -} - diff --git a/source/linspace.c b/source/linspace.c deleted file mode 100644 index c3af9c2..0000000 --- a/source/linspace.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "defines.h" - -/*--------------- linspace ----------------*/ -/* clips a vector */ - - -static t_class *linspace_class; - -typedef struct _linspace -{ - t_object x_obj; - float m_lo; - float m_hi; - float m_n; -} t_linspace; - - -static void linspace_bang(t_linspace *x) -{ - int n; - n=(int)x->m_n; - if ((n<256)&&(n>1)) - { - int i; - float lo,step; - t_atom *ap,*app; - - ap = (t_atom *)getbytes(sizeof(t_atom)*n); - app=ap; - lo=x->m_lo; - step=(x->m_hi-lo)/(n-1); - for (i = 0; i < n; i++) - { - - SETFLOAT(app, lo); - app++; - lo+=step; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),n,ap); - freebytes(ap,n); - } -} - -static void linspace_float(t_linspace *x, t_float lo) -{ - x->m_lo=lo; - linspace_bang(x); -} - -static void *linspace_new(t_float lo, t_float hi, t_float n) -{ - t_linspace *x=(t_linspace *)pd_new(linspace_class); - - floatinlet_new(&x->x_obj, &x->m_hi); - floatinlet_new(&x->x_obj, &x->m_n); - - outlet_new(&x->x_obj, gensym("list")); - x->m_lo=lo; - x->m_hi=hi; - x->m_n=n; - return (void *)x; -} - -void linspace_setup(void) -{ - linspace_class = class_new(gensym("linspace"), - (t_newmethod)linspace_new, 0, - sizeof(t_linspace), - CLASS_DEFAULT, - A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); - class_addfloat(linspace_class, (t_method)linspace_float); - class_addbang(linspace_class, (t_method)linspace_bang); -} - diff --git a/source/lmax.c b/source/lmax.c deleted file mode 100644 index 911304f..0000000 --- a/source/lmax.c +++ /dev/null @@ -1,57 +0,0 @@ -#include "defines.h" - -/*--------------- lmax ---------------*/ - -static t_class *lmax_class; - -typedef struct _lmax -{ - t_object x_obj; - float m_max; - float m_leak; - float m_c_leak; -} t_lmax; - - -static void lmax_perform(t_lmax *x, t_float in) -{ - x->m_max=(in > x->m_max) ? in : x->m_max * x->m_c_leak + in * x->m_leak; - outlet_float(x->x_obj.ob_outlet, x->m_max); -} - -static void lmax_setHalfDecay(t_lmax *x, t_float halfDecayTime) -{ - x->m_c_leak=(float)powf(.5,(1.0f/halfDecayTime)); - x->m_leak=1.0f-x->m_c_leak; -} - -static void lmax_clear(t_lmax *x) -{ - x->m_max= - MAXFLOAT; -} - -static void *lmax_new( t_float halfDecayTime) -{ - t_lmax *x=(t_lmax *)pd_new(lmax_class); - outlet_new(&x->x_obj, gensym("float")); - - lmax_setHalfDecay(x, halfDecayTime); - lmax_clear(x); - return (void *)x; -} - - -void lmax_setup(void) -{ - lmax_class = class_new(gensym("lmax"), - (t_newmethod)lmax_new, 0, - sizeof(t_lmax), - CLASS_DEFAULT, - A_DEFFLOAT, 0); - class_addfloat(lmax_class, (t_method)lmax_perform); - class_addmethod(lmax_class, (t_method)lmax_clear, - gensym("clear"), A_GIMME, NULL); - class_addmethod(lmax_class, (t_method)lmax_setHalfDecay, - gensym("decay"), A_DEFFLOAT, NULL); -} - diff --git a/source/lmin.c b/source/lmin.c deleted file mode 100644 index 51b333a..0000000 --- a/source/lmin.c +++ /dev/null @@ -1,57 +0,0 @@ -#include "defines.h" - -/*--------------- lmin ---------------*/ - -static t_class *lmin_class; - -typedef struct _lmin -{ - t_object x_obj; - float m_min; - float m_leak; - float m_c_leak; -} t_lmin; - - -static void lmin_perform(t_lmin *x, t_float in) -{ - x->m_min=(in < x->m_min) ? in : x->m_min * x->m_c_leak + in * x->m_leak; - outlet_float(x->x_obj.ob_outlet, x->m_min); -} - -static void lmin_setHalfDecay(t_lmin *x, t_float halfDecayTime) -{ - x->m_c_leak=(float)powf(.5,(1.0f/halfDecayTime)); - x->m_leak=1.0f-x->m_c_leak; -} - -static void lmin_clear(t_lmin *x) -{ - x->m_min= MAXFLOAT; -} - -static void *lmin_new( t_float halfDecayTime) -{ - t_lmin *x=(t_lmin *)pd_new(lmin_class); - outlet_new(&x->x_obj, gensym("float")); - - lmin_setHalfDecay(x, halfDecayTime); - lmin_clear(x); - return (void *)x; -} - - -void lmin_setup(void) -{ - lmin_class = class_new(gensym("lmin"), - (t_newmethod)lmin_new, 0, - sizeof(t_lmin), - CLASS_DEFAULT, - A_DEFFLOAT, 0); - class_addfloat(lmin_class, (t_method)lmin_perform); - class_addmethod(lmin_class, (t_method)lmin_clear, - gensym("clear"), A_GIMME, NULL); - class_addmethod(lmin_class, (t_method)lmin_setHalfDecay, - gensym("decay"), A_DEFFLOAT, NULL); -} - diff --git a/source/lrange.c b/source/lrange.c deleted file mode 100644 index 8f5b296..0000000 --- a/source/lrange.c +++ /dev/null @@ -1,60 +0,0 @@ -#include "defines.h" - -/*--------------- lrange ---------------*/ - -static t_class *lrange_class; - -typedef struct _lrange -{ - t_object x_obj; - float m_min; - float m_max; - float m_c_leak; - float m_leak; -} t_lrange; - - -static void lrange_perform(t_lrange *x, t_float in) -{ - x->m_max=(in > x->m_max) ? in : x->m_max * x->m_c_leak + in * x->m_leak; - x->m_min=(in < x->m_min) ? in : x->m_min * x->m_c_leak + in * x->m_leak; - outlet_float(x->x_obj.ob_outlet, x->m_max-x->m_min); -} - -static void lrange_setHalfDecay(t_lrange *x, t_float halfDecayTime) -{ - x->m_c_leak=(float)powf(.5,(1.0f/halfDecayTime)); - x->m_leak=1.0f-x->m_c_leak; -} - -static void lrange_clear(t_lrange *x) -{ - x->m_max = - MAXFLOAT; - x->m_min = MAXFLOAT; -} - -static void *lrange_new( t_float halfDecayTime) -{ - t_lrange *x=(t_lrange *)pd_new(lrange_class); - outlet_new(&x->x_obj, gensym("float")); - - lrange_setHalfDecay(x, halfDecayTime); - lrange_clear(x); - return (void *)x; -} - - -void lrange_setup(void) -{ - lrange_class = class_new(gensym("lrange"), - (t_newmethod)lrange_new, 0, - sizeof(t_lrange), - CLASS_DEFAULT, - A_DEFFLOAT, 0); - class_addfloat(lrange_class, (t_method)lrange_perform); - class_addmethod(lrange_class, (t_method)lrange_clear, - gensym("clear"), A_GIMME, NULL); - class_addmethod(lrange_class, (t_method)lrange_setHalfDecay, - gensym("decay"), A_DEFFLOAT, NULL); -} - diff --git a/source/lstd.c b/source/lstd.c deleted file mode 100644 index 1873bda..0000000 --- a/source/lstd.c +++ /dev/null @@ -1,60 +0,0 @@ -#include "defines.h" - -/*--------------- lstd ---------------*/ - -static t_class *lstd_class; - -typedef struct _lstd -{ - t_object x_obj; - float m_avg; - float m_sum_squares; - float m_std; - float m_c_leak; - float m_leak; -} t_lstd; - - -static void lstd_perform(t_lstd *x, t_float in) -{ - float tmp=x->m_avg-in; - x->m_avg= x->m_avg * x->m_c_leak + in * x->m_leak; - x->m_sum_squares=x->m_sum_squares * x->m_c_leak + x->m_leak*tmp*tmp; - x->m_std=(float)sqrtf(x->m_sum_squares); - outlet_float(x->x_obj.ob_outlet, x->m_std); -} - -static void lstd_setHalfDecay(t_lstd *x, t_float halfDecayTime) -{ - x->m_c_leak=(float)powf(.5,(1.0f/halfDecayTime)); - x->m_leak=1.0f-x->m_c_leak; -} - -static void lstd_clear(t_lstd *x) -{ - x->m_sum_squares=0.0f; - x->m_avg=0.0f; -} - -static void *lstd_new( t_float halfDecayTime) -{ - t_lstd *x=(t_lstd *)pd_new(lstd_class); - outlet_new(&x->x_obj, gensym("float")); - - lstd_setHalfDecay(x, halfDecayTime); - return (void *)x; -} - - -void lstd_setup(void) -{ - lstd_class = class_new(gensym("lstd"), - (t_newmethod)lstd_new, 0, - sizeof(t_lstd), - CLASS_DEFAULT, - A_DEFFLOAT, 0); - class_addfloat(lstd_class, (t_method)lstd_perform); - class_addmethod(lstd_class, (t_method)lstd_setHalfDecay, - gensym("decay"), A_DEFFLOAT, NULL); -} - diff --git a/source/prevl.c b/source/prevl.c deleted file mode 100644 index 2ba39ce..0000000 --- a/source/prevl.c +++ /dev/null @@ -1,161 +0,0 @@ -#include "defines.h" - -/*--------------- prevl ---------------*/ - -static t_class *prevl_class; - -typedef struct _prevl -{ - t_object x_obj; - float m_lo; - float m_hi; - int m_buffer_size; - int m_buffer_index; - float *m_buffer; // circular buffer -} t_prevl; - - -static void prevl_perform_float(t_prevl *x, t_float f) -{ - int index; - index=x->m_buffer_index+1; - index=(index==x->m_buffer_size)?0:index; - x->m_buffer_index=index; - x->m_buffer[index]=f; -} - -static void prevl_bang(t_prevl *x) -{ - int lo,hi,n,index,size; - t_atom *ap,*app; - float *buffer, *bp; - - lo=(int)x->m_lo; - hi=(int)x->m_hi; - - n=hi-lo; - size=x->m_buffer_size; - index=x->m_buffer_index; - ap = (t_atom *)getbytes(sizeof(t_atom)*n); - app=ap; - buffer=x->m_buffer; - bp=buffer+index-lo; - bp=(bp>=buffer)?bp:bp+size; // wrap - - if (bp-buffer>=n) - { // no wrap-around needed - index=n; - while(index--){ - SETFLOAT(app, *bp--); - app++; - } -// post("not wrapped, app-ap=%i",app-ap); - } - else // need to wrap - { - int ps, nn; - ps = bp-buffer; - nn=n; -// post(" nn=%i",nn); - for(;ps>=0;ps--) // don't we miss one sample in signal??? - { -// post("ps=%i",ps); - SETFLOAT(app, buffer[ps]); - app++; - nn--; - } - ps=size-1; -// post(" nn=%i",nn); - for(;nn>0;nn--) - { -// post("ps=%i",ps); - SETFLOAT(app, buffer[ps--]); - app++; - } - - } - - outlet_list(x->x_obj.ob_outlet,gensym("list"),n,ap); - freebytes(ap, sizeof(t_atom)*n); -} - -static void prevl_clear(t_prevl *x) -{ - int i,s; - float *f; - f=x->m_buffer; - s=x->m_buffer_size; - for (i=0;isize) - { - post("prevl: higher bound cannot be higher than the buffer size..."); - hi=size; - } - if (lo<0) - { - post("prevl: lower bound cannot be negative..."); - lo=0; - } - if (hi<1) - { - post("prevl: higher bound cannot be smaller than one..."); - hi=1; - } - if (hi<=lo) - { - post("prevl: higher bound must be higher than lower bound..."); - lo=hi-1.0f; - } - - freebytes(x->m_buffer, x->m_buffer_size); - - x->m_hi=(float)((int)hi); - x->m_lo=(float)((int)lo); - x->m_buffer_size=(int)size; - x->m_buffer = (float*)getbytes(sizeof(float)*x->m_buffer_size); - prevl_clear(x); - x->m_buffer_index=0; -} - -static void *prevl_new(t_float lo, t_float hi, t_float size) -{ - t_prevl *x=(t_prevl *)pd_new(prevl_class); - outlet_new(&x->x_obj, gensym("list")); - x->m_buffer_size=0; - x->m_buffer=0; - prevl_set(x, lo, hi, size); - - floatinlet_new(&x->x_obj, &x->m_lo); - floatinlet_new(&x->x_obj, &x->m_hi); - - return (void *)x; -} - -static void prevl_free(t_prevl *x) -{ - freebytes(x->m_buffer, x->m_buffer_size); -} - -void prevl_setup(void) -{ - prevl_class = class_new(gensym("prevl"), - (t_newmethod)prevl_new, (t_method)prevl_free, - sizeof(t_prevl), - CLASS_DEFAULT, - A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT,0); - - class_addmethod(prevl_class, (t_method)prevl_clear, gensym("clear"),0); - class_addfloat(prevl_class, (t_method)prevl_perform_float); - class_addbang(prevl_class, (t_method)prevl_bang); -} - diff --git a/source/threshold.c b/source/threshold.c deleted file mode 100644 index 2d99e03..0000000 --- a/source/threshold.c +++ /dev/null @@ -1,112 +0,0 @@ -/* --------------------- threshold ----------------------------- */ - -#include "defines.h" - -static t_class *threshold_class; - -typedef struct _threshold -{ - t_object x_obj; - t_outlet *x_outlet1; /* bang out for high thresh */ - t_outlet *x_outlet2; /* bang out for low thresh */ - t_clock *x_clock; /* wakeup for message output */ - int x_state; /* 1 = high, 0 = low */ - float x_hithresh; /* value of high threshold */ - float x_lothresh; /* value of low threshold */ - float x_deadwait; /* msec remaining in dead period */ - float x_hideadtime; /* hi dead */ - float x_lodeadtime; /* lo dead */ -} t_threshold; - -static void threshold_tick(t_threshold *x); -static void threshold_set(t_threshold *x, - t_floatarg hithresh, t_floatarg hideadtime, - t_floatarg lothresh, t_floatarg lodeadtime); - -static t_threshold *threshold_new(t_floatarg hithresh, - t_floatarg hideadtime, t_floatarg lothresh, t_floatarg lodeadtime) -{ - t_threshold *x = (t_threshold *) - pd_new(threshold_class); - x->x_state = 0; /* low state */ - x->x_deadwait = 0; /* no dead time */ - x->x_clock = clock_new(x, (t_method)threshold_tick); - x->x_outlet1 = outlet_new(&x->x_obj, gensym("bang")); - x->x_outlet2 = outlet_new(&x->x_obj, gensym("bang")); - threshold_set(x, hithresh, hideadtime, lothresh, lodeadtime); - return (x); -} - - /* "set" message to specify thresholds and dead times */ -static void threshold_set(t_threshold *x, - t_floatarg hithresh, t_floatarg hideadtime, - t_floatarg lothresh, t_floatarg lodeadtime) -{ - if (lothresh > hithresh) - lothresh = hithresh; - x->x_hithresh = hithresh; - x->x_hideadtime = hideadtime; - x->x_lothresh = lothresh; - x->x_lodeadtime = lodeadtime; -} - - /* number in inlet sets state -- note incompatible with JMAX which used - "int" message for this, impossible here because of auto signal conversion */ -static void threshold_ft1(t_threshold *x, t_floatarg f) -{ - x->x_state = (f != 0); - x->x_deadwait = 0; -} - -static void threshold_tick(t_threshold *x) -{ - if (x->x_state) - outlet_bang(x->x_outlet1); - else outlet_bang(x->x_outlet2); -} - -static void threshold_perform(t_threshold *x, t_float in) -{ - if (x->x_deadwait > 0) - x->x_deadwait -= 1; - else if (x->x_state) - { - /* we're high; look for low sample */ - if (in < x->x_lothresh) - { - clock_delay(x->x_clock, 0L); - x->x_state = 0; - x->x_deadwait = x->x_lodeadtime; - } - } - else - { - /* we're low; look for high sample */ - if (in >= x->x_hithresh) - { - clock_delay(x->x_clock, 0L); - x->x_state = 1; - x->x_deadwait = x->x_hideadtime; - } - } -} - - -static void threshold_ff(t_threshold *x) -{ - clock_free(x->x_clock); -} - -void threshold_setup( void) -{ - threshold_class = class_new(gensym("threshold"), - (t_newmethod)threshold_new, (t_method)threshold_ff, - sizeof(t_threshold), 0, - A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); - - class_addfloat(threshold_class, (t_method)threshold_perform); - class_addmethod(threshold_class, (t_method)threshold_set, - gensym("set"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); - class_addmethod(threshold_class, (t_method)threshold_ft1, - gensym("ft1"), A_FLOAT, 0); -} diff --git a/source/vabs.c b/source/vabs.c deleted file mode 100644 index c928c5e..0000000 --- a/source/vabs.c +++ /dev/null @@ -1,48 +0,0 @@ -#include "defines.h" - -/*--------------- vabs ----------------*/ -/* absolute values of a list of floats */ - - -static t_class *vabs_class; - -typedef struct _vabs -{ - t_object x_obj; -} t_vabs; - - -static void vabs_perform(t_vabs *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - t_atom *ap,*app; - ap = (t_atom *)getbytes(sizeof(t_atom)*argc); - app=ap; - - for (i = 0; i < argc; i++) - { - float f=atom_getfloat(argv++); - SETFLOAT(app, f>0?f:-f); - app++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),argc,ap); - freebytes(ap,argc); -} - -static void *vabs_new() -{ - t_vabs *x=(t_vabs *)pd_new(vabs_class); - outlet_new(&x->x_obj, gensym("list")); - return (void *)x; -} - -void vabs_setup(void) -{ - vabs_class = class_new(gensym("vabs"), - (t_newmethod)vabs_new, 0, - sizeof(t_vabs), - CLASS_DEFAULT, - 0); - class_addlist(vabs_class, (t_method)vabs_perform); -} - diff --git a/source/vclip.c b/source/vclip.c deleted file mode 100644 index 4a11ef5..0000000 --- a/source/vclip.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "defines.h" - -/*--------------- vclip ----------------*/ -/* clips a vector */ - - -static t_class *vclip_class; - -typedef struct _vclip -{ - t_object x_obj; - float m_lo; - float m_hi; -} t_vclip; - - -static void vclip_perform(t_vclip *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - float lo,hi; - t_atom *ap,*app; - ap = (t_atom *)getbytes(sizeof(t_atom)*argc); - app=ap; - lo=x->m_lo; - hi=x->m_hi; - for (i = 0; i < argc; i++) - { - float f=atom_getfloat(argv++); - SETFLOAT(app, (fhi?hi:f))); - app++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),argc,ap); - freebytes(ap,argc); -} - -static void *vclip_new(t_float lo, t_float hi) -{ - t_vclip *x=(t_vclip *)pd_new(vclip_class); - - floatinlet_new(&x->x_obj, &x->m_lo); - floatinlet_new(&x->x_obj, &x->m_hi); - - outlet_new(&x->x_obj, gensym("list")); - x->m_hi=hi; - x->m_lo=lo; - return (void *)x; -} - -void vclip_setup(void) -{ - vclip_class = class_new(gensym("vclip"), - (t_newmethod)vclip_new, 0, - sizeof(t_vclip), - CLASS_DEFAULT, - A_DEFFLOAT,A_DEFFLOAT,0); - class_addlist(vclip_class, (t_method)vclip_perform); -} - diff --git a/source/vcog.c b/source/vcog.c deleted file mode 100644 index 1dd68a4..0000000 --- a/source/vcog.c +++ /dev/null @@ -1,43 +0,0 @@ -#include "defines.h" - -/*--------------- vcog ---------------*/ - -static t_class *vcog_class; - -typedef struct _vcog -{ - t_object x_obj; -} t_vcog; - - -static void vcog_perform(t_vcog *x, t_symbol *s, int argc, t_atom *argv) -{ - float sum=0.f; - float wsum=0.0f; - int i; - for (i = 0; i < argc; i++) - { - float tmp=atom_getfloat(&argv[i]); - sum+= tmp; - wsum+= tmp*i; - } - if (sum!=0.0f) outlet_float(x->x_obj.ob_outlet, 1.0f+(wsum/sum)); -} - -static void *vcog_new( t_float halfDecayTime) -{ - t_vcog *x=(t_vcog *)pd_new(vcog_class); - outlet_new(&x->x_obj, gensym("float")); - return (void *)x; -} - -void vcog_setup(void) -{ - vcog_class = class_new(gensym("vcog"), - (t_newmethod)vcog_new, 0, - sizeof(t_vcog), - CLASS_DEFAULT, - 0); - class_addlist(vcog_class, (t_method)vcog_perform); -} - diff --git a/source/vdbtorms.c b/source/vdbtorms.c deleted file mode 100644 index ab954f6..0000000 --- a/source/vdbtorms.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "defines.h" - -/*--------------- vdbtorms ----------------*/ - -static t_class *vdbtorms_class; - -typedef struct _vdbtorms -{ - t_object x_obj; -} t_vdbtorms; - -float dbtorms(float f) -{ - if (f <= 0) - return(0); - else - { - if (f > 485) - f = 485; - } - return (float)(exp((LOGTEN * 0.05) * (f-100.))); -} - -static void vdbtorms_perform(t_vdbtorms *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - t_atom *ap,*app; - ap = (t_atom *)getbytes(sizeof(t_atom)*argc); - app=ap; - - for (i = 0; i < argc; i++) - { - SETFLOAT(app, dbtorms(atom_getfloat(argv++))); - app++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),argc,ap); - freebytes(ap,argc); -} - -static void *vdbtorms_new() -{ - t_vdbtorms *x=(t_vdbtorms *)pd_new(vdbtorms_class); - outlet_new(&x->x_obj, gensym("list")); - return (void *)x; -} - -void vdbtorms_setup(void) -{ - vdbtorms_class = class_new(gensym("vdbtorms"), - (t_newmethod)vdbtorms_new, 0, - sizeof(t_vdbtorms), - CLASS_DEFAULT, - 0); - class_addlist(vdbtorms_class, (t_method)vdbtorms_perform); -} - diff --git a/source/vdelta.c b/source/vdelta.c deleted file mode 100644 index cc809db..0000000 --- a/source/vdelta.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "defines.h" - -/*--------------- vdelta ----------------------------*/ -/* differences between element in succesive vectors */ - -static t_class *vdelta_class; - -typedef struct _vdelta -{ - t_object x_obj; - float m_c_leak; - float m_leak; - float *m_prev; - int m_n; -} t_vdelta; - - -static void vdelta_perform(t_vdelta *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - t_atom *ap,*app; - float *fp; - float m_leak; - float m_c_leak; - m_leak=x->m_leak; - m_c_leak=x->m_c_leak; - - if (argc!=x->m_n) - { - int i; - if (x->m_prev) - freebytes(x->m_prev,x->m_n); - x->m_prev=(float*)getbytes(argc*sizeof(float)); - for(i=0;im_prev[i]=0.0f; - x->m_n=argc; - } - - fp=x->m_prev; - ap = (t_atom *)getbytes(sizeof(t_atom)*argc); - app=ap; - for (i = 0; i < argc; i++) - { - float f=atom_getfloat(argv++); - SETFLOAT(app, f-*fp); - app++; - *fp++=f; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),argc,ap); - freebytes(ap,argc); -} - -static void *vdelta_new() -{ - t_vdelta *x=(t_vdelta *)pd_new(vdelta_class); - outlet_new(&x->x_obj, gensym("list")); - x->m_n=0; - x->m_prev=0; - return (void *)x; -} - -static void vdelta_free(t_vdelta *x) -{ - freebytes(x->m_prev,x->m_n); -} - -void vdelta_setup(void) -{ - vdelta_class = class_new(gensym("vdelta"), - (t_newmethod)vdelta_new, (t_method)vdelta_free, - sizeof(t_vdelta), - CLASS_DEFAULT, - 0); - class_addlist(vdelta_class, (t_method)vdelta_perform); -} diff --git a/source/vfmod.c b/source/vfmod.c deleted file mode 100644 index 7b7d1af..0000000 --- a/source/vfmod.c +++ /dev/null @@ -1,57 +0,0 @@ -#include "defines.h" - -/*--------------- vfmod ----------------*/ -/* floating point modulo of a vector */ - - -static t_class *vfmod_class; - -typedef struct _vfmod -{ - t_object x_obj; - float m_y; -} t_vfmod; - - -static void vfmod_perform(t_vfmod *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - float y; - t_atom *ap,*app; - ap = (t_atom *)getbytes(sizeof(t_atom)*argc); - app=ap; - y=x->m_y; - if (y==0.0f) - y=1.0f; - for (i = 0; i < argc; i++) - { - SETFLOAT(app, (float)fmod(atom_getfloat(argv++),y)); - app++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),argc,ap); - freebytes(ap,argc); -} - -static void *vfmod_new(t_float y) -{ - t_vfmod *x=(t_vfmod *)pd_new(vfmod_class); - - floatinlet_new(&x->x_obj, &x->m_y); - - outlet_new(&x->x_obj, gensym("list")); - if (y==0.0f) - y=1.0f; - x->m_y=y; - return (void *)x; -} - -void vfmod_setup(void) -{ - vfmod_class = class_new(gensym("vfmod"), - (t_newmethod)vfmod_new, 0, - sizeof(t_vfmod), - CLASS_DEFAULT, - A_DEFFLOAT,A_DEFFLOAT,0); - class_addlist(vfmod_class, (t_method)vfmod_perform); -} - diff --git a/source/vftom.c b/source/vftom.c deleted file mode 100644 index 6355006..0000000 --- a/source/vftom.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "defines.h" - -/*--------------- vftom ----------------*/ - -static t_class *vftom_class; - -typedef struct _vftom -{ - t_object x_obj; -} t_vftom; - -float ftom(float f) -{ - return (float)(f > 0 ? 17.3123405046 * log(.12231220585 * f) : -1500); -} - -static void vftom_perform(t_vftom *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - t_atom *ap,*app; - ap = (t_atom *)getbytes(sizeof(t_atom)*argc); - app=ap; - - for (i = 0; i < argc; i++) - { - SETFLOAT(app, ftom(atom_getfloat(argv++))); - app++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),argc,ap); - freebytes(ap,argc); -} - -static void *vftom_new() -{ - t_vftom *x=(t_vftom *)pd_new(vftom_class); - outlet_new(&x->x_obj, gensym("list")); - return (void *)x; -} - -void vftom_setup(void) -{ - vftom_class = class_new(gensym("vftom"), - (t_newmethod)vftom_new, 0, - sizeof(t_vftom), - CLASS_DEFAULT, - 0); - class_addlist(vftom_class, (t_method)vftom_perform); -} - diff --git a/source/vlavg.c b/source/vlavg.c deleted file mode 100644 index 1e6ba98..0000000 --- a/source/vlavg.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "defines.h" - -/*--------------- vlavg -----------------------*/ -/* leaky average of each element in a list */ -/* arguments: [halfdecay] */ - -static t_class *vlavg_class; - -typedef struct _vlavg -{ - t_object x_obj; - float m_c_leak; - float m_leak; - float *m_avg; - int m_n; -} t_vlavg; - - -static void vlavg_perform(t_vlavg *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - t_atom *ap,*app; - float *fp; - float m_leak; - float m_c_leak; - m_leak=x->m_leak; - m_c_leak=x->m_c_leak; - - if (argc!=x->m_n) - { - int i; - if (x->m_avg) - freebytes(x->m_avg,x->m_n); - x->m_avg=(float*)getbytes(argc*sizeof(float)); - for(i=0;im_avg[i]=0.0f; - x->m_n=argc; - } - - fp=x->m_avg; - ap = (t_atom *)getbytes(sizeof(t_atom)*argc); - app=ap; - for (i = 0; i < argc; i++) - { - float f=atom_getfloat(argv++); - *fp = *fp * m_c_leak + f * m_leak; - SETFLOAT(app, *fp); - app++; - fp++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),argc,ap); - freebytes(ap,argc); -} - -static void vlavg_setHalfDecay(t_vlavg *x, t_floatarg halfDecayTime) -{ - x->m_c_leak=(float)powf(.5,(1.0f/halfDecayTime)); - x->m_leak=1.0f-x->m_c_leak; -} - -static void *vlavg_new(t_float halfDecayTime) -{ - t_vlavg *x=(t_vlavg *)pd_new(vlavg_class); - outlet_new(&x->x_obj, gensym("list")); - vlavg_setHalfDecay(x, halfDecayTime); - x->m_n=0; - x->m_avg=0; - return (void *)x; -} - -static void vlavg_free(t_vlavg *x) -{ - freebytes(x->m_avg,x->m_n); -} - -void vlavg_setup(void) -{ - vlavg_class = class_new(gensym("vlavg"), - (t_newmethod)vlavg_new, (t_method)vlavg_free, - sizeof(t_vlavg), - CLASS_DEFAULT, - A_DEFFLOAT, 0); - class_addmethod(vlavg_class, (t_method)vlavg_setHalfDecay, - gensym("decay"), A_DEFFLOAT, NULL); - class_addlist(vlavg_class, (t_method)vlavg_perform); -} diff --git a/source/vlmax.c b/source/vlmax.c deleted file mode 100644 index a566f49..0000000 --- a/source/vlmax.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "defines.h" - -/*--------------- vlmax -----------------------*/ -/* leaky maximum of each element in a list */ -/* arguments: [halfdecay] */ - -static t_class *vlmax_class; - -typedef struct _vlmax -{ - t_object x_obj; - float m_c_leak; - float m_leak; - float *m_max; - int m_n; -} t_vlmax; - - -static void vlmax_perform(t_vlmax *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - t_atom *ap,*app; - float *fp; - float m_leak; - float m_c_leak; - m_leak=x->m_leak; - m_c_leak=x->m_c_leak; - - if (argc!=x->m_n) - { - int i; - if (x->m_max) - freebytes(x->m_max,x->m_n); - x->m_max=(float*)getbytes(argc*sizeof(float)); - for(i=0;im_max[i]=0.0f; - x->m_n=argc; - } - - fp=x->m_max; - ap = (t_atom *)getbytes(sizeof(t_atom)*argc); - app=ap; - for (i = 0; i < argc; i++) - { - float f=atom_getfloat(argv++); - *fp =(f > *fp ) ? f : *fp *m_c_leak + f*m_leak; - SETFLOAT(app, *fp); - app++; - fp++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),argc,ap); - freebytes(ap,argc); -} - -static void vlmax_setHalfDecay(t_vlmax *x, t_floatarg halfDecayTime) -{ - x->m_c_leak=(float)powf(.5,(1.0f/halfDecayTime)); - x->m_leak=1.0f-x->m_c_leak; -} - -static void *vlmax_new(t_float halfDecayTime) -{ - t_vlmax *x=(t_vlmax *)pd_new(vlmax_class); - outlet_new(&x->x_obj, gensym("list")); - vlmax_setHalfDecay(x, halfDecayTime); - x->m_n=0; - x->m_max=0; - return (void *)x; -} - -static void vlmax_free(t_vlmax *x) -{ - freebytes(x->m_max,x->m_n); -} - -void vlmax_setup(void) -{ - vlmax_class = class_new(gensym("vlmax"), - (t_newmethod)vlmax_new, (t_method)vlmax_free, - sizeof(t_vlmax), - CLASS_DEFAULT, - A_DEFFLOAT, 0); - class_addmethod(vlmax_class, (t_method)vlmax_setHalfDecay, - gensym("decay"), A_DEFFLOAT, NULL); - class_addlist(vlmax_class, (t_method)vlmax_perform); -} diff --git a/source/vlmin.c b/source/vlmin.c deleted file mode 100644 index b839826..0000000 --- a/source/vlmin.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "defines.h" - -/*--------------- vlmin -----------------------*/ -/* leaky minimum of each element in a list */ -/* arguments: [halfdecay] */ - -static t_class *vlmin_class; - -typedef struct _vlmin -{ - t_object x_obj; - float m_c_leak; - float m_leak; - float *m_min; - int m_n; -} t_vlmin; - - -static void vlmin_perform(t_vlmin *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - t_atom *ap,*app; - float *fp; - float m_leak; - float m_c_leak; - m_leak=x->m_leak; - m_c_leak=x->m_c_leak; - - if (argc!=x->m_n) - { - int i; - if (x->m_min) - freebytes(x->m_min,x->m_n); - x->m_min=(float*)getbytes(argc*sizeof(float)); - for(i=0;im_min[i]=0.0f; - x->m_n=argc; - } - - fp=x->m_min; - ap = (t_atom *)getbytes(sizeof(t_atom)*argc); - app=ap; - for (i = 0; i < argc; i++) - { - float f=atom_getfloat(argv++); - *fp =(f < *fp ) ? f : *fp *m_c_leak + f*m_leak; - SETFLOAT(app, *fp); - app++; - fp++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),argc,ap); - freebytes(ap,argc); -} - -static void vlmin_setHalfDecay(t_vlmin *x, t_floatarg halfDecayTime) -{ - x->m_c_leak=(float)powf(.5,(1.0f/halfDecayTime)); - x->m_leak=1.0f-x->m_c_leak; -} - -static void *vlmin_new(t_float halfDecayTime) -{ - t_vlmin *x=(t_vlmin *)pd_new(vlmin_class); - outlet_new(&x->x_obj, gensym("list")); - vlmin_setHalfDecay(x, halfDecayTime); - x->m_n=0; - x->m_min=0; - return (void *)x; -} - -static void vlmin_free(t_vlmin *x) -{ - freebytes(x->m_min,x->m_n); -} - -void vlmin_setup(void) -{ - vlmin_class = class_new(gensym("vlmin"), - (t_newmethod)vlmin_new, (t_method)vlmin_free, - sizeof(t_vlmin), - CLASS_DEFAULT, - A_DEFFLOAT, 0); - class_addmethod(vlmin_class, (t_method)vlmin_setHalfDecay, - gensym("decay"), A_DEFFLOAT, NULL); - class_addlist(vlmin_class, (t_method)vlmin_perform); -} diff --git a/source/vlrange.c b/source/vlrange.c deleted file mode 100644 index 07b383f..0000000 --- a/source/vlrange.c +++ /dev/null @@ -1,99 +0,0 @@ -#include "defines.h" - -/*--------------- vlrange -----------------------*/ -/* leaky range of each element in a list */ -/* arguments: [halfdecay] */ - -static t_class *vlrange_class; - -typedef struct _vlrange -{ - t_object x_obj; - float m_c_leak; - float m_leak; - float *m_min; - float *m_max; - int m_n; -} t_vlrange; - - -static void vlrange_perform(t_vlrange *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - t_atom *ap,*app; - float *fmin, *fmax; - float m_leak; - float m_c_leak; - m_leak=x->m_leak; - m_c_leak=x->m_c_leak; - - if (argc!=x->m_n) - { - int i; - if (x->m_min) - { - freebytes(x->m_min,x->m_n); - freebytes(x->m_max,x->m_n); - } - x->m_min=(float*)getbytes(argc*sizeof(float)); - x->m_max=(float*)getbytes(argc*sizeof(float)); - for(i=0;im_min[i]=0.0f; - x->m_max[i]=0.0f; - } - x->m_n=argc; - } - - fmin=x->m_min; - fmax=x->m_max; - ap = (t_atom *)getbytes(sizeof(t_atom)*argc); - app=ap; - for (i = 0; i < argc; i++) - { - float f=atom_getfloat(argv++); - *fmax =(f > *fmax ) ? f : *fmax *m_c_leak + f*m_leak; - *fmin =(f < *fmin ) ? f : *fmin *m_c_leak + f*m_leak; - SETFLOAT(app, *fmax-*fmin); - app++; - fmax++; - fmin++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),argc,ap); - freebytes(ap,argc); -} - -static void vlrange_setHalfDecay(t_vlrange *x, t_floatarg halfDecayTime) -{ - x->m_c_leak=(float)powf(.5,(1.0f/halfDecayTime)); - x->m_leak=1.0f-x->m_c_leak; -} - -static void *vlrange_new(t_float halfDecayTime) -{ - t_vlrange *x=(t_vlrange *)pd_new(vlrange_class); - outlet_new(&x->x_obj, gensym("list")); - vlrange_setHalfDecay(x, halfDecayTime); - x->m_n=0; - x->m_min=0; - x->m_max=0; - return (void *)x; -} - -static void vlrange_free(t_vlrange *x) -{ - freebytes(x->m_max,x->m_n); - freebytes(x->m_min,x->m_n); -} - -void vlrange_setup(void) -{ - vlrange_class = class_new(gensym("vlrange"), - (t_newmethod)vlrange_new, (t_method)vlrange_free, - sizeof(t_vlrange), - CLASS_DEFAULT, - A_DEFFLOAT, 0); - class_addmethod(vlrange_class, (t_method)vlrange_setHalfDecay, - gensym("decay"), A_DEFFLOAT, NULL); - class_addlist(vlrange_class, (t_method)vlrange_perform); -} diff --git a/source/vmax.c b/source/vmax.c deleted file mode 100644 index ac56423..0000000 --- a/source/vmax.c +++ /dev/null @@ -1,52 +0,0 @@ -#include "defines.h" - -/*--------------- vmax ---------------*/ -/* maximum value in a list of float - and its location (index) -*/ - -static t_class *vmax_class; - -typedef struct _vmax -{ - t_object x_obj; - t_outlet *m_out_maxi; -} t_vmax; - - -static void vmax_perform(t_vmax *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - int maxi; - float max=-MAXFLOAT; - for (i = 0; i < argc; i++) - { - float f=atom_getfloat(&argv[i]); - if (f>max) - { - max=f; - maxi=i; - } - } - outlet_float(x->x_obj.ob_outlet, max); - outlet_float(x->m_out_maxi, (float)(maxi+1)); -} - -static void *vmax_new( t_float halfDecayTime) -{ - t_vmax *x=(t_vmax *)pd_new(vmax_class); - outlet_new(&x->x_obj, gensym("float")); - x->m_out_maxi=outlet_new(&x->x_obj, gensym("float")); - return (void *)x; -} - -void vmax_setup(void) -{ - vmax_class = class_new(gensym("vmax"), - (t_newmethod)vmax_new, 0, - sizeof(t_vmax), - CLASS_DEFAULT, - 0); - class_addlist(vmax_class, (t_method)vmax_perform); -} - diff --git a/source/vmin.c b/source/vmin.c deleted file mode 100644 index a0b578e..0000000 --- a/source/vmin.c +++ /dev/null @@ -1,52 +0,0 @@ -#include "defines.h" - -/*--------------- vmin ---------------*/ -/* maximum value in a list of float - and its location (index) -*/ - -static t_class *vmin_class; - -typedef struct _vmin -{ - t_object x_obj; - t_outlet *m_out_maxi; -} t_vmin; - - -static void vmin_perform(t_vmin *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - int mini; - float min=MAXFLOAT; - for (i = 0; i < argc; i++) - { - float f=atom_getfloat(&argv[i]); - if (fx_obj.ob_outlet, min); - outlet_float(x->m_out_maxi, (float)(mini+1)); -} - -static void *vmin_new( t_float halfDecayTime) -{ - t_vmin *x=(t_vmin *)pd_new(vmin_class); - outlet_new(&x->x_obj, gensym("float")); - x->m_out_maxi=outlet_new(&x->x_obj, gensym("float")); - return (void *)x; -} - -void vmin_setup(void) -{ - vmin_class = class_new(gensym("vmin"), - (t_newmethod)vmin_new, 0, - sizeof(t_vmin), - CLASS_DEFAULT, - 0); - class_addlist(vmin_class, (t_method)vmin_perform); -} - diff --git a/source/vmtof.c b/source/vmtof.c deleted file mode 100644 index 828dcb6..0000000 --- a/source/vmtof.c +++ /dev/null @@ -1,51 +0,0 @@ -#include "defines.h" - -/*--------------- vmtof ----------------*/ - -static t_class *vmtof_class; - -typedef struct _vmtof -{ - t_object x_obj; -} t_vmtof; - -float mtof(float f) -{ - if (f <= -1500) return(0); - else if (f > 1499) return(mtof(1499)); - else return (float)(8.17579891564 * exp(.0577622650 * f)); -} - -static void vmtof_perform(t_vmtof *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - t_atom *ap,*app; - ap = (t_atom *)getbytes(sizeof(t_atom)*argc); - app=ap; - - for (i = 0; i < argc; i++) - { - SETFLOAT(app, mtof(atom_getfloat(argv++))); - app++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),argc,ap); - freebytes(ap,argc); -} - -static void *vmtof_new() -{ - t_vmtof *x=(t_vmtof *)pd_new(vmtof_class); - outlet_new(&x->x_obj, gensym("list")); - return (void *)x; -} - -void vmtof_setup(void) -{ - vmtof_class = class_new(gensym("vmtof"), - (t_newmethod)vmtof_new, 0, - sizeof(t_vmtof), - CLASS_DEFAULT, - 0); - class_addlist(vmtof_class, (t_method)vmtof_perform); -} - diff --git a/source/vnmax.c b/source/vnmax.c deleted file mode 100644 index 7003f6d..0000000 --- a/source/vnmax.c +++ /dev/null @@ -1,55 +0,0 @@ -#include "defines.h" - -/*--------------- vnmax ---------------*/ -/* maximum n values in a list of float - and their locations (indices) -*/ - -//// UNCOMPLETE - - -static t_class *vnmax_class; - -typedef struct _vnmax -{ - t_object x_obj; - t_outlet *m_out_maxi; -} t_vnmax; - - -static void vnmax_perform(t_vnmax *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - int maxi; - float max=-MAXFLOAT; - for (i = 0; i < argc; i++) - { - float f=atom_getfloat(&argv[i]); - if (f>max) - { - max=f; - maxi=i; - } - } - outlet_float(x->x_obj.ob_outlet, max); - outlet_float(x->m_out_maxi, (float)(maxi+1)); -} - -static void *vnmax_new( t_float halfDecayTime) -{ - t_vnmax *x=(t_vnmax *)pd_new(vnmax_class); - outlet_new(&x->x_obj, gensym("list")); - x->m_out_maxi=outlet_new(&x->x_obj, gensym("list")); - return (void *)x; -} - -void vnmax_setup(void) -{ - vnmax_class = class_new(gensym("vnmax"), - (t_newmethod)vnmax_new, 0, - sizeof(t_vnmax), - CLASS_DEFAULT, - 0); - class_addlist(vnmax_class, (t_method)vnmax_perform); -} - diff --git a/source/vpow.c b/source/vpow.c deleted file mode 100644 index 6859859..0000000 --- a/source/vpow.c +++ /dev/null @@ -1,60 +0,0 @@ -#include "defines.h" - -/*--------------- vpow ----------------*/ - -static t_class *vpow_class; - -typedef struct _vpow -{ - t_object x_obj; - float m_y; -} t_vpow; - - -static void vpow_perform(t_vpow *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - float y; - t_atom *ap,*app; - ap = (t_atom *)getbytes(sizeof(t_atom)*argc); - app=ap; - y=x->m_y; - if (y==0.0f) - y=1.0f; - for (i = 0; i < argc; i++) - { - float x=atom_getfloat(argv++); - if (x>0) - x=(float)powf(x,y); - else - x=-1000.; - SETFLOAT(app, x); - app++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),argc,ap); - freebytes(ap,argc); -} - -static void *vpow_new(t_float y) -{ - t_vpow *x=(t_vpow *)pd_new(vpow_class); - - floatinlet_new(&x->x_obj, &x->m_y); - - outlet_new(&x->x_obj, gensym("list")); - if (y==0.0f) - y=1.0f; - x->m_y=y; - return (void *)x; -} - -void vpow_setup(void) -{ - vpow_class = class_new(gensym("vpow"), - (t_newmethod)vpow_new, 0, - sizeof(t_vpow), - CLASS_DEFAULT, - A_DEFFLOAT,A_DEFFLOAT,0); - class_addlist(vpow_class, (t_method)vpow_perform); -} - diff --git a/source/vrms.c b/source/vrms.c deleted file mode 100644 index 52b8d6d..0000000 --- a/source/vrms.c +++ /dev/null @@ -1,41 +0,0 @@ -#include "defines.h" - -/*--------------- vrms ---------------*/ - -static t_class *vrms_class; - -typedef struct _vrms -{ - t_object x_obj; -} t_vrms; - - -static void vrms_perform(t_vrms *x, t_symbol *s, int argc, t_atom *argv) -{ - float sum=0.f; - int i; - for (i = 0; i < argc; i++) - { - float tmp=atom_getfloat(&argv[i]); - sum+= tmp*tmp; - } - outlet_float(x->x_obj.ob_outlet, (float)sqrtf(sum/argc)); -} - -static void *vrms_new( t_float halfDecayTime) -{ - t_vrms *x=(t_vrms *)pd_new(vrms_class); - outlet_new(&x->x_obj, gensym("float")); - return (void *)x; -} - -void vrms_setup(void) -{ - vrms_class = class_new(gensym("vrms"), - (t_newmethod)vrms_new, 0, - sizeof(t_vrms), - CLASS_DEFAULT, - 0); - class_addlist(vrms_class, (t_method)vrms_perform); -} - diff --git a/source/vrmstodb.c b/source/vrmstodb.c deleted file mode 100644 index d375bf9..0000000 --- a/source/vrmstodb.c +++ /dev/null @@ -1,54 +0,0 @@ -#include "defines.h" - -/*--------------- vrmstodb ----------------*/ - -static t_class *vrmstodb_class; - -typedef struct _vrmstodb -{ - t_object x_obj; -} t_vrmstodb; - -float rmstodb(float f) -{ - if (f <= 0) return (0); - else - { - float val = (float)(100 + 20./LOGTEN * log(f)); - return (val < 0 ? 0 : val); - } -} - -static void vrmstodb_perform(t_vrmstodb *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - t_atom *ap,*app; - ap = (t_atom *)getbytes(sizeof(t_atom)*argc); - app=ap; - - for (i = 0; i < argc; i++) - { - SETFLOAT(app, rmstodb(atom_getfloat(argv++))); - app++; - } - outlet_list(x->x_obj.ob_outlet,gensym("list"),argc,ap); - freebytes(ap,argc); -} - -static void *vrmstodb_new() -{ - t_vrmstodb *x=(t_vrmstodb *)pd_new(vrmstodb_class); - outlet_new(&x->x_obj, gensym("list")); - return (void *)x; -} - -void vrmstodb_setup(void) -{ - vrmstodb_class = class_new(gensym("vrmstodb"), - (t_newmethod)vrmstodb_new, 0, - sizeof(t_vrmstodb), - CLASS_DEFAULT, - 0); - class_addlist(vrmstodb_class, (t_method)vrmstodb_perform); -} - diff --git a/source/vstd.c b/source/vstd.c deleted file mode 100644 index 538cb94..0000000 --- a/source/vstd.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "defines.h" - -/*--------------- vstd ---------------*/ - -static t_class *vstd_class; - -typedef struct _vstd -{ - t_object x_obj; -} t_vstd; - - -static void vstd_perform(t_vstd *x, t_symbol *s, int argc, t_atom *argv) -{ - float sumsq=0.0f; - float sum=0.0f; - int i; - for (i = 0; i < argc; i++) - { - float tmp=atom_getfloat(&argv[i]); - sumsq+= tmp*tmp; - sum+=tmp; - } - sumsq/=argc; - sum/=argc; - outlet_float(x->x_obj.ob_outlet, (float)sqrtf(sumsq-sum*sum)); -} - -static void *vstd_new( t_float halfDecayTime) -{ - t_vstd *x=(t_vstd *)pd_new(vstd_class); - outlet_new(&x->x_obj, gensym("float")); - return (void *)x; -} - -void vstd_setup(void) -{ - vstd_class = class_new(gensym("vstd"), - (t_newmethod)vstd_new, 0, - sizeof(t_vstd), - CLASS_DEFAULT, - 0); - class_addlist(vstd_class, (t_method)vstd_perform); -} - diff --git a/source/vsum.c b/source/vsum.c deleted file mode 100644 index dd49f4c..0000000 --- a/source/vsum.c +++ /dev/null @@ -1,40 +0,0 @@ -#include "defines.h" - -/*--------------- vsum ---------------*/ - -static t_class *vsum_class; - -typedef struct _vsum -{ - t_object x_obj; -} t_vsum; - - -static void vsum_perform(t_vsum *x, t_symbol *s, int argc, t_atom *argv) -{ - float sum=0.f; - int i; - for (i = 0; i < argc; i++) - { - sum+= atom_getfloat(&argv[i]); - } - outlet_float(x->x_obj.ob_outlet, sum); -} - -static void *vsum_new() -{ - t_vsum *x=(t_vsum *)pd_new(vsum_class); - outlet_new(&x->x_obj, gensym("float")); - return (void *)x; -} - -void vsum_setup(void) -{ - vsum_class = class_new(gensym("vsum"), - (t_newmethod)vsum_new, 0, - sizeof(t_vsum), - CLASS_DEFAULT, - 0); - class_addlist(vsum_class, (t_method)vsum_perform); -} - diff --git a/source/vthreshold.c b/source/vthreshold.c deleted file mode 100644 index 106cf72..0000000 --- a/source/vthreshold.c +++ /dev/null @@ -1,106 +0,0 @@ -/* --------------------- vthreshold ----------------------------- */ - -#include "defines.h" -#include "memory.h" - -static t_class *vthreshold_class; - -typedef struct _vthreshold -{ - t_object x_obj; - t_outlet *x_outlet1; /* bang out for high thresh */ - t_outlet *x_outlet2; /* bang out for low thresh */ - int *x_state; /* 1 = high, 0 = low */ - int x_n; - float x_hithresh; /* value of high vthreshold */ - float x_lothresh; /* value of low vthreshold */ - float x_hideadtime; /* hi dead */ - float x_lodeadtime; /* lo dead */ -} t_vthreshold; - - /* "set" message to specify vthresholds and dead times */ -static void vthreshold_set(t_vthreshold *x, - t_floatarg hithresh, t_floatarg hideadtime, - t_floatarg lothresh, t_floatarg lodeadtime, - t_floatarg nf) -{ - if (lothresh > hithresh) - lothresh = hithresh; - x->x_hithresh = hithresh; - x->x_hideadtime = hideadtime; - x->x_lothresh = lothresh; - x->x_lodeadtime = lodeadtime; - freebytes(x->x_state,x->x_n); - x->x_n=(int)nf; - x->x_state = (int *)getbytes(sizeof(int)*x->x_n); - memset(x->x_state , 0, x->x_n); -} - -static t_vthreshold *vthreshold_new(t_floatarg hithresh, - t_floatarg hideadtime, t_floatarg lothresh, t_floatarg lodeadtime, t_floatarg n) -{ - t_vthreshold *x = (t_vthreshold *) - pd_new(vthreshold_class); - x->x_state = 0; /* low state */ - x->x_outlet1 = outlet_new(&x->x_obj, gensym("float")); - x->x_outlet2 = outlet_new(&x->x_obj, gensym("float")); - vthreshold_set(x, hithresh, hideadtime, lothresh, lodeadtime, n); - return (x); -} - -static void vthreshold_free(t_vthreshold *x) -{ - freebytes(x->x_state,x->x_n); -} - -static void vthreshold_perform(t_vthreshold *x, t_symbol *s, int argc, t_atom *argv) -{ - int i; - int *state; - - state=x->x_state; - if (argc>x->x_n) argc=x->x_n; - for (i=0;ix->x_hithresh) - { - outlet_float(x->x_outlet1, (float)i); // on - *state=1; - } - } - else - { - if (fx_lothresh) - { - outlet_float(x->x_outlet2, (float)i); // off - *state=-1; - } - } - state++; - } -} - - -static void vthreshold_ff(t_vthreshold *x) -{ - freebytes(x->x_state,x->x_n); -} - -void vthreshold_setup( void) -{ - vthreshold_class = class_new(gensym("vthreshold"), - (t_newmethod)vthreshold_new, (t_method)vthreshold_free, - sizeof(t_vthreshold), 0, - A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); - - class_addlist(vthreshold_class, (t_method)vthreshold_perform); - class_addmethod(vthreshold_class, (t_method)vthreshold_set, - gensym("set"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); -// class_addmethod(vthreshold_class, (t_method)vthreshold_ft1, -// gensym("ft1"), A_FLOAT, 0); -} diff --git a/source/vvconv.c b/source/vvconv.c deleted file mode 100644 index 5541705..0000000 --- a/source/vvconv.c +++ /dev/null @@ -1,151 +0,0 @@ -#include "defines.h" - -/*--------------- vvconv ---------------*/ -/* vector convolution -*/ - -static t_class *vvconv_class; -static t_class *vvconv_scal_class; - -typedef struct _vvconv -{ - t_object x_obj; - - t_int n1, n2; - - t_float *buf1, *buf2; - - t_float f; -} t_vvconv; - - -static void vvconv_lst2(t_vvconv *x, t_symbol *s, int argc, t_atom *argv) -{ - t_float *fp; - if (x->n2 != argc) { - freebytes(x->buf2, x->n2 * sizeof(t_float)); - x->n2 = argc; - x->buf2=(t_float *)getbytes(sizeof(t_float)*x->n2); - }; - fp = x->buf2; - while(argc--)*fp++=atom_getfloat(argv++); -} - -static void vvconv_lst(t_vvconv *x, t_symbol *s, int argc, t_atom *argv) -{ - t_float *fp; - t_atom *ap; - int n; - - if (argc){ - if (x->n1 != argc) { - freebytes(x->buf1, x->n1 * sizeof(t_float)); - x->n1 = argc; - x->buf1=(t_float *)getbytes(sizeof(t_float)*x->n1); - }; - fp = x->buf1; - while(argc--)*fp++=atom_getfloat(argv++); - } - - if (x->n1*x->n2==1){ - outlet_float(x->x_obj.ob_outlet, *x->buf1**x->buf2); - return; - } - if (x->n1==1){ - t_atom *a; - int i = x->n2; - t_float f = *x->buf1; - fp = x->buf2; - n = x->n2; - ap = (t_atom *)getbytes(sizeof(t_atom)*n); - a = ap; - while(i--){ - SETFLOAT(a, *fp++*f); - a++; - } - } else if (x->n2==1){ - t_float f = *x->buf2; - t_atom *a; - int i = x->n1; - n = x->n1; - ap = (t_atom *)getbytes(sizeof(t_atom)*n); - a = ap; - fp = x->buf1; - while(i--){ - SETFLOAT(a, *fp++*f); - a++; - } - } else { - t_atom *a; - int i,j,n1,n2; - t_float *f; - t_float *g; - t_float *fp2=x->buf2; - fp = x->buf1; - n1=x->n1; - n2=x->n2; - n = n1 + n2 - 1; - f = (t_float *)getbytes(sizeof(t_float)*n); - g=f; - for(i=0;ix_obj.ob_outlet, gensym("list"), n, ap); - freebytes(ap, sizeof(t_atom)*n); -} -static void vvconv_free(t_vvconv *x) -{ - freebytes(x->buf1, sizeof(t_float)*x->n1); - freebytes(x->buf2, sizeof(t_float)*x->n2); -} - -static void *vvconv_new(t_symbol *s, int argc, t_atom *argv) -{ - t_vvconv *x; - - if (argc-1){ - x = (t_vvconv *)pd_new(vvconv_class); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("list"), gensym("")); - } else x = (t_vvconv *)pd_new(vvconv_scal_class); - - outlet_new(&x->x_obj, 0); - - x->n1 =1; - x->buf1 =(t_float*)getbytes(sizeof(t_float)); - *x->buf1=0; - - if (argc)vvconv_lst2(x, gensym("list"), argc, argv); - else { - x->n2 =1; - x->buf2 =(t_float*)getbytes(sizeof(t_float)); - *x->buf2=0; - } - - if (argc==1)floatinlet_new(&x->x_obj, x->buf2); - - return (x); -} - -void vvconv_setup(void) -{ - vvconv_class = class_new(gensym("vvconv"), (t_newmethod)vvconv_new, - (t_method)vvconv_free, sizeof(t_vvconv), 0, A_GIMME, 0); - class_addlist(vvconv_class, vvconv_lst); - class_addmethod (vvconv_class, (t_method)vvconv_lst2, gensym(""), A_GIMME, 0); - vvconv_scal_class = class_new(gensym("vv+"), 0, (t_method)vvconv_free, - sizeof(t_vvconv), 0, 0); - class_addlist(vvconv_scal_class, vvconv_lst); -} diff --git a/source/vvminus.c b/source/vvminus.c deleted file mode 100644 index b8b7246..0000000 --- a/source/vvminus.c +++ /dev/null @@ -1,142 +0,0 @@ -#include "defines.h" - -/*--------------- vvminus ---------------*/ -/* vector substraction -*/ - -static t_class *vvminus_class; -static t_class *vvminus_scal_class; - -typedef struct _vvminus -{ - t_object x_obj; - - t_int n1, n2; - - t_float *buf1, *buf2; - - t_float f; -} t_vvminus; - - -static void vvminus_lst2(t_vvminus *x, t_symbol *s, int argc, t_atom *argv) -{ - t_float *fp; - if (x->n2 != argc) { - freebytes(x->buf2, x->n2 * sizeof(t_float)); - x->n2 = argc; - x->buf2=(t_float *)getbytes(sizeof(t_float)*x->n2); - }; - fp = x->buf2; - while(argc--)*fp++=atom_getfloat(argv++); -} - -static void vvminus_lst(t_vvminus *x, t_symbol *s, int argc, t_atom *argv) -{ - t_float *fp; - t_atom *ap; - int n; - - if (argc){ - if (x->n1 != argc) { - freebytes(x->buf1, x->n1 * sizeof(t_float)); - x->n1 = argc; - x->buf1=(t_float *)getbytes(sizeof(t_float)*x->n1); - }; - fp = x->buf1; - while(argc--)*fp++=atom_getfloat(argv++); - } - - if (x->n1*x->n2==1){ - outlet_float(x->x_obj.ob_outlet, *x->buf1-*x->buf2); - return; - } - if (x->n1==1){ - t_atom *a; - int i = x->n2; - t_float f = *x->buf1; - fp = x->buf2; - n = x->n2; - ap = (t_atom *)getbytes(sizeof(t_atom)*n); - a = ap; - while(i--){ - SETFLOAT(a, f-*fp++); - a++; - } - } else if (x->n2==1){ - t_float f = *x->buf2; - t_atom *a; - int i = x->n1; - n = x->n1; - ap = (t_atom *)getbytes(sizeof(t_atom)*n); - a = ap; - fp = x->buf1; - while(i--){ - SETFLOAT(a, *fp++-f); - a++; - } - } else { - t_atom *a; - int i; - t_float *fp2=x->buf2; - fp = x->buf1; - n = x->n1; - if (x->n1!=x->n2){ - post("scalar multiplication: truncating vectors to the same length"); - if (x->n2n1)n=x->n2; - } - ap = (t_atom *)getbytes(sizeof(t_atom)*n); - a = ap; - i=n; - while(i--){ - SETFLOAT(a, *fp++-*fp2++); - a++; - } - } - outlet_list(x->x_obj.ob_outlet, gensym("list"), n, ap); - freebytes(ap, sizeof(t_atom)*n); -} -static void vvminus_free(t_vvminus *x) -{ - freebytes(x->buf1, sizeof(t_float)*x->n1); - freebytes(x->buf2, sizeof(t_float)*x->n2); -} - -static void *vvminus_new(t_symbol *s, int argc, t_atom *argv) -{ - t_vvminus *x; - - if (argc-1){ - x = (t_vvminus *)pd_new(vvminus_class); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("list"), gensym("")); - } else x = (t_vvminus *)pd_new(vvminus_scal_class); - - outlet_new(&x->x_obj, 0); - - x->n1 =1; - x->buf1 =(t_float*)getbytes(sizeof(t_float)); - *x->buf1=0; - - if (argc)vvminus_lst2(x, gensym("list"), argc, argv); - else { - x->n2 =1; - x->buf2 =(t_float*)getbytes(sizeof(t_float)); - *x->buf2=0; - } - - if (argc==1)floatinlet_new(&x->x_obj, x->buf2); - - return (x); -} - -void vvminus_setup(void) -{ - vvminus_class = class_new(gensym("vvminus"), (t_newmethod)vvminus_new, - (t_method)vvminus_free, sizeof(t_vvminus), 0, A_GIMME, 0); - class_addcreator((t_newmethod)vvplus_new, gensym("vv-"), A_GIMME, 0); - class_addlist(vvminus_class, vvminus_lst); - class_addmethod (vvminus_class, (t_method)vvminus_lst2, gensym(""), A_GIMME, 0); - vvminus_scal_class = class_new(gensym("vv-"), 0, (t_method)vvminus_free, - sizeof(t_vvminus), 0, 0); - class_addlist(vvminus_scal_class, vvminus_lst); -} diff --git a/source/vvplus.c b/source/vvplus.c deleted file mode 100644 index a49ce39..0000000 --- a/source/vvplus.c +++ /dev/null @@ -1,142 +0,0 @@ -#include "defines.h" - -/*--------------- vvplus ---------------*/ -/* vector addition -*/ - -static t_class *vvplus_class; -static t_class *vvplus_scal_class; - -typedef struct _vvplus -{ - t_object x_obj; - - t_int n1, n2; - - t_float *buf1, *buf2; - - t_float f; -} t_vvplus; - - -static void vvplus_lst2(t_vvplus *x, t_symbol *s, int argc, t_atom *argv) -{ - t_float *fp; - if (x->n2 != argc) { - freebytes(x->buf2, x->n2 * sizeof(t_float)); - x->n2 = argc; - x->buf2=(t_float *)getbytes(sizeof(t_float)*x->n2); - }; - fp = x->buf2; - while(argc--)*fp++=atom_getfloat(argv++); -} - -static void vvplus_lst(t_vvplus *x, t_symbol *s, int argc, t_atom *argv) -{ - t_float *fp; - t_atom *ap; - int n; - - if (argc){ - if (x->n1 != argc) { - freebytes(x->buf1, x->n1 * sizeof(t_float)); - x->n1 = argc; - x->buf1=(t_float *)getbytes(sizeof(t_float)*x->n1); - }; - fp = x->buf1; - while(argc--)*fp++=atom_getfloat(argv++); - } - - if (x->n1*x->n2==1){ - outlet_float(x->x_obj.ob_outlet, *x->buf1+*x->buf2); - return; - } - if (x->n1==1){ - t_atom *a; - int i = x->n2; - t_float f = *x->buf1; - fp = x->buf2; - n = x->n2; - ap = (t_atom *)getbytes(sizeof(t_atom)*n); - a = ap; - while(i--){ - SETFLOAT(a, *fp+++f); - a++; - } - } else if (x->n2==1){ - t_float f = *x->buf2; - t_atom *a; - int i = x->n1; - n = x->n1; - ap = (t_atom *)getbytes(sizeof(t_atom)*n); - a = ap; - fp = x->buf1; - while(i--){ - SETFLOAT(a, *fp+++f); - a++; - } - } else { - t_atom *a; - int i; - t_float *fp2=x->buf2; - fp = x->buf1; - n = x->n1; - if (x->n1!=x->n2){ - post("scalar multiplication: truncating vectors to the same length"); - if (x->n2n1)n=x->n2; - } - ap = (t_atom *)getbytes(sizeof(t_atom)*n); - a = ap; - i=n; - while(i--){ - SETFLOAT(a, *fp+++*fp2++); - a++; - } - } - outlet_list(x->x_obj.ob_outlet, gensym("list"), n, ap); - freebytes(ap, sizeof(t_atom)*n); -} -static void vvplus_free(t_vvplus *x) -{ - freebytes(x->buf1, sizeof(t_float)*x->n1); - freebytes(x->buf2, sizeof(t_float)*x->n2); -} - -static void *vvplus_new(t_symbol *s, int argc, t_atom *argv) -{ - t_vvplus *x; - - if (argc-1){ - x = (t_vvplus *)pd_new(vvplus_class); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("list"), gensym("")); - } else x = (t_vvplus *)pd_new(vvplus_scal_class); - - outlet_new(&x->x_obj, 0); - - x->n1 =1; - x->buf1 =(t_float*)getbytes(sizeof(t_float)); - *x->buf1=0; - - if (argc)vvplus_lst2(x, gensym("list"), argc, argv); - else { - x->n2 =1; - x->buf2 =(t_float*)getbytes(sizeof(t_float)); - *x->buf2=0; - } - - if (argc==1)floatinlet_new(&x->x_obj, x->buf2); - - return (x); -} - -void vvplus_setup(void) -{ - vvplus_class = class_new(gensym("vvplus"), (t_newmethod)vvplus_new, - (t_method)vvplus_free, sizeof(t_vvplus), 0, A_GIMME, 0); - class_addcreator((t_newmethod)vvplus_new, gensym("vv+"), A_GIMME, 0); - class_addlist(vvplus_class, vvplus_lst); - class_addmethod (vvplus_class, (t_method)vvplus_lst2, gensym(""), A_GIMME, 0); - vvplus_scal_class = class_new(gensym("vv+"), 0, (t_method)vvplus_free, - sizeof(t_vvplus), 0, 0); - class_addlist(vvplus_scal_class, vvplus_lst); -} -- cgit v1.2.1