SMUX8AUTOplus

smux8AUTOplus

desc:v3smux8AUTOplus
//tags: utility processing encode and decode adat s/mux at 96kHz with auto channel detection
//author: QVmember 20220805 v3  https://qvmodular.com/

// 1-8(0-7) for ES-3
//Copyright 2021  Akira Katsurada
//Released under the MIT license
// See  https://opensource.org/licenses/mit-license.php
//tags: utility processing decode adat s/mux at 96khz
//author: QVmember 20220805  https://qvmodular.com/


// input1-8 for encode

in_pin:Input 1
in_pin:Input 2
in_pin:Input 3
in_pin:Input 4
in_pin:Input 5
in_pin:Input 6
in_pin:Input 7
in_pin:Input 8

in_pin:Input 9

out_pin:Output 1
out_pin:Output 2
out_pin:Output 3
out_pin:Output 4
out_pin:Output 5
out_pin:Output 6
out_pin:Output 7
out_pin:Output 8



slider1:0<0,1,1>ChFlip
slider2:1<0,1,1>Auto on off
slider3:1<0,1,1>Alternate Synchronous


@init
framebit = 0;
flip = 0;

@sample
frambit = flip;

slider2 == 0 ? (flip = slider1);


framebit >1  ?  framebit = 0;


framebit == flip  ? (
//ES3 encode input

data0  = spl0 ;
data1  = spl1 ;
data2  = spl2 ;
data3  = spl3 ;
data4  = spl4 ;
data5  = spl5 ;
data6  = spl6 ;
data7  = spl7 ;


 
 
 //ES3 encode output
spl0  = data0;
spl1  = 0;
spl2  = data2;
spl3  = 0;
spl4  = data4;
spl5  = 0;
spl6  = data6;
spl7  = 0;
 


);



framebit == abs(flip-1)  ? (




//autodetect
slider2 == 1 ? (

data_sync = spl8;

data_sync > 0.25 ? (flip = abs(flip -1));
);


slider3 == 0 ? (
data0  = spl0 ;
data1  = spl1 ;
data2  = spl2 ;
data3  = spl3 ;
data4  = spl4 ;
data5  = spl5 ;
data6  = spl6 ;
data7  = spl7 ;
);
//or ES-3 no input



//ES-3 encode output
spl0  = data1;
spl1  = 0;
spl2  = data3;
spl3  = 0;
spl4  = data5;
spl5  = 0;
spl6  = data7;
spl7  = 0;




);

framebit += 1;