[chuck-users] late binding

Beinan Li 2 beinan.li at ubisoft.com
Wed Feb 10 18:40:09 EST 2010


Hi Chuckists,

I'd like to dynamically switch instrument as in my small code (chuck instr.ck my_chuck.ck)

// instr.ck
Class MyInstrument
{
                StkInstrument@ m_whatever;

                Public void Play(dur duration)
{
                m_whatever.noteOn(1);
duration => now;
m_whatever.noteOff(1);
}
}

// my_chuck.ck
MyInstrument dummy;
Mandolin man => dummy.m_whatever;
Dummy.m_whatever  => dac;

1::second => dur d;
dummy.Play(d);

Then I got this error:
[chuck](VM): NullPointerException: (UGen link) in shred[id=5:my_chuck.ck], PC=[46]


Where am I wrong with this late binding?

Thanks,
Beinan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20100210/bbef646e/attachment.htm>


More information about the chuck-users mailing list