[chuck-users] Fixed so quickly.

Andrew C. Smith acsmith at willamette.edu
Mon Apr 20 01:00:18 EDT 2009


I didn't expect it to fix it that quickly, so sorry for the
double-post.  Here's what I did.  This is my new eternal loop:

while( true )
{
    // wait on midi event
    min => now;

    // get the midimsg
    while( min.recv( msg ) )
    {
        // catch only noteon
        //if( msg.data1 != 144 )
        //    continue;

        // check velocity
        if( msg.data1 == 144 ) // THIS IS WHAT I CHANGED, from
msg.data3 > 0 to data1 == 144.
        {
            // store midi note number
            msg.data2 => on.note;
            // store velocity
            msg.data3 => on.velocity;
            // signal the event
            on.signal();
            // yield without advancing time to allow shred to run
            me.yield();
        }
        else if( msg.data1 == 128 ) // ALSO THIS, from else to what it
is now.  This is to handle noteoffs which are all coming as [128 key
64] messages.  I think I understand events now.
        {
            if( us[msg.data2] != null ) us[msg.data2].signal();
        }
    }
}

Curious to know, has anyone else had problems with the polyphony
examples?  Although my keyboard seems to act in the expected way with
Max/MSP (using midinote and poly~) ChucK will not see that.  What's
the deal exactly?

-Andrew


More information about the chuck-users mailing list