[PD] Re: pyext problem?

Frank Barknecht fbar at footils.org
Wed May 31 13:55:14 CEST 2006


Hallo,
Frank Barknecht hat gesagt: // Frank Barknecht wrote:

> I think, for Michael's code it would be better to make "orchestra" a
> real list of "Instrument"s like: 
> 
> orchestra1 = [ ['x1','a',1], ['x2','c',11] ] # changed!
> orchestra = []
> 
> for i in orchestra1:
>     tmp = Instrument(i[0], i[1], i[2])
>     orchestra.append(tmp)
> 
> 
> Then in the pyext class use in float_1 something like:
> 
>     orchestra[index].setVal(f)

I forgot to say: In this case, orchestra should be a class member
like:

class whatever(pyext._class):
    
    def __init__(self, archestra):
        self.orchestra = []
        for i in archestra:
            tmp = Instrument(i[0], i[1], i[2])
            self.orchestra.append(tmp)

    def float_1(self,f):
        if f > 10:
            self.orchestra[0].setVal = f
        else:
            self.orchestra[1].setVal = f


Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__




More information about the Pd-list mailing list