We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › setVlaue() @ rangeController
Page Index Toggle Pages: 1
setVlaue() @ rangeController (Read 1452 times)
setVlaue() @ rangeController
Sep 30th, 2009, 1:46am
 
Hi there,

I'm just using the rangeController from the controlP5 library. I'm trying it this way ight now:
controlP5.controller("rangeController").arrayValue()[1].setValue(.2);

and getting this error:
Cannot invoke setValue(float) on the primitive type float

Doesn't that work at all? Or can I simply use an int instead of an float for an rangeController? It would work with a normal slider, but however doesnt with the rangeController.

cheers
Re: setVlaue() @ rangeController
Reply #1 - Sep 30th, 2009, 4:13am
 
arrayValue() returns an array of floats. float is a primitive type, you cannot invoke methods on them.
It seems that Range has setLowValue(), setHighValue() and setValue() methods. You can invoke them directly on the controller() call result.
Re: setVlaue() @ rangeController
Reply #2 - Oct 1st, 2009, 5:17am
 
ah cool, thx! somehow i didnt find these methods before...
Re: setVlaue() @ rangeController
Reply #3 - Jan 13th, 2010, 11:11am
 
PhiLho  wrote on Sep 30th, 2009, 4:13am:
You can invoke them directly on the controller() call result.


i'm sorry, but i don't really get what you mean by this.
i'm getting the same error when trying to change sample rate for an minim audio player object.

Code:
    if (player.isPlaying()) {
if (player.hasControl(Controller.SAMPLE_RATE)) {
float val = map(mouseX, 0, width, 0.0, 44100.0);
println(player.sampleRate().setValue(val));
}
}


thanks for any help!
Re: setVlaue() @ rangeController
Reply #4 - Jan 17th, 2010, 4:21am
 
I don't know Minim player, but I doubt your question is related to controlP5, is it?
I don't think you quote a relevant part of my message.
sampleRate() probably returns an int or float value. Look at Minim library API to see how to change this sample rate. Might be player.setSampleRate(val) or similar (haven't time to check right now).
Page Index Toggle Pages: 1