aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--analyze-100.pd (renamed from filterbank~/analyze-100.pd)0
-rw-r--r--audience~-help.pd (renamed from audience~/audience~-help.pd)0
-rw-r--r--audience~.c (renamed from audience~/audience~.c)13
-rw-r--r--audience~.h (renamed from audience~/audience~.h)0
-rw-r--r--audience~.tcl (renamed from audience~/audience~.tk)0
-rw-r--r--audience~/INSTALL15
-rw-r--r--audience~/audience~.tk2c69
-rw-r--r--beatify~-help.pd (renamed from beatify~/beatify~-help.pd)0
-rw-r--r--beatify~.c (renamed from beatify~/beatify~.c)0
-rw-r--r--beatify~/INSTALL15
-rw-r--r--blinkenlights-help.pd (renamed from blinkenlights/blinkenlights-help.pd)0
-rw-r--r--blinkenlights.c (renamed from blinkenlights/blinkenlights.c)0
-rw-r--r--blinkenlights/INSTALL15
-rw-r--r--compressor~-help.pd (renamed from compressor~/compressor~-help.pd)0
-rw-r--r--compressor~.c (renamed from compressor~/compressor~.c)0
-rw-r--r--compressor~/INSTALL15
-rw-r--r--cooled~-help.pd (renamed from cooled~/cooled~-help.pd)0
-rw-r--r--cooled~.c (renamed from cooled~/cooled~.c)21
-rw-r--r--cooled~.tcl (renamed from cooled~/cooled~.tk)0
-rw-r--r--cooled~/INSTALL15
-rwxr-xr-xcooled~/cooled~.tk2c65
-rwxr-xr-xcooled~/tk2c.bash24
-rw-r--r--countund-help.pd (renamed from countund/countund-help.pd)0
-rw-r--r--countund.c (renamed from countund/countund.c)0
-rw-r--r--countund/INSTALL7
-rw-r--r--disto~-help.pd (renamed from disto~/disto~-help.pd)0
-rw-r--r--disto~.c (renamed from disto~/disto~.c)0
-rw-r--r--disto~/INSTALL15
-rw-r--r--examples/speaker.gif (renamed from audience~/speaker.gif)bin83 -> 83 bytes
-rw-r--r--examples/wanderer.gif (renamed from audience~/wanderer.gif)bin962 -> 962 bytes
-rw-r--r--examples/yesterday.txt (renamed from scrolllist/yesterday.txt)0
-rw-r--r--exciter-help.pd (renamed from exciter/exciter-help.pd)0
-rw-r--r--exciter.c (renamed from exciter/exciter.c)5
-rw-r--r--exciter.h (renamed from exciter/exciter.h)0
-rw-r--r--exciter.tcl (renamed from exciter/exciter.tk)0
-rw-r--r--exciter/INSTALL15
-rwxr-xr-xexciter/exciter.tk2c94
-rwxr-xr-xexciter/tk2c.bash24
-rw-r--r--filterbank~-help.pd (renamed from filterbank~/filterbank~-help.pd)0
-rw-r--r--filterbank~.c (renamed from filterbank~/filterbank~.c)6
-rw-r--r--filterbank~.h (renamed from filterbank~/filterbank~.h)0
-rw-r--r--filterbank~.tcl (renamed from filterbank~/filterbank~.tk)0
-rw-r--r--filterbank~/INSTALL15
-rwxr-xr-xfilterbank~/filterbank~.tk2c58
-rwxr-xr-xfilterbank~/tk2c.bash24
-rw-r--r--filters.c (renamed from vocoder~/filters.c)0
-rw-r--r--formant~-help.pd (renamed from formant~/formant~-help.pd)0
-rw-r--r--formant~.c (renamed from formant~/formant~.c)0
-rw-r--r--formant~/INSTALL9
-rw-r--r--g_grid.h (renamed from grid/g_grid.h)0
-rw-r--r--graphic-mp3amp~-help.pd (renamed from mp3amp~/graphic-mp3amp~-help.pd)0
-rw-r--r--grid-help.pd (renamed from grid/grid-help.pd)0
-rw-r--r--grid.c (renamed from grid/grid.c)4
-rw-r--r--grid.tcl (renamed from grid/grid.tk)0
-rw-r--r--grid/INSTALL15
-rw-r--r--grid/grid.tk2c164
-rwxr-xr-xgrid/tk2c.bash24
-rw-r--r--interface.h (renamed from mp3amp~/interface.h)0
-rw-r--r--lpc.c (renamed from vocoder~/lpc.c)0
-rw-r--r--mp3amp~-help.pd (renamed from mp3amp~/mp3amp~-help.pd)0
-rw-r--r--mp3amp~.c (renamed from mp3amp~/mp3amp~.c)0
-rw-r--r--mp3amp~/INSTALL19
-rw-r--r--mp3cast~-help.pd (renamed from mp3cast~/mp3cast~-help.pd)0
-rw-r--r--mp3cast~.c (renamed from mp3cast~/mp3cast~.c)0
-rw-r--r--mp3cast~/INSTALL15
-rw-r--r--mp3cast~/interface.h32
-rw-r--r--mp3cast~/mpglib.h65
-rw-r--r--mp3fileout~.c (renamed from mp3live~/mp3fileout~.c)8
-rw-r--r--mp3live~-help.pd (renamed from mp3live~/mp3live~-help.pd)0
-rw-r--r--mp3live~/INSTALL21
-rw-r--r--mp3live~/interface.h32
-rw-r--r--mp3live~/mpglib.h65
-rw-r--r--mp3streamin~.c (renamed from mp3live~/mp3streamin~.c)0
-rw-r--r--mp3streamout~.c (renamed from mp3live~/mp3streamout~.c)16
-rw-r--r--mp3write~-help.pd (renamed from mp3write~/mp3write~-help.pd)0
-rw-r--r--mp3write~.c (renamed from mp3write~/mp3write~.c)20
-rw-r--r--mp3write~/INSTALL15
-rw-r--r--mp3write~/interface.h32
-rw-r--r--mp3write~/mpglib.h65
-rw-r--r--mpglib.h (renamed from mp3amp~/mpglib.h)0
-rw-r--r--mrandtab.pd (renamed from randomblock~/mrandtab.pd)0
-rw-r--r--pianoroll-help.pd (renamed from pianoroll/pianoroll-help.pd)0
-rw-r--r--pianoroll.c (renamed from pianoroll/pianoroll.c)6
-rw-r--r--pianoroll.h (renamed from pianoroll/pianoroll.h)0
-rw-r--r--pianoroll.tcl (renamed from pianoroll/pianoroll.tk)0
-rw-r--r--pianoroll/INSTALL15
-rwxr-xr-xpianoroll/pianoroll.tk2c131
-rwxr-xr-xpianoroll/tk2c.bash24
-rw-r--r--playlist-help.pd (renamed from playlist/playlist-help.pd)0
-rw-r--r--playlist.c (renamed from playlist/playlist.c)4
-rw-r--r--playlist.tcl (renamed from playlist/playlist.tk)0
-rw-r--r--playlist/INSTALL15
-rw-r--r--playlist/playlist.tk2c123
-rwxr-xr-xplaylist/tk2c.bash24
-rw-r--r--probalizer-help.pd (renamed from probalizer/probalizer-help.pd)0
-rw-r--r--probalizer.c (renamed from probalizer/probalizer.c)7
-rw-r--r--probalizer.h (renamed from probalizer/probalizer.h)0
-rw-r--r--probalizer.tcl (renamed from probalizer/probalizer.tk)0
-rw-r--r--probalizer/INSTALL14
-rwxr-xr-xprobalizer/probalizer.tk2c87
-rwxr-xr-xprobalizer/tk2c.bash24
-rw-r--r--randomblock~-help.pd (renamed from randomblock~/randomblock~-help.pd)0
-rw-r--r--randomblock~.c (renamed from randomblock~/randomblock~.c)0
-rw-r--r--randomblock~/INSTALL7
-rw-r--r--randtab.pd (renamed from randomblock~/randtab.pd)0
-rw-r--r--resynth-64.pd (renamed from filterbank~/resynth-64.pd)0
-rw-r--r--rs-disto~.pd (renamed from disto~/rs-disto~.pd)0
-rw-r--r--rs-scratcher~.pd (renamed from scratcher~/rs-scratcher~.pd)0
-rw-r--r--rs-sonogram~.pd (renamed from sonogram~/rs-sonogram~.pd)0
-rw-r--r--rs-sonograph~.pd (renamed from sonogram~/rs-sonograph~.pd)0
-rw-r--r--rs-vocoder~.pd (renamed from vocoder~/rs-vocoder~.pd)0
-rw-r--r--rs-wahwah~.pd (renamed from wahwah~/rs-wahwah~.pd)0
-rw-r--r--samplebox~-help.pd (renamed from samplebox~/samplebox~-help.pd)0
-rw-r--r--samplebox~.c (renamed from samplebox~/samplebox~.c)0
-rw-r--r--samplebox~/INSTALL9
-rw-r--r--scratcher~-help.pd (renamed from scratcher~/scratcher~-help.pd)0
-rw-r--r--scratcher~.c (renamed from scratcher~/scratcher~.c)15
-rw-r--r--scratcher~.tcl (renamed from scratcher~/scratcher~.tk)0
-rw-r--r--scratcher~/INSTALL15
-rwxr-xr-xscratcher~/scratcher~.tk2c58
-rw-r--r--scratcher~/timeval.h76
-rwxr-xr-xscratcher~/tk2c.bash24
-rwxr-xr-xscrolllist-help.pd (renamed from scrolllist/scrolllist-help.pd)11
-rw-r--r--scrolllist.c (renamed from scrolllist/scrolllist.c)6
-rwxr-xr-xscrolllist.tcl (renamed from scrolllist/scrolllist.tk)0
-rwxr-xr-xscrolllist/INSTALL14
-rw-r--r--scrolllist/ave-lucifer.txt35
-rw-r--r--scrolllist/scrolllist.tk2c112
-rwxr-xr-xscrolllist/tk2c.bash24
-rw-r--r--setosc.pd (renamed from filterbank~/setosc.pd)0
-rw-r--r--sonogram~-help.pd (renamed from sonogram~/sonogram~-help.pd)0
-rw-r--r--sonogram~.c (renamed from sonogram~/sonogram~.c)0
-rw-r--r--sonogram~/INSTALL15
-rw-r--r--sonogram~/sonogram~-joge.c2044
-rw-r--r--sonogram~/sonogram~-yves.c2017
-rw-r--r--sonograph~-help.pd (renamed from sonogram~/sonograph~-help.pd)0
-rw-r--r--speexin~.c (renamed from speex~/speexin~.c)0
-rw-r--r--speexout~.c (renamed from speex~/speexout~.c)12
-rw-r--r--speex~-help.pd (renamed from speex~/speex~-help.pd)0
-rw-r--r--speex~/INSTALL18
-rw-r--r--spigot~-help.pd (renamed from spigot~/spigot~-help.pd)0
-rw-r--r--spigot~.c (renamed from spigot~/spigot~.c)0
-rw-r--r--spigot~/INSTALL15
-rw-r--r--tables.c (renamed from vocoder~/tables.c)0
-rw-r--r--test-streaming-mp3.pd (renamed from mp3live~/test-streaming-mp3.pd)0
-rw-r--r--timeval.h (renamed from exciter/timeval.h)0
-rwxr-xr-xtk2c.bash24
-rw-r--r--vocoder~-help.pd (renamed from vocoder~/vocoder~-help.pd)0
-rw-r--r--vocoder~.c (renamed from vocoder~/vocoder~.c)0
-rw-r--r--vocoder~/INSTALL15
-rw-r--r--wahwah~-help.pd (renamed from wahwah~/wahwah~-help.pd)0
-rw-r--r--wahwah~.c (renamed from wahwah~/wahwah~.c)0
-rw-r--r--wahwah~/INSTALL15
-rw-r--r--xmms.pd (renamed from playlist/xmms.pd)0
154 files changed, 89 insertions, 6117 deletions
diff --git a/filterbank~/analyze-100.pd b/analyze-100.pd
index 132876b..132876b 100644
--- a/filterbank~/analyze-100.pd
+++ b/analyze-100.pd
diff --git a/audience~/audience~-help.pd b/audience~-help.pd
index ee90caf..ee90caf 100644
--- a/audience~/audience~-help.pd
+++ b/audience~-help.pd
diff --git a/audience~/audience~.c b/audience~.c
index b14b139..1c32c28 100644
--- a/audience~/audience~.c
+++ b/audience~.c
@@ -42,7 +42,7 @@
#include "audience~.h"
-#ifdef NT
+#ifdef _WIN32
#include <io.h>
#else
#include <unistd.h>
@@ -190,8 +190,8 @@ static void audience_draw_new(t_audience_tilde *x, t_glist *glist)
// create speaker images
for ( ei=0; ei<x->x_nbinputs; ei++ )
{
- SYS_VGUI5("image create photo %xSPEAKER%d -file /tmp/speaker.gif -format gif -width %d -height %d\n",
- x, ei, SPEAKER_WIDTH, SPEAKER_HEIGHT );
+ SYS_VGUI6("image create photo %xSPEAKER%d -file %s/examples/speaker.gif -format gif -width %d -height %d\n",
+ x, ei, audience_class_tilde->c_externdir->s_name, SPEAKER_WIDTH, SPEAKER_HEIGHT );
SYS_VGUI8(".x%x.c create image %d %d -image %xSPEAKER%d -tags %xISPEAKER%d\n",
canvas,
text_xpix(&x->x_obj, glist) + x->x_inputs_x[ei],
@@ -204,8 +204,8 @@ static void audience_draw_new(t_audience_tilde *x, t_glist *glist)
// create listener images
for ( ei=0; ei<x->x_nboutputs; ei++ )
{
- SYS_VGUI5("image create photo %xLISTENER%d -file /tmp/wanderer.gif -format gif -width %d -height %d\n",
- x, ei, LISTENER_WIDTH, LISTENER_HEIGHT );
+ SYS_VGUI6("image create photo %xLISTENER%d -file %s/examples/wanderer.gif -format gif -width %d -height %d\n",
+ x, ei, audience_class_tilde->c_externdir->s_name, LISTENER_WIDTH, LISTENER_HEIGHT );
SYS_VGUI8(".x%x.c create image %d %d -image %xLISTENER%d -tags %xILISTENER%d\n",
canvas,
text_xpix(&x->x_obj, glist) + x->x_outputs_x[ei],
@@ -1034,7 +1034,6 @@ static void audience_delay(t_audience_tilde *x, t_floatarg fdelay )
void audience_tilde_setup(void)
{
post( audience_version );
-#include "audience~.tk2c"
audience_class_tilde = class_new(gensym("audience~"), (t_newmethod)audience_new,
(t_method)audience_free, sizeof(t_audience_tilde), 0, A_GIMME, 0);
CLASS_MAINSIGNALIN( audience_class_tilde, t_audience_tilde, x_f );
@@ -1060,4 +1059,6 @@ void audience_tilde_setup(void)
class_setwidget(audience_class_tilde, &audience_widgetbehavior);
+ sys_vgui("eval [read [open %s/%s.tcl]]\n",
+ audience_class_tilde->c_externdir->s_name, audience_class_tilde->c_name->s_name);
}
diff --git a/audience~/audience~.h b/audience~.h
index b02d1b2..b02d1b2 100644
--- a/audience~/audience~.h
+++ b/audience~.h
diff --git a/audience~/audience~.tk b/audience~.tcl
index fcf7458..fcf7458 100644
--- a/audience~/audience~.tk
+++ b/audience~.tcl
diff --git a/audience~/INSTALL b/audience~/INSTALL
deleted file mode 100644
index a1a03e0..0000000
--- a/audience~/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/audience~
-
-make clean
-
-make
-
-make install
-
-open help-audience~.pd
-
-Thanx for getting here.
-Yves/
-comments and bugs @ ydegoyon@free.fr
diff --git a/audience~/audience~.tk2c b/audience~/audience~.tk2c
deleted file mode 100644
index ea3a7a3..0000000
--- a/audience~/audience~.tk2c
+++ /dev/null
@@ -1,69 +0,0 @@
-// ########### audience procedures -- ydegoyon@free.fr #########
-sys_gui("proc audience_apply {id} {\n");
-// strip "." from the TK id to make a variable name suffix
-sys_gui("set vid [string trimleft $id .]\n");
-// for each variable, make a local variable to hold its name...
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_height [concat graph_height_$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set var_graph_nboutputs [concat graph_nboutputs_$vid]\n");
-sys_gui("global $var_graph_nboutputs\n");
-sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_width] [eval concat $$var_graph_height] [eval concat $$var_graph_nboutputs] \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc audience_cancel {id} {\n");
-sys_gui("set cmd [concat $id cancel \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc audience_ok {id} {\n");
-sys_gui("audience_apply $id\n");
-sys_gui("audience_cancel $id\n");
-sys_gui("}\n");
-sys_gui("proc pdtk_audience_dialog {id width height nboutputs} {\n");
-sys_gui("set vid [string trimleft $id .]\n");
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_height [concat graph_height_$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set var_graph_nboutputs [concat graph_nboutputs_$vid]\n");
-sys_gui("global $var_graph_nboutputs\n");
-sys_gui("set $var_graph_width $width\n");
-sys_gui("set $var_graph_height $height\n");
-sys_gui("set $var_graph_nboutputs $nboutputs\n");
-sys_gui("toplevel $id\n");
-sys_gui("wm title $id {audience}\n");
-sys_gui("wm protocol $id WM_DELETE_WINDOW [concat audience_cancel $id]\n");
-sys_gui("label $id.label -text {2$ SPACE PROPERTIES}\n");
-sys_gui("pack $id.label -side top\n");
-sys_gui("frame $id.buttonframe\n");
-sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n");
-sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"audience_cancel $id\"\n");
-sys_gui("button $id.buttonframe.apply -text {Apply} -command \"audience_apply $id\"\n");
-sys_gui("button $id.buttonframe.ok -text {OK} -command \"audience_ok $id\"\n");
-sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.apply -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.ok -side left -expand 1\n");
-sys_gui("frame $id.1rangef\n");
-sys_gui("pack $id.1rangef -side top\n");
-sys_gui("label $id.1rangef.lwidth -text \"Width :\"\n");
-sys_gui("entry $id.1rangef.width -textvariable $var_graph_width -width 7\n");
-sys_gui("pack $id.1rangef.lwidth $id.1rangef.width -side left\n");
-sys_gui("frame $id.2rangef\n");
-sys_gui("pack $id.2rangef -side top\n");
-sys_gui("label $id.2rangef.lheight -text \"Height :\"\n");
-sys_gui("entry $id.2rangef.height -textvariable $var_graph_height -width 7\n");
-sys_gui("pack $id.2rangef.lheight $id.2rangef.height -side left\n");
-sys_gui("frame $id.3rangef\n");
-sys_gui("pack $id.3rangef -side top\n");
-sys_gui("label $id.3rangef.lnboutputs -text \"Nb Listeners :\"\n");
-sys_gui("entry $id.3rangef.nboutputs -textvariable $var_graph_nboutputs -width 7\n");
-sys_gui("pack $id.3rangef.lnboutputs $id.3rangef.nboutputs -side left\n");
-sys_gui("bind $id.1rangef.width <KeyPress-Return> [concat audience_ok $id]\n");
-sys_gui("bind $id.2rangef.height <KeyPress-Return> [concat audience_ok $id]\n");
-sys_gui("bind $id.3rangef.nboutputs <KeyPress-Return> [concat audience_ok $id]\n");
-sys_gui("focus $id.1rangef.width\n");
-sys_gui("}\n");
-// ########### audience procedures END -- ydegoyon@free.fr #########
diff --git a/beatify~/beatify~-help.pd b/beatify~-help.pd
index 16577a0..16577a0 100644
--- a/beatify~/beatify~-help.pd
+++ b/beatify~-help.pd
diff --git a/beatify~/beatify~.c b/beatify~.c
index 69c2dd0..69c2dd0 100644
--- a/beatify~/beatify~.c
+++ b/beatify~.c
diff --git a/beatify~/INSTALL b/beatify~/INSTALL
deleted file mode 100644
index db33979..0000000
--- a/beatify~/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/beatify~
-
-make clean
-
-make
-
-make install
-
-open help-beatify~.pd
-
-Thanx for getting here.
-Yves/
-comments and bugs @ ydegoyon@free.fr
diff --git a/blinkenlights/blinkenlights-help.pd b/blinkenlights-help.pd
index 32baca0..32baca0 100644
--- a/blinkenlights/blinkenlights-help.pd
+++ b/blinkenlights-help.pd
diff --git a/blinkenlights/blinkenlights.c b/blinkenlights.c
index 03abda9..03abda9 100644
--- a/blinkenlights/blinkenlights.c
+++ b/blinkenlights.c
diff --git a/blinkenlights/INSTALL b/blinkenlights/INSTALL
deleted file mode 100644
index 218e125..0000000
--- a/blinkenlights/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/blinkenlights
-
-make clean
-
-make
-
-make install
-
-open help-blinkenlights.pd
-
-Thanx for getting here.
-Yves/
-comments and bugs @ ydegoyon@free.fr
diff --git a/compressor~/compressor~-help.pd b/compressor~-help.pd
index 0b5d277..0b5d277 100644
--- a/compressor~/compressor~-help.pd
+++ b/compressor~-help.pd
diff --git a/compressor~/compressor~.c b/compressor~.c
index 01204f3..01204f3 100644
--- a/compressor~/compressor~.c
+++ b/compressor~.c
diff --git a/compressor~/INSTALL b/compressor~/INSTALL
deleted file mode 100644
index 8139fba..0000000
--- a/compressor~/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/compressor~
-
-make clean
-
-make
-
-make install
-
-open help-compressor~.pd
-
-Thanx for getting here.
-Yves/
-comments and bugs @ ydegoyon@free.fr
diff --git a/cooled~/cooled~-help.pd b/cooled~-help.pd
index 19a6d67..19a6d67 100644
--- a/cooled~/cooled~-help.pd
+++ b/cooled~-help.pd
diff --git a/cooled~/cooled~.c b/cooled~.c
index 87cec0e..ed5b4b8 100644
--- a/cooled~/cooled~.c
+++ b/cooled~.c
@@ -36,16 +36,21 @@
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
-#include <malloc.h>
#include <ctype.h>
#include <pthread.h>
-#ifdef UNIX
-#include <unistd.h>
+#include <math.h>
+
+#ifdef __APPLE__
+# include <sys/malloc.h>
+#else
+# include <malloc.h>
#endif
-#ifdef NT
-#define M_PI 3.14159265358979323846
+
+#ifdef _WIN32
+# define M_PI 3.14159265358979323846
+#else
+# include <unistd.h>
#endif
-#include <math.h>
#include "m_pd.h"
#include "m_imp.h"
@@ -1353,7 +1358,6 @@ static void *cooled_new(t_symbol *s, int argc, t_atom *argv)
void cooled_tilde_setup(void)
{
-#include "cooled~.tk2c"
post(cooled_version);
cooled_class = class_new(gensym("cooled~"), (t_newmethod)cooled_new, (t_method)cooled_free,
sizeof(t_cooled), 0, A_GIMME, 0);
@@ -1384,4 +1388,7 @@ void cooled_tilde_setup(void)
class_addmethod(cooled_class, (t_method)cooled_readspeed, gensym("readspeed"), A_FLOAT, A_NULL);
class_addmethod(cooled_class, (t_method)cooled_loop, gensym("loop"), A_SYMBOL, A_NULL);
class_addmethod(cooled_class, (t_method)cooled_dialog, gensym("dialog"), A_GIMME, 0);
+
+ sys_vgui("eval [read [open %s/%s.tcl]]\n",
+ cooled_class->c_externdir->s_name, cooled_class->c_name->s_name);
}
diff --git a/cooled~/cooled~.tk b/cooled~.tcl
index ebd7699..ebd7699 100644
--- a/cooled~/cooled~.tk
+++ b/cooled~.tcl
diff --git a/cooled~/INSTALL b/cooled~/INSTALL
deleted file mode 100644
index 411a1c3..0000000
--- a/cooled~/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/cooled~
-
-make clean
-
-make
-
-make install
-
-open help-cooled~.pd
-
-Thanx for getting here.
-Yves/
-comments and bugs @ ydegoyon@free.fr
diff --git a/cooled~/cooled~.tk2c b/cooled~/cooled~.tk2c
deleted file mode 100755
index 417c279..0000000
--- a/cooled~/cooled~.tk2c
+++ /dev/null
@@ -1,65 +0,0 @@
-// ########### cooled procedures -- ydegoyon@free.fr #########
-sys_gui("proc cooled_apply {id} {\n");
-// strip "." from the TK id to make a variable name suffix
-sys_gui("set vid [string trimleft $id .]\n");
-// for each variable, make a local variable to hold its name...
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_height [concat graph_height_$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set var_graph_draw [concat graph_draw_$vid]\n");
-sys_gui("global $var_graph_draw\n");
-sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_width] [eval concat $$var_graph_height] [eval concat $$var_graph_draw] \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc cooled_cancel {id} {\n");
-sys_gui("set cmd [concat $id cancel \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc cooled_ok {id} {\n");
-sys_gui("cooled_apply $id\n");
-sys_gui("cooled_cancel $id\n");
-sys_gui("}\n");
-sys_gui("proc pdtk_cooled_dialog {id width height draw} {\n");
-sys_gui("set vid [string trimleft $id .]\n");
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_height [concat graph_height_$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set var_graph_draw [concat graph_draw_$vid]\n");
-sys_gui("global $var_graph_draw\n");
-sys_gui("set $var_graph_width $width\n");
-sys_gui("set $var_graph_height $height\n");
-sys_gui("set $var_graph_draw $draw\n");
-sys_gui("toplevel $id\n");
-sys_gui("wm title $id {cooled}\n");
-sys_gui("wm protocol $id WM_DELETE_WINDOW [concat cooled_cancel $id]\n");
-sys_gui("label $id.label -text {EDITOR PROPERTIES}\n");
-sys_gui("pack $id.label -side top\n");
-sys_gui("frame $id.buttonframe\n");
-sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n");
-sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"cooled_cancel $id\"\n");
-sys_gui("button $id.buttonframe.apply -text {Apply} -command \"cooled_apply $id\"\n");
-sys_gui("button $id.buttonframe.ok -text {OK} -command \"cooled_ok $id\"\n");
-sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.apply -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.ok -side left -expand 1\n");
-sys_gui("frame $id.1rangef\n");
-sys_gui("pack $id.1rangef -side top\n");
-sys_gui("label $id.1rangef.lwidth -text \"Width :\"\n");
-sys_gui("entry $id.1rangef.width -textvariable $var_graph_width -width 7\n");
-sys_gui("pack $id.1rangef.lwidth $id.1rangef.width -side left\n");
-sys_gui("frame $id.2rangef\n");
-sys_gui("pack $id.2rangef -side top\n");
-sys_gui("label $id.2rangef.lheight -text \"Height :\"\n");
-sys_gui("entry $id.2rangef.height -textvariable $var_graph_height -width 7\n");
-sys_gui("pack $id.2rangef.lheight $id.2rangef.height -side left\n");
-sys_gui("checkbutton $id.draw -text {Draw Sample} -variable $var_graph_draw -anchor w\n");
-sys_gui("pack $id.draw -side top\n");
-sys_gui("bind $id.1rangef.width <KeyPress-Return> [concat cooled_ok $id]\n");
-sys_gui("bind $id.2rangef.height <KeyPress-Return> [concat cooled_ok $id]\n");
-sys_gui("focus $id.1rangef.width\n");
-sys_gui("}\n");
-// ########### cooled procedures END -- ydegoyon@free.fr #########
diff --git a/cooled~/tk2c.bash b/cooled~/tk2c.bash
deleted file mode 100755
index 9dfeb03..0000000
--- a/cooled~/tk2c.bash
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-#set -x
-
-while read line
-do
- for word in $line
- do
- if [ "X"$word != "X"${word#\#} ]
- then
- echo // ${line#\#}
- break
- else
- line=${line//\'/\\\'}
-#useless, slashes never gets in
- line=${line//\\/\\\\}
-#this one's dirty, i know
- line=${line//;/\\\\;}
- line=${line//\"/\\\"}
- echo 'sys_gui("'$line'\n");'
- break
- fi
- done
-done
diff --git a/countund/countund-help.pd b/countund-help.pd
index 89c1207..89c1207 100644
--- a/countund/countund-help.pd
+++ b/countund-help.pd
diff --git a/countund/countund.c b/countund.c
index 976f79c..976f79c 100644
--- a/countund/countund.c
+++ b/countund.c
diff --git a/countund/INSTALL b/countund/INSTALL
deleted file mode 100644
index f2488de..0000000
--- a/countund/INSTALL
+++ /dev/null
@@ -1,7 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/extra/countund~
-
-make
-
-you're set !!
diff --git a/disto~/disto~-help.pd b/disto~-help.pd
index 593702b..593702b 100644
--- a/disto~/disto~-help.pd
+++ b/disto~-help.pd
diff --git a/disto~/disto~.c b/disto~.c
index 66865db..66865db 100644
--- a/disto~/disto~.c
+++ b/disto~.c
diff --git a/disto~/INSTALL b/disto~/INSTALL
deleted file mode 100644
index 319f22a..0000000
--- a/disto~/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/disto~
-
-make clean
-
-make
-
-make install
-
-open help-disto~.pd
-
-Thanx for getting here.
-Yves/
-comments and bugs @ ydegoyon@free.fr
diff --git a/audience~/speaker.gif b/examples/speaker.gif
index 6dd9fd4..6dd9fd4 100644
--- a/audience~/speaker.gif
+++ b/examples/speaker.gif
Binary files differ
diff --git a/audience~/wanderer.gif b/examples/wanderer.gif
index b2a9f8c..b2a9f8c 100644
--- a/audience~/wanderer.gif
+++ b/examples/wanderer.gif
Binary files differ
diff --git a/scrolllist/yesterday.txt b/examples/yesterday.txt
index acbd1ed..acbd1ed 100644
--- a/scrolllist/yesterday.txt
+++ b/examples/yesterday.txt
diff --git a/exciter/exciter-help.pd b/exciter-help.pd
index ab60831..ab60831 100644
--- a/exciter/exciter-help.pd
+++ b/exciter-help.pd
diff --git a/exciter/exciter.c b/exciter.c
index 009776f..cfbd365 100644
--- a/exciter/exciter.c
+++ b/exciter.c
@@ -44,7 +44,7 @@
#include "exciter.h"
-#ifdef NT
+#ifdef _WIN32
#include <io.h>
#else
#include <unistd.h>
@@ -789,7 +789,6 @@ static void exciter_free(t_exciter *x)
void exciter_setup(void)
{
post( exciter_version );
-#include "exciter.tk2c"
exciter_class = class_new(gensym("exciter"), (t_newmethod)exciter_new,
(t_method)exciter_free, sizeof(t_exciter), 0, A_GIMME, 0);
class_addmethod(exciter_class, (t_method)exciter_dialog, gensym("dialog"), A_GIMME, 0);
@@ -819,4 +818,6 @@ void exciter_setup(void)
class_setwidget(exciter_class, &exciter_widgetbehavior);
+ sys_vgui("eval [read [open %s/%s.tcl]]\n",
+ exciter_class->c_externdir->s_name, exciter_class->c_name->s_name);
}
diff --git a/exciter/exciter.h b/exciter.h
index 81076a1..81076a1 100644
--- a/exciter/exciter.h
+++ b/exciter.h
diff --git a/exciter/exciter.tk b/exciter.tcl
index c0280e6..c0280e6 100644
--- a/exciter/exciter.tk
+++ b/exciter.tcl
diff --git a/exciter/INSTALL b/exciter/INSTALL
deleted file mode 100644
index 55894c3..0000000
--- a/exciter/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/exciter
-
-make clean
-
-make
-
-make install
-
-open help-exciter.pd
-
-Thanx for getting here.
-Yves/
-comments and bugs @ ydegoyon@free.fr
diff --git a/exciter/exciter.tk2c b/exciter/exciter.tk2c
deleted file mode 100755
index e201737..0000000
--- a/exciter/exciter.tk2c
+++ /dev/null
@@ -1,94 +0,0 @@
-// ########### exciter procedures -- ydegoyon@free.fr #########
-sys_gui("proc exciter_apply {id} {\n");
-// strip "." from the TK id to make a variable name suffix
-sys_gui("set vid [string trimleft $id .]\n");
-// for each variable, make a local variable to hold its name...
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_height [concat graph_height_$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set var_graph_nbevents [concat graph_nbevents_$vid]\n");
-sys_gui("global $var_graph_nbevents\n");
-sys_gui("set var_graph_timegrain [concat graph_timegrain_$vid]\n");
-sys_gui("global $var_graph_timegrain\n");
-sys_gui("set var_graph_loop [concat graph_loop_$vid]\n");
-sys_gui("global $var_graph_loop\n");
-sys_gui("set var_graph_save [concat graph_save_$vid]\n");
-sys_gui("global $var_graph_save\n");
-sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_width] [eval concat $$var_graph_height] [eval concat $$var_graph_nbevents] [eval concat $$var_graph_timegrain] [eval concat $$var_graph_loop] [eval concat $$var_graph_save] \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc exciter_cancel {id} {\n");
-sys_gui("set cmd [concat $id cancel \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc exciter_ok {id} {\n");
-sys_gui("exciter_apply $id\n");
-sys_gui("exciter_cancel $id\n");
-sys_gui("}\n");
-sys_gui("proc pdtk_exciter_dialog {id width height nbevents timegrain loop save } {\n");
-sys_gui("set vid [string trimleft $id .]\n");
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_height [concat graph_height_$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set var_graph_nbevents [concat graph_nbevents_$vid]\n");
-sys_gui("global $var_graph_nbevents\n");
-sys_gui("set var_graph_timegrain [concat graph_timegrain_$vid]\n");
-sys_gui("global $var_graph_timegrain\n");
-sys_gui("set var_graph_loop [concat graph_loop_$vid]\n");
-sys_gui("global $var_graph_loop\n");
-sys_gui("set var_graph_save [concat graph_save_$vid]\n");
-sys_gui("global $var_graph_save\n");
-sys_gui("set $var_graph_width $width\n");
-sys_gui("set $var_graph_height $height\n");
-sys_gui("set $var_graph_nbevents $nbevents\n");
-sys_gui("set $var_graph_timegrain $timegrain\n");
-sys_gui("set $var_graph_loop $loop\n");
-sys_gui("set $var_graph_save $save\n");
-sys_gui("toplevel $id\n");
-sys_gui("wm title $id {exciter}\n");
-sys_gui("wm protocol $id WM_DELETE_WINDOW [concat exciter_cancel $id]\n");
-sys_gui("label $id.label -text {EXCITER PROPERTIES}\n");
-sys_gui("pack $id.label -side top\n");
-sys_gui("frame $id.buttonframe\n");
-sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n");
-sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"exciter_cancel $id\"\n");
-sys_gui("button $id.buttonframe.apply -text {Apply} -command \"exciter_apply $id\"\n");
-sys_gui("button $id.buttonframe.ok -text {OK} -command \"exciter_ok $id\"\n");
-sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.apply -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.ok -side left -expand 1\n");
-sys_gui("frame $id.1rangef\n");
-sys_gui("pack $id.1rangef -side top\n");
-sys_gui("label $id.1rangef.lwidth -text \"Width :\"\n");
-sys_gui("entry $id.1rangef.width -textvariable $var_graph_width -width 7\n");
-sys_gui("pack $id.1rangef.lwidth $id.1rangef.width -side left\n");
-sys_gui("frame $id.2rangef\n");
-sys_gui("pack $id.2rangef -side top\n");
-sys_gui("label $id.2rangef.lheight -text \"Height :\"\n");
-sys_gui("entry $id.2rangef.height -textvariable $var_graph_height -width 7\n");
-sys_gui("pack $id.2rangef.lheight $id.2rangef.height -side left\n");
-sys_gui("frame $id.3rangef\n");
-sys_gui("pack $id.3rangef -side top\n");
-sys_gui("label $id.3rangef.lnbevents -text \"Nb Events :\"\n");
-sys_gui("entry $id.3rangef.nbevents -textvariable $var_graph_nbevents -width 7\n");
-sys_gui("pack $id.3rangef.lnbevents $id.3rangef.nbevents -side left\n");
-sys_gui("frame $id.4rangef\n");
-sys_gui("pack $id.4rangef -side top\n");
-sys_gui("label $id.4rangef.ltimegrain -text \"Time Grain (seconds) :\"\n");
-sys_gui("entry $id.4rangef.timegrain -textvariable $var_graph_timegrain -width 7\n");
-sys_gui("pack $id.4rangef.ltimegrain $id.4rangef.timegrain -side left\n");
-sys_gui("checkbutton $id.loop -text {Loop} -variable $var_graph_loop -anchor w\n");
-sys_gui("pack $id.loop -side top\n");
-sys_gui("checkbutton $id.save -text {Save contents} -variable $var_graph_save -anchor w\n");
-sys_gui("pack $id.save -side top\n");
-sys_gui("bind $id.1rangef.width <KeyPress-Return> [concat exciter_ok $id]\n");
-sys_gui("bind $id.2rangef.height <KeyPress-Return> [concat exciter_ok $id]\n");
-sys_gui("bind $id.3rangef.nbevents <KeyPress-Return> [concat exciter_ok $id]\n");
-sys_gui("bind $id.4rangef.timegrain <KeyPress-Return> [concat exciter_ok $id]\n");
-sys_gui("focus $id.1rangef.width\n");
-sys_gui("}\n");
-// ########### exciter procedures END -- ydegoyon@free.fr #########
diff --git a/exciter/tk2c.bash b/exciter/tk2c.bash
deleted file mode 100755
index 9dfeb03..0000000
--- a/exciter/tk2c.bash
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-#set -x
-
-while read line
-do
- for word in $line
- do
- if [ "X"$word != "X"${word#\#} ]
- then
- echo // ${line#\#}
- break
- else
- line=${line//\'/\\\'}
-#useless, slashes never gets in
- line=${line//\\/\\\\}
-#this one's dirty, i know
- line=${line//;/\\\\;}
- line=${line//\"/\\\"}
- echo 'sys_gui("'$line'\n");'
- break
- fi
- done
-done
diff --git a/filterbank~/filterbank~-help.pd b/filterbank~-help.pd
index 855e833..855e833 100644
--- a/filterbank~/filterbank~-help.pd
+++ b/filterbank~-help.pd
diff --git a/filterbank~/filterbank~.c b/filterbank~.c
index 4e44c2a..626db7d 100644
--- a/filterbank~/filterbank~.c
+++ b/filterbank~.c
@@ -33,7 +33,7 @@
#include "filterbank~.h"
-#ifdef NT
+#ifdef _WIN32
#include <io.h>
#else
#include <unistd.h>
@@ -641,7 +641,6 @@ static void filterbank_dsp(t_filterbank_tilde *x, t_signal **sp)
void filterbank_tilde_setup(void)
{
post( filterbank_version );
-#include "filterbank~.tk2c"
filterbank_class_tilde = class_new(gensym("filterbank~"), (t_newmethod)filterbank_new,
(t_method)filterbank_free, sizeof(t_filterbank_tilde), 0, A_GIMME, 0);
CLASS_MAINSIGNALIN( filterbank_class_tilde, t_filterbank_tilde, x_f );
@@ -665,4 +664,7 @@ void filterbank_tilde_setup(void)
#endif
class_setwidget(filterbank_class_tilde, &filterbank_widgetbehavior);
+ sys_vgui("eval [read [open %s/%s.tcl]]\n",
+ filterbank_class_tilde->c_externdir->s_name,
+ filterbank_class_tilde->c_name->s_name);
}
diff --git a/filterbank~/filterbank~.h b/filterbank~.h
index 34821c8..34821c8 100644
--- a/filterbank~/filterbank~.h
+++ b/filterbank~.h
diff --git a/filterbank~/filterbank~.tk b/filterbank~.tcl
index 4143802..4143802 100644
--- a/filterbank~/filterbank~.tk
+++ b/filterbank~.tcl
diff --git a/filterbank~/INSTALL b/filterbank~/INSTALL
deleted file mode 100644
index a8b614e..0000000
--- a/filterbank~/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/filterbank~
-
-make clean
-
-make
-
-make install
-
-open help-filterbank~.pd
-
-Thanx for getting here.
-Yves/
-comments and bugs @ ydegoyon@free.fr
diff --git a/filterbank~/filterbank~.tk2c b/filterbank~/filterbank~.tk2c
deleted file mode 100755
index 13d8482..0000000
--- a/filterbank~/filterbank~.tk2c
+++ /dev/null
@@ -1,58 +0,0 @@
-// ########### filterbank procedures -- ydegoyon@free.fr #########
-sys_gui("proc filterbank_apply {id} {\n");
-// strip "." from the TK id to make a variable name suffix
-sys_gui("set vid [string trimleft $id .]\n");
-// for each variable, make a local variable to hold its name...
-sys_gui("set var_graph_lowfreq [concat graph_lowfreq_$vid]\n");
-sys_gui("global $var_graph_lowfreq\n");
-sys_gui("set var_graph_highfreq [concat graph_highfreq_$vid]\n");
-sys_gui("global $var_graph_highfreq\n");
-sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_lowfreq] [eval concat $$var_graph_highfreq] \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc filterbank_cancel {id} {\n");
-sys_gui("set cmd [concat $id cancel \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc filterbank_ok {id} {\n");
-sys_gui("filterbank_apply $id\n");
-sys_gui("filterbank_cancel $id\n");
-sys_gui("}\n");
-sys_gui("proc pdtk_filterbank_dialog {id lowfreq highfreq} {\n");
-sys_gui("set vid [string trimleft $id .]\n");
-sys_gui("set var_graph_lowfreq [concat graph_lowfreq_$vid]\n");
-sys_gui("global $var_graph_lowfreq\n");
-sys_gui("set var_graph_highfreq [concat graph_highfreq_$vid]\n");
-sys_gui("global $var_graph_highfreq\n");
-sys_gui("set $var_graph_lowfreq $lowfreq\n");
-sys_gui("set $var_graph_highfreq $highfreq\n");
-sys_gui("toplevel $id\n");
-sys_gui("wm title $id {filterbank}\n");
-sys_gui("wm protocol $id WM_DELETE_WINDOW [concat filterbank_cancel $id]\n");
-sys_gui("label $id.label -text {FILTERBANK PROPERTIES}\n");
-sys_gui("pack $id.label -side top\n");
-sys_gui("frame $id.buttonframe\n");
-sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n");
-sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"filterbank_cancel $id\"\n");
-sys_gui("button $id.buttonframe.apply -text {Apply} -command \"filterbank_apply $id\"\n");
-sys_gui("button $id.buttonframe.ok -text {OK} -command \"filterbank_ok $id\"\n");
-sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.apply -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.ok -side left -expand 1\n");
-sys_gui("frame $id.1rangef\n");
-sys_gui("pack $id.1rangef -side top\n");
-sys_gui("label $id.1rangef.llowfreq -text \"Lower Frequency :\"\n");
-sys_gui("entry $id.1rangef.lowfreq -textvariable $var_graph_lowfreq -width 7\n");
-sys_gui("pack $id.1rangef.llowfreq $id.1rangef.lowfreq -side left\n");
-sys_gui("frame $id.2rangef\n");
-sys_gui("pack $id.2rangef -side top\n");
-sys_gui("label $id.2rangef.lhighfreq -text \"Higher Frequency :\"\n");
-sys_gui("entry $id.2rangef.highfreq -textvariable $var_graph_highfreq -width 7\n");
-sys_gui("pack $id.2rangef.lhighfreq $id.2rangef.highfreq -side left\n");
-sys_gui("bind $id.1rangef.lowfreq <KeyPress-Return> [concat filterbank_ok $id]\n");
-sys_gui("bind $id.2rangef.highfreq <KeyPress-Return> [concat filterbank_ok $id]\n");
-sys_gui("focus $id.1rangef.lowfreq\n");
-sys_gui("}\n");
-// ########### filterbank procedures END -- ydegoyon@free.fr #########
diff --git a/filterbank~/tk2c.bash b/filterbank~/tk2c.bash
deleted file mode 100755
index 9dfeb03..0000000
--- a/filterbank~/tk2c.bash
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-#set -x
-
-while read line
-do
- for word in $line
- do
- if [ "X"$word != "X"${word#\#} ]
- then
- echo // ${line#\#}
- break
- else
- line=${line//\'/\\\'}
-#useless, slashes never gets in
- line=${line//\\/\\\\}
-#this one's dirty, i know
- line=${line//;/\\\\;}
- line=${line//\"/\\\"}
- echo 'sys_gui("'$line'\n");'
- break
- fi
- done
-done
diff --git a/vocoder~/filters.c b/filters.c
index 2bf9253..2bf9253 100644
--- a/vocoder~/filters.c
+++ b/filters.c
diff --git a/formant~/formant~-help.pd b/formant~-help.pd
index c8102b4..c8102b4 100644
--- a/formant~/formant~-help.pd
+++ b/formant~-help.pd
diff --git a/formant~/formant~.c b/formant~.c
index 686974b..686974b 100644
--- a/formant~/formant~.c
+++ b/formant~.c
diff --git a/formant~/INSTALL b/formant~/INSTALL
deleted file mode 100644
index bcbc08b..0000000
--- a/formant~/INSTALL
+++ /dev/null
@@ -1,9 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/formant~
-
-make
-
-make install
-
-you're set !!
diff --git a/grid/g_grid.h b/g_grid.h
index 9c89228..9c89228 100644
--- a/grid/g_grid.h
+++ b/g_grid.h
diff --git a/mp3amp~/graphic-mp3amp~-help.pd b/graphic-mp3amp~-help.pd
index 241a607..241a607 100644
--- a/mp3amp~/graphic-mp3amp~-help.pd
+++ b/graphic-mp3amp~-help.pd
diff --git a/grid/grid-help.pd b/grid-help.pd
index 23d6cc5..23d6cc5 100644
--- a/grid/grid-help.pd
+++ b/grid-help.pd
diff --git a/grid/grid.c b/grid.c
index d32fcf7..84c0d7c 100644
--- a/grid/grid.c
+++ b/grid.c
@@ -13,6 +13,7 @@
#include <math.h>
#include <ctype.h>
#include "m_pd.h"
+#include "m_imp.h"
#include "g_canvas.h"
#include "g_grid.h"
@@ -674,7 +675,6 @@ static void grid_free(t_grid *x)
void grid_setup(void)
{
-#include "grid.tk2c"
post ( grid_version );
grid_class = class_new(gensym("grid"), (t_newmethod)grid_new,
(t_method)grid_free, sizeof(t_grid), 0, A_GIMME, 0);
@@ -712,4 +712,6 @@ void grid_setup(void)
class_setwidget(grid_class, &grid_widgetbehavior);
+ sys_vgui("eval [read [open %s/%s.tcl]]\n",
+ grid_class->c_externdir->s_name, grid_class->c_name->s_name);
}
diff --git a/grid/grid.tk b/grid.tcl
index fb8d403..fb8d403 100644
--- a/grid/grid.tk
+++ b/grid.tcl
diff --git a/grid/INSTALL b/grid/INSTALL
deleted file mode 100644
index 22c4df6..0000000
--- a/grid/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/grid
-
-make clean
-
-make
-
-make install
-
-open help-grid.pd
-
-Thanx for getting here.
-Yves/
-comments and bugs @ ydegoyon@free.fr
diff --git a/grid/grid.tk2c b/grid/grid.tk2c
deleted file mode 100644
index 3e8f18f..0000000
--- a/grid/grid.tk2c
+++ /dev/null
@@ -1,164 +0,0 @@
-// ########### grid procedures -- ydegoyon@free.fr #########
-sys_gui("proc grid_apply {id} {\n");
-// strip "." from the TK id to make a variable name suffix
-sys_gui("set vid [string trimleft $id .]\n");
-// for each variable, make a local variable to hold its name...
-sys_gui("set var_graph_name [concat graph_name_$vid]\n");
-sys_gui("global $var_graph_name\n");
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_xmin [concat graph_xmin_$vid]\n");
-sys_gui("global $var_graph_xmin\n");
-sys_gui("set var_graph_xmax [concat graph_xmax_$vid]\n");
-sys_gui("global $var_graph_xmax\n");
-sys_gui("set var_graph_height [concat graph_height_$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set var_graph_ymin [concat graph_ymin_$vid]\n");
-sys_gui("global $var_graph_ymin\n");
-sys_gui("set var_graph_ymax [concat graph_ymax_$vid]\n");
-sys_gui("global $var_graph_ymax\n");
-sys_gui("set var_graph_grid [concat graph_grid_$vid]\n");
-sys_gui("global $var_graph_grid\n");
-sys_gui("set var_graph_xstep [concat graph_xstep_$vid]\n");
-sys_gui("global $var_graph_xstep\n");
-sys_gui("set var_graph_ystep [concat graph_ystep_$vid]\n");
-sys_gui("global $var_graph_ystep\n");
-sys_gui("set var_graph_xlines [concat graph_xlines_$vid]\n");
-sys_gui("global $var_graph_xlines\n");
-sys_gui("set var_graph_ylines [concat graph_ylines_$vid]\n");
-sys_gui("global $var_graph_ylines\n");
-sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_name] [eval concat $$var_graph_width] [eval concat $$var_graph_xmin] [eval concat $$var_graph_xmax] [eval concat $$var_graph_height] [eval concat $$var_graph_ymin] [eval concat $$var_graph_ymax] [eval concat $$var_graph_grid] [eval concat $$var_graph_xstep] [eval concat $$var_graph_ystep] [eval concat $$var_graph_xlines] [eval concat $$var_graph_ylines] \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc grid_cancel {id} {\n");
-sys_gui("set cmd [concat $id cancel \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc grid_ok {id} {\n");
-sys_gui("grid_apply $id\n");
-sys_gui("grid_cancel $id\n");
-sys_gui("}\n");
-sys_gui("proc pdtk_grid_dialog {id name width xmin xmax height ymin ymax grid xstep ystep xlines ylines} {\n");
-sys_gui("set vid [string trimleft $id .]\n");
-sys_gui("set var_graph_name [concat graph_name_$vid]\n");
-sys_gui("global $var_graph_name\n");
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_xmin [concat graph_xmin_$vid]\n");
-sys_gui("global $var_graph_xmin\n");
-sys_gui("set var_graph_xmax [concat graph_xmax_$vid]\n");
-sys_gui("global $var_graph_xmax\n");
-sys_gui("set var_graph_height [concat graph_height_$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set var_graph_ymin [concat graph_ymin_$vid]\n");
-sys_gui("global $var_graph_ymin\n");
-sys_gui("set var_graph_ymax [concat graph_ymax_$vid]\n");
-sys_gui("global $var_graph_ymax\n");
-sys_gui("set var_graph_grid [concat graph_grid_$vid]\n");
-sys_gui("global $var_graph_grid\n");
-sys_gui("set var_graph_xstep [concat graph_xstep_$vid]\n");
-sys_gui("global $var_graph_xstep\n");
-sys_gui("set var_graph_ystep [concat graph_ystep_$vid]\n");
-sys_gui("global $var_graph_ystep\n");
-sys_gui("set var_graph_xlines [concat graph_xlines_$vid]\n");
-sys_gui("global $var_graph_xlines\n");
-sys_gui("set var_graph_ylines [concat graph_ylines_$vid]\n");
-sys_gui("global $var_graph_ylines\n");
-sys_gui("set $var_graph_name $name\n");
-sys_gui("set $var_graph_width $width\n");
-sys_gui("set $var_graph_xmin $xmin\n");
-sys_gui("set $var_graph_xmax $xmax\n");
-sys_gui("set $var_graph_height $height\n");
-sys_gui("set $var_graph_ymin $ymin\n");
-sys_gui("set $var_graph_ymax $ymax\n");
-sys_gui("set $var_graph_grid $grid\n");
-sys_gui("set $var_graph_xstep $xstep\n");
-sys_gui("set $var_graph_ystep $ystep\n");
-sys_gui("set $var_graph_xlines $xlines\n");
-sys_gui("set $var_graph_ylines $ylines\n");
-sys_gui("toplevel $id\n");
-sys_gui("wm title $id {grid}\n");
-sys_gui("wm protocol $id WM_DELETE_WINDOW [concat grid_cancel $id]\n");
-sys_gui("label $id.label -text {GRID PROPERTIES}\n");
-sys_gui("pack $id.label -side top\n");
-sys_gui("frame $id.buttonframe\n");
-sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n");
-sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"grid_cancel $id\"\n");
-sys_gui("button $id.buttonframe.apply -text {Apply} -command \"grid_apply $id\"\n");
-sys_gui("button $id.buttonframe.ok -text {OK} -command \"grid_ok $id\"\n");
-sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.apply -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.ok -side left -expand 1\n");
-sys_gui("frame $id.1rangef\n");
-sys_gui("pack $id.1rangef -side top\n");
-sys_gui("label $id.1rangef.lname -text \"Name :\"\n");
-sys_gui("entry $id.1rangef.name -textvariable $var_graph_name -width 7\n");
-sys_gui("pack $id.1rangef.lname $id.1rangef.name -side left\n");
-sys_gui("frame $id.2rangef\n");
-sys_gui("pack $id.2rangef -side top\n");
-sys_gui("label $id.2rangef.lwidth -text \"Width :\"\n");
-sys_gui("entry $id.2rangef.width -textvariable $var_graph_width -width 7\n");
-sys_gui("pack $id.2rangef.lwidth $id.2rangef.width -side left\n");
-sys_gui("frame $id.3rangef\n");
-sys_gui("pack $id.3rangef -side top\n");
-sys_gui("label $id.3rangef.lxmin -text \"X min :\"\n");
-sys_gui("entry $id.3rangef.xmin -textvariable $var_graph_xmin -width 7\n");
-sys_gui("pack $id.3rangef.lxmin $id.3rangef.xmin -side left\n");
-sys_gui("frame $id.4rangef\n");
-sys_gui("pack $id.4rangef -side top\n");
-sys_gui("label $id.4rangef.lxmax -text \"X max :\"\n");
-sys_gui("entry $id.4rangef.xmax -textvariable $var_graph_xmax -width 7\n");
-sys_gui("pack $id.4rangef.lxmax $id.4rangef.xmax -side left\n");
-sys_gui("frame $id.41rangef\n");
-sys_gui("pack $id.41rangef -side top\n");
-sys_gui("label $id.41rangef.lxstep -text \"X step :\"\n");
-sys_gui("entry $id.41rangef.xstep -textvariable $var_graph_xstep -width 7\n");
-sys_gui("pack $id.41rangef.lxstep $id.41rangef.xstep -side left\n");
-sys_gui("frame $id.42rangef\n");
-sys_gui("pack $id.42rangef -side top\n");
-sys_gui("label $id.42rangef.lxlines -text \"X sections :\"\n");
-sys_gui("entry $id.42rangef.xlines -textvariable $var_graph_xlines -width 7\n");
-sys_gui("pack $id.42rangef.lxlines $id.42rangef.xlines -side left\n");
-sys_gui("frame $id.5rangef\n");
-sys_gui("pack $id.5rangef -side top\n");
-sys_gui("label $id.5rangef.lheight -text \"Height :\"\n");
-sys_gui("entry $id.5rangef.height -textvariable $var_graph_height -width 7\n");
-sys_gui("pack $id.5rangef.lheight $id.5rangef.height -side left\n");
-sys_gui("frame $id.6rangef\n");
-sys_gui("pack $id.6rangef -side top\n");
-sys_gui("label $id.6rangef.lymin -text \"Y min :\"\n");
-sys_gui("entry $id.6rangef.ymin -textvariable $var_graph_ymin -width 7\n");
-sys_gui("pack $id.6rangef.lymin $id.6rangef.ymin -side left\n");
-sys_gui("frame $id.7rangef\n");
-sys_gui("pack $id.7rangef -side top\n");
-sys_gui("label $id.7rangef.lymax -text \"Y max :\"\n");
-sys_gui("entry $id.7rangef.ymax -textvariable $var_graph_ymax -width 7\n");
-sys_gui("pack $id.7rangef.lymax $id.7rangef.ymax -side left\n");
-sys_gui("frame $id.71rangef\n");
-sys_gui("pack $id.71rangef -side top\n");
-sys_gui("label $id.71rangef.lystep -text \"Y step :\"\n");
-sys_gui("entry $id.71rangef.ystep -textvariable $var_graph_ystep -width 7\n");
-sys_gui("pack $id.71rangef.lystep $id.71rangef.ystep -side left\n");
-sys_gui("frame $id.72rangef\n");
-sys_gui("pack $id.72rangef -side top\n");
-sys_gui("label $id.72rangef.lylines -text \"Y sections :\"\n");
-sys_gui("entry $id.72rangef.ylines -textvariable $var_graph_ylines -width 7\n");
-sys_gui("pack $id.72rangef.lylines $id.72rangef.ylines -side left\n");
-sys_gui("checkbutton $id.showgrid -text {Show Grid} -variable $var_graph_grid -anchor w\n");
-sys_gui("pack $id.showgrid -side top\n");
-sys_gui("bind $id.1rangef.name <KeyPress-Return> [concat grid_ok $id]\n");
-sys_gui("bind $id.2rangef.width <KeyPress-Return> [concat grid_ok $id]\n");
-sys_gui("bind $id.3rangef.xmin <KeyPress-Return> [concat grid_ok $id]\n");
-sys_gui("bind $id.4rangef.xmax <KeyPress-Return> [concat grid_ok $id]\n");
-sys_gui("bind $id.41rangef.xstep <KeyPress-Return> [concat grid_ok $id]\n");
-sys_gui("bind $id.42rangef.xlines <KeyPress-Return> [concat grid_ok $id]\n");
-sys_gui("bind $id.5rangef.height <KeyPress-Return> [concat grid_ok $id]\n");
-sys_gui("bind $id.6rangef.ymin <KeyPress-Return> [concat grid_ok $id]\n");
-sys_gui("bind $id.7rangef.ymax <KeyPress-Return> [concat grid_ok $id]\n");
-sys_gui("bind $id.71rangef.ystep <KeyPress-Return> [concat grid_ok $id]\n");
-sys_gui("bind $id.72rangef.ylines <KeyPress-Return> [concat grid_ok $id]\n");
-sys_gui("focus $id.1rangef.name\n");
-sys_gui("}\n");
-// ########### grid procedures END -- ydegoyon@free.fr #########
diff --git a/grid/tk2c.bash b/grid/tk2c.bash
deleted file mode 100755
index 9dfeb03..0000000
--- a/grid/tk2c.bash
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-#set -x
-
-while read line
-do
- for word in $line
- do
- if [ "X"$word != "X"${word#\#} ]
- then
- echo // ${line#\#}
- break
- else
- line=${line//\'/\\\'}
-#useless, slashes never gets in
- line=${line//\\/\\\\}
-#this one's dirty, i know
- line=${line//;/\\\\;}
- line=${line//\"/\\\"}
- echo 'sys_gui("'$line'\n");'
- break
- fi
- done
-done
diff --git a/mp3amp~/interface.h b/interface.h
index de3136a..de3136a 100644
--- a/mp3amp~/interface.h
+++ b/interface.h
diff --git a/vocoder~/lpc.c b/lpc.c
index 33159d4..33159d4 100644
--- a/vocoder~/lpc.c
+++ b/lpc.c
diff --git a/mp3amp~/mp3amp~-help.pd b/mp3amp~-help.pd
index 47249b7..47249b7 100644
--- a/mp3amp~/mp3amp~-help.pd
+++ b/mp3amp~-help.pd
diff --git a/mp3amp~/mp3amp~.c b/mp3amp~.c
index 9dfc54e..9dfc54e 100644
--- a/mp3amp~/mp3amp~.c
+++ b/mp3amp~.c
diff --git a/mp3amp~/INSTALL b/mp3amp~/INSTALL
deleted file mode 100644
index 8260a98..0000000
--- a/mp3amp~/INSTALL
+++ /dev/null
@@ -1,19 +0,0 @@
-You need to get lame > v3.90 installed first.
-libmp3lame.so is searched in /usr/local/lib
-( no time to write configure scripts ).
-if it's installed elsewhere, change the Makefile,
-you won't die from that.
-
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/mp3amp~
-
-make clean
-
-make
-
-make install
-
-thanks for getting here.
-
-Yves/
diff --git a/mp3cast~/mp3cast~-help.pd b/mp3cast~-help.pd
index 243570a..243570a 100644
--- a/mp3cast~/mp3cast~-help.pd
+++ b/mp3cast~-help.pd
diff --git a/mp3cast~/mp3cast~.c b/mp3cast~.c
index 0568443..0568443 100644
--- a/mp3cast~/mp3cast~.c
+++ b/mp3cast~.c
diff --git a/mp3cast~/INSTALL b/mp3cast~/INSTALL
deleted file mode 100644
index 769e78e..0000000
--- a/mp3cast~/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-You need to get lame > v3.90 installed first.
-libmp3lame.so is searched in /usr/local/lib
-( no time to write configure scripts ).
-if it's installed elsewhere, change the Makefile,
-you won't die from that.
-
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/mp3cast~
-
-make -f Makefile.linux
-
-make -f Makefile.linux install
-
-you're set !!
diff --git a/mp3cast~/interface.h b/mp3cast~/interface.h
deleted file mode 100644
index de3136a..0000000
--- a/mp3cast~/interface.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-** Copyright (C) 2000 Albert L. Faber
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#ifndef INTERFACE_H_INCLUDED
-#define INTERFACE_H_INCLUDED
-
-// #include "common.h"
-#include "interface.h"
-
-BOOL InitMP3(PMPSTR mp);
-int decodeMP3(PMPSTR mp,unsigned char *inmemory,int inmemsize,char *outmemory,int outmemsize,int *done);
-void ExitMP3(PMPSTR mp);
-
-/* added remove_buf to support mpglib seeking */
-void remove_buf(PMPSTR mp);
-
-#endif
diff --git a/mp3cast~/mpglib.h b/mp3cast~/mpglib.h
deleted file mode 100644
index 1f4ef9a..0000000
--- a/mp3cast~/mpglib.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// #include "lame-analysis.h"
-
-#define NOANALYSIS
-
-#ifndef NOANALYSIS
-extern plotting_data *mpg123_pinfo;
-#endif
-
-struct buf {
- unsigned char *pnt;
- long size;
- long pos;
- struct buf *next;
- struct buf *prev;
-};
-
-struct framebuf {
- struct buf *buf;
- long pos;
- struct frame *next;
- struct frame *prev;
-};
-
-typedef struct mpstr_tag {
- struct buf *head,*tail;
- int vbr_header; /* 1 if valid Xing vbr header detected */
- int num_frames; /* set if vbr header present */
- int enc_delay; /* set if vbr header present */
- int enc_padding; /* set if vbr header present */
- int header_parsed;
- int side_parsed;
- int data_parsed;
- int free_format; /* 1 = free format frame */
- int old_free_format; /* 1 = last frame was free format */
- int bsize;
- int framesize;
- int ssize;
- int dsize;
- int fsizeold;
- int fsizeold_nopadding;
- struct frame fr;
- unsigned char bsspace[2][MAXFRAMESIZE+512]; /* MAXFRAMESIZE */
- real hybrid_block[2][2][SBLIMIT*SSLIMIT];
- int hybrid_blc[2];
- unsigned long header;
- int bsnum;
- real synth_buffs[2][2][0x110];
- int synth_bo;
- int sync_bitstream;
-
-} MPSTR, *PMPSTR;
-
-
-#if ( defined(_MSC_VER) || defined(__BORLANDC__) )
- typedef int BOOL; /* windef.h contains the same definition */
-#else
- #define BOOL int
-#endif
-
-#define MP3_ERR -1
-#define MP3_OK 0
-#define MP3_NEED_MORE 1
-
-
-
diff --git a/mp3live~/mp3fileout~.c b/mp3fileout~.c
index bd2d431..a24b448 100644
--- a/mp3live~/mp3fileout~.c
+++ b/mp3fileout~.c
@@ -419,7 +419,7 @@ static void mp3fileout_connect(t_mp3fileout *x, t_symbol *hostname, t_floatarg f
unsigned int len;
int sockfd;
-#ifndef UNIX
+#ifdef _WIN32
unsigned int ret;
#else
int ret;
@@ -444,7 +444,7 @@ static void mp3fileout_connect(t_mp3fileout *x, t_symbol *hostname, t_floatarg f
if (hp == 0)
{
post("mp3fileout~: bad host?");
-#ifndef UNIX
+#ifdef _WIN32
closesocket(sockfd);
#else
close(sockfd);
@@ -461,7 +461,7 @@ static void mp3fileout_connect(t_mp3fileout *x, t_symbol *hostname, t_floatarg f
if (connect(sockfd, (struct sockaddr *) &csocket, sizeof (csocket)) < 0)
{
error("mp3fileout~: connection failed!\n");
-#ifndef UNIX
+#ifdef _WIN32
closesocket(sockfd);
#else
close(sockfd);
@@ -484,7 +484,7 @@ static void mp3fileout_disconnect(t_mp3fileout *x)
int err = -1;
if(x->x_socket >= 0) /* close socket */
{
-#ifndef UNIX
+#ifdef _WIN32
closesocket(x->x_socket);
#else
close(x->x_socket);
diff --git a/mp3live~/mp3live~-help.pd b/mp3live~-help.pd
index ac68464..ac68464 100644
--- a/mp3live~/mp3live~-help.pd
+++ b/mp3live~-help.pd
diff --git a/mp3live~/INSTALL b/mp3live~/INSTALL
deleted file mode 100644
index 63db4c7..0000000
--- a/mp3live~/INSTALL
+++ /dev/null
@@ -1,21 +0,0 @@
-You need to get lame > v3.90 installed first.
-libmp3lame.so is searched in /usr/local/lib
-( no time to write configure scripts ).
-if it's installed elsewhere, change the Makefile,
-you won't die from that.
-
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/mp3live~
-
-make clean
-
-make
-
-make install
-
-open help-mp3live~.pd
-
-Thanx for getting here.
-
-Yves/
diff --git a/mp3live~/interface.h b/mp3live~/interface.h
deleted file mode 100644
index de3136a..0000000
--- a/mp3live~/interface.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-** Copyright (C) 2000 Albert L. Faber
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#ifndef INTERFACE_H_INCLUDED
-#define INTERFACE_H_INCLUDED
-
-// #include "common.h"
-#include "interface.h"
-
-BOOL InitMP3(PMPSTR mp);
-int decodeMP3(PMPSTR mp,unsigned char *inmemory,int inmemsize,char *outmemory,int outmemsize,int *done);
-void ExitMP3(PMPSTR mp);
-
-/* added remove_buf to support mpglib seeking */
-void remove_buf(PMPSTR mp);
-
-#endif
diff --git a/mp3live~/mpglib.h b/mp3live~/mpglib.h
deleted file mode 100644
index 1f4ef9a..0000000
--- a/mp3live~/mpglib.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// #include "lame-analysis.h"
-
-#define NOANALYSIS
-
-#ifndef NOANALYSIS
-extern plotting_data *mpg123_pinfo;
-#endif
-
-struct buf {
- unsigned char *pnt;
- long size;
- long pos;
- struct buf *next;
- struct buf *prev;
-};
-
-struct framebuf {
- struct buf *buf;
- long pos;
- struct frame *next;
- struct frame *prev;
-};
-
-typedef struct mpstr_tag {
- struct buf *head,*tail;
- int vbr_header; /* 1 if valid Xing vbr header detected */
- int num_frames; /* set if vbr header present */
- int enc_delay; /* set if vbr header present */
- int enc_padding; /* set if vbr header present */
- int header_parsed;
- int side_parsed;
- int data_parsed;
- int free_format; /* 1 = free format frame */
- int old_free_format; /* 1 = last frame was free format */
- int bsize;
- int framesize;
- int ssize;
- int dsize;
- int fsizeold;
- int fsizeold_nopadding;
- struct frame fr;
- unsigned char bsspace[2][MAXFRAMESIZE+512]; /* MAXFRAMESIZE */
- real hybrid_block[2][2][SBLIMIT*SSLIMIT];
- int hybrid_blc[2];
- unsigned long header;
- int bsnum;
- real synth_buffs[2][2][0x110];
- int synth_bo;
- int sync_bitstream;
-
-} MPSTR, *PMPSTR;
-
-
-#if ( defined(_MSC_VER) || defined(__BORLANDC__) )
- typedef int BOOL; /* windef.h contains the same definition */
-#else
- #define BOOL int
-#endif
-
-#define MP3_ERR -1
-#define MP3_OK 0
-#define MP3_NEED_MORE 1
-
-
-
diff --git a/mp3live~/mp3streamin~.c b/mp3streamin~.c
index b01a576..b01a576 100644
--- a/mp3live~/mp3streamin~.c
+++ b/mp3streamin~.c
diff --git a/mp3live~/mp3streamout~.c b/mp3streamout~.c
index 33555ce..f2ea966 100644
--- a/mp3live~/mp3streamout~.c
+++ b/mp3streamout~.c
@@ -214,7 +214,7 @@ static void mp3streamout_stream(t_mp3streamout *x)
error("mp3streamout~: could not send encoded data to the peer (%d)", count);
lame_close( x->lgfp );
x->x_lame = -1;
-#ifndef UNIX
+#ifdef _WIN32
closesocket(x->x_fd);
#else
close(x->x_fd);
@@ -342,7 +342,7 @@ static void mp3streamout_tilde_lame_init(t_mp3streamout *x)
int ret;
x->lgfp = lame_init(); /* set default parameters for now */
-#ifndef UNIX
+#ifdef _WIN32
/* load lame_enc.dll library */
HINSTANCE dll;
dll=LoadLibrary("lame_enc.dll");
@@ -399,7 +399,7 @@ static void mp3streamout_connect(t_mp3streamout *x, t_symbol *hostname, t_floata
unsigned int len;
int sockfd;
-#ifndef UNIX
+#ifdef _WIN32
unsigned int ret;
#else
int ret;
@@ -424,7 +424,7 @@ static void mp3streamout_connect(t_mp3streamout *x, t_symbol *hostname, t_floata
if (hp == 0)
{
post("mp3streamout~: bad host?");
-#ifndef UNIX
+#ifdef _WIN32
closesocket(sockfd);
#else
close(sockfd);
@@ -441,7 +441,7 @@ static void mp3streamout_connect(t_mp3streamout *x, t_symbol *hostname, t_floata
if (connect(sockfd, (struct sockaddr *) &csocket, sizeof (csocket)) < 0)
{
error("mp3streamout~: connection failed!\n");
-#ifndef UNIX
+#ifdef _WIN32
closesocket(sockfd);
#else
close(sockfd);
@@ -476,7 +476,7 @@ static void mp3streamout_disconnect(t_mp3streamout *x)
if(x->x_fd >= 0) /* close socket */
{
-#ifndef UNIX
+#ifdef _WIN32
closesocket(x->x_fd);
#else
close(x->x_fd);
@@ -546,7 +546,7 @@ static void mp3streamout_print(t_mp3streamout *x)
}
post(" mode: %s\n"
" quality: %d", buf, x->x_mp3quality);
-#ifndef UNIX
+#ifdef _WIN32
if(x->x_lamechunk!=0)post(" calculated mp3 chunk size: %d", x->x_lamechunk);
#else
post(" mp3 chunk size: %d", x->x_lamechunk);
@@ -565,7 +565,7 @@ static void mp3streamout_free(t_mp3streamout *x)
lame_close( x->lgfp );
if(x->x_fd >= 0)
-#ifndef UNIX
+#ifdef _WIN32
closesocket(x->x_fd);
#else
close(x->x_fd);
diff --git a/mp3write~/mp3write~-help.pd b/mp3write~-help.pd
index 0e575ba..0e575ba 100644
--- a/mp3write~/mp3write~-help.pd
+++ b/mp3write~-help.pd
diff --git a/mp3write~/mp3write~.c b/mp3write~.c
index b65abed..d16c427 100644
--- a/mp3write~/mp3write~.c
+++ b/mp3write~.c
@@ -192,7 +192,7 @@ static void mp3write_writeframes(t_mp3write *x)
return;
}
-#ifndef UNIX
+#ifdef _WIN32
err = _write(x->x_fd, x->x_mp3outbuf, x->x_mp3size);
#else
err = write(x->x_fd, x->x_mp3outbuf, x->x_mp3size);
@@ -203,7 +203,7 @@ static void mp3write_writeframes(t_mp3write *x)
error("mp3write~: could not write encoded data to file (%d)", err);
lame_close( x->lgfp );
x->x_lame = -1;
-#ifndef UNIX
+#ifdef _WIN32
error("mp3write~: writing data");
_close(x->x_fd);
#else
@@ -328,7 +328,7 @@ static int mp3write_tilde_lame_init(t_mp3write *x)
int ret;
x->lgfp = lame_init(); /* set default parameters for now */
-#ifndef UNIX
+#ifdef _WIN32
/* load lame_enc.dll library */
HINSTANCE dll;
dll=LoadLibrary("lame_enc.dll");
@@ -394,7 +394,7 @@ static void mp3write_open(t_mp3write *x, t_symbol *sfile)
/* closing previous file descriptor */
if ( x->x_fd > 0 ) {
-#ifndef UNIX
+#ifdef _WIN32
if(_close(x->x_fd) < 0 )
#else
if(close(x->x_fd) < 0)
@@ -408,7 +408,7 @@ static void mp3write_open(t_mp3write *x, t_symbol *sfile)
x->x_recflag = 0;
}
-#ifndef UNIX
+#ifdef _WIN32
if ( ( x->x_fd = _open( sfile->s_name, x->x_file_open_mode, _S_IREAD|_S_IWRITE) ) < 0 )
#else
if ( ( x->x_fd = open( sfile->s_name, x->x_file_open_mode, S_IRWXU|S_IRWXG|S_IRWXO ) ) < 0 )
@@ -425,7 +425,7 @@ static void mp3write_open(t_mp3write *x, t_symbol *sfile)
/* setting file write mode to append */
static void mp3write_append(t_mp3write *x)
{
-#ifndef UNIX
+#ifdef _WIN32
x->x_file_open_mode = _O_CREAT|_O_WRONLY|_O_APPEND|_O_BINARY;
#else
x->x_file_open_mode = O_CREAT|O_WRONLY|O_APPEND|O_NONBLOCK;
@@ -436,7 +436,7 @@ static void mp3write_append(t_mp3write *x)
/* setting file write mode to truncate */
static void mp3write_truncate(t_mp3write *x)
{
-#ifndef UNIX
+#ifdef _WIN32
x->x_file_open_mode = _O_CREAT|_O_WRONLY|_O_TRUNC|_O_BINARY;
#else
x->x_file_open_mode = O_CREAT|O_WRONLY|O_TRUNC|O_NONBLOCK;
@@ -486,7 +486,7 @@ static void mp3write_print(t_mp3write *x)
}
post(" mode: %s\n"
" quality: %d", buf, x->x_mp3quality);
-#ifndef UNIX
+#ifdef _WIN32
if(x->x_lamechunk!=0)post(" calculated mp3 chunk size: %d", x->x_lamechunk);
#else
post(" mp3 chunk size: %d", x->x_lamechunk);
@@ -546,7 +546,7 @@ static void mp3write_free(t_mp3write *x)
if(x->x_lame >= 0)
lame_close( x->lgfp );
if(x->x_fd >= 0)
-#ifndef UNIX
+#ifdef _WIN32
_close(x->x_fd);
#else
close(x->x_fd);
@@ -563,7 +563,7 @@ static void *mp3write_new(void)
inlet_new (&x->x_obj, &x->x_obj.ob_pd, gensym ("signal"), gensym ("signal"));
outlet_new (&x->x_obj, &s_float);
x->x_fd = -1;
-#ifndef UNIX
+#ifdef _WIN32
x->x_file_open_mode = _O_CREAT|_O_WRONLY|_O_APPEND|_O_BINARY;
#else
x->x_file_open_mode = O_CREAT|O_WRONLY|O_APPEND|O_NONBLOCK;
diff --git a/mp3write~/INSTALL b/mp3write~/INSTALL
deleted file mode 100644
index 75f5f91..0000000
--- a/mp3write~/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-You need to get lame > v3.90 installed first.
-libmp3lame.so is searched in /usr/local/lib
-( no time to write configure scripts ).
-if it's installed elsewhere, change the Makefile,
-you won't die from that.
-
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/mp3write~
-
-make
-
-make install
-
-you're set !!
diff --git a/mp3write~/interface.h b/mp3write~/interface.h
deleted file mode 100644
index de3136a..0000000
--- a/mp3write~/interface.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-** Copyright (C) 2000 Albert L. Faber
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#ifndef INTERFACE_H_INCLUDED
-#define INTERFACE_H_INCLUDED
-
-// #include "common.h"
-#include "interface.h"
-
-BOOL InitMP3(PMPSTR mp);
-int decodeMP3(PMPSTR mp,unsigned char *inmemory,int inmemsize,char *outmemory,int outmemsize,int *done);
-void ExitMP3(PMPSTR mp);
-
-/* added remove_buf to support mpglib seeking */
-void remove_buf(PMPSTR mp);
-
-#endif
diff --git a/mp3write~/mpglib.h b/mp3write~/mpglib.h
deleted file mode 100644
index 1f4ef9a..0000000
--- a/mp3write~/mpglib.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// #include "lame-analysis.h"
-
-#define NOANALYSIS
-
-#ifndef NOANALYSIS
-extern plotting_data *mpg123_pinfo;
-#endif
-
-struct buf {
- unsigned char *pnt;
- long size;
- long pos;
- struct buf *next;
- struct buf *prev;
-};
-
-struct framebuf {
- struct buf *buf;
- long pos;
- struct frame *next;
- struct frame *prev;
-};
-
-typedef struct mpstr_tag {
- struct buf *head,*tail;
- int vbr_header; /* 1 if valid Xing vbr header detected */
- int num_frames; /* set if vbr header present */
- int enc_delay; /* set if vbr header present */
- int enc_padding; /* set if vbr header present */
- int header_parsed;
- int side_parsed;
- int data_parsed;
- int free_format; /* 1 = free format frame */
- int old_free_format; /* 1 = last frame was free format */
- int bsize;
- int framesize;
- int ssize;
- int dsize;
- int fsizeold;
- int fsizeold_nopadding;
- struct frame fr;
- unsigned char bsspace[2][MAXFRAMESIZE+512]; /* MAXFRAMESIZE */
- real hybrid_block[2][2][SBLIMIT*SSLIMIT];
- int hybrid_blc[2];
- unsigned long header;
- int bsnum;
- real synth_buffs[2][2][0x110];
- int synth_bo;
- int sync_bitstream;
-
-} MPSTR, *PMPSTR;
-
-
-#if ( defined(_MSC_VER) || defined(__BORLANDC__) )
- typedef int BOOL; /* windef.h contains the same definition */
-#else
- #define BOOL int
-#endif
-
-#define MP3_ERR -1
-#define MP3_OK 0
-#define MP3_NEED_MORE 1
-
-
-
diff --git a/mp3amp~/mpglib.h b/mpglib.h
index 1f4ef9a..1f4ef9a 100644
--- a/mp3amp~/mpglib.h
+++ b/mpglib.h
diff --git a/randomblock~/mrandtab.pd b/mrandtab.pd
index 157111c..157111c 100644
--- a/randomblock~/mrandtab.pd
+++ b/mrandtab.pd
diff --git a/pianoroll/pianoroll-help.pd b/pianoroll-help.pd
index 809fec9..809fec9 100644
--- a/pianoroll/pianoroll-help.pd
+++ b/pianoroll-help.pd
diff --git a/pianoroll/pianoroll.c b/pianoroll.c
index c71735c..c63d7cc 100644
--- a/pianoroll/pianoroll.c
+++ b/pianoroll.c
@@ -42,7 +42,7 @@
#include "pianoroll.h"
-#ifdef NT
+#ifdef _WIN32
#include <io.h>
#else
#include <unistd.h>
@@ -780,7 +780,6 @@ static void pianoroll_free(t_pianoroll *x)
void pianoroll_setup(void)
{
post( pianoroll_version );
-#include "pianoroll.tk2c"
pianoroll_class = class_new(gensym("pianoroll"), (t_newmethod)pianoroll_new,
(t_method)pianoroll_free, sizeof(t_pianoroll), 0, A_GIMME, 0);
class_addmethod(pianoroll_class, (t_method)pianoroll_float, &s_float, A_FLOAT, 0);
@@ -812,4 +811,7 @@ void pianoroll_setup(void)
class_setwidget(pianoroll_class, &pianoroll_widgetbehavior);
+ sys_vgui("eval [read [open %s/%s.tcl]]\n",
+ pianoroll_class->c_externdir->s_name,
+ pianoroll_class->c_name->s_name);
}
diff --git a/pianoroll/pianoroll.h b/pianoroll.h
index 4f6a783..4f6a783 100644
--- a/pianoroll/pianoroll.h
+++ b/pianoroll.h
diff --git a/pianoroll/pianoroll.tk b/pianoroll.tcl
index eccadce..eccadce 100644
--- a/pianoroll/pianoroll.tk
+++ b/pianoroll.tcl
diff --git a/pianoroll/INSTALL b/pianoroll/INSTALL
deleted file mode 100644
index b7c38be..0000000
--- a/pianoroll/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/pianoroll
-
-make clean
-
-make
-
-make install
-
-open help-pianoroll.pd
-
-Thanx for getting here.
-Yves/
-comments and bugs @ ydegoyon@free.fr
diff --git a/pianoroll/pianoroll.tk2c b/pianoroll/pianoroll.tk2c
deleted file mode 100755
index 10f5645..0000000
--- a/pianoroll/pianoroll.tk2c
+++ /dev/null
@@ -1,131 +0,0 @@
-// ########### pianoroll procedures -- ydegoyon@free.fr #########
-sys_gui("proc pianoroll_apply {id} {\n");
-// strip "." from the TK id to make a variable name suffix
-sys_gui("set vid [string trimleft $id .]\n");
-// for each variable, make a local variable to hold its name...
-sys_gui("set var_graph_name [concat graph_name_$vid]\n");
-sys_gui("global $var_graph_name\n");
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_height [concat graph_height_$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set var_graph_pmin [concat graph_pmin_$vid]\n");
-sys_gui("global $var_graph_pmin\n");
-sys_gui("set var_graph_pmax [concat graph_pmax_$vid]\n");
-sys_gui("global $var_graph_pmax\n");
-sys_gui("set var_graph_nbgrades [concat graph_nbgrades_$vid]\n");
-sys_gui("global $var_graph_nbgrades\n");
-sys_gui("set var_graph_nbsteps [concat graph_nbsteps_$vid]\n");
-sys_gui("global $var_graph_nbsteps\n");
-sys_gui("set var_graph_defvalue [concat graph_defvalue_$vid]\n");
-sys_gui("global $var_graph_defvalue\n");
-sys_gui("set var_graph_save [concat graph_save_$vid]\n");
-sys_gui("global $var_graph_save\n");
-sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_name] [eval concat $$var_graph_width] [eval concat $$var_graph_height] [eval concat $$var_graph_pmin] [eval concat $$var_graph_pmax] [eval concat $$var_graph_nbgrades] [eval concat $$var_graph_nbsteps] [eval concat $$var_graph_defvalue] [eval concat $$var_graph_save] \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc pianoroll_cancel {id} {\n");
-sys_gui("set cmd [concat $id cancel \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc pianoroll_ok {id} {\n");
-sys_gui("pianoroll_apply $id\n");
-sys_gui("pianoroll_cancel $id\n");
-sys_gui("}\n");
-sys_gui("proc pdtk_pianoroll_dialog {id name width height pmin pmax nbgrades nbsteps defvalue save } {\n");
-sys_gui("set vid [string trimleft $id .]\n");
-sys_gui("set var_graph_name [concat graph_name_$vid]\n");
-sys_gui("global $var_graph_name\n");
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_height [concat graph_height_$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set var_graph_pmin [concat graph_pmin_$vid]\n");
-sys_gui("global $var_graph_pmin\n");
-sys_gui("set var_graph_pmax [concat graph_pmax_$vid]\n");
-sys_gui("global $var_graph_pmax\n");
-sys_gui("set var_graph_nbgrades [concat graph_nbgrades_$vid]\n");
-sys_gui("global $var_graph_nbgrades\n");
-sys_gui("set var_graph_nbsteps [concat graph_nbsteps_$vid]\n");
-sys_gui("global $var_graph_nbsteps\n");
-sys_gui("set var_graph_defvalue [concat graph_defvalue_$vid]\n");
-sys_gui("global $var_graph_defvalue\n");
-sys_gui("set var_graph_save [concat graph_save_$vid]\n");
-sys_gui("global $var_graph_save\n");
-sys_gui("set $var_graph_name $name\n");
-sys_gui("set $var_graph_width $width\n");
-sys_gui("set $var_graph_height $height\n");
-sys_gui("set $var_graph_pmin $pmin\n");
-sys_gui("set $var_graph_pmax $pmax\n");
-sys_gui("set $var_graph_nbgrades $nbgrades\n");
-sys_gui("set $var_graph_nbsteps $nbsteps\n");
-sys_gui("set $var_graph_defvalue $defvalue\n");
-sys_gui("set $var_graph_save $save\n");
-sys_gui("toplevel $id\n");
-sys_gui("wm title $id {pianoroll}\n");
-sys_gui("wm protocol $id WM_DELETE_WINDOW [concat pianoroll_cancel $id]\n");
-sys_gui("label $id.label -text {PIANOROLL PROPERTIES}\n");
-sys_gui("pack $id.label -side top\n");
-sys_gui("frame $id.buttonframe\n");
-sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n");
-sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"pianoroll_cancel $id\"\n");
-sys_gui("button $id.buttonframe.apply -text {Apply} -command \"pianoroll_apply $id\"\n");
-sys_gui("button $id.buttonframe.ok -text {OK} -command \"pianoroll_ok $id\"\n");
-sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.apply -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.ok -side left -expand 1\n");
-sys_gui("frame $id.1rangef\n");
-sys_gui("pack $id.1rangef -side top\n");
-sys_gui("label $id.1rangef.lname -text \"Name :\"\n");
-sys_gui("entry $id.1rangef.name -textvariable $var_graph_name -width 15\n");
-sys_gui("pack $id.1rangef.lname $id.1rangef.name -side left\n");
-sys_gui("frame $id.2rangef\n");
-sys_gui("pack $id.2rangef -side top\n");
-sys_gui("label $id.2rangef.lwidth -text \"Width :\"\n");
-sys_gui("entry $id.2rangef.width -textvariable $var_graph_width -width 7\n");
-sys_gui("pack $id.2rangef.lwidth $id.2rangef.width -side left\n");
-sys_gui("frame $id.3rangef\n");
-sys_gui("pack $id.3rangef -side top\n");
-sys_gui("label $id.3rangef.lheight -text \"Height :\"\n");
-sys_gui("entry $id.3rangef.height -textvariable $var_graph_height -width 7\n");
-sys_gui("pack $id.3rangef.lheight $id.3rangef.height -side left\n");
-sys_gui("frame $id.4rangef\n");
-sys_gui("pack $id.4rangef -side top\n");
-sys_gui("label $id.4rangef.lpmin -text \"Pitch low :\"\n");
-sys_gui("entry $id.4rangef.pmin -textvariable $var_graph_pmin -width 7\n");
-sys_gui("pack $id.4rangef.lpmin $id.4rangef.pmin -side left\n");
-sys_gui("frame $id.5rangef\n");
-sys_gui("pack $id.5rangef -side top\n");
-sys_gui("label $id.5rangef.lpmax -text \"Pitch high :\"\n");
-sys_gui("entry $id.5rangef.pmax -textvariable $var_graph_pmax -width 7\n");
-sys_gui("pack $id.5rangef.lpmax $id.5rangef.pmax -side left\n");
-sys_gui("frame $id.6rangef\n");
-sys_gui("pack $id.6rangef -side top\n");
-sys_gui("label $id.6rangef.lnbgrades -text \"Grades :\"\n");
-sys_gui("entry $id.6rangef.nbgrades -textvariable $var_graph_nbgrades -width 7\n");
-sys_gui("pack $id.6rangef.lnbgrades $id.6rangef.nbgrades -side left\n");
-sys_gui("frame $id.7rangef\n");
-sys_gui("pack $id.7rangef -side top\n");
-sys_gui("label $id.7rangef.lnbsteps -text \"Steps :\"\n");
-sys_gui("entry $id.7rangef.nbsteps -textvariable $var_graph_nbsteps -width 7\n");
-sys_gui("pack $id.7rangef.lnbsteps $id.7rangef.nbsteps -side left\n");
-sys_gui("frame $id.8rangef\n");
-sys_gui("pack $id.8rangef -side top\n");
-sys_gui("label $id.8rangef.ldefvalue -text \"Default Value :\"\n");
-sys_gui("entry $id.8rangef.defvalue -textvariable $var_graph_defvalue -width 7\n");
-sys_gui("pack $id.8rangef.ldefvalue $id.8rangef.defvalue -side left\n");
-sys_gui("checkbutton $id.save -text {Save contents} -variable $var_graph_save -anchor w\n");
-sys_gui("pack $id.save -side top\n");
-sys_gui("bind $id.1rangef.name <KeyPress-Return> [concat pianoroll_ok $id]\n");
-sys_gui("bind $id.2rangef.width <KeyPress-Return> [concat pianoroll_ok $id]\n");
-sys_gui("bind $id.3rangef.height <KeyPress-Return> [concat pianoroll_ok $id]\n");
-sys_gui("bind $id.4rangef.pmin <KeyPress-Return> [concat pianoroll_ok $id]\n");
-sys_gui("bind $id.5rangef.pmax <KeyPress-Return> [concat pianoroll_ok $id]\n");
-sys_gui("bind $id.6rangef.nbgrades <KeyPress-Return> [concat pianoroll_ok $id]\n");
-sys_gui("bind $id.7rangef.nbsteps <KeyPress-Return> [concat pianoroll_ok $id]\n");
-sys_gui("bind $id.8rangef.defvalue <KeyPress-Return> [concat pianoroll_ok $id]\n");
-sys_gui("focus $id.1rangef.name\n");
-sys_gui("}\n");
-// ########### pianoroll procedures END -- ydegoyon@free.fr #########
diff --git a/pianoroll/tk2c.bash b/pianoroll/tk2c.bash
deleted file mode 100755
index 9dfeb03..0000000
--- a/pianoroll/tk2c.bash
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-#set -x
-
-while read line
-do
- for word in $line
- do
- if [ "X"$word != "X"${word#\#} ]
- then
- echo // ${line#\#}
- break
- else
- line=${line//\'/\\\'}
-#useless, slashes never gets in
- line=${line//\\/\\\\}
-#this one's dirty, i know
- line=${line//;/\\\\;}
- line=${line//\"/\\\"}
- echo 'sys_gui("'$line'\n");'
- break
- fi
- done
-done
diff --git a/playlist/playlist-help.pd b/playlist-help.pd
index b035bc3..b035bc3 100644
--- a/playlist/playlist-help.pd
+++ b/playlist-help.pd
diff --git a/playlist/playlist.c b/playlist.c
index 4576267..7311eec 100644
--- a/playlist/playlist.c
+++ b/playlist.c
@@ -1038,7 +1038,6 @@ static void playlist_location(t_playlist *x, t_symbol *flocation)
void playlist_setup(void)
{
post( playlist_version );
-#include "playlist.tk2c"
playlist_class = class_new(gensym("playlist"), (t_newmethod)playlist_new,
(t_method)playlist_free, sizeof(t_playlist),
CLASS_DEFAULT, A_GIMME, 0);
@@ -1069,4 +1068,7 @@ void playlist_setup(void)
class_setwidget(playlist_class, &playlist_widgetbehavior);
+ sys_vgui("eval [read [open %s/%s.tcl]]\n",
+ playlist_class->c_externdir->s_name,
+ playlist_class->c_name->s_name);
}
diff --git a/playlist/playlist.tk b/playlist.tcl
index 5a22a05..5a22a05 100644
--- a/playlist/playlist.tk
+++ b/playlist.tcl
diff --git a/playlist/INSTALL b/playlist/INSTALL
deleted file mode 100644
index 972bba0..0000000
--- a/playlist/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/playlist
-
-make clean
-
-make
-
-make install
-
-open help-playlist.pd
-
-Thanx for getting here.
-Yves/
-comments and bugs @ ydegoyon@free.fr
diff --git a/playlist/playlist.tk2c b/playlist/playlist.tk2c
deleted file mode 100644
index 8058827..0000000
--- a/playlist/playlist.tk2c
+++ /dev/null
@@ -1,123 +0,0 @@
-// ########### playlist procedures -- ydegoyon@free.fr #########
-sys_gui("proc playlist_apply {id} {\n");
-// strip "." from the TK id to make a variable name suffix
-sys_gui("set vid [string trimleft $id .]\n");
-// for each variable, make a local variable to hold its name...
-sys_gui("set var_graph_extension [concat graph_extension_$vid]\n");
-sys_gui("global $var_graph_extension\n");
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_height [concat graph_height$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set var_graph_font [concat graph_font$vid]\n");
-sys_gui("global $var_graph_font\n");
-sys_gui("set var_graph_bgcolor [concat graph_bgcolor$vid]\n");
-sys_gui("global $var_graph_bgcolor\n");
-sys_gui("set var_graph_sbcolor [concat graph_sbcolor$vid]\n");
-sys_gui("global $var_graph_sbcolor\n");
-sys_gui("set var_graph_fgcolor [concat graph_fgcolor$vid]\n");
-sys_gui("global $var_graph_fgcolor\n");
-sys_gui("set var_graph_secolor [concat graph_secolor$vid]\n");
-sys_gui("global $var_graph_secolor\n");
-sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_extension] [eval concat $$var_graph_width] [eval concat $$var_graph_height] [eval concat $$var_graph_font] [eval concat $$var_graph_bgcolor] [eval concat $$var_graph_sbcolor] [eval concat $$var_graph_fgcolor] [eval concat $$var_graph_secolor] \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc playlist_cancel {id} {\n");
-sys_gui("set cmd [concat $id cancel \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc playlist_ok {id} {\n");
-sys_gui("playlist_apply $id\n");
-sys_gui("playlist_cancel $id\n");
-sys_gui("}\n");
-sys_gui("proc pdtk_playlist_dialog {id extension width height font bgcolor sbcolor fgcolor secolor} {\n");
-sys_gui("set vid [string trimleft $id .]\n");
-sys_gui("set var_graph_extension [concat graph_extension_$vid]\n");
-sys_gui("global $var_graph_extension\n");
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_height [concat graph_height$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set var_graph_font [concat graph_font$vid]\n");
-sys_gui("global $var_graph_font\n");
-sys_gui("set var_graph_bgcolor [concat graph_bgcolor$vid]\n");
-sys_gui("global $var_graph_bgcolor\n");
-sys_gui("set var_graph_sbcolor [concat graph_sbcolor$vid]\n");
-sys_gui("global $var_graph_sbcolor\n");
-sys_gui("set var_graph_fgcolor [concat graph_fgcolor$vid]\n");
-sys_gui("global $var_graph_fgcolor\n");
-sys_gui("set var_graph_secolor [concat graph_secolor$vid]\n");
-sys_gui("global $var_graph_secolor\n");
-sys_gui("set $var_graph_extension $extension\n");
-sys_gui("set $var_graph_width $width\n");
-sys_gui("set $var_graph_height $height\n");
-sys_gui("set $var_graph_font $font\n");
-sys_gui("set $var_graph_bgcolor $bgcolor\n");
-sys_gui("set $var_graph_sbcolor $sbcolor\n");
-sys_gui("set $var_graph_fgcolor $fgcolor\n");
-sys_gui("set $var_graph_secolor $secolor\n");
-sys_gui("toplevel $id\n");
-sys_gui("wm title $id {playlist}\n");
-sys_gui("wm protocol $id WM_DELETE_WINDOW [concat playlist_cancel $id]\n");
-sys_gui("label $id.label -text {PLAYLIST PROPERTIES}\n");
-sys_gui("pack $id.label -side top\n");
-sys_gui("frame $id.buttonframe\n");
-sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n");
-sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"playlist_cancel $id\"\n");
-sys_gui("button $id.buttonframe.apply -text {Apply} -command \"playlist_apply $id\"\n");
-sys_gui("button $id.buttonframe.ok -text {OK} -command \"playlist_ok $id\"\n");
-sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.apply -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.ok -side left -expand 1\n");
-sys_gui("frame $id.1rangef\n");
-sys_gui("pack $id.1rangef -side top\n");
-sys_gui("label $id.1rangef.lextension -text \"Files Extension :\"\n");
-sys_gui("entry $id.1rangef.extension -textvariable $var_graph_extension -width 7\n");
-sys_gui("pack $id.1rangef.lextension $id.1rangef.extension -side left\n");
-sys_gui("frame $id.2rangef\n");
-sys_gui("pack $id.2rangef -side top\n");
-sys_gui("label $id.2rangef.lwidth -text \"Width :\"\n");
-sys_gui("entry $id.2rangef.width -textvariable $var_graph_width -width 7\n");
-sys_gui("pack $id.2rangef.lwidth $id.2rangef.width -side left\n");
-sys_gui("frame $id.3rangef\n");
-sys_gui("pack $id.3rangef -side top\n");
-sys_gui("label $id.3rangef.lheight -text \"Height :\"\n");
-sys_gui("entry $id.3rangef.height -textvariable $var_graph_height -width 7\n");
-sys_gui("pack $id.3rangef.lheight $id.3rangef.height -side left\n");
-sys_gui("frame $id.3_5rangef\n");
-sys_gui("pack $id.3_5rangef -side top\n");
-sys_gui("label $id.3_5rangef.lfont -text \"Font :\"\n");
-sys_gui("entry $id.3_5rangef.font -textvariable $var_graph_font -width 30\n");
-sys_gui("pack $id.3_5rangef.lfont $id.3_5rangef.font -side left\n");
-sys_gui("frame $id.4rangef\n");
-sys_gui("pack $id.4rangef -side top\n");
-sys_gui("label $id.4rangef.lbgcolor -text \"Background Color :\"\n");
-sys_gui("entry $id.4rangef.bgcolor -textvariable $var_graph_bgcolor -width 7\n");
-sys_gui("pack $id.4rangef.lbgcolor $id.4rangef.bgcolor -side left\n");
-sys_gui("frame $id.5rangef\n");
-sys_gui("pack $id.5rangef -side top\n");
-sys_gui("label $id.5rangef.lsbcolor -text \"Scroll Bar Color :\"\n");
-sys_gui("entry $id.5rangef.sbcolor -textvariable $var_graph_sbcolor -width 7\n");
-sys_gui("pack $id.5rangef.lsbcolor $id.5rangef.sbcolor -side left\n");
-sys_gui("frame $id.6rangef\n");
-sys_gui("pack $id.6rangef -side top\n");
-sys_gui("label $id.6rangef.lfgcolor -text \"Foreground Color :\"\n");
-sys_gui("entry $id.6rangef.fgcolor -textvariable $var_graph_fgcolor -width 7\n");
-sys_gui("pack $id.6rangef.lfgcolor $id.6rangef.fgcolor -side left\n");
-sys_gui("frame $id.7rangef\n");
-sys_gui("pack $id.7rangef -side top\n");
-sys_gui("label $id.7rangef.lsecolor -text \"Selection Color :\"\n");
-sys_gui("entry $id.7rangef.secolor -textvariable $var_graph_secolor -width 7\n");
-sys_gui("pack $id.7rangef.lsecolor $id.7rangef.secolor -side left\n");
-sys_gui("bind $id.1rangef.extension <KeyPress-Return> [concat playlist_ok $id]\n");
-sys_gui("bind $id.2rangef.width <KeyPress-Return> [concat playlist_ok $id]\n");
-sys_gui("bind $id.3rangef.height <KeyPress-Return> [concat playlist_ok $id]\n");
-sys_gui("bind $id.3_5rangef.font <KeyPress-Return> [concat playlist_ok $id]\n");
-sys_gui("bind $id.4rangef.bgcolor <KeyPress-Return> [concat playlist_ok $id]\n");
-sys_gui("bind $id.5rangef.sbcolor <KeyPress-Return> [concat playlist_ok $id]\n");
-sys_gui("bind $id.6rangef.fgcolor <KeyPress-Return> [concat playlist_ok $id]\n");
-sys_gui("bind $id.7rangef.secolor <KeyPress-Return> [concat playlist_ok $id]\n");
-sys_gui("}\n");
-// ########### playlist procedures END -- ydegoyon@free.fr #########
diff --git a/playlist/tk2c.bash b/playlist/tk2c.bash
deleted file mode 100755
index 9dfeb03..0000000
--- a/playlist/tk2c.bash
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-#set -x
-
-while read line
-do
- for word in $line
- do
- if [ "X"$word != "X"${word#\#} ]
- then
- echo // ${line#\#}
- break
- else
- line=${line//\'/\\\'}
-#useless, slashes never gets in
- line=${line//\\/\\\\}
-#this one's dirty, i know
- line=${line//;/\\\\;}
- line=${line//\"/\\\"}
- echo 'sys_gui("'$line'\n");'
- break
- fi
- done
-done
diff --git a/probalizer/probalizer-help.pd b/probalizer-help.pd
index b3baa89..b3baa89 100644
--- a/probalizer/probalizer-help.pd
+++ b/probalizer-help.pd
diff --git a/probalizer/probalizer.c b/probalizer.c
index c6fe338..073314e 100644
--- a/probalizer/probalizer.c
+++ b/probalizer.c
@@ -42,7 +42,7 @@
#include "probalizer.h"
-#ifdef NT
+#ifdef _WIN32
#include <io.h>
#else
#include <unistd.h>
@@ -673,7 +673,6 @@ static void probalizer_free(t_probalizer *x)
void probalizer_setup(void)
{
post( probalizer_version );
-#include "probalizer.tk2c"
probalizer_class = class_new(gensym("probalizer"), (t_newmethod)probalizer_new,
(t_method)probalizer_free, sizeof(t_probalizer), 0, A_GIMME, 0);
class_addmethod(probalizer_class, (t_method)probalizer_dialog, gensym("dialog"), A_GIMME, 0);
@@ -700,4 +699,8 @@ void probalizer_setup(void)
class_setwidget(probalizer_class, &probalizer_widgetbehavior);
+
+ sys_vgui("eval [read [open %s/%s.tcl]]\n",
+ probalizer_class->c_externdir->s_name,
+ probalizer_class->c_name->s_name);
}
diff --git a/probalizer/probalizer.h b/probalizer.h
index 51c9711..51c9711 100644
--- a/probalizer/probalizer.h
+++ b/probalizer.h
diff --git a/probalizer/probalizer.tk b/probalizer.tcl
index 2f069e9..2f069e9 100644
--- a/probalizer/probalizer.tk
+++ b/probalizer.tcl
diff --git a/probalizer/INSTALL b/probalizer/INSTALL
deleted file mode 100644
index 17ecb34..0000000
--- a/probalizer/INSTALL
+++ /dev/null
@@ -1,14 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/probalizer
-
-make clean
-
-make
-
-make install
-
-open help-probalizer.pd
-
-comments and bugs @ ydegoyon@free.fr
-Yves/
diff --git a/probalizer/probalizer.tk2c b/probalizer/probalizer.tk2c
deleted file mode 100755
index b4a608c..0000000
--- a/probalizer/probalizer.tk2c
+++ /dev/null
@@ -1,87 +0,0 @@
-// ########### probalizer procedures -- ydegoyon@free.fr #########
-sys_gui("proc probalizer_apply {id} {\n");
-// strip "." from the TK id to make a variable name suffix
-sys_gui("set vid [string trimleft $id .]\n");
-// for each variable, make a local variable to hold its name...
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_height [concat graph_height_$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set var_graph_nvalues [concat graph_nvalues_$vid]\n");
-sys_gui("global $var_graph_nvalues\n");
-sys_gui("set var_graph_noccurrences [concat graph_noccurrences_$vid]\n");
-sys_gui("global $var_graph_noccurrences\n");
-sys_gui("set var_graph_save [concat graph_save_$vid]\n");
-sys_gui("global $var_graph_save\n");
-sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_width] [eval concat $$var_graph_height] [eval concat $$var_graph_nvalues] [eval concat $$var_graph_noccurrences] [eval concat $$var_graph_save] \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc probalizer_cancel {id} {\n");
-sys_gui("set cmd [concat $id cancel \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc probalizer_ok {id} {\n");
-sys_gui("probalizer_apply $id\n");
-sys_gui("probalizer_cancel $id\n");
-sys_gui("}\n");
-sys_gui("proc pdtk_probalizer_dialog {id width height nvalues noccurrences save } {\n");
-sys_gui("set vid [string trimleft $id .]\n");
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_height [concat graph_height_$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set var_graph_nvalues [concat graph_nvalues_$vid]\n");
-sys_gui("global $var_graph_nvalues\n");
-sys_gui("set var_graph_noccurrences [concat graph_noccurrences_$vid]\n");
-sys_gui("global $var_graph_noccurrences\n");
-sys_gui("set var_graph_save [concat graph_save_$vid]\n");
-sys_gui("global $var_graph_save\n");
-sys_gui("set $var_graph_width $width\n");
-sys_gui("set $var_graph_height $height\n");
-sys_gui("set $var_graph_nvalues $nvalues\n");
-sys_gui("set $var_graph_noccurrences $noccurrences\n");
-sys_gui("set $var_graph_save $save\n");
-sys_gui("toplevel $id\n");
-sys_gui("wm title $id {probalizer}\n");
-sys_gui("wm protocol $id WM_DELETE_WINDOW [concat probalizer_cancel $id]\n");
-sys_gui("label $id.label -text {PROBALIZER PROPERTIES}\n");
-sys_gui("pack $id.label -side top\n");
-sys_gui("frame $id.buttonframe\n");
-sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n");
-sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"probalizer_cancel $id\"\n");
-sys_gui("button $id.buttonframe.apply -text {Apply} -command \"probalizer_apply $id\"\n");
-sys_gui("button $id.buttonframe.ok -text {OK} -command \"probalizer_ok $id\"\n");
-sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.apply -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.ok -side left -expand 1\n");
-sys_gui("frame $id.1rangef\n");
-sys_gui("pack $id.1rangef -side top\n");
-sys_gui("label $id.1rangef.lwidth -text \"Width :\"\n");
-sys_gui("entry $id.1rangef.width -textvariable $var_graph_width -width 7\n");
-sys_gui("pack $id.1rangef.lwidth $id.1rangef.width -side left\n");
-sys_gui("frame $id.2rangef\n");
-sys_gui("pack $id.2rangef -side top\n");
-sys_gui("label $id.2rangef.lheight -text \"Height :\"\n");
-sys_gui("entry $id.2rangef.height -textvariable $var_graph_height -width 7\n");
-sys_gui("pack $id.2rangef.lheight $id.2rangef.height -side left\n");
-sys_gui("frame $id.3rangef\n");
-sys_gui("pack $id.3rangef -side top\n");
-sys_gui("label $id.3rangef.lnvalues -text \"Values :\"\n");
-sys_gui("entry $id.3rangef.nvalues -textvariable $var_graph_nvalues -width 7\n");
-sys_gui("pack $id.3rangef.lnvalues $id.3rangef.nvalues -side left\n");
-sys_gui("frame $id.4rangef\n");
-sys_gui("pack $id.4rangef -side top\n");
-sys_gui("label $id.4rangef.lnoccurrences -text \"Max Occurrences :\"\n");
-sys_gui("entry $id.4rangef.noccurrences -textvariable $var_graph_noccurrences -width 7\n");
-sys_gui("pack $id.4rangef.lnoccurrences $id.4rangef.noccurrences -side left\n");
-sys_gui("checkbutton $id.save -text {Save contents} -variable $var_graph_save -anchor w\n");
-sys_gui("pack $id.save -side top\n");
-sys_gui("bind $id.1rangef.width <KeyPress-Return> [concat probalizer_ok $id]\n");
-sys_gui("bind $id.2rangef.height <KeyPress-Return> [concat probalizer_ok $id]\n");
-sys_gui("bind $id.3rangef.nvalues <KeyPress-Return> [concat probalizer_ok $id]\n");
-sys_gui("bind $id.4rangef.noccurrences <KeyPress-Return> [concat probalizer_ok $id]\n");
-sys_gui("focus $id.1rangef.width\n");
-sys_gui("}\n");
-// ########### probalizer procedures END -- ydegoyon@free.fr #########
diff --git a/probalizer/tk2c.bash b/probalizer/tk2c.bash
deleted file mode 100755
index 9dfeb03..0000000
--- a/probalizer/tk2c.bash
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-#set -x
-
-while read line
-do
- for word in $line
- do
- if [ "X"$word != "X"${word#\#} ]
- then
- echo // ${line#\#}
- break
- else
- line=${line//\'/\\\'}
-#useless, slashes never gets in
- line=${line//\\/\\\\}
-#this one's dirty, i know
- line=${line//;/\\\\;}
- line=${line//\"/\\\"}
- echo 'sys_gui("'$line'\n");'
- break
- fi
- done
-done
diff --git a/randomblock~/randomblock~-help.pd b/randomblock~-help.pd
index d4b2e5d..d4b2e5d 100644
--- a/randomblock~/randomblock~-help.pd
+++ b/randomblock~-help.pd
diff --git a/randomblock~/randomblock~.c b/randomblock~.c
index 34d2411..34d2411 100644
--- a/randomblock~/randomblock~.c
+++ b/randomblock~.c
diff --git a/randomblock~/INSTALL b/randomblock~/INSTALL
deleted file mode 100644
index ae90f70..0000000
--- a/randomblock~/INSTALL
+++ /dev/null
@@ -1,7 +0,0 @@
-untar in /my/pd/dir/extra
-
-cd /my/pd/dir/extra/randomblock~
-
-make
-
-you're set !!
diff --git a/randomblock~/randtab.pd b/randtab.pd
index 089a86e..089a86e 100644
--- a/randomblock~/randtab.pd
+++ b/randtab.pd
diff --git a/filterbank~/resynth-64.pd b/resynth-64.pd
index bb5a93d..bb5a93d 100644
--- a/filterbank~/resynth-64.pd
+++ b/resynth-64.pd
diff --git a/disto~/rs-disto~.pd b/rs-disto~.pd
index 981d235..981d235 100644
--- a/disto~/rs-disto~.pd
+++ b/rs-disto~.pd
diff --git a/scratcher~/rs-scratcher~.pd b/rs-scratcher~.pd
index 87b0026..87b0026 100644
--- a/scratcher~/rs-scratcher~.pd
+++ b/rs-scratcher~.pd
diff --git a/sonogram~/rs-sonogram~.pd b/rs-sonogram~.pd
index 08274ae..08274ae 100644
--- a/sonogram~/rs-sonogram~.pd
+++ b/rs-sonogram~.pd
diff --git a/sonogram~/rs-sonograph~.pd b/rs-sonograph~.pd
index a8531fa..a8531fa 100644
--- a/sonogram~/rs-sonograph~.pd
+++ b/rs-sonograph~.pd
diff --git a/vocoder~/rs-vocoder~.pd b/rs-vocoder~.pd
index 65dfc0d..65dfc0d 100644
--- a/vocoder~/rs-vocoder~.pd
+++ b/rs-vocoder~.pd
diff --git a/wahwah~/rs-wahwah~.pd b/rs-wahwah~.pd
index af5c256..af5c256 100644
--- a/wahwah~/rs-wahwah~.pd
+++ b/rs-wahwah~.pd
diff --git a/samplebox~/samplebox~-help.pd b/samplebox~-help.pd
index 9b5b6f5..9b5b6f5 100644
--- a/samplebox~/samplebox~-help.pd
+++ b/samplebox~-help.pd
diff --git a/samplebox~/samplebox~.c b/samplebox~.c
index 64e656c..64e656c 100644
--- a/samplebox~/samplebox~.c
+++ b/samplebox~.c
diff --git a/samplebox~/INSTALL b/samplebox~/INSTALL
deleted file mode 100644
index c0dc546..0000000
--- a/samplebox~/INSTALL
+++ /dev/null
@@ -1,9 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/samplebox~
-
-make
-
-make install
-
-you're set !!
diff --git a/scratcher~/scratcher~-help.pd b/scratcher~-help.pd
index 4a9149c..4a9149c 100644
--- a/scratcher~/scratcher~-help.pd
+++ b/scratcher~-help.pd
diff --git a/scratcher~/scratcher~.c b/scratcher~.c
index 6adba91..8fec927 100644
--- a/scratcher~/scratcher~.c
+++ b/scratcher~.c
@@ -46,13 +46,13 @@
#include <pthread.h>
#include <time.h>
#include <sys/time.h>
-#ifdef UNIX
-#include <unistd.h>
-#endif
-#ifdef NT
+#include <math.h>
+
+#ifdef _WIN32
#define M_PI 3.14159265358979323846
+#else
+#include <unistd.h>
#endif
-#include <math.h>
#include "m_pd.h"
#include "m_imp.h"
@@ -780,7 +780,6 @@ static void *scratcher_new(t_symbol *s, int argc, t_atom *argv)
void scratcher_tilde_setup(void)
{
post(scratcher_version);
-#include "scratcher~.tk2c"
scratcher_class = class_new(gensym("scratcher~"), (t_newmethod)scratcher_new, (t_method)scratcher_free,
sizeof(t_scratcher), 0, A_GIMME, 0);
@@ -814,4 +813,8 @@ void scratcher_tilde_setup(void)
class_addmethod(scratcher_class, (t_method)scratcher_stop, gensym("stop"), A_NULL);
class_addmethod(scratcher_class, (t_method)scratcher_reset, gensym("reset"), A_NULL);
class_addmethod(scratcher_class, (t_method)scratcher_dialog, gensym("dialog"), A_GIMME, A_NULL);
+
+ sys_vgui("eval [read [open %s/%s.tcl]]\n",
+ scratcher_class->c_externdir->s_name,
+ scratcher_class->c_name->s_name);
}
diff --git a/scratcher~/scratcher~.tk b/scratcher~.tcl
index bc8ad6f..bc8ad6f 100644
--- a/scratcher~/scratcher~.tk
+++ b/scratcher~.tcl
diff --git a/scratcher~/INSTALL b/scratcher~/INSTALL
deleted file mode 100644
index a99e2c1..0000000
--- a/scratcher~/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/scratcher~
-
-make clean
-
-make
-
-make install
-
-open help-scratcher~.pd
-
-Thanx for getting here.
-Yves/
-comments and bugs @ ydegoyon@free.fr
diff --git a/scratcher~/scratcher~.tk2c b/scratcher~/scratcher~.tk2c
deleted file mode 100755
index 8c07523..0000000
--- a/scratcher~/scratcher~.tk2c
+++ /dev/null
@@ -1,58 +0,0 @@
-// ########### scratcher procedures -- ydegoyon@free.fr #########
-sys_gui("proc scratcher_apply {id} {\n");
-// strip "." from the TK id to make a variable name suffix
-sys_gui("set vid [string trimleft $id .]\n");
-// for each variable, make a local variable to hold its name...
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_height [concat graph_height_$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_width] [eval concat $$var_graph_height] \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc scratcher_cancel {id} {\n");
-sys_gui("set cmd [concat $id cancel \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc scratcher_ok {id} {\n");
-sys_gui("scratcher_apply $id\n");
-sys_gui("scratcher_cancel $id\n");
-sys_gui("}\n");
-sys_gui("proc pdtk_scratcher_dialog {id width height} {\n");
-sys_gui("set vid [string trimleft $id .]\n");
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_height [concat graph_height_$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set $var_graph_width $width\n");
-sys_gui("set $var_graph_height $height\n");
-sys_gui("toplevel $id\n");
-sys_gui("wm title $id {scratcher}\n");
-sys_gui("wm protocol $id WM_DELETE_WINDOW [concat scratcher_cancel $id]\n");
-sys_gui("label $id.label -text {SCRATCHER PROPERTIES}\n");
-sys_gui("pack $id.label -side top\n");
-sys_gui("frame $id.buttonframe\n");
-sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n");
-sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"scratcher_cancel $id\"\n");
-sys_gui("button $id.buttonframe.apply -text {Apply} -command \"scratcher_apply $id\"\n");
-sys_gui("button $id.buttonframe.ok -text {OK} -command \"scratcher_ok $id\"\n");
-sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.apply -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.ok -side left -expand 1\n");
-sys_gui("frame $id.1rangef\n");
-sys_gui("pack $id.1rangef -side top\n");
-sys_gui("label $id.1rangef.lwidth -text \"Width :\"\n");
-sys_gui("entry $id.1rangef.width -textvariable $var_graph_width -width 7\n");
-sys_gui("pack $id.1rangef.lwidth $id.1rangef.width -side left\n");
-sys_gui("frame $id.2rangef\n");
-sys_gui("pack $id.2rangef -side top\n");
-sys_gui("label $id.2rangef.lheight -text \"Height :\"\n");
-sys_gui("entry $id.2rangef.height -textvariable $var_graph_height -width 7\n");
-sys_gui("pack $id.2rangef.lheight $id.2rangef.height -side left\n");
-sys_gui("bind $id.1rangef.name <KeyPress-Return> [concat scratcher_ok $id]\n");
-sys_gui("bind $id.2rangef.height <KeyPress-Return> [concat scratcher_ok $id]\n");
-sys_gui("focus $id.1rangef.name\n");
-sys_gui("}\n");
-// ########### scratcher procedures END -- ydegoyon@free.fr #########
diff --git a/scratcher~/timeval.h b/scratcher~/timeval.h
deleted file mode 100644
index ff04962..0000000
--- a/scratcher~/timeval.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * timeval.h 1.0 01/12/19
- *
- * Defines gettimeofday, timeval, etc. for Win32
- *
- * By Wu Yongwei
- *
- */
-
-#ifndef _TIMEVAL_H
-#define _TIMEVAL_H
-
-#ifdef _WIN32
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <time.h>
-
-#ifndef __GNUC__
-#define EPOCHFILETIME (116444736000000000i64)
-#else
-#define EPOCHFILETIME (116444736000000000LL)
-#endif /* not __GNUC__ */
-
-#if 0
-struct timeval {
- long tv_sec; /* seconds */
- long tv_usec; /* microseconds */
-};
-#endif /* 0 */
-
-struct timezone {
- int tz_minuteswest; /* minutes W of Greenwich */
- int tz_dsttime; /* type of dst correction */
-};
-
-__inline int gettimeofday(struct timeval *tv, struct timezone *tz)
-{
- FILETIME ft;
- LARGE_INTEGER li;
- __int64 t;
- static int tzflag;
-
- if (tv)
- {
- GetSystemTimeAsFileTime(&ft);
- li.LowPart = ft.dwLowDateTime;
- li.HighPart = ft.dwHighDateTime;
- t = li.QuadPart; /* In 100-nanosecond intervals */
- t -= EPOCHFILETIME; /* Offset to the Epoch time */
- t /= 10; /* In microseconds */
- tv->tv_sec = (long)(t / 1000000);
- tv->tv_usec = (long)(t % 1000000);
- }
-
- if (tz)
- {
- if (!tzflag)
- {
- _tzset();
- tzflag++;
- }
- tz->tz_minuteswest = _timezone / 60;
- tz->tz_dsttime = _daylight;
- }
-
- return 0;
-}
-
-#else /* _WIN32 */
-
-#include <sys/time.h>
-
-#endif /* _WIN32 */
-
-#endif /* _TIMEVAL_H */
diff --git a/scratcher~/tk2c.bash b/scratcher~/tk2c.bash
deleted file mode 100755
index 9dfeb03..0000000
--- a/scratcher~/tk2c.bash
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-#set -x
-
-while read line
-do
- for word in $line
- do
- if [ "X"$word != "X"${word#\#} ]
- then
- echo // ${line#\#}
- break
- else
- line=${line//\'/\\\'}
-#useless, slashes never gets in
- line=${line//\\/\\\\}
-#this one's dirty, i know
- line=${line//;/\\\\;}
- line=${line//\"/\\\"}
- echo 'sys_gui("'$line'\n");'
- break
- fi
- done
-done
diff --git a/scrolllist/scrolllist-help.pd b/scrolllist-help.pd
index b16fee2..b9b99a9 100755
--- a/scrolllist/scrolllist-help.pd
+++ b/scrolllist-help.pd
@@ -31,7 +31,7 @@
#X text 470 383 You can change all the properties of the object;
#X msg 612 57 add \$1;
#X text 666 58 add a text;
-#X obj 612 32 l2s;
+#X obj 612 32 zexy/list2symbol;
#X text 808 90 insert a text;
#X msg 742 89 dystopia;
#X msg 612 7 the aesthetics of our anger;
@@ -39,16 +39,16 @@
#X text 797 115 replace a text;
#X text 828 149 delete a text;
#X msg 611 89 insert \$1 3;
-#X obj 709 89 l2s;
-#X obj 705 115 l2s;
+#X obj 709 89 zexy/list2symbol;
+#X obj 705 115 zexy/list2symbol;
#X msg 610 115 replace \$1 3;
#X msg 612 149 delete \$1;
#X obj 692 149 hradio 15 1 0 8 empty empty empty 0 -6 0 8 -262144 -1
-1 0;
#X obj 555 269 textfile;
-#X msg 585 236 read yesterday.txt cr;
+#X msg 585 236 read examples/yesterday.txt cr;
#X msg 620 270 rewind;
-#X obj 527 269 l2s;
+#X obj 527 269 zexy/list2symbol;
#X msg 525 236 add \$1;
#X obj 748 216 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
@@ -69,7 +69,6 @@
#X obj 557 295 s smsg;
#X obj 573 176 s smsg;
#X msg 95 105 sort;
-#X msg 617 295 read ave-lucifer.txt cr;
#X msg 96 211 bgcolor blue;
#X msg 196 212 fgcolor white;
#X msg 304 211 secolor #567823;
diff --git a/scrolllist/scrolllist.c b/scrolllist.c
index 9348895..b897145 100644
--- a/scrolllist/scrolllist.c
+++ b/scrolllist.c
@@ -41,7 +41,7 @@
#include "g_canvas.h"
-#ifdef NT
+#ifdef _WIN32
#include <io.h>
#include <pthread.h>
#else
@@ -999,7 +999,6 @@ static void scrolllist_free(t_scrolllist *x)
void scrolllist_setup(void)
{
post( scrolllist_version );
-#include "scrolllist.tk2c"
scrolllist_class = class_new(gensym("scrolllist"), (t_newmethod)scrolllist_new,
(t_method)scrolllist_free, sizeof(t_scrolllist),
CLASS_DEFAULT, A_GIMME, 0);
@@ -1036,4 +1035,7 @@ void scrolllist_setup(void)
class_setwidget(scrolllist_class, &scrolllist_widgetbehavior);
+ sys_vgui("eval [read [open %s/%s.tcl]]\n",
+ scrolllist_class->c_externdir->s_name,
+ scrolllist_class->c_name->s_name);
}
diff --git a/scrolllist/scrolllist.tk b/scrolllist.tcl
index 79ca61c..79ca61c 100755
--- a/scrolllist/scrolllist.tk
+++ b/scrolllist.tcl
diff --git a/scrolllist/INSTALL b/scrolllist/INSTALL
deleted file mode 100755
index 9b308b4..0000000
--- a/scrolllist/INSTALL
+++ /dev/null
@@ -1,14 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/scrolllist
-
-make clean
-
-make
-
-make install
-
-open help-scrolllist.pd
-
-Thanx for getting here.
-Yves/
diff --git a/scrolllist/ave-lucifer.txt b/scrolllist/ave-lucifer.txt
deleted file mode 100644
index 8aca29e..0000000
--- a/scrolllist/ave-lucifer.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-Ave, Lúcifer
-(Arnaldo Baptista/ Rita Lee/ Élcio Decário)
-
-As maçãs
-Envolvem os corpos nus
-Nesse rio que corre
-Em veias mansas dentro de mim
-
-Anjos e arcanjos
-Não pousam neste éden infernal
-E a flecha do selvagem
-Matou mil aves no ar
-
-Quieta, a serpente se enrola
-Nos seus pés
-É Lúcifer da floresta
-Que tenta me abraçar
-
-Vem amor
-Que um paraíso
-Num abraço amigo
-Sorrira pra nós sem ninguém nos ver
-
-Prometa
-Meu amor macio
-Como uma flor cheia de mel
-Pra te embriagar, sem ninguém nos ver
-
-Tragam uvas negras
-Tragam festas e flores
-Tragam copos e dores
-Tragam incensos odores
-
-Mas, tragam Lúcifer pra mim
-Em uma bandeja pra mim
diff --git a/scrolllist/scrolllist.tk2c b/scrolllist/scrolllist.tk2c
deleted file mode 100644
index 97129fb..0000000
--- a/scrolllist/scrolllist.tk2c
+++ /dev/null
@@ -1,112 +0,0 @@
-// ########### scrolllist procedures -- ydegoyon@free.fr #########
-sys_gui("proc scrolllist_apply {id} {\n");
-// strip "." from the TK id to make a variable name suffix
-sys_gui("set vid [string trimleft $id .]\n");
-// for each variable, make a local variable to hold its name...
-sys_gui("set var_graph_capacity [concat graph_capacity_$vid]\n");
-sys_gui("global $var_graph_capacity\n");
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_height [concat graph_height$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set var_graph_font [concat graph_font$vid]\n");
-sys_gui("global $var_graph_font\n");
-sys_gui("set var_graph_bgcolor [concat graph_bgcolor$vid]\n");
-sys_gui("global $var_graph_bgcolor\n");
-sys_gui("set var_graph_fgcolor [concat graph_fgcolor$vid]\n");
-sys_gui("global $var_graph_fgcolor\n");
-sys_gui("set var_graph_secolor [concat graph_secolor$vid]\n");
-sys_gui("global $var_graph_secolor\n");
-sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_capacity] [eval concat $$var_graph_width] [eval concat $$var_graph_height] [eval concat $$var_graph_font] [eval concat $$var_graph_bgcolor] [eval concat $$var_graph_fgcolor] [eval concat $$var_graph_secolor] \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc scrolllist_cancel {id} {\n");
-sys_gui("set cmd [concat $id cancel \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc scrolllist_ok {id} {\n");
-sys_gui("scrolllist_apply $id\n");
-sys_gui("scrolllist_cancel $id\n");
-sys_gui("}\n");
-sys_gui("proc pdtk_scrolllist_dialog {id capacity width height font bgcolor fgcolor secolor} {\n");
-sys_gui("set vid [string trimleft $id .]\n");
-sys_gui("set var_graph_capacity [concat graph_capacity_$vid]\n");
-sys_gui("global $var_graph_capacity\n");
-sys_gui("set var_graph_width [concat graph_width_$vid]\n");
-sys_gui("global $var_graph_width\n");
-sys_gui("set var_graph_height [concat graph_height$vid]\n");
-sys_gui("global $var_graph_height\n");
-sys_gui("set var_graph_font [concat graph_font$vid]\n");
-sys_gui("global $var_graph_font\n");
-sys_gui("set var_graph_bgcolor [concat graph_bgcolor$vid]\n");
-sys_gui("global $var_graph_bgcolor\n");
-sys_gui("set var_graph_fgcolor [concat graph_fgcolor$vid]\n");
-sys_gui("global $var_graph_fgcolor\n");
-sys_gui("set var_graph_secolor [concat graph_secolor$vid]\n");
-sys_gui("global $var_graph_secolor\n");
-sys_gui("set $var_graph_capacity $capacity\n");
-sys_gui("set $var_graph_width $width\n");
-sys_gui("set $var_graph_height $height\n");
-sys_gui("set $var_graph_font $font\n");
-sys_gui("set $var_graph_bgcolor $bgcolor\n");
-sys_gui("set $var_graph_fgcolor $fgcolor\n");
-sys_gui("set $var_graph_secolor $secolor\n");
-sys_gui("toplevel $id\n");
-sys_gui("wm title $id {scrolllist}\n");
-sys_gui("wm protocol $id WM_DELETE_WINDOW [concat scrolllist_cancel $id]\n");
-sys_gui("label $id.label -text {SCROLLLIST PROPERTIES}\n");
-sys_gui("pack $id.label -side top\n");
-sys_gui("frame $id.buttonframe\n");
-sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n");
-sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"scrolllist_cancel $id\"\n");
-sys_gui("button $id.buttonframe.apply -text {Apply} -command \"scrolllist_apply $id\"\n");
-sys_gui("button $id.buttonframe.ok -text {OK} -command \"scrolllist_ok $id\"\n");
-sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.apply -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.ok -side left -expand 1\n");
-sys_gui("frame $id.1rangef\n");
-sys_gui("pack $id.1rangef -side top\n");
-sys_gui("label $id.1rangef.lcapacity -text \"Capacity :\"\n");
-sys_gui("entry $id.1rangef.capacity -textvariable $var_graph_capacity -width 7\n");
-sys_gui("pack $id.1rangef.lcapacity $id.1rangef.capacity -side left\n");
-sys_gui("frame $id.2rangef\n");
-sys_gui("pack $id.2rangef -side top\n");
-sys_gui("label $id.2rangef.lwidth -text \"Width :\"\n");
-sys_gui("entry $id.2rangef.width -textvariable $var_graph_width -width 7\n");
-sys_gui("pack $id.2rangef.lwidth $id.2rangef.width -side left\n");
-sys_gui("frame $id.3rangef\n");
-sys_gui("pack $id.3rangef -side top\n");
-sys_gui("label $id.3rangef.lheight -text \"Height :\"\n");
-sys_gui("entry $id.3rangef.height -textvariable $var_graph_height -width 7\n");
-sys_gui("pack $id.3rangef.lheight $id.3rangef.height -side left\n");
-sys_gui("frame $id.3_5rangef\n");
-sys_gui("pack $id.3_5rangef -side top\n");
-sys_gui("label $id.3_5rangef.lfont -text \"Font :\"\n");
-sys_gui("entry $id.3_5rangef.font -textvariable $var_graph_font -width 30\n");
-sys_gui("pack $id.3_5rangef.lfont $id.3_5rangef.font -side left\n");
-sys_gui("frame $id.4rangef\n");
-sys_gui("pack $id.4rangef -side top\n");
-sys_gui("label $id.4rangef.lbgcolor -text \"Background Color :\"\n");
-sys_gui("entry $id.4rangef.bgcolor -textvariable $var_graph_bgcolor -width 7\n");
-sys_gui("pack $id.4rangef.lbgcolor $id.4rangef.bgcolor -side left\n");
-sys_gui("frame $id.5rangef\n");
-sys_gui("pack $id.5rangef -side top\n");
-sys_gui("label $id.5rangef.lfgcolor -text \"Foreground Color :\"\n");
-sys_gui("entry $id.5rangef.fgcolor -textvariable $var_graph_fgcolor -width 7\n");
-sys_gui("pack $id.5rangef.lfgcolor $id.5rangef.fgcolor -side left\n");
-sys_gui("frame $id.6rangef\n");
-sys_gui("pack $id.6rangef -side top\n");
-sys_gui("label $id.6rangef.lsecolor -text \"Selection Color :\"\n");
-sys_gui("entry $id.6rangef.secolor -textvariable $var_graph_secolor -width 7\n");
-sys_gui("pack $id.6rangef.lsecolor $id.6rangef.secolor -side left\n");
-sys_gui("bind $id.1rangef.capacity <KeyPress-Return> [concat scrolllist_ok $id]\n");
-sys_gui("bind $id.2rangef.width <KeyPress-Return> [concat scrolllist_ok $id]\n");
-sys_gui("bind $id.3rangef.height <KeyPress-Return> [concat scrolllist_ok $id]\n");
-sys_gui("bind $id.3_5rangef.font <KeyPress-Return> [concat scrolllist_ok $id]\n");
-sys_gui("bind $id.4rangef.bgcolor <KeyPress-Return> [concat scrolllist_ok $id]\n");
-sys_gui("bind $id.5rangef.fgcolor <KeyPress-Return> [concat scrolllist_ok $id]\n");
-sys_gui("bind $id.6rangef.secolor <KeyPress-Return> [concat scrolllist_ok $id]\n");
-sys_gui("}\n");
-// ########### scrolllist procedures END -- ydegoyon@free.fr #########
diff --git a/scrolllist/tk2c.bash b/scrolllist/tk2c.bash
deleted file mode 100755
index 9dfeb03..0000000
--- a/scrolllist/tk2c.bash
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-#set -x
-
-while read line
-do
- for word in $line
- do
- if [ "X"$word != "X"${word#\#} ]
- then
- echo // ${line#\#}
- break
- else
- line=${line//\'/\\\'}
-#useless, slashes never gets in
- line=${line//\\/\\\\}
-#this one's dirty, i know
- line=${line//;/\\\\;}
- line=${line//\"/\\\"}
- echo 'sys_gui("'$line'\n");'
- break
- fi
- done
-done
diff --git a/filterbank~/setosc.pd b/setosc.pd
index 6cb4ff0..6cb4ff0 100644
--- a/filterbank~/setosc.pd
+++ b/setosc.pd
diff --git a/sonogram~/sonogram~-help.pd b/sonogram~-help.pd
index ab00898..ab00898 100644
--- a/sonogram~/sonogram~-help.pd
+++ b/sonogram~-help.pd
diff --git a/sonogram~/sonogram~.c b/sonogram~.c
index 4085b34..4085b34 100644
--- a/sonogram~/sonogram~.c
+++ b/sonogram~.c
diff --git a/sonogram~/INSTALL b/sonogram~/INSTALL
deleted file mode 100644
index d69da45..0000000
--- a/sonogram~/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/sonogram~
-
-make clean
-
-make
-
-make install
-
-open help-sonogram~.pd
-
-Thanx for getting here.
-Yves/
-comments and bugs @ ydegoyon@free.fr
diff --git a/sonogram~/sonogram~-joge.c b/sonogram~/sonogram~-joge.c
deleted file mode 100644
index 8d148fa..0000000
--- a/sonogram~/sonogram~-joge.c
+++ /dev/null
@@ -1,2044 +0,0 @@
-/*------------------------ sonogram~ ------------------------------------------ */
-/* */
-/* sonogram~ : lets you record, play back and modify a sonogram */
-/* constructor : sonogram <size> <graphical=0|1> <phasogram=0|1> */
-/* */
-/* Copyleft Yves Degoyon ( ydegoyon@free.fr ) */
-/* */
-/* This program is free software; you can redistribute it and/or */
-/* modify it under the terms of the GNU General Public License */
-/* as published by the Free Software Foundation; either version 2 */
-/* of the License, or (at your option) any later version. */
-/* */
-/* See file LICENSE for further informations on licensing terms. */
-/* */
-/* This program is distributed in the hope that it will be useful, */
-/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
-/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
-/* GNU General Public License for more details. */
-/* */
-/* You should have received a copy of the GNU General Public License */
-/* along with this program; if not, write to the Free Software */
-/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-/* */
-/* Based on PureData by Miller Puckette and others. */
-/* */
-/* "Living at night" */
-/* "Doesn't help for my complexion" */
-/* David Thomas - Final Solution */
-/* ---------------------------------------------------------------------------- */
-
-/* this doesn't compile on MinGW */
-#ifndef _WIN32
-
-#include <sys/types.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#ifndef __APPLE__
-#include <malloc.h>
-#endif
-#include <ctype.h>
-#ifdef UNIX
-#include <unistd.h>
-#include <pthread.h>
-#endif
-#ifdef _WIN32
-#define M_PI 3.14159265358979323846
-#include "pthread.h"
-#include <windows.h>
-#endif
-#include <math.h>
-
-#include <m_pd.h>
-#include "m_imp.h"
-#include "g_canvas.h"
-
-
-static int guidebug=0;
-static int ignorevisible=1; // ignore visible test
- // because this seems to lead to bad refresh
- // wait for a fix
-
-#define SYS_VGUI2(a,b) if (guidebug) \
- post(a,b);\
- sys_vgui(a,b)
-
-#define SYS_VGUI3(a,b,c) if (guidebug) \
- post(a,b,c);\
- sys_vgui(a,b,c)
-
-#define SYS_VGUI4(a,b,c,d) if (guidebug) \
- post(a,b,c,d);\
- sys_vgui(a,b,c,d)
-
-#define SYS_VGUI5(a,b,c,d,e) if (guidebug) \
- post(a,b,c,d,e);\
- sys_vgui(a,b,c,d,e)
-
-#define SYS_VGUI6(a,b,c,d,e,f) if (guidebug) \
- post(a,b,c,d,e,f);\
- sys_vgui(a,b,c,d,e,f)
-
-#define SYS_VGUI7(a,b,c,d,e,f,g) if (guidebug) \
- post(a,b,c,d,e,f,g );\
- sys_vgui(a,b,c,d,e,f,g)
-
-#define SYS_VGUI9(a,b,c,d,e,f,g,h,i) if (guidebug) \
- post(a,b,c,d,e,f,g,h,i );\
- sys_vgui(a,b,c,d,e,f,g,h,i)
-
-#define SYS_VGUI10(a,b,c,d,e,f,g,h,i,j) if (guidebug) \
- post(a,b,c,d,e,f,g,h,i,j );\
- sys_vgui(a,b,c,d,e,f,g,h,i,j)
-
-#define SYS_VGUI11(a,b,c,d,e,f,g,h,i,j,k) if (guidebug) \
- post(a,b,c,d,e,f,g,h,i,j,k );\
- sys_vgui(a,b,c,d,e,f,g,h,i,j,k)
-
-#define THREAD_SLEEP_TIME 100000 // 100000 us = 100 ms
-
-static char *sonogram_version = "sonogram~: version 0.9, written by Yves Degoyon (ydegoyon@free.fr)";
-
-static t_class *sonogram_class;
-t_widgetbehavior sonogram_widgetbehavior;
-
-
-typedef struct _sonogram
-{
- t_object x_obj;
-
- t_int x_size; /* size of the stored fft ( in blocks~ ) */
- t_float x_samplerate; /* sample rate */
- t_int x_blocksize; /* current block size ( might be modified by block~ object ) */
- t_float x_readpos; /* data's playing position */
- t_int x_writepos; /* data's recording position */
- t_int x_readstart; /* data's starting position for reading */
- t_int x_readend; /* data's ending position for reading */
- t_int x_modstart; /* data's starting position for modifications */
- t_int x_modend; /* data's ending position for modifications */
- t_int x_play; /* playing on/off flag */
- t_float x_readspeed; /* number of grouped blocks for reading */
- t_float x_record; /* flag to start recording process */
- t_float x_empty; /* flag to indicate it's a brand new sonogram */
- t_float *x_rdata; /* table containing real part of the fft */
- t_float *x_rudata; /* undo real data */
- t_float *x_idata; /* table containing imaginery part of the fft */
- t_float *x_iudata; /* undo imaginery data */
- t_float x_phase; /* phase to apply on output */
- t_outlet *x_end; /* outlet for end of restitution */
- t_outlet *x_recend; /* outlet for end of recording */
- t_int *x_multfreq; /* array of multiplicative factor */
- char *x_gifdata; /* buffer for graphical data */
- char *x_guicommand; /* buffer for graphical command */
- t_int x_uxs; /* starting x position for undo */
- t_int x_uxe; /* ending x position for undo */
- t_int x_uys; /* starting y position for undo */
- t_int x_uye; /* ending y position for undo */
-
- /* graphical data block */
- t_int x_enhancemode; /* flag to set enhance mode */
- t_int x_graphic; /* flag to set graphic mode */
- t_int x_phaso; /* flag to indicate if phasogram is shown */
- t_int x_selected; /* flag to remember if we are seleted or not */
- t_int x_erase; /* flag used when an erase is needed */
- t_int x_redraw; /* flag used when drawing is needed */
- t_int x_nbupdated; /* number of points updated */
- t_glist *x_glist; /* keep graphic context for various operations */
- t_int x_zoom; /* zoom factor */
- pthread_t x_updatechild; /* thread id for the update child */
- t_int x_updatestart; /* starting position for update */
- t_int x_updateend; /* ending position for update */
- t_int x_xpos; /* stuck x position */
- t_int x_ypos; /* stuck y position */
- t_int x_shifted; /* remember shift state from last click */
- t_int x_alted; /* remember alt state from last click */
- t_int x_aftermousedown; /* indicates the mousedown event */
- t_int x_xstartcapture; /* x of the start of the capture */
- t_int x_ystartcapture; /* y of the start of the capture */
- t_int x_xendcapture; /* x of the start of the capture */
- t_int x_yendcapture; /* y of the start of the capture */
- t_int x_xdraw; /* x drawing position */
- t_int x_ydraw; /* y drawing position */
- t_float x_modstep; /* step for graphical modifications */
-
- t_float x_f; /* float needed for signal input */
-
-} t_sonogram;
-
-/* ------------------------ drawing functions ---------------------------- */
-static char* sonogram_get_fill_color( t_float fspectrum )
-{
- if ( fspectrum < 0.01 ) {
- return "#EEEEEE";
- } else if ( fspectrum < 0.1 ) {
- return "#DDDDDD";
- } else if ( fspectrum < 0.5 ) {
- return "#CCCCCC";
- } else if ( fspectrum < 1 ) {
- return "#BBBBBB";
- } else if ( fspectrum < 2 ) {
- return "#AAAAAA";
- } else if ( fspectrum < 5 ) {
- return "#999999";
- } else if ( fspectrum < 10 ) {
- return "#888888";
- } else if ( fspectrum < 20 ) {
- return "#777777";
- } else if ( fspectrum < 30 ) {
- return "#666666";
- } else if ( fspectrum < 40 ) {
- return "#555555";
- } else if ( fspectrum < 50 ) {
- return "#444444";
- } else if ( fspectrum < 60 ) {
- return "#333333";
- } else if ( fspectrum < 80 ) {
- return "#222222";
- } else if ( fspectrum < 100 ) {
- return "#111111";
- } else {
- return "#000000";
- }
-}
-
-static char* phasogram_get_fill_color( t_int phase )
-{
- if ( phase < 0 )
- {
- if ( phase > -10 ) {
- return "#111111";
- } else if ( phase > -20 ) {
- return "#222222";
- } else if ( phase > -30 ) {
- return "#333333";
- } else if ( phase > -40 ) {
- return "#444444";
- } else if ( phase > -50 ) {
- return "#555555";
- } else if ( phase > -60 ) {
- return "#666666";
- } else if ( phase > -70 ) {
- return "#777777";
- } else if ( phase > -80 ) {
- return "#888888";
- } else {
- return "#999999";
- }
- }
- else
- {
- if ( phase == 0 ) {
- return "#FFFFFF";
- } else if ( phase < 10 ) {
- return "#111111";
- } else if ( phase < 20 ) {
- return "#222222";
- } else if ( phase < 30 ) {
- return "#333333";
- } else if ( phase < 40 ) {
- return "#444444";
- } else if ( phase < 50 ) {
- return "#555555";
- } else if ( phase < 60 ) {
- return "#666666";
- } else if ( phase < 70 ) {
- return "#777777";
- } else if ( phase < 80 ) {
- return "#888888";
- } else {
- return "#999999";
- }
- }
- // normally never reached
- return "";
-}
-
-static void sonogram_update_point(t_sonogram *x, t_glist *glist, t_int sample, t_int frequency)
-{
- t_canvas *canvas=glist_getcanvas(glist);
- t_float fspectrum=0.0;
- t_int phase=0.0;
- char newColor[ 8 ], olColor[8];
- int i;
-
- post("sonogram~ : joge : updating a point");
-
- fspectrum =
- sqrt( pow( *(x->x_rdata+sample*x->x_blocksize+frequency), 2) +
- pow( *(x->x_idata+sample*x->x_blocksize+frequency), 2) );
- phase = (int) ( atan2( *(x->x_idata+(sample*x->x_blocksize)+frequency),
- *(x->x_rdata+(sample*x->x_blocksize)+frequency) )*180/M_PI );
- if ( x->x_empty && ( fspectrum != 0 ))
- {
- x->x_empty = 0;
- }
- strcpy( newColor, sonogram_get_fill_color( fspectrum ) );
-
- for ( i=0; i<x->x_zoom; i++ )
- {
- sprintf( x->x_gifdata, "%s", strcat( newColor, " ") );
- }
- for ( i=0; i<x->x_zoom; i++ )
- {
- SYS_VGUI5("SONIMAGE%x put {%s} -to %d %d\n", x, x->x_gifdata,
- sample*x->x_zoom+i, (x->x_blocksize/2-frequency)*x->x_zoom );
- }
-
- if ( x->x_phaso )
- {
- strcpy( newColor, phasogram_get_fill_color( phase ) );
- strcpy( x->x_gifdata, "" );
- for ( i=0; i<x->x_zoom; i++ )
- {
- sprintf( x->x_gifdata, "%s", strcat( newColor, " ") );
- }
- for ( i=0; i<x->x_zoom; i++ )
- {
- SYS_VGUI5("FAZIMAGE%x put {%s} -to %d %d\n", x, x->x_gifdata,
- sample*x->x_zoom+i, (x->x_blocksize/2-frequency)*x->x_zoom );
- }
- }
-
- x->x_nbupdated++;
-}
-
-static void sonogram_update_block(t_sonogram *x, t_glist *glist, t_int bnumber)
-{
- t_int fi, i=0;
- t_float fspectrum=0.0;
- t_int phase=0;
- char color[8];
-
- // update sonogram
- for ( fi=x->x_blocksize/2-1; fi>=0; fi-- )
- {
- fspectrum =
- sqrt( pow( *(x->x_rdata+bnumber*x->x_blocksize+fi), 2) +
- pow( *(x->x_idata+bnumber*x->x_blocksize+fi), 2) );
- strcpy( color, sonogram_get_fill_color( fspectrum ) );
- for ( i=0; i<x->x_zoom; i++ )
- {
- strncpy( x->x_gifdata+((x->x_blocksize/2-fi-1)*x->x_zoom+i)*8, strcat( color, " "), 8 );
- }
- }
- for ( i=0; i<x->x_zoom; i++ )
- {
- sprintf( x->x_guicommand, "SONIMAGE%x put {%s} -to %d 0\n", (unsigned int)x, x->x_gifdata, (bnumber*x->x_zoom)+i );
- sys_gui( x->x_guicommand );
- }
-
- // update phasogram
- if ( x->x_phaso )
- {
- strcpy( x->x_gifdata, "" );
- for ( fi=x->x_blocksize/2-1; fi>=0; fi-- )
- {
- phase = (int) ( atan2( *(x->x_idata+bnumber*x->x_blocksize+fi),
- *(x->x_rdata+bnumber*x->x_blocksize+fi) )*180/M_PI );
- strcpy( color, phasogram_get_fill_color( phase ) );
- for ( i=0; i<x->x_zoom; i++ )
- {
- strncpy( x->x_gifdata+((x->x_blocksize/2-fi-1)*x->x_zoom+i)*8, strcat( color, " "), 8 );
- }
- }
- for ( i=0; i<x->x_zoom; i++ )
- {
- sprintf( x->x_guicommand, "FAZIMAGE%x put {%s} -to %d 0\n", (unsigned int)x, x->x_gifdata, (bnumber*x->x_zoom)+i );
- sys_gui( x->x_guicommand );
- }
- }
-
- post("sonogram~ : joge in update_block : update phasogram");
-
-}
-
-static void sonogram_erase_block(t_sonogram *x, t_glist *glist, t_int bnumber )
-{
- t_canvas *canvas=glist_getcanvas(glist);
- t_int fi;
- t_float fspectrum=0.0;
- char fillColor[ 16 ];
-
- for ( fi=0; fi<x->x_blocksize/2; fi++)
- {
- {
- int i;
-
- for ( i=0; i<x->x_zoom; i++ )
- {
- strcpy( x->x_gifdata+i*sizeof("#FFFFFF "), "#FFFFFF " );
- }
- SYS_VGUI5("SONIMAGE%x put {%s} -to %d %d\n", x, x->x_gifdata,
- bnumber*x->x_zoom, (x->x_blocksize/2-fi)*x->x_zoom );
- }
- }
-}
-
-static void *sonogram_do_update_part(void *tdata)
-{
- t_sonogram *x = (t_sonogram*) tdata;
- t_int si;
- t_int nbpoints = 0;
- t_float percentage = 0, opercentage = 0;
-
- // loose synchro
-#ifdef NT
- // usleep's argument is in microseconds while
- // Sleep's argument is in miliseconds therefore
- // need a convertion from micro to mili
- Sleep( THREAD_SLEEP_TIME / 1000 );
-
- // OR jsut use the pd defined sleep function
- //sys_microsleep(THREAD_SLEEP_TIME / 1000);
-#else
- usleep( THREAD_SLEEP_TIME );
-#endif
-
- // check boundaries
- if ( x->x_updateend > x->x_size-1 ) x->x_updateend = x->x_size-1;
- if ( x->x_updatestart < 0 ) x->x_updatestart = 0;
-
- post("sonogram~ : ok, let's go [updating %d, %d]", x->x_updatestart, x->x_updateend );
-
- if ( x->x_erase )
- {
- for ( si=x->x_updatestart; si<=x->x_updateend; si++ )
- {
- sonogram_erase_block(x, x->x_glist, si);
- nbpoints++;
- percentage = (nbpoints*100/(x->x_updateend-x->x_updatestart+1));
- if ( (percentage == (int) percentage) && ((int)percentage%5 == 0) && ( percentage != opercentage ) )
- {
- // post( "sonogram~ : erase part : %d %% completed", (int)percentage );
- opercentage = percentage;
- }
- }
- }
-
- percentage = opercentage = nbpoints = 0;
-
- if ( x->x_redraw )
- {
- for ( si=x->x_updatestart; si<=x->x_updateend; si++ )
- {
- sonogram_update_block(x, x->x_glist, si);
-
- // post("sonogram~ : joge check point : after sonogram_update_block");
-
- nbpoints++;
- percentage = (nbpoints*100/(x->x_updateend-x->x_updatestart+1));
-
- post("sonogram~ : joge : percentage=%d completed", (int)percentage);
-
- if ( (percentage == (int) percentage) && ((int)percentage%5 == 0) && ( percentage != opercentage ) )
- {
- post( "sonogram~ : update part : %d %% completed", (int)percentage );
- opercentage = percentage;
- }
- }
- }
-
- // set borders in black
- SYS_VGUI3(".x%x.c itemconfigure %xSONOGRAM -outline #000000\n", glist_getcanvas(x->x_glist), x);
- if ( x->x_phaso )
- {
- SYS_VGUI3(".x%x.c itemconfigure %xPHASOGRAM -outline #000000\n", glist_getcanvas(x->x_glist), x);
- }
-
- post("sonogram~ : child thread %d ended (nb_updated=%d)", (int)x->x_updatechild, x->x_nbupdated );
- x->x_updatechild = 0;
- return NULL;
-}
-
-static void sonogram_update_part(t_sonogram *x, t_glist *glist, t_int bstart, t_int bend,
- t_int erase, t_int redraw, t_int keepframe)
-{
- pthread_attr_t update_child_attr;
-
- if ( x->x_graphic )
- {
- if ( x->x_updatechild != 0 )
- {
- post( "sonogram~ : error : no update is possible for now" );
- return;
- }
- x->x_updatestart = bstart;
- x->x_updateend = bend;
- if ( !keepframe )
- {
- x->x_erase = 0;
- }
- else
- {
- x->x_erase = erase;
- }
- x->x_redraw = redraw;
- x->x_nbupdated = 0;
- // recreate the square if needed
- if ( ( bstart == 0 ) && ( bend == x->x_size-1 ) && !keepframe )
- {
- SYS_VGUI3(".x%x.c delete %xSONOGRAM\n", glist_getcanvas(glist), x );
- SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill #FFFFFF -tags %xSONOGRAM\n",
- glist_getcanvas(glist), x->x_xpos-1, x->x_ypos-1,
- x->x_xpos + x->x_size*x->x_zoom+1,
- x->x_ypos + x->x_blocksize/2*x->x_zoom+1,
- x);
- SYS_VGUI2("image delete SONIMAGE%x\n", x );
- SYS_VGUI3(".x%x.c delete ISONIMAGE%x\n", glist_getcanvas(glist), x );
- SYS_VGUI4("image create photo SONIMAGE%x -format gif -width %d -height %d\n",
- x, x->x_size*x->x_zoom, x->x_blocksize/2*x->x_zoom );
- SYS_VGUI2("SONIMAGE%x blank\n", x);
- SYS_VGUI6(".x%x.c create image %d %d -image SONIMAGE%x -tags ISONIMAGE%x\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+((x->x_size*x->x_zoom)/2),
- (x->x_ypos+((x->x_blocksize/2*x->x_zoom)/2)), x, x );
- if ( x->x_phaso )
- {
- SYS_VGUI3(".x%x.c delete %xPHASOGRAM\n", glist_getcanvas(glist), x );
- SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill #FFFFFF -tags %xPHASOGRAM\n",
- glist_getcanvas(glist), x->x_xpos-1, x->x_ypos+x->x_blocksize/2*x->x_zoom+2,
- x->x_xpos + x->x_size*x->x_zoom +1,
- x->x_ypos + x->x_blocksize*x->x_zoom + 3,
- x);
- SYS_VGUI2("image delete FAZIMAGE%x\n", x );
- SYS_VGUI3(".x%x.c delete IFAZIMAGE%x\n", glist_getcanvas(glist), x );
- SYS_VGUI4("image create photo FAZIMAGE%x -format gif -width %d -height %d\n",
- x, x->x_size*x->x_zoom, x->x_blocksize/2*x->x_zoom );
- SYS_VGUI2("FAZIMAGE%x blank\n", x);
- SYS_VGUI6(".x%x.c create image %d %d -image FAZIMAGE%x -tags IFAZIMAGE%x\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+((x->x_size*x->x_zoom)/2),
- x->x_ypos+3*((x->x_blocksize/2*x->x_zoom)/2)+2, x, x );
- }
- canvas_fixlinesfor(x->x_glist, (t_text*)x );
- }
- // set borders in red
- SYS_VGUI3(".x%x.c itemconfigure %xSONOGRAM -outline #FF0000\n", glist_getcanvas(glist), x);
- if ( x->x_phaso )
- {
- SYS_VGUI3(".x%x.c itemconfigure %xPHASOGRAM -outline #FF0000\n", glist_getcanvas(glist), x);
- }
-
- // launch update thread
- if ( pthread_attr_init( &update_child_attr ) < 0 ) {
- post( "sonogram~ : could not launch update thread" );
- perror( "pthread_attr_init" );
- return;
- }
- if ( pthread_attr_setdetachstate( &update_child_attr, PTHREAD_CREATE_DETACHED ) < 0 ) {
- post( "sonogram~ : could not launch update thread" );
- perror( "pthread_attr_setdetachstate" );
- return;
- }
- if ( pthread_create( &x->x_updatechild, &update_child_attr, sonogram_do_update_part, x ) < 0 ) {
- post( "sonogram~ : could not launch update thread" );
- perror( "pthread_create" );
- return;
- }
- else
- {
- post( "sonogram~ : drawing thread %d launched", (int)x->x_updatechild );
- }
- }
-}
-
- /* paste selection at the drawing point */
-static void sonogram_paste( t_sonogram* x)
-{
- t_int pxstart = (x->x_xdraw-x->x_xpos)/x->x_zoom;
- t_int pystart = (x->x_ypos-x->x_ydraw)/x->x_zoom+x->x_blocksize/2;
- t_int cxs,cxe,cys,cye,si=0,fi=0;
- t_float *icopy;
- t_float *rcopy;
- t_int copynd;
-
- if ( x->x_xstartcapture > x->x_xendcapture ) {
- fi = x->x_xstartcapture;
- x->x_xstartcapture = x->x_xendcapture;
- x->x_xendcapture = fi;
- }
- if ( x->x_ystartcapture > x->x_yendcapture ) {
- fi = x->x_ystartcapture;
- x->x_ystartcapture = x->x_yendcapture;
- x->x_yendcapture = fi;
- }
- cxs=(x->x_xstartcapture-x->x_xpos)/x->x_zoom;
- cxe=(x->x_xendcapture-x->x_xpos)/x->x_zoom;
- cys=(x->x_ypos-x->x_yendcapture)/x->x_zoom+x->x_blocksize/2;
- cye=(x->x_ypos-x->x_ystartcapture)/x->x_zoom+x->x_blocksize/2;
- if ( cye < 0 ) cye=0;
- if ( cys < 0 ) cys=0;
- if ( cye >= x->x_blocksize/2 ) cye=x->x_blocksize/2-1;
- if ( cys >= x->x_blocksize/2 ) cys=x->x_blocksize/2-1;
- if ( cxe >= x->x_size ) cxe=x->x_size-1;
- if ( cxs >= x->x_size ) cxs=x->x_size-1;
-
- // make a copy first
- icopy = ( t_float* ) getbytes( ( cxe-cxs+1 )*( cye-cys+1 )*sizeof( t_float ) );
- rcopy = ( t_float* ) getbytes( ( cxe-cxs+1 )*( cye-cys+1 )*sizeof( t_float ) );
- if ( !icopy || !rcopy )
- {
- post( "sonogram~ : cannot allocate buffers for pasting" );
- return;
- }
- // copy initial data
- copynd = 0;
- for ( si=cxs; si<=cxe; si++) {
- for ( fi=cys; fi<=cye; fi++) {
- *(rcopy+copynd) = *(x->x_rdata+(si)*x->x_blocksize+fi);
- *(icopy+copynd) = *(x->x_idata+(si)*x->x_blocksize+fi);
- copynd++;
- }
- }
-
- post( "sonogram~ : paste from [%d,%d,%d,%d] to [%d,%d]", cxs, cys, cxe, cye, pxstart, pystart );
-
- for ( si=cxs; si<=cxe; si++) {
- if ( pxstart+si-cxs >= x->x_size ) break;
- copynd = (si-cxs)*(cye-cys+1);
- for ( fi=cys; fi<=cye; fi++) {
- // post ( "sonogram~ : si : %d : fi : %d : copynd : %d", si, fi, copynd );
- if ( pystart+fi-cys >= x->x_blocksize/2 ) break;
- *(x->x_rudata+((si-cxs)*x->x_blocksize)+(fi-cys)) = *(x->x_rdata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys));
- *(x->x_iudata+((si-cxs)*x->x_blocksize)+(fi-cys)) = *(x->x_idata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys));
- if ( x->x_enhancemode )
- {
- // save data for undo
- *(x->x_rdata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys)) += *(rcopy+copynd);
- *(x->x_idata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys)) += *(icopy+copynd);
- }
- else
- {
- *(x->x_rdata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys)) = *(rcopy+copynd);
- *(x->x_idata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys)) = *(icopy+copynd);
- }
- copynd++;
- }
- }
-
- x->x_uxs = pxstart;
- x->x_uxe = pxstart+(si-1)-cxs;
- x->x_uys = pystart;
- x->x_uye = pystart+(fi-1)-cys;;
-
- freebytes( rcopy, ( cxe-cxs+1 )*( cye-cys+1 )*sizeof( t_float ) );
- freebytes( icopy, ( cxe-cxs+1 )*( cye-cys+1 )*sizeof( t_float ) );
-}
-
- /* paste phase at the drawing point */
-static void sonogram_paste_phase( t_sonogram* x)
-{
- t_int pxstart = (x->x_xdraw-x->x_xpos)/x->x_zoom;
- t_int pystart = (x->x_ypos+x->x_blocksize/2*x->x_zoom+1-x->x_ydraw)/x->x_zoom+x->x_blocksize/2;
- t_int cxs,cxe,cys,cye,si,fi;
- t_float fspectrum, fdestspectrum;
- t_float fphase, fdestphase;
- t_float *icopy;
- t_float *rcopy;
- t_int copynd;
-
- if ( x->x_xstartcapture > x->x_xendcapture ) {
- fi = x->x_xstartcapture;
- x->x_xstartcapture = x->x_xendcapture;
- x->x_xendcapture = fi;
- }
- if ( x->x_ystartcapture > x->x_yendcapture ) {
- fi = x->x_ystartcapture;
- x->x_ystartcapture = x->x_yendcapture;
- x->x_yendcapture = fi;
- }
- cxs=(x->x_xstartcapture-x->x_xpos)/x->x_zoom;
- cxe=(x->x_xendcapture-x->x_xpos)/x->x_zoom;
- cys=(x->x_ypos+x->x_blocksize/2*x->x_zoom+1-x->x_yendcapture)/x->x_zoom+x->x_blocksize/2;
- cye=(x->x_ypos+x->x_blocksize/2*x->x_zoom+1-x->x_ystartcapture)/x->x_zoom+x->x_blocksize/2;
- if ( cye < 0 ) cye=0;
- if ( cys < 0 ) cys=0;
- if ( cye >= x->x_blocksize/2 ) cye=x->x_blocksize/2-1;
- if ( cys >= x->x_blocksize/2 ) cys=x->x_blocksize/2-1;
- if ( cxe >= x->x_size ) cxe=x->x_size-1;
- if ( cxs >= x->x_size ) cxs=x->x_size-1;
-
- // make a copy first
- icopy = ( t_float* ) getbytes( ( cxe-cxs+1 )*( cye-cys+1 )*sizeof( t_float ) );
- rcopy = ( t_float* ) getbytes( ( cxe-cxs+1 )*( cye-cys+1 )*sizeof( t_float ) );
- if ( !icopy || !rcopy )
- {
- post( "sonogram~ : cannot allocate buffers for pasting" );
- return;
- }
- // copy initial data
- copynd = 0;
- for ( si=cxs; si<=cxe; si++) {
- for ( fi=cys; fi<=cye; fi++) {
- *(rcopy+copynd) = *(x->x_rdata+(si)*x->x_blocksize+fi);
- *(icopy+copynd) = *(x->x_idata+(si)*x->x_blocksize+fi);
- copynd++;
- }
- }
-
- post( "sonogram~ : paste phase from [%d,%d,%d,%d] to [%d,%d]", cxs, cys, cxe, cye, pxstart, pystart );
-
- for ( si=cxs; si<=cxe; si++) {
- if ( pxstart+si-cxs >= x->x_size ) break;
- copynd = (si-cxs)*(cye-cys+1);
- for ( fi=cys; fi<=cye; fi++) {
- if ( pystart+fi-cys > x->x_blocksize+1 ) break;
- fphase = atan2( *(icopy+copynd), *(rcopy+copynd) );
- fdestspectrum =
- sqrt( pow( *(x->x_rdata+(pxstart+si-cxs)*x->x_blocksize+(pystart+fi-cys)), 2) +
- pow( *(x->x_idata+(pxstart+si-cxs)*x->x_blocksize+(pystart+fi-cys)), 2) );
- fdestphase = atan2( *(x->x_idata+(pxstart+si-cxs)*x->x_blocksize+(pystart+fi-cys)),
- *(x->x_rdata+(pxstart+si-cxs)*x->x_blocksize+(pystart+fi-cys)) );
- if ( x->x_enhancemode )
- {
- *(x->x_rdata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys)) +=
- fdestspectrum*cos( fdestphase + fphase );
- *(x->x_idata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys)) +=
- fdestspectrum*sin( fdestphase + fphase );
- }
- else
- {
- *(x->x_rdata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys)) =
- fdestspectrum*cos( fphase );
- *(x->x_idata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys)) =
- fdestspectrum*sin( fphase );
- }
- copynd++;
- }
- }
-
- freebytes( rcopy, ( cxe-cxs+1 )*( cye-cys+1 )*sizeof( t_float ) );
- freebytes( icopy, ( cxe-cxs+1 )*( cye-cys+1 )*sizeof( t_float ) );
-
- sonogram_update_part(x, x->x_glist, pxstart, pxstart+(si-1)-cxs, 0, 1, 1);
- // start a new capture
- SYS_VGUI3( ".x%x.c delete %xCAPTURE\n", glist_getcanvas( x->x_glist ), x );
- x->x_xstartcapture = x->x_xdraw;
- x->x_ystartcapture = x->x_ydraw;
- x->x_xendcapture = x->x_xdraw;
- x->x_yendcapture = x->x_ydraw;
-
-}
-
-static void sonogram_draw_new(t_sonogram *x, t_glist *glist)
-{
- t_canvas *canvas=glist_getcanvas(glist);
-
- if ( x->x_xpos == -1 )
- {
- x->x_xpos=x->x_obj.te_xpix;
- x->x_ypos=x->x_obj.te_ypix;
- }
- if ( x->x_graphic )
- {
- SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill #FFFFFF -tags %xSONOGRAM\n",
- canvas, x->x_xpos-1, x->x_ypos-1,
- x->x_xpos + x->x_size*x->x_zoom+1,
- x->x_ypos + x->x_blocksize/2*x->x_zoom+1,
- x);
- SYS_VGUI4("image create photo SONIMAGE%x -format gif -width %d -height %d\n",
- x, x->x_size*x->x_zoom, x->x_blocksize/2*x->x_zoom );
- SYS_VGUI2("SONIMAGE%x blank\n", x);
- SYS_VGUI6(".x%x.c create image %d %d -image SONIMAGE%x -tags ISONIMAGE%x\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+((x->x_size*x->x_zoom)/2),
- (x->x_ypos+((x->x_blocksize/2*x->x_zoom)/2)), x, x );
- if ( x->x_phaso )
- {
- SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill #FFFFFF -tags %xPHASOGRAM\n",
- glist_getcanvas(glist), x->x_xpos-1, x->x_ypos+x->x_blocksize/2*x->x_zoom+2,
- x->x_xpos + x->x_size*x->x_zoom +1,
- x->x_ypos + x->x_blocksize*x->x_zoom + 3,
- x);
- SYS_VGUI4("image create photo FAZIMAGE%x -format gif -width %d -height %d\n",
- x, x->x_size*x->x_zoom, x->x_blocksize/2*x->x_zoom );
- SYS_VGUI2("FAZIMAGE%x blank\n", x);
- SYS_VGUI6(".x%x.c create image %d %d -image FAZIMAGE%x -tags IFAZIMAGE%x\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+((x->x_size*x->x_zoom)/2),
- x->x_ypos+3*((x->x_blocksize/2*x->x_zoom)/2)+2, x, x );
- }
- canvas_fixlinesfor( canvas, (t_text*)x );
- }
-}
-
-static void sonogram_draw_delete(t_sonogram *x, t_glist *glist)
-{
- if ( x->x_graphic && glist_isvisible( glist ) )
- {
- SYS_VGUI3( ".x%x.c delete %xCAPTURE\n", glist_getcanvas( glist ), x );
- SYS_VGUI3( ".x%x.c delete line %xREADSTART\n", glist_getcanvas( glist ), x);
- SYS_VGUI3( ".x%x.c delete line %xREADEND\n", glist_getcanvas( glist ), x);
- SYS_VGUI3( ".x%x.c delete line %xMODSTART\n", glist_getcanvas( glist ), x);
- SYS_VGUI3( ".x%x.c delete line %xMODEND\n", glist_getcanvas( glist ), x);
- SYS_VGUI3(".x%x.c delete %xSONOGRAM\n", glist_getcanvas( glist ), x );
- SYS_VGUI3(".x%x.c delete %xPHASOGRAM\n", glist_getcanvas( glist ), x );
- SYS_VGUI3(".x%x.c delete %xISONIMAGE\n", glist_getcanvas( glist ), x );
- SYS_VGUI2("image delete SONIMAGE%x\n", x );
- if ( x->x_phaso )
- {
- SYS_VGUI3(".x%x.c delete %xIFAZIMAGE\n", glist_getcanvas( glist ), x );
- SYS_VGUI2("image delete FAZIMAGE%x\n", x );
- }
- }
-}
-
-static void sonogram_draw_move(t_sonogram *x, t_glist *glist)
-{
- t_canvas *canvas=glist_getcanvas(glist);
-
- if ( x->x_graphic && glist_isvisible( x->x_glist ) )
- {
- SYS_VGUI7(".x%x.c coords %xSONOGRAM %d %d %d %d\n",
- canvas, x,
- x->x_xpos-1, x->x_ypos-1,
- x->x_xpos+x->x_size*x->x_zoom+1,
- x->x_ypos+x->x_blocksize/2*x->x_zoom+1);
- SYS_VGUI5(".x%x.c coords ISONIMAGE%x %d %d\n",
- canvas, x,
- x->x_xpos+((x->x_size*x->x_zoom)/2),
- (x->x_ypos+((x->x_blocksize/2*x->x_zoom)/2)) );
- if ( x->x_phaso )
- {
- SYS_VGUI7(".x%x.c coords %xPHASOGRAM %d %d %d %d\n",
- canvas, x,
- x->x_xpos-1, x->x_ypos+(x->x_blocksize/2*x->x_zoom)+1,
- x->x_xpos+x->x_size*x->x_zoom+1,
- x->x_ypos+x->x_blocksize*x->x_zoom+3);
- SYS_VGUI5(".x%x.c coords IFAZIMAGE%x %d %d\n",
- canvas, x,
- x->x_xpos+((x->x_size*x->x_zoom)/2),
- x->x_ypos+3*((x->x_blocksize/2*x->x_zoom)/2)+2 );
- }
- canvas_fixlinesfor( canvas, (t_text*)x );
- }
-}
-
-static void sonogram_draw_select(t_sonogram* x,t_glist* glist)
-{
- t_canvas *canvas=glist_getcanvas(glist);
-
- if ( x->x_graphic && glist_isvisible( x->x_glist ) )
- {
- if(x->x_selected)
- {
- /* sets the item in blue */
- SYS_VGUI3(".x%x.c itemconfigure %xSONOGRAM -outline #0000FF\n", canvas, x);
- if ( x->x_phaso )
- {
- SYS_VGUI3(".x%x.c itemconfigure %xPHASOGRAM -outline #0000FF\n", canvas, x);
- }
- }
- else
- {
- SYS_VGUI3(".x%x.c itemconfigure %xSONOGRAM -outline #000000\n", canvas, x);
- if ( x->x_phaso )
- {
- SYS_VGUI3(".x%x.c itemconfigure %xPHASOGRAM -outline #000000\n", canvas, x);
- }
- }
- }
-}
-
-/* ------------------------ widget callbacks ----------------------------- */
-
-
-static void sonogram_getrect(t_gobj *z, t_glist *owner,
- int *xp1, int *yp1, int *xp2, int *yp2)
-{
- t_sonogram* x = (t_sonogram*)z;
-
- *xp1 = x->x_xpos;
- *yp1 = x->x_ypos;
- if ( !x->x_phaso )
- {
- *xp2 = x->x_xpos+x->x_size*x->x_zoom;
- *yp2 = x->x_ypos+x->x_blocksize/2*x->x_zoom+1;
- }
- else
- {
- *xp2 = x->x_xpos+x->x_size*x->x_zoom;
- *yp2 = x->x_ypos+x->x_blocksize*x->x_zoom+3;
- }
-}
-
-static void sonogram_save(t_gobj *z, t_binbuf *b)
-{
- t_sonogram *x = (t_sonogram *)z;
-
- binbuf_addv(b, "ssiisiii", gensym("#X"),gensym("obj"),
- (t_int)x->x_xpos, (t_int)x->x_ypos,
- atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)),
- x->x_size, x->x_graphic, x->x_phaso );
- binbuf_addv(b, ";");
-}
-
-static void sonogram_select(t_gobj *z, t_glist *glist, int selected)
-{
- t_sonogram *x = (t_sonogram *)z;
-
- x->x_selected = selected;
- sonogram_draw_select( x, glist );
-}
-
-static void sonogram_vis(t_gobj *z, t_glist *glist, int vis)
-{
- t_sonogram *x = (t_sonogram *)z;
- t_rtext *y;
-
- if (vis)
- {
- sonogram_draw_new( x, glist );
- }
- else
- {
- // erase all points
- sonogram_draw_delete( x, glist );
- }
-}
-
-static void sonogram_delete(t_gobj *z, t_glist *glist)
-{
- canvas_deletelinesfor(glist, (t_text *)z);
-}
-
-static void sonogram_displace(t_gobj *z, t_glist *glist, int dx, int dy)
-{
- t_sonogram *x = (t_sonogram *)z;
- int xold = x->x_xpos;
- int yold = x->x_ypos;
-
- x->x_xpos += dx;
- x->x_ypos += dy;
-
- if ( ( x->x_xpos != xold ) || ( x->x_ypos != yold ) )
- {
- sonogram_draw_move( x, glist );
- }
-
-}
-
-static void sonogram_modify_point( t_sonogram* x, t_int sample, t_int frequency, t_int alted )
-{
- if ( alted )
- {
- *(x->x_rdata+(sample*x->x_blocksize)+frequency) = 0;
- *(x->x_idata+(sample*x->x_blocksize)+frequency) = 0;
- }
- else
- {
- if ( x->x_enhancemode )
- {
- *(x->x_rdata+(sample*x->x_blocksize)+frequency) *= x->x_modstep;
- *(x->x_idata+(sample*x->x_blocksize)+frequency) *= x->x_modstep;
- }
- else
- {
- *(x->x_rdata+(sample*x->x_blocksize)+frequency) += x->x_modstep;
- *(x->x_idata+(sample*x->x_blocksize)+frequency) += x->x_modstep;
- }
- }
-}
-
-static void sonogram_modify_point_phase( t_sonogram* x, t_int sample, t_int frequency, t_int alted )
-{
- t_float fspectrum;
- t_float fphase;
-
- fspectrum =
- sqrt( pow( *(x->x_rdata+sample*x->x_blocksize+frequency), 2) +
- pow( *(x->x_idata+sample*x->x_blocksize+frequency), 2) );
- fphase = atan2( *(x->x_idata+sample*x->x_blocksize+frequency),
- *(x->x_rdata+sample*x->x_blocksize+frequency) );
- if ( alted==4 )
- {
- // setting phase to 0
- *(x->x_rdata+(sample*x->x_blocksize)+frequency) = fspectrum;
- *(x->x_idata+(sample*x->x_blocksize)+frequency) = 0;
- }
- else
- {
- if ( x->x_enhancemode )
- {
- *(x->x_rdata+(sample*x->x_blocksize)+frequency) = fspectrum*cos( fphase*x->x_modstep );
- *(x->x_idata+(sample*x->x_blocksize)+frequency) = fspectrum*sin( fphase*x->x_modstep );
- }
- else
- {
- *(x->x_rdata+(sample*x->x_blocksize)+frequency) = fspectrum*cos( fphase+x->x_modstep );
- *(x->x_idata+(sample*x->x_blocksize)+frequency) = fspectrum*sin( fphase+x->x_modstep );
- }
- }
-}
-
-static void sonogram_motion(t_sonogram *x, t_floatarg dx, t_floatarg dy)
-{
- int fdraw=0, sdraw=0;
-
- // post( "sonogram_motion @ [%d,%d] dx=%f dy=%f alt=%d", x->x_xdraw, x->x_ydraw, dx, dy, x->x_alted );
- if ( ( x->x_shifted || (x->x_alted==4) ) )
- {
- if ( (x->x_xdraw+dx) >= x->x_xpos &&
- (x->x_xdraw+dx) <= x->x_xpos+x->x_size*x->x_zoom ) {
- x->x_xdraw += dx;
- }
- if ( (x->x_ydraw+dy) >= x->x_ypos &&
- (x->x_ydraw+dy) <= x->x_ypos+x->x_blocksize*x->x_zoom ) {
- x->x_ydraw += dy;
- }
- sdraw=(x->x_xdraw-x->x_xpos)/x->x_zoom;
- if ( x->x_ydraw <= x->x_ypos+x->x_blocksize/2*x->x_zoom )
- {
- fdraw=(x->x_ypos-x->x_ydraw)/x->x_zoom+x->x_blocksize/2;
- // post( "modify point @ [%d, %d] alted=%d", sdraw, fdraw, x->x_alted );
- sonogram_modify_point( x, sdraw, fdraw, x->x_alted );
- }
- if ( x->x_ydraw >= x->x_ypos+x->x_blocksize/2*x->x_zoom+1 )
- {
- fdraw=(x->x_ypos+x->x_blocksize*x->x_zoom/2+1-x->x_ydraw)/x->x_zoom+x->x_blocksize/2;
- // post( "modify phase @ [%d, %d]", sdraw, fdraw );
- sonogram_modify_point_phase( x, sdraw, fdraw, x->x_alted );
- }
- sonogram_update_point( x, x->x_glist, sdraw, fdraw );
- }
- else
- {
- if ( (x->x_xendcapture+dx) >= x->x_xpos &&
- (x->x_xendcapture+dx) <= x->x_xpos+x->x_size*x->x_zoom ) {
- x->x_xendcapture += dx;
- }
- if ( (x->x_yendcapture+dy) >= x->x_ypos &&
- (x->x_yendcapture+dy) <= x->x_ypos+x->x_blocksize*x->x_zoom ) {
- x->x_yendcapture += dy;
- }
- SYS_VGUI3( ".x%x.c delete %xCAPTURE\n", glist_getcanvas( x->x_glist ), x );
- SYS_VGUI7( ".x%x.c create rectangle %d %d %d %d -outline #0000FF -tags %xCAPTURE\n",
- glist_getcanvas( x->x_glist ), x->x_xstartcapture,
- x->x_ystartcapture, x->x_xendcapture, x->x_yendcapture, x );
- }
-}
-
-static int sonogram_click(t_gobj *z, struct _glist *glist,
- int xpix, int ypix, int shift, int alt, int dbl, int doit)
-{
- t_sonogram* x = (t_sonogram *)z;
- int si,fi;
-
- // post( "sonogram_click : x=%d y=%d doit=%d alt=%d, shift=%d", xpix, ypix, doit, alt, shift );
- if ( x->x_aftermousedown == 1 && doit == 0)
- {
- x->x_aftermousedown = 1;
- }
- else
- {
- x->x_aftermousedown = 0;
- }
- if ( doit )
- {
- x->x_xdraw = xpix;
- x->x_ydraw = ypix;
- x->x_shifted = shift;
- x->x_alted = alt;
- // activate motion callback
- glist_grab( glist, &x->x_obj.te_g, (t_glistmotionfn)sonogram_motion,
- 0, xpix, ypix );
-
- if ( shift && alt && (x->x_xstartcapture != x->x_xendcapture ) )
- {
- sonogram_paste(x);
- sonogram_paste_phase(x);
- }
- else if ( shift && (x->x_xstartcapture != x->x_xendcapture ) )
- {
- // add or multiply modstep
- if ( x->x_xstartcapture > x->x_xendcapture ) {
- fi = x->x_xstartcapture;
- x->x_xstartcapture = x->x_xendcapture;
- x->x_xendcapture = fi;
- }
- if ( x->x_ystartcapture > x->x_yendcapture ) {
- fi = x->x_ystartcapture;
- x->x_ystartcapture = x->x_yendcapture;
- x->x_yendcapture = fi;
- }
- for ( si=(x->x_xstartcapture-x->x_xpos)/x->x_zoom;
- si<=(x->x_xendcapture-x->x_xpos)/x->x_zoom; si++) {
- for ( fi=(x->x_ypos-x->x_yendcapture)/x->x_zoom+x->x_blocksize/2;
- fi<=(x->x_ypos-x->x_ystartcapture)/x->x_zoom+x->x_blocksize/2; fi++) {
- sonogram_modify_point( x, si, fi, alt );
- }
- for ( fi=(x->x_ypos+x->x_blocksize/2*x->x_zoom+1-x->x_yendcapture)/x->x_zoom+x->x_blocksize/2;
- fi<=(x->x_ypos+x->x_blocksize/2*x->x_zoom+1-x->x_ystartcapture)/x->x_zoom+x->x_blocksize/2; fi++) {
- sonogram_modify_point_phase( x, si, fi, alt );
- }
- }
- // post( "modified y from %d to %d", (x->x_ypos-x->x_yendcapture)/x->x_zoom+x->x_blocksize/2,
- // (x->x_ypos-x->x_ystartcapture)/x->x_zoom+x->x_blocksize/2 );
- sonogram_update_part(x, x->x_glist, (x->x_xstartcapture-x->x_xpos)/x->x_zoom,
- (x->x_xendcapture-x->x_xpos)/x->x_zoom, 0, 1, 1);
- }
- else if ( (alt==4) && (x->x_xstartcapture != x->x_xendcapture ) )
- {
- // clean up area
- if ( x->x_xstartcapture > x->x_xendcapture ) {
- fi = x->x_xstartcapture;
- x->x_xstartcapture = x->x_xendcapture;
- x->x_xendcapture = fi;
- }
- if ( x->x_ystartcapture > x->x_yendcapture ) {
- fi = x->x_ystartcapture;
- x->x_ystartcapture = x->x_yendcapture;
- x->x_yendcapture = fi;
- }
- for ( si=(x->x_xstartcapture-x->x_xpos)/x->x_zoom;
- si<=(x->x_xendcapture-x->x_xpos)/x->x_zoom; si++) {
- for ( fi=(x->x_ypos-x->x_yendcapture)/x->x_zoom+x->x_blocksize/2;
- fi<=(x->x_ypos-x->x_ystartcapture)/x->x_zoom+x->x_blocksize/2; fi++) {
- sonogram_modify_point( x, si, fi, alt );
- }
- for ( fi=(x->x_ypos+x->x_blocksize/2*x->x_zoom+1-x->x_yendcapture)/x->x_zoom+x->x_blocksize/2;
- fi<=(x->x_ypos+x->x_blocksize/2*x->x_zoom+1-x->x_ystartcapture)/x->x_zoom+x->x_blocksize/2; fi++) {
- sonogram_modify_point_phase( x, si, fi, alt );
- }
- }
- sonogram_update_part(x, x->x_glist, (x->x_xstartcapture-x->x_xpos)/x->x_zoom,
- (x->x_xendcapture-x->x_xpos)/x->x_zoom, 0, 1, 1);
- }
- // start a new capture
- SYS_VGUI3( ".x%x.c delete %xCAPTURE\n", glist_getcanvas( x->x_glist ), x );
- x->x_xstartcapture = xpix;
- x->x_ystartcapture = ypix;
- x->x_xendcapture = xpix;
- x->x_yendcapture = ypix;
- }
- else
- {
- // nothing
- }
- x->x_aftermousedown = doit;
- return (1);
-}
-
- /* clean up */
-static void sonogram_free(t_sonogram *x)
-{
- if ( x->x_rdata != NULL ) {
- freebytes(x->x_rdata, x->x_size*x->x_blocksize*sizeof(float) );
- post( "Freed %d bytes", x->x_size*x->x_blocksize*sizeof(float) );
- x->x_rdata = NULL;
- }
- if ( x->x_idata != NULL ) {
- freebytes(x->x_idata, x->x_size*x->x_blocksize*sizeof(float) );
- post( "Freed %d bytes", x->x_size*x->x_blocksize*sizeof(float) );
- x->x_idata = NULL;
- }
- if ( x->x_rudata != NULL ) {
- freebytes(x->x_rudata, x->x_size*x->x_blocksize*sizeof(float) );
- post( "Freed %d bytes", x->x_size*x->x_blocksize*sizeof(float) );
- x->x_rdata = NULL;
- }
- if ( x->x_iudata != NULL ) {
- freebytes(x->x_iudata, x->x_size*x->x_blocksize*sizeof(float) );
- post( "Freed %d bytes", x->x_size*x->x_blocksize*sizeof(float) );
- x->x_idata = NULL;
- }
- if ( x->x_gifdata != NULL ) {
- freebytes(x->x_gifdata, (x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- post( "Freed %d bytes", (x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- x->x_gifdata = NULL;
- }
- if ( x->x_guicommand != NULL ) {
- freebytes(x->x_guicommand, 128+(x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- post( "Freed %d bytes", 128+(x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- x->x_guicommand = NULL;
- }
-}
-
- /* allocate tables for storing ffts */
-static t_int sonogram_allocate(t_sonogram *x)
-{
- t_int fi;
-
- if ( !(x->x_rdata = getbytes( x->x_size*x->x_blocksize*sizeof(float) ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return -1;
- } else {
- post( "sonogram~ : allocated %d bytes", x->x_size*x->x_blocksize*sizeof(float) );
- }
- if ( !(x->x_idata = getbytes( x->x_size*x->x_blocksize*sizeof(float) ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return -1;
- } else {
- post( "sonogram~ : allocated %d bytes", x->x_size*x->x_blocksize*sizeof(float) );
- }
- if ( !(x->x_multfreq = getbytes( x->x_blocksize*sizeof(t_int) ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return -1;
- } else {
- post( "sonogram~ : allocated %d bytes", x->x_blocksize*sizeof(t_int) );
- }
- for ( fi=0; fi<x->x_blocksize; fi++ )
- {
- *(x->x_multfreq+fi)=1;
- }
- // no undo is available
- x->x_uxs = x->x_uxe = x->x_uys = x->x_uye = -1;
- if ( !(x->x_rudata = getbytes( x->x_size*x->x_blocksize*sizeof(float) ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return -1;
- } else {
- post( "sonogram~ : allocated %d bytes", x->x_size*x->x_blocksize*sizeof(float) );
- }
- if ( !(x->x_iudata = getbytes( x->x_size*x->x_blocksize*sizeof(float) ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return -1;
- } else {
- post( "sonogram~ : allocated %d bytes", x->x_size*x->x_blocksize*sizeof(float) );
- }
- if ( !( x->x_gifdata = ( char* ) getbytes( (x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return -1;
- } else {
- post( "sonogram~ : allocated %d bytes", (x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- }
- if ( !( x->x_guicommand = ( char* ) getbytes( 128+(x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return -1;
- } else {
- post( "sonogram~ : allocated %d bytes", 128+(x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- }
-
- return 0;
-}
-
- /* records or playback the sonogram */
-static t_int *sonogram_perform(t_int *w)
-{
- t_float *rin = (t_float *)(w[1]);
- t_float *iin = (t_float *)(w[2]);
- t_float *rout = (t_float *)(w[3]);
- t_float *iout = (t_float *)(w[4]);
- t_float fspectrum = 0.0;
- t_float fphase = 0.0;
- t_int is;
- t_int n = (int)(w[5]); /* number of samples */
- t_sonogram *x = (t_sonogram *)(w[6]);
- t_int bi;
-
- // reallocate tables if blocksize has been changed
- if ( n != x->x_blocksize && x->x_updatechild == 0 ) {
- post( "sonogram~ : reallocating tables" );
- // erase all points
- sonogram_free(x);
- x->x_blocksize = n;
- sonogram_allocate(x);
- sonogram_update_part(x, x->x_glist, 0, x->x_size-1, !x->x_empty, 0, 0);
- canvas_fixlinesfor(x->x_glist, (t_text*)x );
- }
-
- bi = 0;
- while (bi<n)
- {
- // eventually records input
- if ( x->x_record) {
- *(x->x_rdata+(x->x_writepos*x->x_blocksize)+bi)=(*(rin))*(*(x->x_multfreq+bi));
- *(x->x_idata+(x->x_writepos*x->x_blocksize)+bi)=(*(iin))*(*(x->x_multfreq+bi));
- }
- // set outputs
- *rout = 0.0;
- *iout = 0.0;
- if ( x->x_play) {
- is=0;
- fspectrum =
- sqrt( pow( *(x->x_rdata+(((int)x->x_readpos+is)*x->x_blocksize)+bi), 2) +
- pow( *(x->x_idata+(((int)x->x_readpos+is)*x->x_blocksize)+bi), 2) );
- fphase = atan2( *(x->x_idata+(((int)x->x_readpos+is)*x->x_blocksize)+bi),
- *(x->x_rdata+(((int)x->x_readpos+is)*x->x_blocksize)+bi) );
- fphase += (x->x_phase/180.0)*(M_PI);
- *rout += fspectrum*cos( fphase );
- *iout += fspectrum*sin( fphase );
- }
- rout++;iout++;
- rin++;iin++;
- bi++;
-
- }
- // reset playing position until next play
- if ( x->x_play ) {
- x->x_readpos+=x->x_readspeed;
- // post( "xreadpos : %f (added %f)", x->x_readpos, x->x_readspeed );
- if ( x->x_readpos >= (x->x_readend*x->x_size)/100 ) {
- x->x_play=0;
- x->x_readpos=(x->x_readstart*x->x_size)/100;
- // post( "sonogram~ : stopped playing (readpos=%d)", x->x_readpos );
- outlet_bang(x->x_end);
- }
- }
- // reset recording position until next record
- if ( x->x_record ) {
- x->x_writepos++;
- if ( x->x_writepos >= x->x_size ) {
- x->x_record=0;
- x->x_writepos=0;
- sonogram_update_part(x, x->x_glist, 0, x->x_size-1, 0, 1, 0);
- outlet_bang(x->x_recend);
- if ( x->x_empty ) x->x_empty = 0;
- post( "sonogram~ : stopped recording" );
- }
- }
- // post( "sonogram~ : read : %f:%d : write: %d:%d", x->x_readpos, x->x_play, x->x_writepos, x->x_record );
- return (w+7);
-}
-
-static void sonogram_dsp(t_sonogram *x, t_signal **sp)
-{
- dsp_add(sonogram_perform, 6, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec, sp[0]->s_n, x);
-}
-
- /* record the sonogram */
-static void sonogram_record(t_sonogram *x)
-{
- x->x_record=1;
- x->x_writepos=0;
- post( "sonogram~ : recording on" );
-}
-
- /* play the sonogram */
-static void sonogram_play(t_sonogram *x)
-{
- x->x_play=1;
- x->x_readpos=(x->x_readstart*x->x_size)/100;
- post( "sonogram~ : playing on" );
-}
-
- /* setting the starting point for reading ( in percent ) */
-static void sonogram_readstart(t_sonogram *x, t_floatarg fstart)
-{
- t_float startpoint = fstart;
-
- if (startpoint < 0) startpoint = 0;
- if (startpoint > 100) startpoint = 100;
- if ( startpoint > x->x_readend ) {
- x->x_readstart = x->x_readend;
- post( "sonogram~ : warning : range for reading is null" );
- } else {
- x->x_readstart=startpoint;
- }
- if ( x->x_graphic && glist_isvisible( x->x_glist ) )
- {
- SYS_VGUI3( ".x%x.c delete line %xREADSTART\n",
- glist_getcanvas( x->x_glist ), x);
- SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #FF0000 -tags %xREADSTART -width 3\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+(x->x_readstart*(x->x_size)/100 ),
- x->x_ypos, x->x_xpos+(x->x_readstart*(x->x_size)/100 ),
- x->x_ypos+x->x_blocksize*x->x_zoom, x );
- }
-}
-
- /* setting the starting point for modification ( in percent ) */
-static void sonogram_modstart(t_sonogram *x, t_floatarg fstart)
-{
- t_float startpoint = fstart;
-
- if (startpoint < 0) startpoint = 0;
- if (startpoint > 100) startpoint = 100;
- if ( startpoint > x->x_modend ) {
- x->x_modstart = x->x_modend;
- post( "sonogram~ : warning : range for modifications is null" );
- } else {
- x->x_modstart=startpoint;
- }
- if ( x->x_graphic && glist_isvisible( x->x_glist ) )
- {
- SYS_VGUI3( ".x%x.c delete line %xMODSTART\n",
- glist_getcanvas( x->x_glist ), x);
- SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #11E834 -tags %xMODSTART -width 3\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+(x->x_modstart*(x->x_size)/100 ),
- x->x_ypos, x->x_xpos+(x->x_modstart*(x->x_size)/100 ),
- x->x_ypos+x->x_blocksize*x->x_zoom, x );
- }
-}
-
- /* setting the modification step for graphical mode */
-static void sonogram_modstep(t_sonogram *x, t_floatarg fmodstep)
-{
- if ( x->x_graphic )
- {
- x->x_modstep = fmodstep;
- }
-}
-
- /* setting enhance mode */
-static void sonogram_enhancemode(t_sonogram *x, t_floatarg fenhancemode)
-{
- if ( x->x_graphic )
- {
- x->x_enhancemode = fenhancemode;
- }
-}
-
- /* setting the ending point for reading ( in percent ) */
-static void sonogram_readend(t_sonogram *x, t_floatarg fend)
-{
- t_float endpoint = fend;
-
- if (endpoint < 0) endpoint = 0;
- if (endpoint > 100) endpoint = 100;
- if ( endpoint < x->x_readstart ) {
- x->x_readend = x->x_readstart;
- post( "sonogram~ : warning : range for reading is null" );
- } else {
- x->x_readend=endpoint;
- }
- if ( x->x_graphic && glist_isvisible( x->x_glist ) )
- {
- SYS_VGUI3( ".x%x.c delete line %xREADEND\n",
- glist_getcanvas( x->x_glist ), x);
- SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #FF0000 -tags %xREADEND -width 3\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+(x->x_readend*(x->x_size)/100 ),
- x->x_ypos, x->x_xpos+(x->x_readend*(x->x_size)/100 ),
- x->x_ypos+x->x_blocksize*x->x_zoom, x );
- }
-}
-
- /* setting the ending point for modification ( in percent ) */
-static void sonogram_modend(t_sonogram *x, t_floatarg fend)
-{
- t_float endpoint = fend;
-
- if (endpoint < 0) endpoint = 0;
- if (endpoint > 100) endpoint = 100;
- if ( endpoint < x->x_modstart ) {
- x->x_modend = x->x_modstart;
- post( "sonogram~ : warning : range for modifications is null" );
- } else {
- x->x_modend=endpoint;
- }
- if ( x->x_graphic && glist_isvisible( x->x_glist ) )
- {
- SYS_VGUI3( ".x%x.c delete line %xMODEND\n",
- glist_getcanvas( x->x_glist ), x);
- SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #11E834 -tags %xMODEND -width 3\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+(x->x_modend*(x->x_size)/100 ),
- x->x_ypos, x->x_xpos+(x->x_modend*(x->x_size)/100 ),
- x->x_ypos+x->x_blocksize*x->x_zoom, x );
- }
-}
-
- /* sets the reading speed */
-static void sonogram_readspeed(t_sonogram *x, t_floatarg freadspeed)
-{
- if (freadspeed <= 0 ) {
- post( "sonogram~ : wrong readspeed argument" );
- return;
- }
- x->x_readspeed=freadspeed;
-}
-
- /* enhance frequencies */
-static void sonogram_enhance(t_sonogram *x, t_floatarg fstartfreq, t_floatarg fendfreq, t_floatarg fenhance, t_floatarg fnoupdate )
-{
- t_int samplestart, sampleend, si, fi=0, ffi=0;
- t_float oldenergy;
-
- if (fstartfreq < 0 || fendfreq < 0 ||
- fstartfreq > x->x_blocksize || fendfreq > x->x_blocksize ||
- fstartfreq > fendfreq ) {
- post( "sonogram~ : error : wrong frequencies range" );
- return;
- }
- if ( fenhance < 0 ) {
- post( "sonogram~ : error : wrong multiplicating factor" );
- return;
- }
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
- // post("enhancing portion [%d,%d]", samplestart, sampleend );
- for ( si=samplestart; si<=sampleend; si++ ) {
- for ( fi=(int)fstartfreq; fi<=(int)fendfreq; fi++ ) {
- *(x->x_multfreq+fi) = fenhance;
- if ( (fi != 0) && (fi != x->x_blocksize/2-1) )
- {
- /* multiply both r*sin(a) and r*cos(a) to mutiply r */
- *(x->x_rdata+(si*x->x_blocksize)+fi) *= fenhance;
- *(x->x_idata+(si*x->x_blocksize)+fi) *= fenhance;
- }
- }
- }
- // post( "sonogram~ : enhanced %d,%d", fi, ffi );
- if ( !(int)fnoupdate )
- {
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
- }
-}
-
- /* add a constant to frequencies */
-static void sonogram_add(t_sonogram *x, t_floatarg fstartfreq, t_floatarg fendfreq, t_floatarg fadd)
-{
- t_int samplestart, sampleend, si, fi;
- t_float oldenergy;
-
- if (fstartfreq < 0 || fendfreq < 0 ||
- fstartfreq > x->x_blocksize || fendfreq > x->x_blocksize ||
- fstartfreq > fendfreq ) {
- post( "sonogram~ : error : wrong frequencies range" );
- return;
- }
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
- // post("enhancing portion [%d,%d]", samplestart, sampleend );
- for ( si=samplestart; si<=sampleend; si++ ) {
- for ( fi=(int)fstartfreq; fi<=(int)fendfreq; fi++ ) {
- /* multiply both r*sin(a) and r*cos(a) to mutiply r */
- *(x->x_rdata+(si*x->x_blocksize)+fi) += fadd;
- *(x->x_idata+(si*x->x_blocksize)+fi) += fadd;
- }
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* resize sonogram */
-static void sonogram_resize(t_sonogram *x, t_floatarg fnewsize )
-{
- if (fnewsize <= 0) {
- post( "sonogram~ : error : wrong size" );
- return;
- }
- if (x->x_updatechild > 0) {
- post( "sonogram~ : can't resize now, an update is pending." );
- return;
- }
- post( "sonogram~ : reallocating tables" );
- x->x_record = 0;
- x->x_play = 0;
- sonogram_free(x);
- x->x_size = fnewsize;
- sonogram_allocate(x);
- // erase all points, as data is zero no drawing is needed
- sonogram_update_part(x, x->x_glist, 0, x->x_size-1, 0, 0, 0);
-}
-
- /* set zoom factor */
-static void sonogram_zoom(t_sonogram *x, t_floatarg fzoom )
-{
- post( "sonogram~: warning : zoom and big block factors might lead to a crash" );
- if (fzoom < 1) {
- post( "sonogram~ : error : wrong zoom factor" );
- return;
- }
- if ( x->x_gifdata != NULL ) {
- freebytes(x->x_gifdata, (x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- post( "Freed %d bytes", (x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- x->x_gifdata = NULL;
- }
- if ( x->x_guicommand != NULL ) {
- freebytes(x->x_guicommand, 128+(x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- post( "Freed %d bytes", 128+(x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- x->x_guicommand = NULL;
- }
- x->x_zoom = (int)fzoom;
- if ( !( x->x_gifdata = ( char* ) getbytes( (x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return;
- } else {
- post( "sonogram~ : allocated %d bytes", (x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- }
- if ( !( x->x_guicommand = ( char* ) getbytes( 128+(x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return;
- } else {
- post( "sonogram~ : allocated %d bytes", 128+(x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- }
- sonogram_update_part(x, x->x_glist, 0, x->x_size-1, !x->x_empty, !x->x_empty, 0);
- canvas_fixlinesfor(x->x_glist, (t_text*)x );
-}
-
- /* refresh data */
-static void sonogram_refresh(t_sonogram *x)
-{
- sonogram_update_part(x, x->x_glist, 0, x->x_size-1, 0, 1, 1);
-}
-
- /* flip frequencies */
-static void sonogram_flipfreqs(t_sonogram *x)
-{
- t_int samplestart, sampleend, si, fi;
- t_float fvalue;
- t_int ioperon;
-
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
- ioperon=x->x_blocksize/2;
- for ( si=samplestart; si<=sampleend; si++ ) {
- for ( fi=0; fi<=ioperon/2; fi++ ) {
- fvalue = *(x->x_rdata+(si*x->x_blocksize)+fi);
- *(x->x_rdata+(si*x->x_blocksize)+fi) = *(x->x_rdata+(si*x->x_blocksize)+(ioperon-fi-1));
- *(x->x_rdata+(si*x->x_blocksize)+(ioperon-fi-1)) = fvalue;
- fvalue = *(x->x_idata+(si*x->x_blocksize)+fi);
- *(x->x_idata+(si*x->x_blocksize)+fi) = *(x->x_idata+(si*x->x_blocksize)+(ioperon-fi-1));
- *(x->x_idata+(si*x->x_blocksize)+(ioperon-fi-1)) = fvalue;
- }
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* flip blocks */
-static void sonogram_flipblocks(t_sonogram *x)
-{
- t_int samplestart, sampleend, middlesample, fi, si;
- t_float fvalue;
-
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
- middlesample = ( sampleend+samplestart+1 ) / 2;
- for ( si=samplestart; si<=middlesample; si++ ) {
- for ( fi=0; fi<x->x_blocksize; fi++ ) {
- fvalue = *(x->x_rdata+((si)*x->x_blocksize)+fi);
- *(x->x_rdata+((si)*x->x_blocksize)+fi) = *(x->x_rdata+((sampleend+samplestart-si)*x->x_blocksize)+fi);
- *(x->x_rdata+((sampleend+samplestart-si)*x->x_blocksize)+fi) = fvalue;
- fvalue = *(x->x_idata+((si)*x->x_blocksize)+fi);
- *(x->x_idata+((si)*x->x_blocksize)+fi) = *(x->x_idata+((sampleend+samplestart-si)*x->x_blocksize)+fi);
- *(x->x_idata+((sampleend+samplestart-si)*x->x_blocksize)+fi) = fvalue;
- }
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* undo if available */
-static void sonogram_undo(t_sonogram *x)
-{
- t_int si,fi;
-
- if ( x->x_uxs == -1 )
- {
- post( "sonogram~ : nothing to undo, man" );
- return;
- }
-
- post( "sonogram~ : restoring region [%d,%d,%d,%d]", x->x_uxs, x->x_uys, x->x_uxe, x->x_uye );
- for ( si=x->x_uxs; si<=x->x_uxe; si++ ) {
- for ( fi=x->x_uys; fi<=x->x_uye; fi++ ) {
- *(x->x_rdata+((si)*x->x_blocksize)+fi) = *(x->x_rudata+(si-x->x_uxs)*x->x_blocksize+(fi-x->x_uys));
- *(x->x_idata+((si)*x->x_blocksize)+fi) = *(x->x_iudata+(si-x->x_uxs)*x->x_blocksize+(fi-x->x_uys));
- }
- }
- sonogram_update_part(x, x->x_glist, x->x_uxs, x->x_uxe, 0, 1, 1);
-}
-
- /* zswap exchanges real and imaginery part */
-static void sonogram_zswap(t_sonogram *x)
-{
- t_int samplestart, sampleend, fi, si;
- t_float fvalue;
-
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
- for ( si=samplestart; si<=sampleend; si++ ) {
- for ( fi=0; fi<x->x_blocksize; fi++ ) {
- fvalue = *(x->x_rdata+(si*x->x_blocksize)+fi);
- *(x->x_rdata+(si*x->x_blocksize)+fi) = *(x->x_idata+(si*x->x_blocksize)+fi);
- *(x->x_idata+(si*x->x_blocksize)+fi) = fvalue;
- }
- }
-}
-
- /* swap points */
-static void sonogram_swappoints(t_sonogram *x, t_floatarg fnbpoints)
-{
- t_int samplestart, sampleend, sp;
- t_float s1, s2, f1, f2;
- t_float fvalue;
-
- if (fnbpoints <= 0) {
- post( "sonogram~ : error : bad number of points" );
- return;
- }
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
-
- for ( sp=0; sp<fnbpoints; sp++ ) {
-#ifdef NT
- s1 = samplestart + (rand()%(sampleend-samplestart));
- s2 = samplestart + (rand()%(sampleend-samplestart));
- f1 = rand()%( x->x_blocksize/2-1 );
- f2 = rand()%( x->x_blocksize/2-1 );
-#else
- s1 = samplestart + (random()%(sampleend-samplestart));
- s2 = samplestart + (random()%(sampleend-samplestart));
- f1 = random()%( x->x_blocksize/2-1 );
- f2 = random()%( x->x_blocksize/2-1 );
-#endif
- fvalue = *(x->x_rdata+((int)s1*x->x_blocksize)+(int)f1);
- *(x->x_rdata+((int)s1*x->x_blocksize)+(int)f1) = *(x->x_rdata+((int)s2*x->x_blocksize)+(int)f2);
- *(x->x_rdata+((int)s2*x->x_blocksize)+(int)f2) = fvalue;
- fvalue = *(x->x_idata+((int)s1*x->x_blocksize)+(int)f1);
- *(x->x_idata+((int)s1*x->x_blocksize)+(int)f1) = *(x->x_idata+((int)s2*x->x_blocksize)+(int)f2);
- *(x->x_idata+((int)s2*x->x_blocksize)+(int)f2) = fvalue;
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* average blocks according to a factor */
-static void sonogram_average(t_sonogram *x, t_floatarg fnbblocks)
-{
- t_int samplestart, sampleend, fi, si, ssi;
- t_float fraverage, fiaverage;
-
- if (fnbblocks < 1) {
- post( "sonogram~ : error : bad average factor" );
- return;
- }
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
-
- fraverage=fiaverage=0.0;
- for ( fi=0; fi<x->x_blocksize; fi++ ) {
- for ( si=samplestart; si<=sampleend-fnbblocks; si+=fnbblocks ) {
- fraverage=fiaverage=0.0;
- for ( ssi=0; ssi<fnbblocks; ssi++ ) {
- fraverage += *(x->x_rdata+((int)(si+ssi)*x->x_blocksize)+fi);
- fiaverage += *(x->x_idata+((int)(si+ssi)*x->x_blocksize)+fi);
- }
- fraverage /= fnbblocks;
- fiaverage /= fnbblocks;
- for ( ssi=0; ssi<fnbblocks; ssi++ ) {
- *(x->x_rdata+((int)(si+ssi)*x->x_blocksize)+fi)=fraverage;
- *(x->x_idata+((int)(si+ssi)*x->x_blocksize)+fi)=fiaverage;
- }
- }
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* go up by the given number */
-static void sonogram_goup(t_sonogram *x, t_floatarg fgoup)
-{
- t_int samplestart, sampleend, sp, sf;
-
- if (fgoup <= 0 || fgoup > x->x_blocksize/2) {
- post( "sonogram~ : error : wrong offset in goup function" );
- return;
- }
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
-
- for ( sp=samplestart; sp<=sampleend; sp++ ) {
- for (sf=(x->x_blocksize/2)-fgoup-1; sf>=0; sf-- ) {
- *(x->x_rdata+((int)sp*x->x_blocksize)+(sf+(int)fgoup)) =
- *(x->x_rdata+((int)sp*x->x_blocksize)+sf);
- *(x->x_idata+((int)sp*x->x_blocksize)+(sf+(int)fgoup)) =
- *(x->x_idata+((int)sp*x->x_blocksize)+sf);
-
- }
- for (sf=0; sf<fgoup; sf++ ) {
- *(x->x_rdata+((int)sp*x->x_blocksize)+(int)sf) = 0.0;
- *(x->x_idata+((int)sp*x->x_blocksize)+(int)sf) = 0.0;
- }
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* roll up by the given number */
-static void sonogram_roll(t_sonogram *x, t_floatarg froll)
-{
- t_int samplestart, sampleend, sp, sf;
- t_float *fprvalues;
- t_float *fpivalues;
-
- if (froll <= 0 || froll > x->x_blocksize/2) {
- post( "sonogram~ : error : wrong offset in roll function" );
- return;
- }
- fprvalues = (t_float*)getbytes( ((int)froll)*sizeof( float ) );
- if ( !fprvalues ) {
- post( "sonogram~ : error : could not allocate %d bytes", ((int)froll)*sizeof(float) );
- return;
- }
- fpivalues = (t_float*)getbytes( ((int)froll)*sizeof( float ) );
- if ( !fpivalues ) {
- post( "sonogram~ : error : could not allocate %d bytes", ((int)froll)*sizeof(float) );
- return;
- }
-
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
-
- for ( sp=samplestart; sp<=sampleend; sp++ ) {
-
- // saving values
- for (sf=0; sf<froll; sf++ ) {
- *(fprvalues+sf) =
- *(x->x_rdata+((int)sp*x->x_blocksize)+(x->x_blocksize/2-(int)froll+sf));
- *(fpivalues+sf) =
- *(x->x_idata+((int)sp*x->x_blocksize)+(x->x_blocksize/2-(int)froll+sf));
- }
- for (sf=(x->x_blocksize/2)-froll-1; sf>=0; sf-- ) {
- *(x->x_rdata+((int)sp*x->x_blocksize)+(sf+(int)froll)) =
- *(x->x_rdata+((int)sp*x->x_blocksize)+sf);
- *(x->x_idata+((int)sp*x->x_blocksize)+(sf+(int)froll)) =
- *(x->x_idata+((int)sp*x->x_blocksize)+sf);
- }
- for (sf=0; sf<froll; sf++ ) {
- *(x->x_rdata+((int)sp*x->x_blocksize)+(int)sf) = *(fprvalues+sf);
- *(x->x_idata+((int)sp*x->x_blocksize)+(int)sf) = *(fpivalues+sf);
- }
- }
- freebytes( fprvalues, (int)froll*sizeof(float) );
- freebytes( fpivalues, (int)froll*sizeof(float) );
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* suppress point below the threshold */
-static void sonogram_threshold(t_sonogram *x, t_floatarg fthreshold)
-{
- t_int samplestart, sampleend, sp, sf;
- t_float fspectrum;
-
- if (fthreshold <= 0) {
- post( "sonogram~ : error : wrong threshold" );
- return;
- }
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
-
- for ( sp=samplestart; sp<=sampleend; sp++ ) {
- for (sf=0; sf<=(x->x_blocksize/2)-1; sf++ ) {
- fspectrum = sqrt( pow( *(x->x_rdata+sp*x->x_blocksize+sf), 2) +
- pow( *(x->x_idata+sp*x->x_blocksize+sf), 2) );
- if ( fspectrum < fthreshold )
- {
- *(x->x_rdata+sp*x->x_blocksize+sf) = 0.0;
- *(x->x_idata+sp*x->x_blocksize+sf) = 0.0;
- }
- }
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* change the phase */
-static void sonogram_phase(t_sonogram *x, t_floatarg fincphase)
-{
- if (fincphase < 0 || fincphase > 90) {
- post( "sonogram~ : error : wrong phase in phase function : out of [0,90]" );
- return;
- }
- x->x_phase = fincphase;
-}
-
- /* go down by the given number */
-static void sonogram_godown(t_sonogram *x, t_floatarg fgodown)
-{
- t_int samplestart, sampleend, sp, sf;
-
- if (fgodown <= 0 || fgodown > x->x_blocksize/2) {
- post( "sonogram~ : error : wrong offset in godown function" );
- return;
- }
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
-
- for ( sp=samplestart; sp<=sampleend; sp++ ) {
- for (sf=0; sf<=(x->x_blocksize/2)-fgodown-1; sf++ ) {
- *(x->x_rdata+((int)sp*x->x_blocksize)+sf) =
- *(x->x_rdata+((int)sp*x->x_blocksize)+(sf+(int)fgodown));
- *(x->x_idata+((int)sp*x->x_blocksize)+sf) =
- *(x->x_idata+((int)sp*x->x_blocksize)+(sf+(int)fgodown));
- }
- for (sf=(x->x_blocksize/2)-fgodown; sf<(x->x_blocksize/2); sf++ ) {
- *(x->x_rdata+((int)sp*x->x_blocksize)+(int)sf) = 0.0;
- *(x->x_idata+((int)sp*x->x_blocksize)+(int)sf) = 0.0;
- }
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* swap blocks */
-static void sonogram_swapblocks(t_sonogram *x, t_floatarg fperstart, t_floatarg fperend, t_floatarg fpersize)
-{
- t_int samplestart, samplestartb, samplesize, sp, sf;
- t_int iperstart, iperend, ipersize;
- t_float s1, s2;
- t_float fvalue;
-
- iperstart = fperstart;
- iperend = fperend;
- ipersize = fpersize;
-
- if (iperstart < 0 || iperstart > iperend ||
- iperend <= 0 || iperend+ipersize > 100 ||
- ipersize < 0 || fpersize > 100 ) {
- post( "sonogram~ : error : wrong interval [%d%%, %d%%] <-> [%d%%, %d%%]",
- iperstart, iperstart+ipersize, iperend, iperend+ipersize );
- return;
- }
-
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- samplestartb=(x->x_modend*(x->x_size-1))/100;
- samplesize=((samplestartb-samplestart)*ipersize)/100;
- samplestart=samplestart+((samplestartb-samplestart)*iperstart)/100;
- samplestartb=samplestart+((samplestartb-samplestart)*iperend)/100;
-
- post( "swap blocks [%d,%d] and [%d,%d]", samplestart, samplestart+samplesize, samplestartb, samplestartb+samplesize );
-
- for ( sp=samplesize; sp>=0; sp-- ) {
- for ( sf=0; sf<x->x_blocksize; sf++) {
- fvalue = *(x->x_rdata+((int)(samplestart+sp)*x->x_blocksize)+sf);
- *(x->x_rdata+((int)(samplestart+sp)*x->x_blocksize)+sf) = *(x->x_rdata+((int)(samplestartb+sp)*x->x_blocksize)+sf);
- *(x->x_rdata+((int)(samplestartb+sp)*x->x_blocksize)+sf) = fvalue;
- fvalue = *(x->x_idata+((int)(samplestart+sp)*x->x_blocksize)+sf);
- *(x->x_idata+((int)(samplestart+sp)*x->x_blocksize)+sf) = *(x->x_idata+((int)(samplestartb+sp)*x->x_blocksize)+sf);
- *(x->x_idata+((int)(samplestartb+sp)*x->x_blocksize)+sf) = fvalue;
- }
- }
- sonogram_update_part(x, x->x_glist, 0, x->x_size-1, 0, 1, 1);
-}
-
- /* swap frequencies */
-static void sonogram_swapfreqs(t_sonogram *x, t_floatarg ffirstfreq, t_floatarg fsecondfreq)
-{
- t_int samplestart, sampleend, sp;
- t_float fvalue;
-
- if (ffirstfreq < 0 || fsecondfreq <0) {
- post( "sonogram~ : error : wrong frequencies" );
- return;
- }
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
-
- for ( sp=samplestart; sp<=sampleend; sp++ ) {
- fvalue = *(x->x_rdata+((int)sp*x->x_blocksize)+(int)ffirstfreq);
- *(x->x_rdata+((int)sp*x->x_blocksize)+(int)ffirstfreq) =
- *(x->x_rdata+((int)sp*x->x_blocksize)+(int)fsecondfreq);
- *(x->x_rdata+((int)sp*x->x_blocksize)+(int)fsecondfreq) = fvalue;
- fvalue = *(x->x_idata+((int)sp*x->x_blocksize)+(int)ffirstfreq);
- *(x->x_idata+((int)sp*x->x_blocksize)+(int)ffirstfreq) =
- *(x->x_idata+((int)sp*x->x_blocksize)+(int)fsecondfreq);
- *(x->x_idata+((int)sp*x->x_blocksize)+(int)fsecondfreq) = fvalue;
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
-static void *sonogram_new(t_floatarg fsize, t_floatarg fgraphic, t_floatarg fphaso)
-{
- t_sonogram *x = (t_sonogram *)pd_new(sonogram_class);
- outlet_new(&x->x_obj, &s_signal);
- outlet_new(&x->x_obj, &s_signal);
- x->x_recend = outlet_new(&x->x_obj, &s_bang );
- x->x_end = outlet_new(&x->x_obj, &s_bang );
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("readstart"));
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("readend"));
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("modstart"));
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("modend"));
-
- if ( fsize <= 0 || ( fgraphic != 0 && fgraphic != 1 ) || ( fphaso != 0 && fphaso != 1 ) ) {
- error( "sonogram~ : missing or negative creation arguments" );
- return NULL;
- }
-
- // activate graphical callbacks
- if ( fgraphic != 0 )
- {
- class_setwidget(sonogram_class, &sonogram_widgetbehavior);
- }
- x->x_graphic = (int) fgraphic;
- x->x_phaso = (int) fphaso;
-
- x->x_size = fsize;
- x->x_blocksize = sys_getblksize();
- x->x_play = 0;
- x->x_readspeed = 1.;
- x->x_record = 0;
- x->x_readpos = 0.;
- x->x_writepos = 0;
- x->x_modstart = 0;
- x->x_readstart = 0;
- x->x_modend = 100;
- x->x_readend = 100;
- x->x_rdata = NULL;
- x->x_idata = NULL;
- x->x_phase = 0.0;
- x->x_empty = 1;
- x->x_xpos = -1;
- x->x_ypos = -1;
- x->x_samplerate = sys_getsr();
- /* graphic data */
- x->x_selected = 0;
- x->x_zoom = 1;
- x->x_updatechild = 0;
- x->x_modstep = 1.1;
- x->x_enhancemode = 0;
- x->x_glist = (t_glist*)canvas_getcurrent();
-
- if ( sonogram_allocate(x) <0 ) {
- return NULL;
- } else {
- return(x);
- }
-
-}
-
-void sonogram_tilde_setup(void)
-{
- post(sonogram_version);
- sonogram_class = class_new(gensym("sonogram~"), (t_newmethod)sonogram_new, (t_method)sonogram_free,
- sizeof(t_sonogram), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- // set callbacks
- sonogram_widgetbehavior.w_getrectfn = sonogram_getrect;
- sonogram_widgetbehavior.w_displacefn = sonogram_displace;
- sonogram_widgetbehavior.w_selectfn = sonogram_select;
- sonogram_widgetbehavior.w_activatefn = NULL;
- sonogram_widgetbehavior.w_deletefn = sonogram_delete;
- sonogram_widgetbehavior.w_visfn = sonogram_vis;
- sonogram_widgetbehavior.w_clickfn = sonogram_click;
- /*
- * <hans@eds.org>: As of 0.37, pd does not have these last
- * two elements in t_widgetbehavoir anymore.
- * see pd/src/notes.txt:
- * savefunction and dialog into class structure
- */
-#if PD_MINOR_VERSION < 37 || !defined(PD_MINOR_VERSION)
- sonogram_widgetbehavior.w_propertiesfn = NULL;
- sonogram_widgetbehavior.w_savefn = sonogram_save;
-/* this is needed to make the help patch work on < 0.37 */
-
-#else
- class_setpropertiesfn(sonogram_class, NULL);
- class_setsavefn(sonogram_class, &sonogram_save);
-#endif
-
- CLASS_MAINSIGNALIN( sonogram_class, t_sonogram, x_f );
- class_addmethod(sonogram_class, (t_method)sonogram_dsp, gensym("dsp"), A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_record, gensym("record"), A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_enhance, gensym("enhance"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_add, gensym("add"), A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_resize, gensym("resize"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_zoom, gensym("zoom"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_swappoints, gensym("swappoints"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_average, gensym("average"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_swapblocks, gensym("swapblocks"), A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_swapfreqs, gensym("swapfreqs"), A_FLOAT, A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_flipfreqs, gensym("flipfreqs"), A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_flipblocks, gensym("flipblocks"), A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_play, gensym("play"), A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_refresh, gensym("refresh"), A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_enhancemode, gensym("enhancemode"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_goup, gensym("goup"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_godown, gensym("godown"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_roll, gensym("roll"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_threshold, gensym("threshold"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_phase, gensym("phase"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_zswap, gensym("zswap"), A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_modstep, gensym("modstep"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_modstart, gensym("modstart"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_modend, gensym("modend"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_readstart, gensym("readstart"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_readend, gensym("readend"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_readspeed, gensym("readspeed"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_undo, gensym("undo"), A_NULL);
-}
-
-
-#endif /* not _WIN32 */
diff --git a/sonogram~/sonogram~-yves.c b/sonogram~/sonogram~-yves.c
deleted file mode 100644
index 6ff83d8..0000000
--- a/sonogram~/sonogram~-yves.c
+++ /dev/null
@@ -1,2017 +0,0 @@
-/*------------------------ sonogram~ ------------------------------------------ */
-/* */
-/* sonogram~ : lets you record, play back and modify a sonogram */
-/* constructor : sonogram <size> <graphical=0|1> <phasogram=0|1> */
-/* */
-/* Copyleft Yves Degoyon ( ydegoyon@free.fr ) */
-/* */
-/* This program is free software; you can redistribute it and/or */
-/* modify it under the terms of the GNU General Public License */
-/* as published by the Free Software Foundation; either version 2 */
-/* of the License, or (at your option) any later version. */
-/* */
-/* See file LICENSE for further informations on licensing terms. */
-/* */
-/* This program is distributed in the hope that it will be useful, */
-/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
-/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
-/* GNU General Public License for more details. */
-/* */
-/* You should have received a copy of the GNU General Public License */
-/* along with this program; if not, write to the Free Software */
-/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-/* */
-/* Based on PureData by Miller Puckette and others. */
-/* */
-/* "Living at night" */
-/* "Doesn't help for my complexion" */
-/* David Thomas - Final Solution */
-/* ---------------------------------------------------------------------------- */
-
-
-/* this doesn't compile on MinGW */
-#ifndef _WIN32
-
-#include <sys/types.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#ifndef __APPLE__
-#include <malloc.h>
-#endif
-#include <ctype.h>
-#include <pthread.h>
-#ifdef WIN32
-#define random rand
-#define usleep(a) _sleep(a/1000)
-#include <io.h>
-#include <windows.h>
-#else
-#include <unistd.h>
-#endif
-#include <math.h>
-
-#include <m_pd.h>
-#include "m_imp.h"
-#include "g_canvas.h"
-
-
-static int guidebug=0;
-static int ignorevisible=1; // ignore visible test
- // because this seems to lead to bad refresh
- // wait for a fix
-
-#define SYS_VGUI2(a,b) if (guidebug) \
- post(a,b);\
- sys_vgui(a,b)
-
-#define SYS_VGUI3(a,b,c) if (guidebug) \
- post(a,b,c);\
- sys_vgui(a,b,c)
-
-#define SYS_VGUI4(a,b,c,d) if (guidebug) \
- post(a,b,c,d);\
- sys_vgui(a,b,c,d)
-
-#define SYS_VGUI5(a,b,c,d,e) if (guidebug) \
- post(a,b,c,d,e);\
- sys_vgui(a,b,c,d,e)
-
-#define SYS_VGUI6(a,b,c,d,e,f) if (guidebug) \
- post(a,b,c,d,e,f);\
- sys_vgui(a,b,c,d,e,f)
-
-#define SYS_VGUI7(a,b,c,d,e,f,g) if (guidebug) \
- post(a,b,c,d,e,f,g );\
- sys_vgui(a,b,c,d,e,f,g)
-
-#define SYS_VGUI9(a,b,c,d,e,f,g,h,i) if (guidebug) \
- post(a,b,c,d,e,f,g,h,i );\
- sys_vgui(a,b,c,d,e,f,g,h,i)
-
-#define SYS_VGUI10(a,b,c,d,e,f,g,h,i,j) if (guidebug) \
- post(a,b,c,d,e,f,g,h,i,j );\
- sys_vgui(a,b,c,d,e,f,g,h,i,j)
-
-#define SYS_VGUI11(a,b,c,d,e,f,g,h,i,j,k) if (guidebug) \
- post(a,b,c,d,e,f,g,h,i,j,k );\
- sys_vgui(a,b,c,d,e,f,g,h,i,j,k)
-
-#define THREAD_SLEEP_TIME 100000 // 100000 us = 100 ms
-
-static char *sonogram_version = "sonogram~: version 0.9, written by Yves Degoyon (ydegoyon@free.fr)";
-
-static t_class *sonogram_class;
-t_widgetbehavior sonogram_widgetbehavior;
-
-
-typedef struct _sonogram
-{
- t_object x_obj;
-
- t_int x_size; /* size of the stored fft ( in blocks~ ) */
- t_float x_samplerate; /* sample rate */
- t_int x_blocksize; /* current block size ( might be modified by block~ object ) */
- t_float x_readpos; /* data's playing position */
- t_int x_writepos; /* data's recording position */
- t_int x_readstart; /* data's starting position for reading */
- t_int x_readend; /* data's ending position for reading */
- t_int x_modstart; /* data's starting position for modifications */
- t_int x_modend; /* data's ending position for modifications */
- t_int x_play; /* playing on/off flag */
- t_float x_readspeed; /* number of grouped blocks for reading */
- t_float x_record; /* flag to start recording process */
- t_float x_empty; /* flag to indicate it's a brand new sonogram */
- t_float *x_rdata; /* table containing real part of the fft */
- t_float *x_rudata; /* undo real data */
- t_float *x_idata; /* table containing imaginery part of the fft */
- t_float *x_iudata; /* undo imaginery data */
- t_float x_phase; /* phase to apply on output */
- t_outlet *x_end; /* outlet for end of restitution */
- t_outlet *x_recend; /* outlet for end of recording */
- t_int *x_multfreq; /* array of multiplicative factor */
- char *x_gifdata; /* buffer for graphical data */
- char *x_guicommand; /* buffer for graphical command */
- t_int x_uxs; /* starting x position for undo */
- t_int x_uxe; /* ending x position for undo */
- t_int x_uys; /* starting y position for undo */
- t_int x_uye; /* ending y position for undo */
-
- /* graphical data block */
- t_int x_enhancemode; /* flag to set enhance mode */
- t_int x_graphic; /* flag to set graphic mode */
- t_int x_phaso; /* flag to indicate if phasogram is shown */
- t_int x_selected; /* flag to remember if we are seleted or not */
- t_int x_erase; /* flag used when an erase is needed */
- t_int x_redraw; /* flag used when drawing is needed */
- t_int x_nbupdated; /* number of points updated */
- t_glist *x_glist; /* keep graphic context for various operations */
- t_int x_zoom; /* zoom factor */
- pthread_t x_updatechild; /* thread id for the update child */
- t_int x_updatestart; /* starting position for update */
- t_int x_updateend; /* ending position for update */
- t_int x_xpos; /* stuck x position */
- t_int x_ypos; /* stuck y position */
- t_int x_shifted; /* remember shift state from last click */
- t_int x_alted; /* remember alt state from last click */
- t_int x_aftermousedown; /* indicates the mousedown event */
- t_int x_xstartcapture; /* x of the start of the capture */
- t_int x_ystartcapture; /* y of the start of the capture */
- t_int x_xendcapture; /* x of the start of the capture */
- t_int x_yendcapture; /* y of the start of the capture */
- t_int x_xdraw; /* x drawing position */
- t_int x_ydraw; /* y drawing position */
- t_float x_modstep; /* step for graphical modifications */
-
- t_float x_f; /* float needed for signal input */
-
-} t_sonogram;
-
-/* ------------------------ drawing functions ---------------------------- */
-static char* sonogram_get_fill_color( t_float fspectrum )
-{
- if ( fspectrum < 0.01 ) {
- return "#EEEEEE";
- } else if ( fspectrum < 0.1 ) {
- return "#DDDDDD";
- } else if ( fspectrum < 0.5 ) {
- return "#CCCCCC";
- } else if ( fspectrum < 1 ) {
- return "#BBBBBB";
- } else if ( fspectrum < 2 ) {
- return "#AAAAAA";
- } else if ( fspectrum < 5 ) {
- return "#999999";
- } else if ( fspectrum < 10 ) {
- return "#888888";
- } else if ( fspectrum < 20 ) {
- return "#777777";
- } else if ( fspectrum < 30 ) {
- return "#666666";
- } else if ( fspectrum < 40 ) {
- return "#555555";
- } else if ( fspectrum < 50 ) {
- return "#444444";
- } else if ( fspectrum < 60 ) {
- return "#333333";
- } else if ( fspectrum < 80 ) {
- return "#222222";
- } else if ( fspectrum < 100 ) {
- return "#111111";
- } else {
- return "#000000";
- }
-}
-
-static char* phasogram_get_fill_color( t_int phase )
-{
- if ( phase < 0 )
- {
- if ( phase > -10 ) {
- return "#111111";
- } else if ( phase > -20 ) {
- return "#222222";
- } else if ( phase > -30 ) {
- return "#333333";
- } else if ( phase > -40 ) {
- return "#444444";
- } else if ( phase > -50 ) {
- return "#555555";
- } else if ( phase > -60 ) {
- return "#666666";
- } else if ( phase > -70 ) {
- return "#777777";
- } else if ( phase > -80 ) {
- return "#888888";
- } else {
- return "#999999";
- }
- }
- else
- {
- if ( phase == 0 ) {
- return "#FFFFFF";
- } else if ( phase < 10 ) {
- return "#111111";
- } else if ( phase < 20 ) {
- return "#222222";
- } else if ( phase < 30 ) {
- return "#333333";
- } else if ( phase < 40 ) {
- return "#444444";
- } else if ( phase < 50 ) {
- return "#555555";
- } else if ( phase < 60 ) {
- return "#666666";
- } else if ( phase < 70 ) {
- return "#777777";
- } else if ( phase < 80 ) {
- return "#888888";
- } else {
- return "#999999";
- }
- }
- // normally never reached
- return "";
-}
-
-static void sonogram_update_point(t_sonogram *x, t_glist *glist, t_int sample, t_int frequency)
-{
- t_canvas *canvas=glist_getcanvas(glist);
- t_float fspectrum=0.0;
- t_int phase=0.0;
- char newColor[ 8 ], olColor[8];
- int i;
-
- fspectrum =
- sqrt( pow( *(x->x_rdata+sample*x->x_blocksize+frequency), 2) +
- pow( *(x->x_idata+sample*x->x_blocksize+frequency), 2) );
- phase = (int) ( atan2( *(x->x_idata+(sample*x->x_blocksize)+frequency),
- *(x->x_rdata+(sample*x->x_blocksize)+frequency) )*180/M_PI );
- if ( x->x_empty && ( fspectrum != 0 ))
- {
- x->x_empty = 0;
- }
- strcpy( newColor, sonogram_get_fill_color( fspectrum ) );
-
- for ( i=0; i<x->x_zoom; i++ )
- {
- sprintf( x->x_gifdata, "%s", strcat( newColor, " ") );
- }
- for ( i=0; i<x->x_zoom; i++ )
- {
- SYS_VGUI5("SONIMAGE%x put {%s} -to %d %d\n", x, x->x_gifdata,
- sample*x->x_zoom+i, (x->x_blocksize/2-frequency)*x->x_zoom );
- }
-
- if ( x->x_phaso )
- {
- strcpy( newColor, phasogram_get_fill_color( phase ) );
- strcpy( x->x_gifdata, "" );
- for ( i=0; i<x->x_zoom; i++ )
- {
- sprintf( x->x_gifdata, "%s", strcat( newColor, " ") );
- }
- for ( i=0; i<x->x_zoom; i++ )
- {
- SYS_VGUI5("FAZIMAGE%x put {%s} -to %d %d\n", x, x->x_gifdata,
- sample*x->x_zoom+i, (x->x_blocksize/2-frequency)*x->x_zoom );
- }
- }
-
- x->x_nbupdated++;
-}
-
-static void sonogram_update_block(t_sonogram *x, t_glist *glist, t_int bnumber)
-{
- t_int fi, i=0;
- t_float fspectrum=0.0;
- t_int phase=0;
- char color[8];
-
- // update sonogram
- for ( fi=x->x_blocksize/2-1; fi>=0; fi-- )
- {
- fspectrum =
- sqrt( pow( *(x->x_rdata+bnumber*x->x_blocksize+fi), 2) +
- pow( *(x->x_idata+bnumber*x->x_blocksize+fi), 2) );
- strcpy( color, sonogram_get_fill_color( fspectrum ) );
- for ( i=0; i<x->x_zoom; i++ )
- {
- strncpy( x->x_gifdata+((x->x_blocksize/2-fi-1)*x->x_zoom+i)*8, strcat( color, " "), 8 );
- }
- }
- for ( i=0; i<x->x_zoom; i++ )
- {
- sprintf( x->x_guicommand, "SONIMAGE%x put {%s} -to %d 0\n", (unsigned int)x, x->x_gifdata, (bnumber*x->x_zoom)+i );
- sys_gui( x->x_guicommand );
- }
-
- // update phasogram
- if ( x->x_phaso )
- {
- strcpy( x->x_gifdata, "" );
- for ( fi=x->x_blocksize/2-1; fi>=0; fi-- )
- {
- phase = (int) ( atan2( *(x->x_idata+bnumber*x->x_blocksize+fi),
- *(x->x_rdata+bnumber*x->x_blocksize+fi) )*180/M_PI );
- strcpy( color, phasogram_get_fill_color( phase ) );
- for ( i=0; i<x->x_zoom; i++ )
- {
- strncpy( x->x_gifdata+((x->x_blocksize/2-fi-1)*x->x_zoom+i)*8, strcat( color, " "), 8 );
- }
- }
- for ( i=0; i<x->x_zoom; i++ )
- {
- sprintf( x->x_guicommand, "FAZIMAGE%x put {%s} -to %d 0\n", (unsigned int)x, x->x_gifdata, (bnumber*x->x_zoom)+i );
- sys_gui( x->x_guicommand );
- }
- }
-
-}
-
-static void sonogram_erase_block(t_sonogram *x, t_glist *glist, t_int bnumber )
-{
- t_canvas *canvas=glist_getcanvas(glist);
- t_int fi;
- t_float fspectrum=0.0;
- char fillColor[ 16 ];
-
- for ( fi=0; fi<x->x_blocksize/2; fi++)
- {
- {
- int i;
-
- for ( i=0; i<x->x_zoom; i++ )
- {
- strcpy( x->x_gifdata+i*sizeof("#FFFFFF "), "#FFFFFF " );
- }
- SYS_VGUI5("SONIMAGE%x put {%s} -to %d %d\n", x, x->x_gifdata,
- bnumber*x->x_zoom, (x->x_blocksize/2-fi)*x->x_zoom );
- }
- }
-}
-
-static void *sonogram_do_update_part(void *tdata)
-{
- t_sonogram *x = (t_sonogram*) tdata;
- t_int si;
- t_int nbpoints = 0;
- t_float percentage = 0, opercentage = 0;
-
- // loose synchro
- usleep( THREAD_SLEEP_TIME );
-
- // check boundaries
- if ( x->x_updateend > x->x_size-1 ) x->x_updateend = x->x_size-1;
- if ( x->x_updatestart < 0 ) x->x_updatestart = 0;
-
- // post("sonogram~ : ok, let's go [updating %d, %d]", x->x_updatestart, x->x_updateend );
-
- if ( x->x_erase )
- {
- for ( si=x->x_updatestart; si<=x->x_updateend; si++ )
- {
- sonogram_erase_block(x, x->x_glist, si);
- nbpoints++;
- percentage = (nbpoints*100/(x->x_updateend-x->x_updatestart+1));
- if ( (percentage == (int) percentage) && ((int)percentage%5 == 0) && ( percentage != opercentage ) )
- {
- // post( "sonogram~ : erase part : %d %% completed", (int)percentage );
- opercentage = percentage;
- }
- }
- }
-
- percentage = opercentage = nbpoints = 0;
-
- if ( x->x_redraw )
- {
- for ( si=x->x_updatestart; si<=x->x_updateend; si++ )
- {
- sonogram_update_block(x, x->x_glist, si);
- nbpoints++;
- percentage = (nbpoints*100/(x->x_updateend-x->x_updatestart+1));
- if ( (percentage == (int) percentage) && ((int)percentage%5 == 0) && ( percentage != opercentage ) )
- {
- // post( "sonogram~ : update part : %d %% completed", (int)percentage );
- opercentage = percentage;
- }
- }
- }
-
- // set borders in black
- SYS_VGUI3(".x%x.c itemconfigure %xSONOGRAM -outline #000000\n", glist_getcanvas(x->x_glist), x);
- if ( x->x_phaso )
- {
- SYS_VGUI3(".x%x.c itemconfigure %xPHASOGRAM -outline #000000\n", glist_getcanvas(x->x_glist), x);
- }
-
- // post("sonogram~ : child thread %d ended (nb_updated=%d)", (int)x->x_updatechild, x->x_nbupdated );
- x->x_updatechild = 0;
- return NULL;
-}
-
-static void sonogram_update_part(t_sonogram *x, t_glist *glist, t_int bstart, t_int bend,
- t_int erase, t_int redraw, t_int keepframe)
-{
- pthread_attr_t update_child_attr;
-
- if ( x->x_graphic )
- {
- if ( x->x_updatechild != 0 )
- {
- // post( "sonogram~ : error : no update is possible for now" );
- return;
- }
- x->x_updatestart = bstart;
- x->x_updateend = bend;
- if ( !keepframe )
- {
- x->x_erase = 0;
- }
- else
- {
- x->x_erase = erase;
- }
- x->x_redraw = redraw;
- x->x_nbupdated = 0;
- // recreate the square if needed
- if ( ( bstart == 0 ) && ( bend == x->x_size-1 ) && !keepframe )
- {
- SYS_VGUI3(".x%x.c delete %xSONOGRAM\n", glist_getcanvas(glist), x );
- SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill #FFFFFF -tags %xSONOGRAM\n",
- glist_getcanvas(glist), x->x_xpos-1, x->x_ypos-1,
- x->x_xpos + x->x_size*x->x_zoom+1,
- x->x_ypos + x->x_blocksize/2*x->x_zoom+1,
- x);
- SYS_VGUI2("image delete SONIMAGE%x\n", x );
- SYS_VGUI3(".x%x.c delete ISONIMAGE%x\n", glist_getcanvas(glist), x );
- SYS_VGUI4("image create photo SONIMAGE%x -format gif -width %d -height %d\n",
- x, x->x_size*x->x_zoom, x->x_blocksize/2*x->x_zoom );
- SYS_VGUI2("SONIMAGE%x blank\n", x);
- SYS_VGUI6(".x%x.c create image %d %d -image SONIMAGE%x -tags ISONIMAGE%x\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+((x->x_size*x->x_zoom)/2),
- (x->x_ypos+((x->x_blocksize/2*x->x_zoom)/2)), x, x );
- if ( x->x_phaso )
- {
- SYS_VGUI3(".x%x.c delete %xPHASOGRAM\n", glist_getcanvas(glist), x );
- SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill #FFFFFF -tags %xPHASOGRAM\n",
- glist_getcanvas(glist), x->x_xpos-1, x->x_ypos+x->x_blocksize/2*x->x_zoom+2,
- x->x_xpos + x->x_size*x->x_zoom +1,
- x->x_ypos + x->x_blocksize*x->x_zoom + 3,
- x);
- SYS_VGUI2("image delete FAZIMAGE%x\n", x );
- SYS_VGUI3(".x%x.c delete IFAZIMAGE%x\n", glist_getcanvas(glist), x );
- SYS_VGUI4("image create photo FAZIMAGE%x -format gif -width %d -height %d\n",
- x, x->x_size*x->x_zoom, x->x_blocksize/2*x->x_zoom );
- SYS_VGUI2("FAZIMAGE%x blank\n", x);
- SYS_VGUI6(".x%x.c create image %d %d -image FAZIMAGE%x -tags IFAZIMAGE%x\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+((x->x_size*x->x_zoom)/2),
- x->x_ypos+3*((x->x_blocksize/2*x->x_zoom)/2)+2, x, x );
- }
- canvas_fixlinesfor(x->x_glist, (t_text*)x );
- }
- // set borders in red
- SYS_VGUI3(".x%x.c itemconfigure %xSONOGRAM -outline #FF0000\n", glist_getcanvas(glist), x);
- if ( x->x_phaso )
- {
- SYS_VGUI3(".x%x.c itemconfigure %xPHASOGRAM -outline #FF0000\n", glist_getcanvas(glist), x);
- }
-
- // launch update thread
- if ( pthread_attr_init( &update_child_attr ) < 0 ) {
- post( "sonogram~ : could not launch update thread" );
- perror( "pthread_attr_init" );
- return;
- }
- if ( pthread_attr_setdetachstate( &update_child_attr, PTHREAD_CREATE_DETACHED ) < 0 ) {
- post( "sonogram~ : could not launch update thread" );
- perror( "pthread_attr_setdetachstate" );
- return;
- }
- if ( pthread_create( &x->x_updatechild, &update_child_attr, sonogram_do_update_part, x ) < 0 ) {
- post( "sonogram~ : could not launch update thread" );
- perror( "pthread_create" );
- return;
- }
- else
- {
- // post( "sonogram~ : drawing thread %d launched", (int)x->x_updatechild );
- }
- }
-}
-
- /* paste selection at the drawing point */
-static void sonogram_paste( t_sonogram* x)
-{
- t_int pxstart = (x->x_xdraw-x->x_xpos)/x->x_zoom;
- t_int pystart = (x->x_ypos-x->x_ydraw)/x->x_zoom+x->x_blocksize/2;
- t_int cxs,cxe,cys,cye,si=0,fi=0;
- t_float *icopy;
- t_float *rcopy;
- t_int copynd;
-
- if ( x->x_xstartcapture > x->x_xendcapture ) {
- fi = x->x_xstartcapture;
- x->x_xstartcapture = x->x_xendcapture;
- x->x_xendcapture = fi;
- }
- if ( x->x_ystartcapture > x->x_yendcapture ) {
- fi = x->x_ystartcapture;
- x->x_ystartcapture = x->x_yendcapture;
- x->x_yendcapture = fi;
- }
- cxs=(x->x_xstartcapture-x->x_xpos)/x->x_zoom;
- cxe=(x->x_xendcapture-x->x_xpos)/x->x_zoom;
- cys=(x->x_ypos-x->x_yendcapture)/x->x_zoom+x->x_blocksize/2;
- cye=(x->x_ypos-x->x_ystartcapture)/x->x_zoom+x->x_blocksize/2;
- if ( cye < 0 ) cye=0;
- if ( cys < 0 ) cys=0;
- if ( cye >= x->x_blocksize/2 ) cye=x->x_blocksize/2-1;
- if ( cys >= x->x_blocksize/2 ) cys=x->x_blocksize/2-1;
- if ( cxe >= x->x_size ) cxe=x->x_size-1;
- if ( cxs >= x->x_size ) cxs=x->x_size-1;
-
- // make a copy first
- icopy = ( t_float* ) getbytes( ( cxe-cxs+1 )*( cye-cys+1 )*sizeof( t_float ) );
- rcopy = ( t_float* ) getbytes( ( cxe-cxs+1 )*( cye-cys+1 )*sizeof( t_float ) );
- if ( !icopy || !rcopy )
- {
- post( "sonogram~ : cannot allocate buffers for pasting" );
- return;
- }
- // copy initial data
- copynd = 0;
- for ( si=cxs; si<=cxe; si++) {
- for ( fi=cys; fi<=cye; fi++) {
- *(rcopy+copynd) = *(x->x_rdata+(si)*x->x_blocksize+fi);
- *(icopy+copynd) = *(x->x_idata+(si)*x->x_blocksize+fi);
- copynd++;
- }
- }
-
- post( "sonogram~ : paste from [%d,%d,%d,%d] to [%d,%d]", cxs, cys, cxe, cye, pxstart, pystart );
-
- for ( si=cxs; si<=cxe; si++) {
- if ( pxstart+si-cxs >= x->x_size ) break;
- copynd = (si-cxs)*(cye-cys+1);
- for ( fi=cys; fi<=cye; fi++) {
- // post ( "sonogram~ : si : %d : fi : %d : copynd : %d", si, fi, copynd );
- if ( pystart+fi-cys >= x->x_blocksize/2 ) break;
- *(x->x_rudata+((si-cxs)*x->x_blocksize)+(fi-cys)) = *(x->x_rdata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys));
- *(x->x_iudata+((si-cxs)*x->x_blocksize)+(fi-cys)) = *(x->x_idata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys));
- if ( x->x_enhancemode )
- {
- // save data for undo
- *(x->x_rdata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys)) += *(rcopy+copynd);
- *(x->x_idata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys)) += *(icopy+copynd);
- }
- else
- {
- *(x->x_rdata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys)) = *(rcopy+copynd);
- *(x->x_idata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys)) = *(icopy+copynd);
- }
- copynd++;
- }
- }
-
- x->x_uxs = pxstart;
- x->x_uxe = pxstart+(si-1)-cxs;
- x->x_uys = pystart;
- x->x_uye = pystart+(fi-1)-cys;;
-
- freebytes( rcopy, ( cxe-cxs+1 )*( cye-cys+1 )*sizeof( t_float ) );
- freebytes( icopy, ( cxe-cxs+1 )*( cye-cys+1 )*sizeof( t_float ) );
-}
-
- /* paste phase at the drawing point */
-static void sonogram_paste_phase( t_sonogram* x)
-{
- t_int pxstart = (x->x_xdraw-x->x_xpos)/x->x_zoom;
- t_int pystart = (x->x_ypos+x->x_blocksize/2*x->x_zoom+1-x->x_ydraw)/x->x_zoom+x->x_blocksize/2;
- t_int cxs,cxe,cys,cye,si,fi;
- t_float fspectrum, fdestspectrum;
- t_float fphase, fdestphase;
- t_float *icopy;
- t_float *rcopy;
- t_int copynd;
-
- if ( x->x_xstartcapture > x->x_xendcapture ) {
- fi = x->x_xstartcapture;
- x->x_xstartcapture = x->x_xendcapture;
- x->x_xendcapture = fi;
- }
- if ( x->x_ystartcapture > x->x_yendcapture ) {
- fi = x->x_ystartcapture;
- x->x_ystartcapture = x->x_yendcapture;
- x->x_yendcapture = fi;
- }
- cxs=(x->x_xstartcapture-x->x_xpos)/x->x_zoom;
- cxe=(x->x_xendcapture-x->x_xpos)/x->x_zoom;
- cys=(x->x_ypos+x->x_blocksize/2*x->x_zoom+1-x->x_yendcapture)/x->x_zoom+x->x_blocksize/2;
- cye=(x->x_ypos+x->x_blocksize/2*x->x_zoom+1-x->x_ystartcapture)/x->x_zoom+x->x_blocksize/2;
- if ( cye < 0 ) cye=0;
- if ( cys < 0 ) cys=0;
- if ( cye >= x->x_blocksize/2 ) cye=x->x_blocksize/2-1;
- if ( cys >= x->x_blocksize/2 ) cys=x->x_blocksize/2-1;
- if ( cxe >= x->x_size ) cxe=x->x_size-1;
- if ( cxs >= x->x_size ) cxs=x->x_size-1;
-
- // make a copy first
- icopy = ( t_float* ) getbytes( ( cxe-cxs+1 )*( cye-cys+1 )*sizeof( t_float ) );
- rcopy = ( t_float* ) getbytes( ( cxe-cxs+1 )*( cye-cys+1 )*sizeof( t_float ) );
- if ( !icopy || !rcopy )
- {
- post( "sonogram~ : cannot allocate buffers for pasting" );
- return;
- }
- // copy initial data
- copynd = 0;
- for ( si=cxs; si<=cxe; si++) {
- for ( fi=cys; fi<=cye; fi++) {
- *(rcopy+copynd) = *(x->x_rdata+(si)*x->x_blocksize+fi);
- *(icopy+copynd) = *(x->x_idata+(si)*x->x_blocksize+fi);
- copynd++;
- }
- }
-
- post( "sonogram~ : paste phase from [%d,%d,%d,%d] to [%d,%d]", cxs, cys, cxe, cye, pxstart, pystart );
-
- for ( si=cxs; si<=cxe; si++) {
- if ( pxstart+si-cxs >= x->x_size ) break;
- copynd = (si-cxs)*(cye-cys+1);
- for ( fi=cys; fi<=cye; fi++) {
- if ( pystart+fi-cys > x->x_blocksize+1 ) break;
- fphase = atan2( *(icopy+copynd), *(rcopy+copynd) );
- fdestspectrum =
- sqrt( pow( *(x->x_rdata+(pxstart+si-cxs)*x->x_blocksize+(pystart+fi-cys)), 2) +
- pow( *(x->x_idata+(pxstart+si-cxs)*x->x_blocksize+(pystart+fi-cys)), 2) );
- fdestphase = atan2( *(x->x_idata+(pxstart+si-cxs)*x->x_blocksize+(pystart+fi-cys)),
- *(x->x_rdata+(pxstart+si-cxs)*x->x_blocksize+(pystart+fi-cys)) );
- if ( x->x_enhancemode )
- {
- *(x->x_rdata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys)) +=
- fdestspectrum*cos( fdestphase + fphase );
- *(x->x_idata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys)) +=
- fdestspectrum*sin( fdestphase + fphase );
- }
- else
- {
- *(x->x_rdata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys)) =
- fdestspectrum*cos( fphase );
- *(x->x_idata+((pxstart+si-cxs)*x->x_blocksize)+(pystart+fi-cys)) =
- fdestspectrum*sin( fphase );
- }
- copynd++;
- }
- }
-
- freebytes( rcopy, ( cxe-cxs+1 )*( cye-cys+1 )*sizeof( t_float ) );
- freebytes( icopy, ( cxe-cxs+1 )*( cye-cys+1 )*sizeof( t_float ) );
-
- sonogram_update_part(x, x->x_glist, pxstart, pxstart+(si-1)-cxs, 0, 1, 1);
- // start a new capture
- SYS_VGUI3( ".x%x.c delete %xCAPTURE\n", glist_getcanvas( x->x_glist ), x );
- x->x_xstartcapture = x->x_xdraw;
- x->x_ystartcapture = x->x_ydraw;
- x->x_xendcapture = x->x_xdraw;
- x->x_yendcapture = x->x_ydraw;
-
-}
-
-static void sonogram_draw_new(t_sonogram *x, t_glist *glist)
-{
- t_canvas *canvas=glist_getcanvas(glist);
-
- if ( x->x_xpos == -1 )
- {
- x->x_xpos=x->x_obj.te_xpix;
- x->x_ypos=x->x_obj.te_ypix;
- }
- if ( x->x_graphic )
- {
- SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill #FFFFFF -tags %xSONOGRAM\n",
- canvas, x->x_xpos-1, x->x_ypos-1,
- x->x_xpos + x->x_size*x->x_zoom+1,
- x->x_ypos + x->x_blocksize/2*x->x_zoom+1,
- x);
- SYS_VGUI4("image create photo SONIMAGE%x -format gif -width %d -height %d\n",
- x, x->x_size*x->x_zoom, x->x_blocksize/2*x->x_zoom );
- SYS_VGUI2("SONIMAGE%x blank\n", x);
- SYS_VGUI6(".x%x.c create image %d %d -image SONIMAGE%x -tags ISONIMAGE%x\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+((x->x_size*x->x_zoom)/2),
- (x->x_ypos+((x->x_blocksize/2*x->x_zoom)/2)), x, x );
- if ( x->x_phaso )
- {
- SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill #FFFFFF -tags %xPHASOGRAM\n",
- glist_getcanvas(glist), x->x_xpos-1, x->x_ypos+x->x_blocksize/2*x->x_zoom+2,
- x->x_xpos + x->x_size*x->x_zoom +1,
- x->x_ypos + x->x_blocksize*x->x_zoom + 3,
- x);
- SYS_VGUI4("image create photo FAZIMAGE%x -format gif -width %d -height %d\n",
- x, x->x_size*x->x_zoom, x->x_blocksize/2*x->x_zoom );
- SYS_VGUI2("FAZIMAGE%x blank\n", x);
- SYS_VGUI6(".x%x.c create image %d %d -image FAZIMAGE%x -tags IFAZIMAGE%x\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+((x->x_size*x->x_zoom)/2),
- x->x_ypos+3*((x->x_blocksize/2*x->x_zoom)/2)+2, x, x );
- }
- canvas_fixlinesfor( canvas, (t_text*)x );
- }
-}
-
-static void sonogram_draw_delete(t_sonogram *x, t_glist *glist)
-{
- if ( x->x_graphic && glist_isvisible( glist ) )
- {
- SYS_VGUI3( ".x%x.c delete %xCAPTURE\n", glist_getcanvas( glist ), x );
- SYS_VGUI3( ".x%x.c delete line %xREADSTART\n", glist_getcanvas( glist ), x);
- SYS_VGUI3( ".x%x.c delete line %xREADEND\n", glist_getcanvas( glist ), x);
- SYS_VGUI3( ".x%x.c delete line %xMODSTART\n", glist_getcanvas( glist ), x);
- SYS_VGUI3( ".x%x.c delete line %xMODEND\n", glist_getcanvas( glist ), x);
- SYS_VGUI3(".x%x.c delete %xSONOGRAM\n", glist_getcanvas( glist ), x );
- SYS_VGUI3(".x%x.c delete %xPHASOGRAM\n", glist_getcanvas( glist ), x );
- SYS_VGUI3(".x%x.c delete %xISONIMAGE\n", glist_getcanvas( glist ), x );
- SYS_VGUI2("image delete SONIMAGE%x\n", x );
- if ( x->x_phaso )
- {
- SYS_VGUI3(".x%x.c delete %xIFAZIMAGE\n", glist_getcanvas( glist ), x );
- SYS_VGUI2("image delete FAZIMAGE%x\n", x );
- }
- }
-}
-
-static void sonogram_draw_move(t_sonogram *x, t_glist *glist)
-{
- t_canvas *canvas=glist_getcanvas(glist);
-
- if ( x->x_graphic && glist_isvisible( x->x_glist ) )
- {
- SYS_VGUI7(".x%x.c coords %xSONOGRAM %d %d %d %d\n",
- canvas, x,
- x->x_xpos-1, x->x_ypos-1,
- x->x_xpos+x->x_size*x->x_zoom+1,
- x->x_ypos+x->x_blocksize/2*x->x_zoom+1);
- SYS_VGUI5(".x%x.c coords ISONIMAGE%x %d %d\n",
- canvas, x,
- x->x_xpos+((x->x_size*x->x_zoom)/2),
- (x->x_ypos+((x->x_blocksize/2*x->x_zoom)/2)) );
- if ( x->x_phaso )
- {
- SYS_VGUI7(".x%x.c coords %xPHASOGRAM %d %d %d %d\n",
- canvas, x,
- x->x_xpos-1, x->x_ypos+(x->x_blocksize/2*x->x_zoom)+1,
- x->x_xpos+x->x_size*x->x_zoom+1,
- x->x_ypos+x->x_blocksize*x->x_zoom+3);
- SYS_VGUI5(".x%x.c coords IFAZIMAGE%x %d %d\n",
- canvas, x,
- x->x_xpos+((x->x_size*x->x_zoom)/2),
- x->x_ypos+3*((x->x_blocksize/2*x->x_zoom)/2)+2 );
- }
- canvas_fixlinesfor( canvas, (t_text*)x );
- }
-}
-
-static void sonogram_draw_select(t_sonogram* x,t_glist* glist)
-{
- t_canvas *canvas=glist_getcanvas(glist);
-
- if ( x->x_graphic && glist_isvisible( x->x_glist ) )
- {
- if(x->x_selected)
- {
- /* sets the item in blue */
- SYS_VGUI3(".x%x.c itemconfigure %xSONOGRAM -outline #0000FF\n", canvas, x);
- if ( x->x_phaso )
- {
- SYS_VGUI3(".x%x.c itemconfigure %xPHASOGRAM -outline #0000FF\n", canvas, x);
- }
- }
- else
- {
- SYS_VGUI3(".x%x.c itemconfigure %xSONOGRAM -outline #000000\n", canvas, x);
- if ( x->x_phaso )
- {
- SYS_VGUI3(".x%x.c itemconfigure %xPHASOGRAM -outline #000000\n", canvas, x);
- }
- }
- }
-}
-
-/* ------------------------ widget callbacks ----------------------------- */
-
-
-static void sonogram_getrect(t_gobj *z, t_glist *owner,
- int *xp1, int *yp1, int *xp2, int *yp2)
-{
- t_sonogram* x = (t_sonogram*)z;
-
- *xp1 = x->x_xpos;
- *yp1 = x->x_ypos;
- if ( !x->x_phaso )
- {
- *xp2 = x->x_xpos+x->x_size*x->x_zoom;
- *yp2 = x->x_ypos+x->x_blocksize/2*x->x_zoom+1;
- }
- else
- {
- *xp2 = x->x_xpos+x->x_size*x->x_zoom;
- *yp2 = x->x_ypos+x->x_blocksize*x->x_zoom+3;
- }
-}
-
-static void sonogram_save(t_gobj *z, t_binbuf *b)
-{
- t_sonogram *x = (t_sonogram *)z;
-
- binbuf_addv(b, "ssiisiii", gensym("#X"),gensym("obj"),
- (t_int)x->x_xpos, (t_int)x->x_ypos,
- atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)),
- x->x_size, x->x_graphic, x->x_phaso );
- binbuf_addv(b, ";");
-}
-
-static void sonogram_select(t_gobj *z, t_glist *glist, int selected)
-{
- t_sonogram *x = (t_sonogram *)z;
-
- x->x_selected = selected;
- sonogram_draw_select( x, glist );
-}
-
-static void sonogram_vis(t_gobj *z, t_glist *glist, int vis)
-{
- t_sonogram *x = (t_sonogram *)z;
- t_rtext *y;
-
- if (vis)
- {
- sonogram_draw_new( x, glist );
- }
- else
- {
- // erase all points
- sonogram_draw_delete( x, glist );
- }
-}
-
-static void sonogram_delete(t_gobj *z, t_glist *glist)
-{
- canvas_deletelinesfor(glist, (t_text *)z);
-}
-
-static void sonogram_displace(t_gobj *z, t_glist *glist, int dx, int dy)
-{
- t_sonogram *x = (t_sonogram *)z;
- int xold = x->x_xpos;
- int yold = x->x_ypos;
-
- x->x_xpos += dx;
- x->x_ypos += dy;
-
- if ( ( x->x_xpos != xold ) || ( x->x_ypos != yold ) )
- {
- sonogram_draw_move( x, glist );
- }
-
-}
-
-static void sonogram_modify_point( t_sonogram* x, t_int sample, t_int frequency, t_int alted )
-{
- if ( alted )
- {
- *(x->x_rdata+(sample*x->x_blocksize)+frequency) = 0;
- *(x->x_idata+(sample*x->x_blocksize)+frequency) = 0;
- }
- else
- {
- if ( x->x_enhancemode )
- {
- *(x->x_rdata+(sample*x->x_blocksize)+frequency) *= x->x_modstep;
- *(x->x_idata+(sample*x->x_blocksize)+frequency) *= x->x_modstep;
- }
- else
- {
- *(x->x_rdata+(sample*x->x_blocksize)+frequency) += x->x_modstep;
- *(x->x_idata+(sample*x->x_blocksize)+frequency) += x->x_modstep;
- }
- }
-}
-
-static void sonogram_modify_point_phase( t_sonogram* x, t_int sample, t_int frequency, t_int alted )
-{
- t_float fspectrum;
- t_float fphase;
-
- fspectrum =
- sqrt( pow( *(x->x_rdata+sample*x->x_blocksize+frequency), 2) +
- pow( *(x->x_idata+sample*x->x_blocksize+frequency), 2) );
- fphase = atan2( *(x->x_idata+sample*x->x_blocksize+frequency),
- *(x->x_rdata+sample*x->x_blocksize+frequency) );
- if ( alted==4 )
- {
- // setting phase to 0
- *(x->x_rdata+(sample*x->x_blocksize)+frequency) = fspectrum;
- *(x->x_idata+(sample*x->x_blocksize)+frequency) = 0;
- }
- else
- {
- if ( x->x_enhancemode )
- {
- *(x->x_rdata+(sample*x->x_blocksize)+frequency) = fspectrum*cos( fphase*x->x_modstep );
- *(x->x_idata+(sample*x->x_blocksize)+frequency) = fspectrum*sin( fphase*x->x_modstep );
- }
- else
- {
- *(x->x_rdata+(sample*x->x_blocksize)+frequency) = fspectrum*cos( fphase+x->x_modstep );
- *(x->x_idata+(sample*x->x_blocksize)+frequency) = fspectrum*sin( fphase+x->x_modstep );
- }
- }
-}
-
-static void sonogram_motion(t_sonogram *x, t_floatarg dx, t_floatarg dy)
-{
- int fdraw=0, sdraw=0;
-
- // post( "sonogram_motion @ [%d,%d] dx=%f dy=%f alt=%d", x->x_xdraw, x->x_ydraw, dx, dy, x->x_alted );
- if ( ( x->x_shifted || (x->x_alted==4) ) )
- {
- if ( (x->x_xdraw+dx) >= x->x_xpos &&
- (x->x_xdraw+dx) <= x->x_xpos+x->x_size*x->x_zoom ) {
- x->x_xdraw += dx;
- }
- if ( (x->x_ydraw+dy) >= x->x_ypos &&
- (x->x_ydraw+dy) <= x->x_ypos+x->x_blocksize*x->x_zoom ) {
- x->x_ydraw += dy;
- }
- sdraw=(x->x_xdraw-x->x_xpos)/x->x_zoom;
- if ( x->x_ydraw <= x->x_ypos+x->x_blocksize/2*x->x_zoom )
- {
- fdraw=(x->x_ypos-x->x_ydraw)/x->x_zoom+x->x_blocksize/2;
- // post( "modify point @ [%d, %d] alted=%d", sdraw, fdraw, x->x_alted );
- sonogram_modify_point( x, sdraw, fdraw, x->x_alted );
- }
- if ( x->x_ydraw >= x->x_ypos+x->x_blocksize/2*x->x_zoom+1 )
- {
- fdraw=(x->x_ypos+x->x_blocksize*x->x_zoom/2+1-x->x_ydraw)/x->x_zoom+x->x_blocksize/2;
- // post( "modify phase @ [%d, %d]", sdraw, fdraw );
- sonogram_modify_point_phase( x, sdraw, fdraw, x->x_alted );
- }
- sonogram_update_point( x, x->x_glist, sdraw, fdraw );
- }
- else
- {
- if ( (x->x_xendcapture+dx) >= x->x_xpos &&
- (x->x_xendcapture+dx) <= x->x_xpos+x->x_size*x->x_zoom ) {
- x->x_xendcapture += dx;
- }
- if ( (x->x_yendcapture+dy) >= x->x_ypos &&
- (x->x_yendcapture+dy) <= x->x_ypos+x->x_blocksize*x->x_zoom ) {
- x->x_yendcapture += dy;
- }
- SYS_VGUI3( ".x%x.c delete %xCAPTURE\n", glist_getcanvas( x->x_glist ), x );
- SYS_VGUI7( ".x%x.c create rectangle %d %d %d %d -outline #0000FF -tags %xCAPTURE\n",
- glist_getcanvas( x->x_glist ), x->x_xstartcapture,
- x->x_ystartcapture, x->x_xendcapture, x->x_yendcapture, x );
- }
-}
-
-static int sonogram_click(t_gobj *z, struct _glist *glist,
- int xpix, int ypix, int shift, int alt, int dbl, int doit)
-{
- t_sonogram* x = (t_sonogram *)z;
- int si,fi;
-
- // post( "sonogram_click : x=%d y=%d doit=%d alt=%d, shift=%d", xpix, ypix, doit, alt, shift );
- if ( x->x_aftermousedown == 1 && doit == 0)
- {
- x->x_aftermousedown = 1;
- }
- else
- {
- x->x_aftermousedown = 0;
- }
- if ( doit )
- {
- x->x_xdraw = xpix;
- x->x_ydraw = ypix;
- x->x_shifted = shift;
- x->x_alted = alt;
- // activate motion callback
- glist_grab( glist, &x->x_obj.te_g, (t_glistmotionfn)sonogram_motion,
- 0, xpix, ypix );
-
- if ( shift && alt && (x->x_xstartcapture != x->x_xendcapture ) )
- {
- sonogram_paste(x);
- sonogram_paste_phase(x);
- }
- else if ( shift && (x->x_xstartcapture != x->x_xendcapture ) )
- {
- // add or multiply modstep
- if ( x->x_xstartcapture > x->x_xendcapture ) {
- fi = x->x_xstartcapture;
- x->x_xstartcapture = x->x_xendcapture;
- x->x_xendcapture = fi;
- }
- if ( x->x_ystartcapture > x->x_yendcapture ) {
- fi = x->x_ystartcapture;
- x->x_ystartcapture = x->x_yendcapture;
- x->x_yendcapture = fi;
- }
- for ( si=(x->x_xstartcapture-x->x_xpos)/x->x_zoom;
- si<=(x->x_xendcapture-x->x_xpos)/x->x_zoom; si++) {
- for ( fi=(x->x_ypos-x->x_yendcapture)/x->x_zoom+x->x_blocksize/2;
- fi<=(x->x_ypos-x->x_ystartcapture)/x->x_zoom+x->x_blocksize/2; fi++) {
- sonogram_modify_point( x, si, fi, alt );
- }
- for ( fi=(x->x_ypos+x->x_blocksize/2*x->x_zoom+1-x->x_yendcapture)/x->x_zoom+x->x_blocksize/2;
- fi<=(x->x_ypos+x->x_blocksize/2*x->x_zoom+1-x->x_ystartcapture)/x->x_zoom+x->x_blocksize/2; fi++) {
- sonogram_modify_point_phase( x, si, fi, alt );
- }
- }
- // post( "modified y from %d to %d", (x->x_ypos-x->x_yendcapture)/x->x_zoom+x->x_blocksize/2,
- // (x->x_ypos-x->x_ystartcapture)/x->x_zoom+x->x_blocksize/2 );
- sonogram_update_part(x, x->x_glist, (x->x_xstartcapture-x->x_xpos)/x->x_zoom,
- (x->x_xendcapture-x->x_xpos)/x->x_zoom, 0, 1, 1);
- }
- else if ( (alt==4) && (x->x_xstartcapture != x->x_xendcapture ) )
- {
- // clean up area
- if ( x->x_xstartcapture > x->x_xendcapture ) {
- fi = x->x_xstartcapture;
- x->x_xstartcapture = x->x_xendcapture;
- x->x_xendcapture = fi;
- }
- if ( x->x_ystartcapture > x->x_yendcapture ) {
- fi = x->x_ystartcapture;
- x->x_ystartcapture = x->x_yendcapture;
- x->x_yendcapture = fi;
- }
- for ( si=(x->x_xstartcapture-x->x_xpos)/x->x_zoom;
- si<=(x->x_xendcapture-x->x_xpos)/x->x_zoom; si++) {
- for ( fi=(x->x_ypos-x->x_yendcapture)/x->x_zoom+x->x_blocksize/2;
- fi<=(x->x_ypos-x->x_ystartcapture)/x->x_zoom+x->x_blocksize/2; fi++) {
- sonogram_modify_point( x, si, fi, alt );
- }
- for ( fi=(x->x_ypos+x->x_blocksize/2*x->x_zoom+1-x->x_yendcapture)/x->x_zoom+x->x_blocksize/2;
- fi<=(x->x_ypos+x->x_blocksize/2*x->x_zoom+1-x->x_ystartcapture)/x->x_zoom+x->x_blocksize/2; fi++) {
- sonogram_modify_point_phase( x, si, fi, alt );
- }
- }
- sonogram_update_part(x, x->x_glist, (x->x_xstartcapture-x->x_xpos)/x->x_zoom,
- (x->x_xendcapture-x->x_xpos)/x->x_zoom, 0, 1, 1);
- }
- // start a new capture
- SYS_VGUI3( ".x%x.c delete %xCAPTURE\n", glist_getcanvas( x->x_glist ), x );
- x->x_xstartcapture = xpix;
- x->x_ystartcapture = ypix;
- x->x_xendcapture = xpix;
- x->x_yendcapture = ypix;
- }
- else
- {
- // nothing
- }
- x->x_aftermousedown = doit;
- return (1);
-}
-
- /* clean up */
-static void sonogram_free(t_sonogram *x)
-{
- if ( x->x_rdata != NULL ) {
- freebytes(x->x_rdata, x->x_size*x->x_blocksize*sizeof(float) );
- post( "Freed %d bytes", x->x_size*x->x_blocksize*sizeof(float) );
- x->x_rdata = NULL;
- }
- if ( x->x_idata != NULL ) {
- freebytes(x->x_idata, x->x_size*x->x_blocksize*sizeof(float) );
- post( "Freed %d bytes", x->x_size*x->x_blocksize*sizeof(float) );
- x->x_idata = NULL;
- }
- if ( x->x_rudata != NULL ) {
- freebytes(x->x_rudata, x->x_size*x->x_blocksize*sizeof(float) );
- post( "Freed %d bytes", x->x_size*x->x_blocksize*sizeof(float) );
- x->x_rdata = NULL;
- }
- if ( x->x_iudata != NULL ) {
- freebytes(x->x_iudata, x->x_size*x->x_blocksize*sizeof(float) );
- post( "Freed %d bytes", x->x_size*x->x_blocksize*sizeof(float) );
- x->x_idata = NULL;
- }
- if ( x->x_gifdata != NULL ) {
- freebytes(x->x_gifdata, (x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- post( "Freed %d bytes", (x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- x->x_gifdata = NULL;
- }
- if ( x->x_guicommand != NULL ) {
- freebytes(x->x_guicommand, 128+(x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- post( "Freed %d bytes", 128+(x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- x->x_guicommand = NULL;
- }
-}
-
- /* allocate tables for storing ffts */
-static t_int sonogram_allocate(t_sonogram *x)
-{
- t_int fi;
-
- if ( !(x->x_rdata = getbytes( x->x_size*x->x_blocksize*sizeof(float) ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return -1;
- } else {
- post( "sonogram~ : allocated %d bytes", x->x_size*x->x_blocksize*sizeof(float) );
- }
- if ( !(x->x_idata = getbytes( x->x_size*x->x_blocksize*sizeof(float) ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return -1;
- } else {
- post( "sonogram~ : allocated %d bytes", x->x_size*x->x_blocksize*sizeof(float) );
- }
- if ( !(x->x_multfreq = getbytes( x->x_blocksize*sizeof(t_int) ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return -1;
- } else {
- post( "sonogram~ : allocated %d bytes", x->x_blocksize*sizeof(t_int) );
- }
- for ( fi=0; fi<x->x_blocksize; fi++ )
- {
- *(x->x_multfreq+fi)=1;
- }
- // no undo is available
- x->x_uxs = x->x_uxe = x->x_uys = x->x_uye = -1;
- if ( !(x->x_rudata = getbytes( x->x_size*x->x_blocksize*sizeof(float) ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return -1;
- } else {
- post( "sonogram~ : allocated %d bytes", x->x_size*x->x_blocksize*sizeof(float) );
- }
- if ( !(x->x_iudata = getbytes( x->x_size*x->x_blocksize*sizeof(float) ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return -1;
- } else {
- post( "sonogram~ : allocated %d bytes", x->x_size*x->x_blocksize*sizeof(float) );
- }
- if ( !( x->x_gifdata = ( char* ) getbytes( (x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return -1;
- } else {
- post( "sonogram~ : allocated %d bytes", (x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- }
- if ( !( x->x_guicommand = ( char* ) getbytes( 128+(x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return -1;
- } else {
- post( "sonogram~ : allocated %d bytes", 128+(x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- }
-
- return 0;
-}
-
- /* records or playback the sonogram */
-static t_int *sonogram_perform(t_int *w)
-{
- t_float *rin = (t_float *)(w[1]);
- t_float *iin = (t_float *)(w[2]);
- t_float *rout = (t_float *)(w[3]);
- t_float *iout = (t_float *)(w[4]);
- t_float fspectrum = 0.0;
- t_float fphase = 0.0;
- t_int is;
- t_int n = (int)(w[5]); /* number of samples */
- t_sonogram *x = (t_sonogram *)(w[6]);
- t_int bi;
-
- // reallocate tables if blocksize has been changed
- if ( n != x->x_blocksize && x->x_updatechild == 0 ) {
- post( "sonogram~ : reallocating tables" );
- // erase all points
- sonogram_free(x);
- x->x_blocksize = n;
- sonogram_allocate(x);
- sonogram_update_part(x, x->x_glist, 0, x->x_size-1, !x->x_empty, 0, 0);
- canvas_fixlinesfor(x->x_glist, (t_text*)x );
- }
-
- bi = 0;
- while (bi<n)
- {
- // eventually records input
- if ( x->x_record) {
- *(x->x_rdata+(x->x_writepos*x->x_blocksize)+bi)=(*(rin))*(*(x->x_multfreq+bi));
- *(x->x_idata+(x->x_writepos*x->x_blocksize)+bi)=(*(iin))*(*(x->x_multfreq+bi));
- }
- // set outputs
- *rout = 0.0;
- *iout = 0.0;
- if ( x->x_play) {
- is=0;
- fspectrum =
- sqrt( pow( *(x->x_rdata+(((int)x->x_readpos+is)*x->x_blocksize)+bi), 2) +
- pow( *(x->x_idata+(((int)x->x_readpos+is)*x->x_blocksize)+bi), 2) );
- fphase = atan2( *(x->x_idata+(((int)x->x_readpos+is)*x->x_blocksize)+bi),
- *(x->x_rdata+(((int)x->x_readpos+is)*x->x_blocksize)+bi) );
- fphase += (x->x_phase/180.0)*(M_PI);
- *rout += fspectrum*cos( fphase );
- *iout += fspectrum*sin( fphase );
- }
- rout++;iout++;
- rin++;iin++;
- bi++;
-
- }
- // reset playing position until next play
- if ( x->x_play ) {
- x->x_readpos+=x->x_readspeed;
- // post( "xreadpos : %f (added %f)", x->x_readpos, x->x_readspeed );
- if ( x->x_readpos >= (x->x_readend*x->x_size)/100 ) {
- x->x_play=0;
- x->x_readpos=(x->x_readstart*x->x_size)/100;
- // post( "sonogram~ : stopped playing (readpos=%d)", x->x_readpos );
- outlet_bang(x->x_end);
- }
- }
- // reset recording position until next record
- if ( x->x_record ) {
- x->x_writepos++;
- if ( x->x_writepos >= x->x_size ) {
- x->x_record=0;
- x->x_writepos=0;
- sonogram_update_part(x, x->x_glist, 0, x->x_size-1, 0, 1, 0);
- outlet_bang(x->x_recend);
- if ( x->x_empty ) x->x_empty = 0;
- // post( "sonogram~ : stopped recording" );
- }
- }
- // post( "sonogram~ : read : %f:%d : write: %d:%d", x->x_readpos, x->x_play, x->x_writepos, x->x_record );
- return (w+7);
-}
-
-static void sonogram_dsp(t_sonogram *x, t_signal **sp)
-{
- dsp_add(sonogram_perform, 6, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec, sp[0]->s_n, x);
-}
-
- /* record the sonogram */
-static void sonogram_record(t_sonogram *x)
-{
- x->x_record=1;
- x->x_writepos=0;
- // post( "sonogram~ : recording on" );
-}
-
- /* play the sonogram */
-static void sonogram_play(t_sonogram *x)
-{
- x->x_play=1;
- x->x_readpos=(x->x_readstart*x->x_size)/100;
- // post( "sonogram~ : playing on" );
-}
-
- /* setting the starting point for reading ( in percent ) */
-static void sonogram_readstart(t_sonogram *x, t_floatarg fstart)
-{
- t_float startpoint = fstart;
-
- if (startpoint < 0) startpoint = 0;
- if (startpoint > 100) startpoint = 100;
- if ( startpoint > x->x_readend ) {
- x->x_readstart = x->x_readend;
- post( "sonogram~ : warning : range for reading is null" );
- } else {
- x->x_readstart=startpoint;
- }
- if ( x->x_graphic && glist_isvisible( x->x_glist ) )
- {
- SYS_VGUI3( ".x%x.c delete line %xREADSTART\n",
- glist_getcanvas( x->x_glist ), x);
- SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #FF0000 -tags %xREADSTART -width 3\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+(x->x_readstart*(x->x_size)/100 ),
- x->x_ypos, x->x_xpos+(x->x_readstart*(x->x_size)/100 ),
- x->x_ypos+x->x_blocksize*x->x_zoom, x );
- }
-}
-
- /* setting the starting point for modification ( in percent ) */
-static void sonogram_modstart(t_sonogram *x, t_floatarg fstart)
-{
- t_float startpoint = fstart;
-
- if (startpoint < 0) startpoint = 0;
- if (startpoint > 100) startpoint = 100;
- if ( startpoint > x->x_modend ) {
- x->x_modstart = x->x_modend;
- post( "sonogram~ : warning : range for modifications is null" );
- } else {
- x->x_modstart=startpoint;
- }
- if ( x->x_graphic && glist_isvisible( x->x_glist ) )
- {
- SYS_VGUI3( ".x%x.c delete line %xMODSTART\n",
- glist_getcanvas( x->x_glist ), x);
- SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #11E834 -tags %xMODSTART -width 3\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+(x->x_modstart*(x->x_size)/100 ),
- x->x_ypos, x->x_xpos+(x->x_modstart*(x->x_size)/100 ),
- x->x_ypos+x->x_blocksize*x->x_zoom, x );
- }
-}
-
- /* setting the modification step for graphical mode */
-static void sonogram_modstep(t_sonogram *x, t_floatarg fmodstep)
-{
- if ( x->x_graphic )
- {
- x->x_modstep = fmodstep;
- }
-}
-
- /* setting enhance mode */
-static void sonogram_enhancemode(t_sonogram *x, t_floatarg fenhancemode)
-{
- if ( x->x_graphic )
- {
- x->x_enhancemode = fenhancemode;
- }
-}
-
- /* setting the ending point for reading ( in percent ) */
-static void sonogram_readend(t_sonogram *x, t_floatarg fend)
-{
- t_float endpoint = fend;
-
- if (endpoint < 0) endpoint = 0;
- if (endpoint > 100) endpoint = 100;
- if ( endpoint < x->x_readstart ) {
- x->x_readend = x->x_readstart;
- post( "sonogram~ : warning : range for reading is null" );
- } else {
- x->x_readend=endpoint;
- }
- if ( x->x_graphic && glist_isvisible( x->x_glist ) )
- {
- SYS_VGUI3( ".x%x.c delete line %xREADEND\n",
- glist_getcanvas( x->x_glist ), x);
- SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #FF0000 -tags %xREADEND -width 3\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+(x->x_readend*(x->x_size)/100 ),
- x->x_ypos, x->x_xpos+(x->x_readend*(x->x_size)/100 ),
- x->x_ypos+x->x_blocksize*x->x_zoom, x );
- }
-}
-
- /* setting the ending point for modification ( in percent ) */
-static void sonogram_modend(t_sonogram *x, t_floatarg fend)
-{
- t_float endpoint = fend;
-
- if (endpoint < 0) endpoint = 0;
- if (endpoint > 100) endpoint = 100;
- if ( endpoint < x->x_modstart ) {
- x->x_modend = x->x_modstart;
- post( "sonogram~ : warning : range for modifications is null" );
- } else {
- x->x_modend=endpoint;
- }
- if ( x->x_graphic && glist_isvisible( x->x_glist ) )
- {
- SYS_VGUI3( ".x%x.c delete line %xMODEND\n",
- glist_getcanvas( x->x_glist ), x);
- SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #11E834 -tags %xMODEND -width 3\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+(x->x_modend*(x->x_size)/100 ),
- x->x_ypos, x->x_xpos+(x->x_modend*(x->x_size)/100 ),
- x->x_ypos+x->x_blocksize*x->x_zoom, x );
- }
-}
-
- /* sets the reading speed */
-static void sonogram_readspeed(t_sonogram *x, t_floatarg freadspeed)
-{
- if (freadspeed <= 0 ) {
- post( "sonogram~ : wrong readspeed argument" );
- return;
- }
- x->x_readspeed=freadspeed;
-}
-
- /* enhance frequencies */
-static void sonogram_enhance(t_sonogram *x, t_floatarg fstartfreq, t_floatarg fendfreq, t_floatarg fenhance, t_floatarg fnoupdate )
-{
- t_int samplestart, sampleend, si, fi=0, ffi=0;
- t_float oldenergy;
-
- if (fstartfreq < 0 || fendfreq < 0 ||
- fstartfreq > x->x_blocksize || fendfreq > x->x_blocksize ||
- fstartfreq > fendfreq ) {
- post( "sonogram~ : error : wrong frequencies range" );
- return;
- }
- if ( fenhance < 0 ) {
- post( "sonogram~ : error : wrong multiplicating factor" );
- return;
- }
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
- // post("enhancing portion [%d,%d]", samplestart, sampleend );
- for ( si=samplestart; si<=sampleend; si++ ) {
- for ( fi=(int)fstartfreq; fi<=(int)fendfreq; fi++ ) {
- *(x->x_multfreq+fi) = fenhance;
- if ( (fi != 0) && (fi != x->x_blocksize/2-1) )
- {
- /* multiply both r*sin(a) and r*cos(a) to mutiply r */
- *(x->x_rdata+(si*x->x_blocksize)+fi) *= fenhance;
- *(x->x_idata+(si*x->x_blocksize)+fi) *= fenhance;
- }
- }
- }
- // post( "sonogram~ : enhanced %d,%d", fi, ffi );
- if ( !(int)fnoupdate )
- {
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
- }
-}
-
- /* add a constant to frequencies */
-static void sonogram_add(t_sonogram *x, t_floatarg fstartfreq, t_floatarg fendfreq, t_floatarg fadd)
-{
- t_int samplestart, sampleend, si, fi;
- t_float oldenergy;
-
- if (fstartfreq < 0 || fendfreq < 0 ||
- fstartfreq > x->x_blocksize || fendfreq > x->x_blocksize ||
- fstartfreq > fendfreq ) {
- post( "sonogram~ : error : wrong frequencies range" );
- return;
- }
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
- // post("enhancing portion [%d,%d]", samplestart, sampleend );
- for ( si=samplestart; si<=sampleend; si++ ) {
- for ( fi=(int)fstartfreq; fi<=(int)fendfreq; fi++ ) {
- /* multiply both r*sin(a) and r*cos(a) to mutiply r */
- *(x->x_rdata+(si*x->x_blocksize)+fi) += fadd;
- *(x->x_idata+(si*x->x_blocksize)+fi) += fadd;
- }
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* resize sonogram */
-static void sonogram_resize(t_sonogram *x, t_floatarg fnewsize )
-{
- if (fnewsize <= 0) {
- post( "sonogram~ : error : wrong size" );
- return;
- }
- if (x->x_updatechild > 0) {
- post( "sonogram~ : can't resize now, an update is pending." );
- return;
- }
- post( "sonogram~ : reallocating tables" );
- x->x_record = 0;
- x->x_play = 0;
- sonogram_free(x);
- x->x_size = fnewsize;
- sonogram_allocate(x);
- // erase all points, as data is zero no drawing is needed
- sonogram_update_part(x, x->x_glist, 0, x->x_size-1, 0, 0, 0);
-}
-
- /* set zoom factor */
-static void sonogram_zoom(t_sonogram *x, t_floatarg fzoom )
-{
- post( "sonogram~: warning : zoom and big block factors might lead to a crash" );
- if (fzoom < 1) {
- post( "sonogram~ : error : wrong zoom factor" );
- return;
- }
- if ( x->x_gifdata != NULL ) {
- freebytes(x->x_gifdata, (x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- post( "Freed %d bytes", (x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- x->x_gifdata = NULL;
- }
- if ( x->x_guicommand != NULL ) {
- freebytes(x->x_guicommand, 128+(x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- post( "Freed %d bytes", 128+(x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- x->x_guicommand = NULL;
- }
- x->x_zoom = (int)fzoom;
- if ( !( x->x_gifdata = ( char* ) getbytes( (x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return;
- } else {
- post( "sonogram~ : allocated %d bytes", (x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- }
- if ( !( x->x_guicommand = ( char* ) getbytes( 128+(x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") ) ) ) {
- post( "sonogram~ : error : could not allocate buffers" );
- return;
- } else {
- post( "sonogram~ : allocated %d bytes", 128+(x->x_blocksize/2)*x->x_zoom*sizeof("#FFFFFF ") );
- }
- sonogram_update_part(x, x->x_glist, 0, x->x_size-1, !x->x_empty, !x->x_empty, 0);
- canvas_fixlinesfor(x->x_glist, (t_text*)x );
-}
-
- /* refresh data */
-static void sonogram_refresh(t_sonogram *x)
-{
- sonogram_update_part(x, x->x_glist, 0, x->x_size-1, 0, 1, 1);
-}
-
- /* flip frequencies */
-static void sonogram_flipfreqs(t_sonogram *x)
-{
- t_int samplestart, sampleend, si, fi;
- t_float fvalue;
- t_int ioperon;
-
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
- ioperon=x->x_blocksize/2;
- for ( si=samplestart; si<=sampleend; si++ ) {
- for ( fi=0; fi<=ioperon/2; fi++ ) {
- fvalue = *(x->x_rdata+(si*x->x_blocksize)+fi);
- *(x->x_rdata+(si*x->x_blocksize)+fi) = *(x->x_rdata+(si*x->x_blocksize)+(ioperon-fi-1));
- *(x->x_rdata+(si*x->x_blocksize)+(ioperon-fi-1)) = fvalue;
- fvalue = *(x->x_idata+(si*x->x_blocksize)+fi);
- *(x->x_idata+(si*x->x_blocksize)+fi) = *(x->x_idata+(si*x->x_blocksize)+(ioperon-fi-1));
- *(x->x_idata+(si*x->x_blocksize)+(ioperon-fi-1)) = fvalue;
- }
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* flip blocks */
-static void sonogram_flipblocks(t_sonogram *x)
-{
- t_int samplestart, sampleend, middlesample, fi, si;
- t_float fvalue;
-
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
- middlesample = ( sampleend+samplestart+1 ) / 2;
- for ( si=samplestart; si<=middlesample; si++ ) {
- for ( fi=0; fi<x->x_blocksize; fi++ ) {
- fvalue = *(x->x_rdata+((si)*x->x_blocksize)+fi);
- *(x->x_rdata+((si)*x->x_blocksize)+fi) = *(x->x_rdata+((sampleend+samplestart-si)*x->x_blocksize)+fi);
- *(x->x_rdata+((sampleend+samplestart-si)*x->x_blocksize)+fi) = fvalue;
- fvalue = *(x->x_idata+((si)*x->x_blocksize)+fi);
- *(x->x_idata+((si)*x->x_blocksize)+fi) = *(x->x_idata+((sampleend+samplestart-si)*x->x_blocksize)+fi);
- *(x->x_idata+((sampleend+samplestart-si)*x->x_blocksize)+fi) = fvalue;
- }
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* undo if available */
-static void sonogram_undo(t_sonogram *x)
-{
- t_int si,fi;
-
- if ( x->x_uxs == -1 )
- {
- post( "sonogram~ : nothing to undo, man" );
- return;
- }
-
- post( "sonogram~ : restoring region [%d,%d,%d,%d]", x->x_uxs, x->x_uys, x->x_uxe, x->x_uye );
- for ( si=x->x_uxs; si<=x->x_uxe; si++ ) {
- for ( fi=x->x_uys; fi<=x->x_uye; fi++ ) {
- *(x->x_rdata+((si)*x->x_blocksize)+fi) = *(x->x_rudata+(si-x->x_uxs)*x->x_blocksize+(fi-x->x_uys));
- *(x->x_idata+((si)*x->x_blocksize)+fi) = *(x->x_iudata+(si-x->x_uxs)*x->x_blocksize+(fi-x->x_uys));
- }
- }
- sonogram_update_part(x, x->x_glist, x->x_uxs, x->x_uxe, 0, 1, 1);
-}
-
- /* zswap exchanges real and imaginery part */
-static void sonogram_zswap(t_sonogram *x)
-{
- t_int samplestart, sampleend, fi, si;
- t_float fvalue;
-
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
- for ( si=samplestart; si<=sampleend; si++ ) {
- for ( fi=0; fi<x->x_blocksize; fi++ ) {
- fvalue = *(x->x_rdata+(si*x->x_blocksize)+fi);
- *(x->x_rdata+(si*x->x_blocksize)+fi) = *(x->x_idata+(si*x->x_blocksize)+fi);
- *(x->x_idata+(si*x->x_blocksize)+fi) = fvalue;
- }
- }
-}
-
- /* swap points */
-static void sonogram_swappoints(t_sonogram *x, t_floatarg fnbpoints)
-{
- t_int samplestart, sampleend, sp;
- t_float s1, s2, f1, f2;
- t_float fvalue;
-
- if (fnbpoints <= 0) {
- post( "sonogram~ : error : bad number of points" );
- return;
- }
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
-
- for ( sp=0; sp<fnbpoints; sp++ ) {
- s1 = samplestart + (random()%(sampleend-samplestart));
- s2 = samplestart + (random()%(sampleend-samplestart));
- f1 = random()%( x->x_blocksize/2-1 );
- f2 = random()%( x->x_blocksize/2-1 );
- fvalue = *(x->x_rdata+((int)s1*x->x_blocksize)+(int)f1);
- *(x->x_rdata+((int)s1*x->x_blocksize)+(int)f1) = *(x->x_rdata+((int)s2*x->x_blocksize)+(int)f2);
- *(x->x_rdata+((int)s2*x->x_blocksize)+(int)f2) = fvalue;
- fvalue = *(x->x_idata+((int)s1*x->x_blocksize)+(int)f1);
- *(x->x_idata+((int)s1*x->x_blocksize)+(int)f1) = *(x->x_idata+((int)s2*x->x_blocksize)+(int)f2);
- *(x->x_idata+((int)s2*x->x_blocksize)+(int)f2) = fvalue;
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* average blocks according to a factor */
-static void sonogram_average(t_sonogram *x, t_floatarg fnbblocks)
-{
- t_int samplestart, sampleend, fi, si, ssi;
- t_float fraverage, fiaverage;
-
- if (fnbblocks < 1) {
- post( "sonogram~ : error : bad average factor" );
- return;
- }
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
-
- fraverage=fiaverage=0.0;
- for ( fi=0; fi<x->x_blocksize; fi++ ) {
- for ( si=samplestart; si<=sampleend-fnbblocks; si+=fnbblocks ) {
- fraverage=fiaverage=0.0;
- for ( ssi=0; ssi<fnbblocks; ssi++ ) {
- fraverage += *(x->x_rdata+((int)(si+ssi)*x->x_blocksize)+fi);
- fiaverage += *(x->x_idata+((int)(si+ssi)*x->x_blocksize)+fi);
- }
- fraverage /= fnbblocks;
- fiaverage /= fnbblocks;
- for ( ssi=0; ssi<fnbblocks; ssi++ ) {
- *(x->x_rdata+((int)(si+ssi)*x->x_blocksize)+fi)=fraverage;
- *(x->x_idata+((int)(si+ssi)*x->x_blocksize)+fi)=fiaverage;
- }
- }
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* go up by the given number */
-static void sonogram_goup(t_sonogram *x, t_floatarg fgoup)
-{
- t_int samplestart, sampleend, sp, sf;
-
- if (fgoup <= 0 || fgoup > x->x_blocksize/2) {
- post( "sonogram~ : error : wrong offset in goup function" );
- return;
- }
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
-
- for ( sp=samplestart; sp<=sampleend; sp++ ) {
- for (sf=(x->x_blocksize/2)-fgoup-1; sf>=0; sf-- ) {
- *(x->x_rdata+((int)sp*x->x_blocksize)+(sf+(int)fgoup)) =
- *(x->x_rdata+((int)sp*x->x_blocksize)+sf);
- *(x->x_idata+((int)sp*x->x_blocksize)+(sf+(int)fgoup)) =
- *(x->x_idata+((int)sp*x->x_blocksize)+sf);
-
- }
- for (sf=0; sf<fgoup; sf++ ) {
- *(x->x_rdata+((int)sp*x->x_blocksize)+(int)sf) = 0.0;
- *(x->x_idata+((int)sp*x->x_blocksize)+(int)sf) = 0.0;
- }
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* roll up by the given number */
-static void sonogram_roll(t_sonogram *x, t_floatarg froll)
-{
- t_int samplestart, sampleend, sp, sf;
- t_float *fprvalues;
- t_float *fpivalues;
-
- if (froll <= 0 || froll > x->x_blocksize/2) {
- post( "sonogram~ : error : wrong offset in roll function" );
- return;
- }
- fprvalues = (t_float*)getbytes( ((int)froll)*sizeof( float ) );
- if ( !fprvalues ) {
- post( "sonogram~ : error : could not allocate %d bytes", ((int)froll)*sizeof(float) );
- return;
- }
- fpivalues = (t_float*)getbytes( ((int)froll)*sizeof( float ) );
- if ( !fpivalues ) {
- post( "sonogram~ : error : could not allocate %d bytes", ((int)froll)*sizeof(float) );
- return;
- }
-
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
-
- for ( sp=samplestart; sp<=sampleend; sp++ ) {
-
- // saving values
- for (sf=0; sf<froll; sf++ ) {
- *(fprvalues+sf) =
- *(x->x_rdata+((int)sp*x->x_blocksize)+(x->x_blocksize/2-(int)froll+sf));
- *(fpivalues+sf) =
- *(x->x_idata+((int)sp*x->x_blocksize)+(x->x_blocksize/2-(int)froll+sf));
- }
- for (sf=(x->x_blocksize/2)-froll-1; sf>=0; sf-- ) {
- *(x->x_rdata+((int)sp*x->x_blocksize)+(sf+(int)froll)) =
- *(x->x_rdata+((int)sp*x->x_blocksize)+sf);
- *(x->x_idata+((int)sp*x->x_blocksize)+(sf+(int)froll)) =
- *(x->x_idata+((int)sp*x->x_blocksize)+sf);
- }
- for (sf=0; sf<froll; sf++ ) {
- *(x->x_rdata+((int)sp*x->x_blocksize)+(int)sf) = *(fprvalues+sf);
- *(x->x_idata+((int)sp*x->x_blocksize)+(int)sf) = *(fpivalues+sf);
- }
- }
- freebytes( fprvalues, (int)froll*sizeof(float) );
- freebytes( fpivalues, (int)froll*sizeof(float) );
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* suppress point below the threshold */
-static void sonogram_threshold(t_sonogram *x, t_floatarg fthreshold)
-{
- t_int samplestart, sampleend, sp, sf;
- t_float fspectrum;
-
- if (fthreshold <= 0) {
- post( "sonogram~ : error : wrong threshold" );
- return;
- }
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
-
- for ( sp=samplestart; sp<=sampleend; sp++ ) {
- for (sf=0; sf<=(x->x_blocksize/2)-1; sf++ ) {
- fspectrum = sqrt( pow( *(x->x_rdata+sp*x->x_blocksize+sf), 2) +
- pow( *(x->x_idata+sp*x->x_blocksize+sf), 2) );
- if ( fspectrum < fthreshold )
- {
- *(x->x_rdata+sp*x->x_blocksize+sf) = 0.0;
- *(x->x_idata+sp*x->x_blocksize+sf) = 0.0;
- }
- }
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* change the phase */
-static void sonogram_phase(t_sonogram *x, t_floatarg fincphase)
-{
- if (fincphase < 0 || fincphase > 90) {
- post( "sonogram~ : error : wrong phase in phase function : out of [0,90]" );
- return;
- }
- x->x_phase = fincphase;
-}
-
- /* go down by the given number */
-static void sonogram_godown(t_sonogram *x, t_floatarg fgodown)
-{
- t_int samplestart, sampleend, sp, sf;
-
- if (fgodown <= 0 || fgodown > x->x_blocksize/2) {
- post( "sonogram~ : error : wrong offset in godown function" );
- return;
- }
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
-
- for ( sp=samplestart; sp<=sampleend; sp++ ) {
- for (sf=0; sf<=(x->x_blocksize/2)-fgodown-1; sf++ ) {
- *(x->x_rdata+((int)sp*x->x_blocksize)+sf) =
- *(x->x_rdata+((int)sp*x->x_blocksize)+(sf+(int)fgodown));
- *(x->x_idata+((int)sp*x->x_blocksize)+sf) =
- *(x->x_idata+((int)sp*x->x_blocksize)+(sf+(int)fgodown));
- }
- for (sf=(x->x_blocksize/2)-fgodown; sf<(x->x_blocksize/2); sf++ ) {
- *(x->x_rdata+((int)sp*x->x_blocksize)+(int)sf) = 0.0;
- *(x->x_idata+((int)sp*x->x_blocksize)+(int)sf) = 0.0;
- }
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
- /* swap blocks */
-static void sonogram_swapblocks(t_sonogram *x, t_floatarg fperstart, t_floatarg fperend, t_floatarg fpersize)
-{
- t_int samplestart, samplestartb, samplesize, sp, sf;
- t_int iperstart, iperend, ipersize;
- t_float s1, s2;
- t_float fvalue;
-
- iperstart = fperstart;
- iperend = fperend;
- ipersize = fpersize;
-
- if (iperstart < 0 || iperstart > iperend ||
- iperend <= 0 || iperend+ipersize > 100 ||
- ipersize < 0 || fpersize > 100 ) {
- post( "sonogram~ : error : wrong interval [%d%%, %d%%] <-> [%d%%, %d%%]",
- iperstart, iperstart+ipersize, iperend, iperend+ipersize );
- return;
- }
-
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- samplestartb=(x->x_modend*(x->x_size-1))/100;
- samplesize=((samplestartb-samplestart)*ipersize)/100;
- samplestart=samplestart+((samplestartb-samplestart)*iperstart)/100;
- samplestartb=samplestart+((samplestartb-samplestart)*iperend)/100;
-
- post( "swap blocks [%d,%d] and [%d,%d]", samplestart, samplestart+samplesize, samplestartb, samplestartb+samplesize );
-
- for ( sp=samplesize; sp>=0; sp-- ) {
- for ( sf=0; sf<x->x_blocksize; sf++) {
- fvalue = *(x->x_rdata+((int)(samplestart+sp)*x->x_blocksize)+sf);
- *(x->x_rdata+((int)(samplestart+sp)*x->x_blocksize)+sf) = *(x->x_rdata+((int)(samplestartb+sp)*x->x_blocksize)+sf);
- *(x->x_rdata+((int)(samplestartb+sp)*x->x_blocksize)+sf) = fvalue;
- fvalue = *(x->x_idata+((int)(samplestart+sp)*x->x_blocksize)+sf);
- *(x->x_idata+((int)(samplestart+sp)*x->x_blocksize)+sf) = *(x->x_idata+((int)(samplestartb+sp)*x->x_blocksize)+sf);
- *(x->x_idata+((int)(samplestartb+sp)*x->x_blocksize)+sf) = fvalue;
- }
- }
- sonogram_update_part(x, x->x_glist, 0, x->x_size-1, 0, 1, 1);
-}
-
- /* swap frequencies */
-static void sonogram_swapfreqs(t_sonogram *x, t_floatarg ffirstfreq, t_floatarg fsecondfreq)
-{
- t_int samplestart, sampleend, sp;
- t_float fvalue;
-
- if (ffirstfreq < 0 || fsecondfreq <0) {
- post( "sonogram~ : error : wrong frequencies" );
- return;
- }
- samplestart=(x->x_modstart*(x->x_size-1))/100;
- sampleend=(x->x_modend*(x->x_size-1))/100;
-
- for ( sp=samplestart; sp<=sampleend; sp++ ) {
- fvalue = *(x->x_rdata+((int)sp*x->x_blocksize)+(int)ffirstfreq);
- *(x->x_rdata+((int)sp*x->x_blocksize)+(int)ffirstfreq) =
- *(x->x_rdata+((int)sp*x->x_blocksize)+(int)fsecondfreq);
- *(x->x_rdata+((int)sp*x->x_blocksize)+(int)fsecondfreq) = fvalue;
- fvalue = *(x->x_idata+((int)sp*x->x_blocksize)+(int)ffirstfreq);
- *(x->x_idata+((int)sp*x->x_blocksize)+(int)ffirstfreq) =
- *(x->x_idata+((int)sp*x->x_blocksize)+(int)fsecondfreq);
- *(x->x_idata+((int)sp*x->x_blocksize)+(int)fsecondfreq) = fvalue;
- }
- sonogram_update_part(x, x->x_glist, samplestart, sampleend, 0, 1, 1);
-}
-
-static void *sonogram_new(t_floatarg fsize, t_floatarg fgraphic, t_floatarg fphaso)
-{
- t_sonogram *x = (t_sonogram *)pd_new(sonogram_class);
- outlet_new(&x->x_obj, &s_signal);
- outlet_new(&x->x_obj, &s_signal);
- x->x_recend = outlet_new(&x->x_obj, &s_bang );
- x->x_end = outlet_new(&x->x_obj, &s_bang );
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("readstart"));
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("readend"));
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("modstart"));
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("modend"));
-
- if ( fsize <= 0 || ( fgraphic != 0 && fgraphic != 1 ) || ( fphaso != 0 && fphaso != 1 ) ) {
- error( "sonogram~ : missing or negative creation arguments" );
- return NULL;
- }
-
- // activate graphical callbacks
- if ( fgraphic != 0 )
- {
- class_setwidget(sonogram_class, &sonogram_widgetbehavior);
- }
- x->x_graphic = (int) fgraphic;
- x->x_phaso = (int) fphaso;
-
- x->x_size = fsize;
- x->x_blocksize = sys_getblksize();
- x->x_play = 0;
- x->x_readspeed = 1.;
- x->x_record = 0;
- x->x_readpos = 0.;
- x->x_writepos = 0;
- x->x_modstart = 0;
- x->x_readstart = 0;
- x->x_modend = 100;
- x->x_readend = 100;
- x->x_rdata = NULL;
- x->x_idata = NULL;
- x->x_phase = 0.0;
- x->x_empty = 1;
- x->x_xpos = -1;
- x->x_ypos = -1;
- x->x_samplerate = sys_getsr();
- /* graphic data */
- x->x_selected = 0;
- x->x_zoom = 1;
- x->x_updatechild = 0;
- x->x_modstep = 1.1;
- x->x_enhancemode = 0;
- x->x_glist = (t_glist*)canvas_getcurrent();
-
- if ( sonogram_allocate(x) <0 ) {
- return NULL;
- } else {
- return(x);
- }
-
-}
-
-void sonogram_tilde_setup(void)
-{
- post(sonogram_version);
- sonogram_class = class_new(gensym("sonogram~"), (t_newmethod)sonogram_new, (t_method)sonogram_free,
- sizeof(t_sonogram), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
-
- // set callbacks
- sonogram_widgetbehavior.w_getrectfn = sonogram_getrect;
- sonogram_widgetbehavior.w_displacefn = sonogram_displace;
- sonogram_widgetbehavior.w_selectfn = sonogram_select;
- sonogram_widgetbehavior.w_activatefn = NULL;
- sonogram_widgetbehavior.w_deletefn = sonogram_delete;
- sonogram_widgetbehavior.w_visfn = sonogram_vis;
- sonogram_widgetbehavior.w_clickfn = sonogram_click;
- /*
- * <hans@eds.org>: As of 0.37, pd does not have these last
- * two elements in t_widgetbehavoir anymore.
- * see pd/src/notes.txt:
- * savefunction and dialog into class structure
- */
-#if PD_MINOR_VERSION < 37 || !defined(PD_MINOR_VERSION)
- sonogram_widgetbehavior.w_propertiesfn = NULL;
- sonogram_widgetbehavior.w_savefn = sonogram_save;
-/* this is needed to make the help patch work on < 0.37 */
-
-#else
- class_setpropertiesfn(sonogram_class, NULL);
- class_setsavefn(sonogram_class, &sonogram_save);
-#endif
-
- CLASS_MAINSIGNALIN( sonogram_class, t_sonogram, x_f );
- class_addmethod(sonogram_class, (t_method)sonogram_dsp, gensym("dsp"), A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_record, gensym("record"), A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_enhance, gensym("enhance"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_add, gensym("add"), A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_resize, gensym("resize"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_zoom, gensym("zoom"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_swappoints, gensym("swappoints"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_average, gensym("average"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_swapblocks, gensym("swapblocks"), A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_swapfreqs, gensym("swapfreqs"), A_FLOAT, A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_flipfreqs, gensym("flipfreqs"), A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_flipblocks, gensym("flipblocks"), A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_play, gensym("play"), A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_refresh, gensym("refresh"), A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_enhancemode, gensym("enhancemode"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_goup, gensym("goup"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_godown, gensym("godown"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_roll, gensym("roll"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_threshold, gensym("threshold"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_phase, gensym("phase"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_zswap, gensym("zswap"), A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_modstep, gensym("modstep"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_modstart, gensym("modstart"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_modend, gensym("modend"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_readstart, gensym("readstart"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_readend, gensym("readend"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_readspeed, gensym("readspeed"), A_FLOAT, A_NULL);
- class_addmethod(sonogram_class, (t_method)sonogram_undo, gensym("undo"), A_NULL);
-}
-
-#endif /* not _WIN32 */
diff --git a/sonogram~/sonograph~-help.pd b/sonograph~-help.pd
index 4352c3d..4352c3d 100644
--- a/sonogram~/sonograph~-help.pd
+++ b/sonograph~-help.pd
diff --git a/speex~/speexin~.c b/speexin~.c
index eff2601..eff2601 100644
--- a/speex~/speexin~.c
+++ b/speexin~.c
diff --git a/speex~/speexout~.c b/speexout~.c
index 2391e6f..994ee6b 100644
--- a/speex~/speexout~.c
+++ b/speexout~.c
@@ -179,7 +179,7 @@ static void speexout_stream(t_speexout *x)
if(count < 0)
{
error("speexout~: could not send encoded data to the peer (%d)", count);
-#ifndef UNIX
+#ifdef _WIN32
closesocket(x->x_fd);
#else
close(x->x_fd);
@@ -297,7 +297,7 @@ static void speexout_connect(t_speexout *x, t_symbol *hostname, t_floatarg fport
unsigned int len;
int sockfd;
-#ifndef UNIX
+#ifdef _WIN32
unsigned int ret;
#else
int ret;
@@ -322,7 +322,7 @@ static void speexout_connect(t_speexout *x, t_symbol *hostname, t_floatarg fport
if (hp == 0)
{
post("speexout~: bad host?");
-#ifndef UNIX
+#ifdef _WIN32
closesocket(sockfd);
#else
close(sockfd);
@@ -339,7 +339,7 @@ static void speexout_connect(t_speexout *x, t_symbol *hostname, t_floatarg fport
if (connect(sockfd, (struct sockaddr *) &csocket, sizeof (csocket)) < 0)
{
error("speexout~: connection failed!\n");
-#ifndef UNIX
+#ifdef _WIN32
closesocket(sockfd);
#else
close(sockfd);
@@ -363,7 +363,7 @@ static void speexout_disconnect(t_speexout *x)
if(x->x_fd >= 0) /* close socket */
{
-#ifndef UNIX
+#ifdef _WIN32
closesocket(x->x_fd);
#else
close(x->x_fd);
@@ -397,7 +397,7 @@ static void speexout_free(t_speexout *x)
post("speexout~: encoder destroyed");
if(x->x_fd >= 0)
-#ifndef UNIX
+#ifdef _WIN32
closesocket(x->x_fd);
#else
close(x->x_fd);
diff --git a/speex~/speex~-help.pd b/speex~-help.pd
index d1c40d4..d1c40d4 100644
--- a/speex~/speex~-help.pd
+++ b/speex~-help.pd
diff --git a/speex~/INSTALL b/speex~/INSTALL
deleted file mode 100644
index 852c774..0000000
--- a/speex~/INSTALL
+++ /dev/null
@@ -1,18 +0,0 @@
-first, you need to install Speex library,
-i used v0.6.0 available from http://speex.sourceforge.net
-
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/speex~
-
-make clean
-
-make
-
-make install
-
-open help-speex~.pd
-
-Thanx for getting here.
-
-Yves/
diff --git a/spigot~/spigot~-help.pd b/spigot~-help.pd
index eb7f0eb..eb7f0eb 100644
--- a/spigot~/spigot~-help.pd
+++ b/spigot~-help.pd
diff --git a/spigot~/spigot~.c b/spigot~.c
index fe54152..fe54152 100644
--- a/spigot~/spigot~.c
+++ b/spigot~.c
diff --git a/spigot~/INSTALL b/spigot~/INSTALL
deleted file mode 100644
index d8c07c9..0000000
--- a/spigot~/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/spigot~
-
-make clean
-
-make
-
-make install
-
-open help-spigot~.pd
-
-Thanx for getting here.
-Yves/
-comments and bugs @ ydegoyon@free.fr
diff --git a/vocoder~/tables.c b/tables.c
index 049a523..049a523 100644
--- a/vocoder~/tables.c
+++ b/tables.c
diff --git a/mp3live~/test-streaming-mp3.pd b/test-streaming-mp3.pd
index e9e6b2e..e9e6b2e 100644
--- a/mp3live~/test-streaming-mp3.pd
+++ b/test-streaming-mp3.pd
diff --git a/exciter/timeval.h b/timeval.h
index ff04962..ff04962 100644
--- a/exciter/timeval.h
+++ b/timeval.h
diff --git a/tk2c.bash b/tk2c.bash
deleted file mode 100755
index 9dfeb03..0000000
--- a/tk2c.bash
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-#set -x
-
-while read line
-do
- for word in $line
- do
- if [ "X"$word != "X"${word#\#} ]
- then
- echo // ${line#\#}
- break
- else
- line=${line//\'/\\\'}
-#useless, slashes never gets in
- line=${line//\\/\\\\}
-#this one's dirty, i know
- line=${line//;/\\\\;}
- line=${line//\"/\\\"}
- echo 'sys_gui("'$line'\n");'
- break
- fi
- done
-done
diff --git a/vocoder~/vocoder~-help.pd b/vocoder~-help.pd
index 7bbf3b2..7bbf3b2 100644
--- a/vocoder~/vocoder~-help.pd
+++ b/vocoder~-help.pd
diff --git a/vocoder~/vocoder~.c b/vocoder~.c
index 08dbe3d..08dbe3d 100644
--- a/vocoder~/vocoder~.c
+++ b/vocoder~.c
diff --git a/vocoder~/INSTALL b/vocoder~/INSTALL
deleted file mode 100644
index 37c9567..0000000
--- a/vocoder~/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/vocoder~
-
-make clean
-
-make
-
-make install
-
-open help-vocoder~.pd
-
-Thanx for getting here.
-Yves/
-comments and bugs @ ydegoyon@free.fr
diff --git a/wahwah~/wahwah~-help.pd b/wahwah~-help.pd
index 8afeb3c..8afeb3c 100644
--- a/wahwah~/wahwah~-help.pd
+++ b/wahwah~-help.pd
diff --git a/wahwah~/wahwah~.c b/wahwah~.c
index 7f9a9ed..7f9a9ed 100644
--- a/wahwah~/wahwah~.c
+++ b/wahwah~.c
diff --git a/wahwah~/INSTALL b/wahwah~/INSTALL
deleted file mode 100644
index 62ca7df..0000000
--- a/wahwah~/INSTALL
+++ /dev/null
@@ -1,15 +0,0 @@
-untar in /my/pd/dir/externs
-
-cd /my/pd/dir/externs/wahwah~
-
-make clean
-
-make
-
-make install
-
-open help-wahwah~.pd
-
-Thanx for getting here.
-Yves/
-comments and bugs @ ydegoyon@free.fr
diff --git a/playlist/xmms.pd b/xmms.pd
index b9282cd..b9282cd 100644
--- a/playlist/xmms.pd
+++ b/xmms.pd