class library: SynthDef - replaceUGen fixes
[supercollider.git] / server / plugins / MulAddUGens.cpp
blob1970e808ca5100e6292859eae3c43895c7ed73f6
1 /*
2 SuperCollider real time audio synthesis system
3 Copyright (c) 2002 James McCartney. All rights reserved.
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "SC_PlugIn.h"
26 #ifdef NOVA_SIMD
27 #include "simd_memory.hpp"
28 #include "simd_binary_arithmetic.hpp"
29 #include "simd_ternary_arithmetic.hpp"
31 using nova::slope_argument;
33 #if defined(__GNUC__) && !defined(__clang__)
34 #define inline_functions __attribute__ ((flatten))
35 #else
36 #define inline_functions
37 #endif
40 #endif
44 static InterfaceTable *ft;
46 //////////////////////////////////////////////////////////////////////////////////////////////////
48 #define MULIN IN(1)
49 #define ADDIN IN(2)
51 struct MulAdd : public Unit
53 float mPrevMul, mPrevAdd;
56 extern "C"
58 void MulAdd_Ctor(MulAdd *unit);
60 // mul add functions for every occasion:
61 void ampmix_k(MulAdd *unit, int inNumSamples);
63 void ampmix_aa(MulAdd *unit, int inNumSamples);
64 void ampmix_ak(MulAdd *unit, int inNumSamples);
65 void ampmix_ai(MulAdd *unit, int inNumSamples);
67 void ampmix_ka(MulAdd *unit, int inNumSamples);
68 void ampmix_kk(MulAdd *unit, int inNumSamples);
69 void ampmix_ki(MulAdd *unit, int inNumSamples);
71 void ampmix_ia(MulAdd *unit, int inNumSamples);
72 void ampmix_ik(MulAdd *unit, int inNumSamples);
73 void ampmix_ii(MulAdd *unit, int inNumSamples);
76 ////////////////////////////////////////////////////////////////////////////////////////////////////////
79 void ampmix_k(MulAdd *unit, int inNumSamples);
80 void ampmix_k(MulAdd *unit, int inNumSamples)
82 ZOUT0(0) = ZIN0(0) * MULIN[0] + ADDIN[0];
85 void ampmix_aa(MulAdd *unit, int inNumSamples);
86 void ampmix_aa(MulAdd *unit, int inNumSamples)
88 float *in = ZIN(0);
89 float *out = ZOUT(0);
90 float *amp = MULIN - ZOFF;
91 float *mix = ADDIN - ZOFF;
93 LOOP1(inNumSamples, ZXP(out) = ZXP(amp) * ZXP(in) + ZXP(mix); );
96 void ampmix_ak(MulAdd *unit, int inNumSamples);
97 void ampmix_ak(MulAdd *unit, int inNumSamples)
99 float *in = ZIN(0);
100 float *out = ZOUT(0);
101 float *amp = MULIN - ZOFF;
103 float mix_cur = unit->mPrevAdd;
104 float nextMix = ADDIN[0];
105 float mix_slope = CALCSLOPE(nextMix, mix_cur);
106 if (mix_slope == 0.f) {
107 if (mix_cur == 0.f) {
108 LOOP1(inNumSamples, ZXP(out) = ZXP(amp) * ZXP(in); );
109 } else {
110 LOOP1(inNumSamples, ZXP(out) = ZXP(amp) * ZXP(in) + mix_cur; );
112 } else {
113 LOOP1(inNumSamples, ZXP(out) = ZXP(amp) * ZXP(in) + mix_cur; mix_cur += mix_slope; );
114 unit->mPrevAdd = nextMix;
118 void ampmix_ai(MulAdd *unit, int inNumSamples);
119 void ampmix_ai(MulAdd *unit, int inNumSamples)
121 float *in = ZIN(0);
122 float *out = ZOUT(0);
123 float *amp = MULIN - ZOFF;
124 float mix_cur = unit->mPrevAdd;
126 LOOP1(inNumSamples, ZXP(out) = ZXP(amp) * ZXP(in) + mix_cur; );
129 void ampmix_ka(MulAdd *unit, int inNumSamples);
130 void ampmix_ka(MulAdd *unit, int inNumSamples)
132 float *in = ZIN(0);
133 float *out = ZOUT(0);
134 float *mix = ADDIN - ZOFF;
135 float amp_cur = unit->mPrevMul;
136 float nextAmp = MULIN[0];
137 float amp_slope = CALCSLOPE(nextAmp, amp_cur);
139 if (amp_slope == 0.f) {
140 if (amp_cur == 0.f) {
141 ZCopy(inNumSamples, out, mix);
142 } else if (amp_cur == 1.f) {
143 LOOP1(inNumSamples, ZXP(out) = ZXP(in) + ZXP(mix); );
144 } else {
145 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + ZXP(mix); );
147 } else {
148 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + ZXP(mix); amp_cur += amp_slope; );
149 unit->mPrevMul = nextAmp;
153 void ampmix_kk(MulAdd *unit, int inNumSamples);
154 void ampmix_kk(MulAdd *unit, int inNumSamples)
156 float *in = ZIN(0);
157 float *out = ZOUT(0);
159 float amp_cur = unit->mPrevMul;
160 float nextAmp = MULIN[0];
161 float amp_slope = CALCSLOPE(nextAmp, amp_cur);
162 float mix_cur = unit->mPrevAdd;
163 float nextMix = ADDIN[0];
164 float mix_slope = CALCSLOPE(nextMix, mix_cur);
166 if (amp_slope == 0.f) {
167 if (mix_slope == 0.f) {
168 if (mix_cur == 0.f) {
169 if (amp_cur == 1.f) {
170 // do nothing!
171 } else if (amp_cur == 0.f) {
172 ZClear(inNumSamples, out);
173 } else {
174 LOOP1(inNumSamples, ZXP(out) = ZXP(in) * amp_cur;);
176 } else {
177 if (amp_cur == 1.f) {
178 LOOP1(inNumSamples, ZXP(out) = ZXP(in) + mix_cur;);
179 } else if (amp_cur == 0.f) {
180 LOOP1(inNumSamples, ZXP(out) = mix_cur;);
181 } else {
182 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; );
185 } else {
186 if (amp_cur == 1.f) {
187 LOOP1(inNumSamples, ZXP(out) = ZXP(in) + mix_cur; mix_cur += mix_slope;);
188 } else if (amp_cur == 0.f) {
189 LOOP1(inNumSamples, ZXP(out) = mix_cur; mix_cur += mix_slope;);
190 } else {
191 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; mix_cur += mix_slope; );
193 unit->mPrevAdd = nextMix;
195 } else {
196 if (mix_slope == 0.f) {
197 if (mix_cur == 0.f) {
198 LOOP1(inNumSamples, ZXP(out) = ZXP(in) * amp_cur; amp_cur += amp_slope; );
199 } else {
200 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; amp_cur += amp_slope; );
202 } else {
203 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; amp_cur += amp_slope; mix_cur += mix_slope; );
204 unit->mPrevAdd = nextMix;
206 unit->mPrevMul = nextAmp;
210 void ampmix_ki(MulAdd *unit, int inNumSamples);
211 void ampmix_ki(MulAdd *unit, int inNumSamples)
213 float *in = ZIN(0);
214 float *out = ZOUT(0);
216 float amp_cur = unit->mPrevMul;
217 float nextAmp = MULIN[0];
218 float amp_slope = CALCSLOPE(nextAmp, amp_cur);
219 float mix_cur = unit->mPrevAdd;
220 //postbuf("ampmix_ki %p %g %g\n", out, amp_cur, mix_cur);
222 if (amp_slope == 0.f) {
223 if (amp_cur == 1.f) {
224 LOOP1(inNumSamples, ZXP(out) = ZXP(in) + mix_cur;);
225 } else if (amp_cur == 0.f) {
226 LOOP1(inNumSamples, ZXP(out) = mix_cur;);
227 } else {
228 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; );
230 } else {
231 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; amp_cur += amp_slope; );
232 unit->mPrevMul = nextAmp;
236 void ampmix_ia(MulAdd *unit, int inNumSamples);
237 void ampmix_ia(MulAdd *unit, int inNumSamples)
239 float *in = ZIN(0);
240 float *out = ZOUT(0);
241 float *mix = ADDIN - ZOFF;
242 float amp_cur = unit->mPrevMul;
244 #ifdef IPHONE_VEC
245 in++;
246 out++;
247 mix++;
248 vscalarmul(in, amp_cur, in, inNumSamples);
249 vadd(out, in, mix, inNumSamples);
250 #else
251 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + ZXP(mix); );
252 #endif
256 void ampmix_ik(MulAdd *unit, int inNumSamples);
257 void ampmix_ik(MulAdd *unit, int inNumSamples)
259 float *in = ZIN(0);
260 float *out = ZOUT(0);
262 float amp_cur = unit->mPrevMul;
263 float mix_cur = unit->mPrevAdd;
264 float nextMix = ADDIN[0];
265 float mix_slope = CALCSLOPE(nextMix, mix_cur);
267 if (mix_slope == 0.f) {
268 if (mix_cur == 0.f) {
269 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in); );
270 } else {
271 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; );
273 } else {
274 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; mix_cur += mix_slope; );
275 unit->mPrevAdd = nextMix;
279 void ampmix_ii(MulAdd *unit, int inNumSamples);
280 void ampmix_ii(MulAdd *unit, int inNumSamples)
282 float *in = ZIN(0);
283 float *out = ZOUT(0);
285 float amp_cur = unit->mPrevMul;
286 float mix_cur = unit->mPrevAdd;
287 LOOP1(inNumSamples, ZXP(out) = amp_cur * ZXP(in) + mix_cur; );
290 #ifdef NOVA_SIMD
291 inline_functions void ampmix_aa_nova(MulAdd *unit, int inNumSamples)
293 nova::muladd_vec_simd(OUT(0), IN(0), MULIN,
294 ADDIN, inNumSamples);
297 inline_functions void ampmix_aa_nova_64(MulAdd *unit, int inNumSamples)
299 nova::muladd_vec_simd<64>(OUT(0), IN(0), MULIN, ADDIN);
302 inline_functions void ampmix_ak_nova(MulAdd *unit, int inNumSamples)
304 float mix_cur = unit->mPrevAdd;
305 float nextMix = ADDIN[0];
306 if (nextMix == mix_cur) {
307 if (mix_cur == 0.f)
308 nova::times_vec_simd(OUT(0), IN(0), MULIN, inNumSamples);
309 else
310 nova::muladd_vec_simd(OUT(0), IN(0), MULIN, mix_cur, inNumSamples);
311 } else {
312 float mix_slope = CALCSLOPE(nextMix, mix_cur);
313 unit->mPrevAdd = nextMix;
314 nova::muladd_vec_simd(OUT(0), IN(0), MULIN,
315 slope_argument(mix_cur, mix_slope), inNumSamples);
319 inline_functions void ampmix_ak_nova_64(MulAdd *unit, int inNumSamples)
321 float mix_cur = unit->mPrevAdd;
322 float nextMix = ADDIN[0];
323 if (nextMix == mix_cur) {
324 if (mix_cur == 0.f)
325 nova::times_vec_simd<64>(OUT(0), IN(0), MULIN);
326 else
327 nova::muladd_vec_simd<64>(OUT(0), IN(0), MULIN,
328 mix_cur);
329 } else {
330 float mix_slope = CALCSLOPE(nextMix, mix_cur);
331 unit->mPrevAdd = nextMix;
332 nova::muladd_vec_simd<64>(OUT(0), IN(0), MULIN,
333 slope_argument(mix_cur, mix_slope));
337 inline_functions void ampmix_ai_nova(MulAdd *unit, int inNumSamples)
339 nova::muladd_vec_simd(OUT(0), IN(0), MULIN,
340 unit->mPrevAdd, inNumSamples);
343 inline_functions void ampmix_ai_nova_64(MulAdd *unit, int inNumSamples)
345 nova::muladd_vec_simd<64>(OUT(0), IN(0), MULIN,
346 unit->mPrevAdd);
349 inline_functions void ampmix_ka_nova(MulAdd *unit, int inNumSamples)
351 float amp_cur = unit->mPrevMul;
352 float nextAmp = MULIN[0];
354 if (amp_cur == nextAmp) {
355 if (amp_cur == 0.f)
356 nova::copyvec_simd(OUT(0), ADDIN, inNumSamples);
357 else if (amp_cur == 1.f)
358 nova::plus_vec_simd(OUT(0), IN(0), ADDIN, inNumSamples);
359 else
360 nova::muladd_vec_simd(OUT(0), IN(0), amp_cur,
361 ADDIN, inNumSamples);
362 } else {
363 float amp_slope = CALCSLOPE(nextAmp, amp_cur);
364 unit->mPrevMul = nextAmp;
365 nova::muladd_vec_simd(OUT(0), IN(0), slope_argument(amp_cur, amp_slope),
366 ADDIN, inNumSamples);
370 inline_functions void ampmix_ka_nova_64(MulAdd *unit, int inNumSamples)
372 float amp_cur = unit->mPrevMul;
373 float nextAmp = MULIN[0];
375 if (amp_cur == nextAmp) {
376 if (amp_cur == 0.f)
377 nova::copyvec_simd<64>(OUT(0), ADDIN);
378 else if (amp_cur == 1.f)
379 nova::plus_vec_simd<64>(OUT(0), IN(0), ADDIN);
380 else
381 nova::muladd_vec_simd<64>(OUT(0), IN(0), amp_cur,
382 ADDIN);
383 } else {
384 float amp_slope = CALCSLOPE(nextAmp, amp_cur);
385 unit->mPrevMul = nextAmp;
386 nova::muladd_vec_simd<64>(OUT(0), IN(0), slope_argument(amp_cur, amp_slope),
387 ADDIN);
391 inline_functions void ampmix_kk_nova(MulAdd *unit, int inNumSamples)
393 float amp_cur = unit->mPrevMul;
394 float nextAmp = MULIN[0];
395 float mix_cur = unit->mPrevAdd;
396 float nextMix = ADDIN[0];
398 if (nextAmp == amp_cur) {
399 if (nextMix == mix_cur) {
400 if (mix_cur == 0.f) {
401 if (amp_cur == 1.f) {
402 // do nothing!
403 } else if (amp_cur == 0.f)
404 nova::zerovec_simd(OUT(0), inNumSamples);
405 else
406 nova::times_vec_simd(OUT(0), IN(0), amp_cur, inNumSamples);
407 } else {
408 if (amp_cur == 1.f)
409 nova::plus_vec_simd(OUT(0), IN(0), mix_cur, inNumSamples);
410 else if (amp_cur == 0.f)
411 nova::setvec_simd(OUT(0), mix_cur, inNumSamples);
412 else
413 nova::muladd_vec_simd(OUT(0), IN(0), amp_cur,
414 mix_cur, inNumSamples);
416 } else {
417 float mix_slope = CALCSLOPE(nextMix, mix_cur);
418 if (amp_cur == 1.f)
419 nova::plus_vec_simd(OUT(0), IN(0), slope_argument(mix_cur, mix_slope), inNumSamples);
420 else if (amp_cur == 0.f)
421 nova::set_slope_vec_simd(OUT(0), mix_cur, mix_slope, inNumSamples);
422 else
423 nova::muladd_vec_simd(OUT(0), IN(0), amp_cur,
424 slope_argument(mix_cur, mix_slope), inNumSamples);
425 unit->mPrevAdd = nextMix;
427 } else {
428 float amp_slope = CALCSLOPE(nextAmp, amp_cur);
429 if (nextMix == mix_cur) {
430 if (mix_cur == 0.f)
431 nova::times_vec_simd(OUT(0), IN(0), slope_argument(amp_cur, amp_slope), inNumSamples);
432 else
433 nova::muladd_vec_simd(OUT(0), IN(0), slope_argument(amp_cur, amp_slope),
434 mix_cur, inNumSamples);
435 } else {
436 float mix_slope = CALCSLOPE(nextMix, mix_cur);
437 nova::muladd_vec_simd(OUT(0), IN(0), slope_argument(amp_cur, amp_slope),
438 slope_argument(mix_cur, mix_slope), inNumSamples);
439 unit->mPrevAdd = nextMix;
441 unit->mPrevMul = nextAmp;
445 inline_functions void ampmix_ki_nova(MulAdd *unit, int inNumSamples)
447 float amp_cur = unit->mPrevMul;
448 float nextAmp = MULIN[0];
449 float mix_cur = unit->mPrevAdd;
451 if (nextAmp == amp_cur) {
452 if (amp_cur == 1.f)
453 nova::plus_vec_simd(OUT(0), IN(0), mix_cur, inNumSamples);
454 else if (amp_cur == 0.f)
455 nova::setvec_simd(OUT(0), mix_cur, inNumSamples);
456 else
457 nova::muladd_vec_simd(OUT(0), IN(0), amp_cur,
458 mix_cur, inNumSamples);
459 } else {
460 float amp_slope = CALCSLOPE(nextAmp, amp_cur);
461 nova::muladd_vec_simd(OUT(0), IN(0), slope_argument(amp_cur, amp_slope),
462 mix_cur, inNumSamples);
463 unit->mPrevMul = nextAmp;
467 inline_functions void ampmix_ki_nova_64(MulAdd *unit, int inNumSamples)
469 float amp_cur = unit->mPrevMul;
470 float nextAmp = MULIN[0];
471 float mix_cur = unit->mPrevAdd;
473 if (nextAmp == amp_cur) {
474 if (amp_cur == 1.f)
475 nova::plus_vec_simd<64>(OUT(0), IN(0), mix_cur);
476 else if (amp_cur == 0.f)
477 nova::setvec_simd<64>(OUT(0), mix_cur);
478 else
479 nova::muladd_vec_simd<64>(OUT(0), IN(0), amp_cur,
480 mix_cur);
481 } else {
482 float amp_slope = CALCSLOPE(nextAmp, amp_cur);
483 nova::muladd_vec_simd<64>(OUT(0), IN(0), slope_argument(amp_cur, amp_slope),
484 mix_cur);
485 unit->mPrevMul = nextAmp;
489 inline_functions void ampmix_ia_nova(MulAdd *unit, int inNumSamples)
491 nova::muladd_vec_simd(OUT(0), IN(0), unit->mPrevMul,
492 ADDIN, inNumSamples);
495 inline_functions void ampmix_ia_nova_64(MulAdd *unit, int inNumSamples)
497 nova::muladd_vec_simd<64>(OUT(0), IN(0), unit->mPrevMul,
498 ADDIN);
501 inline_functions void ampmix_ik_nova(MulAdd *unit, int inNumSamples)
503 float amp_cur = unit->mPrevMul;
504 float mix_cur = unit->mPrevAdd;
505 float nextMix = ADDIN[0];
507 if (nextMix == mix_cur) {
508 if (mix_cur == 0.f)
509 nova::times_vec_simd(OUT(0), IN(0), amp_cur, inNumSamples);
510 else
511 nova::muladd_vec_simd(OUT(0), IN(0), amp_cur,
512 mix_cur, inNumSamples);
513 } else {
514 float mix_slope = CALCSLOPE(nextMix, mix_cur);
515 nova::muladd_vec_simd(OUT(0), IN(0), amp_cur,
516 slope_argument(mix_cur, mix_slope), inNumSamples);
517 unit->mPrevAdd = nextMix;
521 inline_functions void ampmix_ik_nova_64(MulAdd *unit, int inNumSamples)
523 float amp_cur = unit->mPrevMul;
524 float mix_cur = unit->mPrevAdd;
525 float nextMix = ADDIN[0];
527 if (nextMix == mix_cur) {
528 if (mix_cur == 0.f)
529 nova::times_vec_simd<64>(OUT(0), IN(0), amp_cur);
530 else
531 nova::muladd_vec_simd<64>(OUT(0), IN(0), amp_cur, mix_cur);
532 } else {
533 float mix_slope = CALCSLOPE(nextMix, mix_cur);
534 nova::muladd_vec_simd<64>(OUT(0), IN(0), amp_cur,
535 slope_argument(mix_cur, mix_slope));
536 unit->mPrevAdd = nextMix;
540 inline_functions void ampmix_ii_nova(MulAdd *unit, int inNumSamples)
542 nova::muladd_vec_simd(OUT(0), IN(0), unit->mPrevMul,
543 unit->mPrevAdd, inNumSamples);
546 inline_functions void ampmix_ii_nova_64(MulAdd *unit, int inNumSamples)
548 nova::muladd_vec_simd<64>(OUT(0), IN(0), unit->mPrevMul,
549 unit->mPrevAdd);
552 #endif
557 ////////////////////////////////////////////////////////////////////////////////////////////////////////
559 void MulAdd_Ctor(MulAdd *unit)
561 if (unit->mCalcRate != calc_FullRate) {
562 unit->mCalcFunc = (UnitCalcFunc)&ampmix_k;
563 ampmix_k(unit, 1);
564 return;
567 unit->mPrevMul = ZIN0(1);
568 unit->mPrevAdd = ZIN0(2);
570 int mulRate = INRATE(1);
571 int addRate = INRATE(2);
573 //Print("muladd %d %d %g %g\n", mulRate, addRate, unit->mPrevMul, unit->mPrevAdd);
574 //Print("**** %p %p %p %p\n", IN(0), IN(1), IN(2), OUT(0));
577 #if defined (NOVA_SIMD)
578 if ((BUFLENGTH & 15))
580 #endif
581 switch (mulRate) {
582 case calc_FullRate :
583 switch (addRate) {
584 case calc_FullRate :
585 unit->mCalcFunc = (UnitCalcFunc)&ampmix_aa;
586 break;
587 case calc_BufRate :
588 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ak;
589 break;
590 case calc_ScalarRate :
591 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ai;
592 break;
594 break;
595 case calc_BufRate :
596 switch (addRate) {
597 case calc_FullRate :
598 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ka;
599 break;
600 case calc_BufRate :
601 unit->mCalcFunc = (UnitCalcFunc)&ampmix_kk;
602 break;
603 case calc_ScalarRate :
604 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ki;
605 break;
607 break;
608 case calc_ScalarRate :
609 switch (addRate) {
610 case calc_FullRate :
611 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ia;
612 break;
613 case calc_BufRate :
614 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ik;
615 break;
616 case calc_ScalarRate :
617 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ii;
618 break;
620 break;
623 #if defined (NOVA_SIMD)
624 } else {
625 if (BUFLENGTH == 64) {
626 switch (mulRate) {
627 case calc_FullRate :
628 switch (addRate) {
629 case calc_FullRate :
630 unit->mCalcFunc = (UnitCalcFunc)&ampmix_aa_nova_64;
631 break;
632 case calc_BufRate :
633 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ak_nova_64;
634 break;
635 case calc_ScalarRate :
636 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ai_nova_64;
637 break;
639 break;
640 case calc_BufRate :
641 switch (addRate) {
642 case calc_FullRate :
643 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ka_nova_64;
644 break;
645 case calc_BufRate :
646 unit->mCalcFunc = (UnitCalcFunc)&ampmix_kk_nova;
647 break;
648 case calc_ScalarRate :
649 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ki_nova_64;
650 break;
652 break;
653 case calc_ScalarRate :
654 switch (addRate) {
655 case calc_FullRate :
656 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ia_nova_64;
657 break;
658 case calc_BufRate :
659 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ik_nova_64;
660 break;
661 case calc_ScalarRate :
662 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ii_nova_64;
663 break;
665 break;
667 } else {
668 switch (mulRate) {
669 case calc_FullRate :
670 switch (addRate) {
671 case calc_FullRate :
672 unit->mCalcFunc = (UnitCalcFunc)&ampmix_aa_nova;
673 break;
674 case calc_BufRate :
675 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ak_nova;
676 break;
677 case calc_ScalarRate :
678 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ai_nova;
679 break;
681 break;
682 case calc_BufRate :
683 switch (addRate) {
684 case calc_FullRate :
685 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ka_nova;
686 break;
687 case calc_BufRate :
688 unit->mCalcFunc = (UnitCalcFunc)&ampmix_kk_nova;
689 break;
690 case calc_ScalarRate :
691 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ki_nova;
692 break;
694 break;
695 case calc_ScalarRate :
696 switch (addRate) {
697 case calc_FullRate :
698 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ia_nova;
699 break;
700 case calc_BufRate :
701 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ik_nova;
702 break;
703 case calc_ScalarRate :
704 unit->mCalcFunc = (UnitCalcFunc)&ampmix_ii_nova;
705 break;
707 break;
711 #endif
712 ampmix_k(unit, 1);
716 ////////////////////////////////////////////////////////////////////////////////////////////////////////
718 PluginLoad(MulAdd)
720 ft = inTable;
722 DefineSimpleUnit(MulAdd);