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

Re: [sc-dev] MultiSlider issues




On Dec 17, 2003, at 6:15 PM, James Harkins wrote:

1.

f = FlowView.new;
	// random 1 or 0 (integers) - multislider display is empty
x = SCMultiSliderView(f, Rect(0, 0, 300, 100)).value_(Array.fill(10, { 2.rand }));
	// random 1.0 or 0.0 (floats) - multislider display is correct
y = SCMultiSliderView(f, Rect(0, 0, 300, 100)).value_(Array.fill(10, { 1.0.rand.round }));

Sometimes I'm using an array that might have 1 or 0 as integers, and it's a bummer to have to convert them to floats manually. Should this be handled in the primitive, or should .asFloat be added to the value_ method?

The efficient thing would be for the primitive to handle it.


2. Speaking of value_, you'd think x and y above would be SCMultiSliderViews. They're actually the value arrays, because value_ returns the result of this.setProperty, rather than itself. I'm sure this should be changed -- I'll do it, but I want to make sure it won't break anyone's code.

Yes, it is wrong. setter methods should always return the receiver.

There are some other bugs with SCMultiSliderView.
initializing to a value of zero draws no thumb:

(
w = SCWindow("test", Rect(200 , 450, 200, 200));
v = SCMultiSliderView(w, Rect(0, 0, 180, 180));
v.value = [0, 0.1, 0, 0.1, 0.1, 0, 0, 0.1];
w.front;
)

I don't like how you have to bother with fiddling with the pixel counts so closely instead of having it just dynamically size the thumbs based on the number of values. Changing this would break code. I may implement an alternative multislider..


--
--- james mccartney   james@xxxxxxxxxxxxxx   <http://www.audiosynth.com>
SuperCollider - a real time audio synthesis programming language