allpass int 8 a

8 modulatable 32bit schroeder allpass filters with different types of interpolation (for reverbs and diffusers). These are connect in 1 serie of 8 allpasses.
Author: Jaffasplaffa (Original by Johannes Elliesen)
License: none yet
Github: jaffa/filt/allpass int 8 a.axo

Inlets

frac32buffer in

frac32.positive time

frac32.positive gain

frac32.positive time2

frac32.positive gain2

frac32.positive time3

frac32.positive gain3

frac32.positive time4

frac32.positive gain4

frac32.positive time5

frac32.positive gain5

frac32.positive time6

frac32.positive gain6

frac32.positive time7

frac32.positive gain7

frac32.positive time8

frac32.positive gain8

frac32.bipolar timemod

frac32.bipolar timemod2

frac32.bipolar timemod3

frac32.bipolar timemod4

frac32.bipolar timemod5

frac32.bipolar timemod6

frac32.bipolar timemod7

frac32.bipolar timemod8

Outlets

frac32buffer out

Attributes

combo buffsize

combo interpol

combo location

Declaration
// 1//
#if attr_location == 0
#define LOCATION
#else
#define LOCATION __attribute__((section(".sdram")))
#endif
static const uint32_t LENGTHPOW = (attr_buffsize);
static const uint32_t LENGTH = (1 << attr_buffsize);
static const uint32_t LENGTHMASK = ((1 << attr_buffsize) - 1);

int32_t *delayline;
int wptr;

// 2//
#if attr_location == 0
#define LOCATION2
#else
#define LOCATION2 __attribute__((section(".sdram")))
#endif
static const uint32_t LENGTHPOW2 = (attr_buffsize);
static const uint32_t LENGTH2 = (1 << attr_buffsize);
static const uint32_t LENGTHMASK2 = ((1 << attr_buffsize) - 1);

int32_t *delayline2;
int wptr2;

// 3//
#if attr_location == 0
#define LOCATION3
#else
#define LOCATION3 __attribute__((section(".sdram")))
#endif
static const uint32_t LENGTHPOW3 = (attr_buffsize);
static const uint32_t LENGTH3 = (1 << attr_buffsize);
static const uint32_t LENGTHMASK3 = ((1 << attr_buffsize) - 1);

int32_t *delayline3;
int wptr3;

// 4//
#if attr_location == 0
#define LOCATION4
#else
#define LOCATION4 __attribute__((section(".sdram")))
#endif
static const uint32_t LENGTHPOW4 = (attr_buffsize);
static const uint32_t LENGTH4 = (1 << attr_buffsize);
static const uint32_t LENGTHMASK4 = ((1 << attr_buffsize) - 1);

int32_t *delayline4;
int wptr4;

// 5//
#if attr_location == 0
#define LOCATION5
#else
#define LOCATION5 __attribute__((section(".sdram")))
#endif
static const uint32_t LENGTHPOW5 = (attr_buffsize);
static const uint32_t LENGTH5 = (1 << attr_buffsize);
static const uint32_t LENGTHMASK5 = ((1 << attr_buffsize) - 1);

int32_t *delayline5;
int wptr5;

// 6//
#if attr_location == 0
#define LOCATION6
#else
#define LOCATION6 __attribute__((section(".sdram")))
#endif
static const uint32_t LENGTHPOW6 = (attr_buffsize);
static const uint32_t LENGTH6 = (1 << attr_buffsize);
static const uint32_t LENGTHMASK6 = ((1 << attr_buffsize) - 1);

int32_t *delayline6;
int wptr6;

// 7//
#if attr_location == 0
#define LOCATION7
#else
#define LOCATION7 __attribute__((section(".sdram")))
#endif
static const uint32_t LENGTHPOW7 = (attr_buffsize);
static const uint32_t LENGTH7 = (1 << attr_buffsize);
static const uint32_t LENGTHMASK7 = ((1 << attr_buffsize) - 1);

int32_t *delayline7;
int wptr7;

// 8//
#if attr_location == 0
#define LOCATION8
#else
#define LOCATION8 __attribute__((section(".sdram")))
#endif
static const uint32_t LENGTHPOW8 = (attr_buffsize);
static const uint32_t LENGTH8 = (1 << attr_buffsize);
static const uint32_t LENGTHMASK8 = ((1 << attr_buffsize) - 1);

int32_t *delayline8;
int wptr8;
Init
// Hvad med de der parent og poly index??? //
// 1 //
static int32_t array_[attr_poly][LENGTH] LOCATION;
delayline = &array_[parent->polyIndex][0];

for (int i = 0; i < LENGTH; i++)
  delayline[i] = 0;
wptr = 0;

// 2 //
static int32_t array2_[attr_poly][LENGTH2] LOCATION2;
delayline2 = &array2_[parent->polyIndex][0];

for (int i2 = 0; i2 < LENGTH2; i2++)
  delayline2[i2] = 0;
wptr2 = 0;

// 3 //
static int32_t array3_[attr_poly][LENGTH3] LOCATION3;
delayline3 = &array3_[parent->polyIndex][0];

for (int i3 = 0; i3 < LENGTH3; i3++)
  delayline3[i3] = 0;
wptr3 = 0;

// 4 //
static int32_t array4_[attr_poly][LENGTH4] LOCATION4;
delayline4 = &array4_[parent->polyIndex][0];

for (int i4 = 0; i4 < LENGTH4; i4++)
  delayline4[i4] = 0;
wptr4 = 0;

// 5 //
static int32_t array5_[attr_poly][LENGTH5] LOCATION5;
delayline5 = &array5_[parent->polyIndex][0];

for (int i5 = 0; i5 < LENGTH5; i5++)
  delayline5[i5] = 0;
wptr5 = 0;

// 6 //
static int32_t array6_[attr_poly][LENGTH6] LOCATION6;
delayline6 = &array6_[parent->polyIndex][0];

for (int i6 = 0; i6 < LENGTH6; i6++)
  delayline6[i6] = 0;
wptr6 = 0;

// 7 //
static int32_t array7_[attr_poly][LENGTH6] LOCATION7;
delayline7 = &array7_[parent->polyIndex][0];

for (int i7 = 0; i7 < LENGTH7; i7++)
  delayline7[i7] = 0;
wptr7 = 0;

// 8 //
static int32_t array8_[attr_poly][LENGTH8] LOCATION8;
delayline8 = &array8_[parent->polyIndex][0];

for (int i8 = 0; i8 < LENGTH6; i8++)
  delayline8[i8] = 0;
wptr8 = 0;
Control Rate
// 1 //
int32_t g2 = inlet_gain << 3;

int32_t time = ___SMMUL(inlet_time, inlet_timemod) + inlet_time;
int32_t readOffset_ls8 = ___SMMUL(LENGTH << 10, time << 3);

if (readOffset_ls8 < (8 << 8))
  readOffset_ls8 = (8 << 8); // never less delay than 8 samples

#if attr_interpol > 0
int32_t rint = readOffset_ls8 >> 8; // integral part of delay time
int32_t rfrac =
    readOffset_ls8 & 0x000000FF; // fractional part of delay time in Q8 notation
#endif

// pre-calculate coefficients for 3pt interpolation
#if attr_interpol == 2

int32_t x2 = (rfrac * rfrac); // x^2 in Q16 notation
// in Q16 notation
int32_t c1 = (1 << 16) + (x2 >> 1) - (rfrac << 7) - (rfrac << 8);
int32_t c2 = -x2 + (rfrac << 9);
int32_t c3 = (x2 >> 1) - (rfrac << 7);
#endif

// 2 //
int32_t g22 = inlet_gain2 << 3;

int32_t time2 = ___SMMUL(inlet_time2, inlet_timemod2) + inlet_time2;
int32_t readOffset_ls82 = ___SMMUL(LENGTH2 << 10, time2 << 3);

if (readOffset_ls82 < (8 << 8))
  readOffset_ls82 = (8 << 8); // never less delay than 8 samples

#if attr_interpol > 0
int32_t rint2 = readOffset_ls82 >> 8; // integral part of delay time
int32_t rfrac2 = readOffset_ls82 &
                 0x000000FF; // fractional part of delay time in Q8 notation
#endif

// pre-calculate coefficients for 3pt interpolation
#if attr_interpol == 2

int32_t x22 = (rfrac2 * rfrac2); // x^2 in Q16 notation
// in Q16 notation
int32_t c12 = (1 << 16) + (x22 >> 1) - (rfrac2 << 7) - (rfrac2 << 8);
int32_t c22 = -x22 + (rfrac2 << 9);
int32_t c32 = (x22 >> 1) - (rfrac2 << 7);
#endif

// 3 //
int32_t g23 = inlet_gain3 << 3;

int32_t time3 = ___SMMUL(inlet_time3, inlet_timemod3) + inlet_time3;
int32_t readOffset_ls83 = ___SMMUL(LENGTH3 << 10, time3 << 3);

if (readOffset_ls83 < (8 << 8))
  readOffset_ls83 = (8 << 8); // never less delay than 8 samples

#if attr_interpol > 0
int32_t rint3 = readOffset_ls83 >> 8; // integral part of delay time
int32_t rfrac3 = readOffset_ls83 &
                 0x000000FF; // fractional part of delay time in Q8 notation
#endif

// pre-calculate coefficients for 3pt interpolation
#if attr_interpol == 2

int32_t x3 = (rfrac3 * rfrac3); // x^2 in Q16 notation
// in Q16 notation
int32_t c13 = (1 << 16) + (x3 >> 1) - (rfrac3 << 7) - (rfrac3 << 8);
int32_t c23 = -x3 + (rfrac3 << 9);
int32_t c33 = (x3 >> 1) - (rfrac3 << 7);
#endif

// 4 //
int32_t g24 = inlet_gain4 << 3;

int32_t time4 = ___SMMUL(inlet_time4, inlet_timemod4) + inlet_time4;
int32_t readOffset_ls84 = ___SMMUL(LENGTH4 << 10, time4 << 3);

if (readOffset_ls84 < (8 << 8))
  readOffset_ls84 = (8 << 8); // never less delay than 8 samples

#if attr_interpol > 0
int32_t rint4 = readOffset_ls84 >> 8; // integral part of delay time
int32_t rfrac4 = readOffset_ls84 &
                 0x000000FF; // fractional part of delay time in Q8 notation
#endif

// pre-calculate coefficients for 3pt interpolation
#if attr_interpol == 2

int32_t x4 = (rfrac4 * rfrac4); // x^2 in Q16 notation
// in Q16 notation
int32_t c14 = (1 << 16) + (x4 >> 1) - (rfrac4 << 7) - (rfrac4 << 8);
int32_t c24 = -x4 + (rfrac4 << 9);
int32_t c34 = (x4 >> 1) - (rfrac4 << 7);
#endif

// 5 //
int32_t g25 = inlet_gain5 << 3;

int32_t time5 = ___SMMUL(inlet_time5, inlet_timemod5) + inlet_time5;
int32_t readOffset_ls85 = ___SMMUL(LENGTH5 << 10, time5 << 3);

if (readOffset_ls85 < (8 << 8))
  readOffset_ls85 = (8 << 8); // never less delay than 8 samples

#if attr_interpol > 0
int32_t rint5 = readOffset_ls85 >> 8; // integral part of delay time
int32_t rfrac5 = readOffset_ls85 &
                 0x000000FF; // fractional part of delay time in Q8 notation
#endif

// pre-calculate coefficients for 3pt interpolation
#if attr_interpol == 2

int32_t x5 = (rfrac5 * rfrac5); // x^2 in Q16 notation
// in Q16 notation
int32_t c15 = (1 << 16) + (x5 >> 1) - (rfrac5 << 7) - (rfrac5 << 8);
int32_t c25 = -x5 + (rfrac5 << 9);
int32_t c35 = (x5 >> 1) - (rfrac5 << 7);
#endif

// 6 //
int32_t g26 = inlet_gain6 << 3;

int32_t time6 = ___SMMUL(inlet_time6, inlet_timemod6) + inlet_time6;
int32_t readOffset_ls86 = ___SMMUL(LENGTH6 << 10, time6 << 3);

if (readOffset_ls86 < (8 << 8))
  readOffset_ls86 = (8 << 8); // never less delay than 8 samples

#if attr_interpol > 0
int32_t rint6 = readOffset_ls86 >> 8; // integral part of delay time
int32_t rfrac6 = readOffset_ls86 &
                 0x000000FF; // fractional part of delay time in Q8 notation
#endif

// pre-calculate coefficients for 3pt interpolation
#if attr_interpol == 2

int32_t x6 = (rfrac6 * rfrac6); // x^2 in Q16 notation
// in Q16 notation
int32_t c16 = (1 << 16) + (x6 >> 1) - (rfrac6 << 7) - (rfrac6 << 8);
int32_t c26 = -x6 + (rfrac6 << 9);
int32_t c36 = (x6 >> 1) - (rfrac6 << 7);
#endif

// 7 //
int32_t g27 = inlet_gain7 << 3;

int32_t time7 = ___SMMUL(inlet_time7, inlet_timemod7) + inlet_time7;
int32_t readOffset_ls87 = ___SMMUL(LENGTH7 << 10, time7 << 3);

if (readOffset_ls87 < (8 << 8))
  readOffset_ls87 = (8 << 8); // never less delay than 8 samples

#if attr_interpol > 0
int32_t rint7 = readOffset_ls87 >> 8; // integral part of delay time
int32_t rfrac7 = readOffset_ls87 &
                 0x000000FF; // fractional part of delay time in Q8 notation
#endif

// pre-calculate coefficients for 3pt interpolation
#if attr_interpol == 2

int32_t x7 = (rfrac7 * rfrac7); // x^2 in Q16 notation
// in Q16 notation
int32_t c17 = (1 << 16) + (x7 >> 1) - (rfrac7 << 7) - (rfrac7 << 8);
int32_t c27 = -x7 + (rfrac7 << 9);
int32_t c37 = (x7 >> 1) - (rfrac7 << 7);
#endif

// 8 //
int32_t g28 = inlet_gain8 << 3;

int32_t time8 = ___SMMUL(inlet_time8, inlet_timemod8) + inlet_time8;
int32_t readOffset_ls88 = ___SMMUL(LENGTH8 << 10, time8 << 3);

if (readOffset_ls88 < (8 << 8))
  readOffset_ls88 = (8 << 8); // never less delay than 8 samples

#if attr_interpol > 0
int32_t rint8 = readOffset_ls88 >> 8; // integral part of delay time
int32_t rfrac8 = readOffset_ls88 &
                 0x000000FF; // fractional part of delay time in Q8 notation
#endif

// pre-calculate coefficients for 3pt interpolation
#if attr_interpol == 2

int32_t x8 = (rfrac8 * rfrac8); // x^2 in Q16 notation
// in Q16 notation
int32_t c18 = (1 << 16) + (x8 >> 1) - (rfrac8 << 7) - (rfrac8 << 8);
int32_t c28 = -x8 + (rfrac8 << 9);
int32_t c38 = (x8 >> 1) - (rfrac8 << 7);
#endif
Audio Rate
// 1 //

// no interpolation
#if attr_interpol == 0
int32_t rptr = wptr - (readOffset_ls8 >> 8);
int32_t dout = delayline[rptr & LENGTHMASK];
// linear (2pt) interpolation
#elif attr_interpol == 1
int32_t rptr1 = wptr - rint;
int32_t rptr2 = rptr1 + 1;
int32_t dout1 = delayline[rptr2 & LENGTHMASK] >> 1;
int32_t dout2 = delayline[rptr1 & LENGTHMASK] >> 1;
int32_t dout = ___SMMLA(rfrac << 23, (dout2 - dout1) << 1, dout1) << 1;
// qubic (3pt) interpolation
#elif attr_interpol == 2
int32_t rptr1 = wptr - rint;
int32_t rptr2 = rptr1 + 1;
int32_t rptr3 = rptr1 + 2;

int32_t dout1 = delayline[rptr3 & LENGTHMASK];
int32_t dout2 = delayline[rptr2 & LENGTHMASK];
int32_t dout3 = delayline[rptr1 & LENGTHMASK];
int32_t douttmp1 = ___SMMUL(dout1, c1 << 14);
int32_t douttmp2 = ___SMMLA(dout2, c2 << 14, douttmp1);
int32_t dout = ___SMMLA(dout3, c3 << 14, douttmp2) << 2;
#endif

int32_t din = ___SMMLA(g2, dout, inlet_in >> 2) << 1;
delayline[wptr] = din;
int32_t ONE = ___SMMLS(g2, din, dout >> 1) << 2;
wptr = (wptr + 1) & LENGTHMASK;

// 2 //

// no interpolation
#if attr_interpol == 0
int32_t rptr2 = wptr2 - (readOffset_ls82 >> 8);
int32_t dout222 = delayline2[rptr2 & LENGTHMASK2];
// linear (2pt) interpolation
#elif attr_interpol == 1
int32_t rptr12 = wptr2 - rint2;
int32_t rptr22 = rptr12 + 1;
int32_t dout12 = delayline2[rptr22 & LENGTHMASK2] >> 1;
int32_t dout22 = delayline2[rptr12 & LENGTHMASK2] >> 1;
int32_t dout222 = ___SMMLA(rfrac2 << 23, (dout22 - dout12) << 1, dout12) << 1;
// qubic (3pt) interpolation
#elif attr_interpol == 2
int32_t rptr12 = wptr2 - rint2;
int32_t rptr22 = rptr12 + 1;
int32_t rptr32 = rptr12 + 2;

int32_t dout12 = delayline2[rptr32 & LENGTHMASK2];
int32_t dout22 = delayline2[rptr22 & LENGTHMASK2];
int32_t dout32 = delayline2[rptr12 & LENGTHMASK2];
int32_t douttmp12 = ___SMMUL(dout12, c12 << 14);
int32_t douttmp22 = ___SMMLA(dout22, c22 << 14, douttmp12);
int32_t dout222 = ___SMMLA(dout32, c32 << 14, douttmp22) << 2;
#endif

int32_t din2 = ___SMMLA(g22, dout222, ONE >> 2) << 1;
delayline2[wptr2] = din2;
int32_t TWO = ___SMMLS(g22, din2, dout222 >> 1) << 2;
wptr2 = (wptr2 + 1) & LENGTHMASK2;

// 3 //

// no interpolation
#if attr_interpol == 0
int32_t rptr3 = wptr3 - (readOffset_ls83 >> 8);
int32_t dout333 = delayline3[rptr3 & LENGTHMASK3];
// linear (2pt) interpolation
#elif attr_interpol == 1
int32_t rptr13 = wptr3 - rint3;
int32_t rptr23 = rptr13 + 1;
int32_t dout13 = delayline3[rptr23 & LENGTHMASK3] >> 1;
int32_t dout23 = delayline3[rptr13 & LENGTHMASK3] >> 1;
int32_t dout333 = ___SMMLA(rfrac3 << 23, (dout23 - dout13) << 1, dout13) << 1;
// qubic (3pt) interpolation
#elif attr_interpol == 2
int32_t rptr13 = wptr3 - rint3;
int32_t rptr23 = rptr13 + 1;
int32_t rptr33 = rptr13 + 2;

int32_t dout13 = delayline3[rptr33 & LENGTHMASK3];
int32_t dout23 = delayline3[rptr23 & LENGTHMASK3];
int32_t dout33 = delayline3[rptr13 & LENGTHMASK3];
int32_t douttmp13 = ___SMMUL(dout13, c13 << 14);
int32_t douttmp23 = ___SMMLA(dout23, c23 << 14, douttmp13);
int32_t dout333 = ___SMMLA(dout33, c33 << 14, douttmp23) << 2;
#endif

int32_t din3 = ___SMMLA(g23, dout333, TWO >> 2) << 1;
delayline3[wptr3] = din3;
int32_t THREE = ___SMMLS(g23, din3, dout333 >> 1) << 2;
wptr3 = (wptr3 + 1) & LENGTHMASK3;

// 4 //

// no interpolation
#if attr_interpol == 0
int32_t rptr4 = wptr4 - (readOffset_ls84 >> 8);
int32_t dout4 = delayline4[rptr4 & LENGTHMASK4];
// linear (2pt) interpolation
#elif attr_interpol == 1
int32_t rptr14 = wptr4 - rint4;
int32_t rptr24 = rptr14 + 1;
int32_t dout14 = delayline4[rptr24 & LENGTHMASK4] >> 1;
int32_t dout24 = delayline4[rptr14 & LENGTHMASK4] >> 1;
int32_t dout4 = ___SMMLA(rfrac4 << 23, (dout24 - dout14) << 1, dout14) << 1;
// qubic (3pt) interpolation
#elif attr_interpol == 2
int32_t rptr14 = wptr4 - rint4;
int32_t rptr24 = rptr14 + 1;
int32_t rptr34 = rptr14 + 2;

int32_t dout14 = delayline4[rptr34 & LENGTHMASK4];
int32_t dout24 = delayline4[rptr24 & LENGTHMASK4];
int32_t dout34 = delayline4[rptr14 & LENGTHMASK4];
int32_t douttmp14 = ___SMMUL(dout14, c14 << 14);
int32_t douttmp24 = ___SMMLA(dout24, c24 << 14, douttmp14);
int32_t dout4 = ___SMMLA(dout34, c34 << 14, douttmp24) << 2;
#endif

int32_t din4 = ___SMMLA(g24, dout4, THREE >> 2) << 1;
delayline4[wptr4] = din4;
int32_t FOUR = ___SMMLS(g24, din4, dout4 >> 1) << 2;
wptr4 = (wptr4 + 1) & LENGTHMASK4;

// 5 //

// no interpolation
#if attr_interpol == 0
int32_t rptr5 = wptr5 - (readOffset_ls85 >> 8);
int32_t dout5 = delayline5[rptr5 & LENGTHMASK5];
// linear (2pt) interpolation
#elif attr_interpol == 1
int32_t rptr15 = wptr5 - rint5;
int32_t rptr25 = rptr15 + 1;
int32_t dout15 = delayline5[rptr25 & LENGTHMASK5] >> 1;
int32_t dout25 = delayline5[rptr15 & LENGTHMASK5] >> 1;
int32_t dout5 = ___SMMLA(rfrac5 << 23, (dout25 - dout15) << 1, dout15) << 1;
// qubic (3pt) interpolation
#elif attr_interpol == 2
int32_t rptr15 = wptr5 - rint5;
int32_t rptr25 = rptr15 + 1;
int32_t rptr35 = rptr15 + 2;

int32_t dout15 = delayline5[rptr35 & LENGTHMASK5];
int32_t dout25 = delayline5[rptr25 & LENGTHMASK5];
int32_t dout35 = delayline5[rptr15 & LENGTHMASK5];
int32_t douttmp15 = ___SMMUL(dout15, c15 << 14);
int32_t douttmp25 = ___SMMLA(dout25, c25 << 14, douttmp15);
int32_t dout5 = ___SMMLA(dout35, c35 << 14, douttmp25) << 2;
#endif

int32_t din5 = ___SMMLA(g25, dout5, FOUR >> 2) << 1;
delayline5[wptr5] = din5;
int32_t FIVE = ___SMMLS(g25, din5, dout5 >> 1) << 2;
wptr5 = (wptr5 + 1) & LENGTHMASK5;

// 6 //

// no interpolation
#if attr_interpol == 0
int32_t rptr6 = wptr6 - (readOffset_ls86 >> 8);
int32_t dout6 = delayline6[rptr6 & LENGTHMASK6];
// linear (2pt) interpolation
#elif attr_interpol == 1
int32_t rptr16 = wptr6 - rint6;
int32_t rptr26 = rptr16 + 1;
int32_t dout16 = delayline6[rptr26 & LENGTHMASK6] >> 1;
int32_t dout26 = delayline6[rptr16 & LENGTHMASK6] >> 1;
int32_t dout6 = ___SMMLA(rfrac6 << 23, (dout26 - dout16) << 1, dout16) << 1;
// qubic (3pt) interpolation
#elif attr_interpol == 2
int32_t rptr16 = wptr6 - rint6;
int32_t rptr26 = rptr16 + 1;
int32_t rptr36 = rptr16 + 2;

int32_t dout16 = delayline6[rptr36 & LENGTHMASK6];
int32_t dout26 = delayline6[rptr26 & LENGTHMASK6];
int32_t dout36 = delayline6[rptr16 & LENGTHMASK6];
int32_t douttmp16 = ___SMMUL(dout16, c16 << 14);
int32_t douttmp26 = ___SMMLA(dout26, c26 << 14, douttmp16);
int32_t dout6 = ___SMMLA(dout36, c36 << 14, douttmp26) << 2;
#endif

int32_t din6 = ___SMMLA(g26, dout6, FIVE >> 2) << 1;
delayline6[wptr6] = din6;
int32_t SIX = ___SMMLS(g26, din6, dout6 >> 1) << 2;
wptr6 = (wptr6 + 1) & LENGTHMASK6;

// 7 //

// no interpolation
#if attr_interpol == 0
int32_t rptr7 = wptr7 - (readOffset_ls87 >> 8);
int32_t dout7 = delayline7[rptr6 & LENGTHMASK7];
// linear (2pt) interpolation
#elif attr_interpol == 1
int32_t rptr17 = wptr7 - rint7;
int32_t rptr27 = rptr17 + 1;
int32_t dout17 = delayline7[rptr27 & LENGTHMASK7] >> 1;
int32_t dout27 = delayline7[rptr17 & LENGTHMASK7] >> 1;
int32_t dout7 = ___SMMLA(rfrac7 << 23, (dout27 - dout17) << 1, dout17) << 1;
// qubic (3pt) interpolation
#elif attr_interpol == 2
int32_t rptr17 = wptr7 - rint7;
int32_t rptr27 = rptr17 + 1;
int32_t rptr37 = rptr17 + 2;

int32_t dout17 = delayline7[rptr37 & LENGTHMASK7];
int32_t dout27 = delayline7[rptr27 & LENGTHMASK7];
int32_t dout37 = delayline7[rptr17 & LENGTHMASK7];
int32_t douttmp17 = ___SMMUL(dout17, c17 << 14);
int32_t douttmp27 = ___SMMLA(dout27, c27 << 14, douttmp17);
int32_t dout7 = ___SMMLA(dout37, c37 << 14, douttmp27) << 2;
#endif

int32_t din7 = ___SMMLA(g27, dout7, SIX >> 2) << 1;
delayline7[wptr7] = din7;
int32_t SEVEN = ___SMMLS(g27, din7, dout7 >> 1) << 2;
wptr7 = (wptr7 + 1) & LENGTHMASK7;

// 8 //

// no interpolation
#if attr_interpol == 0
int32_t rptr8 = wptr8 - (readOffset_ls88 >> 8);
int32_t dout8 = delayline8[rptr6 & LENGTHMASK8];
// linear (2pt) interpolation
#elif attr_interpol == 1
int32_t rptr18 = wptr8 - rint8;
int32_t rptr28 = rptr18 + 1;
int32_t dout18 = delayline8[rptr28 & LENGTHMASK8] >> 1;
int32_t dout28 = delayline8[rptr18 & LENGTHMASK8] >> 1;
int32_t dout8 = ___SMMLA(rfrac8 << 23, (dout28 - dout18) << 1, dout18) << 1;
// qubic (3pt) interpolation
#elif attr_interpol == 2
int32_t rptr18 = wptr8 - rint8;
int32_t rptr28 = rptr18 + 1;
int32_t rptr38 = rptr18 + 2;

int32_t dout18 = delayline8[rptr38 & LENGTHMASK8];
int32_t dout28 = delayline8[rptr28 & LENGTHMASK8];
int32_t dout38 = delayline8[rptr18 & LENGTHMASK8];
int32_t douttmp18 = ___SMMUL(dout18, c18 << 14);
int32_t douttmp28 = ___SMMLA(dout28, c28 << 14, douttmp18);
int32_t dout8 = ___SMMLA(dout38, c38 << 14, douttmp28) << 2;
#endif

int32_t din8 = ___SMMLA(g28, dout8, SEVEN >> 2) << 1;
delayline8[wptr8] = din8;
outlet_out = ___SMMLS(g28, din8, dout8 >> 1) << 2;
wptr8 = (wptr8 + 1) & LENGTHMASK8;

Privacy

© 2024 Zrna Research