Open boonier opened 6 months ago
So as to make this easy to test, the following will crash ChucK (for me).
Seems like a seg fault
class EnvelopeFollower extends Chugraph
{
20::ms => dur _rate;
Gain _gain;
OnePole _pole;
Step _step;
inlet => _gain;
inlet => _gain;
_gain => _pole => blackhole;
_step => outlet;
{
3 => _gain.op;
0.99 => _pole.pole;
spork ~ _updateAtRate();
}
fun float last()
{
return _step.last();
}
fun dur rate()
{
return _rate;
}
fun dur rate(dur d)
{
d => _rate;
return d;
}
fun void _updateAtRate()
{
while (true)
{
_pole.last() => _step.next;
_rate => now;
}
}
}
adc => EnvelopeFollower env => blackhole;
SinOsc s => dac;
while (true)
{
100::ms => now;
env.last() * 200 => s.freq;
<<<env.last()>>>;
}
Thank you for the follow up, @boonier! I can reproduce on my end
$ chuck crash.ck
Assertion failed: (func->native_func_kind == ae_fp_mfun), function execute,
file chuck_instr.cpp, line 5299.
Abort trap: 6
Since _step => outlet
in your example I suppose there is no need to override last()
? If I comment out the method declaration it runs fine
$ chuck fixed.ck
0.004344 :(float)
0.022559 :(float)
0.000005 :(float)
0.000015 :(float)
0.000000 :(float)
...
Odd the EnvelopeFollower
example in LiCK does not crash for me
$ chuck --loop
...
[chuck]: (VM) sporking incoming shred: 1 (envFollowerExample.ck)...
0.000001 :(float)
0.000000 :(float)
0.000000 :(float)
0.000002 :(float)
0.000000 :(float)
...
$ chuck + import.ck
$ chuck + examples/envFollowerExample.ck
hmm I have no idea...
I have a question, what does the Step do in this class - is it like a sample and hold?
Yep, exactly like a sample and hold.
There seems to be some problem with naming the method:
fun float last()
(line 48)When I try to plug the value from that method into a ugen, I get an instance VM crash.
When renaming to
lastT()
for example, the EnvelopeFollower class functions as normal. Perhaps there is a conflict with the inherited Chugraph class'last()
method?