From 24e5fc0f1f0688f6a717b419f978652e9f064a0d Mon Sep 17 00:00:00 2001 From: Sojourner Truth <jon.w.wilkes@gmail.com> Date: Tue, 21 Jun 2016 21:04:48 -0400 Subject: [PATCH] sync iem_tab library with Pd-l2ork (probably a commit that I missed awhile back) --- externals/iem/iem_tab/src/VC6/iem_tab.dsp | 85 ++++++++ externals/iem/iem_tab/src/VC6/iem_tab.dsw | 29 +++ externals/iem/iem_tab/src/VC6/makefile_win | 77 ++++++++ externals/iem/iem_tab/src/VC7/iem_tab.vcproj | 52 +++++ .../iem/iem_tab/src/VC7/makefile_vc7proj | 71 +++++++ externals/iem/iem_tab/src/VC9/iem_tab.sln | 20 ++ externals/iem/iem_tab/src/VC9/iem_tab.vcproj | 77 ++++++++ .../iem/iem_tab/src/VC9/makefile_vc9proj | 70 +++++++ externals/iem/iem_tab/src/iem_tab.c | 14 +- externals/iem/iem_tab/src/iem_tab.h | 4 +- externals/iem/iem_tab/src/iem_tab.sln | 20 ++ externals/iem/iem_tab/src/iem_tab.vcproj | 77 ++++++++ externals/iem/iem_tab/src/makefile | 87 +------- externals/iem/iem_tab/src/makefile_d_fat | 10 +- externals/iem/iem_tab/src/makefile_linux | 19 +- externals/iem/iem_tab/src/makefile_vc9proj | 70 +++++++ externals/iem/iem_tab/src/tab_dbtopow.c | 185 ++++++++++++++++++ externals/iem/iem_tab/src/tab_dbtorms.c | 185 ++++++++++++++++++ externals/iem/iem_tab/src/tab_fft.c | 3 +- externals/iem/iem_tab/src/tab_ifft.c | 9 +- externals/iem/iem_tab/src/tab_powtodb.c | 184 +++++++++++++++++ externals/iem/iem_tab/src/tab_rfft.c | 23 ++- externals/iem/iem_tab/src/tab_rifft.c | 13 +- externals/iem/iem_tab/src/tab_rmstodb.c | 184 +++++++++++++++++ externals/iem/iem_tab/tab_dbtopow-help.pd | 58 ++++++ externals/iem/iem_tab/tab_dbtorms-help.pd | 58 ++++++ externals/iem/iem_tab/tab_powtodb-help.pd | 59 ++++++ externals/iem/iem_tab/tab_rmstodb-help.pd | 59 ++++++ 28 files changed, 1677 insertions(+), 125 deletions(-) create mode 100644 externals/iem/iem_tab/src/VC6/iem_tab.dsp create mode 100644 externals/iem/iem_tab/src/VC6/iem_tab.dsw create mode 100644 externals/iem/iem_tab/src/VC6/makefile_win create mode 100644 externals/iem/iem_tab/src/VC7/iem_tab.vcproj create mode 100644 externals/iem/iem_tab/src/VC7/makefile_vc7proj create mode 100644 externals/iem/iem_tab/src/VC9/iem_tab.sln create mode 100644 externals/iem/iem_tab/src/VC9/iem_tab.vcproj create mode 100644 externals/iem/iem_tab/src/VC9/makefile_vc9proj create mode 100644 externals/iem/iem_tab/src/iem_tab.sln create mode 100644 externals/iem/iem_tab/src/iem_tab.vcproj create mode 100644 externals/iem/iem_tab/src/makefile_vc9proj create mode 100644 externals/iem/iem_tab/src/tab_dbtopow.c create mode 100644 externals/iem/iem_tab/src/tab_dbtorms.c create mode 100644 externals/iem/iem_tab/src/tab_powtodb.c create mode 100644 externals/iem/iem_tab/src/tab_rmstodb.c create mode 100644 externals/iem/iem_tab/tab_dbtopow-help.pd create mode 100644 externals/iem/iem_tab/tab_dbtorms-help.pd create mode 100644 externals/iem/iem_tab/tab_powtodb-help.pd create mode 100644 externals/iem/iem_tab/tab_rmstodb-help.pd diff --git a/externals/iem/iem_tab/src/VC6/iem_tab.dsp b/externals/iem/iem_tab/src/VC6/iem_tab.dsp new file mode 100644 index 000000000..c99236027 --- /dev/null +++ b/externals/iem/iem_tab/src/VC6/iem_tab.dsp @@ -0,0 +1,85 @@ +# Microsoft Developer Studio Project File - Name="iem_tab" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) External Target" 0x0106 + +CFG=iem_tab - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "iem_tab.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "iem_tab.mak" CFG="iem_tab - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "iem_tab - Win32 Release" (basierend auf "Win32 (x86) External Target") +!MESSAGE "iem_tab - Win32 Debug" (basierend auf "Win32 (x86) External Target") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" + +!IF "$(CFG)" == "iem_tab - Win32 Release" + +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Cmd_Line "NMAKE /f makefile_win" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "makefile_win.exe" +# PROP BASE Bsc_Name "makefile_win.bsc" +# PROP BASE Target_Dir "" +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Cmd_Line "NMAKE /f makefile_win" +# PROP Rebuild_Opt "/a" +# PROP Target_File "iem_tab.exe" +# PROP Bsc_Name "iem_tab.bsc" +# PROP Target_Dir "" + +!ELSEIF "$(CFG)" == "iem_tab - Win32 Debug" + +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Cmd_Line "NMAKE /f makefile_win" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "makefile_win.exe" +# PROP BASE Bsc_Name "makefile_win.bsc" +# PROP BASE Target_Dir "" +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Cmd_Line "NMAKE /f makefile_win" +# PROP Rebuild_Opt "/a" +# PROP Target_File "iem_tab.exe" +# PROP Bsc_Name "iem_tab.bsc" +# PROP Target_Dir "" + +!ENDIF + +# Begin Target + +# Name "iem_tab - Win32 Release" +# Name "iem_tab - Win32 Debug" + +!IF "$(CFG)" == "iem_tab - Win32 Release" + +!ELSEIF "$(CFG)" == "iem_tab - Win32 Debug" + +!ENDIF + +# Begin Source File + +SOURCE=.\makefile_win +# End Source File +# End Target +# End Project diff --git a/externals/iem/iem_tab/src/VC6/iem_tab.dsw b/externals/iem/iem_tab/src/VC6/iem_tab.dsw new file mode 100644 index 000000000..f33078291 --- /dev/null +++ b/externals/iem/iem_tab/src/VC6/iem_tab.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN! + +############################################################################### + +Project: "iem_tab"=.\iem_tab.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/externals/iem/iem_tab/src/VC6/makefile_win b/externals/iem/iem_tab/src/VC6/makefile_win new file mode 100644 index 000000000..97fb9cdbb --- /dev/null +++ b/externals/iem/iem_tab/src/VC6/makefile_win @@ -0,0 +1,77 @@ + +all: ..\iem_tab.dll + +VIS_CPP_PATH = "C:\Programme\Microsoft Visual Studio\Vc98" + +PD_INST_PATH = "C:\Programme\pd" + +PD_WIN_INCLUDE_PATH = /I. /I$(PD_INST_PATH)\src /I$(VIS_CPP_PATH)\include + +PD_WIN_C_FLAGS = /nologo /W3 /WX /DMSW /DNT /DPD /DWIN32 /DWINDOWS /Ox -DPA_LITTLE_ENDIAN + +PD_WIN_L_FLAGS = /nologo + +PD_WIN_LIB = /NODEFAULTLIB:libc /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel /NODEFAULTLIB:uuid \ + $(VIS_CPP_PATH)\lib\libc.lib \ + $(VIS_CPP_PATH)\lib\oldnames.lib \ + $(VIS_CPP_PATH)\lib\kernel32.lib \ + $(VIS_CPP_PATH)\lib\wsock32.lib \ + $(VIS_CPP_PATH)\lib\winmm.lib \ + $(PD_INST_PATH)\bin\pd.lib + + +SRC = tab_abs.c \ + tab_add.c \ + tab_add_scalar.c \ + tab_carth2polar.c \ + tab_complex_inv.c \ + tab_complex_mul.c \ + tab_const.c \ + tab_conv.c \ + tab_copy.c \ + tab_counter.c \ + tab_cross_corr.c \ + tab_div.c \ + tab_eq.c \ + tab_eq_scalar.c \ + tab_fft.c \ + tab_find_exact_peaks.c \ + tab_find_peaks.c \ + tab_ge.c \ + tab_ge_scalar.c \ + tab_gt.c \ + tab_gt_scalar.c \ + tab_get_size.c \ + tab_ifft.c \ + tab_le.c \ + tab_le_scalar.c \ + tab_lt.c \ + tab_lt_scalar.c \ + tab_max_index.c \ + tab_min_index.c \ + tab_min_max.c \ + tab_mul.c \ + tab_mul_scalar.c \ + tab_ne.c \ + tab_ne_scalar.c \ + tab_reverse.c \ + tab_rfft.c \ + tab_rifft.c \ + tab_sqrt.c \ + tab_sub.c \ + tab_sum.c \ + iem_tab.c + + +OBJ = $(SRC:.c=.obj) + +.c.obj: + cl $(PD_WIN_C_FLAGS) $(PD_WIN_INCLUDE_PATH) /c $*.c + +..\iem_tab.dll: $(OBJ) + link $(PD_WIN_L_FLAGS) /dll /export:iem_tab_setup \ + /out:..\iem_tab.dll $(OBJ) $(PD_WIN_LIB) + +clean: + del *.obj + diff --git a/externals/iem/iem_tab/src/VC7/iem_tab.vcproj b/externals/iem/iem_tab/src/VC7/iem_tab.vcproj new file mode 100644 index 000000000..b1e17892f --- /dev/null +++ b/externals/iem/iem_tab/src/VC7/iem_tab.vcproj @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="iem_tab" + ProjectGUID="{6A44952F-0D55-44EE-9032-928368583BEC}" + SccProjectName="" + SccLocalPath="" + Keyword="MakeFileProj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="0" + ATLMinimizesCRunTimeLibraryUsage="FALSE"> + <Tool + Name="VCNMakeTool" + BuildCommandLine="NMAKE /f makefile_vc7proj" + ReBuildCommandLine="NMAKE /f makefile_vc7proj /a" + Output="iem_tab.exe"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="0" + ATLMinimizesCRunTimeLibraryUsage="FALSE"> + <Tool + Name="VCNMakeTool" + BuildCommandLine="NMAKE /f makefile_vc7proj" + ReBuildCommandLine="NMAKE /f makefile_vc7proj /a" + Output="iem_tab.exe"/> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath="iem_tab.bsc"> + </File> + <File + RelativePath="makefile_vc7proj"> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/externals/iem/iem_tab/src/VC7/makefile_vc7proj b/externals/iem/iem_tab/src/VC7/makefile_vc7proj new file mode 100644 index 000000000..8fc0640bf --- /dev/null +++ b/externals/iem/iem_tab/src/VC7/makefile_vc7proj @@ -0,0 +1,71 @@ +TARGET = iem_tab + +all: ..\$(TARGET).dll + +VIS_CPP_PATH = "C:\Programme\Microsoft Visual Studio .NET 2003\Vc7" +VIS_SDK_PATH = "C:\Programme\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK" +PD_INST_PATH = "C:\Programme\pd-0.42-5" +PD_WIN_INCLUDE_PATH = /I. /I$(PD_INST_PATH)\src /I$(VIS_CPP_PATH)\include +PD_WIN_C_FLAGS = /nologo /W3 /WX /DMSW /DNT /DPD /DWIN32 /DWINDOWS /Ox -D_CRT_SECURE_NO_WARNINGS +PD_WIN_L_FLAGS = /nologo + +PD_WIN_LIB = /NODEFAULTLIB:libcmt /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel32 \ + $(VIS_CPP_PATH)\lib\libcmt.lib \ + $(VIS_CPP_PATH)\lib\oldnames.lib \ + $(VIS_SDK_PATH)\lib\kernel32.lib \ + $(PD_INST_PATH)\bin\pd.lib + +SRC = tab_abs.c \ + tab_add.c \ + tab_add_scalar.c \ + tab_carth2polar.c \ + tab_complex_inv.c \ + tab_complex_mul.c \ + tab_const.c \ + tab_conv.c \ + tab_copy.c \ + tab_counter.c \ + tab_cross_corr.c \ + tab_div.c \ + tab_eq.c \ + tab_eq_scalar.c \ + tab_fft.c \ + tab_find_exact_peaks.c \ + tab_find_peaks.c \ + tab_ge.c \ + tab_ge_scalar.c \ + tab_gt.c \ + tab_gt_scalar.c \ + tab_get_size.c \ + tab_ifft.c \ + tab_le.c \ + tab_le_scalar.c \ + tab_lt.c \ + tab_lt_scalar.c \ + tab_max_index.c \ + tab_min_index.c \ + tab_min_max.c \ + tab_mul.c \ + tab_mul_scalar.c \ + tab_ne.c \ + tab_ne_scalar.c \ + tab_reverse.c \ + tab_rfft.c \ + tab_rifft.c \ + tab_sqrt.c \ + tab_sub.c \ + tab_sum.c \ + iem_tab.c + + +OBJ = $(SRC:.c=.obj) + +.c.obj: + cl $(PD_WIN_C_FLAGS) $(PD_WIN_INCLUDE_PATH) /c $*.c + +..\$(TARGET).dll: $(OBJ) + link $(PD_WIN_L_FLAGS) /dll /export:$(TARGET)_setup \ + /out:..\$(TARGET).dll $(OBJ) $(PD_WIN_LIB) + +clean: + del *.obj diff --git a/externals/iem/iem_tab/src/VC9/iem_tab.sln b/externals/iem/iem_tab/src/VC9/iem_tab.sln new file mode 100644 index 000000000..9cd81222f --- /dev/null +++ b/externals/iem/iem_tab/src/VC9/iem_tab.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iem_tab", "iem_tab.vcproj", "{6A44952F-0D55-44EE-9032-928368583BEC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6A44952F-0D55-44EE-9032-928368583BEC}.Debug|Win32.ActiveCfg = Debug|Win32 + {6A44952F-0D55-44EE-9032-928368583BEC}.Debug|Win32.Build.0 = Debug|Win32 + {6A44952F-0D55-44EE-9032-928368583BEC}.Release|Win32.ActiveCfg = Release|Win32 + {6A44952F-0D55-44EE-9032-928368583BEC}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/externals/iem/iem_tab/src/VC9/iem_tab.vcproj b/externals/iem/iem_tab/src/VC9/iem_tab.vcproj new file mode 100644 index 000000000..2fef5ab52 --- /dev/null +++ b/externals/iem/iem_tab/src/VC9/iem_tab.vcproj @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="iem_tab" + ProjectGUID="{6A44952F-0D55-44EE-9032-928368583BEC}" + Keyword="MakeFileProj" + TargetFrameworkVersion="131072" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="0" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + ATLMinimizesCRunTimeLibraryUsage="false" + > + <Tool + Name="VCNMakeTool" + BuildCommandLine="NMAKE /f makefile_vc9proj" + ReBuildCommandLine="NMAKE /f makefile_vc9proj /a" + CleanCommandLine="" + Output="iem_tab.exe" + PreprocessorDefinitions="" + IncludeSearchPath="" + ForcedIncludes="" + AssemblySearchPath="" + ForcedUsingAssemblies="" + CompileAsManaged="" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="0" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + ATLMinimizesCRunTimeLibraryUsage="false" + > + <Tool + Name="VCNMakeTool" + BuildCommandLine="NMAKE /f makefile_vc9proj" + ReBuildCommandLine="NMAKE /f makefile_vc9proj /a" + CleanCommandLine="" + Output="iem_tab.exe" + PreprocessorDefinitions="" + IncludeSearchPath="" + ForcedIncludes="" + AssemblySearchPath="" + ForcedUsingAssemblies="" + CompileAsManaged="" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath="iem_tab.bsc" + > + </File> + <File + RelativePath="makefile_vc9proj" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/externals/iem/iem_tab/src/VC9/makefile_vc9proj b/externals/iem/iem_tab/src/VC9/makefile_vc9proj new file mode 100644 index 000000000..2c44a2c5a --- /dev/null +++ b/externals/iem/iem_tab/src/VC9/makefile_vc9proj @@ -0,0 +1,70 @@ +TARGET = iem_tab + +all: ..\$(TARGET).dll + +VIS_CPP_PATH = "C:\Program Files\Microsoft Visual Studio 9.0\VC" +VIS_SDK_PATH = "C:\Program Files\Microsoft SDKs\Windows\v6.0A" +PD_INST_PATH = "C:\Program Files\pd-0.43.0" +PD_WIN_INCLUDE_PATH = /I. /I$(PD_INST_PATH)\src /I$(VIS_CPP_PATH)\include +PD_WIN_C_FLAGS = /nologo /W3 /WX /DMSW /DNT /DPD /DWIN32 /DWINDOWS /Ox -D_CRT_SECURE_NO_WARNINGS +PD_WIN_L_FLAGS = /nologo + +PD_WIN_LIB = /NODEFAULTLIB:libcmt /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel32 \ + $(VIS_CPP_PATH)\lib\libcmt.lib \ + $(VIS_CPP_PATH)\lib\oldnames.lib \ + $(VIS_SDK_PATH)\lib\kernel32.lib \ + $(PD_INST_PATH)\bin\pd.lib + +SRC = tab_abs.c \ + tab_add.c \ + tab_add_scalar.c \ + tab_carth2polar.c \ + tab_complex_inv.c \ + tab_complex_mul.c \ + tab_const.c \ + tab_conv.c \ + tab_copy.c \ + tab_counter.c \ + tab_cross_corr.c \ + tab_div.c \ + tab_eq.c \ + tab_eq_scalar.c \ + tab_fft.c \ + tab_find_exact_peaks.c \ + tab_find_peaks.c \ + tab_ge.c \ + tab_ge_scalar.c \ + tab_gt.c \ + tab_gt_scalar.c \ + tab_get_size.c \ + tab_ifft.c \ + tab_le.c \ + tab_le_scalar.c \ + tab_lt.c \ + tab_lt_scalar.c \ + tab_max_index.c \ + tab_min_index.c \ + tab_min_max.c \ + tab_mul.c \ + tab_mul_scalar.c \ + tab_ne.c \ + tab_ne_scalar.c \ + tab_reverse.c \ + tab_rfft.c \ + tab_rifft.c \ + tab_sqrt.c \ + tab_sub.c \ + tab_sum.c \ + iem_tab.c + +OBJ = $(SRC:.c=.obj) + +.c.obj: + cl $(PD_WIN_C_FLAGS) $(PD_WIN_INCLUDE_PATH) /c $*.c + +..\$(TARGET).dll: $(OBJ) + link $(PD_WIN_L_FLAGS) /dll /export:$(TARGET)_setup \ + /out:..\$(TARGET).dll $(OBJ) $(PD_WIN_LIB) + +clean: + del *.obj diff --git a/externals/iem/iem_tab/src/iem_tab.c b/externals/iem/iem_tab/src/iem_tab.c index 9ea084b3b..479ed5576 100644 --- a/externals/iem/iem_tab/src/iem_tab.c +++ b/externals/iem/iem_tab/src/iem_tab.c @@ -1,7 +1,7 @@ /* For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. -iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 */ +iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2011 */ #include "m_pd.h" #include "iemlib.h" @@ -56,6 +56,8 @@ void tab_conv_setup(void); void tab_copy_setup(void); void tab_counter_setup(void); void tab_cross_corr_setup(void); +void tab_dbtopow_setup(void); +void tab_dbtorms_setup(void); void tab_div_setup(void); void tab_eq_setup(void); void tab_eq_scalar_setup(void); @@ -75,14 +77,15 @@ void tab_lt_scalar_setup(void); void tab_max_index_setup(void); void tab_min_index_setup(void); void tab_min_max_setup(void); -//void tab_mls_setup(void); void tab_mul_setup(void); void tab_mul_scalar_setup(void); void tab_ne_setup(void); void tab_ne_scalar_setup(void); +void tab_powtodb_setup(void); void tab_reverse_setup(void); void tab_rfft_setup(void); void tab_rifft_setup(void); +void tab_rmstodb_setup(void); void tab_sqrt_setup(void); void tab_sub_setup(void); void tab_sum_setup(void); @@ -105,6 +108,8 @@ void iem_tab_setup(void) tab_copy_setup(); tab_counter_setup(); tab_cross_corr_setup(); + tab_dbtopow_setup(); + tab_dbtorms_setup(); tab_div_setup(); tab_eq_setup(); tab_eq_scalar_setup(); @@ -124,19 +129,20 @@ void iem_tab_setup(void) tab_max_index_setup(); tab_min_index_setup(); tab_min_max_setup(); - // tab_mls_setup(); tab_mul_setup(); tab_mul_scalar_setup(); tab_ne_setup(); tab_ne_scalar_setup(); + tab_powtodb_setup(); tab_reverse_setup(); tab_rfft_setup(); tab_rifft_setup(); + tab_rmstodb_setup(); tab_sqrt_setup(); tab_sub_setup(); tab_sum_setup(); - post("iem_tab (R-1.18) library loaded! (c) Thomas Musil 01.2009"); + post("iem_tab (R-1.20) library loaded! (c) Thomas Musil 11.2011"); post(" musil%ciem.at iem KUG Graz Austria", '@'); } diff --git a/externals/iem/iem_tab/src/iem_tab.h b/externals/iem/iem_tab/src/iem_tab.h index 2b38f0535..9f1de065b 100644 --- a/externals/iem/iem_tab/src/iem_tab.h +++ b/externals/iem/iem_tab/src/iem_tab.h @@ -8,8 +8,8 @@ iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2009 typedef struct { - float real; - float imag; + t_float real; + t_float imag; } TAB_COMPLEX; diff --git a/externals/iem/iem_tab/src/iem_tab.sln b/externals/iem/iem_tab/src/iem_tab.sln new file mode 100644 index 000000000..9cd81222f --- /dev/null +++ b/externals/iem/iem_tab/src/iem_tab.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iem_tab", "iem_tab.vcproj", "{6A44952F-0D55-44EE-9032-928368583BEC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6A44952F-0D55-44EE-9032-928368583BEC}.Debug|Win32.ActiveCfg = Debug|Win32 + {6A44952F-0D55-44EE-9032-928368583BEC}.Debug|Win32.Build.0 = Debug|Win32 + {6A44952F-0D55-44EE-9032-928368583BEC}.Release|Win32.ActiveCfg = Release|Win32 + {6A44952F-0D55-44EE-9032-928368583BEC}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/externals/iem/iem_tab/src/iem_tab.vcproj b/externals/iem/iem_tab/src/iem_tab.vcproj new file mode 100644 index 000000000..2fef5ab52 --- /dev/null +++ b/externals/iem/iem_tab/src/iem_tab.vcproj @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="iem_tab" + ProjectGUID="{6A44952F-0D55-44EE-9032-928368583BEC}" + Keyword="MakeFileProj" + TargetFrameworkVersion="131072" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="0" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + ATLMinimizesCRunTimeLibraryUsage="false" + > + <Tool + Name="VCNMakeTool" + BuildCommandLine="NMAKE /f makefile_vc9proj" + ReBuildCommandLine="NMAKE /f makefile_vc9proj /a" + CleanCommandLine="" + Output="iem_tab.exe" + PreprocessorDefinitions="" + IncludeSearchPath="" + ForcedIncludes="" + AssemblySearchPath="" + ForcedUsingAssemblies="" + CompileAsManaged="" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="0" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + ATLMinimizesCRunTimeLibraryUsage="false" + > + <Tool + Name="VCNMakeTool" + BuildCommandLine="NMAKE /f makefile_vc9proj" + ReBuildCommandLine="NMAKE /f makefile_vc9proj /a" + CleanCommandLine="" + Output="iem_tab.exe" + PreprocessorDefinitions="" + IncludeSearchPath="" + ForcedIncludes="" + AssemblySearchPath="" + ForcedUsingAssemblies="" + CompileAsManaged="" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath="iem_tab.bsc" + > + </File> + <File + RelativePath="makefile_vc9proj" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/externals/iem/iem_tab/src/makefile b/externals/iem/iem_tab/src/makefile index e43df56ec..630865fd9 100644 --- a/externals/iem/iem_tab/src/makefile +++ b/externals/iem/iem_tab/src/makefile @@ -1,86 +1 @@ -current: all - -.SUFFIXES: .pd_linux - -INCLUDE = -I. -I/usr/local/src/pd/src - -LDFLAGS = -export-dynamic -shared -LIB = -ldl -lm - -#select either the DBG and OPT compiler flags below: - -CFLAGS = -DPD -DUNIX -W -Wno-unused \ - -Wno-parentheses -Wno-switch -O6 -funroll-loops -fomit-frame-pointer -fno-strict-aliasing \ - -DDL_OPEN -fPIC - -SYSTEM = $(shell uname -m) - -# the sources - -SRC = tab_abs.c \ - tab_add.c \ - tab_add_scalar.c \ - tab_carth2polar.c \ - tab_complex_inv.c \ - tab_complex_mul.c \ - tab_const.c \ - tab_conv.c \ - tab_copy.c \ - tab_counter.c \ - tab_cross_corr.c \ - tab_div.c \ - tab_eq.c \ - tab_eq_scalar.c \ - tab_fft.c \ - tab_find_exact_peaks.c \ - tab_find_peaks.c \ - tab_ge.c \ - tab_ge_scalar.c \ - tab_gt.c \ - tab_gt_scalar.c \ - tab_get_size.c \ - tab_ifft.c \ - tab_le.c \ - tab_le_scalar.c \ - tab_lt.c \ - tab_lt_scalar.c \ - tab_max_index.c \ - tab_min_index.c \ - tab_min_max.c \ - tab_mul.c \ - tab_mul_scalar.c \ - tab_ne.c \ - tab_ne_scalar.c \ - tab_reverse.c \ - tab_rfft.c \ - tab_rifft.c \ - tab_sqrt.c \ - tab_sub.c \ - tab_sum.c \ - iem_tab.c - -TARGET = iem_tab.pd_linux - - -OBJ = $(SRC:.c=.o) - -# -# ------------------ targets ------------------------------------ -# - -clean: - rm ../$(TARGET) - rm *.o - -all: $(OBJ) - @echo :: $(OBJ) - $(LD) $(LDFLAGS) -o $(TARGET) *.o $(LIB) - strip --strip-unneeded $(TARGET) - mv $(TARGET) .. - -$(OBJ) : %.o : %.c - $(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $*.c - - - - +include makefile_linux diff --git a/externals/iem/iem_tab/src/makefile_d_fat b/externals/iem/iem_tab/src/makefile_d_fat index d00395f08..0473ba8af 100644 --- a/externals/iem/iem_tab/src/makefile_d_fat +++ b/externals/iem/iem_tab/src/makefile_d_fat @@ -2,7 +2,7 @@ current: all .SUFFIXES: .d_fat -PD_INSTALL_PATH ?= "/Applications/Pd.app/Contents/Resources" +PD_INSTALL_PATH = "/Applications/Pd.app/Contents/Resources" INCLUDE = -I. -I$(PD_INSTALL_PATH)/src @@ -13,7 +13,8 @@ LFLAGS = -bundle -undefined suppress -flat_namespace # the sources -SRC = tab_abs.c \ +SRC = \ + tab_abs.c \ tab_add.c \ tab_add_scalar.c \ tab_carth2polar.c \ @@ -24,6 +25,8 @@ SRC = tab_abs.c \ tab_copy.c \ tab_counter.c \ tab_cross_corr.c \ + tab_dbtopow.c \ + tab_dbtorms.c \ tab_div.c \ tab_eq.c \ tab_eq_scalar.c \ @@ -47,9 +50,11 @@ SRC = tab_abs.c \ tab_mul_scalar.c \ tab_ne.c \ tab_ne_scalar.c \ + tab_powtodb.c \ tab_reverse.c \ tab_rfft.c \ tab_rifft.c \ + tab_rmstodb.c \ tab_sqrt.c \ tab_sub.c \ tab_sum.c \ @@ -75,6 +80,7 @@ all: $(OBJ) mv $(TARGET) .. $(OBJ) : %.o : %.c + touch $*.c $(CC) -arch i386 -arch ppc $(CFLAGS) $(INCLUDE) -c -o $*.o $*.c diff --git a/externals/iem/iem_tab/src/makefile_linux b/externals/iem/iem_tab/src/makefile_linux index 373e9b7a7..9a91e2947 100644 --- a/externals/iem/iem_tab/src/makefile_linux +++ b/externals/iem/iem_tab/src/makefile_linux @@ -2,22 +2,27 @@ current: all .SUFFIXES: .pd_linux -INCLUDE = -I. -I/usr/local/src/pd/src +#edit or define outside + +PD_INCLUDE=/usr/local/src/pd/src + +INCLUDE = -I. -I$(PD_INCLUDE) LDFLAGS = -export-dynamic -shared LIB = -ldl -lm #select either the DBG and OPT compiler flags below: -CFLAGS = -DPD -DUNIX -W -Werror -Wno-unused \ - -Wno-parentheses -Wno-switch -O6 -funroll-loops -fomit-frame-pointer -fno-strict-aliasing \ - -DDL_OPEN -fPIC +CFLAGS = -DPD -DUNIX -W -Wno-unused \ + -Wno-parentheses -Wno-switch -O2 -funroll-loops -fomit-frame-pointer \ + -fno-strict-aliasing -DDL_OPEN -fPIC SYSTEM = $(shell uname -m) # the sources -SRC = tab_abs.c \ +SRC = \ + tab_abs.c \ tab_add.c \ tab_add_scalar.c \ tab_carth2polar.c \ @@ -28,6 +33,8 @@ SRC = tab_abs.c \ tab_copy.c \ tab_counter.c \ tab_cross_corr.c \ + tab_dbtopow.c \ + tab_dbtorms.c \ tab_div.c \ tab_eq.c \ tab_eq_scalar.c \ @@ -51,9 +58,11 @@ SRC = tab_abs.c \ tab_mul_scalar.c \ tab_ne.c \ tab_ne_scalar.c \ + tab_powtodb.c \ tab_reverse.c \ tab_rfft.c \ tab_rifft.c \ + tab_rmstodb.c \ tab_sqrt.c \ tab_sub.c \ tab_sum.c \ diff --git a/externals/iem/iem_tab/src/makefile_vc9proj b/externals/iem/iem_tab/src/makefile_vc9proj new file mode 100644 index 000000000..2c44a2c5a --- /dev/null +++ b/externals/iem/iem_tab/src/makefile_vc9proj @@ -0,0 +1,70 @@ +TARGET = iem_tab + +all: ..\$(TARGET).dll + +VIS_CPP_PATH = "C:\Program Files\Microsoft Visual Studio 9.0\VC" +VIS_SDK_PATH = "C:\Program Files\Microsoft SDKs\Windows\v6.0A" +PD_INST_PATH = "C:\Program Files\pd-0.43.0" +PD_WIN_INCLUDE_PATH = /I. /I$(PD_INST_PATH)\src /I$(VIS_CPP_PATH)\include +PD_WIN_C_FLAGS = /nologo /W3 /WX /DMSW /DNT /DPD /DWIN32 /DWINDOWS /Ox -D_CRT_SECURE_NO_WARNINGS +PD_WIN_L_FLAGS = /nologo + +PD_WIN_LIB = /NODEFAULTLIB:libcmt /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel32 \ + $(VIS_CPP_PATH)\lib\libcmt.lib \ + $(VIS_CPP_PATH)\lib\oldnames.lib \ + $(VIS_SDK_PATH)\lib\kernel32.lib \ + $(PD_INST_PATH)\bin\pd.lib + +SRC = tab_abs.c \ + tab_add.c \ + tab_add_scalar.c \ + tab_carth2polar.c \ + tab_complex_inv.c \ + tab_complex_mul.c \ + tab_const.c \ + tab_conv.c \ + tab_copy.c \ + tab_counter.c \ + tab_cross_corr.c \ + tab_div.c \ + tab_eq.c \ + tab_eq_scalar.c \ + tab_fft.c \ + tab_find_exact_peaks.c \ + tab_find_peaks.c \ + tab_ge.c \ + tab_ge_scalar.c \ + tab_gt.c \ + tab_gt_scalar.c \ + tab_get_size.c \ + tab_ifft.c \ + tab_le.c \ + tab_le_scalar.c \ + tab_lt.c \ + tab_lt_scalar.c \ + tab_max_index.c \ + tab_min_index.c \ + tab_min_max.c \ + tab_mul.c \ + tab_mul_scalar.c \ + tab_ne.c \ + tab_ne_scalar.c \ + tab_reverse.c \ + tab_rfft.c \ + tab_rifft.c \ + tab_sqrt.c \ + tab_sub.c \ + tab_sum.c \ + iem_tab.c + +OBJ = $(SRC:.c=.obj) + +.c.obj: + cl $(PD_WIN_C_FLAGS) $(PD_WIN_INCLUDE_PATH) /c $*.c + +..\$(TARGET).dll: $(OBJ) + link $(PD_WIN_L_FLAGS) /dll /export:$(TARGET)_setup \ + /out:..\$(TARGET).dll $(OBJ) $(PD_WIN_LIB) + +clean: + del *.obj diff --git a/externals/iem/iem_tab/src/tab_dbtopow.c b/externals/iem/iem_tab/src/tab_dbtopow.c new file mode 100644 index 000000000..efcdbdb6c --- /dev/null +++ b/externals/iem/iem_tab/src/tab_dbtopow.c @@ -0,0 +1,185 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2010 */ + +#include "m_pd.h" +#include "iemlib.h" +#include "iem_tab.h" +#include <math.h> + +#define IEMTABLOGTEN 2.302585092994046 + +/* -------------------------- tab_dbtopow ------------------------------ */ + + +typedef struct _tab_dbtopow +{ + t_object x_obj; + int x_size_src1; + int x_size_dst; + int x_offset_src1; + int x_offset_dst; + iemarray_t *x_beg_mem_src1; + iemarray_t *x_beg_mem_dst; + t_symbol *x_sym_scr1; + t_symbol *x_sym_dst; +} t_tab_dbtopow; + +static t_class *tab_dbtopow_class; + +static void tab_dbtopow_src(t_tab_dbtopow *x, t_symbol *s) +{ + x->x_sym_scr1 = s; +} + +static void tab_dbtopow_dst(t_tab_dbtopow *x, t_symbol *s) +{ + x->x_sym_dst = s; +} + +static void tab_dbtopow_bang(t_tab_dbtopow *x) +{ + int i, n; + int ok_src, ok_dst; + iemarray_t *vec_src, *vec_dst; + + ok_src = iem_tab_check_arrays(gensym("tab_dbtopow"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0); + ok_dst = iem_tab_check_arrays(gensym("tab_dbtopow"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0); + + if(ok_src && ok_dst) + { + if(x->x_size_src1 < x->x_size_dst) + n = x->x_size_src1; + else + n = x->x_size_dst; + vec_src = x->x_beg_mem_src1; + vec_dst = x->x_beg_mem_dst; + if(n) + { + t_garray *a; + + for(i=0; i<n; i++) + { + t_float f = iemarray_getfloat(vec_src, i); + + if(f <= 0.0) + iemarray_setfloat(vec_dst, i, 0.0); + else + { + if(f > 870.0) + f = 870.0; + iemarray_setfloat(vec_dst, i, exp((IEMTABLOGTEN * 0.1) * (f-100.0))); + } + } + outlet_bang(x->x_obj.ob_outlet); + a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class); + garray_redraw(a); + } + } +} + +static void tab_dbtopow_list(t_tab_dbtopow *x, t_symbol *s, int argc, t_atom *argv) +{ + int beg_src, beg_dst; + int i, n; + int ok_src, ok_dst; + iemarray_t *vec_src, *vec_dst; + + if((argc >= 3) && + IS_A_FLOAT(argv,0) && + IS_A_FLOAT(argv,1) && + IS_A_FLOAT(argv,2)) + { + beg_src = (int)atom_getintarg(0, argc, argv); + beg_dst = (int)atom_getintarg(1, argc, argv); + n = (int)atom_getintarg(2, argc, argv); + if(beg_src < 0) + beg_src = 0; + if(beg_dst < 0) + beg_dst = 0; + if(n < 0) + n = 0; + + ok_src = iem_tab_check_arrays(gensym("tab_dbtopow"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, beg_src+n); + ok_dst = iem_tab_check_arrays(gensym("tab_dbtopow"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, beg_dst+n); + + if(ok_src && ok_dst) + { + vec_src = x->x_beg_mem_src1 + beg_src; + vec_dst = x->x_beg_mem_dst + beg_dst; + if(n) + { + t_garray *a; + + for(i=0; i<n; i++) + { + t_float f = iemarray_getfloat(vec_src, i); + + if(f <= 0.0) + iemarray_setfloat(vec_dst, i, 0.0); + else + { + if(f > 870.0) + f = 870.0; + iemarray_setfloat(vec_dst, i, exp((IEMTABLOGTEN * 0.1) * (f-100.0))); + } + } + outlet_bang(x->x_obj.ob_outlet); + a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class); + garray_redraw(a); + } + } + } + else + { + post("tab_dbtopow-ERROR: list need 3 float arguments:"); + post(" source_offset + destination_offset + number_of_samples_to_dbtopow"); + } +} + +static void tab_dbtopow_free(t_tab_dbtopow *x) +{ +} + +static void *tab_dbtopow_new(t_symbol *s, int argc, t_atom *argv) +{ + t_tab_dbtopow *x = (t_tab_dbtopow *)pd_new(tab_dbtopow_class); + t_symbol *src, *dst; + + if((argc >= 2) && + IS_A_SYMBOL(argv,0) && + IS_A_SYMBOL(argv,1)) + { + src = (t_symbol *)atom_getsymbolarg(0, argc, argv); + dst = (t_symbol *)atom_getsymbolarg(1, argc, argv); + } + else if((argc >= 1) && + IS_A_SYMBOL(argv,0)) + { + src = (t_symbol *)atom_getsymbolarg(0, argc, argv); + dst = src; + } + else + { + post("tab_dbtopow-ERROR: need 2 symbols arguments:"); + post(" source_array_name + destination_array_name"); + return(0); + } + + x->x_sym_scr1 = src; + x->x_sym_dst = dst; + outlet_new(&x->x_obj, &s_bang); + return(x); +} + +void tab_dbtopow_setup(void) +{ + tab_dbtopow_class = class_new(gensym("tab_dbtopow"), (t_newmethod)tab_dbtopow_new, (t_method)tab_dbtopow_free, + sizeof(t_tab_dbtopow), 0, A_GIMME, 0); + class_addbang(tab_dbtopow_class, (t_method)tab_dbtopow_bang); + class_addlist(tab_dbtopow_class, (t_method)tab_dbtopow_list); + class_addmethod(tab_dbtopow_class, (t_method)tab_dbtopow_src, gensym("src"), A_DEFSYMBOL, 0); + class_addmethod(tab_dbtopow_class, (t_method)tab_dbtopow_src, gensym("src1"), A_DEFSYMBOL, 0); + class_addmethod(tab_dbtopow_class, (t_method)tab_dbtopow_dst, gensym("dst"), A_DEFSYMBOL, 0); +} diff --git a/externals/iem/iem_tab/src/tab_dbtorms.c b/externals/iem/iem_tab/src/tab_dbtorms.c new file mode 100644 index 000000000..87d219478 --- /dev/null +++ b/externals/iem/iem_tab/src/tab_dbtorms.c @@ -0,0 +1,185 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2010 */ + +#include "m_pd.h" +#include "iemlib.h" +#include "iem_tab.h" +#include <math.h> + +#define IEMTABLOGTEN 2.302585092994046 + +/* -------------------------- tab_dbtorms ------------------------------ */ +/* x_beg_mem_dst[i] = sqrt(x_beg_mem_src1[i]) */ + +typedef struct _tab_dbtorms +{ + t_object x_obj; + int x_size_src1; + int x_size_dst; + int x_offset_src1; + int x_offset_dst; + iemarray_t *x_beg_mem_src1; + iemarray_t *x_beg_mem_dst; + t_symbol *x_sym_scr1; + t_symbol *x_sym_dst; +} t_tab_dbtorms; + +static t_class *tab_dbtorms_class; + +static void tab_dbtorms_src(t_tab_dbtorms *x, t_symbol *s) +{ + x->x_sym_scr1 = s; +} + +static void tab_dbtorms_dst(t_tab_dbtorms *x, t_symbol *s) +{ + x->x_sym_dst = s; +} + +static void tab_dbtorms_bang(t_tab_dbtorms *x) +{ + int i, n; + int ok_src, ok_dst; + iemarray_t *vec_src, *vec_dst; + + ok_src = iem_tab_check_arrays(gensym("tab_dbtorms"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0); + ok_dst = iem_tab_check_arrays(gensym("tab_dbtorms"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0); + + if(ok_src && ok_dst) + { + if(x->x_size_src1 < x->x_size_dst) + n = x->x_size_src1; + else + n = x->x_size_dst; + vec_src = x->x_beg_mem_src1; + vec_dst = x->x_beg_mem_dst; + if(n) + { + t_garray *a; + + for(i=0; i<n; i++) + { + t_float f = iemarray_getfloat(vec_src, i); + + if(f <= 0.0) + iemarray_setfloat(vec_dst, i, 0.0); + else + { + if(f > 485.0) + f = 485.0; + iemarray_setfloat(vec_dst, i, exp((IEMTABLOGTEN * 0.05) * (f-100.0))); + } + } + outlet_bang(x->x_obj.ob_outlet); + a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class); + garray_redraw(a); + } + } +} + +static void tab_dbtorms_list(t_tab_dbtorms *x, t_symbol *s, int argc, t_atom *argv) +{ + int beg_src, beg_dst; + int i, n; + int ok_src, ok_dst; + iemarray_t *vec_src, *vec_dst; + + if((argc >= 3) && + IS_A_FLOAT(argv,0) && + IS_A_FLOAT(argv,1) && + IS_A_FLOAT(argv,2)) + { + beg_src = (int)atom_getintarg(0, argc, argv); + beg_dst = (int)atom_getintarg(1, argc, argv); + n = (int)atom_getintarg(2, argc, argv); + if(beg_src < 0) + beg_src = 0; + if(beg_dst < 0) + beg_dst = 0; + if(n < 0) + n = 0; + + ok_src = iem_tab_check_arrays(gensym("tab_dbtorms"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, beg_src+n); + ok_dst = iem_tab_check_arrays(gensym("tab_dbtorms"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, beg_dst+n); + + if(ok_src && ok_dst) + { + vec_src = x->x_beg_mem_src1 + beg_src; + vec_dst = x->x_beg_mem_dst + beg_dst; + if(n) + { + t_garray *a; + + for(i=0; i<n; i++) + { + t_float f = iemarray_getfloat(vec_src, i); + + if(f <= 0.0) + iemarray_setfloat(vec_dst, i, 0.0); + else + { + if(f > 485.0) + f = 485.0; + iemarray_setfloat(vec_dst, i, exp((IEMTABLOGTEN * 0.05) * (f-100.0))); + } + } + outlet_bang(x->x_obj.ob_outlet); + a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class); + garray_redraw(a); + } + } + } + else + { + post("tab_dbtorms-ERROR: list need 3 float arguments:"); + post(" source_offset + destination_offset + number_of_samples_to_dbtorms"); + } +} + +static void tab_dbtorms_free(t_tab_dbtorms *x) +{ +} + +static void *tab_dbtorms_new(t_symbol *s, int argc, t_atom *argv) +{ + t_tab_dbtorms *x = (t_tab_dbtorms *)pd_new(tab_dbtorms_class); + t_symbol *src, *dst; + + if((argc >= 2) && + IS_A_SYMBOL(argv,0) && + IS_A_SYMBOL(argv,1)) + { + src = (t_symbol *)atom_getsymbolarg(0, argc, argv); + dst = (t_symbol *)atom_getsymbolarg(1, argc, argv); + } + else if((argc >= 1) && + IS_A_SYMBOL(argv,0)) + { + src = (t_symbol *)atom_getsymbolarg(0, argc, argv); + dst = src; + } + else + { + post("tab_dbtorms-ERROR: need 2 symbols arguments:"); + post(" source_array_name + destination_array_name"); + return(0); + } + + x->x_sym_scr1 = src; + x->x_sym_dst = dst; + outlet_new(&x->x_obj, &s_bang); + return(x); +} + +void tab_dbtorms_setup(void) +{ + tab_dbtorms_class = class_new(gensym("tab_dbtorms"), (t_newmethod)tab_dbtorms_new, (t_method)tab_dbtorms_free, + sizeof(t_tab_dbtorms), 0, A_GIMME, 0); + class_addbang(tab_dbtorms_class, (t_method)tab_dbtorms_bang); + class_addlist(tab_dbtorms_class, (t_method)tab_dbtorms_list); + class_addmethod(tab_dbtorms_class, (t_method)tab_dbtorms_src, gensym("src"), A_DEFSYMBOL, 0); + class_addmethod(tab_dbtorms_class, (t_method)tab_dbtorms_src, gensym("src1"), A_DEFSYMBOL, 0); + class_addmethod(tab_dbtorms_class, (t_method)tab_dbtorms_dst, gensym("dst"), A_DEFSYMBOL, 0); +} diff --git a/externals/iem/iem_tab/src/tab_fft.c b/externals/iem/iem_tab/src/tab_fft.c index a8107d494..dd4f08943 100644 --- a/externals/iem/iem_tab/src/tab_fft.c +++ b/externals/iem/iem_tab/src/tab_fft.c @@ -42,7 +42,7 @@ static void tab_fft_init(t_tab_fft *x) t_float f, g; TAB_COMPLEX *sincos = x->x_sin_cos; - g = 2.0f * 3.1415926538f / (t_float)fftsize; + g = 2.0 * 3.141592653589793 / (t_float)fftsize; for(i=0; i<fftsize; i++) { f = g * (t_float)i; @@ -390,5 +390,4 @@ void tab_fft_setup(void) class_addmethod(tab_fft_class, (t_method)tab_fft_dst_im, gensym("dst_im"), A_DEFSYMBOL, 0); class_addmethod(tab_fft_class, (t_method)tab_fft_dst_re, gensym("dst1"), A_DEFSYMBOL, 0); class_addmethod(tab_fft_class, (t_method)tab_fft_dst_im, gensym("dst2"), A_DEFSYMBOL, 0); -// class_sethelpsymbol(tab_fft_class, gensym("iemhelp2/tab_fft-help")); } diff --git a/externals/iem/iem_tab/src/tab_ifft.c b/externals/iem/iem_tab/src/tab_ifft.c index 730db2984..4df2a7ec0 100644 --- a/externals/iem/iem_tab/src/tab_ifft.c +++ b/externals/iem/iem_tab/src/tab_ifft.c @@ -42,7 +42,7 @@ static void tab_ifft_init(t_tab_ifft *x) t_float f, g; TAB_COMPLEX *sincos = x->x_sin_cos; - g = 2.0f * 3.1415926538f / (t_float)fftsize; + g = 2.0 * 3.141592653589793 / (t_float)fftsize; for(i=0; i<fftsize; i++) { f = g * (t_float)i; @@ -187,7 +187,7 @@ static void tab_ifft_bang(t_tab_ifft *x) } */ - g = 1.0f / (t_float)fftsize; + g = 1.0 / (t_float)fftsize; for(i = 0; i < fftsize; i++) { iemarray_setfloat(vec_dst_re, i, iemarray_getfloat(vec_dst_re, i)*g); @@ -318,7 +318,7 @@ static void tab_ifft_list(t_tab_ifft *x, t_symbol *s, int argc, t_atom *argv) } */ - g = 1.0f / (t_float)fftsize; + g = 1.0 / (t_float)fftsize; for(i = 0; i < fftsize; i++) { iemarray_setfloat(vec_dst_re, i, iemarray_getfloat(vec_dst_re, i)*g); @@ -401,8 +401,7 @@ void tab_ifft_setup(void) class_addmethod(tab_ifft_class, (t_method)tab_ifft_src_re, gensym("src1"), A_DEFSYMBOL, 0); class_addmethod(tab_ifft_class, (t_method)tab_ifft_src_im, gensym("src2"), A_DEFSYMBOL, 0); class_addmethod(tab_ifft_class, (t_method)tab_ifft_dst_re, gensym("dst_re"), A_DEFSYMBOL, 0); - class_addmethod(tab_ifft_class, (t_method)tab_ifft_dst_im, gensym("dst_re"), A_DEFSYMBOL, 0); + class_addmethod(tab_ifft_class, (t_method)tab_ifft_dst_im, gensym("dst_im"), A_DEFSYMBOL, 0); class_addmethod(tab_ifft_class, (t_method)tab_ifft_dst_re, gensym("dst1"), A_DEFSYMBOL, 0); class_addmethod(tab_ifft_class, (t_method)tab_ifft_dst_im, gensym("dst2"), A_DEFSYMBOL, 0); -// class_sethelpsymbol(tab_ifft_class, gensym("iemhelp2/tab_ifft-help")); } diff --git a/externals/iem/iem_tab/src/tab_powtodb.c b/externals/iem/iem_tab/src/tab_powtodb.c new file mode 100644 index 000000000..a8fd63838 --- /dev/null +++ b/externals/iem/iem_tab/src/tab_powtodb.c @@ -0,0 +1,184 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2010 */ + +#include "m_pd.h" +#include "iemlib.h" +#include "iem_tab.h" +#include <math.h> + +#define IEMTABLOGTEN 2.302585092994046 + +/* -------------------------- tab_powtodb ------------------------------ */ +/* x_beg_mem_dst[i] = sqrt(x_beg_mem_src1[i]) */ + +typedef struct _tab_powtodb +{ + t_object x_obj; + int x_size_src1; + int x_size_dst; + int x_offset_src1; + int x_offset_dst; + iemarray_t *x_beg_mem_src1; + iemarray_t *x_beg_mem_dst; + t_symbol *x_sym_scr1; + t_symbol *x_sym_dst; +} t_tab_powtodb; + +static t_class *tab_powtodb_class; + +static void tab_powtodb_src(t_tab_powtodb *x, t_symbol *s) +{ + x->x_sym_scr1 = s; +} + +static void tab_powtodb_dst(t_tab_powtodb *x, t_symbol *s) +{ + x->x_sym_dst = s; +} + +static void tab_powtodb_bang(t_tab_powtodb *x) +{ + int i, n; + int ok_src, ok_dst; + iemarray_t *vec_src, *vec_dst; + + ok_src = iem_tab_check_arrays(gensym("tab_powtodb"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0); + ok_dst = iem_tab_check_arrays(gensym("tab_powtodb"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0); + + if(ok_src && ok_dst) + { + if(x->x_size_src1 < x->x_size_dst) + n = x->x_size_src1; + else + n = x->x_size_dst; + vec_src = x->x_beg_mem_src1; + vec_dst = x->x_beg_mem_dst; + if(n) + { + t_garray *a; + + for(i=0; i<n; i++) + { + t_float f = iemarray_getfloat(vec_src, i); + + if(f <= 0.0) + iemarray_setfloat(vec_dst, i, 0.0); + else + { + t_float g = 100.0 + 10.0/IEMTABLOGTEN * log(f); + + iemarray_setfloat(vec_dst, i, g < 0.0 ? 0.0 : g); + } + } + outlet_bang(x->x_obj.ob_outlet); + a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class); + garray_redraw(a); + } + } +} + +static void tab_powtodb_list(t_tab_powtodb *x, t_symbol *s, int argc, t_atom *argv) +{ + int beg_src, beg_dst; + int i, n; + int ok_src, ok_dst; + iemarray_t *vec_src, *vec_dst; + + if((argc >= 3) && + IS_A_FLOAT(argv,0) && + IS_A_FLOAT(argv,1) && + IS_A_FLOAT(argv,2)) + { + beg_src = (int)atom_getintarg(0, argc, argv); + beg_dst = (int)atom_getintarg(1, argc, argv); + n = (int)atom_getintarg(2, argc, argv); + if(beg_src < 0) + beg_src = 0; + if(beg_dst < 0) + beg_dst = 0; + if(n < 0) + n = 0; + + ok_src = iem_tab_check_arrays(gensym("tab_powtodb"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, beg_src+n); + ok_dst = iem_tab_check_arrays(gensym("tab_powtodb"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, beg_dst+n); + + if(ok_src && ok_dst) + { + vec_src = x->x_beg_mem_src1 + beg_src; + vec_dst = x->x_beg_mem_dst + beg_dst; + if(n) + { + t_garray *a; + + for(i=0; i<n; i++) + { + t_float f = iemarray_getfloat(vec_src, i); + + if(f <= 0.0) + iemarray_setfloat(vec_dst, i, 0.0); + else + { + t_float g = 100.0 + 10.0/IEMTABLOGTEN * log(f); + + iemarray_setfloat(vec_dst, i, g < 0.0 ? 0.0 : g); + } + } outlet_bang(x->x_obj.ob_outlet); + a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class); + garray_redraw(a); + } + } + } + else + { + post("tab_powtodb-ERROR: list need 3 float arguments:"); + post(" source_offset + destination_offset + number_of_samples_to_sqrt"); + } +} + +static void tab_powtodb_free(t_tab_powtodb *x) +{ +} + +static void *tab_powtodb_new(t_symbol *s, int argc, t_atom *argv) +{ + t_tab_powtodb *x = (t_tab_powtodb *)pd_new(tab_powtodb_class); + t_symbol *src, *dst; + + if((argc >= 2) && + IS_A_SYMBOL(argv,0) && + IS_A_SYMBOL(argv,1)) + { + src = (t_symbol *)atom_getsymbolarg(0, argc, argv); + dst = (t_symbol *)atom_getsymbolarg(1, argc, argv); + } + else if((argc >= 1) && + IS_A_SYMBOL(argv,0)) + { + src = (t_symbol *)atom_getsymbolarg(0, argc, argv); + dst = src; + } + else + { + post("tab_powtodb-ERROR: need 2 symbols arguments:"); + post(" source_array_name + destination_array_name"); + return(0); + } + + x->x_sym_scr1 = src; + x->x_sym_dst = dst; + outlet_new(&x->x_obj, &s_bang); + return(x); +} + +void tab_powtodb_setup(void) +{ + tab_powtodb_class = class_new(gensym("tab_powtodb"), (t_newmethod)tab_powtodb_new, (t_method)tab_powtodb_free, + sizeof(t_tab_powtodb), 0, A_GIMME, 0); + class_addbang(tab_powtodb_class, (t_method)tab_powtodb_bang); + class_addlist(tab_powtodb_class, (t_method)tab_powtodb_list); + class_addmethod(tab_powtodb_class, (t_method)tab_powtodb_src, gensym("src"), A_DEFSYMBOL, 0); + class_addmethod(tab_powtodb_class, (t_method)tab_powtodb_src, gensym("src1"), A_DEFSYMBOL, 0); + class_addmethod(tab_powtodb_class, (t_method)tab_powtodb_dst, gensym("dst"), A_DEFSYMBOL, 0); +} diff --git a/externals/iem/iem_tab/src/tab_rfft.c b/externals/iem/iem_tab/src/tab_rfft.c index 1a3608fdf..bb3a444a2 100644 --- a/externals/iem/iem_tab/src/tab_rfft.c +++ b/externals/iem/iem_tab/src/tab_rfft.c @@ -39,7 +39,7 @@ static void tab_rfft_init(t_tab_rfft *x) t_float f, g; TAB_COMPLEX *sincos = x->x_sin_cos; - g = 2.0f * 3.1415926538f / (t_float)fftsize; + g = 2.0 * 3.141592653589793 / (t_float)fftsize; for(i=0; i<fftsize; i++) { f = g * (t_float)i; @@ -110,7 +110,7 @@ static void tab_rfft_bang(t_tab_rfft *x) for(k=0; k<fftsize; k++) { iemarray_setfloat(vec_dst_re, k, iemarray_getfloat(vec_src, k)); - iemarray_setfloat(vec_dst_im, k, 0.0f); + iemarray_setfloat(vec_dst_im, k, 0.0); } i_inc = fs2; @@ -176,12 +176,12 @@ static void tab_rfft_bang(t_tab_rfft *x) } */ - iemarray_setfloat(vec_dst_im, 0, 0.0f); - iemarray_setfloat(vec_dst_im, fs2, 0.0f); + iemarray_setfloat(vec_dst_im, 0, 0.0); + iemarray_setfloat(vec_dst_im, fs2, 0.0); for(i = fs2+1; i < fftsize; i++) { - iemarray_setfloat(vec_dst_re, i, 0.0f); - iemarray_setfloat(vec_dst_im, i, 0.0f); + iemarray_setfloat(vec_dst_re, i, 0.0); + iemarray_setfloat(vec_dst_im, i, 0.0); } outlet_bang(x->x_obj.ob_outlet); @@ -236,7 +236,7 @@ static void tab_rfft_list(t_tab_rfft *x, t_symbol *s, int argc, t_atom *argv) for(k=0; k<fftsize; k++) { iemarray_setfloat(vec_dst_re, k, iemarray_getfloat(vec_src, k)); - iemarray_setfloat(vec_dst_im, k, 0.0f); + iemarray_setfloat(vec_dst_im, k, 0.0); } i_inc = fs2; @@ -302,12 +302,12 @@ static void tab_rfft_list(t_tab_rfft *x, t_symbol *s, int argc, t_atom *argv) } */ - iemarray_setfloat(vec_dst_im, 0, 0.0f); - iemarray_setfloat(vec_dst_im, fs2, 0.0f); + iemarray_setfloat(vec_dst_im, 0, 0.0); + iemarray_setfloat(vec_dst_im, fs2, 0.0); for(i = fs2+1; i < fftsize; i++) { - iemarray_setfloat(vec_dst_re, i, 0.0f); - iemarray_setfloat(vec_dst_im, i, 0.0f); + iemarray_setfloat(vec_dst_re, i, 0.0); + iemarray_setfloat(vec_dst_im, i, 0.0); } outlet_bang(x->x_obj.ob_outlet); @@ -384,5 +384,4 @@ void tab_rfft_setup(void) class_addmethod(tab_rfft_class, (t_method)tab_rfft_dst_im, gensym("dst_im"), A_DEFSYMBOL, 0); class_addmethod(tab_rfft_class, (t_method)tab_rfft_dst_re, gensym("dst1"), A_DEFSYMBOL, 0); class_addmethod(tab_rfft_class, (t_method)tab_rfft_dst_im, gensym("dst2"), A_DEFSYMBOL, 0); -// class_sethelpsymbol(tab_rfft_class, gensym("iemhelp2/tab_rfft-help")); } diff --git a/externals/iem/iem_tab/src/tab_rifft.c b/externals/iem/iem_tab/src/tab_rifft.c index eddf8ceaf..612576125 100644 --- a/externals/iem/iem_tab/src/tab_rifft.c +++ b/externals/iem/iem_tab/src/tab_rifft.c @@ -40,7 +40,7 @@ static void tab_rifft_init(t_tab_rifft *x) t_float f, g; TAB_COMPLEX *sincos = x->x_sin_cos; - g = 2.0f * 3.1415926538f / (t_float)fftsize; + g = 2.0 * 3.141592653589793 / (t_float)fftsize; for(i=0; i<fftsize; i++) { f = g * (t_float)i; @@ -112,14 +112,14 @@ static void tab_rifft_bang(t_tab_rifft *x) vec_dst_im=x->x_beg_mem_dst_im; iemarray_setfloat(vec_dst_re, 0, iemarray_getfloat(vec_src_re, 0)); - iemarray_setfloat(vec_dst_im, 0, 0.0f); + iemarray_setfloat(vec_dst_im, 0, 0.0); for(j=1; j<fs2; j++) { iemarray_setfloat(vec_dst_re, j, iemarray_getfloat(vec_src_re, j)); iemarray_setfloat(vec_dst_im, j, iemarray_getfloat(vec_src_im, j)); } iemarray_setfloat(vec_dst_re, fs2, iemarray_getfloat(vec_src_re, fs2)); - iemarray_setfloat(vec_dst_im, fs2, 0.0f); + iemarray_setfloat(vec_dst_im, fs2, 0.0); for(k=1, j=fftsize-1; k<fs2; k++, j--) { @@ -190,7 +190,7 @@ static void tab_rifft_bang(t_tab_rifft *x) } */ - g = 1.0f / (t_float)fftsize; + g = 1.0 / (t_float)fftsize; for(i = 0; i < fftsize; i++) { iemarray_setfloat(vec_dst_re, i, iemarray_getfloat(vec_dst_re, i)*g); @@ -250,7 +250,7 @@ static void tab_rifft_list(t_tab_rifft *x, t_symbol *s, int argc, t_atom *argv) iemarray_setfloat(vec_dst_im, j, iemarray_getfloat(vec_src_im, j)); } iemarray_setfloat(vec_dst_re, fs2, iemarray_getfloat(vec_src_re, fs2)); - iemarray_setfloat(vec_dst_im, fs2, 0.0f); + iemarray_setfloat(vec_dst_im, fs2, 0.0); for(k=1, j=fftsize-1; k<fs2; k++, j--) { iemarray_setfloat(vec_dst_re, j, iemarray_getfloat(vec_src_re, k)); @@ -320,7 +320,7 @@ static void tab_rifft_list(t_tab_rifft *x, t_symbol *s, int argc, t_atom *argv) } */ - g = 1.0f / (t_float)fftsize; + g = 1.0 / (t_float)fftsize; for(i = 0; i < fftsize; i++) { iemarray_setfloat(vec_dst_re, i, iemarray_getfloat(vec_dst_re, i)*g); @@ -400,5 +400,4 @@ void tab_rifft_setup(void) class_addmethod(tab_rifft_class, (t_method)tab_rifft_src_im, gensym("src2"), A_DEFSYMBOL, 0); class_addmethod(tab_rifft_class, (t_method)tab_rifft_dst, gensym("dst"), A_DEFSYMBOL, 0); class_addmethod(tab_rifft_class, (t_method)tab_rifft_dst, gensym("dst1"), A_DEFSYMBOL, 0); -// class_sethelpsymbol(tab_rifft_class, gensym("iemhelp2/tab_rifft-help")); } diff --git a/externals/iem/iem_tab/src/tab_rmstodb.c b/externals/iem/iem_tab/src/tab_rmstodb.c new file mode 100644 index 000000000..ae459013a --- /dev/null +++ b/externals/iem/iem_tab/src/tab_rmstodb.c @@ -0,0 +1,184 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_tab written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2010 */ + +#include "m_pd.h" +#include "iemlib.h" +#include "iem_tab.h" +#include <math.h> + +#define IEMTABLOGTEN 2.302585092994046 + +/* -------------------------- tab_rmstodb ------------------------------ */ + +typedef struct _tab_rmstodb +{ + t_object x_obj; + int x_size_src1; + int x_size_dst; + int x_offset_src1; + int x_offset_dst; + iemarray_t *x_beg_mem_src1; + iemarray_t *x_beg_mem_dst; + t_symbol *x_sym_scr1; + t_symbol *x_sym_dst; +} t_tab_rmstodb; + +static t_class *tab_rmstodb_class; + +static void tab_rmstodb_src(t_tab_rmstodb *x, t_symbol *s) +{ + x->x_sym_scr1 = s; +} + +static void tab_rmstodb_dst(t_tab_rmstodb *x, t_symbol *s) +{ + x->x_sym_dst = s; +} + +static void tab_rmstodb_bang(t_tab_rmstodb *x) +{ + int i, n; + int ok_src, ok_dst; + iemarray_t *vec_src, *vec_dst; + + ok_src = iem_tab_check_arrays(gensym("tab_rmstodb"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, 0); + ok_dst = iem_tab_check_arrays(gensym("tab_rmstodb"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, 0); + + if(ok_src && ok_dst) + { + if(x->x_size_src1 < x->x_size_dst) + n = x->x_size_src1; + else + n = x->x_size_dst; + vec_src = x->x_beg_mem_src1; + vec_dst = x->x_beg_mem_dst; + if(n) + { + t_garray *a; + + for(i=0; i<n; i++) + { + t_float f = iemarray_getfloat(vec_src, i); + + if(f <= 0.0) + iemarray_setfloat(vec_dst, i, 0.0); + else + { + t_float g = 100.0 + 20.0/IEMTABLOGTEN * log(f); + + iemarray_setfloat(vec_dst, i, g < 0.0 ? 0.0 : g); + } + } + outlet_bang(x->x_obj.ob_outlet); + a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class); + garray_redraw(a); + } + } +} + +static void tab_rmstodb_list(t_tab_rmstodb *x, t_symbol *s, int argc, t_atom *argv) +{ + int beg_src, beg_dst; + int i, n; + int ok_src, ok_dst; + iemarray_t *vec_src, *vec_dst; + + if((argc >= 3) && + IS_A_FLOAT(argv,0) && + IS_A_FLOAT(argv,1) && + IS_A_FLOAT(argv,2)) + { + beg_src = (int)atom_getintarg(0, argc, argv); + beg_dst = (int)atom_getintarg(1, argc, argv); + n = (int)atom_getintarg(2, argc, argv); + if(beg_src < 0) + beg_src = 0; + if(beg_dst < 0) + beg_dst = 0; + if(n < 0) + n = 0; + + ok_src = iem_tab_check_arrays(gensym("tab_rmstodb"), x->x_sym_scr1, &x->x_beg_mem_src1, &x->x_size_src1, beg_src+n); + ok_dst = iem_tab_check_arrays(gensym("tab_rmstodb"), x->x_sym_dst, &x->x_beg_mem_dst, &x->x_size_dst, beg_dst+n); + + if(ok_src && ok_dst) + { + vec_src = x->x_beg_mem_src1 + beg_src; + vec_dst = x->x_beg_mem_dst + beg_dst; + if(n) + { + t_garray *a; + + for(i=0; i<n; i++) + { + t_float f = iemarray_getfloat(vec_src, i); + + if(f <= 0.0) + iemarray_setfloat(vec_dst, i, 0.0); + else + { + t_float g = 100.0 + 20.0/IEMTABLOGTEN * log(f); + + iemarray_setfloat(vec_dst, i, g < 0.0 ? 0.0 : g); + } + } + outlet_bang(x->x_obj.ob_outlet); + a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class); + garray_redraw(a); + } + } + } + else + { + post("tab_rmstodb-ERROR: list need 3 float arguments:"); + post(" source_offset + destination_offset + number_of_samples_to_rmstodb"); + } +} + +static void tab_rmstodb_free(t_tab_rmstodb *x) +{ +} + +static void *tab_rmstodb_new(t_symbol *s, int argc, t_atom *argv) +{ + t_tab_rmstodb *x = (t_tab_rmstodb *)pd_new(tab_rmstodb_class); + t_symbol *src, *dst; + + if((argc >= 2) && + IS_A_SYMBOL(argv,0) && + IS_A_SYMBOL(argv,1)) + { + src = (t_symbol *)atom_getsymbolarg(0, argc, argv); + dst = (t_symbol *)atom_getsymbolarg(1, argc, argv); + } + else if((argc >= 1) && + IS_A_SYMBOL(argv,0)) + { + src = (t_symbol *)atom_getsymbolarg(0, argc, argv); + dst = src; + } + else + { + post("tab_rmstodb-ERROR: need 2 symbols arguments:"); + post(" source_array_name + destination_array_name"); + return(0); + } + + x->x_sym_scr1 = src; + x->x_sym_dst = dst; + outlet_new(&x->x_obj, &s_bang); + return(x); +} + +void tab_rmstodb_setup(void) +{ + tab_rmstodb_class = class_new(gensym("tab_rmstodb"), (t_newmethod)tab_rmstodb_new, (t_method)tab_rmstodb_free, + sizeof(t_tab_rmstodb), 0, A_GIMME, 0); + class_addbang(tab_rmstodb_class, (t_method)tab_rmstodb_bang); + class_addlist(tab_rmstodb_class, (t_method)tab_rmstodb_list); + class_addmethod(tab_rmstodb_class, (t_method)tab_rmstodb_src, gensym("src"), A_DEFSYMBOL, 0); + class_addmethod(tab_rmstodb_class, (t_method)tab_rmstodb_src, gensym("src1"), A_DEFSYMBOL, 0); + class_addmethod(tab_rmstodb_class, (t_method)tab_rmstodb_dst, gensym("dst"), A_DEFSYMBOL, 0); +} diff --git a/externals/iem/iem_tab/tab_dbtopow-help.pd b/externals/iem/iem_tab/tab_dbtopow-help.pd new file mode 100644 index 000000000..cbd9333c6 --- /dev/null +++ b/externals/iem/iem_tab/tab_dbtopow-help.pd @@ -0,0 +1,58 @@ +#N canvas 369 22 790 417 10; +#N canvas 0 22 450 300 (subpatch) 0; +#X array src 100 float 1; +#A 0 0.0214324 5.77858 10.0643 15.0643 17.2072 22.2072 31.4929 33.6358 +37.2072 38.9929 40.7786 45.0644 49.3501 51.4929 53.6358 55.4215 57.2072 +59.3501 61.493 62.6834 63.8739 65.0644 66.8501 68.6358 70.4215 70.7787 +71.493 72.9215 73.2787 73.6358 75.0644 75.4216 75.7787 76.493 76.8501 +77.2073 77.5644 77.9216 78.6358 79.3501 80.0644 80.7787 81.493 81.8501 +82.2073 83.6358 84.3501 85.0644 85.4216 85.7787 87.2073 87.5644 87.9216 +88.6359 89.3501 90.0644 90.7787 90.7787 91.493 92.2073 92.2073 92.2073 +92.2073 92.2073 92.2073 92.2073 93.6359 93.6359 93.6359 93.6359 93.6359 +93.6359 93.6359 93.6359 93.6359 93.6359 93.6359 93.6359 93.6359 94.3502 +94.3502 94.3502 95.0644 95.0644 95.7787 96.493 96.493 96.493 97.9216 +98.6359 98.6359 99.3502 99.3502 99.3502 100.064 100.064 100.064 100.064 +100.779 100.779; +#X coords 0 100 99 0 200 140 1; +#X restore 534 10 graph; +#N canvas 0 22 450 300 (subpatch) 0; +#X array dst 100 float 0; +#X coords 0 1 99 0 200 140 1; +#X restore 534 166 graph; +#X obj 61 31 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 61 106 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 59 301 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 59 211 50 20 50; +#X text 44 154 list of 3 floats:; +#X text 222 273 1.arg: <symbol> source-name; +#X text 222 286 2.arg: <symbol> destination-name; +#X msg 154 213 src src; +#X msg 185 234 dst dst; +#X text 78 365 IEM KUG; +#X text 57 353 musil; +#X text 92 353 @; +#X text 100 353 iem.at; +#X text 61 375 Graz \, Austria; +#X text 56 165 1.) src onset; +#X text 56 175 2.) dst onset; +#X text 231 261 initial arguments:; +#X text 68 283 <bang> output; +#X text 208 213 <src> xxx : change source name; +#X text 240 233 <dst> xxx : change destination name; +#X text 205 69 (the number of samples which are copied are:; +#X text 218 83 the minimum of both array lengths); +#X text 13 342 (c) Thomas Musil 2000 - 2010; +#X text 57 185 3.) n samples of dbtorms; +#X text 12 4 tab_dbtopow; +#X text 91 32 <bang> calculates the dbtopow-value from src to dst; +#X obj 61 79 tab_dbtopow src dst; +#X obj 59 264 tab_dbtopow src dst; +#X connect 2 0 28 0; +#X connect 5 0 29 0; +#X connect 9 0 29 0; +#X connect 10 0 29 0; +#X connect 28 0 3 0; +#X connect 29 0 4 0; diff --git a/externals/iem/iem_tab/tab_dbtorms-help.pd b/externals/iem/iem_tab/tab_dbtorms-help.pd new file mode 100644 index 000000000..a61a5fd4c --- /dev/null +++ b/externals/iem/iem_tab/tab_dbtorms-help.pd @@ -0,0 +1,58 @@ +#N canvas 369 22 790 417 10; +#N canvas 0 22 450 300 (subpatch) 0; +#X array src 100 float 1; +#A 0 0.0214324 5.77858 10.0643 15.0643 17.2072 22.2072 31.4929 33.6358 +37.2072 38.9929 40.7786 45.0644 49.3501 51.4929 53.6358 55.4215 57.2072 +59.3501 61.493 62.6834 63.8739 65.0644 66.8501 68.6358 70.4215 70.7787 +71.493 72.9215 73.2787 73.6358 75.0644 75.4216 75.7787 76.493 76.8501 +77.2073 77.5644 77.9216 78.6358 79.3501 80.0644 80.7787 81.493 81.8501 +82.2073 83.6358 84.3501 85.0644 85.4216 85.7787 87.2073 87.5644 87.9216 +88.6359 89.3501 90.0644 90.7787 90.7787 91.493 92.2073 92.2073 92.2073 +92.2073 92.2073 92.2073 92.2073 93.6359 93.6359 93.6359 93.6359 93.6359 +93.6359 93.6359 93.6359 93.6359 93.6359 93.6359 93.6359 93.6359 94.3502 +94.3502 94.3502 95.0644 95.0644 95.7787 96.493 96.493 96.493 97.9216 +98.6359 98.6359 99.3502 99.3502 99.3502 100.064 100.064 100.064 100.064 +100.779 100.779; +#X coords 0 100 99 0 200 140 1; +#X restore 534 10 graph; +#N canvas 0 22 450 300 (subpatch) 0; +#X array dst 100 float 0; +#X coords 0 1 99 0 200 140 1; +#X restore 534 166 graph; +#X obj 61 31 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 61 106 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 59 301 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 59 211 50 20 50; +#X text 44 154 list of 3 floats:; +#X text 222 273 1.arg: <symbol> source-name; +#X text 222 286 2.arg: <symbol> destination-name; +#X msg 154 213 src src; +#X msg 185 234 dst dst; +#X text 78 365 IEM KUG; +#X text 57 353 musil; +#X text 92 353 @; +#X text 100 353 iem.at; +#X text 61 375 Graz \, Austria; +#X text 56 165 1.) src onset; +#X text 56 175 2.) dst onset; +#X text 231 261 initial arguments:; +#X text 68 283 <bang> output; +#X text 208 213 <src> xxx : change source name; +#X text 240 233 <dst> xxx : change destination name; +#X text 205 69 (the number of samples which are copied are:; +#X text 218 83 the minimum of both array lengths); +#X text 13 342 (c) Thomas Musil 2000 - 2010; +#X text 12 4 tab_dbtorms; +#X text 90 30 <bang> calculates the dbtorms-value from src to dst; +#X obj 61 79 tab_dbtorms src dst; +#X obj 59 264 tab_dbtorms src dst; +#X text 57 185 3.) n samples of dbtorms; +#X connect 2 0 27 0; +#X connect 5 0 28 0; +#X connect 9 0 28 0; +#X connect 10 0 28 0; +#X connect 27 0 3 0; +#X connect 28 0 4 0; diff --git a/externals/iem/iem_tab/tab_powtodb-help.pd b/externals/iem/iem_tab/tab_powtodb-help.pd new file mode 100644 index 000000000..c5ba3eb0b --- /dev/null +++ b/externals/iem/iem_tab/tab_powtodb-help.pd @@ -0,0 +1,59 @@ +#N canvas 369 22 790 417 10; +#N canvas 0 22 450 300 (subpatch) 0; +#X array src 100 float 1; +#A 0 0.0214324 0.0214324 0.0214324 0.0214324 0.0214324 0.0214324 0.0357179 +0.0357179 0.0428607 0.0428607 0.0428607 0.0500035 0.0642891 0.0714318 +0.0785746 0.0857174 0.0857174 0.100003 0.100003 0.107146 0.107146 0.114289 +0.114289 0.121431 0.121431 0.128574 0.128574 0.135717 0.14286 0.14286 +0.14286 0.150002 0.157145 0.157145 0.171431 0.178574 0.185716 0.192859 +0.200002 0.214287 0.214287 0.22143 0.228573 0.242859 0.242859 0.257144 +0.257144 0.264287 0.278573 0.292858 0.300001 0.314286 0.335715 0.35 +0.357143 0.364286 0.378571 0.392857 0.407143 0.414285 0.435714 0.442857 +0.449999 0.457142 0.471428 0.485713 0.492856 0.499999 0.521427 0.52857 +0.542856 0.542856 0.564284 0.578569 0.599998 0.621426 0.635712 0.642854 +0.649997 0.671426 0.685711 0.699997 0.707139 0.714282 0.735711 0.757139 +0.764282 0.771425 0.778567 0.799996 0.807138 0.821424 0.83571 0.864281 +0.885709 0.885709 0.899995 0.935709 0.949994 0.957137; +#X coords 0 1 99 0 200 140 1; +#X restore 534 10 graph; +#N canvas 0 22 450 300 (subpatch) 0; +#X array dst 100 float 0; +#X coords 0 100 99 0 200 140 1; +#X restore 534 166 graph; +#X obj 61 31 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 61 106 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 59 301 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 59 211 50 20 50; +#X text 44 154 list of 3 floats:; +#X text 222 273 1.arg: <symbol> source-name; +#X text 222 286 2.arg: <symbol> destination-name; +#X msg 154 213 src src; +#X msg 185 234 dst dst; +#X text 78 365 IEM KUG; +#X text 57 353 musil; +#X text 92 353 @; +#X text 100 353 iem.at; +#X text 61 375 Graz \, Austria; +#X text 56 165 1.) src onset; +#X text 56 175 2.) dst onset; +#X text 231 261 initial arguments:; +#X text 68 283 <bang> output; +#X text 208 213 <src> xxx : change source name; +#X text 240 233 <dst> xxx : change destination name; +#X text 205 69 (the number of samples which are copied are:; +#X text 218 83 the minimum of both array lengths); +#X text 13 342 (c) Thomas Musil 2000 - 2010; +#X text 90 29 <bang> calculates the powtodb-value from src to dst; +#X obj 61 78 tab_powtodb src dst; +#X obj 59 264 tab_powtodb src dst; +#X text 57 185 3.) n samples of powtodb; +#X text 12 4 tab_powtodb; +#X connect 2 0 26 0; +#X connect 5 0 27 0; +#X connect 9 0 27 0; +#X connect 10 0 27 0; +#X connect 26 0 3 0; +#X connect 27 0 4 0; diff --git a/externals/iem/iem_tab/tab_rmstodb-help.pd b/externals/iem/iem_tab/tab_rmstodb-help.pd new file mode 100644 index 000000000..06d20dbfb --- /dev/null +++ b/externals/iem/iem_tab/tab_rmstodb-help.pd @@ -0,0 +1,59 @@ +#N canvas 369 22 790 417 10; +#N canvas 0 22 450 300 (subpatch) 0; +#X array src 100 float 1; +#A 0 0.0214324 0.0214324 0.0214324 0.0214324 0.0214324 0.0214324 0.0357179 +0.0357179 0.0428607 0.0428607 0.0428607 0.0500035 0.0642891 0.0714318 +0.0785746 0.0857174 0.0857174 0.100003 0.100003 0.107146 0.107146 0.114289 +0.114289 0.121431 0.121431 0.128574 0.128574 0.135717 0.14286 0.14286 +0.14286 0.150002 0.157145 0.157145 0.171431 0.178574 0.185716 0.192859 +0.200002 0.214287 0.214287 0.22143 0.228573 0.242859 0.242859 0.257144 +0.257144 0.264287 0.278573 0.292858 0.300001 0.314286 0.335715 0.35 +0.357143 0.364286 0.378571 0.392857 0.407143 0.414285 0.435714 0.442857 +0.449999 0.457142 0.471428 0.485713 0.492856 0.499999 0.521427 0.52857 +0.542856 0.542856 0.564284 0.578569 0.599998 0.621426 0.635712 0.642854 +0.649997 0.671426 0.685711 0.699997 0.707139 0.714282 0.735711 0.757139 +0.764282 0.771425 0.778567 0.799996 0.807138 0.821424 0.83571 0.864281 +0.885709 0.885709 0.899995 0.935709 0.949994 0.957137; +#X coords 0 1 99 0 200 140 1; +#X restore 534 10 graph; +#N canvas 0 22 450 300 (subpatch) 0; +#X array dst 100 float 0; +#X coords 0 100 99 0 200 140 1; +#X restore 534 166 graph; +#X obj 61 31 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 61 106 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 59 301 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 59 211 50 20 50; +#X text 44 154 list of 3 floats:; +#X text 222 273 1.arg: <symbol> source-name; +#X text 222 286 2.arg: <symbol> destination-name; +#X msg 154 213 src src; +#X msg 185 234 dst dst; +#X text 78 365 IEM KUG; +#X text 57 353 musil; +#X text 92 353 @; +#X text 100 353 iem.at; +#X text 61 375 Graz \, Austria; +#X text 56 165 1.) src onset; +#X text 56 175 2.) dst onset; +#X text 231 261 initial arguments:; +#X text 68 283 <bang> output; +#X text 208 213 <src> xxx : change source name; +#X text 240 233 <dst> xxx : change destination name; +#X text 205 69 (the number of samples which are copied are:; +#X text 218 83 the minimum of both array lengths); +#X text 12 4 tab_rmstodb; +#X obj 61 78 tab_rmstodb src dst; +#X text 57 185 3.) n samples of rmstodb; +#X obj 59 264 tab_rmstodb src dst; +#X text 13 342 (c) Thomas Musil 2000 - 2010; +#X text 90 29 <bang> calculates the rmstodb-value from src to dst; +#X connect 2 0 25 0; +#X connect 5 0 27 0; +#X connect 9 0 27 0; +#X connect 10 0 27 0; +#X connect 25 0 3 0; +#X connect 27 0 4 0; -- GitLab