How to disable DSP in a subpatch?

Sep 20, 2007 at 3:17pm

How to disable DSP in a subpatch?

Hi all,

I’m writing the help file for an external I created, and I made several sub-patches in the main help patch to demonstrate different possible situations of using the object. Now, if I send the “startwindow” message to the dac~ of the main patch, it starts sound processing for the subpatches as well. The problem is that every subpatch has an instance of my object, and if every instance would being used, the entire help would use more than 100% of my CPU. Is there a way to start the DSP only in the current patch window, without starting it inside the subpatches?

Thank you,
Adam

#33752
Sep 20, 2007 at 3:47pm

Hi,

using poly~ perhaps ?

All the best


Alessandro Fogar

http://www.fogar.it

2007/9/20, sadam :
>
> Hi all,
>
>
> I’m writing the help file for an external I created, and I made several sub-patches in the main help patch to demonstrate different possible situations of using the object. Now, if I send the “startwindow” message to the dac~ of the main patch, it starts sound processing for the subpatches as well. The problem is that every subpatch has an instance of my object, and if every instance would being used, the entire help would use more than 100% of my CPU. Is there a way to start the DSP only in the current patch window, without starting it inside the subpatches?
>
> Thank you,
> Adam
>

#112873
Sep 20, 2007 at 4:09pm

Check the mute~ help file.

The help file of pcontrol doesn’t mention dsp (which is pretty strange actually.. cycling?), but it does disable audio.

Mattijs

#112874
Sep 20, 2007 at 9:15pm

Thank you!

First I tried it but it didn’t turn off the DSP, it only muted the sound (my problem was the CPU utilization), so I got very sad. Then I realized that the t_pxobject has a z_enabled bit that changes by enabling/disabling the subpatcher, so I used this to turn off DPS directly in my perform routine. Now it works!!! :-)

Bye,

#112875
Sep 21, 2007 at 9:52am

#112876
Sep 25, 2007 at 7:59am

sadam schrieb:
> First I tried it but it didn’t turn off the DSP, it only muted the
> sound (my problem was the CPU utilization), so I got very sad. Then I
> realized that the t_pxobject has a z_enabled bit that changes by
> enabling/disabling the subpatcher, so I used this to turn off DPS
> directly in my perform routine. Now it works!!! :-)

Maybe that is the reason why mute~ in general seems unreliable for CPU
optimisation. If every external has to switch itself off, there might be
a lot of the externals, probably even the most expensive, which just
don’t do it.
Could cycling’s knowledge base (Emmanuel/Joshua/Jeremy…) shed some
light on this? Just for explanation…
I do use normally poly~ to control CPU, but only for the reason that
mute~ often doesn’t cut it…
I never heard an explanation for possible problems with mute~.

Just to test it, I made a modified version of the mute~ help file, which
has the reverb from the examples folder incorporated to create some
heavy CPU load. The help file works as advertised and cuts the CPU, but
I know of much more complex patches where it seemed not working, but
maybe due to bugs in the patch, who knows…

Maybe the mute~.help below could be incorporated into the official
distribution? It explains much more than the original one…

Stefan

#P user meter~ 180 232 193 290 50 0 168 0 103 103 103 255 153 0 255 0 0
217 217 0 153 186 0 12 3 3 3 3;
#P user meter~ 165 232 178 290 50 0 168 0 103 103 103 255 153 0 255 0 0
217 217 0 153 186 0 12 3 3 3 3;
#P user gain~ 195 232 16 35 158 0 1.071519 7.94321 10.;
#P user gain~ 147 232 16 35 158 0 1.071519 7.94321 10.;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#N vpatcher 10 59 610 459;
#P inlet 67 31 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P newex 67 50 61 196617 loadmess 1;
#P window linecount 1;
#P newex 67 70 50 196617 metro 50;
#P newex 67 91 65 196617 adstatus cpu;
#P outlet 67 113 15 0;
#P connect 4 0 3 0;
#P connect 3 0 2 0;
#P connect 2 0 1 0;
#P connect 1 0 0 0;
#P pop;
#P hidden newobj 100 298 30 196617 p cpu;
#P flonum 64 299 31 9 0 0 160 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 20 300 41 196617 % CPU;
#P comment 270 308 102 196617 see also: Tutorial 5;
#P message 414 307 39 196617 pass~;
#P message 370 307 42 196617 begin~;
#P hidden newex 370 330 64 196617 prepend help;
#P hidden newex 370 350 45 196617 pcontrol;
#P message 418 261 30 196617 $1 1;
#P toggle 418 241 15 0;
#P newex 418 280 35 196617 mute~;
#B color 5;
#P window setfont “Sans Serif” 18.;
#P comment 15 9 106 196626 mute~;
#B frgb 26 8 57;
#P window setfont “Sans Serif” 9.;
#P comment 15 35 292 196617 Disable signal objects in a patcher;
#P user panel 10 5 400 50;
#X brgb 226 250 200;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P newex 267 182 45 196617 pcontrol;
#P toggle 267 116 15 0;
#P newex 267 137 29 196617 == 0;
#P message 267 162 51 196617 enable $1;
#P toggle 44 117 15 0;
#P message 97 263 27 196617 stop;
#P message 26 263 65 196617 startwindow;
#P newex 147 298 58 196617 dac~;
#P newex 147 162 58 196617 adc~;
#N vpatcher 257 227 570 568;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 50 139 66 196617 yafr2;
#B color 14;
#P newex 50 115 66 196617 yafr2;
#B color 14;
#P window linecount 0;
#P newex 50 231 35 196617 pass~;
#P newex 50 87 66 196617 tapout~ 500;
#P newex 50 65 60 196617 tapin~ 500;
#N comlet Delay Output;
#P outlet 50 279 15 0;
#N comlet Delay input;
#P inlet 50 36 15 0;
#P comment 88 221 164 196617 put pass~ in your subpatch to guarantee a
zeroed output signal when it is switched off with mute~;
#P user panel 39 214 219 50;
#X brgb 255 255 255;
#X frgb 255 232 43;
#X border 2;
#X rounded 0;
#X shadow 0;
#X done;
#P comment 123 122 102 196617 some expensive DSP in subpatchers…;
#P connect 3 0 5 0;
#P connect 5 0 6 0;
#P connect 6 0 8 0;
#P connect 8 0 9 0;
#P connect 9 0 7 0;
#P fasten 6 0 7 0 55 111 44 111 44 206 55 206;
#P connect 7 0 4 0;
#P pop;
#P newobj 147 209 51 196617 p muteme;
#P newex 44 151 35 196617 mute~;
#B color 5;
#P window linecount 2;
#P comment 63 112 182 196617 turn off delayed input (toggle on means
muted , toggle off means unmuted);
#P window linecount 3;
#P comment 28 62 371 196617 mute~ provides an easy way to disable only
the signal objects in a subpatcher. An alternative is to use pcontrol as
shown below , but this disables all objects (i.e. MIDI) and is slightly
slower.;
#P comment 220 251 187 196617 If you send the list 1 1 or 0 1 to mute~
, any subpatchers of the connected patcher will also be muted or unmuted;
#P window linecount 2;
#P comment 25 199 114 196617 connect mute~ outlet to any inlet of a patcher;
#P window linecount 3;
#P comment 300 114 164 196617 approximately the same thing as mute~
using pcontrol – disables MIDI in addition to audio;
#P window linecount 1;
#P comment 27 247 76 196617 . start audio;
#P user panel 14 243 123 43;
#X brgb 255 255 255;
#X frgb 100 202 30;
#X border 2;
#X rounded 0;
#X shadow 0;
#X done;
#P comment 202 213 274 196617 < -- look inside the subpatcher for
additional info;
#P connect 24 0 22 0;
#P connect 23 0 24 0;
#P hidden connect 26 0 25 0;
#P hidden connect 28 0 26 0;
#P hidden connect 27 0 26 0;
#P connect 15 0 18 0;
#P connect 16 0 15 0;
#P connect 17 0 16 0;
#P connect 34 0 11 1;
#P fasten 10 1 36 0 200 228 185 228;
#P connect 10 1 34 0;
#P hidden connect 33 1 34 0;
#P connect 9 0 33 0;
#P fasten 9 0 35 0 152 228 170 228;
#P connect 33 0 11 0;
#P fasten 12 0 11 0 31 293 152 293;
#P fasten 13 0 11 0 102 293 152 293;
#P hidden fasten 22 0 9 0 423 300 462 300 462 204 152 204;
#P connect 10 0 9 0;
#P fasten 18 0 9 0 272 204 152 204;
#P fasten 8 0 9 0 49 193 152 193;
#P hidden connect 32 0 31 0;
#P connect 14 0 8 0;
#P window clipboard copycount 37;


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#112877
Sep 25, 2007 at 12:31pm

#112878
Sep 30, 2007 at 4:56pm

#112879
Sep 30, 2007 at 9:19pm

#112880
Oct 1, 2007 at 6:30am

#112881

You must be logged in to reply to this topic.