[chuck-dev] bug? two files, public class, UGen outside class

Stephen Sinclair radarsat1 at gmail.com
Sun Sep 7 13:00:25 EDT 2008

Make two files:

---- test.ck ----

SinOsc s => dac;

public class NoiseMaker
    public void tick() {

    public void beep(float note)
        Math.mtof(note) => s.freq;
        1 => s.gain;
        20::ms => now;
        0 => s.gain;

while (1) { 1::second => now; }

---- test2.ck ----

NoiseMaker nm[];
new NoiseMaker[1] @=> nm;

while (1) {
    for (0=>int i; i<nm.size(); i++)
    0.5::second => now;


Now run "chuck test.ck test2.ck".

I get,

$ chuck test.ck test2.ck
chuck: chuck_instr.cpp:4475: virtual void
Chuck_Instr_Dot_Member_Func::execute(Chuck_VM*, Chuck_VM_Shred*):
Assertion `m_offset < obj->vtable->funcs.size()' failed.

If I remove the line, "Math.mtof(note) => s.freq;", then I get:

$ chuck test.ck test2.ck
[chuck](VM): NullPointerException: shred[id=2:test2.ck], PC=[32]

If the code from test2.ck is moved into test.ck, then everything works fine.
Also, if the declaration "SinOsc s => dac" is moved into the
NoiseMaker class, everything works fine.

Maybe it's because tick() is being called in the context of test2.ck,
whereas "s" belongs to test.ck's shred?  I dunno.


More information about the chuck-dev mailing list