Forums > MaxMSP

report the state of toggle?

April 9, 2006 | 4:12 pm

hi

i am trying to find a way to report, at any time, the state of a
Toggle without changing its value…..

of course Bang’ing a toggle changes its state – placing an [i] after
the toggle might work (banging the left input of the [i]) but only if
the said toggle was used in the patch so far (the default state of a
toggle being 0, if it was not used i’d like to have it reported as
well)

there certainly must be a way, i just don’t seem to be able to find
it (of course I could loadbang 0 at init or something…. but maybe
someone has a nicer idea)

thanks

kasper

Kasper T. Toeplitz
noise, composition, bass, computer

http://www.sleazeArt.com


April 9, 2006 | 4:34 pm

If you put a fake value in the int box, you can isolate this value
after easily.

Best,
ej

#P window setfont "Sans Serif" 9.;
#P number 103 217 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user umenu 150 222 100 196647 1 64 238 1;
#X add not initialised;
#X add zero;
#X add one;
#P window linecount 1;
#P newex 150 156 30 196617 grab;
#P button 150 134 15 0;
#P toggle 278 157 15 0;
#P newex 150 189 27 196617 + 1;
#P comment 34 134 115 196617 ask for the toggle state;
#P newex 278 204 36 196617 int -1;
#P connect 5 0 7 0;
#P connect 5 0 2 0;
#P connect 5 1 0 0;
#P connect 3 0 0 0;
#P connect 2 0 6 0;
#P connect 4 0 5 0;
#P window clipboard copycount 8;


April 9, 2006 | 4:37 pm

you could use the pattr system. Give the toggle a name (ie mytoggle), and
use a "getmytoggle"->[pattrstorage].

T_


April 9, 2006 | 4:39 pm

On 4/9/06, Thijs Koerselman

wrote:
>
> you could use the pattr system. Give the toggle a name (ie mytoggle), and
> use a "getmytoggle"->[pattrstorage].
>
> T_
>

PS: grab might be useful in this case.


April 9, 2006 | 4:50 pm

>
>PS: grab might be useful in this case.
>
>

thank Thijs and emmanuel

_i did not knew the grab object, it works!!!

but then of course once you give an default value to [i] – zero in
this case since the load state of toggle is 0 – it’s even simpler !!!

max v2;
#N vpatcher 10 59 610 459;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 212 260 32 196617 print;
#P button 264 179 15 0;
#P toggle 163 169 15 0;
#P newex 212 234 27 196617 i 0;
#P comment 291 178 100 196617 report;
#P connect 3 0 1 0;
#P connect 2 0 1 0;
#P connect 1 0 4 0;
#P pop;

many thanks

kasper

Kasper T. Toeplitz
noise, composition, bass, computer

http://www.sleazeArt.com


April 12, 2006 | 9:39 am

Kasper T Toeplitz wrote:
> (the default state of a toggle being 0, if it was not used i’d like
> to have it reported as well)
>
> there certainly must be a way, i just don’t seem to be able to find
> it (of course I could loadbang 0 at init or something…. but maybe
> someone has a nicer idea)

But toggle and int do have the same default (0). Beside the grab your
suggested solution is all you need…

Stefan

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 125 177 29 196617 print;
#P toggle 107 178 15 0;
#P button 107 121 15 0;
#P newex 107 150 47 196617 int;
#P toggle 144 121 15 0;
#P connect 1 0 3 0;
#P connect 1 0 4 0;
#P connect 0 0 1 1;
#P connect 2 0 1 0;
#P window clipboard copycount 5;

[][] [][][] [][] [][][]
[][][][][][][][][][][][][][][]

Stefan Tiedje
Klanggestalter
Electronic Composition
&
Improvisation

/~~~~~
\ /|() ()|
))))) )| | |( \
/// _/)/ )))))
___/ ///

————————-x—-
–_____———–|———–
–(_|_ —-|—–|—–()—-
– _|_)—-|—–()———–
———-()————x—–

14, Av. Pr. Franklin Roosevelt,
94320 Thiais, France
Phone at CCMIX +33-1-57 42 91 09


Viewing 6 posts - 1 through 6 (of 6 total)