grame-cncm / faustlibraries

The Faust libraries
https://faustlibraries.grame.fr
183 stars 59 forks source link

add selectxbus (selectbus with crossfade) #191

Closed marclava closed 2 weeks ago

marclava commented 2 weeks ago

I was looking for an alternative to the ABComparaison plugin (by Daniel Rudrich) and found the new selectbus function then made a version with crossfade using code from selectmulti. The name of this augmented version could be different, or it could even replace selectbus (if the overhead of computing the crossfade is not too high). This is a draft pull request, so please let me know!

Here's some demo code:

import("stdfaust.lib");

bus_size = 2;
num_buses = 3;
xfade = hslider("Xfade (sec)", 0.1, 0, 1, 0.1) * ma.SR;
choice = hslider(
    "Bus[style:radio{'A':1;'B':2;'C':3}]",
    1, 1, num_buses, 1) -1;
process = ba.selectxbus(bus_size, num_buses, xfade, choice);