GameOfLife / Unit-Lib

The Unit Library is a system that provides high level abstractions on top of the SuperCollider language.
25 stars 6 forks source link

UEnvGenRel sometimes not getting the correct u_dur #13

Closed miguel-negrao closed 11 years ago

miguel-negrao commented 11 years ago

Example:

(
UScore(
    UChain(0, 0.0, 30, false, [ 'sine', [ 'freq', UMap('envelope_rel', [ 'env', EnvM([ 100.0, 20000.0, 20000.0 ], [ 0.5, 0.5 ]) ]) ] ], [ 'stereoOutput', [ 'point', Point() ] ])).name_("test envgen").prepareAndStart
)

it get's u_dur 1 second always... It also happens without UMaps. We've had this problem before, I thought it was fixed at some point...

Ok, got it, it happens only with releaseSelf = false, in that case the u_dur is not passed to the unit containing the UEnvGenRel

woutersnoei commented 11 years ago

Ah, that is because when releaseSelf == false the Units actually get inf as u_dur. Or, in fact, they don't get their u_dur set at all if it is done at init, which means they use their default value, which in the case of the UMaps is 1 instead of inf. I'm not sure how to tackle this. One idea could be to set the u_dur on all UMaps regardless of the releaseSelf setting, and make the split for releaseSelf only on normal units. But that would still cause normal units not to know their duration if releaseSelf == false, so we couldn't use UEnvGenRel (or any duration-relative thing) in their Udefs.. Otherwise we could need an extra u_something arg specifying the actual duration. Or maybe a releaseSelf flag for the units that actually use the duration to end the synth and chain, so that they get the dur but don't use it..

woutersnoei commented 11 years ago

actually, I found a simple solution. Please check again with latest commit.

miguel-negrao commented 11 years ago

Yup, seems to be fixed