Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smoothing should be every frame #43

Open
ofZach opened this issue Dec 19, 2015 · 1 comment
Open

smoothing should be every frame #43

ofZach opened this issue Dec 19, 2015 · 1 comment

Comments

@ofZach
Copy link
Owner

ofZach commented Dec 19, 2015

smoothing should happen every every frame not on midi event -- (afaik I can see, smoothing is happening here....

https://github.com/ofZach/dayForNightSFPC/blob/master/addons/ofxParameterMidiSync/src/ofxParameterMidiInfo.cpp#L100-L107

I can't find an easy way to duplicate a parameterGroup (having a kind of shadow param group might be one way to do this, one gets update from midi, the other catches up to the unsmooth value)....

one simple solution (but requires editing projects) is to add variables that track, and add a function called smooth to baseScene, ie for yosukeJhonWhitneyMtrix:

// ofParameter param;
ofParameter numOfGroup;
ofParameter numOfBall;
ofParameter radius;
ofParameter speed;
ofParameter ballRadius;

//----------------------------------------- if it can be smoothed, smooth it
ofParameter<float> radiusSmooth;
ofParameter<float> speedSmooth;
ofParameter<float> ballRadiusSmooth;

void smooth(){
    radiusSmooth = SMOOTH_AMOUNT * radiusSmooth + (1-SMOOTH_AMOUNT) * radius;
    speedSmooth = SMOOTH_AMOUNT * speedSmooth + (1-SMOOTH_AMOUNT) * radius;
    ballRadiusSmooth = SMOOTH_AMOUNT * ballRadiusSmooth + (1-SMOOTH_AMOUNT) * radius;
}
//-----------------------------------------

SMOOTH_AMOUNT can be defined in baseScene or appConstants (like 0.95, etc).

you will need to call smooth in scene manager before update....

can't seem to find a way to do this more automatically.... at least the params are pretty clear per project and it's just the floats to smooth.
I hope this helps!
zach

@ofZach
Copy link
Owner Author

ofZach commented Dec 19, 2015

not clear that radiusSmooth, etc need to be ofParameter they could even just be floats....

then, you need to use them in the code instead of the unsmoothed params like radius...

(so the smoothing happens in the visuals but not on the parameters / code side of the screens...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant