aboutsummaryrefslogtreecommitdiff
path: root/sonogram~
diff options
context:
space:
mode:
authorN.N. <sevyves@users.sourceforge.net>2005-03-02 02:48:57 +0000
committerN.N. <sevyves@users.sourceforge.net>2005-03-02 02:48:57 +0000
commit3c83bb159ecc7a6bb3cc790d508c6e1dbfebd07c (patch)
treeece782f727214f022a6829688e20695b39519023 /sonogram~
parente625413ae9b5cb00209ab406283fff0b622eb5a7 (diff)
Added GOP supoort
svn path=/trunk/externals/unauthorized/; revision=2592
Diffstat (limited to 'sonogram~')
-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
4 files changed, 127 insertions, 122 deletions
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 );
}