aboutsummaryrefslogtreecommitdiff
path: root/pianoroll
diff options
context:
space:
mode:
Diffstat (limited to 'pianoroll')
-rw-r--r--pianoroll/CHANGES.LOG2
-rw-r--r--pianoroll/help-pianoroll.pd80
-rw-r--r--pianoroll/pianoroll.c4
-rwxr-xr-xpianoroll/pianoroll.tk2c131
-rwxr-xr-xpianoroll/tk2c.bash24
5 files changed, 239 insertions, 2 deletions
diff --git a/pianoroll/CHANGES.LOG b/pianoroll/CHANGES.LOG
index bb8e709..72f4901 100644
--- a/pianoroll/CHANGES.LOG
+++ b/pianoroll/CHANGES.LOG
@@ -1,3 +1,5 @@
+0.10
+ fixed coordinates for GOP support
0.9
added GOP support
0.8
diff --git a/pianoroll/help-pianoroll.pd b/pianoroll/help-pianoroll.pd
new file mode 100644
index 0000000..809fec9
--- /dev/null
+++ b/pianoroll/help-pianoroll.pd
@@ -0,0 +1,80 @@
+#N canvas 90 41 827 643 10;
+#X floatatom 71 402 5 0 0;
+#X floatatom 258 400 5 0 0;
+#X text 523 112 (invoke with <right mouse>Properties );
+#X text 524 101 You can set the following properties :;
+#X text 548 141 * Width : graphical x size;
+#X text 548 152 * Height : graphical y size;
+#X text 488 548 bugs and comments @ ydegoyon@free.fr;
+#X msg 587 271 \; pd dsp 0;
+#X msg 653 271 \; pd dsp 1;
+#X text 548 129 * Name;
+#X text 119 401 Pitch;
+#X text 304 399 Volume ( scaled to [0 \, 1] );
+#X text 547 164 * Pitch min : minimum value delivered by left outlet
+;
+#X text 547 176 * Pitch max : maximum value delivered by left outlet
+;
+#X text 547 200 * Step number : number of steps;
+#X text 524 79 ( pitch & volume originally but \, really \, anything
+you like );
+#X msg 238 87 transpose \$1;
+#X floatatom 334 89 5 0 0;
+#X text 240 104 You can transpose the melody ( ?? );
+#X text 241 115 with a float value;
+#X text 548 211 * Default value : must be in [min \, max];
+#X obj 65 165 pianoroll pianoroll1 400 192 -15 15 32 16 0 0 1 -12.0968
+0.741935 -3.3871 0.16129 5.32258 0.16129 -4.35484 0.354839 6.29032
+0.322581 6.29032 1 5.32258 1 -12.0968 0.290323 -10.1613 0.290323 -8.22581
+0.580645 -5.32258 1 7.25807 1 -10.1613 0.580645 -15 0.612903 -15 0.580645
+-15 1;
+#X msg 47 18 bang;
+#X obj 46 80 f;
+#X obj 76 80 + 1;
+#X floatatom 9 104 5 0 0;
+#X obj 47 44 metro 500;
+#X text 527 65 Pianoroll controls two parameters for a sequencer;
+#X text 548 188 * Pitch grades : number of grades for the pitch;
+#X msg 82 18 stop;
+#X floatatom 13 140 5 0 0;
+#X text 57 1 forward;
+#X text 144 0 backward;
+#X msg 136 15 bang;
+#X obj 135 77 f;
+#X obj 136 41 metro 500;
+#X msg 171 16 stop;
+#X obj 165 77 - 1;
+#X msg 239 59 init;
+#X text 279 60 init to default values;
+#X msg 241 33 load pattern#1;
+#X text 352 19 load and save the patterns;
+#X text 352 31 ( values as well as steps number .... );
+#X msg 241 10 save pattern#1;
+#X text 544 383 you can set the pitch and;
+#X text 544 397 the volume with messages;
+#X text 544 409 ( positions start at zero );
+#X msg 541 358 volume 3 0.345;
+#X msg 542 334 pitch 3 -5;
+#X connect 16 0 21 0;
+#X connect 17 0 16 0;
+#X connect 21 0 0 0;
+#X connect 21 1 1 0;
+#X connect 22 0 26 0;
+#X connect 23 0 21 0;
+#X connect 23 0 24 0;
+#X connect 23 0 25 0;
+#X connect 24 0 23 1;
+#X connect 26 0 23 0;
+#X connect 29 0 26 0;
+#X connect 30 0 21 0;
+#X connect 33 0 35 0;
+#X connect 34 0 37 0;
+#X connect 34 0 21 0;
+#X connect 35 0 34 0;
+#X connect 36 0 35 0;
+#X connect 37 0 34 1;
+#X connect 38 0 21 0;
+#X connect 40 0 21 0;
+#X connect 43 0 21 0;
+#X connect 47 0 21 0;
+#X connect 48 0 21 0;
diff --git a/pianoroll/pianoroll.c b/pianoroll/pianoroll.c
index da23357..8bb0c2f 100644
--- a/pianoroll/pianoroll.c
+++ b/pianoroll/pianoroll.c
@@ -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.9 (ydegoyon@free.fr)";
+static char *pianoroll_version = "pianoroll: a graphical sequencer controller, version 0.10 (ydegoyon@free.fr)";
t_widgetbehavior pianoroll_widgetbehavior;
static t_class *pianoroll_class;
@@ -263,7 +263,7 @@ static void pianoroll_save(t_gobj *z, t_binbuf *b)
// post( "saving pianoroll : %s", x->x_name->s_name );
binbuf_addv(b, "ssiissiiffiiifi", gensym("#X"),gensym("obj"),
- (t_int)text_xpix(&x->x_obj, x->x_glist), (t_int)text_ypix(&x->x_obj, x->x_glist),
+ (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix,
gensym("pianoroll"), x->x_name, x->x_width, x->x_height,
x->x_pmin, x->x_pmax,
x->x_nbgrades, x->x_nbsteps,
diff --git a/pianoroll/pianoroll.tk2c b/pianoroll/pianoroll.tk2c
new file mode 100755
index 0000000..10f5645
--- /dev/null
+++ b/pianoroll/pianoroll.tk2c
@@ -0,0 +1,131 @@
+// ########### pianoroll procedures -- ydegoyon@free.fr #########
+sys_gui("proc pianoroll_apply {id} {\n");
+// strip "." from the TK id to make a variable name suffix
+sys_gui("set vid [string trimleft $id .]\n");
+// for each variable, make a local variable to hold its name...
+sys_gui("set var_graph_name [concat graph_name_$vid]\n");
+sys_gui("global $var_graph_name\n");
+sys_gui("set var_graph_width [concat graph_width_$vid]\n");
+sys_gui("global $var_graph_width\n");
+sys_gui("set var_graph_height [concat graph_height_$vid]\n");
+sys_gui("global $var_graph_height\n");
+sys_gui("set var_graph_pmin [concat graph_pmin_$vid]\n");
+sys_gui("global $var_graph_pmin\n");
+sys_gui("set var_graph_pmax [concat graph_pmax_$vid]\n");
+sys_gui("global $var_graph_pmax\n");
+sys_gui("set var_graph_nbgrades [concat graph_nbgrades_$vid]\n");
+sys_gui("global $var_graph_nbgrades\n");
+sys_gui("set var_graph_nbsteps [concat graph_nbsteps_$vid]\n");
+sys_gui("global $var_graph_nbsteps\n");
+sys_gui("set var_graph_defvalue [concat graph_defvalue_$vid]\n");
+sys_gui("global $var_graph_defvalue\n");
+sys_gui("set var_graph_save [concat graph_save_$vid]\n");
+sys_gui("global $var_graph_save\n");
+sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_name] [eval concat $$var_graph_width] [eval concat $$var_graph_height] [eval concat $$var_graph_pmin] [eval concat $$var_graph_pmax] [eval concat $$var_graph_nbgrades] [eval concat $$var_graph_nbsteps] [eval concat $$var_graph_defvalue] [eval concat $$var_graph_save] \\;]\n");
+// puts stderr $cmd
+sys_gui("pd $cmd\n");
+sys_gui("}\n");
+sys_gui("proc pianoroll_cancel {id} {\n");
+sys_gui("set cmd [concat $id cancel \\;]\n");
+// puts stderr $cmd
+sys_gui("pd $cmd\n");
+sys_gui("}\n");
+sys_gui("proc pianoroll_ok {id} {\n");
+sys_gui("pianoroll_apply $id\n");
+sys_gui("pianoroll_cancel $id\n");
+sys_gui("}\n");
+sys_gui("proc pdtk_pianoroll_dialog {id name width height pmin pmax nbgrades nbsteps defvalue save } {\n");
+sys_gui("set vid [string trimleft $id .]\n");
+sys_gui("set var_graph_name [concat graph_name_$vid]\n");
+sys_gui("global $var_graph_name\n");
+sys_gui("set var_graph_width [concat graph_width_$vid]\n");
+sys_gui("global $var_graph_width\n");
+sys_gui("set var_graph_height [concat graph_height_$vid]\n");
+sys_gui("global $var_graph_height\n");
+sys_gui("set var_graph_pmin [concat graph_pmin_$vid]\n");
+sys_gui("global $var_graph_pmin\n");
+sys_gui("set var_graph_pmax [concat graph_pmax_$vid]\n");
+sys_gui("global $var_graph_pmax\n");
+sys_gui("set var_graph_nbgrades [concat graph_nbgrades_$vid]\n");
+sys_gui("global $var_graph_nbgrades\n");
+sys_gui("set var_graph_nbsteps [concat graph_nbsteps_$vid]\n");
+sys_gui("global $var_graph_nbsteps\n");
+sys_gui("set var_graph_defvalue [concat graph_defvalue_$vid]\n");
+sys_gui("global $var_graph_defvalue\n");
+sys_gui("set var_graph_save [concat graph_save_$vid]\n");
+sys_gui("global $var_graph_save\n");
+sys_gui("set $var_graph_name $name\n");
+sys_gui("set $var_graph_width $width\n");
+sys_gui("set $var_graph_height $height\n");
+sys_gui("set $var_graph_pmin $pmin\n");
+sys_gui("set $var_graph_pmax $pmax\n");
+sys_gui("set $var_graph_nbgrades $nbgrades\n");
+sys_gui("set $var_graph_nbsteps $nbsteps\n");
+sys_gui("set $var_graph_defvalue $defvalue\n");
+sys_gui("set $var_graph_save $save\n");
+sys_gui("toplevel $id\n");
+sys_gui("wm title $id {pianoroll}\n");
+sys_gui("wm protocol $id WM_DELETE_WINDOW [concat pianoroll_cancel $id]\n");
+sys_gui("label $id.label -text {PIANOROLL PROPERTIES}\n");
+sys_gui("pack $id.label -side top\n");
+sys_gui("frame $id.buttonframe\n");
+sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n");
+sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"pianoroll_cancel $id\"\n");
+sys_gui("button $id.buttonframe.apply -text {Apply} -command \"pianoroll_apply $id\"\n");
+sys_gui("button $id.buttonframe.ok -text {OK} -command \"pianoroll_ok $id\"\n");
+sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n");
+sys_gui("pack $id.buttonframe.apply -side left -expand 1\n");
+sys_gui("pack $id.buttonframe.ok -side left -expand 1\n");
+sys_gui("frame $id.1rangef\n");
+sys_gui("pack $id.1rangef -side top\n");
+sys_gui("label $id.1rangef.lname -text \"Name :\"\n");
+sys_gui("entry $id.1rangef.name -textvariable $var_graph_name -width 15\n");
+sys_gui("pack $id.1rangef.lname $id.1rangef.name -side left\n");
+sys_gui("frame $id.2rangef\n");
+sys_gui("pack $id.2rangef -side top\n");
+sys_gui("label $id.2rangef.lwidth -text \"Width :\"\n");
+sys_gui("entry $id.2rangef.width -textvariable $var_graph_width -width 7\n");
+sys_gui("pack $id.2rangef.lwidth $id.2rangef.width -side left\n");
+sys_gui("frame $id.3rangef\n");
+sys_gui("pack $id.3rangef -side top\n");
+sys_gui("label $id.3rangef.lheight -text \"Height :\"\n");
+sys_gui("entry $id.3rangef.height -textvariable $var_graph_height -width 7\n");
+sys_gui("pack $id.3rangef.lheight $id.3rangef.height -side left\n");
+sys_gui("frame $id.4rangef\n");
+sys_gui("pack $id.4rangef -side top\n");
+sys_gui("label $id.4rangef.lpmin -text \"Pitch low :\"\n");
+sys_gui("entry $id.4rangef.pmin -textvariable $var_graph_pmin -width 7\n");
+sys_gui("pack $id.4rangef.lpmin $id.4rangef.pmin -side left\n");
+sys_gui("frame $id.5rangef\n");
+sys_gui("pack $id.5rangef -side top\n");
+sys_gui("label $id.5rangef.lpmax -text \"Pitch high :\"\n");
+sys_gui("entry $id.5rangef.pmax -textvariable $var_graph_pmax -width 7\n");
+sys_gui("pack $id.5rangef.lpmax $id.5rangef.pmax -side left\n");
+sys_gui("frame $id.6rangef\n");
+sys_gui("pack $id.6rangef -side top\n");
+sys_gui("label $id.6rangef.lnbgrades -text \"Grades :\"\n");
+sys_gui("entry $id.6rangef.nbgrades -textvariable $var_graph_nbgrades -width 7\n");
+sys_gui("pack $id.6rangef.lnbgrades $id.6rangef.nbgrades -side left\n");
+sys_gui("frame $id.7rangef\n");
+sys_gui("pack $id.7rangef -side top\n");
+sys_gui("label $id.7rangef.lnbsteps -text \"Steps :\"\n");
+sys_gui("entry $id.7rangef.nbsteps -textvariable $var_graph_nbsteps -width 7\n");
+sys_gui("pack $id.7rangef.lnbsteps $id.7rangef.nbsteps -side left\n");
+sys_gui("frame $id.8rangef\n");
+sys_gui("pack $id.8rangef -side top\n");
+sys_gui("label $id.8rangef.ldefvalue -text \"Default Value :\"\n");
+sys_gui("entry $id.8rangef.defvalue -textvariable $var_graph_defvalue -width 7\n");
+sys_gui("pack $id.8rangef.ldefvalue $id.8rangef.defvalue -side left\n");
+sys_gui("checkbutton $id.save -text {Save contents} -variable $var_graph_save -anchor w\n");
+sys_gui("pack $id.save -side top\n");
+sys_gui("bind $id.1rangef.name <KeyPress-Return> [concat pianoroll_ok $id]\n");
+sys_gui("bind $id.2rangef.width <KeyPress-Return> [concat pianoroll_ok $id]\n");
+sys_gui("bind $id.3rangef.height <KeyPress-Return> [concat pianoroll_ok $id]\n");
+sys_gui("bind $id.4rangef.pmin <KeyPress-Return> [concat pianoroll_ok $id]\n");
+sys_gui("bind $id.5rangef.pmax <KeyPress-Return> [concat pianoroll_ok $id]\n");
+sys_gui("bind $id.6rangef.nbgrades <KeyPress-Return> [concat pianoroll_ok $id]\n");
+sys_gui("bind $id.7rangef.nbsteps <KeyPress-Return> [concat pianoroll_ok $id]\n");
+sys_gui("bind $id.8rangef.defvalue <KeyPress-Return> [concat pianoroll_ok $id]\n");
+sys_gui("focus $id.1rangef.name\n");
+sys_gui("}\n");
+// ########### pianoroll procedures END -- ydegoyon@free.fr #########
diff --git a/pianoroll/tk2c.bash b/pianoroll/tk2c.bash
new file mode 100755
index 0000000..9dfeb03
--- /dev/null
+++ b/pianoroll/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