aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--audience~/CHANGES.LOG2
-rw-r--r--audience~/Makefile2
-rw-r--r--audience~/audience~.c174
-rw-r--r--cooled~/CHANGES.LOG2
-rw-r--r--cooled~/cooled~.c125
-rw-r--r--exciter/Makefile2
-rw-r--r--exciter/exciter.c229
-rw-r--r--filterbank~/CHANGES.LOG4
-rw-r--r--filterbank~/Makefile2
-rw-r--r--filterbank~/filterbank~.c93
-rw-r--r--filterbank~/filterbank~.h2
-rw-r--r--grid/CHANGES.LOG2
-rw-r--r--grid/grid.c138
-rw-r--r--grid/help-grid.pd34
-rw-r--r--pianoroll/CHANGES.LOG4
-rw-r--r--pianoroll/Makefile2
-rw-r--r--pianoroll/pianoroll.c123
-rw-r--r--playlist/CHANGES.LOG2
-rw-r--r--playlist/playlist.c161
-rw-r--r--probalizer/CHANGES.LOG4
-rw-r--r--probalizer/Makefile2
-rw-r--r--probalizer/probalizer.c145
-rw-r--r--scratcher~/CHANGES.LOG4
-rw-r--r--scratcher~/Makefile2
-rw-r--r--scratcher~/scratcher~.c225
-rw-r--r--sonogram~/CHANGES.LOG2
-rw-r--r--sonogram~/rs-sonogram~.pd92
-rw-r--r--sonogram~/rs-sonograph~.pd2
-rw-r--r--sonogram~/sonogram~.c153
29 files changed, 845 insertions, 889 deletions
diff --git a/audience~/CHANGES.LOG b/audience~/CHANGES.LOG
index 9957a67..656ec5e 100644
--- a/audience~/CHANGES.LOG
+++ b/audience~/CHANGES.LOG
@@ -1,3 +1,5 @@
+0.6
+ Adaptattions for pd 0.37
0.5
Install images in /tmp
0.4
diff --git a/audience~/Makefile b/audience~/Makefile
index 1de0e20..d60890d 100644
--- a/audience~/Makefile
+++ b/audience~/Makefile
@@ -67,7 +67,7 @@ LINUXCFLAGS = -DPD -DUNIX -DICECAST -O2 -funroll-loops -fomit-frame-pointer \
LINUXINCLUDE = -I../../src
.c.pd_linux:
- ../tk2c.bash < $*.tk > $*.tk2c
+ ./tk2c.bash < $*.tk > $*.tk2c
cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm
strip --strip-unneeded $*.pd_linux
diff --git a/audience~/audience~.c b/audience~/audience~.c
index 110dc70..0d17f03 100644
--- a/audience~/audience~.c
+++ b/audience~/audience~.c
@@ -36,7 +36,6 @@
#include <stdio.h>
#include <math.h>
#include <ctype.h>
-
#include "m_pd.h"
#include "m_imp.h"
#include "g_canvas.h"
@@ -66,7 +65,7 @@
// a pixel is 0.1 meter
#define PIXELSIZE 0.1
-static char *audience_version = "audience : 2d audience simulation, version 0.5 (ydegoyon@free.fr)";
+static char *audience_version = "audience : 2d audience simulation, version 0.6 (ydegoyon@free.fr)";
t_widgetbehavior audience_widgetbehavior;
static t_class *audience_class_tilde;
@@ -115,46 +114,46 @@ static void audience_draw_update(t_audience_tilde *x, t_glist *glist)
{
SYS_VGUI6(".x%x.c coords %xISPEAKER%d %d %d\n",
canvas, x, ei,
- x->x_obj.te_xpix + x->x_inputs_x[ei],
- x->x_obj.te_ypix + x->x_inputs_y[ei]
+ text_xpix(&x->x_obj, glist) + x->x_inputs_x[ei],
+ text_ypix(&x->x_obj, glist) + x->x_inputs_y[ei]
);
SYS_VGUI6(".x%x.c coords %xSPEAKERNUM%d %d %d\n",
canvas, x, ei,
- x->x_obj.te_xpix + x->x_inputs_x[ei] - SPEAKER_WIDTH/2,
- x->x_obj.te_ypix + x->x_inputs_y[ei] - SPEAKER_HEIGHT/2
+ text_xpix(&x->x_obj, glist) + x->x_inputs_x[ei] - SPEAKER_WIDTH/2,
+ text_ypix(&x->x_obj, glist) + x->x_inputs_y[ei] - SPEAKER_HEIGHT/2
);
}
for ( ei=0; ei<x->x_nboutputs; ei++ )
{
SYS_VGUI6(".x%x.c coords %xILISTENER%d %d %d\n",
canvas, x, ei,
- x->x_obj.te_xpix + x->x_outputs_x[ei],
- x->x_obj.te_ypix + x->x_outputs_y[ei]
+ text_xpix(&x->x_obj, glist) + x->x_outputs_x[ei],
+ text_ypix(&x->x_obj, glist) + x->x_outputs_y[ei]
);
SYS_VGUI6(".x%x.c coords %xLISTENERNUM%d %d %d\n",
canvas, x, ei,
- x->x_obj.te_xpix + x->x_outputs_x[ei] + LISTENER_WIDTH/2,
- x->x_obj.te_ypix + x->x_outputs_y[ei] + LISTENER_HEIGHT/2
+ text_xpix(&x->x_obj, glist) + x->x_outputs_x[ei] + LISTENER_WIDTH/2,
+ text_ypix(&x->x_obj, glist) + x->x_outputs_y[ei] + LISTENER_HEIGHT/2
);
}
}
static void audience_draw_new(t_audience_tilde *x, t_glist *glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
- int ei;
+ t_canvas *canvas=glist_getcanvas(glist);
+ int ei;
SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill #EAF1E2 -tags %xAAUDIENCE\n",
- canvas, x->x_obj.te_xpix, x->x_obj.te_ypix,
- x->x_obj.te_xpix + x->x_width, x->x_obj.te_ypix + x->x_height,
+ canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height,
x);
// create captions
SYS_VGUI5(".x%x.c create text %d %d -font -*-courier-bold--normal--10-* -text \"0m\" -tags %xBLCAPTION\n",
- canvas, x->x_obj.te_xpix - 10 , x->x_obj.te_ypix + x->x_height + 10, x );
+ canvas, text_xpix(&x->x_obj, glist) - 10 , text_ypix(&x->x_obj, glist) + x->x_height + 10, x );
SYS_VGUI6(".x%x.c create text %d %d -font -*-courier-bold--normal--10-* -text \"%dm\" -tags %xBRCAPTION\n",
- canvas, x->x_obj.te_xpix + x->x_width + 10 , x->x_obj.te_ypix + x->x_height + 10, x->x_width, x );
+ canvas, text_xpix(&x->x_obj, glist) + x->x_width + 10 , text_ypix(&x->x_obj, glist) + x->x_height + 10, x->x_width, x );
SYS_VGUI6(".x%x.c create text %d %d -font -*-courier-bold--normal--10-* -text \"%dm\" -tags %xULCAPTION\n",
- canvas, x->x_obj.te_xpix - 10 , x->x_obj.te_ypix, x->x_height, x );
+ canvas, text_xpix(&x->x_obj, glist) - 10 , text_ypix(&x->x_obj, glist), x->x_height, x );
// draw all outlets
if ( x->x_nboutputs > 1 )
@@ -162,30 +161,30 @@ static void audience_draw_new(t_audience_tilde *x, t_glist *glist)
for ( ei=0; ei<x->x_nboutputs; ei++ )
{
SYS_VGUI8(".x%x.c create rectangle %d %d %d %d -outline #000000 -fill #000000 -tags %xOUT%d\n",
- canvas, x->x_obj.te_xpix + ( ei * (x->x_width - 5) )/ (x->x_nboutputs-1),
- x->x_obj.te_ypix + x->x_height,
- x->x_obj.te_xpix + ( ei * (x->x_width - 5) )/ (x->x_nboutputs-1) + 5,
- x->x_obj.te_ypix + x->x_height + 2,
+ canvas, text_xpix(&x->x_obj, glist) + ( ei * (x->x_width - 5) )/ (x->x_nboutputs-1),
+ text_ypix(&x->x_obj, glist) + x->x_height,
+ text_xpix(&x->x_obj, glist) + ( ei * (x->x_width - 5) )/ (x->x_nboutputs-1) + 5,
+ text_ypix(&x->x_obj, glist) + x->x_height + 2,
x, ei);
}
}
else
{
SYS_VGUI8(".x%x.c create rectangle %d %d %d %d -outline #000000 -fill #000000 -tags %xOUT%d\n",
- canvas, x->x_obj.te_xpix,
- x->x_obj.te_ypix + x->x_height,
- x->x_obj.te_xpix + 5,
- x->x_obj.te_ypix + x->x_height + 2,
+ canvas, text_xpix(&x->x_obj, glist),
+ text_ypix(&x->x_obj, glist) + x->x_height,
+ text_xpix(&x->x_obj, glist) + 5,
+ text_ypix(&x->x_obj, glist) + x->x_height + 2,
x, 0);
}
// draw all inlets
for ( ei=0; ei<x->x_nbinputs+1; ei++ )
{
SYS_VGUI8(".x%x.c create rectangle %d %d %d %d -outline #000000 -fill #000000 -tags %xIN%d\n",
- canvas, x->x_obj.te_xpix + ( ei * (x->x_width - 5) )/ (x->x_nbinputs),
- x->x_obj.te_ypix - 2,
- x->x_obj.te_xpix + ( ei * (x->x_width - 5) )/ (x->x_nbinputs) + 5,
- x->x_obj.te_ypix,
+ canvas, text_xpix(&x->x_obj, glist) + ( ei * (x->x_width - 5) )/ (x->x_nbinputs),
+ text_ypix(&x->x_obj, glist) - 2,
+ text_xpix(&x->x_obj, glist) + ( ei * (x->x_width - 5) )/ (x->x_nbinputs) + 5,
+ text_ypix(&x->x_obj, glist),
x, ei);
}
// create speaker images
@@ -195,12 +194,12 @@ static void audience_draw_new(t_audience_tilde *x, t_glist *glist)
x, ei, SPEAKER_WIDTH, SPEAKER_HEIGHT );
SYS_VGUI8(".x%x.c create image %d %d -image %xSPEAKER%d -tags %xISPEAKER%d\n",
canvas,
- x->x_obj.te_xpix + x->x_inputs_x[ei],
- x->x_obj.te_ypix + x->x_inputs_y[ei],
+ text_xpix(&x->x_obj, glist) + x->x_inputs_x[ei],
+ text_ypix(&x->x_obj, glist) + x->x_inputs_y[ei],
x, ei, x, ei );
SYS_VGUI7(".x%x.c create text %d %d -font -*-courier-bold--normal--10-* -text \"s%d\" -tags %xSPEAKERNUM%d\n",
- canvas, x->x_obj.te_xpix + x->x_inputs_x[ei] - SPEAKER_WIDTH/2,
- x->x_obj.te_ypix + x->x_inputs_y[ei] - SPEAKER_HEIGHT/2, ei+1, x, ei );
+ canvas, text_xpix(&x->x_obj, glist) + x->x_inputs_x[ei] - SPEAKER_WIDTH/2,
+ text_ypix(&x->x_obj, glist) + x->x_inputs_y[ei] - SPEAKER_HEIGHT/2, ei+1, x, ei );
}
// create listener images
for ( ei=0; ei<x->x_nboutputs; ei++ )
@@ -209,55 +208,55 @@ static void audience_draw_new(t_audience_tilde *x, t_glist *glist)
x, ei, LISTENER_WIDTH, LISTENER_HEIGHT );
SYS_VGUI8(".x%x.c create image %d %d -image %xLISTENER%d -tags %xILISTENER%d\n",
canvas,
- x->x_obj.te_xpix + x->x_outputs_x[ei],
- x->x_obj.te_ypix + x->x_outputs_y[ei],
+ text_xpix(&x->x_obj, glist) + x->x_outputs_x[ei],
+ text_ypix(&x->x_obj, glist) + x->x_outputs_y[ei],
x, ei, x, ei );
SYS_VGUI7(".x%x.c create text %d %d -font -*-courier-bold--normal--10-* -text \"l%d\" -tags %xLISTENERNUM%d\n",
- canvas, x->x_obj.te_xpix + x->x_outputs_x[ei] + LISTENER_WIDTH/2,
- x->x_obj.te_ypix + x->x_outputs_y[ei] + LISTENER_HEIGHT/2, ei+1, x, ei );
+ canvas, text_xpix(&x->x_obj, glist) + x->x_outputs_x[ei] + LISTENER_WIDTH/2,
+ text_ypix(&x->x_obj, glist) + x->x_outputs_y[ei] + LISTENER_HEIGHT/2, ei+1, x, ei );
}
canvas_fixlinesfor( canvas, (t_text*)x );
}
static void audience_draw_move(t_audience_tilde *x, t_glist *glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
- t_int ei;
+ t_canvas *canvas=glist_getcanvas(glist);
+ t_int ei;
SYS_VGUI7(".x%x.c coords %xAAUDIENCE %d %d %d %d\n",
canvas, x,
- x->x_obj.te_xpix, x->x_obj.te_ypix,
- x->x_obj.te_xpix+x->x_width, x->x_obj.te_ypix+x->x_height);
+ text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist)+x->x_width, text_ypix(&x->x_obj, glist)+x->x_height);
SYS_VGUI5(".x%x.c coords %xBLCAPTION %d %d\n",
canvas, x,
- x->x_obj.te_xpix - 10 , x->x_obj.te_ypix + x->x_height + 10);
+ text_xpix(&x->x_obj, glist) - 10 , text_ypix(&x->x_obj, glist) + x->x_height + 10);
SYS_VGUI5(".x%x.c coords %xBRCAPTION %d %d\n",
canvas, x,
- x->x_obj.te_xpix + x->x_width + 10 , x->x_obj.te_ypix + x->x_height + 10 );
+ text_xpix(&x->x_obj, glist) + x->x_width + 10 , text_ypix(&x->x_obj, glist) + x->x_height + 10 );
SYS_VGUI5(".x%x.c coords %xULCAPTION %d %d\n",
canvas, x,
- x->x_obj.te_xpix - 10 , x->x_obj.te_ypix );
+ text_xpix(&x->x_obj, glist) - 10 , text_ypix(&x->x_obj, glist) );
for ( ei=0; ei<x->x_nbinputs+1; ei++ )
{
SYS_VGUI8(".x%x.c coords %xIN%d %d %d %d %d\n",
- canvas, x, ei, x->x_obj.te_xpix + ( ei * (x->x_width - 5) )/ (x->x_nbinputs),
- x->x_obj.te_ypix - 2,
- x->x_obj.te_xpix + ( ei * (x->x_width - 5) )/ (x->x_nbinputs) + 5,
- x->x_obj.te_ypix
+ canvas, x, ei, text_xpix(&x->x_obj, glist) + ( ei * (x->x_width - 5) )/ (x->x_nbinputs),
+ text_ypix(&x->x_obj, glist) - 2,
+ text_xpix(&x->x_obj, glist) + ( ei * (x->x_width - 5) )/ (x->x_nbinputs) + 5,
+ text_ypix(&x->x_obj, glist)
);
}
for ( ei=0; ei<x->x_nbinputs+1; ei++ )
{
SYS_VGUI6(".x%x.c coords %xISPEAKER%d %d %d\n",
canvas, x, ei,
- x->x_obj.te_xpix + x->x_inputs_x[ei],
- x->x_obj.te_ypix + x->x_inputs_y[ei]
+ text_xpix(&x->x_obj, glist) + x->x_inputs_x[ei],
+ text_ypix(&x->x_obj, glist) + x->x_inputs_y[ei]
);
SYS_VGUI6(".x%x.c coords %xSPEAKERNUM%d %d %d\n",
canvas, x, ei,
- x->x_obj.te_xpix + x->x_inputs_x[ei] - SPEAKER_WIDTH/2,
- x->x_obj.te_ypix + x->x_inputs_y[ei] - SPEAKER_HEIGHT/2
+ text_xpix(&x->x_obj, glist) + x->x_inputs_x[ei] - SPEAKER_WIDTH/2,
+ text_ypix(&x->x_obj, glist) + x->x_inputs_y[ei] - SPEAKER_HEIGHT/2
);
}
if ( x->x_nboutputs > 1 )
@@ -265,40 +264,40 @@ static void audience_draw_move(t_audience_tilde *x, t_glist *glist)
for ( ei=0; ei<x->x_nboutputs; ei++ )
{
SYS_VGUI8(".x%x.c coords %xOUT%d %d %d %d %d\n",
- canvas, x, ei, x->x_obj.te_xpix + ( ei * (x->x_width - 5) )/ (x->x_nboutputs-1),
- x->x_obj.te_ypix + x->x_height,
- x->x_obj.te_xpix + ( ei * (x->x_width - 5) )/ (x->x_nboutputs-1) + 5,
- x->x_obj.te_ypix + x->x_height + 2
+ canvas, x, ei, text_xpix(&x->x_obj, glist) + ( ei * (x->x_width - 5) )/ (x->x_nboutputs-1),
+ text_ypix(&x->x_obj, glist) + x->x_height,
+ text_xpix(&x->x_obj, glist) + ( ei * (x->x_width - 5) )/ (x->x_nboutputs-1) + 5,
+ text_ypix(&x->x_obj, glist) + x->x_height + 2
);
SYS_VGUI6(".x%x.c coords %xILISTENER%d %d %d\n",
canvas, x, ei,
- x->x_obj.te_xpix + x->x_outputs_x[ei],
- x->x_obj.te_ypix + x->x_outputs_y[ei]
+ text_xpix(&x->x_obj, glist) + x->x_outputs_x[ei],
+ text_ypix(&x->x_obj, glist) + x->x_outputs_y[ei]
);
SYS_VGUI6(".x%x.c coords %xLISTENERNUM%d %d %d\n",
canvas, x, ei,
- x->x_obj.te_xpix + x->x_outputs_x[ei] + LISTENER_WIDTH/2,
- x->x_obj.te_ypix + x->x_outputs_y[ei] + LISTENER_HEIGHT/2
+ text_xpix(&x->x_obj, glist) + x->x_outputs_x[ei] + LISTENER_WIDTH/2,
+ text_ypix(&x->x_obj, glist) + x->x_outputs_y[ei] + LISTENER_HEIGHT/2
);
}
}
else
{
SYS_VGUI8(".x%x.c coords %xOUT%d %d %d %d %d\n",
- canvas, x, 0, x->x_obj.te_xpix,
- x->x_obj.te_ypix + x->x_height,
- x->x_obj.te_xpix + 5,
- x->x_obj.te_ypix + x->x_height + 2
+ canvas, x, 0, text_xpix(&x->x_obj, glist),
+ text_ypix(&x->x_obj, glist) + x->x_height,
+ text_xpix(&x->x_obj, glist) + 5,
+ text_ypix(&x->x_obj, glist) + x->x_height + 2
);
SYS_VGUI6(".x%x.c coords %xILISTENER%d %d %d\n",
canvas, x, 0,
- x->x_obj.te_xpix + x->x_outputs_x[0],
- x->x_obj.te_ypix + x->x_outputs_y[0]
+ text_xpix(&x->x_obj, glist) + x->x_outputs_x[0],
+ text_ypix(&x->x_obj, glist) + x->x_outputs_y[0]
);
SYS_VGUI6(".x%x.c coords %xLISTENERNUM%d %d %d\n",
canvas, x, 0,
- x->x_obj.te_xpix + x->x_outputs_x[0] + LISTENER_WIDTH/2,
- x->x_obj.te_ypix + x->x_outputs_y[0] + LISTENER_HEIGHT/2
+ text_xpix(&x->x_obj, glist) + x->x_outputs_x[0] + LISTENER_WIDTH/2,
+ text_ypix(&x->x_obj, glist) + x->x_outputs_y[0] + LISTENER_HEIGHT/2
);
}
canvas_fixlinesfor( canvas, (t_text*)x );
@@ -306,8 +305,8 @@ static void audience_draw_move(t_audience_tilde *x, t_glist *glist)
static void audience_draw_erase(t_audience_tilde* x,t_glist* glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
- int ei;
+ t_canvas *canvas=glist_getcanvas(glist);
+ int ei;
SYS_VGUI3(".x%x.c delete %xAAUDIENCE\n", canvas, x);
SYS_VGUI3(".x%x.c delete %xBLCAPTION\n", canvas, x);
@@ -355,10 +354,10 @@ static void audience_getrect(t_gobj *z, t_glist *owner,
{
t_audience_tilde* x = (t_audience_tilde*)z;
- *xp1 = x->x_obj.te_xpix;
- *yp1 = x->x_obj.te_ypix;
- *xp2 = x->x_obj.te_xpix+x->x_width;
- *yp2 = x->x_obj.te_ypix+x->x_height;
+ *xp1 = text_xpix(&x->x_obj, owner);
+ *yp1 = text_ypix(&x->x_obj, owner);
+ *xp2 = text_xpix(&x->x_obj, owner)+x->x_width;
+ *yp2 = text_ypix(&x->x_obj, owner)+x->x_height;
}
static void audience_save(t_gobj *z, t_binbuf *b)
@@ -367,7 +366,7 @@ static void audience_save(t_gobj *z, t_binbuf *b)
t_int ii;
binbuf_addv(b, "ssiisiiiifi", gensym("#X"),gensym("obj"),
- (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix,
+ (t_int)text_xpix(&x->x_obj, x->x_glist), (t_int)text_ypix(&x->x_obj, x->x_glist),
gensym("audience~"), x->x_width, x->x_height,
x->x_nbinputs, x->x_nboutputs, x->x_attenuation, x->x_applydelay );
for ( ii=0; ii<x->x_nbinputs; ii++ )
@@ -588,8 +587,8 @@ static void audience_delete(t_gobj *z, t_glist *glist)
static void audience_displace(t_gobj *z, t_glist *glist, int dx, int dy)
{
t_audience_tilde *x = (t_audience_tilde *)z;
- int xold = x->x_obj.te_xpix;
- int yold = x->x_obj.te_ypix;
+ int xold = text_xpix(&x->x_obj, glist);
+ int yold = text_ypix(&x->x_obj, glist);
// post( "audience_displace dx=%d dy=%d", dx, dy );
@@ -637,8 +636,8 @@ static int audience_click(t_gobj *z, struct _glist *glist,
// post( "audience_click doit=%d x=%d y=%d", doit, xpix, ypix );
if ( doit)
{
- t_int relx = xpix-x->x_obj.te_xpix;
- t_int rely = ypix-x->x_obj.te_ypix;
+ t_int relx = xpix-text_xpix(&x->x_obj, glist);
+ t_int rely = ypix-text_ypix(&x->x_obj, glist);
// post( "audience~ : relx : %d : rely : %d", relx, rely );
x->x_type_selected = AUDIENCE_NONE;
@@ -1049,20 +1048,15 @@ void audience_tilde_setup(void)
audience_widgetbehavior.w_deletefn = audience_delete;
audience_widgetbehavior.w_visfn = audience_vis;
audience_widgetbehavior.w_clickfn = audience_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)
+
+#if PD_MINOR_VERSION >= 37
+ class_setpropertiesfn(audience_class_tilde, audience_properties);
+ class_setsavefn(audience_class_tilde, audience_save);
+#else
audience_widgetbehavior.w_propertiesfn = audience_properties;
audience_widgetbehavior.w_savefn = audience_save;
-#else
- class_setsavefn(audience_class_tilde, &audience_save);
- class_setpropertiesfn(audience_class_tilde, &audience_properties);
#endif
class_setwidget(audience_class_tilde, &audience_widgetbehavior);
- class_sethelpsymbol(audience_class_tilde, gensym("help-audience~.pd"));
+ class_sethelpsymbol(audience_class_tilde, gensym("audience~.pd"));
}
diff --git a/cooled~/CHANGES.LOG b/cooled~/CHANGES.LOG
index d19f257..d57da95 100644
--- a/cooled~/CHANGES.LOG
+++ b/cooled~/CHANGES.LOG
@@ -1,3 +1,5 @@
+0.13
+ added GOP support
0.12
adapted for pd 0.37
0.11
diff --git a/cooled~/cooled~.c b/cooled~/cooled~.c
index 68e2b8e..18dc6ea 100644
--- a/cooled~/cooled~.c
+++ b/cooled~/cooled~.c
@@ -36,24 +36,14 @@
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
-
-#ifdef __APPLE__
-#include <sys/malloc.h>
-#else
#include <malloc.h>
-#endif
-
#include <ctype.h>
#include <pthread.h>
#ifdef UNIX
#include <unistd.h>
#endif
#ifdef NT
-#include <windows.h>
-int usleep (unsigned int us) {
- Sleep((long)(us/1000.));
- return 0;
-}
+#define M_PI 3.14159265358979323846
#endif
#include <math.h>
@@ -116,7 +106,7 @@ static int ignorevisible=1; // ignore visible test
#define COOLED_DEFAULT_WIDTH 400
#define COOLED_DEFAULT_HEIGHT 200
-static char *cooled_version = "cooled~: version 0.12, written by Yves Degoyon (ydegoyon@free.fr)";
+static char *cooled_version = "cooled~: version 0.13, written by Yves Degoyon (ydegoyon@free.fr)";
static t_class *cooled_class;
t_widgetbehavior cooled_widgetbehavior;
@@ -252,10 +242,10 @@ static void cooled_update_block(t_cooled *x, t_glist *glist, t_int bnumber)
static void cooled_erase_block(t_cooled *x, t_glist *glist, t_int sample )
{
- t_canvas *canvas=glist_getcanvas(glist);
- t_int hi;
- t_float fspectrum=0.0;
- char fillColor[ 16 ];
+ t_canvas *canvas=glist_getcanvas(glist);
+ t_int hi;
+ t_float fspectrum=0.0;
+ char fillColor[ 16 ];
for ( hi=0; hi<x->x_height; hi++)
{
@@ -275,10 +265,11 @@ static void cooled_erase_block(t_cooled *x, t_glist *glist, t_int sample )
static void *cooled_do_update_part(void *tdata)
{
- t_cooled *x = (t_cooled*) tdata;
- t_int si;
- t_int nbpoints = 0;
- t_float percentage = 0, opercentage = 0;
+ t_cooled *x = (t_cooled*) tdata;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
+ t_int si;
+ t_int nbpoints = 0;
+ t_float percentage = 0, opercentage = 0;
// loose synchro
usleep( THREAD_SLEEP_TIME );
@@ -324,16 +315,16 @@ static void *cooled_do_update_part(void *tdata)
if ( glist_isvisible( x->x_glist ) )
{
SYS_VGUI3( ".x%x.c delete rectangle %xCLIPZONE\n",
- glist_getcanvas( x->x_glist ), x);
+ canvas, x);
if ( ( x->x_readstart != 0 ) || ( x->x_readend != 100 ) )
{
SYS_VGUI7( ".x%x.c create rectangle %d %d %d %d -outline #FF0000 -tags %xCLIPZONE -width 2\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+(int)(x->x_readstart*(x->x_width)/100 ),
+ canvas, x->x_xpos+(int)(x->x_readstart*(x->x_width)/100 ),
x->x_ypos, x->x_xpos+(int)(x->x_readend*(x->x_width)/100 ),
x->x_ypos+x->x_height*x->x_zoom, x );
}
// set borders in black
- SYS_VGUI3(".x%x.c itemconfigure %xCOOLED -outline #000000\n", glist_getcanvas(x->x_glist), x);
+ SYS_VGUI3(".x%x.c itemconfigure %xCOOLED -outline #000000\n", canvas, x);
}
post("cooled~ : child thread %d ended", (int)x->x_updatechild );
@@ -344,8 +335,8 @@ static void *cooled_do_update_part(void *tdata)
static void cooled_update_part(t_cooled *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;
- t_canvas *canvas=glist_getcanvas(x->x_glist);
+ pthread_attr_t update_child_attr;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
if ( x->x_updatechild != 0 )
{
@@ -368,8 +359,8 @@ static void cooled_update_part(t_cooled *x, t_glist *glist, t_int bstart, t_int
{
if ( ( bstart == 0 ) && ( bend == x->x_width-1 ) && !keepframe )
{
- SYS_VGUI3(".x%x.c delete %xCOOLEDL\n", glist_getcanvas(glist), x );
- SYS_VGUI3(".x%x.c delete %xCOOLEDR\n", glist_getcanvas(glist), x );
+ SYS_VGUI3(".x%x.c delete %xCOOLEDL\n", canvas, x );
+ SYS_VGUI3(".x%x.c delete %xCOOLEDR\n", canvas, x );
SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill #FFFFFF -tags %xCOOLEDR\n",
canvas, x->x_xpos, x->x_ypos,
x->x_xpos + x->x_width*x->x_zoom,
@@ -382,18 +373,18 @@ static void cooled_update_part(t_cooled *x, t_glist *glist, t_int bstart, t_int
x->x_ypos + x->x_height*x->x_zoom,
x);
SYS_VGUI2("image delete COOLEDIMAGE%x\n", x );
- SYS_VGUI3(".x%x.c delete ICOOLEDIMAGE%x\n", glist_getcanvas(glist), x );
+ SYS_VGUI3(".x%x.c delete ICOOLEDIMAGE%x\n", canvas, x );
SYS_VGUI4("image create photo COOLEDIMAGE%x -format gif -width %d -height %d\n",
x, x->x_width*x->x_zoom, x->x_height*x->x_zoom );
SYS_VGUI2("COOLEDIMAGE%x blank\n", x );
SYS_VGUI6(".x%x.c create image %d %d -image COOLEDIMAGE%x -tags ICOOLEDIMAGE%x\n",
- glist_getcanvas( x->x_glist ),
+ canvas,
x->x_xpos+(x->x_width*x->x_zoom)/2,
x->x_ypos+(x->x_height*x->x_zoom)/2, x, x );
- canvas_fixlinesfor( glist_getcanvas(x->x_glist), (t_text*)x );
+ canvas_fixlinesfor( canvas, (t_text*)x );
}
// set borders in red
- SYS_VGUI3(".x%x.c itemconfigure %xCOOLED -outline #FF0000\n", glist_getcanvas(glist), x);
+ SYS_VGUI3(".x%x.c itemconfigure %xCOOLED -outline #FF0000\n", canvas, x);
}
// launch update thread
@@ -420,14 +411,11 @@ static void cooled_update_part(t_cooled *x, t_glist *glist, t_int bstart, t_int
static void cooled_draw_new(t_cooled *x, t_glist *glist)
{
- t_canvas *canvas=glist_getcanvas(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;
- x->x_xdraw=x->x_obj.te_xpix;
- }
+ x->x_xpos=text_xpix(&x->x_obj, glist);
+ x->x_ypos=text_ypix(&x->x_obj, glist);
+ x->x_xdraw=text_xpix(&x->x_obj, glist);
SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill #FFFFFF -tags %xCOOLEDR\n",
canvas, x->x_xpos, x->x_ypos,
x->x_xpos + x->x_width*x->x_zoom,
@@ -443,7 +431,7 @@ static void cooled_draw_new(t_cooled *x, t_glist *glist)
x, x->x_width*x->x_zoom, x->x_height*x->x_zoom );
SYS_VGUI2("COOLEDIMAGE%x blank\n", x );
SYS_VGUI6(".x%x.c create image %d %d -image COOLEDIMAGE%x -tags ICOOLEDIMAGE%x\n",
- glist_getcanvas( x->x_glist ),
+ canvas,
x->x_xpos+(x->x_width*x->x_zoom)/2,
x->x_ypos+(x->x_height*x->x_zoom)/2, x, x );
if ( x->x_draw) cooled_update_part(x, x->x_glist, 0, x->x_width-1, 0, 1, 0);
@@ -452,24 +440,26 @@ static void cooled_draw_new(t_cooled *x, t_glist *glist)
static void cooled_draw_delete(t_cooled *x, t_glist *glist)
{
+ t_canvas *canvas=glist_getcanvas(glist);
+
if ( glist_isvisible( glist ) )
{
- SYS_VGUI3( ".x%x.c delete %xCAPTURE\n", glist_getcanvas( glist ), x );
+ SYS_VGUI3( ".x%x.c delete %xCAPTURE\n", canvas, x );
if ( ( x->x_readstart != 0 ) || ( x->x_readend != 100 ) )
{
- SYS_VGUI3( ".x%x.c delete rectangle %xCLIPZONE\n", glist_getcanvas( glist ), x);
+ SYS_VGUI3( ".x%x.c delete rectangle %xCLIPZONE\n", canvas, x);
}
- SYS_VGUI3( ".x%x.c delete line %xINSERTHERE\n", glist_getcanvas( glist ), x);
- SYS_VGUI3(".x%x.c delete %xCOOLEDR\n", glist_getcanvas( glist ), x );
- SYS_VGUI3(".x%x.c delete %xCOOLEDL\n", glist_getcanvas( glist ), x );
- SYS_VGUI3(".x%x.c delete ICOOLEDIMAGE%x\n", glist_getcanvas( glist ), x );
+ SYS_VGUI3( ".x%x.c delete line %xINSERTHERE\n", canvas, x);
+ SYS_VGUI3(".x%x.c delete %xCOOLEDR\n", canvas, x );
+ SYS_VGUI3(".x%x.c delete %xCOOLEDL\n", canvas, x );
+ SYS_VGUI3(".x%x.c delete ICOOLEDIMAGE%x\n", canvas, x );
SYS_VGUI2("image delete COOLEDIMAGE%x\n", x );
}
}
static void cooled_draw_move(t_cooled *x, t_glist *glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
+ t_canvas *canvas=glist_getcanvas(glist);
if ( glist_isvisible( x->x_glist ) )
{
@@ -509,7 +499,7 @@ static void cooled_draw_move(t_cooled *x, t_glist *glist)
static void cooled_draw_select(t_cooled* x,t_glist* glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
+ t_canvas *canvas=glist_getcanvas(glist);
if ( glist_isvisible( x->x_glist ) )
{
@@ -534,6 +524,7 @@ static void cooled_draw_select(t_cooled* x,t_glist* glist)
static void cooled_readstart(t_cooled *x, t_floatarg fstart)
{
t_float startpoint = fstart;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
if (startpoint < 0) startpoint = 0;
if (startpoint > 100) startpoint = 100;
@@ -544,11 +535,11 @@ static void cooled_readstart(t_cooled *x, t_floatarg fstart)
if ( glist_isvisible( x->x_glist ) )
{
SYS_VGUI3( ".x%x.c delete rectangle %xCLIPZONE\n",
- glist_getcanvas( x->x_glist ), x);
+ canvas, x);
if ( ( x->x_readstart != 0 ) || ( x->x_readend != 100 ) )
{
SYS_VGUI7( ".x%x.c create rectangle %d %d %d %d -outline #FF0000 -tags %xCLIPZONE -width 2\n",
- glist_getcanvas( x->x_glist ), x->x_xpos+(int)(x->x_readstart*x->x_width*x->x_zoom/100 ),
+ canvas, x->x_xpos+(int)(x->x_readstart*x->x_width*x->x_zoom/100 ),
x->x_ypos, x->x_xpos+(int)(x->x_readend*x->x_width*x->x_zoom/100 ),
x->x_ypos+x->x_height*x->x_zoom, x );
}
@@ -560,6 +551,7 @@ static void cooled_readstart(t_cooled *x, t_floatarg fstart)
static void cooled_readend(t_cooled *x, t_floatarg fend)
{
t_float endpoint = fend;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
if (endpoint < 0) endpoint = 0;
if (endpoint > 100) endpoint = 100;
@@ -570,11 +562,11 @@ static void cooled_readend(t_cooled *x, t_floatarg fend)
if ( glist_isvisible( x->x_glist ) )
{
SYS_VGUI3( ".x%x.c delete rectangle %xCLIPZONE\n",
- glist_getcanvas( x->x_glist ), x);
+ canvas, x);
if ( ( x->x_readstart != 0 ) || ( x->x_readend != 100 ) )
{
SYS_VGUI7( ".x%x.c create rectangle %d %d %d %d -outline #FF0000 -tags %xCLIPZONE -width 2\n",
- glist_getcanvas( x->x_glist ),
+ canvas,
x->x_xpos+(int)(x->x_readstart*x->x_width*x->x_zoom/100 ),
x->x_ypos, x->x_xpos+(int)(x->x_readend*x->x_width*x->x_zoom/100 ),
x->x_ypos+x->x_height*x->x_zoom, x );
@@ -586,7 +578,7 @@ static void cooled_readend(t_cooled *x, t_floatarg fend)
static void cooled_getrect(t_gobj *z, t_glist *owner,
int *xp1, int *yp1, int *xp2, int *yp2)
{
- t_cooled* x = (t_cooled*)z;
+ t_cooled* x = (t_cooled*)z;
*xp1 = x->x_xpos;
*yp1 = x->x_ypos;
@@ -596,7 +588,7 @@ static void cooled_getrect(t_gobj *z, t_glist *owner,
static void cooled_save(t_gobj *z, t_binbuf *b)
{
- t_cooled *x = (t_cooled *)z;
+ t_cooled *x = (t_cooled *)z;
binbuf_addv(b, "ssiisiiii", gensym("#X"),gensym("obj"),
(t_int)x->x_xpos, (t_int)x->x_ypos,
@@ -606,7 +598,7 @@ static void cooled_save(t_gobj *z, t_binbuf *b)
static void cooled_select(t_gobj *z, t_glist *glist, int selected)
{
- t_cooled *x = (t_cooled *)z;
+ t_cooled *x = (t_cooled *)z;
x->x_selected = selected;
cooled_draw_select( x, glist );
@@ -614,8 +606,8 @@ static void cooled_select(t_gobj *z, t_glist *glist, int selected)
static void cooled_vis(t_gobj *z, t_glist *glist, int vis)
{
- t_cooled *x = (t_cooled *)z;
- t_rtext *y;
+ t_cooled *x = (t_cooled *)z;
+ t_rtext *y;
if (vis)
{
@@ -635,9 +627,9 @@ static void cooled_delete(t_gobj *z, t_glist *glist)
static void cooled_displace(t_gobj *z, t_glist *glist, int dx, int dy)
{
- t_cooled *x = (t_cooled *)z;
- int xold = x->x_xpos;
- int yold = x->x_ypos;
+ t_cooled *x = (t_cooled *)z;
+ t_int xold = x->x_xpos;
+ t_int yold = x->x_ypos;
x->x_xpos += dx;
x->x_ypos += dy;
@@ -835,8 +827,9 @@ static void cooled_dialog(t_cooled *x, t_symbol *s, int argc, t_atom *argv)
static int cooled_click(t_gobj *z, struct _glist *glist,
int xpix, int ypix, int shift, int alt, int dbl, int doit)
{
- t_cooled* x = (t_cooled *)z;
- t_int pipos;
+ t_cooled* x = (t_cooled *)z;
+ t_int pipos;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
// post( "cooled_click : x=%d y=%d doit=%d alt=%d, shift=%d", xpix, ypix, doit, alt, shift );
if ( doit )
@@ -867,9 +860,9 @@ static int cooled_click(t_gobj *z, struct _glist *glist,
if ( glist_isvisible( x->x_glist ) )
{
SYS_VGUI3( ".x%x.c delete line %xINSERTHERE\n",
- glist_getcanvas( x->x_glist ), x);
+ canvas, x);
SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #00FFFF -tags %xINSERTHERE -width 2\n",
- glist_getcanvas( x->x_glist ), x->x_xdraw,
+ canvas, x->x_xdraw,
x->x_ypos, x->x_xdraw,
x->x_ypos+x->x_height*x->x_zoom, x );
}
@@ -1373,13 +1366,9 @@ void cooled_tilde_setup(void)
cooled_widgetbehavior.w_deletefn = cooled_delete;
cooled_widgetbehavior.w_visfn = cooled_vis;
cooled_widgetbehavior.w_clickfn = cooled_click;
-#if PD_MINOR_VERSION >= 37
+
class_setpropertiesfn(cooled_class, cooled_properties);
class_setsavefn(cooled_class, cooled_save);
-#else
- cooled_widgetbehavior.w_propertiesfn = cooled_properties;
- cooled_widgetbehavior.w_savefn = cooled_save;
-#endif
CLASS_MAINSIGNALIN( cooled_class, t_cooled, x_f );
class_addmethod(cooled_class, (t_method)cooled_dsp, gensym("dsp"), A_NULL);
diff --git a/exciter/Makefile b/exciter/Makefile
index 898abc1..66eab54 100644
--- a/exciter/Makefile
+++ b/exciter/Makefile
@@ -67,7 +67,7 @@ LINUXCFLAGS = -DPD -DUNIX -DICECAST -O2 -funroll-loops -fomit-frame-pointer \
LINUXINCLUDE = -I../../src
.c.pd_linux:
- ../tk2c.bash < $*.tk >$*.tk2c
+ ./tk2c.bash < $*.tk >$*.tk2c
cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm
strip --strip-unneeded $*.pd_linux
diff --git a/exciter/exciter.c b/exciter/exciter.c
index 16c584f..a7bd528 100644
--- a/exciter/exciter.c
+++ b/exciter/exciter.c
@@ -37,8 +37,8 @@
#include <math.h>
#include <ctype.h>
#include <time.h>
-#include <m_pd.h>
-
+#include <sys/time.h>
+#include "m_pd.h"
#include "m_imp.h"
#include "g_canvas.h"
#include "t_tk.h"
@@ -46,10 +46,7 @@
#ifdef NT
#include <io.h>
-#include <winsock2.h>
-#include <sys/timeb.h>
#else
-#include <sys/time.h>
#include <unistd.h>
#endif
@@ -65,7 +62,7 @@ void canvas_startmotion(t_canvas *x);
#define EXCITER_PIXEL_GRAIN 5
-static char *exciter_version = "exciter: a bang-events sequencer, version 0.2 (ydegoyon@free.fr)";
+static char *exciter_version = "exciter: a bang-events sequencer, version 0.4 (ydegoyon@free.fr)";
t_widgetbehavior exciter_widgetbehavior;
static t_class *exciter_class;
@@ -120,14 +117,14 @@ static void exciter_draw_gem(t_exciter *x, t_glist *glist, t_int ix, t_int iy)
SYS_VGUI13(".x%x.c create polygon %d %d %d %d %d %d %d %d -outline #000000 -fill #FFFFFF -tags %xEVENT%.4d%.4d\n",
canvas,
- x->x_obj.te_xpix + ix*EXCITER_PIXEL_GRAIN,
- x->x_obj.te_ypix + x->x_height - (iy+1)*x->x_height/x->x_nbevents + 2*polyray,
- x->x_obj.te_xpix + ix*EXCITER_PIXEL_GRAIN + polyray,
- x->x_obj.te_ypix + x->x_height - (iy+1)*x->x_height/x->x_nbevents + polyray,
- x->x_obj.te_xpix + ix*EXCITER_PIXEL_GRAIN + 2*polyray,
- x->x_obj.te_ypix + x->x_height - (iy+1)*x->x_height/x->x_nbevents,
- x->x_obj.te_xpix + ix*EXCITER_PIXEL_GRAIN + polyray,
- x->x_obj.te_ypix + x->x_height - (iy+1)*x->x_height/x->x_nbevents - polyray,
+ text_xpix(&x->x_obj, glist) + ix*EXCITER_PIXEL_GRAIN,
+ text_ypix(&x->x_obj, glist) + x->x_height - (iy+1)*x->x_height/x->x_nbevents + 2*polyray,
+ text_xpix(&x->x_obj, glist) + ix*EXCITER_PIXEL_GRAIN + polyray,
+ text_ypix(&x->x_obj, glist) + x->x_height - (iy+1)*x->x_height/x->x_nbevents + polyray,
+ text_xpix(&x->x_obj, glist) + ix*EXCITER_PIXEL_GRAIN + 2*polyray,
+ text_ypix(&x->x_obj, glist) + x->x_height - (iy+1)*x->x_height/x->x_nbevents,
+ text_xpix(&x->x_obj, glist) + ix*EXCITER_PIXEL_GRAIN + polyray,
+ text_ypix(&x->x_obj, glist) + x->x_height - (iy+1)*x->x_height/x->x_nbevents - polyray,
x, ix, iy);
}
@@ -166,39 +163,39 @@ static void exciter_draw_new(t_exciter *x, t_glist *glist)
t_int ei;
SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -outline #000000 -fill #902181 -tags %xLINE\n",
- canvas, x->x_obj.te_xpix, x->x_obj.te_ypix,
- x->x_obj.te_xpix+x->x_width, x->x_obj.te_ypix+x->x_height,
+ canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist)+x->x_width, text_ypix(&x->x_obj, glist)+x->x_height,
x);
SYS_VGUI5(".x%x.c create text %d %d -font -*-courier-bold--normal--10-* -text \"0 s\" -tags %xLOWERCAPTION\n",
- canvas, x->x_obj.te_xpix, x->x_obj.te_ypix + x->x_height + 10, x );
+ canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist) + x->x_height + 10, x );
SYS_VGUI6(".x%x.c create text %d %d -font -*-courier-bold--normal--10-* -text \"%.2f s\" -tags %xHIGHERCAPTION\n",
- canvas, x->x_obj.te_xpix + x->x_width, x->x_obj.te_ypix + x->x_height + 10,
+ canvas, text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height + 10,
x->x_width/EXCITER_PIXEL_GRAIN*x->x_timegrain , x);
SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -outline #000000 -fill #000000 -tags %xIN\n",
- canvas, x->x_obj.te_xpix,
- x->x_obj.te_ypix - 2,
- x->x_obj.te_xpix + 5,
- x->x_obj.te_ypix ,
+ canvas, text_xpix(&x->x_obj, glist),
+ text_ypix(&x->x_obj, glist) - 2,
+ text_xpix(&x->x_obj, glist) + 5,
+ text_ypix(&x->x_obj, glist) ,
x);
if ( x->x_nbevents > 1 )
{
for ( ei=0; ei<x->x_nbevents; ei++ )
{
SYS_VGUI8(".x%x.c create rectangle %d %d %d %d -outline #000000 -fill #000000 -tags %xOUT%d\n",
- canvas, x->x_obj.te_xpix + ( ei * (x->x_width - 5) )/ (x->x_nbevents-1),
- x->x_obj.te_ypix + x->x_height,
- x->x_obj.te_xpix + ( ei * (x->x_width - 5) )/ (x->x_nbevents-1) + 5,
- x->x_obj.te_ypix + x->x_height + 2,
+ canvas, text_xpix(&x->x_obj, glist) + ( ei * (x->x_width - 5) )/ (x->x_nbevents-1),
+ text_ypix(&x->x_obj, glist) + x->x_height,
+ text_xpix(&x->x_obj, glist) + ( ei * (x->x_width - 5) )/ (x->x_nbevents-1) + 5,
+ text_ypix(&x->x_obj, glist) + x->x_height + 2,
x, ei);
}
}
else
{
SYS_VGUI8(".x%x.c create rectangle %d %d %d %d -outline #000000 -fill #000000 -tags %xOUT%d\n",
- canvas, x->x_obj.te_xpix,
- x->x_obj.te_ypix + x->x_height,
- x->x_obj.te_xpix + 5,
- x->x_obj.te_ypix + x->x_height + 2,
+ canvas, text_xpix(&x->x_obj, glist),
+ text_ypix(&x->x_obj, glist) + x->x_height,
+ text_xpix(&x->x_obj, glist) + 5,
+ text_ypix(&x->x_obj, glist) + x->x_height + 2,
x, 0);
}
canvas_fixlinesfor( canvas, (t_text*)x );
@@ -211,38 +208,38 @@ static void exciter_draw_move(t_exciter *x, t_glist *glist)
t_int ei, gi;
SYS_VGUI7(".x%x.c coords %xLINE %d %d %d %d \n",
- canvas, x, x->x_obj.te_xpix, x->x_obj.te_ypix,
- x->x_obj.te_xpix+x->x_width, x->x_obj.te_ypix+x->x_height
+ canvas, x, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist)+x->x_width, text_ypix(&x->x_obj, glist)+x->x_height
);
SYS_VGUI5(".x%x.c coords %xLOWERCAPTION %d %d\n",
- canvas, x, x->x_obj.te_xpix, x->x_obj.te_ypix + x->x_height + 10 );
+ canvas, x, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist) + x->x_height + 10 );
SYS_VGUI5(".x%x.c coords %xHIGHERCAPTION %d %d\n",
- canvas, x, x->x_obj.te_xpix + x->x_width, x->x_obj.te_ypix + x->x_height + 10);
+ canvas, x, text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height + 10);
SYS_VGUI7(".x%x.c coords %xIN %d %d %d %d\n",
- canvas, x, x->x_obj.te_xpix,
- x->x_obj.te_ypix - 2,
- x->x_obj.te_xpix + 5,
- x->x_obj.te_ypix
+ canvas, x, text_xpix(&x->x_obj, glist),
+ text_ypix(&x->x_obj, glist) - 2,
+ text_xpix(&x->x_obj, glist) + 5,
+ text_ypix(&x->x_obj, glist)
);
if ( x->x_nbevents > 1 )
{
for ( ei=0; ei<x->x_nbevents; ei++ )
{
SYS_VGUI8(".x%x.c coords %xOUT%d %d %d %d %d\n",
- canvas, x, ei, x->x_obj.te_xpix + ( ei * (x->x_width - 5) )/ (x->x_nbevents-1),
- x->x_obj.te_ypix + x->x_height,
- x->x_obj.te_xpix + ( ei * (x->x_width - 5) )/ (x->x_nbevents-1) + 5,
- x->x_obj.te_ypix + x->x_height + 2
+ canvas, x, ei, text_xpix(&x->x_obj, glist) + ( ei * (x->x_width - 5) )/ (x->x_nbevents-1),
+ text_ypix(&x->x_obj, glist) + x->x_height,
+ text_xpix(&x->x_obj, glist) + ( ei * (x->x_width - 5) )/ (x->x_nbevents-1) + 5,
+ text_ypix(&x->x_obj, glist) + x->x_height + 2
);
}
}
else
{
SYS_VGUI8(".x%x.c coords %xOUT%d %d %d %d %d\n",
- canvas, x, 0, x->x_obj.te_xpix,
- x->x_obj.te_ypix + x->x_height,
- x->x_obj.te_xpix + 5,
- x->x_obj.te_ypix + x->x_height + 2
+ canvas, x, 0, text_xpix(&x->x_obj, glist),
+ text_ypix(&x->x_obj, glist) + x->x_height,
+ text_xpix(&x->x_obj, glist) + 5,
+ text_ypix(&x->x_obj, glist) + x->x_height + 2
);
}
for ( ei=0; ei<x->x_nbevents; ei++ )
@@ -251,14 +248,14 @@ static void exciter_draw_move(t_exciter *x, t_glist *glist)
{
SYS_VGUI13(".x%x.c coords %xEVENT%.4d%.4d %d %d %d %d %d %d %d %d\n",
canvas, x, gi, ei,
- x->x_obj.te_xpix + gi*EXCITER_PIXEL_GRAIN,
- x->x_obj.te_ypix + x->x_height - (ei+1)*x->x_height/x->x_nbevents + 2*polyray,
- x->x_obj.te_xpix + gi*EXCITER_PIXEL_GRAIN + polyray,
- x->x_obj.te_ypix + x->x_height - (ei+1)*x->x_height/x->x_nbevents + polyray,
- x->x_obj.te_xpix + gi*EXCITER_PIXEL_GRAIN + 2*polyray,
- x->x_obj.te_ypix + x->x_height - (ei+1)*x->x_height/x->x_nbevents,
- x->x_obj.te_xpix + gi*EXCITER_PIXEL_GRAIN + polyray,
- x->x_obj.te_ypix + x->x_height - (ei+1)*x->x_height/x->x_nbevents - polyray
+ text_xpix(&x->x_obj, glist) + gi*EXCITER_PIXEL_GRAIN,
+ text_ypix(&x->x_obj, glist) + x->x_height - (ei+1)*x->x_height/x->x_nbevents + 2*polyray,
+ text_xpix(&x->x_obj, glist) + gi*EXCITER_PIXEL_GRAIN + polyray,
+ text_ypix(&x->x_obj, glist) + x->x_height - (ei+1)*x->x_height/x->x_nbevents + polyray,
+ text_xpix(&x->x_obj, glist) + gi*EXCITER_PIXEL_GRAIN + 2*polyray,
+ text_ypix(&x->x_obj, glist) + x->x_height - (ei+1)*x->x_height/x->x_nbevents,
+ text_xpix(&x->x_obj, glist) + gi*EXCITER_PIXEL_GRAIN + polyray,
+ text_ypix(&x->x_obj, glist) + x->x_height - (ei+1)*x->x_height/x->x_nbevents - polyray
);
}
}
@@ -294,13 +291,13 @@ static void exciter_draw_select(t_exciter* x,t_glist* glist)
if(x->x_selected)
{
/* sets the main item in blue */
- SYS_VGUI3(".x%x.c itemconfigure %xLINE -outline #0000FF\n", glist_getcanvas(glist), x);
+ SYS_VGUI3(".x%x.c itemconfigure %xLINE -outline #0000FF\n", canvas, x);
}
else
{
/* sets the main item in black */
- SYS_VGUI3(".x%x.c itemconfigure %xLINE -outline #000000\n", glist_getcanvas(glist), x);
+ SYS_VGUI3(".x%x.c itemconfigure %xLINE -outline #000000\n", canvas, x);
}
}
@@ -312,10 +309,10 @@ static void exciter_getrect(t_gobj *z, t_glist *owner,
{
t_exciter* x = (t_exciter*)z;
- *xp1 = x->x_obj.te_xpix;
- *yp1 = x->x_obj.te_ypix;
- *xp2 = x->x_obj.te_xpix+x->x_width;
- *yp2 = x->x_obj.te_ypix+x->x_height;
+ *xp1 = text_xpix(&x->x_obj, owner);
+ *yp1 = text_ypix(&x->x_obj, owner);
+ *xp2 = text_xpix(&x->x_obj, owner)+x->x_width;
+ *yp2 = text_ypix(&x->x_obj, owner)+x->x_height;
}
static void exciter_save(t_gobj *z, t_binbuf *b)
@@ -324,7 +321,7 @@ static void exciter_save(t_gobj *z, t_binbuf *b)
int ei,gi;
binbuf_addv(b, "ssiisiiifii", gensym("#X"),gensym("obj"),
- (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix,
+ (t_int)text_xpix(&x->x_obj, x->x_glist), (t_int)text_ypix(&x->x_obj, x->x_glist),
gensym("exciter"), x->x_width, x->x_height,
x->x_nbevents, x->x_timegrain,
x->x_loop, x->x_save
@@ -367,10 +364,9 @@ static void exciter_select(t_gobj *z, t_glist *glist, int selected)
static void exciter_vis(t_gobj *z, t_glist *glist, int vis)
{
- t_exciter *x = (t_exciter *)z;
- t_rtext *y;
+ t_exciter *x = (t_exciter *)z;
- // post("exciter_vis : %d", vis );
+ post("exciter_vis : %d", vis );
if (vis)
{
exciter_draw_new( x, glist );
@@ -496,17 +492,17 @@ static void exciter_delete(t_gobj *z, t_glist *glist)
static void exciter_displace(t_gobj *z, t_glist *glist, int dx, int dy)
{
- t_exciter *x = (t_exciter *)z;
- int xold = x->x_obj.te_xpix;
- int yold = x->x_obj.te_ypix;
+ t_exciter *x = (t_exciter *)z;
+ t_int xold = text_xpix(&x->x_obj, glist);
+ t_int yold = text_ypix(&x->x_obj, glist);
// post( "exciter_displace dx=%d dy=%d", dx, dy );
x->x_obj.te_xpix += dx;
x->x_obj.te_ypix += dy;
- if(xold != x->x_obj.te_xpix || yold != x->x_obj.te_ypix)
+ if(xold != text_xpix(&x->x_obj, glist) || yold != text_ypix(&x->x_obj, glist))
{
- exciter_draw_move(x, x->x_glist);
+ exciter_draw_move(x, glist);
}
}
@@ -514,14 +510,13 @@ static int exciter_click(t_gobj *z, struct _glist *glist,
int xpix, int ypix, int shift, int alt, int dbl, int doit)
{
t_exciter* x = (t_exciter *)z;
- t_canvas *canvas=glist_getcanvas(glist);
t_int nevent, npix;
if ( doit)
{
nevent = ( 1 - ( ( ypix - ( (float)x->x_height / (float) x->x_nbevents / 2 )
- - x->x_obj.te_ypix) / (float)x->x_height ) )*(x->x_nbevents-1);
- npix = ( xpix - 1 - x->x_obj.te_xpix) / EXCITER_PIXEL_GRAIN;
+ - text_ypix(&x->x_obj, glist)) / (float)x->x_height ) )*(x->x_nbevents-1);
+ npix = ( xpix - 1 - text_xpix(&x->x_obj, glist)) / EXCITER_PIXEL_GRAIN;
// post( "exciter : selected event (%d,%d)", nevent, npix );
// set or unset event
{
@@ -542,13 +537,14 @@ static int exciter_click(t_gobj *z, struct _glist *glist,
static t_exciter *exciter_new(t_symbol *s, int argc, t_atom *argv)
{
- int bi, i, ei, gi;
- t_exciter *x;
- t_pd *x2;
+ int bi, i, ei, gi;
+ t_exciter *x;
+ t_pd *x2;
// post( "exciter_new : create : %s argc =%d", s->s_name, argc );
x = (t_exciter *)pd_new(exciter_class);
+ x->x_glist = (t_glist *) canvas_getcurrent();
// new exciter created from the gui
if ( argc != 0 )
{
@@ -600,7 +596,6 @@ static t_exciter *exciter_new(t_symbol *s, int argc, t_atom *argv)
x->x_plooptime = 0L;
x->x_gindex = -1;
x->x_looplength = x->x_timegrain * x->x_width * 1000 / EXCITER_PIXEL_GRAIN;
- x->x_glist = (t_glist *) canvas_getcurrent();
x->x_bangs = (t_outlet **) getbytes( x->x_nbevents*sizeof(t_outlet **) );
for ( bi=0; bi<x->x_nbevents; bi++ )
@@ -622,7 +617,7 @@ static t_exciter *exciter_new(t_symbol *s, int argc, t_atom *argv)
ai += 2;
}
}
- // post( "exciter_new width: %d height : %d", x->x_width, x->x_height );
+ post( "exciter_new width: %d height : %d", x->x_width, x->x_height );
return (x);
}
@@ -685,30 +680,20 @@ static void exciter_reset(t_exciter *x)
static t_int *exciter_perform(t_int *w)
{
- t_int ei, gi;
- t_int gstart, gend;
- t_exciter* x = (t_exciter*)(w[1]);
-#ifdef NT
- time_t et;
- struct _timeb tv;
-#else
- struct timeval tv;
- struct timezone tz;
-#endif
- long long looptime = 0L;
- double preltime = x->x_reltime;
+ t_int ei, gi;
+ t_int gstart, gend;
+ t_exciter* x = (t_exciter*)(w[1]);
+ struct timeval tv;
+ struct timezone tz;
+ long long looptime = 0L;
+ double preltime = x->x_reltime;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
if ( x->x_started )
{
// get current time in ms
-#ifdef NT
- time( &et );
- _ftime( &tv );
- looptime = et*1000 + tv.millitm;
-#else
- gettimeofday( &tv, &tz );
- looptime = tv.tv_sec*1000 + tv.tv_usec/1000;
-#endif
+ gettimeofday( &tv, &tz );
+ looptime = tv.tv_sec*1000 + tv.tv_usec/1000;
if ( x->x_plooptime == 0L )
{
x->x_plooptime = looptime;
@@ -749,7 +734,7 @@ static t_int *exciter_perform(t_int *w)
{
outlet_bang( x->x_bangs[ ei ] );
SYS_VGUI5(".x%x.c itemconfigure %xEVENT%.4d%.4d -fill #00FF00\n",
- glist_getcanvas(x->x_glist), x, gi, ei);
+ canvas, x, gi, ei);
}
}
}
@@ -764,7 +749,7 @@ static t_int *exciter_perform(t_int *w)
if ( *(x->x_sbangs+ei*(x->x_width/EXCITER_PIXEL_GRAIN)+gi ) == 1 )
{
SYS_VGUI5(".x%x.c itemconfigure %xEVENT%.4d%.4d -fill #FFFFFF\n",
- glist_getcanvas(x->x_glist), x, gi, ei);
+ canvas, x, gi, ei);
}
}
}
@@ -790,7 +775,7 @@ static void exciter_free(t_exciter *x)
{
for ( ei=0; ei<x->x_nbevents; ei++ )
{
- outlet_free( x->x_bangs[ei] );
+ outlet_free( x->x_bangs[ei] );
}
freebytes( x->x_bangs, x->x_nbevents*sizeof(t_outlet*) );
}
@@ -822,45 +807,15 @@ void exciter_setup(void)
exciter_widgetbehavior.w_deletefn = exciter_delete;
exciter_widgetbehavior.w_visfn = exciter_vis;
exciter_widgetbehavior.w_clickfn = exciter_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)
+
+#if PD_MINOR_VERSION >= 37
+ class_setpropertiesfn(exciter_class, exciter_properties);
+ class_setsavefn(exciter_class, exciter_save);
+#else
exciter_widgetbehavior.w_propertiesfn = exciter_properties;
exciter_widgetbehavior.w_savefn = exciter_save;
-#else
- class_setsavefn(exciter_class, &exciter_save);
- class_setpropertiesfn(exciter_class, &exciter_properties);
#endif
- class_setwidget(exciter_class, &exciter_widgetbehavior);
-}
-/* OPTIONAL */
- /* callback caught by canvas class for the creation of a exciter */
-/*
-void canvas_exciter(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
-{
- t_atom at;
- t_binbuf *b = binbuf_new();
- int xval, yval;
- int i;
-
- pd_vmess(&gl->gl_pd, gensym("editmode"), "i", 1);
- glist_noselect(gl);
- if ( argc == 0 )
- {
- SETSYMBOL(&at, gensym("exciter"));
- }
- else
- {
- SETSYMBOL(&at, argv[1].a_w.w_symbol);
- }
- binbuf_restore(b, 1, &at);
- glist_getnextxy(gl, &xval, &yval);
- canvas_objtext(gl, xval, yval, 1, b);
- canvas_startmotion(glist_getcanvas(gl));
+ class_setwidget(exciter_class, &exciter_widgetbehavior);
+ class_sethelpsymbol(exciter_class, gensym("exciter.pd"));
}
-*/
diff --git a/filterbank~/CHANGES.LOG b/filterbank~/CHANGES.LOG
index 63318c7..a0b4205 100644
--- a/filterbank~/CHANGES.LOG
+++ b/filterbank~/CHANGES.LOG
@@ -1,2 +1,6 @@
+0.3
+ Added GOP support
+0.2
+ Adapted for pd 0.37
0.1
First filterbank~ implementation
diff --git a/filterbank~/Makefile b/filterbank~/Makefile
index 1052ae7..121a5c8 100644
--- a/filterbank~/Makefile
+++ b/filterbank~/Makefile
@@ -79,7 +79,7 @@ LINUXINCLUDE = -I../../src
cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
.c.pd_linux:
- ../tk2c.bash < $*.tk > $*.tk2c
+ ./tk2c.bash < $*.tk > $*.tk2c
cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm
strip --strip-unneeded $*.pd_linux
diff --git a/filterbank~/filterbank~.c b/filterbank~/filterbank~.c
index 09dcb8f..51a2998 100644
--- a/filterbank~/filterbank~.c
+++ b/filterbank~/filterbank~.c
@@ -35,7 +35,6 @@
#ifdef NT
#include <io.h>
-#define random rand
#else
#include <unistd.h>
#endif
@@ -46,7 +45,7 @@
#define FILTERBANK_OUTLET_WIDTH 5
#define FILTERBANK_HEIGHT 16
-static char *filterbank_version = "filterbank : responses from a set of band-pass filters, version 0.1 (ydegoyon@free.fr)";
+static char *filterbank_version = "filterbank : responses from a set of band-pass filters, version 0.3 (ydegoyon@free.fr)";
t_widgetbehavior filterbank_widgetbehavior;
static t_class *filterbank_class_tilde;
@@ -132,34 +131,34 @@ static void filterbank_draw_new(t_filterbank_tilde *x, t_glist *glist)
SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill #FFFFFF -tags %xFILTERBANK\n",
canvas,
- x->x_obj.te_xpix,
- x->x_obj.te_ypix,
- x->x_obj.te_xpix + x->x_width,
- x->x_obj.te_ypix + x->x_height,
+ text_xpix(&x->x_obj, glist),
+ text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist) + x->x_width,
+ text_ypix(&x->x_obj, glist) + x->x_height,
x);
SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill #000000 -tags %xSIN\n",
canvas,
- x->x_obj.te_xpix,
- x->x_obj.te_ypix-1,
- x->x_obj.te_xpix+7,
- x->x_obj.te_ypix,
+ text_xpix(&x->x_obj, glist),
+ text_ypix(&x->x_obj, glist)-1,
+ text_xpix(&x->x_obj, glist)+7,
+ text_ypix(&x->x_obj, glist),
x);
for ( fi=0; fi<x->x_nbfilters; fi++ )
{
char color[8];
- sprintf( color, "#%.2x%.2x%.2x", random() % 256, random() % 256, random() % 256 );
+ sprintf( color, "#%.2x%.2x%.2x", (int)random() % 256, (int)random() % 256, (int)random() % 256 );
SYS_VGUI11(".x%x.c create polygon %d %d %d %d %d %d -outline #000000 -fill %s -tags %xFILTER%d\n",
canvas,
- x->x_obj.te_xpix + fi*x->x_width/x->x_nbfilters,
- x->x_obj.te_ypix,
- x->x_obj.te_xpix + fi*x->x_width/x->x_nbfilters + x->x_width/(2*x->x_nbfilters),
- x->x_obj.te_ypix + x->x_height,
- x->x_obj.te_xpix + (fi+1)*x->x_width/x->x_nbfilters,
- x->x_obj.te_ypix,
+ text_xpix(&x->x_obj, glist) + fi*x->x_width/x->x_nbfilters,
+ text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist) + fi*x->x_width/x->x_nbfilters + x->x_width/(2*x->x_nbfilters),
+ text_ypix(&x->x_obj, glist) + x->x_height,
+ text_xpix(&x->x_obj, glist) + (fi+1)*x->x_width/x->x_nbfilters,
+ text_ypix(&x->x_obj, glist),
color, x, fi);
}
}
@@ -174,30 +173,30 @@ static void filterbank_draw_move(t_filterbank_tilde *x, t_glist *glist)
SYS_VGUI7(".x%x.c coords %xFILTERBANK %d %d %d %d\n",
canvas, x,
- x->x_obj.te_xpix,
- x->x_obj.te_ypix,
- x->x_obj.te_xpix + x->x_width,
- x->x_obj.te_ypix + x->x_height
+ text_xpix(&x->x_obj, glist),
+ text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist) + x->x_width,
+ text_ypix(&x->x_obj, glist) + x->x_height
);
SYS_VGUI7(".x%x.c coords %xSIN %d %d %d %d\n",
canvas, x,
- x->x_obj.te_xpix,
- x->x_obj.te_ypix-1,
- x->x_obj.te_xpix+7,
- x->x_obj.te_ypix
+ text_xpix(&x->x_obj, glist),
+ text_ypix(&x->x_obj, glist)-1,
+ text_xpix(&x->x_obj, glist)+7,
+ text_ypix(&x->x_obj, glist)
);
for ( fi=0; fi<x->x_nbfilters; fi++ )
{
SYS_VGUI10(".x%x.c coords %xFILTER%d %d %d %d %d %d %d\n",
canvas, x, fi,
- x->x_obj.te_xpix + fi*x->x_width/x->x_nbfilters,
- x->x_obj.te_ypix,
- x->x_obj.te_xpix + fi*x->x_width/x->x_nbfilters + x->x_width/(2*x->x_nbfilters),
- x->x_obj.te_ypix + x->x_height,
- x->x_obj.te_xpix + (fi+1)*x->x_width/x->x_nbfilters,
- x->x_obj.te_ypix
+ text_xpix(&x->x_obj, glist) + fi*x->x_width/x->x_nbfilters,
+ text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist) + fi*x->x_width/x->x_nbfilters + x->x_width/(2*x->x_nbfilters),
+ text_ypix(&x->x_obj, glist) + x->x_height,
+ text_xpix(&x->x_obj, glist) + (fi+1)*x->x_width/x->x_nbfilters,
+ text_ypix(&x->x_obj, glist)
);
}
@@ -241,10 +240,10 @@ static void filterbank_getrect(t_gobj *z, t_glist *owner,
{
t_filterbank_tilde* x = (t_filterbank_tilde*)z;
- *xp1 = x->x_obj.te_xpix;
- *yp1 = x->x_obj.te_ypix;
- *xp2 = x->x_obj.te_xpix+x->x_width;
- *yp2 = x->x_obj.te_ypix+x->x_height;
+ *xp1 = text_xpix(&x->x_obj, owner);
+ *yp1 = text_ypix(&x->x_obj, owner);
+ *xp2 = text_xpix(&x->x_obj, owner)+x->x_width;
+ *yp2 = text_ypix(&x->x_obj, owner)+x->x_height;
}
static void filterbank_save(t_gobj *z, t_binbuf *b)
@@ -253,7 +252,7 @@ static void filterbank_save(t_gobj *z, t_binbuf *b)
t_int ii;
binbuf_addv(b, "ssiisiii", gensym("#X"),gensym("obj"),
- (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix,
+ (t_int)text_xpix(&x->x_obj, x->x_glist), (t_int)text_ypix(&x->x_obj, x->x_glist),
gensym("filterbank~"), x->x_lowfreq, x->x_highfreq,
x->x_nbfilters );
binbuf_addv(b, ";");
@@ -380,14 +379,14 @@ static void filterbank_delete(t_gobj *z, t_glist *glist)
static void filterbank_displace(t_gobj *z, t_glist *glist, int dx, int dy)
{
t_filterbank_tilde *x = (t_filterbank_tilde *)z;
- int xold = x->x_obj.te_xpix;
- int yold = x->x_obj.te_ypix;
+ int xold = text_xpix(&x->x_obj, glist);
+ int yold = text_ypix(&x->x_obj, glist);
// post( "filterbank_displace dx=%d dy=%d", dx, dy );
x->x_obj.te_xpix += dx;
x->x_obj.te_ypix += dy;
- if(xold != x->x_obj.te_xpix || yold != x->x_obj.te_ypix)
+ if(xold != text_xpix(&x->x_obj, glist) || yold != text_ypix(&x->x_obj, glist) )
{
filterbank_draw_move(x, x->x_glist);
}
@@ -655,18 +654,14 @@ void filterbank_tilde_setup(void)
filterbank_widgetbehavior.w_deletefn = filterbank_delete;
filterbank_widgetbehavior.w_visfn = filterbank_vis;
filterbank_widgetbehavior.w_clickfn = NULL;
- /*
- * <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)
+
+#if PD_MINOR_VERSION >= 37
+ class_setpropertiesfn(filterbank_class_tilde, filterbank_properties);
+ class_setsavefn(filterbank_class_tilde, filterbank_save);
+#else
filterbank_widgetbehavior.w_propertiesfn = filterbank_properties;
filterbank_widgetbehavior.w_savefn = filterbank_save;
-#else
- class_setsavefn(filterbank_class_tilde, &filterbank_save);
- class_setpropertiesfn(filterbank_class_tilde, &filterbank_properties);
#endif
class_setwidget(filterbank_class_tilde, &filterbank_widgetbehavior);
+ class_sethelpsymbol(filterbank_class_tilde, gensym("filterbank~.pd"));
}
diff --git a/filterbank~/filterbank~.h b/filterbank~/filterbank~.h
index e458f61..7b3be8d 100644
--- a/filterbank~/filterbank~.h
+++ b/filterbank~/filterbank~.h
@@ -40,7 +40,7 @@
#include <stdio.h>
#include <math.h>
#include <ctype.h>
-#include <m_pd.h>
+#include "m_pd.h"
#include "m_imp.h"
#include "g_canvas.h"
#include "t_tk.h"
diff --git a/grid/CHANGES.LOG b/grid/CHANGES.LOG
index 339b742..7706b29 100644
--- a/grid/CHANGES.LOG
+++ b/grid/CHANGES.LOG
@@ -1,3 +1,5 @@
+0.6
+ added GOP support
0.5
Adapted for pd 0.37
0.4
diff --git a/grid/grid.c b/grid/grid.c
index e982027..3e1bfd9 100644
--- a/grid/grid.c
+++ b/grid/grid.c
@@ -35,7 +35,7 @@ static int gridcount=0;
static int guidebug=0;
static int pointsize = 5;
-static char *grid_version = "grid: version 0.5, written by Yves Degoyon (ydegoyon@free.fr)";
+static char *grid_version = "grid: version 0.6, written by Yves Degoyon (ydegoyon@free.fr)";
#define GRID_SYS_VGUI2(a,b) if (guidebug) \
post(a,b);\
@@ -60,8 +60,8 @@ static char *grid_version = "grid: version 0.5, written by Yves Degoyon (ydego
/* drawing functions */
static void grid_draw_update(t_grid *x, t_glist *glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
- t_int xpoint=x->x_current, ypoint=x->y_current;
+ t_canvas *canvas=glist_getcanvas(glist);
+ t_int xpoint=x->x_current, ypoint=x->y_current;
// later : try to figure out what's this test for ??
// if (glist_isvisible(glist))
@@ -72,12 +72,12 @@ static void grid_draw_update(t_grid *x, t_glist *glist)
GRID_SYS_VGUI3(".x%x.c delete %xPOINT\n", canvas, x);
}
- if ( x->x_current < x->x_obj.te_xpix ) xpoint = x->x_obj.te_xpix;
- if ( x->x_current > x->x_obj.te_xpix + x->x_width - pointsize )
- xpoint = x->x_obj.te_xpix + x->x_width - pointsize;
- if ( x->y_current < x->x_obj.te_ypix ) ypoint = x->x_obj.te_ypix;
- if ( x->y_current > x->x_obj.te_ypix + x->x_height - pointsize )
- ypoint = x->x_obj.te_ypix + x->x_height - pointsize;
+ if ( x->x_current < text_xpix(&x->x_obj, glist) ) xpoint = text_xpix(&x->x_obj, glist);
+ if ( x->x_current > text_xpix(&x->x_obj, glist) + x->x_width - pointsize )
+ xpoint = text_xpix(&x->x_obj, glist) + x->x_width - pointsize;
+ if ( x->y_current < text_ypix(&x->x_obj, glist) ) ypoint = text_ypix(&x->x_obj, glist);
+ if ( x->y_current > text_ypix(&x->x_obj, glist) + x->x_height - pointsize )
+ ypoint = text_ypix(&x->x_obj, glist) + x->x_height - pointsize;
// draw the selected point
GRID_SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill #FF0000 -tags %xPOINT\n",
canvas, xpoint, ypoint, xpoint+pointsize, ypoint+pointsize, x);
@@ -91,44 +91,44 @@ static void grid_draw_update(t_grid *x, t_glist *glist)
static void grid_draw_new(t_grid *x, t_glist *glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
- char *tagRoot;
+ t_canvas *canvas=glist_getcanvas(glist);
+ char *tagRoot;
rtext_new(glist, (t_text *)x );
tagRoot = rtext_gettag(glist_findrtext(glist,(t_text *)x));
GRID_SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill #124392 -tags %xGRID\n",
- canvas, x->x_obj.te_xpix, x->x_obj.te_ypix,
- x->x_obj.te_xpix + x->x_width, x->x_obj.te_ypix + x->x_height,
+ canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height,
x);
GRID_SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -tags %so0\n",
- canvas, x->x_obj.te_xpix, x->x_obj.te_ypix + x->x_height+1,
- x->x_obj.te_xpix+7, x->x_obj.te_ypix + x->x_height+2,
+ canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist) + x->x_height+1,
+ text_xpix(&x->x_obj, glist)+7, text_ypix(&x->x_obj, glist) + x->x_height+2,
tagRoot);
GRID_SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -tags %so1\n",
- canvas, x->x_obj.te_xpix+x->x_width-7, x->x_obj.te_ypix + x->x_height+1,
- x->x_obj.te_xpix+x->x_width, x->x_obj.te_ypix + x->x_height+2,
+ canvas, text_xpix(&x->x_obj, glist)+x->x_width-7, text_ypix(&x->x_obj, glist) + x->x_height+1,
+ text_xpix(&x->x_obj, glist)+x->x_width, text_ypix(&x->x_obj, glist) + x->x_height+2,
tagRoot);
if ( x->x_grid )
{
- int xlpos = x->x_obj.te_xpix+x->x_width/x->x_xlines;
- int ylpos = x->x_obj.te_ypix+x->x_height/x->x_ylines;
+ int xlpos = text_xpix(&x->x_obj, glist)+x->x_width/x->x_xlines;
+ int ylpos = text_ypix(&x->x_obj, glist)+x->x_height/x->x_ylines;
int xcount = 1;
int ycount = 1;
- while ( xlpos < x->x_obj.te_xpix+x->x_width )
+ while ( xlpos < text_xpix(&x->x_obj, glist)+x->x_width )
{
GRID_SYS_VGUI9(".x%x.c create line %d %d %d %d -fill #FFFFFF -tags %xLINE%d%d\n",
- canvas, xlpos, x->x_obj.te_ypix,
- xlpos, x->x_obj.te_ypix+x->x_height,
+ canvas, xlpos, text_ypix(&x->x_obj, glist),
+ xlpos, text_ypix(&x->x_obj, glist)+x->x_height,
x, xcount, 0 );
xlpos+=x->x_width/x->x_xlines;
xcount++;
}
- while ( ylpos < x->x_obj.te_ypix+x->x_height )
+ while ( ylpos < text_ypix(&x->x_obj, glist)+x->x_height )
{
GRID_SYS_VGUI9(".x%x.c create line %d %d %d %d -fill #FFFFFF -tags %xLINE%d%d\n",
- canvas, x->x_obj.te_xpix, ylpos,
- x->x_obj.te_xpix+x->x_width, ylpos,
+ canvas, text_xpix(&x->x_obj, glist), ylpos,
+ text_xpix(&x->x_obj, glist)+x->x_width, ylpos,
x, 0, ycount);
ylpos+=x->x_height/x->x_ylines;
ycount++;
@@ -139,45 +139,45 @@ static void grid_draw_new(t_grid *x, t_glist *glist)
static void grid_draw_move(t_grid *x, t_glist *glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
- char *tagRoot;
+ t_canvas *canvas=glist_getcanvas(glist);
+ char *tagRoot;
tagRoot = rtext_gettag(glist_findrtext(glist,(t_text *)x));
GRID_SYS_VGUI7(".x%x.c coords %xGRID %d %d %d %d\n",
canvas, x,
- x->x_obj.te_xpix, x->x_obj.te_ypix,
- x->x_obj.te_xpix+x->x_width, x->x_obj.te_ypix+x->x_height);
+ text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist)+x->x_width, text_ypix(&x->x_obj, glist)+x->x_height);
GRID_SYS_VGUI7(".x%x.c coords %so0 %d %d %d %d\n",
canvas, tagRoot,
- x->x_obj.te_xpix, x->x_obj.te_ypix + x->x_height+1,
- x->x_obj.te_xpix+7, x->x_obj.te_ypix + x->x_height+2 );
+ text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist) + x->x_height+1,
+ text_xpix(&x->x_obj, glist)+7, text_ypix(&x->x_obj, glist) + x->x_height+2 );
GRID_SYS_VGUI7(".x%x.c coords %so1 %d %d %d %d\n",
canvas, tagRoot,
- x->x_obj.te_xpix+x->x_width-7, x->x_obj.te_ypix + x->x_height+1,
- x->x_obj.te_xpix+x->x_width, x->x_obj.te_ypix + x->x_height+2 );
+ text_xpix(&x->x_obj, glist)+x->x_width-7, text_ypix(&x->x_obj, glist) + x->x_height+1,
+ text_xpix(&x->x_obj, glist)+x->x_width, text_ypix(&x->x_obj, glist) + x->x_height+2 );
if ( x->x_point )
{
grid_draw_update(x, glist);
}
if ( x->x_grid )
{
- int xlpos = x->x_obj.te_xpix+x->x_width/x->x_xlines;
- int ylpos = x->x_obj.te_ypix+x->x_height/x->x_ylines;
+ int xlpos = text_xpix(&x->x_obj, glist)+x->x_width/x->x_xlines;
+ int ylpos = text_ypix(&x->x_obj, glist)+x->x_height/x->x_ylines;
int xcount = 1;
int ycount = 1;
- while ( xlpos < x->x_obj.te_xpix+x->x_width )
+ while ( xlpos < text_xpix(&x->x_obj, glist)+x->x_width )
{
GRID_SYS_VGUI9(".x%x.c coords %xLINE%d%d %d %d %d %d\n",
- canvas, x, xcount, 0, xlpos, x->x_obj.te_ypix,
- xlpos, x->x_obj.te_ypix + x->x_height);
+ canvas, x, xcount, 0, xlpos, text_ypix(&x->x_obj, glist),
+ xlpos, text_ypix(&x->x_obj, glist) + x->x_height);
xlpos+=x->x_width/x->x_xlines;
xcount++;
}
- while ( ylpos < x->x_obj.te_ypix+x->x_height )
+ while ( ylpos < text_ypix(&x->x_obj, glist)+x->x_height )
{
GRID_SYS_VGUI9(".x%x.c coords %xLINE%d%d %d %d %d %d\n",
- canvas, x, 0, ycount, x->x_obj.te_xpix, ylpos,
- x->x_obj.te_xpix + x->x_width, ylpos);
+ canvas, x, 0, ycount, text_xpix(&x->x_obj, glist), ylpos,
+ text_xpix(&x->x_obj, glist) + x->x_width, ylpos);
ylpos+=x->x_height/x->x_ylines;
ycount++;
}
@@ -187,9 +187,9 @@ static void grid_draw_move(t_grid *x, t_glist *glist)
static void grid_draw_erase(t_grid* x,t_glist* glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
- int i;
- char *tagRoot;
+ t_canvas *canvas=glist_getcanvas(glist);
+ int i;
+ char *tagRoot;
tagRoot = rtext_gettag(glist_findrtext(glist,(t_text *)x));
GRID_SYS_VGUI3(".x%x.c delete %xGRID\n", canvas, x);
@@ -216,7 +216,7 @@ static void grid_draw_erase(t_grid* x,t_glist* glist)
static void grid_draw_select(t_grid* x,t_glist* glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
+ t_canvas *canvas=glist_getcanvas(glist);
if(x->x_selected)
{
@@ -236,14 +236,14 @@ static void grid_output_current(t_grid* x)
t_float xvalue, yvalue;
t_float xmodstep, ymodstep;
- xvalue = x->x_min + (x->x_current - x->x_obj.te_xpix) * (x->x_max-x->x_min) / x->x_width ;
+ xvalue = x->x_min + (x->x_current - text_xpix(&x->x_obj, x->x_glist)) * (x->x_max-x->x_min) / x->x_width ;
if (xvalue < x->x_min ) xvalue = x->x_min;
if (xvalue > x->x_max ) xvalue = x->x_max;
xmodstep = ((float)((int)(xvalue*10000) % (int)(x->x_xstep*10000))/10000.);
xvalue = xvalue - xmodstep;
outlet_float( x->x_xoutlet, xvalue );
- yvalue = x->y_max - (x->y_current - x->x_obj.te_ypix ) * (x->y_max-x->y_min) / x->x_height ;
+ yvalue = x->y_max - (x->y_current - text_ypix(&x->x_obj, x->x_glist) ) * (x->y_max-x->y_min) / x->x_height ;
if (yvalue < x->y_min ) yvalue = x->y_min;
if (yvalue > x->y_max ) yvalue = x->y_max;
ymodstep = ((float)((int)(yvalue*10000) % (int)(x->x_ystep*10000))/10000.);
@@ -259,10 +259,10 @@ static void grid_getrect(t_gobj *z, t_glist *owner,
{
t_grid* x = (t_grid*)z;
- *xp1 = x->x_obj.te_xpix;
- *yp1 = x->x_obj.te_ypix;
- *xp2 = x->x_obj.te_xpix+x->x_width;
- *yp2 = x->x_obj.te_ypix+x->x_height;
+ *xp1 = text_xpix(&x->x_obj, x->x_glist);
+ *yp1 = text_ypix(&x->x_obj, x->x_glist);
+ *xp2 = text_xpix(&x->x_obj, x->x_glist)+x->x_width;
+ *yp2 = text_ypix(&x->x_obj, x->x_glist)+x->x_height;
}
static void grid_save(t_gobj *z, t_binbuf *b)
@@ -271,7 +271,7 @@ static void grid_save(t_gobj *z, t_binbuf *b)
// post( "saving grid : %s", x->x_name->s_name );
binbuf_addv(b, "ssiissiffiffiffiiff", gensym("#X"),gensym("obj"),
- (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix,
+ (t_int)text_xpix(&x->x_obj, x->x_glist), (t_int)text_ypix(&x->x_obj, x->x_glist),
gensym("grid"), x->x_name, x->x_width, x->x_min,
x->x_max, x->x_height,
x->y_min, x->y_max,
@@ -361,8 +361,8 @@ static void grid_delete(t_gobj *z, t_glist *glist)
static void grid_displace(t_gobj *z, t_glist *glist, int dx, int dy)
{
t_grid *x = (t_grid *)z;
- int xold = x->x_obj.te_xpix;
- int yold = x->x_obj.te_ypix;
+ int xold = text_xpix(&x->x_obj, glist);
+ int yold = text_ypix(&x->x_obj, glist);
// post( "grid_displace dx=%d dy=%d", dx, dy );
@@ -370,7 +370,7 @@ static void grid_displace(t_gobj *z, t_glist *glist, int dx, int dy)
x->x_current += dx;
x->x_obj.te_ypix += dy;
x->y_current += dy;
- if(xold != x->x_obj.te_xpix || yold != x->x_obj.te_ypix)
+ if(xold != text_xpix(&x->x_obj, glist) || yold != text_ypix(&x->x_obj, glist))
{
grid_draw_move(x, x->x_glist);
}
@@ -422,8 +422,8 @@ static void grid_goto(t_grid *x, t_floatarg newx, t_floatarg newy)
// post( "grid_set x=%f y=%f", newx, newy );
- x->x_current = newx + x->x_obj.te_xpix;
- x->y_current = newy + x->x_obj.te_ypix;
+ x->x_current = newx + text_xpix(&x->x_obj, x->x_glist);
+ x->y_current = newy + text_ypix(&x->x_obj, x->x_glist);
if(xold != x->x_current || yold != x->y_current)
{
grid_output_current(x);
@@ -439,12 +439,12 @@ static void grid_values(t_grid* x, t_floatarg xvalue, t_floatarg yvalue)
if (xvalue < x->x_min ) xvalue = x->x_min;
if (xvalue > x->x_max ) xvalue = x->x_max;
- x->x_current = x->x_obj.te_xpix + ((xvalue - x->x_min) / x->x_max) * x->x_width;
+ x->x_current = text_xpix(&x->x_obj, x->x_glist) + ((xvalue - x->x_min) / x->x_max) * x->x_width;
if (yvalue < x->y_min ) yvalue = x->y_min;
if (yvalue > x->y_max ) yvalue = x->y_max;
- x->y_current = x->x_obj.te_ypix + (1 - ((yvalue - x->y_min) / x->y_max)) * x->x_height;
+ x->y_current = text_ypix(&x->x_obj, x->x_glist) + (1 - ((yvalue - x->y_min) / x->y_max)) * x->x_height;
if(xold != x->x_current || yold != x->y_current) {
grid_output_current(x);
@@ -460,12 +460,12 @@ static void grid_xvalues(t_grid* x, t_floatarg xvalue, t_floatarg yvalue)
if (xvalue < x->x_min ) xvalue = x->x_min;
if (xvalue > x->x_max ) xvalue = x->x_max;
- x->x_current = x->x_obj.te_xpix + ((xvalue - x->x_min) / x->x_max) * x->x_width;
+ x->x_current = text_xpix(&x->x_obj, x->x_glist) + ((xvalue - x->x_min) / x->x_max) * x->x_width;
if (yvalue < x->y_min ) yvalue = x->y_min;
if (yvalue > x->y_max ) yvalue = x->y_max;
- x->y_current = x->x_obj.te_ypix + (1 - ((yvalue - x->y_min) / x->y_max)) * x->x_height;
+ x->y_current = text_ypix(&x->x_obj, x->x_glist) + (1 - ((yvalue - x->y_min) / x->y_max)) * x->x_height;
if(xold != x->x_current || yold != x->y_current) {
grid_draw_update(x, x->x_glist);
@@ -478,11 +478,11 @@ static void grid_valuemotion(t_grid* x, t_floatarg dx, t_floatarg dy)
int yold = x->y_current;
t_float xvalue, yvalue;
- xvalue = x->x_min + (x->x_current - x->x_obj.te_xpix) * (x->x_max-x->x_min) / x->x_width ;
+ xvalue = x->x_min + (x->x_current - text_xpix(&x->x_obj, x->x_glist)) * (x->x_max-x->x_min) / x->x_width ;
if (xvalue < x->x_min ) xvalue = x->x_min;
if (xvalue > x->x_max ) xvalue = x->x_max;
- yvalue = x->y_max - (x->y_current - x->x_obj.te_ypix ) * (x->y_max-x->y_min) / x->x_height ;
+ yvalue = x->y_max - (x->y_current - text_ypix(&x->x_obj, x->x_glist) ) * (x->y_max-x->y_min) / x->x_height ;
if (yvalue < x->y_min ) yvalue = x->y_min;
if (yvalue > x->y_max ) yvalue = x->y_max;
@@ -492,12 +492,12 @@ static void grid_valuemotion(t_grid* x, t_floatarg dx, t_floatarg dy)
if (xvalue < x->x_min ) xvalue = x->x_min;
if (xvalue > x->x_max ) xvalue = x->x_max;
- x->x_current = x->x_obj.te_xpix + ((xvalue - x->x_min) / x->x_max) * x->x_width;
+ x->x_current = text_xpix(&x->x_obj, x->x_glist) + ((xvalue - x->x_min) / x->x_max) * x->x_width;
if (yvalue < x->y_min ) yvalue = x->y_min;
if (yvalue > x->y_max ) yvalue = x->y_max;
- x->y_current = x->x_obj.te_ypix + (1 - ((yvalue - x->y_min) / x->y_max)) * x->x_height;
+ x->y_current = text_ypix(&x->x_obj, x->x_glist) + (1 - ((yvalue - x->y_min) / x->y_max)) * x->x_height;
if(xold != x->x_current || yold != x->y_current) {
grid_output_current(x);
@@ -511,11 +511,11 @@ static void grid_xvaluemotion(t_grid* x, t_floatarg dx, t_floatarg dy)
int yold = x->y_current;
t_float xvalue, yvalue;
- xvalue = x->x_min + (x->x_current - x->x_obj.te_xpix) * (x->x_max-x->x_min) / x->x_width ;
+ xvalue = x->x_min + (x->x_current - text_xpix(&x->x_obj, x->x_glist)) * (x->x_max-x->x_min) / x->x_width ;
if (xvalue < x->x_min ) xvalue = x->x_min;
if (xvalue > x->x_max ) xvalue = x->x_max;
- yvalue = x->y_max - (x->y_current - x->x_obj.te_ypix ) * (x->y_max-x->y_min) / x->x_height ;
+ yvalue = x->y_max - (x->y_current - text_ypix(&x->x_obj, x->x_glist) ) * (x->y_max-x->y_min) / x->x_height ;
if (yvalue < x->y_min ) yvalue = x->y_min;
if (yvalue > x->y_max ) yvalue = x->y_max;
@@ -525,12 +525,12 @@ static void grid_xvaluemotion(t_grid* x, t_floatarg dx, t_floatarg dy)
if (xvalue < x->x_min ) xvalue = x->x_min;
if (xvalue > x->x_max ) xvalue = x->x_max;
- x->x_current = x->x_obj.te_xpix + ((xvalue - x->x_min) / x->x_max) * x->x_width;
+ x->x_current = text_xpix(&x->x_obj, x->x_glist) + ((xvalue - x->x_min) / x->x_max) * x->x_width;
if (yvalue < x->y_min ) yvalue = x->y_min;
if (yvalue > x->y_max ) yvalue = x->y_max;
- x->y_current = x->x_obj.te_ypix + (1 - ((yvalue - x->y_min) / x->y_max)) * x->x_height;
+ x->y_current = text_ypix(&x->x_obj, x->x_glist) + (1 - ((yvalue - x->y_min) / x->y_max)) * x->x_height;
if(xold != x->x_current || yold != x->y_current) {
grid_draw_update(x, x->x_glist);
diff --git a/grid/help-grid.pd b/grid/help-grid.pd
index b31c29e..663237f 100644
--- a/grid/help-grid.pd
+++ b/grid/help-grid.pd
@@ -1,7 +1,7 @@
#N canvas 26 1 763 647 10;
-#X obj 71 76 grid grid1 200 0 199 200 0 199 1 1 1 10 10 188 197;
-#X floatatom 72 293 5 0 0;
-#X floatatom 257 282 5 0 0;
+#X obj 72 77 grid grid1 200 0 199 200 0 199 1 1 1 10 10 192 224;
+#X floatatom 72 293 5 0 0 0 - - -;
+#X floatatom 257 282 5 0 0 0 - - -;
#X text 41 21 Grid is a 2-dimensional control object;
#X text 319 449 (invoke with <right mouse>Properties );
#X text 322 439 You can set the following properties :;
@@ -28,12 +28,12 @@ grid;
#X msg 587 271 \; pd dsp 0;
#X msg 653 271 \; pd dsp 1;
#X obj 276 417 *~;
-#X floatatom 276 360 0 0 0;
+#X floatatom 276 360 0 0 0 0 - - -;
#X obj 357 397 line~;
-#X floatatom 188 380 0 0 0;
+#X floatatom 188 380 0 0 0 0 - - -;
#X obj 188 494 cos~;
#X obj 188 450 +~;
-#X floatatom 228 506 0 0 100;
+#X floatatom 228 506 0 0 100 0 - - -;
#N canvas 159 26 495 270 output 0;
#X obj 338 160 t b;
#X obj 338 110 f;
@@ -89,7 +89,7 @@ grid;
#X msg 266 506 MUTE;
#X obj 276 385 osc~ 0;
#X obj 357 371 pack 0 50;
-#X floatatom 357 318 0 0 0;
+#X floatatom 357 318 0 0 0 0 - - -;
#X obj 357 345 / 100;
#X text 188 345 carrier;
#X text 184 355 frequency;
@@ -104,34 +104,34 @@ grid;
#X text 393 325 in hundredths;
#X text 40 32 It was inspired by the chaospad device;
#X text 346 568 * Y step : Y delta for an Y update;
-#X floatatom 474 85 5 0 0;
-#X floatatom 586 84 5 0 0;
+#X floatatom 474 85 5 0 0 0 - - -;
+#X floatatom 586 84 5 0 0 0 - - -;
#X obj 411 82 pack f f;
#X msg 332 81 goto \$1 \$2;
#X msg 546 83 bang;
#X text 524 84 X;
#X text 333 63 Set position :;
#X text 631 85 Y;
-#X floatatom 486 120 5 0 0;
-#X floatatom 586 121 5 0 0;
+#X floatatom 486 120 5 0 0 0 - - -;
+#X floatatom 586 121 5 0 0 0 - - -;
#X obj 423 119 pack f f;
#X msg 546 120 bang;
#X text 530 120 X;
#X text 634 121 Y;
-#X floatatom 528 156 5 0 0;
-#X floatatom 633 156 5 0 0;
+#X floatatom 528 156 5 0 0 0 - - -;
+#X floatatom 633 156 5 0 0 0 - - -;
#X obj 465 153 pack f f;
#X msg 593 154 bang;
#X text 578 155 X;
#X text 679 156 Y;
-#X floatatom 503 191 5 0 0;
-#X floatatom 607 190 5 0 0;
+#X floatatom 503 191 5 0 0 0 - - -;
+#X floatatom 607 190 5 0 0 0 - - -;
#X obj 440 188 pack f f;
#X msg 568 189 bang;
#X text 553 190 X;
#X text 656 191 Y;
-#X floatatom 539 224 5 0 0;
-#X floatatom 638 226 5 0 0;
+#X floatatom 539 224 5 0 0 0 - - -;
+#X floatatom 638 226 5 0 0 0 - - -;
#X obj 472 223 pack f f;
#X msg 600 224 bang;
#X text 585 225 X;
diff --git a/pianoroll/CHANGES.LOG b/pianoroll/CHANGES.LOG
index 59034b6..bb8e709 100644
--- a/pianoroll/CHANGES.LOG
+++ b/pianoroll/CHANGES.LOG
@@ -1,3 +1,7 @@
+0.9
+ added GOP support
+0.8
+ adapted for pd 0.37
0.7
added "pitch x y" and "volume x y" messages
0.6
diff --git a/pianoroll/Makefile b/pianoroll/Makefile
index ccd162c..cb90cf2 100644
--- a/pianoroll/Makefile
+++ b/pianoroll/Makefile
@@ -67,7 +67,7 @@ LINUXCFLAGS = -DPD -DUNIX -DICECAST -O2 -funroll-loops -fomit-frame-pointer \
LINUXINCLUDE = -I../../src
.c.pd_linux:
- ../tk2c.bash < $*.tk >$*.tk2c
+ ./tk2c.bash < $*.tk >$*.tk2c
cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm
strip --strip-unneeded $*.pd_linux
diff --git a/pianoroll/pianoroll.c b/pianoroll/pianoroll.c
index 1cc0a07..da23357 100644
--- a/pianoroll/pianoroll.c
+++ b/pianoroll/pianoroll.c
@@ -36,7 +36,7 @@
#include <stdio.h>
#include <math.h>
#include <ctype.h>
-#include <m_pd.h>
+#include "m_pd.h"
#include "m_imp.h"
#include "g_canvas.h"
#include "t_tk.h"
@@ -60,7 +60,7 @@ void canvas_startmotion(t_canvas *x);
#define DEFAULT_SEQUENCER_PITCH_MIN -15
#define DEFAULT_SEQUENCER_PITCH_MAX 15
-static char *pianoroll_version = "pianoroll: a graphical sequencer controller, version 0.7 (ydegoyon@free.fr)";
+static char *pianoroll_version = "pianoroll: a graphical sequencer controller, version 0.9 (ydegoyon@free.fr)";
t_widgetbehavior pianoroll_widgetbehavior;
static t_class *pianoroll_class;
@@ -96,9 +96,9 @@ static int pointsize = 5;
/* drawing functions */
static void pianoroll_draw_update(t_pianoroll *x, t_glist *glist)
{
- int si;
+ t_int si;
+ t_canvas *canvas=glist_getcanvas(glist);
- t_canvas *canvas=glist_getcanvas(glist);
for ( si=0; si<x->x_nbsteps; si++ )
{
int vi = (int)((1.0-x->x_volumes[si])*(x->x_nbgrades-1));
@@ -113,7 +113,7 @@ static void pianoroll_draw_update(t_pianoroll *x, t_glist *glist)
static void pianoroll_draw_new(t_pianoroll *x, t_glist *glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
+ t_canvas *canvas=glist_getcanvas(glist);
// draw the grid
{
@@ -126,17 +126,17 @@ static void pianoroll_draw_new(t_pianoroll *x, t_glist *glist)
{
SYS_VGUI9(".x%x.c create rectangle %d %d %d %d -fill #771623 -outline #998121 -tags %xPITCH%.4d%.4d\n",
canvas,
- x->x_obj.te_xpix+(int)(gi*xgstep),
- x->x_obj.te_ypix+(int)(gj*ygstep),
- x->x_obj.te_xpix+(int)(gi*xgstep)+(int)(2*xgstep/3),
- x->x_obj.te_ypix+(int)((gj+1)*ygstep),
+ text_xpix(&x->x_obj, glist)+(int)(gi*xgstep),
+ text_ypix(&x->x_obj, glist)+(int)(gj*ygstep),
+ text_xpix(&x->x_obj, glist)+(int)(gi*xgstep)+(int)(2*xgstep/3),
+ text_ypix(&x->x_obj, glist)+(int)((gj+1)*ygstep),
x, gi, gj );
SYS_VGUI9(".x%x.c create rectangle %d %d %d %d -fill #562663 -outline #998121 -tags %xVOLUME%.4d%.4d\n",
canvas,
- x->x_obj.te_xpix+(int)(gi*xgstep)+(int)(2*xgstep/3),
- x->x_obj.te_ypix+(int)(gj*ygstep),
- x->x_obj.te_xpix+(int)((gi+1)*xgstep),
- x->x_obj.te_ypix+(int)((gj+1)*ygstep),
+ text_xpix(&x->x_obj, glist)+(int)(gi*xgstep)+(int)(2*xgstep/3),
+ text_ypix(&x->x_obj, glist)+(int)(gj*ygstep),
+ text_xpix(&x->x_obj, glist)+(int)((gi+1)*xgstep),
+ text_ypix(&x->x_obj, glist)+(int)((gj+1)*ygstep),
x, gi, gj );
}
}
@@ -145,16 +145,16 @@ static void pianoroll_draw_new(t_pianoroll *x, t_glist *glist)
x->x_height = (int)((x->x_nbgrades)*ygstep);
}
SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -tags %xIN\n",
- canvas, x->x_obj.te_xpix, x->x_obj.te_ypix - 1,
- x->x_obj.te_xpix+7, x->x_obj.te_ypix,
+ canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist) - 1,
+ text_xpix(&x->x_obj, glist)+7, text_ypix(&x->x_obj, glist),
x);
SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -tags %xOUTL\n",
- canvas, x->x_obj.te_xpix, x->x_obj.te_ypix + x->x_height+1,
- x->x_obj.te_xpix+7, x->x_obj.te_ypix + x->x_height+2,
+ canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist) + x->x_height+1,
+ text_xpix(&x->x_obj, glist)+7, text_ypix(&x->x_obj, glist) + x->x_height+2,
x);
SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -tags %xOUTR\n",
- canvas, x->x_obj.te_xpix+x->x_width-7, x->x_obj.te_ypix + x->x_height+1,
- x->x_obj.te_xpix+x->x_width, x->x_obj.te_ypix + x->x_height+2,
+ canvas, text_xpix(&x->x_obj, glist)+x->x_width-7, text_ypix(&x->x_obj, glist) + x->x_height+1,
+ text_xpix(&x->x_obj, glist)+x->x_width, text_ypix(&x->x_obj, glist) + x->x_height+2,
x);
canvas_fixlinesfor( canvas, (t_text*)x );
@@ -162,7 +162,7 @@ static void pianoroll_draw_new(t_pianoroll *x, t_glist *glist)
static void pianoroll_draw_move(t_pianoroll *x, t_glist *glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
+ t_canvas *canvas=glist_getcanvas(glist);
// move the grid
{
@@ -175,40 +175,40 @@ static void pianoroll_draw_move(t_pianoroll *x, t_glist *glist)
{
SYS_VGUI9(".x%x.c coords %xPITCH%.4d%.4d %d %d %d %d\n",
canvas, x, gi, gj,
- x->x_obj.te_xpix+(int)(gi*xgstep),
- x->x_obj.te_ypix+(int)(gj*ygstep),
- x->x_obj.te_xpix+(int)(gi*xgstep)+(int)(2*xgstep/3),
- x->x_obj.te_ypix+(int)((gj+1)*ygstep)
+ text_xpix(&x->x_obj, glist)+(int)(gi*xgstep),
+ text_ypix(&x->x_obj, glist)+(int)(gj*ygstep),
+ text_xpix(&x->x_obj, glist)+(int)(gi*xgstep)+(int)(2*xgstep/3),
+ text_ypix(&x->x_obj, glist)+(int)((gj+1)*ygstep)
);
SYS_VGUI9(".x%x.c coords %xVOLUME%.4d%.4d %d %d %d %d\n",
canvas, x, gi, gj,
- x->x_obj.te_xpix+(int)(gi*xgstep)+(int)(2*xgstep/3),
- x->x_obj.te_ypix+(int)(gj*ygstep),
- x->x_obj.te_xpix+(int)((gi+1)*xgstep),
- x->x_obj.te_ypix+(int)((gj+1)*ygstep)
+ text_xpix(&x->x_obj, glist)+(int)(gi*xgstep)+(int)(2*xgstep/3),
+ text_ypix(&x->x_obj, glist)+(int)(gj*ygstep),
+ text_xpix(&x->x_obj, glist)+(int)((gi+1)*xgstep),
+ text_ypix(&x->x_obj, glist)+(int)((gj+1)*ygstep)
);
}
}
}
SYS_VGUI7(".x%x.c coords %xIN %d %d %d %d \n",
- canvas, x, x->x_obj.te_xpix, x->x_obj.te_ypix - 1,
- x->x_obj.te_xpix+7, x->x_obj.te_ypix
+ canvas, x, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist) - 1,
+ text_xpix(&x->x_obj, glist)+7, text_ypix(&x->x_obj, glist)
);
SYS_VGUI7(".x%x.c coords %xOUTL %d %d %d %d\n",
- canvas, x, x->x_obj.te_xpix, x->x_obj.te_ypix + x->x_height+1,
- x->x_obj.te_xpix+7, x->x_obj.te_ypix + x->x_height+2
+ canvas, x, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist) + x->x_height+1,
+ text_xpix(&x->x_obj, glist)+7, text_ypix(&x->x_obj, glist) + x->x_height+2
);
SYS_VGUI7(".x%x.c coords %xOUTR %d %d %d %d\n",
- canvas, x, x->x_obj.te_xpix+x->x_width-7, x->x_obj.te_ypix + x->x_height+1,
- x->x_obj.te_xpix+x->x_width, x->x_obj.te_ypix + x->x_height+2
+ canvas, x, text_xpix(&x->x_obj, glist)+x->x_width-7, text_ypix(&x->x_obj, glist) + x->x_height+1,
+ text_xpix(&x->x_obj, glist)+x->x_width, text_ypix(&x->x_obj, glist) + x->x_height+2
);
canvas_fixlinesfor( canvas, (t_text*)x );
}
static void pianoroll_draw_erase(t_pianoroll* x,t_glist* glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
- int i;
+ t_canvas *canvas=glist_getcanvas(glist);
+ t_int i;
SYS_VGUI3(".x%x.c delete %xIN\n", canvas, x);
SYS_VGUI3(".x%x.c delete %xOUTL\n", canvas, x);
@@ -229,7 +229,7 @@ static void pianoroll_draw_erase(t_pianoroll* x,t_glist* glist)
static void pianoroll_draw_select(t_pianoroll* x,t_glist* glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
+ t_canvas *canvas=glist_getcanvas(glist);
if(x->x_selected)
{
@@ -250,20 +250,20 @@ static void pianoroll_getrect(t_gobj *z, t_glist *owner,
{
t_pianoroll* x = (t_pianoroll*)z;
- *xp1 = x->x_obj.te_xpix;
- *yp1 = x->x_obj.te_ypix;
- *xp2 = x->x_obj.te_xpix+x->x_width;
- *yp2 = x->x_obj.te_ypix+x->x_height;
+ *xp1 = text_xpix(&x->x_obj, owner);
+ *yp1 = text_ypix(&x->x_obj, owner);
+ *xp2 = text_xpix(&x->x_obj, owner)+x->x_width;
+ *yp2 = text_ypix(&x->x_obj, owner)+x->x_height;
}
static void pianoroll_save(t_gobj *z, t_binbuf *b)
{
- t_pianoroll *x = (t_pianoroll *)z;
- int i;
+ t_pianoroll *x = (t_pianoroll *)z;
+ t_int i;
// post( "saving pianoroll : %s", x->x_name->s_name );
binbuf_addv(b, "ssiissiiffiiifi", gensym("#X"),gensym("obj"),
- (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix,
+ (t_int)text_xpix(&x->x_obj, x->x_glist), (t_int)text_ypix(&x->x_obj, x->x_glist),
gensym("pianoroll"), x->x_name, x->x_width, x->x_height,
x->x_pmin, x->x_pmax,
x->x_nbgrades, x->x_nbsteps,
@@ -281,8 +281,8 @@ static void pianoroll_save(t_gobj *z, t_binbuf *b)
static void pianoroll_properties(t_gobj *z, t_glist *owner)
{
- char buf[800];
- t_pianoroll *x=(t_pianoroll *)z;
+ char buf[800];
+ t_pianoroll *x=(t_pianoroll *)z;
sprintf(buf, "pdtk_pianoroll_dialog %%s %s %d %d %.2f %.2f %d %d %d %d\n",
x->x_name->s_name, x->x_width, x->x_height, x->x_pmin, x->x_pmax,
@@ -395,8 +395,8 @@ static void pianoroll_delete(t_gobj *z, t_glist *glist)
static void pianoroll_displace(t_gobj *z, t_glist *glist, int dx, int dy)
{
t_pianoroll *x = (t_pianoroll *)z;
- int xold = x->x_obj.te_xpix;
- int yold = x->x_obj.te_ypix;
+ int xold = text_xpix(&x->x_obj, glist);
+ int yold = text_ypix(&x->x_obj, glist);
// post( "pianoroll_displace dx=%d dy=%d", dx, dy );
@@ -411,8 +411,8 @@ static void pianoroll_displace(t_gobj *z, t_glist *glist, int dx, int dy)
static int pianoroll_click(t_gobj *z, struct _glist *glist,
int xpix, int ypix, int shift, int alt, int dbl, int doit)
{
- t_pianoroll* x = (t_pianoroll *)z;
- t_canvas *canvas=glist_getcanvas(glist);
+ t_pianoroll* x = (t_pianoroll *)z;
+ t_canvas *canvas=glist_getcanvas(glist);
if ( doit)
{
@@ -422,12 +422,12 @@ static int pianoroll_click(t_gobj *z, struct _glist *glist,
t_float xgstep = x->x_width/x->x_nbsteps;
t_float ygstep = x->x_height/x->x_nbgrades;
- si = ( xpix - x->x_obj.te_xpix ) / xgstep;
- gi = ( ypix - x->x_obj.te_ypix ) / ygstep;
+ si = ( xpix - text_xpix(&x->x_obj, glist) ) / xgstep;
+ gi = ( ypix - text_ypix(&x->x_obj, glist) ) / ygstep;
// post( "pianoroll : step : %d : grade : %d", si, gi );
- if ( ( xpix - x->x_obj.te_xpix ) > ( si*xgstep+2*xgstep/3 ) )
+ if ( ( xpix - text_xpix(&x->x_obj, glist) ) > ( si*xgstep+2*xgstep/3 ) )
{
{
SYS_VGUI5(".x%x.c itemconfigure %xVOLUME%.4d%.4d -fill #562663\n", canvas, x, si, x->x_ivolumes[ si ] );
@@ -800,18 +800,15 @@ void pianoroll_setup(void)
pianoroll_widgetbehavior.w_deletefn = pianoroll_delete;
pianoroll_widgetbehavior.w_visfn = pianoroll_vis;
pianoroll_widgetbehavior.w_clickfn = pianoroll_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)
+
+#if PD_MINOR_VERSION >= 37
+ class_setpropertiesfn(pianoroll_class, pianoroll_properties);
+ class_setsavefn(pianoroll_class, pianoroll_save);
+#else
pianoroll_widgetbehavior.w_propertiesfn = pianoroll_properties;
pianoroll_widgetbehavior.w_savefn = pianoroll_save;
-#else
- class_setsavefn(pianoroll_class, &pianoroll_save);
- class_setpropertiesfn(pianoroll_class, &pianoroll_properties);
#endif
+
class_setwidget(pianoroll_class, &pianoroll_widgetbehavior);
+ class_sethelpsymbol(pianoroll_class, gensym("pianoroll.pd"));
}
diff --git a/playlist/CHANGES.LOG b/playlist/CHANGES.LOG
index 03f2770..147e03b 100644
--- a/playlist/CHANGES.LOG
+++ b/playlist/CHANGES.LOG
@@ -1,3 +1,5 @@
+0.10
+ added GOP support
0.9
do not output directories ( for clicks and seeks )
fixed cut&paste of playlists
diff --git a/playlist/playlist.c b/playlist/playlist.c
index b753710..d31fd15 100644
--- a/playlist/playlist.c
+++ b/playlist/playlist.c
@@ -35,6 +35,8 @@
#include <math.h>
#include <ctype.h>
#include <regex.h>
+#include <time.h>
+#include <sys/time.h>
#include "m_pd.h"
#include "m_imp.h"
#include "g_canvas.h"
@@ -135,14 +137,17 @@ static void playlist_update_dir(t_playlist *x, t_glist *glist)
t_canvas *canvas=glist_getcanvas(glist);
t_int i;
char wrappedname[ MAX_DIR_LENGTH ];
+ struct timespec tv;
+
+ tv.tv_sec = 0;
+ tv.tv_nsec = 10000000;
// set title
- SYS_VGUI3(".x%x.c delete %xTITLE\n", glist_getcanvas(glist), x);
- SYS_VGUI8(".x%x.c create text %d %d -width %d -text \"%s\" \
- -anchor w -font %s -tags %xTITLE\n",
+ SYS_VGUI3(".x%x.c delete %xTITLE\n", canvas, x);
+ SYS_VGUI8(".x%x.c create text %d %d -width %d -text \"%s\" -anchor w -font %s -tags %xTITLE\n",
canvas,
- x->x_obj.te_xpix+5,
- x->x_obj.te_ypix-10,
+ text_xpix(&x->x_obj, glist)+5,
+ text_ypix(&x->x_obj, glist)-10,
x->x_width,
x->x_curdir,
x->x_font,
@@ -151,7 +156,7 @@ static void playlist_update_dir(t_playlist *x, t_glist *glist)
// delete previous entries
for ( i=x->x_firstseen; i<=x->x_lastseen; i++ )
{
- SYS_VGUI4(".x%x.c delete %xENTRY%d\n", glist_getcanvas(glist), x, i);
+ SYS_VGUI4(".x%x.c delete %xENTRY%d\n", canvas, x, i);
}
// display the content of current directory
@@ -213,14 +218,14 @@ static void playlist_update_dir(t_playlist *x, t_glist *glist)
// display the entry if displayable
if ( x->x_nentries*x->x_charheight+5 < x->x_height )
{
+ // nanosleep( &tv, NULL );
x->x_lastseen = x->x_nentries;
strncpy( wrappedname, x->x_dentries[x->x_nentries], MIN(x->x_width/x->x_charwidth, MAX_DIR_LENGTH) );
wrappedname[ x->x_width/x->x_charwidth ] = '\0';
- SYS_VGUI11(".x%x.c create text %d %d -fill %s -activefill %s -width %d -text \"%s\" \
- -anchor w -font %s -tags %xENTRY%d\n",
+ SYS_VGUI11(".x%x.c create text %d %d -fill %s -activefill %s -width %d -text \"%s\" -anchor w -font %s -tags %xENTRY%d\n",
canvas,
- x->x_obj.te_xpix+5,
- x->x_obj.te_ypix+5+(x->x_nentries-x->x_firstseen)*x->x_charheight,
+ text_xpix(&x->x_obj, glist)+5,
+ text_ypix(&x->x_obj, glist)+5+(x->x_nentries-x->x_firstseen)*x->x_charheight,
x->x_fgcolor,
x->x_secolor,
x->x_width,
@@ -287,13 +292,14 @@ void playlist_draw_new(t_playlist *x, t_glist *glist)
{
t_canvas *canvas=glist_getcanvas(glist);
+ x->x_glist = glist;
SYS_VGUI8(".x%x.c create rectangle %d %d %d %d -fill %s -tags %xPLAYLIST\n",
- canvas, x->x_obj.te_xpix, x->x_obj.te_ypix,
- x->x_obj.te_xpix + x->x_width, x->x_obj.te_ypix + x->x_height,
+ canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height,
x->x_bgcolor, x);
SYS_VGUI8(".x%x.c create rectangle %d %d %d %d -fill %s -tags %xSCROLLLIST\n",
- canvas, x->x_obj.te_xpix+4*x->x_width/5, x->x_obj.te_ypix,
- x->x_obj.te_xpix + x->x_width, x->x_obj.te_ypix + x->x_height,
+ canvas, text_xpix(&x->x_obj, glist)+4*x->x_width/5, text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height,
x->x_sbcolor, x);
playlist_update_dir( x, glist );
@@ -302,28 +308,33 @@ void playlist_draw_new(t_playlist *x, t_glist *glist)
void playlist_draw_move(t_playlist *x, t_glist *glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
- t_int i;
+ t_canvas *canvas=glist_getcanvas(glist);
+ t_int i;
+ struct timespec tv;
+ tv.tv_sec = 0;
+ tv.tv_nsec = 10000000;
+
SYS_VGUI7(".x%x.c coords %xPLAYLIST %d %d %d %d\n",
canvas, x,
- x->x_obj.te_xpix, x->x_obj.te_ypix,
- x->x_obj.te_xpix+x->x_width,
- x->x_obj.te_ypix+x->x_height);
+ text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist)+x->x_width,
+ text_ypix(&x->x_obj, glist)+x->x_height);
SYS_VGUI7(".x%x.c coords %xSCROLLLIST %d %d %d %d\n",
canvas, x,
- x->x_obj.te_xpix+4*x->x_width/5, x->x_obj.te_ypix,
- x->x_obj.te_xpix+x->x_width,
- x->x_obj.te_ypix+x->x_height);
+ text_xpix(&x->x_obj, glist)+4*x->x_width/5, text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist)+x->x_width,
+ text_ypix(&x->x_obj, glist)+x->x_height);
SYS_VGUI5(".x%x.c coords %xTITLE %d %d\n",
canvas, x,
- x->x_obj.te_xpix+5, x->x_obj.te_ypix-10 );
+ text_xpix(&x->x_obj, glist)+5, text_ypix(&x->x_obj, glist)-10 );
for ( i=x->x_firstseen; i<=x->x_lastseen; i++ )
{
+ // nanosleep( &tv, NULL );
SYS_VGUI6(".x%x.c coords %xENTRY%d %d %d\n",
canvas, x, i,
- x->x_obj.te_xpix+5,
- x->x_obj.te_ypix+5+(i-x->x_firstseen)*x->x_charheight);
+ text_xpix(&x->x_obj, glist)+5,
+ text_ypix(&x->x_obj, glist)+5+(i-x->x_firstseen)*x->x_charheight);
}
canvas_fixlinesfor( canvas, (t_text*)x );
@@ -331,21 +342,21 @@ void playlist_draw_move(t_playlist *x, t_glist *glist)
void playlist_draw_erase(t_playlist* x, t_glist* glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
- int i;
+ t_canvas *canvas=glist_getcanvas(glist);
+ t_int i;
SYS_VGUI3(".x%x.c delete %xPLAYLIST\n", canvas, x);
SYS_VGUI3(".x%x.c delete %xSCROLLLIST\n", canvas, x);
SYS_VGUI3(".x%x.c delete %xTITLE\n", canvas, x);
for ( i=x->x_firstseen; i<=x->x_lastseen; i++ )
{
- SYS_VGUI4(".x%x.c delete %xENTRY%d\n", glist_getcanvas(glist), x, i);
+ SYS_VGUI4(".x%x.c delete %xENTRY%d\n", canvas, x, i);
}
}
void playlist_draw_select(t_playlist* x, t_glist* glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
+ t_canvas *canvas=glist_getcanvas(glist);
// post( "playlist : select" );
if(x->x_selected)
@@ -365,21 +376,21 @@ void playlist_draw_select(t_playlist* x, t_glist* glist)
void playlist_getrect(t_gobj *z, t_glist *owner,
int *xp1, int *yp1, int *xp2, int *yp2)
{
- t_playlist* x = (t_playlist*)z;
+ t_playlist* x = (t_playlist*)z;
- *xp1 = x->x_obj.te_xpix;
- *yp1 = x->x_obj.te_ypix;
- *xp2 = x->x_obj.te_xpix+x->x_width;
- *yp2 = x->x_obj.te_ypix+x->x_height;
+ *xp1 = text_xpix(&x->x_obj, owner);
+ *yp1 = text_ypix(&x->x_obj, owner);
+ *xp2 = text_xpix(&x->x_obj, owner)+x->x_width;
+ *yp2 = text_ypix(&x->x_obj, owner)+x->x_height;
}
void playlist_save(t_gobj *z, t_binbuf *b)
{
- t_playlist *x = (t_playlist *)z;
+ t_playlist *x = (t_playlist *)z;
// post( "saving playlist : %s", x->x_extension );
binbuf_addv(b, "ssiissiisssss", gensym("#X"), gensym("obj"),
- (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix,
+ (t_int)text_xpix(&x->x_obj, x->x_glist), (t_int)text_ypix(&x->x_obj, x->x_glist),
gensym("playlist"), gensym(x->x_extension), x->x_width, x->x_height,
gensym(x->x_font), gensym(x->x_bgcolor), gensym(x->x_sbcolor),
gensym(x->x_fgcolor), gensym(x->x_secolor) );
@@ -388,7 +399,7 @@ void playlist_save(t_gobj *z, t_binbuf *b)
void playlist_select(t_gobj *z, t_glist *glist, int selected)
{
- t_playlist *x = (t_playlist *)z;
+ t_playlist *x = (t_playlist *)z;
x->x_selected = selected;
@@ -397,9 +408,10 @@ void playlist_select(t_gobj *z, t_glist *glist, int selected)
void playlist_vis(t_gobj *z, t_glist *glist, int vis)
{
- t_playlist *x = (t_playlist *)z;
- t_rtext *y;
+ t_playlist *x = (t_playlist *)z;
+ t_rtext *y;
+ x->x_glist = glist;
if (vis)
{
playlist_draw_new( x, glist );
@@ -412,20 +424,22 @@ void playlist_vis(t_gobj *z, t_glist *glist, int vis)
void playlist_delete(t_gobj *z, t_glist *glist)
{
+ t_playlist *x = (t_playlist *)z;
+
canvas_deletelinesfor( glist_getcanvas(glist), (t_text *)z);
}
void playlist_displace(t_gobj *z, t_glist *glist, int dx, int dy)
{
- t_playlist *x = (t_playlist *)z;
- int xold = x->x_obj.te_xpix;
- int yold = x->x_obj.te_ypix;
+ t_playlist *x = (t_playlist *)z;
+ t_int xold = text_xpix(&x->x_obj, glist);
+ t_int yold = text_ypix(&x->x_obj, glist);
// post( "playlist_displace dx=%d dy=%d", dx, dy );
x->x_obj.te_xpix += dx;
x->x_obj.te_ypix += dy;
- if(xold != x->x_obj.te_xpix || yold != x->x_obj.te_ypix)
+ if(xold != text_xpix(&x->x_obj, glist) || yold != text_ypix(&x->x_obj, glist))
{
playlist_draw_move(x, glist);
}
@@ -433,7 +447,8 @@ void playlist_displace(t_gobj *z, t_glist *glist, int dx, int dy)
void playlist_motion(t_playlist *x, t_floatarg dx, t_floatarg dy)
{
- int i;
+ t_int i;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
x->x_cdy+=dy;
@@ -449,7 +464,7 @@ void playlist_motion(t_playlist *x, t_floatarg dx, t_floatarg dy)
{
for ( i=x->x_firstseen; i<=x->x_lastseen; i++ )
{
- SYS_VGUI4(".x%x.c delete %xENTRY%d\n", x->x_glist, x, i);
+ SYS_VGUI4(".x%x.c delete %xENTRY%d\n", canvas, x, i);
}
x->x_firstseen++;
for ( i=x->x_firstseen; i< x->x_nentries; i++ )
@@ -461,11 +476,10 @@ void playlist_motion(t_playlist *x, t_floatarg dx, t_floatarg dy)
x->x_lastseen = i;
strncpy( wrappedname, x->x_dentries[i], x->x_width/x->x_charwidth );
wrappedname[ x->x_width/x->x_charwidth ] = '\0';
- SYS_VGUI11(".x%x.c create text %d %d -fill %s -activefill %s -width %d -text \"%s\" \
- -anchor w -font %s -tags %xENTRY%d\n",
- glist_getcanvas(x->x_glist),
- x->x_obj.te_xpix+5,
- x->x_obj.te_ypix+5+(i-x->x_firstseen)*x->x_charheight,
+ SYS_VGUI11(".x%x.c create text %d %d -fill %s -activefill %s -width %d -text \"%s\" -anchor w -font %s -tags %xENTRY%d\n",
+ canvas,
+ text_xpix(&x->x_obj, x->x_glist)+5,
+ text_ypix(&x->x_obj, x->x_glist)+5+(i-x->x_firstseen)*x->x_charheight,
x->x_fgcolor,
x->x_secolor,
x->x_width,
@@ -476,7 +490,7 @@ void playlist_motion(t_playlist *x, t_floatarg dx, t_floatarg dy)
else break;
}
SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n",
- x->x_glist, x, x->x_itemselected, x->x_secolor);
+ canvas, x, x->x_itemselected, x->x_secolor);
// post( "playlist : moved down first=%d last=%d", x->x_firstseen, x->x_lastseen );
}
}
@@ -489,7 +503,7 @@ void playlist_motion(t_playlist *x, t_floatarg dx, t_floatarg dy)
{
for ( i=x->x_firstseen; i<=x->x_lastseen; i++ )
{
- SYS_VGUI4(".x%x.c delete %xENTRY%d\n", x->x_glist, x, i);
+ SYS_VGUI4(".x%x.c delete %xENTRY%d\n", canvas, x, i);
}
x->x_firstseen--;
for ( i=x->x_firstseen; i< x->x_nentries; i++ )
@@ -503,9 +517,9 @@ void playlist_motion(t_playlist *x, t_floatarg dx, t_floatarg dy)
wrappedname[ x->x_width/x->x_charwidth ] = '\0';
SYS_VGUI11(".x%x.c create text %d %d -fill %s -activefill %s -width %d -text \"%s\" \
-anchor w -font %s -tags %xENTRY%d\n",
- glist_getcanvas(x->x_glist),
- x->x_obj.te_xpix+5,
- x->x_obj.te_ypix+5+(i-x->x_firstseen)*x->x_charheight,
+ canvas,
+ text_xpix(&x->x_obj, x->x_glist)+5,
+ text_ypix(&x->x_obj, x->x_glist)+5+(i-x->x_firstseen)*x->x_charheight,
x->x_fgcolor,
x->x_secolor,
x->x_width,
@@ -516,7 +530,7 @@ void playlist_motion(t_playlist *x, t_floatarg dx, t_floatarg dy)
else break;
}
SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n",
- x->x_glist, x, x->x_itemselected, x->x_secolor);
+ canvas, x, x->x_itemselected, x->x_secolor);
// post( "playlist : moved up first=%d last=%d", x->x_firstseen, x->x_lastseen );
}
}
@@ -525,21 +539,22 @@ void playlist_motion(t_playlist *x, t_floatarg dx, t_floatarg dy)
int playlist_click(t_gobj *z, struct _glist *glist,
- int xpix, int ypix, int shift, int alt, int dbl, int doit)
+ int xpix, int ypix, int shift, int alt, int dbl, int doit)
{
- t_playlist* x = (t_playlist *)z;
+ t_playlist* x = (t_playlist *)z;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
if (doit)
{
// leave a margin for scrolling without selection
- if ( (xpix-x->x_obj.te_xpix) < 4*x->x_width/5 )
+ if ( (xpix-text_xpix(&x->x_obj, glist)) < 4*x->x_width/5 )
{
// deselect previously selected item
SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n",
- x->x_glist, x, x->x_itemselected, x->x_fgcolor);
- x->x_itemselected = x->x_firstseen + (ypix-x->x_obj.te_ypix)/x->x_charheight;
+ canvas, x, x->x_itemselected, x->x_fgcolor);
+ x->x_itemselected = x->x_firstseen + (ypix-text_ypix(&x->x_obj, glist))/x->x_charheight;
SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n",
- x->x_glist, x, x->x_itemselected, x->x_secolor);
+ canvas, x, x->x_itemselected, x->x_secolor);
// post( "playlist : selected item : %d", x->x_itemselected );
if ( x->x_dentries && ( x->x_itemselected < x->x_nentries ) )
{
@@ -590,16 +605,17 @@ int playlist_click(t_gobj *z, struct _glist *glist,
}
}
}
- glist_grab(glist, &x->x_obj.te_g, (t_glistmotionfn)playlist_motion,
- 0, xpix, ypix);
+ x->x_glist = glist;
+ glist_grab( glist, &x->x_obj.te_g, (t_glistmotionfn)playlist_motion,
+ NULL, xpix, ypix );
}
return (1);
}
static void playlist_properties(t_gobj *z, t_glist *owner)
{
- char buf[800];
- t_playlist *x=(t_playlist *)z;
+ char buf[800];
+ t_playlist *x=(t_playlist *)z;
sprintf(buf, "pdtk_playlist_dialog %%s %s %d %d %s %s %s %s %s\n",
x->x_extension, x->x_width, x->x_height,
@@ -645,9 +661,9 @@ static void playlist_dialog(t_playlist *x, t_symbol *s, int argc, t_atom *argv)
t_playlist *playlist_new(t_symbol *s, int argc, t_atom *argv )
{
- t_int i, argoffset=0;
- t_playlist *x;
- char *tmpcurdir;
+ t_int i, argoffset=0;
+ t_playlist *x;
+ char *tmpcurdir;
x = (t_playlist *)pd_new(playlist_class);
@@ -845,7 +861,8 @@ void playlist_free(t_playlist *x)
void playlist_seek(t_playlist *x, t_floatarg fseeked)
{
- int iout=0;
+ t_int iout=0;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
if ( fseeked < 0 )
{
@@ -862,9 +879,9 @@ void playlist_seek(t_playlist *x, t_floatarg fseeked)
{
return;
}
- SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n", x->x_glist, x, x->x_itemselected, x->x_fgcolor);
+ SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n", canvas, x, x->x_itemselected, x->x_fgcolor);
x->x_itemselected = iout;
- SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n", x->x_glist, x, x->x_itemselected, x->x_secolor);
+ SYS_VGUI5(".x%x.c itemconfigure %xENTRY%d -fill %s\n", canvas, x, x->x_itemselected, x->x_secolor);
playlist_output_current(x);
}
diff --git a/probalizer/CHANGES.LOG b/probalizer/CHANGES.LOG
index 6f7036d..497eaaa 100644
--- a/probalizer/CHANGES.LOG
+++ b/probalizer/CHANGES.LOG
@@ -1,2 +1,6 @@
+0.3
+ added GOP support
+0.2
+ adapted for pd 0.37
0.1
first implementation
diff --git a/probalizer/Makefile b/probalizer/Makefile
index 40c4c78..7b35b04 100644
--- a/probalizer/Makefile
+++ b/probalizer/Makefile
@@ -67,7 +67,7 @@ LINUXCFLAGS = -DPD -DUNIX -O2 -funroll-loops -fomit-frame-pointer \
LINUXINCLUDE = -I../../src
.c.pd_linux:
- ../tk2c.bash < $*.tk >$*.tk2c
+ ./tk2c.bash < $*.tk >$*.tk2c
cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm
strip --strip-unneeded $*.pd_linux
diff --git a/probalizer/probalizer.c b/probalizer/probalizer.c
index 973e1d2..86ce42d 100644
--- a/probalizer/probalizer.c
+++ b/probalizer/probalizer.c
@@ -1,3 +1,4 @@
+/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2002 Yves Degoyon. */
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL */
/* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
@@ -35,7 +36,7 @@
#include <stdio.h>
#include <math.h>
#include <ctype.h>
-#include <m_pd.h>
+#include "m_pd.h"
#include "m_imp.h"
#include "g_canvas.h"
#include "t_tk.h"
@@ -43,7 +44,6 @@
#ifdef NT
#include <io.h>
-#define random rand
#else
#include <unistd.h>
#endif
@@ -54,7 +54,7 @@
#define DEFAULT_PROBALIZER_NBOCCURRENCES 100
#define DEFAULT_PROB_VALUE 10
-static char *probalizer_version = "probalizer : outputs integer values according to a drawn probability curve , version 0.1 (ydegoyon@free.fr)";
+static char *probalizer_version = "probalizer : outputs integer values according to a drawn probability curve , version 0.3 (ydegoyon@free.fr)";
t_widgetbehavior probalizer_widgetbehavior;
static t_class *probalizer_class;
@@ -105,43 +105,43 @@ static void probalizer_draw_new(t_probalizer *x, t_glist *glist)
t_int ei;
SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -outline #000000 -fill #6790E2 -tags %xPROBALIZER\n",
- canvas, x->x_obj.te_xpix, x->x_obj.te_ypix,
- x->x_obj.te_xpix+x->x_width, x->x_obj.te_ypix+x->x_height,
+ canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist)+x->x_width, text_ypix(&x->x_obj, glist)+x->x_height,
x);
SYS_VGUI5(".x%x.c create text %d %d -font -*-courier-bold--normal--10-* -text \"0\" -tags %xLTCAPTION\n",
- canvas, x->x_obj.te_xpix-15, x->x_obj.te_ypix + x->x_height, x );
+ canvas, text_xpix(&x->x_obj, glist)-15, text_ypix(&x->x_obj, glist) + x->x_height, x );
SYS_VGUI6(".x%x.c create text %d %d -font -*-courier-bold--normal--10-* -text \"%d\" -tags %xLBCAPTION\n",
- canvas, x->x_obj.te_xpix-15, x->x_obj.te_ypix, x->x_noccurrences, x );
+ canvas, text_xpix(&x->x_obj, glist)-15, text_ypix(&x->x_obj, glist), x->x_noccurrences, x );
SYS_VGUI5(".x%x.c create text %d %d -font -*-courier-bold--normal--10-* -text \"1\" -tags %xBLCAPTION\n",
- canvas, x->x_obj.te_xpix+2, x->x_obj.te_ypix + x->x_height + 10, x );
+ canvas, text_xpix(&x->x_obj, glist)+2, text_ypix(&x->x_obj, glist) + x->x_height + 10, x );
SYS_VGUI6(".x%x.c create text %d %d -font -*-courier-bold--normal--10-* -text \"%d\" -tags %xBRCAPTION\n",
- canvas, x->x_obj.te_xpix + x->x_width-5, x->x_obj.te_ypix + x->x_height + 10, x->x_nvalues, x );
+ canvas, text_xpix(&x->x_obj, glist) + x->x_width-5, text_ypix(&x->x_obj, glist) + x->x_height + 10, x->x_nvalues, x );
SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -outline #000000 -fill #000000 -tags %xIN\n",
- canvas, x->x_obj.te_xpix,
- x->x_obj.te_ypix - 2,
- x->x_obj.te_xpix + 5,
- x->x_obj.te_ypix ,
+ canvas, text_xpix(&x->x_obj, glist),
+ text_ypix(&x->x_obj, glist) - 2,
+ text_xpix(&x->x_obj, glist) + 5,
+ text_ypix(&x->x_obj, glist) ,
x);
SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -outline #000000 -fill #000000 -tags %xOUT\n",
- canvas, x->x_obj.te_xpix,
- x->x_obj.te_ypix + x->x_height,
- x->x_obj.te_xpix + 5,
- x->x_obj.te_ypix + x->x_height + 2,
+ canvas, text_xpix(&x->x_obj, glist),
+ text_ypix(&x->x_obj, glist) + x->x_height,
+ text_xpix(&x->x_obj, glist) + 5,
+ text_ypix(&x->x_obj, glist) + x->x_height + 2,
x);
SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -outline #000000 -fill #000000 -tags %xOUT2\n",
- canvas, x->x_obj.te_xpix + x->x_width -5,
- x->x_obj.te_ypix + x->x_height,
- x->x_obj.te_xpix + x->x_width,
- x->x_obj.te_ypix + x->x_height + 2,
+ canvas, text_xpix(&x->x_obj, glist) + x->x_width -5,
+ text_ypix(&x->x_obj, glist) + x->x_height,
+ text_xpix(&x->x_obj, glist) + x->x_width,
+ text_ypix(&x->x_obj, glist) + x->x_height + 2,
x);
for ( ei=0; ei<x->x_nvalues; ei++ )
{
SYS_VGUI8(".x%x.c create rectangle %d %d %d %d -outline #000000 -fill #118373 -tags %xPROB%d\n",
canvas,
- x->x_obj.te_xpix + ei * x->x_width/x->x_nvalues,
- x->x_obj.te_ypix + x->x_height - ( *(x->x_probs+ei) * x->x_height / x->x_noccurrences ),
- x->x_obj.te_xpix + (ei+1) * x->x_width/x->x_nvalues,
- x->x_obj.te_ypix + x->x_height,
+ text_xpix(&x->x_obj, glist) + ei * x->x_width/x->x_nvalues,
+ text_ypix(&x->x_obj, glist) + x->x_height - ( *(x->x_probs+ei) * x->x_height / x->x_noccurrences ),
+ text_xpix(&x->x_obj, glist) + (ei+1) * x->x_width/x->x_nvalues,
+ text_ypix(&x->x_obj, glist) + x->x_height,
x, ei);
}
canvas_fixlinesfor( canvas, (t_text*)x );
@@ -156,10 +156,10 @@ static void probalizer_draw_update(t_probalizer *x)
{
SYS_VGUI8(".x%x.c coords %xPROB%d %d %d %d %d\n",
canvas, x, ei,
- x->x_obj.te_xpix + ei * x->x_width / x->x_nvalues,
- x->x_obj.te_ypix + x->x_height - ( *(x->x_probs+ei) * x->x_height / x->x_noccurrences ),
- x->x_obj.te_xpix + (ei+1) * x->x_width / x->x_nvalues,
- x->x_obj.te_ypix + x->x_height );
+ text_xpix(&x->x_obj, x->x_glist) + ei * x->x_width / x->x_nvalues,
+ text_ypix(&x->x_obj, x->x_glist) + x->x_height - ( *(x->x_probs+ei) * x->x_height / x->x_noccurrences ),
+ text_xpix(&x->x_obj, x->x_glist) + (ei+1) * x->x_width / x->x_nvalues,
+ text_ypix(&x->x_obj, x->x_glist) + x->x_height );
}
canvas_fixlinesfor( canvas, (t_text*)x );
}
@@ -170,51 +170,51 @@ static void probalizer_draw_move(t_probalizer *x, t_glist *glist)
t_int ei;
SYS_VGUI7(".x%x.c coords %xPROBALIZER %d %d %d %d \n",
- canvas, x, x->x_obj.te_xpix, x->x_obj.te_ypix,
- x->x_obj.te_xpix+x->x_width, x->x_obj.te_ypix+x->x_height
+ canvas, x, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist)+x->x_width, text_ypix(&x->x_obj, glist)+x->x_height
);
SYS_VGUI7(".x%x.c coords %xIN %d %d %d %d\n",
- canvas, x, x->x_obj.te_xpix,
- x->x_obj.te_ypix - 2,
- x->x_obj.te_xpix + 5,
- x->x_obj.te_ypix
+ canvas, x, text_xpix(&x->x_obj, glist),
+ text_ypix(&x->x_obj, glist) - 2,
+ text_xpix(&x->x_obj, glist) + 5,
+ text_ypix(&x->x_obj, glist)
);
SYS_VGUI7(".x%x.c coords %xOUT %d %d %d %d\n",
- canvas, x, x->x_obj.te_xpix,
- x->x_obj.te_ypix + x->x_height,
- x->x_obj.te_xpix + 5,
- x->x_obj.te_ypix + x->x_height + 2
+ canvas, x, text_xpix(&x->x_obj, glist),
+ text_ypix(&x->x_obj, glist) + x->x_height,
+ text_xpix(&x->x_obj, glist) + 5,
+ text_ypix(&x->x_obj, glist) + x->x_height + 2
);
SYS_VGUI7(".x%x.c coords %xOUT2 %d %d %d %d\n",
- canvas, x, x->x_obj.te_xpix + x->x_width - 5,
- x->x_obj.te_ypix + x->x_height,
- x->x_obj.te_xpix + x->x_width,
- x->x_obj.te_ypix + x->x_height + 2
+ canvas, x, text_xpix(&x->x_obj, glist) + x->x_width - 5,
+ text_ypix(&x->x_obj, glist) + x->x_height,
+ text_xpix(&x->x_obj, glist) + x->x_width,
+ text_ypix(&x->x_obj, glist) + x->x_height + 2
);
SYS_VGUI5(".x%x.c coords %xLTCAPTION %d %d\n",
- canvas, x, x->x_obj.te_xpix-15,
- x->x_obj.te_ypix + x->x_height
+ canvas, x, text_xpix(&x->x_obj, glist)-15,
+ text_ypix(&x->x_obj, glist) + x->x_height
);
SYS_VGUI5(".x%x.c coords %xLBCAPTION %d %d\n",
- canvas, x, x->x_obj.te_xpix-15,
- x->x_obj.te_ypix
+ canvas, x, text_xpix(&x->x_obj, glist)-15,
+ text_ypix(&x->x_obj, glist)
);
SYS_VGUI5(".x%x.c coords %xBLCAPTION %d %d\n",
- canvas, x, x->x_obj.te_xpix+2,
- x->x_obj.te_ypix + x->x_height + 10
+ canvas, x, text_xpix(&x->x_obj, glist)+2,
+ text_ypix(&x->x_obj, glist) + x->x_height + 10
);
SYS_VGUI5(".x%x.c coords %xBRCAPTION %d %d\n",
- canvas, x, x->x_obj.te_xpix + x->x_width - 5,
- x->x_obj.te_ypix + x->x_height + 10
+ canvas, x, text_xpix(&x->x_obj, glist) + x->x_width - 5,
+ text_ypix(&x->x_obj, glist) + x->x_height + 10
);
for ( ei=0; ei<x->x_nvalues; ei++ )
{
SYS_VGUI8(".x%x.c coords %xPROB%d %d %d %d %d\n",
canvas, x, ei,
- x->x_obj.te_xpix + ei * x->x_width / x->x_nvalues,
- x->x_obj.te_ypix + x->x_height - ( *(x->x_probs+ei) * x->x_height / x->x_noccurrences ),
- x->x_obj.te_xpix + (ei+1) * x->x_width / x->x_nvalues,
- x->x_obj.te_ypix + x->x_height );
+ text_xpix(&x->x_obj, glist) + ei * x->x_width / x->x_nvalues,
+ text_ypix(&x->x_obj, glist) + x->x_height - ( *(x->x_probs+ei) * x->x_height / x->x_noccurrences ),
+ text_xpix(&x->x_obj, glist) + (ei+1) * x->x_width / x->x_nvalues,
+ text_ypix(&x->x_obj, glist) + x->x_height );
}
canvas_fixlinesfor( canvas, (t_text*)x );
}
@@ -263,10 +263,10 @@ static void probalizer_getrect(t_gobj *z, t_glist *owner,
{
t_probalizer* x = (t_probalizer*)z;
- *xp1 = x->x_obj.te_xpix;
- *yp1 = x->x_obj.te_ypix;
- *xp2 = x->x_obj.te_xpix+x->x_width;
- *yp2 = x->x_obj.te_ypix+x->x_height;
+ *xp1 = text_xpix(&x->x_obj, owner);
+ *yp1 = text_ypix(&x->x_obj, owner);
+ *xp2 = text_xpix(&x->x_obj, owner)+x->x_width;
+ *yp2 = text_ypix(&x->x_obj, owner)+x->x_height;
}
static void probalizer_save(t_gobj *z, t_binbuf *b)
@@ -275,7 +275,7 @@ static void probalizer_save(t_gobj *z, t_binbuf *b)
int ei,gi;
binbuf_addv(b, "ssiisiiiii", gensym("#X"),gensym("obj"),
- (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix,
+ (t_int)text_xpix(&x->x_obj, x->x_glist), (t_int)text_ypix(&x->x_obj, x->x_glist),
gensym("probalizer"), x->x_width, x->x_height,
x->x_nvalues, x->x_noccurrences, x->x_save );
if ( x->x_save )
@@ -397,8 +397,8 @@ static void probalizer_delete(t_gobj *z, t_glist *glist)
static void probalizer_displace(t_gobj *z, t_glist *glist, int dx, int dy)
{
t_probalizer *x = (t_probalizer *)z;
- int xold = x->x_obj.te_xpix;
- int yold = x->x_obj.te_ypix;
+ int xold = text_xpix(&x->x_obj, glist);
+ int yold = text_ypix(&x->x_obj, glist);
// post( "probalizer_displace dx=%d dy=%d", dx, dy );
@@ -422,8 +422,8 @@ static int probalizer_click(t_gobj *z, struct _glist *glist,
int nevent;
int newvalue;
- nevent = ((float)( xpix - x->x_obj.te_xpix ))/((float)x->x_width/(float)x->x_nvalues);
- newvalue = ((float)(x->x_obj.te_ypix + x->x_height - ypix))/( (float)x->x_height/(float)x->x_noccurrences);
+ nevent = ((float)( xpix - text_xpix(&x->x_obj, glist) ))/((float)x->x_width/(float)x->x_nvalues);
+ newvalue = ((float)(text_ypix(&x->x_obj, glist) + x->x_height - ypix))/( (float)x->x_height/(float)x->x_noccurrences);
// post( "changed %d to %d", nevent, newvalue );
@@ -688,18 +688,15 @@ void probalizer_setup(void)
probalizer_widgetbehavior.w_deletefn = probalizer_delete;
probalizer_widgetbehavior.w_visfn = probalizer_vis;
probalizer_widgetbehavior.w_clickfn = probalizer_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)
+
+#if PD_MINOR_VERSION >= 37
+ class_setpropertiesfn(probalizer_class, probalizer_properties);
+ class_setsavefn(probalizer_class, probalizer_save);
+#else
probalizer_widgetbehavior.w_propertiesfn = probalizer_properties;
probalizer_widgetbehavior.w_savefn = probalizer_save;
-#else
- class_setsavefn(probalizer_class, &probalizer_save);
- class_setpropertiesfn(probalizer_class, &probalizer_properties);
#endif
+
class_setwidget(probalizer_class, &probalizer_widgetbehavior);
+ class_sethelpsymbol(probalizer_class, gensym("probalizer.pd"));
}
diff --git a/scratcher~/CHANGES.LOG b/scratcher~/CHANGES.LOG
index 32d8318..31e90d9 100644
--- a/scratcher~/CHANGES.LOG
+++ b/scratcher~/CHANGES.LOG
@@ -1,3 +1,7 @@
+0.9
+ added GOP support
+0.8
+ adapted for pd 0.37
0.7
fixed more crashes in carmona
0.6
diff --git a/scratcher~/Makefile b/scratcher~/Makefile
index de0c834..823d3b7 100644
--- a/scratcher~/Makefile
+++ b/scratcher~/Makefile
@@ -67,7 +67,7 @@ LINUXCFLAGS = -DPD -DUNIX -DICECAST -O2 -funroll-loops -fomit-frame-pointer \
LINUXINCLUDE = -I../../src
.c.pd_linux:
- ../tk2c.bash <$*.tk >$*.tk2c
+ ./tk2c.bash <$*.tk >$*.tk2c
cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm
# strip --strip-unneeded $*.pd_linux
diff --git a/scratcher~/scratcher~.c b/scratcher~/scratcher~.c
index 87be8a2..129579f 100644
--- a/scratcher~/scratcher~.c
+++ b/scratcher~/scratcher~.c
@@ -37,9 +37,7 @@
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
-#ifndef MACOSX
#include <malloc.h>
-#endif
#include <ctype.h>
#include <pthread.h>
#include <time.h>
@@ -48,12 +46,11 @@
#include <unistd.h>
#endif
#ifdef NT
-#include <winsock2.h>
-#include <sys/timeb.h>
+#define M_PI 3.14159265358979323846
#endif
#include <math.h>
-#include <m_pd.h>
+#include "m_pd.h"
#include "m_imp.h"
#include "g_canvas.h"
#include "t_tk.h"
@@ -113,7 +110,7 @@ static int ignorevisible=1; // ignore visible test
#define SCRATCHER_NB_GROOVES 20
#define SCRATCHER_MOVE_TIMEOUT 20
-static char *scratcher_version = "scratcher~: version 0.7, written by Yves Degoyon (ydegoyon@free.fr)";
+static char *scratcher_version = "scratcher~: version 0.9, written by Yves Degoyon (ydegoyon@free.fr)";
static t_class *scratcher_class;
t_widgetbehavior scratcher_widgetbehavior;
@@ -159,32 +156,32 @@ static void scratcher_draw_new(t_scratcher *x, t_glist *glist)
t_int ci;
SYS_VGUI7(".x%x.c create oval %d %d %d %d -fill #000000 -tags %xSCRATCHER\n",
- canvas, x->x_obj.te_xpix, x->x_obj.te_ypix,
- x->x_obj.te_xpix + x->x_width,
- x->x_obj.te_ypix + x->x_height,
+ canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist) + x->x_width,
+ text_ypix(&x->x_obj, glist) + x->x_height,
x);
for ( ci=0; ci<SCRATCHER_NB_GROOVES; ci ++)
{
SYS_VGUI8(".x%x.c create oval %d %d %d %d -outline #FFFFFF -tags %xGROOVE%d\n",
- canvas, x->x_obj.te_xpix + ci*x->x_width/(2*SCRATCHER_NB_GROOVES),
- x->x_obj.te_ypix + ci*x->x_height/(2*SCRATCHER_NB_GROOVES),
- x->x_obj.te_xpix + x->x_width - ci*x->x_width/(2*SCRATCHER_NB_GROOVES),
- x->x_obj.te_ypix + x->x_height - ci*x->x_height/(2*SCRATCHER_NB_GROOVES),
+ canvas, text_xpix(&x->x_obj, glist) + ci*x->x_width/(2*SCRATCHER_NB_GROOVES),
+ text_ypix(&x->x_obj, glist) + ci*x->x_height/(2*SCRATCHER_NB_GROOVES),
+ text_xpix(&x->x_obj, glist) + x->x_width - ci*x->x_width/(2*SCRATCHER_NB_GROOVES),
+ text_ypix(&x->x_obj, glist) + x->x_height - ci*x->x_height/(2*SCRATCHER_NB_GROOVES),
x, ci);
}
if ( x->x_showspeed )
{
SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #FF0000 -tags %xSPEEDBAR -width 3\n",
- canvas, x->x_obj.te_xpix+x->x_width/2,
- x->x_obj.te_ypix+x->x_height/2,
- x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1. )),
- x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1. )),
+ canvas, text_xpix(&x->x_obj, glist)+x->x_width/2,
+ text_ypix(&x->x_obj, glist)+x->x_height/2,
+ text_xpix(&x->x_obj, glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1. )),
+ text_ypix(&x->x_obj, glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1. )),
x );
}
SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -tags %xFSCRATCHER\n",
- canvas, x->x_obj.te_xpix, x->x_obj.te_ypix,
- x->x_obj.te_xpix + x->x_width,
- x->x_obj.te_ypix + x->x_height,
+ canvas, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist) + x->x_width,
+ text_ypix(&x->x_obj, glist) + x->x_height,
x);
canvas_fixlinesfor( canvas, (t_text*)x );
}
@@ -192,15 +189,16 @@ static void scratcher_draw_new(t_scratcher *x, t_glist *glist)
static void scratcher_draw_delete(t_scratcher *x, t_glist *glist)
{
t_int ci;
+ t_canvas *canvas=glist_getcanvas(glist);
if ( glist_isvisible( glist ) )
{
- SYS_VGUI3( ".x%x.c delete %xSCRATCHER\n", glist_getcanvas( glist ), x );
- SYS_VGUI3( ".x%x.c delete %xFSCRATCHER\n", glist_getcanvas( glist ), x );
- SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", glist_getcanvas( glist ), x );
+ SYS_VGUI3( ".x%x.c delete %xSCRATCHER\n", canvas, x );
+ SYS_VGUI3( ".x%x.c delete %xFSCRATCHER\n", canvas, x );
+ SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", canvas, x );
for ( ci=0; ci<SCRATCHER_NB_GROOVES; ci ++)
{
- SYS_VGUI4( ".x%x.c delete %xGROOVE%d\n", glist_getcanvas( glist ), x, ci );
+ SYS_VGUI4( ".x%x.c delete %xGROOVE%d\n", canvas, x, ci );
}
}
}
@@ -214,32 +212,32 @@ static void scratcher_draw_move(t_scratcher *x, t_glist *glist)
{
SYS_VGUI7(".x%x.c coords %xSCRATCHER %d %d %d %d\n",
canvas, x,
- x->x_obj.te_xpix-1, x->x_obj.te_ypix-1,
- x->x_obj.te_xpix+x->x_width+1,
- x->x_obj.te_ypix+x->x_height+1);
+ text_xpix(&x->x_obj, glist)-1, text_ypix(&x->x_obj, glist)-1,
+ text_xpix(&x->x_obj, glist)+x->x_width+1,
+ text_ypix(&x->x_obj, glist)+x->x_height+1);
SYS_VGUI7(".x%x.c coords %xFSCRATCHER %d %d %d %d\n",
canvas, x,
- x->x_obj.te_xpix-1, x->x_obj.te_ypix-1,
- x->x_obj.te_xpix+x->x_width+1,
- x->x_obj.te_ypix+x->x_height+1);
+ text_xpix(&x->x_obj, glist)-1, text_ypix(&x->x_obj, glist)-1,
+ text_xpix(&x->x_obj, glist)+x->x_width+1,
+ text_ypix(&x->x_obj, glist)+x->x_height+1);
if ( x->x_showspeed )
{
SYS_VGUI7( ".x%x.c coords %xSPEEDBAR %d %d %d %d\n",
canvas, x,
- x->x_obj.te_xpix+x->x_width/2,
- x->x_obj.te_ypix+x->x_height/2,
- x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
- x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
+ text_xpix(&x->x_obj, glist)+x->x_width/2,
+ text_ypix(&x->x_obj, glist)+x->x_height/2,
+ text_xpix(&x->x_obj, glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
+ text_ypix(&x->x_obj, glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
);
}
for ( ci=0; ci<SCRATCHER_NB_GROOVES; ci ++)
{
SYS_VGUI8(".x%x.c coords %xGROOVE%d %d %d %d %d\n",
canvas, x, ci,
- x->x_obj.te_xpix + ci*x->x_width/(2*SCRATCHER_NB_GROOVES),
- x->x_obj.te_ypix + ci*x->x_height/(2*SCRATCHER_NB_GROOVES),
- x->x_obj.te_xpix + x->x_width - ci*x->x_width/(2*SCRATCHER_NB_GROOVES),
- x->x_obj.te_ypix + x->x_height - ci*x->x_height/(2*SCRATCHER_NB_GROOVES)
+ text_xpix(&x->x_obj, glist) + ci*x->x_width/(2*SCRATCHER_NB_GROOVES),
+ text_ypix(&x->x_obj, glist) + ci*x->x_height/(2*SCRATCHER_NB_GROOVES),
+ text_xpix(&x->x_obj, glist) + x->x_width - ci*x->x_width/(2*SCRATCHER_NB_GROOVES),
+ text_ypix(&x->x_obj, glist) + x->x_height - ci*x->x_height/(2*SCRATCHER_NB_GROOVES)
);
}
canvas_fixlinesfor( canvas, (t_text*)x );
@@ -269,10 +267,10 @@ static void scratcher_getrect(t_gobj *z, t_glist *owner,
{
t_scratcher* x = (t_scratcher*)z;
- *xp1 = x->x_obj.te_xpix;
- *yp1 = x->x_obj.te_ypix;
- *xp2 = x->x_obj.te_xpix+x->x_width;
- *yp2 = x->x_obj.te_ypix+x->x_height;
+ *xp1 = text_xpix(&x->x_obj, owner);
+ *yp1 = text_ypix(&x->x_obj, owner);
+ *xp2 = text_xpix(&x->x_obj, owner)+x->x_width;
+ *yp2 = text_ypix(&x->x_obj, owner)+x->x_height;
}
static void scratcher_save(t_gobj *z, t_binbuf *b)
@@ -280,7 +278,7 @@ static void scratcher_save(t_gobj *z, t_binbuf *b)
t_scratcher *x = (t_scratcher *)z;
binbuf_addv(b, "ssiisiiiiff", gensym("#X"),gensym("obj"),
- (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix,
+ (t_int)text_xpix(&x->x_obj, x->x_glist), (t_int)text_ypix(&x->x_obj, x->x_glist),
gensym("scratcher~"), x->x_size, x->x_width, x->x_height,
x->x_sensibility, x->x_maxspeed, x->x_inertia );
binbuf_addv(b, ";");
@@ -326,13 +324,9 @@ static void scratcher_displace(t_gobj *z, t_glist *glist, int dx, int dy)
static void scratcher_motion(t_scratcher *x, t_floatarg dx, t_floatarg dy)
{
-#ifdef NT
- time_t et;
- struct _timeb tv;
-#else
struct timeval tv;
struct timezone tz;
-#endif
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
// post( "scratcher_motion dx=%f dy=%f", dx, dy );
@@ -340,24 +334,18 @@ static void scratcher_motion(t_scratcher *x, t_floatarg dx, t_floatarg dy)
x->x_mousemoved = 1;
// get current time in ms
-#ifdef NT
- time( &et );
- _ftime( &tv );
- x->x_lastmovetime = et*1000 + tv.millitm;
-#else
gettimeofday( &tv, &tz );
x->x_lastmovetime = tv.tv_sec*1000 + tv.tv_usec/1000;
-#endif
// post( "scratcher~ : move time : %ld", x->x_lastmovetime );
if ( x->x_showspeed )
{
SYS_VGUI7( ".x%x.c coords %xSPEEDBAR %d %d %d %d\n",
- glist_getcanvas( x->x_glist ), x,
- x->x_obj.te_xpix+x->x_width/2,
- x->x_obj.te_ypix+x->x_height/2,
- x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
- x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
+ canvas, x,
+ text_xpix(&x->x_obj, x->x_glist)+x->x_width/2,
+ text_ypix(&x->x_obj, x->x_glist)+x->x_height/2,
+ text_xpix(&x->x_obj, x->x_glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
+ text_ypix(&x->x_obj, x->x_glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
);
}
}
@@ -396,15 +384,17 @@ static void scratcher_dialog(t_scratcher *x, t_symbol *s, int argc, t_atom *argv
/* reset reading speed */
static void scratcher_reset(t_scratcher *x)
{
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
+
x->x_readspeed=1.;
if ( x->x_showspeed )
{
SYS_VGUI7( ".x%x.c coords %xSPEEDBAR %d %d %d %d\n",
- glist_getcanvas( x->x_glist ), x,
- x->x_obj.te_xpix+x->x_width/2,
- x->x_obj.te_ypix+x->x_height/2,
- x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
- x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
+ canvas, x,
+ text_xpix(&x->x_obj, x->x_glist)+x->x_width/2,
+ text_ypix(&x->x_obj, x->x_glist)+x->x_height/2,
+ text_xpix(&x->x_obj, x->x_glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
+ text_ypix(&x->x_obj, x->x_glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
);
}
}
@@ -412,7 +402,8 @@ static void scratcher_reset(t_scratcher *x)
static int scratcher_click(t_gobj *z, struct _glist *glist,
int xpix, int ypix, int shift, int alt, int dbl, int doit)
{
- t_scratcher* x = (t_scratcher *)z;
+ t_scratcher* x = (t_scratcher *)z;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
// post( "scratcher_click : x=%d y=%d doit=%d alt=%d, shift=%d", xpix, ypix, doit, alt, shift );
if ( doit )
@@ -425,11 +416,11 @@ static int scratcher_click(t_gobj *z, struct _glist *glist,
if ( x->x_showspeed )
{
SYS_VGUI7( ".x%x.c coords %xSPEEDBAR %d %d %d %d\n",
- glist_getcanvas( x->x_glist ), x,
- x->x_obj.te_xpix+x->x_width/2,
- x->x_obj.te_ypix+x->x_height/2,
- x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
- x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
+ canvas, x,
+ text_xpix(&x->x_obj, glist)+x->x_width/2,
+ text_ypix(&x->x_obj, glist)+x->x_height/2,
+ text_xpix(&x->x_obj, glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
+ text_ypix(&x->x_obj, glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
);
}
}
@@ -485,18 +476,14 @@ static t_int scratcher_reallocate(t_scratcher *x, t_int ioldsize, t_int inewsize
/* records or playback the scratcher */
static t_int *scratcher_perform(t_int *w)
{
- t_float *in = (t_float *)(w[1]);
- t_float *out = (t_float *)(w[2]);
- t_int n = (int)(w[3]); /* number of samples */
- t_scratcher *x = (t_scratcher *)(w[4]);
-#ifdef NT
- time_t et;
- struct _timeb tv;
-#else
- struct timeval tv;
- struct timezone tz;
-#endif
- long long perftime = 0L;
+ t_float *in = (t_float *)(w[1]);
+ t_float *out = (t_float *)(w[2]);
+ t_int n = (int)(w[3]); /* number of samples */
+ t_scratcher *x = (t_scratcher *)(w[4]);
+ struct timeval tv;
+ struct timezone tz;
+ long long perftime = 0L;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
x->x_readspeed += x->x_speedinc;
if ( x->x_readspeed > x->x_maxspeed )
@@ -514,14 +501,8 @@ static t_int *scratcher_perform(t_int *w)
if ( x->x_mousemoved )
{
// get current time in ms
-#ifdef NT
- time( &et );
- _ftime( &tv );
- perftime = et*1000 + tv.millitm;
-#else
- gettimeofday( &tv, &tz );
- perftime = tv.tv_sec*1000 + tv.tv_usec/1000;
-#endif
+ gettimeofday( &tv, &tz );
+ perftime = tv.tv_sec*1000 + tv.tv_usec/1000;
if ( perftime - x->x_lastmovetime > SCRATCHER_MOVE_TIMEOUT )
{
// post( "scratcher~ : mouse timeout (m=%ld)", perftime );
@@ -545,11 +526,11 @@ static t_int *scratcher_perform(t_int *w)
if ( x->x_showspeed )
{
SYS_VGUI7( ".x%x.c coords %xSPEEDBAR %d %d %d %d\n",
- glist_getcanvas( x->x_glist ), x,
- x->x_obj.te_xpix+x->x_width/2,
- x->x_obj.te_ypix+x->x_height/2,
- x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
- x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
+ canvas, x,
+ text_xpix(&x->x_obj, x->x_glist)+x->x_width/2,
+ text_ypix(&x->x_obj, x->x_glist)+x->x_height/2,
+ text_xpix(&x->x_obj, x->x_glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1 )),
+ text_ypix(&x->x_obj, x->x_glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1 ))
);
}
}
@@ -591,18 +572,20 @@ static void scratcher_dsp(t_scratcher *x, t_signal **sp)
/* play the sound */
static void scratcher_play(t_scratcher *x)
{
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
+
x->x_play=1;
// reset read position
x->x_readpos=0;
x->x_readspeed=1.;
if ( x->x_showspeed )
{
- SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", glist_getcanvas( x->x_glist ), x );
+ SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", canvas, x );
SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #FF0000 -tags %xSPEEDBAR -width 3\n",
- glist_getcanvas( x->x_glist ), x->x_obj.te_xpix+x->x_width/2,
- x->x_obj.te_ypix+x->x_height/2,
- x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1. )),
- x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1. )),
+ canvas, text_xpix(&x->x_obj, x->x_glist)+x->x_width/2,
+ text_ypix(&x->x_obj, x->x_glist)+x->x_height/2,
+ text_xpix(&x->x_obj, x->x_glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1. )),
+ text_ypix(&x->x_obj, x->x_glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1. )),
x );
}
}
@@ -610,18 +593,20 @@ static void scratcher_play(t_scratcher *x)
/* stop playing */
static void scratcher_stop(t_scratcher *x)
{
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
+
x->x_play=0;
// reset read position
x->x_readpos=0;
x->x_readspeed=0.;
if ( x->x_showspeed )
{
- SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", glist_getcanvas( x->x_glist ), x );
+ SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", canvas, x );
SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #FF0000 -tags %xSPEEDBAR -width 3\n",
- glist_getcanvas( x->x_glist ), x->x_obj.te_xpix+x->x_width/2,
- x->x_obj.te_ypix+x->x_height/2,
- x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1. )),
- x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1. )),
+ canvas, text_xpix(&x->x_obj, x->x_glist)+x->x_width/2,
+ text_ypix(&x->x_obj, x->x_glist)+x->x_height/2,
+ text_xpix(&x->x_obj, x->x_glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1. )),
+ text_ypix(&x->x_obj, x->x_glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1. )),
x );
}
}
@@ -685,19 +670,21 @@ static void scratcher_inertia(t_scratcher *x, t_floatarg finertia )
/* toggle speed line */
static void scratcher_showspeed(t_scratcher *x, t_floatarg fshowspeed )
{
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
+
if (fshowspeed == 0) {
x->x_showspeed = 0;
- SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", glist_getcanvas( x->x_glist ), x );
+ SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", canvas, x );
}
else
{
x->x_showspeed = 1;
- SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", glist_getcanvas( x->x_glist ), x );
+ SYS_VGUI3( ".x%x.c delete %xSPEEDBAR\n", canvas, x );
SYS_VGUI7( ".x%x.c create line %d %d %d %d -fill #FF0000 -tags %xSPEEDBAR -width 3\n",
- glist_getcanvas( x->x_glist ), x->x_obj.te_xpix+x->x_width/2,
- x->x_obj.te_ypix+x->x_height/2,
- x->x_obj.te_xpix+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1. )),
- x->x_obj.te_ypix+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1. )),
+ canvas, text_xpix(&x->x_obj, x->x_glist)+x->x_width/2,
+ text_ypix(&x->x_obj, x->x_glist)+x->x_height/2,
+ text_xpix(&x->x_obj, x->x_glist)+x->x_width/2 + (int)(x->x_width/2*cos( x->x_readspeed - 1. )),
+ text_ypix(&x->x_obj, x->x_glist)+x->x_height/2 - (int)(x->x_width/2*sin( x->x_readspeed - 1. )),
x );
}
}
@@ -791,6 +778,7 @@ void scratcher_tilde_setup(void)
#include "scratcher~.tk2c"
scratcher_class = class_new(gensym("scratcher~"), (t_newmethod)scratcher_new, (t_method)scratcher_free,
sizeof(t_scratcher), 0, A_GIMME, 0);
+ class_sethelpsymbol( scratcher_class, gensym("scratcher~.pd") );
// set callbacks
scratcher_widgetbehavior.w_getrectfn = scratcher_getrect;
@@ -800,18 +788,13 @@ void scratcher_tilde_setup(void)
scratcher_widgetbehavior.w_deletefn = scratcher_delete;
scratcher_widgetbehavior.w_visfn = scratcher_vis;
scratcher_widgetbehavior.w_clickfn = scratcher_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)
+
+#if PD_MINOR_VERSION >= 37
+ class_setpropertiesfn(scratcher_class, scratcher_properties);
+ class_setsavefn(scratcher_class, scratcher_save);
+#else
scratcher_widgetbehavior.w_propertiesfn = scratcher_properties;
scratcher_widgetbehavior.w_savefn = scratcher_save;
-#else
- class_setpropertiesfn(scratcher_class, &scratcher_properties);
- class_setsavefn(scratcher_class, &scratcher_save);
#endif
CLASS_MAINSIGNALIN( scratcher_class, t_scratcher, x_f );
diff --git a/sonogram~/CHANGES.LOG b/sonogram~/CHANGES.LOG
index c40ae6a..77b7234 100644
--- a/sonogram~/CHANGES.LOG
+++ b/sonogram~/CHANGES.LOG
@@ -1,3 +1,5 @@
+0.13
+ added GOP support
0.12
adapted for pd 0.37
0.11
diff --git a/sonogram~/rs-sonogram~.pd b/sonogram~/rs-sonogram~.pd
index 864666f..08274ae 100644
--- a/sonogram~/rs-sonogram~.pd
+++ b/sonogram~/rs-sonogram~.pd
@@ -1,11 +1,11 @@
-#N canvas 43 28 986 681 10;
+#N canvas 7 13 986 674 10;
#X msg 306 57 record;
#X msg 19 34 bang;
#X obj 19 54 openpanel;
#X obj 21 152 soundfiler;
#X msg 259 42 bang;
#X obj 262 101 rfft~;
-#X floatatom 59 171 10 0 0;
+#X floatatom 59 171 10 0 0 0 - - -;
#X msg 20 211 resize \$1;
#X obj 19 74 t s b;
#X obj 22 114 pack s s;
@@ -40,7 +40,7 @@
#X text 919 110 100 %;
#X text 783 76 Set portion of the sonogram to modify;
#X msg 953 108 100;
-#N canvas 309 22 600 544 modifications 0;
+#N canvas 656 8 600 544 modifications 1;
#X text 234 236 Filter a frequency;
#X text 254 190 Enhance a frequency by 10% ( might be a range of frequencies
with message 'enhance f1 f2 x' );
@@ -87,7 +87,6 @@ with message 'enhance f1 f2 x' );
-128992 0;
#X msg 115 466 add \$1 \$1 -0.5;
#X text 218 465 Sub a constant from a frequency;
-#X msg 113 395 average 100;
#X text 198 393 Average over 100 blocks ( smooth with some sounds )
;
#X obj 16 454 outlet;
@@ -95,47 +94,48 @@ with message 'enhance f1 f2 x' );
#X msg 159 69 godown 5;
#X msg 107 198 enhance \$1 \$1 1.1 0;
#X msg 116 488 threshold \$1;
-#X floatatom 208 489 5 0 0;
+#X floatatom 208 489 5 0 0 0 - - -;
#X msg 107 239 enhance \$1 \$1 0 0;
#X text 249 488 Suppress all points below the threshold;
#X text 159 91 Roll frequencies : same as above but without loss;
-#X connect 3 0 38 0;
+#X msg 113 395 average 10;
+#X connect 3 0 37 0;
#X connect 4 0 8 0;
-#X connect 5 0 38 0;
+#X connect 5 0 37 0;
#X connect 6 0 5 0;
#X connect 8 0 9 0;
#X connect 9 0 6 1;
#X connect 10 0 11 0;
#X connect 11 0 12 0;
#X connect 12 0 6 0;
-#X connect 13 0 41 0;
-#X connect 14 0 44 0;
-#X connect 16 0 38 0;
-#X connect 17 0 38 0;
-#X connect 20 0 38 0;
-#X connect 22 0 38 0;
-#X connect 23 0 38 0;
-#X connect 26 0 38 0;
+#X connect 13 0 40 0;
+#X connect 14 0 43 0;
+#X connect 16 0 37 0;
+#X connect 17 0 37 0;
+#X connect 20 0 37 0;
+#X connect 22 0 37 0;
+#X connect 23 0 37 0;
+#X connect 26 0 37 0;
#X connect 27 0 26 0;
#X connect 30 0 31 0;
-#X connect 31 0 38 0;
+#X connect 31 0 37 0;
#X connect 33 0 34 0;
-#X connect 34 0 38 0;
-#X connect 36 0 38 0;
-#X connect 39 0 38 0;
-#X connect 40 0 38 0;
-#X connect 41 0 38 0;
-#X connect 42 0 38 0;
-#X connect 43 0 42 0;
-#X connect 44 0 38 0;
+#X connect 34 0 37 0;
+#X connect 38 0 37 0;
+#X connect 39 0 37 0;
+#X connect 40 0 37 0;
+#X connect 41 0 37 0;
+#X connect 42 0 41 0;
+#X connect 43 0 37 0;
+#X connect 46 0 37 0;
#X restore 861 131 pd modifications;
#X text 513 609 Zoom factor (>1);
#X msg 418 608 zoom 2;
#X obj 256 79 tabplay~ \$0-sonosample;
-#X obj 80 275 sonogram~ 463 1 1 1;
+#X obj 114 263 sonogram~ 2452 1 1;
#X msg 467 608 zoom 1;
#X msg 484 99 readspeed \$1;
-#X floatatom 617 99 5 0 0;
+#X floatatom 617 99 5 0 0 0 - - -;
#X text 487 121 Reading speed;
#X obj 576 99 / 100;
#X msg 661 99 100;
@@ -146,7 +146,7 @@ with message 'enhance f1 f2 x' );
#X msg 780 207 start;
#X msg 822 207 stop;
#X msg 418 652 modstep \$1;
-#X floatatom 499 652 5 0 0;
+#X floatatom 499 652 5 0 0 0 - - -;
#X obj 525 36 spigot;
#X obj 573 36 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 1
;
@@ -177,14 +177,13 @@ with message 'enhance f1 f2 x' );
#X text 785 57 Step 4 : modify parts of the sonogram;
#X obj 260 126 rifft~;
#X msg 418 630 refresh;
-#X obj 829 571 block~ 256;
#X text 239 10 Step 2 : Record the sonogram;
#X obj 927 565 loadbang;
#N canvas 0 1 682 488 envelop 0;
#X obj 33 400 outlet;
#X obj 46 327 tabread envelop;
#X msg 23 263 bang;
-#X floatatom 23 299 5 0 0;
+#X floatatom 23 299 5 0 0 0 - - -;
#X obj 71 280 + 1;
#X msg 23 281 0;
#X text 25 239 Apply envelop;
@@ -195,7 +194,7 @@ with message 'enhance f1 f2 x' );
#X msg 425 349 bang;
#X msg 370 374 \; envelop const 1;
#X msg 203 381 refresh;
-#X floatatom 160 280 5 0 0;
+#X floatatom 160 280 5 0 0 0 - - -;
#X msg 163 300 bang;
#X obj 98 280 moses 127;
#X msg 485 347 bang;
@@ -231,7 +230,7 @@ with message 'enhance f1 f2 x' );
#X connect 20 0 13 0;
#X restore 780 131 pd envelop;
#X obj 310 174 / 100;
-#X floatatom 309 147 5 0 0;
+#X floatatom 309 147 5 0 0 0 - - -;
#X obj 263 174 *~ 1;
#X obj 261 149 /~ 256;
#X text 332 129 Volume;
@@ -241,6 +240,9 @@ with message 'enhance f1 f2 x' );
#X msg 488 630 undo;
#X text 526 630 One level undo;
#X obj 21 192 makefilename %d-sonosample;
+#X msg 23 264 undo;
+#X msg 17 317 zoom 1;
+#X obj 829 571 block~ 256;
#X connect 0 0 41 0;
#X connect 1 0 2 0;
#X connect 2 0 8 0;
@@ -268,7 +270,7 @@ with message 'enhance f1 f2 x' );
#X connect 37 0 41 0;
#X connect 39 0 41 0;
#X connect 40 0 5 0;
-#X connect 40 0 90 0;
+#X connect 40 0 89 0;
#X connect 41 0 82 0;
#X connect 41 1 82 1;
#X connect 41 3 53 0;
@@ -290,18 +292,20 @@ with message 'enhance f1 f2 x' );
#X connect 56 0 15 0;
#X connect 57 0 56 1;
#X connect 62 0 64 0;
-#X connect 63 0 98 0;
+#X connect 63 0 97 0;
#X connect 64 0 41 0;
#X connect 78 0 36 0;
-#X connect 82 0 91 0;
+#X connect 82 0 90 0;
#X connect 83 0 41 0;
-#X connect 86 0 14 0;
-#X connect 87 0 41 0;
-#X connect 88 0 90 1;
-#X connect 89 0 88 0;
-#X connect 90 0 16 0;
-#X connect 90 0 51 0;
-#X connect 90 0 51 1;
-#X connect 91 0 90 0;
-#X connect 96 0 41 0;
-#X connect 98 0 9 1;
+#X connect 85 0 14 0;
+#X connect 86 0 41 0;
+#X connect 87 0 89 1;
+#X connect 88 0 87 0;
+#X connect 89 0 16 0;
+#X connect 89 0 51 0;
+#X connect 89 0 51 1;
+#X connect 90 0 89 0;
+#X connect 95 0 41 0;
+#X connect 97 0 9 1;
+#X connect 98 0 41 0;
+#X connect 99 0 41 0;
diff --git a/sonogram~/rs-sonograph~.pd b/sonogram~/rs-sonograph~.pd
index c8795ec..a8531fa 100644
--- a/sonogram~/rs-sonograph~.pd
+++ b/sonogram~/rs-sonograph~.pd
@@ -141,7 +141,7 @@ circular );
#X connect 44 0 46 0;
#X restore 694 150 pd modifications;
#X obj 298 73 tabplay~ \$0-sonosample;
-#X obj 106 329 sonogram~ 215 0;
+#X obj 106 329 sonogram~ 256 0;
#X text 538 54 When the sonogram is RED (updating) \,;
#X text 537 43 VERY IMPORTANT NOTE :;
#X text 591 116 Step 4 : modify parts of the sonogram ... and send
diff --git a/sonogram~/sonogram~.c b/sonogram~/sonogram~.c
index 24a38a9..ff70ae1 100644
--- a/sonogram~/sonogram~.c
+++ b/sonogram~/sonogram~.c
@@ -37,25 +37,14 @@
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
-
-#ifdef __APPLE__
-#include <sys/malloc.h>
-#else
#include <malloc.h>
-#endif
-
#include <ctype.h>
#include <pthread.h>
#ifdef UNIX
#include <unistd.h>
#endif
#ifdef NT
-#define random rand
-#include <windows.h>
-static int usleep (unsigned int us) {
- Sleep((long)(us/1000.));
- return 0;
-}
+#define M_PI 3.14159265358979323846
#endif
#include <math.h>
@@ -382,10 +371,12 @@ static void sonogram_erase_block(t_sonogram *x, t_glist *glist, t_int bnumber )
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;
+ t_sonogram *x = (t_sonogram*) tdata;
+ t_int si;
+ t_int nbpoints = 0;
+ t_float percentage = 0, opercentage = 0;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
+
// loose synchro
usleep( THREAD_SLEEP_TIME );
@@ -429,10 +420,10 @@ static void *sonogram_do_update_part(void *tdata)
}
// set borders in black
- SYS_VGUI3(".x%x.c itemconfigure %xSONOGRAM -outline #000000\n", glist_getcanvas(x->x_glist), x);
+ 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", glist_getcanvas(x->x_glist), x);
+ SYS_VGUI3(".x%x.c itemconfigure %xPHASOGRAM -outline #000000\n", canvas, x);
}
// post("sonogram~ : child thread %d ended (nb_updated=%d)", (int)x->x_updatechild, x->x_nbupdated );
@@ -443,7 +434,8 @@ static void *sonogram_do_update_part(void *tdata)
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;
+ pthread_attr_t update_child_attr;
+ t_canvas *canvas=glist_getcanvas(glist);
if ( x->x_graphic )
{
@@ -467,44 +459,44 @@ static void sonogram_update_part(t_sonogram *x, t_glist *glist, t_int bstart, t_
// 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_VGUI3(".x%x.c delete %xSONOGRAM\n", canvas, 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_VGUI3(".x%x.c delete ISONIMAGE%x\n", canvas, 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),
+ canvas, 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_VGUI3(".x%x.c delete %xPHASOGRAM\n", canvas, 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,
+ canvas, 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_VGUI3(".x%x.c delete IFAZIMAGE%x\n", canvas, 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),
+ canvas, 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( glist_getcanvas(x->x_glist), (t_text*)x );
+ canvas_fixlinesfor( canvas, (t_text*)x );
}
// set borders in red
- SYS_VGUI3(".x%x.c itemconfigure %xSONOGRAM -outline #FF0000\n", glist_getcanvas(glist), x);
+ SYS_VGUI3(".x%x.c itemconfigure %xSONOGRAM -outline #FF0000\n", canvas, x);
if ( x->x_phaso )
{
- SYS_VGUI3(".x%x.c itemconfigure %xPHASOGRAM -outline #FF0000\n", glist_getcanvas(glist), x);
+ SYS_VGUI3(".x%x.c itemconfigure %xPHASOGRAM -outline #FF0000\n", canvas, x);
}
// launch update thread
@@ -616,14 +608,16 @@ static void sonogram_paste( t_sonogram* x)
/* 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;
+ 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;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
+
if ( x->x_xstartcapture > x->x_xendcapture ) {
fi = x->x_xstartcapture;
@@ -700,7 +694,7 @@ static void sonogram_paste_phase( t_sonogram* x)
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 );
+ SYS_VGUI3( ".x%x.c delete %xCAPTURE\n", canvas, x );
x->x_xstartcapture = x->x_xdraw;
x->x_ystartcapture = x->x_ydraw;
x->x_xendcapture = x->x_xdraw;
@@ -710,13 +704,10 @@ static void sonogram_paste_phase( t_sonogram* x)
static void sonogram_draw_new(t_sonogram *x, t_glist *glist)
{
- t_canvas *canvas=glist_getcanvas(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;
- }
+ x->x_xpos=text_xpix(&x->x_obj, glist);
+ x->x_ypos=text_ypix(&x->x_obj, glist);
if ( x->x_graphic )
{
SYS_VGUI7(".x%x.c create rectangle %d %d %d %d -fill #FFFFFF -tags %xSONOGRAM\n",
@@ -728,12 +719,12 @@ static void sonogram_draw_new(t_sonogram *x, t_glist *glist)
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),
+ canvas, 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,
+ canvas, 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);
@@ -741,7 +732,7 @@ static void sonogram_draw_new(t_sonogram *x, t_glist *glist)
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),
+ canvas, 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 );
@@ -750,20 +741,22 @@ static void sonogram_draw_new(t_sonogram *x, t_glist *glist)
static void sonogram_draw_delete(t_sonogram *x, t_glist *glist)
{
+ t_canvas *canvas=glist_getcanvas(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_VGUI3( ".x%x.c delete %xCAPTURE\n", canvas, x );
+ SYS_VGUI3( ".x%x.c delete line %xREADSTART\n", canvas, x);
+ SYS_VGUI3( ".x%x.c delete line %xREADEND\n", canvas, x);
+ SYS_VGUI3( ".x%x.c delete line %xMODSTART\n", canvas, x);
+ SYS_VGUI3( ".x%x.c delete line %xMODEND\n", canvas, x);
+ SYS_VGUI3(".x%x.c delete %xSONOGRAM\n", canvas, x );
+ SYS_VGUI3(".x%x.c delete %xPHASOGRAM\n", canvas, x );
+ SYS_VGUI3(".x%x.c delete %xISONIMAGE\n", canvas, 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_VGUI3(".x%x.c delete %xIFAZIMAGE\n", canvas, x );
SYS_VGUI2("image delete FAZIMAGE%x\n", x );
}
}
@@ -771,7 +764,7 @@ static void sonogram_draw_delete(t_sonogram *x, t_glist *glist)
static void sonogram_draw_move(t_sonogram *x, t_glist *glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
+ t_canvas *canvas=glist_getcanvas(glist);
if ( x->x_graphic && glist_isvisible( x->x_glist ) )
{
@@ -802,7 +795,7 @@ static void sonogram_draw_move(t_sonogram *x, t_glist *glist)
static void sonogram_draw_select(t_sonogram* x,t_glist* glist)
{
- t_canvas *canvas=glist_getcanvas(glist);
+ t_canvas *canvas=glist_getcanvas(glist);
if ( x->x_graphic && glist_isvisible( x->x_glist ) )
{
@@ -958,7 +951,8 @@ static void sonogram_modify_point_phase( t_sonogram* x, t_int sample, t_int freq
static void sonogram_motion(t_sonogram *x, t_floatarg dx, t_floatarg dy)
{
- int fdraw=0, sdraw=0;
+ t_int fdraw=0, sdraw=0;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
// 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) ) )
@@ -996,18 +990,19 @@ static void sonogram_motion(t_sonogram *x, t_floatarg dx, t_floatarg dy)
(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_VGUI3( ".x%x.c delete %xCAPTURE\n", canvas, 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 );
+ canvas, 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;
+ t_sonogram* x = (t_sonogram *)z;
+ t_int si,fi;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
+
// 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)
@@ -1090,7 +1085,7 @@ static int sonogram_click(t_gobj *z, struct _glist *glist,
(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 );
+ SYS_VGUI3( ".x%x.c delete %xCAPTURE\n", canvas, x );
x->x_xstartcapture = xpix;
x->x_ystartcapture = ypix;
x->x_xendcapture = xpix;
@@ -1369,7 +1364,8 @@ static void sonogram_play(t_sonogram *x)
/* setting the starting point for reading ( in percent ) */
static void sonogram_readstart(t_sonogram *x, t_floatarg fstart)
{
- t_float startpoint = fstart;
+ t_float startpoint = fstart;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
if (startpoint < 0) startpoint = 0;
if (startpoint > 100) startpoint = 100;
@@ -1380,9 +1376,9 @@ static void sonogram_readstart(t_sonogram *x, t_floatarg fstart)
if ( x->x_graphic && glist_isvisible( x->x_glist ) )
{
SYS_VGUI3( ".x%x.c delete line %xREADSTART\n",
- glist_getcanvas( x->x_glist ), x);
+ canvas, 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 ),
+ canvas, 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 );
}
@@ -1391,7 +1387,8 @@ static void sonogram_readstart(t_sonogram *x, t_floatarg fstart)
/* setting the starting point for modification ( in percent ) */
static void sonogram_modstart(t_sonogram *x, t_floatarg fstart)
{
- t_float startpoint = fstart;
+ t_float startpoint = fstart;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
if (startpoint < 0) startpoint = 0;
if (startpoint > 100) startpoint = 100;
@@ -1404,9 +1401,9 @@ static void sonogram_modstart(t_sonogram *x, t_floatarg fstart)
if ( x->x_graphic && glist_isvisible( x->x_glist ) )
{
SYS_VGUI3( ".x%x.c delete line %xMODSTART\n",
- glist_getcanvas( x->x_glist ), x);
+ canvas, 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 ),
+ canvas, 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 );
}
@@ -1433,7 +1430,8 @@ static void sonogram_enhancemode(t_sonogram *x, t_floatarg fenhancemode)
/* setting the ending point for reading ( in percent ) */
static void sonogram_readend(t_sonogram *x, t_floatarg fend)
{
- t_float endpoint = fend;
+ t_float endpoint = fend;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
if (endpoint < 0) endpoint = 0;
if (endpoint > 100) endpoint = 100;
@@ -1444,9 +1442,9 @@ static void sonogram_readend(t_sonogram *x, t_floatarg fend)
if ( x->x_graphic && glist_isvisible( x->x_glist ) )
{
SYS_VGUI3( ".x%x.c delete line %xREADEND\n",
- glist_getcanvas( x->x_glist ), x);
+ canvas, 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 ),
+ canvas, 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 );
}
@@ -1455,7 +1453,8 @@ static void sonogram_readend(t_sonogram *x, t_floatarg fend)
/* setting the ending point for modification ( in percent ) */
static void sonogram_modend(t_sonogram *x, t_floatarg fend)
{
- t_float endpoint = fend;
+ t_float endpoint = fend;
+ t_canvas *canvas=glist_getcanvas(x->x_glist);
if (endpoint < 0) endpoint = 0;
if (endpoint > 100) endpoint = 100;
@@ -1468,9 +1467,9 @@ static void sonogram_modend(t_sonogram *x, t_floatarg fend)
if ( x->x_graphic && glist_isvisible( x->x_glist ) )
{
SYS_VGUI3( ".x%x.c delete line %xMODEND\n",
- glist_getcanvas( x->x_glist ), x);
+ canvas, 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 ),
+ canvas, 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 );
}