From 61b909037fddbfba6c0374bb250dfda675256c0e Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sun, 2 Feb 2003 04:39:30 +0000 Subject: "" svn path=/trunk/; revision=378 --- externals/grill/dyn/readme.txt | 8 ++++ externals/grill/dyn/src/main.cpp | 68 ++++++++++++++++++--------------- externals/grill/vasp/pd-ex/granular1.pd | 20 +++++----- externals/grill/vasp/pd-ex/granular2.pd | 19 +++++---- 4 files changed, 68 insertions(+), 47 deletions(-) (limited to 'externals') diff --git a/externals/grill/dyn/readme.txt b/externals/grill/dyn/readme.txt index 58d9bc84..5d8a32ae 100644 --- a/externals/grill/dyn/readme.txt +++ b/externals/grill/dyn/readme.txt @@ -30,8 +30,15 @@ o GCC: edit "config-pd-darwin.txt" & run "sh build-pd-darwin.sh" CHANGES: -------- +0.0.2: +- give the dyn~ subcanvas a name (hard to access - for the wild scripters out there), + so that it is different from the canvas where dyn~ is in +- corrected names of message in- and out-proxies. +- manually retrigger DSP after loading an abstraction + 0.0.1: - send loadbangs for loaded abstractions +- now use "dsp" message to enable dsp in sub-canvas (no need of canvas_addtolist, canvas_takefromlist any more) 0.0.0 - initial cvs version @@ -40,4 +47,5 @@ CHANGES: TODO: -------- +- support message boxes (do we need them?) - Hash table for object tags diff --git a/externals/grill/dyn/src/main.cpp b/externals/grill/dyn/src/main.cpp index 6af3e671..01810c4e 100644 --- a/externals/grill/dyn/src/main.cpp +++ b/externals/grill/dyn/src/main.cpp @@ -17,7 +17,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #error You need at least flext version 0.4.2 #endif -#define DYN_VERSION "0.0.1" +#define DYN_VERSION "0.0.3" #if FLEXT_SYS != FLEXT_SYS_PD @@ -71,6 +71,7 @@ protected: void FromCanvas(t_object *o); virtual bool m_method_(int n,const t_symbol *s,int argc,const t_atom *argv); + virtual void m_dsp(int n,t_signalvec const *insigs,t_signalvec const *outsigs); virtual void m_signal(int n,t_sample *const *insigs,t_sample *const *outsigs); // proxy object @@ -202,25 +203,26 @@ load it.. if there is no canvas, PD currently crashes. How to create the canvas: - 1) via direct call to canvas_new() 2) a message to pd_canvasmaker con: does not return a pointer for the created canvas - There are two possibilities for the canvas - 1) make a sub canvas to the one where dyn~ resides: pro: no problems with environment (abstractions are found and loaded correctly) - con: canvas must be manually added to the list of canvases so that it gets DSP - (the respective functions must be exported from PD) 2) make a root canvas: pro: it will be in the canvas list per default, hence DSP is processed con: canvas environment must be created manually (is normally done by pd_canvasmaker if there is a directory set, which is again done somewhere else) +Enabling DSP on the subcanvas +1) send it a "dsp" message (see rabin~ by K.Czaja)... but, which signal vector should be taken? + -> answer: NONE! (just send NULL) +2) add it to the list of _root_ canvases (these will be DSP-processed per default) + (for this the canvas_addtolist and canvas_takefromlist functions are used) + however, it's not clear if this can lead to problems since it is no root-canvas! -In both cases the 1)s have been chosen as the cleaner solution +In all cases the 1)s have been chosen as the cleaner solution */ dyn::dyn(int argc,const t_atom *argv): @@ -241,33 +243,26 @@ dyn::dyn(int argc,const t_atom *argv): int i; -#ifdef ROOT_CANVAS - // set NULL for creation of a root canvas - // so that DSP is called without connections to dyn~ canvas - canvas_setcurrent(NULL); -#endif - - // make a canvas for dyn~ - canvas = canvas_new(NULL, gensym("canvas"), 0, NULL); - -#ifndef ROOT_CANVAS - canvas_addtolist(canvas); -#endif + // make a sub-canvas for dyn~ + t_atom arg[6]; + SetInt(arg[0],0); // xpos + SetInt(arg[1],0); // ypos + SetInt(arg[2],700); // xwidth + SetInt(arg[3],520); // xwidth + SetString(arg[4]," dyn~-canvas "); // canvas name + SetInt(arg[5],0); // visible + canvas = canvas_new(NULL, NULL, 6, arg); // must do that.... canvas_unsetcurrent(canvas); -#ifdef ROOT_CANVAS - canvas_unsetcurrent(NULL); -#endif - pxin = new proxyin *[s_inlets+m_inlets]; for(i = 0; i < s_inlets+m_inlets; ++i) { bool sig = i < s_inlets; pxin[i] = (proxyin *)object_new(sig?pxins_class:pxin_class); pxin[i]->init(this,sig); t_binbuf *b = binbuf_new(); - binbuf_text(b,"dyn-in~",7); + binbuf_text(b,sig?"dyn-in~":"dyn-in",7); ToCanvas(&pxin[i]->obj,b,i*100,10); // place them left-to-right } @@ -277,7 +272,7 @@ dyn::dyn(int argc,const t_atom *argv): pxout[i] = (proxyout *)object_new(sig?pxouts_class:pxout_class); pxout[i]->init(this,i,sig); t_binbuf *b = binbuf_new(); - binbuf_text(b,"dyn-out~",8); + binbuf_text(b,sig?"dyn-out~":"dyn-out",8); ToCanvas(&pxout[i]->obj,b,i*100,500); // place them left-to-right } @@ -304,9 +299,6 @@ dyn::~dyn() } if(canvas) { -#ifndef ROOT_CANVAS - canvas_takeofflist(canvas); -#endif pd_free((t_pd *)canvas); } } @@ -328,7 +320,7 @@ void dyn::Add(const t_symbol *n,t_object *ob) void dyn::ToCanvas(t_object *o,t_binbuf *b,int x,int y) { - // add object to the glist.... this is needed to use canvas_deletelinesfor + // add object to the glist.... this is needed for graphical representation // which is needed to have all connections be properly deleted o->te_binbuf = b; @@ -402,6 +394,7 @@ void dyn::m_newobj(int _argc_,const t_atom *_argv_) // send message to object maker binbuf_eval(b,&pd_objectmaker,0,NULL); + // look for latest created object t_object *x = (t_object *)pd_newest(); if(x) { // place it @@ -410,8 +403,15 @@ void dyn::m_newobj(int _argc_,const t_atom *_argv_) Add(name,x); // send loadbang (if it is an abstraction) - if(pd_class(&x->te_g.g_pd) == canvas_class) + if(pd_class(&x->te_g.g_pd) == canvas_class) { + // loadbang the abstraction pd_vmess((t_pd *)x,gensym("loadbang"),""); + + // for an abstraction dsp must be restarted + // that's necessary because ToCanvas is called manually + // (may also be necessary for normal objects in a later PD version) + canvas_update_dsp(); + } } else { post("%s - new: Could not create object",thisName()); @@ -612,6 +612,14 @@ void dyn::proxyout::init(dyn *t,int o,bool s) } +void dyn::m_dsp(int n,t_signalvec const *insigs,t_signalvec const *outsigs) +{ + // add sub canvas to dsp list (no signal vector to borrow from .. set it to NULL) + mess1((t_pd *)canvas, gensym("dsp"),NULL); + + flext_dsp::m_dsp(n,insigs,outsigs); +} + void dyn::m_signal(int n,t_sample *const *insigs,t_sample *const *outsigs) { int i; diff --git a/externals/grill/vasp/pd-ex/granular1.pd b/externals/grill/vasp/pd-ex/granular1.pd index 2a601fc0..2ef369f9 100755 --- a/externals/grill/vasp/pd-ex/granular1.pd +++ b/externals/grill/vasp/pd-ex/granular1.pd @@ -1,4 +1,4 @@ -#N canvas 62 0 628 493 10; +#N canvas 62 0 630 495 10; #N canvas 0 0 450 300 graph34 0; #X array insert 128 float 1; #A 0 1 0.995185 0.980785 0.95694 0.92388 0.881921 0.83147 0.77301 0.707107 @@ -73,7 +73,6 @@ #X obj 76 333 s \$0-density; #X obj 204 275 tgl 15 0 empty empty start/stop 0 -6 0 8 -24198 -1 -1 1 1; -#X text 319 80 this array is insertet at triggering points; #X obj 76 290 * 0.001; #X floatatom 241 429 0 0 0 0 - - -; #X obj 241 407 env~ 32768; @@ -329,13 +328,14 @@ -1 -1 600 1; #X obj 204 374 *~ 0.2; #X text 387 445 needs the zexy library and vasp; -#X connect 2 0 15 0; +#X text 319 80 this array is inserted at triggering points; +#X connect 2 0 14 0; #X connect 4 0 7 0; -#X connect 5 0 10 0; +#X connect 5 0 9 0; #X connect 8 0 1 0; -#X connect 10 0 4 0; -#X connect 12 0 11 0; -#X connect 14 0 15 1; -#X connect 15 0 3 0; -#X connect 15 0 3 1; -#X connect 15 0 12 0; +#X connect 9 0 4 0; +#X connect 11 0 10 0; +#X connect 13 0 14 1; +#X connect 14 0 3 0; +#X connect 14 0 3 1; +#X connect 14 0 11 0; diff --git a/externals/grill/vasp/pd-ex/granular2.pd b/externals/grill/vasp/pd-ex/granular2.pd index a065c25c..cfea7d6c 100644 --- a/externals/grill/vasp/pd-ex/granular2.pd +++ b/externals/grill/vasp/pd-ex/granular2.pd @@ -1,4 +1,4 @@ -#N canvas 30 24 706 558 10; +#N canvas 30 24 708 560 10; #N canvas 0 0 450 300 graph34 0; #X array insert 128 float 0; #X coords 0 1 127 -1 200 140 1; @@ -6,7 +6,7 @@ #N canvas 339 256 523 452 player 0; #X obj 228 372 tabplay~ schnipparray; #X obj 228 396 throw~ toex; -#X obj 208 45 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +#X obj 208 45 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 ; #X obj 208 76 spigot; #X obj 104 330 s \$0-part; @@ -67,11 +67,11 @@ #X obj 204 403 dac~; #X floatatom 51 318 0 0 0 0 - - -; #X obj 51 278 nbx 5 14 -1e+037 1e+037 0 1 empty empty empty 0 -6 0 -10 -24198 -1 -1 18.13 256; +10 -24198 -1 -1 80.13 256; #X text 51 260 density; #X obj 51 340 s \$0-density; #X obj 204 275 tgl 15 0 empty empty start/stop 0 -6 0 8 -24198 -1 -1 -0 1; +1 1; #X floatatom 241 430 0 0 0 0 - - -; #X obj 241 407 env~ 32768; #N canvas 202 187 293 232 inside 0; @@ -256,7 +256,7 @@ #X connect 4 0 1 0; #X connect 5 0 2 0; #X restore 41 95 pd init; -#N canvas 409 43 522 372 create_schnippl 0; +#N canvas 409 43 526 376 create_schnippl 0; #X msg 155 114 vasp insert; #X obj 155 182 vasp.u; #X obj 155 138 vasp.osc 6.4; @@ -275,8 +275,11 @@ #X obj 273 251 vasp.osc 2; #X obj 273 271 vasp.*xwindow hamming; #X obj 355 230 nbx 5 14 -1e+037 1e+037 0 0 empty empty empty 0 -6 0 -10 -24198 -1 -1 28 256; +10 -24198 -1 -1 3 256; #X text 56 71 create various slices to insert; +#X msg 405 113 vasp insert; +#X obj 405 161 vasp.u; +#X obj 405 137 vasp.= 0; #X connect 0 0 2 0; #X connect 2 0 12 0; #X connect 3 0 11 0; @@ -290,10 +293,12 @@ #X connect 15 0 16 0; #X connect 16 0 14 0; #X connect 17 0 15 1; +#X connect 19 0 21 0; +#X connect 21 0 20 0; #X restore 40 47 pd create_schnippl; #X restore 53 489 pd inside; #X obj 322 271 vsl 15 100 0 1 0 1 empty empty volume 0 -8 0 8 -24198 --1 -1 3400 1; +-1 -1 4400 1; #X obj 204 374 *~ 0.2; #X text 332 464 needs the zexy library and vasp; #X obj 51 297 * 0.0001; -- cgit v1.2.1