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

Re: [sc-users] SCTabletView Action speed limit?



Part of the issue is approaching the problem as if you were still using Max :-)

What I mean is, the Max model depends on firing signals out of the tablet view, which you then filter using speedlim. Doesn't work that way in supercollider. There isn't a way to slow down the callback from a GUI object (or an OSC responder, or MIDI action etc.). It's just a callback, and it's going to fire whenever there is something to do.

Right now you are imagining two objects: the GUI, and the synth player. I would suggest refiguring this as three objects: GUI, an object (or even just a set of variables) holding parameters from the GUI in memory, and the synth player. Then the connections are:

GUI --> variables (the GUI callback just writes values into the variables)
synth player <-- variables (the synth player runs at its own speed, and polls the variables only when needed)

I'll use an Event for storage because I prefer keeping related things together (instead of just having them all floating in a disorganized soup). Events are great for adhoc data structures.

~tabletValues = (x: 0, y: 0, pressure: 0);

// the action here ONLY changes the state of the system
// it does not do anything expensive
t.action = { |view, x, y, pressure|
~tabletValues.x_(x).y_(y).pressure_(pressure)
};

// this guy controls the pace, using the tablet values on demand
synthPlayer = Routine({
loop {
Synth(...) // calc controls based on ~tabletValues.x etc.
someAmountOfTime.wait;
}
});

hjh


On Dec 3, 2008, at 8:38 PM, Level26 wrote:


Hi all,
I have recently jumped back in to learning supercollider after some years of
Max/MSP, as well as studying OOP in general. I have been trying to figure
out how to implement something like the max object speedlim...more
specifically, I am triggering playback of a buffer selection using
SCTabletView's action_(). I would like the action to create a new synth with
the arguments passed by t.action.
I have not been able to control the rate at which the action_() callback
evaluates its function. 
This is what I have as the action function:
t.action = "" view, x,y,pressure;
p = Synth(\jahBufPlay,[\bufnum, b.bufnum,\pan,-1.0+(x.value/150),\vol,
pressure.value,\pos, v.selectionStart(0),\length,
v.selectionSize(0)/44100,\rateScale,2.0-(y.value/75)]);
n.value = (2.0-(y.value/75.0));
[x,y,pressure].postln;
};
(I think there are better ways to scale the values, but that is not my main
concern at the moment.)


What is a good technique to make t.action evaluate its function at specified
time intervals? 
I have tried various versions of Routines and SystemClock.schedAbs. I
basically want to know: is the tablet moving? if yes where is it every x
seconds? 
Thanks,

Jeff
I am excited by the possibilities of SC!
-- 
Sent from the Supercollider - User mailing list archive at Nabble.com.


_______________________________________________
sc-users mailing list



: H. James Harkins
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman