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

Function FetchInForAdd

Opcodes/pvadd.c:37–63  ·  view source on GitHub ↗

This is used in pvadd instead of the Fetch() from dsputil.c */

Source from the content-addressed store, hash-verified

35
36/* This is used in pvadd instead of the Fetch() from dsputil.c */
37void FetchInForAdd(float *inp, MYFLT *buf, int32 fsize,
38 MYFLT pos, int32_t binoffset, int32_t maxbin, int32_t binincr)
39{
40 int32 j;
41 float *frame0, *frame1;
42 int32 base;
43 MYFLT frac;
44
45 base = (int32)pos;
46 frac = pos - (MYFLT)base;
47 /* & how close to get to next */
48 frame0 = inp + ((int32)fsize+2L)*base;
49 frame1 = frame0 + ((int32)fsize+2L);
50 if (frac != FL(0.0)) {
51 for (j = binoffset; j < maxbin; j+=binincr) {
52 buf[2L*j] = frame0[2L*j] + frac*(frame1[2L*j]-frame0[2L*j]);
53 buf[2L*j+1L] = frame0[2L*j+1L]
54 + frac*(frame1[2L*j+1L]-frame0[2L*j+1L]);
55 }
56 }
57 else {
58 for (j = binoffset; j < maxbin; j+=binincr) {
59 buf[2L*j] = frame0[2L*j];
60 buf[2L*j+1] = frame0[2L*j+1L];
61 }
62 }
63}
64
65int32_t pvaddset_(CSOUND *csound, PVADD *p, int32_t stringname)
66{

Callers 1

pvaddFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected