triggers - Max/Msp Past object in C++ (increment a value when a threshold is passed) -



triggers - Max/Msp Past object in C++ (increment a value when a threshold is passed) -

i come max/msp got object called "past", increment variable when threshold exceeded. (like trigger)

i'd same in c++, don't know how to...

for exemple, i'd create x variable , y counter : when x>100, y=y+1;

i've tried this, doesn't work :

x++; cout << "x = " << x << endl; if (x>100){bang=1;} cout << "bang = " << bang << endl; if(bang == !bang){y++;} cout << "y = " << y << endl; if (y > 0){cout << "done" << endl; }

well, first of bang == !bang false (considering cast boolean, when bang 1 considered true, !bang false won't equal).

if want utilize inverse bitwise of number, have tilda operator "~"

there many ways create triggers, simplest way fits need should next :

static bool triggerfired=false; void runloop(int curx, int &yref) { curx++; if (curx > 100 && !triggerfired) { triggerfired = true; yref++; } }

the static boolean value has purpose create trigger fire once, , not each time after x > 100 .

c++ triggers max counter increment

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -