From d8e4c552f0e58ddb76dc3991c37ce13557eb8a2e Mon Sep 17 00:00:00 2001 From: "N.N." Date: Tue, 30 Mar 2004 04:25:10 +0000 Subject: cooled~ 0.12 svn path=/trunk/externals/unauthorized/; revision=1516 --- cooled~/CHANGES.LOG | 2 + cooled~/Makefile | 2 +- cooled~/cooled~.c | 18 +----- cooled~/cooled~.tk2c | 65 ++++++++++++++++++++++ cooled~/help-cooled~.pd | 144 ++++++++++++++++++++++++++++++++++++++++++++++++ cooled~/tk2c.bash | 24 ++++++++ 6 files changed, 239 insertions(+), 16 deletions(-) create mode 100755 cooled~/cooled~.tk2c create mode 100644 cooled~/help-cooled~.pd create mode 100755 cooled~/tk2c.bash diff --git a/cooled~/CHANGES.LOG b/cooled~/CHANGES.LOG index 4e490a3..d19f257 100644 --- a/cooled~/CHANGES.LOG +++ b/cooled~/CHANGES.LOG @@ -1,3 +1,5 @@ +0.12 + adapted for pd 0.37 0.11 prevent crashes during reallocation 0.10 diff --git a/cooled~/Makefile b/cooled~/Makefile index 5c9da80..0ce41a7 100644 --- a/cooled~/Makefile +++ b/cooled~/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 -lpthread -lc -lm strip --strip-unneeded $*.pd_linux diff --git a/cooled~/cooled~.c b/cooled~/cooled~.c index 249c549..51e97f3 100644 --- a/cooled~/cooled~.c +++ b/cooled~/cooled~.c @@ -36,9 +36,7 @@ #include #include #include -#ifndef MACOSX #include -#endif #include #include #ifdef UNIX @@ -48,8 +46,8 @@ #define M_PI 3.14159265358979323846 #endif #include -#include +#include "m_pd.h" #include "m_imp.h" #include "g_canvas.h" #include "t_tk.h" @@ -108,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.11, written by Yves Degoyon (ydegoyon@free.fr)"; +static char *cooled_version = "cooled~: version 0.12, written by Yves Degoyon (ydegoyon@free.fr)"; static t_class *cooled_class; t_widgetbehavior cooled_widgetbehavior; @@ -1355,6 +1353,7 @@ void cooled_tilde_setup(void) post(cooled_version); cooled_class = class_new(gensym("cooled~"), (t_newmethod)cooled_new, (t_method)cooled_free, sizeof(t_cooled), 0, A_GIMME, 0); + class_sethelpsymbol( cooled_class, gensym("cooled~.pd") ); // set callbacks cooled_widgetbehavior.w_getrectfn = cooled_getrect; @@ -1364,19 +1363,8 @@ void cooled_tilde_setup(void) cooled_widgetbehavior.w_deletefn = cooled_delete; cooled_widgetbehavior.w_visfn = cooled_vis; cooled_widgetbehavior.w_clickfn = cooled_click; - /* - * : 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) cooled_widgetbehavior.w_propertiesfn = cooled_properties; cooled_widgetbehavior.w_savefn = cooled_save; -#else - class_setsavefn(cooled_class, &cooled_save); - class_setpropertiesfn(cooled_class, &cooled_properties); -#endif CLASS_MAINSIGNALIN( cooled_class, t_cooled, x_f ); class_addmethod(cooled_class, (t_method)cooled_dsp, gensym("dsp"), A_NULL); diff --git a/cooled~/cooled~.tk2c b/cooled~/cooled~.tk2c new file mode 100755 index 0000000..417c279 --- /dev/null +++ b/cooled~/cooled~.tk2c @@ -0,0 +1,65 @@ +// ########### cooled procedures -- ydegoyon@free.fr ######### +sys_gui("proc cooled_apply {id} {\n"); +// strip "." from the TK id to make a variable name suffix +sys_gui("set vid [string trimleft $id .]\n"); +// for each variable, make a local variable to hold its name... +sys_gui("set var_graph_width [concat graph_width_$vid]\n"); +sys_gui("global $var_graph_width\n"); +sys_gui("set var_graph_height [concat graph_height_$vid]\n"); +sys_gui("global $var_graph_height\n"); +sys_gui("set var_graph_draw [concat graph_draw_$vid]\n"); +sys_gui("global $var_graph_draw\n"); +sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_width] [eval concat $$var_graph_height] [eval concat $$var_graph_draw] \\;]\n"); +// puts stderr $cmd +sys_gui("pd $cmd\n"); +sys_gui("}\n"); +sys_gui("proc cooled_cancel {id} {\n"); +sys_gui("set cmd [concat $id cancel \\;]\n"); +// puts stderr $cmd +sys_gui("pd $cmd\n"); +sys_gui("}\n"); +sys_gui("proc cooled_ok {id} {\n"); +sys_gui("cooled_apply $id\n"); +sys_gui("cooled_cancel $id\n"); +sys_gui("}\n"); +sys_gui("proc pdtk_cooled_dialog {id width height draw} {\n"); +sys_gui("set vid [string trimleft $id .]\n"); +sys_gui("set var_graph_width [concat graph_width_$vid]\n"); +sys_gui("global $var_graph_width\n"); +sys_gui("set var_graph_height [concat graph_height_$vid]\n"); +sys_gui("global $var_graph_height\n"); +sys_gui("set var_graph_draw [concat graph_draw_$vid]\n"); +sys_gui("global $var_graph_draw\n"); +sys_gui("set $var_graph_width $width\n"); +sys_gui("set $var_graph_height $height\n"); +sys_gui("set $var_graph_draw $draw\n"); +sys_gui("toplevel $id\n"); +sys_gui("wm title $id {cooled}\n"); +sys_gui("wm protocol $id WM_DELETE_WINDOW [concat cooled_cancel $id]\n"); +sys_gui("label $id.label -text {EDITOR PROPERTIES}\n"); +sys_gui("pack $id.label -side top\n"); +sys_gui("frame $id.buttonframe\n"); +sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n"); +sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"cooled_cancel $id\"\n"); +sys_gui("button $id.buttonframe.apply -text {Apply} -command \"cooled_apply $id\"\n"); +sys_gui("button $id.buttonframe.ok -text {OK} -command \"cooled_ok $id\"\n"); +sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n"); +sys_gui("pack $id.buttonframe.apply -side left -expand 1\n"); +sys_gui("pack $id.buttonframe.ok -side left -expand 1\n"); +sys_gui("frame $id.1rangef\n"); +sys_gui("pack $id.1rangef -side top\n"); +sys_gui("label $id.1rangef.lwidth -text \"Width :\"\n"); +sys_gui("entry $id.1rangef.width -textvariable $var_graph_width -width 7\n"); +sys_gui("pack $id.1rangef.lwidth $id.1rangef.width -side left\n"); +sys_gui("frame $id.2rangef\n"); +sys_gui("pack $id.2rangef -side top\n"); +sys_gui("label $id.2rangef.lheight -text \"Height :\"\n"); +sys_gui("entry $id.2rangef.height -textvariable $var_graph_height -width 7\n"); +sys_gui("pack $id.2rangef.lheight $id.2rangef.height -side left\n"); +sys_gui("checkbutton $id.draw -text {Draw Sample} -variable $var_graph_draw -anchor w\n"); +sys_gui("pack $id.draw -side top\n"); +sys_gui("bind $id.1rangef.width [concat cooled_ok $id]\n"); +sys_gui("bind $id.2rangef.height [concat cooled_ok $id]\n"); +sys_gui("focus $id.1rangef.width\n"); +sys_gui("}\n"); +// ########### cooled procedures END -- ydegoyon@free.fr ######### diff --git a/cooled~/help-cooled~.pd b/cooled~/help-cooled~.pd new file mode 100644 index 0000000..19a6d67 --- /dev/null +++ b/cooled~/help-cooled~.pd @@ -0,0 +1,144 @@ +#N canvas 29 25 986 675 10; +#X msg 30 628 \; pd dsp 1; +#X msg 104 629 \; pd dsp 0; +#X obj 122 567 dac~; +#X obj 29 599 loadbang; +#X obj 115 531 *~ 1; +#X obj 156 530 *~ 1; +#X floatatom 204 531 5 0 0; +#X text 557 36 Cooled~ : a micro sound editor; +#X text 555 48 it supports selection and cut/paste modifications; +#X text 686 645 Comments and bugs @ ydegoyon@noos.fr; +#X obj 277 506 print recend; +#X obj 362 540 print playend; +#X msg 28 31 bang; +#X obj 27 53 openpanel; +#X msg 62 226 resize \$1; +#X obj 27 73 t s b; +#X obj 76 73 float \$0; +#X text 27 6 Step 1 : Load a sound file; +#X obj 27 96 route float; +#X text 95 25 ( a small one ); +#X msg 208 218 record; +#X msg 315 10 bang; +#X text 355 9 Step 2 : Record the sound; +#X obj 63 163 pack s s s; +#X obj 19 117 makefilename %d-right-channel; +#X obj 23 140 makefilename %d-left-channel; +#X obj 180 611 table \$0-right-channel; +#X obj 181 636 table \$0-left-channel; +#X msg 62 184 read -resize \$1 \$2 \$3; +#X obj 289 41 tabplay~ \$0-right-channel; +#X obj 288 67 tabplay~ \$0-left-channel; +#X msg 18 298 refresh; +#X msg 23 467 play; +#X msg 22 445 bang; +#X text 11 494 Step 3 : Play it back; +#X obj 146 249 cooled~ 81839 400 200 1; +#X obj 397 157 hsl 128 15 0 100 0 0 empty empty empty 20 8 0 8 -262144 +-1 -1 0 1; +#X obj 397 179 hsl 128 15 0 100 0 0 empty empty empty 20 8 0 8 -262144 +-1 -1 12700 1; +#X text 400 131 Reading positions; +#X text 539 153 Start; +#X text 538 179 End; +#X msg 301 106 readspeed \$1; +#X floatatom 438 106 5 0 0; +#X obj 397 106 / 100; +#X msg 489 106 100; +#X text 521 105 Reading speed; +#X msg 18 328 zoom 2; +#X msg 19 357 zoom 1; +#X msg 361 179 100; +#X obj 297 179 loadbang; +#X obj 600 187 random 100; +#X msg 660 137 bang; +#X obj 681 186 random 100; +#X text 641 114 Random play; +#X obj 602 164 metro 1000; +#X text 601 507 Mouse modifications :; +#X text 601 522 : erase selection; +#X text 601 537 : replace by selection; +#X text 418 612 The red area is the selection; +#X text 419 596 point for paste and replace; +#X text 420 581 Note : the blue line is the insertion; +#X msg 361 155 0; +#X text 600 552 : add selection [ noize ]; +#X text 706 429 (invoke with Properties ); +#X text 709 419 You can set the following properties :; +#X text 733 460 * Width : graphical x size; +#X text 733 476 * Height : graphical y size; +#X msg 704 138 stop; +#X text 686 631 Part of unauthorized PD; +#X obj 683 163 metro 1000; +#X msg 23 391 stereo; +#X text 19 413 Map to stereo; +#X floatatom 448 481 8 0 0; +#X floatatom 521 481 8 0 0; +#X text 447 502 start; +#X text 510 503 end; +#X text 469 518 Selection; +#X msg 460 219 loop *2; +#X msg 401 218 loop /2; +#X msg 342 218 loop <1; +#X obj 62 206 soundfiler; +#X msg 282 218 loop >1; +#X text 520 220 loop operators ( accept any float value ); +#X connect 3 0 0 0; +#X connect 4 0 2 0; +#X connect 5 0 2 1; +#X connect 6 0 4 1; +#X connect 6 0 5 1; +#X connect 12 0 13 0; +#X connect 13 0 15 0; +#X connect 14 0 35 0; +#X connect 15 0 23 0; +#X connect 15 1 16 0; +#X connect 16 0 18 0; +#X connect 18 0 24 0; +#X connect 18 0 25 0; +#X connect 20 0 35 0; +#X connect 21 0 20 0; +#X connect 21 0 29 0; +#X connect 21 0 30 0; +#X connect 23 0 28 0; +#X connect 24 0 23 1; +#X connect 25 0 23 2; +#X connect 28 0 80 0; +#X connect 29 0 35 0; +#X connect 30 0 35 1; +#X connect 31 0 35 0; +#X connect 32 0 35 0; +#X connect 33 0 32 0; +#X connect 35 0 4 0; +#X connect 35 1 5 0; +#X connect 35 2 10 0; +#X connect 35 3 11 0; +#X connect 35 3 32 0; +#X connect 35 4 72 0; +#X connect 35 5 73 0; +#X connect 36 0 35 2; +#X connect 37 0 35 3; +#X connect 41 0 35 0; +#X connect 42 0 43 0; +#X connect 43 0 41 0; +#X connect 44 0 42 0; +#X connect 46 0 35 0; +#X connect 47 0 35 0; +#X connect 48 0 37 0; +#X connect 49 0 48 0; +#X connect 50 0 35 2; +#X connect 51 0 54 0; +#X connect 51 0 69 0; +#X connect 52 0 35 3; +#X connect 54 0 50 0; +#X connect 61 0 36 0; +#X connect 67 0 54 0; +#X connect 67 0 69 0; +#X connect 69 0 52 0; +#X connect 70 0 35 0; +#X connect 77 0 35 0; +#X connect 78 0 35 0; +#X connect 79 0 35 0; +#X connect 80 0 14 0; +#X connect 81 0 35 0; diff --git a/cooled~/tk2c.bash b/cooled~/tk2c.bash new file mode 100755 index 0000000..9dfeb03 --- /dev/null +++ b/cooled~/tk2c.bash @@ -0,0 +1,24 @@ +#!/bin/bash + +#set -x + +while read line +do + for word in $line + do + if [ "X"$word != "X"${word#\#} ] + then + echo // ${line#\#} + break + else + line=${line//\'/\\\'} +#useless, slashes never gets in + line=${line//\\/\\\\} +#this one's dirty, i know + line=${line//;/\\\\;} + line=${line//\"/\\\"} + echo 'sys_gui("'$line'\n");' + break + fi + done +done -- cgit v1.2.1