grame-cncm / faustlibraries

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

add ba.selectbus #189

Closed DBraun closed 4 weeks ago

DBraun commented 4 weeks ago

Select a bus among NUM_BUSES buses, where each bus has BUS_SIZE outputs. The order of the signal inputs should be the signals of the first bus, the signals of the second bus, and so on.

I thought that there was a need for a variation of ba.selectmulti where the crossfade is zero and the "circuits" are many signals from many buses.

Example program:

import("stdfaust.lib");
selectbus(BUS_SIZE, NUM_BUSES, i) = ro.interleave(BUS_SIZE, NUM_BUSES) : par(j, BUS_SIZE, ba.selectn(NUM_BUSES, i));

BUS_SIZE = 3;
NUM_BUSES = 4;

i = nentry("i", 0, 0, NUM_BUSES-1, 1);
process = si.bus(BUS_SIZE*NUM_BUSES) : selectbus(BUS_SIZE, NUM_BUSES, i);