TrigFunc

TrigFunc(input, function)

Python function callback.

TrigFunc calls the function given at parameter `function` each time it receives a trigger in its `input` parameter.

Parent class : PyoObject

Parameters:

    input : PyoObject
        Audio signal sending triggers.
    function : Python function
        Function to be called.

Methods:

    setInput(x, fadetime) : Replace the `input` attribute.
    setFunction(x) : Replace the `function` attribute.

Attributes:

    input : PyoObject. Audio trigger signal.
    function : Python function. Function to be called.

Notes:

    The out() method is bypassed. TrigFunc's signal can not be sent 
    to audio outs.
    
    TrigFunc has no `mul` and `add` attributes.

Examples:

    >>> s = Server().boot()
    >>> s.start()
    >>> c = 0
    >>> def count():
    ...     global c
    ...     c += 1
    ...     print c
    >>> m = Metro(.125).play()
    >>> tr = TrigRand(m, 400, 600)
    >>> tf = TrigFunc(m, count)
    >>> a = Sine(tr, mul=.5).out()

Methods details:

    TrigFunc.setInput(x, fadetime=0.05):

        Replace the `input` attribute.
        
        Parameters:

        x : PyoObject
            New signal to process.
        fadetime : float, optional
            Crossfade time between old and new input. Defaults to 0.05.

    TrigFunc.setFunction(x):

        Replace the `function` attribute.
        
        Parameters:

        x : Python function
            new `function` attribute.