| 117 | */ |
| 118 | template <MYFLT (*trop)(MYFLT, MYFLT, MYFLT)> |
| 119 | struct ArrayOp4 : csnd::Plugin<1, 3> { |
| 120 | |
| 121 | int process(csnd::myfltvec &out, csnd::myfltvec &in, MYFLT v1, MYFLT v2) { |
| 122 | for (MYFLT *s = in.begin(), *o = out.begin(); s != in.end(); s++, o++) |
| 123 | *o = trop(*s, v1, v2); |
| 124 | return OK; |
| 125 | } |
| 126 | |
| 127 | int init() { |
| 128 | csnd::myfltvec &out = outargs.myfltvec_data(0); |
| 129 | csnd::myfltvec &in = inargs.myfltvec_data(0); |
| 130 | out.init(csound, in.len()); |
| 131 | if(!is_perf()) process(out, in, inargs[1], inargs[2]); |
| 132 | return OK; |
| 133 | } |
| 134 | |
| 135 | int kperf() { |
| 136 | return process(outargs.myfltvec_data(0), inargs.myfltvec_data(0), inargs[1], |
| 137 | inargs[2]); |
| 138 | } |
| 139 | }; |
| 140 | |
| 141 | /** k-rate operator |
| 142 | kout[] sort[a,d] kin[] |
nothing calls this directly
no outgoing calls
no test coverage detected