MCPcopy Create free account
hub / github.com/csound/csound / readFilter

Function readFilter

Opcodes/bformdec2.cpp:1886–1904  ·  view source on GitHub ↗

readFilter -- delay-line access routine (band splitting) * * Reads sample x[n-i] from a previously established delay line. * With this syntax i is +ve for a time delay and -ve for a time advance. * * The use of explicit indexing rather than implicit index incrementing * allows multiple lattice structures to access the same delay line. * (adapted from csound/Opcodes/hrtfopcodes.c) * */

Source from the content-addressed store, hash-verified

1884 *
1885 */
1886static double readFilter(HOAMBDEC* p, int32_t i, int j)
1887{
1888
1889 double* readPoint; /* Generic pointer address */
1890 int32_t delay;
1891 /* Calculate the address of the index for this read */
1892 readPoint = p->currPos[j] - i;
1893 delay = p->ndelay;
1894
1895 /* Wrap around for time-delay if necessary */
1896 if (readPoint < ((double*)p->delay[j].auxp) )
1897 readPoint += delay;
1898 else
1899 /* Wrap for time-advance if necessary */
1900 if (readPoint > ((double*)p->delay[j].auxp + (delay-1)) )
1901 readPoint -= delay;
1902
1903 return *readPoint; /* Dereference read address for delayed value */
1904}
1905
1906
1907/* insertFilter -- delay-line update routine (band splitting)

Callers 1

ahoambdecFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected