[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-users] Working with playbuf/trigger



Thanks to everyone in advance -

MyApp.applicationData.at("KeyboardOperator").at("CurrentNodeProxy").source = { 
arg rate = 1, trigger = 0, startPos = 0, loop = 1;
//enable trigger
trigger = if(BinaryOpUGen('==', trigger, 1), Impulse.kr(MouseX.kr(0.5,100,0.5)), 0);
PlayBuf.ar(1,b,rate,trigger,startPos, loop).dup;
};

With the above code, when i set trigger to 1 i can then take control via impulse/MouseX to execute trigger. My question is, how can I just execute trigger just once? for instance doing something like this:

MyApp.applicationData.at("KeyboardOperator").at("CurrentNodeProxy").source = { 
arg rate = 1, trigger = 0, startPos = 0, loop = 1;
PlayBuf.ar(1,b,rate,trigger,startPos, loop).dup;
};

MyApp.applicationData.at("KeyboardOperator").at("CurrentNodeProxy").set(\trigger, 1);

MyApp.applicationData.at("KeyboardOperator").at("CurrentNodeProxy").set(\trigger, 0);

I would think that this would jump to the startPos and then continue playing, which is the behavior that I am trying to achieve. This leads me to believe that impulse is executing at a different time/context (which i do not fully understand yet) and modulating with the value from MouseX. How can I trigger a jump back just using NodeProxy.Set()?


Thanks again,

Sam