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