[chuck-users] extending buildin Ugen (eg SndBuf)

Atte atte at youmail.dk
Sat Mar 14 06:18:48 EDT 2015


Hi

Thought I could inherit from SndBuf and extend by overiding some funtions:

public class Beat extends SndBuf{
    int last_pos;

    fun void tempo_match(dur match_length){
        length()/match_length => rate;
    }

    fun void pos(int sample){
        if(sample < 0){
            last_pos => sample;
        }
        sample => s.pos => last_pos;
    }

    fun void random(int nb_slices){
        Math.random2(0,nb_slices-1) * samples()/nb_slices => pos =>
last_pos;;
    }

}

but chuck gives me:

[lib_beat2.ck]:line(13): function 'Beat.pos' matches 'SndBuf.pos' but
cannot override...

Any way to achieve what I'm trying to do?

Cheers
-- 
Atte

http://atte.dk   http://a773.dk


More information about the chuck-users mailing list