

// function to partially match filename for buffers
~getSmp = { |regexp|
    ~bfrList.detect { |buf|
        regexp.matchRegexp(buf.path)
    }
};


// function to (re)launch effect busses
~launchBusses = {

    // feedback delay bus // -----------------------------------------------------------
    ~localfdlyBus.free; ~localfdlyBus = Bus.audio(s, 2);

    ~localFeedFX.free; ~localFeedFX = Synth(\localFeedbackDelay1, [\inBus, ~localfdlyBus, \outBus, 0, \amount, 0.9], addAction:\addToTail);

    // control
    //~localFeedFX.set(\amount, 0.9)



    // low pass filter // ----------------------------------------------------------------
    ~lpfFXBus1.free; ~lpfFXBus1 = Bus.audio(s, 2);

    ~lpfFX1.free; ~lpfFX1 = Synth(\lpfFX, [\inBus, ~lpfFXBus1, \outBus, ~localfdlyBus, \cutoff, 20000], target: ~localFeedFX, addAction:\addBefore);

    // control
    //~lpfFX1.set(\cutoffLag, 2, \cutoff, 50)
    //~lpfFX1.set(\cutoffLag, 3, \cutoff, 20000)


    // reverb fx  ----------------------------------------------------------------------------
    ~revFXbus1.free; ~revFXbus1 = Bus.audio(s, 2);
    ~reverb1.free;
    ~reverb1 = Synth(\revfx, [\inBus, ~revFXbus1, \wet, 1], addAction:\addToTail);


    // saturation fx -------------------------------------------------------------------------
    ~satBus1.free; ~satBus1 = Bus.audio(s, 2);
    ~saturator1.free; ~saturator1 = Synth(\saturator, [\inBus, ~satBus1, \amp, 1], addAction:\addToTail);

    //~saturator1.set(\amp, 1)
    //~saturator1.set(\amp, 0)
};
