#N canvas 290 49 764 739 12;
#X msg 113 410 foo bar baz;
#X obj 257 501 osc~ 440;
#X obj 174 638 env~ 8192;
#X floatatom 174 667 8 0 0 0 - - - 0;
#X msg 79 340 pd~ stop;
#X obj 257 638 env~ 8192;
#X floatatom 257 667 8 0 0 0 - - - 0;
#X obj 191 551 *~;
#X obj 257 551 *~;
#X obj 34 12 pd~;
#X msg 636 255 \; pd dsp \$1;
#X obj 4 41 cnv 1 750 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X text 672 11 <= click;
#N canvas 476 113 719 484 reference 0;
#X obj 6 35 cnv 5 700 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 6 219 cnv 2 700 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 6 307 cnv 2 700 2 empty empty ARGUMENTS: 8 12 0 13 #202020 #000000 0;
#X obj 5 455 cnv 5 700 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X obj 5 248 cnv 1 700 1 empty empty 1st: 8 12 0 13 #9f9f9f #000000 0;
#X obj 5 275 cnv 1 700 1 empty empty n: 8 12 0 13 #9f9f9f #000000 0;
#X obj 42 6 pd~;
#X obj 5 333 cnv 1 700 1 empty empty flags: 8 12 0 13 #9f9f9f #000000 0;
#X text 102 339 -ninsig <float>: sets number of input audio channels (default 2)., f 74;
#X text 102 357 -noutsig <float>: sets number of output audio channels (default 2)., f 74;
#X obj 6 67 cnv 1 700 1 empty empty 1st: 8 12 0 13 #9f9f9f #000000 0;
#X text 60 73 pd~ start <anything> -;
#X text 144 105 pd~ stop - stops the pd sub-process., f 78;
#X text 144 142 anything -;
#X obj 6 190 cnv 1 700 1 empty empty n: 8 12 0 13 #9f9f9f #000000 0;
#X text 102 393 -fifo <float>: sets number of blocks for round-trip (default 5)., f 74;
#X text 102 411 -pddir <symbol>: sets Pd's directory (needed if different than default)., f 74;
#X text 102 429 -scheddir <symbol>: sets scheduler's directory (also needed if different)., f 74;
#X text 77 5 - run a pd sub-process (for multiprocessing).;
#X text 158 163 signal - signal input if there's a corresponding [adc~] input., f 76;
#X text 158 196 signal - signal input if there's a corresponding [adc~] input., f 76;
#X text 143 251 anything - messages from the sub-process sent via [stdout] objects., f 67;
#X text 158 280 signal - signal output if there's a corresponding [dac~] output., f 64;
#X text 221 73 start a new sub-process. This message takes startup flags and needs a pd file to open., f 67;
#X text 94 44 total number of 'n' signal inlets as given by the -ninsig flag., f 67;
#X text 94 226 total number of 'n' signal outlets as given by the -noutsig flag., f 69;
#X text 221 142 messages besides "pd~" are sent to the sub-process., f 67;
#X text 102 375 -sr <float>: sets sample rate of subprocess (default Pd's current)., f 74;
#X text 95 124 pd~ vis <float> - <1> starts and <0> stops the gui in the sub-process., f 85;
#X restore 578 12 pd reference;
#X text 29 710 see also:;
#X obj 105 711 stdout;
#X obj 292 551 tgl 19 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000 0 1;
#X obj 226 551 tgl 19 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000 0 1;
#X text 69 11 - run a pd sub-process (for multiprocessing);
#X text 666 224 DSP on/off;
#X obj 636 221 ../../doc/5.reference/set-dsp-tgl;
#X msg 17 284 pd~ start pd~-subprocess.pd;
#X obj 3 700 cnv 1 750 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X text 347 633 The first outlet reports messages the sub-process sends us via [stdout] objects. Any other outlets are signals corresponding to [dac~] objects in the sub-process., f 55;
#X obj 92 651 print pd~;
#X obj 126 477 tgl 19 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000 0 1;
#X text 270 481 v;
#X text 270 472 |;
#X text 274 461 _;
#X text 280 461 _;
#X text 27 49 The [pd~] object starts and manages a Pd sub-process that can communicate with the super-process (this one) via audio channels and/or Pd messages. In this way you can take advantage of multi-core CPUs. The Max version of [pd~] \, on the other hand \, allows you to use Pd features from within Max., f 100;
#X msg 126 504 pd dsp \$1;
#X msg 333 563 pd-pd~-subprocess.pd vis \$1;
#X obj 333 537 tgl 19 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000 0 1;
#X msg 333 504 0;
#X msg 373 504 1;
#X text 359 536 hide/show window;
#X text 403 504 * <-----------------;
#X obj 92 596 pd~ -ninsig 2 -noutsig 2 -fifo 20 -sr 48000, f 24;
#X text 271 602 <-- see [pd reference] for creation flag's descriptions.;
#X msg 126 434 0;
#X msg 166 434 1;
#X text 148 478 DSP On/Off;
#X text 27 219 ATTENTION: DSP must be running in this process for the sub-process to start and run. This is because its clock is slaved to audio I/O it gets from us!, f 75;
#X text 27 98 Messages with the "pd~" selector control the sub-process. A "pd~ start" message takes a pd file name to open and optional startup flags before it. For example \, "-nogui" prevents the sub-process's GUI from appearing. Note that you shouldn't specify the number of channels in and out or sample rate via startup flags since that's set by [pd~]'s creation flags. The sub-process doesn't open real audio and MIDI devices \, so audio/midi config flags (-audiodev \, -midiindev \, etc.) are ignored. Messages without the "pd~" selector are sent to the sub-process (see examples/details below). Note that the sub-process cannot communicate with MIDI devices connected to Pd \, so MIDI messages need to be sent in and out via regular messages to the sub-process., f 100;
#X text 560 225 --------->;
#X obj 162 711 ../../doc/5.reference/pd-messages;
#X msg 46 315 pd~ start -nogui -send pd\ dsp\ 1 pd~-subprocess.pd;
#X text 411 316 (re)start with flags \, see -->;
#N canvas 707 185 554 486 more 0;
#X obj 106 224 pdcontrol;
#X obj 106 164 pdcontrol;
#X msg 106 134 dir;
#X msg 106 193 browse \$1/../../doc/1.manual/x3.htm;
#X text 143 132 <-- Click to open Chapter 3 of Pd's Manual;
#X text 50 28 For a list of all startup flags you can use please refer to the Pd Manual \, Chapter 3 "Getting Pd to run". More specifically \, go to section 3.5 "Preferences and startup options". You can go to the manual via the "help" and "browser" menus or click the message below., f 63;
#X text 42 266 Note \, however \, that audio/midi flags are ignored as the sub-process doesn't open real audio and MIDI devices \, so please refer to 'general flags' only., f 69;
#X text 42 320 In the example on the parent patch we used the '-nogui' flag to run Pd without the GUI and also the '-send' flag to send a message to pd to turn the DSP on. Note that unlike the way you'd use this flag in startup menu or command line you should not use quotes. Instead we have to escape spaces with backslashes., f 69;
#X text 42 404 By the way \, of course you can just use a [loadbang] in the subprocess to turn DSP on \, so these examples are mostly didactical \, not practical., f 69;
#X connect 1 0 3 0;
#X connect 2 0 1 0;
#X connect 3 0 0 0;
#X restore 620 317 pd more about startup flags;
#X f 13;
#X text 218 277 sending a new "start" message stops the sub-process (if there's one) and starts a new one (DSP must be on).;
#X text 206 407 other messages are sent to the sub-process \, such as to [receive] objects (like 'foo' in this example) and also messages to 'pd' ("pd dsp 1" \, etc). You can also communicate to the patch file itself (see below *)., f 73;
#X text 291 467 audio input signals appear in [adc~] objects in the sub-process., f 64;
#X text 549 505 you can communicate to the patch via its file name preceded by 'pd-'. Check the [pd-messages] file in the 'see also' section for more options/details., f 26;
#X msg 89 363 pd~ vis 1;
#X msg 103 386 pd~ vis 0;
#X text 179 366 start or stop subprocess gui, f 14;
#X text 143 340 stop the sub-process;
#X text 543 709 Updated for Pd version 0.56;
#X connect 0 0 38 0;
#X connect 1 0 7 0;
#X connect 1 0 8 0;
#X connect 2 0 3 0;
#X connect 4 0 38 0;
#X connect 5 0 6 0;
#X connect 7 0 38 0;
#X connect 8 0 38 1;
#X connect 16 0 8 1;
#X connect 17 0 7 1;
#X connect 20 0 10 0;
#X connect 21 0 38 0;
#X connect 25 0 31 0;
#X connect 31 0 38 0;
#X connect 32 0 38 0;
#X connect 33 0 32 0;
#X connect 34 0 33 0;
#X connect 35 0 33 0;
#X connect 38 0 24 0;
#X connect 38 1 2 0;
#X connect 38 2 5 0;
#X connect 40 0 25 0;
#X connect 41 0 25 0;
#X connect 47 0 38 0;
#X connect 54 0 38 0;
#X connect 55 0 38 0;
