Codebase list guitarix / debian/0.29.0-1
Imported Debian patch 0.29.0-1 Roland Stigge authored 9 years ago Ross Gammon committed 8 years ago
725 changed file(s) with 66108 addition(s) and 2379 deletion(s). Raw diff Collapse all Expand all
IR/BestPlugins_Bands/Hora Zulu Siempre soñé saber sobre nadie negó nunca nada.wav less more
Binary diff not shown
0 guitarix2 (0.28.1) unstable; urgency=low
0 guitarix2 (0.29.0git) unstable; urgency=low
11 * git head
22
3 -- brummer <brummer-@web.de> Sat, 20 Apr 2013 21:30:35 +0200
3 -- brummer <brummer-@web.de> Sat, 03 Nov 2013 06:30:35 +0200
4
5 guitarix2 (0.28.3) unstable; urgency=low
6 * MODification (https://github.com/portalmod)
7 * add defines for MOD UI to all LV2 plugs
8 * add a couple of new plugs
9
10 -- brummer <brummer-@web.de> Sat, 03 Nov 2013 06:30:35 +0200
411
512 guitarix2 (0.25.2) unstable; urgency=low
613 * add ts9 tube screamer to lv2.plugs
0 guitarix (0.29.0-1) unstable; urgency=medium
1
2 * New upstream release (Closes: #749116)
3 * Updated debian/watch via http://qa.debian.org/watch/sf.php
4
5 -- Roland Stigge <stigge@antcom.de> Sun, 25 May 2014 16:21:57 +0200
6
07 guitarix (0.28.2-4) unstable; urgency=low
18
29 * debian/control:
11 Section: sound
22 Priority: extra
33 Maintainer: Roland Stigge <stigge@antcom.de>
4 Build-Depends: debhelper (>= 9), python, libjack-dev, libsndfile1-dev, libgtk2.0-dev, ladspa-sdk, libzita-convolver-dev, libgtkmm-2.4-dev, libboost-dev (>= 1.53), libboost-thread-dev (>= 1.53), intltool, liblrdf0-dev, libboost-system-dev (>= 1.53), lv2-dev, libavahi-gobject-dev
4 Build-Depends: debhelper (>= 9), python, libjack-dev, libsndfile1-dev, libgtk2.0-dev, ladspa-sdk, libzita-convolver-dev, libgtkmm-2.4-dev, libboost-dev (>= 1.53), libboost-thread-dev (>= 1.53), intltool, liblrdf0-dev, libboost-system-dev (>= 1.53), lv2-dev, libavahi-gobject-dev, libeigen3-dev, libbluetooth-dev, libzita-resampler-dev
55 Standards-Version: 3.9.5
66 Homepage: http://guitarix.sourceforge.net/
77
00 version=3
1 http://sf.net/guitarix/guitarix.?-(.*)\.tar\.bz2
1 http://qa.debian.org/watch/sf.php/guitarix/ \
2 (?:|.*/)guitarix2(?:[_\-]v?|)(\d[^\s/]*)\.(?:tar\.xz|txz|tar\.bz2|tbz2|tar\.gz|tgz)
0 ["gx_head_file_version", [1, 2, "0.26.0git"],
0 ["gx_head_file_version", [1, 2, "0.29.0git"],
11 "Dist1", {
22 "engine": {
33 "IR.auto_freq": "manual",
117117 "eqs.fs1k": 0,
118118 "eqs.fs250": 0.4,
119119 "eqs.fs2k": 0,
120 "eqs.fs31_25": -50,
120 "eqs.fs31_25": -40,
121121 "eqs.fs4k": 0,
122122 "eqs.fs500": 0,
123123 "eqs.fs62_5": -21.2,
432432 "IR.freq": 440,
433433 "IR.on_off": 0,
434434 "IR.peak": 1,
435 "IR.position": 5,
435 "IR.position": 7,
436436 "IR.pp": "post",
437437 "abgate.attack": 4,
438438 "abgate.decay": 50,
454454 "amp.tonestack.Middle": 0.4,
455455 "amp.tonestack.Treble": 0.75,
456456 "amp.tonestack.on_off": 0,
457 "amp.tonestack.position": 14,
457 "amp.tonestack.position": 9,
458458 "amp.tonestack.pp": "post",
459459 "amp.tonestack.select": "M2199",
460460 "amp.wet_dry": 0,
473473 "biquad.on_off": 0,
474474 "biquad.position": 12,
475475 "biquad.pp": "post",
476 "cab.Level": 1.72,
476 "cab.Level": 2,
477477 "cab.bass": 0,
478478 "cab.on_off": 1,
479 "cab.position": 3,
479 "cab.position": 2,
480480 "cab.pp": "post",
481481 "cab.select": "4x12",
482482 "cab.treble": -0.4,
492492 "chorus_mono.position": 19,
493493 "chorus_mono.pp": "post",
494494 "chorus_mono.wet_dry": 100,
495 "compressor.attack": 0.002,
495 "compressor.attack": 0.003,
496496 "compressor.knee": 3,
497497 "compressor.on_off": 1,
498 "compressor.position": 0,
498 "compressor.position": 1,
499499 "compressor.pp": "pre",
500 "compressor.ratio": 2,
500 "compressor.ratio": 2.045,
501501 "compressor.release": 0.5,
502 "compressor.threshold": -20,
502 "compressor.threshold": -20.21,
503503 "con.Level": 5,
504504 "con.on_off": 1,
505505 "crybaby.autowah": "auto",
512512 "delay.delay": 100,
513513 "delay.gain": -9.83626,
514514 "delay.on_off": 0,
515 "delay.position": 6,
515 "delay.position": 8,
516516 "delay.pp": "post",
517517 "echo.on_off": 0,
518518 "echo.percent": 0,
519519 "echo.position": 7,
520520 "echo.pp": "post",
521521 "echo.time": 1,
522 "eq.bandwidth1": 41,
523 "eq.bandwidth2": 220,
524 "eq.bandwidth3": 880,
525 "eq.bandwidth4": 1760,
526 "eq.level1": 0,
527 "eq.level2": 0,
528 "eq.level3": 0,
529 "eq.level4": 0,
530 "eq.on_off": 0,
531 "eq.peak1": 110,
532 "eq.peak2": 440,
533 "eq.peak3": 1760,
534 "eq.peak4": 3520,
535 "eq.position": 10,
536 "eq.pp": "post",
522537 "eqs.Qs125": 50,
523538 "eqs.Qs16k": 50,
524539 "eqs.Qs1k": 50,
544559 "eqs.fs1k": 0,
545560 "eqs.fs250": 0.4,
546561 "eqs.fs2k": 0,
547 "eqs.fs31_25": -50,
562 "eqs.fs31_25": -40,
548563 "eqs.fs4k": 0,
549564 "eqs.fs500": 0,
550565 "eqs.fs62_5": -21.2,
552567 "eqs.on_off": 1,
553568 "eqs.position": 1,
554569 "eqs.pp": "post",
555 "expander.attack": 0.001,
556 "expander.knee": 3,
557 "expander.on_off": 0,
558 "expander.position": 8,
559 "expander.pp": "post",
560 "expander.ratio": 2,
570 "expander.attack": 0.004,
571 "expander.knee": 0,
572 "expander.on_off": 1,
573 "expander.position": 0,
574 "expander.pp": "pre",
575 "expander.ratio": 20,
561576 "expander.release": 0.1,
562 "expander.threshold": -40,
577 "expander.threshold": -52,
563578 "feedback.feedback": 0,
564579 "feedback.on_off": 0,
565580 "feedback.position": 22,
592607 "freeverb.RoomSize": 1,
593608 "freeverb.damp": 0.425,
594609 "freeverb.on_off": 0,
595 "freeverb.position": 2,
610 "freeverb.position": 3,
596611 "freeverb.pp": "post",
597612 "freeverb.wet_dry": 29,
598613 "gx_distortion.drive": 0.64,
607622 "gx_distortion.middle_l_drive": 1,
608623 "gx_distortion.middle_l_gain": 10,
609624 "gx_distortion.on_off": 0,
610 "gx_distortion.position": 5,
625 "gx_distortion.position": 6,
611626 "gx_distortion.pp": "post",
612627 "gx_distortion.resonator.on_off": 0,
613628 "gx_distortion.split_high_freq": 1250,
660675 "low_high_pass.lhp.low_freq": 5000,
661676 "low_high_pass.lhp.on_off": 0,
662677 "low_highpass.on_off": 0,
663 "low_highpass.position": 1,
678 "low_highpass.position": 2,
664679 "low_highpass.pp": "post",
680 "mbc.Attack1": 0.012,
681 "mbc.Attack2": 0.012,
682 "mbc.Attack3": 0.012,
683 "mbc.Attack4": 0.012,
684 "mbc.Attack5": 0.012,
685 "mbc.Makeup-Threshold1": 2,
686 "mbc.Makeup-Threshold2": 2,
687 "mbc.Makeup-Threshold3": 2,
688 "mbc.Makeup-Threshold4": 2,
689 "mbc.Makeup-Threshold5": 2,
690 "mbc.Makeup1": 13,
691 "mbc.Makeup2": 10,
692 "mbc.Makeup3": 4,
693 "mbc.Makeup4": 8,
694 "mbc.Makeup5": 11,
695 "mbc.Mode1": "Compress",
696 "mbc.Mode2": "Compress",
697 "mbc.Mode3": "Compress",
698 "mbc.Mode4": "Compress",
699 "mbc.Mode5": "Compress",
700 "mbc.Ratio1": 2,
701 "mbc.Ratio2": 2,
702 "mbc.Ratio3": 2,
703 "mbc.Ratio4": 2,
704 "mbc.Ratio5": 2,
705 "mbc.Release1": 1.25,
706 "mbc.Release2": 1.25,
707 "mbc.Release3": 1.25,
708 "mbc.Release4": 1.25,
709 "mbc.Release5": 1.25,
710 "mbc.crossover_b1_b2": 80,
711 "mbc.crossover_b2_b3": 210,
712 "mbc.crossover_b3_b4": 1700,
713 "mbc.crossover_b4_b5": 5000,
714 "mbc.on_off": 0,
715 "mbc.position": 11,
716 "mbc.pp": "post",
717 "mbchor.crossover_b1_b2": 80,
718 "mbchor.crossover_b2_b3": 210,
719 "mbchor.crossover_b3_b4": 1700,
720 "mbchor.crossover_b4_b5": 5000,
721 "mbchor.delay1": 0.02,
722 "mbchor.delay2": 0.04,
723 "mbchor.delay3": 0.06,
724 "mbchor.delay4": 0.08,
725 "mbchor.delay5": 0.1,
726 "mbchor.depth1": 0.02,
727 "mbchor.depth2": 0.04,
728 "mbchor.depth3": 0.06,
729 "mbchor.depth4": 0.08,
730 "mbchor.depth5": 0.1,
731 "mbchor.freq1": 30,
732 "mbchor.freq2": 60,
733 "mbchor.freq3": 90,
734 "mbchor.freq4": 120,
735 "mbchor.freq5": 150,
736 "mbchor.level1": 0.5,
737 "mbchor.level2": 0.5,
738 "mbchor.level3": 0.5,
739 "mbchor.level4": 0.5,
740 "mbchor.level5": 0.5,
741 "mbchor.on_off": 0,
742 "mbchor.position": 34,
743 "mbchor.pp": "pre",
744 "mbcs.Attack1": 0.012,
745 "mbcs.Attack2": 0.012,
746 "mbcs.Attack3": 0.012,
747 "mbcs.Attack4": 0.012,
748 "mbcs.Attack5": 0.012,
749 "mbcs.Makeup-Threshold1": 2,
750 "mbcs.Makeup-Threshold2": 2,
751 "mbcs.Makeup-Threshold3": 2,
752 "mbcs.Makeup-Threshold4": 2,
753 "mbcs.Makeup-Threshold5": 2,
754 "mbcs.Makeup1": 13,
755 "mbcs.Makeup2": 10,
756 "mbcs.Makeup3": 4,
757 "mbcs.Makeup4": 8,
758 "mbcs.Makeup5": 11,
759 "mbcs.Mode1": "Compress",
760 "mbcs.Mode2": "Compress",
761 "mbcs.Mode3": "Compress",
762 "mbcs.Mode4": "Compress",
763 "mbcs.Mode5": "Compress",
764 "mbcs.Ratio1": 2,
765 "mbcs.Ratio2": 2,
766 "mbcs.Ratio3": 2,
767 "mbcs.Ratio4": 2,
768 "mbcs.Ratio5": 2,
769 "mbcs.Release1": 1.25,
770 "mbcs.Release2": 1.25,
771 "mbcs.Release3": 1.25,
772 "mbcs.Release4": 1.25,
773 "mbcs.Release5": 1.25,
774 "mbcs.crossover_b1_b2": 80,
775 "mbcs.crossover_b2_b3": 210,
776 "mbcs.crossover_b3_b4": 1700,
777 "mbcs.crossover_b4_b5": 5000,
778 "mbcs.on_off": 0,
779 "mbcs.position": 13,
780 "mbd.Drive1": 0,
781 "mbd.Drive2": 0,
782 "mbd.Drive3": 0,
783 "mbd.Drive4": 0,
784 "mbd.Drive5": 0,
785 "mbd.Gain": 0,
786 "mbd.Offset1": 0,
787 "mbd.Offset2": 0,
788 "mbd.Offset3": 0,
789 "mbd.Offset4": 0,
790 "mbd.Offset5": 0,
791 "mbd.crossover_b1_b2": 80,
792 "mbd.crossover_b2_b3": 210,
793 "mbd.crossover_b3_b4": 1700,
794 "mbd.crossover_b4_b5": 5000,
795 "mbd.on_off": 0,
796 "mbd.position": 31,
797 "mbd.pp": "pre",
798 "mbdel.crossover_b1_b2": 80,
799 "mbdel.crossover_b2_b3": 210,
800 "mbdel.crossover_b3_b4": 1700,
801 "mbdel.crossover_b4_b5": 5000,
802 "mbdel.delay1": 30,
803 "mbdel.delay2": 60,
804 "mbdel.delay3": 90,
805 "mbdel.delay4": 120,
806 "mbdel.delay5": 150,
807 "mbdel.gain1": -10,
808 "mbdel.gain2": -5,
809 "mbdel.gain3": -2,
810 "mbdel.gain4": 0,
811 "mbdel.gain5": -10,
812 "mbdel.on_off": 0,
813 "mbdel.position": 33,
814 "mbdel.pp": "pre",
815 "mbe.crossover_b1_b2": 80,
816 "mbe.crossover_b2_b3": 210,
817 "mbe.crossover_b3_b4": 1700,
818 "mbe.crossover_b4_b5": 5000,
819 "mbe.on_off": 0,
820 "mbe.percent1": 10,
821 "mbe.percent2": 30,
822 "mbe.percent3": 45,
823 "mbe.percent4": 20,
824 "mbe.percent5": 0,
825 "mbe.position": 32,
826 "mbe.pp": "pre",
827 "mbe.time1": 30,
828 "mbe.time2": 60,
829 "mbe.time3": 120,
830 "mbe.time4": 150,
831 "mbe.time5": 240,
665832 "midi_out.beat_detector.atack_gain": 5,
666833 "midi_out.beat_detector.beat_gain": 1,
667834 "midi_out.beat_detector.midi_gain": 1,
698865 "moog.fr": 3108.8,
699866 "moog.on_off": 0,
700867 "moog.position": 0,
701 "noise_gate.on_off": 1,
702 "noise_gate.threshold": 0.097,
868 "noise_gate.on_off": 0,
869 "noise_gate.threshold": 0.148,
703870 "oscilloscope.on_off": 0,
704871 "oscilloscope.position": 11,
705872 "oscilloscope.pp": "post",
726893 "phaser_mono.position": 18,
727894 "phaser_mono.pp": "post",
728895 "phaser_mono.wet_dry": 100,
729 "pre.Level": 1,
730 "pre.bass": 0,
896 "pre.Level": 0.43,
897 "pre.bass": 1,
731898 "pre.on_off": 0,
732 "pre.position": 25,
899 "pre.position": 3,
733900 "pre.pp": "post",
734 "pre.select": "AC30",
901 "pre.select": "Mesa Boogie",
735902 "pre.treble": 0,
736903 "shaper.on_off": 0,
737904 "shaper.sharper": 10,
791958 "ui.crybaby": 0,
792959 "ui.delay": 0,
793960 "ui.echo": 0,
961 "ui.eq": 0,
794962 "ui.eqs": 1,
795 "ui.expander": 0,
963 "ui.expander": 1,
796964 "ui.feedback": 0,
797965 "ui.flanger": 0,
798966 "ui.flanger_mono": 0,
803971 "ui.jconv": 0,
804972 "ui.jconv_mono": 0,
805973 "ui.low_highpass": 0,
974 "ui.mbc": 0,
975 "ui.mbcs": 0,
806976 "ui.midi_out": 0,
807977 "ui.moog": 0,
808978 "ui.oscilloscope": 0,
809979 "ui.overdrive": 0,
810980 "ui.phaser": 0,
811981 "ui.phaser_mono": 0,
812 "ui.pre": 0,
982 "ui.pre": 1,
813983 "ui.stereodelay": 0,
814984 "ui.stereoecho": 0,
815985 "ui.stereoverb": 0,
8521022 "zita_rev1.position": 8
8531023 }
8541024 },
1025 "OverSharp", {
1026 "engine": {
1027 "AC-15.position": 1,
1028 "AC-15.pp": "pre",
1029 "AC-30.position": 1,
1030 "AC-30.pp": "pre",
1031 "Ampeg.position": 1,
1032 "Ampeg.pp": "pre",
1033 "Bassman.position": 1,
1034 "Bassman.pp": "pre",
1035 "Deville.position": 1,
1036 "Deville.pp": "pre",
1037 "Engl.position": 1,
1038 "Engl.pp": "pre",
1039 "Fender.position": 1,
1040 "Fender.pp": "pre",
1041 "Gibsen.position": 1,
1042 "Gibsen.pp": "pre",
1043 "Hughes&Kettner.position": 1,
1044 "Hughes&Kettner.pp": "pre",
1045 "IR.auto_freq": "manual",
1046 "IR.bandwidth": 100,
1047 "IR.freq": 440,
1048 "IR.on_off": 0,
1049 "IR.peak": 1,
1050 "IR.position": 6,
1051 "IR.pp": "post",
1052 "Ibanez.position": 1,
1053 "Ibanez.pp": "pre",
1054 "JCM-2000.position": 1,
1055 "JCM-2000.pp": "pre",
1056 "JCM-800.position": 1,
1057 "JCM-800.pp": "pre",
1058 "JTM-45.position": 1,
1059 "JTM-45.pp": "pre",
1060 "Junior.position": 1,
1061 "Junior.pp": "pre",
1062 "M-Lead.position": 1,
1063 "M-Lead.pp": "pre",
1064 "M2199.position": 1,
1065 "M2199.pp": "pre",
1066 "MIG 100 H.position": 1,
1067 "MIG 100 H.pp": "pre",
1068 "Mesa Boogie.position": 1,
1069 "Mesa Boogie.pp": "pre",
1070 "Peavey.position": 1,
1071 "Peavey.pp": "pre",
1072 "Princeton.position": 1,
1073 "Princeton.pp": "pre",
1074 "Roland.position": 1,
1075 "Roland.pp": "pre",
1076 "SOL 100.position": 1,
1077 "SOL 100.pp": "pre",
1078 "Trio Preamp.position": 1,
1079 "Trio Preamp.pp": "pre",
1080 "Triple Giant.position": 1,
1081 "Triple Giant.pp": "pre",
1082 "Twin Reverb.position": 1,
1083 "Twin Reverb.pp": "pre",
1084 "abgate.attack": 4,
1085 "abgate.decay": 50,
1086 "abgate.gaterange": -30,
1087 "abgate.hold": 5,
1088 "abgate.on_off": 0,
1089 "abgate.position": 26,
1090 "abgate.pp": "post",
1091 "abgate.threshold": -70,
1092 "amp.balance": 0,
1093 "amp.bass_boost.on_off": 0,
1094 "amp.clip.on_off": 0,
1095 "amp.feed_on_off": 0,
1096 "amp.fuzz": 0,
1097 "amp.on_off": 0,
1098 "amp.out_amp": 3.76,
1099 "amp.out_master": -15.17,
1100 "amp.tonestack.Bass": 0.5,
1101 "amp.tonestack.Middle": 0.5,
1102 "amp.tonestack.Treble": 0.755843,
1103 "amp.tonestack.on_off": 0,
1104 "amp.tonestack.position": 2,
1105 "amp.tonestack.pp": "post",
1106 "amp.tonestack.select": "Bassman",
1107 "amp.wet_dry": -0.82,
1108 "amp2.stage1.Pregain": 0,
1109 "amp2.stage2.gain1": 14,
1110 "ampmodul.amp2.stage1.tube1": 6,
1111 "ampmodul.amp2.stage2.tube2": 6,
1112 "ampmodul.feedbac": 0,
1113 "ampmodul.feedback": 0,
1114 "ampmodul.level": -20,
1115 "ampmodul.on_off": 0,
1116 "ampmodul.position": 5,
1117 "ampmodul.wet_dry": 0,
1118 "auto.position": 1,
1119 "auto.pp": "pre",
1120 "bassbooster.Level": 9.415,
1121 "biquad.Freq": 1200,
1122 "biquad.on_off": 0,
1123 "biquad.position": 12,
1124 "biquad.pp": "post",
1125 "cab.Level": 2.18418,
1126 "cab.bass": 0,
1127 "cab.on_off": 0,
1128 "cab.position": 3,
1129 "cab.pp": "post",
1130 "cab.select": "AC-30",
1131 "cab.treble": 2.00034,
1132 "chorus.delay": 0.02,
1133 "chorus.depth": 0.02,
1134 "chorus.freq": 3,
1135 "chorus.level": 0.5,
1136 "chorus.on_off": 1,
1137 "chorus.position": 0,
1138 "chorus_mono.freq": 2,
1139 "chorus_mono.level": 0.5,
1140 "chorus_mono.on_off": 0,
1141 "chorus_mono.position": 15,
1142 "chorus_mono.pp": "post",
1143 "chorus_mono.wet_dry": 100,
1144 "compressor.attack": 0.002,
1145 "compressor.knee": 3,
1146 "compressor.on_off": 1,
1147 "compressor.position": 0,
1148 "compressor.pp": "pre",
1149 "compressor.ratio": 2,
1150 "compressor.release": 0.5,
1151 "compressor.threshold": -20,
1152 "con.Level": 4.955,
1153 "con.on_off": 1,
1154 "crybaby.autowah": "manual",
1155 "crybaby.level": 0.1,
1156 "crybaby.on_off": 0,
1157 "crybaby.position": 4,
1158 "crybaby.pp": "post",
1159 "crybaby.wah": 0,
1160 "crybaby.wet_dry": 100,
1161 "default.position": 1,
1162 "default.pp": "pre",
1163 "delay.delay": 0,
1164 "delay.gain": 0,
1165 "delay.on_off": 0,
1166 "delay.position": 6,
1167 "delay.pp": "post",
1168 "dide.bpm": 120,
1169 "dide.feedback": 50,
1170 "dide.gain": 100,
1171 "dide.highpass": 120,
1172 "dide.howpass": 12000,
1173 "dide.level": 50,
1174 "dide.mode": "plain",
1175 "dide.notes": "1/4 note",
1176 "dide.on_off": 0,
1177 "dide.position": 24,
1178 "dide.pp": "pre",
1179 "didest.bpm": 134,
1180 "didest.feedback": 49.5,
1181 "didest.gain": 35,
1182 "didest.highpass": 120,
1183 "didest.howpass": 12000,
1184 "didest.level": 49.5,
1185 "didest.mode": "plain",
1186 "didest.notes": "1/4 note",
1187 "didest.on_off": 0,
1188 "didest.position": 2,
1189 "echo.on_off": 0,
1190 "echo.percent": 0,
1191 "echo.position": 9,
1192 "echo.pp": "post",
1193 "echo.time": 1,
1194 "eq.bandwidth1": 41,
1195 "eq.bandwidth2": 220,
1196 "eq.bandwidth3": 880,
1197 "eq.bandwidth4": 1760,
1198 "eq.level1": 0,
1199 "eq.level2": 0,
1200 "eq.level3": 0,
1201 "eq.level4": 0,
1202 "eq.on_off": 0,
1203 "eq.peak1": 110,
1204 "eq.peak2": 440,
1205 "eq.peak3": 1760,
1206 "eq.peak4": 3520,
1207 "eq.position": 23,
1208 "eq.pp": "pre",
1209 "eqs.Qs125": 50,
1210 "eqs.Qs16k": 50,
1211 "eqs.Qs1k": 50,
1212 "eqs.Qs250": 50,
1213 "eqs.Qs2k": 50,
1214 "eqs.Qs31_25": 50,
1215 "eqs.Qs4k": 50,
1216 "eqs.Qs500": 50,
1217 "eqs.Qs62_5": 50,
1218 "eqs.Qs8k": 50,
1219 "eqs.freq125": 125,
1220 "eqs.freq16k": 16000,
1221 "eqs.freq1k": 1000,
1222 "eqs.freq250": 250,
1223 "eqs.freq2k": 2000,
1224 "eqs.freq31_25": 31,
1225 "eqs.freq4k": 4000,
1226 "eqs.freq500": 500,
1227 "eqs.freq62_5": 62,
1228 "eqs.freq8k": 8000,
1229 "eqs.fs125": 0,
1230 "eqs.fs16k": 0,
1231 "eqs.fs1k": 0,
1232 "eqs.fs250": 0,
1233 "eqs.fs2k": 0,
1234 "eqs.fs31_25": 0,
1235 "eqs.fs4k": 0,
1236 "eqs.fs500": 0,
1237 "eqs.fs62_5": 0,
1238 "eqs.fs8k": 0,
1239 "eqs.on_off": 0,
1240 "eqs.position": 5,
1241 "eqs.pp": "post",
1242 "expander.attack": 0.001,
1243 "expander.knee": 3,
1244 "expander.on_off": 0,
1245 "expander.position": 4,
1246 "expander.pp": "post",
1247 "expander.ratio": 2,
1248 "expander.release": 0.1,
1249 "expander.threshold": -40,
1250 "feedback.feedback": 0,
1251 "feedback.on_off": 0,
1252 "feedback.position": 13,
1253 "feedback.pp": "post",
1254 "feedback.wet_dry": 100,
1255 "flanger.LFO freq": 0.2,
1256 "flanger.depth": 1,
1257 "flanger.feedback gain": 0,
1258 "flanger.flange delay": 10,
1259 "flanger.flange delay offset": 1,
1260 "flanger.invert": "linear",
1261 "flanger.level": 0,
1262 "flanger.on_off": 0,
1263 "flanger.position": 0,
1264 "flanger_mono.freq": 0.2,
1265 "flanger_mono.level": 0,
1266 "flanger_mono.on_off": 0,
1267 "flanger_mono.position": 15,
1268 "flanger_mono.pp": "post",
1269 "flanger_mono.wet_dry": 100,
1270 "flanger_mono_gx.depth": 0.5,
1271 "flanger_mono_gx.feedback": -0.707,
1272 "flanger_mono_gx.freq": 0.2,
1273 "flanger_mono_gx.mix": 0,
1274 "flanger_mono_gx.on_off": 0,
1275 "flanger_mono_gx.position": 21,
1276 "flanger_mono_gx.pp": "post",
1277 "flanger_mono_gx.wet": 100,
1278 "flanger_mono_gx.width": 5,
1279 "freeverb.RoomSize": 0.5,
1280 "freeverb.damp": 0.5,
1281 "freeverb.on_off": 0,
1282 "freeverb.position": 3,
1283 "freeverb.pp": "post",
1284 "freeverb.wet_dry": 100,
1285 "gx_distortion.drive": 1,
1286 "gx_distortion.gain": 2.2,
1287 "gx_distortion.high_drive": 1,
1288 "gx_distortion.high_gain": 10,
1289 "gx_distortion.level": 0.01,
1290 "gx_distortion.low_drive": 1,
1291 "gx_distortion.low_gain": 10,
1292 "gx_distortion.middle_h_drive": 1,
1293 "gx_distortion.middle_h_gain": 10,
1294 "gx_distortion.middle_l_drive": 1,
1295 "gx_distortion.middle_l_gain": 10,
1296 "gx_distortion.on_off": 1,
1297 "gx_distortion.position": 1,
1298 "gx_distortion.pp": "post",
1299 "gx_distortion.resonator.on_off": 1,
1300 "gx_distortion.split_high_freq": 1250,
1301 "gx_distortion.split_low_freq": 250,
1302 "gx_distortion.split_middle_freq": 650,
1303 "gx_distortion.trigger": 0,
1304 "gx_distortion.vibrato": 1,
1305 "gx_distortion.wet_dry": 100,
1306 "gxdistortion.drive": 0,
1307 "gxdistortion.wet_dry": 0,
1308 "highbooster.Level": 0.5,
1309 "highbooster.on_off": 0,
1310 "highbooster.position": 2,
1311 "highbooster.pp": "post",
1312 "jconv.balance": 0,
1313 "jconv.convolver": {
1314 "jconv.IRFile": "greathall.wav",
1315 "jconv.IRDir": "%S",
1316 "jconv.Gain": 0.598717,
1317 "jconv.GainCor": 1,
1318 "jconv.Offset": 0,
1319 "jconv.Length": 112561,
1320 "jconv.Delay": 0,
1321 "jconv.gainline": [[0, 0], [112560, 0]]
1322 },
1323 "jconv.diff_delay": 0,
1324 "jconv.gain": -8.52482,
1325 "jconv.on_off": 0,
1326 "jconv.position": 0,
1327 "jconv.wet_dry": 100,
1328 "jconv_mono.convolver": {
1329 "jconv.IRFile": "greathall.wav",
1330 "jconv.IRDir": "%S",
1331 "jconv.Gain": 0.598717,
1332 "jconv.GainCor": 1,
1333 "jconv.Offset": 0,
1334 "jconv.Length": 112561,
1335 "jconv.Delay": 0,
1336 "jconv.gainline": [[0, 0], [112560, 0]]
1337 },
1338 "jconv_mono.gain": 0,
1339 "jconv_mono.on_off": 0,
1340 "jconv_mono.position": 13,
1341 "jconv_mono.pp": "post",
1342 "jconv_mono.wet_dry": 100,
1343 "low_high_pass.lhc.high_freq": 5000,
1344 "low_high_pass.lhc.low_freq": 130,
1345 "low_high_pass.lhc.on_off": 0,
1346 "low_high_pass.lhp.high_freq": 130,
1347 "low_high_pass.lhp.low_freq": 5000,
1348 "low_high_pass.lhp.on_off": 0,
1349 "low_highpass.on_off": 0,
1350 "low_highpass.position": 1,
1351 "low_highpass.pp": "post",
1352 "manual.position": 1,
1353 "manual.pp": "pre",
1354 "mbc.Attack1": 0.012,
1355 "mbc.Attack2": 0.012,
1356 "mbc.Attack3": 0.012,
1357 "mbc.Attack4": 0.012,
1358 "mbc.Attack5": 0.012,
1359 "mbc.Makeup-Threshold1": 2,
1360 "mbc.Makeup-Threshold2": 2,
1361 "mbc.Makeup-Threshold3": 2,
1362 "mbc.Makeup-Threshold4": 2,
1363 "mbc.Makeup-Threshold5": 2,
1364 "mbc.Makeup1": 13,
1365 "mbc.Makeup2": 10,
1366 "mbc.Makeup3": 4,
1367 "mbc.Makeup4": 8,
1368 "mbc.Makeup5": 11,
1369 "mbc.Mode1": "Compress",
1370 "mbc.Mode2": "Compress",
1371 "mbc.Mode3": "Compress",
1372 "mbc.Mode4": "Compress",
1373 "mbc.Mode5": "Compress",
1374 "mbc.Ratio1": 2,
1375 "mbc.Ratio2": 2,
1376 "mbc.Ratio3": 2,
1377 "mbc.Ratio4": 2,
1378 "mbc.Ratio5": 2,
1379 "mbc.Release1": 1.25,
1380 "mbc.Release2": 1.25,
1381 "mbc.Release3": 1.25,
1382 "mbc.Release4": 1.25,
1383 "mbc.Release5": 1.25,
1384 "mbc.crossover_b1_b2": 80,
1385 "mbc.crossover_b2_b3": 210,
1386 "mbc.crossover_b3_b4": 1700,
1387 "mbc.crossover_b4_b5": 5000,
1388 "mbc.on_off": 0,
1389 "mbc.position": 30,
1390 "mbc.pp": "pre",
1391 "mbchor.crossover_b1_b2": 80,
1392 "mbchor.crossover_b2_b3": 210,
1393 "mbchor.crossover_b3_b4": 1700,
1394 "mbchor.crossover_b4_b5": 5000,
1395 "mbchor.delay1": 0.02,
1396 "mbchor.delay2": 0.04,
1397 "mbchor.delay3": 0.06,
1398 "mbchor.delay4": 0.08,
1399 "mbchor.delay5": 0.1,
1400 "mbchor.depth1": 0.02,
1401 "mbchor.depth2": 0.04,
1402 "mbchor.depth3": 0.06,
1403 "mbchor.depth4": 0.08,
1404 "mbchor.depth5": 0.1,
1405 "mbchor.freq1": 30,
1406 "mbchor.freq2": 60,
1407 "mbchor.freq3": 90,
1408 "mbchor.freq4": 120,
1409 "mbchor.freq5": 150,
1410 "mbchor.level1": 0.5,
1411 "mbchor.level2": 0.5,
1412 "mbchor.level3": 0.5,
1413 "mbchor.level4": 0.5,
1414 "mbchor.level5": 0.5,
1415 "mbchor.on_off": 0,
1416 "mbchor.position": 34,
1417 "mbchor.pp": "pre",
1418 "mbcs.Attack1": 0.012,
1419 "mbcs.Attack2": 0.012,
1420 "mbcs.Attack3": 0.012,
1421 "mbcs.Attack4": 0.012,
1422 "mbcs.Attack5": 0.012,
1423 "mbcs.Makeup-Threshold1": 2,
1424 "mbcs.Makeup-Threshold2": 2,
1425 "mbcs.Makeup-Threshold3": 2,
1426 "mbcs.Makeup-Threshold4": 2,
1427 "mbcs.Makeup-Threshold5": 2,
1428 "mbcs.Makeup1": 13,
1429 "mbcs.Makeup2": 10,
1430 "mbcs.Makeup3": 4,
1431 "mbcs.Makeup4": 8,
1432 "mbcs.Makeup5": 11,
1433 "mbcs.Mode1": "Compress",
1434 "mbcs.Mode2": "Compress",
1435 "mbcs.Mode3": "Compress",
1436 "mbcs.Mode4": "Compress",
1437 "mbcs.Mode5": "Compress",
1438 "mbcs.Ratio1": 2,
1439 "mbcs.Ratio2": 2,
1440 "mbcs.Ratio3": 2,
1441 "mbcs.Ratio4": 2,
1442 "mbcs.Ratio5": 2,
1443 "mbcs.Release1": 1.25,
1444 "mbcs.Release2": 1.25,
1445 "mbcs.Release3": 1.25,
1446 "mbcs.Release4": 1.25,
1447 "mbcs.Release5": 1.25,
1448 "mbcs.crossover_b1_b2": 80,
1449 "mbcs.crossover_b2_b3": 210,
1450 "mbcs.crossover_b3_b4": 1700,
1451 "mbcs.crossover_b4_b5": 5000,
1452 "mbcs.on_off": 0,
1453 "mbcs.position": 14,
1454 "mbd.Drive1": 0,
1455 "mbd.Drive2": 0,
1456 "mbd.Drive3": 0,
1457 "mbd.Drive4": 0,
1458 "mbd.Drive5": 0,
1459 "mbd.Gain": 0,
1460 "mbd.Offset1": 0,
1461 "mbd.Offset2": 0,
1462 "mbd.Offset3": 0,
1463 "mbd.Offset4": 0,
1464 "mbd.Offset5": 0,
1465 "mbd.crossover_b1_b2": 80,
1466 "mbd.crossover_b2_b3": 210,
1467 "mbd.crossover_b3_b4": 1700,
1468 "mbd.crossover_b4_b5": 5000,
1469 "mbd.on_off": 0,
1470 "mbd.position": 31,
1471 "mbd.pp": "pre",
1472 "mbdel.crossover_b1_b2": 80,
1473 "mbdel.crossover_b2_b3": 210,
1474 "mbdel.crossover_b3_b4": 1700,
1475 "mbdel.crossover_b4_b5": 5000,
1476 "mbdel.delay1": 30,
1477 "mbdel.delay2": 60,
1478 "mbdel.delay3": 90,
1479 "mbdel.delay4": 120,
1480 "mbdel.delay5": 150,
1481 "mbdel.gain1": -10,
1482 "mbdel.gain2": -5,
1483 "mbdel.gain3": -2,
1484 "mbdel.gain4": 0,
1485 "mbdel.gain5": -10,
1486 "mbdel.on_off": 0,
1487 "mbdel.position": 33,
1488 "mbdel.pp": "pre",
1489 "mbe.crossover_b1_b2": 80,
1490 "mbe.crossover_b2_b3": 210,
1491 "mbe.crossover_b3_b4": 1700,
1492 "mbe.crossover_b4_b5": 5000,
1493 "mbe.on_off": 0,
1494 "mbe.percent1": 10,
1495 "mbe.percent2": 30,
1496 "mbe.percent3": 45,
1497 "mbe.percent4": 20,
1498 "mbe.percent5": 0,
1499 "mbe.position": 32,
1500 "mbe.pp": "pre",
1501 "mbe.time1": 30,
1502 "mbe.time2": 60,
1503 "mbe.time3": 120,
1504 "mbe.time4": 150,
1505 "mbe.time5": 240,
1506 "midi_out.beat_detector.atack_gain": 5,
1507 "midi_out.beat_detector.beat_gain": 1,
1508 "midi_out.beat_detector.midi_gain": 1,
1509 "midi_out.beat_detector.note_off": 2,
1510 "midi_out.beat_detector.stepper": 1,
1511 "midi_out.channel_1.auto_pitch": 0,
1512 "midi_out.channel_1.autogain": 0,
1513 "midi_out.channel_1.channel": 0,
1514 "midi_out.channel_1.oktave": 0,
1515 "midi_out.channel_1.program": 0,
1516 "midi_out.channel_1.sensity": 20,
1517 "midi_out.channel_1.velocity": 64,
1518 "midi_out.channel_1.volume": 64,
1519 "midi_out.channel_2.auto_pitch": 0,
1520 "midi_out.channel_2.autogain": 0,
1521 "midi_out.channel_2.channel": 0,
1522 "midi_out.channel_2.oktave": 0,
1523 "midi_out.channel_2.on_off": 0,
1524 "midi_out.channel_2.program": 0,
1525 "midi_out.channel_2.sensity": 20,
1526 "midi_out.channel_2.velocity": 64,
1527 "midi_out.channel_2.volume": 64,
1528 "midi_out.channel_3.auto_pitch": 0,
1529 "midi_out.channel_3.autogain": 0,
1530 "midi_out.channel_3.channel": 0,
1531 "midi_out.channel_3.oktave": 0,
1532 "midi_out.channel_3.on_off": 0,
1533 "midi_out.channel_3.program": 0,
1534 "midi_out.channel_3.sensity": 20,
1535 "midi_out.channel_3.velocity": 64,
1536 "midi_out.channel_3.volume": 64,
1537 "midi_out.on_off": 0,
1538 "moog.Q": 1,
1539 "moog.fr": 3000,
1540 "moog.on_off": 0,
1541 "moog.position": 4,
1542 "noise_gate.on_off": 1,
1543 "noise_gate.threshold": 0.154,
1544 "oscilloscope.on_off": 0,
1545 "oscilloscope.position": 11,
1546 "oscilloscope.pp": "post",
1547 "overdrive.drive": 1,
1548 "overdrive.on_off": 0,
1549 "overdrive.position": 3,
1550 "overdrive.pp": "post",
1551 "overdrive.wet_dry": 100,
1552 "phaser.MaxNotch1Freq": 800,
1553 "phaser.MinNotch1Freq": 100,
1554 "phaser.Notch width": 1000,
1555 "phaser.NotchFreq": 1.5,
1556 "phaser.Speed": 0.5,
1557 "phaser.VibratoMode": "direct ",
1558 "phaser.depth": 1,
1559 "phaser.feedback gain": 0,
1560 "phaser.invert": "linear",
1561 "phaser.level": 0,
1562 "phaser.on_off": 0,
1563 "phaser.position": 1,
1564 "phaser_mono.Speed": 0.5,
1565 "phaser_mono.level": 0,
1566 "phaser_mono.on_off": 0,
1567 "phaser_mono.position": 14,
1568 "phaser_mono.pp": "post",
1569 "phaser_mono.wet_dry": 100,
1570 "pre.Level": 1,
1571 "pre.bass": 0,
1572 "pre.on_off": 0,
1573 "pre.position": 6,
1574 "pre.pp": "post",
1575 "pre.select": "AC30",
1576 "pre.treble": 0,
1577 "rev_rocket.position": 1,
1578 "rev_rocket.pp": "pre",
1579 "shaper.on_off": 0,
1580 "shaper.sharper": 1,
1581 "stereodelay.LFO freq": 0.2,
1582 "stereodelay.invert": "linear",
1583 "stereodelay.l_delay": 0,
1584 "stereodelay.l_gain": 0,
1585 "stereodelay.on_off": 0,
1586 "stereodelay.position": 1,
1587 "stereodelay.r_delay": 0,
1588 "stereodelay.r_gain": 0,
1589 "stereoecho.LFO freq": 0.2,
1590 "stereoecho.invert": "linear",
1591 "stereoecho.on_off": 0,
1592 "stereoecho.percent_l": 0,
1593 "stereoecho.percent_r": 0,
1594 "stereoecho.position": 3,
1595 "stereoecho.time_l": 1,
1596 "stereoecho.time_r": 1,
1597 "stereoverb.LFO freq": 0.2,
1598 "stereoverb.RoomSize": 0.172676,
1599 "stereoverb.damp": 0.5,
1600 "stereoverb.invert": "linear",
1601 "stereoverb.on_off": 0,
1602 "stereoverb.position": 10,
1603 "stereoverb.wet_dry": 40.3238,
1604 "tonemodul.Bass": 0,
1605 "tonemodul.Middle": 0,
1606 "tonemodul.ON": 0,
1607 "tonemodul.Treble": 0,
1608 "tonemodul.on_off": 0,
1609 "tonemodul.position": 3,
1610 "tonemodul.sharper": 1,
1611 "tremolo.SINE": "triangle",
1612 "tremolo.depth": 0.5,
1613 "tremolo.freq": 5,
1614 "tremolo.on_off": 0,
1615 "tremolo.position": 14,
1616 "tremolo.pp": "post",
1617 "tremolo.wet_dry": 100,
1618 "ts9sim.drive": 0.5,
1619 "ts9sim.level": -16,
1620 "ts9sim.on_off": 0,
1621 "ts9sim.position": 7,
1622 "ts9sim.pp": "post",
1623 "ts9sim.tone": 400,
1624 "tube.select": "pre 12AU7/ push-pull 6V6",
1625 "ui.IR": 0,
1626 "ui.abgate": 0,
1627 "ui.amp.tonestack": 0,
1628 "ui.ampmodul": 0,
1629 "ui.biquad": 0,
1630 "ui.cab": 0,
1631 "ui.chorus": 1,
1632 "ui.chorus_mono": 0,
1633 "ui.compressor": 1,
1634 "ui.crybaby": 0,
1635 "ui.delay": 0,
1636 "ui.dide": 0,
1637 "ui.didest": 1,
1638 "ui.echo": 0,
1639 "ui.eq": 0,
1640 "ui.eqs": 0,
1641 "ui.expander": 0,
1642 "ui.feedback": 0,
1643 "ui.flanger": 0,
1644 "ui.flanger_mono": 0,
1645 "ui.flanger_mono_gx": 0,
1646 "ui.freeverb": 0,
1647 "ui.gx_distortion": 1,
1648 "ui.highbooster": 0,
1649 "ui.jconv": 0,
1650 "ui.jconv_mono": 0,
1651 "ui.low_highpass": 0,
1652 "ui.mbc": 0,
1653 "ui.mbchor": 0,
1654 "ui.mbcs": 0,
1655 "ui.mbd": 0,
1656 "ui.mbdel": 0,
1657 "ui.mbe": 0,
1658 "ui.midi_out": 0,
1659 "ui.moog": 0,
1660 "ui.oscilloscope": 0,
1661 "ui.overdrive": 0,
1662 "ui.phaser": 0,
1663 "ui.phaser_mono": 0,
1664 "ui.pre": 0,
1665 "ui.stereodelay": 0,
1666 "ui.stereoecho": 0,
1667 "ui.stereoverb": 0,
1668 "ui.tonemodul": 0,
1669 "ui.tremolo": 0,
1670 "ui.ts9sim": 0,
1671 "ui.univibe": 0,
1672 "ui.univibe_mono": 0,
1673 "ui.zita_rev1": 1,
1674 "univibe.depth": 0.37,
1675 "univibe.fb": -0.6,
1676 "univibe.freq": 4.4,
1677 "univibe.lrcross": 0,
1678 "univibe.on_off": 0,
1679 "univibe.panning": 0,
1680 "univibe.position": 12,
1681 "univibe.stereo": 0.11,
1682 "univibe.wet_dry": 1,
1683 "univibe.width": 0.5,
1684 "univibe_mono.depth": 0.37,
1685 "univibe_mono.fb": -0.6,
1686 "univibe_mono.freq": 4.4,
1687 "univibe_mono.on_off": 0,
1688 "univibe_mono.position": 27,
1689 "univibe_mono.pp": "post",
1690 "univibe_mono.wet_dry": 1,
1691 "univibe_mono.width": 0.5,
1692 "zita_rev1.decay_times.hf_damping": 6000,
1693 "zita_rev1.decay_times.lf_x": 285.5,
1694 "zita_rev1.decay_times.low_rt60": 3,
1695 "zita_rev1.decay_times.mid_rt60": 2,
1696 "zita_rev1.equalizer1.eq1_freq": 315,
1697 "zita_rev1.equalizer1.eq1_level": 0,
1698 "zita_rev1.equalizer2.eq2_freq": 315,
1699 "zita_rev1.equalizer2.eq2_level": 0,
1700 "zita_rev1.input.in_delay": 60,
1701 "zita_rev1.on_off": 1,
1702 "zita_rev1.output.dry_wet_mix": -0.109179,
1703 "zita_rev1.output.level": 6.34781,
1704 "zita_rev1.position": 1
1705 }
1706 },
8551707 "Chorus Clean", {
8561708 "engine": {
8571709 "IR.auto_freq": "manual",
8701722 "abgate.pp": "post",
8711723 "abgate.threshold": -70,
8721724 "amp.balance": 0,
873 "amp.bass_boost.on_off": 0,
1725 "amp.bass_boost.on_off": 1,
8741726 "amp.clip.on_off": 0,
8751727 "amp.feed_on_off": 0,
8761728 "amp.fuzz": 0,
8861738 "amp.tonestack.select": "Princeton",
8871739 "amp.wet_dry": 0,
8881740 "amp2.stage1.Pregain": 3.97252e-16,
889 "amp2.stage2.gain1": 0.2,
1741 "amp2.stage2.gain1": 20,
8901742 "ampmodul.amp2.stage1.tube1": 6,
8911743 "ampmodul.amp2.stage2.tube2": 6,
8921744 "ampmodul.feedbac": 0,
8951747 "ampmodul.on_off": 0,
8961748 "ampmodul.position": 5,
8971749 "ampmodul.wet_dry": 0,
898 "bassbooster.Level": 10,
1750 "bassbooster.Level": 18.775,
8991751 "biquad.Freq": 718.5,
9001752 "biquad.on_off": 0,
9011753 "biquad.position": 8,
9021754 "biquad.pp": "post",
9031755 "cab.Level": 1,
9041756 "cab.bass": 0,
905 "cab.on_off": 1,
906 "cab.position": 6,
1757 "cab.on_off": 0,
1758 "cab.position": 3,
9071759 "cab.pp": "post",
9081760 "cab.select": "4x12",
9091761 "cab.treble": 10,
9211773 "chorus_mono.wet_dry": 100,
9221774 "compressor.attack": 0.002,
9231775 "compressor.knee": 3,
924 "compressor.on_off": 0,
925 "compressor.position": 3,
1776 "compressor.on_off": 1,
1777 "compressor.position": 1,
9261778 "compressor.pp": "post",
927 "compressor.ratio": 9.9807,
1779 "compressor.ratio": 2,
9281780 "compressor.release": 0.5,
929 "compressor.threshold": -8.99634,
1781 "compressor.threshold": -20,
9301782 "con.Level": 5,
931 "con.on_off": 1,
1783 "con.on_off": 0,
9321784 "crybaby.autowah": "manual",
9331785 "crybaby.level": 0.1,
9341786 "crybaby.on_off": 0,
9361788 "crybaby.pp": "post",
9371789 "crybaby.wah": 0,
9381790 "crybaby.wet_dry": 0,
939 "delay.delay": 0,
1791 "delay.delay": 50,
9401792 "delay.gain": 0,
9411793 "delay.on_off": 0,
942 "delay.position": 4,
943 "delay.pp": "post",
1794 "delay.position": 0,
1795 "delay.pp": "pre",
9441796 "echo.on_off": 0,
9451797 "echo.percent": 55,
9461798 "echo.position": 5,
9661818 "eqs.freq500": 500,
9671819 "eqs.freq62_5": 62,
9681820 "eqs.freq8k": 8000,
969 "eqs.fs125": 0,
1821 "eqs.fs125": -34.4,
9701822 "eqs.fs16k": 0,
971 "eqs.fs1k": -50,
972 "eqs.fs250": 0,
1823 "eqs.fs1k": -40,
1824 "eqs.fs250": -32,
9731825 "eqs.fs2k": 0,
9741826 "eqs.fs31_25": 0,
9751827 "eqs.fs4k": 0,
9761828 "eqs.fs500": 0,
977 "eqs.fs62_5": 0,
1829 "eqs.fs62_5": -40,
9781830 "eqs.fs8k": 0,
979 "eqs.on_off": 0,
980 "eqs.position": 9,
1831 "eqs.on_off": 1,
1832 "eqs.position": 4,
9811833 "eqs.pp": "post",
9821834 "expander.attack": 0.001,
9831835 "expander.knee": 3,
10181870 "flanger_mono_gx.width": 5,
10191871 "freeverb.RoomSize": 0.7,
10201872 "freeverb.damp": 0.65,
1021 "freeverb.on_off": 1,
1022 "freeverb.position": 5,
1873 "freeverb.on_off": 0,
1874 "freeverb.position": 2,
10231875 "freeverb.pp": "post",
10241876 "freeverb.wet_dry": 0.1,
10251877 "gx_distortion.drive": 0.64,
11562008 "pre.Level": 1,
11572009 "pre.bass": 0,
11582010 "pre.on_off": 0,
1159 "pre.position": 10,
2011 "pre.position": 5,
11602012 "pre.pp": "post",
11612013 "pre.select": "AC30",
11622014 "pre.treble": 0,
12142066 "ui.cab": 1,
12152067 "ui.chorus": 1,
12162068 "ui.chorus_mono": 0,
1217 "ui.compressor": 0,
2069 "ui.compressor": 1,
12182070 "ui.crybaby": 0,
1219 "ui.delay": 0,
2071 "ui.delay": 1,
12202072 "ui.echo": 0,
12212073 "ui.eqs": 1,
12222074 "ui.expander": 0,
12782130 "zita_rev1.output.level": 0,
12792131 "zita_rev1.position": 8
12802132 }
2133 },
2134 "King", {
2135 "engine": {
2136 "IR.auto_freq": "manual",
2137 "IR.bandwidth": 100,
2138 "IR.freq": 440,
2139 "IR.on_off": 0,
2140 "IR.peak": 1,
2141 "IR.position": 5,
2142 "IR.pp": "post",
2143 "abgate.attack": 4,
2144 "abgate.decay": 50,
2145 "abgate.gaterange": -30,
2146 "abgate.hold": 5,
2147 "abgate.on_off": 0,
2148 "abgate.position": 26,
2149 "abgate.pp": "post",
2150 "abgate.threshold": -70,
2151 "amp.balance": 0,
2152 "amp.bass_boost.on_off": 0,
2153 "amp.clip.on_off": 0,
2154 "amp.feed_on_off": 0,
2155 "amp.fuzz": 1.99,
2156 "amp.on_off": 1,
2157 "amp.out_amp": 4,
2158 "amp.out_master": 4,
2159 "amp.tonestack.Bass": 0.5,
2160 "amp.tonestack.Middle": 0.5,
2161 "amp.tonestack.Treble": 0.765,
2162 "amp.tonestack.on_off": 1,
2163 "amp.tonestack.position": 0,
2164 "amp.tonestack.pp": "pre",
2165 "amp.tonestack.select": "Bassman",
2166 "amp.wet_dry": -0.82,
2167 "amp2.stage1.Pregain": 6.64126,
2168 "amp2.stage2.gain1": 12.4,
2169 "ampmodul.amp2.stage1.tube1": 6,
2170 "ampmodul.amp2.stage2.tube2": 6,
2171 "ampmodul.feedbac": 0,
2172 "ampmodul.feedback": 0,
2173 "ampmodul.level": -20,
2174 "ampmodul.on_off": 0,
2175 "ampmodul.position": 7,
2176 "ampmodul.wet_dry": 0,
2177 "bassbooster.Level": 9.415,
2178 "biquad.Freq": 1200,
2179 "biquad.on_off": 0,
2180 "biquad.position": 13,
2181 "biquad.pp": "post",
2182 "cab.Level": 1.9625,
2183 "cab.bass": 0,
2184 "cab.on_off": 1,
2185 "cab.position": 2,
2186 "cab.pp": "post",
2187 "cab.select": "AC-30",
2188 "cab.treble": 2.00034,
2189 "chorus.delay": 0.02,
2190 "chorus.depth": 0.02,
2191 "chorus.freq": 3,
2192 "chorus.level": 0.5,
2193 "chorus.on_off": 0,
2194 "chorus.position": 1,
2195 "chorus_mono.freq": 2,
2196 "chorus_mono.level": 0.5,
2197 "chorus_mono.on_off": 0,
2198 "chorus_mono.position": 15,
2199 "chorus_mono.pp": "post",
2200 "chorus_mono.wet_dry": 100,
2201 "compressor.attack": 0,
2202 "compressor.knee": 20,
2203 "compressor.on_off": 1,
2204 "compressor.position": 4,
2205 "compressor.pp": "post",
2206 "compressor.ratio": 2.9,
2207 "compressor.release": 8.85,
2208 "compressor.threshold": -20.53,
2209 "con.Level": 4.955,
2210 "con.on_off": 1,
2211 "crybaby.autowah": "manual",
2212 "crybaby.level": 0.1,
2213 "crybaby.on_off": 0,
2214 "crybaby.position": 3,
2215 "crybaby.pp": "post",
2216 "crybaby.wah": 0,
2217 "crybaby.wet_dry": 100,
2218 "delay.delay": 0,
2219 "delay.gain": 0,
2220 "delay.on_off": 0,
2221 "delay.position": 9,
2222 "delay.pp": "post",
2223 "echo.on_off": 0,
2224 "echo.percent": 0,
2225 "echo.position": 8,
2226 "echo.pp": "post",
2227 "echo.time": 1,
2228 "eqs.Qs125": 50,
2229 "eqs.Qs16k": 50,
2230 "eqs.Qs1k": 50,
2231 "eqs.Qs250": 50,
2232 "eqs.Qs2k": 50,
2233 "eqs.Qs31_25": 50,
2234 "eqs.Qs4k": 50,
2235 "eqs.Qs500": 50,
2236 "eqs.Qs62_5": 50,
2237 "eqs.Qs8k": 50,
2238 "eqs.freq125": 125,
2239 "eqs.freq16k": 16000,
2240 "eqs.freq1k": 1000,
2241 "eqs.freq250": 250,
2242 "eqs.freq2k": 2000,
2243 "eqs.freq31_25": 31,
2244 "eqs.freq4k": 4000,
2245 "eqs.freq500": 500,
2246 "eqs.freq62_5": 62,
2247 "eqs.freq8k": 8000,
2248 "eqs.fs125": 0,
2249 "eqs.fs16k": 0,
2250 "eqs.fs1k": 0,
2251 "eqs.fs250": 0,
2252 "eqs.fs2k": 0,
2253 "eqs.fs31_25": 0,
2254 "eqs.fs4k": 0,
2255 "eqs.fs500": 0,
2256 "eqs.fs62_5": 0,
2257 "eqs.fs8k": 0,
2258 "eqs.on_off": 0,
2259 "eqs.position": 1,
2260 "eqs.pp": "post",
2261 "expander.attack": 0.001,
2262 "expander.knee": 3,
2263 "expander.on_off": 0,
2264 "expander.position": 9,
2265 "expander.pp": "post",
2266 "expander.ratio": 2,
2267 "expander.release": 0.1,
2268 "expander.threshold": -40,
2269 "feedback.feedback": 0,
2270 "feedback.on_off": 0,
2271 "feedback.position": 16,
2272 "feedback.pp": "post",
2273 "feedback.wet_dry": 100,
2274 "flanger.LFO freq": 0.2,
2275 "flanger.depth": 1,
2276 "flanger.feedback gain": 0,
2277 "flanger.flange delay": 10,
2278 "flanger.flange delay offset": 1,
2279 "flanger.invert": "linear",
2280 "flanger.level": 0,
2281 "flanger.on_off": 0,
2282 "flanger.position": 2,
2283 "flanger_mono.freq": 0.2,
2284 "flanger_mono.level": 0,
2285 "flanger_mono.on_off": 0,
2286 "flanger_mono.position": 15,
2287 "flanger_mono.pp": "post",
2288 "flanger_mono.wet_dry": 100,
2289 "flanger_mono_gx.depth": 0.5,
2290 "flanger_mono_gx.feedback": -0.707,
2291 "flanger_mono_gx.freq": 0.2,
2292 "flanger_mono_gx.mix": 0,
2293 "flanger_mono_gx.on_off": 0,
2294 "flanger_mono_gx.position": 21,
2295 "flanger_mono_gx.pp": "post",
2296 "flanger_mono_gx.wet": 100,
2297 "flanger_mono_gx.width": 5,
2298 "freeverb.RoomSize": 0.5,
2299 "freeverb.damp": 0.5,
2300 "freeverb.on_off": 0,
2301 "freeverb.position": 19,
2302 "freeverb.pp": "post",
2303 "freeverb.wet_dry": 100,
2304 "gx_distortion.drive": 0.64,
2305 "gx_distortion.gain": 2,
2306 "gx_distortion.high_drive": 1,
2307 "gx_distortion.high_gain": 10,
2308 "gx_distortion.level": 0.01,
2309 "gx_distortion.low_drive": 1,
2310 "gx_distortion.low_gain": 10,
2311 "gx_distortion.middle_h_drive": 1,
2312 "gx_distortion.middle_h_gain": 10,
2313 "gx_distortion.middle_l_drive": 1,
2314 "gx_distortion.middle_l_gain": 10,
2315 "gx_distortion.on_off": 0,
2316 "gx_distortion.position": 4,
2317 "gx_distortion.pp": "post",
2318 "gx_distortion.resonator.on_off": 0,
2319 "gx_distortion.split_high_freq": 1250,
2320 "gx_distortion.split_low_freq": 250,
2321 "gx_distortion.split_middle_freq": 650,
2322 "gx_distortion.trigger": 0.12,
2323 "gx_distortion.vibrato": 1,
2324 "gx_distortion.wet_dry": 100,
2325 "gxdistortion.drive": 1,
2326 "gxdistortion.wet_dry": 39.5,
2327 "highbooster.Level": 0.5,
2328 "highbooster.on_off": 0,
2329 "highbooster.position": 2,
2330 "highbooster.pp": "post",
2331 "jconv.balance": 0,
2332 "jconv.convolver": {
2333 "jconv.IRFile": "greathall.wav",
2334 "jconv.IRDir": "",
2335 "jconv.Gain": 0.598717,
2336 "jconv.GainCor": 1,
2337 "jconv.Offset": 0,
2338 "jconv.Length": 112561,
2339 "jconv.Delay": 0,
2340 "jconv.gainline": [[0, 0], [112560, 0]]
2341 },
2342 "jconv.diff_delay": 0,
2343 "jconv.gain": -8.52482,
2344 "jconv.on_off": 0,
2345 "jconv.position": 9,
2346 "jconv.wet_dry": 100,
2347 "jconv_mono.convolver": {
2348 "jconv.IRFile": "greathall.wav",
2349 "jconv.IRDir": "",
2350 "jconv.Gain": 0.598717,
2351 "jconv.GainCor": 1,
2352 "jconv.Offset": 0,
2353 "jconv.Length": 112561,
2354 "jconv.Delay": 0,
2355 "jconv.gainline": [[0, 0], [112560, 0]]
2356 },
2357 "jconv_mono.gain": 0,
2358 "jconv_mono.on_off": 0,
2359 "jconv_mono.position": 13,
2360 "jconv_mono.pp": "post",
2361 "jconv_mono.wet_dry": 100,
2362 "low_high_pass.lhc.high_freq": 5000,
2363 "low_high_pass.lhc.low_freq": 130,
2364 "low_high_pass.lhc.on_off": 0,
2365 "low_high_pass.lhp.high_freq": 130,
2366 "low_high_pass.lhp.low_freq": 5000,
2367 "low_high_pass.lhp.on_off": 0,
2368 "low_highpass.on_off": 0,
2369 "low_highpass.position": 1,
2370 "low_highpass.pp": "post",
2371 "midi_out.beat_detector.atack_gain": 5,
2372 "midi_out.beat_detector.beat_gain": 1,
2373 "midi_out.beat_detector.midi_gain": 1,
2374 "midi_out.beat_detector.note_off": 2,
2375 "midi_out.beat_detector.stepper": 1,
2376 "midi_out.channel_1.auto_pitch": 0,
2377 "midi_out.channel_1.autogain": 0,
2378 "midi_out.channel_1.channel": 0,
2379 "midi_out.channel_1.oktave": 0,
2380 "midi_out.channel_1.program": 0,
2381 "midi_out.channel_1.sensity": 20,
2382 "midi_out.channel_1.velocity": 64,
2383 "midi_out.channel_1.volume": 64,
2384 "midi_out.channel_2.auto_pitch": 0,
2385 "midi_out.channel_2.autogain": 0,
2386 "midi_out.channel_2.channel": 0,
2387 "midi_out.channel_2.oktave": 0,
2388 "midi_out.channel_2.on_off": 0,
2389 "midi_out.channel_2.program": 0,
2390 "midi_out.channel_2.sensity": 20,
2391 "midi_out.channel_2.velocity": 64,
2392 "midi_out.channel_2.volume": 64,
2393 "midi_out.channel_3.auto_pitch": 0,
2394 "midi_out.channel_3.autogain": 0,
2395 "midi_out.channel_3.channel": 0,
2396 "midi_out.channel_3.oktave": 0,
2397 "midi_out.channel_3.on_off": 0,
2398 "midi_out.channel_3.program": 0,
2399 "midi_out.channel_3.sensity": 20,
2400 "midi_out.channel_3.velocity": 64,
2401 "midi_out.channel_3.volume": 64,
2402 "midi_out.on_off": 0,
2403 "moog.Q": 1,
2404 "moog.fr": 3000,
2405 "moog.on_off": 0,
2406 "moog.position": 6,
2407 "noise_gate.on_off": 1,
2408 "noise_gate.threshold": 0.124,
2409 "oscilloscope.on_off": 0,
2410 "oscilloscope.position": 11,
2411 "oscilloscope.pp": "post",
2412 "overdrive.drive": 1,
2413 "overdrive.on_off": 0,
2414 "overdrive.position": 7,
2415 "overdrive.pp": "post",
2416 "overdrive.wet_dry": 100,
2417 "phaser.MaxNotch1Freq": 800,
2418 "phaser.MinNotch1Freq": 100,
2419 "phaser.Notch width": 1000,
2420 "phaser.NotchFreq": 1.5,
2421 "phaser.Speed": 0.5,
2422 "phaser.VibratoMode": "direct ",
2423 "phaser.depth": 1,
2424 "phaser.feedback gain": 0,
2425 "phaser.invert": "linear",
2426 "phaser.level": 0,
2427 "phaser.on_off": 0,
2428 "phaser.position": 3,
2429 "phaser_mono.Speed": 0.5,
2430 "phaser_mono.level": 0,
2431 "phaser_mono.on_off": 0,
2432 "phaser_mono.position": 14,
2433 "phaser_mono.pp": "post",
2434 "phaser_mono.wet_dry": 100,
2435 "pre.Level": 1,
2436 "pre.bass": 0,
2437 "pre.on_off": 0,
2438 "pre.position": 3,
2439 "pre.pp": "post",
2440 "pre.select": "AC30",
2441 "pre.treble": 0,
2442 "shaper.on_off": 0,
2443 "shaper.sharper": 1,
2444 "stereodelay.LFO freq": 0.2,
2445 "stereodelay.invert": "linear",
2446 "stereodelay.l_delay": 0,
2447 "stereodelay.l_gain": 0,
2448 "stereodelay.on_off": 0,
2449 "stereodelay.position": 4,
2450 "stereodelay.r_delay": 0,
2451 "stereodelay.r_gain": 0,
2452 "stereoecho.LFO freq": 0.2,
2453 "stereoecho.invert": "linear",
2454 "stereoecho.on_off": 0,
2455 "stereoecho.percent_l": 0,
2456 "stereoecho.percent_r": 0,
2457 "stereoecho.position": 5,
2458 "stereoecho.time_l": 1,
2459 "stereoecho.time_r": 1,
2460 "stereoverb.LFO freq": 0.2,
2461 "stereoverb.RoomSize": 0.172676,
2462 "stereoverb.damp": 0.5,
2463 "stereoverb.invert": "linear",
2464 "stereoverb.on_off": 0,
2465 "stereoverb.position": 10,
2466 "stereoverb.wet_dry": 40.3238,
2467 "tonemodul.Bass": 0,
2468 "tonemodul.Middle": 0,
2469 "tonemodul.ON": 0,
2470 "tonemodul.Treble": 0,
2471 "tonemodul.on_off": 0,
2472 "tonemodul.position": 8,
2473 "tonemodul.sharper": 1,
2474 "tremolo.SINE": "triangle",
2475 "tremolo.depth": 0.5,
2476 "tremolo.freq": 5,
2477 "tremolo.on_off": 0,
2478 "tremolo.position": 14,
2479 "tremolo.pp": "post",
2480 "tremolo.wet_dry": 100,
2481 "ts9sim.drive": 0.5,
2482 "ts9sim.level": -16,
2483 "ts9sim.on_off": 0,
2484 "ts9sim.position": 6,
2485 "ts9sim.pp": "post",
2486 "ts9sim.tone": 400,
2487 "tube.select": "pre 12AU7/ push-pull 6V6",
2488 "ui.IR": 0,
2489 "ui.abgate": 0,
2490 "ui.amp.tonestack": 1,
2491 "ui.ampmodul": 0,
2492 "ui.biquad": 0,
2493 "ui.cab": 1,
2494 "ui.chorus": 0,
2495 "ui.chorus_mono": 0,
2496 "ui.compressor": 1,
2497 "ui.crybaby": 0,
2498 "ui.delay": 0,
2499 "ui.echo": 0,
2500 "ui.eqs": 0,
2501 "ui.expander": 0,
2502 "ui.feedback": 0,
2503 "ui.flanger": 0,
2504 "ui.flanger_mono": 0,
2505 "ui.flanger_mono_gx": 0,
2506 "ui.freeverb": 0,
2507 "ui.gx_distortion": 0,
2508 "ui.highbooster": 0,
2509 "ui.jconv": 0,
2510 "ui.jconv_mono": 0,
2511 "ui.low_highpass": 0,
2512 "ui.midi_out": 0,
2513 "ui.moog": 0,
2514 "ui.oscilloscope": 0,
2515 "ui.overdrive": 0,
2516 "ui.phaser": 0,
2517 "ui.phaser_mono": 0,
2518 "ui.pre": 0,
2519 "ui.stereodelay": 0,
2520 "ui.stereoecho": 0,
2521 "ui.stereoverb": 0,
2522 "ui.tonemodul": 0,
2523 "ui.tremolo": 0,
2524 "ui.ts9sim": 0,
2525 "ui.univibe": 0,
2526 "ui.univibe_mono": 0,
2527 "ui.zita_rev1": 1,
2528 "univibe.depth": 0.37,
2529 "univibe.fb": -0.6,
2530 "univibe.freq": 4.4,
2531 "univibe.lrcross": 0,
2532 "univibe.on_off": 0,
2533 "univibe.panning": 0,
2534 "univibe.position": 12,
2535 "univibe.stereo": 0.11,
2536 "univibe.wet_dry": 1,
2537 "univibe.width": 0.5,
2538 "univibe_mono.depth": 0.37,
2539 "univibe_mono.fb": -0.6,
2540 "univibe_mono.freq": 4.4,
2541 "univibe_mono.on_off": 0,
2542 "univibe_mono.position": 27,
2543 "univibe_mono.pp": "post",
2544 "univibe_mono.wet_dry": 1,
2545 "univibe_mono.width": 0.5,
2546 "zita_rev1.decay_times.hf_damping": 6000,
2547 "zita_rev1.decay_times.lf_x": 285.5,
2548 "zita_rev1.decay_times.low_rt60": 3,
2549 "zita_rev1.decay_times.mid_rt60": 2,
2550 "zita_rev1.equalizer1.eq1_freq": 315,
2551 "zita_rev1.equalizer1.eq1_level": 0,
2552 "zita_rev1.equalizer2.eq2_freq": 315,
2553 "zita_rev1.equalizer2.eq2_level": 0,
2554 "zita_rev1.input.in_delay": 60,
2555 "zita_rev1.on_off": 1,
2556 "zita_rev1.output.dry_wet_mix": -0.109179,
2557 "zita_rev1.output.level": 6.34781,
2558 "zita_rev1.position": 11
2559 }
2560 },
2561 "Wild Metal", {
2562 "engine": {
2563 "AC-15.position": 1,
2564 "AC-15.pp": "pre",
2565 "AC-30.position": 1,
2566 "AC-30.pp": "pre",
2567 "Ampeg.position": 1,
2568 "Ampeg.pp": "pre",
2569 "Bassman.position": 1,
2570 "Bassman.pp": "pre",
2571 "Deville.position": 1,
2572 "Deville.pp": "pre",
2573 "Engl.position": 1,
2574 "Engl.pp": "pre",
2575 "Fender.position": 1,
2576 "Fender.pp": "pre",
2577 "GCB_95.hotpotz": 0.5,
2578 "GCB_95.on_off": 0,
2579 "GCB_95.position": 20,
2580 "GCB_95.pp": "post",
2581 "Gibsen.position": 1,
2582 "Gibsen.pp": "pre",
2583 "Hughes&Kettner.position": 1,
2584 "Hughes&Kettner.pp": "pre",
2585 "IR.auto_freq": "manual",
2586 "IR.bandwidth": 4495.6,
2587 "IR.freq": 499.2,
2588 "IR.on_off": 0,
2589 "IR.peak": 10,
2590 "IR.position": 8,
2591 "IR.pp": "post",
2592 "Ibanez.position": 1,
2593 "Ibanez.pp": "pre",
2594 "JCM-2000.position": 1,
2595 "JCM-2000.pp": "pre",
2596 "JCM-800.position": 1,
2597 "JCM-800.pp": "pre",
2598 "JCM800Pre.P6v": 0.5,
2599 "JCM800Pre.on_off": 0,
2600 "JCM800Pre.position": 14,
2601 "JCM800Pre.pp": "post",
2602 "JTM-45.position": 1,
2603 "JTM-45.pp": "pre",
2604 "Junior.position": 1,
2605 "Junior.pp": "pre",
2606 "M-Lead.position": 1,
2607 "M-Lead.pp": "pre",
2608 "M2199.position": 1,
2609 "M2199.pp": "pre",
2610 "MIG 100 H.position": 1,
2611 "MIG 100 H.pp": "pre",
2612 "Mesa Boogie.position": 1,
2613 "Mesa Boogie.pp": "pre",
2614 "Peavey.position": 1,
2615 "Peavey.pp": "pre",
2616 "Princeton.position": 1,
2617 "Princeton.pp": "pre",
2618 "Roland.position": 1,
2619 "Roland.pp": "pre",
2620 "SOL 100.position": 1,
2621 "SOL 100.pp": "pre",
2622 "Trio Preamp.position": 1,
2623 "Trio Preamp.pp": "pre",
2624 "Triple Giant.position": 1,
2625 "Triple Giant.pp": "pre",
2626 "Twin Reverb.position": 1,
2627 "Twin Reverb.pp": "pre",
2628 "abgate.attack": 4,
2629 "abgate.decay": 50,
2630 "abgate.gaterange": -30,
2631 "abgate.hold": 5,
2632 "abgate.on_off": 0,
2633 "abgate.position": 26,
2634 "abgate.pp": "post",
2635 "abgate.threshold": -70,
2636 "amp.balance": 0,
2637 "amp.bass_boost.on_off": 1,
2638 "amp.clip.on_off": 0,
2639 "amp.feed_on_off": 0,
2640 "amp.fuzz": 1.99,
2641 "amp.on_off": 0,
2642 "amp.out_amp": 4,
2643 "amp.out_master": -32.18,
2644 "amp.tonestack.Bass": 0.65,
2645 "amp.tonestack.Middle": 0.19,
2646 "amp.tonestack.Treble": 0.6,
2647 "amp.tonestack.on_off": 1,
2648 "amp.tonestack.position": 1,
2649 "amp.tonestack.pp": "pre",
2650 "amp.tonestack.select": "Fender",
2651 "amp.wet_dry": -0.82,
2652 "amp2.stage1.Pregain": 20,
2653 "amp2.stage2.gain1": 6.5,
2654 "ampmodul.amp2.stage1.tube1": -11.4,
2655 "ampmodul.amp2.stage2.tube2": 11.8,
2656 "ampmodul.feedbac": 0.55,
2657 "ampmodul.feedback": 0.11,
2658 "ampmodul.level": -26.2,
2659 "ampmodul.on_off": 1,
2660 "ampmodul.position": 0,
2661 "ampmodul.wet_dry": -0.8,
2662 "auto.position": 1,
2663 "auto.pp": "pre",
2664 "bassEnhancer.Frequency": 89.7001,
2665 "bassEnhancer.HarmonicsdB": 1.03999,
2666 "bassEnhancer.on_off": 0,
2667 "bassEnhancer.position": 5,
2668 "bassbooster.Level": 10,
2669 "biquad.Freq": 1200,
2670 "biquad.on_off": 0,
2671 "biquad.position": 18,
2672 "biquad.pp": "post",
2673 "cab.Level": 4.8,
2674 "cab.bass": 2.5,
2675 "cab.on_off": 1,
2676 "cab.position": 2,
2677 "cab.pp": "post",
2678 "cab.select": "Mesa Boogie",
2679 "cab.treble": 0.5,
2680 "chorus.delay": 0.02,
2681 "chorus.depth": 0.02,
2682 "chorus.freq": 3,
2683 "chorus.level": 0.5,
2684 "chorus.on_off": 0,
2685 "chorus.position": 1,
2686 "chorus_mono.freq": 2,
2687 "chorus_mono.level": 0.5,
2688 "chorus_mono.on_off": 0,
2689 "chorus_mono.position": 15,
2690 "chorus_mono.pp": "post",
2691 "chorus_mono.wet_dry": 100,
2692 "compressor.attack": 0,
2693 "compressor.knee": 20,
2694 "compressor.on_off": 0,
2695 "compressor.position": 3,
2696 "compressor.pp": "post",
2697 "compressor.ratio": 2.9,
2698 "compressor.release": 8.85,
2699 "compressor.threshold": -20.53,
2700 "con.Level": 4.955,
2701 "con.on_off": 0,
2702 "crybaby.autowah": "manual",
2703 "crybaby.level": 0.1,
2704 "crybaby.on_off": 0,
2705 "crybaby.position": 3,
2706 "crybaby.pp": "post",
2707 "crybaby.wah": 0,
2708 "crybaby.wet_dry": 100,
2709 "dattorros_progenitor.bandwidth": 0.9,
2710 "dattorros_progenitor.damping": 0.1,
2711 "dattorros_progenitor.decay": 0.1,
2712 "dattorros_progenitor.decay diff 1": 0.1,
2713 "dattorros_progenitor.decay diff 2": 0.1,
2714 "dattorros_progenitor.dry/wet": 0.5,
2715 "dattorros_progenitor.excursion": 0,
2716 "dattorros_progenitor.input diff 1": 0.1,
2717 "dattorros_progenitor.input diff 2": 0.1,
2718 "dattorros_progenitor.on_off": 0,
2719 "dattorros_progenitor.position": 16,
2720 "dattorros_progenitor.predelay ms": 0,
2721 "default.position": 1,
2722 "default.pp": "pre",
2723 "delay.delay": 0,
2724 "delay.gain": 0,
2725 "delay.on_off": 0,
2726 "delay.position": 5,
2727 "delay.pp": "post",
2728 "dide.bpm": 120,
2729 "dide.feedback": 50,
2730 "dide.gain": 100,
2731 "dide.highpass": 120,
2732 "dide.howpass": 12000,
2733 "dide.level": 50,
2734 "dide.mode": "plain",
2735 "dide.notes": "1/4 note",
2736 "dide.on_off": 0,
2737 "dide.position": 27,
2738 "dide.pp": "pre",
2739 "didest.bpm": 120,
2740 "didest.feedback": 50,
2741 "didest.gain": 100,
2742 "didest.highpass": 120,
2743 "didest.howpass": 12000,
2744 "didest.level": 50,
2745 "didest.mode": "plain",
2746 "didest.notes": "1/4 note",
2747 "didest.on_off": 0,
2748 "didest.position": 5,
2749 "dubber.clip1": 100,
2750 "dubber.clip2": 100,
2751 "dubber.clip3": 100,
2752 "dubber.clip4": 100,
2753 "dubber.clips1": 0,
2754 "dubber.clips2": 0,
2755 "dubber.clips3": 0,
2756 "dubber.clips4": 0,
2757 "dubber.filename": "tape",
2758 "dubber.gain": 0,
2759 "dubber.level1": 50,
2760 "dubber.level2": 50,
2761 "dubber.level3": 50,
2762 "dubber.level4": 50,
2763 "dubber.mix": 100,
2764 "dubber.on_off": 0,
2765 "dubber.play1": 0,
2766 "dubber.play2": 0,
2767 "dubber.play3": 0,
2768 "dubber.play4": 0,
2769 "dubber.position": 17,
2770 "dubber.pp": "post",
2771 "dubber.rec1": 0,
2772 "dubber.rec2": 0,
2773 "dubber.rec3": 0,
2774 "dubber.rec4": 0,
2775 "dubber.reset1": 0,
2776 "dubber.reset2": 0,
2777 "dubber.reset3": 0,
2778 "dubber.reset4": 0,
2779 "dubber.rplay1": 0,
2780 "dubber.rplay2": -0,
2781 "dubber.rplay3": 0,
2782 "dubber.rplay4": 0,
2783 "dubber.speed1": 0,
2784 "dubber.speed2": 0,
2785 "dubber.speed3": 0,
2786 "dubber.speed4": 0,
2787 "echo.on_off": 0,
2788 "echo.percent": 0,
2789 "echo.position": 8,
2790 "echo.pp": "post",
2791 "echo.time": 1,
2792 "eq.bandwidth1": 41,
2793 "eq.bandwidth2": 220,
2794 "eq.bandwidth3": 880,
2795 "eq.bandwidth4": 1760,
2796 "eq.level1": 0,
2797 "eq.level2": 0,
2798 "eq.level3": 0,
2799 "eq.level4": 0,
2800 "eq.on_off": 0,
2801 "eq.peak1": 110,
2802 "eq.peak2": 440,
2803 "eq.peak3": 1760,
2804 "eq.peak4": 3520,
2805 "eq.position": 7,
2806 "eq.pp": "post",
2807 "eqs.Qs125": 50,
2808 "eqs.Qs16k": 50,
2809 "eqs.Qs1k": 50,
2810 "eqs.Qs250": 50,
2811 "eqs.Qs2k": 50,
2812 "eqs.Qs31_25": 50,
2813 "eqs.Qs4k": 50,
2814 "eqs.Qs500": 50,
2815 "eqs.Qs62_5": 50,
2816 "eqs.Qs8k": 50,
2817 "eqs.freq125": 125,
2818 "eqs.freq16k": 16000,
2819 "eqs.freq1k": 1000,
2820 "eqs.freq250": 250,
2821 "eqs.freq2k": 2000,
2822 "eqs.freq31_25": 31,
2823 "eqs.freq4k": 4000,
2824 "eqs.freq500": 500,
2825 "eqs.freq62_5": 62,
2826 "eqs.freq8k": 8000,
2827 "eqs.fs125": 0,
2828 "eqs.fs16k": 0,
2829 "eqs.fs1k": 0,
2830 "eqs.fs250": 0,
2831 "eqs.fs2k": 0,
2832 "eqs.fs31_25": 0,
2833 "eqs.fs4k": 0,
2834 "eqs.fs500": 0,
2835 "eqs.fs62_5": 0,
2836 "eqs.fs8k": 0,
2837 "eqs.on_off": 0,
2838 "eqs.position": 6,
2839 "eqs.pp": "post",
2840 "expander.attack": 0.002,
2841 "expander.knee": 3,
2842 "expander.on_off": 1,
2843 "expander.position": 0,
2844 "expander.pp": "pre",
2845 "expander.ratio": 10.025,
2846 "expander.release": 0.2,
2847 "expander.threshold": -20,
2848 "feedback.feedback": 0,
2849 "feedback.on_off": 0,
2850 "feedback.position": 19,
2851 "feedback.pp": "post",
2852 "feedback.wet_dry": 100,
2853 "flanger.LFO freq": 0.2,
2854 "flanger.depth": 1,
2855 "flanger.feedback gain": 0,
2856 "flanger.flange delay": 10,
2857 "flanger.flange delay offset": 1,
2858 "flanger.invert": "linear",
2859 "flanger.level": 0,
2860 "flanger.on_off": 0,
2861 "flanger.position": 2,
2862 "flanger_mono.freq": 0.2,
2863 "flanger_mono.level": 0,
2864 "flanger_mono.on_off": 0,
2865 "flanger_mono.position": 15,
2866 "flanger_mono.pp": "post",
2867 "flanger_mono.wet_dry": 100,
2868 "flanger_mono_gx.depth": 0.5,
2869 "flanger_mono_gx.feedback": -0.707,
2870 "flanger_mono_gx.freq": 0.2,
2871 "flanger_mono_gx.mix": 0,
2872 "flanger_mono_gx.on_off": 0,
2873 "flanger_mono_gx.position": 21,
2874 "flanger_mono_gx.pp": "post",
2875 "flanger_mono_gx.wet": 100,
2876 "flanger_mono_gx.width": 5,
2877 "freeverb.RoomSize": 0.29,
2878 "freeverb.damp": 0.35,
2879 "freeverb.on_off": 0,
2880 "freeverb.position": 1,
2881 "freeverb.pp": "post",
2882 "freeverb.wet_dry": 38,
2883 "gain.gain": 0,
2884 "gain.on_off": 0,
2885 "gain.position": 4,
2886 "gain.pp": "post",
2887 "graphiceq.g1": 0,
2888 "graphiceq.g10": 0,
2889 "graphiceq.g11": 0,
2890 "graphiceq.g2": 0,
2891 "graphiceq.g3": 0,
2892 "graphiceq.g4": 0,
2893 "graphiceq.g5": 0,
2894 "graphiceq.g6": 0,
2895 "graphiceq.g7": 0,
2896 "graphiceq.g8": 0,
2897 "graphiceq.g9": 0,
2898 "graphiceq.on_off": 0,
2899 "graphiceq.position": 10,
2900 "graphiceq.pp": "post",
2901 "gx_distortion.drive": 0.64,
2902 "gx_distortion.gain": 2,
2903 "gx_distortion.high_drive": 1,
2904 "gx_distortion.high_gain": 10,
2905 "gx_distortion.level": 0.01,
2906 "gx_distortion.low_drive": 1,
2907 "gx_distortion.low_gain": 10,
2908 "gx_distortion.middle_h_drive": 1,
2909 "gx_distortion.middle_h_gain": 10,
2910 "gx_distortion.middle_l_drive": 1,
2911 "gx_distortion.middle_l_gain": 10,
2912 "gx_distortion.on_off": 0,
2913 "gx_distortion.position": 4,
2914 "gx_distortion.pp": "post",
2915 "gx_distortion.resonator.on_off": 0,
2916 "gx_distortion.split_high_freq": 1250,
2917 "gx_distortion.split_low_freq": 250,
2918 "gx_distortion.split_middle_freq": 650,
2919 "gx_distortion.trigger": 0.12,
2920 "gx_distortion.vibrato": 1,
2921 "gx_distortion.wet_dry": 100,
2922 "gxdistortion.drive": 1,
2923 "gxdistortion.wet_dry": 100,
2924 "highbooster.Level": 0.5,
2925 "highbooster.on_off": 0,
2926 "highbooster.position": 5,
2927 "highbooster.pp": "post",
2928 "jconv.balance": 0,
2929 "jconv.convolver": {
2930 "jconv.IRFile": "greathall.wav",
2931 "jconv.IRDir": "%S",
2932 "jconv.Gain": 0.598717,
2933 "jconv.GainCor": 1,
2934 "jconv.Offset": 0,
2935 "jconv.Length": 112561,
2936 "jconv.Delay": 0,
2937 "jconv.gainline": [[0, 0], [112560, 0]]
2938 },
2939 "jconv.diff_delay": 0,
2940 "jconv.gain": -8.52482,
2941 "jconv.on_off": 0,
2942 "jconv.position": 9,
2943 "jconv.wet_dry": 100,
2944 "jconv_mono.convolver": {
2945 "jconv.IRFile": "greathall.wav",
2946 "jconv.IRDir": "%S",
2947 "jconv.Gain": 0.598717,
2948 "jconv.GainCor": 1,
2949 "jconv.Offset": 0,
2950 "jconv.Length": 112561,
2951 "jconv.Delay": 0,
2952 "jconv.gainline": [[0, 0], [112560, 0]]
2953 },
2954 "jconv_mono.gain": 0,
2955 "jconv_mono.on_off": 0,
2956 "jconv_mono.position": 13,
2957 "jconv_mono.pp": "post",
2958 "jconv_mono.wet_dry": 100,
2959 "low_high_pass.lhc.high_freq": 5000,
2960 "low_high_pass.lhc.low_freq": 130,
2961 "low_high_pass.lhc.on_off": 0,
2962 "low_high_pass.lhp.high_freq": 130,
2963 "low_high_pass.lhp.low_freq": 5000,
2964 "low_high_pass.lhp.on_off": 0,
2965 "low_highpass.on_off": 0,
2966 "low_highpass.position": 8,
2967 "low_highpass.pp": "post",
2968 "manual.position": 1,
2969 "manual.pp": "pre",
2970 "mbc.Attack1": 0.012,
2971 "mbc.Attack2": 0.012,
2972 "mbc.Attack3": 0.012,
2973 "mbc.Attack4": 0.012,
2974 "mbc.Attack5": 0.012,
2975 "mbc.Makeup-Threshold1": 2,
2976 "mbc.Makeup-Threshold2": 2,
2977 "mbc.Makeup-Threshold3": 2,
2978 "mbc.Makeup-Threshold4": 2,
2979 "mbc.Makeup-Threshold5": 2,
2980 "mbc.Makeup1": 13,
2981 "mbc.Makeup2": 10,
2982 "mbc.Makeup3": 4,
2983 "mbc.Makeup4": 8,
2984 "mbc.Makeup5": 11,
2985 "mbc.Mode1": "Compress",
2986 "mbc.Mode2": "Compress",
2987 "mbc.Mode3": "Compress",
2988 "mbc.Mode4": "Compress",
2989 "mbc.Mode5": "Compress",
2990 "mbc.Ratio1": 2,
2991 "mbc.Ratio2": 2,
2992 "mbc.Ratio3": 2,
2993 "mbc.Ratio4": 2,
2994 "mbc.Ratio5": 2,
2995 "mbc.Release1": 1.25,
2996 "mbc.Release2": 1.25,
2997 "mbc.Release3": 1.25,
2998 "mbc.Release4": 1.25,
2999 "mbc.Release5": 1.25,
3000 "mbc.crossover_b1_b2": 80,
3001 "mbc.crossover_b2_b3": 210,
3002 "mbc.crossover_b3_b4": 1700,
3003 "mbc.crossover_b4_b5": 5000,
3004 "mbc.on_off": 0,
3005 "mbc.position": 35,
3006 "mbc.pp": "pre",
3007 "mbchor.crossover_b1_b2": 80,
3008 "mbchor.crossover_b2_b3": 210,
3009 "mbchor.crossover_b3_b4": 1700,
3010 "mbchor.crossover_b4_b5": 5000,
3011 "mbchor.delay1": 0.02,
3012 "mbchor.delay2": 0.04,
3013 "mbchor.delay3": 0.06,
3014 "mbchor.delay4": 0.08,
3015 "mbchor.delay5": 0.1,
3016 "mbchor.depth1": 0.02,
3017 "mbchor.depth2": 0.04,
3018 "mbchor.depth3": 0.06,
3019 "mbchor.depth4": 0.08,
3020 "mbchor.depth5": 0.1,
3021 "mbchor.freq1": 30,
3022 "mbchor.freq2": 60,
3023 "mbchor.freq3": 90,
3024 "mbchor.freq4": 120,
3025 "mbchor.freq5": 150,
3026 "mbchor.level1": 0.5,
3027 "mbchor.level2": 0.5,
3028 "mbchor.level3": 0.5,
3029 "mbchor.level4": 0.5,
3030 "mbchor.level5": 0.5,
3031 "mbchor.on_off": 0,
3032 "mbchor.position": 39,
3033 "mbchor.pp": "pre",
3034 "mbcs.Attack1": 0.012,
3035 "mbcs.Attack2": 0.012,
3036 "mbcs.Attack3": 0.012,
3037 "mbcs.Attack4": 0.012,
3038 "mbcs.Attack5": 0.012,
3039 "mbcs.Makeup-Threshold1": 2,
3040 "mbcs.Makeup-Threshold2": 2,
3041 "mbcs.Makeup-Threshold3": 2,
3042 "mbcs.Makeup-Threshold4": 2,
3043 "mbcs.Makeup-Threshold5": 2,
3044 "mbcs.Makeup1": 13,
3045 "mbcs.Makeup2": 10,
3046 "mbcs.Makeup3": 4,
3047 "mbcs.Makeup4": 8,
3048 "mbcs.Makeup5": 11,
3049 "mbcs.Mode1": "Compress",
3050 "mbcs.Mode2": "Compress",
3051 "mbcs.Mode3": "Compress",
3052 "mbcs.Mode4": "Compress",
3053 "mbcs.Mode5": "Compress",
3054 "mbcs.Ratio1": 2,
3055 "mbcs.Ratio2": 2,
3056 "mbcs.Ratio3": 2,
3057 "mbcs.Ratio4": 2,
3058 "mbcs.Ratio5": 2,
3059 "mbcs.Release1": 1.25,
3060 "mbcs.Release2": 1.25,
3061 "mbcs.Release3": 1.25,
3062 "mbcs.Release4": 1.25,
3063 "mbcs.Release5": 1.25,
3064 "mbcs.crossover_b1_b2": 80,
3065 "mbcs.crossover_b2_b3": 210,
3066 "mbcs.crossover_b3_b4": 1700,
3067 "mbcs.crossover_b4_b5": 5000,
3068 "mbcs.on_off": 0,
3069 "mbcs.position": 15,
3070 "mbd.Drive1": 0,
3071 "mbd.Drive2": 0,
3072 "mbd.Drive3": 0,
3073 "mbd.Drive4": 0,
3074 "mbd.Drive5": 0,
3075 "mbd.Gain": 0,
3076 "mbd.Offset1": 0,
3077 "mbd.Offset2": 0,
3078 "mbd.Offset3": 0,
3079 "mbd.Offset4": 0,
3080 "mbd.Offset5": 0,
3081 "mbd.crossover_b1_b2": 80,
3082 "mbd.crossover_b2_b3": 210,
3083 "mbd.crossover_b3_b4": 1700,
3084 "mbd.crossover_b4_b5": 5000,
3085 "mbd.on_off": 0,
3086 "mbd.position": 13,
3087 "mbd.pp": "post",
3088 "mbdel.crossover_b1_b2": 80,
3089 "mbdel.crossover_b2_b3": 210,
3090 "mbdel.crossover_b3_b4": 1700,
3091 "mbdel.crossover_b4_b5": 5000,
3092 "mbdel.delay1": 30,
3093 "mbdel.delay2": 60,
3094 "mbdel.delay3": 90,
3095 "mbdel.delay4": 120,
3096 "mbdel.delay5": 150,
3097 "mbdel.gain1": -10,
3098 "mbdel.gain2": -5,
3099 "mbdel.gain3": -2,
3100 "mbdel.gain4": 0,
3101 "mbdel.gain5": -10,
3102 "mbdel.on_off": 0,
3103 "mbdel.position": 38,
3104 "mbdel.pp": "pre",
3105 "mbe.crossover_b1_b2": 80,
3106 "mbe.crossover_b2_b3": 210,
3107 "mbe.crossover_b3_b4": 1700,
3108 "mbe.crossover_b4_b5": 5000,
3109 "mbe.on_off": 0,
3110 "mbe.percent1": 10,
3111 "mbe.percent2": 30,
3112 "mbe.percent3": 45,
3113 "mbe.percent4": 20,
3114 "mbe.percent5": 0,
3115 "mbe.position": 37,
3116 "mbe.pp": "pre",
3117 "mbe.time1": 30,
3118 "mbe.time2": 60,
3119 "mbe.time3": 120,
3120 "mbe.time4": 150,
3121 "mbe.time5": 240,
3122 "midi_out.beat_detector.atack_gain": 5,
3123 "midi_out.beat_detector.beat_gain": 1,
3124 "midi_out.beat_detector.midi_gain": 1,
3125 "midi_out.beat_detector.note_off": 2,
3126 "midi_out.beat_detector.stepper": 1,
3127 "midi_out.channel_1.auto_pitch": 0,
3128 "midi_out.channel_1.autogain": 0,
3129 "midi_out.channel_1.channel": 0,
3130 "midi_out.channel_1.oktave": 0,
3131 "midi_out.channel_1.program": 0,
3132 "midi_out.channel_1.sensity": 20,
3133 "midi_out.channel_1.velocity": 64,
3134 "midi_out.channel_1.volume": 64,
3135 "midi_out.channel_2.auto_pitch": 0,
3136 "midi_out.channel_2.autogain": 0,
3137 "midi_out.channel_2.channel": 0,
3138 "midi_out.channel_2.oktave": 0,
3139 "midi_out.channel_2.on_off": 0,
3140 "midi_out.channel_2.program": 0,
3141 "midi_out.channel_2.sensity": 20,
3142 "midi_out.channel_2.velocity": 64,
3143 "midi_out.channel_2.volume": 64,
3144 "midi_out.channel_3.auto_pitch": 0,
3145 "midi_out.channel_3.autogain": 0,
3146 "midi_out.channel_3.channel": 0,
3147 "midi_out.channel_3.oktave": 0,
3148 "midi_out.channel_3.on_off": 0,
3149 "midi_out.channel_3.program": 0,
3150 "midi_out.channel_3.sensity": 20,
3151 "midi_out.channel_3.velocity": 64,
3152 "midi_out.channel_3.volume": 64,
3153 "midi_out.on_off": 0,
3154 "moog.Q": 1,
3155 "moog.fr": 3000,
3156 "moog.on_off": 0,
3157 "moog.position": 1,
3158 "noise_gate.on_off": 0,
3159 "noise_gate.threshold": 0.01,
3160 "oscilloscope.on_off": 0,
3161 "oscilloscope.position": 11,
3162 "oscilloscope.pp": "post",
3163 "overdrive.drive": 1,
3164 "overdrive.on_off": 0,
3165 "overdrive.position": 12,
3166 "overdrive.pp": "post",
3167 "overdrive.wet_dry": 100,
3168 "panoram_enhancer.Delay width": 0.235,
3169 "panoram_enhancer.Frequency width": 0,
3170 "panoram_enhancer.on_off": 0,
3171 "panoram_enhancer.position": 4,
3172 "phaser.MaxNotch1Freq": 800,
3173 "phaser.MinNotch1Freq": 100,
3174 "phaser.Notch width": 1000,
3175 "phaser.NotchFreq": 1.5,
3176 "phaser.Speed": 0.5,
3177 "phaser.VibratoMode": "direct ",
3178 "phaser.depth": 1,
3179 "phaser.feedback gain": 0,
3180 "phaser.invert": "linear",
3181 "phaser.level": 0,
3182 "phaser.on_off": 0,
3183 "phaser.position": 3,
3184 "phaser_mono.Speed": 0.5,
3185 "phaser_mono.level": 0,
3186 "phaser_mono.on_off": 0,
3187 "phaser_mono.position": 14,
3188 "phaser_mono.pp": "post",
3189 "phaser_mono.wet_dry": 100,
3190 "pre.Level": 1,
3191 "pre.bass": 0,
3192 "pre.on_off": 0,
3193 "pre.position": 7,
3194 "pre.pp": "post",
3195 "pre.select": "AC30",
3196 "pre.treble": 0,
3197 "recorder.file": "wav",
3198 "recorder.gain": 0,
3199 "recorder.on_off": 0,
3200 "recorder.position": 7,
3201 "recorder.pp": "pre",
3202 "recorder.rec": 0,
3203 "rev_rocket.position": 1,
3204 "rev_rocket.pp": "pre",
3205 "ringModulatorSt.dry/wet": 0.5,
3206 "ringModulatorSt.freq": 240,
3207 "ringModulatorSt.on_off": 0,
3208 "ringModulatorSt.position": 19,
3209 "ring_modulator.dry/wet": 0.5,
3210 "ring_modulator.freq": 240,
3211 "ring_modulator.on_off": 0,
3212 "ring_modulator.position": 32,
3213 "ring_modulator.pp": "pre",
3214 "shaper.on_off": 0,
3215 "shaper.sharper": 10,
3216 "st_recorder.file": "wav",
3217 "st_recorder.gain": 0,
3218 "st_recorder.on_off": 0,
3219 "st_recorder.position": 6,
3220 "st_recorder.rec": 0,
3221 "stereodelay.LFO freq": 0.2,
3222 "stereodelay.invert": "linear",
3223 "stereodelay.l_delay": 20,
3224 "stereodelay.l_gain": -3,
3225 "stereodelay.on_off": 0,
3226 "stereodelay.position": 2,
3227 "stereodelay.r_delay": 50,
3228 "stereodelay.r_gain": -3,
3229 "stereoecho.LFO freq": 0.2,
3230 "stereoecho.invert": "linear",
3231 "stereoecho.on_off": 0,
3232 "stereoecho.percent_l": 0,
3233 "stereoecho.percent_r": 0,
3234 "stereoecho.position": 5,
3235 "stereoecho.time_l": 1,
3236 "stereoecho.time_r": 1,
3237 "stereoverb.LFO freq": 0.2,
3238 "stereoverb.RoomSize": 0.172676,
3239 "stereoverb.damp": 0.5,
3240 "stereoverb.invert": "linear",
3241 "stereoverb.on_off": 0,
3242 "stereoverb.position": 3,
3243 "stereoverb.wet_dry": 40.3238,
3244 "tonemodul.Bass": 0,
3245 "tonemodul.Middle": 0,
3246 "tonemodul.ON": 0,
3247 "tonemodul.Treble": 0,
3248 "tonemodul.on_off": 0,
3249 "tonemodul.position": 3,
3250 "tonemodul.sharper": 1,
3251 "tremolo.SINE": "triangle",
3252 "tremolo.depth": 0.5,
3253 "tremolo.freq": 5,
3254 "tremolo.on_off": 0,
3255 "tremolo.position": 14,
3256 "tremolo.pp": "post",
3257 "tremolo.wet_dry": 100,
3258 "ts9sim.drive": 0.5,
3259 "ts9sim.level": -16,
3260 "ts9sim.on_off": 0,
3261 "ts9sim.position": 11,
3262 "ts9sim.pp": "post",
3263 "ts9sim.tone": 400,
3264 "tube.select": "pre 12AU7/ push-pull 6V6",
3265 "ui.GCB_95": 0,
3266 "ui.IR": 0,
3267 "ui.JCM800Pre": 0,
3268 "ui.abgate": 0,
3269 "ui.amp.tonestack": 1,
3270 "ui.ampmodul": 1,
3271 "ui.bassEnhancer": 0,
3272 "ui.biquad": 0,
3273 "ui.cab": 1,
3274 "ui.chorus": 1,
3275 "ui.chorus_mono": 0,
3276 "ui.compressor": 0,
3277 "ui.crybaby": 0,
3278 "ui.dattorros_progenitor": 0,
3279 "ui.delay": 0,
3280 "ui.dide": 0,
3281 "ui.didest": 0,
3282 "ui.dubber": 0,
3283 "ui.echo": 0,
3284 "ui.eq": 0,
3285 "ui.eqs": 0,
3286 "ui.expander": 1,
3287 "ui.feedback": 0,
3288 "ui.flanger": 0,
3289 "ui.flanger_mono": 0,
3290 "ui.flanger_mono_gx": 0,
3291 "ui.freeverb": 1,
3292 "ui.gain": 0,
3293 "ui.graphiceq": 0,
3294 "ui.gx_distortion": 0,
3295 "ui.highbooster": 0,
3296 "ui.jconv": 0,
3297 "ui.jconv_mono": 0,
3298 "ui.low_highpass": 0,
3299 "ui.mbc": 0,
3300 "ui.mbchor": 0,
3301 "ui.mbcs": 0,
3302 "ui.mbd": 0,
3303 "ui.mbdel": 0,
3304 "ui.mbe": 0,
3305 "ui.midi_out": 0,
3306 "ui.moog": 0,
3307 "ui.oscilloscope": 0,
3308 "ui.overdrive": 0,
3309 "ui.panoram_enhancer": 0,
3310 "ui.phaser": 0,
3311 "ui.phaser_mono": 0,
3312 "ui.pre": 0,
3313 "ui.recorder": 0,
3314 "ui.ringModulatorSt": 0,
3315 "ui.ring_modulator": 0,
3316 "ui.st_recorder": 0,
3317 "ui.stereodelay": 1,
3318 "ui.stereoecho": 0,
3319 "ui.stereoverb": 1,
3320 "ui.tonemodul": 0,
3321 "ui.tremolo": 0,
3322 "ui.ts9sim": 0,
3323 "ui.univibe": 0,
3324 "ui.univibe_mono": 0,
3325 "ui.zita_rev1": 0,
3326 "univibe.depth": 0.37,
3327 "univibe.fb": -0.6,
3328 "univibe.freq": 4.4,
3329 "univibe.lrcross": 0,
3330 "univibe.on_off": 0,
3331 "univibe.panning": 0,
3332 "univibe.position": 12,
3333 "univibe.stereo": 0.11,
3334 "univibe.wet_dry": 1,
3335 "univibe.width": 0.5,
3336 "univibe_mono.depth": 0.37,
3337 "univibe_mono.fb": -0.6,
3338 "univibe_mono.freq": 4.4,
3339 "univibe_mono.on_off": 0,
3340 "univibe_mono.position": 27,
3341 "univibe_mono.pp": "post",
3342 "univibe_mono.wet_dry": 1,
3343 "univibe_mono.width": 0.5,
3344 "zita_rev1.decay_times.hf_damping": 6000,
3345 "zita_rev1.decay_times.lf_x": 285.5,
3346 "zita_rev1.decay_times.low_rt60": 3,
3347 "zita_rev1.decay_times.mid_rt60": 2,
3348 "zita_rev1.equalizer1.eq1_freq": 315,
3349 "zita_rev1.equalizer1.eq1_level": 0,
3350 "zita_rev1.equalizer2.eq2_freq": 315,
3351 "zita_rev1.equalizer2.eq2_level": 0,
3352 "zita_rev1.input.in_delay": 60,
3353 "zita_rev1.on_off": 0,
3354 "zita_rev1.output.dry_wet_mix": -0.109179,
3355 "zita_rev1.output.level": 6.34781,
3356 "zita_rev1.position": 4
3357 }
12813358 }
12823359 ]
44 _Comment=Simple mono amplifier simulation
55 Exec=guitarix
66 Icon=gx_head
7 Categories=AudioVideo;X-Jack;Midi;X-MIDI;
7 Categories=AudioVideo;Audio;X-Jack;Midi;X-MIDI;
88 Terminal=false
99 Type=Application
123123 fm->hold_state = 0;
124124 fm->current_peak = 0;
125125 fm->current_level = 0;
126 fm->old_peak_db = -INFINITY;
126127 gtk_widget_set_events(GTK_WIDGET(fm),
127128 GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK);
128129 }
360361 }
361362 }
362363
364
365
366 inline float power2db(float power) {
367 return 20.*log10(power);
368 }
369
370 inline double log_meter (double db)
371 {
372 // keep log_meter_inv in sync when changing anying!
373 gfloat def = 0.0f; /* Meter deflection %age */
374
375 if (db < -70.0f) {
376 def = 0.0f;
377 } else if (db < -60.0f) {
378 def = (db + 70.0f) * 0.25f;
379 } else if (db < -50.0f) {
380 def = (db + 60.0f) * 0.5f + 2.5f;
381 } else if (db < -40.0f) {
382 def = (db + 50.0f) * 0.75f + 7.5f;
383 } else if (db < -30.0f) {
384 def = (db + 40.0f) * 1.5f + 15.0f;
385 } else if (db < -20.0f) {
386 def = (db + 30.0f) * 2.0f + 30.0f;
387 } else if (db < 6.0f) {
388 def = (db + 20.0f) * 2.5f + 50.0f;
389 } else {
390 def = 115.0f;
391 }
392
393 /* 115 is the deflection %age that would be
394 when db=6.0. this is an arbitrary
395 endpoint for our scaling.
396 */
397
398 return def/115.0f;
399 }
400
401 double meter_level_by_power(GxFastMeter* fm, float new_level) {
402
403 static const float falloff = 27 * 60 * 0.0005;
404
405 // calculate peak dB and translate into meter
406 float peak_db = -INFINITY;
407 if (new_level > 0) {
408 peak_db = power2db(new_level);
409 }
410 // retrieve old meter value and consider falloff
411 if (peak_db < fm->old_peak_db) {
412 peak_db = max(peak_db, fm->old_peak_db - falloff);
413 }
414 fm->old_peak_db = peak_db;
415 return (log_meter(peak_db));
416 }
417
418
419 /* ------- setting meter level ----------- */
420 void gx_fast_meter_set_by_power(GxFastMeter* fm, gdouble lvl)
421 {
422 float old_level = fm->current_level;
423 float old_peak = fm->current_peak;
424
425 lvl = max(0.0, min(1.0, meter_level_by_power(fm,lvl)));
426 fm->current_level = lvl;
427
428 if (lvl >= fm->current_peak) {
429 fm->current_peak = lvl;
430 fm->hold_state = fm->hold_cnt;
431 }
432 if (fm->hold_state > 0) {
433 --fm->hold_state;
434 }
435 if (fm->hold_state == 0) {
436 fm->current_peak = lvl;
437 }
438 if (fm->current_level == old_level &&
439 (fm->hold_state == 0 || fm->current_peak == old_peak)) {
440 return;
441 }
442 GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(fm));
443 if (window) {
444 queue_vertical_redraw(fm, window);
445 }
446 }
447
363448 /* ------------- clear fast meter object ------------ */
364449 void gx_fast_meter_clear(GxFastMeter* fm)
365450 {
5151
5252 float current_level;
5353 float current_peak;
54 float old_peak_db;
5455 gint dimen, clr0, clr1, clr2, clr3;
5556 };
5657
6465 GtkWidget* gx_fast_meter_new(long hold, gulong dimen, int clr0, int clr1, int clr2, int clr3);
6566
6667 void gx_fast_meter_set (GxFastMeter* fastmeter, gdouble lvl);
68 void gx_fast_meter_set_by_power (GxFastMeter* fastmeter, gdouble lvl);
6769 void gx_fast_meter_clear (GxFastMeter* fastmeter);
6870
6971 void gx_fast_meter_set_hold_count (GxFastMeter* fastmeter, gint val);
927927 static void eq_expose(GtkWidget *wi, GdkEventExpose *ev)
928928 {
929929 cairo_t *cr;
930 cairo_text_extents_t extents;
931930 /* create a cairo context */
932931 cr = gdk_cairo_create(wi->window);
933932 GdkRegion *region;
944943 cairo_rectangle (cr, x0,y0,rect_width,rect_height+3);
945944 cairo_pattern_t*pat =
946945 cairo_pattern_create_linear (0, y0, 0, y0+rect_height);
947 //cairo_pattern_create_radial (x0+200,y0+ rect_height*0.5, 5,x0+800, y0+ rect_height*0.5, 200.0);
948946 set_skin_color(wi, pat);
949 //cairo_pattern_add_color_stop_rgb (pat, 0, 0.3, 0.3, 0.3);
950 //cairo_pattern_add_color_stop_rgb (pat, 0.5, 0.15, 0.15, 0.15);
951 //cairo_pattern_add_color_stop_rgb (pat, 1, 0.1, 0.1, 0.1);
952947 cairo_set_source (cr, pat);
953948 cairo_fill (cr);
954
955 cairo_set_source_rgb(cr, 0.2, 0.2, 0.2);
956 cairo_set_line_width(cr, 2.0);
957 cairo_move_to(cr,x0+rect_width-3, y0+3);
958 cairo_line_to(cr, x0+rect_width-3, y0+rect_height-2);
959 cairo_line_to(cr, x0+2, y0+rect_height-2);
960 cairo_stroke(cr);
961
962 cairo_set_source_rgb(cr, 0.1, 0.1, 0.1);
963 cairo_set_line_width(cr, 2.0);
964 cairo_move_to(cr,x0+3, y0+rect_height-1);
965 cairo_line_to(cr, x0+3, y0+3);
966 cairo_line_to(cr, x0+rect_width-3, y0+3);
967 cairo_stroke(cr);
968
969 const gchar * title = "faust";
970 cairo_select_font_face (cr, "sans", CAIRO_FONT_SLANT_NORMAL,
971 CAIRO_FONT_WEIGHT_BOLD);
972 cairo_set_font_size (cr, 10);
973 cairo_text_extents (cr,title , &extents);
974 double x = x0+rect_width-extents.height - 3 ;
975 double y = y0+rect_height*0.9+extents.height/2 - 3;
976 cairo_move_to(cr,x, y);
977 cairo_rotate (cr,270* M_PI/180);
978 cairo_text_path (cr,title);
979 cairo_set_source_rgb (cr, 0.3, 0.3, 0.3);
980 cairo_fill (cr);
981949
982950 cairo_pattern_destroy (pat);
983951 cairo_destroy(cr);
25152483 gdk_region_destroy (region);
25162484 }
25172485
2486 static void simple_level_meter_expose(GtkWidget *wi, GdkEventExpose *ev)
2487 {
2488 cairo_t *cr;
2489 /* create a cairo context */
2490 cr = gdk_cairo_create(wi->window);
2491 GdkRegion *region;
2492 region = gdk_region_rectangle (&wi->allocation);
2493 gdk_region_intersect (region, ev->region);
2494 gdk_cairo_region (cr, region);
2495 cairo_clip (cr);
2496 cairo_set_font_size (cr, 7.0);
2497
2498 double x0 = wi->allocation.x+1;
2499 double y0 = wi->allocation.y+2;
2500 double rect_width = wi->allocation.width-2;
2501 double rect_height = wi->allocation.height-4;
2502
2503 int db_points[] = { -50, -40, -30, -20, -10, -3, 0, 4 };
2504 char buf[32];
2505
2506 cairo_rectangle (cr, x0,y0,rect_width,rect_height+2);
2507 cairo_set_source_rgb (cr, 0, 0, 0);
2508 cairo_fill (cr);
2509
2510 cairo_pattern_t*pat = cairo_pattern_create_linear (x0, 0, x0+rect_width, 0);
2511 cairo_pattern_add_color_stop_rgba (pat, 0.3, 0.01, 0.01, 0.02, 0.3);
2512 cairo_pattern_add_color_stop_rgba (pat, 0.5, 0.2, 0.2, 0.2, 0.3);
2513 cairo_pattern_add_color_stop_rgba (pat, 1, 0.01, 0.01, 0.01, 0.3);
2514 cairo_set_source (cr, pat);
2515 cairo_rectangle (cr, x0+1,y0+1,rect_width-2,rect_height-2);
2516 cairo_fill (cr);
2517
2518 for (unsigned int i = 0; i < sizeof (db_points)/sizeof (db_points[0]); ++i)
2519 {
2520 float fraction = log_meter(db_points[i]);
2521 cairo_set_source_rgb (cr, 0.12*i, 1, 0.1);
2522
2523 cairo_move_to (cr, x0+rect_width*0.2,y0+rect_height - (rect_height * fraction));
2524 cairo_line_to (cr, x0+rect_width ,y0+rect_height - (rect_height * fraction));
2525 if (i<6)
2526 {
2527 snprintf (buf, sizeof (buf), "%d", db_points[i]);
2528 cairo_move_to (cr, x0+rect_width*0.32,y0+rect_height - (rect_height * fraction));
2529 }
2530 else
2531 {
2532 snprintf (buf, sizeof (buf), " %d", db_points[i]);
2533 cairo_move_to (cr, x0+rect_width*0.34,y0+rect_height - (rect_height * fraction));
2534 }
2535 cairo_show_text (cr, buf);
2536 }
2537
2538 cairo_set_source_rgb (cr, 0.4, 0.8, 0.4);
2539 cairo_set_line_width (cr, 0.5);
2540 cairo_stroke (cr);
2541
2542 cairo_pattern_destroy (pat);
2543 cairo_destroy(cr);
2544 gdk_region_destroy (region);
2545 }
2546
25182547 static void set_expose_func(GxPaintBox *paint_box, const gchar *paint_func)
25192548 {
25202549 if (strcmp(paint_func, "amp_expose") == 0) {
25692598 paint_box->expose_func = ir_expose;
25702599 } else if (strcmp(paint_func, "main_expose") == 0) {
25712600 paint_box->expose_func = main_expose;
2601 } else if (strcmp(paint_func, "simple_level_meter_expose") == 0) {
2602 paint_box->expose_func = simple_level_meter_expose;
25722603 } else if (strcmp(paint_func, "level_meter_expose") == 0) {
25732604 paint_box->expose_func = level_meter_expose;
25742605 } else if (strcmp(paint_func, "cab_expose") == 0) {
5050 gint display_width;
5151 gtk_widget_style_get(widget, "display-width", &display_width, NULL);
5252 GdkPixbuf *pb = gtk_widget_render_icon(widget, get_stock_id(widget), GtkIconSize(-1), NULL);
53 requisition->height = 12+gdk_pixbuf_get_height(pb);
53 requisition->height = 2+gdk_pixbuf_get_height(pb);
5454 requisition->width = (gdk_pixbuf_get_width(pb) + display_width) / 2;
5555 _gx_regler_calc_size_request(GX_REGLER(widget), requisition);
5656 g_object_unref(pb);
5757 }
5858
59 static void port_display_expose(
59 static void port_display_expose(GdkEventExpose *ev,
6060 GtkWidget *widget, GdkRectangle *rect, gdouble sliderstate, GdkPixbuf *image)
6161 {
6262 cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(widget));
63 GxPortDisplay *port_display = GX_PORT_DISPLAY(widget);
64 GdkRegion *region;
65 region = gdk_region_rectangle (&widget->allocation);
66 gdk_region_intersect (region, ev->region);
67 gdk_cairo_region (cr, region);
68 cairo_clip (cr);
6369 gdk_cairo_set_source_pixbuf(cr, image, rect->x - (rect->width-(gint)sliderstate), rect->y);
6470 cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height);
6571 cairo_fill(cr);
72 if (port_display->cutoff_low + port_display->cutoff_high) {
73 cairo_set_source_rgba (cr, 0.8, 0.1, 0.1, 0.4);
74 cairo_set_line_width(cr, rect->height);
75 gint low = rect->width * port_display->cutoff_low * 0.01;
76 gint high = (rect->width* port_display->cutoff_high * 0.01)-2;
77 gint lw = rect->height/2;
78 cairo_move_to(cr,rect->x, rect->y+lw);
79 cairo_line_to(cr,rect->x + low, rect->y+lw);
80 cairo_stroke (cr);
81 cairo_move_to(cr,rect->width - high, rect->y+lw);
82 cairo_line_to(cr,rect->width+2, rect->y+lw);
83 cairo_stroke (cr);
84 cairo_set_source_rgba (cr, 0.1, 0.6, 0.1, 0.4);
85 cairo_move_to(cr,rect->x+ low, rect->y+lw);
86 cairo_line_to(cr,rect->width - high, rect->y+lw);
87 cairo_stroke (cr);
88
89 }
6690 cairo_destroy(cr);
91 gdk_region_destroy (region);
6792 }
6893
6994 static gboolean gx_port_display_expose(GtkWidget *widget, GdkEventExpose *event)
77102 image_rect.width = (gdk_pixbuf_get_width(pb) + display_width) / 2;
78103 gdouble sliderstate = _gx_regler_get_step_pos(GX_REGLER(widget), image_rect.width-display_width);
79104 _gx_regler_get_positions(GX_REGLER(widget), &image_rect, &value_rect);
80 port_display_expose(widget, &image_rect, sliderstate, pb);
105 port_display_expose(event, widget, &image_rect, sliderstate, pb);
81106 _gx_regler_simple_display_value(GX_REGLER(widget), &value_rect);
82107 g_object_unref(pb);
83108 return FALSE;
94119 static void gx_port_display_init(GxPortDisplay *port_display)
95120 {
96121 gtk_widget_set_name (GTK_WIDGET(port_display),"rack_slider");
122 port_display->cutoff_low = 0;
123 port_display->cutoff_high = 0;
97124 }
125
126 void gx_port_display_set_state(GxPortDisplay *port_display, gint cutoff_low, gint cutoff_high) {
127 g_assert(GX_IS_PORT_DISPLAY(port_display));
128 port_display->cutoff_low = cutoff_low;
129 port_display->cutoff_high = cutoff_high;
130 }
3535
3636 struct _GxPortDisplay {
3737 GxVSlider parent;
38 gint cutoff_low;
39 gint cutoff_high;
3840 };
3941
4042 struct _GxPortDisplayClass {
4345
4446 GType gx_port_display_get_type(void);
4547
48 void gx_port_display_set_state(GxPortDisplay *pd, gint cutoff_low, gint cutoff_high);
4649 G_END_DECLS
4750
4851 #endif /* __GX_PORT_DISPLAY_H__ */
4646 { "pbutton_off", pb_pbutton_off },
4747 { "rbutton_on", pb_rbutton_on },
4848 { "rbutton_off", pb_rbutton_off },
49 { "prbutton_on", pb_prbutton_on },
50 { "prbutton_off", pb_prbutton_off },
4951 { "vslider", pb_vslider },
5052 { "wheel_back", pb_wheel_back },
5153 { "wheel_vertical_back", pb_wheel_vertical_back },
3939 "pbutton_off.png",
4040 "rbutton_on.png",
4141 "rbutton_off.png",
42 "prbutton_on.png",
43 "prbutton_off.png",
4244 "vslider.png",
4345 "wheel_back.png",
4446 "wheel_vertical_back.png",
Binary diff not shown
2626 public:
2727 _CTOR_DEFAULT
2828 _WRAP_METHOD(void set(double lvl), gx_fast_meter_set)
29 _WRAP_METHOD(void set_by_power(double lvl), gx_fast_meter_set_by_power)
2930 _WRAP_METHOD(void clear(), gx_fast_meter_clear)
3031 _WRAP_METHOD(void set_hold_count(int val), gx_fast_meter_set_hold_count)
3132 _WRAP_PROPERTY(hold, int)
1919
2020 Gxw::PortDisplay::PortDisplay(Gtk::Adjustment& adjustment):
2121 _CONSTRUCT("adjustment", adjustment.gobj())
22 {}
22
23 namespace Gxw
24 {
25
26 void PortDisplay::set_state(int cutoff_low, int cutoff_high)
27 {
28 gx_port_display_set_state(gobj(), cutoff_low, cutoff_high);
29 }
30
31 }
2626 class PortDisplay: public Gxw::VSlider {
2727 _CLASS_GTKOBJECT(PortDisplay,GxPortDisplay,GX_PORT_DISPLAY,Gxw::VSlider,GxVSlider)
2828 public:
29 void set_state(int cutoff_low, int cutoff_high);
2930 explicit PortDisplay(Gtk::Adjustment& adjustment);
3031 _CTOR_DEFAULT
3132 };
133133 gx_fast_meter_set(gobj(), lvl);
134134 }
135135
136 void FastMeter::set_by_power(double lvl)
137 {
138 gx_fast_meter_set_by_power(gobj(), lvl);
139 }
140
136141 void FastMeter::clear()
137142 {
138143 gx_fast_meter_clear(gobj());
9696
9797 void set(double lvl);
9898
99 void set_by_power(double lvl);
100
99101 void clear();
100102
101103 void set_hold_count(int val);
4949
5050 namespace Gxw
5151 {
52
53 void PortDisplay::set_state(int cutoff_low, int cutoff_high)
54 {
55 gx_port_display_set_state(gobj(), cutoff_low, cutoff_high);
56 }
5257
5358
5459 /* The *_Class implementation: */
9393 private:
9494
9595 public:
96 void set_state(int cutoff_low, int cutoff_high);
9697 explicit PortDisplay(Gtk::Adjustment& adjustment);
9798 PortDisplay();
9899
2727 src/faust-generated/autowah.cc
2828 src/faust-generated/balance.cc
2929 src/faust-generated/bassbooster.cc
30 src/faust-generated/bass_enhancer.cc
3031 src/faust-generated/biquad.cc
3132 src/faust-generated/cabinet_impulse_former.cc
3233 src/faust-generated/chorus.cc
3334 src/faust-generated/chorus_mono.cc
3435 src/faust-generated/compressor.cc
3536 src/faust-generated/crybaby.cc
37 src/faust-generated/dattorros_progenitor.cc
3638 src/faust-generated/delay.cc
39 src/faust-generated/digital_delay.cc
40 src/faust-generated/digital_delay_st.cc
41 src/faust-generated/duck_delay.cc
42 src/faust-generated/duck_delay_st.cc
3743 src/faust-generated/echo.cc
44 src/faust-generated/expander.cc
3845 src/faust-generated/flanger.cc
3946 src/faust-generated/flanger_mono.cc
4047 src/faust-generated/freeverb.cc
48 src/faust-generated/gain.cc
49 src/faust-generated/graphiceq.cc
4150 src/faust-generated/gx_ampmodul.cc
4251 src/faust-generated/gx_ampout.cc
4352 src/faust-generated/gx_ampout_ladspa.cc
6473 src/faust-generated/gxamp8.cc
6574 src/faust-generated/gxamp9.cc
6675 src/faust-generated/gxfeed.cc
76 src/faust-generated/gxnoamp.cc
77 src/faust-generated/highbooster.cc
6778 src/faust-generated/impulseresponse.cc
6879 src/faust-generated/jconv_post.cc
80 src/faust-generated/jconv_post_mono.cc
6981 src/faust-generated/low_high_pass.cc
7082 src/faust-generated/moog.cc
7183 src/faust-generated/noise_shaper.cc
7284 src/faust-generated/overdrive.cc
85 src/faust-generated/panoram_enhancer.cc
86 src/faust-generated/peak_eq.cc
7387 src/faust-generated/phaser.cc
7488 src/faust-generated/phaser_mono.cc
7589 src/faust-generated/presence_level.cc
90 src/faust-generated/ring_modulator.cc
91 src/faust-generated/ring_modulator_st.cc
7692 src/faust-generated/selecteq.cc
7793 src/faust-generated/softclip.cc
7894 src/faust-generated/stereodelay.cc
87103 src/faust-generated/tonestack_bogner.cc
88104 src/faust-generated/tonestack_crunch.cc
89105 src/faust-generated/tonestack_default.cc
106 src/faust-generated/tonestack_engl.cc
90107 src/faust-generated/tonestack_fender_blues.cc
91108 src/faust-generated/tonestack_fender_default.cc
92109 src/faust-generated/tonestack_fender_deville.cc
121138 src/gx_head/engine/gx_internal_ui_plugins.cpp
122139 src/gx_head/engine/gx_jack.cpp
123140 src/gx_head/engine/gx_json.cpp
141 src/gx_head/engine/gx_livelooper.cc
124142 src/gx_head/engine/gx_midi_plugin.cpp
125143 src/gx_head/engine/gx_paramtable.cpp
126144 src/gx_head/engine/gx_pluginloader.cpp
127145 src/gx_head/engine/gx_preset.cpp
146 src/gx_head/engine/gx_record.cc
128147 src/gx_head/engine/gx_system.cpp
129148 src/gx_head/gui/gx_gui_helpers.cpp
130149 src/gx_head/gui/gx_jack_options.cpp
142161 src/ladspa/ladspa_guitarix.cpp
143162 src/headers/gx_main_window.h
144163 src/plugins/abgate.cc
164 src/plugins/generated/flanger_gx.cc
165 src/plugins/generated/mbc.cc
166 src/plugins/generated/mbchor.cc
167 src/plugins/generated/mbcs.cc
168 src/plugins/generated/mbd.cc
169 src/plugins/generated/mbdel.cc
170 src/plugins/generated/mbe.cc
171 src/plugins/generated/ts9sim.cc
145172 src/plugins/generated/zita_rev1.cc
173 src/plugins/reversedelay.cc
146174 src/plugins/vibe.cc
147175 src/plugins/zita_rev1_ui.glade
103103 GxIREdit::gain-line-color = { 0, 60000, 0, 65535 }
104104 }
105105
106 style "guitarix_playhead"
107 {
108 stock["portdisplay"] = {{"playhead.png"}}
109 GxRegler::show-value = 0
110 }
111
112 style "guitarix_slevel"
113 {
114 stock["levelslider"] = {{"simplelevelslider.png"}}
115 GxRegler::show-value = 0
116 GxLevelSlider::slider--width = 3
117 }
118
119
120 widget "*.lmw" style:highest "guitarix_slevel"
121 widget "*.playhead" style:highest "guitarix_playhead"
106122 widget "*.smallbutton" style:highest "guitarix_small_button"
107123 widget "*.effekt_label" style:highest "guitarix_caption"
108124 widget "*.filter_box.*.effekt_label" style:highest "guitarix_bold_label"
Binary diff not shown
4848 'readonly.png',
4949 'scratch.png',
5050 'versiondiff.png',
51 'playhead.png',
52 'simplelevelslider.png',
5153 ]
5254
5355 def configure(conf):
4747
4848 void SimpleResampler::setup(int32_t sampleRate, uint32_t fact)
4949 {
50 int32_t d = gcd(sampleRate, sampleRate*fact);
51 ratio_a = sampleRate / d;
52 ratio_b = (sampleRate*fact) / d;
53
5054 assert(fact <= MAX_UPSAMPLE);
5155 m_fact = fact;
5256 const int32_t qual = 16; // resulting in a total delay of 2*qual (0.7ms @44100)
6872 r_down.process();
6973 }
7074
71 void SimpleResampler::up(int32_t count, float *input, float *output)
75 int32_t SimpleResampler::up(int32_t count, float *input, float *output)
7276 {
7377 r_up.inp_count = count;
7478 r_up.inp_data = input;
75 r_up.out_count = count * m_fact;
79 int m = get_max_out_size(count);
80 r_up.out_count = m;
7681 r_up.out_data = output;
7782 r_up.process();
7883 assert(r_up.inp_count == 0);
79 assert(r_up.out_count == 0);
84 assert(r_up.out_count <= 1);
85 r_down.inp_count = m - r_up.out_count;
86 return r_down.inp_count;
8087 }
8188
8289 void SimpleResampler::down(int32_t count, float *input, float *output)
8390 {
84 r_down.inp_count = count * m_fact;
91 //r_down.inp_count = count * m_fact;
8592 r_down.inp_data = input;
8693 r_down.out_count = count+1; // +1 == trick to drain input
8794 r_down.out_data = output;
3636 private:
3737 Resampler r_up, r_down;
3838 int32_t m_fact;
39 int32_t ratio_a;
40 int32_t ratio_b;
3941 public:
4042 SimpleResampler(): r_up(), r_down(), m_fact() {}
4143 void setup(int32_t sampleRate, uint32_t fact);
42 void up(int32_t count, float *input, float *output);
44 int32_t up(int32_t count, float *input, float *output);
4345 void down(int32_t count, float *input, float *output);
46 int32_t get_max_out_size(int32_t i_size)
47 {
48 return (i_size * ratio_b) / ratio_a + 1;
49 }
4450 };
4551
4652 class BufferResampler: Resampler
0 declare id "bmpf";
1 declare name "BigMuffFuzzPadel";
2 declare shortname "FuzzPadel";
3 declare category "Distortion";
4 declare description "BigMuffFuzzPadel";
5
6
7 import("guitarix.lib");
8 import("filter.lib");
9 import("effect.lib");
10 import("reduce.lib");
11
12
13 bigmuff = _<: filter1,filter2:>_ with {
14 tone = vslider("tone",0.5,0,1,0.01);
15 filter1 = highpass( 1, 1856):*(tone);
16 filter2 = lowpass( 1, 408 ) :*(1-tone);
17 };
18
19 process = _<:*(dry),(*(wet):*(gain):bigmuff:fuzz:fuzzy:fiz):>downfilter with {
20 //fuzz(x) = x-0.15*x^2-0.15*x^3;
21 //fuzz(x) = 1.5*x-0.5*x^3;
22 fuzz(x) = (1+drive/101)*x/(1+drive/101*abs(x));
23 drive = vslider("drive", 1, -3, 100, 1);
24 fuzzy = fuzzy_tube(2,1,0.5,drive);
25 fiz(x) = x+(x^7);
26 downfilter = lowpass(1,5631): highpass(1,80);
27 gain = vslider("Input",0,-24,20,0.1) : db2linear : smoothi(0.999);
28 wet = vslider("Output", 100, 50, 100, 1) : /(100);
29 dry = 1 - wet;
30
31 };
1313 dtime = hslider("delay", 0.02, 0, 0.2, 0.01);
1414 depth = hslider("depth", 0.02, 0, 1, 0.01);
1515
16 tblosc(n,f,freq,mod) = (1-d)*rdtable(n,waveform,i&(n-1)) +
17 d*rdtable(n,waveform,(i+1)&(n-1))
16 tblosc(n,f,freq,mod) = (1-d)*rdtable(n,wform,i&(n-1)) +
17 d*rdtable(n,wform,(i+1)&(n-1))
1818 with {
19 waveform = time*(2.0*PI)/n : f;
19 wform = time*(2.0*PI)/n : f;
2020 phase = freq/SR : (+ : decimal) ~ _;
2121 modphase = decimal(phase+mod/(2*PI))*n;
2222 i = int(floor(modphase));
0 declare id "duckDelay";
1 declare name "Duck Delay";
2 declare category "Echo / Delay";
3
4 //------------------------------------
5 //Inspired by:
6 //http://www.gvst.co.uk/gduckdly.htm
7 //Axe-FX II Owner's manual:5.6
8 //------------------------------------
9
10 //------------------------------------
11 //Description:
12 //The delayed signal added to output dependent of input signal amplitude.
13 //If the input signal is high. The delayed signall turned off, and vise versa.
14 //The switching controlled by envelope follower
15 //(parameters: "attack", "release", and main - "amount", what controls envelope follower influence).
16 //
17 //Parameters description:
18 //time - delay time in milliseconds
19 //feedback - delay feedback
20 //attack, release - envelope follower time in seconds controls
21 //amount dB - envelope follower influence
22 //------------------------------------
23
24 import("music.lib");
25 import("effect.lib");
26
27 //Constrols
28 p_time = hslider("time", 500, 1, 2000, 1):smooth(tau2pole(0.1));
29 p_feedback = hslider("feedback", 0, 0, 1, 0.05);
30 p_attack_time = hslider("attack", 0.1, 0.05, 0.5, 0.05);
31 p_release_time = hslider("relese", 0.1, 0.05, 2, 0.05);
32 p_amount = hslider("amount", 0.5, 0,56, 0.05):db2linear;
33
34 //Consts
35 c_channels_sw_time = 0.1;
36 c_fdelay_max_len = 393216;
37
38 get_delay_length(x) = x*SR:_*0.001;
39
40 process = _<:
41 _,(_<:(_+_:fdelay(c_fdelay_max_len,get_delay_length(p_time)))~_*p_feedback,
42 (amp_follower_ud(p_attack_time,p_release_time):_*p_amount:_>1:(1 - _):
43 smooth(tau2pole(c_channels_sw_time)))):_,_*_
44 :>_;
0 declare id "duckDelaySt";
1 declare name "Duck Delay St";
2 declare category "Echo / Delay";
3
4 //------------------------------------
5 //Description:
6 //The delayed signal added to output dependent of input signal amplitude.
7 //If the input signal is high. The delayed signall turned off, and vise versa.
8 //The switching controlled by envelope follower
9 //(parameters: "attack", "release", and main - "amount", what is controls envelope follower influence).
10 //
11 //Parameters description:
12 //time - delay time in milliseconds
13 //feedback - delay feedback
14 //pingpong - changes feedback character
15 //coloration - LP/HP coloration filter
16 //attack, release - envelope follower time in seconds controls
17 //amount dB - envelope follower influence
18 //effect - amplitude of effect signal in mix
19 //------------------------------------
20
21 import("music.lib");
22 import("effect.lib");
23
24 //Constrols
25 p_time = hslider("time", 500, 1, 2000, 1):smooth(tau2pole(0.1));
26 p_feedback = hslider("feedback", 0, 0, 1, 0.05);
27 p_pingpong = hslider("pingpong", 0, 0, 1, 0.05);
28 coloration = hslider("coloration", 0, -1, 1, 0.05);
29
30 p_attack_time = hslider("attack", 0.1, 0.05, 0.5, 0.05);
31 p_release_time = hslider("release", 0.1, 0.05, 2, 0.05);
32 p_amount = hslider("amount", 0.5, 0,56, 0.05):db2linear;
33
34 p_effect = hslider("effect", 0, -16, +4, 0.1) : db2linear : smooth(0.999);
35
36 //Consts
37 c_fdelay_max_len = 393216;
38 c_channels_sw_time = 0.1;
39
40 //Funcs
41 X = (_,_)<:(!,_,_,!);
42 get_delay_length(x) = x*SR:_*0.001;
43 coloration_filter(coloration) = _<:(lowshelf(5,(1 - coloration)*12,440),
44 highshelf(5,coloration*12,880)):>_*db2linear(-15);
45
46 pp_delay(time,fb_coef,pp_fb_coef) = _,_*(1 - pp_fb_coef):
47 (_,X,_:(X:(pp_fb_delay(time, fb_coef,pp_fb_coef))),
48 (X:(pp_fb_delay(time, fb_coef,pp_fb_coef))):_,_)~X
49 :>_,_
50 with {
51 pp_fb_delay(time,fb_coef,pp_fb_coef) = _+_*pp_fb_coef:
52 (_+_:fdelay(c_fdelay_max_len,get_delay_length(p_time)))~_*fb_coef;
53 };
54
55 switcher(att, rel, amount) = amp_follower_ud(att,rel):
56 _*amount:_>1:(1 - _):
57 smooth(tau2pole(c_channels_sw_time));
58
59 process = (_<:_,_,_),(_<:_,_,_):
60 _,
61 switcher(p_attack_time, p_release_time, p_amount),
62 (pp_delay(p_time,p_feedback*(1 - p_pingpong),p_pingpong*p_feedback):
63 coloration_filter(coloration),coloration_filter(coloration)),
64 switcher(p_attack_time, p_release_time, p_amount),
65 _:
66 _,_*_,_*_,_:(_,_*p_effect:>_),(_*p_effect,_:>_);
67
0 declare id "graphiceq";
1 declare name "Graphic EQ";
2 declare category "Tone control";
3 declare description "Graphic EQ";
4
5
6 import("filter.lib");
7 import("reduce.lib");
8
9
10 //geq = filterbank(3, (31.25, 62.5, 125., 250., 500., 1000., 2000., 4000., 8000., 16000.));
11 geq = filterbank(3, (44., 88., 177., 354., 707., 1414., 2828., 5657., 11384., 18110.));
12
13 g1 = vslider("g1[tooltip:gain (dB) below 31.25 Hz]", 0, -60, 20, 0.1) : db2linear : smooth(0.999);
14 g2 = vslider("g2 [tooltip:gain (dB) at 62.5 Hz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
15 g3 = vslider("g3 [tooltip:gain (dB) at 125 Hz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
16 g4 = vslider("g4 [tooltip:gain (dB) at 250 Hz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
17 g5 = vslider("g5 [tooltip:gain (dB) at 500 Hz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
18 g6 = vslider("g6 [tooltip:gain (dB) at 1 kHz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
19 g7 = vslider("g7 [tooltip:gain (dB) at 2 kHz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
20 g8 = vslider("g8 [tooltip:gain (dB) at 4 kHz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
21 g9 = vslider("g9 [tooltip:gain (dB) at 8 kHz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
22 g10 = vslider("g10 [tooltip:gain (dB) at 16 kHz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
23 g11 = vslider("g11 [tooltip:gain (dB) above 16 kHz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
24
25
26 v1(x) = attach(x, envelop(x) : vbargraph("v1[nomidi:no]", -70, +5));
27 v2(x) = attach(x, envelop(x) : vbargraph("v2[nomidi:no]", -70, +5));
28 v3(x) = attach(x, envelop(x) : vbargraph("v3[nomidi:no]", -70, +5));
29 v4(x) = attach(x, envelop(x) : vbargraph("v4[nomidi:no]", -70, +5));
30 v5(x) = attach(x, envelop(x) : vbargraph("v5[nomidi:no]", -70, +5));
31
32 v6(x) = attach(x, envelop(x) : vbargraph("v6[nomidi:no]", -70, +5));
33 v7(x) = attach(x, envelop(x) : vbargraph("v7[nomidi:no]", -70, +5));
34 v8(x) = attach(x, envelop(x) : vbargraph("v8[nomidi:no]", -70, +5));
35 v9(x) = attach(x, envelop(x) : vbargraph("v9[nomidi:no]", -70, +5));
36 v10(x) = attach(x, envelop(x) : vbargraph("v10[nomidi:no]", -70, +5));
37 v11(x) = attach(x, envelop(x) : vbargraph("v11[nomidi:no]", -70, +5));
38
39 envelop = abs : max ~ (1.0/SR) : reduce(max,4096) ;
40
41 process = geq :(*(g11):v11), (*(g10):v10),(*(g9):v9),(*(g8):v8),(*(g7):v7),(*(g6):v6),
42 (*(g5):v5),(*(g4):v4),(*(g3):v3),(*(g2):v2),(*(g1):v1) :>_;
0 import("filter.lib");
1 import("reduce.lib");
2 import("guitarix.lib");
3
4 vmeter1(x) = attach(x, envelop(x) : vbargraph("v1[unit:dB]", -70, +5));
5
6 envelop = abs : max ~ (1.0/SR) : reduce(max,4096) ; // : max(db2linear(-70)) : linear2db;
7
8 process = lowpass(1,5631): highpass(1,80): vmeter1 ;
0 import("filter.lib");
1 import("guitarix.lib");
2
3
4 ssclip(x) = a : sym_clip(0.9) with {
5 th = 0.33;
6 a = if(abs(x)<th, 2*x, copysign(x,(3-(2-x*3)^2)/3));
7 };
8
9 process = lowpass(1,5631): highpass(1,80):ssclip ;
0 declare id "mbc";
1 declare name "Multi Band Compressor";
2 declare shortname "MB Compressor";
3 declare category "Guitar Effects";
4 declare description "Multi Band Compressor contributed by kokoko3k";
5
6 import("effect.lib");
7 import("filter.lib");
8 import("music.lib");
9 import("reduce.lib");
10
11 vmeter1(x) = attach(x, envelop(x) : vbargraph("v1[tooltip:no]", -70, +5));
12 vmeter2(x) = attach(x, envelop(x) : vbargraph("v2[tooltip:no]", -70, +5));
13 vmeter3(x) = attach(x, envelop(x) : vbargraph("v3[tooltip:no]", -70, +5));
14 vmeter4(x) = attach(x, envelop(x) : vbargraph("v4[tooltip:no]", -70, +5));
15 vmeter5(x) = attach(x, envelop(x) : vbargraph("v5[tooltip:no]", -70, +5));
16 vmeter6(x) = attach(x, envelop(x) : vbargraph("v6[tooltip:no]", -70, +5));
17 vmeter7(x) = attach(x, envelop(x) : vbargraph("v7[tooltip:no]", -70, +5));
18 vmeter8(x) = attach(x, envelop(x) : vbargraph("v8[tooltip:no]", -70, +5));
19 vmeter9(x) = attach(x, envelop(x) : vbargraph("v9[tooltip:no]", -70, +5));
20 vmeter10(x) = attach(x, envelop(x) : vbargraph("v10[tooltip:no]", -70, +5));
21
22 envelop = abs : max ~ (1.0/SR) : reduce(max,4096) ; // : max(db2linear(-70)) : linear2db;
23
24 //Mono
25 process = geq : ( gcomp5s , gcomp4s , gcomp3s, gcomp2s, gcomp1s) :>_ with {
26 gcomp1s = vmeter6:bypass1(bswitch1,compressor_mono(ratio1,-push1,attack1,release1)):*(Makeup1) : vmeter1;
27 gcomp2s = vmeter7:bypass1(bswitch2,compressor_mono(ratio2,-push2,attack2,release2)):*(Makeup2) : vmeter2;
28 gcomp3s = vmeter8:bypass1(bswitch3,compressor_mono(ratio3,-push3,attack3,release3)):*(Makeup3) : vmeter3;
29 gcomp4s = vmeter9:bypass1(bswitch4,compressor_mono(ratio4,-push4,attack4,release4)):*(Makeup4) : vmeter4;
30 gcomp5s = vmeter10:bypass1(bswitch5,compressor_mono(ratio5,-push5,attack5,release5)):*(Makeup5) : vmeter5;
31 };
32
33
34 sel1 = hslider("Mode1[enum:Compress|Bypass|Mute][tooltip: Compress or Mute the selected band, or Bypass The Compressor]",1,1,3,1);
35 sel2 = hslider("Mode2[enum:Compress|Bypass|Mute][tooltip: Compress or Mute the selected band, or Bypass The Compressor]",1,1,3,1);
36 sel3 = hslider("Mode3[enum:Compress|Bypass|Mute][tooltip: Compress or Mute the selected band, or Bypass The Compressor]",1,1,3,1);
37 sel4 = hslider("Mode4[enum:Compress|Bypass|Mute][tooltip: Compress or Mute the selected band, or Bypass The Compressor]",1,1,3,1);
38 sel5 = hslider("Mode5[enum:Compress|Bypass|Mute][tooltip: Compress or Mute the selected band, or Bypass The Compressor]",1,1,3,1);
39
40 not(x) = abs(x-1);
41 mute1 = not(max(0,sel1-2));
42 mute2 = not(max(0,sel2-2));
43 mute3 = not(max(0,sel3-2));
44 mute4 = not(max(0,sel4-2));
45 mute5 = not(max(0,sel5-2));
46
47 bypass(switch, block) = _ <: select2(switch, _, block);
48
49 bswitch1 = max(0,sel1-1);
50 bswitch2 = max(0,sel2-1);
51 bswitch3 = max(0,sel3-1);
52 bswitch4 = max(0,sel4-1);
53 bswitch5 = max(0,sel5-1);
54
55 hifr1 =hslider("crossover_b1_b2 [log][name:Crossover B1-B2 (hz)][tooltip: Crossover bandpass frequency]" ,80 , 20, 20000, 1.08);
56 hifr2 =hslider("crossover_b2_b3 [log][name:Crossover B2-B3 (hz)][tooltip: Crossover bandpass frequency]",210,20,20000,1.08);
57 hifr3 =hslider("crossover_b3_b4 [log][name:Crossover B3-B4 (hz)][tooltip: Crossover bandpass frequency]",1700,20,20000,1.08);
58 hifr4 =hslider("crossover_b4_b5 [log][name:Crossover B4-B5 (hz)][tooltip: Crossover bandpass frequency]",5000,20,20000,1.08);
59
60 geq = filterbank(3, (hifr1,hifr2,hifr3,hifr4));
61
62 ratio1 = hslider("[9] Ratio1 [tooltip: Compression ratio]",2,1,100,0.1);
63 attack1 = hslider("[A] Attack1 [tooltip: Time before the compressor starts to kick in]", 0.012, 0.001, 1, 0.001);
64 release1 = hslider("[B] Release1 [tooltip: Time before the compressor releases the sound]", 1.25, 0.01, 10, 0.01);
65
66 ratio2 = hslider("[9] Ratio2 [tooltip: Compression ratio]",2,1,100,0.1);
67 attack2 = hslider("[A] Attack2 [tooltip: Time before the compressor starts to kick in]", 0.012, 0.001, 1, 0.001);
68 release2 = hslider("[B] Release2 [tooltip: Time before the compressor releases the sound]", 1.25, 0.01, 10, 0.01);
69
70 ratio3 = hslider("[9] Ratio3 [tooltip: Compression ratio]",2,1,100,0.1);
71 attack3 = hslider("[A] Attack3 [tooltip: Time before the compressor starts to kick in]", 0.012, 0.001, 1, 0.001);
72 release3 = hslider("[B] Release3 [tooltip: Time before the compressor releases the sound]", 1.25, 0.01, 10, 0.01);
73
74 ratio4 = hslider("[9] Ratio4 [tooltip: Compression ratio]",2,1,100,0.1);
75 attack4 = hslider("[A] Attack4 [tooltip: Time before the compressor starts to kick in]", 0.012, 0.001, 1, 0.001);
76 release4 = hslider("[B] Release4 [tooltip: Time before the compressor releases the sound]", 1.25, 0.01, 10, 0.01);
77
78 ratio5 = hslider("[9] Ratio5 [tooltip: Compression ratio]",2,1,100,0.1);
79 attack5 = hslider("[A] Attack5 [tooltip: Time before the compressor starts to kick in]", 0.012, 0.001, 1, 0.001);
80 release5 = hslider("[B] Release5 [tooltip: Time before the compressor releases the sound]", 1.25, 0.01, 10, 0.01);
81
82 push1 = hslider("[5] Makeup1 [tooltip: Post amplification and threshold]" , 13, -50, +50, 0.1) ; // threshold-=push ; makeup+=push
83 push2 = hslider("[5] Makeup2 [tooltip: Post amplification and threshold]" , 10, -50, +50, 0.1) ; // threshold-=push ; makeup+=push
84 push3 = hslider("[5] Makeup3 [tooltip: Post amplification and threshold]" , 4, -50, +50, 0.1) ; // threshold-=push ; makeup+=push
85 push4 = hslider("[5] Makeup4 [tooltip: Post amplification and threshold]" , 8, -50, +50, 0.1) ; // threshold-=push ; makeup+=push
86 push5 = hslider("[5] Makeup5 [tooltip: Post amplification and threshold]" , 11, -50, +50, 0.1) ; // threshold-=push ; makeup+=push
87
88 safe1 = hslider("[6] MakeupThreshold1 [tooltip: Threshold correction, an anticlip measure]" , 2, 0, +10, 0.1) ; // makeup-=safe
89 safe2 = hslider("[6] MakeupThreshold2 [tooltip: Threshold correction, an anticlip measure]" , 2, 0, +10, 0.1) ; // makeup-=safe
90 safe3 = hslider("[6] MakeupThreshold3 [tooltip: Threshold correction, an anticlip measure]" , 2, 0, +10, 0.1) ; // makeup-=safe
91 safe4 = hslider("[6] MakeupThreshold4 [tooltip: Threshold correction, an anticlip measure]" , 2, 0, +10, 0.1) ; // makeup-=safe
92 safe5 = hslider("[6] MakeupThreshold5 [tooltip: Threshold correction, an anticlip measure]" , 2, 0, +10, 0.1) ; // makeup-=safe
93
94 Makeup1 = mute1* (not(bswitch1)*(push1-safe1) : db2linear : smooth(0.999));
95 Makeup2 = mute2* (not(bswitch2)*(push2-safe2) : db2linear : smooth(0.999));
96 Makeup3 = mute3* (not(bswitch3)*(push3-safe3) : db2linear : smooth(0.999));
97 Makeup4 = mute4* (not(bswitch4)*(push4-safe4) : db2linear : smooth(0.999));
98 Makeup5 = mute5* (not(bswitch5)*(push5-safe5) : db2linear : smooth(0.999));
99
100 //Low end headsets: 13,10,4,8,11 (split 80,210,1700,5000)
101 //Mid-high end headsets: 17,20.5,20,10.5,10 (split 44,180,800,5000)
0 declare id "mbd";
1 declare name "MultiBand Distortion";
2 declare shortname "MB Distortion";
3 declare category "Distortion";
4 declare description "MultiBand Distortion";
5
6 import("effect.lib");
7 import("filter.lib");
8 import("music.lib");
9 import("math.lib");
10 import("reduce.lib");
11
12 anti_denormal = pow(10,-20);
13 anti_denormal_ac = 1 - 1' : *(anti_denormal) : + ~ *(-1);
14
15 hifr1 =hslider("crossover_b1_b2 [log][name:Crossover B1-B2 (hz)][tooltip: Crossover bandpass frequency]" ,80 , 20, 20000, 1.08);
16 hifr2 =hslider("crossover_b2_b3 [log][name:Crossover B2-B3 (hz)][tooltip: Crossover bandpass frequency]",210,20,20000,1.08);
17 hifr3 =hslider("crossover_b3_b4 [log][name:Crossover B3-B4 (hz)][tooltip: Crossover bandpass frequency]",1700,20,20000,1.08);
18 hifr4 =hslider("crossover_b4_b5 [log][name:Crossover B4-B5 (hz)][tooltip: Crossover bandpass frequency]",5000,20,20000,1.08);
19
20 geq = filterbank(3, (hifr1,hifr2,hifr3,hifr4));
21
22 drive1 = hslider("Drive1 [tooltip: Amount of distortion]", 0, 0, 1, 0.01);
23 offset1 = hslider("Offset1 [tooltip: Brings in even harmonics]", 0, 0, 0.5, 0.01);
24 drive2 = hslider("Drive2 [tooltip: Amount of distortion]", 0, 0, 1, 0.01);
25 offset2 = hslider("Offset2 [tooltip: Brings in even harmonics]", 0, 0, 0.5, 0.01);
26 drive3 = hslider("Drive3 [tooltip: Amount of distortion]", 0, 0, 1, 0.01);
27 offset3 = hslider("Offset3 [tooltip: Brings in even harmonics]", 0, 0, 0.5, 0.01);
28 drive4 = hslider("Drive4 [tooltip: Amount of distortion]", 0, 0, 1, 0.01);
29 offset4 = hslider("Offset4 [tooltip: Brings in even harmonics]", 0, 0, 0.5, 0.01);
30 drive5 = hslider("Drive5 [tooltip: Amount of distortion]", 0, 0, 1, 0.01);
31 offset5 = hslider("Offset5 [tooltip: Brings in even harmonics]", 0, 0, 0.5, 0.01);
32
33 gain1 = vslider("Gain", 0, -40, 4, 0.1) : db2linear : smooth(0.999);
34
35 vmeter1(x) = attach(x, envelop(x) : vbargraph("v1[nomidi:no]", -70, +5));
36 vmeter2(x) = attach(x, envelop(x) : vbargraph("v2[nomidi:no]", -70, +5));
37 vmeter3(x) = attach(x, envelop(x) : vbargraph("v3[nomidi:no]", -70, +5));
38 vmeter4(x) = attach(x, envelop(x) : vbargraph("v4[nomidi:no]", -70, +5));
39 vmeter5(x) = attach(x, envelop(x) : vbargraph("v5[nomidi:no]", -70, +5));
40
41 envelop = abs : max ~ (1.0/SR) : reduce(max,4096); // : max(db2linear(-70)) : linear2db;
42
43 process = _: +(anti_denormal_ac): geq: ( dist5s , dist4s , dist3s, dist2s, dist1s) :> *(gain1) with {
44 dist1s = cubicnl_nodc(drive1,offset1: smooth(0.999)) : vmeter1;
45 dist2s = cubicnl_nodc(drive2,offset2: smooth(0.999)) : vmeter2;
46 dist3s = cubicnl_nodc(drive3,offset3: smooth(0.999)) : vmeter3;
47 dist4s = cubicnl_nodc(drive4,offset4: smooth(0.999)) : vmeter4;
48 dist5s = cubicnl_nodc(drive5,offset5: smooth(0.999)) : vmeter5;
49
50 };
0 declare id "mbdel";
1 declare name "MultiBand Delay";
2 declare shortname "MB Delay";
3 declare category "Echo / Delay";
4 declare description "Multi Band Delay";
5
6 import("effect.lib");
7 import("filter.lib");
8 import("music.lib");
9 import("math.lib");
10 import("reduce.lib");
11
12 hifr1 =hslider("crossover_b1_b2 [log][name:Crossover B1-B2 (hz)][tooltip: Crossover bandpass frequency]" ,80 , 20, 20000, 1.08);
13 hifr2 =hslider("crossover_b2_b3 [log][name:Crossover B2-B3 (hz)][tooltip: Crossover bandpass frequency]",210,20,20000,1.08);
14 hifr3 =hslider("crossover_b3_b4 [log][name:Crossover B3-B4 (hz)][tooltip: Crossover bandpass frequency]",1700,20,20000,1.08);
15 hifr4 =hslider("crossover_b4_b5 [log][name:Crossover B4-B5 (hz)][tooltip: Crossover bandpass frequency]",5000,20,20000,1.08);
16
17 geq = filterbank(3, (hifr1,hifr2,hifr3,hifr4));
18
19
20 interp = 100*SR/1000.0;
21 N = int( 2^18);
22 g1 = vslider("gain1", -10, -20, 20, 0.1) : db2linear : smooth(0.999);
23 d1 = tempo(hslider("delay1[tooltip:Delay in Beats per Minute]",30,24,360,1));
24 g2 = vslider("gain2", -5, -20, 20, 0.1) : db2linear : smooth(0.999);
25 d2 = tempo(hslider("delay2[tooltip:Delay in Beats per Minute]",60,24,360,1));
26 g3 = vslider("gain3", -2, -20, 20, 0.1) : db2linear : smooth(0.999);
27 d3 = tempo(hslider("delay3[tooltip:Delay in Beats per Minute]",90,24,360,1));
28 g4 = vslider("gain4", 0, -20, 20, 0.1) : db2linear : smooth(0.999);
29 d4 = tempo(hslider("delay4[tooltip:Delay in Beats per Minute]",120,24,360,1));
30 g5 = vslider("gain5", -10, -20, 20, 0.1) : db2linear : smooth(0.999);
31 d5 = tempo(hslider("delay5[tooltip:Delay in Beats per Minute]",150,24,360,1));
32
33 del(g,d) = *(g) : sdelay(N, interp,d) ;
34
35 vmeter1(x) = attach(x, envelop(x) : vbargraph("v1[nomidi:no]", -70, +5));
36 vmeter2(x) = attach(x, envelop(x) : vbargraph("v2[nomidi:no]", -70, +5));
37 vmeter3(x) = attach(x, envelop(x) : vbargraph("v3[nomidi:no]", -70, +5));
38 vmeter4(x) = attach(x, envelop(x) : vbargraph("v4[nomidi:no]", -70, +5));
39 vmeter5(x) = attach(x, envelop(x) : vbargraph("v5[nomidi:no]", -70, +5));
40
41 envelop = abs : max ~ (1.0/SR) : reduce(max,4096) ; // : max(db2linear(-70)) : linear2db;
42
43 process = _<:(geq: ( dist5s , dist4s , dist3s, dist2s, dist1s)),_:>_ with {
44 dist1s = del(g1,d1) : vmeter1;
45 dist2s = del(g2,d2) : vmeter2;
46 dist3s = del(g3,d3) : vmeter3;
47 dist4s = del(g4,d4) : vmeter4;
48 dist5s = del(g5,d5) : vmeter5;
49
50 };
0 declare id "mbe";
1 declare name "MultiBand Echo";
2 declare shortname "MB Echo";
3 declare category "Echo / Delay";
4 declare description "Multi Band Echo";
5
6 import("effect.lib");
7 import("filter.lib");
8 import("music.lib");
9 import("math.lib");
10 import("reduce.lib");
11
12 hifr1 =hslider("crossover_b1_b2 [log][name:Crossover B1-B2 (hz)][tooltip: Crossover bandpass frequency]" ,80 , 20, 20000, 1.08);
13 hifr2 =hslider("crossover_b2_b3 [log][name:Crossover B2-B3 (hz)][tooltip: Crossover bandpass frequency]",210,20,20000,1.08);
14 hifr3 =hslider("crossover_b3_b4 [log][name:Crossover B3-B4 (hz)][tooltip: Crossover bandpass frequency]",1700,20,20000,1.08);
15 hifr4 =hslider("crossover_b4_b5 [log][name:Crossover B4-B5 (hz)][tooltip: Crossover bandpass frequency]",5000,20,20000,1.08);
16
17 geq = filterbank(3, (hifr1,hifr2,hifr3,hifr4));
18
19
20 t1 = tempo(hslider("time1[tooltip:Echo in Beats per Minute]",30,24,360,1));
21 r1 = hslider("percent1", 10, 0, 100, 0.1)/100.0 : smooth(0.999);
22 t2 = tempo(hslider("time2[tooltip:Echo in Beats per Minute]",60,24,360,1));
23 r2 = hslider("percent2", 30, 0, 100, 0.1)/100.0 : smooth(0.999);
24 t3 = tempo(hslider("time3[tooltip:Echo in Beats per Minute]",120,24,360,1));
25 r3 = hslider("percent3", 45, 0, 100, 0.1)/100.0 : smooth(0.999);
26 t4 = tempo(hslider("time4[tooltip:Echo in Beats per Minute]",150,24,360,1));
27 r4 = hslider("percent4", 20, 0, 100, 0.1)/100.0 : smooth(0.999);
28 t5 = tempo(hslider("time5[tooltip:Echo in Beats per Minute]",240,24,360,1));
29 r5 = hslider("percent5", 0, 0, 100, 0.1)/100.0 : smooth(0.999);
30
31 vmeter1(x) = attach(x, envelop(x) : vbargraph("v1[nomidi:no]", -70, +5));
32 vmeter2(x) = attach(x, envelop(x) : vbargraph("v2[nomidi:no]", -70, +5));
33 vmeter3(x) = attach(x, envelop(x) : vbargraph("v3[nomidi:no]", -70, +5));
34 vmeter4(x) = attach(x, envelop(x) : vbargraph("v4[nomidi:no]", -70, +5));
35 vmeter5(x) = attach(x, envelop(x) : vbargraph("v5[nomidi:no]", -70, +5));
36
37 envelop = abs : max ~ (1.0/SR) : reduce(max,4096) ; // : max(db2linear(-70)) : linear2db;
38
39 echo1(t,r) = +~(sdelay(int(2^18), 100*SR/1000.0, t) * (r));
40
41 process = geq: ( dist5s , dist4s , dist3s, dist2s, dist1s) :>_ with {
42 dist1s = echo1(t1,r1) : vmeter1 ;
43 dist2s = echo1(t2,r2) : vmeter2;
44 dist3s = echo1(t3,r3) : vmeter3;
45 dist4s = echo1(t4,r4) : vmeter4;
46 dist5s = echo1(t5,r5) : vmeter5;
47
48 };
11 # encoding: utf-8
22
33 import wscript_helper
4 import shutil
45
56 def build(bld):
67 unused_sources = [
5152 'gxtubedelay.dsp',
5253 'gxtubevibrato.dsp',
5354 'gxechocat.dsp',
55 'mbdel.dsp',
56 'mbe.dsp',
5457
5558 ]
5659
9396 'gx_studiopre_st.dsp',
9497 'low_high_cut.dsp',
9598 'uniBar.dsp',
96
99 'mbd.dsp',
100 'mbc.dsp',
101 'bmfp.dsp',
102 'lowpass_up.dsp',
103 'lowpass_down.dsp',
104 'graphiceq.dsp',
105 'duck_delay.dsp',
106 'duck_delay_st.dsp',
107
97108 # tone stacks
98109 'tonestack_default.dsp',
99110 'tonestack_bassman.dsp',
200211 'balance.dsp',
201212 ]
202213
214 sources_gx_plugin = [
215
216 # 'graphiceq.dsp',
217 ]
218
203219
204220 if bld.env['FAUST']:
221 for x in sources_gx_plugin:
222 shutil.copy('src/faust/%s' % x, 'src/LV2/faust/%s' % x)
223
205224 arg, float_arg, double_arg = wscript_helper.get_faust_args(bld)
206225 bld.new_task_gen(
207226 source = sources_plugin,
227 proc = "../tools/dsp2cc",
228 proc_args = arg+["--init-type=plugin-lv2"],
229 )
230 bld.new_task_gen(
231 source = sources_gx_plugin,
208232 proc = "../tools/dsp2cc",
209233 proc_args = arg+["--init-type=plugin-lv2"],
210234 )
2525 void connect(uint32_t port,void* data);
2626 void clear_state_f();
2727 void init(uint32_t samplingFreq);
28 void compute(int count, float *input0, float *output0);
28 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2929
3030 static void clear_state_f_static(PluginLV2*);
3131 static void init_static(uint32_t samplingFreq, PluginLV2*);
32 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
32 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
3333 static void del_instance(PluginLV2 *p);
3434 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3535 public:
8686 static_cast<Dsp*>(p)->init(samplingFreq);
8787 }
8888
89 void always_inline Dsp::compute(int count, float *input0, float *output0)
89 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
9090 {
9191 #define fslider0 (*fslider0_)
9292 #define fslider1 (*fslider1_)
121121 #undef fslider2
122122 }
123123
124 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
124 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
125125 {
126126 static_cast<Dsp*>(p)->compute(count, input0, output0);
127127 }
1212 void connect(uint32_t port,void* data);
1313 void clear_state_f();
1414 void init(uint32_t samplingFreq);
15 void compute(int count, float *input0, float *input1, float *output0, float *output1);
15 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
1616
1717 static void clear_state_f_static(PluginLV2*);
1818 static void init_static(uint32_t samplingFreq, PluginLV2*);
19 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
19 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2020 static void del_instance(PluginLV2 *p);
2121 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2222 public:
6464 static_cast<Dsp*>(p)->init(samplingFreq);
6565 }
6666
67 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
67 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
6868 {
6969 #define fslider0 (*fslider0_)
7070 double fSlow0 = (0.0010000000000000009 * fslider0);
7878 #undef fslider0
7979 }
8080
81 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
81 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
8282 {
8383 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
8484 }
1717 void connect(uint32_t port,void* data);
1818 void clear_state_f();
1919 void init(uint32_t samplingFreq);
20 void compute(int count, float *input0, float *output0);
20 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2121
2222 static void clear_state_f_static(PluginLV2*);
2323 static void init_static(uint32_t samplingFreq, PluginLV2*);
24 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
24 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2525 static void del_instance(PluginLV2 *p);
2626 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2727 public:
7979 static_cast<Dsp*>(p)->init(samplingFreq);
8080 }
8181
82 void always_inline Dsp::compute(int count, float *input0, float *output0)
82 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8383 {
8484 #define fslider0 (*fslider0_)
8585 double fSlow0 = pow(10,(0.05 * fslider0));
9797 #undef fslider0
9898 }
9999
100 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
100 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
101101 {
102102 static_cast<Dsp*>(p)->compute(count, input0, output0);
103103 }
1313 void connect(uint32_t port,void* data);
1414 void clear_state_f();
1515 void init(uint32_t samplingFreq);
16 void compute(int count, float *input0, float *output0);
16 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1717
1818 static void clear_state_f_static(PluginLV2*);
1919 static void init_static(uint32_t samplingFreq, PluginLV2*);
20 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
20 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2121 static void del_instance(PluginLV2 *p);
2222 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2323 public:
6666 static_cast<Dsp*>(p)->init(samplingFreq);
6767 }
6868
69 void always_inline Dsp::compute(int count, float *input0, float *output0)
69 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7070 {
7171 #define fslider0 (*fslider0_)
7272 double fSlow0 = log((fConst0 * fslider0));
8080 #undef fslider0
8181 }
8282
83 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
83 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
8484 {
8585 static_cast<Dsp*>(p)->compute(count, input0, output0);
8686 }
0 // generated from file '../src/LV2/faust/bmfp.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.65 (http://faust.grame.fr)
2
3
4 namespace bmfp {
5
6 class Dsp: public PluginLV2 {
7 private:
8 uint32_t fSamplingFreq;
9 FAUSTFLOAT fslider0;
10 FAUSTFLOAT *fslider0_;
11 double fRec3[2];
12 FAUSTFLOAT fslider1;
13 FAUSTFLOAT *fslider1_;
14 double fVec0[2];
15 int iConst0;
16 double fConst1;
17 double fConst2;
18 double fConst3;
19 double fConst4;
20 double fRec2[2];
21 FAUSTFLOAT fslider2;
22 FAUSTFLOAT *fslider2_;
23 double fConst5;
24 double fConst6;
25 double fConst7;
26 double fConst8;
27 double fConst9;
28 double fConst10;
29 double fConst11;
30 double fRec4[2];
31 FAUSTFLOAT fslider3;
32 FAUSTFLOAT *fslider3_;
33 double fVec1[2];
34 double fConst12;
35 double fConst13;
36 double fConst14;
37 double fConst15;
38 double fRec1[2];
39 double fConst16;
40 double fConst17;
41 double fConst18;
42 double fConst19;
43 double fConst20;
44 double fRec0[2];
45 void connect(uint32_t port,void* data);
46 void clear_state_f();
47 void init(uint32_t samplingFreq);
48 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
49
50 static void clear_state_f_static(PluginLV2*);
51 static void init_static(uint32_t samplingFreq, PluginLV2*);
52 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
53 static void del_instance(PluginLV2 *p);
54 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
55 public:
56 Dsp();
57 ~Dsp();
58 };
59
60
61
62 Dsp::Dsp()
63 : PluginLV2() {
64 version = PLUGINLV2_VERSION;
65 id = "bmpf";
66 name = N_("BigMuffFuzzPadel");
67 mono_audio = compute_static;
68 stereo_audio = 0;
69 set_samplerate = init_static;
70 activate_plugin = 0;
71 connect_ports = connect_static;
72 clear_state = clear_state_f_static;
73 delete_instance = del_instance;
74 }
75
76 Dsp::~Dsp() {
77 }
78
79 inline void Dsp::clear_state_f()
80 {
81 for (int i=0; i<2; i++) fRec3[i] = 0;
82 for (int i=0; i<2; i++) fVec0[i] = 0;
83 for (int i=0; i<2; i++) fRec2[i] = 0;
84 for (int i=0; i<2; i++) fRec4[i] = 0;
85 for (int i=0; i<2; i++) fVec1[i] = 0;
86 for (int i=0; i<2; i++) fRec1[i] = 0;
87 for (int i=0; i<2; i++) fRec0[i] = 0;
88 }
89
90 void Dsp::clear_state_f_static(PluginLV2 *p)
91 {
92 static_cast<Dsp*>(p)->clear_state_f();
93 }
94
95 inline void Dsp::init(uint32_t samplingFreq)
96 {
97 fSamplingFreq = samplingFreq;
98 iConst0 = min(192000, max(1, fSamplingFreq));
99 fConst1 = (1.0 / tan((1281.7698026646356 / double(iConst0))));
100 fConst2 = (1 + fConst1);
101 fConst3 = (1.0 / fConst2);
102 fConst4 = (0 - ((1 - fConst1) / fConst2));
103 fConst5 = tan((5830.795965062656 / double(iConst0)));
104 fConst6 = (0.01 / fConst5);
105 fConst7 = (1.0 / fConst5);
106 fConst8 = (0 - fConst7);
107 fConst9 = (1 + fConst7);
108 fConst10 = (1.0 / fConst9);
109 fConst11 = (0 - ((1 - fConst7) / fConst9));
110 fConst12 = (1.0 / tan((17690.308232364125 / double(iConst0))));
111 fConst13 = (1 + fConst12);
112 fConst14 = (1.0 / fConst13);
113 fConst15 = (0 - ((1 - fConst12) / fConst13));
114 fConst16 = (1.0 / tan((251.32741228718345 / double(iConst0))));
115 fConst17 = (0 - fConst16);
116 fConst18 = (1 + fConst16);
117 fConst19 = (1.0 / fConst18);
118 fConst20 = (0 - ((1 - fConst16) / fConst18));
119 clear_state_f();
120 }
121
122 void Dsp::init_static(uint32_t samplingFreq, PluginLV2 *p)
123 {
124 static_cast<Dsp*>(p)->init(samplingFreq);
125 }
126
127 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
128 {
129 #define fslider0 (*fslider0_)
130 #define fslider1 (*fslider1_)
131 #define fslider2 (*fslider2_)
132 #define fslider3 (*fslider3_)
133 double fSlow0 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider0))));
134 double fSlow1 = double(fslider1);
135 double fSlow2 = (0.01 * fSlow1);
136 double fSlow3 = double(fslider2);
137 double fSlow4 = (1 - fSlow3);
138 double fSlow5 = (fConst6 * fSlow1);
139 double fSlow6 = double(fslider3);
140 double fSlow7 = (0.009900990099009901 * fSlow6);
141 double fSlow8 = (1 + fSlow7);
142 double fSlow9 = (0.25 * fSlow6);
143 double fSlow10 = (1 - fSlow2);
144 for (int i=0; i<count; i++) {
145 fRec3[0] = ((0.999 * fRec3[1]) + fSlow0);
146 double fTemp0 = (double)input0[i];
147 double fTemp1 = (fTemp0 * fRec3[0]);
148 double fTemp2 = (fSlow2 * fTemp1);
149 fVec0[0] = fTemp2;
150 fRec2[0] = ((fConst4 * fRec2[1]) + (fConst3 * (fVec0[0] + fVec0[1])));
151 fRec4[0] = ((fConst11 * fRec4[1]) + (fConst10 * ((fConst8 * fVec0[1]) + (fSlow5 * fTemp1))));
152 double fTemp3 = ((fSlow3 * fRec4[0]) + (fSlow4 * fRec2[0]));
153 double fTemp4 = (1 + (fSlow7 * fabs(fTemp3)));
154 double fTemp5 = max(-0.7, min(0.7, (fSlow8 * ((fTemp3 * (1 + (fSlow9 * ((2 - fabs((fSlow8 * (fTemp3 / fTemp4)))) - 1)))) / fTemp4))));
155 double fTemp6 = ((fSlow10 * fTemp0) + (fTemp5 * (1 + faustpower<6>(fTemp5))));
156 fVec1[0] = fTemp6;
157 fRec1[0] = ((fConst15 * fRec1[1]) + (fConst14 * (fVec1[0] + fVec1[1])));
158 fRec0[0] = ((fConst20 * fRec0[1]) + (fConst19 * ((fConst16 * fRec1[0]) + (fConst17 * fRec1[1]))));
159 output0[i] = (FAUSTFLOAT)fRec0[0];
160 // post processing
161 fRec0[1] = fRec0[0];
162 fRec1[1] = fRec1[0];
163 fVec1[1] = fVec1[0];
164 fRec4[1] = fRec4[0];
165 fRec2[1] = fRec2[0];
166 fVec0[1] = fVec0[0];
167 fRec3[1] = fRec3[0];
168 }
169 #undef fslider0
170 #undef fslider1
171 #undef fslider2
172 #undef fslider3
173 }
174
175 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
176 {
177 static_cast<Dsp*>(p)->compute(count, input0, output0);
178 }
179
180
181 void Dsp::connect(uint32_t port,void* data)
182 {
183 switch ((PortIndex)port)
184 {
185 case INPUT:
186 fslider0_ = (float*)data; // , 0.0, -24.0, 2e+01, 0.1
187 break;
188 case OUTPUT:
189 fslider1_ = (float*)data; // , 1e+02, 5e+01, 1e+02, 1.0
190 break;
191 case DRIVE:
192 fslider3_ = (float*)data; // , 1.0, -3.0, 1e+02, 1.0
193 break;
194 case TONE:
195 fslider2_ = (float*)data; // , 0.5, 0.0, 1.0, 0.01
196 break;
197 default:
198 break;
199 }
200 }
201
202 void Dsp::connect_static(uint32_t port,void* data, PluginLV2 *p)
203 {
204 static_cast<Dsp*>(p)->connect(port, data);
205 }
206
207
208 PluginLV2 *plugin() {
209 return new Dsp();
210 }
211
212 void Dsp::del_instance(PluginLV2 *p)
213 {
214 delete static_cast<Dsp*>(p);
215 }
216
217 /*
218 typedef enum
219 {
220 INPUT,
221 OUTPUT,
222 DRIVE,
223 TONE,
224 } PortIndex;
225 */
226
227 } // end namespace bmfp
4949 void clear_state_f();
5050 int activate(bool start);
5151 void init(uint32_t samplingFreq);
52 void compute(int count, float *input0, float *input1, float *output0, float *output1);
52 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
5353
5454 static void clear_state_f_static(PluginLV2*);
5555 static int activate_static(bool start, PluginLV2*);
5656 static void init_static(uint32_t samplingFreq, PluginLV2*);
57 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
57 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
5858 static void del_instance(PluginLV2 *p);
5959 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
6060 public:
146146 return static_cast<Dsp*>(p)->activate(start);
147147 }
148148
149 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
149 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
150150 {
151151 #define fslider0 (*fslider0_)
152152 #define fslider1 (*fslider1_)
188188 #undef fslider3
189189 }
190190
191 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
191 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
192192 {
193193 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
194194 }
4242 void connect(uint32_t port,void* data);
4343 void clear_state_f();
4444 void init(uint32_t samplingFreq);
45 void compute(int count, float *input0, float *output0);
45 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
4646
4747 static void clear_state_f_static(PluginLV2*);
4848 static void init_static(uint32_t samplingFreq, PluginLV2*);
49 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
49 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
5050 static void del_instance(PluginLV2 *p);
5151 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
5252 public:
103103 static_cast<Dsp*>(p)->init(samplingFreq);
104104 }
105105
106 void always_inline Dsp::compute(int count, float *input0, float *output0)
106 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
107107 {
108108 #define fslider0 (*fslider0_)
109109 #define fslider1 (*fslider1_)
134134 #undef fslider2
135135 }
136136
137 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
137 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
138138 {
139139 static_cast<Dsp*>(p)->compute(count, input0, output0);
140140 }
2525 void connect(uint32_t port,void* data);
2626 void clear_state_f();
2727 void init(uint32_t samplingFreq);
28 void compute(int count, float *input0, float *output0);
28 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2929
3030 static void clear_state_f_static(PluginLV2*);
3131 static void init_static(uint32_t samplingFreq, PluginLV2*);
32 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
32 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
3333 static void del_instance(PluginLV2 *p);
3434 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3535 public:
8282 static_cast<Dsp*>(p)->init(samplingFreq);
8383 }
8484
85 void always_inline Dsp::compute(int count, float *input0, float *output0)
85 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8686 {
8787 #define fentry0 (*fentry0_)
8888 #define fentry1 (*fentry1_)
114114 #undef fentry2
115115 }
116116
117 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
117 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
118118 {
119119 static_cast<Dsp*>(p)->compute(count, input0, output0);
120120 }
2222 void connect(uint32_t port,void* data);
2323 void clear_state_f();
2424 void init(uint32_t samplingFreq);
25 void compute(int count, float *input0, float *output0);
25 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2626
2727 static void clear_state_f_static(PluginLV2*);
2828 static void init_static(uint32_t samplingFreq, PluginLV2*);
29 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
29 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
3030 static void del_instance(PluginLV2 *p);
3131 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3232 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
112112 #undef fslider2
113113 }
114114
115 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
115 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
116116 {
117117 static_cast<Dsp*>(p)->compute(count, input0, output0);
118118 }
2121 void clear_state_f();
2222 int activate(bool start);
2323 void init(uint32_t samplingFreq);
24 void compute(int count, float *input0, float *output0);
24 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2525
2626 static void clear_state_f_static(PluginLV2*);
2727 static int activate_static(bool start, PluginLV2*);
2828 static void init_static(uint32_t samplingFreq, PluginLV2*);
29 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
29 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
3030 static void del_instance(PluginLV2 *p);
3131 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3232 public:
108108 return static_cast<Dsp*>(p)->activate(start);
109109 }
110110
111 void always_inline Dsp::compute(int count, float *input0, float *output0)
111 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
112112 {
113113 #define fslider0 (*fslider0_)
114114 #define fslider1 (*fslider1_)
133133 #undef fslider1
134134 }
135135
136 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
136 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
137137 {
138138 static_cast<Dsp*>(p)->compute(count, input0, output0);
139139 }
0 // generated from file '../src/LV2/faust/duck_delay.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.46 (http://faust.grame.fr)
2
3
4 namespace duck_delay {
5
6 class Dsp: public PluginLV2 {
7 private:
8 uint32_t fSamplingFreq;
9 int iConst0;
10 double fConst1;
11 FAUSTFLOAT fslider0;
12 FAUSTFLOAT *fslider0_;
13 double fConst2;
14 FAUSTFLOAT fslider1;
15 FAUSTFLOAT *fslider1_;
16 double fRec2[2];
17 double fRec1[2];
18 FAUSTFLOAT fslider2;
19 FAUSTFLOAT *fslider2_;
20 double fConst3;
21 double fRec0[2];
22 FAUSTFLOAT fslider3;
23 FAUSTFLOAT *fslider3_;
24 int IOTA;
25 double fVec0[524288];
26 FAUSTFLOAT fslider4;
27 FAUSTFLOAT *fslider4_;
28 double fRec4[2];
29 double fConst4;
30 double fRec3[2];
31 void connect(uint32_t port,void* data);
32 void clear_state_f();
33 void init(uint32_t samplingFreq);
34 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
35
36 static void clear_state_f_static(PluginLV2*);
37 static void init_static(uint32_t samplingFreq, PluginLV2*);
38 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
39 static void del_instance(PluginLV2 *p);
40 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
41 public:
42 Dsp();
43 ~Dsp();
44 };
45
46
47
48 Dsp::Dsp()
49 : PluginLV2() {
50 version = PLUGINLV2_VERSION;
51 id = "duckDelay";
52 name = N_("Duck Delay");
53 mono_audio = compute_static;
54 stereo_audio = 0;
55 set_samplerate = init_static;
56 activate_plugin = 0;
57 connect_ports = connect_static;
58 clear_state = clear_state_f_static;
59 delete_instance = del_instance;
60 }
61
62 Dsp::~Dsp() {
63 }
64
65 inline void Dsp::clear_state_f()
66 {
67 for (int i=0; i<2; i++) fRec2[i] = 0;
68 for (int i=0; i<2; i++) fRec1[i] = 0;
69 for (int i=0; i<2; i++) fRec0[i] = 0;
70 for (int i=0; i<524288; i++) fVec0[i] = 0;
71 for (int i=0; i<2; i++) fRec4[i] = 0;
72 for (int i=0; i<2; i++) fRec3[i] = 0;
73 }
74
75 void Dsp::clear_state_f_static(PluginLV2 *p)
76 {
77 static_cast<Dsp*>(p)->clear_state_f();
78 }
79
80 inline void Dsp::init(uint32_t samplingFreq)
81 {
82 fSamplingFreq = samplingFreq;
83 iConst0 = min(192000, max(1, fSamplingFreq));
84 fConst1 = exp((0 - (1e+01 / iConst0)));
85 fConst2 = (1.0 / iConst0);
86 fConst3 = (1.0 - fConst1);
87 IOTA = 0;
88 fConst4 = (0.001 * iConst0);
89 clear_state_f();
90 }
91
92 void Dsp::init_static(uint32_t samplingFreq, PluginLV2 *p)
93 {
94 static_cast<Dsp*>(p)->init(samplingFreq);
95 }
96
97 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
98 {
99 #define fslider0 (*fslider0_)
100 #define fslider1 (*fslider1_)
101 #define fslider2 (*fslider2_)
102 #define fslider3 (*fslider3_)
103 #define fslider4 (*fslider4_)
104 double fSlow0 = exp((0 - (fConst2 / fslider0)));
105 double fSlow1 = exp((0 - (fConst2 / fslider1)));
106 double fSlow2 = (1.0 - fSlow1);
107 double fSlow3 = (1.0 - fSlow0);
108 double fSlow4 = pow(10,(0.05 * fslider2));
109 double fSlow5 = fslider3;
110 double fSlow6 = (fConst3 * fslider4);
111 for (int i=0; i<count; i++) {
112 double fTemp0 = (double)input0[i];
113 double fTemp1 = fabs(fTemp0);
114 fRec2[0] = ((fSlow2 * fTemp1) + (fSlow1 * max(fTemp1, fRec2[1])));
115 fRec1[0] = ((fSlow3 * fRec2[0]) + (fSlow0 * fRec1[1]));
116 fRec0[0] = ((fConst3 * (1 - ((fSlow4 * fRec1[0]) > 1))) + (fConst1 * fRec0[1]));
117 double fTemp2 = (fTemp0 + (fSlow5 * fRec3[1]));
118 fVec0[IOTA&524287] = fTemp2;
119 fRec4[0] = (fSlow6 + (fConst1 * fRec4[1]));
120 double fTemp3 = (fConst4 * fRec4[0]);
121 int iTemp4 = int(fTemp3);
122 int iTemp5 = (1 + iTemp4);
123 fRec3[0] = (((fTemp3 - iTemp4) * fVec0[(IOTA-int((int(iTemp5) & 393215)))&524287]) + ((iTemp5 - fTemp3) * fVec0[(IOTA-int((iTemp4 & 393215)))&524287]));
124 output0[i] = (FAUSTFLOAT)(fTemp0 + (fRec3[0] * fRec0[0]));
125 // post processing
126 fRec3[1] = fRec3[0];
127 fRec4[1] = fRec4[0];
128 IOTA = IOTA+1;
129 fRec0[1] = fRec0[0];
130 fRec1[1] = fRec1[0];
131 fRec2[1] = fRec2[0];
132 }
133 #undef fslider0
134 #undef fslider1
135 #undef fslider2
136 #undef fslider3
137 #undef fslider4
138 }
139
140 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
141 {
142 static_cast<Dsp*>(p)->compute(count, input0, output0);
143 }
144
145
146 void Dsp::connect(uint32_t port,void* data)
147 {
148 switch ((PortIndex)port)
149 {
150 case AMOUNT:
151 fslider2_ = (float*)data; // , 0.5, 0.0, 56.0, 0.05
152 break;
153 case ATTACK:
154 fslider0_ = (float*)data; // , 0.1, 0.05, 0.5, 0.05
155 break;
156 case FEEDBACK:
157 fslider3_ = (float*)data; // , 0.0, 0.0, 1.0, 0.05
158 break;
159 case RELESE:
160 fslider1_ = (float*)data; // , 0.1, 0.05, 2.0, 0.05
161 break;
162 case TIME:
163 fslider4_ = (float*)data; // , 5e+02, 1.0, 2e+03, 1.0
164 break;
165 default:
166 break;
167 }
168 }
169
170 void Dsp::connect_static(uint32_t port,void* data, PluginLV2 *p)
171 {
172 static_cast<Dsp*>(p)->connect(port, data);
173 }
174
175
176 PluginLV2 *plugin() {
177 return new Dsp();
178 }
179
180 void Dsp::del_instance(PluginLV2 *p)
181 {
182 delete static_cast<Dsp*>(p);
183 }
184
185 /*
186 typedef enum
187 {
188 AMOUNT,
189 ATTACK,
190 FEEDBACK,
191 RELESE,
192 TIME,
193 } PortIndex;
194 */
195
196 } // end namespace duck_delay
0 // generated from file '../src/LV2/faust/duck_delay_st.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.65 (http://faust.grame.fr)
2
3
4 namespace duck_delay_st {
5
6 class Dsp: public PluginLV2 {
7 private:
8 uint32_t fSamplingFreq;
9 int iConst0;
10 double fConst1;
11 double fConst2;
12 double fConst3;
13 double fConst4;
14 double fConst5;
15 double fConst6;
16 double fConst7;
17 double fConst8;
18 FAUSTFLOAT fslider0;
19 FAUSTFLOAT *fslider0_;
20 FAUSTFLOAT fslider1;
21 FAUSTFLOAT *fslider1_;
22 int IOTA;
23 double fVec0[524288];
24 double fConst9;
25 FAUSTFLOAT fslider2;
26 FAUSTFLOAT *fslider2_;
27 double fConst10;
28 double fRec6[2];
29 double fConst11;
30 double fRec5[2];
31 double fRec3[2];
32 double fVec1[524288];
33 double fRec7[2];
34 double fRec4[2];
35 double fConst12;
36 double fConst13;
37 double fConst14;
38 double fConst15;
39 double fRec2[2];
40 double fRec1[3];
41 double fConst16;
42 double fRec0[3];
43 FAUSTFLOAT fslider3;
44 FAUSTFLOAT *fslider3_;
45 double fRec10[2];
46 double fRec9[3];
47 double fRec8[3];
48 double fConst17;
49 double fConst18;
50 double fConst19;
51 double fConst20;
52 double fConst21;
53 double fConst22;
54 double fConst23;
55 double fConst24;
56 double fConst25;
57 double fConst26;
58 double fConst27;
59 double fRec13[2];
60 double fRec12[3];
61 double fRec11[3];
62 double fConst28;
63 double fRec16[2];
64 double fRec15[3];
65 double fConst29;
66 double fRec14[3];
67 FAUSTFLOAT fslider4;
68 FAUSTFLOAT *fslider4_;
69 double fRec17[2];
70 FAUSTFLOAT fslider5;
71 FAUSTFLOAT *fslider5_;
72 double fConst30;
73 double fRec20[2];
74 FAUSTFLOAT fslider6;
75 FAUSTFLOAT *fslider6_;
76 double fRec19[2];
77 FAUSTFLOAT fslider7;
78 FAUSTFLOAT *fslider7_;
79 double fRec18[2];
80 double fRec23[2];
81 double fRec22[3];
82 double fRec21[3];
83 double fRec26[2];
84 double fRec25[3];
85 double fRec24[3];
86 double fRec29[2];
87 double fRec28[3];
88 double fRec27[3];
89 double fRec32[2];
90 double fRec31[3];
91 double fRec30[3];
92 double fRec35[2];
93 double fRec34[2];
94 double fRec33[2];
95 void connect(uint32_t port,void* data);
96 void clear_state_f();
97 void init(uint32_t samplingFreq);
98 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
99
100 static void clear_state_f_static(PluginLV2*);
101 static void init_static(uint32_t samplingFreq, PluginLV2*);
102 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
103 static void del_instance(PluginLV2 *p);
104 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
105 public:
106 Dsp();
107 ~Dsp();
108 };
109
110
111
112 Dsp::Dsp()
113 : PluginLV2() {
114 version = PLUGINLV2_VERSION;
115 id = "duckDelaySt";
116 name = N_("Duck Delay St");
117 mono_audio = 0;
118 stereo_audio = compute_static;
119 set_samplerate = init_static;
120 activate_plugin = 0;
121 connect_ports = connect_static;
122 clear_state = clear_state_f_static;
123 delete_instance = del_instance;
124 }
125
126 Dsp::~Dsp() {
127 }
128
129 inline void Dsp::clear_state_f()
130 {
131 for (int i=0; i<524288; i++) fVec0[i] = 0;
132 for (int i=0; i<2; i++) fRec6[i] = 0;
133 for (int i=0; i<2; i++) fRec5[i] = 0;
134 for (int i=0; i<2; i++) fRec3[i] = 0;
135 for (int i=0; i<524288; i++) fVec1[i] = 0;
136 for (int i=0; i<2; i++) fRec7[i] = 0;
137 for (int i=0; i<2; i++) fRec4[i] = 0;
138 for (int i=0; i<2; i++) fRec2[i] = 0;
139 for (int i=0; i<3; i++) fRec1[i] = 0;
140 for (int i=0; i<3; i++) fRec0[i] = 0;
141 for (int i=0; i<2; i++) fRec10[i] = 0;
142 for (int i=0; i<3; i++) fRec9[i] = 0;
143 for (int i=0; i<3; i++) fRec8[i] = 0;
144 for (int i=0; i<2; i++) fRec13[i] = 0;
145 for (int i=0; i<3; i++) fRec12[i] = 0;
146 for (int i=0; i<3; i++) fRec11[i] = 0;
147 for (int i=0; i<2; i++) fRec16[i] = 0;
148 for (int i=0; i<3; i++) fRec15[i] = 0;
149 for (int i=0; i<3; i++) fRec14[i] = 0;
150 for (int i=0; i<2; i++) fRec17[i] = 0;
151 for (int i=0; i<2; i++) fRec20[i] = 0;
152 for (int i=0; i<2; i++) fRec19[i] = 0;
153 for (int i=0; i<2; i++) fRec18[i] = 0;
154 for (int i=0; i<2; i++) fRec23[i] = 0;
155 for (int i=0; i<3; i++) fRec22[i] = 0;
156 for (int i=0; i<3; i++) fRec21[i] = 0;
157 for (int i=0; i<2; i++) fRec26[i] = 0;
158 for (int i=0; i<3; i++) fRec25[i] = 0;
159 for (int i=0; i<3; i++) fRec24[i] = 0;
160 for (int i=0; i<2; i++) fRec29[i] = 0;
161 for (int i=0; i<3; i++) fRec28[i] = 0;
162 for (int i=0; i<3; i++) fRec27[i] = 0;
163 for (int i=0; i<2; i++) fRec32[i] = 0;
164 for (int i=0; i<3; i++) fRec31[i] = 0;
165 for (int i=0; i<3; i++) fRec30[i] = 0;
166 for (int i=0; i<2; i++) fRec35[i] = 0;
167 for (int i=0; i<2; i++) fRec34[i] = 0;
168 for (int i=0; i<2; i++) fRec33[i] = 0;
169 }
170
171 void Dsp::clear_state_f_static(PluginLV2 *p)
172 {
173 static_cast<Dsp*>(p)->clear_state_f();
174 }
175
176 inline void Dsp::init(uint32_t samplingFreq)
177 {
178 fSamplingFreq = samplingFreq;
179 iConst0 = min(192000, max(1, fSamplingFreq));
180 fConst1 = tan((2764.601535159018 / double(iConst0)));
181 fConst2 = (1.0 / faustpower<2>(fConst1));
182 fConst3 = (2 * (1 - fConst2));
183 fConst4 = (1.0 / fConst1);
184 fConst5 = (1 + ((fConst4 - 0.6180339887498947) / fConst1));
185 fConst6 = (1.0 / (1 + ((0.6180339887498947 + fConst4) / fConst1)));
186 fConst7 = (1 + ((fConst4 - 1.6180339887498947) / fConst1));
187 fConst8 = (1.0 / (1 + ((fConst4 + 1.6180339887498947) / fConst1)));
188 IOTA = 0;
189 fConst9 = exp((0 - (1e+01 / double(iConst0))));
190 fConst10 = (1.0 - fConst9);
191 fConst11 = (0.001 * iConst0);
192 fConst12 = (0 - fConst4);
193 fConst13 = (1 + fConst4);
194 fConst14 = (1.0 / fConst13);
195 fConst15 = (0 - ((1 - fConst4) / fConst13));
196 fConst16 = (2 * (0 - fConst2));
197 fConst17 = tan((1382.300767579509 / double(iConst0)));
198 fConst18 = (1.0 / faustpower<2>(fConst17));
199 fConst19 = (2 * (1 - fConst18));
200 fConst20 = (1.0 / fConst17);
201 fConst21 = (1 + ((fConst20 - 0.6180339887498947) / fConst17));
202 fConst22 = (1.0 / (1 + ((0.6180339887498947 + fConst20) / fConst17)));
203 fConst23 = (1 + ((fConst20 - 1.6180339887498947) / fConst17));
204 fConst24 = (1.0 / (1 + ((1.6180339887498947 + fConst20) / fConst17)));
205 fConst25 = (1 + fConst20);
206 fConst26 = (1.0 / fConst25);
207 fConst27 = (0 - ((1 - fConst20) / fConst25));
208 fConst28 = (0 - fConst20);
209 fConst29 = (2 * (0 - fConst18));
210 fConst30 = (1.0 / double(iConst0));
211 clear_state_f();
212 }
213
214 void Dsp::init_static(uint32_t samplingFreq, PluginLV2 *p)
215 {
216 static_cast<Dsp*>(p)->init(samplingFreq);
217 }
218
219 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
220 {
221 #define fslider0 (*fslider0_)
222 #define fslider1 (*fslider1_)
223 #define fslider2 (*fslider2_)
224 #define fslider3 (*fslider3_)
225 #define fslider4 (*fslider4_)
226 #define fslider5 (*fslider5_)
227 #define fslider6 (*fslider6_)
228 #define fslider7 (*fslider7_)
229 double fSlow0 = double(fslider0);
230 double fSlow1 = (1 - fSlow0);
231 double fSlow2 = double(fslider1);
232 double fSlow3 = (fConst10 * double(fslider2));
233 double fSlow4 = (1 - (fSlow0 * fSlow2));
234 double fSlow5 = double(fslider3);
235 double fSlow6 = pow(10,(0.6 * fSlow5));
236 double fSlow7 = pow(10,(0.6 * (1 - fSlow5)));
237 double fSlow8 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider4))));
238 double fSlow9 = exp((0 - (fConst30 / double(fslider5))));
239 double fSlow10 = (1.0 - fSlow9);
240 double fSlow11 = exp((0 - (fConst30 / double(fslider6))));
241 double fSlow12 = (1.0 - fSlow11);
242 double fSlow13 = pow(10,(0.05 * double(fslider7)));
243 for (int i=0; i<count; i++) {
244 double fTemp0 = (double)input0[i];
245 double fTemp1 = (fTemp0 + (fSlow2 * ((fSlow1 * fRec5[1]) + (fSlow0 * fRec4[1]))));
246 fVec0[IOTA&524287] = fTemp1;
247 fRec6[0] = (fSlow3 + (fConst9 * fRec6[1]));
248 double fTemp2 = (fConst11 * fRec6[0]);
249 int iTemp3 = int(fTemp2);
250 int iTemp4 = (1 + iTemp3);
251 int iTemp5 = int((int(iTemp4) & 393215));
252 double fTemp6 = (fTemp2 - iTemp3);
253 double fTemp7 = (iTemp4 - fTemp2);
254 int iTemp8 = int((iTemp3 & 393215));
255 fRec5[0] = ((fVec0[(IOTA-iTemp8)&524287] * fTemp7) + (fTemp6 * fVec0[(IOTA-iTemp5)&524287]));
256 fRec3[0] = fRec5[0];
257 double fTemp9 = (double)input1[i];
258 double fTemp10 = ((fSlow4 * fTemp9) + (fSlow2 * ((fSlow1 * fRec7[1]) + (fSlow0 * fRec3[1]))));
259 fVec1[IOTA&524287] = fTemp10;
260 fRec7[0] = ((fTemp7 * fVec1[(IOTA-iTemp8)&524287]) + (fTemp6 * fVec1[(IOTA-iTemp5)&524287]));
261 fRec4[0] = fRec7[0];
262 fRec2[0] = ((fConst15 * fRec2[1]) + (fConst14 * ((fConst4 * fRec3[0]) + (fConst12 * fRec3[1]))));
263 fRec1[0] = (fRec2[0] - (fConst8 * ((fConst7 * fRec1[2]) + (fConst3 * fRec1[1]))));
264 fRec0[0] = ((fConst8 * (((fConst2 * fRec1[0]) + (fConst16 * fRec1[1])) + (fConst2 * fRec1[2]))) - (fConst6 * ((fConst5 * fRec0[2]) + (fConst3 * fRec0[1]))));
265 double fTemp11 = (fRec3[0] + fRec3[1]);
266 fRec10[0] = ((fConst15 * fRec10[1]) + (fConst14 * fTemp11));
267 fRec9[0] = (fRec10[0] - (fConst8 * ((fConst7 * fRec9[2]) + (fConst3 * fRec9[1]))));
268 fRec8[0] = ((fConst8 * (fRec9[2] + (fRec9[0] + (2 * fRec9[1])))) - (fConst6 * ((fConst5 * fRec8[2]) + (fConst3 * fRec8[1]))));
269 fRec13[0] = ((fConst27 * fRec13[1]) + (fConst26 * fTemp11));
270 fRec12[0] = (fRec13[0] - (fConst24 * ((fConst23 * fRec12[2]) + (fConst19 * fRec12[1]))));
271 fRec11[0] = ((fConst24 * (fRec12[2] + (fRec12[0] + (2 * fRec12[1])))) - (fConst22 * ((fConst21 * fRec11[2]) + (fConst19 * fRec11[1]))));
272 fRec16[0] = ((fConst27 * fRec16[1]) + (fConst26 * ((fConst20 * fRec3[0]) + (fConst28 * fRec3[1]))));
273 fRec15[0] = (fRec16[0] - (fConst24 * ((fConst23 * fRec15[2]) + (fConst19 * fRec15[1]))));
274 fRec14[0] = ((fConst24 * (((fConst18 * fRec15[0]) + (fConst29 * fRec15[1])) + (fConst18 * fRec15[2]))) - (fConst22 * ((fConst21 * fRec14[2]) + (fConst19 * fRec14[1]))));
275 fRec17[0] = ((0.999 * fRec17[1]) + fSlow8);
276 double fTemp12 = fabs(fTemp0);
277 fRec20[0] = ((fSlow9 * max(fTemp12, fRec20[1])) + (fSlow10 * fTemp12));
278 fRec19[0] = ((fSlow11 * fRec19[1]) + (fSlow12 * fRec20[0]));
279 fRec18[0] = ((fConst9 * fRec18[1]) + (fConst10 * (1 - ((fSlow13 * fRec19[0]) > 1))));
280 output0[i] = (FAUSTFLOAT)(fTemp0 + (0.1778279410038923 * ((fRec18[0] * fRec17[0]) * ((fConst22 * ((((fConst18 * fRec14[0]) + (fConst29 * fRec14[1])) + (fConst18 * fRec14[2])) + (fSlow7 * (fRec11[2] + (fRec11[0] + (2 * fRec11[1])))))) + (fConst6 * ((fRec8[2] + (fRec8[0] + (2 * fRec8[1]))) + (fSlow6 * (((fConst2 * fRec0[0]) + (fConst16 * fRec0[1])) + (fConst2 * fRec0[2])))))))));
281 fRec23[0] = ((fConst15 * fRec23[1]) + (fConst14 * ((fConst4 * fRec4[0]) + (fConst12 * fRec4[1]))));
282 fRec22[0] = (fRec23[0] - (fConst8 * ((fConst7 * fRec22[2]) + (fConst3 * fRec22[1]))));
283 fRec21[0] = ((fConst8 * (((fConst2 * fRec22[0]) + (fConst16 * fRec22[1])) + (fConst2 * fRec22[2]))) - (fConst6 * ((fConst5 * fRec21[2]) + (fConst3 * fRec21[1]))));
284 double fTemp13 = (fRec4[0] + fRec4[1]);
285 fRec26[0] = ((fConst15 * fRec26[1]) + (fConst14 * fTemp13));
286 fRec25[0] = (fRec26[0] - (fConst8 * ((fConst7 * fRec25[2]) + (fConst3 * fRec25[1]))));
287 fRec24[0] = ((fConst8 * (fRec25[2] + (fRec25[0] + (2 * fRec25[1])))) - (fConst6 * ((fConst5 * fRec24[2]) + (fConst3 * fRec24[1]))));
288 fRec29[0] = ((fConst27 * fRec29[1]) + (fConst26 * fTemp13));
289 fRec28[0] = (fRec29[0] - (fConst24 * ((fConst23 * fRec28[2]) + (fConst19 * fRec28[1]))));
290 fRec27[0] = ((fConst24 * (fRec28[2] + (fRec28[0] + (2 * fRec28[1])))) - (fConst22 * ((fConst21 * fRec27[2]) + (fConst19 * fRec27[1]))));
291 fRec32[0] = ((fConst27 * fRec32[1]) + (fConst26 * ((fConst20 * fRec4[0]) + (fConst28 * fRec4[1]))));
292 fRec31[0] = (fRec32[0] - (fConst24 * ((fConst23 * fRec31[2]) + (fConst19 * fRec31[1]))));
293 fRec30[0] = ((fConst24 * (((fConst18 * fRec31[0]) + (fConst29 * fRec31[1])) + (fConst18 * fRec31[2]))) - (fConst22 * ((fConst21 * fRec30[2]) + (fConst19 * fRec30[1]))));
294 double fTemp14 = fabs(fTemp9);
295 fRec35[0] = ((fSlow9 * max(fTemp14, fRec35[1])) + (fSlow10 * fTemp14));
296 fRec34[0] = ((fSlow11 * fRec34[1]) + (fSlow12 * fRec35[0]));
297 fRec33[0] = ((fConst9 * fRec33[1]) + (fConst10 * (1 - ((fSlow13 * fRec34[0]) > 1))));
298 output1[i] = (FAUSTFLOAT)(fTemp9 + (0.1778279410038923 * ((fRec17[0] * fRec33[0]) * ((fConst22 * ((((fConst18 * fRec30[0]) + (fConst29 * fRec30[1])) + (fConst18 * fRec30[2])) + (fSlow7 * (fRec27[2] + (fRec27[0] + (2 * fRec27[1])))))) + (fConst6 * ((fRec24[2] + (fRec24[0] + (2 * fRec24[1]))) + (fSlow6 * (((fConst2 * fRec21[0]) + (fConst16 * fRec21[1])) + (fConst2 * fRec21[2])))))))));
299 // post processing
300 fRec33[1] = fRec33[0];
301 fRec34[1] = fRec34[0];
302 fRec35[1] = fRec35[0];
303 fRec30[2] = fRec30[1]; fRec30[1] = fRec30[0];
304 fRec31[2] = fRec31[1]; fRec31[1] = fRec31[0];
305 fRec32[1] = fRec32[0];
306 fRec27[2] = fRec27[1]; fRec27[1] = fRec27[0];
307 fRec28[2] = fRec28[1]; fRec28[1] = fRec28[0];
308 fRec29[1] = fRec29[0];
309 fRec24[2] = fRec24[1]; fRec24[1] = fRec24[0];
310 fRec25[2] = fRec25[1]; fRec25[1] = fRec25[0];
311 fRec26[1] = fRec26[0];
312 fRec21[2] = fRec21[1]; fRec21[1] = fRec21[0];
313 fRec22[2] = fRec22[1]; fRec22[1] = fRec22[0];
314 fRec23[1] = fRec23[0];
315 fRec18[1] = fRec18[0];
316 fRec19[1] = fRec19[0];
317 fRec20[1] = fRec20[0];
318 fRec17[1] = fRec17[0];
319 fRec14[2] = fRec14[1]; fRec14[1] = fRec14[0];
320 fRec15[2] = fRec15[1]; fRec15[1] = fRec15[0];
321 fRec16[1] = fRec16[0];
322 fRec11[2] = fRec11[1]; fRec11[1] = fRec11[0];
323 fRec12[2] = fRec12[1]; fRec12[1] = fRec12[0];
324 fRec13[1] = fRec13[0];
325 fRec8[2] = fRec8[1]; fRec8[1] = fRec8[0];
326 fRec9[2] = fRec9[1]; fRec9[1] = fRec9[0];
327 fRec10[1] = fRec10[0];
328 fRec0[2] = fRec0[1]; fRec0[1] = fRec0[0];
329 fRec1[2] = fRec1[1]; fRec1[1] = fRec1[0];
330 fRec2[1] = fRec2[0];
331 fRec4[1] = fRec4[0];
332 fRec7[1] = fRec7[0];
333 fRec3[1] = fRec3[0];
334 fRec5[1] = fRec5[0];
335 fRec6[1] = fRec6[0];
336 IOTA = IOTA+1;
337 }
338 #undef fslider0
339 #undef fslider1
340 #undef fslider2
341 #undef fslider3
342 #undef fslider4
343 #undef fslider5
344 #undef fslider6
345 #undef fslider7
346 }
347
348 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
349 {
350 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
351 }
352
353
354 void Dsp::connect(uint32_t port,void* data)
355 {
356 switch ((PortIndex)port)
357 {
358 case AMOUNT:
359 fslider7_ = (float*)data; // , 0.5, 0.0, 56.0, 0.05
360 break;
361 case ATTACK:
362 fslider6_ = (float*)data; // , 0.1, 0.05, 0.5, 0.05
363 break;
364 case COLORATION:
365 fslider3_ = (float*)data; // , 0.0, -1.0, 1.0, 0.05
366 break;
367 case EFFECT:
368 fslider4_ = (float*)data; // , 0.0, -16.0, 4.0, 0.1
369 break;
370 case FEEDBACK:
371 fslider1_ = (float*)data; // , 0.0, 0.0, 1.0, 0.05
372 break;
373 case PINGPONG:
374 fslider0_ = (float*)data; // , 0.0, 0.0, 1.0, 0.05
375 break;
376 case RELEASE:
377 fslider5_ = (float*)data; // , 0.1, 0.05, 2.0, 0.05
378 break;
379 case TIME:
380 fslider2_ = (float*)data; // , 5e+02, 1.0, 2e+03, 1.0
381 break;
382 default:
383 break;
384 }
385 }
386
387 void Dsp::connect_static(uint32_t port,void* data, PluginLV2 *p)
388 {
389 static_cast<Dsp*>(p)->connect(port, data);
390 }
391
392
393 PluginLV2 *plugin() {
394 return new Dsp();
395 }
396
397 void Dsp::del_instance(PluginLV2 *p)
398 {
399 delete static_cast<Dsp*>(p);
400 }
401
402 /*
403 typedef enum
404 {
405 AMOUNT,
406 ATTACK,
407 COLORATION,
408 EFFECT,
409 FEEDBACK,
410 PINGPONG,
411 RELEASE,
412 TIME,
413 } PortIndex;
414 */
415
416 } // end namespace duck_delay_st
2020 void clear_state_f();
2121 int activate(bool start);
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *output0);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static int activate_static(bool start, PluginLV2*);
2727 static void init_static(uint32_t samplingFreq, PluginLV2*);
28 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
28 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2929 static void del_instance(PluginLV2 *p);
3030 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3131 public:
106106 return static_cast<Dsp*>(p)->activate(start);
107107 }
108108
109 void always_inline Dsp::compute(int count, float *input0, float *output0)
109 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
110110 {
111111 #define fslider0 (*fslider0_)
112112 #define fslider1 (*fslider1_)
122122 #undef fslider1
123123 }
124124
125 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
125 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
126126 {
127127 static_cast<Dsp*>(p)->compute(count, input0, output0);
128128 }
2525 void connect(uint32_t port,void* data);
2626 void clear_state_f();
2727 void init(uint32_t samplingFreq);
28 void compute(int count, float *input0, float *output0);
28 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2929
3030 static void clear_state_f_static(PluginLV2*);
3131 static void init_static(uint32_t samplingFreq, PluginLV2*);
32 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
32 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
3333 static void del_instance(PluginLV2 *p);
3434 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3535 public:
8282 static_cast<Dsp*>(p)->init(samplingFreq);
8383 }
8484
85 void always_inline Dsp::compute(int count, float *input0, float *output0)
85 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8686 {
8787 #define fslider0 (*fslider0_)
8888 #define fslider1 (*fslider1_)
114114 #undef fentry2
115115 }
116116
117 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
117 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
118118 {
119119 static_cast<Dsp*>(p)->compute(count, input0, output0);
120120 }
3333 void connect(uint32_t port,void* data);
3434 void clear_state_f();
3535 void init(uint32_t samplingFreq);
36 void compute(int count, float *input0, float *input1, float *output0, float *output1);
36 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
3737
3838 static void clear_state_f_static(PluginLV2*);
3939 static void init_static(uint32_t samplingFreq, PluginLV2*);
40 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
40 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
4141 static void del_instance(PluginLV2 *p);
4242 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
4343 public:
9494 static_cast<Dsp*>(p)->init(samplingFreq);
9595 }
9696
97 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
97 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
9898 {
9999 #define fslider0 (*fslider0_)
100100 #define fslider1 (*fslider1_)
150150 #undef fcheckbox0
151151 }
152152
153 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
153 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
154154 {
155155 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
156156 }
2323 void connect(uint32_t port,void* data);
2424 void clear_state_f();
2525 void init(uint32_t samplingFreq);
26 void compute(int count, float *input0, float *output0);
26 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2727
2828 static void clear_state_f_static(PluginLV2*);
2929 static void init_static(uint32_t samplingFreq, PluginLV2*);
30 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
30 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
3131 static void del_instance(PluginLV2 *p);
3232 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3333 public:
8282 static_cast<Dsp*>(p)->init(samplingFreq);
8383 }
8484
85 void always_inline Dsp::compute(int count, float *input0, float *output0)
85 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8686 {
8787 #define fslider0 (*fslider0_)
8888 #define fslider1 (*fslider1_)
119119 #undef fslider2
120120 }
121121
122 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
122 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
123123 {
124124 static_cast<Dsp*>(p)->compute(count, input0, output0);
125125 }
4848 void connect(uint32_t port,void* data);
4949 void clear_state_f();
5050 void init(uint32_t samplingFreq);
51 void compute(int count, float *input0, float *output0);
51 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
5252
5353 static void clear_state_f_static(PluginLV2*);
5454 static void init_static(uint32_t samplingFreq, PluginLV2*);
55 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
55 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
5656 static void del_instance(PluginLV2 *p);
5757 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
5858 public:
132132 static_cast<Dsp*>(p)->init(samplingFreq);
133133 }
134134
135 void always_inline Dsp::compute(int count, float *input0, float *output0)
135 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
136136 {
137137 #define fslider0 (*fslider0_)
138138 #define fslider1 (*fslider1_)
213213 #undef fslider2
214214 }
215215
216 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
216 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
217217 {
218218 static_cast<Dsp*>(p)->compute(count, input0, output0);
219219 }
0 // generated from file '../src/LV2/faust/graphiceq.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.65 (http://faust.grame.fr)
2
3
4 namespace graphiceq {
5
6 class Dsp: public PluginLV2 {
7 private:
8 uint32_t fSamplingFreq;
9 int iConst0;
10 double fConst1;
11 double fConst2;
12 double fConst3;
13 double fConst4;
14 double fConst5;
15 double fConst6;
16 double fConst7;
17 double fConst8;
18 double fConst9;
19 double fConst10;
20 double fConst11;
21 double fConst12;
22 double fConst13;
23 double fConst14;
24 double fConst15;
25 double fConst16;
26 double fConst17;
27 double fConst18;
28 double fConst19;
29 double fConst20;
30 double fConst21;
31 double fConst22;
32 double fConst23;
33 double fConst24;
34 double fConst25;
35 double fConst26;
36 double fConst27;
37 double fConst28;
38 double fConst29;
39 double fConst30;
40 double fConst31;
41 double fConst32;
42 double fConst33;
43 double fConst34;
44 double fConst35;
45 double fConst36;
46 double fConst37;
47 double fConst38;
48 double fConst39;
49 double fConst40;
50 double fConst41;
51 double fConst42;
52 double fConst43;
53 double fConst44;
54 double fConst45;
55 double fConst46;
56 double fConst47;
57 double fConst48;
58 double fConst49;
59 double fConst50;
60 double fConst51;
61 double fConst52;
62 double fConst53;
63 double fConst54;
64 double fConst55;
65 double fConst56;
66 double fConst57;
67 double fConst58;
68 double fConst59;
69 double fConst60;
70 double fConst61;
71 double fConst62;
72 double fConst63;
73 double fConst64;
74 double fConst65;
75 double fConst66;
76 double fConst67;
77 double fConst68;
78 double fConst69;
79 double fConst70;
80 double fVec0[2];
81 double fConst71;
82 double fConst72;
83 double fConst73;
84 double fRec23[2];
85 double fRec22[3];
86 double fVec1[2];
87 double fConst74;
88 double fConst75;
89 double fConst76;
90 double fRec21[2];
91 double fRec20[3];
92 double fVec2[2];
93 double fConst77;
94 double fConst78;
95 double fConst79;
96 double fRec19[2];
97 double fRec18[3];
98 double fVec3[2];
99 double fConst80;
100 double fConst81;
101 double fConst82;
102 double fRec17[2];
103 double fRec16[3];
104 double fVec4[2];
105 double fConst83;
106 double fConst84;
107 double fConst85;
108 double fRec15[2];
109 double fRec14[3];
110 double fVec5[2];
111 double fConst86;
112 double fConst87;
113 double fConst88;
114 double fRec13[2];
115 double fRec12[3];
116 double fVec6[2];
117 double fConst89;
118 double fConst90;
119 double fConst91;
120 double fRec11[2];
121 double fRec10[3];
122 double fVec7[2];
123 double fConst92;
124 double fConst93;
125 double fConst94;
126 double fRec9[2];
127 double fRec8[3];
128 double fVec8[2];
129 double fConst95;
130 double fConst96;
131 double fConst97;
132 double fRec7[2];
133 double fRec6[3];
134 double fVec9[2];
135 double fConst98;
136 double fConst99;
137 double fConst100;
138 double fRec5[2];
139 double fRec4[3];
140 FAUSTFLOAT fslider0;
141 FAUSTFLOAT *fslider0_;
142 double fRec24[2];
143 double fRec0[2];
144 int iRec1[2];
145 double fRec2[2];
146 FAUSTFLOAT fbargraph0;
147 FAUSTFLOAT *fbargraph0_;
148 double fConst101;
149 double fRec30[2];
150 double fRec29[3];
151 double fConst102;
152 FAUSTFLOAT fslider1;
153 FAUSTFLOAT *fslider1_;
154 double fRec31[2];
155 double fRec25[2];
156 int iRec26[2];
157 double fRec27[2];
158 FAUSTFLOAT fbargraph1;
159 FAUSTFLOAT *fbargraph1_;
160 double fConst103;
161 double fConst104;
162 double fConst105;
163 double fRec38[2];
164 double fRec37[3];
165 double fConst106;
166 double fRec36[3];
167 FAUSTFLOAT fslider2;
168 FAUSTFLOAT *fslider2_;
169 double fRec39[2];
170 double fRec32[2];
171 int iRec33[2];
172 double fRec34[2];
173 FAUSTFLOAT fbargraph2;
174 FAUSTFLOAT *fbargraph2_;
175 double fConst107;
176 double fConst108;
177 double fConst109;
178 double fRec47[2];
179 double fRec46[3];
180 double fConst110;
181 double fRec45[3];
182 double fRec44[3];
183 FAUSTFLOAT fslider3;
184 FAUSTFLOAT *fslider3_;
185 double fRec48[2];
186 double fRec40[2];
187 int iRec41[2];
188 double fRec42[2];
189 FAUSTFLOAT fbargraph3;
190 FAUSTFLOAT *fbargraph3_;
191 double fConst111;
192 double fConst112;
193 double fConst113;
194 double fRec57[2];
195 double fRec56[3];
196 double fConst114;
197 double fRec55[3];
198 double fRec54[3];
199 double fRec53[3];
200 FAUSTFLOAT fslider4;
201 FAUSTFLOAT *fslider4_;
202 double fRec58[2];
203 double fRec49[2];
204 int iRec50[2];
205 double fRec51[2];
206 FAUSTFLOAT fbargraph4;
207 FAUSTFLOAT *fbargraph4_;
208 double fConst115;
209 double fConst116;
210 double fConst117;
211 double fRec68[2];
212 double fRec67[3];
213 double fConst118;
214 double fRec66[3];
215 double fRec65[3];
216 double fRec64[3];
217 double fRec63[3];
218 FAUSTFLOAT fslider5;
219 FAUSTFLOAT *fslider5_;
220 double fRec69[2];
221 double fRec59[2];
222 int iRec60[2];
223 double fRec61[2];
224 FAUSTFLOAT fbargraph5;
225 FAUSTFLOAT *fbargraph5_;
226 double fConst119;
227 double fConst120;
228 double fConst121;
229 double fRec80[2];
230 double fRec79[3];
231 double fConst122;
232 double fRec78[3];
233 double fRec77[3];
234 double fRec76[3];
235 double fRec75[3];
236 double fRec74[3];
237 FAUSTFLOAT fslider6;
238 FAUSTFLOAT *fslider6_;
239 double fRec81[2];
240 double fRec70[2];
241 int iRec71[2];
242 double fRec72[2];
243 FAUSTFLOAT fbargraph6;
244 FAUSTFLOAT *fbargraph6_;
245 double fConst123;
246 double fConst124;
247 double fConst125;
248 double fRec93[2];
249 double fRec92[3];
250 double fConst126;
251 double fRec91[3];
252 double fRec90[3];
253 double fRec89[3];
254 double fRec88[3];
255 double fRec87[3];
256 double fRec86[3];
257 FAUSTFLOAT fslider7;
258 FAUSTFLOAT *fslider7_;
259 double fRec94[2];
260 double fRec82[2];
261 int iRec83[2];
262 double fRec84[2];
263 FAUSTFLOAT fbargraph7;
264 FAUSTFLOAT *fbargraph7_;
265 double fConst127;
266 double fConst128;
267 double fConst129;
268 double fRec107[2];
269 double fRec106[3];
270 double fConst130;
271 double fRec105[3];
272 double fRec104[3];
273 double fRec103[3];
274 double fRec102[3];
275 double fRec101[3];
276 double fRec100[3];
277 double fRec99[3];
278 FAUSTFLOAT fslider8;
279 FAUSTFLOAT *fslider8_;
280 double fRec108[2];
281 double fRec95[2];
282 int iRec96[2];
283 double fRec97[2];
284 FAUSTFLOAT fbargraph8;
285 FAUSTFLOAT *fbargraph8_;
286 double fConst131;
287 double fConst132;
288 double fConst133;
289 double fRec122[2];
290 double fRec121[3];
291 double fConst134;
292 double fRec120[3];
293 double fRec119[3];
294 double fRec118[3];
295 double fRec117[3];
296 double fRec116[3];
297 double fRec115[3];
298 double fRec114[3];
299 double fRec113[3];
300 FAUSTFLOAT fslider9;
301 FAUSTFLOAT *fslider9_;
302 double fRec123[2];
303 double fRec109[2];
304 int iRec110[2];
305 double fRec111[2];
306 FAUSTFLOAT fbargraph9;
307 FAUSTFLOAT *fbargraph9_;
308 double fConst135;
309 double fConst136;
310 double fConst137;
311 double fRec138[2];
312 double fRec137[3];
313 double fConst138;
314 double fRec136[3];
315 double fRec135[3];
316 double fRec134[3];
317 double fRec133[3];
318 double fRec132[3];
319 double fRec131[3];
320 double fRec130[3];
321 double fRec129[3];
322 double fRec128[3];
323 FAUSTFLOAT fslider10;
324 FAUSTFLOAT *fslider10_;
325 double fRec139[2];
326 double fRec124[2];
327 int iRec125[2];
328 double fRec126[2];
329 FAUSTFLOAT fbargraph10;
330 FAUSTFLOAT *fbargraph10_;
331 void connect(uint32_t port,void* data);
332 void clear_state_f();
333 void init(uint32_t samplingFreq);
334 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
335
336 static void clear_state_f_static(PluginLV2*);
337 static void init_static(uint32_t samplingFreq, PluginLV2*);
338 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
339 static void del_instance(PluginLV2 *p);
340 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
341 public:
342 Dsp();
343 ~Dsp();
344 };
345
346
347
348 Dsp::Dsp()
349 : PluginLV2() {
350 version = PLUGINLV2_VERSION;
351 id = "graphiceq";
352 name = N_("Graphic EQ");
353 mono_audio = compute_static;
354 stereo_audio = 0;
355 set_samplerate = init_static;
356 activate_plugin = 0;
357 connect_ports = connect_static;
358 clear_state = clear_state_f_static;
359 delete_instance = del_instance;
360 }
361
362 Dsp::~Dsp() {
363 }
364
365 inline void Dsp::clear_state_f()
366 {
367 for (int i=0; i<2; i++) fVec0[i] = 0;
368 for (int i=0; i<2; i++) fRec23[i] = 0;
369 for (int i=0; i<3; i++) fRec22[i] = 0;
370 for (int i=0; i<2; i++) fVec1[i] = 0;
371 for (int i=0; i<2; i++) fRec21[i] = 0;
372 for (int i=0; i<3; i++) fRec20[i] = 0;
373 for (int i=0; i<2; i++) fVec2[i] = 0;
374 for (int i=0; i<2; i++) fRec19[i] = 0;
375 for (int i=0; i<3; i++) fRec18[i] = 0;
376 for (int i=0; i<2; i++) fVec3[i] = 0;
377 for (int i=0; i<2; i++) fRec17[i] = 0;
378 for (int i=0; i<3; i++) fRec16[i] = 0;
379 for (int i=0; i<2; i++) fVec4[i] = 0;
380 for (int i=0; i<2; i++) fRec15[i] = 0;
381 for (int i=0; i<3; i++) fRec14[i] = 0;
382 for (int i=0; i<2; i++) fVec5[i] = 0;
383 for (int i=0; i<2; i++) fRec13[i] = 0;
384 for (int i=0; i<3; i++) fRec12[i] = 0;
385 for (int i=0; i<2; i++) fVec6[i] = 0;
386 for (int i=0; i<2; i++) fRec11[i] = 0;
387 for (int i=0; i<3; i++) fRec10[i] = 0;
388 for (int i=0; i<2; i++) fVec7[i] = 0;
389 for (int i=0; i<2; i++) fRec9[i] = 0;
390 for (int i=0; i<3; i++) fRec8[i] = 0;
391 for (int i=0; i<2; i++) fVec8[i] = 0;
392 for (int i=0; i<2; i++) fRec7[i] = 0;
393 for (int i=0; i<3; i++) fRec6[i] = 0;
394 for (int i=0; i<2; i++) fVec9[i] = 0;
395 for (int i=0; i<2; i++) fRec5[i] = 0;
396 for (int i=0; i<3; i++) fRec4[i] = 0;
397 for (int i=0; i<2; i++) fRec24[i] = 0;
398 for (int i=0; i<2; i++) fRec0[i] = 0;
399 for (int i=0; i<2; i++) iRec1[i] = 0;
400 for (int i=0; i<2; i++) fRec2[i] = 0;
401 for (int i=0; i<2; i++) fRec30[i] = 0;
402 for (int i=0; i<3; i++) fRec29[i] = 0;
403 for (int i=0; i<2; i++) fRec31[i] = 0;
404 for (int i=0; i<2; i++) fRec25[i] = 0;
405 for (int i=0; i<2; i++) iRec26[i] = 0;
406 for (int i=0; i<2; i++) fRec27[i] = 0;
407 for (int i=0; i<2; i++) fRec38[i] = 0;
408 for (int i=0; i<3; i++) fRec37[i] = 0;
409 for (int i=0; i<3; i++) fRec36[i] = 0;
410 for (int i=0; i<2; i++) fRec39[i] = 0;
411 for (int i=0; i<2; i++) fRec32[i] = 0;
412 for (int i=0; i<2; i++) iRec33[i] = 0;
413 for (int i=0; i<2; i++) fRec34[i] = 0;
414 for (int i=0; i<2; i++) fRec47[i] = 0;
415 for (int i=0; i<3; i++) fRec46[i] = 0;
416 for (int i=0; i<3; i++) fRec45[i] = 0;
417 for (int i=0; i<3; i++) fRec44[i] = 0;
418 for (int i=0; i<2; i++) fRec48[i] = 0;
419 for (int i=0; i<2; i++) fRec40[i] = 0;
420 for (int i=0; i<2; i++) iRec41[i] = 0;
421 for (int i=0; i<2; i++) fRec42[i] = 0;
422 for (int i=0; i<2; i++) fRec57[i] = 0;
423 for (int i=0; i<3; i++) fRec56[i] = 0;
424 for (int i=0; i<3; i++) fRec55[i] = 0;
425 for (int i=0; i<3; i++) fRec54[i] = 0;
426 for (int i=0; i<3; i++) fRec53[i] = 0;
427 for (int i=0; i<2; i++) fRec58[i] = 0;
428 for (int i=0; i<2; i++) fRec49[i] = 0;
429 for (int i=0; i<2; i++) iRec50[i] = 0;
430 for (int i=0; i<2; i++) fRec51[i] = 0;
431 for (int i=0; i<2; i++) fRec68[i] = 0;
432 for (int i=0; i<3; i++) fRec67[i] = 0;
433 for (int i=0; i<3; i++) fRec66[i] = 0;
434 for (int i=0; i<3; i++) fRec65[i] = 0;
435 for (int i=0; i<3; i++) fRec64[i] = 0;
436 for (int i=0; i<3; i++) fRec63[i] = 0;
437 for (int i=0; i<2; i++) fRec69[i] = 0;
438 for (int i=0; i<2; i++) fRec59[i] = 0;
439 for (int i=0; i<2; i++) iRec60[i] = 0;
440 for (int i=0; i<2; i++) fRec61[i] = 0;
441 for (int i=0; i<2; i++) fRec80[i] = 0;
442 for (int i=0; i<3; i++) fRec79[i] = 0;
443 for (int i=0; i<3; i++) fRec78[i] = 0;
444 for (int i=0; i<3; i++) fRec77[i] = 0;
445 for (int i=0; i<3; i++) fRec76[i] = 0;
446 for (int i=0; i<3; i++) fRec75[i] = 0;
447 for (int i=0; i<3; i++) fRec74[i] = 0;
448 for (int i=0; i<2; i++) fRec81[i] = 0;
449 for (int i=0; i<2; i++) fRec70[i] = 0;
450 for (int i=0; i<2; i++) iRec71[i] = 0;
451 for (int i=0; i<2; i++) fRec72[i] = 0;
452 for (int i=0; i<2; i++) fRec93[i] = 0;
453 for (int i=0; i<3; i++) fRec92[i] = 0;
454 for (int i=0; i<3; i++) fRec91[i] = 0;
455 for (int i=0; i<3; i++) fRec90[i] = 0;
456 for (int i=0; i<3; i++) fRec89[i] = 0;
457 for (int i=0; i<3; i++) fRec88[i] = 0;
458 for (int i=0; i<3; i++) fRec87[i] = 0;
459 for (int i=0; i<3; i++) fRec86[i] = 0;
460 for (int i=0; i<2; i++) fRec94[i] = 0;
461 for (int i=0; i<2; i++) fRec82[i] = 0;
462 for (int i=0; i<2; i++) iRec83[i] = 0;
463 for (int i=0; i<2; i++) fRec84[i] = 0;
464 for (int i=0; i<2; i++) fRec107[i] = 0;
465 for (int i=0; i<3; i++) fRec106[i] = 0;
466 for (int i=0; i<3; i++) fRec105[i] = 0;
467 for (int i=0; i<3; i++) fRec104[i] = 0;
468 for (int i=0; i<3; i++) fRec103[i] = 0;
469 for (int i=0; i<3; i++) fRec102[i] = 0;
470 for (int i=0; i<3; i++) fRec101[i] = 0;
471 for (int i=0; i<3; i++) fRec100[i] = 0;
472 for (int i=0; i<3; i++) fRec99[i] = 0;
473 for (int i=0; i<2; i++) fRec108[i] = 0;
474 for (int i=0; i<2; i++) fRec95[i] = 0;
475 for (int i=0; i<2; i++) iRec96[i] = 0;
476 for (int i=0; i<2; i++) fRec97[i] = 0;
477 for (int i=0; i<2; i++) fRec122[i] = 0;
478 for (int i=0; i<3; i++) fRec121[i] = 0;
479 for (int i=0; i<3; i++) fRec120[i] = 0;
480 for (int i=0; i<3; i++) fRec119[i] = 0;
481 for (int i=0; i<3; i++) fRec118[i] = 0;
482 for (int i=0; i<3; i++) fRec117[i] = 0;
483 for (int i=0; i<3; i++) fRec116[i] = 0;
484 for (int i=0; i<3; i++) fRec115[i] = 0;
485 for (int i=0; i<3; i++) fRec114[i] = 0;
486 for (int i=0; i<3; i++) fRec113[i] = 0;
487 for (int i=0; i<2; i++) fRec123[i] = 0;
488 for (int i=0; i<2; i++) fRec109[i] = 0;
489 for (int i=0; i<2; i++) iRec110[i] = 0;
490 for (int i=0; i<2; i++) fRec111[i] = 0;
491 for (int i=0; i<2; i++) fRec138[i] = 0;
492 for (int i=0; i<3; i++) fRec137[i] = 0;
493 for (int i=0; i<3; i++) fRec136[i] = 0;
494 for (int i=0; i<3; i++) fRec135[i] = 0;
495 for (int i=0; i<3; i++) fRec134[i] = 0;
496 for (int i=0; i<3; i++) fRec133[i] = 0;
497 for (int i=0; i<3; i++) fRec132[i] = 0;
498 for (int i=0; i<3; i++) fRec131[i] = 0;
499 for (int i=0; i<3; i++) fRec130[i] = 0;
500 for (int i=0; i<3; i++) fRec129[i] = 0;
501 for (int i=0; i<3; i++) fRec128[i] = 0;
502 for (int i=0; i<2; i++) fRec139[i] = 0;
503 for (int i=0; i<2; i++) fRec124[i] = 0;
504 for (int i=0; i<2; i++) iRec125[i] = 0;
505 for (int i=0; i<2; i++) fRec126[i] = 0;
506 }
507
508 void Dsp::clear_state_f_static(PluginLV2 *p)
509 {
510 static_cast<Dsp*>(p)->clear_state_f();
511 }
512
513 inline void Dsp::init(uint32_t samplingFreq)
514 {
515 fSamplingFreq = samplingFreq;
516 iConst0 = min(192000, max(1, fSamplingFreq));
517 fConst1 = (1.0 / double(iConst0));
518 fConst2 = tan((138.23007675795088 / double(iConst0)));
519 fConst3 = (1.0 / faustpower<2>(fConst2));
520 fConst4 = (2 * (1 - fConst3));
521 fConst5 = (1.0 / fConst2);
522 fConst6 = (1 + ((fConst5 - 1.0000000000000004) / fConst2));
523 fConst7 = (1.0 / (1 + ((fConst5 + 1.0000000000000004) / fConst2)));
524 fConst8 = tan((276.46015351590177 / double(iConst0)));
525 fConst9 = (1.0 / faustpower<2>(fConst8));
526 fConst10 = (2 * (1 - fConst9));
527 fConst11 = (1.0 / fConst8);
528 fConst12 = (1 + ((fConst11 - 1.0000000000000004) / fConst8));
529 fConst13 = (1 + ((fConst11 + 1.0000000000000004) / fConst8));
530 fConst14 = (1.0 / fConst13);
531 fConst15 = tan((556.0618996853934 / double(iConst0)));
532 fConst16 = (1.0 / faustpower<2>(fConst15));
533 fConst17 = (2 * (1 - fConst16));
534 fConst18 = (1.0 / fConst15);
535 fConst19 = (1 + ((fConst18 - 1.0000000000000004) / fConst15));
536 fConst20 = (1 + ((fConst18 + 1.0000000000000004) / fConst15));
537 fConst21 = (1.0 / fConst20);
538 fConst22 = tan((1112.1237993707869 / double(iConst0)));
539 fConst23 = (1.0 / faustpower<2>(fConst22));
540 fConst24 = (2 * (1 - fConst23));
541 fConst25 = (1.0 / fConst22);
542 fConst26 = (1 + ((fConst25 - 1.0000000000000004) / fConst22));
543 fConst27 = (1 + ((fConst25 + 1.0000000000000004) / fConst22));
544 fConst28 = (1.0 / fConst27);
545 fConst29 = tan((2221.1060060879836 / double(iConst0)));
546 fConst30 = (1.0 / faustpower<2>(fConst29));
547 fConst31 = (2 * (1 - fConst30));
548 fConst32 = (1.0 / fConst29);
549 fConst33 = (1 + ((fConst32 - 1.0000000000000004) / fConst29));
550 fConst34 = (1 + ((fConst32 + 1.0000000000000004) / fConst29));
551 fConst35 = (1.0 / fConst34);
552 fConst36 = tan((4442.212012175967 / double(iConst0)));
553 fConst37 = (1.0 / faustpower<2>(fConst36));
554 fConst38 = (2 * (1 - fConst37));
555 fConst39 = (1.0 / fConst36);
556 fConst40 = (1 + ((fConst39 - 1.0000000000000004) / fConst36));
557 fConst41 = (1 + ((fConst39 + 1.0000000000000004) / fConst36));
558 fConst42 = (1.0 / fConst41);
559 fConst43 = tan((8884.424024351934 / double(iConst0)));
560 fConst44 = (1.0 / faustpower<2>(fConst43));
561 fConst45 = (2 * (1 - fConst44));
562 fConst46 = (1.0 / fConst43);
563 fConst47 = (1 + ((fConst46 - 1.0000000000000004) / fConst43));
564 fConst48 = (1 + ((fConst46 + 1.0000000000000004) / fConst43));
565 fConst49 = (1.0 / fConst48);
566 fConst50 = tan((17771.98964135746 / double(iConst0)));
567 fConst51 = (1.0 / faustpower<2>(fConst50));
568 fConst52 = (2 * (1 - fConst51));
569 fConst53 = (1.0 / fConst50);
570 fConst54 = (1 + ((fConst53 - 1.0000000000000004) / fConst50));
571 fConst55 = (1 + ((fConst53 + 1.0000000000000004) / fConst50));
572 fConst56 = (1.0 / fConst55);
573 fConst57 = tan((35763.890768466204 / double(iConst0)));
574 fConst58 = (1.0 / faustpower<2>(fConst57));
575 fConst59 = (2 * (1 - fConst58));
576 fConst60 = (1.0 / fConst57);
577 fConst61 = (1 + ((fConst60 - 1.0000000000000004) / fConst57));
578 fConst62 = (1 + ((fConst60 + 1.0000000000000004) / fConst57));
579 fConst63 = (1.0 / fConst62);
580 fConst64 = tan((56894.24295651115 / double(iConst0)));
581 fConst65 = (1.0 / faustpower<2>(fConst64));
582 fConst66 = (2 * (1 - fConst65));
583 fConst67 = (1.0 / fConst64);
584 fConst68 = (1 + ((fConst67 - 1.0000000000000004) / fConst64));
585 fConst69 = (1 + ((1.0000000000000004 + fConst67) / fConst64));
586 fConst70 = (1.0 / fConst69);
587 fConst71 = (1 + fConst67);
588 fConst72 = (1.0 / fConst71);
589 fConst73 = (0 - ((1 - fConst67) / fConst71));
590 fConst74 = (1 + fConst60);
591 fConst75 = (1.0 / (fConst74 * fConst69));
592 fConst76 = (0 - ((1 - fConst60) / fConst74));
593 fConst77 = (1 + fConst53);
594 fConst78 = (1.0 / (fConst77 * fConst62));
595 fConst79 = (0 - ((1 - fConst53) / fConst77));
596 fConst80 = (1 + fConst46);
597 fConst81 = (1.0 / (fConst80 * fConst55));
598 fConst82 = (0 - ((1 - fConst46) / fConst80));
599 fConst83 = (1 + fConst39);
600 fConst84 = (1.0 / (fConst83 * fConst48));
601 fConst85 = (0 - ((1 - fConst39) / fConst83));
602 fConst86 = (1 + fConst32);
603 fConst87 = (1.0 / (fConst86 * fConst41));
604 fConst88 = (0 - ((1 - fConst32) / fConst86));
605 fConst89 = (1 + fConst25);
606 fConst90 = (1.0 / (fConst89 * fConst34));
607 fConst91 = (0 - ((1 - fConst25) / fConst89));
608 fConst92 = (1 + fConst18);
609 fConst93 = (1.0 / (fConst92 * fConst27));
610 fConst94 = (0 - ((1 - fConst18) / fConst92));
611 fConst95 = (1 + fConst11);
612 fConst96 = (1.0 / (fConst95 * fConst20));
613 fConst97 = (0 - ((1 - fConst11) / fConst95));
614 fConst98 = (1 + fConst5);
615 fConst99 = (1.0 / (fConst98 * fConst13));
616 fConst100 = (0 - ((1 - fConst5) / fConst98));
617 fConst101 = (0 - fConst5);
618 fConst102 = (2 * (0 - fConst3));
619 fConst103 = (1 + ((fConst5 - 1.0) / fConst2));
620 fConst104 = (1.0 / (1 + ((1.0 + fConst5) / fConst2)));
621 fConst105 = (0 - fConst11);
622 fConst106 = (2 * (0 - fConst9));
623 fConst107 = (1 + ((fConst11 - 1.0) / fConst8));
624 fConst108 = (1.0 / (1 + ((1.0 + fConst11) / fConst8)));
625 fConst109 = (0 - fConst18);
626 fConst110 = (2 * (0 - fConst16));
627 fConst111 = (1 + ((fConst18 - 1.0) / fConst15));
628 fConst112 = (1.0 / (1 + ((1.0 + fConst18) / fConst15)));
629 fConst113 = (0 - fConst25);
630 fConst114 = (2 * (0 - fConst23));
631 fConst115 = (1 + ((fConst25 - 1.0) / fConst22));
632 fConst116 = (1.0 / (1 + ((1.0 + fConst25) / fConst22)));
633 fConst117 = (0 - fConst32);
634 fConst118 = (2 * (0 - fConst30));
635 fConst119 = (1 + ((fConst32 - 1.0) / fConst29));
636 fConst120 = (1.0 / (1 + ((1.0 + fConst32) / fConst29)));
637 fConst121 = (0 - fConst39);
638 fConst122 = (2 * (0 - fConst37));
639 fConst123 = (1 + ((fConst39 - 1.0) / fConst36));
640 fConst124 = (1.0 / (1 + ((1.0 + fConst39) / fConst36)));
641 fConst125 = (0 - fConst46);
642 fConst126 = (2 * (0 - fConst44));
643 fConst127 = (1 + ((fConst46 - 1.0) / fConst43));
644 fConst128 = (1.0 / (1 + ((1.0 + fConst46) / fConst43)));
645 fConst129 = (0 - fConst53);
646 fConst130 = (2 * (0 - fConst51));
647 fConst131 = (1 + ((fConst53 - 1.0) / fConst50));
648 fConst132 = (1.0 / (1 + ((1.0 + fConst53) / fConst50)));
649 fConst133 = (0 - fConst60);
650 fConst134 = (2 * (0 - fConst58));
651 fConst135 = (1 + ((fConst60 - 1.0) / fConst57));
652 fConst136 = (1.0 / (1 + ((1.0 + fConst60) / fConst57)));
653 fConst137 = (0 - fConst67);
654 fConst138 = (2 * (0 - fConst65));
655 clear_state_f();
656 }
657
658 void Dsp::init_static(uint32_t samplingFreq, PluginLV2 *p)
659 {
660 static_cast<Dsp*>(p)->init(samplingFreq);
661 }
662
663 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
664 {
665 #define fslider0 (*fslider0_)
666 #define fbargraph0 (*fbargraph0_)
667 #define fslider1 (*fslider1_)
668 #define fbargraph1 (*fbargraph1_)
669 #define fslider2 (*fslider2_)
670 #define fbargraph2 (*fbargraph2_)
671 #define fslider3 (*fslider3_)
672 #define fbargraph3 (*fbargraph3_)
673 #define fslider4 (*fslider4_)
674 #define fbargraph4 (*fbargraph4_)
675 #define fslider5 (*fslider5_)
676 #define fbargraph5 (*fbargraph5_)
677 #define fslider6 (*fslider6_)
678 #define fbargraph6 (*fbargraph6_)
679 #define fslider7 (*fslider7_)
680 #define fbargraph7 (*fbargraph7_)
681 #define fslider8 (*fslider8_)
682 #define fbargraph8 (*fbargraph8_)
683 #define fslider9 (*fslider9_)
684 #define fbargraph9 (*fbargraph9_)
685 #define fslider10 (*fslider10_)
686 #define fbargraph10 (*fbargraph10_)
687 double fSlow0 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider0))));
688 double fSlow1 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider1))));
689 double fSlow2 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider2))));
690 double fSlow3 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider3))));
691 double fSlow4 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider4))));
692 double fSlow5 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider5))));
693 double fSlow6 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider6))));
694 double fSlow7 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider7))));
695 double fSlow8 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider8))));
696 double fSlow9 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider9))));
697 double fSlow10 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider10))));
698 for (int i=0; i<count; i++) {
699 double fTemp0 = (double)input0[i];
700 fVec0[0] = fTemp0;
701 fRec23[0] = ((fConst73 * fRec23[1]) + (fConst72 * (fVec0[0] + fVec0[1])));
702 fRec22[0] = (fRec23[0] - (fConst70 * ((fConst68 * fRec22[2]) + (fConst66 * fRec22[1]))));
703 double fTemp1 = (fRec22[2] + (fRec22[0] + (2 * fRec22[1])));
704 fVec1[0] = fTemp1;
705 fRec21[0] = ((fConst76 * fRec21[1]) + (fConst75 * (fVec1[0] + fVec1[1])));
706 fRec20[0] = (fRec21[0] - (fConst63 * ((fConst61 * fRec20[2]) + (fConst59 * fRec20[1]))));
707 double fTemp2 = (fRec20[2] + (fRec20[0] + (2 * fRec20[1])));
708 fVec2[0] = fTemp2;
709 fRec19[0] = ((fConst79 * fRec19[1]) + (fConst78 * (fVec2[0] + fVec2[1])));
710 fRec18[0] = (fRec19[0] - (fConst56 * ((fConst54 * fRec18[2]) + (fConst52 * fRec18[1]))));
711 double fTemp3 = (fRec18[2] + (fRec18[0] + (2 * fRec18[1])));
712 fVec3[0] = fTemp3;
713 fRec17[0] = ((fConst82 * fRec17[1]) + (fConst81 * (fVec3[0] + fVec3[1])));
714 fRec16[0] = (fRec17[0] - (fConst49 * ((fConst47 * fRec16[2]) + (fConst45 * fRec16[1]))));
715 double fTemp4 = (fRec16[2] + (fRec16[0] + (2 * fRec16[1])));
716 fVec4[0] = fTemp4;
717 fRec15[0] = ((fConst85 * fRec15[1]) + (fConst84 * (fVec4[0] + fVec4[1])));
718 fRec14[0] = (fRec15[0] - (fConst42 * ((fConst40 * fRec14[2]) + (fConst38 * fRec14[1]))));
719 double fTemp5 = (fRec14[2] + (fRec14[0] + (2 * fRec14[1])));
720 fVec5[0] = fTemp5;
721 fRec13[0] = ((fConst88 * fRec13[1]) + (fConst87 * (fVec5[0] + fVec5[1])));
722 fRec12[0] = (fRec13[0] - (fConst35 * ((fConst33 * fRec12[2]) + (fConst31 * fRec12[1]))));
723 double fTemp6 = (fRec12[2] + (fRec12[0] + (2 * fRec12[1])));
724 fVec6[0] = fTemp6;
725 fRec11[0] = ((fConst91 * fRec11[1]) + (fConst90 * (fVec6[0] + fVec6[1])));
726 fRec10[0] = (fRec11[0] - (fConst28 * ((fConst26 * fRec10[2]) + (fConst24 * fRec10[1]))));
727 double fTemp7 = (fRec10[2] + (fRec10[0] + (2 * fRec10[1])));
728 fVec7[0] = fTemp7;
729 fRec9[0] = ((fConst94 * fRec9[1]) + (fConst93 * (fVec7[0] + fVec7[1])));
730 fRec8[0] = (fRec9[0] - (fConst21 * ((fConst19 * fRec8[2]) + (fConst17 * fRec8[1]))));
731 double fTemp8 = (fRec8[2] + (fRec8[0] + (2 * fRec8[1])));
732 fVec8[0] = fTemp8;
733 fRec7[0] = ((fConst97 * fRec7[1]) + (fConst96 * (fVec8[0] + fVec8[1])));
734 fRec6[0] = (fRec7[0] - (fConst14 * ((fConst12 * fRec6[2]) + (fConst10 * fRec6[1]))));
735 double fTemp9 = (fRec6[2] + (fRec6[0] + (2 * fRec6[1])));
736 fVec9[0] = fTemp9;
737 fRec5[0] = ((fConst100 * fRec5[1]) + (fConst99 * (fVec9[0] + fVec9[1])));
738 fRec4[0] = (fRec5[0] - (fConst7 * ((fConst6 * fRec4[2]) + (fConst4 * fRec4[1]))));
739 fRec24[0] = ((0.999 * fRec24[1]) + fSlow0);
740 double fTemp10 = (fConst7 * (fRec24[0] * (fRec4[2] + (fRec4[0] + (2 * fRec4[1])))));
741 double fRec3 = max(fConst1, fabs(fTemp10));
742 int iTemp11 = int((iRec1[1] < 4096));
743 fRec0[0] = ((iTemp11)?max(fRec0[1], fRec3):fRec3);
744 iRec1[0] = ((iTemp11)?(1 + iRec1[1]):1);
745 fRec2[0] = ((iTemp11)?fRec2[1]:fRec0[1]);
746 fbargraph0 = fRec2[0];
747 fRec30[0] = ((fConst100 * fRec30[1]) + (fConst99 * ((fConst5 * fVec9[0]) + (fConst101 * fVec9[1]))));
748 fRec29[0] = (fRec30[0] - (fConst7 * ((fConst6 * fRec29[2]) + (fConst4 * fRec29[1]))));
749 fRec31[0] = ((0.999 * fRec31[1]) + fSlow1);
750 double fTemp12 = (fConst7 * (fRec31[0] * (((fConst3 * fRec29[0]) + (fConst102 * fRec29[1])) + (fConst3 * fRec29[2]))));
751 double fRec28 = max(fConst1, fabs(fTemp12));
752 int iTemp13 = int((iRec26[1] < 4096));
753 fRec25[0] = ((iTemp13)?max(fRec25[1], fRec28):fRec28);
754 iRec26[0] = ((iTemp13)?(1 + iRec26[1]):1);
755 fRec27[0] = ((iTemp13)?fRec27[1]:fRec25[1]);
756 fbargraph1 = fRec27[0];
757 double fTemp14 = (fConst4 * fRec36[1]);
758 fRec38[0] = ((fConst97 * fRec38[1]) + (fConst96 * ((fConst11 * fVec8[0]) + (fConst105 * fVec8[1]))));
759 fRec37[0] = (fRec38[0] - (fConst14 * ((fConst12 * fRec37[2]) + (fConst10 * fRec37[1]))));
760 fRec36[0] = ((fConst14 * (((fConst9 * fRec37[0]) + (fConst106 * fRec37[1])) + (fConst9 * fRec37[2]))) - (fConst104 * ((fConst103 * fRec36[2]) + fTemp14)));
761 fRec39[0] = ((0.999 * fRec39[1]) + fSlow2);
762 double fTemp15 = (fRec39[0] * (fRec36[2] + (fConst104 * (fTemp14 + (fConst103 * fRec36[0])))));
763 double fRec35 = max(fConst1, fabs(fTemp15));
764 int iTemp16 = int((iRec33[1] < 4096));
765 fRec32[0] = ((iTemp16)?max(fRec32[1], fRec35):fRec35);
766 iRec33[0] = ((iTemp16)?(1 + iRec33[1]):1);
767 fRec34[0] = ((iTemp16)?fRec34[1]:fRec32[1]);
768 fbargraph2 = fRec34[0];
769 double fTemp17 = (fConst4 * fRec44[1]);
770 double fTemp18 = (fConst10 * fRec45[1]);
771 fRec47[0] = ((fConst94 * fRec47[1]) + (fConst93 * ((fConst18 * fVec7[0]) + (fConst109 * fVec7[1]))));
772 fRec46[0] = (fRec47[0] - (fConst21 * ((fConst19 * fRec46[2]) + (fConst17 * fRec46[1]))));
773 fRec45[0] = ((fConst21 * (((fConst16 * fRec46[0]) + (fConst110 * fRec46[1])) + (fConst16 * fRec46[2]))) - (fConst108 * ((fConst107 * fRec45[2]) + fTemp18)));
774 fRec44[0] = ((fRec45[2] + (fConst108 * (fTemp18 + (fConst107 * fRec45[0])))) - (fConst104 * ((fConst103 * fRec44[2]) + fTemp17)));
775 fRec48[0] = ((0.999 * fRec48[1]) + fSlow3);
776 double fTemp19 = (fRec48[0] * (fRec44[2] + (fConst104 * (fTemp17 + (fConst103 * fRec44[0])))));
777 double fRec43 = max(fConst1, fabs(fTemp19));
778 int iTemp20 = int((iRec41[1] < 4096));
779 fRec40[0] = ((iTemp20)?max(fRec40[1], fRec43):fRec43);
780 iRec41[0] = ((iTemp20)?(1 + iRec41[1]):1);
781 fRec42[0] = ((iTemp20)?fRec42[1]:fRec40[1]);
782 fbargraph3 = fRec42[0];
783 double fTemp21 = (fConst4 * fRec53[1]);
784 double fTemp22 = (fConst10 * fRec54[1]);
785 double fTemp23 = (fConst17 * fRec55[1]);
786 fRec57[0] = ((fConst91 * fRec57[1]) + (fConst90 * ((fConst25 * fVec6[0]) + (fConst113 * fVec6[1]))));
787 fRec56[0] = (fRec57[0] - (fConst28 * ((fConst26 * fRec56[2]) + (fConst24 * fRec56[1]))));
788 fRec55[0] = ((fConst28 * (((fConst23 * fRec56[0]) + (fConst114 * fRec56[1])) + (fConst23 * fRec56[2]))) - (fConst112 * ((fConst111 * fRec55[2]) + fTemp23)));
789 fRec54[0] = ((fRec55[2] + (fConst112 * (fTemp23 + (fConst111 * fRec55[0])))) - (fConst108 * ((fConst107 * fRec54[2]) + fTemp22)));
790 fRec53[0] = ((fRec54[2] + (fConst108 * (fTemp22 + (fConst107 * fRec54[0])))) - (fConst104 * ((fConst103 * fRec53[2]) + fTemp21)));
791 fRec58[0] = ((0.999 * fRec58[1]) + fSlow4);
792 double fTemp24 = (fRec58[0] * (fRec53[2] + (fConst104 * (fTemp21 + (fConst103 * fRec53[0])))));
793 double fRec52 = max(fConst1, fabs(fTemp24));
794 int iTemp25 = int((iRec50[1] < 4096));
795 fRec49[0] = ((iTemp25)?max(fRec49[1], fRec52):fRec52);
796 iRec50[0] = ((iTemp25)?(1 + iRec50[1]):1);
797 fRec51[0] = ((iTemp25)?fRec51[1]:fRec49[1]);
798 fbargraph4 = fRec51[0];
799 double fTemp26 = (fConst4 * fRec63[1]);
800 double fTemp27 = (fConst10 * fRec64[1]);
801 double fTemp28 = (fConst17 * fRec65[1]);
802 double fTemp29 = (fConst24 * fRec66[1]);
803 fRec68[0] = ((fConst88 * fRec68[1]) + (fConst87 * ((fConst32 * fVec5[0]) + (fConst117 * fVec5[1]))));
804 fRec67[0] = (fRec68[0] - (fConst35 * ((fConst33 * fRec67[2]) + (fConst31 * fRec67[1]))));
805 fRec66[0] = ((fConst35 * (((fConst30 * fRec67[0]) + (fConst118 * fRec67[1])) + (fConst30 * fRec67[2]))) - (fConst116 * ((fConst115 * fRec66[2]) + fTemp29)));
806 fRec65[0] = ((fRec66[2] + (fConst116 * (fTemp29 + (fConst115 * fRec66[0])))) - (fConst112 * ((fConst111 * fRec65[2]) + fTemp28)));
807 fRec64[0] = ((fRec65[2] + (fConst112 * (fTemp28 + (fConst111 * fRec65[0])))) - (fConst108 * ((fConst107 * fRec64[2]) + fTemp27)));
808 fRec63[0] = ((fRec64[2] + (fConst108 * (fTemp27 + (fConst107 * fRec64[0])))) - (fConst104 * ((fConst103 * fRec63[2]) + fTemp26)));
809 fRec69[0] = ((0.999 * fRec69[1]) + fSlow5);
810 double fTemp30 = (fRec69[0] * (fRec63[2] + (fConst104 * (fTemp26 + (fConst103 * fRec63[0])))));
811 double fRec62 = max(fConst1, fabs(fTemp30));
812 int iTemp31 = int((iRec60[1] < 4096));
813 fRec59[0] = ((iTemp31)?max(fRec59[1], fRec62):fRec62);
814 iRec60[0] = ((iTemp31)?(1 + iRec60[1]):1);
815 fRec61[0] = ((iTemp31)?fRec61[1]:fRec59[1]);
816 fbargraph5 = fRec61[0];
817 double fTemp32 = (fConst4 * fRec74[1]);
818 double fTemp33 = (fConst10 * fRec75[1]);
819 double fTemp34 = (fConst17 * fRec76[1]);
820 double fTemp35 = (fConst24 * fRec77[1]);
821 double fTemp36 = (fConst31 * fRec78[1]);
822 fRec80[0] = ((fConst85 * fRec80[1]) + (fConst84 * ((fConst39 * fVec4[0]) + (fConst121 * fVec4[1]))));
823 fRec79[0] = (fRec80[0] - (fConst42 * ((fConst40 * fRec79[2]) + (fConst38 * fRec79[1]))));
824 fRec78[0] = ((fConst42 * (((fConst37 * fRec79[0]) + (fConst122 * fRec79[1])) + (fConst37 * fRec79[2]))) - (fConst120 * ((fConst119 * fRec78[2]) + fTemp36)));
825 fRec77[0] = ((fRec78[2] + (fConst120 * (fTemp36 + (fConst119 * fRec78[0])))) - (fConst116 * ((fConst115 * fRec77[2]) + fTemp35)));
826 fRec76[0] = ((fRec77[2] + (fConst116 * (fTemp35 + (fConst115 * fRec77[0])))) - (fConst112 * ((fConst111 * fRec76[2]) + fTemp34)));
827 fRec75[0] = ((fRec76[2] + (fConst112 * (fTemp34 + (fConst111 * fRec76[0])))) - (fConst108 * ((fConst107 * fRec75[2]) + fTemp33)));
828 fRec74[0] = ((fRec75[2] + (fConst108 * (fTemp33 + (fConst107 * fRec75[0])))) - (fConst104 * ((fConst103 * fRec74[2]) + fTemp32)));
829 fRec81[0] = ((0.999 * fRec81[1]) + fSlow6);
830 double fTemp37 = (fRec81[0] * (fRec74[2] + (fConst104 * (fTemp32 + (fConst103 * fRec74[0])))));
831 double fRec73 = max(fConst1, fabs(fTemp37));
832 int iTemp38 = int((iRec71[1] < 4096));
833 fRec70[0] = ((iTemp38)?max(fRec70[1], fRec73):fRec73);
834 iRec71[0] = ((iTemp38)?(1 + iRec71[1]):1);
835 fRec72[0] = ((iTemp38)?fRec72[1]:fRec70[1]);
836 fbargraph6 = fRec72[0];
837 double fTemp39 = (fConst4 * fRec86[1]);
838 double fTemp40 = (fConst10 * fRec87[1]);
839 double fTemp41 = (fConst17 * fRec88[1]);
840 double fTemp42 = (fConst24 * fRec89[1]);
841 double fTemp43 = (fConst31 * fRec90[1]);
842 double fTemp44 = (fConst38 * fRec91[1]);
843 fRec93[0] = ((fConst82 * fRec93[1]) + (fConst81 * ((fConst46 * fVec3[0]) + (fConst125 * fVec3[1]))));
844 fRec92[0] = (fRec93[0] - (fConst49 * ((fConst47 * fRec92[2]) + (fConst45 * fRec92[1]))));
845 fRec91[0] = ((fConst49 * (((fConst44 * fRec92[0]) + (fConst126 * fRec92[1])) + (fConst44 * fRec92[2]))) - (fConst124 * ((fConst123 * fRec91[2]) + fTemp44)));
846 fRec90[0] = ((fRec91[2] + (fConst124 * (fTemp44 + (fConst123 * fRec91[0])))) - (fConst120 * ((fConst119 * fRec90[2]) + fTemp43)));
847 fRec89[0] = ((fRec90[2] + (fConst120 * (fTemp43 + (fConst119 * fRec90[0])))) - (fConst116 * ((fConst115 * fRec89[2]) + fTemp42)));
848 fRec88[0] = ((fRec89[2] + (fConst116 * (fTemp42 + (fConst115 * fRec89[0])))) - (fConst112 * ((fConst111 * fRec88[2]) + fTemp41)));
849 fRec87[0] = ((fRec88[2] + (fConst112 * (fTemp41 + (fConst111 * fRec88[0])))) - (fConst108 * ((fConst107 * fRec87[2]) + fTemp40)));
850 fRec86[0] = ((fRec87[2] + (fConst108 * (fTemp40 + (fConst107 * fRec87[0])))) - (fConst104 * ((fConst103 * fRec86[2]) + fTemp39)));
851 fRec94[0] = ((0.999 * fRec94[1]) + fSlow7);
852 double fTemp45 = (fRec94[0] * (fRec86[2] + (fConst104 * (fTemp39 + (fConst103 * fRec86[0])))));
853 double fRec85 = max(fConst1, fabs(fTemp45));
854 int iTemp46 = int((iRec83[1] < 4096));
855 fRec82[0] = ((iTemp46)?max(fRec82[1], fRec85):fRec85);
856 iRec83[0] = ((iTemp46)?(1 + iRec83[1]):1);
857 fRec84[0] = ((iTemp46)?fRec84[1]:fRec82[1]);
858 fbargraph7 = fRec84[0];
859 double fTemp47 = (fConst4 * fRec99[1]);
860 double fTemp48 = (fConst10 * fRec100[1]);
861 double fTemp49 = (fConst17 * fRec101[1]);
862 double fTemp50 = (fConst24 * fRec102[1]);
863 double fTemp51 = (fConst31 * fRec103[1]);
864 double fTemp52 = (fConst38 * fRec104[1]);
865 double fTemp53 = (fConst45 * fRec105[1]);
866 fRec107[0] = ((fConst79 * fRec107[1]) + (fConst78 * ((fConst53 * fVec2[0]) + (fConst129 * fVec2[1]))));
867 fRec106[0] = (fRec107[0] - (fConst56 * ((fConst54 * fRec106[2]) + (fConst52 * fRec106[1]))));
868 fRec105[0] = ((fConst56 * (((fConst51 * fRec106[0]) + (fConst130 * fRec106[1])) + (fConst51 * fRec106[2]))) - (fConst128 * ((fConst127 * fRec105[2]) + fTemp53)));
869 fRec104[0] = ((fRec105[2] + (fConst128 * (fTemp53 + (fConst127 * fRec105[0])))) - (fConst124 * ((fConst123 * fRec104[2]) + fTemp52)));
870 fRec103[0] = ((fRec104[2] + (fConst124 * (fTemp52 + (fConst123 * fRec104[0])))) - (fConst120 * ((fConst119 * fRec103[2]) + fTemp51)));
871 fRec102[0] = ((fRec103[2] + (fConst120 * (fTemp51 + (fConst119 * fRec103[0])))) - (fConst116 * ((fConst115 * fRec102[2]) + fTemp50)));
872 fRec101[0] = ((fRec102[2] + (fConst116 * (fTemp50 + (fConst115 * fRec102[0])))) - (fConst112 * ((fConst111 * fRec101[2]) + fTemp49)));
873 fRec100[0] = ((fRec101[2] + (fConst112 * (fTemp49 + (fConst111 * fRec101[0])))) - (fConst108 * ((fConst107 * fRec100[2]) + fTemp48)));
874 fRec99[0] = ((fRec100[2] + (fConst108 * (fTemp48 + (fConst107 * fRec100[0])))) - (fConst104 * ((fConst103 * fRec99[2]) + fTemp47)));
875 fRec108[0] = ((0.999 * fRec108[1]) + fSlow8);
876 double fTemp54 = (fRec108[0] * (fRec99[2] + (fConst104 * (fTemp47 + (fConst103 * fRec99[0])))));
877 double fRec98 = max(fConst1, fabs(fTemp54));
878 int iTemp55 = int((iRec96[1] < 4096));
879 fRec95[0] = ((iTemp55)?max(fRec95[1], fRec98):fRec98);
880 iRec96[0] = ((iTemp55)?(1 + iRec96[1]):1);
881 fRec97[0] = ((iTemp55)?fRec97[1]:fRec95[1]);
882 fbargraph8 = fRec97[0];
883 double fTemp56 = (fConst4 * fRec113[1]);
884 double fTemp57 = (fConst10 * fRec114[1]);
885 double fTemp58 = (fConst17 * fRec115[1]);
886 double fTemp59 = (fConst24 * fRec116[1]);
887 double fTemp60 = (fConst31 * fRec117[1]);
888 double fTemp61 = (fConst38 * fRec118[1]);
889 double fTemp62 = (fConst45 * fRec119[1]);
890 double fTemp63 = (fConst52 * fRec120[1]);
891 fRec122[0] = ((fConst76 * fRec122[1]) + (fConst75 * ((fConst60 * fVec1[0]) + (fConst133 * fVec1[1]))));
892 fRec121[0] = (fRec122[0] - (fConst63 * ((fConst61 * fRec121[2]) + (fConst59 * fRec121[1]))));
893 fRec120[0] = ((fConst63 * (((fConst58 * fRec121[0]) + (fConst134 * fRec121[1])) + (fConst58 * fRec121[2]))) - (fConst132 * ((fConst131 * fRec120[2]) + fTemp63)));
894 fRec119[0] = ((fRec120[2] + (fConst132 * (fTemp63 + (fConst131 * fRec120[0])))) - (fConst128 * ((fConst127 * fRec119[2]) + fTemp62)));
895 fRec118[0] = ((fRec119[2] + (fConst128 * (fTemp62 + (fConst127 * fRec119[0])))) - (fConst124 * ((fConst123 * fRec118[2]) + fTemp61)));
896 fRec117[0] = ((fRec118[2] + (fConst124 * (fTemp61 + (fConst123 * fRec118[0])))) - (fConst120 * ((fConst119 * fRec117[2]) + fTemp60)));
897 fRec116[0] = ((fRec117[2] + (fConst120 * (fTemp60 + (fConst119 * fRec117[0])))) - (fConst116 * ((fConst115 * fRec116[2]) + fTemp59)));
898 fRec115[0] = ((fRec116[2] + (fConst116 * (fTemp59 + (fConst115 * fRec116[0])))) - (fConst112 * ((fConst111 * fRec115[2]) + fTemp58)));
899 fRec114[0] = ((fRec115[2] + (fConst112 * (fTemp58 + (fConst111 * fRec115[0])))) - (fConst108 * ((fConst107 * fRec114[2]) + fTemp57)));
900 fRec113[0] = ((fRec114[2] + (fConst108 * (fTemp57 + (fConst107 * fRec114[0])))) - (fConst104 * ((fConst103 * fRec113[2]) + fTemp56)));
901 fRec123[0] = ((0.999 * fRec123[1]) + fSlow9);
902 double fTemp64 = (fRec123[0] * (fRec113[2] + (fConst104 * (fTemp56 + (fConst103 * fRec113[0])))));
903 double fRec112 = max(fConst1, fabs(fTemp64));
904 int iTemp65 = int((iRec110[1] < 4096));
905 fRec109[0] = ((iTemp65)?max(fRec109[1], fRec112):fRec112);
906 iRec110[0] = ((iTemp65)?(1 + iRec110[1]):1);
907 fRec111[0] = ((iTemp65)?fRec111[1]:fRec109[1]);
908 fbargraph9 = fRec111[0];
909 double fTemp66 = (fConst4 * fRec128[1]);
910 double fTemp67 = (fConst10 * fRec129[1]);
911 double fTemp68 = (fConst17 * fRec130[1]);
912 double fTemp69 = (fConst24 * fRec131[1]);
913 double fTemp70 = (fConst31 * fRec132[1]);
914 double fTemp71 = (fConst38 * fRec133[1]);
915 double fTemp72 = (fConst45 * fRec134[1]);
916 double fTemp73 = (fConst52 * fRec135[1]);
917 double fTemp74 = (fConst59 * fRec136[1]);
918 fRec138[0] = ((fConst73 * fRec138[1]) + (fConst72 * ((fConst67 * fVec0[0]) + (fConst137 * fVec0[1]))));
919 fRec137[0] = (fRec138[0] - (fConst70 * ((fConst68 * fRec137[2]) + (fConst66 * fRec137[1]))));
920 fRec136[0] = ((fConst70 * (((fConst65 * fRec137[0]) + (fConst138 * fRec137[1])) + (fConst65 * fRec137[2]))) - (fConst136 * ((fConst135 * fRec136[2]) + fTemp74)));
921 fRec135[0] = ((fRec136[2] + (fConst136 * (fTemp74 + (fConst135 * fRec136[0])))) - (fConst132 * ((fConst131 * fRec135[2]) + fTemp73)));
922 fRec134[0] = ((fRec135[2] + (fConst132 * (fTemp73 + (fConst131 * fRec135[0])))) - (fConst128 * ((fConst127 * fRec134[2]) + fTemp72)));
923 fRec133[0] = ((fRec134[2] + (fConst128 * (fTemp72 + (fConst127 * fRec134[0])))) - (fConst124 * ((fConst123 * fRec133[2]) + fTemp71)));
924 fRec132[0] = ((fRec133[2] + (fConst124 * (fTemp71 + (fConst123 * fRec133[0])))) - (fConst120 * ((fConst119 * fRec132[2]) + fTemp70)));
925 fRec131[0] = ((fRec132[2] + (fConst120 * (fTemp70 + (fConst119 * fRec132[0])))) - (fConst116 * ((fConst115 * fRec131[2]) + fTemp69)));
926 fRec130[0] = ((fRec131[2] + (fConst116 * (fTemp69 + (fConst115 * fRec131[0])))) - (fConst112 * ((fConst111 * fRec130[2]) + fTemp68)));
927 fRec129[0] = ((fRec130[2] + (fConst112 * (fTemp68 + (fConst111 * fRec130[0])))) - (fConst108 * ((fConst107 * fRec129[2]) + fTemp67)));
928 fRec128[0] = ((fRec129[2] + (fConst108 * (fTemp67 + (fConst107 * fRec129[0])))) - (fConst104 * ((fConst103 * fRec128[2]) + fTemp66)));
929 fRec139[0] = ((0.999 * fRec139[1]) + fSlow10);
930 double fTemp75 = (fRec139[0] * (fRec128[2] + (fConst104 * (fTemp66 + (fConst103 * fRec128[0])))));
931 double fRec127 = max(fConst1, fabs(fTemp75));
932 int iTemp76 = int((iRec125[1] < 4096));
933 fRec124[0] = ((iTemp76)?max(fRec124[1], fRec127):fRec127);
934 iRec125[0] = ((iTemp76)?(1 + iRec125[1]):1);
935 fRec126[0] = ((iTemp76)?fRec126[1]:fRec124[1]);
936 fbargraph10 = fRec126[0];
937 output0[i] = (FAUSTFLOAT)((((((((((fTemp75 + fTemp64) + fTemp54) + fTemp45) + fTemp37) + fTemp30) + fTemp24) + fTemp19) + fTemp15) + fTemp12) + fTemp10);
938 // post processing
939 fRec126[1] = fRec126[0];
940 iRec125[1] = iRec125[0];
941 fRec124[1] = fRec124[0];
942 fRec139[1] = fRec139[0];
943 fRec128[2] = fRec128[1]; fRec128[1] = fRec128[0];
944 fRec129[2] = fRec129[1]; fRec129[1] = fRec129[0];
945 fRec130[2] = fRec130[1]; fRec130[1] = fRec130[0];
946 fRec131[2] = fRec131[1]; fRec131[1] = fRec131[0];
947 fRec132[2] = fRec132[1]; fRec132[1] = fRec132[0];
948 fRec133[2] = fRec133[1]; fRec133[1] = fRec133[0];
949 fRec134[2] = fRec134[1]; fRec134[1] = fRec134[0];
950 fRec135[2] = fRec135[1]; fRec135[1] = fRec135[0];
951 fRec136[2] = fRec136[1]; fRec136[1] = fRec136[0];
952 fRec137[2] = fRec137[1]; fRec137[1] = fRec137[0];
953 fRec138[1] = fRec138[0];
954 fRec111[1] = fRec111[0];
955 iRec110[1] = iRec110[0];
956 fRec109[1] = fRec109[0];
957 fRec123[1] = fRec123[0];
958 fRec113[2] = fRec113[1]; fRec113[1] = fRec113[0];
959 fRec114[2] = fRec114[1]; fRec114[1] = fRec114[0];
960 fRec115[2] = fRec115[1]; fRec115[1] = fRec115[0];
961 fRec116[2] = fRec116[1]; fRec116[1] = fRec116[0];
962 fRec117[2] = fRec117[1]; fRec117[1] = fRec117[0];
963 fRec118[2] = fRec118[1]; fRec118[1] = fRec118[0];
964 fRec119[2] = fRec119[1]; fRec119[1] = fRec119[0];
965 fRec120[2] = fRec120[1]; fRec120[1] = fRec120[0];
966 fRec121[2] = fRec121[1]; fRec121[1] = fRec121[0];
967 fRec122[1] = fRec122[0];
968 fRec97[1] = fRec97[0];
969 iRec96[1] = iRec96[0];
970 fRec95[1] = fRec95[0];
971 fRec108[1] = fRec108[0];
972 fRec99[2] = fRec99[1]; fRec99[1] = fRec99[0];
973 fRec100[2] = fRec100[1]; fRec100[1] = fRec100[0];
974 fRec101[2] = fRec101[1]; fRec101[1] = fRec101[0];
975 fRec102[2] = fRec102[1]; fRec102[1] = fRec102[0];
976 fRec103[2] = fRec103[1]; fRec103[1] = fRec103[0];
977 fRec104[2] = fRec104[1]; fRec104[1] = fRec104[0];
978 fRec105[2] = fRec105[1]; fRec105[1] = fRec105[0];
979 fRec106[2] = fRec106[1]; fRec106[1] = fRec106[0];
980 fRec107[1] = fRec107[0];
981 fRec84[1] = fRec84[0];
982 iRec83[1] = iRec83[0];
983 fRec82[1] = fRec82[0];
984 fRec94[1] = fRec94[0];
985 fRec86[2] = fRec86[1]; fRec86[1] = fRec86[0];
986 fRec87[2] = fRec87[1]; fRec87[1] = fRec87[0];
987 fRec88[2] = fRec88[1]; fRec88[1] = fRec88[0];
988 fRec89[2] = fRec89[1]; fRec89[1] = fRec89[0];
989 fRec90[2] = fRec90[1]; fRec90[1] = fRec90[0];
990 fRec91[2] = fRec91[1]; fRec91[1] = fRec91[0];
991 fRec92[2] = fRec92[1]; fRec92[1] = fRec92[0];
992 fRec93[1] = fRec93[0];
993 fRec72[1] = fRec72[0];
994 iRec71[1] = iRec71[0];
995 fRec70[1] = fRec70[0];
996 fRec81[1] = fRec81[0];
997 fRec74[2] = fRec74[1]; fRec74[1] = fRec74[0];
998 fRec75[2] = fRec75[1]; fRec75[1] = fRec75[0];
999 fRec76[2] = fRec76[1]; fRec76[1] = fRec76[0];
1000 fRec77[2] = fRec77[1]; fRec77[1] = fRec77[0];
1001 fRec78[2] = fRec78[1]; fRec78[1] = fRec78[0];
1002 fRec79[2] = fRec79[1]; fRec79[1] = fRec79[0];
1003 fRec80[1] = fRec80[0];
1004 fRec61[1] = fRec61[0];
1005 iRec60[1] = iRec60[0];
1006 fRec59[1] = fRec59[0];
1007 fRec69[1] = fRec69[0];
1008 fRec63[2] = fRec63[1]; fRec63[1] = fRec63[0];
1009 fRec64[2] = fRec64[1]; fRec64[1] = fRec64[0];
1010 fRec65[2] = fRec65[1]; fRec65[1] = fRec65[0];
1011 fRec66[2] = fRec66[1]; fRec66[1] = fRec66[0];
1012 fRec67[2] = fRec67[1]; fRec67[1] = fRec67[0];
1013 fRec68[1] = fRec68[0];
1014 fRec51[1] = fRec51[0];
1015 iRec50[1] = iRec50[0];
1016 fRec49[1] = fRec49[0];
1017 fRec58[1] = fRec58[0];
1018 fRec53[2] = fRec53[1]; fRec53[1] = fRec53[0];
1019 fRec54[2] = fRec54[1]; fRec54[1] = fRec54[0];
1020 fRec55[2] = fRec55[1]; fRec55[1] = fRec55[0];
1021 fRec56[2] = fRec56[1]; fRec56[1] = fRec56[0];
1022 fRec57[1] = fRec57[0];
1023 fRec42[1] = fRec42[0];
1024 iRec41[1] = iRec41[0];
1025 fRec40[1] = fRec40[0];
1026 fRec48[1] = fRec48[0];
1027 fRec44[2] = fRec44[1]; fRec44[1] = fRec44[0];
1028 fRec45[2] = fRec45[1]; fRec45[1] = fRec45[0];
1029 fRec46[2] = fRec46[1]; fRec46[1] = fRec46[0];
1030 fRec47[1] = fRec47[0];
1031 fRec34[1] = fRec34[0];
1032 iRec33[1] = iRec33[0];
1033 fRec32[1] = fRec32[0];
1034 fRec39[1] = fRec39[0];
1035 fRec36[2] = fRec36[1]; fRec36[1] = fRec36[0];
1036 fRec37[2] = fRec37[1]; fRec37[1] = fRec37[0];
1037 fRec38[1] = fRec38[0];
1038 fRec27[1] = fRec27[0];
1039 iRec26[1] = iRec26[0];
1040 fRec25[1] = fRec25[0];
1041 fRec31[1] = fRec31[0];
1042 fRec29[2] = fRec29[1]; fRec29[1] = fRec29[0];
1043 fRec30[1] = fRec30[0];
1044 fRec2[1] = fRec2[0];
1045 iRec1[1] = iRec1[0];
1046 fRec0[1] = fRec0[0];
1047 fRec24[1] = fRec24[0];
1048 fRec4[2] = fRec4[1]; fRec4[1] = fRec4[0];
1049 fRec5[1] = fRec5[0];
1050 fVec9[1] = fVec9[0];
1051 fRec6[2] = fRec6[1]; fRec6[1] = fRec6[0];
1052 fRec7[1] = fRec7[0];
1053 fVec8[1] = fVec8[0];
1054 fRec8[2] = fRec8[1]; fRec8[1] = fRec8[0];
1055 fRec9[1] = fRec9[0];
1056 fVec7[1] = fVec7[0];
1057 fRec10[2] = fRec10[1]; fRec10[1] = fRec10[0];
1058 fRec11[1] = fRec11[0];
1059 fVec6[1] = fVec6[0];
1060 fRec12[2] = fRec12[1]; fRec12[1] = fRec12[0];
1061 fRec13[1] = fRec13[0];
1062 fVec5[1] = fVec5[0];
1063 fRec14[2] = fRec14[1]; fRec14[1] = fRec14[0];
1064 fRec15[1] = fRec15[0];
1065 fVec4[1] = fVec4[0];
1066 fRec16[2] = fRec16[1]; fRec16[1] = fRec16[0];
1067 fRec17[1] = fRec17[0];
1068 fVec3[1] = fVec3[0];
1069 fRec18[2] = fRec18[1]; fRec18[1] = fRec18[0];
1070 fRec19[1] = fRec19[0];
1071 fVec2[1] = fVec2[0];
1072 fRec20[2] = fRec20[1]; fRec20[1] = fRec20[0];
1073 fRec21[1] = fRec21[0];
1074 fVec1[1] = fVec1[0];
1075 fRec22[2] = fRec22[1]; fRec22[1] = fRec22[0];
1076 fRec23[1] = fRec23[0];
1077 fVec0[1] = fVec0[0];
1078 }
1079 #undef fslider0
1080 #undef fbargraph0
1081 #undef fslider1
1082 #undef fbargraph1
1083 #undef fslider2
1084 #undef fbargraph2
1085 #undef fslider3
1086 #undef fbargraph3
1087 #undef fslider4
1088 #undef fbargraph4
1089 #undef fslider5
1090 #undef fbargraph5
1091 #undef fslider6
1092 #undef fbargraph6
1093 #undef fslider7
1094 #undef fbargraph7
1095 #undef fslider8
1096 #undef fbargraph8
1097 #undef fslider9
1098 #undef fbargraph9
1099 #undef fslider10
1100 #undef fbargraph10
1101 }
1102
1103 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
1104 {
1105 static_cast<Dsp*>(p)->compute(count, input0, output0);
1106 }
1107
1108
1109 void Dsp::connect(uint32_t port,void* data)
1110 {
1111 switch ((PortIndex)port)
1112 {
1113 case G10:
1114 fslider9_ = (float*)data; // , 0.0, -3e+01, 2e+01, 0.1
1115 break;
1116 case G11:
1117 fslider10_ = (float*)data; // , 0.0, -3e+01, 2e+01, 0.1
1118 break;
1119 case G1:
1120 fslider0_ = (float*)data; // , 0.0, -6e+01, 2e+01, 0.1
1121 break;
1122 case G2:
1123 fslider1_ = (float*)data; // , 0.0, -3e+01, 2e+01, 0.1
1124 break;
1125 case G3:
1126 fslider2_ = (float*)data; // , 0.0, -3e+01, 2e+01, 0.1
1127 break;
1128 case G4:
1129 fslider3_ = (float*)data; // , 0.0, -3e+01, 2e+01, 0.1
1130 break;
1131 case G5:
1132 fslider4_ = (float*)data; // , 0.0, -3e+01, 2e+01, 0.1
1133 break;
1134 case G6:
1135 fslider5_ = (float*)data; // , 0.0, -3e+01, 2e+01, 0.1
1136 break;
1137 case G7:
1138 fslider6_ = (float*)data; // , 0.0, -3e+01, 2e+01, 0.1
1139 break;
1140 case G8:
1141 fslider7_ = (float*)data; // , 0.0, -3e+01, 2e+01, 0.1
1142 break;
1143 case G9:
1144 fslider8_ = (float*)data; // , 0.0, -3e+01, 2e+01, 0.1
1145 break;
1146 case V10:
1147 fbargraph9_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
1148 break;
1149 case V11:
1150 fbargraph10_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
1151 break;
1152 case V1:
1153 fbargraph0_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
1154 break;
1155 case V2:
1156 fbargraph1_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
1157 break;
1158 case V3:
1159 fbargraph2_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
1160 break;
1161 case V4:
1162 fbargraph3_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
1163 break;
1164 case V5:
1165 fbargraph4_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
1166 break;
1167 case V6:
1168 fbargraph5_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
1169 break;
1170 case V7:
1171 fbargraph6_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
1172 break;
1173 case V8:
1174 fbargraph7_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
1175 break;
1176 case V9:
1177 fbargraph8_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
1178 break;
1179 default:
1180 break;
1181 }
1182 }
1183
1184 void Dsp::connect_static(uint32_t port,void* data, PluginLV2 *p)
1185 {
1186 static_cast<Dsp*>(p)->connect(port, data);
1187 }
1188
1189
1190 PluginLV2 *plugin() {
1191 return new Dsp();
1192 }
1193
1194 void Dsp::del_instance(PluginLV2 *p)
1195 {
1196 delete static_cast<Dsp*>(p);
1197 }
1198
1199 /*
1200 typedef enum
1201 {
1202 G10,
1203 G11,
1204 G1,
1205 G2,
1206 G3,
1207 G4,
1208 G5,
1209 G6,
1210 G7,
1211 G8,
1212 G9,
1213 V10,
1214 V11,
1215 V1,
1216 V2,
1217 V3,
1218 V4,
1219 V5,
1220 V6,
1221 V7,
1222 V8,
1223 V9,
1224 } PortIndex;
1225 */
1226
1227 } // end namespace graphiceq
7979 void connect(uint32_t port,void* data);
8080 void clear_state_f();
8181 void init(uint32_t samplingFreq);
82 void compute(int count, float *input0, float *input1, float *output0, float *output1);
82 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
8383
8484 static void clear_state_f_static(PluginLV2*);
8585 static void init_static(uint32_t samplingFreq, PluginLV2*);
86 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
86 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
8787 static void del_instance(PluginLV2 *p);
8888 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
8989 public:
193193 static_cast<Dsp*>(p)->init(samplingFreq);
194194 }
195195
196 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
196 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
197197 {
198198 #define fslider0 (*fslider0_)
199199 #define fslider1 (*fslider1_)
300300 #undef fslider5
301301 }
302302
303 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
303 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
304304 {
305305 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
306306 }
1212 void connect(uint32_t port,void* data);
1313 void clear_state_f();
1414 void init(uint32_t samplingFreq);
15 void compute(int count, float *input0, float *output0);
15 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1616
1717 static void clear_state_f_static(PluginLV2*);
1818 static void init_static(uint32_t samplingFreq, PluginLV2*);
19 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
19 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2020 static void del_instance(PluginLV2 *p);
2121 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2222 public:
6464 static_cast<Dsp*>(p)->init(samplingFreq);
6565 }
6666
67 void always_inline Dsp::compute(int count, float *input0, float *output0)
67 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
6868 {
6969 #define fslider0 (*fslider0_)
7070 double fSlow0 = (0.0010000000000000009 * pow(10,(0.05 * fslider0)));
7777 #undef fslider0
7878 }
7979
80 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
80 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
8181 {
8282 static_cast<Dsp*>(p)->compute(count, input0, output0);
8383 }
1616 void connect(uint32_t port,void* data);
1717 void clear_state_f();
1818 void init(uint32_t samplingFreq);
19 void compute(int count, float *input0, float *output0);
19 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2020
2121 static void clear_state_f_static(PluginLV2*);
2222 static void init_static(uint32_t samplingFreq, PluginLV2*);
23 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
23 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2424 static void del_instance(PluginLV2 *p);
2525 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2626 public:
7373 static_cast<Dsp*>(p)->init(samplingFreq);
7474 }
7575
76 void always_inline Dsp::compute(int count, float *input0, float *output0)
76 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7777 {
7878 #define fslider0 (*fslider0_)
7979 #define fslider1 (*fslider1_)
9191 #undef fcheckbox0
9292 }
9393
94 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
94 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
9595 {
9696 static_cast<Dsp*>(p)->compute(count, input0, output0);
9797 }
9090 void connect(uint32_t port,void* data);
9191 void clear_state_f();
9292 void init(uint32_t samplingFreq);
93 void compute(int count, float *input0, float *output0);
93 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
9494
9595 static void clear_state_f_static(PluginLV2*);
9696 static void init_static(uint32_t samplingFreq, PluginLV2*);
97 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
97 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
9898 static void del_instance(PluginLV2 *p);
9999 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
100100 public:
213213 static_cast<Dsp*>(p)->init(samplingFreq);
214214 }
215215
216 void always_inline Dsp::compute(int count, float *input0, float *output0)
216 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
217217 {
218218 #define fcheckbox0 (*fcheckbox0_)
219219 #define fslider0 (*fslider0_)
294294 #undef fslider2
295295 }
296296
297 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
297 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
298298 {
299299 static_cast<Dsp*>(p)->compute(count, input0, output0);
300300 }
8888 void connect(uint32_t port,void* data);
8989 void clear_state_f();
9090 void init(uint32_t samplingFreq);
91 void compute(int count, float *input0, float *output0);
91 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
9292
9393 static void clear_state_f_static(PluginLV2*);
9494 static void init_static(uint32_t samplingFreq, PluginLV2*);
95 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
95 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
9696 static void del_instance(PluginLV2 *p);
9797 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
9898 public:
209209 static_cast<Dsp*>(p)->init(samplingFreq);
210210 }
211211
212 void always_inline Dsp::compute(int count, float *input0, float *output0)
212 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
213213 {
214214 #define fslider0 (*fslider0_)
215215 #define fcheckbox0 (*fcheckbox0_)
296296 #undef fslider2
297297 }
298298
299 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
299 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
300300 {
301301 static_cast<Dsp*>(p)->compute(count, input0, output0);
302302 }
9494 void connect(uint32_t port,void* data);
9595 void clear_state_f();
9696 void init(uint32_t samplingFreq);
97 void compute(int count, float *input0, float *output0);
97 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
9898
9999 static void clear_state_f_static(PluginLV2*);
100100 static void init_static(uint32_t samplingFreq, PluginLV2*);
101 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
101 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
102102 static void del_instance(PluginLV2 *p);
103103 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
104104 public:
199199 static_cast<Dsp*>(p)->init(samplingFreq);
200200 }
201201
202 void always_inline Dsp::compute(int count, float *input0, float *output0)
202 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
203203 {
204204 #define fslider0 (*fslider0_)
205205 #define fslider1 (*fslider1_)
381381 #undef fslider13
382382 }
383383
384 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
384 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
385385 {
386386 static_cast<Dsp*>(p)->compute(count, input0, output0);
387387 }
1414 void connect(uint32_t port,void* data);
1515 void clear_state_f();
1616 void init(uint32_t samplingFreq);
17 void compute(int count, float *input0, float *output0);
17 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1818
1919 static void clear_state_f_static(PluginLV2*);
2020 static void init_static(uint32_t samplingFreq, PluginLV2*);
21 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
21 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2222 static void del_instance(PluginLV2 *p);
2323 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2424 public:
6666 static_cast<Dsp*>(p)->init(samplingFreq);
6767 }
6868
69 void always_inline Dsp::compute(int count, float *input0, float *output0)
69 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7070 {
7171 #define fslider0 (*fslider0_)
7272 #define fslider1 (*fslider1_)
8484 #undef fslider1
8585 }
8686
87 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
87 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
8888 {
8989 static_cast<Dsp*>(p)->compute(count, input0, output0);
9090 }
3333 void connect(uint32_t port,void* data);
3434 void clear_state_f();
3535 void init(uint32_t samplingFreq);
36 void compute(int count, float *input0, float *output0);
36 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
3737
3838 static void clear_state_f_static(PluginLV2*);
3939 static void init_static(uint32_t samplingFreq, PluginLV2*);
40 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
40 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
4141 static void del_instance(PluginLV2 *p);
4242 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
4343 public:
9696 static_cast<Dsp*>(p)->init(samplingFreq);
9797 }
9898
99 void always_inline Dsp::compute(int count, float *input0, float *output0)
99 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
100100 {
101101 #define fslider0 (*fslider0_)
102102 #define fslider1 (*fslider1_)
159159 #undef fslider5
160160 }
161161
162 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
162 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
163163 {
164164 static_cast<Dsp*>(p)->compute(count, input0, output0);
165165 }
1212 void connect(uint32_t port,void* data);
1313 void clear_state_f();
1414 void init(uint32_t samplingFreq);
15 void compute(int count, float *input0, float *input1, float *output0, float *output1);
15 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
1616
1717 static void clear_state_f_static(PluginLV2*);
1818 static void init_static(uint32_t samplingFreq, PluginLV2*);
19 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
19 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2020 static void del_instance(PluginLV2 *p);
2121 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2222 public:
6464 static_cast<Dsp*>(p)->init(samplingFreq);
6565 }
6666
67 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
67 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
6868 {
6969 #define fslider0 (*fslider0_)
7070 double fSlow0 = (0.0010000000000000009 * pow(10,(0.05 * fslider0)));
7878 #undef fslider0
7979 }
8080
81 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
81 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
8282 {
8383 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
8484 }
1414 void connect(uint32_t port,void* data);
1515 void clear_state_f();
1616 void init(uint32_t samplingFreq);
17 void compute(int count, float *input0, float *input1, float *output0, float *output1);
17 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
1818
1919 static void clear_state_f_static(PluginLV2*);
2020 static void init_static(uint32_t samplingFreq, PluginLV2*);
21 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
21 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2222 static void del_instance(PluginLV2 *p);
2323 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2424 public:
7171 static_cast<Dsp*>(p)->init(samplingFreq);
7272 }
7373
74 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
74 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
7575 {
7676 #define fslider0 (*fslider0_)
7777 #define fslider1 (*fslider1_)
8787 #undef fslider1
8888 }
8989
90 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
90 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
9191 {
9292 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
9393 }
4545 void connect(uint32_t port,void* data);
4646 void clear_state_f();
4747 void init(uint32_t samplingFreq);
48 void compute(int count, float *input0, float *output0);
48 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
4949
5050 static void clear_state_f_static(PluginLV2*);
5151 static void init_static(uint32_t samplingFreq, PluginLV2*);
52 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
52 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
5353 static void del_instance(PluginLV2 *p);
5454 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
5555 public:
121121 static_cast<Dsp*>(p)->init(samplingFreq);
122122 }
123123
124 void always_inline Dsp::compute(int count, float *input0, float *output0)
124 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
125125 {
126126 #define fslider0 (*fslider0_)
127127 #define fslider1 (*fslider1_)
204204 #undef fcheckbox0
205205 }
206206
207 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
207 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
208208 {
209209 static_cast<Dsp*>(p)->compute(count, input0, output0);
210210 }
6666 void connect(uint32_t port,void* data);
6767 void clear_state_f();
6868 void init(uint32_t samplingFreq);
69 void compute(int count, float *input0, float *input1, float *output0, float *output1);
69 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
7070
7171 static void clear_state_f_static(PluginLV2*);
7272 static void init_static(uint32_t samplingFreq, PluginLV2*);
73 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
73 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
7474 static void del_instance(PluginLV2 *p);
7575 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
7676 public:
153153 static_cast<Dsp*>(p)->init(samplingFreq);
154154 }
155155
156 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
156 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
157157 {
158158 #define fslider0 (*fslider0_)
159159 #define fslider1 (*fslider1_)
312312 #undef fcheckbox1
313313 }
314314
315 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
315 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
316316 {
317317 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
318318 }
104104 void connect(uint32_t port,void* data);
105105 void clear_state_f();
106106 void init(uint32_t samplingFreq);
107 void compute(int count, float *input0, float *output0);
107 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
108108
109109 static void clear_state_f_static(PluginLV2*);
110110 static void init_static(uint32_t samplingFreq, PluginLV2*);
111 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
111 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
112112 static void del_instance(PluginLV2 *p);
113113 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
114114 public:
235235 static_cast<Dsp*>(p)->init(samplingFreq);
236236 }
237237
238 void always_inline Dsp::compute(int count, float *input0, float *output0)
238 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
239239 {
240240 #define fslider0 (*fslider0_)
241241 #define fcheckbox0 (*fcheckbox0_)
346346 #undef fslider4
347347 }
348348
349 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
349 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
350350 {
351351 static_cast<Dsp*>(p)->compute(count, input0, output0);
352352 }
133133 void connect(uint32_t port,void* data);
134134 void clear_state_f();
135135 void init(uint32_t samplingFreq);
136 void compute(int count, float *input0, float *input1, float *output0, float *output1);
136 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
137137
138138 static void clear_state_f_static(PluginLV2*);
139139 static void init_static(uint32_t samplingFreq, PluginLV2*);
140 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
140 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
141141 static void del_instance(PluginLV2 *p);
142142 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
143143 public:
295295 static_cast<Dsp*>(p)->init(samplingFreq);
296296 }
297297
298 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
298 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
299299 {
300300 #define fslider0 (*fslider0_)
301301 #define fslider1 (*fslider1_)
555555 #undef fslider10
556556 }
557557
558 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
558 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
559559 {
560560 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
561561 }
127127 void connect(uint32_t port,void* data);
128128 void clear_state_f();
129129 void init(uint32_t samplingFreq);
130 void compute(int count, float *input0, float *output0);
130 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
131131
132132 static void clear_state_f_static(PluginLV2*);
133133 static void init_static(uint32_t samplingFreq, PluginLV2*);
134 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
134 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
135135 static void del_instance(PluginLV2 *p);
136136 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
137137 public:
287287 static_cast<Dsp*>(p)->init(samplingFreq);
288288 }
289289
290 void always_inline Dsp::compute(int count, float *input0, float *output0)
290 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
291291 {
292292 #define fslider0 (*fslider0_)
293293 #define fslider1 (*fslider1_)
417417 #undef fslider3
418418 }
419419
420 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
420 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
421421 {
422422 static_cast<Dsp*>(p)->compute(count, input0, output0);
423423 }
131131 void connect(uint32_t port,void* data);
132132 void clear_state_f();
133133 void init(uint32_t samplingFreq);
134 void compute(int count, float *input0, float *output0);
134 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
135135
136136 static void clear_state_f_static(PluginLV2*);
137137 static void init_static(uint32_t samplingFreq, PluginLV2*);
138 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
138 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
139139 static void del_instance(PluginLV2 *p);
140140 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
141141 public:
295295 static_cast<Dsp*>(p)->init(samplingFreq);
296296 }
297297
298 void always_inline Dsp::compute(int count, float *input0, float *output0)
298 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
299299 {
300300 #define fslider0 (*fslider0_)
301301 #define fslider1 (*fslider1_)
434434 #undef fslider3
435435 }
436436
437 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
437 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
438438 {
439439 static_cast<Dsp*>(p)->compute(count, input0, output0);
440440 }
173173 void connect(uint32_t port,void* data);
174174 void clear_state_f();
175175 void init(uint32_t samplingFreq);
176 void compute(int count, float *input0, float *input1, float *output0, float *output1);
176 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
177177
178178 static void clear_state_f_static(PluginLV2*);
179179 static void init_static(uint32_t samplingFreq, PluginLV2*);
180 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
180 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
181181 static void del_instance(PluginLV2 *p);
182182 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
183183 public:
379379 static_cast<Dsp*>(p)->init(samplingFreq);
380380 }
381381
382 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
382 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
383383 {
384384 #define fslider0 (*fslider0_)
385385 #define fslider1 (*fslider1_)
625625 #undef fslider3
626626 }
627627
628 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
628 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
629629 {
630630 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
631631 }
143143 void connect(uint32_t port,void* data);
144144 void clear_state_f();
145145 void init(uint32_t samplingFreq);
146 void compute(int count, float *input0, float *output0);
146 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
147147
148148 static void clear_state_f_static(PluginLV2*);
149149 static void init_static(uint32_t samplingFreq, PluginLV2*);
150 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
150 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
151151 static void del_instance(PluginLV2 *p);
152152 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
153153 public:
319319 static_cast<Dsp*>(p)->init(samplingFreq);
320320 }
321321
322 void always_inline Dsp::compute(int count, float *input0, float *output0)
322 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
323323 {
324324 #define fslider0 (*fslider0_)
325325 #define fslider1 (*fslider1_)
489489 #undef fslider3
490490 }
491491
492 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
492 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
493493 {
494494 static_cast<Dsp*>(p)->compute(count, input0, output0);
495495 }
194194 void connect(uint32_t port,void* data);
195195 void clear_state_f();
196196 void init(uint32_t samplingFreq);
197 void compute(int count, float *input0, float *input1, float *output0, float *output1);
197 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
198198
199199 static void clear_state_f_static(PluginLV2*);
200200 static void init_static(uint32_t samplingFreq, PluginLV2*);
201 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
201 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
202202 static void del_instance(PluginLV2 *p);
203203 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
204204 public:
421421 static_cast<Dsp*>(p)->init(samplingFreq);
422422 }
423423
424 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
424 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
425425 {
426426 #define fslider0 (*fslider0_)
427427 #define fslider1 (*fslider1_)
726726 #undef fslider3
727727 }
728728
729 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
729 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
730730 {
731731 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
732732 }
135135 void connect(uint32_t port,void* data);
136136 void clear_state_f();
137137 void init(uint32_t samplingFreq);
138 void compute(int count, float *input0, float *output0);
138 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
139139
140140 static void clear_state_f_static(PluginLV2*);
141141 static void init_static(uint32_t samplingFreq, PluginLV2*);
142 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
142 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
143143 static void del_instance(PluginLV2 *p);
144144 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
145145 public:
303303 static_cast<Dsp*>(p)->init(samplingFreq);
304304 }
305305
306 void always_inline Dsp::compute(int count, float *input0, float *output0)
306 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
307307 {
308308 #define fslider0 (*fslider0_)
309309 #define fslider1 (*fslider1_)
448448 #undef fslider3
449449 }
450450
451 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
451 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
452452 {
453453 static_cast<Dsp*>(p)->compute(count, input0, output0);
454454 }
180180 void connect(uint32_t port,void* data);
181181 void clear_state_f();
182182 void init(uint32_t samplingFreq);
183 void compute(int count, float *input0, float *input1, float *output0, float *output1);
183 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
184184
185185 static void clear_state_f_static(PluginLV2*);
186186 static void init_static(uint32_t samplingFreq, PluginLV2*);
187 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
187 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
188188 static void del_instance(PluginLV2 *p);
189189 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
190190 public:
393393 static_cast<Dsp*>(p)->init(samplingFreq);
394394 }
395395
396 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
396 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
397397 {
398398 #define fslider0 (*fslider0_)
399399 #define fslider1 (*fslider1_)
651651 #undef fslider3
652652 }
653653
654 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
654 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
655655 {
656656 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
657657 }
143143 void connect(uint32_t port,void* data);
144144 void clear_state_f();
145145 void init(uint32_t samplingFreq);
146 void compute(int count, float *input0, float *output0);
146 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
147147
148148 static void clear_state_f_static(PluginLV2*);
149149 static void init_static(uint32_t samplingFreq, PluginLV2*);
150 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
150 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
151151 static void del_instance(PluginLV2 *p);
152152 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
153153 public:
319319 static_cast<Dsp*>(p)->init(samplingFreq);
320320 }
321321
322 void always_inline Dsp::compute(int count, float *input0, float *output0)
322 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
323323 {
324324 #define fslider0 (*fslider0_)
325325 #define fslider1 (*fslider1_)
489489 #undef fslider3
490490 }
491491
492 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
492 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
493493 {
494494 static_cast<Dsp*>(p)->compute(count, input0, output0);
495495 }
194194 void connect(uint32_t port,void* data);
195195 void clear_state_f();
196196 void init(uint32_t samplingFreq);
197 void compute(int count, float *input0, float *input1, float *output0, float *output1);
197 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
198198
199199 static void clear_state_f_static(PluginLV2*);
200200 static void init_static(uint32_t samplingFreq, PluginLV2*);
201 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
201 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
202202 static void del_instance(PluginLV2 *p);
203203 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
204204 public:
421421 static_cast<Dsp*>(p)->init(samplingFreq);
422422 }
423423
424 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
424 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
425425 {
426426 #define fslider0 (*fslider0_)
427427 #define fslider1 (*fslider1_)
726726 #undef fslider3
727727 }
728728
729 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
729 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
730730 {
731731 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
732732 }
127127 void connect(uint32_t port,void* data);
128128 void clear_state_f();
129129 void init(uint32_t samplingFreq);
130 void compute(int count, float *input0, float *output0);
130 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
131131
132132 static void clear_state_f_static(PluginLV2*);
133133 static void init_static(uint32_t samplingFreq, PluginLV2*);
134 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
134 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
135135 static void del_instance(PluginLV2 *p);
136136 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
137137 public:
287287 static_cast<Dsp*>(p)->init(samplingFreq);
288288 }
289289
290 void always_inline Dsp::compute(int count, float *input0, float *output0)
290 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
291291 {
292292 #define fslider0 (*fslider0_)
293293 #define fslider1 (*fslider1_)
417417 #undef fslider3
418418 }
419419
420 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
420 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
421421 {
422422 static_cast<Dsp*>(p)->compute(count, input0, output0);
423423 }
165165 void connect(uint32_t port,void* data);
166166 void clear_state_f();
167167 void init(uint32_t samplingFreq);
168 void compute(int count, float *input0, float *input1, float *output0, float *output1);
168 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
169169
170170 static void clear_state_f_static(PluginLV2*);
171171 static void init_static(uint32_t samplingFreq, PluginLV2*);
172 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
172 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
173173 static void del_instance(PluginLV2 *p);
174174 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
175175 public:
288288 {
289289 fSamplingFreq = samplingFreq;
290290 iConst0 = min(192000, max(1, fSamplingFreq));
291 fConst1 = (1.0 / tan((97.38937226128358 / double(iConst0))));
291 fConst1 = (1.0 / tan((20517.741620594938 / double(iConst0))));
292292 fConst2 = (1 + fConst1);
293293 fConst3 = (0 - ((1 - fConst1) / fConst2));
294 fConst4 = (1.0 / tan((20517.741620594938 / double(iConst0))));
294 fConst4 = (1.0 / tan((97.38937226128358 / double(iConst0))));
295295 fConst5 = (1 + fConst4);
296296 fConst6 = (0 - ((1 - fConst4) / fConst5));
297297 fConst7 = (1.0 / tan((270.1769682087222 / double(iConst0))));
328328 fConst38 = (1 + ((fConst37 - 1.414213562373095) / fConst35));
329329 fConst39 = (1 + ((1.414213562373095 + fConst37) / fConst35));
330330 fConst40 = (1.0 / fConst39);
331 fConst41 = (0 - fConst1);
332 fConst42 = (1.0 / (fConst2 * fConst39));
331 fConst41 = (0 - fConst4);
332 fConst42 = (1.0 / (fConst5 * fConst39));
333333 fConst43 = (1.0 / fConst33);
334334 fConst44 = (0 - fConst20);
335335 fConst45 = (1.0 / (fConst24 * fConst31));
345345 fConst55 = (1.0 / (1 + ((1.0 + fConst20) / fConst17)));
346346 fConst56 = (0 - fConst29);
347347 fConst57 = (2 * (0 - fConst27));
348 fConst58 = (1.0 / fConst5);
349 fConst59 = (0.025 / fConst2);
348 fConst58 = (1.0 / fConst2);
349 fConst59 = (0.025 / fConst5);
350350 fConst60 = (1.0 / tan((414.6902302738527 / double(iConst0))));
351351 fConst61 = (1 + fConst60);
352352 fConst62 = (0 - ((1 - fConst60) / fConst61));
363363 static_cast<Dsp*>(p)->init(samplingFreq);
364364 }
365365
366 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
366 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
367367 {
368368 #define fslider0 (*fslider0_)
369369 #define fslider1 (*fslider1_)
396396 fRec19[0] = (fTemp5 - (fConst40 * ((fConst38 * fRec19[2]) + (fConst36 * fRec19[1]))));
397397 double fTemp6 = (fRec19[2] + (fRec19[0] + (2 * fRec19[1])));
398398 fVec1[0] = fTemp6;
399 fRec18[0] = ((fConst42 * ((fConst41 * fVec1[1]) + (fConst1 * fVec1[0]))) + (fConst3 * fRec18[1]));
399 fRec18[0] = ((fConst42 * ((fConst41 * fVec1[1]) + (fConst4 * fVec1[0]))) + (fConst6 * fRec18[1]));
400400 fRec17[0] = ((fConst43 * (fRec18[0] + fRec18[1])) + (fConst34 * fRec17[1]));
401401 fRec16[0] = (fRec17[0] - (fConst32 * ((fConst30 * fRec16[2]) + (fConst28 * fRec16[1]))));
402402 double fTemp7 = (fRec16[2] + (fRec16[0] + (2 * fRec16[1])));
424424 double fTemp14 = max((double)-1, min((double)1, (fSlow7 * (fRec28[2] + (fRec28[0] + (2 * fRec28[1]))))));
425425 double fTemp15 = ((1.2589412 * (fTemp14 * (1 - (0.3333333333333333 * faustpower<2>(fTemp14))))) + (1.584893192 * ((fTemp13 * (1 - (0.3333333333333333 * faustpower<2>(fTemp13)))) + ((fTemp10 * (1 - (0.3333333333333333 * faustpower<2>(fTemp10)))) + (0.8413951417869425 * (fTemp8 * (1 - (0.3333333333333333 * faustpower<2>(fTemp8)))))))));
426426 fVec4[0] = fTemp15;
427 fRec12[0] = ((fConst58 * (fVec4[0] + fVec4[1])) + (fConst6 * fRec12[1]));
427 fRec12[0] = ((fConst58 * (fVec4[0] + fVec4[1])) + (fConst3 * fRec12[1]));
428428 double fTemp16 = (1e-15 + fTemp2);
429429 fRec9[0] = (Ftube(TUBE_TABLE_12AT7_68k, (((fSlow11 * ((fTemp16 * (4 - (4 * fabs(fTemp16)))) - fTemp16)) + ((fSlow10 * fTemp5) + ((fSlow9 * fRec12[0]) + (fRec11[0] + fTemp2)))) - 2.6177529999999978)) - 153.04618518518518);
430 fRec8[0] = ((fConst59 * ((fConst41 * fRec9[1]) + (fConst1 * fRec9[0]))) + (fConst3 * fRec8[1]));
430 fRec8[0] = ((fConst59 * ((fConst41 * fRec9[1]) + (fConst4 * fRec9[0]))) + (fConst6 * fRec8[1]));
431431 double fTemp17 = (fRec8[0] * fRec7[0]);
432432 fVec5[0] = fTemp17;
433 fRec6[0] = ((fConst58 * (fVec5[0] + fVec5[1])) + (fConst6 * fRec6[1]));
433 fRec6[0] = ((fConst58 * (fVec5[0] + fVec5[1])) + (fConst3 * fRec6[1]));
434434 double fTemp18 = (1e-15 + (0.015 * fRec5[1]));
435435 fVec6[0] = fTemp18;
436436 fRec30[0] = ((fConst63 * (fVec6[0] + fVec6[1])) + (fConst62 * fRec30[1]));
437437 fRec5[0] = (Ftube(TUBE_TABLE_12AT7_250k, ((fRec30[0] + fRec6[0]) - 1.887331999999999)) - 124.17786666666666);
438 fRec4[0] = ((fConst59 * ((fConst41 * fRec5[1]) + (fConst1 * fRec5[0]))) + (fConst3 * fRec4[1]));
438 fRec4[0] = ((fConst59 * ((fConst41 * fRec5[1]) + (fConst4 * fRec5[0]))) + (fConst6 * fRec4[1]));
439439 double fTemp19 = (fRec7[0] * fRec4[0]);
440440 fVec7[0] = fTemp19;
441 fRec3[0] = ((fConst58 * (fVec7[0] + fVec7[1])) + (fConst6 * fRec3[1]));
441 fRec3[0] = ((fConst58 * (fVec7[0] + fVec7[1])) + (fConst3 * fRec3[1]));
442442 double fTemp20 = (1e-15 + (0.0082 * fRec2[1]));
443443 fVec8[0] = fTemp20;
444444 fRec31[0] = ((fConst67 * (fVec8[0] + fVec8[1])) + (fConst66 * fRec31[1]));
445445 fRec2[0] = (Ftube(TUBE_TABLE_12AT7_250k, ((fRec31[0] + fRec3[0]) - 1.2569619999999988)) - 96.7119512195122);
446 fRec1[0] = ((fConst59 * ((fConst41 * fRec2[1]) + (fConst1 * fRec2[0]))) + (fConst3 * fRec1[1]));
446 fRec1[0] = ((fConst6 * fRec1[1]) + (fConst59 * ((fConst41 * fRec2[1]) + (fConst4 * fRec2[0]))));
447447 output0[i] = (FAUSTFLOAT)(fRec1[0] * fRec0[0]);
448448 double fTemp21 = (double)input1[i];
449449 double fTemp22 = (fTemp21 * fTemp0);
455455 fRec48[0] = (fTemp25 - (fConst40 * ((fConst38 * fRec48[2]) + (fConst36 * fRec48[1]))));
456456 double fTemp26 = (fRec48[2] + (fRec48[0] + (2 * fRec48[1])));
457457 fVec10[0] = fTemp26;
458 fRec47[0] = ((fConst42 * ((fConst41 * fVec10[1]) + (fConst1 * fVec10[0]))) + (fConst3 * fRec47[1]));
458 fRec47[0] = ((fConst42 * ((fConst41 * fVec10[1]) + (fConst4 * fVec10[0]))) + (fConst6 * fRec47[1]));
459459 fRec46[0] = ((fConst43 * (fRec47[0] + fRec47[1])) + (fConst34 * fRec46[1]));
460460 fRec45[0] = (fRec46[0] - (fConst32 * ((fConst30 * fRec45[2]) + (fConst28 * fRec45[1]))));
461461 double fTemp27 = (fRec45[2] + (fRec45[0] + (2 * fRec45[1])));
483483 double fTemp34 = max((double)-1, min((double)1, (fSlow7 * (fRec57[2] + (fRec57[0] + (2 * fRec57[1]))))));
484484 double fTemp35 = ((1.2589412 * (fTemp34 * (1 - (0.3333333333333333 * faustpower<2>(fTemp34))))) + (1.584893192 * ((fTemp33 * (1 - (0.3333333333333333 * faustpower<2>(fTemp33)))) + ((fTemp30 * (1 - (0.3333333333333333 * faustpower<2>(fTemp30)))) + (0.8413951417869425 * (fTemp28 * (1 - (0.3333333333333333 * faustpower<2>(fTemp28)))))))));
485485 fVec13[0] = fTemp35;
486 fRec41[0] = ((fConst58 * (fVec13[0] + fVec13[1])) + (fConst6 * fRec41[1]));
486 fRec41[0] = ((fConst58 * (fVec13[0] + fVec13[1])) + (fConst3 * fRec41[1]));
487487 double fTemp36 = (1e-15 + fTemp22);
488488 fRec39[0] = (Ftube(TUBE_TABLE_12AT7_68k, (((fSlow11 * ((fTemp36 * (4 - (4 * fabs(fTemp36)))) - fTemp36)) + ((fSlow10 * fTemp25) + ((fSlow9 * fRec41[0]) + (fRec40[0] + fTemp22)))) - 2.6177529999999978)) - 153.04618518518518);
489 fRec38[0] = ((fConst59 * ((fConst41 * fRec39[1]) + (fConst1 * fRec39[0]))) + (fConst3 * fRec38[1]));
489 fRec38[0] = ((fConst59 * ((fConst41 * fRec39[1]) + (fConst4 * fRec39[0]))) + (fConst6 * fRec38[1]));
490490 double fTemp37 = (fRec7[0] * fRec38[0]);
491491 fVec14[0] = fTemp37;
492 fRec37[0] = ((fConst58 * (fVec14[0] + fVec14[1])) + (fConst6 * fRec37[1]));
492 fRec37[0] = ((fConst58 * (fVec14[0] + fVec14[1])) + (fConst3 * fRec37[1]));
493493 double fTemp38 = (1e-15 + (0.015 * fRec36[1]));
494494 fVec15[0] = fTemp38;
495495 fRec59[0] = ((fConst63 * (fVec15[0] + fVec15[1])) + (fConst62 * fRec59[1]));
496496 fRec36[0] = (Ftube(TUBE_TABLE_12AT7_250k, ((fRec59[0] + fRec37[0]) - 1.887331999999999)) - 124.17786666666666);
497 fRec35[0] = ((fConst59 * ((fConst41 * fRec36[1]) + (fConst1 * fRec36[0]))) + (fConst3 * fRec35[1]));
497 fRec35[0] = ((fConst59 * ((fConst41 * fRec36[1]) + (fConst4 * fRec36[0]))) + (fConst6 * fRec35[1]));
498498 double fTemp39 = (fRec7[0] * fRec35[0]);
499499 fVec16[0] = fTemp39;
500 fRec34[0] = ((fConst58 * (fVec16[0] + fVec16[1])) + (fConst6 * fRec34[1]));
500 fRec34[0] = ((fConst58 * (fVec16[0] + fVec16[1])) + (fConst3 * fRec34[1]));
501501 double fTemp40 = (1e-15 + (0.0082 * fRec33[1]));
502502 fVec17[0] = fTemp40;
503503 fRec60[0] = ((fConst67 * (fVec17[0] + fVec17[1])) + (fConst66 * fRec60[1]));
504504 fRec33[0] = (Ftube(TUBE_TABLE_12AT7_250k, ((fRec60[0] + fRec34[0]) - 1.2569619999999988)) - 96.7119512195122);
505 fRec32[0] = ((fConst59 * ((fConst41 * fRec33[1]) + (fConst1 * fRec33[0]))) + (fConst3 * fRec32[1]));
505 fRec32[0] = ((fConst59 * ((fConst41 * fRec33[1]) + (fConst4 * fRec33[0]))) + (fConst6 * fRec32[1]));
506506 output1[i] = (FAUSTFLOAT)(fRec0[0] * fRec32[0]);
507507 // post processing
508508 fRec32[1] = fRec32[0];
591591 #undef fslider3
592592 }
593593
594 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
594 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
595595 {
596596 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
597597 }
134134 void connect(uint32_t port,void* data);
135135 void clear_state_f();
136136 void init(uint32_t samplingFreq);
137 void compute(int count, float *input0, float *output0);
137 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
138138
139139 static void clear_state_f_static(PluginLV2*);
140140 static void init_static(uint32_t samplingFreq, PluginLV2*);
141 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
141 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
142142 static void del_instance(PluginLV2 *p);
143143 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
144144 public:
301301 static_cast<Dsp*>(p)->init(samplingFreq);
302302 }
303303
304 void always_inline Dsp::compute(int count, float *input0, float *output0)
304 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
305305 {
306306 #define fslider0 (*fslider0_)
307307 #define fslider1 (*fslider1_)
446446 #undef fslider3
447447 }
448448
449 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
449 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
450450 {
451451 static_cast<Dsp*>(p)->compute(count, input0, output0);
452452 }
179179 void connect(uint32_t port,void* data);
180180 void clear_state_f();
181181 void init(uint32_t samplingFreq);
182 void compute(int count, float *input0, float *input1, float *output0, float *output1);
182 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
183183
184184 static void clear_state_f_static(PluginLV2*);
185185 static void init_static(uint32_t samplingFreq, PluginLV2*);
186 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
186 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
187187 static void del_instance(PluginLV2 *p);
188188 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
189189 public:
391391 static_cast<Dsp*>(p)->init(samplingFreq);
392392 }
393393
394 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
394 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
395395 {
396396 #define fslider0 (*fslider0_)
397397 #define fslider1 (*fslider1_)
649649 #undef fslider3
650650 }
651651
652 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
652 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
653653 {
654654 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
655655 }
170170 void connect(uint32_t port,void* data);
171171 void clear_state_f();
172172 void init(uint32_t samplingFreq);
173 void compute(int count, float *input0, float *output0);
173 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
174174
175175 static void clear_state_f_static(PluginLV2*);
176176 static void init_static(uint32_t samplingFreq, PluginLV2*);
177 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
177 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
178178 static void del_instance(PluginLV2 *p);
179179 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
180180 public:
373373 static_cast<Dsp*>(p)->init(samplingFreq);
374374 }
375375
376 void always_inline Dsp::compute(int count, float *input0, float *output0)
376 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
377377 {
378378 #define fslider0 (*fslider0_)
379379 #define fslider1 (*fslider1_)
587587 #undef fslider3
588588 }
589589
590 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
590 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
591591 {
592592 static_cast<Dsp*>(p)->compute(count, input0, output0);
593593 }
238238 void connect(uint32_t port,void* data);
239239 void clear_state_f();
240240 void init(uint32_t samplingFreq);
241 void compute(int count, float *input0, float *input1, float *output0, float *output1);
241 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
242242
243243 static void clear_state_f_static(PluginLV2*);
244244 static void init_static(uint32_t samplingFreq, PluginLV2*);
245 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
245 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
246246 static void del_instance(PluginLV2 *p);
247247 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
248248 public:
509509 static_cast<Dsp*>(p)->init(samplingFreq);
510510 }
511511
512 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
512 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
513513 {
514514 #define fslider0 (*fslider0_)
515515 #define fslider1 (*fslider1_)
904904 #undef fslider3
905905 }
906906
907 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
907 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
908908 {
909909 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
910910 }
143143 void connect(uint32_t port,void* data);
144144 void clear_state_f();
145145 void init(uint32_t samplingFreq);
146 void compute(int count, float *input0, float *output0);
146 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
147147
148148 static void clear_state_f_static(PluginLV2*);
149149 static void init_static(uint32_t samplingFreq, PluginLV2*);
150 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
150 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
151151 static void del_instance(PluginLV2 *p);
152152 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
153153 public:
319319 static_cast<Dsp*>(p)->init(samplingFreq);
320320 }
321321
322 void always_inline Dsp::compute(int count, float *input0, float *output0)
322 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
323323 {
324324 #define fslider0 (*fslider0_)
325325 #define fslider1 (*fslider1_)
489489 #undef fslider3
490490 }
491491
492 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
492 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
493493 {
494494 static_cast<Dsp*>(p)->compute(count, input0, output0);
495495 }
194194 void connect(uint32_t port,void* data);
195195 void clear_state_f();
196196 void init(uint32_t samplingFreq);
197 void compute(int count, float *input0, float *input1, float *output0, float *output1);
197 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
198198
199199 static void clear_state_f_static(PluginLV2*);
200200 static void init_static(uint32_t samplingFreq, PluginLV2*);
201 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
201 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
202202 static void del_instance(PluginLV2 *p);
203203 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
204204 public:
421421 static_cast<Dsp*>(p)->init(samplingFreq);
422422 }
423423
424 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
424 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
425425 {
426426 #define fslider0 (*fslider0_)
427427 #define fslider1 (*fslider1_)
561561 fRec55[0] = (fRec56[0] - (fConst19 * ((fConst17 * fRec55[2]) + (fConst15 * fRec55[1]))));
562562 fRec54[0] = ((fConst19 * (((fConst14 * fRec55[0]) + (fConst44 * fRec55[1])) + (fConst14 * fRec55[2]))) - (fConst12 * ((fConst11 * fRec54[2]) + fTemp34)));
563563 double fTemp51 = max((double)-1, min((double)1, (fSlow4 * (fRec54[2] + (fConst12 * (fTemp34 + (fConst11 * fRec54[0])))))));
564 fRec67[0] = ((fConst43 * (fVec13[0] + fVec13[1])) + (fConst21 * fRec67[1]));
564 fRec67[0] = ((fConst21 * fRec67[1]) + (fConst43 * (fVec13[0] + fVec13[1])));
565565 fRec66[0] = (fRec67[0] - (fConst19 * ((fConst17 * fRec66[2]) + (fConst15 * fRec66[1]))));
566566 double fTemp52 = (fRec66[2] + (fRec66[0] + (2 * fRec66[1])));
567567 fVec14[0] = fTemp52;
726726 #undef fslider3
727727 }
728728
729 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
729 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
730730 {
731731 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
732732 }
127127 void connect(uint32_t port,void* data);
128128 void clear_state_f();
129129 void init(uint32_t samplingFreq);
130 void compute(int count, float *input0, float *output0);
130 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
131131
132132 static void clear_state_f_static(PluginLV2*);
133133 static void init_static(uint32_t samplingFreq, PluginLV2*);
134 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
134 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
135135 static void del_instance(PluginLV2 *p);
136136 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
137137 public:
287287 static_cast<Dsp*>(p)->init(samplingFreq);
288288 }
289289
290 void always_inline Dsp::compute(int count, float *input0, float *output0)
290 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
291291 {
292292 #define fslider0 (*fslider0_)
293293 #define fslider1 (*fslider1_)
417417 #undef fslider3
418418 }
419419
420 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
420 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
421421 {
422422 static_cast<Dsp*>(p)->compute(count, input0, output0);
423423 }
165165 void connect(uint32_t port,void* data);
166166 void clear_state_f();
167167 void init(uint32_t samplingFreq);
168 void compute(int count, float *input0, float *input1, float *output0, float *output1);
168 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
169169
170170 static void clear_state_f_static(PluginLV2*);
171171 static void init_static(uint32_t samplingFreq, PluginLV2*);
172 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
172 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
173173 static void del_instance(PluginLV2 *p);
174174 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
175175 public:
363363 static_cast<Dsp*>(p)->init(samplingFreq);
364364 }
365365
366 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
366 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
367367 {
368368 #define fslider0 (*fslider0_)
369369 #define fslider1 (*fslider1_)
591591 #undef fslider3
592592 }
593593
594 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
594 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
595595 {
596596 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
597597 }
129129 void connect(uint32_t port,void* data);
130130 void clear_state_f();
131131 void init(uint32_t samplingFreq);
132 void compute(int count, float *input0, float *output0);
132 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
133133
134134 static void clear_state_f_static(PluginLV2*);
135135 static void init_static(uint32_t samplingFreq, PluginLV2*);
136 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
136 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
137137 static void del_instance(PluginLV2 *p);
138138 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
139139 public:
291291 static_cast<Dsp*>(p)->init(samplingFreq);
292292 }
293293
294 void always_inline Dsp::compute(int count, float *input0, float *output0)
294 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
295295 {
296296 #define fslider0 (*fslider0_)
297297 #define fslider1 (*fslider1_)
417417 #undef fslider3
418418 }
419419
420 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
420 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
421421 {
422422 static_cast<Dsp*>(p)->compute(count, input0, output0);
423423 }
166166 void connect(uint32_t port,void* data);
167167 void clear_state_f();
168168 void init(uint32_t samplingFreq);
169 void compute(int count, float *input0, float *input1, float *output0, float *output1);
169 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
170170
171171 static void clear_state_f_static(PluginLV2*);
172172 static void init_static(uint32_t samplingFreq, PluginLV2*);
173 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
173 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
174174 static void del_instance(PluginLV2 *p);
175175 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
176176 public:
365365 static_cast<Dsp*>(p)->init(samplingFreq);
366366 }
367367
368 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
368 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
369369 {
370370 #define fslider0 (*fslider0_)
371371 #define fslider1 (*fslider1_)
585585 #undef fslider3
586586 }
587587
588 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
588 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
589589 {
590590 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
591591 }
128128 void connect(uint32_t port,void* data);
129129 void clear_state_f();
130130 void init(uint32_t samplingFreq);
131 void compute(int count, float *input0, float *output0);
131 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
132132
133133 static void clear_state_f_static(PluginLV2*);
134134 static void init_static(uint32_t samplingFreq, PluginLV2*);
135 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
135 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
136136 static void del_instance(PluginLV2 *p);
137137 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
138138 public:
213213 {
214214 fSamplingFreq = samplingFreq;
215215 iConst0 = min(192000, max(1, fSamplingFreq));
216 fConst1 = (1.0 / tan((20517.741620594938 / double(iConst0))));
216 fConst1 = (1.0 / tan((97.38937226128358 / double(iConst0))));
217217 fConst2 = (1 + fConst1);
218218 fConst3 = (0 - ((1 - fConst1) / fConst2));
219 fConst4 = (1.0 / tan((97.38937226128358 / double(iConst0))));
219 fConst4 = (1.0 / tan((20517.741620594938 / double(iConst0))));
220220 fConst5 = (1 + fConst4);
221221 fConst6 = (0 - ((1 - fConst4) / fConst5));
222222 fConst7 = (1.0 / tan((270.1769682087222 / double(iConst0))));
253253 fConst38 = (1 + ((fConst37 - 1.414213562373095) / fConst35));
254254 fConst39 = (1 + ((1.414213562373095 + fConst37) / fConst35));
255255 fConst40 = (1.0 / fConst39);
256 fConst41 = (0 - fConst4);
257 fConst42 = (1.0 / (fConst5 * fConst39));
256 fConst41 = (0 - fConst1);
257 fConst42 = (1.0 / (fConst2 * fConst39));
258258 fConst43 = (1.0 / fConst33);
259259 fConst44 = (0 - fConst20);
260260 fConst45 = (1.0 / (fConst24 * fConst31));
270270 fConst55 = (1.0 / (1 + ((1.0 + fConst20) / fConst17)));
271271 fConst56 = (0 - fConst29);
272272 fConst57 = (2 * (0 - fConst27));
273 fConst58 = (1.0 / fConst2);
274 fConst59 = (0.025 / fConst5);
275 fConst60 = (2.0 / fConst2);
273 fConst58 = (1.0 / fConst5);
274 fConst59 = (0.025 / fConst2);
275 fConst60 = (2.0 / fConst5);
276276 fConst61 = (1.0 / tan((414.6902302738527 / double(iConst0))));
277277 fConst62 = (1 + fConst61);
278278 fConst63 = (0 - ((1 - fConst61) / fConst62));
289289 static_cast<Dsp*>(p)->init(samplingFreq);
290290 }
291291
292 void always_inline Dsp::compute(int count, float *input0, float *output0)
292 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
293293 {
294294 #define fslider0 (*fslider0_)
295295 #define fslider1 (*fslider1_)
321321 fRec19[0] = (fTemp4 - (fConst40 * ((fConst38 * fRec19[2]) + (fConst36 * fRec19[1]))));
322322 double fTemp5 = (fRec19[2] + (fRec19[0] + (2 * fRec19[1])));
323323 fVec1[0] = fTemp5;
324 fRec18[0] = ((fConst42 * ((fConst41 * fVec1[1]) + (fConst4 * fVec1[0]))) + (fConst6 * fRec18[1]));
324 fRec18[0] = ((fConst42 * ((fConst41 * fVec1[1]) + (fConst1 * fVec1[0]))) + (fConst3 * fRec18[1]));
325325 fRec17[0] = ((fConst43 * (fRec18[0] + fRec18[1])) + (fConst34 * fRec17[1]));
326326 fRec16[0] = (fRec17[0] - (fConst32 * ((fConst30 * fRec16[2]) + (fConst28 * fRec16[1]))));
327327 double fTemp6 = (fRec16[2] + (fRec16[0] + (2 * fRec16[1])));
349349 double fTemp13 = max((double)-1, min((double)1, (fSlow7 * (fRec28[2] + (fRec28[0] + (2 * fRec28[1]))))));
350350 double fTemp14 = ((1.2589412 * (fTemp13 * (1 - (0.3333333333333333 * faustpower<2>(fTemp13))))) + (1.584893192 * ((fTemp12 * (1 - (0.3333333333333333 * faustpower<2>(fTemp12)))) + ((fTemp9 * (1 - (0.3333333333333333 * faustpower<2>(fTemp9)))) + (0.8413951417869425 * (fTemp7 * (1 - (0.3333333333333333 * faustpower<2>(fTemp7)))))))));
351351 fVec4[0] = fTemp14;
352 fRec12[0] = ((fConst58 * (fVec4[0] + fVec4[1])) + (fConst3 * fRec12[1]));
352 fRec12[0] = ((fConst58 * (fVec4[0] + fVec4[1])) + (fConst6 * fRec12[1]));
353353 double fTemp15 = (1e-15 + fTemp1);
354354 fRec9[0] = (Ftube(TUBE_TABLE_12AU7_68k, (((fSlow11 * ((fTemp15 * (4 - (4 * fabs(fTemp15)))) - fTemp15)) + ((fSlow10 * fTemp4) + ((fSlow9 * fRec12[0]) + (fRec11[0] + fTemp1)))) - 3.7189619999999977)) - 112.26066666666668);
355 fRec8[0] = ((fConst59 * ((fConst41 * fRec9[1]) + (fConst4 * fRec9[0]))) + (fConst6 * fRec8[1]));
355 fRec8[0] = ((fConst59 * ((fConst41 * fRec9[1]) + (fConst1 * fRec9[0]))) + (fConst3 * fRec8[1]));
356356 double fTemp16 = (fRec8[0] * fRec7[0]);
357357 fVec5[0] = fTemp16;
358 fRec6[0] = ((fConst60 * (fVec5[0] + fVec5[1])) + (fConst3 * fRec6[1]));
358 fRec6[0] = ((fConst60 * (fVec5[0] + fVec5[1])) + (fConst6 * fRec6[1]));
359359 double fTemp17 = (1e-15 + (0.015 * fRec5[1]));
360360 fVec6[0] = fTemp17;
361361 fRec30[0] = ((fConst64 * (fVec6[0] + fVec6[1])) + (fConst63 * fRec30[1]));
362362 fRec5[0] = (Ftube(TUBE_TABLE_12AU7_250k, ((fRec30[0] + fRec6[0]) - 2.314843999999999)) - 95.67706666666666);
363 fRec4[0] = ((fConst59 * ((fConst41 * fRec5[1]) + (fConst4 * fRec5[0]))) + (fConst6 * fRec4[1]));
363 fRec4[0] = ((fConst59 * ((fConst41 * fRec5[1]) + (fConst1 * fRec5[0]))) + (fConst3 * fRec4[1]));
364364 double fTemp18 = (fRec7[0] * fRec4[0]);
365365 fVec7[0] = fTemp18;
366 fRec3[0] = ((fConst60 * (fVec7[0] + fVec7[1])) + (fConst3 * fRec3[1]));
366 fRec3[0] = ((fConst60 * (fVec7[0] + fVec7[1])) + (fConst6 * fRec3[1]));
367367 double fTemp19 = (1e-15 + (0.0082 * fRec2[1]));
368368 fVec8[0] = fTemp19;
369369 fRec31[0] = ((fConst68 * (fVec8[0] + fVec8[1])) + (fConst67 * fRec31[1]));
370370 fRec2[0] = (Ftube(TUBE_TABLE_12AU7_250k, ((fRec31[0] + fRec3[0]) - 1.356566999999999)) - 84.565);
371 fRec1[0] = ((fConst6 * fRec1[1]) + (fConst59 * ((fConst41 * fRec2[1]) + (fConst4 * fRec2[0]))));
371 fRec1[0] = ((fConst59 * ((fConst41 * fRec2[1]) + (fConst1 * fRec2[0]))) + (fConst3 * fRec1[1]));
372372 output0[i] = (FAUSTFLOAT)(2.0 * (fRec1[0] * fRec0[0]));
373373 // post processing
374374 fRec1[1] = fRec1[0];
419419 #undef fslider3
420420 }
421421
422 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
422 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
423423 {
424424 static_cast<Dsp*>(p)->compute(count, input0, output0);
425425 }
166166 void connect(uint32_t port,void* data);
167167 void clear_state_f();
168168 void init(uint32_t samplingFreq);
169 void compute(int count, float *input0, float *input1, float *output0, float *output1);
169 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
170170
171171 static void clear_state_f_static(PluginLV2*);
172172 static void init_static(uint32_t samplingFreq, PluginLV2*);
173 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
173 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
174174 static void del_instance(PluginLV2 *p);
175175 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
176176 public:
365365 static_cast<Dsp*>(p)->init(samplingFreq);
366366 }
367367
368 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
368 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
369369 {
370370 #define fslider0 (*fslider0_)
371371 #define fslider1 (*fslider1_)
593593 #undef fslider3
594594 }
595595
596 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
596 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
597597 {
598598 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
599599 }
135135 void connect(uint32_t port,void* data);
136136 void clear_state_f();
137137 void init(uint32_t samplingFreq);
138 void compute(int count, float *input0, float *output0);
138 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
139139
140140 static void clear_state_f_static(PluginLV2*);
141141 static void init_static(uint32_t samplingFreq, PluginLV2*);
142 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
142 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
143143 static void del_instance(PluginLV2 *p);
144144 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
145145 public:
303303 static_cast<Dsp*>(p)->init(samplingFreq);
304304 }
305305
306 void always_inline Dsp::compute(int count, float *input0, float *output0)
306 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
307307 {
308308 #define fslider0 (*fslider0_)
309309 #define fslider1 (*fslider1_)
448448 #undef fslider3
449449 }
450450
451 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
451 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
452452 {
453453 static_cast<Dsp*>(p)->compute(count, input0, output0);
454454 }
180180 void connect(uint32_t port,void* data);
181181 void clear_state_f();
182182 void init(uint32_t samplingFreq);
183 void compute(int count, float *input0, float *input1, float *output0, float *output1);
183 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
184184
185185 static void clear_state_f_static(PluginLV2*);
186186 static void init_static(uint32_t samplingFreq, PluginLV2*);
187 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
187 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
188188 static void del_instance(PluginLV2 *p);
189189 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
190190 public:
393393 static_cast<Dsp*>(p)->init(samplingFreq);
394394 }
395395
396 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
396 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
397397 {
398398 #define fslider0 (*fslider0_)
399399 #define fslider1 (*fslider1_)
434434 fVec3[0] = fTemp4;
435435 fRec24[0] = ((fConst51 * (fVec3[0] + fVec3[1])) + (fConst50 * fRec24[1]));
436436 fRec15[0] = (Ftube(TUBE_TABLE_12AU7_250k, ((fRec24[0] + fRec16[0]) - 0.445486999999999)) - 75.67231707317073);
437 fRec14[0] = ((fConst43 * ((fConst1 * fRec15[0]) + (fConst42 * fRec15[1]))) + (fConst3 * fRec14[1]));
437 fRec14[0] = ((fConst43 * ((fConst42 * fRec15[1]) + (fConst1 * fRec15[0]))) + (fConst3 * fRec14[1]));
438438 double fTemp5 = (1e-15 + (fRec14[0] * fRec13[0]));
439439 fRec12[0] = (fTemp5 - (fConst37 * ((fConst35 * fRec12[2]) + (fConst33 * fRec12[1]))));
440440 double fTemp6 = (fRec12[2] + (fRec12[0] + (2 * fRec12[1])));
651651 #undef fslider3
652652 }
653653
654 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
654 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
655655 {
656656 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
657657 }
134134 void connect(uint32_t port,void* data);
135135 void clear_state_f();
136136 void init(uint32_t samplingFreq);
137 void compute(int count, float *input0, float *output0);
137 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
138138
139139 static void clear_state_f_static(PluginLV2*);
140140 static void init_static(uint32_t samplingFreq, PluginLV2*);
141 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
141 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
142142 static void del_instance(PluginLV2 *p);
143143 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
144144 public:
301301 static_cast<Dsp*>(p)->init(samplingFreq);
302302 }
303303
304 void always_inline Dsp::compute(int count, float *input0, float *output0)
304 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
305305 {
306306 #define fslider0 (*fslider0_)
307307 #define fslider1 (*fslider1_)
446446 #undef fslider3
447447 }
448448
449 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
449 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
450450 {
451451 static_cast<Dsp*>(p)->compute(count, input0, output0);
452452 }
179179 void connect(uint32_t port,void* data);
180180 void clear_state_f();
181181 void init(uint32_t samplingFreq);
182 void compute(int count, float *input0, float *input1, float *output0, float *output1);
182 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
183183
184184 static void clear_state_f_static(PluginLV2*);
185185 static void init_static(uint32_t samplingFreq, PluginLV2*);
186 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
186 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
187187 static void del_instance(PluginLV2 *p);
188188 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
189189 public:
391391 static_cast<Dsp*>(p)->init(samplingFreq);
392392 }
393393
394 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
394 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
395395 {
396396 #define fslider0 (*fslider0_)
397397 #define fslider1 (*fslider1_)
649649 #undef fslider3
650650 }
651651
652 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
652 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
653653 {
654654 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
655655 }
171171 void connect(uint32_t port,void* data);
172172 void clear_state_f();
173173 void init(uint32_t samplingFreq);
174 void compute(int count, float *input0, float *output0);
174 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
175175
176176 static void clear_state_f_static(PluginLV2*);
177177 static void init_static(uint32_t samplingFreq, PluginLV2*);
178 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
178 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
179179 static void del_instance(PluginLV2 *p);
180180 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
181181 public:
375375 static_cast<Dsp*>(p)->init(samplingFreq);
376376 }
377377
378 void always_inline Dsp::compute(int count, float *input0, float *output0)
378 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
379379 {
380380 #define fslider0 (*fslider0_)
381381 #define fslider1 (*fslider1_)
589589 #undef fslider3
590590 }
591591
592 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
592 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
593593 {
594594 static_cast<Dsp*>(p)->compute(count, input0, output0);
595595 }
239239 void connect(uint32_t port,void* data);
240240 void clear_state_f();
241241 void init(uint32_t samplingFreq);
242 void compute(int count, float *input0, float *input1, float *output0, float *output1);
242 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
243243
244244 static void clear_state_f_static(PluginLV2*);
245245 static void init_static(uint32_t samplingFreq, PluginLV2*);
246 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
246 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
247247 static void del_instance(PluginLV2 *p);
248248 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
249249 public:
511511 static_cast<Dsp*>(p)->init(samplingFreq);
512512 }
513513
514 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
514 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
515515 {
516516 #define fslider0 (*fslider0_)
517517 #define fslider1 (*fslider1_)
906906 #undef fslider3
907907 }
908908
909 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
909 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
910910 {
911911 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
912912 }
170170 void connect(uint32_t port,void* data);
171171 void clear_state_f();
172172 void init(uint32_t samplingFreq);
173 void compute(int count, float *input0, float *output0);
173 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
174174
175175 static void clear_state_f_static(PluginLV2*);
176176 static void init_static(uint32_t samplingFreq, PluginLV2*);
177 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
177 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
178178 static void del_instance(PluginLV2 *p);
179179 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
180180 public:
373373 static_cast<Dsp*>(p)->init(samplingFreq);
374374 }
375375
376 void always_inline Dsp::compute(int count, float *input0, float *output0)
376 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
377377 {
378378 #define fslider0 (*fslider0_)
379379 #define fslider1 (*fslider1_)
587587 #undef fslider3
588588 }
589589
590 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
590 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
591591 {
592592 static_cast<Dsp*>(p)->compute(count, input0, output0);
593593 }
238238 void connect(uint32_t port,void* data);
239239 void clear_state_f();
240240 void init(uint32_t samplingFreq);
241 void compute(int count, float *input0, float *input1, float *output0, float *output1);
241 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
242242
243243 static void clear_state_f_static(PluginLV2*);
244244 static void init_static(uint32_t samplingFreq, PluginLV2*);
245 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
245 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
246246 static void del_instance(PluginLV2 *p);
247247 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
248248 public:
509509 static_cast<Dsp*>(p)->init(samplingFreq);
510510 }
511511
512 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
512 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
513513 {
514514 #define fslider0 (*fslider0_)
515515 #define fslider1 (*fslider1_)
904904 #undef fslider3
905905 }
906906
907 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
907 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
908908 {
909909 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
910910 }
173173 void connect(uint32_t port,void* data);
174174 void clear_state_f();
175175 void init(uint32_t samplingFreq);
176 void compute(int count, float *input0, float *output0);
176 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
177177
178178 static void clear_state_f_static(PluginLV2*);
179179 static void init_static(uint32_t samplingFreq, PluginLV2*);
180 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
180 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
181181 static void del_instance(PluginLV2 *p);
182182 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
183183 public:
379379 static_cast<Dsp*>(p)->init(samplingFreq);
380380 }
381381
382 void always_inline Dsp::compute(int count, float *input0, float *output0)
382 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
383383 {
384384 #define fslider0 (*fslider0_)
385385 #define fslider1 (*fslider1_)
593593 #undef fslider3
594594 }
595595
596 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
596 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
597597 {
598598 static_cast<Dsp*>(p)->compute(count, input0, output0);
599599 }
241241 void connect(uint32_t port,void* data);
242242 void clear_state_f();
243243 void init(uint32_t samplingFreq);
244 void compute(int count, float *input0, float *input1, float *output0, float *output1);
244 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
245245
246246 static void clear_state_f_static(PluginLV2*);
247247 static void init_static(uint32_t samplingFreq, PluginLV2*);
248 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
248 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
249249 static void del_instance(PluginLV2 *p);
250250 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
251251 public:
515515 static_cast<Dsp*>(p)->init(samplingFreq);
516516 }
517517
518 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
518 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
519519 {
520520 #define fslider0 (*fslider0_)
521521 #define fslider1 (*fslider1_)
910910 #undef fslider3
911911 }
912912
913 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
913 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
914914 {
915915 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
916916 }
143143 void connect(uint32_t port,void* data);
144144 void clear_state_f();
145145 void init(uint32_t samplingFreq);
146 void compute(int count, float *input0, float *output0);
146 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
147147
148148 static void clear_state_f_static(PluginLV2*);
149149 static void init_static(uint32_t samplingFreq, PluginLV2*);
150 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
150 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
151151 static void del_instance(PluginLV2 *p);
152152 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
153153 public:
319319 static_cast<Dsp*>(p)->init(samplingFreq);
320320 }
321321
322 void always_inline Dsp::compute(int count, float *input0, float *output0)
322 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
323323 {
324324 #define fslider0 (*fslider0_)
325325 #define fslider1 (*fslider1_)
489489 #undef fslider3
490490 }
491491
492 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
492 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
493493 {
494494 static_cast<Dsp*>(p)->compute(count, input0, output0);
495495 }
194194 void connect(uint32_t port,void* data);
195195 void clear_state_f();
196196 void init(uint32_t samplingFreq);
197 void compute(int count, float *input0, float *input1, float *output0, float *output1);
197 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
198198
199199 static void clear_state_f_static(PluginLV2*);
200200 static void init_static(uint32_t samplingFreq, PluginLV2*);
201 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
201 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
202202 static void del_instance(PluginLV2 *p);
203203 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
204204 public:
421421 static_cast<Dsp*>(p)->init(samplingFreq);
422422 }
423423
424 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
424 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
425425 {
426426 #define fslider0 (*fslider0_)
427427 #define fslider1 (*fslider1_)
561561 fRec55[0] = (fRec56[0] - (fConst19 * ((fConst17 * fRec55[2]) + (fConst15 * fRec55[1]))));
562562 fRec54[0] = ((fConst19 * (((fConst14 * fRec55[0]) + (fConst44 * fRec55[1])) + (fConst14 * fRec55[2]))) - (fConst12 * ((fConst11 * fRec54[2]) + fTemp34)));
563563 double fTemp51 = max((double)-1, min((double)1, (fSlow4 * (fRec54[2] + (fConst12 * (fTemp34 + (fConst11 * fRec54[0])))))));
564 fRec67[0] = ((fConst43 * (fVec13[0] + fVec13[1])) + (fConst21 * fRec67[1]));
564 fRec67[0] = ((fConst21 * fRec67[1]) + (fConst43 * (fVec13[0] + fVec13[1])));
565565 fRec66[0] = (fRec67[0] - (fConst19 * ((fConst17 * fRec66[2]) + (fConst15 * fRec66[1]))));
566566 double fTemp52 = (fRec66[2] + (fRec66[0] + (2 * fRec66[1])));
567567 fVec14[0] = fTemp52;
726726 #undef fslider3
727727 }
728728
729 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
729 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
730730 {
731731 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
732732 }
165165 void connect(uint32_t port,void* data);
166166 void clear_state_f();
167167 void init(uint32_t samplingFreq);
168 void compute(int count, float *input0, float *input1, float *output0, float *output1);
168 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
169169
170170 static void clear_state_f_static(PluginLV2*);
171171 static void init_static(uint32_t samplingFreq, PluginLV2*);
172 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
172 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
173173 static void del_instance(PluginLV2 *p);
174174 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
175175 public:
363363 static_cast<Dsp*>(p)->init(samplingFreq);
364364 }
365365
366 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
366 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
367367 {
368368 #define fslider0 (*fslider0_)
369369 #define fslider1 (*fslider1_)
591591 #undef fslider3
592592 }
593593
594 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
594 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
595595 {
596596 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
597597 }
115115 void clear_state_f();
116116 int activate(bool start);
117117 void init(uint32_t samplingFreq);
118 void compute(int count, float *input0, float *output0);
118 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
119119
120120 static void clear_state_f_static(PluginLV2*);
121121 static int activate_static(bool start, PluginLV2*);
122122 static void init_static(uint32_t samplingFreq, PluginLV2*);
123 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
123 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
124124 static void del_instance(PluginLV2 *p);
125125 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
126126 public:
285285 return static_cast<Dsp*>(p)->activate(start);
286286 }
287287
288 void always_inline Dsp::compute(int count, float *input0, float *output0)
288 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
289289 {
290290 #define fslider0 (*fslider0_)
291291 #define fslider1 (*fslider1_)
409409 #undef fslider3
410410 }
411411
412 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
412 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
413413 {
414414 static_cast<Dsp*>(p)->compute(count, input0, output0);
415415 }
2828 void connect(uint32_t port,void* data);
2929 void clear_state_f();
3030 void init(uint32_t samplingFreq);
31 void compute(int count, float *input0, float *input1, float *output0, float *output1);
31 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
3232
3333 static void clear_state_f_static(PluginLV2*);
3434 static void init_static(uint32_t samplingFreq, PluginLV2*);
35 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
35 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
3636 static void del_instance(PluginLV2 *p);
3737 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3838 public:
9494 static_cast<Dsp*>(p)->init(samplingFreq);
9595 }
9696
97 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
97 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
9898 {
9999 #define fslider0 (*fslider0_)
100100 #define fcheckbox0 (*fcheckbox0_)
151151 #undef fcheckbox0
152152 }
153153
154 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
154 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
155155 {
156156 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
157157 }
9090 void connect(uint32_t port,void* data);
9191 void clear_state_f();
9292 void init(uint32_t samplingFreq);
93 void compute(int count, float *input0, float *output0);
93 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
9494
9595 static void clear_state_f_static(PluginLV2*);
9696 static void init_static(uint32_t samplingFreq, PluginLV2*);
97 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
97 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
9898 static void del_instance(PluginLV2 *p);
9999 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
100100 public:
213213 static_cast<Dsp*>(p)->init(samplingFreq);
214214 }
215215
216 void always_inline Dsp::compute(int count, float *input0, float *output0)
216 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
217217 {
218218 #define fslider0 (*fslider0_)
219219 #define fslider1 (*fslider1_)
325325 #undef fslider3
326326 }
327327
328 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
328 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
329329 {
330330 static_cast<Dsp*>(p)->compute(count, input0, output0);
331331 }
148148 void connect(uint32_t port,void* data);
149149 void clear_state_f();
150150 void init(uint32_t samplingFreq);
151 void compute(int count, float *input0, float *output0);
151 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
152152
153153 static void clear_state_f_static(PluginLV2*);
154154 static void init_static(uint32_t samplingFreq, PluginLV2*);
155 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
155 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
156156 static void del_instance(PluginLV2 *p);
157157 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
158158 public:
329329 static_cast<Dsp*>(p)->init(samplingFreq);
330330 }
331331
332 void always_inline Dsp::compute(int count, float *input0, float *output0)
332 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
333333 {
334334 #define fslider0 (*fslider0_)
335335 #define fslider1 (*fslider1_)
477477 #undef fslider3
478478 }
479479
480 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
480 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
481481 {
482482 static_cast<Dsp*>(p)->compute(count, input0, output0);
483483 }
1212 void connect(uint32_t port,void* data);
1313 void clear_state_f();
1414 void init(uint32_t samplingFreq);
15 void compute(int count, float *input0, float *output0);
15 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1616
1717 static void clear_state_f_static(PluginLV2*);
1818 static void init_static(uint32_t samplingFreq, PluginLV2*);
19 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
19 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2020 static void del_instance(PluginLV2 *p);
2121 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2222 public:
6464 static_cast<Dsp*>(p)->init(samplingFreq);
6565 }
6666
67 void always_inline Dsp::compute(int count, float *input0, float *output0)
67 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
6868 {
6969 #define fslider0 (*fslider0_)
7070 double fSlow0 = (0.0010000000000000009 * pow(10,(0.05 * fslider0)));
7777 #undef fslider0
7878 }
7979
80 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
80 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
8181 {
8282 static_cast<Dsp*>(p)->compute(count, input0, output0);
8383 }
5353 void connect(uint32_t port,void* data);
5454 void clear_state_f();
5555 void init(uint32_t samplingFreq);
56 void compute(int count, float *input0, float *output0);
56 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
5757
5858 static void clear_state_f_static(PluginLV2*);
5959 static void init_static(uint32_t samplingFreq, PluginLV2*);
60 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
60 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
6161 static void del_instance(PluginLV2 *p);
6262 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
6363 public:
141141 static_cast<Dsp*>(p)->init(samplingFreq);
142142 }
143143
144 void always_inline Dsp::compute(int count, float *input0, float *output0)
144 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
145145 {
146146 #define fslider0 (*fslider0_)
147147 #define fslider1 (*fslider1_)
190190 #undef fslider2
191191 }
192192
193 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
193 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
194194 {
195195 static_cast<Dsp*>(p)->compute(count, input0, output0);
196196 }
7171 void clear_state_f();
7272 int activate(bool start);
7373 void init(uint32_t samplingFreq);
74 void compute(int count, float *input0, float *output0);
74 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
7575
7676 static void clear_state_f_static(PluginLV2*);
7777 static int activate_static(bool start, PluginLV2*);
7878 static void init_static(uint32_t samplingFreq, PluginLV2*);
79 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
79 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
8080 static void del_instance(PluginLV2 *p);
8181 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
8282 public:
203203 return static_cast<Dsp*>(p)->activate(start);
204204 }
205205
206 void always_inline Dsp::compute(int count, float *input0, float *output0)
206 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
207207 {
208208 #define fslider0 (*fslider0_)
209209 #define fslider1 (*fslider1_)
269269 #undef fslider3
270270 }
271271
272 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
272 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
273273 {
274274 static_cast<Dsp*>(p)->compute(count, input0, output0);
275275 }
4747 void connect(uint32_t port,void* data);
4848 void clear_state_f();
4949 void init(uint32_t samplingFreq);
50 void compute(int count, float *input0, float *output0);
50 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
5151
5252 static void clear_state_f_static(PluginLV2*);
5353 static void init_static(uint32_t samplingFreq, PluginLV2*);
54 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
54 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
5555 static void del_instance(PluginLV2 *p);
5656 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
5757 public:
127127 static_cast<Dsp*>(p)->init(samplingFreq);
128128 }
129129
130 void always_inline Dsp::compute(int count, float *input0, float *output0)
130 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
131131 {
132132 #define fslider0 (*fslider0_)
133133 #define fcheckbox0 (*fcheckbox0_)
185185 #undef fslider2
186186 }
187187
188 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
188 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
189189 {
190190 static_cast<Dsp*>(p)->compute(count, input0, output0);
191191 }
6767 void clear_state_f();
6868 int activate(bool start);
6969 void init(uint32_t samplingFreq);
70 void compute(int count, float *input0, float *output0);
70 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
7171
7272 static void clear_state_f_static(PluginLV2*);
7373 static int activate_static(bool start, PluginLV2*);
7474 static void init_static(uint32_t samplingFreq, PluginLV2*);
75 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
75 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
7676 static void del_instance(PluginLV2 *p);
7777 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
7878 public:
195195 return static_cast<Dsp*>(p)->activate(start);
196196 }
197197
198 void always_inline Dsp::compute(int count, float *input0, float *output0)
198 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
199199 {
200200 #define fslider0 (*fslider0_)
201201 #define fcheckbox0 (*fcheckbox0_)
265265 #undef fslider2
266266 }
267267
268 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
268 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
269269 {
270270 static_cast<Dsp*>(p)->compute(count, input0, output0);
271271 }
1818 void connect(uint32_t port,void* data);
1919 void clear_state_f();
2020 void init(uint32_t samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222
2323 static void clear_state_f_static(PluginLV2*);
2424 static void init_static(uint32_t samplingFreq, PluginLV2*);
25 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
25 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2626 static void del_instance(PluginLV2 *p);
2727 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2828 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *output0)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8080 {
8181 #define fslider0 (*fslider0_)
8282 double fSlow0 = (pow(10,(0.05 * fslider0)) - 1);
9292 #undef fslider0
9393 }
9494
95 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
95 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
9696 {
9797 static_cast<Dsp*>(p)->compute(count, input0, output0);
9898 }
2222 void connect(uint32_t port,void* data);
2323 void clear_state_f();
2424 void init(uint32_t samplingFreq);
25 void compute(int count, float *input0, float *output0);
25 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2626
2727 static void clear_state_f_static(PluginLV2*);
2828 static void init_static(uint32_t samplingFreq, PluginLV2*);
29 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
29 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
3030 static void del_instance(PluginLV2 *p);
3131 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3232 public:
7878 static_cast<Dsp*>(p)->init(samplingFreq);
7979 }
8080
81 void always_inline Dsp::compute(int count, float *input0, float *output0)
81 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8282 {
8383 #define fslider0 (*fslider0_)
8484 #define fslider1 (*fslider1_)
103103 #undef fslider2
104104 }
105105
106 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
106 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
107107 {
108108 static_cast<Dsp*>(p)->compute(count, input0, output0);
109109 }
3535 void connect(uint32_t port,void* data);
3636 void clear_state_f();
3737 void init(uint32_t samplingFreq);
38 void compute(int count, float *input0, float *output0);
38 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
3939
4040 static void clear_state_f_static(PluginLV2*);
4141 static void init_static(uint32_t samplingFreq, PluginLV2*);
42 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
42 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
4343 static void del_instance(PluginLV2 *p);
4444 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
4545 public:
112112 static_cast<Dsp*>(p)->init(samplingFreq);
113113 }
114114
115 void always_inline Dsp::compute(int count, float *input0, float *output0)
115 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
116116 {
117117 for (int i=0; i<count; i++) {
118118 iVec0[0] = 1;
140140 }
141141 }
142142
143 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
143 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
144144 {
145145 static_cast<Dsp*>(p)->compute(count, input0, output0);
146146 }
3333 void connect(uint32_t port,void* data);
3434 void clear_state_f();
3535 void init(uint32_t samplingFreq);
36 void compute(int count, float *input0, float *output0);
36 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
3737
3838 static void clear_state_f_static(PluginLV2*);
3939 static void init_static(uint32_t samplingFreq, PluginLV2*);
40 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
40 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
4141 static void del_instance(PluginLV2 *p);
4242 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
4343 public:
102102 static_cast<Dsp*>(p)->init(samplingFreq);
103103 }
104104
105 void always_inline Dsp::compute(int count, float *input0, float *output0)
105 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
106106 {
107107 #define fentry0 (*fentry0_)
108108 #define fentry1 (*fentry1_)
169169 #undef fcheckbox1
170170 }
171171
172 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
172 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
173173 {
174174 static_cast<Dsp*>(p)->compute(count, input0, output0);
175175 }
0 // generated from file '../src/LV2/faust/lowpass_down.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.65 (http://faust.grame.fr)
2
3
4 namespace lowpass_down {
5
6 class Dsp: public PluginLV2 {
7 private:
8 uint32_t fSamplingFreq;
9 int iConst0;
10 double fConst1;
11 double fVec0[2];
12 double fConst2;
13 double fConst3;
14 double fConst4;
15 double fConst5;
16 double fRec5[2];
17 double fConst6;
18 double fConst7;
19 double fConst8;
20 double fConst9;
21 double fConst10;
22 double fRec4[2];
23 double fRec0[2];
24 int iRec1[2];
25 double fRec2[2];
26 FAUSTFLOAT fbargraph0;
27 FAUSTFLOAT *fbargraph0_;
28 void connect(uint32_t port,void* data);
29 void clear_state_f();
30 void init(uint32_t samplingFreq);
31 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
32
33 static void clear_state_f_static(PluginLV2*);
34 static void init_static(uint32_t samplingFreq, PluginLV2*);
35 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
36 static void del_instance(PluginLV2 *p);
37 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
38 public:
39 Dsp();
40 ~Dsp();
41 };
42
43
44
45 Dsp::Dsp()
46 : PluginLV2() {
47 version = PLUGINLV2_VERSION;
48 id = "lowpass_down";
49 name = "?lowpass_down";
50 mono_audio = compute_static;
51 stereo_audio = 0;
52 set_samplerate = init_static;
53 activate_plugin = 0;
54 connect_ports = connect_static;
55 clear_state = clear_state_f_static;
56 delete_instance = del_instance;
57 }
58
59 Dsp::~Dsp() {
60 }
61
62 inline void Dsp::clear_state_f()
63 {
64 for (int i=0; i<2; i++) fVec0[i] = 0;
65 for (int i=0; i<2; i++) fRec5[i] = 0;
66 for (int i=0; i<2; i++) fRec4[i] = 0;
67 for (int i=0; i<2; i++) fRec0[i] = 0;
68 for (int i=0; i<2; i++) iRec1[i] = 0;
69 for (int i=0; i<2; i++) fRec2[i] = 0;
70 }
71
72 void Dsp::clear_state_f_static(PluginLV2 *p)
73 {
74 static_cast<Dsp*>(p)->clear_state_f();
75 }
76
77 inline void Dsp::init(uint32_t samplingFreq)
78 {
79 fSamplingFreq = samplingFreq;
80 iConst0 = min(192000, max(1, fSamplingFreq));
81 fConst1 = (1.0 / double(iConst0));
82 fConst2 = (1.0 / tan((17690.308232364125 / double(iConst0))));
83 fConst3 = (1 + fConst2);
84 fConst4 = (1.0 / fConst3);
85 fConst5 = (0 - ((1 - fConst2) / fConst3));
86 fConst6 = (1.0 / tan((251.32741228718345 / double(iConst0))));
87 fConst7 = (0 - fConst6);
88 fConst8 = (1 + fConst6);
89 fConst9 = (1.0 / fConst8);
90 fConst10 = (0 - ((1 - fConst6) / fConst8));
91 clear_state_f();
92 }
93
94 void Dsp::init_static(uint32_t samplingFreq, PluginLV2 *p)
95 {
96 static_cast<Dsp*>(p)->init(samplingFreq);
97 }
98
99 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
100 {
101 #define fbargraph0 (*fbargraph0_)
102 for (int i=0; i<count; i++) {
103 double fTemp0 = (double)input0[i];
104 fVec0[0] = fTemp0;
105 fRec5[0] = ((fConst5 * fRec5[1]) + (fConst4 * (fVec0[0] + fVec0[1])));
106 fRec4[0] = ((fConst10 * fRec4[1]) + (fConst9 * ((fConst6 * fRec5[0]) + (fConst7 * fRec5[1]))));
107 double fRec3 = max(fConst1, fabs(fRec4[0]));
108 int iTemp1 = int((iRec1[1] < 4096));
109 fRec0[0] = ((iTemp1)?max(fRec0[1], fRec3):fRec3);
110 iRec1[0] = ((iTemp1)?(1 + iRec1[1]):1);
111 fRec2[0] = ((iTemp1)?fRec2[1]:fRec0[1]);
112 fbargraph0 = fRec2[0];
113 output0[i] = (FAUSTFLOAT)fRec4[0];
114 // post processing
115 fRec2[1] = fRec2[0];
116 iRec1[1] = iRec1[0];
117 fRec0[1] = fRec0[0];
118 fRec4[1] = fRec4[0];
119 fRec5[1] = fRec5[0];
120 fVec0[1] = fVec0[0];
121 }
122 #undef fbargraph0
123 }
124
125 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
126 {
127 static_cast<Dsp*>(p)->compute(count, input0, output0);
128 }
129
130
131 void Dsp::connect(uint32_t port,void* data)
132 {
133 switch ((PortIndex)port)
134 {
135 case V1:
136 fbargraph0_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
137 break;
138 default:
139 break;
140 }
141 }
142
143 void Dsp::connect_static(uint32_t port,void* data, PluginLV2 *p)
144 {
145 static_cast<Dsp*>(p)->connect(port, data);
146 }
147
148
149 PluginLV2 *plugin() {
150 return new Dsp();
151 }
152
153 void Dsp::del_instance(PluginLV2 *p)
154 {
155 delete static_cast<Dsp*>(p);
156 }
157
158 /*
159 typedef enum
160 {
161 V1,
162 } PortIndex;
163 */
164
165 } // end namespace lowpass_down
0 // generated from file '../src/LV2/faust/lowpass_up.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.65 (http://faust.grame.fr)
2
3
4 namespace lowpass_up {
5
6 class Dsp: public PluginLV2 {
7 private:
8 uint32_t fSamplingFreq;
9 double fVec0[2];
10 int iConst0;
11 double fConst1;
12 double fConst2;
13 double fConst3;
14 double fConst4;
15 double fRec1[2];
16 double fConst5;
17 double fConst6;
18 double fConst7;
19 double fConst8;
20 double fConst9;
21 double fRec0[2];
22 void connect(uint32_t port,void* data);
23 void clear_state_f();
24 void init(uint32_t samplingFreq);
25 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
26
27 static void clear_state_f_static(PluginLV2*);
28 static void init_static(uint32_t samplingFreq, PluginLV2*);
29 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
30 static void del_instance(PluginLV2 *p);
31 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
32 public:
33 Dsp();
34 ~Dsp();
35 };
36
37
38
39 Dsp::Dsp()
40 : PluginLV2() {
41 version = PLUGINLV2_VERSION;
42 id = "lowpass_up";
43 name = "?lowpass_up";
44 mono_audio = compute_static;
45 stereo_audio = 0;
46 set_samplerate = init_static;
47 activate_plugin = 0;
48 connect_ports = connect_static;
49 clear_state = clear_state_f_static;
50 delete_instance = del_instance;
51 }
52
53 Dsp::~Dsp() {
54 }
55
56 inline void Dsp::clear_state_f()
57 {
58 for (int i=0; i<2; i++) fVec0[i] = 0;
59 for (int i=0; i<2; i++) fRec1[i] = 0;
60 for (int i=0; i<2; i++) fRec0[i] = 0;
61 }
62
63 void Dsp::clear_state_f_static(PluginLV2 *p)
64 {
65 static_cast<Dsp*>(p)->clear_state_f();
66 }
67
68 inline void Dsp::init(uint32_t samplingFreq)
69 {
70 fSamplingFreq = samplingFreq;
71 iConst0 = min(192000, max(1, fSamplingFreq));
72 fConst1 = (1.0 / tan((17690.308232364125 / double(iConst0))));
73 fConst2 = (1 + fConst1);
74 fConst3 = (1.0 / fConst2);
75 fConst4 = (0 - ((1 - fConst1) / fConst2));
76 fConst5 = (1.0 / tan((251.32741228718345 / double(iConst0))));
77 fConst6 = (0 - fConst5);
78 fConst7 = (1 + fConst5);
79 fConst8 = (1.0 / fConst7);
80 fConst9 = (0 - ((1 - fConst5) / fConst7));
81 clear_state_f();
82 }
83
84 void Dsp::init_static(uint32_t samplingFreq, PluginLV2 *p)
85 {
86 static_cast<Dsp*>(p)->init(samplingFreq);
87 }
88
89 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
90 {
91 for (int i=0; i<count; i++) {
92 double fTemp0 = (double)input0[i];
93 fVec0[0] = fTemp0;
94 fRec1[0] = ((fConst4 * fRec1[1]) + (fConst3 * (fVec0[0] + fVec0[1])));
95 fRec0[0] = ((fConst9 * fRec0[1]) + (fConst8 * ((fConst5 * fRec1[0]) + (fConst6 * fRec1[1]))));
96 output0[i] = (FAUSTFLOAT)max(-0.9, min(0.9, ((int((fabs(fRec0[0]) < 0.33)))?(2 * fRec0[0]):copysign(fRec0[0], (0.3333333333333333 * (3 - faustpower<2>((2 - (3 * fRec0[0])))))))));
97 // post processing
98 fRec0[1] = fRec0[0];
99 fRec1[1] = fRec1[0];
100 fVec0[1] = fVec0[0];
101 }
102 }
103
104 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
105 {
106 static_cast<Dsp*>(p)->compute(count, input0, output0);
107 }
108
109
110 void Dsp::connect(uint32_t port,void* data)
111 {
112 switch ((PortIndex)port)
113 {
114 default:
115 break;
116 }
117 }
118
119 void Dsp::connect_static(uint32_t port,void* data, PluginLV2 *p)
120 {
121 static_cast<Dsp*>(p)->connect(port, data);
122 }
123
124
125 PluginLV2 *plugin() {
126 return new Dsp();
127 }
128
129 void Dsp::del_instance(PluginLV2 *p)
130 {
131 delete static_cast<Dsp*>(p);
132 }
133
134 /*
135 typedef enum
136 {
137 } PortIndex;
138 */
139
140 } // end namespace lowpass_up
0 // generated from file '../src/LV2/faust/mbc.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.65 (http://faust.grame.fr)
2
3
4 namespace mbc {
5
6 class Dsp: public PluginLV2 {
7 private:
8 uint32_t fSamplingFreq;
9 int iConst0;
10 double fConst1;
11 FAUSTFLOAT fslider0;
12 FAUSTFLOAT *fslider0_;
13 double fConst2;
14 FAUSTFLOAT fslider1;
15 FAUSTFLOAT *fslider1_;
16 FAUSTFLOAT fslider2;
17 FAUSTFLOAT *fslider2_;
18 FAUSTFLOAT fslider3;
19 FAUSTFLOAT *fslider3_;
20 double fVec0[2];
21 double fRec18[2];
22 double fRec17[3];
23 double fVec1[2];
24 double fRec16[2];
25 double fRec15[3];
26 double fVec2[2];
27 double fRec14[2];
28 double fRec13[3];
29 double fVec3[2];
30 double fRec12[2];
31 double fRec11[3];
32 double fRec7[2];
33 int iRec8[2];
34 double fRec9[2];
35 FAUSTFLOAT fbargraph0;
36 FAUSTFLOAT *fbargraph0_;
37 FAUSTFLOAT fslider4;
38 FAUSTFLOAT *fslider4_;
39 FAUSTFLOAT fslider5;
40 FAUSTFLOAT *fslider5_;
41 double fRec6[2];
42 FAUSTFLOAT fslider6;
43 FAUSTFLOAT *fslider6_;
44 double fRec5[2];
45 FAUSTFLOAT fslider7;
46 FAUSTFLOAT *fslider7_;
47 double fConst3;
48 FAUSTFLOAT fslider8;
49 FAUSTFLOAT *fslider8_;
50 double fRec4[2];
51 FAUSTFLOAT fslider9;
52 FAUSTFLOAT *fslider9_;
53 double fRec19[2];
54 double fRec0[2];
55 int iRec1[2];
56 double fRec2[2];
57 FAUSTFLOAT fbargraph1;
58 FAUSTFLOAT *fbargraph1_;
59 double fRec32[2];
60 double fRec31[3];
61 double fRec27[2];
62 int iRec28[2];
63 double fRec29[2];
64 FAUSTFLOAT fbargraph2;
65 FAUSTFLOAT *fbargraph2_;
66 FAUSTFLOAT fslider10;
67 FAUSTFLOAT *fslider10_;
68 FAUSTFLOAT fslider11;
69 FAUSTFLOAT *fslider11_;
70 double fRec26[2];
71 FAUSTFLOAT fslider12;
72 FAUSTFLOAT *fslider12_;
73 double fRec25[2];
74 FAUSTFLOAT fslider13;
75 FAUSTFLOAT *fslider13_;
76 FAUSTFLOAT fslider14;
77 FAUSTFLOAT *fslider14_;
78 double fRec24[2];
79 FAUSTFLOAT fslider15;
80 FAUSTFLOAT *fslider15_;
81 double fRec33[2];
82 double fRec20[2];
83 int iRec21[2];
84 double fRec22[2];
85 FAUSTFLOAT fbargraph3;
86 FAUSTFLOAT *fbargraph3_;
87 double fRec47[2];
88 double fRec46[3];
89 double fRec45[3];
90 double fRec41[2];
91 int iRec42[2];
92 double fRec43[2];
93 FAUSTFLOAT fbargraph4;
94 FAUSTFLOAT *fbargraph4_;
95 FAUSTFLOAT fslider16;
96 FAUSTFLOAT *fslider16_;
97 FAUSTFLOAT fslider17;
98 FAUSTFLOAT *fslider17_;
99 double fRec40[2];
100 FAUSTFLOAT fslider18;
101 FAUSTFLOAT *fslider18_;
102 double fRec39[2];
103 FAUSTFLOAT fslider19;
104 FAUSTFLOAT *fslider19_;
105 FAUSTFLOAT fslider20;
106 FAUSTFLOAT *fslider20_;
107 double fRec38[2];
108 FAUSTFLOAT fslider21;
109 FAUSTFLOAT *fslider21_;
110 double fRec48[2];
111 double fRec34[2];
112 int iRec35[2];
113 double fRec36[2];
114 FAUSTFLOAT fbargraph5;
115 FAUSTFLOAT *fbargraph5_;
116 double fRec63[2];
117 double fRec62[3];
118 double fRec61[3];
119 double fRec60[3];
120 double fRec56[2];
121 int iRec57[2];
122 double fRec58[2];
123 FAUSTFLOAT fbargraph6;
124 FAUSTFLOAT *fbargraph6_;
125 FAUSTFLOAT fslider22;
126 FAUSTFLOAT *fslider22_;
127 FAUSTFLOAT fslider23;
128 FAUSTFLOAT *fslider23_;
129 double fRec55[2];
130 FAUSTFLOAT fslider24;
131 FAUSTFLOAT *fslider24_;
132 double fRec54[2];
133 FAUSTFLOAT fslider25;
134 FAUSTFLOAT *fslider25_;
135 FAUSTFLOAT fslider26;
136 FAUSTFLOAT *fslider26_;
137 double fRec53[2];
138 FAUSTFLOAT fslider27;
139 FAUSTFLOAT *fslider27_;
140 double fRec64[2];
141 double fRec49[2];
142 int iRec50[2];
143 double fRec51[2];
144 FAUSTFLOAT fbargraph7;
145 FAUSTFLOAT *fbargraph7_;
146 double fRec80[2];
147 double fRec79[3];
148 double fRec78[3];
149 double fRec77[3];
150 double fRec76[3];
151 double fRec72[2];
152 int iRec73[2];
153 double fRec74[2];
154 FAUSTFLOAT fbargraph8;
155 FAUSTFLOAT *fbargraph8_;
156 FAUSTFLOAT fslider28;
157 FAUSTFLOAT *fslider28_;
158 FAUSTFLOAT fslider29;
159 FAUSTFLOAT *fslider29_;
160 double fRec71[2];
161 FAUSTFLOAT fslider30;
162 FAUSTFLOAT *fslider30_;
163 double fRec70[2];
164 FAUSTFLOAT fslider31;
165 FAUSTFLOAT *fslider31_;
166 FAUSTFLOAT fslider32;
167 FAUSTFLOAT *fslider32_;
168 double fRec69[2];
169 FAUSTFLOAT fslider33;
170 FAUSTFLOAT *fslider33_;
171 double fRec81[2];
172 double fRec65[2];
173 int iRec66[2];
174 double fRec67[2];
175 FAUSTFLOAT fbargraph9;
176 FAUSTFLOAT *fbargraph9_;
177 void connect(uint32_t port,void* data);
178 void clear_state_f();
179 void init(uint32_t samplingFreq);
180 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
181
182 static void clear_state_f_static(PluginLV2*);
183 static void init_static(uint32_t samplingFreq, PluginLV2*);
184 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
185 static void del_instance(PluginLV2 *p);
186 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
187 public:
188 Dsp();
189 ~Dsp();
190 };
191
192
193
194 Dsp::Dsp()
195 : PluginLV2() {
196 version = PLUGINLV2_VERSION;
197 id = "mbc";
198 name = N_("Multi Band Compressor");
199 mono_audio = compute_static;
200 stereo_audio = 0;
201 set_samplerate = init_static;
202 activate_plugin = 0;
203 connect_ports = connect_static;
204 clear_state = clear_state_f_static;
205 delete_instance = del_instance;
206 }
207
208 Dsp::~Dsp() {
209 }
210
211 inline void Dsp::clear_state_f()
212 {
213 for (int i=0; i<2; i++) fVec0[i] = 0;
214 for (int i=0; i<2; i++) fRec18[i] = 0;
215 for (int i=0; i<3; i++) fRec17[i] = 0;
216 for (int i=0; i<2; i++) fVec1[i] = 0;
217 for (int i=0; i<2; i++) fRec16[i] = 0;
218 for (int i=0; i<3; i++) fRec15[i] = 0;
219 for (int i=0; i<2; i++) fVec2[i] = 0;
220 for (int i=0; i<2; i++) fRec14[i] = 0;
221 for (int i=0; i<3; i++) fRec13[i] = 0;
222 for (int i=0; i<2; i++) fVec3[i] = 0;
223 for (int i=0; i<2; i++) fRec12[i] = 0;
224 for (int i=0; i<3; i++) fRec11[i] = 0;
225 for (int i=0; i<2; i++) fRec7[i] = 0;
226 for (int i=0; i<2; i++) iRec8[i] = 0;
227 for (int i=0; i<2; i++) fRec9[i] = 0;
228 for (int i=0; i<2; i++) fRec6[i] = 0;
229 for (int i=0; i<2; i++) fRec5[i] = 0;
230 for (int i=0; i<2; i++) fRec4[i] = 0;
231 for (int i=0; i<2; i++) fRec19[i] = 0;
232 for (int i=0; i<2; i++) fRec0[i] = 0;
233 for (int i=0; i<2; i++) iRec1[i] = 0;
234 for (int i=0; i<2; i++) fRec2[i] = 0;
235 for (int i=0; i<2; i++) fRec32[i] = 0;
236 for (int i=0; i<3; i++) fRec31[i] = 0;
237 for (int i=0; i<2; i++) fRec27[i] = 0;
238 for (int i=0; i<2; i++) iRec28[i] = 0;
239 for (int i=0; i<2; i++) fRec29[i] = 0;
240 for (int i=0; i<2; i++) fRec26[i] = 0;
241 for (int i=0; i<2; i++) fRec25[i] = 0;
242 for (int i=0; i<2; i++) fRec24[i] = 0;
243 for (int i=0; i<2; i++) fRec33[i] = 0;
244 for (int i=0; i<2; i++) fRec20[i] = 0;
245 for (int i=0; i<2; i++) iRec21[i] = 0;
246 for (int i=0; i<2; i++) fRec22[i] = 0;
247 for (int i=0; i<2; i++) fRec47[i] = 0;
248 for (int i=0; i<3; i++) fRec46[i] = 0;
249 for (int i=0; i<3; i++) fRec45[i] = 0;
250 for (int i=0; i<2; i++) fRec41[i] = 0;
251 for (int i=0; i<2; i++) iRec42[i] = 0;
252 for (int i=0; i<2; i++) fRec43[i] = 0;
253 for (int i=0; i<2; i++) fRec40[i] = 0;
254 for (int i=0; i<2; i++) fRec39[i] = 0;
255 for (int i=0; i<2; i++) fRec38[i] = 0;
256 for (int i=0; i<2; i++) fRec48[i] = 0;
257 for (int i=0; i<2; i++) fRec34[i] = 0;
258 for (int i=0; i<2; i++) iRec35[i] = 0;
259 for (int i=0; i<2; i++) fRec36[i] = 0;
260 for (int i=0; i<2; i++) fRec63[i] = 0;
261 for (int i=0; i<3; i++) fRec62[i] = 0;
262 for (int i=0; i<3; i++) fRec61[i] = 0;
263 for (int i=0; i<3; i++) fRec60[i] = 0;
264 for (int i=0; i<2; i++) fRec56[i] = 0;
265 for (int i=0; i<2; i++) iRec57[i] = 0;
266 for (int i=0; i<2; i++) fRec58[i] = 0;
267 for (int i=0; i<2; i++) fRec55[i] = 0;
268 for (int i=0; i<2; i++) fRec54[i] = 0;
269 for (int i=0; i<2; i++) fRec53[i] = 0;
270 for (int i=0; i<2; i++) fRec64[i] = 0;
271 for (int i=0; i<2; i++) fRec49[i] = 0;
272 for (int i=0; i<2; i++) iRec50[i] = 0;
273 for (int i=0; i<2; i++) fRec51[i] = 0;
274 for (int i=0; i<2; i++) fRec80[i] = 0;
275 for (int i=0; i<3; i++) fRec79[i] = 0;
276 for (int i=0; i<3; i++) fRec78[i] = 0;
277 for (int i=0; i<3; i++) fRec77[i] = 0;
278 for (int i=0; i<3; i++) fRec76[i] = 0;
279 for (int i=0; i<2; i++) fRec72[i] = 0;
280 for (int i=0; i<2; i++) iRec73[i] = 0;
281 for (int i=0; i<2; i++) fRec74[i] = 0;
282 for (int i=0; i<2; i++) fRec71[i] = 0;
283 for (int i=0; i<2; i++) fRec70[i] = 0;
284 for (int i=0; i<2; i++) fRec69[i] = 0;
285 for (int i=0; i<2; i++) fRec81[i] = 0;
286 for (int i=0; i<2; i++) fRec65[i] = 0;
287 for (int i=0; i<2; i++) iRec66[i] = 0;
288 for (int i=0; i<2; i++) fRec67[i] = 0;
289 }
290
291 void Dsp::clear_state_f_static(PluginLV2 *p)
292 {
293 static_cast<Dsp*>(p)->clear_state_f();
294 }
295
296 inline void Dsp::init(uint32_t samplingFreq)
297 {
298 fSamplingFreq = samplingFreq;
299 iConst0 = min(192000, max(1, fSamplingFreq));
300 fConst1 = (1.0 / double(iConst0));
301 fConst2 = (3.141592653589793 / double(iConst0));
302 fConst3 = (2.0 / double(iConst0));
303 clear_state_f();
304 }
305
306 void Dsp::init_static(uint32_t samplingFreq, PluginLV2 *p)
307 {
308 static_cast<Dsp*>(p)->init(samplingFreq);
309 }
310
311 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
312 {
313 #define fslider0 (*fslider0_)
314 #define fslider1 (*fslider1_)
315 #define fslider2 (*fslider2_)
316 #define fslider3 (*fslider3_)
317 #define fbargraph0 (*fbargraph0_)
318 #define fslider4 (*fslider4_)
319 #define fslider5 (*fslider5_)
320 #define fslider6 (*fslider6_)
321 #define fslider7 (*fslider7_)
322 #define fslider8 (*fslider8_)
323 #define fslider9 (*fslider9_)
324 #define fbargraph1 (*fbargraph1_)
325 #define fbargraph2 (*fbargraph2_)
326 #define fslider10 (*fslider10_)
327 #define fslider11 (*fslider11_)
328 #define fslider12 (*fslider12_)
329 #define fslider13 (*fslider13_)
330 #define fslider14 (*fslider14_)
331 #define fslider15 (*fslider15_)
332 #define fbargraph3 (*fbargraph3_)
333 #define fbargraph4 (*fbargraph4_)
334 #define fslider16 (*fslider16_)
335 #define fslider17 (*fslider17_)
336 #define fslider18 (*fslider18_)
337 #define fslider19 (*fslider19_)
338 #define fslider20 (*fslider20_)
339 #define fslider21 (*fslider21_)
340 #define fbargraph5 (*fbargraph5_)
341 #define fbargraph6 (*fbargraph6_)
342 #define fslider22 (*fslider22_)
343 #define fslider23 (*fslider23_)
344 #define fslider24 (*fslider24_)
345 #define fslider25 (*fslider25_)
346 #define fslider26 (*fslider26_)
347 #define fslider27 (*fslider27_)
348 #define fbargraph7 (*fbargraph7_)
349 #define fbargraph8 (*fbargraph8_)
350 #define fslider28 (*fslider28_)
351 #define fslider29 (*fslider29_)
352 #define fslider30 (*fslider30_)
353 #define fslider31 (*fslider31_)
354 #define fslider32 (*fslider32_)
355 #define fslider33 (*fslider33_)
356 #define fbargraph9 (*fbargraph9_)
357 double fSlow0 = tan((fConst2 * double(fslider0)));
358 double fSlow1 = (1.0 / faustpower<2>(fSlow0));
359 double fSlow2 = (2 * (1 - fSlow1));
360 double fSlow3 = (1.0 / fSlow0);
361 double fSlow4 = (1 + ((fSlow3 - 1.0000000000000004) / fSlow0));
362 double fSlow5 = (1.0 / (1 + ((fSlow3 + 1.0000000000000004) / fSlow0)));
363 double fSlow6 = tan((fConst2 * double(fslider1)));
364 double fSlow7 = (1.0 / faustpower<2>(fSlow6));
365 double fSlow8 = (2 * (1 - fSlow7));
366 double fSlow9 = (1.0 / fSlow6);
367 double fSlow10 = (1 + ((fSlow9 - 1.0000000000000004) / fSlow6));
368 double fSlow11 = (1 + ((fSlow9 + 1.0000000000000004) / fSlow6));
369 double fSlow12 = (1.0 / fSlow11);
370 double fSlow13 = tan((fConst2 * double(fslider2)));
371 double fSlow14 = (1.0 / faustpower<2>(fSlow13));
372 double fSlow15 = (2 * (1 - fSlow14));
373 double fSlow16 = (1.0 / fSlow13);
374 double fSlow17 = (1 + ((fSlow16 - 1.0000000000000004) / fSlow13));
375 double fSlow18 = (1 + ((fSlow16 + 1.0000000000000004) / fSlow13));
376 double fSlow19 = (1.0 / fSlow18);
377 double fSlow20 = tan((fConst2 * double(fslider3)));
378 double fSlow21 = (1.0 / faustpower<2>(fSlow20));
379 double fSlow22 = (2 * (1 - fSlow21));
380 double fSlow23 = (1.0 / fSlow20);
381 double fSlow24 = (1 + ((fSlow23 - 1.0000000000000004) / fSlow20));
382 double fSlow25 = (1 + ((1.0000000000000004 + fSlow23) / fSlow20));
383 double fSlow26 = (1.0 / fSlow25);
384 double fSlow27 = (1 + fSlow23);
385 double fSlow28 = (1.0 / fSlow27);
386 double fSlow29 = (0 - ((1 - fSlow23) / fSlow27));
387 double fSlow30 = (1 + fSlow16);
388 double fSlow31 = (1.0 / fSlow30);
389 double fSlow32 = (0 - ((1 - fSlow16) / fSlow30));
390 double fSlow33 = (1 + fSlow9);
391 double fSlow34 = (1.0 / fSlow33);
392 double fSlow35 = (0 - ((1 - fSlow9) / fSlow33));
393 double fSlow36 = (1 + fSlow3);
394 double fSlow37 = (1.0 / fSlow36);
395 double fSlow38 = (0 - ((1 - fSlow3) / fSlow36));
396 double fSlow39 = double(fslider4);
397 double fSlow40 = max((double)0, (fSlow39 - 1));
398 int iSlow41 = int(fSlow40);
399 double fSlow42 = exp((0 - (fConst1 / double(fslider5))));
400 double fSlow43 = (1.0 - fSlow42);
401 double fSlow44 = double(fslider6);
402 double fSlow45 = exp((0 - (fConst1 / fSlow44)));
403 double fSlow46 = (1.0 - fSlow45);
404 double fSlow47 = double(fslider7);
405 double fSlow48 = exp((0 - (fConst3 / fSlow44)));
406 double fSlow49 = (((1.0 / double(double(fslider8))) - 1.0) * (1.0 - fSlow48));
407 double fSlow50 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow47 - double(fslider9)) * fabs((fSlow40 - 1))))));
408 double fSlow51 = fabs((max((double)0, (fSlow39 - 2)) - 1));
409 double fSlow52 = (0 - fSlow3);
410 double fSlow53 = (1.0 / (fSlow0 * fSlow11));
411 double fSlow54 = (2 * (0 - fSlow1));
412 double fSlow55 = double(fslider10);
413 double fSlow56 = max((double)0, (fSlow55 - 1));
414 int iSlow57 = int(fSlow56);
415 double fSlow58 = exp((0 - (fConst1 / double(fslider11))));
416 double fSlow59 = (1.0 - fSlow58);
417 double fSlow60 = double(fslider12);
418 double fSlow61 = exp((0 - (fConst1 / fSlow60)));
419 double fSlow62 = (1.0 - fSlow61);
420 double fSlow63 = double(fslider13);
421 double fSlow64 = exp((0 - (fConst3 / fSlow60)));
422 double fSlow65 = (((1.0 / double(double(fslider14))) - 1.0) * (1.0 - fSlow64));
423 double fSlow66 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow63 - double(fslider15)) * fabs((fSlow56 - 1))))));
424 double fSlow67 = fabs((max((double)0, (fSlow55 - 2)) - 1));
425 double fSlow68 = (1 + ((fSlow3 - 1.0) / fSlow0));
426 double fSlow69 = (1.0 / (1 + ((1.0 + fSlow3) / fSlow0)));
427 double fSlow70 = (0 - fSlow9);
428 double fSlow71 = (1.0 / (fSlow6 * fSlow18));
429 double fSlow72 = (2 * (0 - fSlow7));
430 double fSlow73 = double(fslider16);
431 double fSlow74 = max((double)0, (fSlow73 - 1));
432 int iSlow75 = int(fSlow74);
433 double fSlow76 = exp((0 - (fConst1 / double(fslider17))));
434 double fSlow77 = (1.0 - fSlow76);
435 double fSlow78 = double(fslider18);
436 double fSlow79 = exp((0 - (fConst1 / fSlow78)));
437 double fSlow80 = (1.0 - fSlow79);
438 double fSlow81 = double(fslider19);
439 double fSlow82 = exp((0 - (fConst3 / fSlow78)));
440 double fSlow83 = (((1.0 / double(double(fslider20))) - 1.0) * (1.0 - fSlow82));
441 double fSlow84 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow81 - double(fslider21)) * fabs((fSlow74 - 1))))));
442 double fSlow85 = fabs((max((double)0, (fSlow73 - 2)) - 1));
443 double fSlow86 = (1 + ((fSlow9 - 1.0) / fSlow6));
444 double fSlow87 = (1.0 / (1 + ((1.0 + fSlow9) / fSlow6)));
445 double fSlow88 = (0 - fSlow16);
446 double fSlow89 = (1.0 / (fSlow13 * fSlow25));
447 double fSlow90 = (2 * (0 - fSlow14));
448 double fSlow91 = double(fslider22);
449 double fSlow92 = max((double)0, (fSlow91 - 1));
450 int iSlow93 = int(fSlow92);
451 double fSlow94 = exp((0 - (fConst1 / double(fslider23))));
452 double fSlow95 = (1.0 - fSlow94);
453 double fSlow96 = double(fslider24);
454 double fSlow97 = exp((0 - (fConst1 / fSlow96)));
455 double fSlow98 = (1.0 - fSlow97);
456 double fSlow99 = double(fslider25);
457 double fSlow100 = exp((0 - (fConst3 / fSlow96)));
458 double fSlow101 = (((1.0 / double(double(fslider26))) - 1.0) * (1.0 - fSlow100));
459 double fSlow102 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow99 - double(fslider27)) * fabs((fSlow92 - 1))))));
460 double fSlow103 = fabs((max((double)0, (fSlow91 - 2)) - 1));
461 double fSlow104 = (1 + ((fSlow16 - 1.0) / fSlow13));
462 double fSlow105 = (1.0 / (1 + ((1.0 + fSlow16) / fSlow13)));
463 double fSlow106 = (0 - fSlow23);
464 double fSlow107 = (2 * (0 - fSlow21));
465 double fSlow108 = double(fslider28);
466 double fSlow109 = max((double)0, (fSlow108 - 1));
467 int iSlow110 = int(fSlow109);
468 double fSlow111 = exp((0 - (fConst1 / double(fslider29))));
469 double fSlow112 = (1.0 - fSlow111);
470 double fSlow113 = double(fslider30);
471 double fSlow114 = exp((0 - (fConst1 / fSlow113)));
472 double fSlow115 = (1.0 - fSlow114);
473 double fSlow116 = double(fslider31);
474 double fSlow117 = exp((0 - (fConst3 / fSlow113)));
475 double fSlow118 = (((1.0 / double(double(fslider32))) - 1.0) * (1.0 - fSlow117));
476 double fSlow119 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow116 - double(fslider33)) * fabs((fSlow109 - 1))))));
477 double fSlow120 = fabs((max((double)0, (fSlow108 - 2)) - 1));
478 for (int i=0; i<count; i++) {
479 double fTemp0 = (double)input0[i];
480 fVec0[0] = fTemp0;
481 fRec18[0] = ((fSlow29 * fRec18[1]) + (fSlow28 * (fVec0[0] + fVec0[1])));
482 fRec17[0] = (fRec18[0] - (fSlow26 * ((fSlow24 * fRec17[2]) + (fSlow22 * fRec17[1]))));
483 double fTemp1 = (fRec17[2] + (fRec17[0] + (2 * fRec17[1])));
484 double fTemp2 = (fSlow26 * fTemp1);
485 fVec1[0] = fTemp2;
486 fRec16[0] = ((fSlow32 * fRec16[1]) + (fSlow31 * (fVec1[0] + fVec1[1])));
487 fRec15[0] = (fRec16[0] - (fSlow19 * ((fSlow17 * fRec15[2]) + (fSlow15 * fRec15[1]))));
488 double fTemp3 = (fRec15[2] + (fRec15[0] + (2 * fRec15[1])));
489 double fTemp4 = (fSlow19 * fTemp3);
490 fVec2[0] = fTemp4;
491 fRec14[0] = ((fSlow35 * fRec14[1]) + (fSlow34 * (fVec2[0] + fVec2[1])));
492 fRec13[0] = (fRec14[0] - (fSlow12 * ((fSlow10 * fRec13[2]) + (fSlow8 * fRec13[1]))));
493 double fTemp5 = (fRec13[2] + (fRec13[0] + (2 * fRec13[1])));
494 double fTemp6 = (fSlow12 * fTemp5);
495 fVec3[0] = fTemp6;
496 fRec12[0] = ((fSlow38 * fRec12[1]) + (fSlow37 * (fVec3[0] + fVec3[1])));
497 fRec11[0] = (fRec12[0] - (fSlow5 * ((fSlow4 * fRec11[2]) + (fSlow2 * fRec11[1]))));
498 double fTemp7 = (fSlow5 * (fRec11[2] + (fRec11[0] + (2 * fRec11[1]))));
499 double fRec10 = max(fConst1, fabs(fTemp7));
500 int iTemp8 = int((iRec8[1] < 4096));
501 fRec7[0] = ((iTemp8)?max(fRec7[1], fRec10):fRec10);
502 iRec8[0] = ((iTemp8)?(1 + iRec8[1]):1);
503 fRec9[0] = ((iTemp8)?fRec9[1]:fRec7[1]);
504 fbargraph0 = fRec9[0];
505 double fTemp9 = fTemp7;
506 double fTemp10 = ((iSlow41)?0:fTemp9);
507 double fTemp11 = fabs(fTemp10);
508 fRec6[0] = ((fSlow42 * max(fTemp11, fRec6[1])) + (fSlow43 * fTemp11));
509 fRec5[0] = ((fSlow45 * fRec5[1]) + (fSlow46 * fRec6[0]));
510 fRec4[0] = ((fSlow48 * fRec4[1]) + (fSlow49 * max((fSlow47 + (20 * log10(fRec5[0]))), 0.0)));
511 fRec19[0] = ((0.999 * fRec19[1]) + fSlow50);
512 double fTemp12 = (fSlow51 * (fRec19[0] * ((iSlow41)?fTemp9:(fTemp10 * pow(10,(0.05 * fRec4[0]))))));
513 double fRec3 = max(fConst1, fabs(fTemp12));
514 int iTemp13 = int((iRec1[1] < 4096));
515 fRec0[0] = ((iTemp13)?max(fRec0[1], fRec3):fRec3);
516 iRec1[0] = ((iTemp13)?(1 + iRec1[1]):1);
517 fRec2[0] = ((iTemp13)?fRec2[1]:fRec0[1]);
518 fbargraph1 = fRec2[0];
519 fRec32[0] = ((fSlow38 * fRec32[1]) + (fSlow37 * ((fSlow53 * fTemp5) + (fSlow52 * fVec3[1]))));
520 fRec31[0] = (fRec32[0] - (fSlow5 * ((fSlow4 * fRec31[2]) + (fSlow2 * fRec31[1]))));
521 double fTemp14 = (fSlow5 * (((fSlow1 * fRec31[0]) + (fSlow54 * fRec31[1])) + (fSlow1 * fRec31[2])));
522 double fRec30 = max(fConst1, fabs(fTemp14));
523 int iTemp15 = int((iRec28[1] < 4096));
524 fRec27[0] = ((iTemp15)?max(fRec27[1], fRec30):fRec30);
525 iRec28[0] = ((iTemp15)?(1 + iRec28[1]):1);
526 fRec29[0] = ((iTemp15)?fRec29[1]:fRec27[1]);
527 fbargraph2 = fRec29[0];
528 double fTemp16 = fTemp14;
529 double fTemp17 = ((iSlow57)?0:fTemp16);
530 double fTemp18 = fabs(fTemp17);
531 fRec26[0] = ((fSlow58 * max(fTemp18, fRec26[1])) + (fSlow59 * fTemp18));
532 fRec25[0] = ((fSlow61 * fRec25[1]) + (fSlow62 * fRec26[0]));
533 fRec24[0] = ((fSlow64 * fRec24[1]) + (fSlow65 * max((fSlow63 + (20 * log10(fRec25[0]))), 0.0)));
534 fRec33[0] = ((0.999 * fRec33[1]) + fSlow66);
535 double fTemp19 = (fSlow67 * (fRec33[0] * ((iSlow57)?fTemp16:(fTemp17 * pow(10,(0.05 * fRec24[0]))))));
536 double fRec23 = max(fConst1, fabs(fTemp19));
537 int iTemp20 = int((iRec21[1] < 4096));
538 fRec20[0] = ((iTemp20)?max(fRec20[1], fRec23):fRec23);
539 iRec21[0] = ((iTemp20)?(1 + iRec21[1]):1);
540 fRec22[0] = ((iTemp20)?fRec22[1]:fRec20[1]);
541 fbargraph3 = fRec22[0];
542 double fTemp21 = (fSlow2 * fRec45[1]);
543 fRec47[0] = ((fSlow35 * fRec47[1]) + (fSlow34 * ((fSlow71 * fTemp3) + (fSlow70 * fVec2[1]))));
544 fRec46[0] = (fRec47[0] - (fSlow12 * ((fSlow10 * fRec46[2]) + (fSlow8 * fRec46[1]))));
545 fRec45[0] = ((fSlow12 * (((fSlow7 * fRec46[0]) + (fSlow72 * fRec46[1])) + (fSlow7 * fRec46[2]))) - (fSlow69 * ((fSlow68 * fRec45[2]) + fTemp21)));
546 double fTemp22 = (fRec45[2] + (fSlow69 * (fTemp21 + (fSlow68 * fRec45[0]))));
547 double fRec44 = max(fConst1, fabs(fTemp22));
548 int iTemp23 = int((iRec42[1] < 4096));
549 fRec41[0] = ((iTemp23)?max(fRec41[1], fRec44):fRec44);
550 iRec42[0] = ((iTemp23)?(1 + iRec42[1]):1);
551 fRec43[0] = ((iTemp23)?fRec43[1]:fRec41[1]);
552 fbargraph4 = fRec43[0];
553 double fTemp24 = fTemp22;
554 double fTemp25 = ((iSlow75)?0:fTemp24);
555 double fTemp26 = fabs(fTemp25);
556 fRec40[0] = ((fSlow76 * max(fTemp26, fRec40[1])) + (fSlow77 * fTemp26));
557 fRec39[0] = ((fSlow79 * fRec39[1]) + (fSlow80 * fRec40[0]));
558 fRec38[0] = ((fSlow82 * fRec38[1]) + (fSlow83 * max((fSlow81 + (20 * log10(fRec39[0]))), 0.0)));
559 fRec48[0] = ((0.999 * fRec48[1]) + fSlow84);
560 double fTemp27 = (fSlow85 * (fRec48[0] * ((iSlow75)?fTemp24:(fTemp25 * pow(10,(0.05 * fRec38[0]))))));
561 double fRec37 = max(fConst1, fabs(fTemp27));
562 int iTemp28 = int((iRec35[1] < 4096));
563 fRec34[0] = ((iTemp28)?max(fRec34[1], fRec37):fRec37);
564 iRec35[0] = ((iTemp28)?(1 + iRec35[1]):1);
565 fRec36[0] = ((iTemp28)?fRec36[1]:fRec34[1]);
566 fbargraph5 = fRec36[0];
567 double fTemp29 = (fSlow2 * fRec60[1]);
568 double fTemp30 = (fSlow8 * fRec61[1]);
569 fRec63[0] = ((fSlow32 * fRec63[1]) + (fSlow31 * ((fSlow89 * fTemp1) + (fSlow88 * fVec1[1]))));
570 fRec62[0] = (fRec63[0] - (fSlow19 * ((fSlow17 * fRec62[2]) + (fSlow15 * fRec62[1]))));
571 fRec61[0] = ((fSlow19 * (((fSlow14 * fRec62[0]) + (fSlow90 * fRec62[1])) + (fSlow14 * fRec62[2]))) - (fSlow87 * ((fSlow86 * fRec61[2]) + fTemp30)));
572 fRec60[0] = ((fRec61[2] + (fSlow87 * (fTemp30 + (fSlow86 * fRec61[0])))) - (fSlow69 * ((fSlow68 * fRec60[2]) + fTemp29)));
573 double fTemp31 = (fRec60[2] + (fSlow69 * (fTemp29 + (fSlow68 * fRec60[0]))));
574 double fRec59 = max(fConst1, fabs(fTemp31));
575 int iTemp32 = int((iRec57[1] < 4096));
576 fRec56[0] = ((iTemp32)?max(fRec56[1], fRec59):fRec59);
577 iRec57[0] = ((iTemp32)?(1 + iRec57[1]):1);
578 fRec58[0] = ((iTemp32)?fRec58[1]:fRec56[1]);
579 fbargraph6 = fRec58[0];
580 double fTemp33 = fTemp31;
581 double fTemp34 = ((iSlow93)?0:fTemp33);
582 double fTemp35 = fabs(fTemp34);
583 fRec55[0] = ((fSlow94 * max(fTemp35, fRec55[1])) + (fSlow95 * fTemp35));
584 fRec54[0] = ((fSlow97 * fRec54[1]) + (fSlow98 * fRec55[0]));
585 fRec53[0] = ((fSlow100 * fRec53[1]) + (fSlow101 * max((fSlow99 + (20 * log10(fRec54[0]))), 0.0)));
586 fRec64[0] = ((0.999 * fRec64[1]) + fSlow102);
587 double fTemp36 = (fSlow103 * (fRec64[0] * ((iSlow93)?fTemp33:(fTemp34 * pow(10,(0.05 * fRec53[0]))))));
588 double fRec52 = max(fConst1, fabs(fTemp36));
589 int iTemp37 = int((iRec50[1] < 4096));
590 fRec49[0] = ((iTemp37)?max(fRec49[1], fRec52):fRec52);
591 iRec50[0] = ((iTemp37)?(1 + iRec50[1]):1);
592 fRec51[0] = ((iTemp37)?fRec51[1]:fRec49[1]);
593 fbargraph7 = fRec51[0];
594 double fTemp38 = (fSlow2 * fRec76[1]);
595 double fTemp39 = (fSlow8 * fRec77[1]);
596 double fTemp40 = (fSlow15 * fRec78[1]);
597 fRec80[0] = ((fSlow29 * fRec80[1]) + (fSlow28 * ((fSlow23 * fVec0[0]) + (fSlow106 * fVec0[1]))));
598 fRec79[0] = (fRec80[0] - (fSlow26 * ((fSlow24 * fRec79[2]) + (fSlow22 * fRec79[1]))));
599 fRec78[0] = ((fSlow26 * (((fSlow21 * fRec79[0]) + (fSlow107 * fRec79[1])) + (fSlow21 * fRec79[2]))) - (fSlow105 * ((fSlow104 * fRec78[2]) + fTemp40)));
600 fRec77[0] = ((fRec78[2] + (fSlow105 * (fTemp40 + (fSlow104 * fRec78[0])))) - (fSlow87 * ((fSlow86 * fRec77[2]) + fTemp39)));
601 fRec76[0] = ((fRec77[2] + (fSlow87 * (fTemp39 + (fSlow86 * fRec77[0])))) - (fSlow69 * ((fSlow68 * fRec76[2]) + fTemp38)));
602 double fTemp41 = (fRec76[2] + (fSlow69 * (fTemp38 + (fSlow68 * fRec76[0]))));
603 double fRec75 = max(fConst1, fabs(fTemp41));
604 int iTemp42 = int((iRec73[1] < 4096));
605 fRec72[0] = ((iTemp42)?max(fRec72[1], fRec75):fRec75);
606 iRec73[0] = ((iTemp42)?(1 + iRec73[1]):1);
607 fRec74[0] = ((iTemp42)?fRec74[1]:fRec72[1]);
608 fbargraph8 = fRec74[0];
609 double fTemp43 = fTemp41;
610 double fTemp44 = ((iSlow110)?0:fTemp43);
611 double fTemp45 = fabs(fTemp44);
612 fRec71[0] = ((fSlow111 * max(fTemp45, fRec71[1])) + (fSlow112 * fTemp45));
613 fRec70[0] = ((fSlow114 * fRec70[1]) + (fSlow115 * fRec71[0]));
614 fRec69[0] = ((fSlow117 * fRec69[1]) + (fSlow118 * max((fSlow116 + (20 * log10(fRec70[0]))), 0.0)));
615 fRec81[0] = ((0.999 * fRec81[1]) + fSlow119);
616 double fTemp46 = (fSlow120 * (fRec81[0] * ((iSlow110)?fTemp43:(fTemp44 * pow(10,(0.05 * fRec69[0]))))));
617 double fRec68 = max(fConst1, fabs(fTemp46));
618 int iTemp47 = int((iRec66[1] < 4096));
619 fRec65[0] = ((iTemp47)?max(fRec65[1], fRec68):fRec68);
620 iRec66[0] = ((iTemp47)?(1 + iRec66[1]):1);
621 fRec67[0] = ((iTemp47)?fRec67[1]:fRec65[1]);
622 fbargraph9 = fRec67[0];
623 output0[i] = (FAUSTFLOAT)((((fTemp46 + fTemp36) + fTemp27) + fTemp19) + fTemp12);
624 // post processing
625 fRec67[1] = fRec67[0];
626 iRec66[1] = iRec66[0];
627 fRec65[1] = fRec65[0];
628 fRec81[1] = fRec81[0];
629 fRec69[1] = fRec69[0];
630 fRec70[1] = fRec70[0];
631 fRec71[1] = fRec71[0];
632 fRec74[1] = fRec74[0];
633 iRec73[1] = iRec73[0];
634 fRec72[1] = fRec72[0];
635 fRec76[2] = fRec76[1]; fRec76[1] = fRec76[0];
636 fRec77[2] = fRec77[1]; fRec77[1] = fRec77[0];
637 fRec78[2] = fRec78[1]; fRec78[1] = fRec78[0];
638 fRec79[2] = fRec79[1]; fRec79[1] = fRec79[0];
639 fRec80[1] = fRec80[0];
640 fRec51[1] = fRec51[0];
641 iRec50[1] = iRec50[0];
642 fRec49[1] = fRec49[0];
643 fRec64[1] = fRec64[0];
644 fRec53[1] = fRec53[0];
645 fRec54[1] = fRec54[0];
646 fRec55[1] = fRec55[0];
647 fRec58[1] = fRec58[0];
648 iRec57[1] = iRec57[0];
649 fRec56[1] = fRec56[0];
650 fRec60[2] = fRec60[1]; fRec60[1] = fRec60[0];
651 fRec61[2] = fRec61[1]; fRec61[1] = fRec61[0];
652 fRec62[2] = fRec62[1]; fRec62[1] = fRec62[0];
653 fRec63[1] = fRec63[0];
654 fRec36[1] = fRec36[0];
655 iRec35[1] = iRec35[0];
656 fRec34[1] = fRec34[0];
657 fRec48[1] = fRec48[0];
658 fRec38[1] = fRec38[0];
659 fRec39[1] = fRec39[0];
660 fRec40[1] = fRec40[0];
661 fRec43[1] = fRec43[0];
662 iRec42[1] = iRec42[0];
663 fRec41[1] = fRec41[0];
664 fRec45[2] = fRec45[1]; fRec45[1] = fRec45[0];
665 fRec46[2] = fRec46[1]; fRec46[1] = fRec46[0];
666 fRec47[1] = fRec47[0];
667 fRec22[1] = fRec22[0];
668 iRec21[1] = iRec21[0];
669 fRec20[1] = fRec20[0];
670 fRec33[1] = fRec33[0];
671 fRec24[1] = fRec24[0];
672 fRec25[1] = fRec25[0];
673 fRec26[1] = fRec26[0];
674 fRec29[1] = fRec29[0];
675 iRec28[1] = iRec28[0];
676 fRec27[1] = fRec27[0];
677 fRec31[2] = fRec31[1]; fRec31[1] = fRec31[0];
678 fRec32[1] = fRec32[0];
679 fRec2[1] = fRec2[0];
680 iRec1[1] = iRec1[0];
681 fRec0[1] = fRec0[0];
682 fRec19[1] = fRec19[0];
683 fRec4[1] = fRec4[0];
684 fRec5[1] = fRec5[0];
685 fRec6[1] = fRec6[0];
686 fRec9[1] = fRec9[0];
687 iRec8[1] = iRec8[0];
688 fRec7[1] = fRec7[0];
689 fRec11[2] = fRec11[1]; fRec11[1] = fRec11[0];
690 fRec12[1] = fRec12[0];
691 fVec3[1] = fVec3[0];
692 fRec13[2] = fRec13[1]; fRec13[1] = fRec13[0];
693 fRec14[1] = fRec14[0];
694 fVec2[1] = fVec2[0];
695 fRec15[2] = fRec15[1]; fRec15[1] = fRec15[0];
696 fRec16[1] = fRec16[0];
697 fVec1[1] = fVec1[0];
698 fRec17[2] = fRec17[1]; fRec17[1] = fRec17[0];
699 fRec18[1] = fRec18[0];
700 fVec0[1] = fVec0[0];
701 }
702 #undef fslider0
703 #undef fslider1
704 #undef fslider2
705 #undef fslider3
706 #undef fbargraph0
707 #undef fslider4
708 #undef fslider5
709 #undef fslider6
710 #undef fslider7
711 #undef fslider8
712 #undef fslider9
713 #undef fbargraph1
714 #undef fbargraph2
715 #undef fslider10
716 #undef fslider11
717 #undef fslider12
718 #undef fslider13
719 #undef fslider14
720 #undef fslider15
721 #undef fbargraph3
722 #undef fbargraph4
723 #undef fslider16
724 #undef fslider17
725 #undef fslider18
726 #undef fslider19
727 #undef fslider20
728 #undef fslider21
729 #undef fbargraph5
730 #undef fbargraph6
731 #undef fslider22
732 #undef fslider23
733 #undef fslider24
734 #undef fslider25
735 #undef fslider26
736 #undef fslider27
737 #undef fbargraph7
738 #undef fbargraph8
739 #undef fslider28
740 #undef fslider29
741 #undef fslider30
742 #undef fslider31
743 #undef fslider32
744 #undef fslider33
745 #undef fbargraph9
746 }
747
748 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
749 {
750 static_cast<Dsp*>(p)->compute(count, input0, output0);
751 }
752
753
754 void Dsp::connect(uint32_t port,void* data)
755 {
756 switch ((PortIndex)port)
757 {
758 // static const value_pair fslider4_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
759 case MODE1:
760 fslider4_ = (float*)data; // , 1.0, 1.0, 3.0, 1.0
761 break;
762 // static const value_pair fslider10_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
763 case MODE2:
764 fslider10_ = (float*)data; // , 1.0, 1.0, 3.0, 1.0
765 break;
766 // static const value_pair fslider16_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
767 case MODE3:
768 fslider16_ = (float*)data; // , 1.0, 1.0, 3.0, 1.0
769 break;
770 // static const value_pair fslider22_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
771 case MODE4:
772 fslider22_ = (float*)data; // , 1.0, 1.0, 3.0, 1.0
773 break;
774 // static const value_pair fslider28_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
775 case MODE5:
776 fslider28_ = (float*)data; // , 1.0, 1.0, 3.0, 1.0
777 break;
778 case MAKEUP1:
779 fslider7_ = (float*)data; // , 13.0, -5e+01, 5e+01, 0.1
780 break;
781 case MAKEUP2:
782 fslider13_ = (float*)data; // , 1e+01, -5e+01, 5e+01, 0.1
783 break;
784 case MAKEUP3:
785 fslider19_ = (float*)data; // , 4.0, -5e+01, 5e+01, 0.1
786 break;
787 case MAKEUP4:
788 fslider25_ = (float*)data; // , 8.0, -5e+01, 5e+01, 0.1
789 break;
790 case MAKEUP5:
791 fslider31_ = (float*)data; // , 11.0, -5e+01, 5e+01, 0.1
792 break;
793 case MAKEUPTHRESHOLD1:
794 fslider9_ = (float*)data; // , 2.0, 0.0, 1e+01, 0.1
795 break;
796 case MAKEUPTHRESHOLD2:
797 fslider15_ = (float*)data; // , 2.0, 0.0, 1e+01, 0.1
798 break;
799 case MAKEUPTHRESHOLD3:
800 fslider21_ = (float*)data; // , 2.0, 0.0, 1e+01, 0.1
801 break;
802 case MAKEUPTHRESHOLD4:
803 fslider27_ = (float*)data; // , 2.0, 0.0, 1e+01, 0.1
804 break;
805 case MAKEUPTHRESHOLD5:
806 fslider33_ = (float*)data; // , 2.0, 0.0, 1e+01, 0.1
807 break;
808 case RATIO1:
809 fslider8_ = (float*)data; // , 2.0, 1.0, 1e+02, 0.1
810 break;
811 case RATIO2:
812 fslider14_ = (float*)data; // , 2.0, 1.0, 1e+02, 0.1
813 break;
814 case RATIO3:
815 fslider20_ = (float*)data; // , 2.0, 1.0, 1e+02, 0.1
816 break;
817 case RATIO4:
818 fslider26_ = (float*)data; // , 2.0, 1.0, 1e+02, 0.1
819 break;
820 case RATIO5:
821 fslider32_ = (float*)data; // , 2.0, 1.0, 1e+02, 0.1
822 break;
823 case ATTACK1:
824 fslider6_ = (float*)data; // , 0.012, 0.001, 1.0, 0.001
825 break;
826 case ATTACK2:
827 fslider12_ = (float*)data; // , 0.012, 0.001, 1.0, 0.001
828 break;
829 case ATTACK3:
830 fslider18_ = (float*)data; // , 0.012, 0.001, 1.0, 0.001
831 break;
832 case ATTACK4:
833 fslider24_ = (float*)data; // , 0.012, 0.001, 1.0, 0.001
834 break;
835 case ATTACK5:
836 fslider30_ = (float*)data; // , 0.012, 0.001, 1.0, 0.001
837 break;
838 case RELEASE1:
839 fslider5_ = (float*)data; // , 1.25, 0.01, 1e+01, 0.01
840 break;
841 case RELEASE2:
842 fslider11_ = (float*)data; // , 1.25, 0.01, 1e+01, 0.01
843 break;
844 case RELEASE3:
845 fslider17_ = (float*)data; // , 1.25, 0.01, 1e+01, 0.01
846 break;
847 case RELEASE4:
848 fslider23_ = (float*)data; // , 1.25, 0.01, 1e+01, 0.01
849 break;
850 case RELEASE5:
851 fslider29_ = (float*)data; // , 1.25, 0.01, 1e+01, 0.01
852 break;
853 case CROSSOVER_B1_B2:
854 fslider0_ = (float*)data; // , 8e+01, 2e+01, 2e+04, 1.08
855 break;
856 case CROSSOVER_B2_B3:
857 fslider1_ = (float*)data; // , 2.1e+02, 2e+01, 2e+04, 1.08
858 break;
859 case CROSSOVER_B3_B4:
860 fslider2_ = (float*)data; // , 1.7e+03, 2e+01, 2e+04, 1.08
861 break;
862 case CROSSOVER_B4_B5:
863 fslider3_ = (float*)data; // , 5e+03, 2e+01, 2e+04, 1.08
864 break;
865 case V10:
866 fbargraph8_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
867 break;
868 case V1:
869 fbargraph1_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
870 break;
871 case V2:
872 fbargraph3_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
873 break;
874 case V3:
875 fbargraph5_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
876 break;
877 case V4:
878 fbargraph7_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
879 break;
880 case V5:
881 fbargraph9_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
882 break;
883 case V6:
884 fbargraph0_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
885 break;
886 case V7:
887 fbargraph2_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
888 break;
889 case V8:
890 fbargraph4_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
891 break;
892 case V9:
893 fbargraph6_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
894 break;
895 default:
896 break;
897 }
898 }
899
900 void Dsp::connect_static(uint32_t port,void* data, PluginLV2 *p)
901 {
902 static_cast<Dsp*>(p)->connect(port, data);
903 }
904
905
906 PluginLV2 *plugin() {
907 return new Dsp();
908 }
909
910 void Dsp::del_instance(PluginLV2 *p)
911 {
912 delete static_cast<Dsp*>(p);
913 }
914
915 /*
916 typedef enum
917 {
918 MODE1,
919 MODE2,
920 MODE3,
921 MODE4,
922 MODE5,
923 MAKEUP1,
924 MAKEUP2,
925 MAKEUP3,
926 MAKEUP4,
927 MAKEUP5,
928 MAKEUPTHRESHOLD1,
929 MAKEUPTHRESHOLD2,
930 MAKEUPTHRESHOLD3,
931 MAKEUPTHRESHOLD4,
932 MAKEUPTHRESHOLD5,
933 RATIO1,
934 RATIO2,
935 RATIO3,
936 RATIO4,
937 RATIO5,
938 ATTACK1,
939 ATTACK2,
940 ATTACK3,
941 ATTACK4,
942 ATTACK5,
943 RELEASE1,
944 RELEASE2,
945 RELEASE3,
946 RELEASE4,
947 RELEASE5,
948 CROSSOVER_B1_B2,
949 CROSSOVER_B2_B3,
950 CROSSOVER_B3_B4,
951 CROSSOVER_B4_B5,
952 V10,
953 V1,
954 V2,
955 V3,
956 V4,
957 V5,
958 V6,
959 V7,
960 V8,
961 V9,
962 } PortIndex;
963 */
964
965 } // end namespace mbc
0 // generated from file '../src/LV2/faust/mbd.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.65 (http://faust.grame.fr)
2
3
4 namespace mbd {
5
6 class Dsp: public PluginLV2 {
7 private:
8 uint32_t fSamplingFreq;
9 FAUSTFLOAT fslider0;
10 FAUSTFLOAT *fslider0_;
11 int iVec0[2];
12 double fRec0[2];
13 int iConst0;
14 double fConst1;
15 FAUSTFLOAT fslider1;
16 FAUSTFLOAT *fslider1_;
17 double fConst2;
18 FAUSTFLOAT fslider2;
19 FAUSTFLOAT *fslider2_;
20 FAUSTFLOAT fslider3;
21 FAUSTFLOAT *fslider3_;
22 FAUSTFLOAT fslider4;
23 FAUSTFLOAT *fslider4_;
24 double fRec14[2];
25 double fVec1[2];
26 double fRec13[2];
27 double fRec12[3];
28 double fVec2[2];
29 double fRec11[2];
30 double fRec10[3];
31 double fVec3[2];
32 double fRec9[2];
33 double fRec8[3];
34 double fVec4[2];
35 double fRec7[2];
36 double fRec6[3];
37 FAUSTFLOAT fslider5;
38 FAUSTFLOAT *fslider5_;
39 FAUSTFLOAT fslider6;
40 FAUSTFLOAT *fslider6_;
41 double fRec15[2];
42 double fVec5[2];
43 double fRec5[2];
44 double fRec1[2];
45 int iRec2[2];
46 double fRec3[2];
47 FAUSTFLOAT fbargraph0;
48 FAUSTFLOAT *fbargraph0_;
49 double fRec22[2];
50 double fRec21[3];
51 FAUSTFLOAT fslider7;
52 FAUSTFLOAT *fslider7_;
53 FAUSTFLOAT fslider8;
54 FAUSTFLOAT *fslider8_;
55 double fRec23[2];
56 double fVec6[2];
57 double fRec20[2];
58 double fRec16[2];
59 int iRec17[2];
60 double fRec18[2];
61 FAUSTFLOAT fbargraph1;
62 FAUSTFLOAT *fbargraph1_;
63 double fRec31[2];
64 double fRec30[3];
65 double fRec29[3];
66 FAUSTFLOAT fslider9;
67 FAUSTFLOAT *fslider9_;
68 FAUSTFLOAT fslider10;
69 FAUSTFLOAT *fslider10_;
70 double fRec32[2];
71 double fVec7[2];
72 double fRec28[2];
73 double fRec24[2];
74 int iRec25[2];
75 double fRec26[2];
76 FAUSTFLOAT fbargraph2;
77 FAUSTFLOAT *fbargraph2_;
78 double fRec41[2];
79 double fRec40[3];
80 double fRec39[3];
81 double fRec38[3];
82 FAUSTFLOAT fslider11;
83 FAUSTFLOAT *fslider11_;
84 FAUSTFLOAT fslider12;
85 FAUSTFLOAT *fslider12_;
86 double fRec42[2];
87 double fVec8[2];
88 double fRec37[2];
89 double fRec33[2];
90 int iRec34[2];
91 double fRec35[2];
92 FAUSTFLOAT fbargraph3;
93 FAUSTFLOAT *fbargraph3_;
94 double fRec52[2];
95 double fRec51[3];
96 double fRec50[3];
97 double fRec49[3];
98 double fRec48[3];
99 FAUSTFLOAT fslider13;
100 FAUSTFLOAT *fslider13_;
101 FAUSTFLOAT fslider14;
102 FAUSTFLOAT *fslider14_;
103 double fRec53[2];
104 double fVec9[2];
105 double fRec47[2];
106 double fRec43[2];
107 int iRec44[2];
108 double fRec45[2];
109 FAUSTFLOAT fbargraph4;
110 FAUSTFLOAT *fbargraph4_;
111 void connect(uint32_t port,void* data);
112 void clear_state_f();
113 void init(uint32_t samplingFreq);
114 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
115
116 static void clear_state_f_static(PluginLV2*);
117 static void init_static(uint32_t samplingFreq, PluginLV2*);
118 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
119 static void del_instance(PluginLV2 *p);
120 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
121 public:
122 Dsp();
123 ~Dsp();
124 };
125
126
127
128 Dsp::Dsp()
129 : PluginLV2() {
130 version = PLUGINLV2_VERSION;
131 id = "mbd";
132 name = N_("MultiBand Distortion");
133 mono_audio = compute_static;
134 stereo_audio = 0;
135 set_samplerate = init_static;
136 activate_plugin = 0;
137 connect_ports = connect_static;
138 clear_state = clear_state_f_static;
139 delete_instance = del_instance;
140 }
141
142 Dsp::~Dsp() {
143 }
144
145 inline void Dsp::clear_state_f()
146 {
147 for (int i=0; i<2; i++) iVec0[i] = 0;
148 for (int i=0; i<2; i++) fRec0[i] = 0;
149 for (int i=0; i<2; i++) fRec14[i] = 0;
150 for (int i=0; i<2; i++) fVec1[i] = 0;
151 for (int i=0; i<2; i++) fRec13[i] = 0;
152 for (int i=0; i<3; i++) fRec12[i] = 0;
153 for (int i=0; i<2; i++) fVec2[i] = 0;
154 for (int i=0; i<2; i++) fRec11[i] = 0;
155 for (int i=0; i<3; i++) fRec10[i] = 0;
156 for (int i=0; i<2; i++) fVec3[i] = 0;
157 for (int i=0; i<2; i++) fRec9[i] = 0;
158 for (int i=0; i<3; i++) fRec8[i] = 0;
159 for (int i=0; i<2; i++) fVec4[i] = 0;
160 for (int i=0; i<2; i++) fRec7[i] = 0;
161 for (int i=0; i<3; i++) fRec6[i] = 0;
162 for (int i=0; i<2; i++) fRec15[i] = 0;
163 for (int i=0; i<2; i++) fVec5[i] = 0;
164 for (int i=0; i<2; i++) fRec5[i] = 0;
165 for (int i=0; i<2; i++) fRec1[i] = 0;
166 for (int i=0; i<2; i++) iRec2[i] = 0;
167 for (int i=0; i<2; i++) fRec3[i] = 0;
168 for (int i=0; i<2; i++) fRec22[i] = 0;
169 for (int i=0; i<3; i++) fRec21[i] = 0;
170 for (int i=0; i<2; i++) fRec23[i] = 0;
171 for (int i=0; i<2; i++) fVec6[i] = 0;
172 for (int i=0; i<2; i++) fRec20[i] = 0;
173 for (int i=0; i<2; i++) fRec16[i] = 0;
174 for (int i=0; i<2; i++) iRec17[i] = 0;
175 for (int i=0; i<2; i++) fRec18[i] = 0;
176 for (int i=0; i<2; i++) fRec31[i] = 0;
177 for (int i=0; i<3; i++) fRec30[i] = 0;
178 for (int i=0; i<3; i++) fRec29[i] = 0;
179 for (int i=0; i<2; i++) fRec32[i] = 0;
180 for (int i=0; i<2; i++) fVec7[i] = 0;
181 for (int i=0; i<2; i++) fRec28[i] = 0;
182 for (int i=0; i<2; i++) fRec24[i] = 0;
183 for (int i=0; i<2; i++) iRec25[i] = 0;
184 for (int i=0; i<2; i++) fRec26[i] = 0;
185 for (int i=0; i<2; i++) fRec41[i] = 0;
186 for (int i=0; i<3; i++) fRec40[i] = 0;
187 for (int i=0; i<3; i++) fRec39[i] = 0;
188 for (int i=0; i<3; i++) fRec38[i] = 0;
189 for (int i=0; i<2; i++) fRec42[i] = 0;
190 for (int i=0; i<2; i++) fVec8[i] = 0;
191 for (int i=0; i<2; i++) fRec37[i] = 0;
192 for (int i=0; i<2; i++) fRec33[i] = 0;
193 for (int i=0; i<2; i++) iRec34[i] = 0;
194 for (int i=0; i<2; i++) fRec35[i] = 0;
195 for (int i=0; i<2; i++) fRec52[i] = 0;
196 for (int i=0; i<3; i++) fRec51[i] = 0;
197 for (int i=0; i<3; i++) fRec50[i] = 0;
198 for (int i=0; i<3; i++) fRec49[i] = 0;
199 for (int i=0; i<3; i++) fRec48[i] = 0;
200 for (int i=0; i<2; i++) fRec53[i] = 0;
201 for (int i=0; i<2; i++) fVec9[i] = 0;
202 for (int i=0; i<2; i++) fRec47[i] = 0;
203 for (int i=0; i<2; i++) fRec43[i] = 0;
204 for (int i=0; i<2; i++) iRec44[i] = 0;
205 for (int i=0; i<2; i++) fRec45[i] = 0;
206 }
207
208 void Dsp::clear_state_f_static(PluginLV2 *p)
209 {
210 static_cast<Dsp*>(p)->clear_state_f();
211 }
212
213 inline void Dsp::init(uint32_t samplingFreq)
214 {
215 fSamplingFreq = samplingFreq;
216 iConst0 = min(192000, max(1, fSamplingFreq));
217 fConst1 = (1.0 / double(iConst0));
218 fConst2 = (3.141592653589793 / double(iConst0));
219 clear_state_f();
220 }
221
222 void Dsp::init_static(uint32_t samplingFreq, PluginLV2 *p)
223 {
224 static_cast<Dsp*>(p)->init(samplingFreq);
225 }
226
227 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
228 {
229 #define fslider0 (*fslider0_)
230 #define fslider1 (*fslider1_)
231 #define fslider2 (*fslider2_)
232 #define fslider3 (*fslider3_)
233 #define fslider4 (*fslider4_)
234 #define fslider5 (*fslider5_)
235 #define fslider6 (*fslider6_)
236 #define fbargraph0 (*fbargraph0_)
237 #define fslider7 (*fslider7_)
238 #define fslider8 (*fslider8_)
239 #define fbargraph1 (*fbargraph1_)
240 #define fslider9 (*fslider9_)
241 #define fslider10 (*fslider10_)
242 #define fbargraph2 (*fbargraph2_)
243 #define fslider11 (*fslider11_)
244 #define fslider12 (*fslider12_)
245 #define fbargraph3 (*fbargraph3_)
246 #define fslider13 (*fslider13_)
247 #define fslider14 (*fslider14_)
248 #define fbargraph4 (*fbargraph4_)
249 double fSlow0 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider0))));
250 double fSlow1 = tan((fConst2 * double(fslider1)));
251 double fSlow2 = (1.0 / faustpower<2>(fSlow1));
252 double fSlow3 = (2 * (1 - fSlow2));
253 double fSlow4 = (1.0 / fSlow1);
254 double fSlow5 = (1 + ((fSlow4 - 1.0000000000000004) / fSlow1));
255 double fSlow6 = (1 + ((fSlow4 + 1.0000000000000004) / fSlow1));
256 double fSlow7 = (1.0 / fSlow6);
257 double fSlow8 = tan((fConst2 * double(fslider2)));
258 double fSlow9 = (1.0 / faustpower<2>(fSlow8));
259 double fSlow10 = (2 * (1 - fSlow9));
260 double fSlow11 = (1.0 / fSlow8);
261 double fSlow12 = (1 + ((fSlow11 - 1.0000000000000004) / fSlow8));
262 double fSlow13 = (1 + ((fSlow11 + 1.0000000000000004) / fSlow8));
263 double fSlow14 = (1.0 / fSlow13);
264 double fSlow15 = tan((fConst2 * double(fslider3)));
265 double fSlow16 = (1.0 / faustpower<2>(fSlow15));
266 double fSlow17 = (2 * (1 - fSlow16));
267 double fSlow18 = (1.0 / fSlow15);
268 double fSlow19 = (1 + ((fSlow18 - 1.0000000000000004) / fSlow15));
269 double fSlow20 = (1 + ((fSlow18 + 1.0000000000000004) / fSlow15));
270 double fSlow21 = (1.0 / fSlow20);
271 double fSlow22 = tan((fConst2 * double(fslider4)));
272 double fSlow23 = (1.0 / faustpower<2>(fSlow22));
273 double fSlow24 = (2 * (1 - fSlow23));
274 double fSlow25 = (1.0 / fSlow22);
275 double fSlow26 = (1 + ((fSlow25 - 1.0000000000000004) / fSlow22));
276 double fSlow27 = (1 + ((1.0000000000000004 + fSlow25) / fSlow22));
277 double fSlow28 = (1.0 / fSlow27);
278 double fSlow29 = (1 + fSlow25);
279 double fSlow30 = (1.0 / fSlow29);
280 double fSlow31 = (0 - ((1 - fSlow25) / fSlow29));
281 double fSlow32 = (1 + fSlow18);
282 double fSlow33 = (1.0 / fSlow32);
283 double fSlow34 = (0 - ((1 - fSlow18) / fSlow32));
284 double fSlow35 = (1 + fSlow11);
285 double fSlow36 = (1.0 / fSlow35);
286 double fSlow37 = (0 - ((1 - fSlow11) / fSlow35));
287 double fSlow38 = (1 + fSlow4);
288 double fSlow39 = (1.0 / fSlow38);
289 double fSlow40 = (0 - ((1 - fSlow4) / fSlow38));
290 double fSlow41 = (pow(1e+01,(2 * double(fslider5))) / fSlow6);
291 double fSlow42 = (0.0010000000000000009 * double(fslider6));
292 double fSlow43 = (0 - fSlow4);
293 double fSlow44 = (1.0 / (fSlow1 * fSlow13));
294 double fSlow45 = (2 * (0 - fSlow2));
295 double fSlow46 = (pow(1e+01,(2 * double(fslider7))) / fSlow6);
296 double fSlow47 = (0.0010000000000000009 * double(fslider8));
297 double fSlow48 = (1 + ((fSlow4 - 1.0) / fSlow1));
298 double fSlow49 = (1.0 / (1 + ((1.0 + fSlow4) / fSlow1)));
299 double fSlow50 = (0 - fSlow11);
300 double fSlow51 = (1.0 / (fSlow8 * fSlow20));
301 double fSlow52 = (2 * (0 - fSlow9));
302 double fSlow53 = pow(1e+01,(2 * double(fslider9)));
303 double fSlow54 = (0.0010000000000000009 * double(fslider10));
304 double fSlow55 = (1 + ((fSlow11 - 1.0) / fSlow8));
305 double fSlow56 = (1.0 / (1 + ((1.0 + fSlow11) / fSlow8)));
306 double fSlow57 = (0 - fSlow18);
307 double fSlow58 = (1.0 / (fSlow15 * fSlow27));
308 double fSlow59 = (2 * (0 - fSlow16));
309 double fSlow60 = pow(1e+01,(2 * double(fslider11)));
310 double fSlow61 = (0.0010000000000000009 * double(fslider12));
311 double fSlow62 = (1 + ((fSlow18 - 1.0) / fSlow15));
312 double fSlow63 = (1.0 / (1 + ((1.0 + fSlow18) / fSlow15)));
313 double fSlow64 = (0 - fSlow25);
314 double fSlow65 = (2 * (0 - fSlow23));
315 double fSlow66 = pow(1e+01,(2 * double(fslider13)));
316 double fSlow67 = (0.0010000000000000009 * double(fslider14));
317 for (int i=0; i<count; i++) {
318 iVec0[0] = 1;
319 fRec0[0] = ((0.999 * fRec0[1]) + fSlow0);
320 fRec14[0] = ((1e-20 * (1 - iVec0[1])) - fRec14[1]);
321 double fTemp0 = ((double)input0[i] + fRec14[0]);
322 fVec1[0] = fTemp0;
323 fRec13[0] = ((fSlow31 * fRec13[1]) + (fSlow30 * (fVec1[0] + fVec1[1])));
324 fRec12[0] = (fRec13[0] - (fSlow28 * ((fSlow26 * fRec12[2]) + (fSlow24 * fRec12[1]))));
325 double fTemp1 = (fRec12[2] + (fRec12[0] + (2 * fRec12[1])));
326 double fTemp2 = (fSlow28 * fTemp1);
327 fVec2[0] = fTemp2;
328 fRec11[0] = ((fSlow34 * fRec11[1]) + (fSlow33 * (fVec2[0] + fVec2[1])));
329 fRec10[0] = (fRec11[0] - (fSlow21 * ((fSlow19 * fRec10[2]) + (fSlow17 * fRec10[1]))));
330 double fTemp3 = (fRec10[2] + (fRec10[0] + (2 * fRec10[1])));
331 double fTemp4 = (fSlow21 * fTemp3);
332 fVec3[0] = fTemp4;
333 fRec9[0] = ((fSlow37 * fRec9[1]) + (fSlow36 * (fVec3[0] + fVec3[1])));
334 fRec8[0] = (fRec9[0] - (fSlow14 * ((fSlow12 * fRec8[2]) + (fSlow10 * fRec8[1]))));
335 double fTemp5 = (fRec8[2] + (fRec8[0] + (2 * fRec8[1])));
336 double fTemp6 = (fSlow14 * fTemp5);
337 fVec4[0] = fTemp6;
338 fRec7[0] = ((fSlow40 * fRec7[1]) + (fSlow39 * (fVec4[0] + fVec4[1])));
339 fRec6[0] = (fRec7[0] - (fSlow7 * ((fSlow5 * fRec6[2]) + (fSlow3 * fRec6[1]))));
340 fRec15[0] = (fSlow42 + (0.999 * fRec15[1]));
341 double fTemp7 = max((double)-1, min((double)1, (fRec15[0] + (fSlow41 * (fRec6[2] + (fRec6[0] + (2 * fRec6[1])))))));
342 double fTemp8 = (fTemp7 * (1 - (0.3333333333333333 * faustpower<2>(fTemp7))));
343 fVec5[0] = fTemp8;
344 fRec5[0] = (((0.995 * fRec5[1]) + fVec5[0]) - fVec5[1]);
345 double fRec4 = max(fConst1, fabs(fRec5[0]));
346 int iTemp9 = int((iRec2[1] < 4096));
347 fRec1[0] = ((iTemp9)?max(fRec1[1], fRec4):fRec4);
348 iRec2[0] = ((iTemp9)?(1 + iRec2[1]):1);
349 fRec3[0] = ((iTemp9)?fRec3[1]:fRec1[1]);
350 fbargraph0 = fRec3[0];
351 fRec22[0] = ((fSlow40 * fRec22[1]) + (fSlow39 * ((fSlow44 * fTemp5) + (fSlow43 * fVec4[1]))));
352 fRec21[0] = (fRec22[0] - (fSlow7 * ((fSlow5 * fRec21[2]) + (fSlow3 * fRec21[1]))));
353 fRec23[0] = (fSlow47 + (0.999 * fRec23[1]));
354 double fTemp10 = max((double)-1, min((double)1, (fRec23[0] + (fSlow46 * (((fSlow2 * fRec21[0]) + (fSlow45 * fRec21[1])) + (fSlow2 * fRec21[2]))))));
355 double fTemp11 = (fTemp10 * (1 - (0.3333333333333333 * faustpower<2>(fTemp10))));
356 fVec6[0] = fTemp11;
357 fRec20[0] = (((0.995 * fRec20[1]) + fVec6[0]) - fVec6[1]);
358 double fRec19 = max(fConst1, fabs(fRec20[0]));
359 int iTemp12 = int((iRec17[1] < 4096));
360 fRec16[0] = ((iTemp12)?max(fRec16[1], fRec19):fRec19);
361 iRec17[0] = ((iTemp12)?(1 + iRec17[1]):1);
362 fRec18[0] = ((iTemp12)?fRec18[1]:fRec16[1]);
363 fbargraph1 = fRec18[0];
364 double fTemp13 = (fSlow3 * fRec29[1]);
365 fRec31[0] = ((fSlow37 * fRec31[1]) + (fSlow36 * ((fSlow51 * fTemp3) + (fSlow50 * fVec3[1]))));
366 fRec30[0] = (fRec31[0] - (fSlow14 * ((fSlow12 * fRec30[2]) + (fSlow10 * fRec30[1]))));
367 fRec29[0] = ((fSlow14 * (((fSlow9 * fRec30[0]) + (fSlow52 * fRec30[1])) + (fSlow9 * fRec30[2]))) - (fSlow49 * ((fSlow48 * fRec29[2]) + fTemp13)));
368 fRec32[0] = (fSlow54 + (0.999 * fRec32[1]));
369 double fTemp14 = max((double)-1, min((double)1, (fRec32[0] + (fSlow53 * (fRec29[2] + (fSlow49 * (fTemp13 + (fSlow48 * fRec29[0]))))))));
370 double fTemp15 = (fTemp14 * (1 - (0.3333333333333333 * faustpower<2>(fTemp14))));
371 fVec7[0] = fTemp15;
372 fRec28[0] = (((0.995 * fRec28[1]) + fVec7[0]) - fVec7[1]);
373 double fRec27 = max(fConst1, fabs(fRec28[0]));
374 int iTemp16 = int((iRec25[1] < 4096));
375 fRec24[0] = ((iTemp16)?max(fRec24[1], fRec27):fRec27);
376 iRec25[0] = ((iTemp16)?(1 + iRec25[1]):1);
377 fRec26[0] = ((iTemp16)?fRec26[1]:fRec24[1]);
378 fbargraph2 = fRec26[0];
379 double fTemp17 = (fSlow3 * fRec38[1]);
380 double fTemp18 = (fSlow10 * fRec39[1]);
381 fRec41[0] = ((fSlow34 * fRec41[1]) + (fSlow33 * ((fSlow58 * fTemp1) + (fSlow57 * fVec2[1]))));
382 fRec40[0] = (fRec41[0] - (fSlow21 * ((fSlow19 * fRec40[2]) + (fSlow17 * fRec40[1]))));
383 fRec39[0] = ((fSlow21 * (((fSlow16 * fRec40[0]) + (fSlow59 * fRec40[1])) + (fSlow16 * fRec40[2]))) - (fSlow56 * ((fSlow55 * fRec39[2]) + fTemp18)));
384 fRec38[0] = ((fRec39[2] + (fSlow56 * (fTemp18 + (fSlow55 * fRec39[0])))) - (fSlow49 * ((fSlow48 * fRec38[2]) + fTemp17)));
385 fRec42[0] = (fSlow61 + (0.999 * fRec42[1]));
386 double fTemp19 = max((double)-1, min((double)1, (fRec42[0] + (fSlow60 * (fRec38[2] + (fSlow49 * (fTemp17 + (fSlow48 * fRec38[0]))))))));
387 double fTemp20 = (fTemp19 * (1 - (0.3333333333333333 * faustpower<2>(fTemp19))));
388 fVec8[0] = fTemp20;
389 fRec37[0] = (((0.995 * fRec37[1]) + fVec8[0]) - fVec8[1]);
390 double fRec36 = max(fConst1, fabs(fRec37[0]));
391 int iTemp21 = int((iRec34[1] < 4096));
392 fRec33[0] = ((iTemp21)?max(fRec33[1], fRec36):fRec36);
393 iRec34[0] = ((iTemp21)?(1 + iRec34[1]):1);
394 fRec35[0] = ((iTemp21)?fRec35[1]:fRec33[1]);
395 fbargraph3 = fRec35[0];
396 double fTemp22 = (fSlow3 * fRec48[1]);
397 double fTemp23 = (fSlow10 * fRec49[1]);
398 double fTemp24 = (fSlow17 * fRec50[1]);
399 fRec52[0] = ((fSlow31 * fRec52[1]) + (fSlow30 * ((fSlow25 * fVec1[0]) + (fSlow64 * fVec1[1]))));
400 fRec51[0] = (fRec52[0] - (fSlow28 * ((fSlow26 * fRec51[2]) + (fSlow24 * fRec51[1]))));
401 fRec50[0] = ((fSlow28 * (((fSlow23 * fRec51[0]) + (fSlow65 * fRec51[1])) + (fSlow23 * fRec51[2]))) - (fSlow63 * ((fSlow62 * fRec50[2]) + fTemp24)));
402 fRec49[0] = ((fRec50[2] + (fSlow63 * (fTemp24 + (fSlow62 * fRec50[0])))) - (fSlow56 * ((fSlow55 * fRec49[2]) + fTemp23)));
403 fRec48[0] = ((fRec49[2] + (fSlow56 * (fTemp23 + (fSlow55 * fRec49[0])))) - (fSlow49 * ((fSlow48 * fRec48[2]) + fTemp22)));
404 fRec53[0] = (fSlow67 + (0.999 * fRec53[1]));
405 double fTemp25 = max((double)-1, min((double)1, (fRec53[0] + (fSlow66 * (fRec48[2] + (fSlow49 * (fTemp22 + (fSlow48 * fRec48[0]))))))));
406 double fTemp26 = (fTemp25 * (1 - (0.3333333333333333 * faustpower<2>(fTemp25))));
407 fVec9[0] = fTemp26;
408 fRec47[0] = (((0.995 * fRec47[1]) + fVec9[0]) - fVec9[1]);
409 double fRec46 = max(fConst1, fabs(fRec47[0]));
410 int iTemp27 = int((iRec44[1] < 4096));
411 fRec43[0] = ((iTemp27)?max(fRec43[1], fRec46):fRec46);
412 iRec44[0] = ((iTemp27)?(1 + iRec44[1]):1);
413 fRec45[0] = ((iTemp27)?fRec45[1]:fRec43[1]);
414 fbargraph4 = fRec45[0];
415 output0[i] = (FAUSTFLOAT)(((((fRec47[0] + fRec37[0]) + fRec28[0]) + fRec20[0]) + fRec5[0]) * fRec0[0]);
416 // post processing
417 fRec45[1] = fRec45[0];
418 iRec44[1] = iRec44[0];
419 fRec43[1] = fRec43[0];
420 fRec47[1] = fRec47[0];
421 fVec9[1] = fVec9[0];
422 fRec53[1] = fRec53[0];
423 fRec48[2] = fRec48[1]; fRec48[1] = fRec48[0];
424 fRec49[2] = fRec49[1]; fRec49[1] = fRec49[0];
425 fRec50[2] = fRec50[1]; fRec50[1] = fRec50[0];
426 fRec51[2] = fRec51[1]; fRec51[1] = fRec51[0];
427 fRec52[1] = fRec52[0];
428 fRec35[1] = fRec35[0];
429 iRec34[1] = iRec34[0];
430 fRec33[1] = fRec33[0];
431 fRec37[1] = fRec37[0];
432 fVec8[1] = fVec8[0];
433 fRec42[1] = fRec42[0];
434 fRec38[2] = fRec38[1]; fRec38[1] = fRec38[0];
435 fRec39[2] = fRec39[1]; fRec39[1] = fRec39[0];
436 fRec40[2] = fRec40[1]; fRec40[1] = fRec40[0];
437 fRec41[1] = fRec41[0];
438 fRec26[1] = fRec26[0];
439 iRec25[1] = iRec25[0];
440 fRec24[1] = fRec24[0];
441 fRec28[1] = fRec28[0];
442 fVec7[1] = fVec7[0];
443 fRec32[1] = fRec32[0];
444 fRec29[2] = fRec29[1]; fRec29[1] = fRec29[0];
445 fRec30[2] = fRec30[1]; fRec30[1] = fRec30[0];
446 fRec31[1] = fRec31[0];
447 fRec18[1] = fRec18[0];
448 iRec17[1] = iRec17[0];
449 fRec16[1] = fRec16[0];
450 fRec20[1] = fRec20[0];
451 fVec6[1] = fVec6[0];
452 fRec23[1] = fRec23[0];
453 fRec21[2] = fRec21[1]; fRec21[1] = fRec21[0];
454 fRec22[1] = fRec22[0];
455 fRec3[1] = fRec3[0];
456 iRec2[1] = iRec2[0];
457 fRec1[1] = fRec1[0];
458 fRec5[1] = fRec5[0];
459 fVec5[1] = fVec5[0];
460 fRec15[1] = fRec15[0];
461 fRec6[2] = fRec6[1]; fRec6[1] = fRec6[0];
462 fRec7[1] = fRec7[0];
463 fVec4[1] = fVec4[0];
464 fRec8[2] = fRec8[1]; fRec8[1] = fRec8[0];
465 fRec9[1] = fRec9[0];
466 fVec3[1] = fVec3[0];
467 fRec10[2] = fRec10[1]; fRec10[1] = fRec10[0];
468 fRec11[1] = fRec11[0];
469 fVec2[1] = fVec2[0];
470 fRec12[2] = fRec12[1]; fRec12[1] = fRec12[0];
471 fRec13[1] = fRec13[0];
472 fVec1[1] = fVec1[0];
473 fRec14[1] = fRec14[0];
474 fRec0[1] = fRec0[0];
475 iVec0[1] = iVec0[0];
476 }
477 #undef fslider0
478 #undef fslider1
479 #undef fslider2
480 #undef fslider3
481 #undef fslider4
482 #undef fslider5
483 #undef fslider6
484 #undef fbargraph0
485 #undef fslider7
486 #undef fslider8
487 #undef fbargraph1
488 #undef fslider9
489 #undef fslider10
490 #undef fbargraph2
491 #undef fslider11
492 #undef fslider12
493 #undef fbargraph3
494 #undef fslider13
495 #undef fslider14
496 #undef fbargraph4
497 }
498
499 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
500 {
501 static_cast<Dsp*>(p)->compute(count, input0, output0);
502 }
503
504
505 void Dsp::connect(uint32_t port,void* data)
506 {
507 switch ((PortIndex)port)
508 {
509 case DRIVE1:
510 fslider5_ = (float*)data; // , 0.0, 0.0, 1.0, 0.01
511 break;
512 case DRIVE2:
513 fslider7_ = (float*)data; // , 0.0, 0.0, 1.0, 0.01
514 break;
515 case DRIVE3:
516 fslider9_ = (float*)data; // , 0.0, 0.0, 1.0, 0.01
517 break;
518 case DRIVE4:
519 fslider11_ = (float*)data; // , 0.0, 0.0, 1.0, 0.01
520 break;
521 case DRIVE5:
522 fslider13_ = (float*)data; // , 0.0, 0.0, 1.0, 0.01
523 break;
524 case GAIN:
525 fslider0_ = (float*)data; // , 0.0, -4e+01, 4.0, 0.1
526 break;
527 case OFFSET1:
528 fslider6_ = (float*)data; // , 0.0, 0.0, 0.5, 0.01
529 break;
530 case OFFSET2:
531 fslider8_ = (float*)data; // , 0.0, 0.0, 0.5, 0.01
532 break;
533 case OFFSET3:
534 fslider10_ = (float*)data; // , 0.0, 0.0, 0.5, 0.01
535 break;
536 case OFFSET4:
537 fslider12_ = (float*)data; // , 0.0, 0.0, 0.5, 0.01
538 break;
539 case OFFSET5:
540 fslider14_ = (float*)data; // , 0.0, 0.0, 0.5, 0.01
541 break;
542 case CROSSOVER_B1_B2:
543 fslider1_ = (float*)data; // , 8e+01, 2e+01, 2e+04, 1.08
544 break;
545 case CROSSOVER_B2_B3:
546 fslider2_ = (float*)data; // , 2.1e+02, 2e+01, 2e+04, 1.08
547 break;
548 case CROSSOVER_B3_B4:
549 fslider3_ = (float*)data; // , 1.7e+03, 2e+01, 2e+04, 1.08
550 break;
551 case CROSSOVER_B4_B5:
552 fslider4_ = (float*)data; // , 5e+03, 2e+01, 2e+04, 1.08
553 break;
554 case V1:
555 fbargraph0_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
556 break;
557 case V2:
558 fbargraph1_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
559 break;
560 case V3:
561 fbargraph2_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
562 break;
563 case V4:
564 fbargraph3_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
565 break;
566 case V5:
567 fbargraph4_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
568 break;
569 default:
570 break;
571 }
572 }
573
574 void Dsp::connect_static(uint32_t port,void* data, PluginLV2 *p)
575 {
576 static_cast<Dsp*>(p)->connect(port, data);
577 }
578
579
580 PluginLV2 *plugin() {
581 return new Dsp();
582 }
583
584 void Dsp::del_instance(PluginLV2 *p)
585 {
586 delete static_cast<Dsp*>(p);
587 }
588
589 /*
590 typedef enum
591 {
592 DRIVE1,
593 DRIVE2,
594 DRIVE3,
595 DRIVE4,
596 DRIVE5,
597 GAIN,
598 OFFSET1,
599 OFFSET2,
600 OFFSET3,
601 OFFSET4,
602 OFFSET5,
603 CROSSOVER_B1_B2,
604 CROSSOVER_B2_B3,
605 CROSSOVER_B3_B4,
606 CROSSOVER_B4_B5,
607 V1,
608 V2,
609 V3,
610 V4,
611 V5,
612 } PortIndex;
613 */
614
615 } // end namespace mbd
0 // generated from file '../src/LV2/faust/mbdel.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.65 (http://faust.grame.fr)
2
3
4 namespace mbdel {
5
6 class Dsp: public PluginLV2 {
7 private:
8 uint32_t fSamplingFreq;
9 int iConst0;
10 double fConst1;
11 FAUSTFLOAT fslider0;
12 FAUSTFLOAT *fslider0_;
13 double fConst2;
14 FAUSTFLOAT fslider1;
15 FAUSTFLOAT *fslider1_;
16 FAUSTFLOAT fslider2;
17 FAUSTFLOAT *fslider2_;
18 FAUSTFLOAT fslider3;
19 FAUSTFLOAT *fslider3_;
20 double fVec0[2];
21 double fRec8[2];
22 double fRec7[3];
23 double fRec6[3];
24 double fRec5[3];
25 double fRec4[3];
26 FAUSTFLOAT fslider4;
27 FAUSTFLOAT *fslider4_;
28 double fRec9[2];
29 int IOTA;
30 double *fVec1;
31 double fConst3;
32 double fConst4;
33 FAUSTFLOAT fslider5;
34 FAUSTFLOAT *fslider5_;
35 int iConst5;
36 double fRec10[2];
37 double fRec11[2];
38 double fRec12[2];
39 double fRec13[2];
40 double fRec0[2];
41 int iRec1[2];
42 double fRec2[2];
43 FAUSTFLOAT fbargraph0;
44 FAUSTFLOAT *fbargraph0_;
45 double fRec23[2];
46 double fRec22[3];
47 double fVec2[2];
48 double fRec21[2];
49 double fRec20[3];
50 double fRec19[3];
51 double fRec18[3];
52 FAUSTFLOAT fslider6;
53 FAUSTFLOAT *fslider6_;
54 double fRec24[2];
55 double *fVec3;
56 FAUSTFLOAT fslider7;
57 FAUSTFLOAT *fslider7_;
58 double fRec25[2];
59 double fRec26[2];
60 double fRec27[2];
61 double fRec28[2];
62 double fRec14[2];
63 int iRec15[2];
64 double fRec16[2];
65 FAUSTFLOAT fbargraph1;
66 FAUSTFLOAT *fbargraph1_;
67 double fRec37[2];
68 double fRec36[3];
69 double fVec4[2];
70 double fRec35[2];
71 double fRec34[3];
72 double fRec33[3];
73 FAUSTFLOAT fslider8;
74 FAUSTFLOAT *fslider8_;
75 double fRec38[2];
76 double *fVec5;
77 FAUSTFLOAT fslider9;
78 FAUSTFLOAT *fslider9_;
79 double fRec39[2];
80 double fRec40[2];
81 double fRec41[2];
82 double fRec42[2];
83 double fRec29[2];
84 int iRec30[2];
85 double fRec31[2];
86 FAUSTFLOAT fbargraph2;
87 FAUSTFLOAT *fbargraph2_;
88 double fRec50[2];
89 double fRec49[3];
90 double fVec6[2];
91 double fRec48[2];
92 double fRec47[3];
93 FAUSTFLOAT fslider10;
94 FAUSTFLOAT *fslider10_;
95 double fRec51[2];
96 double *fVec7;
97 FAUSTFLOAT fslider11;
98 FAUSTFLOAT *fslider11_;
99 double fRec52[2];
100 double fRec53[2];
101 double fRec54[2];
102 double fRec55[2];
103 double fRec43[2];
104 int iRec44[2];
105 double fRec45[2];
106 FAUSTFLOAT fbargraph3;
107 FAUSTFLOAT *fbargraph3_;
108 double fRec61[2];
109 double fRec60[3];
110 FAUSTFLOAT fslider12;
111 FAUSTFLOAT *fslider12_;
112 double fRec62[2];
113 double *fVec8;
114 FAUSTFLOAT fslider13;
115 FAUSTFLOAT *fslider13_;
116 double fRec63[2];
117 double fRec64[2];
118 double fRec65[2];
119 double fRec66[2];
120 double fRec56[2];
121 int iRec57[2];
122 double fRec58[2];
123 FAUSTFLOAT fbargraph4;
124 FAUSTFLOAT *fbargraph4_;
125 bool mem_allocated;
126 void mem_alloc();
127 void mem_free();
128 void connect(uint32_t port,void* data);
129 void clear_state_f();
130 int activate(bool start);
131 void init(uint32_t samplingFreq);
132 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
133
134 static void clear_state_f_static(PluginLV2*);
135 static int activate_static(bool start, PluginLV2*);
136 static void init_static(uint32_t samplingFreq, PluginLV2*);
137 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
138 static void del_instance(PluginLV2 *p);
139 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
140 public:
141 Dsp();
142 ~Dsp();
143 };
144
145
146
147 Dsp::Dsp()
148 : PluginLV2(),
149 fVec1(0),
150 fVec3(0),
151 fVec5(0),
152 fVec7(0),
153 fVec8(0),
154 mem_allocated(false) {
155 version = PLUGINLV2_VERSION;
156 id = "mbdel";
157 name = N_("MultiBand Delay");
158 mono_audio = compute_static;
159 stereo_audio = 0;
160 set_samplerate = init_static;
161 activate_plugin = activate_static;
162 connect_ports = connect_static;
163 clear_state = clear_state_f_static;
164 delete_instance = del_instance;
165 }
166
167 Dsp::~Dsp() {
168 }
169
170 inline void Dsp::clear_state_f()
171 {
172 for (int i=0; i<2; i++) fVec0[i] = 0;
173 for (int i=0; i<2; i++) fRec8[i] = 0;
174 for (int i=0; i<3; i++) fRec7[i] = 0;
175 for (int i=0; i<3; i++) fRec6[i] = 0;
176 for (int i=0; i<3; i++) fRec5[i] = 0;
177 for (int i=0; i<3; i++) fRec4[i] = 0;
178 for (int i=0; i<2; i++) fRec9[i] = 0;
179 for (int i=0; i<262144; i++) fVec1[i] = 0;
180 for (int i=0; i<2; i++) fRec10[i] = 0;
181 for (int i=0; i<2; i++) fRec11[i] = 0;
182 for (int i=0; i<2; i++) fRec12[i] = 0;
183 for (int i=0; i<2; i++) fRec13[i] = 0;
184 for (int i=0; i<2; i++) fRec0[i] = 0;
185 for (int i=0; i<2; i++) iRec1[i] = 0;
186 for (int i=0; i<2; i++) fRec2[i] = 0;
187 for (int i=0; i<2; i++) fRec23[i] = 0;
188 for (int i=0; i<3; i++) fRec22[i] = 0;
189 for (int i=0; i<2; i++) fVec2[i] = 0;
190 for (int i=0; i<2; i++) fRec21[i] = 0;
191 for (int i=0; i<3; i++) fRec20[i] = 0;
192 for (int i=0; i<3; i++) fRec19[i] = 0;
193 for (int i=0; i<3; i++) fRec18[i] = 0;
194 for (int i=0; i<2; i++) fRec24[i] = 0;
195 for (int i=0; i<262144; i++) fVec3[i] = 0;
196 for (int i=0; i<2; i++) fRec25[i] = 0;
197 for (int i=0; i<2; i++) fRec26[i] = 0;
198 for (int i=0; i<2; i++) fRec27[i] = 0;
199 for (int i=0; i<2; i++) fRec28[i] = 0;
200 for (int i=0; i<2; i++) fRec14[i] = 0;
201 for (int i=0; i<2; i++) iRec15[i] = 0;
202 for (int i=0; i<2; i++) fRec16[i] = 0;
203 for (int i=0; i<2; i++) fRec37[i] = 0;
204 for (int i=0; i<3; i++) fRec36[i] = 0;
205 for (int i=0; i<2; i++) fVec4[i] = 0;
206 for (int i=0; i<2; i++) fRec35[i] = 0;
207 for (int i=0; i<3; i++) fRec34[i] = 0;
208 for (int i=0; i<3; i++) fRec33[i] = 0;
209 for (int i=0; i<2; i++) fRec38[i] = 0;
210 for (int i=0; i<262144; i++) fVec5[i] = 0;
211 for (int i=0; i<2; i++) fRec39[i] = 0;
212 for (int i=0; i<2; i++) fRec40[i] = 0;
213 for (int i=0; i<2; i++) fRec41[i] = 0;
214 for (int i=0; i<2; i++) fRec42[i] = 0;
215 for (int i=0; i<2; i++) fRec29[i] = 0;
216 for (int i=0; i<2; i++) iRec30[i] = 0;
217 for (int i=0; i<2; i++) fRec31[i] = 0;
218 for (int i=0; i<2; i++) fRec50[i] = 0;
219 for (int i=0; i<3; i++) fRec49[i] = 0;
220 for (int i=0; i<2; i++) fVec6[i] = 0;
221 for (int i=0; i<2; i++) fRec48[i] = 0;
222 for (int i=0; i<3; i++) fRec47[i] = 0;
223 for (int i=0; i<2; i++) fRec51[i] = 0;
224 for (int i=0; i<262144; i++) fVec7[i] = 0;
225 for (int i=0; i<2; i++) fRec52[i] = 0;
226 for (int i=0; i<2; i++) fRec53[i] = 0;
227 for (int i=0; i<2; i++) fRec54[i] = 0;
228 for (int i=0; i<2; i++) fRec55[i] = 0;
229 for (int i=0; i<2; i++) fRec43[i] = 0;
230 for (int i=0; i<2; i++) iRec44[i] = 0;
231 for (int i=0; i<2; i++) fRec45[i] = 0;
232 for (int i=0; i<2; i++) fRec61[i] = 0;
233 for (int i=0; i<3; i++) fRec60[i] = 0;
234 for (int i=0; i<2; i++) fRec62[i] = 0;
235 for (int i=0; i<262144; i++) fVec8[i] = 0;
236 for (int i=0; i<2; i++) fRec63[i] = 0;
237 for (int i=0; i<2; i++) fRec64[i] = 0;
238 for (int i=0; i<2; i++) fRec65[i] = 0;
239 for (int i=0; i<2; i++) fRec66[i] = 0;
240 for (int i=0; i<2; i++) fRec56[i] = 0;
241 for (int i=0; i<2; i++) iRec57[i] = 0;
242 for (int i=0; i<2; i++) fRec58[i] = 0;
243 }
244
245 void Dsp::clear_state_f_static(PluginLV2 *p)
246 {
247 static_cast<Dsp*>(p)->clear_state_f();
248 }
249
250 inline void Dsp::init(uint32_t samplingFreq)
251 {
252 fSamplingFreq = samplingFreq;
253 iConst0 = min(192000, max(1, fSamplingFreq));
254 fConst1 = (1.0 / double(iConst0));
255 fConst2 = (3.141592653589793 / double(iConst0));
256 IOTA = 0;
257 fConst3 = (1e+01 / double(iConst0));
258 fConst4 = (0 - fConst3);
259 iConst5 = (60 * iConst0);
260 }
261
262 void Dsp::init_static(uint32_t samplingFreq, PluginLV2 *p)
263 {
264 static_cast<Dsp*>(p)->init(samplingFreq);
265 }
266
267 void Dsp::mem_alloc()
268 {
269 if (!fVec1) fVec1 = new double[262144];
270 if (!fVec3) fVec3 = new double[262144];
271 if (!fVec5) fVec5 = new double[262144];
272 if (!fVec7) fVec7 = new double[262144];
273 if (!fVec8) fVec8 = new double[262144];
274 mem_allocated = true;
275 }
276
277 void Dsp::mem_free()
278 {
279 mem_allocated = false;
280 if (fVec1) { delete fVec1; fVec1 = 0; }
281 if (fVec3) { delete fVec3; fVec3 = 0; }
282 if (fVec5) { delete fVec5; fVec5 = 0; }
283 if (fVec7) { delete fVec7; fVec7 = 0; }
284 if (fVec8) { delete fVec8; fVec8 = 0; }
285 }
286
287 int Dsp::activate(bool start)
288 {
289 if (start) {
290 if (!mem_allocated) {
291 mem_alloc();
292 clear_state_f();
293 }
294 } else if (mem_allocated) {
295 mem_free();
296 }
297 return 0;
298 }
299
300 int Dsp::activate_static(bool start, PluginLV2 *p)
301 {
302 return static_cast<Dsp*>(p)->activate(start);
303 }
304
305 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
306 {
307 #define fslider0 (*fslider0_)
308 #define fslider1 (*fslider1_)
309 #define fslider2 (*fslider2_)
310 #define fslider3 (*fslider3_)
311 #define fslider4 (*fslider4_)
312 #define fslider5 (*fslider5_)
313 #define fbargraph0 (*fbargraph0_)
314 #define fslider6 (*fslider6_)
315 #define fslider7 (*fslider7_)
316 #define fbargraph1 (*fbargraph1_)
317 #define fslider8 (*fslider8_)
318 #define fslider9 (*fslider9_)
319 #define fbargraph2 (*fbargraph2_)
320 #define fslider10 (*fslider10_)
321 #define fslider11 (*fslider11_)
322 #define fbargraph3 (*fbargraph3_)
323 #define fslider12 (*fslider12_)
324 #define fslider13 (*fslider13_)
325 #define fbargraph4 (*fbargraph4_)
326 double fSlow0 = tan((fConst2 * double(fslider0)));
327 double fSlow1 = (1.0 / faustpower<2>(fSlow0));
328 double fSlow2 = (2 * (1 - fSlow1));
329 double fSlow3 = (1.0 / fSlow0);
330 double fSlow4 = (1 + ((fSlow3 - 1.0) / fSlow0));
331 double fSlow5 = (1.0 / (1 + ((1.0 + fSlow3) / fSlow0)));
332 double fSlow6 = tan((fConst2 * double(fslider1)));
333 double fSlow7 = (1.0 / faustpower<2>(fSlow6));
334 double fSlow8 = (2 * (1 - fSlow7));
335 double fSlow9 = (1.0 / fSlow6);
336 double fSlow10 = (1 + ((fSlow9 - 1.0) / fSlow6));
337 double fSlow11 = (1.0 / (1 + ((1.0 + fSlow9) / fSlow6)));
338 double fSlow12 = tan((fConst2 * double(fslider2)));
339 double fSlow13 = (1.0 / faustpower<2>(fSlow12));
340 double fSlow14 = (2 * (1 - fSlow13));
341 double fSlow15 = (1.0 / fSlow12);
342 double fSlow16 = (1 + ((fSlow15 - 1.0) / fSlow12));
343 double fSlow17 = (1.0 / (1 + ((1.0 + fSlow15) / fSlow12)));
344 double fSlow18 = tan((fConst2 * double(fslider3)));
345 double fSlow19 = (1.0 / faustpower<2>(fSlow18));
346 double fSlow20 = (2 * (1 - fSlow19));
347 double fSlow21 = (1.0 / fSlow18);
348 double fSlow22 = (1 + ((fSlow21 - 1.0000000000000004) / fSlow18));
349 double fSlow23 = (1 + ((1.0000000000000004 + fSlow21) / fSlow18));
350 double fSlow24 = (1.0 / fSlow23);
351 double fSlow25 = (0 - fSlow21);
352 double fSlow26 = (1 + fSlow21);
353 double fSlow27 = (1.0 / fSlow26);
354 double fSlow28 = (0 - ((1 - fSlow21) / fSlow26));
355 double fSlow29 = (2 * (0 - fSlow19));
356 double fSlow30 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider4))));
357 double fSlow31 = (double(iConst5) / double(fslider5));
358 double fSlow32 = (1 + ((fSlow15 - 1.0000000000000004) / fSlow12));
359 double fSlow33 = (1 + ((fSlow15 + 1.0000000000000004) / fSlow12));
360 double fSlow34 = (1.0 / fSlow33);
361 double fSlow35 = (0 - fSlow15);
362 double fSlow36 = (1.0 / (fSlow12 * fSlow23));
363 double fSlow37 = (1 + fSlow15);
364 double fSlow38 = (1.0 / fSlow37);
365 double fSlow39 = (0 - ((1 - fSlow15) / fSlow37));
366 double fSlow40 = (2 * (0 - fSlow13));
367 double fSlow41 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider6))));
368 double fSlow42 = (double(iConst5) / double(fslider7));
369 double fSlow43 = (1 + ((fSlow9 - 1.0000000000000004) / fSlow6));
370 double fSlow44 = (1 + ((fSlow9 + 1.0000000000000004) / fSlow6));
371 double fSlow45 = (1.0 / fSlow44);
372 double fSlow46 = (0 - fSlow9);
373 double fSlow47 = (1.0 / (fSlow6 * fSlow33));
374 double fSlow48 = (1 + fSlow9);
375 double fSlow49 = (1.0 / fSlow48);
376 double fSlow50 = (0 - ((1 - fSlow9) / fSlow48));
377 double fSlow51 = (2 * (0 - fSlow7));
378 double fSlow52 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider8))));
379 double fSlow53 = (double(iConst5) / double(fslider9));
380 double fSlow54 = (1 + ((fSlow3 - 1.0000000000000004) / fSlow0));
381 double fSlow55 = (1.0 / (1 + ((fSlow3 + 1.0000000000000004) / fSlow0)));
382 double fSlow56 = (0 - fSlow3);
383 double fSlow57 = (1.0 / (fSlow0 * fSlow44));
384 double fSlow58 = (1 + fSlow3);
385 double fSlow59 = (1.0 / fSlow58);
386 double fSlow60 = (0 - ((1 - fSlow3) / fSlow58));
387 double fSlow61 = (2 * (0 - fSlow1));
388 double fSlow62 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider10))));
389 double fSlow63 = (double(iConst5) / double(fslider11));
390 double fSlow64 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider12))));
391 double fSlow65 = (double(iConst5) / double(fslider13));
392 for (int i=0; i<count; i++) {
393 double fTemp0 = (fSlow2 * fRec4[1]);
394 double fTemp1 = (fSlow8 * fRec5[1]);
395 double fTemp2 = (fSlow14 * fRec6[1]);
396 double fTemp3 = (double)input0[i];
397 fVec0[0] = fTemp3;
398 fRec8[0] = ((fSlow28 * fRec8[1]) + (fSlow27 * ((fSlow21 * fVec0[0]) + (fSlow25 * fVec0[1]))));
399 fRec7[0] = (fRec8[0] - (fSlow24 * ((fSlow22 * fRec7[2]) + (fSlow20 * fRec7[1]))));
400 fRec6[0] = ((fSlow24 * (((fSlow19 * fRec7[0]) + (fSlow29 * fRec7[1])) + (fSlow19 * fRec7[2]))) - (fSlow17 * ((fSlow16 * fRec6[2]) + fTemp2)));
401 fRec5[0] = ((fRec6[2] + (fSlow17 * (fTemp2 + (fSlow16 * fRec6[0])))) - (fSlow11 * ((fSlow10 * fRec5[2]) + fTemp1)));
402 fRec4[0] = ((fRec5[2] + (fSlow11 * (fTemp1 + (fSlow10 * fRec5[0])))) - (fSlow5 * ((fSlow4 * fRec4[2]) + fTemp0)));
403 fRec9[0] = (fSlow30 + (0.999 * fRec9[1]));
404 double fTemp4 = (fRec9[0] * (fRec4[2] + (fSlow5 * (fTemp0 + (fSlow4 * fRec4[0])))));
405 fVec1[IOTA&262143] = fTemp4;
406 double fTemp5 = ((int((fRec10[1] != 0.0)))?((int(((fRec11[1] > 0.0) & (fRec11[1] < 1.0))))?fRec10[1]:0):((int(((fRec11[1] == 0.0) & (fSlow31 != fRec12[1]))))?fConst3:((int(((fRec11[1] == 1.0) & (fSlow31 != fRec13[1]))))?fConst4:0)));
407 fRec10[0] = fTemp5;
408 fRec11[0] = max(0.0, min(1.0, (fRec11[1] + fTemp5)));
409 fRec12[0] = ((int(((fRec11[1] >= 1.0) & (fRec13[1] != fSlow31))))?fSlow31:fRec12[1]);
410 fRec13[0] = ((int(((fRec11[1] <= 0.0) & (fRec12[1] != fSlow31))))?fSlow31:fRec13[1]);
411 double fTemp6 = (((1.0 - fRec11[0]) * fVec1[(IOTA-int((int(fRec12[0]) & 262143)))&262143]) + (fRec11[0] * fVec1[(IOTA-int((int(fRec13[0]) & 262143)))&262143]));
412 double fRec3 = max(fConst1, fabs(fTemp6));
413 int iTemp7 = int((iRec1[1] < 4096));
414 fRec0[0] = ((iTemp7)?max(fRec0[1], fRec3):fRec3);
415 iRec1[0] = ((iTemp7)?(1 + iRec1[1]):1);
416 fRec2[0] = ((iTemp7)?fRec2[1]:fRec0[1]);
417 fbargraph0 = fRec2[0];
418 double fTemp8 = (fSlow2 * fRec18[1]);
419 double fTemp9 = (fSlow8 * fRec19[1]);
420 fRec23[0] = ((fSlow28 * fRec23[1]) + (fSlow27 * (fVec0[0] + fVec0[1])));
421 fRec22[0] = (fRec23[0] - (fSlow24 * ((fSlow22 * fRec22[2]) + (fSlow20 * fRec22[1]))));
422 double fTemp10 = (fRec22[2] + (fRec22[0] + (2 * fRec22[1])));
423 double fTemp11 = (fSlow24 * fTemp10);
424 fVec2[0] = fTemp11;
425 fRec21[0] = ((fSlow39 * fRec21[1]) + (fSlow38 * ((fSlow36 * fTemp10) + (fSlow35 * fVec2[1]))));
426 fRec20[0] = (fRec21[0] - (fSlow34 * ((fSlow32 * fRec20[2]) + (fSlow14 * fRec20[1]))));
427 fRec19[0] = ((fSlow34 * (((fSlow13 * fRec20[0]) + (fSlow40 * fRec20[1])) + (fSlow13 * fRec20[2]))) - (fSlow11 * ((fSlow10 * fRec19[2]) + fTemp9)));
428 fRec18[0] = ((fRec19[2] + (fSlow11 * (fTemp9 + (fSlow10 * fRec19[0])))) - (fSlow5 * ((fSlow4 * fRec18[2]) + fTemp8)));
429 fRec24[0] = (fSlow41 + (0.999 * fRec24[1]));
430 double fTemp12 = (fRec24[0] * (fRec18[2] + (fSlow5 * (fTemp8 + (fSlow4 * fRec18[0])))));
431 fVec3[IOTA&262143] = fTemp12;
432 double fTemp13 = ((int((fRec25[1] != 0.0)))?((int(((fRec26[1] > 0.0) & (fRec26[1] < 1.0))))?fRec25[1]:0):((int(((fRec26[1] == 0.0) & (fSlow42 != fRec27[1]))))?fConst3:((int(((fRec26[1] == 1.0) & (fSlow42 != fRec28[1]))))?fConst4:0)));
433 fRec25[0] = fTemp13;
434 fRec26[0] = max(0.0, min(1.0, (fRec26[1] + fTemp13)));
435 fRec27[0] = ((int(((fRec26[1] >= 1.0) & (fRec28[1] != fSlow42))))?fSlow42:fRec27[1]);
436 fRec28[0] = ((int(((fRec26[1] <= 0.0) & (fRec27[1] != fSlow42))))?fSlow42:fRec28[1]);
437 double fTemp14 = (((1.0 - fRec26[0]) * fVec3[(IOTA-int((int(fRec27[0]) & 262143)))&262143]) + (fRec26[0] * fVec3[(IOTA-int((int(fRec28[0]) & 262143)))&262143]));
438 double fRec17 = max(fConst1, fabs(fTemp14));
439 int iTemp15 = int((iRec15[1] < 4096));
440 fRec14[0] = ((iTemp15)?max(fRec14[1], fRec17):fRec17);
441 iRec15[0] = ((iTemp15)?(1 + iRec15[1]):1);
442 fRec16[0] = ((iTemp15)?fRec16[1]:fRec14[1]);
443 fbargraph1 = fRec16[0];
444 double fTemp16 = (fSlow2 * fRec33[1]);
445 fRec37[0] = ((fSlow39 * fRec37[1]) + (fSlow38 * (fVec2[0] + fVec2[1])));
446 fRec36[0] = (fRec37[0] - (fSlow34 * ((fSlow32 * fRec36[2]) + (fSlow14 * fRec36[1]))));
447 double fTemp17 = (fRec36[2] + (fRec36[0] + (2 * fRec36[1])));
448 double fTemp18 = (fSlow34 * fTemp17);
449 fVec4[0] = fTemp18;
450 fRec35[0] = ((fSlow50 * fRec35[1]) + (fSlow49 * ((fSlow47 * fTemp17) + (fSlow46 * fVec4[1]))));
451 fRec34[0] = (fRec35[0] - (fSlow45 * ((fSlow43 * fRec34[2]) + (fSlow8 * fRec34[1]))));
452 fRec33[0] = ((fSlow45 * (((fSlow7 * fRec34[0]) + (fSlow51 * fRec34[1])) + (fSlow7 * fRec34[2]))) - (fSlow5 * ((fSlow4 * fRec33[2]) + fTemp16)));
453 fRec38[0] = (fSlow52 + (0.999 * fRec38[1]));
454 double fTemp19 = (fRec38[0] * (fRec33[2] + (fSlow5 * (fTemp16 + (fSlow4 * fRec33[0])))));
455 fVec5[IOTA&262143] = fTemp19;
456 double fTemp20 = ((int((fRec39[1] != 0.0)))?((int(((fRec40[1] > 0.0) & (fRec40[1] < 1.0))))?fRec39[1]:0):((int(((fRec40[1] == 0.0) & (fSlow53 != fRec41[1]))))?fConst3:((int(((fRec40[1] == 1.0) & (fSlow53 != fRec42[1]))))?fConst4:0)));
457 fRec39[0] = fTemp20;
458 fRec40[0] = max(0.0, min(1.0, (fRec40[1] + fTemp20)));
459 fRec41[0] = ((int(((fRec40[1] >= 1.0) & (fRec42[1] != fSlow53))))?fSlow53:fRec41[1]);
460 fRec42[0] = ((int(((fRec40[1] <= 0.0) & (fRec41[1] != fSlow53))))?fSlow53:fRec42[1]);
461 double fTemp21 = (((1.0 - fRec40[0]) * fVec5[(IOTA-int((int(fRec41[0]) & 262143)))&262143]) + (fRec40[0] * fVec5[(IOTA-int((int(fRec42[0]) & 262143)))&262143]));
462 double fRec32 = max(fConst1, fabs(fTemp21));
463 int iTemp22 = int((iRec30[1] < 4096));
464 fRec29[0] = ((iTemp22)?max(fRec29[1], fRec32):fRec32);
465 iRec30[0] = ((iTemp22)?(1 + iRec30[1]):1);
466 fRec31[0] = ((iTemp22)?fRec31[1]:fRec29[1]);
467 fbargraph2 = fRec31[0];
468 fRec50[0] = ((fSlow50 * fRec50[1]) + (fSlow49 * (fVec4[0] + fVec4[1])));
469 fRec49[0] = (fRec50[0] - (fSlow45 * ((fSlow43 * fRec49[2]) + (fSlow8 * fRec49[1]))));
470 double fTemp23 = (fRec49[2] + (fRec49[0] + (2 * fRec49[1])));
471 double fTemp24 = (fSlow45 * fTemp23);
472 fVec6[0] = fTemp24;
473 fRec48[0] = ((fSlow60 * fRec48[1]) + (fSlow59 * ((fSlow57 * fTemp23) + (fSlow56 * fVec6[1]))));
474 fRec47[0] = (fRec48[0] - (fSlow55 * ((fSlow54 * fRec47[2]) + (fSlow2 * fRec47[1]))));
475 fRec51[0] = (fSlow62 + (0.999 * fRec51[1]));
476 double fTemp25 = (fSlow55 * (fRec51[0] * (((fSlow1 * fRec47[0]) + (fSlow61 * fRec47[1])) + (fSlow1 * fRec47[2]))));
477 fVec7[IOTA&262143] = fTemp25;
478 double fTemp26 = ((int((fRec52[1] != 0.0)))?((int(((fRec53[1] > 0.0) & (fRec53[1] < 1.0))))?fRec52[1]:0):((int(((fRec53[1] == 0.0) & (fSlow63 != fRec54[1]))))?fConst3:((int(((fRec53[1] == 1.0) & (fSlow63 != fRec55[1]))))?fConst4:0)));
479 fRec52[0] = fTemp26;
480 fRec53[0] = max(0.0, min(1.0, (fRec53[1] + fTemp26)));
481 fRec54[0] = ((int(((fRec53[1] >= 1.0) & (fRec55[1] != fSlow63))))?fSlow63:fRec54[1]);
482 fRec55[0] = ((int(((fRec53[1] <= 0.0) & (fRec54[1] != fSlow63))))?fSlow63:fRec55[1]);
483 double fTemp27 = (((1.0 - fRec53[0]) * fVec7[(IOTA-int((int(fRec54[0]) & 262143)))&262143]) + (fRec53[0] * fVec7[(IOTA-int((int(fRec55[0]) & 262143)))&262143]));
484 double fRec46 = max(fConst1, fabs(fTemp27));
485 int iTemp28 = int((iRec44[1] < 4096));
486 fRec43[0] = ((iTemp28)?max(fRec43[1], fRec46):fRec46);
487 iRec44[0] = ((iTemp28)?(1 + iRec44[1]):1);
488 fRec45[0] = ((iTemp28)?fRec45[1]:fRec43[1]);
489 fbargraph3 = fRec45[0];
490 fRec61[0] = ((fSlow60 * fRec61[1]) + (fSlow59 * (fVec6[0] + fVec6[1])));
491 fRec60[0] = (fRec61[0] - (fSlow55 * ((fSlow54 * fRec60[2]) + (fSlow2 * fRec60[1]))));
492 fRec62[0] = (fSlow64 + (0.999 * fRec62[1]));
493 double fTemp29 = (fSlow55 * (fRec62[0] * (fRec60[2] + (fRec60[0] + (2 * fRec60[1])))));
494 fVec8[IOTA&262143] = fTemp29;
495 double fTemp30 = ((int((fRec63[1] != 0.0)))?((int(((fRec64[1] > 0.0) & (fRec64[1] < 1.0))))?fRec63[1]:0):((int(((fRec64[1] == 0.0) & (fSlow65 != fRec65[1]))))?fConst3:((int(((fRec64[1] == 1.0) & (fSlow65 != fRec66[1]))))?fConst4:0)));
496 fRec63[0] = fTemp30;
497 fRec64[0] = max(0.0, min(1.0, (fRec64[1] + fTemp30)));
498 fRec65[0] = ((int(((fRec64[1] >= 1.0) & (fRec66[1] != fSlow65))))?fSlow65:fRec65[1]);
499 fRec66[0] = ((int(((fRec64[1] <= 0.0) & (fRec65[1] != fSlow65))))?fSlow65:fRec66[1]);
500 double fTemp31 = (((1.0 - fRec64[0]) * fVec8[(IOTA-int((int(fRec65[0]) & 262143)))&262143]) + (fRec64[0] * fVec8[(IOTA-int((int(fRec66[0]) & 262143)))&262143]));
501 double fRec59 = max(fConst1, fabs(fTemp31));
502 int iTemp32 = int((iRec57[1] < 4096));
503 fRec56[0] = ((iTemp32)?max(fRec56[1], fRec59):fRec59);
504 iRec57[0] = ((iTemp32)?(1 + iRec57[1]):1);
505 fRec58[0] = ((iTemp32)?fRec58[1]:fRec56[1]);
506 fbargraph4 = fRec58[0];
507 output0[i] = (FAUSTFLOAT)(fTemp31 + (fTemp27 + (fTemp21 + (fTemp14 + (fVec0[0] + fTemp6)))));
508 // post processing
509 fRec58[1] = fRec58[0];
510 iRec57[1] = iRec57[0];
511 fRec56[1] = fRec56[0];
512 fRec66[1] = fRec66[0];
513 fRec65[1] = fRec65[0];
514 fRec64[1] = fRec64[0];
515 fRec63[1] = fRec63[0];
516 fRec62[1] = fRec62[0];
517 fRec60[2] = fRec60[1]; fRec60[1] = fRec60[0];
518 fRec61[1] = fRec61[0];
519 fRec45[1] = fRec45[0];
520 iRec44[1] = iRec44[0];
521 fRec43[1] = fRec43[0];
522 fRec55[1] = fRec55[0];
523 fRec54[1] = fRec54[0];
524 fRec53[1] = fRec53[0];
525 fRec52[1] = fRec52[0];
526 fRec51[1] = fRec51[0];
527 fRec47[2] = fRec47[1]; fRec47[1] = fRec47[0];
528 fRec48[1] = fRec48[0];
529 fVec6[1] = fVec6[0];
530 fRec49[2] = fRec49[1]; fRec49[1] = fRec49[0];
531 fRec50[1] = fRec50[0];
532 fRec31[1] = fRec31[0];
533 iRec30[1] = iRec30[0];
534 fRec29[1] = fRec29[0];
535 fRec42[1] = fRec42[0];
536 fRec41[1] = fRec41[0];
537 fRec40[1] = fRec40[0];
538 fRec39[1] = fRec39[0];
539 fRec38[1] = fRec38[0];
540 fRec33[2] = fRec33[1]; fRec33[1] = fRec33[0];
541 fRec34[2] = fRec34[1]; fRec34[1] = fRec34[0];
542 fRec35[1] = fRec35[0];
543 fVec4[1] = fVec4[0];
544 fRec36[2] = fRec36[1]; fRec36[1] = fRec36[0];
545 fRec37[1] = fRec37[0];
546 fRec16[1] = fRec16[0];
547 iRec15[1] = iRec15[0];
548 fRec14[1] = fRec14[0];
549 fRec28[1] = fRec28[0];
550 fRec27[1] = fRec27[0];
551 fRec26[1] = fRec26[0];
552 fRec25[1] = fRec25[0];
553 fRec24[1] = fRec24[0];
554 fRec18[2] = fRec18[1]; fRec18[1] = fRec18[0];
555 fRec19[2] = fRec19[1]; fRec19[1] = fRec19[0];
556 fRec20[2] = fRec20[1]; fRec20[1] = fRec20[0];
557 fRec21[1] = fRec21[0];
558 fVec2[1] = fVec2[0];
559 fRec22[2] = fRec22[1]; fRec22[1] = fRec22[0];
560 fRec23[1] = fRec23[0];
561 fRec2[1] = fRec2[0];
562 iRec1[1] = iRec1[0];
563 fRec0[1] = fRec0[0];
564 fRec13[1] = fRec13[0];
565 fRec12[1] = fRec12[0];
566 fRec11[1] = fRec11[0];
567 fRec10[1] = fRec10[0];
568 IOTA = IOTA+1;
569 fRec9[1] = fRec9[0];
570 fRec4[2] = fRec4[1]; fRec4[1] = fRec4[0];
571 fRec5[2] = fRec5[1]; fRec5[1] = fRec5[0];
572 fRec6[2] = fRec6[1]; fRec6[1] = fRec6[0];
573 fRec7[2] = fRec7[1]; fRec7[1] = fRec7[0];
574 fRec8[1] = fRec8[0];
575 fVec0[1] = fVec0[0];
576 }
577 #undef fslider0
578 #undef fslider1
579 #undef fslider2
580 #undef fslider3
581 #undef fslider4
582 #undef fslider5
583 #undef fbargraph0
584 #undef fslider6
585 #undef fslider7
586 #undef fbargraph1
587 #undef fslider8
588 #undef fslider9
589 #undef fbargraph2
590 #undef fslider10
591 #undef fslider11
592 #undef fbargraph3
593 #undef fslider12
594 #undef fslider13
595 #undef fbargraph4
596 }
597
598 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
599 {
600 static_cast<Dsp*>(p)->compute(count, input0, output0);
601 }
602
603
604 void Dsp::connect(uint32_t port,void* data)
605 {
606 switch ((PortIndex)port)
607 {
608 case CROSSOVER_B1_B2:
609 fslider0_ = (float*)data; // , 8e+01, 2e+01, 2e+04, 1.08
610 break;
611 case CROSSOVER_B2_B3:
612 fslider1_ = (float*)data; // , 2.1e+02, 2e+01, 2e+04, 1.08
613 break;
614 case CROSSOVER_B3_B4:
615 fslider2_ = (float*)data; // , 1.7e+03, 2e+01, 2e+04, 1.08
616 break;
617 case CROSSOVER_B4_B5:
618 fslider3_ = (float*)data; // , 5e+03, 2e+01, 2e+04, 1.08
619 break;
620 case DELAY1:
621 fslider13_ = (float*)data; // , 3e+01, 24.0, 3.6e+02, 1.0
622 break;
623 case DELAY2:
624 fslider11_ = (float*)data; // , 6e+01, 24.0, 3.6e+02, 1.0
625 break;
626 case DELAY3:
627 fslider9_ = (float*)data; // , 9e+01, 24.0, 3.6e+02, 1.0
628 break;
629 case DELAY4:
630 fslider7_ = (float*)data; // , 1.2e+02, 24.0, 3.6e+02, 1.0
631 break;
632 case DELAY5:
633 fslider5_ = (float*)data; // , 1.5e+02, 24.0, 3.6e+02, 1.0
634 break;
635 case GAIN1:
636 fslider12_ = (float*)data; // , -1e+01, -2e+01, 2e+01, 0.1
637 break;
638 case GAIN2:
639 fslider10_ = (float*)data; // , -5.0, -2e+01, 2e+01, 0.1
640 break;
641 case GAIN3:
642 fslider8_ = (float*)data; // , -2.0, -2e+01, 2e+01, 0.1
643 break;
644 case GAIN4:
645 fslider6_ = (float*)data; // , 0.0, -2e+01, 2e+01, 0.1
646 break;
647 case GAIN5:
648 fslider4_ = (float*)data; // , -1e+01, -2e+01, 2e+01, 0.1
649 break;
650 case V1:
651 fbargraph4_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
652 break;
653 case V2:
654 fbargraph3_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
655 break;
656 case V3:
657 fbargraph2_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
658 break;
659 case V4:
660 fbargraph1_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
661 break;
662 case V5:
663 fbargraph0_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
664 break;
665 default:
666 break;
667 }
668 }
669
670 void Dsp::connect_static(uint32_t port,void* data, PluginLV2 *p)
671 {
672 static_cast<Dsp*>(p)->connect(port, data);
673 }
674
675
676 PluginLV2 *plugin() {
677 return new Dsp();
678 }
679
680 void Dsp::del_instance(PluginLV2 *p)
681 {
682 delete static_cast<Dsp*>(p);
683 }
684
685 /*
686 typedef enum
687 {
688 CROSSOVER_B1_B2,
689 CROSSOVER_B2_B3,
690 CROSSOVER_B3_B4,
691 CROSSOVER_B4_B5,
692 DELAY1,
693 DELAY2,
694 DELAY3,
695 DELAY4,
696 DELAY5,
697 GAIN1,
698 GAIN2,
699 GAIN3,
700 GAIN4,
701 GAIN5,
702 V1,
703 V2,
704 V3,
705 V4,
706 V5,
707 } PortIndex;
708 */
709
710 } // end namespace mbdel
0 // generated from file '../src/LV2/faust/mbe.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.65 (http://faust.grame.fr)
2
3
4 namespace mbe {
5
6 class Dsp: public PluginLV2 {
7 private:
8 uint32_t fSamplingFreq;
9 int iConst0;
10 double fConst1;
11 FAUSTFLOAT fslider0;
12 FAUSTFLOAT *fslider0_;
13 double fConst2;
14 FAUSTFLOAT fslider1;
15 FAUSTFLOAT *fslider1_;
16 FAUSTFLOAT fslider2;
17 FAUSTFLOAT *fslider2_;
18 FAUSTFLOAT fslider3;
19 FAUSTFLOAT *fslider3_;
20 double fVec0[2];
21 double fRec12[2];
22 double fRec11[3];
23 double fVec1[2];
24 double fRec10[2];
25 double fRec9[3];
26 double fVec2[2];
27 double fRec8[2];
28 double fRec7[3];
29 double fVec3[2];
30 double fRec6[2];
31 double fRec5[3];
32 double fConst3;
33 double fConst4;
34 FAUSTFLOAT fslider4;
35 FAUSTFLOAT *fslider4_;
36 int iConst5;
37 double fRec13[2];
38 double fRec14[2];
39 double fRec15[2];
40 double fRec16[2];
41 FAUSTFLOAT fslider5;
42 FAUSTFLOAT *fslider5_;
43 double fRec17[2];
44 int IOTA;
45 double *fRec4;
46 double fRec0[2];
47 int iRec1[2];
48 double fRec2[2];
49 FAUSTFLOAT fbargraph0;
50 FAUSTFLOAT *fbargraph0_;
51 double fRec24[2];
52 double fRec23[3];
53 FAUSTFLOAT fslider6;
54 FAUSTFLOAT *fslider6_;
55 double fRec25[2];
56 double fRec26[2];
57 double fRec27[2];
58 double fRec28[2];
59 FAUSTFLOAT fslider7;
60 FAUSTFLOAT *fslider7_;
61 double fRec29[2];
62 double *fRec22;
63 double fRec18[2];
64 int iRec19[2];
65 double fRec20[2];
66 FAUSTFLOAT fbargraph1;
67 FAUSTFLOAT *fbargraph1_;
68 double fRec37[2];
69 double fRec36[3];
70 double fRec35[3];
71 FAUSTFLOAT fslider8;
72 FAUSTFLOAT *fslider8_;
73 double fRec38[2];
74 double fRec39[2];
75 double fRec40[2];
76 double fRec41[2];
77 FAUSTFLOAT fslider9;
78 FAUSTFLOAT *fslider9_;
79 double fRec42[2];
80 double *fRec34;
81 double fRec30[2];
82 int iRec31[2];
83 double fRec32[2];
84 FAUSTFLOAT fbargraph2;
85 FAUSTFLOAT *fbargraph2_;
86 double fRec51[2];
87 double fRec50[3];
88 double fRec49[3];
89 double fRec48[3];
90 FAUSTFLOAT fslider10;
91 FAUSTFLOAT *fslider10_;
92 double fRec52[2];
93 double fRec53[2];
94 double fRec54[2];
95 double fRec55[2];
96 FAUSTFLOAT fslider11;
97 FAUSTFLOAT *fslider11_;
98 double fRec56[2];
99 double *fRec47;
100 double fRec43[2];
101 int iRec44[2];
102 double fRec45[2];
103 FAUSTFLOAT fbargraph3;
104 FAUSTFLOAT *fbargraph3_;
105 double fRec66[2];
106 double fRec65[3];
107 double fRec64[3];
108 double fRec63[3];
109 double fRec62[3];
110 FAUSTFLOAT fslider12;
111 FAUSTFLOAT *fslider12_;
112 double fRec67[2];
113 double fRec68[2];
114 double fRec69[2];
115 double fRec70[2];
116 FAUSTFLOAT fslider13;
117 FAUSTFLOAT *fslider13_;
118 double fRec71[2];
119 double *fRec61;
120 double fRec57[2];
121 int iRec58[2];
122 double fRec59[2];
123 FAUSTFLOAT fbargraph4;
124 FAUSTFLOAT *fbargraph4_;
125 bool mem_allocated;
126 void mem_alloc();
127 void mem_free();
128 void connect(uint32_t port,void* data);
129 void clear_state_f();
130 int activate(bool start);
131 void init(uint32_t samplingFreq);
132 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
133
134 static void clear_state_f_static(PluginLV2*);
135 static int activate_static(bool start, PluginLV2*);
136 static void init_static(uint32_t samplingFreq, PluginLV2*);
137 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
138 static void del_instance(PluginLV2 *p);
139 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
140 public:
141 Dsp();
142 ~Dsp();
143 };
144
145
146
147 Dsp::Dsp()
148 : PluginLV2(),
149 fRec4(0),
150 fRec22(0),
151 fRec34(0),
152 fRec47(0),
153 fRec61(0),
154 mem_allocated(false) {
155 version = PLUGINLV2_VERSION;
156 id = "mbe";
157 name = N_("MultiBand Echo");
158 mono_audio = compute_static;
159 stereo_audio = 0;
160 set_samplerate = init_static;
161 activate_plugin = activate_static;
162 connect_ports = connect_static;
163 clear_state = clear_state_f_static;
164 delete_instance = del_instance;
165 }
166
167 Dsp::~Dsp() {
168 }
169
170 inline void Dsp::clear_state_f()
171 {
172 for (int i=0; i<2; i++) fVec0[i] = 0;
173 for (int i=0; i<2; i++) fRec12[i] = 0;
174 for (int i=0; i<3; i++) fRec11[i] = 0;
175 for (int i=0; i<2; i++) fVec1[i] = 0;
176 for (int i=0; i<2; i++) fRec10[i] = 0;
177 for (int i=0; i<3; i++) fRec9[i] = 0;
178 for (int i=0; i<2; i++) fVec2[i] = 0;
179 for (int i=0; i<2; i++) fRec8[i] = 0;
180 for (int i=0; i<3; i++) fRec7[i] = 0;
181 for (int i=0; i<2; i++) fVec3[i] = 0;
182 for (int i=0; i<2; i++) fRec6[i] = 0;
183 for (int i=0; i<3; i++) fRec5[i] = 0;
184 for (int i=0; i<2; i++) fRec13[i] = 0;
185 for (int i=0; i<2; i++) fRec14[i] = 0;
186 for (int i=0; i<2; i++) fRec15[i] = 0;
187 for (int i=0; i<2; i++) fRec16[i] = 0;
188 for (int i=0; i<2; i++) fRec17[i] = 0;
189 for (int i=0; i<524288; i++) fRec4[i] = 0;
190 for (int i=0; i<2; i++) fRec0[i] = 0;
191 for (int i=0; i<2; i++) iRec1[i] = 0;
192 for (int i=0; i<2; i++) fRec2[i] = 0;
193 for (int i=0; i<2; i++) fRec24[i] = 0;
194 for (int i=0; i<3; i++) fRec23[i] = 0;
195 for (int i=0; i<2; i++) fRec25[i] = 0;
196 for (int i=0; i<2; i++) fRec26[i] = 0;
197 for (int i=0; i<2; i++) fRec27[i] = 0;
198 for (int i=0; i<2; i++) fRec28[i] = 0;
199 for (int i=0; i<2; i++) fRec29[i] = 0;
200 for (int i=0; i<524288; i++) fRec22[i] = 0;
201 for (int i=0; i<2; i++) fRec18[i] = 0;
202 for (int i=0; i<2; i++) iRec19[i] = 0;
203 for (int i=0; i<2; i++) fRec20[i] = 0;
204 for (int i=0; i<2; i++) fRec37[i] = 0;
205 for (int i=0; i<3; i++) fRec36[i] = 0;
206 for (int i=0; i<3; i++) fRec35[i] = 0;
207 for (int i=0; i<2; i++) fRec38[i] = 0;
208 for (int i=0; i<2; i++) fRec39[i] = 0;
209 for (int i=0; i<2; i++) fRec40[i] = 0;
210 for (int i=0; i<2; i++) fRec41[i] = 0;
211 for (int i=0; i<2; i++) fRec42[i] = 0;
212 for (int i=0; i<524288; i++) fRec34[i] = 0;
213 for (int i=0; i<2; i++) fRec30[i] = 0;
214 for (int i=0; i<2; i++) iRec31[i] = 0;
215 for (int i=0; i<2; i++) fRec32[i] = 0;
216 for (int i=0; i<2; i++) fRec51[i] = 0;
217 for (int i=0; i<3; i++) fRec50[i] = 0;
218 for (int i=0; i<3; i++) fRec49[i] = 0;
219 for (int i=0; i<3; i++) fRec48[i] = 0;
220 for (int i=0; i<2; i++) fRec52[i] = 0;
221 for (int i=0; i<2; i++) fRec53[i] = 0;
222 for (int i=0; i<2; i++) fRec54[i] = 0;
223 for (int i=0; i<2; i++) fRec55[i] = 0;
224 for (int i=0; i<2; i++) fRec56[i] = 0;
225 for (int i=0; i<524288; i++) fRec47[i] = 0;
226 for (int i=0; i<2; i++) fRec43[i] = 0;
227 for (int i=0; i<2; i++) iRec44[i] = 0;
228 for (int i=0; i<2; i++) fRec45[i] = 0;
229 for (int i=0; i<2; i++) fRec66[i] = 0;
230 for (int i=0; i<3; i++) fRec65[i] = 0;
231 for (int i=0; i<3; i++) fRec64[i] = 0;
232 for (int i=0; i<3; i++) fRec63[i] = 0;
233 for (int i=0; i<3; i++) fRec62[i] = 0;
234 for (int i=0; i<2; i++) fRec67[i] = 0;
235 for (int i=0; i<2; i++) fRec68[i] = 0;
236 for (int i=0; i<2; i++) fRec69[i] = 0;
237 for (int i=0; i<2; i++) fRec70[i] = 0;
238 for (int i=0; i<2; i++) fRec71[i] = 0;
239 for (int i=0; i<524288; i++) fRec61[i] = 0;
240 for (int i=0; i<2; i++) fRec57[i] = 0;
241 for (int i=0; i<2; i++) iRec58[i] = 0;
242 for (int i=0; i<2; i++) fRec59[i] = 0;
243 }
244
245 void Dsp::clear_state_f_static(PluginLV2 *p)
246 {
247 static_cast<Dsp*>(p)->clear_state_f();
248 }
249
250 inline void Dsp::init(uint32_t samplingFreq)
251 {
252 fSamplingFreq = samplingFreq;
253 iConst0 = min(192000, max(1, fSamplingFreq));
254 fConst1 = (1.0 / double(iConst0));
255 fConst2 = (3.141592653589793 / double(iConst0));
256 fConst3 = (1e+01 / double(iConst0));
257 fConst4 = (0 - fConst3);
258 iConst5 = (60 * iConst0);
259 IOTA = 0;
260 }
261
262 void Dsp::init_static(uint32_t samplingFreq, PluginLV2 *p)
263 {
264 static_cast<Dsp*>(p)->init(samplingFreq);
265 }
266
267 void Dsp::mem_alloc()
268 {
269 if (!fRec4) fRec4 = new double[524288];
270 if (!fRec22) fRec22 = new double[524288];
271 if (!fRec34) fRec34 = new double[524288];
272 if (!fRec47) fRec47 = new double[524288];
273 if (!fRec61) fRec61 = new double[524288];
274 mem_allocated = true;
275 }
276
277 void Dsp::mem_free()
278 {
279 mem_allocated = false;
280 if (fRec4) { delete fRec4; fRec4 = 0; }
281 if (fRec22) { delete fRec22; fRec22 = 0; }
282 if (fRec34) { delete fRec34; fRec34 = 0; }
283 if (fRec47) { delete fRec47; fRec47 = 0; }
284 if (fRec61) { delete fRec61; fRec61 = 0; }
285 }
286
287 int Dsp::activate(bool start)
288 {
289 if (start) {
290 if (!mem_allocated) {
291 mem_alloc();
292 clear_state_f();
293 }
294 } else if (mem_allocated) {
295 mem_free();
296 }
297 return 0;
298 }
299
300 int Dsp::activate_static(bool start, PluginLV2 *p)
301 {
302 return static_cast<Dsp*>(p)->activate(start);
303 }
304
305 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
306 {
307 #define fslider0 (*fslider0_)
308 #define fslider1 (*fslider1_)
309 #define fslider2 (*fslider2_)
310 #define fslider3 (*fslider3_)
311 #define fslider4 (*fslider4_)
312 #define fslider5 (*fslider5_)
313 #define fbargraph0 (*fbargraph0_)
314 #define fslider6 (*fslider6_)
315 #define fslider7 (*fslider7_)
316 #define fbargraph1 (*fbargraph1_)
317 #define fslider8 (*fslider8_)
318 #define fslider9 (*fslider9_)
319 #define fbargraph2 (*fbargraph2_)
320 #define fslider10 (*fslider10_)
321 #define fslider11 (*fslider11_)
322 #define fbargraph3 (*fbargraph3_)
323 #define fslider12 (*fslider12_)
324 #define fslider13 (*fslider13_)
325 #define fbargraph4 (*fbargraph4_)
326 double fSlow0 = tan((fConst2 * double(fslider0)));
327 double fSlow1 = (1.0 / faustpower<2>(fSlow0));
328 double fSlow2 = (2 * (1 - fSlow1));
329 double fSlow3 = (1.0 / fSlow0);
330 double fSlow4 = (1 + ((fSlow3 - 1.0000000000000004) / fSlow0));
331 double fSlow5 = (1.0 / (1 + ((fSlow3 + 1.0000000000000004) / fSlow0)));
332 double fSlow6 = tan((fConst2 * double(fslider1)));
333 double fSlow7 = (1.0 / faustpower<2>(fSlow6));
334 double fSlow8 = (2 * (1 - fSlow7));
335 double fSlow9 = (1.0 / fSlow6);
336 double fSlow10 = (1 + ((fSlow9 - 1.0000000000000004) / fSlow6));
337 double fSlow11 = (1 + ((fSlow9 + 1.0000000000000004) / fSlow6));
338 double fSlow12 = (1.0 / fSlow11);
339 double fSlow13 = tan((fConst2 * double(fslider2)));
340 double fSlow14 = (1.0 / faustpower<2>(fSlow13));
341 double fSlow15 = (2 * (1 - fSlow14));
342 double fSlow16 = (1.0 / fSlow13);
343 double fSlow17 = (1 + ((fSlow16 - 1.0000000000000004) / fSlow13));
344 double fSlow18 = (1 + ((fSlow16 + 1.0000000000000004) / fSlow13));
345 double fSlow19 = (1.0 / fSlow18);
346 double fSlow20 = tan((fConst2 * double(fslider3)));
347 double fSlow21 = (1.0 / faustpower<2>(fSlow20));
348 double fSlow22 = (2 * (1 - fSlow21));
349 double fSlow23 = (1.0 / fSlow20);
350 double fSlow24 = (1 + ((fSlow23 - 1.0000000000000004) / fSlow20));
351 double fSlow25 = (1 + ((1.0000000000000004 + fSlow23) / fSlow20));
352 double fSlow26 = (1.0 / fSlow25);
353 double fSlow27 = (1 + fSlow23);
354 double fSlow28 = (1.0 / fSlow27);
355 double fSlow29 = (0 - ((1 - fSlow23) / fSlow27));
356 double fSlow30 = (1 + fSlow16);
357 double fSlow31 = (1.0 / fSlow30);
358 double fSlow32 = (0 - ((1 - fSlow16) / fSlow30));
359 double fSlow33 = (1 + fSlow9);
360 double fSlow34 = (1.0 / fSlow33);
361 double fSlow35 = (0 - ((1 - fSlow9) / fSlow33));
362 double fSlow36 = (1 + fSlow3);
363 double fSlow37 = (1.0 / fSlow36);
364 double fSlow38 = (0 - ((1 - fSlow3) / fSlow36));
365 double fSlow39 = (double(iConst5) / double(fslider4));
366 double fSlow40 = (1.000000000000001e-05 * double(fslider5));
367 double fSlow41 = (0 - fSlow3);
368 double fSlow42 = (1.0 / (fSlow0 * fSlow11));
369 double fSlow43 = (2 * (0 - fSlow1));
370 double fSlow44 = (double(iConst5) / double(fslider6));
371 double fSlow45 = (1.000000000000001e-05 * double(fslider7));
372 double fSlow46 = (1 + ((fSlow3 - 1.0) / fSlow0));
373 double fSlow47 = (1.0 / (1 + ((1.0 + fSlow3) / fSlow0)));
374 double fSlow48 = (0 - fSlow9);
375 double fSlow49 = (1.0 / (fSlow6 * fSlow18));
376 double fSlow50 = (2 * (0 - fSlow7));
377 double fSlow51 = (double(iConst5) / double(fslider8));
378 double fSlow52 = (1.000000000000001e-05 * double(fslider9));
379 double fSlow53 = (1 + ((fSlow9 - 1.0) / fSlow6));
380 double fSlow54 = (1.0 / (1 + ((1.0 + fSlow9) / fSlow6)));
381 double fSlow55 = (0 - fSlow16);
382 double fSlow56 = (1.0 / (fSlow13 * fSlow25));
383 double fSlow57 = (2 * (0 - fSlow14));
384 double fSlow58 = (double(iConst5) / double(fslider10));
385 double fSlow59 = (1.000000000000001e-05 * double(fslider11));
386 double fSlow60 = (1 + ((fSlow16 - 1.0) / fSlow13));
387 double fSlow61 = (1.0 / (1 + ((1.0 + fSlow16) / fSlow13)));
388 double fSlow62 = (0 - fSlow23);
389 double fSlow63 = (2 * (0 - fSlow21));
390 double fSlow64 = (double(iConst5) / double(fslider12));
391 double fSlow65 = (1.000000000000001e-05 * double(fslider13));
392 for (int i=0; i<count; i++) {
393 double fTemp0 = (double)input0[i];
394 fVec0[0] = fTemp0;
395 fRec12[0] = ((fSlow29 * fRec12[1]) + (fSlow28 * (fVec0[0] + fVec0[1])));
396 fRec11[0] = (fRec12[0] - (fSlow26 * ((fSlow24 * fRec11[2]) + (fSlow22 * fRec11[1]))));
397 double fTemp1 = (fRec11[2] + (fRec11[0] + (2 * fRec11[1])));
398 double fTemp2 = (fSlow26 * fTemp1);
399 fVec1[0] = fTemp2;
400 fRec10[0] = ((fSlow32 * fRec10[1]) + (fSlow31 * (fVec1[0] + fVec1[1])));
401 fRec9[0] = (fRec10[0] - (fSlow19 * ((fSlow17 * fRec9[2]) + (fSlow15 * fRec9[1]))));
402 double fTemp3 = (fRec9[2] + (fRec9[0] + (2 * fRec9[1])));
403 double fTemp4 = (fSlow19 * fTemp3);
404 fVec2[0] = fTemp4;
405 fRec8[0] = ((fSlow35 * fRec8[1]) + (fSlow34 * (fVec2[0] + fVec2[1])));
406 fRec7[0] = (fRec8[0] - (fSlow12 * ((fSlow10 * fRec7[2]) + (fSlow8 * fRec7[1]))));
407 double fTemp5 = (fRec7[2] + (fRec7[0] + (2 * fRec7[1])));
408 double fTemp6 = (fSlow12 * fTemp5);
409 fVec3[0] = fTemp6;
410 fRec6[0] = ((fSlow38 * fRec6[1]) + (fSlow37 * (fVec3[0] + fVec3[1])));
411 fRec5[0] = (fRec6[0] - (fSlow5 * ((fSlow4 * fRec5[2]) + (fSlow2 * fRec5[1]))));
412 double fTemp7 = ((int((fRec13[1] != 0.0)))?((int(((fRec14[1] > 0.0) & (fRec14[1] < 1.0))))?fRec13[1]:0):((int(((fRec14[1] == 0.0) & (fSlow39 != fRec15[1]))))?fConst3:((int(((fRec14[1] == 1.0) & (fSlow39 != fRec16[1]))))?fConst4:0)));
413 fRec13[0] = fTemp7;
414 fRec14[0] = max(0.0, min(1.0, (fRec14[1] + fTemp7)));
415 fRec15[0] = ((int(((fRec14[1] >= 1.0) & (fRec16[1] != fSlow39))))?fSlow39:fRec15[1]);
416 fRec16[0] = ((int(((fRec14[1] <= 0.0) & (fRec15[1] != fSlow39))))?fSlow39:fRec16[1]);
417 fRec17[0] = (fSlow40 + (0.999 * fRec17[1]));
418 fRec4[IOTA&524287] = ((fRec17[0] * (((1.0 - fRec14[0]) * fRec4[(IOTA-int((1 + int((int(fRec15[0]) & 262143)))))&524287]) + (fRec14[0] * fRec4[(IOTA-int((1 + int((int(fRec16[0]) & 262143)))))&524287]))) + (fSlow5 * (fRec5[2] + (fRec5[0] + (2 * fRec5[1])))));
419 double fTemp8 = fRec4[(IOTA-0)&524287];
420 double fRec3 = max(fConst1, fabs(fTemp8));
421 int iTemp9 = int((iRec1[1] < 4096));
422 fRec0[0] = ((iTemp9)?max(fRec0[1], fRec3):fRec3);
423 iRec1[0] = ((iTemp9)?(1 + iRec1[1]):1);
424 fRec2[0] = ((iTemp9)?fRec2[1]:fRec0[1]);
425 fbargraph0 = fRec2[0];
426 fRec24[0] = ((fSlow38 * fRec24[1]) + (fSlow37 * ((fSlow42 * fTemp5) + (fSlow41 * fVec3[1]))));
427 fRec23[0] = (fRec24[0] - (fSlow5 * ((fSlow4 * fRec23[2]) + (fSlow2 * fRec23[1]))));
428 double fTemp10 = ((int((fRec25[1] != 0.0)))?((int(((fRec26[1] > 0.0) & (fRec26[1] < 1.0))))?fRec25[1]:0):((int(((fRec26[1] == 0.0) & (fSlow44 != fRec27[1]))))?fConst3:((int(((fRec26[1] == 1.0) & (fSlow44 != fRec28[1]))))?fConst4:0)));
429 fRec25[0] = fTemp10;
430 fRec26[0] = max(0.0, min(1.0, (fRec26[1] + fTemp10)));
431 fRec27[0] = ((int(((fRec26[1] >= 1.0) & (fRec28[1] != fSlow44))))?fSlow44:fRec27[1]);
432 fRec28[0] = ((int(((fRec26[1] <= 0.0) & (fRec27[1] != fSlow44))))?fSlow44:fRec28[1]);
433 fRec29[0] = (fSlow45 + (0.999 * fRec29[1]));
434 fRec22[IOTA&524287] = ((fRec29[0] * (((1.0 - fRec26[0]) * fRec22[(IOTA-int((1 + int((int(fRec27[0]) & 262143)))))&524287]) + (fRec26[0] * fRec22[(IOTA-int((1 + int((int(fRec28[0]) & 262143)))))&524287]))) + (fSlow5 * (((fSlow1 * fRec23[0]) + (fSlow43 * fRec23[1])) + (fSlow1 * fRec23[2]))));
435 double fTemp11 = fRec22[(IOTA-0)&524287];
436 double fRec21 = max(fConst1, fabs(fTemp11));
437 int iTemp12 = int((iRec19[1] < 4096));
438 fRec18[0] = ((iTemp12)?max(fRec18[1], fRec21):fRec21);
439 iRec19[0] = ((iTemp12)?(1 + iRec19[1]):1);
440 fRec20[0] = ((iTemp12)?fRec20[1]:fRec18[1]);
441 fbargraph1 = fRec20[0];
442 double fTemp13 = (fSlow2 * fRec35[1]);
443 fRec37[0] = ((fSlow35 * fRec37[1]) + (fSlow34 * ((fSlow49 * fTemp3) + (fSlow48 * fVec2[1]))));
444 fRec36[0] = (fRec37[0] - (fSlow12 * ((fSlow10 * fRec36[2]) + (fSlow8 * fRec36[1]))));
445 fRec35[0] = ((fSlow12 * (((fSlow7 * fRec36[0]) + (fSlow50 * fRec36[1])) + (fSlow7 * fRec36[2]))) - (fSlow47 * ((fSlow46 * fRec35[2]) + fTemp13)));
446 double fTemp14 = ((int((fRec38[1] != 0.0)))?((int(((fRec39[1] > 0.0) & (fRec39[1] < 1.0))))?fRec38[1]:0):((int(((fRec39[1] == 0.0) & (fSlow51 != fRec40[1]))))?fConst3:((int(((fRec39[1] == 1.0) & (fSlow51 != fRec41[1]))))?fConst4:0)));
447 fRec38[0] = fTemp14;
448 fRec39[0] = max(0.0, min(1.0, (fRec39[1] + fTemp14)));
449 fRec40[0] = ((int(((fRec39[1] >= 1.0) & (fRec41[1] != fSlow51))))?fSlow51:fRec40[1]);
450 fRec41[0] = ((int(((fRec39[1] <= 0.0) & (fRec40[1] != fSlow51))))?fSlow51:fRec41[1]);
451 fRec42[0] = (fSlow52 + (0.999 * fRec42[1]));
452 fRec34[IOTA&524287] = ((fSlow47 * (fTemp13 + (fSlow46 * fRec35[0]))) + ((fRec42[0] * (((1.0 - fRec39[0]) * fRec34[(IOTA-int((1 + int((int(fRec40[0]) & 262143)))))&524287]) + (fRec39[0] * fRec34[(IOTA-int((1 + int((int(fRec41[0]) & 262143)))))&524287]))) + fRec35[2]));
453 double fTemp15 = fRec34[(IOTA-0)&524287];
454 double fRec33 = max(fConst1, fabs(fTemp15));
455 int iTemp16 = int((iRec31[1] < 4096));
456 fRec30[0] = ((iTemp16)?max(fRec30[1], fRec33):fRec33);
457 iRec31[0] = ((iTemp16)?(1 + iRec31[1]):1);
458 fRec32[0] = ((iTemp16)?fRec32[1]:fRec30[1]);
459 fbargraph2 = fRec32[0];
460 double fTemp17 = (fSlow2 * fRec48[1]);
461 double fTemp18 = (fSlow8 * fRec49[1]);
462 fRec51[0] = ((fSlow32 * fRec51[1]) + (fSlow31 * ((fSlow56 * fTemp1) + (fSlow55 * fVec1[1]))));
463 fRec50[0] = (fRec51[0] - (fSlow19 * ((fSlow17 * fRec50[2]) + (fSlow15 * fRec50[1]))));
464 fRec49[0] = ((fSlow19 * (((fSlow14 * fRec50[0]) + (fSlow57 * fRec50[1])) + (fSlow14 * fRec50[2]))) - (fSlow54 * ((fSlow53 * fRec49[2]) + fTemp18)));
465 fRec48[0] = ((fRec49[2] + (fSlow54 * (fTemp18 + (fSlow53 * fRec49[0])))) - (fSlow47 * ((fSlow46 * fRec48[2]) + fTemp17)));
466 double fTemp19 = ((int((fRec52[1] != 0.0)))?((int(((fRec53[1] > 0.0) & (fRec53[1] < 1.0))))?fRec52[1]:0):((int(((fRec53[1] == 0.0) & (fSlow58 != fRec54[1]))))?fConst3:((int(((fRec53[1] == 1.0) & (fSlow58 != fRec55[1]))))?fConst4:0)));
467 fRec52[0] = fTemp19;
468 fRec53[0] = max(0.0, min(1.0, (fRec53[1] + fTemp19)));
469 fRec54[0] = ((int(((fRec53[1] >= 1.0) & (fRec55[1] != fSlow58))))?fSlow58:fRec54[1]);
470 fRec55[0] = ((int(((fRec53[1] <= 0.0) & (fRec54[1] != fSlow58))))?fSlow58:fRec55[1]);
471 fRec56[0] = (fSlow59 + (0.999 * fRec56[1]));
472 fRec47[IOTA&524287] = ((fSlow47 * (fTemp17 + (fSlow46 * fRec48[0]))) + ((fRec56[0] * (((1.0 - fRec53[0]) * fRec47[(IOTA-int((1 + int((int(fRec54[0]) & 262143)))))&524287]) + (fRec53[0] * fRec47[(IOTA-int((1 + int((int(fRec55[0]) & 262143)))))&524287]))) + fRec48[2]));
473 double fTemp20 = fRec47[(IOTA-0)&524287];
474 double fRec46 = max(fConst1, fabs(fTemp20));
475 int iTemp21 = int((iRec44[1] < 4096));
476 fRec43[0] = ((iTemp21)?max(fRec43[1], fRec46):fRec46);
477 iRec44[0] = ((iTemp21)?(1 + iRec44[1]):1);
478 fRec45[0] = ((iTemp21)?fRec45[1]:fRec43[1]);
479 fbargraph3 = fRec45[0];
480 double fTemp22 = (fSlow2 * fRec62[1]);
481 double fTemp23 = (fSlow8 * fRec63[1]);
482 double fTemp24 = (fSlow15 * fRec64[1]);
483 fRec66[0] = ((fSlow29 * fRec66[1]) + (fSlow28 * ((fSlow23 * fVec0[0]) + (fSlow62 * fVec0[1]))));
484 fRec65[0] = (fRec66[0] - (fSlow26 * ((fSlow24 * fRec65[2]) + (fSlow22 * fRec65[1]))));
485 fRec64[0] = ((fSlow26 * (((fSlow21 * fRec65[0]) + (fSlow63 * fRec65[1])) + (fSlow21 * fRec65[2]))) - (fSlow61 * ((fSlow60 * fRec64[2]) + fTemp24)));
486 fRec63[0] = ((fRec64[2] + (fSlow61 * (fTemp24 + (fSlow60 * fRec64[0])))) - (fSlow54 * ((fSlow53 * fRec63[2]) + fTemp23)));
487 fRec62[0] = ((fRec63[2] + (fSlow54 * (fTemp23 + (fSlow53 * fRec63[0])))) - (fSlow47 * ((fSlow46 * fRec62[2]) + fTemp22)));
488 double fTemp25 = ((int((fRec67[1] != 0.0)))?((int(((fRec68[1] > 0.0) & (fRec68[1] < 1.0))))?fRec67[1]:0):((int(((fRec68[1] == 0.0) & (fSlow64 != fRec69[1]))))?fConst3:((int(((fRec68[1] == 1.0) & (fSlow64 != fRec70[1]))))?fConst4:0)));
489 fRec67[0] = fTemp25;
490 fRec68[0] = max(0.0, min(1.0, (fRec68[1] + fTemp25)));
491 fRec69[0] = ((int(((fRec68[1] >= 1.0) & (fRec70[1] != fSlow64))))?fSlow64:fRec69[1]);
492 fRec70[0] = ((int(((fRec68[1] <= 0.0) & (fRec69[1] != fSlow64))))?fSlow64:fRec70[1]);
493 fRec71[0] = (fSlow65 + (0.999 * fRec71[1]));
494 fRec61[IOTA&524287] = ((fSlow47 * (fTemp22 + (fSlow46 * fRec62[0]))) + ((fRec71[0] * (((1.0 - fRec68[0]) * fRec61[(IOTA-int((1 + int((int(fRec69[0]) & 262143)))))&524287]) + (fRec68[0] * fRec61[(IOTA-int((1 + int((int(fRec70[0]) & 262143)))))&524287]))) + fRec62[2]));
495 double fTemp26 = fRec61[(IOTA-0)&524287];
496 double fRec60 = max(fConst1, fabs(fTemp26));
497 int iTemp27 = int((iRec58[1] < 4096));
498 fRec57[0] = ((iTemp27)?max(fRec57[1], fRec60):fRec60);
499 iRec58[0] = ((iTemp27)?(1 + iRec58[1]):1);
500 fRec59[0] = ((iTemp27)?fRec59[1]:fRec57[1]);
501 fbargraph4 = fRec59[0];
502 output0[i] = (FAUSTFLOAT)((((fTemp26 + fTemp20) + fTemp15) + fTemp11) + fTemp8);
503 // post processing
504 fRec59[1] = fRec59[0];
505 iRec58[1] = iRec58[0];
506 fRec57[1] = fRec57[0];
507 fRec71[1] = fRec71[0];
508 fRec70[1] = fRec70[0];
509 fRec69[1] = fRec69[0];
510 fRec68[1] = fRec68[0];
511 fRec67[1] = fRec67[0];
512 fRec62[2] = fRec62[1]; fRec62[1] = fRec62[0];
513 fRec63[2] = fRec63[1]; fRec63[1] = fRec63[0];
514 fRec64[2] = fRec64[1]; fRec64[1] = fRec64[0];
515 fRec65[2] = fRec65[1]; fRec65[1] = fRec65[0];
516 fRec66[1] = fRec66[0];
517 fRec45[1] = fRec45[0];
518 iRec44[1] = iRec44[0];
519 fRec43[1] = fRec43[0];
520 fRec56[1] = fRec56[0];
521 fRec55[1] = fRec55[0];
522 fRec54[1] = fRec54[0];
523 fRec53[1] = fRec53[0];
524 fRec52[1] = fRec52[0];
525 fRec48[2] = fRec48[1]; fRec48[1] = fRec48[0];
526 fRec49[2] = fRec49[1]; fRec49[1] = fRec49[0];
527 fRec50[2] = fRec50[1]; fRec50[1] = fRec50[0];
528 fRec51[1] = fRec51[0];
529 fRec32[1] = fRec32[0];
530 iRec31[1] = iRec31[0];
531 fRec30[1] = fRec30[0];
532 fRec42[1] = fRec42[0];
533 fRec41[1] = fRec41[0];
534 fRec40[1] = fRec40[0];
535 fRec39[1] = fRec39[0];
536 fRec38[1] = fRec38[0];
537 fRec35[2] = fRec35[1]; fRec35[1] = fRec35[0];
538 fRec36[2] = fRec36[1]; fRec36[1] = fRec36[0];
539 fRec37[1] = fRec37[0];
540 fRec20[1] = fRec20[0];
541 iRec19[1] = iRec19[0];
542 fRec18[1] = fRec18[0];
543 fRec29[1] = fRec29[0];
544 fRec28[1] = fRec28[0];
545 fRec27[1] = fRec27[0];
546 fRec26[1] = fRec26[0];
547 fRec25[1] = fRec25[0];
548 fRec23[2] = fRec23[1]; fRec23[1] = fRec23[0];
549 fRec24[1] = fRec24[0];
550 fRec2[1] = fRec2[0];
551 iRec1[1] = iRec1[0];
552 fRec0[1] = fRec0[0];
553 IOTA = IOTA+1;
554 fRec17[1] = fRec17[0];
555 fRec16[1] = fRec16[0];
556 fRec15[1] = fRec15[0];
557 fRec14[1] = fRec14[0];
558 fRec13[1] = fRec13[0];
559 fRec5[2] = fRec5[1]; fRec5[1] = fRec5[0];
560 fRec6[1] = fRec6[0];
561 fVec3[1] = fVec3[0];
562 fRec7[2] = fRec7[1]; fRec7[1] = fRec7[0];
563 fRec8[1] = fRec8[0];
564 fVec2[1] = fVec2[0];
565 fRec9[2] = fRec9[1]; fRec9[1] = fRec9[0];
566 fRec10[1] = fRec10[0];
567 fVec1[1] = fVec1[0];
568 fRec11[2] = fRec11[1]; fRec11[1] = fRec11[0];
569 fRec12[1] = fRec12[0];
570 fVec0[1] = fVec0[0];
571 }
572 #undef fslider0
573 #undef fslider1
574 #undef fslider2
575 #undef fslider3
576 #undef fslider4
577 #undef fslider5
578 #undef fbargraph0
579 #undef fslider6
580 #undef fslider7
581 #undef fbargraph1
582 #undef fslider8
583 #undef fslider9
584 #undef fbargraph2
585 #undef fslider10
586 #undef fslider11
587 #undef fbargraph3
588 #undef fslider12
589 #undef fslider13
590 #undef fbargraph4
591 }
592
593 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
594 {
595 static_cast<Dsp*>(p)->compute(count, input0, output0);
596 }
597
598
599 void Dsp::connect(uint32_t port,void* data)
600 {
601 switch ((PortIndex)port)
602 {
603 case CROSSOVER_B1_B2:
604 fslider0_ = (float*)data; // , 8e+01, 2e+01, 2e+04, 1.08
605 break;
606 case CROSSOVER_B2_B3:
607 fslider1_ = (float*)data; // , 2.1e+02, 2e+01, 2e+04, 1.08
608 break;
609 case CROSSOVER_B3_B4:
610 fslider2_ = (float*)data; // , 1.7e+03, 2e+01, 2e+04, 1.08
611 break;
612 case CROSSOVER_B4_B5:
613 fslider3_ = (float*)data; // , 5e+03, 2e+01, 2e+04, 1.08
614 break;
615 case PERCENT1:
616 fslider5_ = (float*)data; // , 1e+01, 0.0, 1e+02, 0.1
617 break;
618 case PERCENT2:
619 fslider7_ = (float*)data; // , 3e+01, 0.0, 1e+02, 0.1
620 break;
621 case PERCENT3:
622 fslider9_ = (float*)data; // , 45.0, 0.0, 1e+02, 0.1
623 break;
624 case PERCENT4:
625 fslider11_ = (float*)data; // , 2e+01, 0.0, 1e+02, 0.1
626 break;
627 case PERCENT5:
628 fslider13_ = (float*)data; // , 0.0, 0.0, 1e+02, 0.1
629 break;
630 case TIME1:
631 fslider4_ = (float*)data; // , 3e+01, 24.0, 3.6e+02, 1.0
632 break;
633 case TIME2:
634 fslider6_ = (float*)data; // , 6e+01, 24.0, 3.6e+02, 1.0
635 break;
636 case TIME3:
637 fslider8_ = (float*)data; // , 1.2e+02, 24.0, 3.6e+02, 1.0
638 break;
639 case TIME4:
640 fslider10_ = (float*)data; // , 1.5e+02, 24.0, 3.6e+02, 1.0
641 break;
642 case TIME5:
643 fslider12_ = (float*)data; // , 2.4e+02, 24.0, 3.6e+02, 1.0
644 break;
645 case V1:
646 fbargraph0_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
647 break;
648 case V2:
649 fbargraph1_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
650 break;
651 case V3:
652 fbargraph2_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
653 break;
654 case V4:
655 fbargraph3_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
656 break;
657 case V5:
658 fbargraph4_ = (float*)data; // , -70.0, -70.0, 4.0, 0.00001
659 break;
660 default:
661 break;
662 }
663 }
664
665 void Dsp::connect_static(uint32_t port,void* data, PluginLV2 *p)
666 {
667 static_cast<Dsp*>(p)->connect(port, data);
668 }
669
670
671 PluginLV2 *plugin() {
672 return new Dsp();
673 }
674
675 void Dsp::del_instance(PluginLV2 *p)
676 {
677 delete static_cast<Dsp*>(p);
678 }
679
680 /*
681 typedef enum
682 {
683 CROSSOVER_B1_B2,
684 CROSSOVER_B2_B3,
685 CROSSOVER_B3_B4,
686 CROSSOVER_B4_B5,
687 PERCENT1,
688 PERCENT2,
689 PERCENT3,
690 PERCENT4,
691 PERCENT5,
692 TIME1,
693 TIME2,
694 TIME3,
695 TIME4,
696 TIME5,
697 V1,
698 V2,
699 V3,
700 V4,
701 V5,
702 } PortIndex;
703 */
704
705 } // end namespace mbe
2727 void connect(uint32_t port,void* data);
2828 void clear_state_f();
2929 void init(uint32_t samplingFreq);
30 void compute(int count, float *input0, float *input1, float *output0, float *output1);
30 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
3131
3232 static void clear_state_f_static(PluginLV2*);
3333 static void init_static(uint32_t samplingFreq, PluginLV2*);
34 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
34 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
3535 static void del_instance(PluginLV2 *p);
3636 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3737 public:
9292 static_cast<Dsp*>(p)->init(samplingFreq);
9393 }
9494
95 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
95 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
9696 {
9797 #define fslider0 (*fslider0_)
9898 #define fslider1 (*fslider1_)
136136 #undef fslider1
137137 }
138138
139 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
139 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
140140 {
141141 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
142142 }
1515 void connect(uint32_t port,void* data);
1616 void clear_state_f();
1717 void init(uint32_t samplingFreq);
18 void compute(int count, float *input0, float *output0);
18 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1919
2020 static void clear_state_f_static(PluginLV2*);
2121 static void init_static(uint32_t samplingFreq, PluginLV2*);
22 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
22 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2323 static void del_instance(PluginLV2 *p);
2424 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2525 public:
7070 static_cast<Dsp*>(p)->init(samplingFreq);
7171 }
7272
73 void always_inline Dsp::compute(int count, float *input0, float *output0)
73 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7474 {
7575 #define fslider0 (*fslider0_)
7676 double fSlow0 = fslider0;
8989 #undef fslider0
9090 }
9191
92 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
92 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
9393 {
9494 static_cast<Dsp*>(p)->compute(count, input0, output0);
9595 }
1010 void connect(uint32_t port,void* data);
1111 void clear_state_f();
1212 void init(uint32_t samplingFreq);
13 void compute(int count, float *input0, float *output0);
13 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1414
1515 static void clear_state_f_static(PluginLV2*);
1616 static void init_static(uint32_t samplingFreq, PluginLV2*);
17 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
17 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
1818 static void del_instance(PluginLV2 *p);
1919 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2020 public:
6262 static_cast<Dsp*>(p)->init(samplingFreq);
6363 }
6464
65 void always_inline Dsp::compute(int count, float *input0, float *output0)
65 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
6666 {
6767 for (int i=0; i<count; i++) {
6868 iRec0[0] = (12345 + (1103515245 * iRec0[1]));
7272 }
7373 }
7474
75 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
75 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
7676 {
7777 static_cast<Dsp*>(p)->compute(count, input0, output0);
7878 }
1414 void connect(uint32_t port,void* data);
1515 void clear_state_f();
1616 void init(uint32_t samplingFreq);
17 void compute(int count, float *input0, float *output0);
17 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1818
1919 static void clear_state_f_static(PluginLV2*);
2020 static void init_static(uint32_t samplingFreq, PluginLV2*);
21 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
21 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2222 static void del_instance(PluginLV2 *p);
2323 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2424 public:
6666 static_cast<Dsp*>(p)->init(samplingFreq);
6767 }
6868
69 void always_inline Dsp::compute(int count, float *input0, float *output0)
69 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7070 {
7171 #define fslider0 (*fslider0_)
7272 #define fslider1 (*fslider1_)
8989 #undef fslider1
9090 }
9191
92 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
92 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
9393 {
9494 static_cast<Dsp*>(p)->compute(count, input0, output0);
9595 }
4545 void connect(uint32_t port,void* data);
4646 void clear_state_f();
4747 void init(uint32_t samplingFreq);
48 void compute(int count, float *input0, float *input1, float *output0, float *output1);
48 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
4949
5050 static void clear_state_f_static(PluginLV2*);
5151 static void init_static(uint32_t samplingFreq, PluginLV2*);
52 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
52 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
5353 static void del_instance(PluginLV2 *p);
5454 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
5555 public:
112112 static_cast<Dsp*>(p)->init(samplingFreq);
113113 }
114114
115 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
115 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
116116 {
117117 #define fslider0 (*fslider0_)
118118 #define fcheckbox0 (*fcheckbox0_)
199199 #undef fslider7
200200 }
201201
202 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
202 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
203203 {
204204 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
205205 }
3232 void connect(uint32_t port,void* data);
3333 void clear_state_f();
3434 void init(uint32_t samplingFreq);
35 void compute(int count, float *input0, float *output0);
35 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
3636
3737 static void clear_state_f_static(PluginLV2*);
3838 static void init_static(uint32_t samplingFreq, PluginLV2*);
39 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
39 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
4040 static void del_instance(PluginLV2 *p);
4141 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
4242 public:
100100 static_cast<Dsp*>(p)->init(samplingFreq);
101101 }
102102
103 void always_inline Dsp::compute(int count, float *input0, float *output0)
103 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
104104 {
105105 #define fslider0 (*fslider0_)
106106 #define fslider1 (*fslider1_)
143143 #undef fslider2
144144 }
145145
146 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
146 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
147147 {
148148 static_cast<Dsp*>(p)->compute(count, input0, output0);
149149 }
8080 void connect(uint32_t port,void* data);
8181 void clear_state_f();
8282 void init(uint32_t samplingFreq);
83 void compute(int count, float *input0, float *output0);
83 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
8484
8585 static void clear_state_f_static(PluginLV2*);
8686 static void init_static(uint32_t samplingFreq, PluginLV2*);
87 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
87 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
8888 static void del_instance(PluginLV2 *p);
8989 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
9090 public:
142142 static_cast<Dsp*>(p)->init(samplingFreq);
143143 }
144144
145 void always_inline Dsp::compute(int count, float *input0, float *output0)
145 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
146146 {
147147 #define fslider0 (*fslider0_)
148148 #define fslider1 (*fslider1_)
330330 #undef fslider29
331331 }
332332
333 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
333 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
334334 {
335335 static_cast<Dsp*>(p)->compute(count, input0, output0);
336336 }
1010 FAUSTFLOAT *fslider0_;
1111 void connect(uint32_t port,void* data);
1212 void init(uint32_t samplingFreq);
13 void compute(int count, float *input0, float *output0);
13 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1414
1515 static void init_static(uint32_t samplingFreq, PluginLV2*);
16 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
16 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
1717 static void del_instance(PluginLV2 *p);
1818 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
1919 public:
5050 static_cast<Dsp*>(p)->init(samplingFreq);
5151 }
5252
53 void always_inline Dsp::compute(int count, float *input0, float *output0)
53 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
5454 {
5555 #define fslider0 (*fslider0_)
5656 double fSlow0 = (0.88 * (2 - fslider0));
6363 #undef fslider0
6464 }
6565
66 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
66 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
6767 {
6868 static_cast<Dsp*>(p)->compute(count, input0, output0);
6969 }
1010 void connect(uint32_t port,void* data);
1111 void clear_state_f();
1212 void init(uint32_t samplingFreq);
13 void compute(int count, float *input0, float *input1, float *output0, float *output1);
13 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
1414
1515 static void clear_state_f_static(PluginLV2*);
1616 static void init_static(uint32_t samplingFreq, PluginLV2*);
17 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
17 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
1818 static void del_instance(PluginLV2 *p);
1919 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2020 public:
6262 static_cast<Dsp*>(p)->init(samplingFreq);
6363 }
6464
65 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
65 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
6666 {
6767 for (int i=0; i<count; i++) {
6868 iRec0[0] = (12345 + (1103515245 * iRec0[1]));
7474 }
7575 }
7676
77 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
77 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
7878 {
7979 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
8080 }
4444 void clear_state_f();
4545 int activate(bool start);
4646 void init(uint32_t samplingFreq);
47 void compute(int count, float *input0, float *input1, float *output0, float *output1);
47 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
4848
4949 static void clear_state_f_static(PluginLV2*);
5050 static int activate_static(bool start, PluginLV2*);
5151 static void init_static(uint32_t samplingFreq, PluginLV2*);
52 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
52 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
5353 static void del_instance(PluginLV2 *p);
5454 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
5555 public:
149149 return static_cast<Dsp*>(p)->activate(start);
150150 }
151151
152 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
152 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
153153 {
154154 #define fslider0 (*fslider0_)
155155 #define fcheckbox0 (*fcheckbox0_)
212212 #undef fslider4
213213 }
214214
215 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
215 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
216216 {
217217 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
218218 }
4242 void clear_state_f();
4343 int activate(bool start);
4444 void init(uint32_t samplingFreq);
45 void compute(int count, float *input0, float *input1, float *output0, float *output1);
45 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
4646
4747 static void clear_state_f_static(PluginLV2*);
4848 static int activate_static(bool start, PluginLV2*);
4949 static void init_static(uint32_t samplingFreq, PluginLV2*);
50 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
50 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
5151 static void del_instance(PluginLV2 *p);
5252 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
5353 public:
145145 return static_cast<Dsp*>(p)->activate(start);
146146 }
147147
148 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
148 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
149149 {
150150 #define fslider0 (*fslider0_)
151151 #define fslider1 (*fslider1_)
202202 #undef fslider4
203203 }
204204
205 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
205 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
206206 {
207207 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
208208 }
8888 void connect(uint32_t port,void* data);
8989 void clear_state_f();
9090 void init(uint32_t samplingFreq);
91 void compute(int count, float *input0, float *input1, float *output0, float *output1);
91 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
9292
9393 static void clear_state_f_static(PluginLV2*);
9494 static void init_static(uint32_t samplingFreq, PluginLV2*);
95 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
95 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
9696 static void del_instance(PluginLV2 *p);
9797 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
9898 public:
208208 static_cast<Dsp*>(p)->init(samplingFreq);
209209 }
210210
211 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
211 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
212212 {
213213 #define fslider0 (*fslider0_)
214214 #define fslider1 (*fslider1_)
364364 #undef fcheckbox0
365365 }
366366
367 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
367 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
368368 {
369369 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
370370 }
7474 void connect(uint32_t port,void* data);
7575 void clear_state_f();
7676 void init(uint32_t samplingFreq);
77 void compute(int count, float *input0, float *input1, float *output0, float *output1);
77 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
7878
7979 static void clear_state_f_static(PluginLV2*);
8080 static void init_static(uint32_t samplingFreq, PluginLV2*);
81 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
81 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
8282 static void del_instance(PluginLV2 *p);
8383 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
8484 public:
180180 static_cast<Dsp*>(p)->init(samplingFreq);
181181 }
182182
183 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
183 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
184184 {
185185 #define fslider0 (*fslider0_)
186186 #define fslider1 (*fslider1_)
275275 #undef fcheckbox0
276276 }
277277
278 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
278 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
279279 {
280280 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
281281 }
2323 void connect(uint32_t port,void* data);
2424 void clear_state_f();
2525 void init(uint32_t samplingFreq);
26 void compute(int count, float *input0, float *output0);
26 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2727
2828 static void clear_state_f_static(PluginLV2*);
2929 static void init_static(uint32_t samplingFreq, PluginLV2*);
30 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
30 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
3131 static void del_instance(PluginLV2 *p);
3232 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3333 public:
8282 static_cast<Dsp*>(p)->init(samplingFreq);
8383 }
8484
85 void always_inline Dsp::compute(int count, float *input0, float *output0)
85 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8686 {
8787 #define fslider0 (*fslider0_)
8888 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, output0);
129129 }
2424 void connect(uint32_t port,void* data);
2525 void clear_state_f();
2626 void init(uint32_t samplingFreq);
27 void compute(int count, float *input0, float *input1, float *output0, float *output1);
27 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2828
2929 static void clear_state_f_static(PluginLV2*);
3030 static void init_static(uint32_t samplingFreq, PluginLV2*);
31 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
31 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
3232 static void del_instance(PluginLV2 *p);
3333 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3434 public:
8484 static_cast<Dsp*>(p)->init(samplingFreq);
8585 }
8686
87 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
87 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8888 {
8989 #define fslider0 (*fslider0_)
9090 #define fslider1 (*fslider1_)
128128 #undef fslider2
129129 }
130130
131 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
131 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
132132 {
133133 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
134134 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
2727 void connect(uint32_t port,void* data);
2828 void clear_state_f();
2929 void init(uint32_t samplingFreq);
30 void compute(int count, float *input0, float *output0);
30 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
3131
3232 static void clear_state_f_static(PluginLV2*);
3333 static void init_static(uint32_t samplingFreq, PluginLV2*);
34 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
34 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
3535 static void del_instance(PluginLV2 *p);
3636 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3737 public:
9090 static_cast<Dsp*>(p)->init(samplingFreq);
9191 }
9292
93 void always_inline Dsp::compute(int count, float *input0, float *output0)
93 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
9494 {
9595 #define fslider0 (*fslider0_)
9696 #define fslider1 (*fslider1_)
165165 #undef fslider2
166166 }
167167
168 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
168 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
169169 {
170170 static_cast<Dsp*>(p)->compute(count, input0, output0);
171171 }
3232 void connect(uint32_t port,void* data);
3333 void clear_state_f();
3434 void init(uint32_t samplingFreq);
35 void compute(int count, float *input0, float *input1, float *output0, float *output1);
35 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
3636
3737 static void clear_state_f_static(PluginLV2*);
3838 static void init_static(uint32_t samplingFreq, PluginLV2*);
39 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
39 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
4040 static void del_instance(PluginLV2 *p);
4141 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
4242 public:
100100 static_cast<Dsp*>(p)->init(samplingFreq);
101101 }
102102
103 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
103 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
104104 {
105105 #define fslider0 (*fslider0_)
106106 #define fslider1 (*fslider1_)
187187 #undef fslider2
188188 }
189189
190 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
190 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
191191 {
192192 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
193193 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
1919 void connect(uint32_t port,void* data);
2020 void clear_state_f();
2121 void init(uint32_t samplingFreq);
22 void compute(int count, float *input0, float *output0);
22 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2323
2424 static void clear_state_f_static(PluginLV2*);
2525 static void init_static(uint32_t samplingFreq, PluginLV2*);
26 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
2727 static void del_instance(PluginLV2 *p);
2828 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
2929 public:
7474 static_cast<Dsp*>(p)->init(samplingFreq);
7575 }
7676
77 void always_inline Dsp::compute(int count, float *input0, float *output0)
77 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7878 {
7979 #define fslider0 (*fslider0_)
8080 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
2020 void connect(uint32_t port,void* data);
2121 void clear_state_f();
2222 void init(uint32_t samplingFreq);
23 void compute(int count, float *input0, float *input1, float *output0, float *output1);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2424
2525 static void clear_state_f_static(PluginLV2*);
2626 static void init_static(uint32_t samplingFreq, PluginLV2*);
27 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
2828 static void del_instance(PluginLV2 *p);
2929 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3030 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
8080 {
8181 #define fslider0 (*fslider0_)
8282 #define fslider1 (*fslider1_)
123123 #undef fslider2
124124 }
125125
126 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginLV2 *p)
126 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
127127 {
128128 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
129129 }
2828 void connect(uint32_t port,void* data);
2929 void clear_state_f();
3030 void init(uint32_t samplingFreq);
31 void compute(int count, float *input0, float *output0);
31 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
3232
3333 static void clear_state_f_static(PluginLV2*);
3434 static void init_static(uint32_t samplingFreq, PluginLV2*);
35 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
35 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
3636 static void del_instance(PluginLV2 *p);
3737 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
3838 public:
9090 static_cast<Dsp*>(p)->init(samplingFreq);
9191 }
9292
93 void always_inline Dsp::compute(int count, float *input0, float *output0)
93 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
9494 {
9595 #define fslider0 (*fslider0_)
9696 #define fcheckbox0 (*fcheckbox0_)
130130 #undef fslider2
131131 }
132132
133 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
133 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
134134 {
135135 static_cast<Dsp*>(p)->compute(count, input0, output0);
136136 }
5151 void connect(uint32_t port,void* data);
5252 void clear_state_f();
5353 void init(uint32_t samplingFreq);
54 void compute(int count, float *input0, float *output0);
54 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
5555
5656 static void clear_state_f_static(PluginLV2*);
5757 static void init_static(uint32_t samplingFreq, PluginLV2*);
58 static void compute_static(int count, float *input0, float *output0, PluginLV2*);
58 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
5959 static void del_instance(PluginLV2 *p);
6060 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
6161 public:
138138 static_cast<Dsp*>(p)->init(samplingFreq);
139139 }
140140
141 void always_inline Dsp::compute(int count, float *input0, float *output0)
141 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
142142 {
143143 #define fcheckbox0 (*fcheckbox0_)
144144 #define fslider0 (*fslider0_)
205205 #undef fslider1
206206 }
207207
208 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginLV2 *p)
208 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
209209 {
210210 static_cast<Dsp*>(p)->compute(count, input0, output0);
211211 }
2929 @prefix opt: <http://lv2plug.in/ns/ext/options#> .
3030 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
3131 @prefix work: <http://lv2plug.in/ns/ext/worker#> .
32 @prefix mod: <http://portalmod.com/ns/modgui#> .
3233
3334 <http://guitarix.sourceforge.net#me>
3435 a foaf:Person ;
4344
4445 <http://guitarix.sourceforge.net/plugins/gx_amp#GUITARIX>
4546 a lv2:Plugin ,
46 lv2:AmplifierPlugin ;
47 lv2:SimulatorPlugin ;
4748 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4849 doap:name "GxAmplifier-X";
4950 doap:license <http://opensource.org/licenses/isc> ;
5657 bufsz:maxBlockLength 8192 ;
5758 lv2:extensionData work:interface ;
5859
60 lv2:minorVersion 28;
61 lv2:microVersion 3;
62
5963 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_amp#gui>;
60
64
65 rdfs:comment """
66 This plugin is the combination of guitarix's head, tonestack and cabinet, which, in that order, composes the signal path. In the tube-amp part, "PreGain" corresponds to the gain used at the amp input, "Drive" controls the power amp gain, "Distortion" is a blend between clean and distorted sound (lower boundary is all clean, upper boundary all distorted) and "MasterGain" controls the output gain. Mainly, the responsible for the signal distortion are "PreGain" and "Drive" parameters. Besides that, there is a list of possible valve combinations so you can vary your distortion.
67
68 At the Tonestack part, we find a basic equalization set ("Bass", "Middle", "Treble" and "Presence") and a list of tone-responses from a few well-known amps, you can check this list in the link at the end of this description (there might be some version differences).
69
70 Finally, at the Cabinet path, we have "Cabinet", which corresponds to another output gain, it doesn't distort the signal so it can be used as a Master output and there's another list, containing a virtual sound of the cabinet of speakers selected (more details in the link below).
71
72 Based on:
73 https://sourceforge.net/apps/mediawiki/guitarix/index.php?title=EnhancedUI
74 https://sourceforge.net/apps/mediawiki/guitarix/index.php?title=Tonestack
75 https://sourceforge.net/apps/mediawiki/guitarix/index.php?title=Cabinet_Impulse_Response_convolution
76 """;
77
6178 lv2:port [
6279 a lv2:InputPort ,
6380 lv2:ControlPort ;
275292 lv2:index 16 ;
276293 lv2:symbol "in" ;
277294 lv2:name "in" ;
295 ] ;
296 mod:gui [
297 a mod:Gui;
298 mod:resourcesDirectory <modgui>;
299 mod:iconTemplate <modgui/gx_amp.html>;
300 mod:templateData <modgui/gx_amp.json>;
301 mod:screenshot <modgui/gx_amp.png>;
302 mod:thumbnail <modgui/gx_amp-thumb.png>;
278303 ] .
304
279305
280306 <http://guitarix.sourceforge.net/plugins/gx_amp#gui>
281307 a guiext:GtkUI;
0 <div class="mod-pedal mod-rack-model-001 mod-rack-model-001">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-control-group clearfix">
5 <div class="mod-switch" mod-role="bypass">
6 <div class="mod-switch-image" mod-role="bypass-light"></div>
7 </div>
8 <div class="mod-separator"></div>
9 {{#controls.0}}
10 <div class="mod-chicken-head">
11 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
12 <span class="mod-chicken-head-title">{{name}}</span>
13 </div>
14 {{/controls.0}}
15 {{#controls.1}}
16 <div class="mod-chicken-head">
17 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
18 <span class="mod-chicken-head-title">{{name}}</span>
19 </div>
20 {{/controls.1}}
21 {{#controls.2}}
22 <div class="mod-chicken-head">
23 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
24 <span class="mod-chicken-head-title">{{name}}</span>
25 </div>
26 {{/controls.2}}
27 {{#controls.3}}
28 <div class="mod-chicken-head">
29 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
30 <span class="mod-chicken-head-title">{{name}}</span>
31 </div>
32 {{/controls.3}}
33 <div class="mod-separator"></div>
34 {{#controls.4}}
35 <div class="mod-chicken-head">
36 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
37 <span class="mod-chicken-head-title">{{name}}</span>
38 </div>
39 {{/controls.4}}
40 {{#controls.5}}
41 <div class="mod-chicken-head">
42 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
43 <span class="mod-chicken-head-title">{{name}}</span>
44 </div>
45 {{/controls.5}}
46 {{#controls.6}}
47 <div class="mod-chicken-head">
48 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
49 <span class="mod-chicken-head-title">{{name}}</span>
50 </div>
51 {{/controls.6}}
52 {{#controls.7}}
53 <div class="mod-chicken-head">
54 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
55 <span class="mod-chicken-head-title">{{name}}</span>
56 </div>
57 {{/controls.7}}
58 <div class="mod-separator"></div>
59 {{#controls.8}}
60 <div class="mod-chicken-head">
61 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
62 <span class="mod-chicken-head-title">{{name}}</span>
63 </div>
64 {{/controls.8}}
65 {{#controls.9}}
66 <div class="mod-enumerated mod-enumerated-1" mod-role="input-control-port" mod-port-symbol="{{symbol}}" mod-widget="custom-select">
67 <div mod-role="input-control-value" mod-port-symbol="{{symbol}}" class="mod-enumerated-selected"></div>
68 <div class="mod-enumerated-list" mod-widget-property="hidden">
69 {{#scalePoints}}
70 <div mod-role="enumeration-option" mod-port-value="{{value}}">{{label}}</div>
71 {{/scalePoints}}
72 </div>
73 </div>
74 {{/controls.9}}
75 {{#controls.10}}
76 <div class="mod-enumerated mod-enumerated-2" mod-role="input-control-port" mod-port-symbol="{{symbol}}" mod-widget="custom-select">
77 <div mod-role="input-control-value" mod-port-symbol="{{symbol}}" class="mod-enumerated-selected"></div>
78 <div class="mod-enumerated-list" mod-widget-property="hidden">
79 {{#scalePoints}}
80 <div mod-role="enumeration-option" mod-port-value="{{value}}">{{label}}</div>
81 {{/scalePoints}}
82 </div>
83 </div>
84 {{/controls.10}}
85 {{#controls.11}}
86 <div class="mod-enumerated mod-enumerated-3" mod-role="input-control-port" mod-port-symbol="{{symbol}}" mod-widget="custom-select">
87 <div mod-role="input-control-value" mod-port-symbol="{{symbol}}" class="mod-enumerated-selected"></div>
88 <div class="mod-enumerated-list" mod-widget-property="hidden">
89 {{#scalePoints}}
90 <div mod-role="enumeration-option" mod-port-value="{{value}}">{{label}}</div>
91 {{/scalePoints}}
92 </div>
93 </div>
94 {{/controls.11}}
95 </div>
96 <div class="mod-pedal-input">
97 {{#effect.ports.audio.input}}
98 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
99 <div class="mod-pedal-input-image"></div>
100 </div>
101 {{/effect.ports.audio.input}}
102 {{#effect.ports.midi.input}}
103 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
104 <div class="mod-pedal-input-image"></div>
105 </div>
106 {{/effect.ports.midi.input}}
107 </div>
108 <div class="mod-pedal-output">
109 {{#effect.ports.audio.output}}
110 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
111 <div class="mod-pedal-output-image"></div>
112 </div>
113 {{/effect.ports.audio.output}}
114 {{#effect.ports.midi.output}}
115 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
116 <div class="mod-pedal-input-image"></div>
117 </div>
118 {{/effect.ports.midi.output}}
119 </div>
120 </div>
0 {
1 "author": "Guitarix",
2 "controls": [
3 {
4 "name": "PreGain",
5 "symbol": "PreGain"
6 },
7 {
8 "name": "Drive",
9 "symbol": "Drive"
10 },
11 {
12 "name": "Distortion",
13 "symbol": "Distortion"
14 },
15 {
16 "name": "MasterGain",
17 "symbol": "MasterGain"
18 },
19 {
20 "name": "Bass",
21 "symbol": "Bass"
22 },
23 {
24 "name": "Middle",
25 "symbol": "Middle"
26 },
27 {
28 "name": "Treble",
29 "symbol": "Treble"
30 },
31 {
32 "name": "Presence",
33 "symbol": "Presence"
34 },
35 {
36 "name": "Cabinet",
37 "symbol": "Cabinet"
38 },
39 {
40 "name": "Model",
41 "symbol": "model"
42 },
43 {
44 "name": "Tonestack Model",
45 "symbol": "t_model"
46 },
47 {
48 "name": "Cab Model",
49 "symbol": "c_model"
50 }
51 ],
52 "label": "GX Amplifier X"
53 }
350350 rcfile += to_string(model);
351351 rcfile += ".rc";
352352 gtk_rc_parse(rcfile.c_str());
353 gtk_rc_reparse_all_for_settings(gtk_settings_get_default(),true);
353 // gtk_rc_reparse_all_for_settings(gtk_settings_get_default(),true);
354354 Glib::ustring o = "widget \"*." + plug_name + "\" style:highest \"gx_lv2-" + to_string(model) + "\"";
355355 gtk_rc_parse_string(o.c_str());
356356 gtk_rc_reset_styles(gtk_settings_get_default());
8080 bld.install_files('${LV2DIR}/gx_amp.lv2', 'manifest.ttl')
8181 bld.install_files('${LV2DIR}/gx_amp.lv2', 'gx_amp.ttl')
8282
83 bld.install_files('${LV2DIR}/gx_amp.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2929 @prefix opt: <http://lv2plug.in/ns/ext/options#> .
3030 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
3131 @prefix work: <http://lv2plug.in/ns/ext/worker#> .
32 @prefix mod: <http://portalmod.com/ns/modgui#> .
3233
3334 <http://guitarix.sourceforge.net#me>
3435 a foaf:Person ;
4344
4445 <http://guitarix.sourceforge.net/plugins/gx_amp_stereo#GUITARIX_ST>
4546 a lv2:Plugin ,
46 lv2:AmplifierPlugin ;
47 lv2:SimulatorPlugin ;
4748 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4849 doap:name "GxAmplifier-Stereo-X";
4950 doap:license <http://opensource.org/licenses/isc> ;
5859
5960 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_amp_stereo#gui>;
6061
62 lv2:minorVersion 28;
63 lv2:microVersion 3;
64
65 rdfs:comment """
66 Stereo version of gx_amp.
67
68 This plugin is the combination of guitarix's head, tonestack and cabinet, which, in that order, composes the signal path. In the tube-amp part, "PreGain" corresponds to the gain used at the amp input, "Drive" controls the power amp gain, "Distortion" is a blend between clean and distorted sound (lower boundary is all clean, upper boundary all distorted) and "MasterGain" controls the output gain. Mainly, the responsible for the signal distortion are "PreGain" and "Drive" parameters. Besides that, there is a list of possible valve combinations so you can vary your distortion.
69
70 At the Tonestack part, we find a basic equalization set ("Bass", "Middle", "Treble" and "Presence") and a list of tone-responses from a few well-known amps, you can check this list in the link at the end of this description (there might be some version differences).
71
72 Finally, at the Cabinet path, we have "Cabinet", which corresponds to another output gain, it doesn't distort the signal so it can be used as a Master output and there's another list, containing a virtual sound of the cabinet of speakers selected (more details in the link below).
73
74 Based on:
75 https://sourceforge.net/apps/mediawiki/guitarix/index.php?title=EnhancedUI
76 https://sourceforge.net/apps/mediawiki/guitarix/index.php?title=Tonestack
77 https://sourceforge.net/apps/mediawiki/guitarix/index.php?title=Cabinet_Impulse_Response_convolution
78 """;
79
80
6181 lv2:port [
6282 a lv2:InputPort ,
6383 lv2:ControlPort ;
287307 lv2:index 18 ;
288308 lv2:symbol "in1" ;
289309 lv2:name "In1" ;
310 ] ;
311 mod:gui [
312 a mod:Gui;
313 mod:resourcesDirectory <modgui>;
314 mod:iconTemplate <modgui/gx_amp_stereo.html>;
315 mod:templateData <modgui/gx_amp_stereo.json>;
316 mod:screenshot <modgui/gx_amp_stereo.png>;
317 mod:thumbnail <modgui/gx_amp_stereo-thumb.png>;
290318 ] .
319
291320
292321 <http://guitarix.sourceforge.net/plugins/gx_amp_stereo#gui>
293322 a guiext:GtkUI;
0 <div class="mod-pedal mod-rack-model-001 mod-rack-model-001">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-control-group clearfix">
5 <div class="mod-switch" mod-role="bypass">
6 <div class="mod-switch-image" mod-role="bypass-light"></div>
7 </div>
8 <div class="mod-separator"></div>
9 {{#controls.0}}
10 <div class="mod-chicken-head">
11 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
12 <span class="mod-chicken-head-title">{{name}}</span>
13 </div>
14 {{/controls.0}}
15 {{#controls.1}}
16 <div class="mod-chicken-head">
17 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
18 <span class="mod-chicken-head-title">{{name}}</span>
19 </div>
20 {{/controls.1}}
21 {{#controls.2}}
22 <div class="mod-chicken-head">
23 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
24 <span class="mod-chicken-head-title">{{name}}</span>
25 </div>
26 {{/controls.2}}
27 {{#controls.3}}
28 <div class="mod-chicken-head">
29 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
30 <span class="mod-chicken-head-title">{{name}}</span>
31 </div>
32 {{/controls.3}}
33 <div class="mod-separator"></div>
34 {{#controls.4}}
35 <div class="mod-chicken-head">
36 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
37 <span class="mod-chicken-head-title">{{name}}</span>
38 </div>
39 {{/controls.4}}
40 {{#controls.5}}
41 <div class="mod-chicken-head">
42 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
43 <span class="mod-chicken-head-title">{{name}}</span>
44 </div>
45 {{/controls.5}}
46 {{#controls.6}}
47 <div class="mod-chicken-head">
48 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
49 <span class="mod-chicken-head-title">{{name}}</span>
50 </div>
51 {{/controls.6}}
52 {{#controls.7}}
53 <div class="mod-chicken-head">
54 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
55 <span class="mod-chicken-head-title">{{name}}</span>
56 </div>
57 {{/controls.7}}
58 <div class="mod-separator"></div>
59 {{#controls.8}}
60 <div class="mod-chicken-head">
61 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
62 <span class="mod-chicken-head-title">{{name}}</span>
63 </div>
64 {{/controls.8}}
65 {{#controls.9}}
66 <div class="mod-enumerated mod-enumerated-1" mod-role="input-control-port" mod-port-symbol="{{symbol}}" mod-widget="custom-select">
67 <div mod-role="input-control-value" mod-port-symbol="{{symbol}}" class="mod-enumerated-selected"></div>
68 <div class="mod-enumerated-list" mod-widget-property="hidden">
69 {{#scalePoints}}
70 <div mod-role="enumeration-option" mod-port-value="{{value}}">{{label}}</div>
71 {{/scalePoints}}
72 </div>
73 </div>
74 {{/controls.9}}
75 {{#controls.10}}
76 <div class="mod-enumerated mod-enumerated-2" mod-role="input-control-port" mod-port-symbol="{{symbol}}" mod-widget="custom-select">
77 <div mod-role="input-control-value" mod-port-symbol="{{symbol}}" class="mod-enumerated-selected"></div>
78 <div class="mod-enumerated-list" mod-widget-property="hidden">
79 {{#scalePoints}}
80 <div mod-role="enumeration-option" mod-port-value="{{value}}">{{label}}</div>
81 {{/scalePoints}}
82 </div>
83 </div>
84 {{/controls.10}}
85 {{#controls.11}}
86 <div class="mod-enumerated mod-enumerated-3" mod-role="input-control-port" mod-port-symbol="{{symbol}}" mod-widget="custom-select">
87 <div mod-role="input-control-value" mod-port-symbol="{{symbol}}" class="mod-enumerated-selected"></div>
88 <div class="mod-enumerated-list" mod-widget-property="hidden">
89 {{#scalePoints}}
90 <div mod-role="enumeration-option" mod-port-value="{{value}}">{{label}}</div>
91 {{/scalePoints}}
92 </div>
93 </div>
94 {{/controls.11}}
95 </div>
96 <div class="mod-pedal-input">
97 {{#effect.ports.audio.input}}
98 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
99 <div class="mod-pedal-input-image"></div>
100 </div>
101 {{/effect.ports.audio.input}}
102 {{#effect.ports.midi.input}}
103 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
104 <div class="mod-pedal-input-image"></div>
105 </div>
106 {{/effect.ports.midi.input}}
107 </div>
108 <div class="mod-pedal-output">
109 {{#effect.ports.audio.output}}
110 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
111 <div class="mod-pedal-output-image"></div>
112 </div>
113 {{/effect.ports.audio.output}}
114 {{#effect.ports.midi.output}}
115 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
116 <div class="mod-pedal-input-image"></div>
117 </div>
118 {{/effect.ports.midi.output}}
119 </div>
120 </div>
0 {
1 "author": "Guitarix",
2 "controls": [
3 {
4 "name": "PreGain",
5 "symbol": "PreGain"
6 },
7 {
8 "name": "Drive",
9 "symbol": "Drive"
10 },
11 {
12 "name": "Distortion",
13 "symbol": "Distortion"
14 },
15 {
16 "name": "MasterGain",
17 "symbol": "MasterGain"
18 },
19 {
20 "name": "Bass",
21 "symbol": "Bass"
22 },
23 {
24 "name": "Middle",
25 "symbol": "Middle"
26 },
27 {
28 "name": "Treble",
29 "symbol": "Treble"
30 },
31 {
32 "name": "Presence",
33 "symbol": "Presence"
34 },
35 {
36 "name": "Cabinet",
37 "symbol": "Cabinet"
38 },
39 {
40 "name": "Model",
41 "symbol": "model"
42 },
43 {
44 "name": "Tonestack Model",
45 "symbol": "t_model"
46 },
47 {
48 "name": "Cab Model",
49 "symbol": "c_model"
50 }
51 ],
52 "label": "Stereo Amp X"
53 }
349349 rcfile += to_string(model);
350350 rcfile += ".rc";
351351 gtk_rc_parse(rcfile.c_str());
352 gtk_rc_reparse_all_for_settings(gtk_settings_get_default(),true);
352 //gtk_rc_reparse_all_for_settings(gtk_settings_get_default(),true);
353353 Glib::ustring o = "widget \"*." + plug_name + "\" style:highest \"gx_lv2-" + to_string(model) + "\"";
354354 gtk_rc_parse_string(o.c_str());
355355 gtk_rc_reset_styles(gtk_settings_get_default());
8080 bld.install_files('${LV2DIR}/gx_amp_stereo.lv2', 'manifest.ttl')
8181 bld.install_files('${LV2DIR}/gx_amp_stereo.lv2', 'gx_amp_stereo.ttl')
8282
83 bld.install_files('${LV2DIR}/gx_amp_stereo.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
0 static const unsigned int bark_center_freqs[] = {50, 150, 250, 350, 450, 570, 700,840,1000,1170,1370,1600,1850,2150,2500,2900,3400,4000,4800,5800,7000,8500,10500,13500};
1 static const unsigned int bark_bands_widths[] = {80,100,100,100,110,120,140,150,160,190,210,240,280,320,380,450,550,700,900,1100,1300,1800,2500,3500};
2 #define BARK_NUMBER_OF_BANDS (24)
0 namespace barkgraphiceq {
1
2 #include "bark_freq_grid.h"
3
4 #include <iostream>
5
6 class Dsp: public PluginLV2 {
7 private:
8 int fSamplingFreq;
9
10 //First elements in both arrays are common gains
11 float* fslider[BARK_NUMBER_OF_BANDS];
12 float* fbargraph[BARK_NUMBER_OF_BANDS];
13 orfanidis_eq::eq* p_eq;
14
15 void connect(uint32_t port,void* data);
16 void clear_state_f();
17 void init(uint32_t samplingFreq);
18 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
19
20 static void clear_state_f_static(PluginLV2*);
21 static void init_static(uint32_t samplingFreq, PluginLV2*);
22 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
23 static void del_instance(PluginLV2 *p);
24 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
25
26 public:
27 Dsp();
28 ~Dsp();
29 };
30
31 Dsp::Dsp()
32 : PluginLV2() {
33
34 version = PLUGINLV2_VERSION;
35 id = "barkgraphiceq";
36 name = N_("Bark Grid EQ");
37 mono_audio = compute_static;
38 stereo_audio = 0;
39 set_samplerate = init_static;
40 activate_plugin = 0;
41 connect_ports = connect_static;
42 clear_state = clear_state_f_static;
43 delete_instance = del_instance;
44
45 p_eq = NULL;
46
47 clear_state_f();
48
49 }
50
51 Dsp::~Dsp() {
52 }
53
54 inline void Dsp::clear_state_f()
55 {
56 for(unsigned int i = 0; i < BARK_NUMBER_OF_BANDS; i++)
57 {
58 fslider[i] = 0;
59 fbargraph[i] = 0;
60 }
61 }
62
63 void Dsp::clear_state_f_static(PluginLV2 *p)
64 {
65 static_cast<Dsp*>(p)->clear_state_f();
66 }
67
68 inline void Dsp::init(unsigned int samplingFreq)
69 {
70 fSamplingFreq = samplingFreq;
71
72 orfanidis_eq::freq_grid fg;
73
74 //Apply Bark frequency grid
75 for (unsigned int i = 0; i < BARK_NUMBER_OF_BANDS; i++)
76 fg.add_band(bark_center_freqs[i], bark_bands_widths[i]);
77
78 //Create Butterworth EQ object
79 p_eq = new orfanidis_eq::eq(fg, orfanidis_eq::butterworth);
80
81 clear_state_f();
82 }
83
84 void Dsp::init_static(unsigned int samplingFreq, PluginLV2 *p)
85 {
86 static_cast<Dsp*>(p)->init(samplingFreq);
87 }
88
89 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
90 {
91 //Set params
92 for(unsigned int j = 0; j < BARK_NUMBER_OF_BANDS; j++) {
93 p_eq->change_band_param_db(j, *fslider[j]);
94 }
95
96 for (int i=0; i<count; i++) {
97 //sbs processing, note:p_eq works with doubles
98 double out = 0;
99 for(unsigned int j = 0; j < BARK_NUMBER_OF_BANDS; j++) {
100 double input = input0[i];
101 double band_out = 0;
102 p_eq->sbs_process_band(j, &input, &band_out);
103 *fbargraph[j] = BARK_NUMBER_OF_BANDS*band_out*band_out;
104 out += band_out;
105 }
106 output0[i] = out;
107 }
108 }
109
110 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
111 {
112 static_cast<Dsp*>(p)->compute(count, input0, output0);
113 }
114
115 void Dsp::connect(uint32_t port,void* data)
116 {
117 switch ((PortIndex)port)
118 {
119 case G1:
120 fslider[0] = (float*)data;
121 break;
122 case G2:
123 fslider[1] = (float*)data;
124 break;
125 case G3:
126 fslider[2] = (float*)data;
127 break;
128 case G4:
129 fslider[3] = (float*)data;
130 break;
131 case G5:
132 fslider[4] = (float*)data;
133 break;
134 case G6:
135 fslider[5] = (float*)data;
136 break;
137 case G7:
138 fslider[6] = (float*)data;
139 break;
140 case G8:
141 fslider[7] = (float*)data;
142 break;
143 case G9:
144 fslider[8] = (float*)data;
145 break;
146 case G10:
147 fslider[9] = (float*)data;
148 break;
149 case G11:
150 fslider[10] = (float*)data;
151 break;
152 case G12:
153 fslider[11] = (float*)data;
154 break;
155 case G13:
156 fslider[12] = (float*)data;
157 break;
158 case G14:
159 fslider[13] = (float*)data;
160 break;
161 case G15:
162 fslider[14] = (float*)data;
163 break;
164 case G16:
165 fslider[15] = (float*)data;
166 break;
167 case G17:
168 fslider[16] = (float*)data;
169 break;
170 case G18:
171 fslider[17] = (float*)data;
172 break;
173 case G19:
174 fslider[18] = (float*)data;
175 break;
176 case G20:
177 fslider[19] = (float*)data;
178 break;
179 case G21:
180 fslider[20] = (float*)data;
181 break;
182 case G22:
183 fslider[21] = (float*)data;
184 break;
185 case G23:
186 fslider[22] = (float*)data;
187 break;
188 case G24:
189 fslider[23] = (float*)data;
190 break;
191
192 case V1:
193 fbargraph[0] = (float*)data;
194 break;
195 case V2:
196 fbargraph[1] = (float*)data;
197 break;
198 case V3:
199 fbargraph[2] = (float*)data;
200 break;
201 case V4:
202 fbargraph[3] = (float*)data;
203 break;
204 case V5:
205 fbargraph[4] = (float*)data;
206 break;
207 case V6:
208 fbargraph[5] = (float*)data;
209 break;
210 case V7:
211 fbargraph[6] = (float*)data;
212 break;
213 case V8:
214 fbargraph[7] = (float*)data;
215 break;
216 case V9:
217 fbargraph[8] = (float*)data;
218 break;
219 case V10:
220 fbargraph[9] = (float*)data;
221 break;
222 case V11:
223 fbargraph[10] = (float*)data;
224 break;
225 case V12:
226 fbargraph[11] = (float*)data;
227 break;
228 case V13:
229 fbargraph[12] = (float*)data;
230 break;
231 case V14:
232 fbargraph[13] = (float*)data;
233 break;
234 case V15:
235 fbargraph[14] = (float*)data;
236 break;
237 case V16:
238 fbargraph[15] = (float*)data;
239 break;
240 case V17:
241 fbargraph[16] = (float*)data;
242 break;
243 case V18:
244 fbargraph[17] = (float*)data;
245 break;
246 case V19:
247 fbargraph[18] = (float*)data;
248 break;
249 case V20:
250 fbargraph[19] = (float*)data;
251 break;
252 case V21:
253 fbargraph[20] = (float*)data;
254 break;
255 case V22:
256 fbargraph[21] = (float*)data;
257 break;
258 case V23:
259 fbargraph[22] = (float*)data;
260 break;
261 case V24:
262 fbargraph[23] = (float*)data;
263 break;
264
265 default:
266 break;
267 }
268 }
269
270 void Dsp::connect_static(uint32_t port,void* data, PluginLV2 *p)
271 {
272 static_cast<Dsp*>(p)->connect(port, data);
273 }
274
275 PluginLV2 *plugin() {
276 return new Dsp();
277 }
278
279 void Dsp::del_instance(PluginLV2 *p)
280 {
281 //Delete eq
282 delete static_cast<Dsp*>(p)->p_eq;
283 delete static_cast<Dsp*>(p);
284 }
285
286 } // end namespace barkgraphiceq
287
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 ////////////////////////////// LOCAL INCLUDES //////////////////////////
21 #include "orfanidis_eq.h"
22
23 #include "gx_common.h" // faust support and denormal protection (SSE)
24 #include "gx_barkgraphiceq.h" // define struct PortIndex
25 #include "gx_pluginlv2.h" // define struct PluginLV2
26 #include "barkgraphiceq.cc" // Must be here, because have std::vector<> conflicts with some other header
27
28 ////////////////////////////// PLUG-IN CLASS ///////////////////////////
29
30 class Gx_barkgraphiceq_
31 {
32 private:
33 // pointer to buffer
34 float* output;
35 float* input;
36 // pointer to dsp class
37 PluginLV2* barkgraphiceq;
38 // private functions
39 inline void run_dsp_(uint32_t n_samples);
40 inline void connect_(uint32_t port,void* data);
41 inline void init_dsp_(uint32_t rate);
42 inline void connect_all__ports(uint32_t port, void* data);
43 inline void activate_f();
44 inline void clean_up();
45 inline void deactivate_f();
46
47 public:
48 // LV2 Descriptor
49 static const LV2_Descriptor descriptor;
50 // static wrapper to private functions
51 static void deactivate(LV2_Handle instance);
52 static void cleanup(LV2_Handle instance);
53 static void run(LV2_Handle instance, uint32_t n_samples);
54 static void activate(LV2_Handle instance);
55 static void connect_port(LV2_Handle instance, uint32_t port, void* data);
56 static LV2_Handle instantiate(const LV2_Descriptor* descriptor,
57 double rate, const char* bundle_path,
58 const LV2_Feature* const* features);
59 Gx_barkgraphiceq_();
60 ~Gx_barkgraphiceq_();
61 };
62
63 // constructor
64 Gx_barkgraphiceq_::Gx_barkgraphiceq_() :
65 output(NULL),
66 input(NULL),
67 barkgraphiceq(barkgraphiceq::plugin()) {};
68
69 // destructor
70 Gx_barkgraphiceq_::~Gx_barkgraphiceq_()
71 {
72 // just to be sure the plug have given free the allocated mem
73 // it didn't hurd if the mem is already given free by clean_up()
74 if (barkgraphiceq->activate_plugin !=0)
75 barkgraphiceq->activate_plugin(false, barkgraphiceq);
76 // delete DSP class
77 barkgraphiceq->delete_instance(barkgraphiceq);
78 };
79
80 ///////////////////////// PRIVATE CLASS FUNCTIONS /////////////////////
81
82 void Gx_barkgraphiceq_::init_dsp_(uint32_t rate)
83 {
84 AVOIDDENORMALS(); // init the SSE denormal protection
85 barkgraphiceq->set_samplerate(rate, barkgraphiceq); // init the DSP class
86 }
87
88 // connect the Ports used by the plug-in class
89 void Gx_barkgraphiceq_::connect_(uint32_t port,void* data)
90 {
91 switch ((PortIndex)port)
92 {
93 case EFFECTS_OUTPUT:
94 output = static_cast<float*>(data);
95 break;
96 case EFFECTS_INPUT:
97 input = static_cast<float*>(data);
98 break;
99 default:
100 break;
101 }
102 }
103
104 void Gx_barkgraphiceq_::activate_f()
105 {
106 // allocate the internal DSP mem
107 if (barkgraphiceq->activate_plugin !=0)
108 barkgraphiceq->activate_plugin(true, barkgraphiceq);
109 }
110
111 void Gx_barkgraphiceq_::clean_up()
112 {
113 // delete the internal DSP mem
114 if (barkgraphiceq->activate_plugin !=0)
115 barkgraphiceq->activate_plugin(false, barkgraphiceq);
116 }
117
118 void Gx_barkgraphiceq_::deactivate_f()
119 {
120 // delete the internal DSP mem
121 if (barkgraphiceq->activate_plugin !=0)
122 barkgraphiceq->activate_plugin(false, barkgraphiceq);
123 }
124
125 void Gx_barkgraphiceq_::run_dsp_(uint32_t n_samples)
126 {
127 barkgraphiceq->mono_audio(static_cast<int>(n_samples), input, output, barkgraphiceq);
128 }
129
130 void Gx_barkgraphiceq_::connect_all__ports(uint32_t port, void* data)
131 {
132 // connect the Ports used by the plug-in class
133 connect_(port,data);
134 // connect the Ports used by the DSP class
135 barkgraphiceq->connect_ports(port, data, barkgraphiceq);
136 }
137
138 ////////////////////// STATIC CLASS FUNCTIONS ////////////////////////
139
140 LV2_Handle
141 Gx_barkgraphiceq_::instantiate(const LV2_Descriptor* descriptor,
142 double rate, const char* bundle_path,
143 const LV2_Feature* const* features)
144 {
145 // init the plug-in class
146 Gx_barkgraphiceq_ *self = new Gx_barkgraphiceq_();
147 if (!self)
148 {
149 return NULL;
150 }
151
152 self->init_dsp_((uint32_t)rate);
153
154 return (LV2_Handle)self;
155 }
156
157 void Gx_barkgraphiceq_::connect_port(LV2_Handle instance,
158 uint32_t port, void* data)
159 {
160 // connect all ports
161 static_cast<Gx_barkgraphiceq_*>(instance)->connect_all__ports(port, data);
162 }
163
164 void Gx_barkgraphiceq_::activate(LV2_Handle instance)
165 {
166 // allocate needed mem
167 static_cast<Gx_barkgraphiceq_*>(instance)->activate_f();
168 }
169
170 void Gx_barkgraphiceq_::run(LV2_Handle instance, uint32_t n_samples)
171 {
172 // run dsp
173 static_cast<Gx_barkgraphiceq_*>(instance)->run_dsp_(n_samples);
174 }
175
176 void Gx_barkgraphiceq_::deactivate(LV2_Handle instance)
177 {
178 // free allocated mem
179 static_cast<Gx_barkgraphiceq_*>(instance)->deactivate_f();
180 }
181
182 void Gx_barkgraphiceq_::cleanup(LV2_Handle instance)
183 {
184 // well, clean up after us
185 Gx_barkgraphiceq_* self = static_cast<Gx_barkgraphiceq_*>(instance);
186 self->clean_up();
187 delete self;
188 }
189
190 const LV2_Descriptor Gx_barkgraphiceq_::descriptor =
191 {
192 GXPLUGIN_URI "#_barkgraphiceq_",
193 Gx_barkgraphiceq_::instantiate,
194 Gx_barkgraphiceq_::connect_port,
195 Gx_barkgraphiceq_::activate,
196 Gx_barkgraphiceq_::run,
197 Gx_barkgraphiceq_::deactivate,
198 Gx_barkgraphiceq_::cleanup,
199 NULL
200 };
201
202 ////////////////////////// LV2 SYMBOL EXPORT ///////////////////////////
203
204 extern "C"
205 LV2_SYMBOL_EXPORT
206 const LV2_Descriptor*
207 lv2_descriptor(uint32_t index)
208 {
209 switch (index)
210 {
211 case 0:
212 return &Gx_barkgraphiceq_::descriptor;
213 default:
214 return NULL;
215 }
216 }
217
218 ///////////////////////////// FIN //////////////////////////////////////
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_GXEFFECTS_H_
22 #define SRC_HEADERS_GXEFFECTS_H_
23
24 #include <lv2.h>
25
26 #define GXPLUGIN_URI "http://guitarix.sourceforge.net/plugins/gx_barkgraphiceq_"
27 #define GXPLUGIN_UI_URI "http://guitarix.sourceforge.net/plugins/gx_barkgraphiceq_#gui"
28
29
30 typedef enum
31 {
32 G1,
33 G2,
34 G3,
35 G4,
36 G5,
37 G6,
38 G7,
39 G8,
40 G9,
41 G10,
42 G11,
43 G12,
44 G13,
45 G14,
46 G15,
47 G16,
48 G17,
49 G18,
50 G19,
51 G20,
52 G21,
53 G22,
54 G23,
55 G24,
56
57 V1,
58 V2,
59 V3,
60 V4,
61 V5,
62 V6,
63 V7,
64 V8,
65 V9,
66 V10,
67 V11,
68 V12,
69 V13,
70 V14,
71 V15,
72 V16,
73 V17,
74 V18,
75 V19,
76 V20,
77 V21,
78 V22,
79 V23,
80 V24,
81
82 EFFECTS_OUTPUT,
83 EFFECTS_INPUT,
84 } PortIndex;
85
86 #endif //SRC_HEADERS_GXEFFECTS_H_
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19
20 @prefix doap: <http://usefulinc.com/ns/doap#> .
21 @prefix foaf: <http://xmlns.com/foaf/0.1/> .
22 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
23 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
24 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
25 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26
27 <http://guitarix.sourceforge.net#me>
28 a foaf:Person ;
29 foaf:name "Guitarix team" ;
30 foaf:mbox <mailto:brummer@web.de> ;
31 rdfs:seeAlso <http://guitarix.sourceforge.net> .
32
33 <http://guitarix.sourceforge.net/plugins/gx_barkgraphiceq_>
34 a doap:Project ;
35 doap:maintainer <http://guitarix.sourceforge.net#me> ;
36 doap:name "Gx_barkgraphiceq_" .
37
38 <http://guitarix.sourceforge.net/plugins/gx_barkgraphiceq_#_barkgraphiceq_>
39 a lv2:Plugin ,
40 lv2:EQPlugin ;
41 doap:maintainer <http://guitarix.sourceforge.net#me> ;
42 doap:name "GxBarkGraphicEQ";
43 doap:license <http://opensource.org/licenses/isc> ;
44 lv2:project <http://guitarix.sourceforge.net/plugins/gx_barkgraphiceq_> ;
45 lv2:optionalFeature lv2:hardRTCapable ;
46
47 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_barkgraphiceq_#gui>;
48
49 lv2:minorVersion 28;
50 lv2:microVersion 3;
51
52 lv2:port [
53 a lv2:InputPort ,
54 lv2:ControlPort ;
55 lv2:index 0 ;
56 lv2:symbol "G1" ;
57 lv2:name "G1";
58 lv2:default 0.0 ;
59 lv2:minimum -3e+01 ;
60 lv2:maximum 2e+01 ;
61 ] , [
62 a lv2:InputPort ,
63 lv2:ControlPort ;
64 lv2:index 1 ;
65 lv2:symbol "G2" ;
66 lv2:name "G2";
67 lv2:default 0 ;
68 lv2:minimum -3e+01 ;
69 lv2:maximum 2e+01 ;
70 ] , [
71 a lv2:InputPort ,
72 lv2:ControlPort ;
73 lv2:index 2 ;
74 lv2:symbol "G3" ;
75 lv2:name "G3";
76 lv2:default 0.0 ;
77 lv2:minimum -3e+01 ;
78 lv2:maximum 2e+01 ;
79 ] , [
80 a lv2:InputPort ,
81 lv2:ControlPort ;
82 lv2:index 3 ;
83 lv2:symbol "G4" ;
84 lv2:name "G4";
85 lv2:default 0.0;
86 lv2:minimum -3e+01 ;
87 lv2:maximum 2e+01 ;
88 ] , [
89 a lv2:InputPort ,
90 lv2:ControlPort ;
91 lv2:index 4 ;
92 lv2:symbol "G5" ;
93 lv2:name "G5";
94 lv2:default 0.0 ;
95 lv2:minimum -3e+01 ;
96 lv2:maximum 2e+01 ;
97 ] , [
98 a lv2:InputPort ,
99 lv2:ControlPort ;
100 lv2:index 5 ;
101 lv2:symbol "G6" ;
102 lv2:name "G6";
103 lv2:default 0.0 ;
104 lv2:minimum -3e+01 ;
105 lv2:maximum 2e+01 ;
106 ] , [
107 a lv2:InputPort ,
108 lv2:ControlPort ;
109 lv2:index 6 ;
110 lv2:symbol "G7" ;
111 lv2:name "G7";
112 lv2:default 0 ;
113 lv2:minimum -3e+01 ;
114 lv2:maximum 2e+01 ;
115 ] , [
116 a lv2:InputPort ,
117 lv2:ControlPort ;
118 lv2:index 7 ;
119 lv2:symbol "G8" ;
120 lv2:name "G8";
121 lv2:default 0.0 ;
122 lv2:minimum -3e+01 ;
123 lv2:maximum 2e+01 ;
124 ] , [
125 a lv2:InputPort ,
126 lv2:ControlPort ;
127 lv2:index 8 ;
128 lv2:symbol "G9" ;
129 lv2:name "G9";
130 lv2:default 0.0 ;
131 lv2:minimum -3e+01 ;
132 lv2:maximum 2e+01 ;
133 ] , [
134 a lv2:InputPort ,
135 lv2:ControlPort ;
136 lv2:index 9 ;
137 lv2:symbol "G10" ;
138 lv2:name "G10";
139 lv2:default 0.0;
140 lv2:minimum -3e+01 ;
141 lv2:maximum 2e+01 ;
142 ] , [
143 a lv2:InputPort ,
144 lv2:ControlPort ;
145 lv2:index 10 ;
146 lv2:symbol "G11" ;
147 lv2:name "G11";
148 lv2:default 0.0 ;
149 lv2:minimum -3e+01 ;
150 lv2:maximum 2e+01 ;
151 ] , [
152 a lv2:InputPort ,
153 lv2:ControlPort ;
154 lv2:index 11 ;
155 lv2:symbol "G12" ;
156 lv2:name "G12";
157 lv2:default 0.0 ;
158 lv2:minimum -3e+01 ;
159 lv2:maximum 2e+01 ;
160 ] , [
161 a lv2:InputPort ,
162 lv2:ControlPort ;
163 lv2:index 12 ;
164 lv2:symbol "G13" ;
165 lv2:name "G13";
166 lv2:default 0.0 ;
167 lv2:minimum -3e+01 ;
168 lv2:maximum 2e+01 ;
169 ] , [
170 a lv2:InputPort ,
171 lv2:ControlPort ;
172 lv2:index 13 ;
173 lv2:symbol "G14" ;
174 lv2:name "G14";
175 lv2:default 0.0 ;
176 lv2:minimum -3e+01 ;
177 lv2:maximum 2e+01 ;
178 ] , [
179 a lv2:InputPort ,
180 lv2:ControlPort ;
181 lv2:index 14 ;
182 lv2:symbol "G15" ;
183 lv2:name "G15";
184 lv2:default 0.0 ;
185 lv2:minimum -3e+01 ;
186 lv2:maximum 2e+01 ;
187 ] , [
188 a lv2:InputPort ,
189 lv2:ControlPort ;
190 lv2:index 15 ;
191 lv2:symbol "G16" ;
192 lv2:name "G16";
193 lv2:default 0.0 ;
194 lv2:minimum -3e+01 ;
195 lv2:maximum 2e+01 ;
196 ] , [
197 a lv2:InputPort ,
198 lv2:ControlPort ;
199 lv2:index 16 ;
200 lv2:symbol "G17" ;
201 lv2:name "G17";
202 lv2:default 0.0 ;
203 lv2:minimum -3e+01 ;
204 lv2:maximum 2e+01 ;
205 ] , [
206 a lv2:InputPort ,
207 lv2:ControlPort ;
208 lv2:index 17 ;
209 lv2:symbol "G18" ;
210 lv2:name "G18";
211 lv2:default 0.0 ;
212 lv2:minimum -3e+01 ;
213 lv2:maximum 2e+01 ;
214 ] , [
215 a lv2:InputPort ,
216 lv2:ControlPort ;
217 lv2:index 18 ;
218 lv2:symbol "G19" ;
219 lv2:name "G19";
220 lv2:default 0.0 ;
221 lv2:minimum -3e+01 ;
222 lv2:maximum 2e+01 ;
223 ] , [
224 a lv2:InputPort ,
225 lv2:ControlPort ;
226 lv2:index 19 ;
227 lv2:symbol "G20" ;
228 lv2:name "G20";
229 lv2:default 0.0 ;
230 lv2:minimum -3e+01 ;
231 lv2:maximum 2e+01 ;
232 ] , [
233 a lv2:InputPort ,
234 lv2:ControlPort ;
235 lv2:index 20 ;
236 lv2:symbol "G21" ;
237 lv2:name "G21";
238 lv2:default 0.0 ;
239 lv2:minimum -3e+01 ;
240 lv2:maximum 2e+01 ;
241 ] , [
242 a lv2:InputPort ,
243 lv2:ControlPort ;
244 lv2:index 21 ;
245 lv2:symbol "G22" ;
246 lv2:name "G22";
247 lv2:default 0.0 ;
248 lv2:minimum -3e+01 ;
249 lv2:maximum 2e+01 ;
250 ] , [
251 a lv2:InputPort ,
252 lv2:ControlPort ;
253 lv2:index 22 ;
254 lv2:symbol "G23" ;
255 lv2:name "G23";
256 lv2:default 0.0 ;
257 lv2:minimum -3e+01 ;
258 lv2:maximum 2e+01 ;
259 ] , [
260 a lv2:InputPort ,
261 lv2:ControlPort ;
262 lv2:index 23 ;
263 lv2:symbol "G24" ;
264 lv2:name "G24";
265 lv2:default 0.0 ;
266 lv2:minimum -3e+01 ;
267 lv2:maximum 2e+01 ;
268 ] , [
269
270 a lv2:ControlPort, lv2:OutputPort ;
271 lv2:index 24 ;
272 lv2:symbol "V1" ;
273 lv2:name "V1";
274 lv2:default 0.0 ;
275 lv2:minimum -40.0 ;
276 lv2:maximum 4.0 ;
277 ] , [
278 a lv2:ControlPort, lv2:OutputPort ;
279 lv2:index 25 ;
280 lv2:symbol "V2" ;
281 lv2:name "V2";
282 lv2:default 0.0 ;
283 lv2:minimum -40.0 ;
284 lv2:maximum 4.0 ;
285 ] , [
286 a lv2:ControlPort, lv2:OutputPort ;
287 lv2:index 26 ;
288 lv2:symbol "V3" ;
289 lv2:name "V3";
290 lv2:default 0.0 ;
291 lv2:minimum -40.0 ;
292 lv2:maximum 4.0 ;
293 ] , [
294 a lv2:ControlPort, lv2:OutputPort ;
295 lv2:index 27 ;
296 lv2:symbol "V4" ;
297 lv2:name "V4";
298 lv2:default 0.0 ;
299 lv2:minimum -40.0 ;
300 lv2:maximum 4.0 ;
301 ] , [
302 a lv2:ControlPort, lv2:OutputPort ;
303 lv2:index 28 ;
304 lv2:symbol "V5" ;
305 lv2:name "V5";
306 lv2:default 0.0 ;
307 lv2:minimum -40.0 ;
308 lv2:maximum 4.0 ;
309 ] , [
310 a lv2:ControlPort, lv2:OutputPort ;
311 lv2:index 29 ;
312 lv2:symbol "V6" ;
313 lv2:name "V6";
314 lv2:default 0.0 ;
315 lv2:minimum -40.0 ;
316 lv2:maximum 4.0 ;
317 ] , [
318 a lv2:ControlPort, lv2:OutputPort ;
319 lv2:index 30 ;
320 lv2:symbol "V7" ;
321 lv2:name "V7";
322 lv2:default 0.0 ;
323 lv2:minimum -40.0 ;
324 lv2:maximum 4.0 ;
325 ] , [
326 a lv2:ControlPort, lv2:OutputPort ;
327 lv2:index 31 ;
328 lv2:symbol "V8" ;
329 lv2:name "V8";
330 lv2:default 0.0 ;
331 lv2:minimum -40.0 ;
332 lv2:maximum 4.0 ;
333 ] , [
334 a lv2:ControlPort, lv2:OutputPort ;
335 lv2:index 32 ;
336 lv2:symbol "V9" ;
337 lv2:name "V9";
338 lv2:default 0.0 ;
339 lv2:minimum -40.0 ;
340 lv2:maximum 4.0 ;
341 ] , [
342 a lv2:ControlPort, lv2:OutputPort ;
343 lv2:index 33 ;
344 lv2:symbol "V10" ;
345 lv2:name "V10";
346 lv2:default 0.0 ;
347 lv2:minimum -40.0 ;
348 lv2:maximum 4.0 ;
349 ] , [
350 a lv2:ControlPort, lv2:OutputPort ;
351 lv2:index 34 ;
352 lv2:symbol "V11" ;
353 lv2:name "V11";
354 lv2:default 0.0 ;
355 lv2:minimum -40.0 ;
356 lv2:maximum 4.0 ;
357 ] , [
358 a lv2:ControlPort, lv2:OutputPort ;
359 lv2:index 35 ;
360 lv2:symbol "V12" ;
361 lv2:name "V12";
362 lv2:default 0.0 ;
363 lv2:minimum -40.0 ;
364 lv2:maximum 4.0 ;
365 ] , [
366 a lv2:ControlPort, lv2:OutputPort ;
367 lv2:index 36 ;
368 lv2:symbol "V13" ;
369 lv2:name "V13";
370 lv2:default 0.0 ;
371 lv2:minimum -40.0 ;
372 lv2:maximum 4.0 ;
373 ] , [
374 a lv2:ControlPort, lv2:OutputPort ;
375 lv2:index 37 ;
376 lv2:symbol "V14" ;
377 lv2:name "V14";
378 lv2:default 0.0 ;
379 lv2:minimum -40.0 ;
380 lv2:maximum 4.0 ;
381 ] , [
382 a lv2:ControlPort, lv2:OutputPort ;
383 lv2:index 38 ;
384 lv2:symbol "V15" ;
385 lv2:name "V15";
386 lv2:default 0.0 ;
387 lv2:minimum -40.0 ;
388 lv2:maximum 4.0 ;
389 ] , [
390 a lv2:ControlPort, lv2:OutputPort ;
391 lv2:index 39 ;
392 lv2:symbol "V16" ;
393 lv2:name "V16";
394 lv2:default 0.0 ;
395 lv2:minimum -40.0 ;
396 lv2:maximum 4.0 ;
397 ] , [
398 a lv2:ControlPort, lv2:OutputPort ;
399 lv2:index 40 ;
400 lv2:symbol "V17" ;
401 lv2:name "V17";
402 lv2:default 0.0 ;
403 lv2:minimum -40.0 ;
404 lv2:maximum 4.0 ;
405 ] , [
406 a lv2:ControlPort, lv2:OutputPort ;
407 lv2:index 41 ;
408 lv2:symbol "V18" ;
409 lv2:name "V18";
410 lv2:default 0.0 ;
411 lv2:minimum -40.0 ;
412 lv2:maximum 4.0 ;
413 ] , [
414 a lv2:ControlPort, lv2:OutputPort ;
415 lv2:index 42 ;
416 lv2:symbol "V19" ;
417 lv2:name "V19";
418 lv2:default 0.0 ;
419 lv2:minimum -40.0 ;
420 lv2:maximum 4.0 ;
421 ] , [
422 a lv2:ControlPort, lv2:OutputPort ;
423 lv2:index 43 ;
424 lv2:symbol "V20" ;
425 lv2:name "V20";
426 lv2:default 0.0 ;
427 lv2:minimum -40.0 ;
428 lv2:maximum 4.0 ;
429 ] , [
430 a lv2:ControlPort, lv2:OutputPort ;
431 lv2:index 44 ;
432 lv2:symbol "V21" ;
433 lv2:name "V21";
434 lv2:default 0.0 ;
435 lv2:minimum -40.0 ;
436 lv2:maximum 4.0 ;
437 ] , [
438 a lv2:ControlPort, lv2:OutputPort ;
439 lv2:index 45 ;
440 lv2:symbol "V22" ;
441 lv2:name "V22";
442 lv2:default 0.0 ;
443 lv2:minimum -40.0 ;
444 lv2:maximum 4.0 ;
445 ] , [
446 a lv2:ControlPort, lv2:OutputPort ;
447 lv2:index 46 ;
448 lv2:symbol "V23" ;
449 lv2:name "V23";
450 lv2:default 0.0 ;
451 lv2:minimum -40.0 ;
452 lv2:maximum 4.0 ;
453 ] , [
454 a lv2:ControlPort, lv2:OutputPort ;
455 lv2:index 47 ;
456 lv2:symbol "V24" ;
457 lv2:name "V24";
458 lv2:default 0.0 ;
459 lv2:minimum -40.0 ;
460 lv2:maximum 4.0 ;
461 ] , [
462
463 a lv2:AudioPort ,
464 lv2:OutputPort ;
465 lv2:index 48 ;
466 lv2:symbol "out" ;
467 lv2:name "Out"
468 ] , [
469 a lv2:AudioPort ,
470 lv2:InputPort ;
471 lv2:index 49 ;
472 lv2:symbol "in" ;
473 lv2:name "In" ;
474 ].
475
476 <http://guitarix.sourceforge.net/plugins/gx_barkgraphiceq_#gui>
477 a guiext:GtkUI;
478 guiext:binary <gx_barkgraphiceq_gui.so>;
479 guiext:requiredFeature guiext:makeResident .
480
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include <string>
21 #include <iostream>
22
23 #include <gtkmm.h>
24 #include "gx_barkgraphiceq.h"
25 #include "widget.h"
26
27
28 #include <lv2.h>
29 #include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
30
31 using namespace std;
32
33 class Gx_barkgraphiceq_GUI
34 {
35 private:
36 Glib::ustring plugskin;
37 Glib::ustring addKnob;
38 Glib::ustring plug_name;
39 void set_skin();
40 void set_plug_name(const char * plugin_uri);
41 GtkWidget* make_gui();
42 public:
43
44 Widget* widget;
45 static void set_plug_name_static(Gx_barkgraphiceq_GUI *self, const char * plugin_uri)
46 {
47 self->set_plug_name(plugin_uri);
48 }
49 static GtkWidget* make_gui_static(Gx_barkgraphiceq_GUI *self)
50 {
51 return self->make_gui();
52 }
53
54 Gx_barkgraphiceq_GUI () {};
55 ~Gx_barkgraphiceq_GUI () {};
56 } ;
57
58 void Gx_barkgraphiceq_GUI::set_skin()
59 {
60 Glib::ustring toparse = "pixmap_path ";
61 toparse += " '";
62 toparse += GX_LV2_STYLE_DIR;
63 toparse += "/'\n";
64 toparse += "style \"gx_";
65 toparse += plug_name;
66 toparse += "_dark-paintbox\"\n"
67 " { \n"
68 "GxPaintBox::skin-gradient = {\n"
69 "{ 65536, 983, 983, 983, 65536 }, \n"
70 "{ 32768, 6276, 6276, 6276, 65536 },\n"
71 "{ 0, 22760, 22760, 22760, 65536 }}\n"
72 " GxPaintBox::box-gradient = {\n"
73 "{ 0, 6142, 6142, 6142, 62428 }, \n"
74 "{ 22768, 53, 53, 53, 42428 }, \n"
75 "{ 52428, 8, 8, 80, 32428 }, \n"
76 "{ 65536, 5364, 5364, 5364, 52428 }} \n"
77 " GxPaintBox::icon-set = 26\n"
78 " }\n"
79 "\n"
80 "style 'gx_head_expander_box' \n"
81 " { \n"
82 " fg[NORMAL] = '#c0c6d0' \n"
83 " font_name = 'sans 7.5 bold' \n"
84 " }\n";
85
86 toparse += " widget '*.amplabel' style:highest 'gx_head_expander_box'\n";
87 toparse += " style \"gx_";
88 toparse += plug_name;
89 toparse += "_slevel\"\n"
90 "{\n"
91 "stock['levelslider'] = {{'simplelevelslider.png'}}\n"
92 "GxLevelSlider::slider-width = 3\n"
93 "GxRegler::show-value = 0\n"
94 "}\n"
95 "widget '*.";
96 toparse += plug_name;
97 toparse += "' style 'gx_";
98 toparse += plug_name;
99 toparse += "_slevel' "
100
101 "widget '*.";
102 toparse += plug_name;
103 toparse += "' style 'gx_";
104 toparse += plug_name;
105 toparse += "_dark-paintbox' "
106 "style 'gx_fastmeter'\n"
107 " {\n"
108 " GxFastMeter::clr-bottom = '#003808'\n"
109 " GxFastMeter::clr-middle = '#00ff00'\n"
110 " GxFastMeter::clr-top = '#ff0000'\n"
111 " GxFastMeter::over = '#ff0000'\n"
112 " }\n"
113 " class '*GxFastMeter' style:highest 'gx_fastmeter'\n";
114
115 gtk_rc_parse_string (toparse.c_str());
116 }
117
118 void Gx_barkgraphiceq_GUI::set_plug_name( const char * plugin_uri)
119 {
120
121
122
123
124
125
126 if (strcmp("http://guitarix.sourceforge.net/plugins/gx_barkgraphiceq_#_barkgraphiceq_", plugin_uri) == 0)
127 {
128 plug_name = "_barkgraphiceq_";
129 }
130 else
131 {
132 plug_name = "_barkgraphiceq_";
133 }
134 }
135
136 GtkWidget* Gx_barkgraphiceq_GUI::make_gui()
137 {
138 // init the gxwmm library
139 Gxw::init();
140 set_skin();
141 GtkWidget* container = gtk_vbox_new(FALSE, 2);
142 widget = new Widget(plug_name);
143 GtkWidget* cWidget = GTK_WIDGET(widget->gobj());
144 gtk_container_add(GTK_CONTAINER(container), cWidget );
145
146 return container;
147 }
148
149
150 static LV2UI_Handle instantiate(const struct _LV2UI_Descriptor * descriptor,
151 const char * plugin_uri,
152 const char * bundle_path,
153 LV2UI_Write_Function write_function,
154 LV2UI_Controller controller,
155 LV2UI_Widget * widget,
156 const LV2_Feature * const * features)
157 {
158 Gx_barkgraphiceq_GUI* self = new Gx_barkgraphiceq_GUI();
159 if (self == NULL) return NULL;
160 self->set_plug_name_static(self, plugin_uri);
161 *widget = (LV2UI_Widget)self->make_gui_static(self);
162 self->widget->controller = controller;
163 self->widget->write_function = write_function;
164 return (LV2UI_Handle)self;
165 }
166
167 static void cleanup(LV2UI_Handle ui)
168 {
169 Gx_barkgraphiceq_GUI *pluginGui = static_cast<Gx_barkgraphiceq_GUI*>(ui);
170 delete pluginGui->widget;
171 delete pluginGui;
172 }
173
174 static void port_event(LV2UI_Handle ui,
175 uint32_t port_index,
176 uint32_t buffer_size,
177 uint32_t format,
178 const void * buffer)
179 {
180 Gx_barkgraphiceq_GUI *self = static_cast<Gx_barkgraphiceq_GUI*>(ui);
181 self->widget->set_value_static( port_index, buffer_size, format, buffer, self->widget);
182 return;
183 }
184
185 static LV2UI_Descriptor descriptors[] =
186 {
187 {GXPLUGIN_UI_URI, instantiate, cleanup, port_event, NULL}
188 };
189
190 const LV2UI_Descriptor * lv2ui_descriptor(uint32_t index)
191 {
192 //printf("lv2ui_descriptor(%u) called\n", (uint32_t)index);
193 if (index >= sizeof(descriptors) / sizeof(descriptors[0]))
194 {
195 return NULL;
196 }
197 return descriptors + index;
198 }
199
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_barkgraphiceq_#_barkgraphiceq_>
23 a lv2:Plugin ;
24 lv2:binary <gx_barkgraphiceq.so> ;
25 rdfs:seeAlso <gx_barkgraphiceq.ttl> .
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_barkgraphiceq_#_barkgraphiceq_>
23 a lv2:Plugin ;
24 lv2:binary <gx_barkgraphiceq@LIB_EXT@> ;
25 rdfs:seeAlso <gx_barkgraphiceq.ttl> .
0 #ifndef ORFANIDIS_EQ_H_
1 #define ORFANIDIS_EQ_H_
2
3 //https://github.com/thedrgreenthumb/orfanidis_eq
4
5 #include <math.h>
6 #include <vector>
7
8 namespace orfanidis_eq {
9
10 //Eq data types.
11 typedef double eq_single_t;
12 typedef double eq_double_t;
13 //NOTE: the default float type usage
14 //can have shortage of precision
15
16 //Eq types
17 typedef enum {
18 none,
19 butterworth,
20 chebyshev1,
21 chebyshev2
22 } eq_type;
23
24 //Eq errors
25 typedef enum {
26 no_error,
27 invalid_input_data_error,
28 processing_error
29 } eq_error_t;
30
31 //Constants
32 static const eq_double_t pi = 3.1415926535897932384626433832795;
33 static const unsigned int fo_section_order = 4;
34
35 //Default gains
36 static const int max_base_gain_db = 0;
37 static const int min_base_gain_db = -60;
38 static const int butterworth_band_gain_db = -3;
39 static const int chebyshev1_band_base_gain_db = -6;
40 static const int chebyshev2_band_base_gain_db = -40;
41 static const int eq_min_max_gain_db = 46;
42
43 //Default freq's
44 static const eq_double_t lowest_grid_center_freq_hz = 31.25;
45 static const eq_double_t bands_grid_center_freq_hz = 1000;
46 static const eq_double_t lowest_audio_freq_hz = 20;
47 static const eq_double_t highest_audio_freq_hz = 20000;
48
49 //Eq config constants
50 static const unsigned int default_eq_band_filters_order = 4; //>2
51 static const eq_double_t default_sample_freq_hz = 48000;
52
53 //Version
54 static const char* eq_version = "0.01";
55
56
57 //------------ Conversion functions class ------------
58 class conversions
59 {
60 int db_min_max;
61 std::vector<eq_double_t> lin_gains;
62
63 int lin_gains_index(eq_double_t x) {
64 int int_x = (int)x;
65 if((x >= -db_min_max) && (x < db_min_max - 1))
66 return db_min_max + int_x;
67
68 return db_min_max;
69 }
70
71 conversions(){}
72
73 public:
74
75 conversions(int min_max) {
76 db_min_max = min_max;
77 //Update table (vector elements) for fast conversions
78 int step = -min_max;
79 while(step <= min_max)
80 lin_gains.push_back(db_2_lin(step++));
81 }
82
83 inline eq_double_t fast_db_2_lin(eq_double_t x) {
84 int int_part = (int)x;
85 eq_double_t frac_part = x - int_part;
86 return lin_gains[lin_gains_index(int_part)]*(1-frac_part)+(lin_gains[lin_gains_index(int_part + 1)])*frac_part;
87 }
88
89 inline eq_double_t fast_lin_2_db(eq_double_t x) {
90 if((x >= lin_gains[0]) && (x < lin_gains[lin_gains.size() - 1])) {
91 for (unsigned int i = 0; i < lin_gains.size() - 2; i++)
92 if((x >= lin_gains[i]) && (x < lin_gains[i + 1]))
93 return lin_gains[i] + (lin_gains[i + 1] - lin_gains[i])*(x - ((int)x));
94 }
95
96 return 0;
97 }
98
99 inline static eq_double_t db_2_lin(eq_double_t x) {
100 return pow(10, x/20);
101 }
102
103 inline static eq_double_t lin_2_db(eq_double_t x) {
104 return 20*log(x);
105 }
106
107 inline static eq_double_t rad_2_hz(eq_double_t x, eq_double_t fs) {
108 return 2*pi/x*fs;
109 }
110
111 inline static eq_double_t hz_2_rad(eq_double_t x, eq_double_t fs) {
112 return 2*pi*x/fs;
113 }
114 };
115
116 //------------ Band freq's structure ------------
117 struct band_freqs {
118 private:
119 band_freqs();
120
121 public:
122 eq_double_t min_freq;
123 eq_double_t center_freq;
124 eq_double_t max_freq;
125
126 band_freqs(eq_double_t f1, eq_double_t f0, eq_double_t f2):
127 min_freq(f1), center_freq(f0), max_freq(f2){}
128
129 ~band_freqs(){}
130 };
131
132 //------------ Frequency grid class ------------
133 class freq_grid {
134 private:
135 std::vector<band_freqs> freqs_;
136
137 public:
138 freq_grid(){}
139 freq_grid(const freq_grid& fg){this->freqs_ = fg.freqs_;}
140 ~freq_grid(){}
141
142 eq_error_t set_band(eq_double_t fmin, eq_double_t f0, eq_double_t fmax) {
143 freqs_.clear();
144 return add_band(fmin, f0, fmax);
145 }
146
147 eq_error_t add_band(eq_double_t fmin, eq_double_t f0, eq_double_t fmax) {
148 if(fmin < f0 && f0 < fmax)
149 freqs_.push_back(band_freqs(fmin, f0, fmax));
150 else
151 return invalid_input_data_error;
152 return no_error;
153 }
154
155 eq_error_t add_band(eq_double_t f0, eq_double_t df) {
156 if(f0 >= df/2)
157 {
158 eq_double_t fmin = f0 - df/2;
159 eq_double_t fmax = f0 + df/2;
160 freqs_.push_back(band_freqs(fmin, f0, fmax));
161 }
162 else
163 return invalid_input_data_error;
164 return no_error;
165 }
166
167 eq_error_t set_5_bands(eq_double_t center_freq = bands_grid_center_freq_hz) {
168 freqs_.clear();
169 if(lowest_audio_freq_hz < center_freq &&
170 center_freq < highest_audio_freq_hz) {
171
172 //Find lowest center frequency in band
173 eq_double_t lowest_center_freq = center_freq;
174 while(lowest_center_freq > lowest_grid_center_freq_hz)
175 lowest_center_freq/=4.0;
176 if(lowest_center_freq < lowest_grid_center_freq_hz)
177 lowest_center_freq*=4.0;
178
179 //Calculate freq's
180 eq_double_t f0 = lowest_center_freq;
181 for(unsigned int i = 0; i < 5 ; i++) {
182 freqs_.push_back(band_freqs(f0/2, f0, f0*2));
183 f0 *= 4;
184 }
185 }
186 else
187 return invalid_input_data_error;
188 return no_error;
189 }
190
191 eq_error_t set_10_bands(eq_double_t center_freq = bands_grid_center_freq_hz) {
192 freqs_.clear();
193 if(lowest_audio_freq_hz < center_freq &&
194 center_freq < highest_audio_freq_hz) {
195
196 //Find lowest center frequency in band
197 eq_double_t lowest_center_freq = center_freq;
198 while(lowest_center_freq > lowest_grid_center_freq_hz)
199 lowest_center_freq/=2;
200 if(lowest_center_freq < lowest_grid_center_freq_hz)
201 lowest_center_freq*=2;
202
203 //Calculate freq's
204 eq_double_t f0 = lowest_center_freq;
205 for(unsigned int i = 0; i < 10; i++) {
206 freqs_.push_back(band_freqs(f0/pow(2,0.5), f0, f0*pow(2,0.5)));
207 f0 *= 2;
208 }
209 }
210 else
211 return invalid_input_data_error;
212 return no_error;
213 }
214
215 eq_error_t set_20_bands(eq_double_t center_freq = bands_grid_center_freq_hz) {
216 freqs_.clear();
217 if(lowest_audio_freq_hz < center_freq &&
218 center_freq < highest_audio_freq_hz) {
219
220 //Find lowest center frequency in band
221 eq_double_t lowest_center_freq = center_freq;
222 while(lowest_center_freq > lowest_audio_freq_hz)
223 lowest_center_freq/=pow(2,0.5);
224 if(lowest_center_freq < lowest_audio_freq_hz)
225 lowest_center_freq*=pow(2,0.5);
226
227 //Calculate freq's
228 eq_double_t f0 = lowest_center_freq;
229 for(unsigned int i = 0; i < 20; i++) {
230 freqs_.push_back(band_freqs(f0/pow(2,0.25), f0, f0*pow(2,0.25)));
231 f0 *= pow(2,0.5);
232 }
233 }
234 else
235 return invalid_input_data_error;
236 return no_error;
237 }
238
239 eq_error_t set_30_bands(eq_double_t center_freq = bands_grid_center_freq_hz) {
240 freqs_.clear();
241 if(lowest_audio_freq_hz < center_freq &&
242 center_freq < highest_audio_freq_hz) {
243
244 //Find lowest center frequency in band
245 eq_double_t lowest_center_freq = center_freq;
246 while(lowest_center_freq > lowest_audio_freq_hz)
247 lowest_center_freq/=pow(2.0,1.0/3.0);
248 if(lowest_center_freq < lowest_audio_freq_hz)
249 lowest_center_freq*=pow(2.0,1.0/3.0);
250
251 //Calculate freq's
252 eq_double_t f0 = lowest_center_freq;
253 for(unsigned int i = 0; i < 30; i++) {
254 freqs_.push_back(band_freqs(f0/pow(2.0,1.0/6.0), f0, f0*pow(2.0,1.0/6.0)));
255 f0 *= pow(2,1.0/3.0);
256 }
257 }
258 else
259 return invalid_input_data_error;
260 return no_error;
261 }
262
263 unsigned int get_number_of_bands(){return freqs_.size();}
264 std::vector<band_freqs> get_freqs(){return freqs_;}
265 unsigned int get_freq(unsigned int number) {
266 if(number < freqs_.size())
267 return freqs_[number].center_freq;
268 else
269 return 0;
270 }
271
272 unsigned int get_rounded_freq(unsigned int number) {
273 if(number < freqs_.size()) {
274 unsigned int freq = freqs_[number].center_freq;
275 if (freq < 100)
276 return freq;
277 else if(freq >= 100 && freq < 1000) {
278 unsigned int rest = freq%10;
279 if(rest < 5)
280 return freq - rest;
281 else
282 return freq - rest + 10;
283 }
284 else if(freq >= 1000 && freq < 10000) {
285 unsigned int rest = freq%100;
286 if(rest < 50)
287 return freq - rest;
288 else
289 return freq - rest + 100;
290 }
291 else if(freq >= 10000) {
292 unsigned int rest = freq%1000;
293 if(rest < 500)
294 return freq - rest;
295 else
296 return freq - rest + 1000;
297 }
298 }
299 return 0;
300 }
301 };
302
303 //------------ Forth order sections ------------
304 class fo_section {
305 protected:
306 eq_single_t b0; eq_single_t b1; eq_single_t b2; eq_single_t b3; eq_single_t b4;
307 eq_single_t a0; eq_single_t a1; eq_single_t a2; eq_single_t a3; eq_single_t a4;
308
309 eq_single_t numBuf[fo_section_order];
310 eq_single_t denumBuf[fo_section_order];
311
312 inline eq_single_t df1_fo_process(eq_single_t in) {
313 eq_single_t out = 0;
314 out+= b0*in;
315 out+= (b1*numBuf[0] - denumBuf[0]*a1);
316 out+= (b2*numBuf[1] - denumBuf[1]*a2);
317 out+= (b3*numBuf[2] - denumBuf[2]*a3);
318 out+= (b4*numBuf[3] - denumBuf[3]*a4);
319
320 numBuf[3] = numBuf[2];
321 numBuf[2] = numBuf[1];
322 numBuf[1] = numBuf[0];
323 *numBuf = in;
324
325 denumBuf[3] = denumBuf[2];
326 denumBuf[2] = denumBuf[1];
327 denumBuf[1] = denumBuf[0];
328 *denumBuf = out;
329
330 return(out);
331 }
332
333 public:
334 fo_section() {
335 b0 = 0; b1 = 0; b2 = 0; b3 = 0; b4 = 0;
336 a0 = 1; a1 = 0; a2 = 0; a3 = 0; a4 = 0;
337
338 for(unsigned int i = 0; i < fo_section_order; i++) {
339 numBuf[i] = 0;
340 denumBuf[i] = 0;
341 }
342 }
343
344 virtual ~fo_section(){}
345
346 eq_single_t process(eq_single_t in) {
347 return df1_fo_process(in);
348 }
349
350 virtual fo_section get() {
351 return *this;
352 }
353 };
354
355 class butterworth_fo_section : public fo_section {
356 public:
357 butterworth_fo_section(eq_double_t beta,
358 eq_double_t s, eq_double_t g, eq_double_t g0,
359 eq_double_t D, eq_double_t c0) {
360 b0 = (g*g*beta*beta + 2*g*g0*s*beta + g0*g0)/D;
361 b1 = -4*c0*(g0*g0 + g*g0*s*beta)/D;
362 b2 = 2*(g0*g0*(1 + 2*c0*c0) - g*g*beta*beta)/D;
363 b3 = -4*c0*(g0*g0 - g*g0*s*beta)/D;
364 b4 = (g*g*beta*beta - 2*g*g0*s*beta + g0*g0)/D;
365
366 a0 = 1;
367 a1 = -4*c0*(1 + s*beta)/D;
368 a2 = 2*(1 + 2*c0*c0 - beta*beta)/D;
369 a3 = -4*c0*(1 - s*beta)/D;
370 a4 = (beta*beta - 2*s*beta + 1)/D;
371 }
372
373 fo_section get() {return *this;}
374 };
375
376 class chebyshev_type1_fo_section : public fo_section {
377 public:
378 chebyshev_type1_fo_section(eq_double_t a,
379 eq_double_t c, eq_double_t tetta_b,
380 eq_double_t g0, eq_double_t s, eq_double_t b,
381 eq_double_t D, eq_double_t c0) {
382 b0 = ((b*b + g0*g0*c*c)*tetta_b*tetta_b + 2*g0*b*s*tetta_b + g0*g0)/D;
383 b1 = -4*c0*(g0*g0 + g0*b*s*tetta_b)/D;
384 b2 = 2*(g0*g0*(1 + 2*c0*c0) - (b*b + g0*g0*c*c)*tetta_b*tetta_b)/D;
385 b3 = -4*c0*(g0*g0 - g0*b*s*tetta_b)/D;
386 b4 = ((b*b + g0*g0*c*c)*tetta_b*tetta_b - 2*g0*b*s*tetta_b + g0*g0)/D;
387
388 a0 = 1;
389 a1 = -4*c0*(1 + a*s*tetta_b)/D;
390 a2 = 2*(1 + 2*c0*c0 - (a*a + c*c)*tetta_b*tetta_b)/D;
391 a3 = -4*c0*(1 - a*s*tetta_b)/D;
392 a4 = ((a*a + c*c)*tetta_b*tetta_b - 2*a*s*tetta_b + 1)/D;
393 }
394
395 fo_section get() {return *this;}
396 };
397
398 class chebyshev_type2_fo_section : public fo_section {
399 public:
400 chebyshev_type2_fo_section(eq_double_t a,
401 eq_double_t c, eq_double_t tetta_b,
402 eq_double_t g, eq_double_t s, eq_double_t b,
403 eq_double_t D, eq_double_t c0) {
404 b0 = (g*g*tetta_b*tetta_b + 2*g*b*s*tetta_b + b*b + g*g*c*c)/D;
405 b1 = -4*c0*(b*b + g*g*c*c + g*b*s*tetta_b)/D;
406 b2 = 2*((b*b + g*g*c*c)*(1 + 2*c0*c0) - g*g*tetta_b*tetta_b)/D;
407 b3 = -4*c0*(b*b + g*g*c*c - g*b*s*tetta_b)/D;
408 b4 = (g*g*tetta_b*tetta_b - 2*g*b*s*tetta_b + b*b + g*g*c*c)/D;
409
410 a0 = 1;
411 a1 = -4*c0*(a*a + c*c + a*s*tetta_b)/D;
412 a2 = 2*((a*a + c*c)*(1 + 2*c0*c0) - tetta_b*tetta_b)/D;
413 a3 = -4*c0*(a*a + c*c - a*s*tetta_b)/D;
414 a4 = (tetta_b*tetta_b - 2*a*s*tetta_b + a*a + c*c)/D;
415 }
416
417 fo_section get() {return *this;}
418 };
419
420 //------------ Bandpass filters ------------
421 class bp_filter {
422 public:
423 bp_filter(){}
424 virtual ~bp_filter(){}
425
426 virtual eq_single_t process(eq_single_t in) = 0;
427 };
428
429 class dummy_bp_filter : public bp_filter {
430 public:
431 dummy_bp_filter(){}
432 ~dummy_bp_filter(){}
433
434 eq_single_t process(eq_single_t in){return in;}
435 };
436
437 class butterworth_bp_filter : public bp_filter {
438 private:
439 std::vector<fo_section> sections_;
440
441 butterworth_bp_filter(){}
442 public:
443 butterworth_bp_filter(unsigned int N,
444 eq_double_t w0, eq_double_t wb,
445 eq_double_t G, eq_double_t Gb, eq_double_t G0) {
446 //Get number of analog sections
447 unsigned int r = N%2;
448 unsigned int L = (N - r)/2;
449
450 //Convert gains to linear scale
451 G = conversions::db_2_lin(G);
452 Gb = conversions::db_2_lin(Gb);
453 G0 = conversions::db_2_lin(G0);
454
455 eq_double_t epsilon = pow(((eq_double_t)(G*G - Gb*Gb))/(Gb*Gb - G0*G0),0.5);
456 eq_double_t g = pow(((eq_double_t)G),1.0/((eq_double_t)N));
457 eq_double_t g0 = pow(((eq_double_t)G0),1.0/((eq_double_t)N));
458 eq_double_t beta = pow(((eq_double_t)epsilon), -1.0/((eq_double_t)N))*tan(wb/2.0);
459
460 eq_double_t c0 = cos(w0);
461 if (w0 == 0) c0 = 1;
462 if (w0 == pi/2) c0=0;
463 if (w0 == pi) c0 =- 1;
464
465 //Calculate every section
466 for(unsigned int i = 1; i <= L; i++) {
467 eq_double_t ui = (2.0*i-1)/N;
468 eq_double_t si = sin(pi*ui/2.0);
469
470 eq_double_t Di = beta*beta + 2*si*beta + 1;
471
472 sections_.push_back(butterworth_fo_section(beta, si, g, g0, Di, c0));
473 }
474 }
475
476 ~butterworth_bp_filter(){}
477
478 virtual eq_single_t process(eq_single_t in) {
479 eq_single_t p0 = in;
480 eq_single_t p1 = 0;
481 //Process FO sections in serial connection
482 for(unsigned int i = 0; i < sections_.size(); i++) {
483 p1 = sections_[i].process(p0);
484 p0 = p1;
485 }
486
487 return p1;
488 }
489 };
490
491 class chebyshev_type1_bp_filter : public bp_filter {
492 private:
493 std::vector<fo_section> sections_;
494
495 chebyshev_type1_bp_filter(){}
496 public:
497 chebyshev_type1_bp_filter(unsigned int N,
498 eq_double_t w0, eq_double_t wb,
499 eq_double_t G, eq_double_t Gb, eq_double_t G0) {
500 //Get number of analog sections
501 unsigned int r = N%2;
502 unsigned int L = (N - r)/2;
503
504 //Convert gains to linear scale
505 G = conversions::db_2_lin(G);
506 Gb = conversions::db_2_lin(Gb);
507 G0 = conversions::db_2_lin(G0);
508
509 eq_double_t epsilon = pow((eq_double_t)(G*G - Gb*Gb)/(Gb*Gb - G0*G0),0.5);
510 eq_double_t g0 = pow((eq_double_t)(G0),1.0/N);
511 eq_double_t alfa = pow(1.0/epsilon + pow(1 + pow(epsilon,-2.0),0.5),1.0/N);
512 eq_double_t beta = pow(G/epsilon + Gb*pow(1 + pow(epsilon,-2.0),0.5),1.0/N);
513 eq_double_t a = 0.5*(alfa - 1.0/alfa);
514 eq_double_t b = 0.5*(beta - g0*g0*(1/beta));
515 eq_double_t tetta_b = tan(wb/2);
516
517 eq_double_t c0 = cos(w0);
518 if (w0 == 0) c0 = 1;
519 if (w0 == pi/2) c0=0;
520 if (w0 == pi) c0 =- 1;
521
522 //Calculate every section
523 for(unsigned int i = 1; i <= L; i++) {
524 eq_double_t ui = (2.0*i-1.0)/N;
525 eq_double_t ci = cos(pi*ui/2.0);
526 eq_double_t si = sin(pi*ui/2.0);
527
528 eq_double_t Di = (a*a + ci*ci)*tetta_b*tetta_b + 2.0*a*si*tetta_b + 1;
529 sections_.push_back(chebyshev_type1_fo_section(a, ci, tetta_b, g0, si, b, Di, c0));
530 }
531 }
532
533
534 ~chebyshev_type1_bp_filter(){}
535
536 eq_single_t process(eq_single_t in) {
537 eq_single_t p0 = in;
538 eq_single_t p1 = 0;
539 //Process FO sections in serial connection
540 for(unsigned int i = 0; i < sections_.size(); i++) {
541 p1 = sections_[i].process(p0);
542 p0 = p1;
543 }
544
545 return p1;
546 }
547 };
548
549 class chebyshev_type2_bp_filter : public bp_filter {
550 private:
551 std::vector<fo_section> sections_;
552
553 chebyshev_type2_bp_filter(){}
554 public:
555 chebyshev_type2_bp_filter(unsigned int N,
556 eq_double_t w0, eq_double_t wb,
557 eq_double_t G, eq_double_t Gb, eq_double_t G0) {
558 //Get number of analog sections
559 unsigned int r = N%2;
560 unsigned int L = (N - r)/2;
561
562 //Convert gains to linear scale
563 G = conversions::db_2_lin(G);
564 Gb = conversions::db_2_lin(Gb);
565 G0 = conversions::db_2_lin(G0);
566
567 eq_double_t epsilon = pow((eq_double_t)((G*G - Gb*Gb)/(Gb*Gb - G0*G0)),0.5);
568 eq_double_t g = pow((eq_double_t)(G),1.0/N);
569 eq_double_t eu = pow(epsilon + sqrt(1 + epsilon*epsilon), 1.0/N);
570 eq_double_t ew = pow(G0*epsilon + Gb*sqrt(1 + epsilon*epsilon), 1.0/N);
571 eq_double_t a = (eu - 1.0/eu)/2.0;
572 eq_double_t b = (ew - g*g/ew)/2.0;
573 eq_double_t tetta_b = tan(wb/2);
574
575 eq_double_t c0 = cos(w0);
576 if (w0 == 0) c0 = 1;
577 if (w0 == pi/2) c0=0;
578 if (w0 == pi) c0 =- 1;
579
580 //Calculate every section
581 for(unsigned int i = 1; i <= L; i++) {
582 eq_double_t ui = (2.0*i-1.0)/N;
583 eq_double_t ci = cos(pi*ui/2.0);
584 eq_double_t si = sin(pi*ui/2.0);
585 eq_double_t Di = tetta_b*tetta_b + 2*a*si*tetta_b + a*a + ci*ci;
586
587 sections_.push_back(chebyshev_type2_fo_section(a, ci, tetta_b, g, si, b, Di, c0));
588 }
589 }
590
591 ~chebyshev_type2_bp_filter(){}
592
593 eq_single_t process(eq_single_t in) {
594 eq_single_t p0 = in;
595 eq_single_t p1 = 0;
596
597 //Process FO sections in serial connection
598 for(unsigned int i = 0; i < sections_.size(); i++) {
599 p1 = sections_[i].process(p0);
600 p0 = p1;
601 }
602
603 return p1;
604 }
605 };
606
607 // ------------ eq ------------
608 class eq {
609 private:
610 conversions conv;
611 eq_double_t sampling_frequency_;
612 freq_grid freq_grid_;
613 std::vector<eq_single_t> band_gains_;
614 std::vector<bp_filter*> filters_;
615 eq_type current_eq_type_;
616
617 eq():conv(eq_min_max_gain_db){}
618 eq(const eq&):conv(eq_min_max_gain_db){}
619
620 const char *get_eq_text(eq_type type) {
621 switch(type) {
622 case none:
623 return "not initialized";
624 case butterworth:
625 return "butterworth";
626 case chebyshev1:
627 return "chebyshev1";
628 case chebyshev2:
629 return "chebyshev2";
630 default:
631 return "none";
632 }
633 }
634
635 void cleanup_filters_array() {
636 for(unsigned int j = 0; j < get_number_of_bands(); j++)
637 delete filters_[j];
638 }
639
640 public:
641 eq(freq_grid &fg, eq_type eq_t = none) : conv(eq_min_max_gain_db) {
642 sampling_frequency_ = default_sample_freq_hz;
643 freq_grid_ = fg;
644 current_eq_type_ = eq_t;
645
646 //Initialize filters array using fake objects
647 for(unsigned int j = 0; j < get_number_of_bands(); j++) {
648 bp_filter* flt = new dummy_bp_filter;
649 filters_.push_back(flt);
650 }
651
652 if(eq_t != none)
653 set_eq(freq_grid_, eq_t);
654 }
655 ~eq(){cleanup_filters_array();}
656
657 eq_error_t set_eq(freq_grid& fg, eq_type eqt) {
658 band_gains_.clear();
659 cleanup_filters_array();
660 filters_.clear();
661
662 freq_grid_ = fg;
663
664 for(unsigned int i = 0; i < freq_grid_.get_number_of_bands(); i++) {
665
666 eq_double_t wb = conversions::hz_2_rad(
667 freq_grid_.get_freqs()[i].max_freq - freq_grid_.get_freqs()[i].min_freq,
668 sampling_frequency_);
669
670 eq_double_t w0 = conversions::hz_2_rad(
671 freq_grid_.get_freqs()[i].center_freq,
672 sampling_frequency_);
673
674 switch(eqt) {
675 case (butterworth): {
676 butterworth_bp_filter* bf = new butterworth_bp_filter(
677 default_eq_band_filters_order,
678 w0,
679 wb,
680 max_base_gain_db,
681 butterworth_band_gain_db,
682 min_base_gain_db
683 );
684
685 filters_.push_back(bf);
686 break;
687 }
688
689 case (chebyshev1): {
690 chebyshev_type1_bp_filter* cf1 = new chebyshev_type1_bp_filter(
691 default_eq_band_filters_order,
692 w0,
693 wb,
694 max_base_gain_db,
695 chebyshev1_band_base_gain_db,
696 min_base_gain_db
697 );
698
699 filters_.push_back(cf1);
700 break;
701 }
702
703 case (chebyshev2): {
704 chebyshev_type2_bp_filter* cf2 = new chebyshev_type2_bp_filter(
705 default_eq_band_filters_order,
706 w0,
707 wb,
708 max_base_gain_db,
709 chebyshev2_band_base_gain_db,
710 min_base_gain_db
711 );
712
713 filters_.push_back(cf2);
714 break;
715 }
716
717 default:
718 current_eq_type_ = none;
719 return invalid_input_data_error;
720
721 }
722 band_gains_.push_back(max_base_gain_db);
723 }
724
725 current_eq_type_ = eqt;
726 return no_error;
727 }
728
729 eq_error_t set_eq(eq_type eqt)
730 {
731 return set_eq(freq_grid_, eqt);
732 }
733
734 eq_error_t set_sample_rate(eq_double_t sr) {
735 eq_error_t err = no_error;
736 sampling_frequency_ = sr;
737 err = set_eq(freq_grid_, current_eq_type_);
738
739 return err;
740 }
741
742 void change_params(std::vector<eq_single_t> band_gains) {
743 band_gains_ = band_gains;
744 }
745
746 void change_band_param(unsigned int band_number, eq_single_t band_gain) {
747 if(band_number < get_number_of_bands())
748 band_gains_[band_number] = band_gain;
749 }
750
751 void change_band_param_db(unsigned int band_number, eq_single_t band_gain) {
752 if(band_number < get_number_of_bands())
753 band_gains_[band_number] = conv.fast_db_2_lin(band_gain);
754 }
755
756 eq_error_t sbs_process_band(unsigned int band_number, eq_single_t *in, eq_single_t *out) {
757 if(band_number < get_number_of_bands())
758 *out = band_gains_[band_number]*filters_[band_number]->process(*in);
759 else
760 return invalid_input_data_error;
761
762 return no_error;
763 }
764
765 eq_error_t sbs_process(eq_single_t *in, eq_single_t *out) {
766 eq_error_t err = no_error;
767 eq_single_t acc_out = 0;
768 for(unsigned int j = 0; j < get_number_of_bands(); j++)
769 {
770 eq_single_t band_out = 0;
771 err = sbs_process_band(j, in, &band_out);
772 acc_out += band_out;
773 }
774 *out = acc_out;
775
776 return err;
777 }
778
779 eq_type get_eq_type(){return current_eq_type_;}
780 const char* get_string_eq_type(){return get_eq_text(current_eq_type_);}
781 unsigned int get_number_of_bands(){return freq_grid_.get_number_of_bands();}
782 const char* get_version(){return eq_version;}
783 };
784
785 } //namespace orfanidis_eq
786 #endif //ORFANIDIS_EQ_H_
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include "widget.h"
21
22 #include "stdio.h"
23 #include <iostream>
24
25 #include "bark_freq_grid.h"
26
27 #define max(x, y) (((x) > (y)) ? (x) : (y))
28
29 /* @get controller by port
30 * this function is used by make_selector() make_controller()
31 * set_value() and on_value_changed()
32 * so controller widgets needs only here asined to a port,
33 * and all functions which need acess to the controller widget pointer
34 * can receive them by port number
35 */
36
37 Gtk::Widget* Widget::get_controller_by_port(uint32_t port_index)
38 {
39 switch ((PortIndex)port_index )
40 {
41 case G1:
42 return &m_levelslider[0];
43 case G2:
44 return &m_levelslider[1];
45 case G3:
46 return &m_levelslider[2];
47 case G4:
48 return &m_levelslider[3];
49 case G5:
50 return &m_levelslider[4];
51 case G6:
52 return &m_levelslider[5];
53 case G7:
54 return &m_levelslider[6];
55 case G8:
56 return &m_levelslider[7];
57 case G9:
58 return &m_levelslider[8];
59 case G10:
60 return &m_levelslider[9];
61 case G11:
62 return &m_levelslider[10];
63 case G12:
64 return &m_levelslider[11];
65 case G13:
66 return &m_levelslider[12];
67 case G14:
68 return &m_levelslider[13];
69 case G15:
70 return &m_levelslider[14];
71 case G16:
72 return &m_levelslider[15];
73 case G17:
74 return &m_levelslider[16];
75 case G18:
76 return &m_levelslider[17];
77 case G19:
78 return &m_levelslider[18];
79 case G20:
80 return &m_levelslider[19];
81 case G21:
82 return &m_levelslider[20];
83 case G22:
84 return &m_levelslider[21];
85 case G23:
86 return &m_levelslider[22];
87 case G24:
88 return &m_levelslider[23];
89
90 default:
91 return NULL;
92 }
93 }
94
95 Widget::Widget(Glib::ustring plugname):
96 plug_name(plugname)
97 {
98 // set labels
99 for(unsigned int i = 0; i < BARK_NUMBER_OF_BANDS; i++)
100 {
101 char buffer[100];
102 sprintf (buffer, "%d", bark_center_freqs[i]);
103 m_label[i].set_text(buffer);
104 }
105
106 // make controllers
107 double max_gain = 4;
108 double min_gain = -40;
109 double step = 0.01;
110 make_controller( "", min_gain, max_gain, step, G1, false);
111 make_controller( "", min_gain, max_gain, step, G2, false);
112 make_controller( "", min_gain, max_gain, step, G3, false);
113 make_controller( "", min_gain, max_gain, step, G4, false);
114 make_controller( "", min_gain, max_gain, step, G5, false);
115 make_controller( "", min_gain, max_gain, step, G6, false);
116 make_controller( "", min_gain, max_gain, step, G7, false);
117 make_controller( "", min_gain, max_gain, step, G8, false);
118 make_controller( "", min_gain, max_gain, step, G9, false);
119 make_controller( "", min_gain, max_gain, step, G10, false);
120 make_controller( "", min_gain, max_gain, step, G11, false);
121 make_controller( "", min_gain, max_gain, step, G12, false);
122 make_controller( "", min_gain, max_gain, step, G13, false);
123 make_controller( "", min_gain, max_gain, step, G14, false);
124 make_controller( "", min_gain, max_gain, step, G15, false);
125 make_controller( "", min_gain, max_gain, step, G16, false);
126 make_controller( "", min_gain, max_gain, step, G17, false);
127 make_controller( "", min_gain, max_gain, step, G18, false);
128 make_controller( "", min_gain, max_gain, step, G19, false);
129 make_controller( "", min_gain, max_gain, step, G20, false);
130 make_controller( "", min_gain, max_gain, step, G21, false);
131 make_controller( "", min_gain, max_gain, step, G22, false);
132 make_controller( "", min_gain, max_gain, step, G23, false);
133 make_controller( "", min_gain, max_gain, step, G24, false);
134
135 // set propertys for the main paintbox holding the skin
136 m_paintbox[0].set_border_width(25);
137 m_paintbox[0].set_spacing(10);
138 m_paintbox[0].set_homogeneous(false);
139 m_paintbox[0].set_name(plug_name);
140 m_paintbox[0].property_paint_func() = "gxhead_expose";
141 add(m_paintbox[0]);
142 // set a vertical box in the paintbox
143 m_paintbox[0].pack_start(m_vbox[24]);
144 m_vbox[24].pack_start(m_hbox[25],Gtk::PACK_EXPAND_WIDGET);
145 m_vbox[24].pack_start(m_hbox[24],Gtk::PACK_SHRINK);
146 m_hbox[24].set_homogeneous(true);
147 // put boxed controllers into controller box
148 for (uint32_t i = 0;i<24;i++) {
149 fastmeter[i].set_hold_count(25);
150 fastmeter[i].set_property("dimen",5);
151 m_hbox[i].set_border_width(6);
152 m_paintbox[i+1].property_paint_func() = "simple_level_meter_expose";
153 m_paintbox[i+1].set_name(plug_name);
154 m_paintbox[i+1].set_border_width(2);
155 m_paintbox[i+1].pack_start(fastmeter[i]);
156 m_paintbox[i+1].pack_start(m_levelslider[i]);
157 m_hbox[i].pack_start(m_paintbox[i+1]);
158 m_label[i].set_name("amplabel");
159 //Change font little bit
160 Pango::FontDescription fdsc("Arial");
161 fdsc.set_size(8000);
162 m_label[i].modify_font(fdsc);
163 m_vbox[i].add(m_label[i]);
164 m_vbox[i].add(m_hbox[i]);
165 m_hbox[24].pack_start(m_vbox[i],Gtk::PACK_SHRINK);
166 }
167
168 set_app_paintable(true);
169 show_all();
170 }
171
172 Widget::~Widget()
173 {
174
175 }
176
177 // create stackboxes with controllers for port name
178 void Widget::make_controller( Glib::ustring label,
179 float min, float max,
180 float digits,
181 PortIndex port_name,
182 bool show_value)
183 {
184 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
185 get_controller_by_port(port_name));
186 if (regler)
187 {
188
189 regler->cp_configure("LEVELSLIDER", label, min, max, digits);
190 regler->set_show_value(show_value);
191 regler->set_name(plug_name);
192 regler->signal_value_changed().connect(sigc::bind(sigc::mem_fun(
193 *this, &Widget::on_value_changed), port_name));
194 }
195 }
196
197 // receive controller value changes from host and set them to controller
198 void Widget::set_value(uint32_t port_index,
199 uint32_t format,
200 const void * buffer)
201 {
202 if ( format == 0 )
203 {
204 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
205 get_controller_by_port(port_index));
206 float value = *static_cast<const float*>(buffer);
207 if (regler) regler->cp_set_value(value);
208 if (port_index == V1) refresh_meter_level(0,value);
209 else if (port_index == V2) refresh_meter_level(1,value);
210 else if (port_index == V3) refresh_meter_level(2,value);
211 else if (port_index == V4) refresh_meter_level(3,value);
212 else if (port_index == V5) refresh_meter_level(4,value);
213 else if (port_index == V6) refresh_meter_level(5,value);
214 else if (port_index == V7) refresh_meter_level(6,value);
215 else if (port_index == V8) refresh_meter_level(7,value);
216 else if (port_index == V9) refresh_meter_level(8,value);
217 else if (port_index == V10) refresh_meter_level(9,value);
218 else if (port_index == V11) refresh_meter_level(10,value);
219 else if (port_index == V12) refresh_meter_level(11,value);
220 else if (port_index == V13) refresh_meter_level(12,value);
221 else if (port_index == V14) refresh_meter_level(13,value);
222 else if (port_index == V15) refresh_meter_level(14,value);
223 else if (port_index == V16) refresh_meter_level(15,value);
224 else if (port_index == V17) refresh_meter_level(16,value);
225 else if (port_index == V18) refresh_meter_level(17,value);
226 else if (port_index == V19) refresh_meter_level(18,value);
227 else if (port_index == V20) refresh_meter_level(19,value);
228 else if (port_index == V21) refresh_meter_level(20,value);
229 else if (port_index == V22) refresh_meter_level(21,value);
230 else if (port_index == V23) refresh_meter_level(22,value);
231 else if (port_index == V24) refresh_meter_level(23,value);
232 }
233 }
234
235 // write (UI) controller value changes to the host->engine
236 void Widget::on_value_changed(uint32_t port_index)
237 {
238 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
239 get_controller_by_port(port_index));
240 if (regler)
241 {
242 float value = regler->cp_get_value();
243 write_function(controller, port_index, sizeof(float), 0,
244 static_cast<const void*>(&value));
245 }
246 }
247
248 void Widget::refresh_meter_level(int m, float new_level) {
249 fastmeter[m].set_by_power(new_level);
250 }
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_WIDGET_H_
22 #define SRC_HEADERS_WIDGET_H_
23
24 #include <gtkmm.h>
25 #include <gxwmm.h>
26 #include "gx_barkgraphiceq.h"
27 #include "../config.h" // for GX_STYLE_DIR
28 // LV2UI stuff
29 #include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
30
31 class Widget : public Gtk::HBox
32 {
33 private:
34 Gtk::Widget* get_controller_by_port(uint32_t port_index);
35
36 void refresh_meter_level(int meter,float new_level);
37
38 void on_value_changed(uint32_t port_index);
39
40 void make_controller(Glib::ustring label,
41 float min, float max,
42 float digits,
43 PortIndex port_name,
44 bool show_value);
45
46 void set_value(uint32_t port_index,
47 uint32_t format,
48 const void * buffer);
49 public:
50
51 // public Lv2 communication stuff
52 LV2UI_Controller controller;
53 LV2UI_Write_Function write_function;
54 static void set_value_static(uint32_t port_index,
55 uint32_t buffer_size,
56 uint32_t format,
57 const void * buffer, Widget *self)
58 {
59 self->set_value(port_index,format,buffer);
60 }
61
62 Widget(Glib::ustring plugname);
63 ~Widget();
64
65 protected:
66 Glib::ustring plug_name;
67 Gtk::HBox m_hbox[27];
68 Gtk::VBox m_vbox[26];
69 Gtk::Label m_label[25];
70
71 Gxw::LevelSlider m_levelslider[25];
72 Gxw::FastMeter fastmeter[25];
73 Gxw::PaintBox m_paintbox[26];
74 };
75
76 #endif //SRC_HEADERS_WIDGET_H_
0 #!/usr/bin/env python
1 # encoding: utf-8
2
3 import sys, os, TaskGen, ctypes
4
5 def configure(conf):
6 pass
7
8 def build(bld):
9 bundle = 'gx_barkgraphiceq.lv2'
10
11 src = ['gx_barkgraphiceq.cpp'
12 ]
13 incl = ['../faust', './', '../DSP','../../headers']
14 lib = []
15 if sys.platform.startswith("linux"):
16 lib.append('dl')
17 uselib = ['LV2CORE']
18 cxxflag =[]
19 if not bld.env['OPT'] and bld.env['SSE2']:
20 cxxflag = [ "-msse2", "-mfpmath=sse"]
21 lv2_effects = bld(
22 features='cxx cshlib ',
23 includes = incl,
24 lib = lib,
25 uselib = uselib,
26 obj_ext = '_14.o',
27 cxxflags = cxxflag,
28 defines = ["LV2_SO"],
29 target = 'gx_barkgraphiceq',
30 source = src,
31 install_path = '${LV2DIR}/%s' % bundle,
32 chmod = 0o755,
33 )
34 lv2_effects.env['shlib_PATTERN'] = '%s.so'
35
36 uselib_local5 = []
37 libpath5 = []
38 lib5 = []
39 incl5 = ['../../../libgxwmm','../../../libgxw','../']
40 if sys.platform.startswith("linux"):
41 lib5.append('dl')
42 if bld.env["GX_LIB_SHARED"]:
43 lib5 += ['gxwmm','gxw']
44 libpath5 += [bld.path.find_dir("../../../libgxw/gxw").bldpath(bld.env),
45 bld.path.find_dir("../../../libgxwmm/gxwmm").bldpath(bld.env)]
46 else:
47 uselib_local5 += ['gxwmm','gxw']
48
49 lv2_effetcs_gui = bld(
50 features='cxx cshlib ',
51 includes = incl5,
52 lib = lib5,
53 uselib = 'LV2CORE GTKMM',
54 libpath = libpath5,
55 uselib_local = uselib_local5,
56 linkflags = '-Wl,-z,nodelete',
57 defines = ["LV2_GUI"],
58 target = 'gx_barkgraphiceq_gui',
59 source = 'widget.cpp gx_barkgraphiceq_gui.cpp',
60 install_path = '${LV2DIR}/%s' % bundle,
61 chmod = 0o755,
62 )
63 lv2_effetcs_gui.env['shlib_PATTERN'] = '%s.so'
64
65
66 install_path = '${LV2DIR}/%s' % bundle,
67 bld.install_files('${LV2DIR}/gx_barkgraphiceq.lv2', 'manifest.ttl')
68 bld.install_files('${LV2DIR}/gx_barkgraphiceq.lv2', 'gx_barkgraphiceq.ttl')
69
70 bld.install_files('${LV2DIR}/gx_barkgraphiceq.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
27 @prefix time: <http://lv2plug.in/ns/ext/time/#>.
28 @prefix units: <http://lv2plug.in/ns/extensions/units#> .
2629
2730 <http://guitarix.sourceforge.net#me>
2831 a foaf:Person ;
3740
3841 <http://guitarix.sourceforge.net/plugins/gx_chorus_stereo#_chorus_stereo>
3942 a lv2:Plugin ,
40 lv2:EffectPlugin ;
43 lv2:ChorusPlugin ;
4144 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4245 doap:name "GxChorus-Stereo";
4346 doap:license <http://opensource.org/licenses/isc> ;
4649
4750 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_chorus_stereo#gui>;
4851
52 lv2:minorVersion 28;
53 lv2:microVersion 3;
54
4955 lv2:port [
5056 a lv2:InputPort ,
5157 lv2:ControlPort ;
8288 lv2:default 3.0 ;
8389 lv2:minimum 0.1 ;
8490 lv2:maximum 10.0 ;
91 lv2:designation time:beatsPerMinute;
92 units:unit units:hz ;
8593 ] , [
8694 a lv2:AudioPort ,
8795 lv2:OutputPort ;
106114 lv2:index 7 ;
107115 lv2:symbol "in1" ;
108116 lv2:name "In1" ;
109 ].
117 ] ;
118 mod:gui [
119 a mod:Gui;
120 mod:resourcesDirectory <modgui>;
121 mod:iconTemplate <modgui/gx_chorus.html>;
122 mod:templateData <modgui/gx_chorus.json>;
123 mod:screenshot <modgui/gx_chorus.png>;
124 mod:thumbnail <modgui/gx_chorus-thumb.png>;
125 ] .
126
110127
111128 <http://guitarix.sourceforge.net/plugins/gx_chorus_stereo#gui>
112129 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-japanese mod-four-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group mod-{{knob}} clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "purple",
3 "controls": [
4 {
5 "name": "Level",
6 "symbol": "level"
7 },
8 {
9 "name": "Delay",
10 "symbol": "delay"
11 },
12 {
13 "name": "Depth",
14 "symbol": "depth"
15 },
16 {
17 "name": "Freq",
18 "symbol": "freq"
19 }
20 ],
21 "knob": "red",
22 "label": "Stereo Chorus"
23 }
6767 bld.install_files('${LV2DIR}/gx_chorus.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gx_chorus.lv2', 'gx_chorus.ttl')
6969
70 bld.install_files('${LV2DIR}/gx_chorus.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
2627
2728 <http://guitarix.sourceforge.net#me>
2829 a foaf:Person ;
3738
3839 <http://guitarix.sourceforge.net/plugins/gx_compressor#_compressor>
3940 a lv2:Plugin ,
40 lv2:EffectPlugin ;
41 lv2:CompressorPlugin ;
4142 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4243 doap:name "GxCompressor";
4344 doap:license <http://opensource.org/licenses/isc> ;
4647
4748 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_compressor#gui>;
4849
50 lv2:minorVersion 28;
51 lv2:microVersion 3;
52
4953 lv2:port [
5054 a lv2:InputPort ,
5155 lv2:ControlPort ;
103107 lv2:index 6 ;
104108 lv2:symbol "in" ;
105109 lv2:name "In" ;
106 ].
110 ] ;
111 mod:gui [
112 a mod:Gui;
113 mod:resourcesDirectory <modgui>;
114 mod:iconTemplate <modgui/gx_compressor.html>;
115 mod:templateData <modgui/gx_compressor.json>;
116 mod:screenshot <modgui/gx_compressor.png>;
117 mod:thumbnail <modgui/gx_compressor-thumb.png>;
118 ] .
119
107120
108121 <http://guitarix.sourceforge.net/plugins/gx_compressor#gui>
109122 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-japanese mod-eight-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group mod-{{knob}} clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "red",
3 "controls": [
4 {
5 "name": "ATTACK",
6 "symbol": "ATTACK"
7 },
8 {
9 "name": "RELEASE",
10 "symbol": "RELEASE"
11 },
12 {
13 "name": "RATIO",
14 "symbol": "RATIO"
15 },
16 {
17 "name": "KNEE",
18 "symbol": "KNEE"
19 },
20 {
21 "name": "THRESHOLD",
22 "symbol": "THRESHOLD"
23 }
24 ],
25 "knob": "red",
26 "label": "Compressor"
27 }
6767 bld.install_files('${LV2DIR}/gx_compressor.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gx_compressor.lv2', 'gx_compressor.ttl')
6969
70 bld.install_files('${LV2DIR}/gx_compressor.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
27 @prefix units: <http://lv2plug.in/ns/extensions/units#> .
28 @prefix time: <http://lv2plug.in/ns/ext/time/#>.
2629
2730 <http://guitarix.sourceforge.net#me>
2831 a foaf:Person ;
3740
3841 <http://guitarix.sourceforge.net/plugins/gx_delay_stereo#_delay_stereo>
3942 a lv2:Plugin ,
40 lv2:EffectPlugin ;
43 lv2:DelayPlugin ;
4144 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4245 doap:name "GxDelay-Stereo";
4346 doap:license <http://opensource.org/licenses/isc> ;
4649
4750 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_delay_stereo#gui>;
4851
52 lv2:minorVersion 28;
53 lv2:microVersion 3;
54
4955 lv2:port [
5056 a lv2:InputPort ,
5157 lv2:ControlPort ;
7783 lv2:default 1000.0 ;
7884 lv2:minimum 1.0 ;
7985 lv2:maximum 5000.0 ;
86 lv2:designation time:beatsPerMinute;
87 units:unit units:ms ;
8088 ] , [
8189 a lv2:InputPort ,
8290 lv2:ControlPort ;
95103 lv2:default 1000.0 ;
96104 lv2:minimum 1.0 ;
97105 lv2:maximum 5000.0 ;
106 lv2:designation time:beatsPerMinute;
107 units:unit units:ms ;
98108 ] , [
99109 a lv2:InputPort ,
100110 lv2:ControlPort ;
110120 lv2:index 6 ;
111121 lv2:symbol "link" ;
112122 lv2:name "Link (L+R)";
113 lv2:default 0. ;
114 lv2:minimum 0. ;
123 lv2:default 0 ;
124 lv2:minimum 0 ;
115125 lv2:maximum 1.0 ;
116126 ] , [
117127 a lv2:AudioPort ,
137147 lv2:index 10 ;
138148 lv2:symbol "in1" ;
139149 lv2:name "In1" ;
140 ].
150 ] ;
151 mod:gui [
152 a mod:Gui;
153 mod:resourcesDirectory <modgui>;
154 mod:iconTemplate <modgui/gx_delay.html>;
155 mod:templateData <modgui/gx_delay.json>;
156 mod:screenshot <modgui/gx_delay.png>;
157 mod:thumbnail <modgui/gx_delay-thumb.png>;
158 ] .
159
141160
142161 <http://guitarix.sourceforge.net/plugins/gx_delay_stereo#gui>
143162 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-japanese mod-seven-b-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group mod-{{knob}} clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <span class="mod-knob-title">{{name}}</span>
9 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "white",
3 "controls": [
4 {
5 "name": "Mode",
6 "symbol": "mode"
7 },
8 {
9 "name": "L Level",
10 "symbol": "level_l"
11 },
12 {
13 "name": "R Level",
14 "symbol": "level_r"
15 },
16 {
17 "name": "LFO",
18 "symbol": "lfo"
19 },
20 {
21 "name": "Link (L+R)",
22 "symbol": "link"
23 },
24 {
25 "name": "L Time",
26 "symbol": "timt_l"
27 },
28 {
29 "name": "R Time",
30 "symbol": "timt_r"
31 }
32 ],
33 "knob": "red",
34 "label": "Stereo Delay"
35 }
6767 bld.install_files('${LV2DIR}/gx_delay.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gx_delay.lv2', 'gx_delay.ttl')
6969
70 bld.install_files('${LV2DIR}/gx_delay.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
0
1 # check if user is root
2 user = $(shell whoami)
3 ifeq ($(user),root)
4 INSTALL_DIR = /usr/lib/lv2
5 else
6 INSTALL_DIR = ~/.lv2
7 endif
8
9 ifneq (cat /proc/cpuinfo | grep sse2 >/dev/null,)
10 SSE_CFLAGS = -msse2 -mfpmath=sse
11 else ifneq (cat /proc/cpuinfo | grep sse >/dev/null,)
12 SSE_CFLAGS = -msse -mfpmath=sse
13 else
14 SSE_CFLAGS = ""
15 endif
16
17 # set bundle name
18 NAME = gx_duck_delay
19 BUNDLE = $(NAME).lv2
20 VER = 0.1
21 # set compile flags
22 CXXFLAGS = -I. -I../DSP -O2 -Wall -funroll-loops -ffast-math -fomit-frame-pointer -fstrength-reduce $(SSE_CFLAGS)
23 LDFLAGS = -I. -I../DSP -shared -Llibrary -lc -lm -fPIC -DPIC
24 # invoke build files
25 OBJECTS = $(NAME).cpp
26 ## output style (bash colours)
27 BLUE = "\033[1;34m"
28 RED = "\033[1;31m"
29 NONE = "\033[0m"
30
31 .PHONY : all clean install uninstall
32
33 all : $(NAME)
34 @mkdir -p ./$(BUNDLE)
35 @cp ./*.ttl ./$(BUNDLE)
36 @mv ./*.so ./$(BUNDLE)
37 @if [ -f ./$(BUNDLE)/$(NAME).so ]; then echo $(BLUE)"build finish, now run make install"; \
38 else echo $(RED)"sorry, build failed"; fi
39 @echo $(NONE)
40
41 clean :
42 @rm -f $(NAME).so
43 @rm -rf ./$(BUNDLE)
44 @echo ". ." $(BLUE)", done"$(NONE)
45
46 install : all
47 @mkdir -p $(DESTDIR)$(INSTALL_DIR)/$(BUNDLE)
48 install ./$(BUNDLE)/* $(DESTDIR)$(INSTALL_DIR)/$(BUNDLE)
49 @echo ". ." $(BLUE)", done"$(NONE)
50
51 uninstall :
52 @rm -rf $(INSTALL_DIR)/$(BUNDLE)
53 @echo ". ." $(BLUE)", done"$(NONE)
54
55 $(NAME) :
56 $(CXX) $(CXXFLAGS) $(OBJECTS) $(LDFLAGS) -o $(NAME).so
0 // generated from file './faust/duck_delay.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.46 (http://faust.grame.fr)
2
3 namespace duck_delay {
4
5 class Dsp: public PluginLV2 {
6 private:
7 uint32_t fSamplingFreq;
8 int iConst0;
9 double fConst1;
10 FAUSTFLOAT fslider0;
11 FAUSTFLOAT *fslider0_;
12 double fConst2;
13 FAUSTFLOAT fslider1;
14 FAUSTFLOAT *fslider1_;
15 double fRec2[2];
16 double fRec1[2];
17 FAUSTFLOAT fslider2;
18 FAUSTFLOAT *fslider2_;
19 double fConst3;
20 double fRec0[2];
21 FAUSTFLOAT fslider3;
22 FAUSTFLOAT *fslider3_;
23 int IOTA;
24 double fVec0[524288];
25 FAUSTFLOAT fslider4;
26 FAUSTFLOAT *fslider4_;
27 double fRec4[2];
28 double fConst4;
29 double fRec3[2];
30 void connect(uint32_t port,void* data);
31 void clear_state_f();
32 void init(uint32_t samplingFreq);
33 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
34
35 static void clear_state_f_static(PluginLV2*);
36 static void init_static(uint32_t samplingFreq, PluginLV2*);
37 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2*);
38 static void del_instance(PluginLV2 *p);
39 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
40 public:
41 Dsp();
42 ~Dsp();
43 };
44
45
46
47 Dsp::Dsp()
48 : PluginLV2() {
49 version = PLUGINLV2_VERSION;
50 id = "duckDelay";
51 name = N_("Duck Delay");
52 mono_audio = compute_static;
53 stereo_audio = 0;
54 set_samplerate = init_static;
55 activate_plugin = 0;
56 connect_ports = connect_static;
57 clear_state = clear_state_f_static;
58 delete_instance = del_instance;
59 }
60
61 Dsp::~Dsp() {
62 }
63
64 inline void Dsp::clear_state_f()
65 {
66 for (int i=0; i<2; i++) fRec2[i] = 0;
67 for (int i=0; i<2; i++) fRec1[i] = 0;
68 for (int i=0; i<2; i++) fRec0[i] = 0;
69 for (int i=0; i<524288; i++) fVec0[i] = 0;
70 for (int i=0; i<2; i++) fRec4[i] = 0;
71 for (int i=0; i<2; i++) fRec3[i] = 0;
72 }
73
74 void Dsp::clear_state_f_static(PluginLV2 *p)
75 {
76 static_cast<Dsp*>(p)->clear_state_f();
77 }
78
79 inline void Dsp::init(uint32_t samplingFreq)
80 {
81 fSamplingFreq = samplingFreq;
82 iConst0 = min(192000, max(1, fSamplingFreq));
83 fConst1 = exp((0 - (1e+01 / iConst0)));
84 fConst2 = (1.0 / iConst0);
85 fConst3 = (1.0 - fConst1);
86 IOTA = 0;
87 fConst4 = (0.001 * iConst0);
88 clear_state_f();
89 }
90
91 void Dsp::init_static(uint32_t samplingFreq, PluginLV2 *p)
92 {
93 static_cast<Dsp*>(p)->init(samplingFreq);
94 }
95
96 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
97 {
98 #define fslider0 (*fslider0_)
99 #define fslider1 (*fslider1_)
100 #define fslider2 (*fslider2_)
101 #define fslider3 (*fslider3_)
102 #define fslider4 (*fslider4_)
103 double fSlow0 = exp((0 - (fConst2 / fslider0)));
104 double fSlow1 = exp((0 - (fConst2 / fslider1)));
105 double fSlow2 = (1.0 - fSlow1);
106 double fSlow3 = (1.0 - fSlow0);
107 double fSlow4 = pow(10,(0.05 * fslider2));
108 double fSlow5 = fslider3;
109 double fSlow6 = (fConst3 * fslider4);
110 for (int i=0; i<count; i++) {
111 double fTemp0 = (double)input0[i];
112 double fTemp1 = fabs(fTemp0);
113 fRec2[0] = ((fSlow2 * fTemp1) + (fSlow1 * max(fTemp1, fRec2[1])));
114 fRec1[0] = ((fSlow3 * fRec2[0]) + (fSlow0 * fRec1[1]));
115 fRec0[0] = ((fConst3 * (1 - ((fSlow4 * fRec1[0]) > 1))) + (fConst1 * fRec0[1]));
116 double fTemp2 = (fTemp0 + (fSlow5 * fRec3[1]));
117 fVec0[IOTA&524287] = fTemp2;
118 fRec4[0] = (fSlow6 + (fConst1 * fRec4[1]));
119 double fTemp3 = (fConst4 * fRec4[0]);
120 int iTemp4 = int(fTemp3);
121 int iTemp5 = (1 + iTemp4);
122 fRec3[0] = (((fTemp3 - iTemp4) * fVec0[(IOTA-int((int(iTemp5) & 393215)))&524287]) + ((iTemp5 - fTemp3) * fVec0[(IOTA-int((iTemp4 & 393215)))&524287]));
123 output0[i] = (FAUSTFLOAT)(fTemp0 + (fRec3[0] * fRec0[0]));
124 // post processing
125 fRec3[1] = fRec3[0];
126 fRec4[1] = fRec4[0];
127 IOTA = IOTA+1;
128 fRec0[1] = fRec0[0];
129 fRec1[1] = fRec1[0];
130 fRec2[1] = fRec2[0];
131 }
132 #undef fslider0
133 #undef fslider1
134 #undef fslider2
135 #undef fslider3
136 #undef fslider4
137 }
138
139 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginLV2 *p)
140 {
141 static_cast<Dsp*>(p)->compute(count, input0, output0);
142 }
143
144
145 void Dsp::connect(uint32_t port,void* data)
146 {
147 switch ((PortIndex)port)
148 {
149 case AMOUNT:
150 fslider2_ = (float*)data; // , 0.5, 0.0, 56.0, 0.05
151 break;
152 case ATTACK:
153 fslider0_ = (float*)data; // , 0.1, 0.05, 0.5, 0.05
154 break;
155 case FEEDBACK:
156 fslider3_ = (float*)data; // , 0.0, 0.0, 1.0, 0.05
157 break;
158 case RELESE:
159 fslider1_ = (float*)data; // , 0.1, 0.05, 2.0, 0.05
160 break;
161 case TIME:
162 fslider4_ = (float*)data; // , 5e+02, 1.0, 2e+03, 1.0
163 break;
164 default:
165 break;
166 }
167 }
168
169 void Dsp::connect_static(uint32_t port,void* data, PluginLV2 *p)
170 {
171 static_cast<Dsp*>(p)->connect(port, data);
172 }
173
174
175 PluginLV2 *plugin() {
176 return new Dsp();
177 }
178
179 void Dsp::del_instance(PluginLV2 *p)
180 {
181 delete static_cast<Dsp*>(p);
182 }
183
184 /*
185 typedef enum
186 {
187 AMOUNT,
188 ATTACK,
189 FEEDBACK,
190 RELESE,
191 TIME,
192 } PortIndex;
193 */
194
195 } // end namespace duck_delay
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 ////////////////////////////// LOCAL INCLUDES //////////////////////////
21
22 #include "gx_common.h" // faust support and denormal protection (SSE)
23 #include "gx_duck_delay.h" // define struct PortIndex
24 #include "gx_pluginlv2.h" // define struct PluginLV2
25 #include "duck_delay.cc" // dsp class generated by faust -> dsp2cc
26
27 ////////////////////////////// PLUG-IN CLASS ///////////////////////////
28
29 namespace duck_delay {
30
31 class Gx_duck_delay_
32 {
33 private:
34 // pointer to buffer
35 float* output;
36 float* input;
37 // pointer to dsp class
38 PluginLV2* duck_delay;
39 // private functions
40 inline void run_dsp_(uint32_t n_samples);
41 inline void connect_(uint32_t port,void* data);
42 inline void init_dsp_(uint32_t rate);
43 inline void connect_all__ports(uint32_t port, void* data);
44 inline void activate_f();
45 inline void clean_up();
46 inline void deactivate_f();
47
48 public:
49 // LV2 Descriptor
50 static const LV2_Descriptor descriptor;
51 // static wrapper to private functions
52 static void deactivate(LV2_Handle instance);
53 static void cleanup(LV2_Handle instance);
54 static void run(LV2_Handle instance, uint32_t n_samples);
55 static void activate(LV2_Handle instance);
56 static void connect_port(LV2_Handle instance, uint32_t port, void* data);
57 static LV2_Handle instantiate(const LV2_Descriptor* descriptor,
58 double rate, const char* bundle_path,
59 const LV2_Feature* const* features);
60 Gx_duck_delay_();
61 ~Gx_duck_delay_();
62 };
63
64 // constructor
65 Gx_duck_delay_::Gx_duck_delay_() :
66 output(NULL),
67 input(NULL),
68 duck_delay(duck_delay::plugin()) {};
69
70 // destructor
71 Gx_duck_delay_::~Gx_duck_delay_()
72 {
73 // just to be sure the plug have given free the allocated mem
74 // it didn't hurd if the mem is already given free by clean_up()
75 if (duck_delay->activate_plugin !=0)
76 duck_delay->activate_plugin(false, duck_delay);
77 // delete DSP class
78 duck_delay->delete_instance(duck_delay);
79 };
80
81 ///////////////////////// PRIVATE CLASS FUNCTIONS /////////////////////
82
83 void Gx_duck_delay_::init_dsp_(uint32_t rate)
84 {
85 AVOIDDENORMALS(); // init the SSE denormal protection
86 duck_delay->set_samplerate(rate, duck_delay); // init the DSP class
87 }
88
89 // connect the Ports used by the plug-in class
90 void Gx_duck_delay_::connect_(uint32_t port,void* data)
91 {
92 switch ((PortIndex)port)
93 {
94 case EFFECTS_OUTPUT:
95 output = static_cast<float*>(data);
96 break;
97 case EFFECTS_INPUT:
98 input = static_cast<float*>(data);
99 break;
100 default:
101 break;
102 }
103 }
104
105 void Gx_duck_delay_::activate_f()
106 {
107 // allocate the internal DSP mem
108 if (duck_delay->activate_plugin !=0)
109 duck_delay->activate_plugin(true, duck_delay);
110 }
111
112 void Gx_duck_delay_::clean_up()
113 {
114 // delete the internal DSP mem
115 if (duck_delay->activate_plugin !=0)
116 duck_delay->activate_plugin(false, duck_delay);
117 }
118
119 void Gx_duck_delay_::deactivate_f()
120 {
121 // delete the internal DSP mem
122 if (duck_delay->activate_plugin !=0)
123 duck_delay->activate_plugin(false, duck_delay);
124 }
125
126 void Gx_duck_delay_::run_dsp_(uint32_t n_samples)
127 {
128 duck_delay->mono_audio(static_cast<int>(n_samples), input, output, duck_delay);
129 }
130
131 void Gx_duck_delay_::connect_all__ports(uint32_t port, void* data)
132 {
133 // connect the Ports used by the plug-in class
134 connect_(port,data);
135 // connect the Ports used by the DSP class
136 duck_delay->connect_ports(port, data, duck_delay);
137 }
138
139 ////////////////////// STATIC CLASS FUNCTIONS ////////////////////////
140
141 LV2_Handle
142 Gx_duck_delay_::instantiate(const LV2_Descriptor* descriptor,
143 double rate, const char* bundle_path,
144 const LV2_Feature* const* features)
145 {
146 // init the plug-in class
147 Gx_duck_delay_ *self = new Gx_duck_delay_();
148 if (!self)
149 {
150 return NULL;
151 }
152
153 self->init_dsp_((uint32_t)rate);
154
155 return (LV2_Handle)self;
156 }
157
158 void Gx_duck_delay_::connect_port(LV2_Handle instance,
159 uint32_t port, void* data)
160 {
161 // connect all ports
162 static_cast<Gx_duck_delay_*>(instance)->connect_all__ports(port, data);
163 }
164
165 void Gx_duck_delay_::activate(LV2_Handle instance)
166 {
167 // allocate needed mem
168 static_cast<Gx_duck_delay_*>(instance)->activate_f();
169 }
170
171 void Gx_duck_delay_::run(LV2_Handle instance, uint32_t n_samples)
172 {
173 // run dsp
174 static_cast<Gx_duck_delay_*>(instance)->run_dsp_(n_samples);
175 }
176
177 void Gx_duck_delay_::deactivate(LV2_Handle instance)
178 {
179 // free allocated mem
180 static_cast<Gx_duck_delay_*>(instance)->deactivate_f();
181 }
182
183 void Gx_duck_delay_::cleanup(LV2_Handle instance)
184 {
185 // well, clean up after us
186 Gx_duck_delay_* self = static_cast<Gx_duck_delay_*>(instance);
187 self->clean_up();
188 delete self;
189 }
190
191 const LV2_Descriptor Gx_duck_delay_::descriptor =
192 {
193 GXPLUGIN_URI "#_duck_delay_",
194 Gx_duck_delay_::instantiate,
195 Gx_duck_delay_::connect_port,
196 Gx_duck_delay_::activate,
197 Gx_duck_delay_::run,
198 Gx_duck_delay_::deactivate,
199 Gx_duck_delay_::cleanup,
200 NULL
201 };
202
203
204 } // end namespace duck_delay
205
206 ////////////////////////// LV2 SYMBOL EXPORT ///////////////////////////
207
208 extern "C"
209 LV2_SYMBOL_EXPORT
210 const LV2_Descriptor*
211 lv2_descriptor(uint32_t index)
212 {
213 switch (index)
214 {
215 case 0:
216 return &duck_delay::Gx_duck_delay_::descriptor;
217 default:
218 return NULL;
219 }
220 }
221
222 ///////////////////////////// FIN //////////////////////////////////////
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_GXEFFECTS_H_
22 #define SRC_HEADERS_GXEFFECTS_H_
23
24 #include <lv2.h>
25
26 #define GXPLUGIN_URI "http://guitarix.sourceforge.net/plugins/gx_duck_delay_"
27 #define GXPLUGIN_UI_URI "http://guitarix.sourceforge.net/plugins/gx_duck_delay_#gui"
28
29
30 typedef enum
31 {
32 EFFECTS_OUTPUT,
33 EFFECTS_INPUT,
34 AMOUNT,
35 ATTACK,
36 FEEDBACK,
37 RELESE,
38 TIME,
39 } PortIndex;
40
41 #endif //SRC_HEADERS_GXEFFECTS_H_
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19
20 @prefix doap: <http://usefulinc.com/ns/doap#> .
21 @prefix foaf: <http://xmlns.com/foaf/0.1/> .
22 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
23 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
24 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
25 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#>.
27 @prefix time: <http://lv2plug.in/ns/ext/time/#>.
28 @prefix units: <http://lv2plug.in/ns/extensions/units#> .
29
30 <http://guitarix.sourceforge.net#me>
31 a foaf:Person ;
32 foaf:name "Guitarix team" ;
33 foaf:mbox <mailto:brummer@web.de> ;
34 rdfs:seeAlso <http://guitarix.sourceforge.net> .
35
36 <http://guitarix.sourceforge.net/plugins/gx_duck_delay_>
37 a doap:Project ;
38 doap:maintainer <http://guitarix.sourceforge.net#me> ;
39 doap:name "Gx_duck_delay_" .
40
41 <http://guitarix.sourceforge.net/plugins/gx_duck_delay_#_duck_delay_>
42 a lv2:Plugin ,
43 lv2:DelayPlugin ;
44 doap:maintainer <http://guitarix.sourceforge.net#me> ;
45 doap:name "Gxduck_delay";
46 doap:license <http://opensource.org/licenses/isc> ;
47 lv2:project <http://guitarix.sourceforge.net/plugins/gx_duck_delay_> ;
48 lv2:optionalFeature lv2:hardRTCapable ;
49
50 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_duck_delay_#gui>;
51
52 lv2:minorVersion 28;
53 lv2:microVersion 3;
54
55 lv2:port [
56 a lv2:AudioPort ,
57 lv2:OutputPort ;
58 lv2:index 0 ;
59 lv2:symbol "out" ;
60 lv2:name "Out"
61 ] , [
62 a lv2:AudioPort ,
63 lv2:InputPort ;
64 lv2:index 1 ;
65 lv2:symbol "in" ;
66 lv2:name "In" ;
67 ]
68 , [
69 a lv2:InputPort ,
70 lv2:ControlPort ;
71 lv2:index 2 ;
72 lv2:symbol "AMOUNT" ;
73 lv2:name "AMOUNT" ;
74 lv2:default 0.5 ;
75 lv2:minimum 0.0 ;
76 lv2:maximum 56.0 ;
77 ] , [
78 a lv2:InputPort ,
79 lv2:ControlPort ;
80 lv2:index 3 ;
81 lv2:symbol "ATTACK" ;
82 lv2:name "ATTACK" ;
83 lv2:default 0.1 ;
84 lv2:minimum 0.05 ;
85 lv2:maximum 0.5 ;
86 ] , [
87 a lv2:InputPort ,
88 lv2:ControlPort ;
89 lv2:index 4 ;
90 lv2:symbol "FEEDBACK" ;
91 lv2:name "FEEDBACK" ;
92 lv2:default 0.0 ;
93 lv2:minimum 0.0 ;
94 lv2:maximum 1.0 ;
95 ] , [
96 a lv2:InputPort ,
97 lv2:ControlPort ;
98 lv2:index 5 ;
99 lv2:symbol "RELESE" ;
100 lv2:name "RELESE" ;
101 lv2:default 0.1 ;
102 lv2:minimum 0.05 ;
103 lv2:maximum 2.0 ;
104 ] , [
105 a lv2:InputPort ,
106 lv2:ControlPort ;
107 lv2:index 6 ;
108 lv2:symbol "TIME" ;
109 lv2:name "TIME" ;
110 lv2:default 5e+02 ;
111 lv2:minimum 1.0 ;
112 lv2:maximum 2e+03 ;
113 ];
114 mod:gui [
115 a mod:Gui;
116 mod:resourcesDirectory <modgui>;
117 mod:iconTemplate <modgui/icon-gxduck_delay.html>;
118 mod:templateData <modgui/data-gxduck_delay.json>;
119 mod:screenshot <modgui/screenshot-gxduck_delay.png>;
120 mod:thumbnail <modgui/thumb-gxduck_delay.png>;
121 ].
122
123 <http://guitarix.sourceforge.net/plugins/gx_duck_delay_#gui>
124 a guiext:GtkUI;
125 guiext:binary <gx_duck_delay_gui.so>;
126 guiext:requiredFeature guiext:makeResident .
127
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include <string>
21 #include <iostream>
22
23 #include <gtkmm.h>
24 #include "gx_duck_delay.h"
25 #include "widget.h"
26
27
28 #include <lv2.h>
29 #include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
30
31 using namespace std;
32
33 class Gx_duck_delayGUI
34 {
35 private:
36 Glib::ustring plugskin;
37 Glib::ustring addKnob;
38 Glib::ustring plug_name;
39 void set_knob(Glib::ustring knob);
40 void set_skin();
41 void set_plug_name(const char * plugin_uri);
42 GtkWidget* make_gui();
43 public:
44
45 Widget* widget;
46 static void set_plug_name_static(Gx_duck_delayGUI *self, const char * plugin_uri)
47 {
48 self->set_plug_name(plugin_uri);
49 }
50 static GtkWidget* make_gui_static(Gx_duck_delayGUI *self)
51 {
52 return self->make_gui();
53 }
54
55 Gx_duck_delayGUI () {};
56 ~Gx_duck_delayGUI () {};
57 } ;
58
59 void Gx_duck_delayGUI::set_knob( Glib::ustring knob)
60 {
61 addKnob = " style 'gx_";
62 addKnob += plug_name;
63 addKnob += "_dark_skin_icons'\n"
64 " { \n"
65 " stock['bigknob'] = {{'";
66 addKnob += knob;
67 addKnob += ".png'}}\n"
68 " stock['smallknob'] = {{'";
69 addKnob += knob;
70 addKnob += "-small.png'}}\n"
71 " stock['smallknobr'] = {{'";
72 addKnob += knob;
73 addKnob += "-middle.png'}}\n"
74 " stock['button_on'] = {{'"
75 "echo-switch_on.png'}}\n"
76 " stock['button_off'] = {{'"
77 "echo-switch_off.png'}}\n"
78 " }\n"
79 "widget '*.";
80 addKnob += plug_name;
81 addKnob += "' style 'gx_";
82 addKnob += plug_name;
83 addKnob += "_dark_skin_icons' \n"
84 "class '*GxToggleImage' style'gx_";
85 addKnob += plug_name;
86 addKnob += "_dark_skin_icons' \n";
87 }
88
89 void Gx_duck_delayGUI::set_skin()
90 {
91 Glib::ustring toparse = "pixmap_path ";
92 toparse += " '";
93 toparse += GX_LV2_STYLE_DIR;
94 toparse += "/'\n";
95 toparse += "style \"gx_";
96 toparse += plug_name;
97 toparse += "_dark-paintbox\"\n"
98 " { \n"
99 "GxPaintBox::skin-gradient = {\n"
100 "{ 65536, 0, 0, 13107, 52428 }, \n"
101 "{ 52428, 0, 0, 0, 52428 },\n"
102 "{ 13107, 0, 0, 13107, 13107 }}\n"
103 " GxPaintBox::icon-set =11\n"
104 " }\n"
105 "\n"
106 "style 'gx_head_duck_delay_box' \n"
107 " { \n"
108 " fg[NORMAL] = '#c0c6d0' \n"
109 "font_name = 'sans 7.5 bold' \n"
110 " }\n";
111 toparse += addKnob;
112
113 toparse += " widget '*.amplabel' style:highest 'gx_head_duck_delay_box'\n"
114 "widget '*.";
115 toparse += plug_name;
116 toparse += "' style 'gx_";
117 toparse += plug_name;
118 toparse += "_dark-paintbox' ";
119 toparse += " style 'gx_selector_";
120 toparse += plug_name;
121 toparse += "'\n"
122 " {\n"
123 " fg[NORMAL] = '#c0c6d0'\n"
124 " GtkRange::trough-border = 2\n"
125 " GtkRange::stepper-size = 8\n"
126 " GtkRange::stepper-spacing = 2\n"
127 " GxRegler::value-border = { 2, 0, 0, 0 }\n"
128 " font_name = 'sans 7.5'\n"
129 " xthickness = 10\n"
130 " ythickness = 1\n"
131 " }\n"
132 "widget '*.";
133 toparse += plug_name;
134 toparse += "' style:highest 'gx_selector_";
135 toparse += plug_name;
136 toparse += "'\n";
137 toparse += "style 'gx_switch'\n"
138 "{\n"
139 "xthickness = 0\n"
140 "ythickness = 0\n"
141 "GtkButton::inner-border = {0, 0, 0, 0}\n"
142 "GtkButton::default-border = {0, 0, 0, 0}\n"
143 "GtkButton::focus-line-width = 0\n"
144 "GtkButton::focus-padding = 0\n"
145 "GtkButton::interior-focus = 0\n"
146 "GtkButton::child-displacement-x = 0\n"
147 "GtkButton::child-displacement-y = 0\n"
148 " }\n"
149 "widget '*.";
150 toparse += plug_name;
151 toparse += "' style:highest 'gx_switch'";
152
153 gtk_rc_parse_string (toparse.c_str());
154 }
155
156 void Gx_duck_delayGUI::set_plug_name( const char * plugin_uri)
157 {
158 addKnob = "";
159
160 if (strcmp("http://guitarix.sourceforge.net/plugins/gx_duck_delay_#_duck_delay_", plugin_uri) == 0)
161 {
162 plug_name = "_duck_delay";
163 set_knob("nk-knob");
164 }
165 else
166 {
167 plug_name = "_duck_delay";
168 }
169 }
170
171 GtkWidget* Gx_duck_delayGUI::make_gui()
172 {
173 // init the gxwmm library
174 Gxw::init();
175 set_skin();
176 GtkWidget* container = gtk_vbox_new(FALSE, 2);
177 widget = new Widget(plug_name);
178 GtkWidget* cWidget = GTK_WIDGET(widget->gobj());
179 gtk_container_add(GTK_CONTAINER(container), cWidget );
180
181 return container;
182 }
183
184
185 static LV2UI_Handle instantiate(const struct _LV2UI_Descriptor * descriptor,
186 const char * plugin_uri,
187 const char * bundle_path,
188 LV2UI_Write_Function write_function,
189 LV2UI_Controller controller,
190 LV2UI_Widget * widget,
191 const LV2_Feature * const * features)
192 {
193 Gx_duck_delayGUI* self = new Gx_duck_delayGUI();
194 if (self == NULL) return NULL;
195 self->set_plug_name_static(self, plugin_uri);
196 *widget = (LV2UI_Widget)self->make_gui_static(self);
197 self->widget->controller = controller;
198 self->widget->write_function = write_function;
199 return (LV2UI_Handle)self;
200 }
201
202 static void cleanup(LV2UI_Handle ui)
203 {
204 Gx_duck_delayGUI *pluginGui = static_cast<Gx_duck_delayGUI*>(ui);
205 delete pluginGui->widget;
206 delete pluginGui;
207 }
208
209 static void port_event(LV2UI_Handle ui,
210 uint32_t port_index,
211 uint32_t buffer_size,
212 uint32_t format,
213 const void * buffer)
214 {
215 Gx_duck_delayGUI *self = static_cast<Gx_duck_delayGUI*>(ui);
216 self->widget->set_value_static( port_index, buffer_size, format, buffer, self->widget);
217 return;
218 }
219
220 static LV2UI_Descriptor descriptors[] =
221 {
222 {GXPLUGIN_UI_URI, instantiate, cleanup, port_event, NULL}
223 };
224
225 const LV2UI_Descriptor * lv2ui_descriptor(uint32_t index)
226 {
227 //printf("lv2ui_descriptor(%u) called\n", (uint32_t)index);
228 if (index >= sizeof(descriptors) / sizeof(descriptors[0]))
229 {
230 return NULL;
231 }
232 return descriptors + index;
233 }
234
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_duck_delay_#_duck_delay_>
23 a lv2:Plugin ;
24 lv2:binary <gx_duck_delay.so> ;
25 rdfs:seeAlso <gx_duck_delay.ttl> .
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_duck_delay_#_duck_delay_>
23 a lv2:Plugin ;
24 lv2:binary <gx_duck_delay@LIB_EXT@> ;
25 rdfs:seeAlso <gx_duck_delay.ttl> .
0 <div class="mod-pedal mod-pedal-japanese mod-eight-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group mod-{{knob}} clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "red",
3 "controls": [
4 {
5 "name": "AMOUNT",
6 "symbol": "AMOUNT"
7 },
8 {
9 "name": "ATTACK",
10 "symbol": "ATTACK"
11 },
12 {
13 "name": "FEEDBACK",
14 "symbol": "FEEDBACK"
15 },
16 {
17 "name": "RELESE",
18 "symbol": "RELESE"
19 },
20 {
21 "name": "TIME",
22 "symbol": "TIME"
23 }
24 ],
25 "knob": "red",
26 "label": "Ducking delay"
27 }
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include "widget.h"
21
22 #include <iostream>
23
24
25 /* @get controller by port
26 * this function is used by make_selector() make_controller_box()
27 * set_value() and on_value_changed()
28 * so controller widgets needs only here asined to a port,
29 * and all functions which need acess to the controller widget pointer
30 * can receive them by port number
31 */
32
33 Gtk::Widget* Widget::get_controller_by_port(uint32_t port_index)
34 {
35 switch ((PortIndex)port_index )
36 {
37 case AMOUNT:
38 return &m_bigknob;
39 case ATTACK:
40 return &m_smallknob3;
41 case FEEDBACK:
42 return &m_smallknob4;
43 case RELESE:
44 return &m_smallknob5;
45 case TIME:
46 return &m_smallknob6;
47 default:
48 return NULL;
49 }
50 }
51
52 Widget::Widget(Glib::ustring plugname):
53 plug_name(plugname)
54 {
55 // create controllers for port name, change order, and fix typo
56 make_controller_box(&m_vbox2, "TIME", 1.0, 2000, 1, TIME);
57 make_controller_box(&m_vbox3, "FEEDBACK", 0.0, 1.0, 0.01, FEEDBACK);
58 make_controller_box(&m_vbox4, "ATTACK", 0.05, 0.5, 0.01, ATTACK);
59 make_controller_box(&m_vbox5, "RELEASE", 0.05, 2.0, 0.01, RELESE);
60 make_controller_box(&m_vbox6, "AMOUNT", 0.0, 56.0, 0.1, AMOUNT);
61
62 // set propertys for the main paintbox holding the skin
63 m_paintbox.set_border_width(10);
64 m_paintbox.set_spacing(6);
65 m_paintbox.set_homogeneous(false);
66 m_paintbox.set_name(plug_name);
67 m_paintbox.property_paint_func() = "gxhead_expose";
68 add(m_paintbox);
69 // box for the controllers
70 m_hbox_.set_spacing(14);
71 m_hbox_.set_border_width(5);
72 m_hbox_.set_homogeneous(false);
73 // set a vertical box in the paintbox
74 m_vbox.set_border_width(2);
75 m_vbox1.set_border_width(2);
76 m_paintbox.pack_start(m_vbox_);
77 // and controller box on top
78 m_vbox_.pack_start(m_hbox_, Gtk::PACK_SHRINK);
79 // put boxed controllers into controller box
80 m_hbox_.pack_start(m_vbox,Gtk::PACK_EXPAND_PADDING);
81 m_hbox_.pack_start(m_vbox2);
82 m_hbox_.pack_start(m_vbox3);
83 m_hbox_.pack_start(m_vbox4);
84 m_hbox_.pack_start(m_vbox5);
85 m_hbox_.pack_start(m_vbox6);
86 m_hbox_.pack_start(m_vbox1,Gtk::PACK_EXPAND_PADDING);
87
88 // connect expose handler as resize handler
89 m_paintbox.signal_expose_event().connect(
90 sigc::mem_fun(this, &Widget::_expose_event), true);
91
92 set_app_paintable(true);
93 show_all();
94 }
95
96 Widget::~Widget()
97 {
98
99 }
100
101 // set borderwith for paintbox when widget resize
102 // to hold controllers in place
103 bool Widget::_expose_event(GdkEventExpose *event)
104 {
105 int x, y, width, height, depth;
106 m_paintbox.get_window()->get_geometry(x, y, width, height, depth);
107 //double_t height = m_paintbox.get_window()->get_height();
108 m_paintbox.set_border_width(height/20);
109 return false;
110 }
111
112 // create selectors from gxwmm
113 void Widget::make_selector(Glib::ustring labela,
114 Glib::ustring tables[],
115 size_t _size,
116 float min, float digits,
117 PortIndex port_name)
118 {
119 Gxw::Selector *regler = static_cast<Gxw::Selector*>
120 (get_controller_by_port(port_name));
121 if (regler)
122 {
123 float max = static_cast<float>(_size+1);
124
125 Gtk::TreeModelColumn<Glib::ustring> label;
126 Gtk::TreeModelColumnRecord rec;
127 rec.add(label);
128 Glib::RefPtr<Gtk::ListStore> ls = Gtk::ListStore::create(rec);
129
130 for (uint32_t i = 0 ; i< _size; ++i) {
131 ls->append()->set_value(0, tables[i]);
132 }
133 regler->set_model(ls);
134 regler->set_has_tooltip();
135 regler->set_tooltip_text(labela);
136 regler->cp_configure("SELECTOR", labela, min, max, digits);
137 regler->set_show_value(false);
138 regler->set_name(plug_name);
139 regler->signal_value_changed().connect(sigc::bind(sigc::mem_fun(
140 *this, &Widget::on_value_changed), port_name));
141 }
142 }
143
144 // create stackboxes with controllers for port name
145 void Widget::make_controller_box(Gtk::Box *box,
146 Glib::ustring label,
147 float min, float max,
148 float digits,
149 PortIndex port_name)
150 {
151 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
152 get_controller_by_port(port_name));
153 if (regler)
154 {
155 Gtk::Label* pr = new Gtk::Label(label, 0);
156 pr->set_name("amplabel");
157 // use label images instead simple string labes
158 /*Glib::ustring label_image = GX_LV2_STYLE_DIR;
159 label_image += "/";
160 label_image += label;
161 label_image += "-label.png";
162 Gtk::Image *pr = new Gtk::Image(label_image);*/
163
164 Gtk::VBox* b1 = new Gtk::VBox();
165 box->pack_start( *Gtk::manage(b1), Gtk::PACK_EXPAND_PADDING);
166 box->pack_start( *Gtk::manage(pr),Gtk::PACK_SHRINK);
167 regler->cp_configure("KNOB", label, min, max, digits);
168 regler->set_show_value(false);
169 regler->set_name(plug_name);
170 box->pack_start(*regler,Gtk::PACK_SHRINK);
171 Gtk::VBox* b2 = new Gtk::VBox();
172 box->pack_start( *Gtk::manage(b2), Gtk::PACK_EXPAND_PADDING);
173 regler->signal_value_changed().connect(sigc::bind(sigc::mem_fun(
174 *this, &Widget::on_value_changed), port_name));
175 }
176 }
177
178 // create stackboxes with switch controller for port name
179 void Widget::make_switch_box(Gtk::Box *box,
180 Glib::ustring label,
181 PortIndex port_name)
182 {
183 Gxw::Switch *regler = static_cast<Gxw::Switch*>(
184 get_controller_by_port(port_name));
185 if (regler)
186 {
187 Gtk::Label* pr = new Gtk::Label(label, 0);
188 pr->set_name("amplabel");
189 // use label images instead simple string labes
190 /*Glib::ustring label_image = GX_LV2_STYLE_DIR;
191 label_image += "/"+plug_name+"-";
192 label_image += label;
193 label_image += "-label.png";
194 Gtk::Image *pr = new Gtk::Image(label_image);*/
195
196 regler->cp_configure("switch", label, 0, 1, 1);
197 regler->set_name(plug_name);
198 regler->set_base_name( "button" );
199 Gtk::VBox* b1 = new Gtk::VBox();
200 box->pack_start( *Gtk::manage(b1), Gtk::PACK_EXPAND_PADDING);
201 box->pack_start( *Gtk::manage(pr),Gtk::PACK_SHRINK);
202 box->pack_start(*regler,Gtk::PACK_SHRINK);
203 Gtk::VBox* b2 = new Gtk::VBox();
204 box->pack_start( *Gtk::manage(b2), Gtk::PACK_EXPAND_PADDING);
205 regler->signal_toggled().connect(sigc::bind(sigc::mem_fun(
206 *this, &Widget::on_value_changed), port_name));
207 }
208 }
209
210 // receive controller value changes from host and set them to controller
211 void Widget::set_value(uint32_t port_index,
212 uint32_t format,
213 const void * buffer)
214 {
215 if ( format == 0 )
216 {
217 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
218 get_controller_by_port(port_index));
219 if (regler)
220 {
221 float value = *static_cast<const float*>(buffer);
222 regler->cp_set_value(value);
223 }
224 }
225 }
226
227 // write (UI) controller value changes to the host->engine
228 void Widget::on_value_changed(uint32_t port_index)
229 {
230 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
231 get_controller_by_port(port_index));
232 if (regler)
233 {
234 float value = regler->cp_get_value();
235 write_function(controller, port_index, sizeof(float), 0,
236 static_cast<const void*>(&value));
237 }
238 }
239
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_WIDGET_H_
22 #define SRC_HEADERS_WIDGET_H_
23
24 #include <gtkmm.h>
25 #include <gxwmm.h>
26 #include "gx_duck_delay.h"
27 #include "../config.h" // for GX_STYLE_DIR
28 // LV2UI stuff
29 #include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
30
31 class Widget : public Gtk::HBox
32 {
33 private:
34 Gtk::Widget* get_controller_by_port(uint32_t port_index);
35
36 void on_value_changed(uint32_t port_index);
37
38 void make_controller_box(Gtk::Box *box,
39 Glib::ustring label,
40 float min, float max,
41 float digits,
42 PortIndex port_name);
43
44 void make_selector(Glib::ustring label,
45 Glib::ustring tables[],
46 size_t _size,
47 float min, float digits,
48 PortIndex port_name);
49
50 void make_switch_box(Gtk::Box *box,
51 Glib::ustring label,
52 PortIndex port_name);
53
54 bool _expose_event(GdkEventExpose *event);
55
56 void set_value(uint32_t port_index,
57 uint32_t format,
58 const void * buffer);
59 public:
60
61 // public Lv2 communication stuff
62 LV2UI_Controller controller;
63 LV2UI_Write_Function write_function;
64 static void set_value_static(uint32_t port_index,
65 uint32_t buffer_size,
66 uint32_t format,
67 const void * buffer, Widget *self)
68 {
69 self->set_value(port_index,format,buffer);
70 }
71
72 Widget(Glib::ustring plugname);
73 ~Widget();
74
75 protected:
76 Glib::ustring plug_name;
77 Gtk::VBox m_vbox_;
78 Gtk::VBox m_vbox;
79 Gtk::VBox m_vbox1;
80 Gtk::VBox m_vbox2;
81 Gtk::VBox m_vbox3;
82 Gtk::VBox m_vbox4;
83 Gtk::VBox m_vbox5;
84 Gtk::VBox m_vbox6;
85 Gtk::HBox m_hbox_;
86
87 Gxw::PaintBox m_paintbox;
88 Gxw::BigKnob m_bigknob;
89 Gxw::BigKnob m_smallknob3;
90 Gxw::BigKnob m_smallknob4;
91 Gxw::BigKnob m_smallknob5;
92 Gxw::BigKnob m_smallknob6;
93 };
94
95 #endif //SRC_HEADERS_WIDGET_H_
0 #!/usr/bin/env python
1 # encoding: utf-8
2
3 import sys, os, TaskGen, ctypes
4
5 def configure(conf):
6 pass
7
8 def build(bld):
9 bundle = 'gx_duck_delay.lv2'
10
11 src = ['gx_duck_delay.cpp'
12 ]
13 incl = ['../faust-generated','./', '../DSP']
14 lib = []
15 if sys.platform.startswith("linux"):
16 lib.append('dl')
17 uselib = ['LV2CORE']
18 cxxflag =[]
19 if not bld.env['OPT'] and bld.env['SSE2']:
20 cxxflag = [ "-msse2", "-mfpmath=sse"]
21 lv2_effects = bld(
22 features='cxx cshlib ',
23 includes = incl,
24 lib = lib,
25 uselib = uselib,
26 obj_ext = '_5.o',
27 cxxflags = cxxflag,
28 defines = ["LV2_SO"],
29 target = 'gx_duck_delay',
30 source = src,
31 install_path = '${LV2DIR}/%s' % bundle,
32 chmod = 0o755,
33 )
34 lv2_effects.env['shlib_PATTERN'] = '%s.so'
35
36 uselib_local5 = []
37 libpath5 = []
38 lib5 = []
39 incl5 = ['../../../libgxwmm','../../../libgxw','../']
40 if sys.platform.startswith("linux"):
41 lib5.append('dl')
42 if bld.env["GX_LIB_SHARED"]:
43 lib5 += ['gxwmm','gxw']
44 libpath5 += [bld.path.find_dir("../../../libgxw/gxw").bldpath(bld.env),
45 bld.path.find_dir("../../../libgxwmm/gxwmm").bldpath(bld.env)]
46 else:
47 uselib_local5 += ['gxwmm','gxw']
48
49 lv2_effetcs_gui = bld(
50 features='cxx cshlib ',
51 includes = incl5,
52 lib = lib5,
53 uselib = 'LV2CORE GTKMM',
54 libpath = libpath5,
55 uselib_local = uselib_local5,
56 linkflags = '-Wl,-z,nodelete',
57 defines = ["LV2_GUI"],
58 target = 'gx_duck_delay_gui',
59 source = 'widget.cpp gx_duck_delay_gui.cpp',
60 install_path = '${LV2DIR}/%s' % bundle,
61 chmod = 0o755,
62 )
63 lv2_effetcs_gui.env['shlib_PATTERN'] = '%s.so'
64
65
66 install_path = '${LV2DIR}/%s' % bundle,
67 bld.install_files('${LV2DIR}/gx_duck_delay.lv2', 'manifest.ttl')
68 bld.install_files('${LV2DIR}/gx_duck_delay.lv2', 'gx_duck_delay.ttl')
69
70 bld.install_files('${LV2DIR}/gx_duck_delay.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
0
1 # check if user is root
2 user = $(shell whoami)
3 ifeq ($(user),root)
4 INSTALL_DIR = /usr/lib/lv2
5 else
6 INSTALL_DIR = ~/.lv2
7 endif
8
9 ifneq (cat /proc/cpuinfo | grep sse2 >/dev/null,)
10 SSE_CFLAGS = -msse2 -mfpmath=sse
11 else ifneq (cat /proc/cpuinfo | grep sse >/dev/null,)
12 SSE_CFLAGS = -msse -mfpmath=sse
13 else
14 SSE_CFLAGS = ""
15 endif
16
17 # set bundle name
18 NAME = gx_duck_delay_st
19 BUNDLE = $(NAME).lv2
20 VER = 0.1
21 # set compile flags
22 CXXFLAGS = -I. -I../DSP -O2 -Wall -funroll-loops -ffast-math -fomit-frame-pointer -fstrength-reduce $(SSE_CFLAGS)
23 LDFLAGS = -I. -I../DSP -shared -Llibrary -lc -lm -fPIC -DPIC
24 # invoke build files
25 OBJECTS = $(NAME).cpp
26 ## output style (bash colours)
27 BLUE = "\033[1;34m"
28 RED = "\033[1;31m"
29 NONE = "\033[0m"
30
31 .PHONY : all clean install uninstall
32
33 all : $(NAME)
34 @mkdir -p ./$(BUNDLE)
35 @cp ./*.ttl ./$(BUNDLE)
36 @mv ./*.so ./$(BUNDLE)
37 @if [ -f ./$(BUNDLE)/$(NAME).so ]; then echo $(BLUE)"build finish, now run make install"; \
38 else echo $(RED)"sorry, build failed"; fi
39 @echo $(NONE)
40
41 clean :
42 @rm -f $(NAME).so
43 @rm -rf ./$(BUNDLE)
44 @echo ". ." $(BLUE)", done"$(NONE)
45
46 install : all
47 @mkdir -p $(DESTDIR)$(INSTALL_DIR)/$(BUNDLE)
48 install ./$(BUNDLE)/* $(DESTDIR)$(INSTALL_DIR)/$(BUNDLE)
49 @echo ". ." $(BLUE)", done"$(NONE)
50
51 uninstall :
52 @rm -rf $(INSTALL_DIR)/$(BUNDLE)
53 @echo ". ." $(BLUE)", done"$(NONE)
54
55 $(NAME) :
56 $(CXX) $(CXXFLAGS) $(OBJECTS) $(LDFLAGS) -o $(NAME).so
0 // generated from file './faust/duck_delay_st.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.65 (http://faust.grame.fr)
2
3
4 namespace duck_delay_st {
5
6 class Dsp: public PluginLV2 {
7 private:
8 uint32_t fSamplingFreq;
9 int iConst0;
10 double fConst1;
11 double fConst2;
12 double fConst3;
13 double fConst4;
14 double fConst5;
15 double fConst6;
16 double fConst7;
17 double fConst8;
18 FAUSTFLOAT fslider0;
19 FAUSTFLOAT *fslider0_;
20 FAUSTFLOAT fslider1;
21 FAUSTFLOAT *fslider1_;
22 int IOTA;
23 double fVec0[524288];
24 double fConst9;
25 FAUSTFLOAT fslider2;
26 FAUSTFLOAT *fslider2_;
27 double fConst10;
28 double fRec6[2];
29 double fConst11;
30 double fRec5[2];
31 double fRec3[2];
32 double fVec1[524288];
33 double fRec7[2];
34 double fRec4[2];
35 double fConst12;
36 double fConst13;
37 double fConst14;
38 double fConst15;
39 double fRec2[2];
40 double fRec1[3];
41 double fConst16;
42 double fRec0[3];
43 FAUSTFLOAT fslider3;
44 FAUSTFLOAT *fslider3_;
45 double fRec10[2];
46 double fRec9[3];
47 double fRec8[3];
48 double fConst17;
49 double fConst18;
50 double fConst19;
51 double fConst20;
52 double fConst21;
53 double fConst22;
54 double fConst23;
55 double fConst24;
56 double fConst25;
57 double fConst26;
58 double fConst27;
59 double fRec13[2];
60 double fRec12[3];
61 double fRec11[3];
62 double fConst28;
63 double fRec16[2];
64 double fRec15[3];
65 double fConst29;
66 double fRec14[3];
67 FAUSTFLOAT fslider4;
68 FAUSTFLOAT *fslider4_;
69 double fRec17[2];
70 FAUSTFLOAT fslider5;
71 FAUSTFLOAT *fslider5_;
72 double fConst30;
73 double fRec20[2];
74 FAUSTFLOAT fslider6;
75 FAUSTFLOAT *fslider6_;
76 double fRec19[2];
77 FAUSTFLOAT fslider7;
78 FAUSTFLOAT *fslider7_;
79 double fRec18[2];
80 double fRec23[2];
81 double fRec22[3];
82 double fRec21[3];
83 double fRec26[2];
84 double fRec25[3];
85 double fRec24[3];
86 double fRec29[2];
87 double fRec28[3];
88 double fRec27[3];
89 double fRec32[2];
90 double fRec31[3];
91 double fRec30[3];
92 double fRec35[2];
93 double fRec34[2];
94 double fRec33[2];
95 void connect(uint32_t port,void* data);
96 void clear_state_f();
97 void init(uint32_t samplingFreq);
98 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
99
100 static void clear_state_f_static(PluginLV2*);
101 static void init_static(uint32_t samplingFreq, PluginLV2*);
102 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
103 static void del_instance(PluginLV2 *p);
104 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
105 public:
106 Dsp();
107 ~Dsp();
108 };
109
110
111
112 Dsp::Dsp()
113 : PluginLV2() {
114 version = PLUGINLV2_VERSION;
115 id = "duckDelaySt";
116 name = N_("Duck Delay St");
117 mono_audio = 0;
118 stereo_audio = compute_static;
119 set_samplerate = init_static;
120 activate_plugin = 0;
121 connect_ports = connect_static;
122 clear_state = clear_state_f_static;
123 delete_instance = del_instance;
124 }
125
126 Dsp::~Dsp() {
127 }
128
129 inline void Dsp::clear_state_f()
130 {
131 for (int i=0; i<524288; i++) fVec0[i] = 0;
132 for (int i=0; i<2; i++) fRec6[i] = 0;
133 for (int i=0; i<2; i++) fRec5[i] = 0;
134 for (int i=0; i<2; i++) fRec3[i] = 0;
135 for (int i=0; i<524288; i++) fVec1[i] = 0;
136 for (int i=0; i<2; i++) fRec7[i] = 0;
137 for (int i=0; i<2; i++) fRec4[i] = 0;
138 for (int i=0; i<2; i++) fRec2[i] = 0;
139 for (int i=0; i<3; i++) fRec1[i] = 0;
140 for (int i=0; i<3; i++) fRec0[i] = 0;
141 for (int i=0; i<2; i++) fRec10[i] = 0;
142 for (int i=0; i<3; i++) fRec9[i] = 0;
143 for (int i=0; i<3; i++) fRec8[i] = 0;
144 for (int i=0; i<2; i++) fRec13[i] = 0;
145 for (int i=0; i<3; i++) fRec12[i] = 0;
146 for (int i=0; i<3; i++) fRec11[i] = 0;
147 for (int i=0; i<2; i++) fRec16[i] = 0;
148 for (int i=0; i<3; i++) fRec15[i] = 0;
149 for (int i=0; i<3; i++) fRec14[i] = 0;
150 for (int i=0; i<2; i++) fRec17[i] = 0;
151 for (int i=0; i<2; i++) fRec20[i] = 0;
152 for (int i=0; i<2; i++) fRec19[i] = 0;
153 for (int i=0; i<2; i++) fRec18[i] = 0;
154 for (int i=0; i<2; i++) fRec23[i] = 0;
155 for (int i=0; i<3; i++) fRec22[i] = 0;
156 for (int i=0; i<3; i++) fRec21[i] = 0;
157 for (int i=0; i<2; i++) fRec26[i] = 0;
158 for (int i=0; i<3; i++) fRec25[i] = 0;
159 for (int i=0; i<3; i++) fRec24[i] = 0;
160 for (int i=0; i<2; i++) fRec29[i] = 0;
161 for (int i=0; i<3; i++) fRec28[i] = 0;
162 for (int i=0; i<3; i++) fRec27[i] = 0;
163 for (int i=0; i<2; i++) fRec32[i] = 0;
164 for (int i=0; i<3; i++) fRec31[i] = 0;
165 for (int i=0; i<3; i++) fRec30[i] = 0;
166 for (int i=0; i<2; i++) fRec35[i] = 0;
167 for (int i=0; i<2; i++) fRec34[i] = 0;
168 for (int i=0; i<2; i++) fRec33[i] = 0;
169 }
170
171 void Dsp::clear_state_f_static(PluginLV2 *p)
172 {
173 static_cast<Dsp*>(p)->clear_state_f();
174 }
175
176 inline void Dsp::init(uint32_t samplingFreq)
177 {
178 fSamplingFreq = samplingFreq;
179 iConst0 = min(192000, max(1, fSamplingFreq));
180 fConst1 = tan((2764.601535159018 / double(iConst0)));
181 fConst2 = (1.0 / faustpower<2>(fConst1));
182 fConst3 = (2 * (1 - fConst2));
183 fConst4 = (1.0 / fConst1);
184 fConst5 = (1 + ((fConst4 - 0.6180339887498947) / fConst1));
185 fConst6 = (1.0 / (1 + ((0.6180339887498947 + fConst4) / fConst1)));
186 fConst7 = (1 + ((fConst4 - 1.6180339887498947) / fConst1));
187 fConst8 = (1.0 / (1 + ((fConst4 + 1.6180339887498947) / fConst1)));
188 IOTA = 0;
189 fConst9 = exp((0 - (1e+01 / double(iConst0))));
190 fConst10 = (1.0 - fConst9);
191 fConst11 = (0.001 * iConst0);
192 fConst12 = (0 - fConst4);
193 fConst13 = (1 + fConst4);
194 fConst14 = (1.0 / fConst13);
195 fConst15 = (0 - ((1 - fConst4) / fConst13));
196 fConst16 = (2 * (0 - fConst2));
197 fConst17 = tan((1382.300767579509 / double(iConst0)));
198 fConst18 = (1.0 / faustpower<2>(fConst17));
199 fConst19 = (2 * (1 - fConst18));
200 fConst20 = (1.0 / fConst17);
201 fConst21 = (1 + ((fConst20 - 0.6180339887498947) / fConst17));
202 fConst22 = (1.0 / (1 + ((0.6180339887498947 + fConst20) / fConst17)));
203 fConst23 = (1 + ((fConst20 - 1.6180339887498947) / fConst17));
204 fConst24 = (1.0 / (1 + ((1.6180339887498947 + fConst20) / fConst17)));
205 fConst25 = (1 + fConst20);
206 fConst26 = (1.0 / fConst25);
207 fConst27 = (0 - ((1 - fConst20) / fConst25));
208 fConst28 = (0 - fConst20);
209 fConst29 = (2 * (0 - fConst18));
210 fConst30 = (1.0 / double(iConst0));
211 clear_state_f();
212 }
213
214 void Dsp::init_static(uint32_t samplingFreq, PluginLV2 *p)
215 {
216 static_cast<Dsp*>(p)->init(samplingFreq);
217 }
218
219 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
220 {
221 #define fslider0 (*fslider0_)
222 #define fslider1 (*fslider1_)
223 #define fslider2 (*fslider2_)
224 #define fslider3 (*fslider3_)
225 #define fslider4 (*fslider4_)
226 #define fslider5 (*fslider5_)
227 #define fslider6 (*fslider6_)
228 #define fslider7 (*fslider7_)
229 double fSlow0 = double(fslider0);
230 double fSlow1 = (1 - fSlow0);
231 double fSlow2 = double(fslider1);
232 double fSlow3 = (fConst10 * double(fslider2));
233 double fSlow4 = (1 - (fSlow0 * fSlow2));
234 double fSlow5 = double(fslider3);
235 double fSlow6 = pow(10,(0.6 * fSlow5));
236 double fSlow7 = pow(10,(0.6 * (1 - fSlow5)));
237 double fSlow8 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider4))));
238 double fSlow9 = exp((0 - (fConst30 / double(fslider5))));
239 double fSlow10 = (1.0 - fSlow9);
240 double fSlow11 = exp((0 - (fConst30 / double(fslider6))));
241 double fSlow12 = (1.0 - fSlow11);
242 double fSlow13 = pow(10,(0.05 * double(fslider7)));
243 for (int i=0; i<count; i++) {
244 double fTemp0 = (double)input0[i];
245 double fTemp1 = (fTemp0 + (fSlow2 * ((fSlow1 * fRec5[1]) + (fSlow0 * fRec4[1]))));
246 fVec0[IOTA&524287] = fTemp1;
247 fRec6[0] = (fSlow3 + (fConst9 * fRec6[1]));
248 double fTemp2 = (fConst11 * fRec6[0]);
249 int iTemp3 = int(fTemp2);
250 int iTemp4 = (1 + iTemp3);
251 int iTemp5 = int((int(iTemp4) & 393215));
252 double fTemp6 = (fTemp2 - iTemp3);
253 double fTemp7 = (iTemp4 - fTemp2);
254 int iTemp8 = int((iTemp3 & 393215));
255 fRec5[0] = ((fVec0[(IOTA-iTemp8)&524287] * fTemp7) + (fTemp6 * fVec0[(IOTA-iTemp5)&524287]));
256 fRec3[0] = fRec5[0];
257 double fTemp9 = (double)input1[i];
258 double fTemp10 = ((fSlow4 * fTemp9) + (fSlow2 * ((fSlow1 * fRec7[1]) + (fSlow0 * fRec3[1]))));
259 fVec1[IOTA&524287] = fTemp10;
260 fRec7[0] = ((fTemp7 * fVec1[(IOTA-iTemp8)&524287]) + (fTemp6 * fVec1[(IOTA-iTemp5)&524287]));
261 fRec4[0] = fRec7[0];
262 fRec2[0] = ((fConst15 * fRec2[1]) + (fConst14 * ((fConst4 * fRec3[0]) + (fConst12 * fRec3[1]))));
263 fRec1[0] = (fRec2[0] - (fConst8 * ((fConst7 * fRec1[2]) + (fConst3 * fRec1[1]))));
264 fRec0[0] = ((fConst8 * (((fConst2 * fRec1[0]) + (fConst16 * fRec1[1])) + (fConst2 * fRec1[2]))) - (fConst6 * ((fConst5 * fRec0[2]) + (fConst3 * fRec0[1]))));
265 double fTemp11 = (fRec3[0] + fRec3[1]);
266 fRec10[0] = ((fConst15 * fRec10[1]) + (fConst14 * fTemp11));
267 fRec9[0] = (fRec10[0] - (fConst8 * ((fConst7 * fRec9[2]) + (fConst3 * fRec9[1]))));
268 fRec8[0] = ((fConst8 * (fRec9[2] + (fRec9[0] + (2 * fRec9[1])))) - (fConst6 * ((fConst5 * fRec8[2]) + (fConst3 * fRec8[1]))));
269 fRec13[0] = ((fConst27 * fRec13[1]) + (fConst26 * fTemp11));
270 fRec12[0] = (fRec13[0] - (fConst24 * ((fConst23 * fRec12[2]) + (fConst19 * fRec12[1]))));
271 fRec11[0] = ((fConst24 * (fRec12[2] + (fRec12[0] + (2 * fRec12[1])))) - (fConst22 * ((fConst21 * fRec11[2]) + (fConst19 * fRec11[1]))));
272 fRec16[0] = ((fConst27 * fRec16[1]) + (fConst26 * ((fConst20 * fRec3[0]) + (fConst28 * fRec3[1]))));
273 fRec15[0] = (fRec16[0] - (fConst24 * ((fConst23 * fRec15[2]) + (fConst19 * fRec15[1]))));
274 fRec14[0] = ((fConst24 * (((fConst18 * fRec15[0]) + (fConst29 * fRec15[1])) + (fConst18 * fRec15[2]))) - (fConst22 * ((fConst21 * fRec14[2]) + (fConst19 * fRec14[1]))));
275 fRec17[0] = ((0.999 * fRec17[1]) + fSlow8);
276 double fTemp12 = fabs(fTemp0);
277 fRec20[0] = ((fSlow9 * max(fTemp12, fRec20[1])) + (fSlow10 * fTemp12));
278 fRec19[0] = ((fSlow11 * fRec19[1]) + (fSlow12 * fRec20[0]));
279 fRec18[0] = ((fConst9 * fRec18[1]) + (fConst10 * (1 - ((fSlow13 * fRec19[0]) > 1))));
280 output0[i] = (FAUSTFLOAT)(fTemp0 + (0.1778279410038923 * ((fRec18[0] * fRec17[0]) * ((fConst22 * ((((fConst18 * fRec14[0]) + (fConst29 * fRec14[1])) + (fConst18 * fRec14[2])) + (fSlow7 * (fRec11[2] + (fRec11[0] + (2 * fRec11[1])))))) + (fConst6 * ((fRec8[2] + (fRec8[0] + (2 * fRec8[1]))) + (fSlow6 * (((fConst2 * fRec0[0]) + (fConst16 * fRec0[1])) + (fConst2 * fRec0[2])))))))));
281 fRec23[0] = ((fConst15 * fRec23[1]) + (fConst14 * ((fConst4 * fRec4[0]) + (fConst12 * fRec4[1]))));
282 fRec22[0] = (fRec23[0] - (fConst8 * ((fConst7 * fRec22[2]) + (fConst3 * fRec22[1]))));
283 fRec21[0] = ((fConst8 * (((fConst2 * fRec22[0]) + (fConst16 * fRec22[1])) + (fConst2 * fRec22[2]))) - (fConst6 * ((fConst5 * fRec21[2]) + (fConst3 * fRec21[1]))));
284 double fTemp13 = (fRec4[0] + fRec4[1]);
285 fRec26[0] = ((fConst15 * fRec26[1]) + (fConst14 * fTemp13));
286 fRec25[0] = (fRec26[0] - (fConst8 * ((fConst7 * fRec25[2]) + (fConst3 * fRec25[1]))));
287 fRec24[0] = ((fConst8 * (fRec25[2] + (fRec25[0] + (2 * fRec25[1])))) - (fConst6 * ((fConst5 * fRec24[2]) + (fConst3 * fRec24[1]))));
288 fRec29[0] = ((fConst27 * fRec29[1]) + (fConst26 * fTemp13));
289 fRec28[0] = (fRec29[0] - (fConst24 * ((fConst23 * fRec28[2]) + (fConst19 * fRec28[1]))));
290 fRec27[0] = ((fConst24 * (fRec28[2] + (fRec28[0] + (2 * fRec28[1])))) - (fConst22 * ((fConst21 * fRec27[2]) + (fConst19 * fRec27[1]))));
291 fRec32[0] = ((fConst27 * fRec32[1]) + (fConst26 * ((fConst20 * fRec4[0]) + (fConst28 * fRec4[1]))));
292 fRec31[0] = (fRec32[0] - (fConst24 * ((fConst23 * fRec31[2]) + (fConst19 * fRec31[1]))));
293 fRec30[0] = ((fConst24 * (((fConst18 * fRec31[0]) + (fConst29 * fRec31[1])) + (fConst18 * fRec31[2]))) - (fConst22 * ((fConst21 * fRec30[2]) + (fConst19 * fRec30[1]))));
294 double fTemp14 = fabs(fTemp9);
295 fRec35[0] = ((fSlow9 * max(fTemp14, fRec35[1])) + (fSlow10 * fTemp14));
296 fRec34[0] = ((fSlow11 * fRec34[1]) + (fSlow12 * fRec35[0]));
297 fRec33[0] = ((fConst9 * fRec33[1]) + (fConst10 * (1 - ((fSlow13 * fRec34[0]) > 1))));
298 output1[i] = (FAUSTFLOAT)(fTemp9 + (0.1778279410038923 * ((fRec17[0] * fRec33[0]) * ((fConst22 * ((((fConst18 * fRec30[0]) + (fConst29 * fRec30[1])) + (fConst18 * fRec30[2])) + (fSlow7 * (fRec27[2] + (fRec27[0] + (2 * fRec27[1])))))) + (fConst6 * ((fRec24[2] + (fRec24[0] + (2 * fRec24[1]))) + (fSlow6 * (((fConst2 * fRec21[0]) + (fConst16 * fRec21[1])) + (fConst2 * fRec21[2])))))))));
299 // post processing
300 fRec33[1] = fRec33[0];
301 fRec34[1] = fRec34[0];
302 fRec35[1] = fRec35[0];
303 fRec30[2] = fRec30[1]; fRec30[1] = fRec30[0];
304 fRec31[2] = fRec31[1]; fRec31[1] = fRec31[0];
305 fRec32[1] = fRec32[0];
306 fRec27[2] = fRec27[1]; fRec27[1] = fRec27[0];
307 fRec28[2] = fRec28[1]; fRec28[1] = fRec28[0];
308 fRec29[1] = fRec29[0];
309 fRec24[2] = fRec24[1]; fRec24[1] = fRec24[0];
310 fRec25[2] = fRec25[1]; fRec25[1] = fRec25[0];
311 fRec26[1] = fRec26[0];
312 fRec21[2] = fRec21[1]; fRec21[1] = fRec21[0];
313 fRec22[2] = fRec22[1]; fRec22[1] = fRec22[0];
314 fRec23[1] = fRec23[0];
315 fRec18[1] = fRec18[0];
316 fRec19[1] = fRec19[0];
317 fRec20[1] = fRec20[0];
318 fRec17[1] = fRec17[0];
319 fRec14[2] = fRec14[1]; fRec14[1] = fRec14[0];
320 fRec15[2] = fRec15[1]; fRec15[1] = fRec15[0];
321 fRec16[1] = fRec16[0];
322 fRec11[2] = fRec11[1]; fRec11[1] = fRec11[0];
323 fRec12[2] = fRec12[1]; fRec12[1] = fRec12[0];
324 fRec13[1] = fRec13[0];
325 fRec8[2] = fRec8[1]; fRec8[1] = fRec8[0];
326 fRec9[2] = fRec9[1]; fRec9[1] = fRec9[0];
327 fRec10[1] = fRec10[0];
328 fRec0[2] = fRec0[1]; fRec0[1] = fRec0[0];
329 fRec1[2] = fRec1[1]; fRec1[1] = fRec1[0];
330 fRec2[1] = fRec2[0];
331 fRec4[1] = fRec4[0];
332 fRec7[1] = fRec7[0];
333 fRec3[1] = fRec3[0];
334 fRec5[1] = fRec5[0];
335 fRec6[1] = fRec6[0];
336 IOTA = IOTA+1;
337 }
338 #undef fslider0
339 #undef fslider1
340 #undef fslider2
341 #undef fslider3
342 #undef fslider4
343 #undef fslider5
344 #undef fslider6
345 #undef fslider7
346 }
347
348 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
349 {
350 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
351 }
352
353
354 void Dsp::connect(uint32_t port,void* data)
355 {
356 switch ((PortIndex)port)
357 {
358 case AMOUNT:
359 fslider7_ = (float*)data; // , 0.5, 0.0, 56.0, 0.05
360 break;
361 case ATTACK:
362 fslider6_ = (float*)data; // , 0.1, 0.05, 0.5, 0.05
363 break;
364 case COLORATION:
365 fslider3_ = (float*)data; // , 0.0, -1.0, 1.0, 0.05
366 break;
367 case EFFECT:
368 fslider4_ = (float*)data; // , 0.0, -16.0, 4.0, 0.1
369 break;
370 case FEEDBACK:
371 fslider1_ = (float*)data; // , 0.0, 0.0, 1.0, 0.05
372 break;
373 case PINGPONG:
374 fslider0_ = (float*)data; // , 0.0, 0.0, 1.0, 0.05
375 break;
376 case RELEASE:
377 fslider5_ = (float*)data; // , 0.1, 0.05, 2.0, 0.05
378 break;
379 case TIME:
380 fslider2_ = (float*)data; // , 5e+02, 1.0, 2e+03, 1.0
381 break;
382 default:
383 break;
384 }
385 }
386
387 void Dsp::connect_static(uint32_t port,void* data, PluginLV2 *p)
388 {
389 static_cast<Dsp*>(p)->connect(port, data);
390 }
391
392
393 PluginLV2 *plugin() {
394 return new Dsp();
395 }
396
397 void Dsp::del_instance(PluginLV2 *p)
398 {
399 delete static_cast<Dsp*>(p);
400 }
401
402 /*
403 typedef enum
404 {
405 AMOUNT,
406 ATTACK,
407 COLORATION,
408 EFFECT,
409 FEEDBACK,
410 PINGPONG,
411 RELEASE,
412 TIME,
413 } PortIndex;
414 */
415
416 } // end namespace duck_delay_st
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 ////////////////////////////// LOCAL INCLUDES //////////////////////////
21
22 #include "gx_common.h" // faust support and denormal protection (SSE)
23 #include "gx_duck_delay_st.h" // define struct PortIndex
24 #include "gx_pluginlv2.h" // define struct PluginLV2
25 #include "duck_delay_st.cc" // dsp class generated by faust -> dsp2cc
26
27 ////////////////////////////// PLUG-IN CLASS ///////////////////////////
28
29 namespace duck_delay_st {
30
31 class Gx_duck_delay_st_
32 {
33 private:
34 // pointer to buffer
35 float* output;
36 float* input;
37 float* output1;
38 float* input1;
39 // pointer to dsp class
40 PluginLV2* duck_delay_st;
41 // private functions
42 inline void run_dsp_(uint32_t n_samples);
43 inline void connect_(uint32_t port,void* data);
44 inline void init_dsp_(uint32_t rate);
45 inline void connect_all__ports(uint32_t port, void* data);
46 inline void activate_f();
47 inline void clean_up();
48 inline void deactivate_f();
49
50 public:
51 // LV2 Descriptor
52 static const LV2_Descriptor descriptor;
53 // static wrapper to private functions
54 static void deactivate(LV2_Handle instance);
55 static void cleanup(LV2_Handle instance);
56 static void run(LV2_Handle instance, uint32_t n_samples);
57 static void activate(LV2_Handle instance);
58 static void connect_port(LV2_Handle instance, uint32_t port, void* data);
59 static LV2_Handle instantiate(const LV2_Descriptor* descriptor,
60 double rate, const char* bundle_path,
61 const LV2_Feature* const* features);
62 Gx_duck_delay_st_();
63 ~Gx_duck_delay_st_();
64 };
65
66 // constructor
67 Gx_duck_delay_st_::Gx_duck_delay_st_() :
68 output(NULL),
69 input(NULL),
70 duck_delay_st(duck_delay_st::plugin()) {};
71
72 // destructor
73 Gx_duck_delay_st_::~Gx_duck_delay_st_()
74 {
75 // just to be sure the plug have given free the allocated mem
76 // it didn't hurd if the mem is already given free by clean_up()
77 if (duck_delay_st->activate_plugin !=0)
78 duck_delay_st->activate_plugin(false, duck_delay_st);
79 // delete DSP class
80 duck_delay_st->delete_instance(duck_delay_st);
81 };
82
83 ///////////////////////// PRIVATE CLASS FUNCTIONS /////////////////////
84
85 void Gx_duck_delay_st_::init_dsp_(uint32_t rate)
86 {
87 AVOIDDENORMALS(); // init the SSE denormal protection
88 duck_delay_st->set_samplerate(rate, duck_delay_st); // init the DSP class
89 }
90
91 // connect the Ports used by the plug-in class
92 void Gx_duck_delay_st_::connect_(uint32_t port,void* data)
93 {
94 switch ((PortIndex)port)
95 {
96 case EFFECTS_OUTPUT:
97 output = static_cast<float*>(data);
98 break;
99 case EFFECTS_INPUT:
100 input = static_cast<float*>(data);
101 break;
102 case EFFECTS_OUTPUT1:
103 output1 = static_cast<float*>(data);
104 break;
105 case EFFECTS_INPUT1:
106 input1 = static_cast<float*>(data);
107 break;
108 default:
109 break;
110 }
111 }
112
113 void Gx_duck_delay_st_::activate_f()
114 {
115 // allocate the internal DSP mem
116 if (duck_delay_st->activate_plugin !=0)
117 duck_delay_st->activate_plugin(true, duck_delay_st);
118 }
119
120 void Gx_duck_delay_st_::clean_up()
121 {
122 // delete the internal DSP mem
123 if (duck_delay_st->activate_plugin !=0)
124 duck_delay_st->activate_plugin(false, duck_delay_st);
125 }
126
127 void Gx_duck_delay_st_::deactivate_f()
128 {
129 // delete the internal DSP mem
130 if (duck_delay_st->activate_plugin !=0)
131 duck_delay_st->activate_plugin(false, duck_delay_st);
132 }
133
134 void Gx_duck_delay_st_::run_dsp_(uint32_t n_samples)
135 {
136 duck_delay_st->stereo_audio(static_cast<int>(n_samples), input, input1, output, output1, duck_delay_st);
137 }
138
139 void Gx_duck_delay_st_::connect_all__ports(uint32_t port, void* data)
140 {
141 // connect the Ports used by the plug-in class
142 connect_(port,data);
143 // connect the Ports used by the DSP class
144 duck_delay_st->connect_ports(port, data, duck_delay_st);
145 }
146
147 ////////////////////// STATIC CLASS FUNCTIONS ////////////////////////
148
149 LV2_Handle
150 Gx_duck_delay_st_::instantiate(const LV2_Descriptor* descriptor,
151 double rate, const char* bundle_path,
152 const LV2_Feature* const* features)
153 {
154 // init the plug-in class
155 Gx_duck_delay_st_ *self = new Gx_duck_delay_st_();
156 if (!self)
157 {
158 return NULL;
159 }
160
161 self->init_dsp_((uint32_t)rate);
162
163 return (LV2_Handle)self;
164 }
165
166 void Gx_duck_delay_st_::connect_port(LV2_Handle instance,
167 uint32_t port, void* data)
168 {
169 // connect all ports
170 static_cast<Gx_duck_delay_st_*>(instance)->connect_all__ports(port, data);
171 }
172
173 void Gx_duck_delay_st_::activate(LV2_Handle instance)
174 {
175 // allocate needed mem
176 static_cast<Gx_duck_delay_st_*>(instance)->activate_f();
177 }
178
179 void Gx_duck_delay_st_::run(LV2_Handle instance, uint32_t n_samples)
180 {
181 // run dsp
182 static_cast<Gx_duck_delay_st_*>(instance)->run_dsp_(n_samples);
183 }
184
185 void Gx_duck_delay_st_::deactivate(LV2_Handle instance)
186 {
187 // free allocated mem
188 static_cast<Gx_duck_delay_st_*>(instance)->deactivate_f();
189 }
190
191 void Gx_duck_delay_st_::cleanup(LV2_Handle instance)
192 {
193 // well, clean up after us
194 Gx_duck_delay_st_* self = static_cast<Gx_duck_delay_st_*>(instance);
195 self->clean_up();
196 delete self;
197 }
198
199 const LV2_Descriptor Gx_duck_delay_st_::descriptor =
200 {
201 GXPLUGIN_URI "#_duck_delay_st_",
202 Gx_duck_delay_st_::instantiate,
203 Gx_duck_delay_st_::connect_port,
204 Gx_duck_delay_st_::activate,
205 Gx_duck_delay_st_::run,
206 Gx_duck_delay_st_::deactivate,
207 Gx_duck_delay_st_::cleanup,
208 NULL
209 };
210
211 } // end namespace duck_delay_st
212
213 ////////////////////////// LV2 SYMBOL EXPORT ///////////////////////////
214
215 extern "C"
216 LV2_SYMBOL_EXPORT
217 const LV2_Descriptor*
218 lv2_descriptor(uint32_t index)
219 {
220 switch (index)
221 {
222 case 0:
223 return &duck_delay_st::Gx_duck_delay_st_::descriptor;
224 default:
225 return NULL;
226 }
227 }
228
229 ///////////////////////////// FIN //////////////////////////////////////
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_GXEFFECTS_H_
22 #define SRC_HEADERS_GXEFFECTS_H_
23
24 #include <lv2.h>
25
26 #define GXPLUGIN_URI "http://guitarix.sourceforge.net/plugins/gx_duck_delay_st_"
27 #define GXPLUGIN_UI_URI "http://guitarix.sourceforge.net/plugins/gx_duck_delay_st_#gui"
28
29
30 typedef enum
31 {
32 EFFECTS_OUTPUT,
33 EFFECTS_INPUT,
34 EFFECTS_OUTPUT1,
35 EFFECTS_INPUT1,
36 AMOUNT,
37 ATTACK,
38 COLORATION,
39 EFFECT,
40 FEEDBACK,
41 PINGPONG,
42 RELEASE,
43 TIME,
44 } PortIndex;
45
46 #endif //SRC_HEADERS_GXEFFECTS_H_
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19
20 @prefix doap: <http://usefulinc.com/ns/doap#> .
21 @prefix foaf: <http://xmlns.com/foaf/0.1/> .
22 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
23 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
24 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
25 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#>.
27 @prefix time: <http://lv2plug.in/ns/ext/time/#>.
28 @prefix units: <http://lv2plug.in/ns/extensions/units#> .
29
30 <http://guitarix.sourceforge.net#me>
31 a foaf:Person ;
32 foaf:name "Guitarix team" ;
33 foaf:mbox <mailto:brummer@web.de> ;
34 rdfs:seeAlso <http://guitarix.sourceforge.net> .
35
36 <http://guitarix.sourceforge.net/plugins/gx_duck_delay_st_>
37 a doap:Project ;
38 doap:maintainer <http://guitarix.sourceforge.net#me> ;
39 doap:name "Gx_duck_delay_st_" .
40
41 <http://guitarix.sourceforge.net/plugins/gx_duck_delay_st_#_duck_delay_st_>
42 a lv2:Plugin ,
43 lv2:DelayPlugin ;
44 doap:maintainer <http://guitarix.sourceforge.net#me> ;
45 doap:name "Gxduck_delay_st";
46 doap:license <http://opensource.org/licenses/isc> ;
47 lv2:project <http://guitarix.sourceforge.net/plugins/gx_duck_delay_st_> ;
48 lv2:optionalFeature lv2:hardRTCapable ;
49
50 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_duck_delay_st_#gui>;
51
52 lv2:minorVersion 28;
53 lv2:microVersion 3;
54
55 lv2:port [
56 a lv2:AudioPort ,
57 lv2:OutputPort ;
58 lv2:index 0 ;
59 lv2:symbol "out" ;
60 lv2:name "Out"
61 ] , [
62 a lv2:AudioPort ,
63 lv2:InputPort ;
64 lv2:index 1 ;
65 lv2:symbol "in" ;
66 lv2:name "In" ;
67 ] , [
68 a lv2:AudioPort ,
69 lv2:OutputPort ;
70 lv2:index 2 ;
71 lv2:symbol "out1" ;
72 lv2:name "Out1"
73 ] , [
74 a lv2:AudioPort ,
75 lv2:InputPort ;
76 lv2:index 3 ;
77 lv2:symbol "in1" ;
78 lv2:name "In1" ;
79 ]
80 , [
81 a lv2:InputPort ,
82 lv2:ControlPort ;
83 lv2:index 4 ;
84 lv2:symbol "AMOUNT" ;
85 lv2:name "AMOUNT" ;
86 lv2:default 0.5 ;
87 lv2:minimum 0.0 ;
88 lv2:maximum 56.0 ;
89 ] , [
90 a lv2:InputPort ,
91 lv2:ControlPort ;
92 lv2:index 5 ;
93 lv2:symbol "ATTACK" ;
94 lv2:name "ATTACK" ;
95 lv2:default 0.1 ;
96 lv2:minimum 0.05 ;
97 lv2:maximum 0.5 ;
98 ] , [
99 a lv2:InputPort ,
100 lv2:ControlPort ;
101 lv2:index 6 ;
102 lv2:symbol "COLORATION" ;
103 lv2:name "COLORATION" ;
104 lv2:default 0.0 ;
105 lv2:minimum -1.0 ;
106 lv2:maximum 1.0 ;
107 ] , [
108 a lv2:InputPort ,
109 lv2:ControlPort ;
110 lv2:index 7 ;
111 lv2:symbol "EFFECT" ;
112 lv2:name "EFFECT" ;
113 lv2:default 0.0 ;
114 lv2:minimum -16.0 ;
115 lv2:maximum 4.0 ;
116 ] , [
117 a lv2:InputPort ,
118 lv2:ControlPort ;
119 lv2:index 8 ;
120 lv2:symbol "FEEDBACK" ;
121 lv2:name "FEEDBACK" ;
122 lv2:default 0.0 ;
123 lv2:minimum 0.0 ;
124 lv2:maximum 1.0 ;
125 ] , [
126 a lv2:InputPort ,
127 lv2:ControlPort ;
128 lv2:index 9 ;
129 lv2:symbol "PINGPONG" ;
130 lv2:name "PINGPONG" ;
131 lv2:default 0.0 ;
132 lv2:minimum 0.0 ;
133 lv2:maximum 1.0 ;
134 ] , [
135 a lv2:InputPort ,
136 lv2:ControlPort ;
137 lv2:index 10 ;
138 lv2:symbol "RELEASE" ;
139 lv2:name "RELEASE" ;
140 lv2:default 0.1 ;
141 lv2:minimum 0.05 ;
142 lv2:maximum 2.0 ;
143 ] , [
144 a lv2:InputPort ,
145 lv2:ControlPort ;
146 lv2:index 11 ;
147 lv2:symbol "TIME" ;
148 lv2:name "TIME" ;
149 lv2:default 5e+02 ;
150 lv2:minimum 1.0 ;
151 lv2:maximum 2e+03 ;
152 ];
153 mod:gui [
154 a mod:Gui;
155 mod:resourcesDirectory <modgui>;
156 mod:iconTemplate <modgui/icon-gxduck_delay_st.html>;
157 mod:templateData <modgui/data-gxduck_delay_st.json>;
158 mod:screenshot <modgui/screenshot-gxduck_delay_st.png>;
159 mod:thumbnail <modgui/thumb-gxduck_delay_st.png>;
160 ].
161
162 <http://guitarix.sourceforge.net/plugins/gx_duck_delay_st_#gui>
163 a guiext:GtkUI;
164 guiext:binary <gx_duck_delay_st_gui.so>;
165 guiext:requiredFeature guiext:makeResident .
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include <string>
21 #include <iostream>
22
23 #include <gtkmm.h>
24 #include "gx_duck_delay_st.h"
25 #include "widget.h"
26
27
28 #include <lv2.h>
29 #include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
30
31 using namespace std;
32
33 class Gx_duck_delay_stGUI
34 {
35 private:
36 Glib::ustring plugskin;
37 Glib::ustring addKnob;
38 Glib::ustring plug_name;
39 void set_knob(Glib::ustring knob);
40 void set_skin();
41 void set_plug_name(const char * plugin_uri);
42 GtkWidget* make_gui();
43 public:
44
45 Widget* widget;
46 static void set_plug_name_static(Gx_duck_delay_stGUI *self, const char * plugin_uri)
47 {
48 self->set_plug_name(plugin_uri);
49 }
50 static GtkWidget* make_gui_static(Gx_duck_delay_stGUI *self)
51 {
52 return self->make_gui();
53 }
54
55 Gx_duck_delay_stGUI () {};
56 ~Gx_duck_delay_stGUI () {};
57 } ;
58
59 void Gx_duck_delay_stGUI::set_knob( Glib::ustring knob)
60 {
61 addKnob = " style 'gx_";
62 addKnob += plug_name;
63 addKnob += "_dark_skin_icons'\n"
64 " { \n"
65 " stock['bigknob'] = {{'";
66 addKnob += knob;
67 addKnob += ".png'}}\n"
68 " stock['smallknob'] = {{'";
69 addKnob += knob;
70 addKnob += "-small.png'}}\n"
71 " stock['smallknobr'] = {{'";
72 addKnob += knob;
73 addKnob += "-middle.png'}}\n"
74 " stock['button_on'] = {{'"
75 "echo-switch_on.png'}}\n"
76 " stock['button_off'] = {{'"
77 "echo-switch_off.png'}}\n"
78 " }\n"
79 "widget '*.";
80 addKnob += plug_name;
81 addKnob += "' style 'gx_";
82 addKnob += plug_name;
83 addKnob += "_dark_skin_icons' \n"
84 "class '*GxToggleImage' style'gx_";
85 addKnob += plug_name;
86 addKnob += "_dark_skin_icons' \n";
87 }
88
89 void Gx_duck_delay_stGUI::set_skin()
90 {
91 Glib::ustring toparse = "pixmap_path ";
92 toparse += " '";
93 toparse += GX_LV2_STYLE_DIR;
94 toparse += "/'\n";
95 toparse += "style \"gx_";
96 toparse += plug_name;
97 toparse += "_dark-paintbox\"\n"
98 " { \n"
99 "GxPaintBox::skin-gradient = {\n"
100 "{ 65536, 0, 0, 13107, 52428 }, \n"
101 "{ 52428, 0, 0, 0, 52428 },\n"
102 "{ 13107, 0, 0, 13107, 13107 }}\n"
103 " GxPaintBox::icon-set =11\n"
104 " }\n"
105 "\n"
106 "style 'gx_head_duck_delay_st_box' \n"
107 " { \n"
108 " fg[NORMAL] = '#c0c6d0' \n"
109 "font_name = 'sans 7.5 bold' \n"
110 " }\n";
111 toparse += addKnob;
112
113 toparse += " widget '*.amplabel' style:highest 'gx_head_duck_delay_st_box'\n"
114 "widget '*.";
115 toparse += plug_name;
116 toparse += "' style 'gx_";
117 toparse += plug_name;
118 toparse += "_dark-paintbox' ";
119 toparse += " style 'gx_selector_";
120 toparse += plug_name;
121 toparse += "'\n"
122 " {\n"
123 " fg[NORMAL] = '#c0c6d0'\n"
124 " GtkRange::trough-border = 2\n"
125 " GtkRange::stepper-size = 8\n"
126 " GtkRange::stepper-spacing = 2\n"
127 " GxRegler::value-border = { 2, 0, 0, 0 }\n"
128 " font_name = 'sans 7.5'\n"
129 " xthickness = 10\n"
130 " ythickness = 1\n"
131 " }\n"
132 "widget '*.";
133 toparse += plug_name;
134 toparse += "' style:highest 'gx_selector_";
135 toparse += plug_name;
136 toparse += "'\n";
137 toparse += "style 'gx_switch'\n"
138 "{\n"
139 "xthickness = 0\n"
140 "ythickness = 0\n"
141 "GtkButton::inner-border = {0, 0, 0, 0}\n"
142 "GtkButton::default-border = {0, 0, 0, 0}\n"
143 "GtkButton::focus-line-width = 0\n"
144 "GtkButton::focus-padding = 0\n"
145 "GtkButton::interior-focus = 0\n"
146 "GtkButton::child-displacement-x = 0\n"
147 "GtkButton::child-displacement-y = 0\n"
148 " }\n"
149 "widget '*.";
150 toparse += plug_name;
151 toparse += "' style:highest 'gx_switch'";
152
153 gtk_rc_parse_string (toparse.c_str());
154 }
155
156 void Gx_duck_delay_stGUI::set_plug_name( const char * plugin_uri)
157 {
158 addKnob = "";
159
160 if (strcmp("http://guitarix.sourceforge.net/plugins/gx_duck_delay_st_#_duck_delay_st_", plugin_uri) == 0)
161 {
162 plug_name = "_duck_delay_st";
163 set_knob("nk-knob");
164 }
165 else
166 {
167 plug_name = "_duck_delay_st";
168 }
169 }
170
171 GtkWidget* Gx_duck_delay_stGUI::make_gui()
172 {
173 // init the gxwmm library
174 Gxw::init();
175 set_skin();
176 GtkWidget* container = gtk_vbox_new(FALSE, 2);
177 widget = new Widget(plug_name);
178 GtkWidget* cWidget = GTK_WIDGET(widget->gobj());
179 gtk_container_add(GTK_CONTAINER(container), cWidget );
180
181 return container;
182 }
183
184
185 static LV2UI_Handle instantiate(const struct _LV2UI_Descriptor * descriptor,
186 const char * plugin_uri,
187 const char * bundle_path,
188 LV2UI_Write_Function write_function,
189 LV2UI_Controller controller,
190 LV2UI_Widget * widget,
191 const LV2_Feature * const * features)
192 {
193 Gx_duck_delay_stGUI* self = new Gx_duck_delay_stGUI();
194 if (self == NULL) return NULL;
195 self->set_plug_name_static(self, plugin_uri);
196 *widget = (LV2UI_Widget)self->make_gui_static(self);
197 self->widget->controller = controller;
198 self->widget->write_function = write_function;
199 return (LV2UI_Handle)self;
200 }
201
202 static void cleanup(LV2UI_Handle ui)
203 {
204 Gx_duck_delay_stGUI *pluginGui = static_cast<Gx_duck_delay_stGUI*>(ui);
205 delete pluginGui->widget;
206 delete pluginGui;
207 }
208
209 static void port_event(LV2UI_Handle ui,
210 uint32_t port_index,
211 uint32_t buffer_size,
212 uint32_t format,
213 const void * buffer)
214 {
215 Gx_duck_delay_stGUI *self = static_cast<Gx_duck_delay_stGUI*>(ui);
216 self->widget->set_value_static( port_index, buffer_size, format, buffer, self->widget);
217 return;
218 }
219
220 static LV2UI_Descriptor descriptors[] =
221 {
222 {GXPLUGIN_UI_URI, instantiate, cleanup, port_event, NULL}
223 };
224
225 const LV2UI_Descriptor * lv2ui_descriptor(uint32_t index)
226 {
227 //printf("lv2ui_descriptor(%u) called\n", (uint32_t)index);
228 if (index >= sizeof(descriptors) / sizeof(descriptors[0]))
229 {
230 return NULL;
231 }
232 return descriptors + index;
233 }
234
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_duck_delay_st_#_duck_delay_st_>
23 a lv2:Plugin ;
24 lv2:binary <gx_duck_delay_st.so> ;
25 rdfs:seeAlso <gx_duck_delay_st.ttl> .
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_duck_delay_st_#_duck_delay_st_>
23 a lv2:Plugin ;
24 lv2:binary <gx_duck_delay_st@LIB_EXT@> ;
25 rdfs:seeAlso <gx_duck_delay_st.ttl> .
0 <div class="mod-pedal mod-pedal-japanese mod-eight-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group mod-{{knob}} clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "red",
3 "controls": [
4 {
5 "name": "AMOUNT",
6 "symbol": "AMOUNT"
7 },
8 {
9 "name": "ATTACK",
10 "symbol": "ATTACK"
11 },
12 {
13 "name": "COLORATION",
14 "symbol": "COLORATION"
15 },
16 {
17 "name": "EFFECT",
18 "symbol": "EFFECT"
19 },
20 {
21 "name": "FEEDBACK",
22 "symbol": "FEEDBACK"
23 }
24 {
25 "name": "PINGPONG",
26 "symbol": "PINGPONG"
27 }
28 {
29 "name": "RELEASE",
30 "symbol": "RELEASE"
31 }
32 {
33 "name": "TIME",
34 "symbol": "TIME"
35 }
36 ],
37 "knob": "red",
38 "label": "duck_delay"
39 }
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include "widget.h"
21
22 #include <iostream>
23
24
25 /* @get controller by port
26 * this function is used by make_selector() make_controller_box()
27 * set_value() and on_value_changed()
28 * so controller widgets needs only here asined to a port,
29 * and all functions which need acess to the controller widget pointer
30 * can receive them by port number
31 */
32
33 Gtk::Widget* Widget::get_controller_by_port(uint32_t port_index)
34 {
35 switch ((PortIndex)port_index )
36 {
37 case AMOUNT:
38 return &m_bigknob;
39 case ATTACK:
40 return &m_smallknob3;
41 case COLORATION:
42 return &m_smallknob4;
43 case EFFECT:
44 return &m_smallknob5;
45 case FEEDBACK:
46 return &m_smallknob6;
47 case PINGPONG:
48 return &m_smallknob7;
49 case RELEASE:
50 return &m_smallknob8;
51 case TIME:
52 return &m_smallknob9;
53 default:
54 return NULL;
55 }
56 }
57
58 Widget::Widget(Glib::ustring plugname):
59 plug_name(plugname)
60 {
61 // create controllers for port name, change controls order in UI
62 make_controller_box(&m_vbox2, "TIME", 1.0, 2000.0, 1.0, TIME);
63 make_controller_box(&m_vbox3, "FEEDBACK", 0.0, 1.0, 0.001, FEEDBACK);
64 make_controller_box(&m_vbox4, "PINGPONG", 0.0, 1.0, 0.001, PINGPONG);
65 make_controller_box(&m_vbox5, "COLORATION", -1.0, 1.0, 0.1, COLORATION);
66 make_controller_box(&m_vbox6, "ATTACK", 0.05, 0.5, 0.01, ATTACK);
67 make_controller_box(&m_vbox7, "RELEASE", 0.05, 2.0, 0.001, RELEASE);
68 make_controller_box(&m_vbox8, "AMOUNT", 0, 56.0, 0.1, AMOUNT);
69 make_controller_box(&m_vbox9, "EFFECT", -16.0, 4.0, 0.01, EFFECT);
70
71 // set propertys for the main paintbox holding the skin
72 m_paintbox.set_border_width(10);
73 m_paintbox.set_spacing(6);
74 m_paintbox.set_homogeneous(false);
75 m_paintbox.set_name(plug_name);
76 m_paintbox.property_paint_func() = "gxhead_expose";
77 add(m_paintbox);
78 // box for the controllers
79 m_hbox_.set_spacing(14);
80 m_hbox_.set_border_width(5);
81 m_hbox_.set_homogeneous(false);
82 // set a vertical box in the paintbox
83 m_vbox.set_border_width(2);
84 m_vbox1.set_border_width(2);
85 m_paintbox.pack_start(m_vbox_);
86 // and controller box on top
87 m_vbox_.pack_start(m_hbox_, Gtk::PACK_SHRINK);
88 // put boxed controllers into controller box
89 m_hbox_.pack_start(m_vbox,Gtk::PACK_EXPAND_PADDING);
90 m_hbox_.pack_start(m_vbox2);
91 m_hbox_.pack_start(m_vbox3);
92 m_hbox_.pack_start(m_vbox4);
93 m_hbox_.pack_start(m_vbox5);
94 m_hbox_.pack_start(m_vbox6);
95 m_hbox_.pack_start(m_vbox7);
96 m_hbox_.pack_start(m_vbox8);
97 m_hbox_.pack_start(m_vbox9);
98 m_hbox_.pack_start(m_vbox1,Gtk::PACK_EXPAND_PADDING);
99
100 // connect expose handler as resize handler
101 m_paintbox.signal_expose_event().connect(
102 sigc::mem_fun(this, &Widget::_expose_event), true);
103
104 set_app_paintable(true);
105 show_all();
106 }
107
108 Widget::~Widget()
109 {
110
111 }
112
113 // set borderwith for paintbox when widget resize
114 // to hold controllers in place
115 bool Widget::_expose_event(GdkEventExpose *event)
116 {
117 int x, y, width, height, depth;
118 m_paintbox.get_window()->get_geometry(x, y, width, height, depth);
119 //double_t height = m_paintbox.get_window()->get_height();
120 m_paintbox.set_border_width(height/20);
121 return false;
122 }
123
124 // create selectors from gxwmm
125 void Widget::make_selector(Glib::ustring labela,
126 Glib::ustring tables[],
127 size_t _size,
128 float min, float digits,
129 PortIndex port_name)
130 {
131 Gxw::Selector *regler = static_cast<Gxw::Selector*>
132 (get_controller_by_port(port_name));
133 if (regler)
134 {
135 float max = static_cast<float>(_size+1);
136
137 Gtk::TreeModelColumn<Glib::ustring> label;
138 Gtk::TreeModelColumnRecord rec;
139 rec.add(label);
140 Glib::RefPtr<Gtk::ListStore> ls = Gtk::ListStore::create(rec);
141
142 for (uint32_t i = 0 ; i< _size; ++i) {
143 ls->append()->set_value(0, tables[i]);
144 }
145 regler->set_model(ls);
146 regler->set_has_tooltip();
147 regler->set_tooltip_text(labela);
148 regler->cp_configure("SELECTOR", labela, min, max, digits);
149 regler->set_show_value(false);
150 regler->set_name(plug_name);
151 regler->signal_value_changed().connect(sigc::bind(sigc::mem_fun(
152 *this, &Widget::on_value_changed), port_name));
153 }
154 }
155
156 // create stackboxes with controllers for port name
157 void Widget::make_controller_box(Gtk::Box *box,
158 Glib::ustring label,
159 float min, float max,
160 float digits,
161 PortIndex port_name)
162 {
163 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
164 get_controller_by_port(port_name));
165 if (regler)
166 {
167 Gtk::Label* pr = new Gtk::Label(label, 0);
168 pr->set_name("amplabel");
169 // use label images instead simple string labes
170 /*Glib::ustring label_image = GX_LV2_STYLE_DIR;
171 label_image += "/";
172 label_image += label;
173 label_image += "-label.png";
174 Gtk::Image *pr = new Gtk::Image(label_image);*/
175
176 Gtk::VBox* b1 = new Gtk::VBox();
177 box->pack_start( *Gtk::manage(b1), Gtk::PACK_EXPAND_PADDING);
178 box->pack_start( *Gtk::manage(pr),Gtk::PACK_SHRINK);
179 regler->cp_configure("KNOB", label, min, max, digits);
180 regler->set_show_value(false);
181 regler->set_name(plug_name);
182 box->pack_start(*regler,Gtk::PACK_SHRINK);
183 Gtk::VBox* b2 = new Gtk::VBox();
184 box->pack_start( *Gtk::manage(b2), Gtk::PACK_EXPAND_PADDING);
185 regler->signal_value_changed().connect(sigc::bind(sigc::mem_fun(
186 *this, &Widget::on_value_changed), port_name));
187 }
188 }
189
190 // create stackboxes with switch controller for port name
191 void Widget::make_switch_box(Gtk::Box *box,
192 Glib::ustring label,
193 PortIndex port_name)
194 {
195 Gxw::Switch *regler = static_cast<Gxw::Switch*>(
196 get_controller_by_port(port_name));
197 if (regler)
198 {
199 Gtk::Label* pr = new Gtk::Label(label, 0);
200 pr->set_name("amplabel");
201 // use label images instead simple string labes
202 /*Glib::ustring label_image = GX_LV2_STYLE_DIR;
203 label_image += "/"+plug_name+"-";
204 label_image += label;
205 label_image += "-label.png";
206 Gtk::Image *pr = new Gtk::Image(label_image);*/
207
208 regler->cp_configure("switch", label, 0, 1, 1);
209 regler->set_name(plug_name);
210 regler->set_base_name( "button" );
211 Gtk::VBox* b1 = new Gtk::VBox();
212 box->pack_start( *Gtk::manage(b1), Gtk::PACK_EXPAND_PADDING);
213 box->pack_start( *Gtk::manage(pr),Gtk::PACK_SHRINK);
214 box->pack_start(*regler,Gtk::PACK_SHRINK);
215 Gtk::VBox* b2 = new Gtk::VBox();
216 box->pack_start( *Gtk::manage(b2), Gtk::PACK_EXPAND_PADDING);
217 regler->signal_toggled().connect(sigc::bind(sigc::mem_fun(
218 *this, &Widget::on_value_changed), port_name));
219 }
220 }
221
222 // receive controller value changes from host and set them to controller
223 void Widget::set_value(uint32_t port_index,
224 uint32_t format,
225 const void * buffer)
226 {
227 if ( format == 0 )
228 {
229 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
230 get_controller_by_port(port_index));
231 if (regler)
232 {
233 float value = *static_cast<const float*>(buffer);
234 regler->cp_set_value(value);
235 }
236 }
237 }
238
239 // write (UI) controller value changes to the host->engine
240 void Widget::on_value_changed(uint32_t port_index)
241 {
242 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
243 get_controller_by_port(port_index));
244 if (regler)
245 {
246 float value = regler->cp_get_value();
247 write_function(controller, port_index, sizeof(float), 0,
248 static_cast<const void*>(&value));
249 }
250 }
251
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_WIDGET_H_
22 #define SRC_HEADERS_WIDGET_H_
23
24 #include <gtkmm.h>
25 #include <gxwmm.h>
26 #include "gx_duck_delay_st.h"
27 #include "../config.h" // for GX_STYLE_DIR
28 // LV2UI stuff
29 #include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
30
31 class Widget : public Gtk::HBox
32 {
33 private:
34 Gtk::Widget* get_controller_by_port(uint32_t port_index);
35
36 void on_value_changed(uint32_t port_index);
37
38 void make_controller_box(Gtk::Box *box,
39 Glib::ustring label,
40 float min, float max,
41 float digits,
42 PortIndex port_name);
43
44 void make_selector(Glib::ustring label,
45 Glib::ustring tables[],
46 size_t _size,
47 float min, float digits,
48 PortIndex port_name);
49
50 void make_switch_box(Gtk::Box *box,
51 Glib::ustring label,
52 PortIndex port_name);
53
54 bool _expose_event(GdkEventExpose *event);
55
56 void set_value(uint32_t port_index,
57 uint32_t format,
58 const void * buffer);
59 public:
60
61 // public Lv2 communication stuff
62 LV2UI_Controller controller;
63 LV2UI_Write_Function write_function;
64 static void set_value_static(uint32_t port_index,
65 uint32_t buffer_size,
66 uint32_t format,
67 const void * buffer, Widget *self)
68 {
69 self->set_value(port_index,format,buffer);
70 }
71
72 Widget(Glib::ustring plugname);
73 ~Widget();
74
75 protected:
76 Glib::ustring plug_name;
77 Gtk::VBox m_vbox_;
78 Gtk::VBox m_vbox;
79 Gtk::VBox m_vbox1;
80 Gtk::VBox m_vbox2;
81 Gtk::VBox m_vbox3;
82 Gtk::VBox m_vbox4;
83 Gtk::VBox m_vbox5;
84 Gtk::VBox m_vbox6; //!!!Was here
85 Gtk::VBox m_vbox7;
86 Gtk::VBox m_vbox8;
87 Gtk::VBox m_vbox9;
88 Gtk::HBox m_hbox_;
89
90 Gxw::PaintBox m_paintbox;
91 Gxw::BigKnob m_bigknob;
92 Gxw::BigKnob m_smallknob3;
93 Gxw::BigKnob m_smallknob4;
94 Gxw::BigKnob m_smallknob5;
95 Gxw::BigKnob m_smallknob6; //!!!Was here
96 Gxw::BigKnob m_smallknob7;
97 Gxw::BigKnob m_smallknob8;
98 Gxw::BigKnob m_smallknob9;
99 };
100
101 #endif //SRC_HEADERS_WIDGET_H_
0 #!/usr/bin/env python
1 # encoding: utf-8
2
3 import sys, os, TaskGen, ctypes
4
5 def configure(conf):
6 pass
7
8 def build(bld):
9 bundle = 'gx_duck_delay_st.lv2'
10
11 src = ['gx_duck_delay_st.cpp'
12 ]
13 incl = ['../faust','./', '../DSP']
14 lib = []
15 if sys.platform.startswith("linux"):
16 lib.append('dl')
17 uselib = ['LV2CORE']
18 cxxflag =[]
19 if not bld.env['OPT'] and bld.env['SSE2']:
20 cxxflag = [ "-msse2", "-mfpmath=sse"]
21 lv2_effects = bld(
22 features='cxx cshlib ',
23 includes = incl,
24 lib = lib,
25 uselib = uselib,
26 obj_ext = '_5.o',
27 cxxflags = cxxflag,
28 defines = ["LV2_SO"],
29 target = 'gx_duck_delay_st',
30 source = src,
31 install_path = '${LV2DIR}/%s' % bundle,
32 chmod = 0o755,
33 )
34 lv2_effects.env['shlib_PATTERN'] = '%s.so'
35
36 uselib_local5 = []
37 libpath5 = []
38 lib5 = []
39 incl5 = ['../../../libgxwmm','../../../libgxw','../']
40 if sys.platform.startswith("linux"):
41 lib5.append('dl')
42 if bld.env["GX_LIB_SHARED"]:
43 lib5 += ['gxwmm','gxw']
44 libpath5 += [bld.path.find_dir("../../../libgxw/gxw").bldpath(bld.env),
45 bld.path.find_dir("../../../libgxwmm/gxwmm").bldpath(bld.env)]
46 else:
47 uselib_local5 += ['gxwmm','gxw']
48
49 lv2_effetcs_gui = bld(
50 features='cxx cshlib ',
51 includes = incl5,
52 lib = lib5,
53 uselib = 'LV2CORE GTKMM',
54 libpath = libpath5,
55 uselib_local = uselib_local5,
56 linkflags = '-Wl,-z,nodelete',
57 defines = ["LV2_GUI"],
58 target = 'gx_duck_delay_st_gui',
59 source = 'widget.cpp gx_duck_delay_st_gui.cpp',
60 install_path = '${LV2DIR}/%s' % bundle,
61 chmod = 0o755,
62 )
63 lv2_effetcs_gui.env['shlib_PATTERN'] = '%s.so'
64
65
66 install_path = '${LV2DIR}/%s' % bundle,
67 bld.install_files('${LV2DIR}/gx_duck_delay_st.lv2', 'manifest.ttl')
68 bld.install_files('${LV2DIR}/gx_duck_delay_st.lv2', 'gx_duck_delay_st.ttl')
69
70 bld.install_files('${LV2DIR}/gx_duck_delay_st.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
27 @prefix units: <http://lv2plug.in/ns/extensions/units#> .
28 @prefix time: <http://lv2plug.in/ns/ext/time/#>.
2629
2730 <http://guitarix.sourceforge.net#me>
2831 a foaf:Person ;
3740
3841 <http://guitarix.sourceforge.net/plugins/gx_echo_stereo#_echo_stereo>
3942 a lv2:Plugin ,
40 lv2:EffectPlugin ;
43 lv2:DelayPlugin ;
4144 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4245 doap:name "GxEcho-Stereo";
4346 doap:license <http://opensource.org/licenses/isc> ;
4649
4750 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_echo_stereo#gui>;
4851
52 lv2:minorVersion 28;
53 lv2:microVersion 3;
54
4955 lv2:port [
5056 a lv2:InputPort ,
5157 lv2:ControlPort ;
7783 lv2:default 100.0 ;
7884 lv2:minimum 1.0 ;
7985 lv2:maximum 2000.0 ;
86 lv2:designation time:beatsPerMinute;
87 units:unit units:ms ;
8088 ] , [
8189 a lv2:InputPort ,
8290 lv2:ControlPort ;
95103 lv2:default 100.0 ;
96104 lv2:minimum 1.0 ;
97105 lv2:maximum 2000.0 ;
106 lv2:designation time:beatsPerMinute;
107 units:unit units:ms ;
98108 ] , [
99109 a lv2:InputPort ,
100110 lv2:ControlPort ;
110120 lv2:index 6 ;
111121 lv2:symbol "link" ;
112122 lv2:name "Link (L+R)";
113 lv2:default 0. ;
114 lv2:minimum 0. ;
123 lv2:default 0 ;
124 lv2:minimum 0 ;
115125 lv2:maximum 1.0 ;
116126 ] , [
117127 a lv2:AudioPort ,
137147 lv2:index 10 ;
138148 lv2:symbol "in1" ;
139149 lv2:name "In1" ;
140 ].
150 ] ;
151 mod:gui [
152 a mod:Gui;
153 mod:resourcesDirectory <modgui>;
154 mod:iconTemplate <modgui/gx_echo.html>;
155 mod:templateData <modgui/gx_echo.json>;
156 mod:screenshot <modgui/gx_echo.png>;
157 mod:thumbnail <modgui/gx_echo-thumb.png>;
158 ] .
159
141160
142161 <http://guitarix.sourceforge.net/plugins/gx_echo_stereo#gui>
143162 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-japanese mod-seven-b-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group mod-{{knob}} clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <span class="mod-knob-title">{{name}}</span>
9 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "white",
3 "controls": [
4 {
5 "name": "Mode",
6 "symbol": "mode"
7 },
8 {
9 "name": "L Time",
10 "symbol": "timt_l"
11 },
12 {
13 "name": "R Time",
14 "symbol": "timt_r"
15 },
16 {
17 "name": "LFO",
18 "symbol": "lfo"
19 },
20 {
21 "name": "Link (L+R)",
22 "symbol": "link"
23 },
24 {
25 "name": "L Level",
26 "symbol": "level_l"
27 },
28 {
29 "name": "R Level",
30 "symbol": "level_r"
31 }
32 ],
33 "knob": "red",
34 "label": "Stereo Echo"
35 }
6767 bld.install_files('${LV2DIR}/gx_echo.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gx_echo.lv2', 'gx_echo.ttl')
6969
70 bld.install_files('${LV2DIR}/gx_echo.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
2627
2728 <http://guitarix.sourceforge.net#me>
2829 a foaf:Person ;
3738
3839 <http://guitarix.sourceforge.net/plugins/gx_expander#_expander>
3940 a lv2:Plugin ,
40 lv2:EffectPlugin ;
41 lv2:ExpanderPlugin ;
4142 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4243 doap:name "GxExpander";
4344 doap:license <http://opensource.org/licenses/isc> ;
4647
4748 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_expander#gui>;
4849
50 lv2:minorVersion 28;
51 lv2:microVersion 3;
52
4953 lv2:port [
5054 a lv2:InputPort ,
5155 lv2:ControlPort ;
103107 lv2:index 6 ;
104108 lv2:symbol "in" ;
105109 lv2:name "In" ;
106 ].
110 ] ;
111 mod:gui [
112 a mod:Gui;
113 mod:resourcesDirectory <modgui>;
114 mod:iconTemplate <modgui/gx_expander.html>;
115 mod:templateData <modgui/gx_expander.json>;
116 mod:screenshot <modgui/gx_expander.png>;
117 mod:thumbnail <modgui/gx_expander-thumb.png>;
118 ] .
119
107120
108121 <http://guitarix.sourceforge.net/plugins/gx_expander#gui>
109122 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-japanese mod-eight-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group mod-{{knob}} clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "red",
3 "controls": [
4 {
5 "name": "ATTACK",
6 "symbol": "ATTACK"
7 },
8 {
9 "name": "RELEASE",
10 "symbol": "RELEASE"
11 },
12 {
13 "name": "RATIO",
14 "symbol": "RATIO"
15 },
16 {
17 "name": "KNEE",
18 "symbol": "KNEE"
19 },
20 {
21 "name": "THRESHOLD",
22 "symbol": "THRESHOLD"
23 }
24 ],
25 "knob": "white",
26 "label": "Expander"
27 }
6767 bld.install_files('${LV2DIR}/gx_expander.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gx_expander.lv2', 'gx_expander.ttl')
6969
70 bld.install_files('${LV2DIR}/gx_expander.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
27 @prefix time: <http://lv2plug.in/ns/ext/time/#>.
28 @prefix units: <http://lv2plug.in/ns/extensions/units#> .
2629
2730 <http://guitarix.sourceforge.net#me>
2831 a foaf:Person ;
3740
3841 <http://guitarix.sourceforge.net/plugins/gx_flanger#_flanger>
3942 a lv2:Plugin ,
40 lv2:EffectPlugin ;
43 lv2:FlangerPlugin ;
4144 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4245 doap:name "GxFlanger";
4346 doap:license <http://opensource.org/licenses/isc> ;
4649
4750 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_flanger#gui>;
4851
52 lv2:minorVersion 28;
53 lv2:microVersion 3;
54
4955 lv2:port [
5056 a lv2:InputPort ,
5157 lv2:ControlPort ;
7379 lv2:default 0.2 ;
7480 lv2:minimum 0.05 ;
7581 lv2:maximum 10.0 ;
82 lv2:designation time:beatsPerMinute;
83 units:unit units:hz ;
7684 ] , [
7785 a lv2:InputPort ,
7886 lv2:ControlPort ;
112120 lv2:index 7 ;
113121 lv2:symbol "in" ;
114122 lv2:name "In" ;
115 ].
123 ] ;
124 mod:gui [
125 a mod:Gui;
126 mod:resourcesDirectory <modgui>;
127 mod:iconTemplate <modgui/gx_flanger.html>;
128 mod:templateData <modgui/gx_flanger.json>;
129 mod:screenshot <modgui/gx_flanger.png>;
130 mod:thumbnail <modgui/gx_flanger-thumb.png>;
131 ] .
132
116133
117134 <http://guitarix.sourceforge.net/plugins/gx_flanger#gui>
118135 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-japanese mod-eight-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group mod-{{knob}} clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "purple",
3 "controls": [
4 {
5 "name": "DEPTH",
6 "symbol": "depth"
7 },
8 {
9 "name": "WIDTH",
10 "symbol": "width"
11 },
12 {
13 "name": "FREQ",
14 "symbol": "freq"
15 },
16 {
17 "name": "FEEDBACK",
18 "symbol": "feedback"
19 },
20 {
21 "name": "MIX",
22 "symbol": "mix"
23 }
24 ],
25 "knob": "white",
26 "label": "Flanger"
27 }
6767 bld.install_files('${LV2DIR}/gx_flanger.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gx_flanger.lv2', 'gx_flanger.ttl')
6969
70 bld.install_files('${LV2DIR}/gx_flanger.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 //#include <zita-resampler/resampler.h>
20 //#include <cassert>
21 ////////////////////////////// LOCAL INCLUDES //////////////////////////
22 #include "gx_resampler.h"
23 #include "gx_common.h" // faust support and denormal protection (SSE)
24 #include "gx_fuzz.h" // define struct PortIndex
25 #include "gx_pluginlv2.h" // define struct PluginLV2
26 #include "bmfp.cc" // dsp class generated by faust -> dsp2cc
27 #include "lowpass_up.cc" // dsp class generated by faust -> dsp2cc
28 #include "lowpass_down.cc" // dsp class generated by faust -> dsp2cc
29 #ifndef __SSE__
30 #include "noiser.cc"
31 #endif
32
33 ////////////////////////////// PLUG-IN CLASS ///////////////////////////
34
35 class Gx_fuzz_
36 {
37 private:
38 // pointer to buffer
39 float* output;
40 float* input;
41 // pointer to dsp class
42 PluginLV2* fuzz;
43 PluginLV2* pass;
44 PluginLV2* passd;
45 #ifndef __SSE__
46 PluginLV2* wn;
47 #endif
48 // private functions
49 inline void run_dsp_(uint32_t n_samples);
50 inline void connect_(uint32_t port,void* data);
51 inline void init_dsp_(uint32_t rate);
52 inline void connect_all__ports(uint32_t port, void* data);
53 inline void activate_f();
54 inline void clean_up();
55 inline void deactivate_f();
56 gx_resample::SimpleResampler resamp;
57
58 public:
59 // LV2 Descriptor
60 static const LV2_Descriptor descriptor;
61 // static wrapper to private functions
62 static void deactivate(LV2_Handle instance);
63 static void cleanup(LV2_Handle instance);
64 static void run(LV2_Handle instance, uint32_t n_samples);
65 static void activate(LV2_Handle instance);
66 static void connect_port(LV2_Handle instance, uint32_t port, void* data);
67 static LV2_Handle instantiate(const LV2_Descriptor* descriptor,
68 double rate, const char* bundle_path,
69 const LV2_Feature* const* features);
70 Gx_fuzz_();
71 ~Gx_fuzz_();
72 };
73
74 // constructor
75 Gx_fuzz_::Gx_fuzz_() :
76 output(NULL),
77 input(NULL),
78 fuzz(bmfp::plugin()),
79 pass(lowpass_up::plugin()),
80 passd(lowpass_down::plugin()) {};
81
82 // destructor
83 Gx_fuzz_::~Gx_fuzz_()
84 {
85 // just to be sure the plug have given free the allocated mem
86 // it didn't hurd if the mem is already given free by clean_up()
87 if (fuzz->activate_plugin !=0)
88 fuzz->activate_plugin(false, fuzz);
89 // delete DSP class
90 fuzz->delete_instance(fuzz);
91 if (pass->activate_plugin !=0)
92 pass->activate_plugin(false, pass);
93 // delete DSP class
94 pass->delete_instance(pass);
95 if (passd->activate_plugin !=0)
96 passd->activate_plugin(false, passd);
97 // delete DSP class
98 passd->delete_instance(passd);
99 };
100
101 ///////////////////////// PRIVATE CLASS FUNCTIONS /////////////////////
102
103 void Gx_fuzz_::init_dsp_(uint32_t rate)
104 {
105 AVOIDDENORMALS(); // init the SSE denormal protection
106 resamp.setup(rate, 4);
107 fuzz->set_samplerate(4*rate, fuzz); // init the DSP class
108 pass->set_samplerate(rate, pass); // init the DSP class
109 passd->set_samplerate(rate, passd); // init the DSP class
110 #ifndef __SSE__
111 wn = noiser::plugin();
112 wn->set_samplerate(rate, wn);
113 #endif
114 }
115
116 // connect the Ports used by the plug-in class
117 void Gx_fuzz_::connect_(uint32_t port,void* data)
118 {
119 switch ((PortIndex)port)
120 {
121 case EFFECTS_OUTPUT:
122 output = static_cast<float*>(data);
123 break;
124 case EFFECTS_INPUT:
125 input = static_cast<float*>(data);
126 break;
127 default:
128 break;
129 }
130 }
131
132 void Gx_fuzz_::activate_f()
133 {
134 // allocate the internal DSP mem
135 if (fuzz->activate_plugin !=0)
136 fuzz->activate_plugin(true, fuzz);
137 if (pass->activate_plugin !=0)
138 pass->activate_plugin(true, pass);
139 if (passd->activate_plugin !=0)
140 passd->activate_plugin(true, passd);
141 }
142
143 void Gx_fuzz_::clean_up()
144 {
145 // delete the internal DSP mem
146 if (fuzz->activate_plugin !=0)
147 fuzz->activate_plugin(false, fuzz);
148 if (pass->activate_plugin !=0)
149 pass->activate_plugin(false, pass);
150 if (passd->activate_plugin !=0)
151 passd->activate_plugin(false, passd);
152 }
153
154 void Gx_fuzz_::deactivate_f()
155 {
156 // delete the internal DSP mem
157 if (fuzz->activate_plugin !=0)
158 fuzz->activate_plugin(false, fuzz);
159 if (pass->activate_plugin !=0)
160 pass->activate_plugin(false, pass);
161 if (passd->activate_plugin !=0)
162 passd->activate_plugin(false, passd);
163 }
164
165 void Gx_fuzz_::run_dsp_(uint32_t n_samples)
166 {
167 #ifndef __SSE__
168 wn->mono_audio(static_cast<int>(n_samples), input, input, wn);;
169 #endif
170 pass->mono_audio(n_samples, input, output, pass);
171 float buf[resamp.get_max_out_size(n_samples)];
172 int n = resamp.up(n_samples, output, buf);
173 fuzz->mono_audio(n, buf, buf, fuzz);
174 resamp.down(n_samples,buf, output);
175 passd->mono_audio(n_samples, output, output, passd);
176 }
177
178 void Gx_fuzz_::connect_all__ports(uint32_t port, void* data)
179 {
180 // connect the Ports used by the plug-in class
181 connect_(port,data);
182 // connect the Ports used by the DSP class
183 fuzz->connect_ports(port, data, fuzz);
184 passd->connect_ports(port, data, passd);
185 }
186
187 ////////////////////// STATIC CLASS FUNCTIONS ////////////////////////
188
189 LV2_Handle
190 Gx_fuzz_::instantiate(const LV2_Descriptor* descriptor,
191 double rate, const char* bundle_path,
192 const LV2_Feature* const* features)
193 {
194 // init the plug-in class
195 Gx_fuzz_ *self = new Gx_fuzz_();
196 if (!self)
197 {
198 return NULL;
199 }
200
201 self->init_dsp_((uint32_t)rate);
202
203 return (LV2_Handle)self;
204 }
205
206 void Gx_fuzz_::connect_port(LV2_Handle instance,
207 uint32_t port, void* data)
208 {
209 // connect all ports
210 static_cast<Gx_fuzz_*>(instance)->connect_all__ports(port, data);
211 }
212
213 void Gx_fuzz_::activate(LV2_Handle instance)
214 {
215 // allocate needed mem
216 static_cast<Gx_fuzz_*>(instance)->activate_f();
217 }
218
219 void Gx_fuzz_::run(LV2_Handle instance, uint32_t n_samples)
220 {
221 // run dsp
222 static_cast<Gx_fuzz_*>(instance)->run_dsp_(n_samples);
223 }
224
225 void Gx_fuzz_::deactivate(LV2_Handle instance)
226 {
227 // free allocated mem
228 static_cast<Gx_fuzz_*>(instance)->deactivate_f();
229 }
230
231 void Gx_fuzz_::cleanup(LV2_Handle instance)
232 {
233 // well, clean up after us
234 Gx_fuzz_* self = static_cast<Gx_fuzz_*>(instance);
235 self->clean_up();
236 delete self;
237 }
238
239 const LV2_Descriptor Gx_fuzz_::descriptor =
240 {
241 GXPLUGIN_URI "#fuzz_",
242 Gx_fuzz_::instantiate,
243 Gx_fuzz_::connect_port,
244 Gx_fuzz_::activate,
245 Gx_fuzz_::run,
246 Gx_fuzz_::deactivate,
247 Gx_fuzz_::cleanup,
248 NULL
249 };
250
251 ////////////////////////// LV2 SYMBOL EXPORT ///////////////////////////
252
253 extern "C"
254 LV2_SYMBOL_EXPORT
255 const LV2_Descriptor*
256 lv2_descriptor(uint32_t index)
257 {
258 switch (index)
259 {
260 case 0:
261 return &Gx_fuzz_::descriptor;
262 default:
263 return NULL;
264 }
265 }
266
267 ///////////////////////////// FIN //////////////////////////////////////
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_GXEFFECTS_H_
22 #define SRC_HEADERS_GXEFFECTS_H_
23
24 #include <lv2.h>
25
26 #define GXPLUGIN_URI "http://guitarix.sourceforge.net/plugins/gx_fuzz_"
27 #define GXPLUGIN_UI_URI "http://guitarix.sourceforge.net/plugins/gx_fuzz_#gui"
28
29
30 typedef enum
31 {
32 INPUT,
33 OUTPUT,
34 DRIVE,
35 TONE,
36 V1,
37 EFFECTS_OUTPUT,
38 EFFECTS_INPUT,
39 } PortIndex;
40
41 #endif //SRC_HEADERS_GXEFFECTS_H_
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19
20 @prefix doap: <http://usefulinc.com/ns/doap#> .
21 @prefix foaf: <http://xmlns.com/foaf/0.1/> .
22 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
23 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
24 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
25 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
27
28 <http://guitarix.sourceforge.net#me>
29 a foaf:Person ;
30 foaf:name "Guitarix team" ;
31 foaf:mbox <mailto:brummer@web.de> ;
32 rdfs:seeAlso <http://guitarix.sourceforge.net> .
33
34 <http://guitarix.sourceforge.net/plugins/gx_fuzz_>
35 a doap:Project ;
36 doap:maintainer <http://guitarix.sourceforge.net#me> ;
37 doap:name "Gx_fuzz_" .
38
39 <http://guitarix.sourceforge.net/plugins/gx_fuzz_#fuzz_>
40 a lv2:Plugin ,
41 lv2:DistortionPlugin ;
42 doap:maintainer <http://guitarix.sourceforge.net#me> ;
43 doap:name "GxFuzz";
44 doap:license <http://opensource.org/licenses/isc> ;
45 lv2:project <http://guitarix.sourceforge.net/plugins/gx_fuzz_> ;
46 lv2:optionalFeature lv2:hardRTCapable ;
47
48 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_fuzz_#gui>;
49
50 lv2:minorVersion 28;
51 lv2:microVersion 3;
52
53 lv2:port [
54 a lv2:InputPort ,
55 lv2:ControlPort ;
56 lv2:index 0 ;
57 lv2:symbol "INPUT" ;
58 lv2:name "INPUT";
59 lv2:default 0.0 ;
60 lv2:minimum -20.0 ;
61 lv2:maximum 1e+01 ;
62 ] , [
63 a lv2:InputPort ,
64 lv2:ControlPort ;
65 lv2:index 1 ;
66 lv2:symbol "OUTPUT" ;
67 lv2:name "OUTPUT";
68 lv2:default 1e+02 ;
69 lv2:minimum 5e+01 ;
70 lv2:maximum 1e+02 ;
71 ] , [
72 a lv2:InputPort ,
73 lv2:ControlPort ;
74 lv2:index 2 ;
75 lv2:symbol "DRIVE" ;
76 lv2:name "DRIVE";
77 lv2:default 1.0 ;
78 lv2:minimum -3.0 ;
79 lv2:maximum 100 ;
80 ] , [
81 a lv2:InputPort ,
82 lv2:ControlPort ;
83 lv2:index 3 ;
84 lv2:symbol "TONE" ;
85 lv2:name "TONE";
86 lv2:default 0.5 ;
87 lv2:minimum 0.0 ;
88 lv2:maximum 1.0 ;
89 ] , [
90 a lv2:ControlPort, lv2:OutputPort ;
91 lv2:index 4 ;
92 lv2:symbol "V1" ;
93 lv2:name "V1";
94 lv2:default 0.0 ;
95 lv2:minimum -70.0 ;
96 lv2:maximum 4.0 ;
97 ] , [
98 a lv2:AudioPort ,
99 lv2:OutputPort ;
100 lv2:index 5 ;
101 lv2:symbol "out" ;
102 lv2:name "Out"
103 ] , [
104 a lv2:AudioPort ,
105 lv2:InputPort ;
106 lv2:index 6 ;
107 lv2:symbol "in" ;
108 lv2:name "In" ;
109 ] ;
110 mod:gui [
111 a mod:Gui;
112 mod:resourcesDirectory <modgui>;
113 mod:iconTemplate <modgui/gx_fuzz.html>;
114 mod:templateData <modgui/gx_fuzz.json>;
115 mod:screenshot <modgui/gx_fuzz.png>;
116 mod:thumbnail <modgui/gx_fuzz-thumb.png>;
117 ] .
118
119
120 <http://guitarix.sourceforge.net/plugins/gx_fuzz_#gui>
121 a guiext:GtkUI;
122 guiext:binary <gx_fuzz_gui.so>;
123 guiext:requiredFeature guiext:makeResident .
124
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include <string>
21 #include <iostream>
22
23 #include <gtkmm.h>
24 #include "gx_fuzz.h"
25 #include "widget.h"
26
27
28 #include <lv2.h>
29 #include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
30
31 using namespace std;
32
33 class Gx_fuzz_stereoGUI
34 {
35 private:
36 Glib::ustring plugskin;
37 Glib::ustring addKnob;
38 Glib::ustring plug_name;
39 void set_knob(Glib::ustring knob);
40 void set_skin();
41 void set_plug_name(const char * plugin_uri);
42 GtkWidget* make_gui();
43 public:
44
45 Widget* widget;
46 static void set_plug_name_static(Gx_fuzz_stereoGUI *self, const char * plugin_uri)
47 {
48 self->set_plug_name(plugin_uri);
49 }
50 static GtkWidget* make_gui_static(Gx_fuzz_stereoGUI *self)
51 {
52 return self->make_gui();
53 }
54
55 Gx_fuzz_stereoGUI () {};
56 ~Gx_fuzz_stereoGUI () {};
57 } ;
58
59 void Gx_fuzz_stereoGUI::set_knob( Glib::ustring knob)
60 {
61 addKnob = " style 'gx_";
62 addKnob += plug_name;
63 addKnob += "_dark_skin_icons'\n"
64 " { \n"
65 " stock['bigknob'] = {{'";
66 addKnob += knob;
67 addKnob += ".png'}}\n"
68 " stock['smallknob'] = {{'";
69 addKnob += knob;
70 addKnob += "-small.png'}}\n"
71 " stock['smallknobr'] = {{'";
72 addKnob += knob;
73 addKnob += "-middle.png'}}\n"
74 " stock['button_on'] = {{'"
75 "echo-switch_on.png'}}\n"
76 " stock['button_off'] = {{'"
77 "echo-switch_off.png'}}\n"
78 " }\n"
79 "widget '*.";
80 addKnob += plug_name;
81 addKnob += "' style 'gx_";
82 addKnob += plug_name;
83 addKnob += "_dark_skin_icons' \n"
84 "class '*GxToggleImage' style'gx_";
85 addKnob += plug_name;
86 addKnob += "_dark_skin_icons' \n";
87 }
88
89 void Gx_fuzz_stereoGUI::set_skin()
90 {
91 Glib::ustring toparse = "pixmap_path ";
92 toparse += " '";
93 toparse += GX_LV2_STYLE_DIR;
94 toparse += "/'\n";
95 toparse += "style \"gx_";
96 toparse += plug_name;
97 toparse += "_dark-paintbox\"\n"
98 " { \n"
99 "GxPaintBox::skin-gradient = {\n"
100 "{ 65536, 0, 0, 13107, 52428 }, \n"
101 "{ 52428, 0, 0, 0, 52428 },\n"
102 "{ 13107, 0, 0, 13107, 13107 }}\n"
103 " GxPaintBox::box-gradient = {\n"
104 "{ 0, 61, 61, 61, 62428 }, \n"
105 "{ 22768, 80, 83, 80, 42428 }, \n"
106 "{ 52428, 8, 8, 80, 32428 }, \n"
107 "{ 65536, 4, 4, 4, 52428 }} \n"
108 " GxPaintBox::icon-set =11\n"
109 " }\n"
110 "\n"
111 "style 'gx_head_expander_box' \n"
112 " { \n"
113 " fg[NORMAL] = '#c0c6d0' \n"
114 "font_name = 'sans 7.5 bold' \n"
115 " }\n";
116 toparse += addKnob;
117
118 toparse += " widget '*.amplabel' style:highest 'gx_head_expander_box'\n"
119 "widget '*.";
120 toparse += plug_name;
121 toparse += "' style 'gx_";
122 toparse += plug_name;
123 toparse += "_dark-paintbox' ";
124 toparse += " style 'gx_selector_";
125 toparse += plug_name;
126 toparse += "'\n"
127 " {\n"
128 " fg[NORMAL] = '#c0c6d0'\n"
129 " GtkRange::trough-border = 2\n"
130 " GtkRange::stepper-size = 8\n"
131 " GtkRange::stepper-spacing = 2\n"
132 " GxRegler::value-border = { 2, 0, 0, 0 }\n"
133 " font_name = 'sans 7.5'\n"
134 " xthickness = 10\n"
135 " ythickness = 1\n"
136 " }\n"
137 "widget '*.";
138 toparse += plug_name;
139 toparse += "' style:highest 'gx_selector_";
140 toparse += plug_name;
141 toparse += "'\n";
142 toparse += "style 'gx_switch'\n"
143 "{\n"
144 "xthickness = 0\n"
145 "ythickness = 0\n"
146 "GtkButton::inner-border = {0, 0, 0, 0}\n"
147 "GtkButton::default-border = {0, 0, 0, 0}\n"
148 "GtkButton::focus-line-width = 0\n"
149 "GtkButton::focus-padding = 0\n"
150 "GtkButton::interior-focus = 0\n"
151 "GtkButton::child-displacement-x = 0\n"
152 "GtkButton::child-displacement-y = 0\n"
153 " }\n"
154 "widget '*.";
155 toparse += plug_name;
156 toparse += "' style:highest 'gx_switch'";
157 toparse += "style 'gx_fastmeter'\n"
158 " {\n"
159 " GxFastMeter::clr-bottom = '#003808'\n"
160 " GxFastMeter::clr-middle = '#00ff00'\n"
161 " GxFastMeter::clr-top = '#ff0000'\n"
162 " GxFastMeter::over = '#ff0000'\n"
163 " }\n"
164 " class '*GxFastMeter' style:highest 'gx_fastmeter'\n";
165
166 gtk_rc_parse_string (toparse.c_str());
167 }
168
169 void Gx_fuzz_stereoGUI::set_plug_name( const char * plugin_uri)
170 {
171 addKnob = "";
172
173 if (strcmp("http://guitarix.sourceforge.net/plugins/gx_fuzz_#fuzz_", plugin_uri) == 0)
174 {
175 plug_name = "GxFuzz";
176 set_knob("nk-knob");
177 }
178 else
179 {
180 plug_name = "_fuzz_stereo";
181 }
182 }
183
184 GtkWidget* Gx_fuzz_stereoGUI::make_gui()
185 {
186 // init the gxwmm library
187 Gxw::init();
188 set_skin();
189 GtkWidget* container = gtk_vbox_new(FALSE, 2);
190 widget = new Widget(plug_name);
191 GtkWidget* cWidget = GTK_WIDGET(widget->gobj());
192 gtk_container_add(GTK_CONTAINER(container), cWidget );
193
194 return container;
195 }
196
197
198 static LV2UI_Handle instantiate(const struct _LV2UI_Descriptor * descriptor,
199 const char * plugin_uri,
200 const char * bundle_path,
201 LV2UI_Write_Function write_function,
202 LV2UI_Controller controller,
203 LV2UI_Widget * widget,
204 const LV2_Feature * const * features)
205 {
206 Gx_fuzz_stereoGUI* self = new Gx_fuzz_stereoGUI();
207 if (self == NULL) return NULL;
208 self->set_plug_name_static(self, plugin_uri);
209 *widget = (LV2UI_Widget)self->make_gui_static(self);
210 self->widget->controller = controller;
211 self->widget->write_function = write_function;
212 return (LV2UI_Handle)self;
213 }
214
215 static void cleanup(LV2UI_Handle ui)
216 {
217 Gx_fuzz_stereoGUI *pluginGui = static_cast<Gx_fuzz_stereoGUI*>(ui);
218 delete pluginGui->widget;
219 delete pluginGui;
220 }
221
222 static void port_event(LV2UI_Handle ui,
223 uint32_t port_index,
224 uint32_t buffer_size,
225 uint32_t format,
226 const void * buffer)
227 {
228 Gx_fuzz_stereoGUI *self = static_cast<Gx_fuzz_stereoGUI*>(ui);
229 self->widget->set_value_static( port_index, buffer_size, format, buffer, self->widget);
230 return;
231 }
232
233 static LV2UI_Descriptor descriptors[] =
234 {
235 {GXPLUGIN_UI_URI, instantiate, cleanup, port_event, NULL}
236 };
237
238 const LV2UI_Descriptor * lv2ui_descriptor(uint32_t index)
239 {
240 //printf("lv2ui_descriptor(%u) called\n", (uint32_t)index);
241 if (index >= sizeof(descriptors) / sizeof(descriptors[0]))
242 {
243 return NULL;
244 }
245 return descriptors + index;
246 }
247
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_fuzz_#fuzz_>
23 a lv2:Plugin ;
24 lv2:binary <gx_fuzz.so> ;
25 rdfs:seeAlso <gx_fuzz.ttl> .
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_fuzz_#fuzz_>
23 a lv2:Plugin ;
24 lv2:binary <gx_fuzz@LIB_EXT@> ;
25 rdfs:seeAlso <gx_fuzz.ttl> .
0 <div class="mod-pedal mod-pedal-japanese mod-four-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group mod-{{knob}} clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "orange",
3 "controls": [
4 {
5 "name": "INPUT",
6 "symbol": "INPUT"
7 },
8 {
9 "name": "DRIVE",
10 "symbol": "DRIVE"
11 },
12 {
13 "name": "TONE",
14 "symbol": "TONE"
15 },
16 {
17 "name": "OUTPUT",
18 "symbol": "OUTPUT"
19 }
20 ],
21 "knob": "white",
22 "label": "Fuzz"
23 }
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include "widget.h"
21
22 #include <iostream>
23
24
25 /* @get controller by port
26 * this function is used by make_selector() make_controller_box()
27 * set_value() and on_value_changed()
28 * so controller widgets needs only here asined to a port,
29 * and all functions which need acess to the controller widget pointer
30 * can receive them by port number
31 */
32 /*
33 typedef enum
34 {
35 INPUT,
36 OUTPUT,
37 DRIVE,
38 TONE,
39 } PortIndex;
40 */
41
42 Gtk::Widget* Widget::get_controller_by_port(uint32_t port_index)
43 {
44 switch ((PortIndex)port_index )
45 {
46 case INPUT:
47 return &m_bigknob[0];
48 case OUTPUT:
49 return &m_bigknob[1];
50 case DRIVE:
51 return &m_bigknob[2];
52 case TONE:
53 return &m_bigknob[3];
54 default:
55 return NULL;
56 }
57 }
58
59 Widget::Widget(Glib::ustring plugname):
60 plug_name(plugname)
61 {
62 // create controllers for port name
63 make_controller_box(&m_vbox2, "INPUT", -24.0, 1e+01, 0.1, INPUT);
64 make_controller_box(&m_vbox3, "DRIVE", -3.0, 100.0, 1.0, DRIVE);
65 make_controller_box(&m_vbox4, "TONE", 0.0, 1.0, 0.01, TONE);
66 make_controller_box(&m_vbox5, "OUTPUT",5e+01, 1e+02, 1.0 , OUTPUT);
67
68 fastmeter.set_hold_count(12);
69 fastmeter.set_property("dimen",5);
70 fastmeter.set_tooltip_text("Output");
71 m_paintbox[1].property_paint_func() = "RackBox_expose";
72 m_paintbox[1].set_name(plug_name);
73 m_paintbox[1].set_border_width(5);
74 m_paintbox[1].set_spacing(2);
75 m_paintbox[1].pack_start(fastmeter);
76
77 // set propertys for the main paintbox holding the skin
78 m_paintbox[0].set_border_width(10);
79 m_paintbox[0].set_spacing(6);
80 m_paintbox[0].set_homogeneous(false);
81 m_paintbox[0].set_name(plug_name);
82 m_paintbox[0].property_paint_func() = "compressor_expose";
83 add(m_paintbox[0]);
84 // box for the controllers
85 m_hbox_.set_spacing(14);
86 m_hbox_.set_border_width(24);
87 m_hbox_.set_homogeneous(false);
88 // set a vertical box in the paintbox
89 m_vbox.set_border_width(14);
90 m_vbox1.set_border_width(14);
91 m_paintbox[0].pack_start(m_vbox_);
92 // and controller box on top
93 m_vbox_.pack_start(m_hbox_, Gtk::PACK_SHRINK);
94 // put boxed controllers into controller box
95 m_hbox_.pack_start(m_vbox1, Gtk::PACK_EXPAND_PADDING);
96 m_hbox_.pack_start(m_vbox2);
97 m_hbox_.pack_start(m_vbox3);
98 m_hbox_.pack_start(m_vbox4);
99 m_hbox_.pack_start(m_vbox5);
100 m_hbox_.pack_start(m_paintbox[1],Gtk::PACK_SHRINK);
101 m_hbox_.pack_start(m_vbox, Gtk::PACK_EXPAND_PADDING);
102
103 // connect expose handler as resize handler
104 // m_paintbox[0].signal_expose_event().connect(
105 // sigc::mem_fun(this, &Widget::_expose_event), true);
106
107 set_app_paintable(true);
108 show_all();
109 }
110
111 Widget::~Widget()
112 {
113
114 }
115
116 // set borderwith for paintbox when widget resize
117 // to hold controllers in place
118 bool Widget::_expose_event(GdkEventExpose *event)
119 {
120 int x, y, width, height, depth;
121 m_paintbox[0].get_window()->get_geometry(x, y, width, height, depth);
122 //double_t height = m_paintbox.get_window()->get_height();
123 m_paintbox[0].set_border_width(height/10);
124 return false;
125 }
126
127 // create selectors from gxwmm
128 void Widget::make_selector(Glib::ustring labela,
129 Glib::ustring tables[],
130 size_t _size,
131 float min, float digits,
132 PortIndex port_name)
133 {
134 Gxw::Selector *regler = static_cast<Gxw::Selector*>
135 (get_controller_by_port(port_name));
136 if (regler)
137 {
138 float max = static_cast<float>(_size+1);
139
140 Gtk::TreeModelColumn<Glib::ustring> label;
141 Gtk::TreeModelColumnRecord rec;
142 rec.add(label);
143 Glib::RefPtr<Gtk::ListStore> ls = Gtk::ListStore::create(rec);
144
145 for (uint32_t i = 0 ; i< _size; ++i) {
146 ls->append()->set_value(0, tables[i]);
147 }
148 regler->set_model(ls);
149 regler->set_has_tooltip();
150 regler->set_tooltip_text(labela);
151 regler->cp_configure("SELECTOR", labela, min, max, digits);
152 regler->set_show_value(false);
153 regler->set_name(plug_name);
154 regler->signal_value_changed().connect(sigc::bind(sigc::mem_fun(
155 *this, &Widget::on_value_changed), port_name));
156 }
157 }
158
159 // create stackboxes with controllers for port name
160 void Widget::make_controller_box(Gtk::Box *box,
161 Glib::ustring label,
162 float min, float max,
163 float digits,
164 PortIndex port_name)
165 {
166 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
167 get_controller_by_port(port_name));
168 if (regler)
169 {
170 Gtk::Label* pr = new Gtk::Label(label, 0);
171 pr->set_name("amplabel");
172 // use label images instead simple string labes
173 /*Glib::ustring label_image = GX_LV2_STYLE_DIR;
174 label_image += "/";
175 label_image += label;
176 label_image += "-label.png";
177 Gtk::Image *pr = new Gtk::Image(label_image);*/
178
179 Gtk::VBox* b1 = new Gtk::VBox();
180 box->pack_start( *Gtk::manage(b1), Gtk::PACK_EXPAND_PADDING);
181 box->pack_start( *Gtk::manage(pr),Gtk::PACK_SHRINK);
182 regler->cp_configure("KNOB", label, min, max, digits);
183 regler->set_show_value(false);
184 regler->set_name(plug_name);
185 box->pack_start(*regler,Gtk::PACK_SHRINK);
186 Gtk::VBox* b2 = new Gtk::VBox();
187 box->pack_start( *Gtk::manage(b2), Gtk::PACK_EXPAND_PADDING);
188 regler->signal_value_changed().connect(sigc::bind(sigc::mem_fun(
189 *this, &Widget::on_value_changed), port_name));
190 }
191 }
192
193 // create stackboxes with switch controller for port name
194 void Widget::make_switch_box(Gtk::Box *box,
195 Glib::ustring label,
196 PortIndex port_name)
197 {
198 Gxw::Switch *regler = static_cast<Gxw::Switch*>(
199 get_controller_by_port(port_name));
200 if (regler)
201 {
202 Gtk::Label* pr = new Gtk::Label(label, 0);
203 pr->set_name("amplabel");
204 // use label images instead simple string labes
205 /*Glib::ustring label_image = GX_LV2_STYLE_DIR;
206 label_image += "/"+plug_name+"-";
207 label_image += label;
208 label_image += "-label.png";
209 Gtk::Image *pr = new Gtk::Image(label_image);*/
210
211 regler->cp_configure("switch", label, 0, 1, 1);
212 regler->set_name(plug_name);
213 regler->set_base_name( "button" );
214 Gtk::VBox* b1 = new Gtk::VBox();
215 box->pack_start( *Gtk::manage(b1), Gtk::PACK_EXPAND_PADDING);
216 box->pack_start( *Gtk::manage(pr),Gtk::PACK_SHRINK);
217 box->pack_start(*regler,Gtk::PACK_SHRINK);
218 Gtk::VBox* b2 = new Gtk::VBox();
219 box->pack_start( *Gtk::manage(b2), Gtk::PACK_EXPAND_PADDING);
220 regler->signal_toggled().connect(sigc::bind(sigc::mem_fun(
221 *this, &Widget::on_value_changed), port_name));
222 }
223 }
224
225 // receive controller value changes from host and set them to controller
226 void Widget::set_value(uint32_t port_index,
227 uint32_t format,
228 const void * buffer)
229 {
230 if ( format == 0 )
231 {
232 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
233 get_controller_by_port(port_index));
234 float value = *static_cast<const float*>(buffer);
235 if (regler)
236 {
237 regler->cp_set_value(value);
238 }
239 else if (port_index == V1) {
240 fastmeter.set_by_power(value);
241 }
242 }
243 }
244
245 // write (UI) controller value changes to the host->engine
246 void Widget::on_value_changed(uint32_t port_index)
247 {
248 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
249 get_controller_by_port(port_index));
250 if (regler)
251 {
252 float value = regler->cp_get_value();
253 write_function(controller, port_index, sizeof(float), 0,
254 static_cast<const void*>(&value));
255 }
256 }
257
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_WIDGET_H_
22 #define SRC_HEADERS_WIDGET_H_
23
24 #include <gtkmm.h>
25 #include <gxwmm.h>
26 #include "gx_fuzz.h"
27 #include "../config.h" // for GX_STYLE_DIR
28 // LV2UI stuff
29 #include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
30
31 class Widget : public Gtk::HBox
32 {
33 private:
34 Gtk::Widget* get_controller_by_port(uint32_t port_index);
35
36 void on_value_changed(uint32_t port_index);
37
38
39 void make_controller_box(Gtk::Box *box,
40 Glib::ustring label,
41 float min, float max,
42 float digits,
43 PortIndex port_name);
44
45 void make_selector(Glib::ustring label,
46 Glib::ustring tables[],
47 size_t _size,
48 float min, float digits,
49 PortIndex port_name);
50
51 void make_switch_box(Gtk::Box *box,
52 Glib::ustring label,
53 PortIndex port_name);
54
55 bool _expose_event(GdkEventExpose *event);
56
57 void set_value(uint32_t port_index,
58 uint32_t format,
59 const void * buffer);
60 public:
61
62 // public Lv2 communication stuff
63 LV2UI_Controller controller;
64 LV2UI_Write_Function write_function;
65 static void set_value_static(uint32_t port_index,
66 uint32_t buffer_size,
67 uint32_t format,
68 const void * buffer, Widget *self)
69 {
70 self->set_value(port_index,format,buffer);
71 }
72
73 Widget(Glib::ustring plugname);
74 ~Widget();
75
76 protected:
77 Glib::ustring plug_name;
78 Gtk::VBox m_vbox_;
79 Gtk::VBox m_vbox;
80 Gtk::VBox m_vbox1;
81 Gtk::VBox m_vbox2;
82 Gtk::VBox m_vbox3;
83 Gtk::VBox m_vbox4;
84 Gtk::VBox m_vbox5;
85 Gtk::HBox m_hbox_;
86
87 Gxw::PaintBox m_paintbox[2];
88 Gxw::BigKnob m_bigknob[4];
89 Gxw::FastMeter fastmeter;
90 };
91
92 #endif //SRC_HEADERS_WIDGET_H_
0 #!/usr/bin/env python
1 # encoding: utf-8
2
3 import sys, os, TaskGen, ctypes, wscript_helper
4
5 def configure(conf):
6 pass
7
8 def build(bld):
9 bundle = 'gx_fuzz.lv2'
10
11 src = ['gx_fuzz.cpp',
12 '../DSP/gx_resampler.cc',
13 ]
14 incl = ['../faust','./', '../DSP']
15 lib = []
16 if sys.platform.startswith("linux"):
17 lib.append('dl')
18 uselib = ['LV2CORE']
19 wscript_helper.add_zita_resampler(bld, uselib, src, incl, base="../..")
20 cxxflag =[]
21 if not bld.env['OPT'] and bld.env['SSE2']:
22 cxxflag = [ "-msse2", "-mfpmath=sse"]
23 lv2_effects = bld(
24 features='cxx cshlib ',
25 includes = incl,
26 lib = lib,
27 uselib = uselib,
28 obj_ext = '_14.o',
29 cxxflags = cxxflag,
30 defines = ["LV2_SO"],
31 target = 'gx_fuzz',
32 source = src,
33 install_path = '${LV2DIR}/%s' % bundle,
34 chmod = 0o755,
35 )
36 lv2_effects.env['shlib_PATTERN'] = '%s.so'
37
38 uselib_local5 = []
39 libpath5 = []
40 lib5 = []
41 incl5 = ['../../../libgxwmm','../../../libgxw','../']
42 if sys.platform.startswith("linux"):
43 lib5.append('dl')
44 if bld.env["GX_LIB_SHARED"]:
45 lib5 += ['gxwmm','gxw']
46 libpath5 += [bld.path.find_dir("../../../libgxw/gxw").bldpath(bld.env),
47 bld.path.find_dir("../../../libgxwmm/gxwmm").bldpath(bld.env)]
48 else:
49 uselib_local5 += ['gxwmm','gxw']
50
51 lv2_effetcs_gui = bld(
52 features='cxx cshlib ',
53 includes = incl5,
54 lib = lib5,
55 uselib = 'LV2CORE GTKMM',
56 libpath = libpath5,
57 uselib_local = uselib_local5,
58 linkflags = '-Wl,-z,nodelete',
59 defines = ["LV2_GUI"],
60 target = 'gx_fuzz_gui',
61 source = 'widget.cpp gx_fuzz_gui.cpp',
62 install_path = '${LV2DIR}/%s' % bundle,
63 chmod = 0o755,
64 )
65 lv2_effetcs_gui.env['shlib_PATTERN'] = '%s.so'
66
67
68 install_path = '${LV2DIR}/%s' % bundle,
69 bld.install_files('${LV2DIR}/gx_fuzz.lv2', 'manifest.ttl')
70 bld.install_files('${LV2DIR}/gx_fuzz.lv2', 'gx_fuzz.ttl')
71
72 bld.install_files('${LV2DIR}/gx_fuzz.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 ////////////////////////////// LOCAL INCLUDES //////////////////////////
21
22 #include "gx_common.h" // faust support and denormal protection (SSE)
23 #include "gx_graphiceq.h" // define struct PortIndex
24 #include "gx_pluginlv2.h" // define struct PluginLV2
25 #include "graphiceq.cc" // dsp class generated by faust -> dsp2cc
26
27 ////////////////////////////// PLUG-IN CLASS ///////////////////////////
28
29 class Gx_graphiceq_
30 {
31 private:
32 // pointer to buffer
33 float* output;
34 float* input;
35 // pointer to dsp class
36 PluginLV2* graphiceq;
37 // private functions
38 inline void run_dsp_(uint32_t n_samples);
39 inline void connect_(uint32_t port,void* data);
40 inline void init_dsp_(uint32_t rate);
41 inline void connect_all__ports(uint32_t port, void* data);
42 inline void activate_f();
43 inline void clean_up();
44 inline void deactivate_f();
45
46 public:
47 // LV2 Descriptor
48 static const LV2_Descriptor descriptor;
49 // static wrapper to private functions
50 static void deactivate(LV2_Handle instance);
51 static void cleanup(LV2_Handle instance);
52 static void run(LV2_Handle instance, uint32_t n_samples);
53 static void activate(LV2_Handle instance);
54 static void connect_port(LV2_Handle instance, uint32_t port, void* data);
55 static LV2_Handle instantiate(const LV2_Descriptor* descriptor,
56 double rate, const char* bundle_path,
57 const LV2_Feature* const* features);
58 Gx_graphiceq_();
59 ~Gx_graphiceq_();
60 };
61
62 // constructor
63 Gx_graphiceq_::Gx_graphiceq_() :
64 output(NULL),
65 input(NULL),
66 graphiceq(graphiceq::plugin()) {};
67
68 // destructor
69 Gx_graphiceq_::~Gx_graphiceq_()
70 {
71 // just to be sure the plug have given free the allocated mem
72 // it didn't hurd if the mem is already given free by clean_up()
73 if (graphiceq->activate_plugin !=0)
74 graphiceq->activate_plugin(false, graphiceq);
75 // delete DSP class
76 graphiceq->delete_instance(graphiceq);
77 };
78
79 ///////////////////////// PRIVATE CLASS FUNCTIONS /////////////////////
80
81 void Gx_graphiceq_::init_dsp_(uint32_t rate)
82 {
83 AVOIDDENORMALS(); // init the SSE denormal protection
84 graphiceq->set_samplerate(rate, graphiceq); // init the DSP class
85 }
86
87 // connect the Ports used by the plug-in class
88 void Gx_graphiceq_::connect_(uint32_t port,void* data)
89 {
90 switch ((PortIndex)port)
91 {
92 case EFFECTS_OUTPUT:
93 output = static_cast<float*>(data);
94 break;
95 case EFFECTS_INPUT:
96 input = static_cast<float*>(data);
97 break;
98 default:
99 break;
100 }
101 }
102
103 void Gx_graphiceq_::activate_f()
104 {
105 // allocate the internal DSP mem
106 if (graphiceq->activate_plugin !=0)
107 graphiceq->activate_plugin(true, graphiceq);
108 }
109
110 void Gx_graphiceq_::clean_up()
111 {
112 // delete the internal DSP mem
113 if (graphiceq->activate_plugin !=0)
114 graphiceq->activate_plugin(false, graphiceq);
115 }
116
117 void Gx_graphiceq_::deactivate_f()
118 {
119 // delete the internal DSP mem
120 if (graphiceq->activate_plugin !=0)
121 graphiceq->activate_plugin(false, graphiceq);
122 }
123
124 void Gx_graphiceq_::run_dsp_(uint32_t n_samples)
125 {
126 graphiceq->mono_audio(static_cast<int>(n_samples), input, output, graphiceq);
127 }
128
129 void Gx_graphiceq_::connect_all__ports(uint32_t port, void* data)
130 {
131 // connect the Ports used by the plug-in class
132 connect_(port,data);
133 // connect the Ports used by the DSP class
134 graphiceq->connect_ports(port, data, graphiceq);
135 }
136
137 ////////////////////// STATIC CLASS FUNCTIONS ////////////////////////
138
139 LV2_Handle
140 Gx_graphiceq_::instantiate(const LV2_Descriptor* descriptor,
141 double rate, const char* bundle_path,
142 const LV2_Feature* const* features)
143 {
144 // init the plug-in class
145 Gx_graphiceq_ *self = new Gx_graphiceq_();
146 if (!self)
147 {
148 return NULL;
149 }
150
151 self->init_dsp_((uint32_t)rate);
152
153 return (LV2_Handle)self;
154 }
155
156 void Gx_graphiceq_::connect_port(LV2_Handle instance,
157 uint32_t port, void* data)
158 {
159 // connect all ports
160 static_cast<Gx_graphiceq_*>(instance)->connect_all__ports(port, data);
161 }
162
163 void Gx_graphiceq_::activate(LV2_Handle instance)
164 {
165 // allocate needed mem
166 static_cast<Gx_graphiceq_*>(instance)->activate_f();
167 }
168
169 void Gx_graphiceq_::run(LV2_Handle instance, uint32_t n_samples)
170 {
171 // run dsp
172 static_cast<Gx_graphiceq_*>(instance)->run_dsp_(n_samples);
173 }
174
175 void Gx_graphiceq_::deactivate(LV2_Handle instance)
176 {
177 // free allocated mem
178 static_cast<Gx_graphiceq_*>(instance)->deactivate_f();
179 }
180
181 void Gx_graphiceq_::cleanup(LV2_Handle instance)
182 {
183 // well, clean up after us
184 Gx_graphiceq_* self = static_cast<Gx_graphiceq_*>(instance);
185 self->clean_up();
186 delete self;
187 }
188
189 const LV2_Descriptor Gx_graphiceq_::descriptor =
190 {
191 GXPLUGIN_URI "#_graphiceq_",
192 Gx_graphiceq_::instantiate,
193 Gx_graphiceq_::connect_port,
194 Gx_graphiceq_::activate,
195 Gx_graphiceq_::run,
196 Gx_graphiceq_::deactivate,
197 Gx_graphiceq_::cleanup,
198 NULL
199 };
200
201 ////////////////////////// LV2 SYMBOL EXPORT ///////////////////////////
202
203 extern "C"
204 LV2_SYMBOL_EXPORT
205 const LV2_Descriptor*
206 lv2_descriptor(uint32_t index)
207 {
208 switch (index)
209 {
210 case 0:
211 return &Gx_graphiceq_::descriptor;
212 default:
213 return NULL;
214 }
215 }
216
217 ///////////////////////////// FIN //////////////////////////////////////
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_GXEFFECTS_H_
22 #define SRC_HEADERS_GXEFFECTS_H_
23
24 #include <lv2.h>
25
26 #define GXPLUGIN_URI "http://guitarix.sourceforge.net/plugins/gx_graphiceq_"
27 #define GXPLUGIN_UI_URI "http://guitarix.sourceforge.net/plugins/gx_graphiceq_#gui"
28
29
30 typedef enum
31 {
32 G10,
33 G11,
34 G1,
35 G2,
36 G3,
37 G4,
38 G5,
39 G6,
40 G7,
41 G8,
42 G9,
43 V10,
44 V11,
45 V1,
46 V2,
47 V3,
48 V4,
49 V5,
50 V6,
51 V7,
52 V8,
53 V9,
54 EFFECTS_OUTPUT,
55 EFFECTS_INPUT,
56 } PortIndex;
57
58 #endif //SRC_HEADERS_GXEFFECTS_H_
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19
20 @prefix doap: <http://usefulinc.com/ns/doap#> .
21 @prefix foaf: <http://xmlns.com/foaf/0.1/> .
22 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
23 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
24 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
25 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26
27 <http://guitarix.sourceforge.net#me>
28 a foaf:Person ;
29 foaf:name "Guitarix team" ;
30 foaf:mbox <mailto:brummer@web.de> ;
31 rdfs:seeAlso <http://guitarix.sourceforge.net> .
32
33 <http://guitarix.sourceforge.net/plugins/gx_graphiceq_>
34 a doap:Project ;
35 doap:maintainer <http://guitarix.sourceforge.net#me> ;
36 doap:name "Gx_graphiceq_" .
37
38 <http://guitarix.sourceforge.net/plugins/gx_graphiceq_#_graphiceq_>
39 a lv2:Plugin ,
40 lv2:EQPlugin ;
41 doap:maintainer <http://guitarix.sourceforge.net#me> ;
42 doap:name "GxGraphicEQ";
43 doap:license <http://opensource.org/licenses/isc> ;
44 lv2:project <http://guitarix.sourceforge.net/plugins/gx_graphiceq_> ;
45 lv2:optionalFeature lv2:hardRTCapable ;
46
47 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_graphiceq_#gui>;
48
49 lv2:minorVersion 28;
50 lv2:microVersion 3;
51
52 lv2:port [
53 a lv2:InputPort ,
54 lv2:ControlPort ;
55 lv2:index 0 ;
56 lv2:symbol "G10" ;
57 lv2:name "G10";
58 lv2:default 0.0;
59 lv2:minimum -3e+01 ;
60 lv2:maximum 2e+01 ;
61 ] , [
62 a lv2:InputPort ,
63 lv2:ControlPort ;
64 lv2:index 1 ;
65 lv2:symbol "G11" ;
66 lv2:name "G11";
67 lv2:default 0.0 ;
68 lv2:minimum -3e+01 ;
69 lv2:maximum 2e+01 ;
70 ] , [
71 a lv2:InputPort ,
72 lv2:ControlPort ;
73 lv2:index 2 ;
74 lv2:symbol "G1" ;
75 lv2:name "G1";
76 lv2:default 0.0 ;
77 lv2:minimum -3e+01 ;
78 lv2:maximum 2e+01 ;
79 ] , [
80 a lv2:InputPort ,
81 lv2:ControlPort ;
82 lv2:index 3 ;
83 lv2:symbol "G2" ;
84 lv2:name "G2";
85 lv2:default 0 ;
86 lv2:minimum -3e+01 ;
87 lv2:maximum 2e+01 ;
88 ] , [
89 a lv2:InputPort ,
90 lv2:ControlPort ;
91 lv2:index 4 ;
92 lv2:symbol "G3" ;
93 lv2:name "G3";
94 lv2:default 0.0 ;
95 lv2:minimum -3e+01 ;
96 lv2:maximum 2e+01 ;
97 ] , [
98 a lv2:InputPort ,
99 lv2:ControlPort ;
100 lv2:index 5 ;
101 lv2:symbol "G4" ;
102 lv2:name "G4";
103 lv2:default 0.0;
104 lv2:minimum -3e+01 ;
105 lv2:maximum 2e+01 ;
106 ] , [
107 a lv2:InputPort ,
108 lv2:ControlPort ;
109 lv2:index 6 ;
110 lv2:symbol "G5" ;
111 lv2:name "G5";
112 lv2:default 0.0 ;
113 lv2:minimum -3e+01 ;
114 lv2:maximum 2e+01 ;
115 ] , [
116 a lv2:InputPort ,
117 lv2:ControlPort ;
118 lv2:index 7 ;
119 lv2:symbol "G6" ;
120 lv2:name "G6";
121 lv2:default 0.0 ;
122 lv2:minimum -3e+01 ;
123 lv2:maximum 2e+01 ;
124 ] , [
125 a lv2:InputPort ,
126 lv2:ControlPort ;
127 lv2:index 8 ;
128 lv2:symbol "G7" ;
129 lv2:name "G7";
130 lv2:default 0 ;
131 lv2:minimum -3e+01 ;
132 lv2:maximum 2e+01 ;
133 ] , [
134 a lv2:InputPort ,
135 lv2:ControlPort ;
136 lv2:index 9 ;
137 lv2:symbol "G8" ;
138 lv2:name "G8";
139 lv2:default 0.0 ;
140 lv2:minimum -3e+01 ;
141 lv2:maximum 2e+01 ;
142 ] , [
143 a lv2:InputPort ,
144 lv2:ControlPort ;
145 lv2:index 10 ;
146 lv2:symbol "G9" ;
147 lv2:name "G9";
148 lv2:default 0.0 ;
149 lv2:minimum -3e+01 ;
150 lv2:maximum 2e+01 ;
151 ] , [
152 a lv2:ControlPort, lv2:OutputPort ;
153 lv2:index 11 ;
154 lv2:symbol "V10" ;
155 lv2:name "V10";
156 lv2:default 0.0 ;
157 lv2:minimum -70.0 ;
158 lv2:maximum 4.0 ;
159 ] , [
160 a lv2:ControlPort, lv2:OutputPort ;
161 lv2:index 12 ;
162 lv2:symbol "V11" ;
163 lv2:name "V11";
164 lv2:default 0.0 ;
165 lv2:minimum -70.0 ;
166 lv2:maximum 4.0 ;
167 ] , [
168 a lv2:ControlPort, lv2:OutputPort ;
169 lv2:index 13 ;
170 lv2:symbol "V1" ;
171 lv2:name "V1";
172 lv2:default 0.0 ;
173 lv2:minimum -70.0 ;
174 lv2:maximum 4.0 ;
175 ] , [
176 a lv2:ControlPort, lv2:OutputPort ;
177 lv2:index 14 ;
178 lv2:symbol "V2" ;
179 lv2:name "V2";
180 lv2:default 0.0 ;
181 lv2:minimum -70.0 ;
182 lv2:maximum 4.0 ;
183 ] , [
184 a lv2:ControlPort, lv2:OutputPort ;
185 lv2:index 15 ;
186 lv2:symbol "V3" ;
187 lv2:name "V3";
188 lv2:default 0.0 ;
189 lv2:minimum -70.0 ;
190 lv2:maximum 4.0 ;
191 ] , [
192 a lv2:ControlPort, lv2:OutputPort ;
193 lv2:index 16 ;
194 lv2:symbol "V4" ;
195 lv2:name "V4";
196 lv2:default 0.0 ;
197 lv2:minimum -70.0 ;
198 lv2:maximum 4.0 ;
199 ] , [
200 a lv2:ControlPort, lv2:OutputPort ;
201 lv2:index 17 ;
202 lv2:symbol "V5" ;
203 lv2:name "V5";
204 lv2:default 0.0 ;
205 lv2:minimum -70.0 ;
206 lv2:maximum 4.0 ;
207 ] , [
208 a lv2:ControlPort, lv2:OutputPort ;
209 lv2:index 18 ;
210 lv2:symbol "V6" ;
211 lv2:name "V6";
212 lv2:default 0.0 ;
213 lv2:minimum -70.0 ;
214 lv2:maximum 4.0 ;
215 ] , [
216 a lv2:ControlPort, lv2:OutputPort ;
217 lv2:index 19 ;
218 lv2:symbol "V7" ;
219 lv2:name "V7";
220 lv2:default 0.0 ;
221 lv2:minimum -70.0 ;
222 lv2:maximum 4.0 ;
223 ] , [
224 a lv2:ControlPort, lv2:OutputPort ;
225 lv2:index 20 ;
226 lv2:symbol "V8" ;
227 lv2:name "V8";
228 lv2:default 0.0 ;
229 lv2:minimum -70.0 ;
230 lv2:maximum 4.0 ;
231 ] , [
232 a lv2:ControlPort, lv2:OutputPort ;
233 lv2:index 21 ;
234 lv2:symbol "V9" ;
235 lv2:name "V9";
236 lv2:default 0.0 ;
237 lv2:minimum -70.0 ;
238 lv2:maximum 4.0 ;
239 ] , [
240 a lv2:AudioPort ,
241 lv2:OutputPort ;
242 lv2:index 22 ;
243 lv2:symbol "out" ;
244 lv2:name "Out"
245 ] , [
246 a lv2:AudioPort ,
247 lv2:InputPort ;
248 lv2:index 23 ;
249 lv2:symbol "in" ;
250 lv2:name "In" ;
251 ].
252
253 <http://guitarix.sourceforge.net/plugins/gx_graphiceq_#gui>
254 a guiext:GtkUI;
255 guiext:binary <gx_graphiceq_gui.so>;
256 guiext:requiredFeature guiext:makeResident .
257
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include <string>
21 #include <iostream>
22
23 #include <gtkmm.h>
24 #include "gx_graphiceq.h"
25 #include "widget.h"
26
27
28 #include <lv2.h>
29 #include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
30
31 using namespace std;
32
33 class Gx_graphiceq_GUI
34 {
35 private:
36 Glib::ustring plugskin;
37 Glib::ustring addKnob;
38 Glib::ustring plug_name;
39 void set_skin();
40 void set_plug_name(const char * plugin_uri);
41 GtkWidget* make_gui();
42 public:
43
44 Widget* widget;
45 static void set_plug_name_static(Gx_graphiceq_GUI *self, const char * plugin_uri)
46 {
47 self->set_plug_name(plugin_uri);
48 }
49 static GtkWidget* make_gui_static(Gx_graphiceq_GUI *self)
50 {
51 return self->make_gui();
52 }
53
54 Gx_graphiceq_GUI () {};
55 ~Gx_graphiceq_GUI () {};
56 } ;
57
58 void Gx_graphiceq_GUI::set_skin()
59 {
60 Glib::ustring toparse = "pixmap_path ";
61 toparse += " '";
62 toparse += GX_LV2_STYLE_DIR;
63 toparse += "/'\n";
64 toparse += "style \"gx_";
65 toparse += plug_name;
66 toparse += "_dark-paintbox\"\n"
67 " { \n"
68 "GxPaintBox::skin-gradient = {\n"
69 "{ 65536, 983, 983, 983, 65536 }, \n"
70 "{ 32768, 6276, 6276, 6276, 65536 },\n"
71 "{ 0, 22760, 22760, 22760, 65536 }}\n"
72 " GxPaintBox::box-gradient = {\n"
73 "{ 0, 6142, 6142, 6142, 62428 }, \n"
74 "{ 22768, 53, 53, 53, 42428 }, \n"
75 "{ 52428, 8, 8, 80, 32428 }, \n"
76 "{ 65536, 5364, 5364, 5364, 52428 }} \n"
77 " GxPaintBox::icon-set =11\n"
78 " }\n"
79 "\n"
80 "style 'gx_head_expander_box' \n"
81 " { \n"
82 " fg[NORMAL] = '#c0c6d0' \n"
83 " font_name = 'sans 7.5 bold' \n"
84 " }\n";
85
86 toparse += " widget '*.amplabel' style:highest 'gx_head_expander_box'\n";
87 toparse += " style \"gx_";
88 toparse += plug_name;
89 toparse += "_slevel\"\n"
90 "{\n"
91 "stock['levelslider'] = {{'simplelevelslider.png'}}\n"
92 "GxLevelSlider::slider-width = 3\n"
93 "GxRegler::show-value = 0\n"
94 "}\n"
95 "widget '*.";
96 toparse += plug_name;
97 toparse += "' style 'gx_";
98 toparse += plug_name;
99 toparse += "_slevel' "
100
101 "widget '*.";
102 toparse += plug_name;
103 toparse += "' style 'gx_";
104 toparse += plug_name;
105 toparse += "_dark-paintbox' "
106 "style 'gx_fastmeter'\n"
107 " {\n"
108 " GxFastMeter::clr-bottom = '#003808'\n"
109 " GxFastMeter::clr-middle = '#00ff00'\n"
110 " GxFastMeter::clr-top = '#ff0000'\n"
111 " GxFastMeter::over = '#ff0000'\n"
112 " }\n"
113 " class '*GxFastMeter' style:highest 'gx_fastmeter'\n";
114
115 gtk_rc_parse_string (toparse.c_str());
116 }
117
118 void Gx_graphiceq_GUI::set_plug_name( const char * plugin_uri)
119 {
120
121 if (strcmp("http://guitarix.sourceforge.net/plugins/gx_graphiceq_#_graphiceq_", plugin_uri) == 0)
122 {
123 plug_name = "_graphiceq_";
124 }
125 else
126 {
127 plug_name = "_graphiceq_";
128 }
129 }
130
131 GtkWidget* Gx_graphiceq_GUI::make_gui()
132 {
133 // init the gxwmm library
134 Gxw::init();
135 set_skin();
136 GtkWidget* container = gtk_vbox_new(FALSE, 2);
137 widget = new Widget(plug_name);
138 GtkWidget* cWidget = GTK_WIDGET(widget->gobj());
139 gtk_container_add(GTK_CONTAINER(container), cWidget );
140
141 return container;
142 }
143
144
145 static LV2UI_Handle instantiate(const struct _LV2UI_Descriptor * descriptor,
146 const char * plugin_uri,
147 const char * bundle_path,
148 LV2UI_Write_Function write_function,
149 LV2UI_Controller controller,
150 LV2UI_Widget * widget,
151 const LV2_Feature * const * features)
152 {
153 Gx_graphiceq_GUI* self = new Gx_graphiceq_GUI();
154 if (self == NULL) return NULL;
155 self->set_plug_name_static(self, plugin_uri);
156 *widget = (LV2UI_Widget)self->make_gui_static(self);
157 self->widget->controller = controller;
158 self->widget->write_function = write_function;
159 return (LV2UI_Handle)self;
160 }
161
162 static void cleanup(LV2UI_Handle ui)
163 {
164 Gx_graphiceq_GUI *pluginGui = static_cast<Gx_graphiceq_GUI*>(ui);
165 delete pluginGui->widget;
166 delete pluginGui;
167 }
168
169 static void port_event(LV2UI_Handle ui,
170 uint32_t port_index,
171 uint32_t buffer_size,
172 uint32_t format,
173 const void * buffer)
174 {
175 Gx_graphiceq_GUI *self = static_cast<Gx_graphiceq_GUI*>(ui);
176 self->widget->set_value_static( port_index, buffer_size, format, buffer, self->widget);
177 return;
178 }
179
180 static LV2UI_Descriptor descriptors[] =
181 {
182 {GXPLUGIN_UI_URI, instantiate, cleanup, port_event, NULL}
183 };
184
185 const LV2UI_Descriptor * lv2ui_descriptor(uint32_t index)
186 {
187 //printf("lv2ui_descriptor(%u) called\n", (uint32_t)index);
188 if (index >= sizeof(descriptors) / sizeof(descriptors[0]))
189 {
190 return NULL;
191 }
192 return descriptors + index;
193 }
194
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_graphiceq_#_graphiceq_>
23 a lv2:Plugin ;
24 lv2:binary <gx_graphiceq.so> ;
25 rdfs:seeAlso <gx_graphiceq.ttl> .
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_graphiceq_#_graphiceq_>
23 a lv2:Plugin ;
24 lv2:binary <gx_graphiceq@LIB_EXT@> ;
25 rdfs:seeAlso <gx_graphiceq.ttl> .
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include "widget.h"
21
22 #include <iostream>
23
24 #define max(x, y) (((x) > (y)) ? (x) : (y))
25
26 /* @get controller by port
27 * this function is used by make_selector() make_controller()
28 * set_value() and on_value_changed()
29 * so controller widgets needs only here asined to a port,
30 * and all functions which need acess to the controller widget pointer
31 * can receive them by port number
32 */
33
34 Gtk::Widget* Widget::get_controller_by_port(uint32_t port_index)
35 {
36 switch ((PortIndex)port_index )
37 {
38 case G1:
39 return &m_levelslider[0];
40 case G2:
41 return &m_levelslider[1];
42 case G3:
43 return &m_levelslider[2];
44 case G4:
45 return &m_levelslider[3];
46 case G5:
47 return &m_levelslider[4];
48 case G6:
49 return &m_levelslider[5];
50 case G7:
51 return &m_levelslider[6];
52 case G8:
53 return &m_levelslider[7];
54 case G9:
55 return &m_levelslider[8];
56 case G10:
57 return &m_levelslider[9];
58 case G11:
59 return &m_levelslider[10];
60 default:
61 return NULL;
62 }
63 }
64
65 Widget::Widget(Glib::ustring plugname):
66 plug_name(plugname)
67 {
68 // set labels
69 m_label[0].set_text(">31");
70 m_label[1].set_text("62");
71 m_label[2].set_text("125");
72 m_label[3].set_text("250");
73 m_label[4].set_text("500");
74 m_label[5].set_text("1k");
75 m_label[6].set_text("2k");
76 m_label[7].set_text("4k");
77 m_label[8].set_text("8k");
78 m_label[9].set_text("16k");
79 m_label[10].set_text("<");
80 // make controllers
81 make_controller( "", -30, 20, 0.01, G1, false);
82 make_controller( "", -30, 20, 0.01, G2, false);
83 make_controller( "", -30, 20, 0.01, G3, false);
84 make_controller( "", -30, 20, 0.01, G4, false);
85 make_controller( "", -30, 20, 0.01, G5, false);
86 make_controller( "", -30, 20, 0.01, G6, false);
87 make_controller( "", -30, 20, 0.01, G7, false);
88 make_controller( "", -30, 20, 0.01, G8, false);
89 make_controller( "", -30, 20, 0.01, G9, false);
90 make_controller( "", -30, 20, 0.01, G10, false);
91 make_controller( "", -30, 20, 0.01, G11, false);
92 // set propertys for the main paintbox holding the skin
93 m_paintbox[0].set_border_width(15);
94 m_paintbox[0].set_spacing(2);
95 m_paintbox[0].set_homogeneous(false);
96 m_paintbox[0].set_name(plug_name);
97 m_paintbox[0].property_paint_func() = "gxhead_expose";
98 add(m_paintbox[0]);
99 // set a vertical box in the paintbox
100 m_paintbox[0].pack_start(m_vbox[11]);
101 m_vbox[11].pack_start(m_hbox[12],Gtk::PACK_EXPAND_WIDGET);
102 m_vbox[11].pack_start(m_hbox[11],Gtk::PACK_SHRINK);
103 m_hbox[11].set_homogeneous(true);
104 // put boxed controllers into controller box
105 for (uint32_t i = 0;i<11;i++) {
106 fastmeter[i].set_hold_count(12);
107 fastmeter[i].set_property("dimen",5);
108 m_hbox[i].set_border_width(6);
109 m_paintbox[i+1].property_paint_func() = "simple_level_meter_expose";
110 m_paintbox[i+1].set_name(plug_name);
111 m_paintbox[i+1].set_border_width(2);
112 m_paintbox[i+1].pack_start(fastmeter[i]);
113 m_paintbox[i+1].pack_start(m_levelslider[i]);
114 m_hbox[i].pack_start(m_paintbox[i+1]);
115 m_label[i].set_name("amplabel");
116 m_vbox[i].add(m_label[i]);
117 m_vbox[i].add(m_hbox[i]);
118 m_hbox[11].pack_start(m_vbox[i],Gtk::PACK_SHRINK);
119 }
120
121 set_app_paintable(true);
122 show_all();
123 }
124
125 Widget::~Widget()
126 {
127
128 }
129
130 // create stackboxes with controllers for port name
131 void Widget::make_controller( Glib::ustring label,
132 float min, float max,
133 float digits,
134 PortIndex port_name,
135 bool show_value)
136 {
137 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
138 get_controller_by_port(port_name));
139 if (regler)
140 {
141
142 regler->cp_configure("LEVELSLIDER", label, min, max, digits);
143 regler->set_show_value(show_value);
144 regler->set_name(plug_name);
145 regler->signal_value_changed().connect(sigc::bind(sigc::mem_fun(
146 *this, &Widget::on_value_changed), port_name));
147 }
148 }
149
150 // receive controller value changes from host and set them to controller
151 void Widget::set_value(uint32_t port_index,
152 uint32_t format,
153 const void * buffer)
154 {
155 if ( format == 0 )
156 {
157 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
158 get_controller_by_port(port_index));
159 float value = *static_cast<const float*>(buffer);
160 if (regler) regler->cp_set_value(value);
161 if (port_index == V1) refresh_meter_level(0,value);
162 else if (port_index == V2) refresh_meter_level(1,value);
163 else if (port_index == V3) refresh_meter_level(2,value);
164 else if (port_index == V4) refresh_meter_level(3,value);
165 else if (port_index == V5) refresh_meter_level(4,value);
166 else if (port_index == V6) refresh_meter_level(5,value);
167 else if (port_index == V7) refresh_meter_level(6,value);
168 else if (port_index == V8) refresh_meter_level(7,value);
169 else if (port_index == V9) refresh_meter_level(8,value);
170 else if (port_index == V10) refresh_meter_level(9,value);
171 else if (port_index == V11) refresh_meter_level(10,value);
172 }
173 }
174
175 // write (UI) controller value changes to the host->engine
176 void Widget::on_value_changed(uint32_t port_index)
177 {
178 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
179 get_controller_by_port(port_index));
180 if (regler)
181 {
182 float value = regler->cp_get_value();
183 write_function(controller, port_index, sizeof(float), 0,
184 static_cast<const void*>(&value));
185 }
186 }
187
188 void Widget::refresh_meter_level(int m, float new_level) {
189 fastmeter[m].set_by_power(new_level);
190 }
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_WIDGET_H_
22 #define SRC_HEADERS_WIDGET_H_
23
24 #include <gtkmm.h>
25 #include <gxwmm.h>
26 #include "gx_graphiceq.h"
27 #include "../config.h" // for GX_STYLE_DIR
28 // LV2UI stuff
29 #include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
30
31 class Widget : public Gtk::HBox
32 {
33 private:
34 Gtk::Widget* get_controller_by_port(uint32_t port_index);
35
36 void refresh_meter_level(int meter,float new_level);
37
38 void on_value_changed(uint32_t port_index);
39
40 void make_controller(Glib::ustring label,
41 float min, float max,
42 float digits,
43 PortIndex port_name,
44 bool show_value);
45
46 void set_value(uint32_t port_index,
47 uint32_t format,
48 const void * buffer);
49 public:
50
51 // public Lv2 communication stuff
52 LV2UI_Controller controller;
53 LV2UI_Write_Function write_function;
54 static void set_value_static(uint32_t port_index,
55 uint32_t buffer_size,
56 uint32_t format,
57 const void * buffer, Widget *self)
58 {
59 self->set_value(port_index,format,buffer);
60 }
61
62 Widget(Glib::ustring plugname);
63 ~Widget();
64
65 protected:
66 Glib::ustring plug_name;
67 Gtk::HBox m_hbox[13];
68 Gtk::VBox m_vbox[12];
69 Gtk::Label m_label[11];
70
71 Gxw::LevelSlider m_levelslider[11];
72 Gxw::FastMeter fastmeter[11];
73 Gxw::PaintBox m_paintbox[12];
74 };
75
76 #endif //SRC_HEADERS_WIDGET_H_
0 #!/usr/bin/env python
1 # encoding: utf-8
2
3 import sys, os, TaskGen, ctypes
4
5 def configure(conf):
6 pass
7
8 def build(bld):
9 bundle = 'gx_graphiceq.lv2'
10
11 src = ['gx_graphiceq.cpp'
12 ]
13 incl = ['../faust','./', '../DSP']
14 lib = []
15 if sys.platform.startswith("linux"):
16 lib.append('dl')
17 uselib = ['LV2CORE']
18 cxxflag =[]
19 if not bld.env['OPT'] and bld.env['SSE2']:
20 cxxflag = [ "-msse2", "-mfpmath=sse"]
21 lv2_effects = bld(
22 features='cxx cshlib ',
23 includes = incl,
24 lib = lib,
25 uselib = uselib,
26 obj_ext = '_14.o',
27 cxxflags = cxxflag,
28 defines = ["LV2_SO"],
29 target = 'gx_graphiceq',
30 source = src,
31 install_path = '${LV2DIR}/%s' % bundle,
32 chmod = 0o755,
33 )
34 lv2_effects.env['shlib_PATTERN'] = '%s.so'
35
36 uselib_local5 = []
37 libpath5 = []
38 lib5 = []
39 incl5 = ['../../../libgxwmm','../../../libgxw','../']
40 if sys.platform.startswith("linux"):
41 lib5.append('dl')
42 if bld.env["GX_LIB_SHARED"]:
43 lib5 += ['gxwmm','gxw']
44 libpath5 += [bld.path.find_dir("../../../libgxw/gxw").bldpath(bld.env),
45 bld.path.find_dir("../../../libgxwmm/gxwmm").bldpath(bld.env)]
46 else:
47 uselib_local5 += ['gxwmm','gxw']
48
49 lv2_effetcs_gui = bld(
50 features='cxx cshlib ',
51 includes = incl5,
52 lib = lib5,
53 uselib = 'LV2CORE GTKMM',
54 libpath = libpath5,
55 uselib_local = uselib_local5,
56 linkflags = '-Wl,-z,nodelete',
57 defines = ["LV2_GUI"],
58 target = 'gx_graphiceq_gui',
59 source = 'widget.cpp gx_graphiceq_gui.cpp',
60 install_path = '${LV2DIR}/%s' % bundle,
61 chmod = 0o755,
62 )
63 lv2_effetcs_gui.env['shlib_PATTERN'] = '%s.so'
64
65
66 install_path = '${LV2DIR}/%s' % bundle,
67 bld.install_files('${LV2DIR}/gx_graphiceq.lv2', 'manifest.ttl')
68 bld.install_files('${LV2DIR}/gx_graphiceq.lv2', 'gx_graphiceq.ttl')
69
70 bld.install_files('${LV2DIR}/gx_graphiceq.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 ////////////////////////////// LOCAL INCLUDES //////////////////////////
21
22 #include "gx_common.h" // faust support and denormal protection (SSE)
23 #include "gx_mbcompressor.h" // define struct PortIndex
24 #include "gx_pluginlv2.h" // define struct PluginLV2
25 #include "mbc.cc" // dsp class generated by faust -> dsp2cc
26
27 ////////////////////////////// PLUG-IN CLASS ///////////////////////////
28
29 class Gx_mbcompressor_
30 {
31 private:
32 // pointer to buffer
33 float* output;
34 float* input;
35 // pointer to dsp class
36 PluginLV2* mbcompressor;
37 // private functions
38 inline void run_dsp_(uint32_t n_samples);
39 inline void connect_(uint32_t port,void* data);
40 inline void init_dsp_(uint32_t rate);
41 inline void connect_all__ports(uint32_t port, void* data);
42 inline void activate_f();
43 inline void clean_up();
44 inline void deactivate_f();
45
46 public:
47 // LV2 Descriptor
48 static const LV2_Descriptor descriptor;
49 // static wrapper to private functions
50 static void deactivate(LV2_Handle instance);
51 static void cleanup(LV2_Handle instance);
52 static void run(LV2_Handle instance, uint32_t n_samples);
53 static void activate(LV2_Handle instance);
54 static void connect_port(LV2_Handle instance, uint32_t port, void* data);
55 static LV2_Handle instantiate(const LV2_Descriptor* descriptor,
56 double rate, const char* bundle_path,
57 const LV2_Feature* const* features);
58 Gx_mbcompressor_();
59 ~Gx_mbcompressor_();
60 };
61
62 // constructor
63 Gx_mbcompressor_::Gx_mbcompressor_() :
64 output(NULL),
65 input(NULL),
66 mbcompressor(mbc::plugin()) {};
67
68 // destructor
69 Gx_mbcompressor_::~Gx_mbcompressor_()
70 {
71 // just to be sure the plug have given free the allocated mem
72 // it didn't hurd if the mem is already given free by clean_up()
73 if (mbcompressor->activate_plugin !=0)
74 mbcompressor->activate_plugin(false, mbcompressor);
75 // delete DSP class
76 mbcompressor->delete_instance(mbcompressor);
77 };
78
79 ///////////////////////// PRIVATE CLASS FUNCTIONS /////////////////////
80
81 void Gx_mbcompressor_::init_dsp_(uint32_t rate)
82 {
83 AVOIDDENORMALS(); // init the SSE denormal protection
84 mbcompressor->set_samplerate(rate, mbcompressor); // init the DSP class
85 }
86
87 // connect the Ports used by the plug-in class
88 void Gx_mbcompressor_::connect_(uint32_t port,void* data)
89 {
90 switch ((PortIndex)port)
91 {
92 case EFFECTS_OUTPUT:
93 output = static_cast<float*>(data);
94 break;
95 case EFFECTS_INPUT:
96 input = static_cast<float*>(data);
97 break;
98 default:
99 break;
100 }
101 }
102
103 void Gx_mbcompressor_::activate_f()
104 {
105 // allocate the internal DSP mem
106 if (mbcompressor->activate_plugin !=0)
107 mbcompressor->activate_plugin(true, mbcompressor);
108 }
109
110 void Gx_mbcompressor_::clean_up()
111 {
112 // delete the internal DSP mem
113 if (mbcompressor->activate_plugin !=0)
114 mbcompressor->activate_plugin(false, mbcompressor);
115 }
116
117 void Gx_mbcompressor_::deactivate_f()
118 {
119 // delete the internal DSP mem
120 if (mbcompressor->activate_plugin !=0)
121 mbcompressor->activate_plugin(false, mbcompressor);
122 }
123
124 void Gx_mbcompressor_::run_dsp_(uint32_t n_samples)
125 {
126 mbcompressor->mono_audio(static_cast<int>(n_samples), input, output, mbcompressor);
127 }
128
129 void Gx_mbcompressor_::connect_all__ports(uint32_t port, void* data)
130 {
131 // connect the Ports used by the plug-in class
132 connect_(port,data);
133 // connect the Ports used by the DSP class
134 mbcompressor->connect_ports(port, data, mbcompressor);
135 }
136
137 ////////////////////// STATIC CLASS FUNCTIONS ////////////////////////
138
139 LV2_Handle
140 Gx_mbcompressor_::instantiate(const LV2_Descriptor* descriptor,
141 double rate, const char* bundle_path,
142 const LV2_Feature* const* features)
143 {
144 // init the plug-in class
145 Gx_mbcompressor_ *self = new Gx_mbcompressor_();
146 if (!self)
147 {
148 return NULL;
149 }
150
151 self->init_dsp_((uint32_t)rate);
152
153 return (LV2_Handle)self;
154 }
155
156 void Gx_mbcompressor_::connect_port(LV2_Handle instance,
157 uint32_t port, void* data)
158 {
159 // connect all ports
160 static_cast<Gx_mbcompressor_*>(instance)->connect_all__ports(port, data);
161 }
162
163 void Gx_mbcompressor_::activate(LV2_Handle instance)
164 {
165 // allocate needed mem
166 static_cast<Gx_mbcompressor_*>(instance)->activate_f();
167 }
168
169 void Gx_mbcompressor_::run(LV2_Handle instance, uint32_t n_samples)
170 {
171 // run dsp
172 static_cast<Gx_mbcompressor_*>(instance)->run_dsp_(n_samples);
173 }
174
175 void Gx_mbcompressor_::deactivate(LV2_Handle instance)
176 {
177 // free allocated mem
178 static_cast<Gx_mbcompressor_*>(instance)->deactivate_f();
179 }
180
181 void Gx_mbcompressor_::cleanup(LV2_Handle instance)
182 {
183 // well, clean up after us
184 Gx_mbcompressor_* self = static_cast<Gx_mbcompressor_*>(instance);
185 self->clean_up();
186 delete self;
187 }
188
189 const LV2_Descriptor Gx_mbcompressor_::descriptor =
190 {
191 GXPLUGIN_URI "#_mbcompressor_",
192 Gx_mbcompressor_::instantiate,
193 Gx_mbcompressor_::connect_port,
194 Gx_mbcompressor_::activate,
195 Gx_mbcompressor_::run,
196 Gx_mbcompressor_::deactivate,
197 Gx_mbcompressor_::cleanup,
198 NULL
199 };
200
201 ////////////////////////// LV2 SYMBOL EXPORT ///////////////////////////
202
203 extern "C"
204 LV2_SYMBOL_EXPORT
205 const LV2_Descriptor*
206 lv2_descriptor(uint32_t index)
207 {
208 switch (index)
209 {
210 case 0:
211 return &Gx_mbcompressor_::descriptor;
212 default:
213 return NULL;
214 }
215 }
216
217 ///////////////////////////// FIN //////////////////////////////////////
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_GXEFFECTS_H_
22 #define SRC_HEADERS_GXEFFECTS_H_
23
24 #include <lv2.h>
25
26 #define GXPLUGIN_URI "http://guitarix.sourceforge.net/plugins/gx_mbcompressor_"
27 #define GXPLUGIN_UI_URI "http://guitarix.sourceforge.net/plugins/gx_mbcompressor_#gui"
28
29
30 typedef enum
31 {
32 MODE1,
33 MODE2,
34 MODE3,
35 MODE4,
36 MODE5,
37 MAKEUP1,
38 MAKEUP2,
39 MAKEUP3,
40 MAKEUP4,
41 MAKEUP5,
42 MAKEUPTHRESHOLD1,
43 MAKEUPTHRESHOLD2,
44 MAKEUPTHRESHOLD3,
45 MAKEUPTHRESHOLD4,
46 MAKEUPTHRESHOLD5,
47 RATIO1,
48 RATIO2,
49 RATIO3,
50 RATIO4,
51 RATIO5,
52 ATTACK1,
53 ATTACK2,
54 ATTACK3,
55 ATTACK4,
56 ATTACK5,
57 RELEASE1,
58 RELEASE2,
59 RELEASE3,
60 RELEASE4,
61 RELEASE5,
62 CROSSOVER_B1_B2,
63 CROSSOVER_B2_B3,
64 CROSSOVER_B3_B4,
65 CROSSOVER_B4_B5,
66 V1,
67 V2,
68 V3,
69 V4,
70 V5,
71 V6,
72 V7,
73 V8,
74 V9,
75 V10,
76 EFFECTS_OUTPUT,
77 EFFECTS_INPUT,
78 } PortIndex;
79
80 #endif //SRC_HEADERS_GXEFFECTS_H_
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19
20 @prefix doap: <http://usefulinc.com/ns/doap#> .
21 @prefix foaf: <http://xmlns.com/foaf/0.1/> .
22 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
23 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
24 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
25 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26
27 <http://guitarix.sourceforge.net#me>
28 a foaf:Person ;
29 foaf:name "Guitarix team" ;
30 foaf:mbox <mailto:brummer@web.de> ;
31 rdfs:seeAlso <http://guitarix.sourceforge.net> .
32
33 <http://guitarix.sourceforge.net/plugins/gx_mbcompressor_>
34 a doap:Project ;
35 doap:maintainer <http://guitarix.sourceforge.net#me> ;
36 doap:name "Gx_mbcompressor_" .
37
38 <http://guitarix.sourceforge.net/plugins/gx_mbcompressor_#_mbcompressor_>
39 a lv2:Plugin ,
40 lv2:CompressorPlugin ;
41 doap:maintainer <http://guitarix.sourceforge.net#me> ;
42 doap:name "GxMultiBandCompressor";
43 doap:license <http://opensource.org/licenses/isc> ;
44 lv2:project <http://guitarix.sourceforge.net/plugins/gx_mbcompressor_> ;
45 lv2:optionalFeature lv2:hardRTCapable ;
46
47 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_mbcompressor_#gui>;
48
49 lv2:minorVersion 28;
50 lv2:microVersion 3;
51
52 lv2:port [
53 a lv2:InputPort ,
54 lv2:ControlPort ;
55 lv2:index 0 ;
56 lv2:symbol "MODE1" ;
57 lv2:name "MODE1";
58 lv2:portProperty lv2:integer;
59 lv2:portProperty lv2:enumeration ;
60 lv2:default 1 ;
61 lv2:minimum 1 ;
62 lv2:maximum 3 ;
63 lv2:scalePoint [rdfs:label "Compress"; rdf:value 1];
64 lv2:scalePoint [rdfs:label "Bypass"; rdf:value 2];
65 lv2:scalePoint [rdfs:label "Mute"; rdf:value 3];
66 ] , [
67 a lv2:InputPort ,
68 lv2:ControlPort ;
69 lv2:index 1 ;
70 lv2:symbol "MODE2" ;
71 lv2:name "MODE2";
72 lv2:portProperty lv2:integer;
73 lv2:portProperty lv2:enumeration ;
74 lv2:default 1 ;
75 lv2:minimum 1 ;
76 lv2:maximum 3 ;
77 lv2:scalePoint [rdfs:label "Compress"; rdf:value 1];
78 lv2:scalePoint [rdfs:label "Bypass"; rdf:value 2];
79 lv2:scalePoint [rdfs:label "Mute"; rdf:value 3];
80 ] , [
81 a lv2:InputPort ,
82 lv2:ControlPort ;
83 lv2:index 2 ;
84 lv2:symbol "MODE3" ;
85 lv2:name "MODE3";
86 lv2:portProperty lv2:integer;
87 lv2:portProperty lv2:enumeration ;
88 lv2:default 1 ;
89 lv2:minimum 1 ;
90 lv2:maximum 3 ;
91 lv2:scalePoint [rdfs:label "Compress"; rdf:value 1];
92 lv2:scalePoint [rdfs:label "Bypass"; rdf:value 2];
93 lv2:scalePoint [rdfs:label "Mute"; rdf:value 3];
94 ] , [
95 a lv2:InputPort ,
96 lv2:ControlPort ;
97 lv2:index 3 ;
98 lv2:symbol "MODE4" ;
99 lv2:name "MODE4";
100 lv2:portProperty lv2:integer;
101 lv2:portProperty lv2:enumeration ;
102 lv2:default 1 ;
103 lv2:minimum 1 ;
104 lv2:maximum 3 ;
105 lv2:scalePoint [rdfs:label "Compress"; rdf:value 1];
106 lv2:scalePoint [rdfs:label "Bypass"; rdf:value 2];
107 lv2:scalePoint [rdfs:label "Mute"; rdf:value 3];
108 ] , [
109 a lv2:InputPort ,
110 lv2:ControlPort ;
111 lv2:index 4 ;
112 lv2:symbol "MODE5" ;
113 lv2:name "MODE5";
114 lv2:portProperty lv2:integer;
115 lv2:portProperty lv2:enumeration ;
116 lv2:default 1 ;
117 lv2:minimum 1 ;
118 lv2:maximum 3 ;
119 lv2:scalePoint [rdfs:label "Compress"; rdf:value 1];
120 lv2:scalePoint [rdfs:label "Bypass"; rdf:value 2];
121 lv2:scalePoint [rdfs:label "Mute"; rdf:value 3];
122 ] , [
123 a lv2:InputPort ,
124 lv2:ControlPort ;
125 lv2:index 5 ;
126 lv2:symbol "MAKEUP1" ;
127 lv2:name "MAKEUP1";
128 lv2:default 13.0 ;
129 lv2:minimum -5e+01 ;
130 lv2:maximum 5e+01 ;
131 ] , [
132 a lv2:InputPort ,
133 lv2:ControlPort ;
134 lv2:index 6 ;
135 lv2:symbol "MAKEUP2" ;
136 lv2:name "MAKEUP2";
137 lv2:default 13.0 ;
138 lv2:minimum -5e+01 ;
139 lv2:maximum 5e+01 ;
140 ] , [
141 a lv2:InputPort ,
142 lv2:ControlPort ;
143 lv2:index 7 ;
144 lv2:symbol "MAKEUP3" ;
145 lv2:name "MAKEUP3";
146 lv2:default 13.0 ;
147 lv2:minimum -5e+01 ;
148 lv2:maximum 5e+01 ;
149 ] , [
150 a lv2:InputPort ,
151 lv2:ControlPort ;
152 lv2:index 8 ;
153 lv2:symbol "MAKEUP4" ;
154 lv2:name "MAKEUP4";
155 lv2:default 13.0 ;
156 lv2:minimum -5e+01 ;
157 lv2:maximum 5e+01 ;
158 ] , [
159 a lv2:InputPort ,
160 lv2:ControlPort ;
161 lv2:index 9 ;
162 lv2:symbol "MAKEUP5" ;
163 lv2:name "MAKEUP5";
164 lv2:default 13.0 ;
165 lv2:minimum -5e+01 ;
166 lv2:maximum 5e+01 ;
167 ] , [
168 a lv2:InputPort ,
169 lv2:ControlPort ;
170 lv2:index 10 ;
171 lv2:symbol "MAKEUPTHRESHOLD1" ;
172 lv2:name "MAKEUPTHRESHOLD1";
173 lv2:default 2.0 ;
174 lv2:minimum 0.0 ;
175 lv2:maximum 1e+01 ;
176 ] , [
177 a lv2:InputPort ,
178 lv2:ControlPort ;
179 lv2:index 11 ;
180 lv2:symbol "MAKEUPTHRESHOLD2" ;
181 lv2:name "MAKEUPTHRESHOLD2";
182 lv2:default 2.0 ;
183 lv2:minimum 0.0 ;
184 lv2:maximum 1e+01 ;
185 ] , [
186 a lv2:InputPort ,
187 lv2:ControlPort ;
188 lv2:index 12 ;
189 lv2:symbol "MAKEUPTHRESHOLD3" ;
190 lv2:name "MAKEUPTHRESHOLD3";
191 lv2:default 2.0 ;
192 lv2:minimum 0.0 ;
193 lv2:maximum 1e+01 ;
194 ] , [
195 a lv2:InputPort ,
196 lv2:ControlPort ;
197 lv2:index 13 ;
198 lv2:symbol "MAKEUPTHRESHOLD4" ;
199 lv2:name "MAKEUPTHRESHOLD4";
200 lv2:default 2.0 ;
201 lv2:minimum 0.0 ;
202 lv2:maximum 1e+01 ;
203 ] , [
204 a lv2:InputPort ,
205 lv2:ControlPort ;
206 lv2:index 14 ;
207 lv2:symbol "MAKEUPTHRESHOLD5" ;
208 lv2:name "MAKEUPTHRESHOLD5";
209 lv2:default 2.0 ;
210 lv2:minimum 0.0 ;
211 lv2:maximum 1e+01 ;
212 ] , [
213 a lv2:InputPort ,
214 lv2:ControlPort ;
215 lv2:index 15 ;
216 lv2:symbol "RATIO1" ;
217 lv2:name "RATIO1";
218 lv2:default 13.0 ;
219 lv2:minimum 1.0 ;
220 lv2:maximum 1e+02 ;
221 ] , [
222 a lv2:InputPort ,
223 lv2:ControlPort ;
224 lv2:index 16 ;
225 lv2:symbol "RATIO2" ;
226 lv2:name "RATIO2";
227 lv2:default 10.0 ;
228 lv2:minimum 1.0 ;
229 lv2:maximum 1e+02 ;
230 ] , [
231 a lv2:InputPort ,
232 lv2:ControlPort ;
233 lv2:index 17 ;
234 lv2:symbol "RATIO3" ;
235 lv2:name "RATIO3";
236 lv2:default 4.0 ;
237 lv2:minimum 1.0 ;
238 lv2:maximum 1e+02 ;
239 ] , [
240 a lv2:InputPort ,
241 lv2:ControlPort ;
242 lv2:index 18 ;
243 lv2:symbol "RATIO4" ;
244 lv2:name "RATIO4";
245 lv2:default 8.0 ;
246 lv2:minimum 1.0 ;
247 lv2:maximum 1e+02 ;
248 ] , [
249 a lv2:InputPort ,
250 lv2:ControlPort ;
251 lv2:index 19 ;
252 lv2:symbol "RATIO5" ;
253 lv2:name "RATIO5";
254 lv2:default 11.0 ;
255 lv2:minimum 1.0 ;
256 lv2:maximum 1e+02 ;
257 ] , [
258 a lv2:InputPort ,
259 lv2:ControlPort ;
260 lv2:index 20 ;
261 lv2:symbol "ATTACK1" ;
262 lv2:name "ATTACK1";
263 lv2:default 0.012 ;
264 lv2:minimum 0.001 ;
265 lv2:maximum 1.0 ;
266 ] , [
267 a lv2:InputPort ,
268 lv2:ControlPort ;
269 lv2:index 21 ;
270 lv2:symbol "ATTACK2" ;
271 lv2:name "ATTACK2";
272 lv2:default 0.012 ;
273 lv2:minimum 0.001 ;
274 lv2:maximum 1.0 ;
275 ] , [
276 a lv2:InputPort ,
277 lv2:ControlPort ;
278 lv2:index 22 ;
279 lv2:symbol "ATTACK3" ;
280 lv2:name "ATTACK3";
281 lv2:default 0.012 ;
282 lv2:minimum 0.001 ;
283 lv2:maximum 1.0 ;
284 ] , [
285 a lv2:InputPort ,
286 lv2:ControlPort ;
287 lv2:index 23 ;
288 lv2:symbol "ATTACK4" ;
289 lv2:name "ATTACK4";
290 lv2:default 0.012 ;
291 lv2:minimum 0.001 ;
292 lv2:maximum 1.0 ;
293 ] , [
294 a lv2:InputPort ,
295 lv2:ControlPort ;
296 lv2:index 24 ;
297 lv2:symbol "ATTACK5" ;
298 lv2:name "ATTACK5";
299 lv2:default 0.012 ;
300 lv2:minimum 0.001 ;
301 lv2:maximum 1.0 ;
302 ] , [
303 a lv2:InputPort ,
304 lv2:ControlPort ;
305 lv2:index 25 ;
306 lv2:symbol "RELEASE1" ;
307 lv2:name "RELEASE1";
308 lv2:default 1.25 ;
309 lv2:minimum 0.01 ;
310 lv2:maximum 1e+01 ;
311 ] , [
312 a lv2:InputPort ,
313 lv2:ControlPort ;
314 lv2:index 26 ;
315 lv2:symbol "RELEASE2" ;
316 lv2:name "RELEASE2";
317 lv2:default 1.25 ;
318 lv2:minimum 0.01 ;
319 lv2:maximum 1e+01 ;
320 ] , [
321 a lv2:InputPort ,
322 lv2:ControlPort ;
323 lv2:index 27 ;
324 lv2:symbol "RELEASE3" ;
325 lv2:name "RELEASE3";
326 lv2:default 1.25 ;
327 lv2:minimum 0.01 ;
328 lv2:maximum 1e+01 ;
329 ] , [
330 a lv2:InputPort ,
331 lv2:ControlPort ;
332 lv2:index 28 ;
333 lv2:symbol "RELEASE4" ;
334 lv2:name "RELEASE4";
335 lv2:default 1.25 ;
336 lv2:minimum 0.01 ;
337 lv2:maximum 1e+01 ;
338 ] , [
339 a lv2:InputPort ,
340 lv2:ControlPort ;
341 lv2:index 29 ;
342 lv2:symbol "RELEASE5" ;
343 lv2:name "RELEASE5";
344 lv2:default 1.25 ;
345 lv2:minimum 0.01 ;
346 lv2:maximum 1e+01 ;
347 ] , [
348 a lv2:InputPort ,
349 lv2:ControlPort ;
350 lv2:index 30 ;
351 lv2:symbol "CROSSOVER_B1_B2" ;
352 lv2:name "LOW SHELF";
353 lv2:default 8e+01 ;
354 lv2:minimum 2e+01 ;
355 lv2:maximum 2e+04 ;
356 ] , [
357 a lv2:InputPort ,
358 lv2:ControlPort ;
359 lv2:index 31 ;
360 lv2:symbol "CROSSOVER_B2_B3" ;
361 lv2:name "CROSSOVER_B2_B3";
362 lv2:default 2.1e+02 ;
363 lv2:minimum 2e+01 ;
364 lv2:maximum 2e+04 ;
365 ] , [
366 a lv2:InputPort ,
367 lv2:ControlPort ;
368 lv2:index 32 ;
369 lv2:symbol "CROSSOVER_B3_B4" ;
370 lv2:name "CROSSOVER_B3_B4";
371 lv2:default 1.7e+03 ;
372 lv2:minimum 2e+01 ;
373 lv2:maximum 2e+04 ;
374 ] , [
375 a lv2:InputPort ,
376 lv2:ControlPort ;
377 lv2:index 33 ;
378 lv2:symbol "CROSSOVER_B4_B5" ;
379 lv2:name "CROSSOVER_B4_B5";
380 lv2:default 5e+03 ;
381 lv2:minimum 2e+01 ;
382 lv2:maximum 2e+04 ;
383 ] , [
384 a lv2:ControlPort, lv2:OutputPort ;
385 lv2:index 34 ;
386 lv2:symbol "V1" ;
387 lv2:name "V1";
388 lv2:default 0.0 ;
389 lv2:minimum -70.0 ;
390 lv2:maximum 4.0 ;
391 ] , [
392 a lv2:ControlPort, lv2:OutputPort ;
393 lv2:index 35 ;
394 lv2:symbol "V2" ;
395 lv2:name "V2";
396 lv2:default 0.0 ;
397 lv2:minimum -70.0 ;
398 lv2:maximum 4.0 ;
399 ] , [
400 a lv2:ControlPort, lv2:OutputPort ;
401 lv2:index 36 ;
402 lv2:symbol "V3" ;
403 lv2:name "V3";
404 lv2:default 0.0 ;
405 lv2:minimum -70.0 ;
406 lv2:maximum 4.0 ;
407 ] , [
408 a lv2:ControlPort, lv2:OutputPort ;
409 lv2:index 37 ;
410 lv2:symbol "V4" ;
411 lv2:name "V4";
412 lv2:default 0.0 ;
413 lv2:minimum -70.0 ;
414 lv2:maximum 4.0 ;
415 ] , [
416 a lv2:ControlPort, lv2:OutputPort ;
417 lv2:index 38 ;
418 lv2:symbol "V5" ;
419 lv2:name "V5";
420 lv2:default 0.0 ;
421 lv2:minimum -70.0 ;
422 lv2:maximum 4.0 ;
423 ] , [
424 a lv2:ControlPort, lv2:OutputPort ;
425 lv2:index 39 ;
426 lv2:symbol "V6" ;
427 lv2:name "V6";
428 lv2:default 0.0 ;
429 lv2:minimum -70.0 ;
430 lv2:maximum 4.0 ;
431 ] , [
432 a lv2:ControlPort, lv2:OutputPort ;
433 lv2:index 40 ;
434 lv2:symbol "V7" ;
435 lv2:name "V7";
436 lv2:default 0.0 ;
437 lv2:minimum -70.0 ;
438 lv2:maximum 4.0 ;
439 ] , [
440 a lv2:ControlPort, lv2:OutputPort ;
441 lv2:index 41 ;
442 lv2:symbol "V8" ;
443 lv2:name "V8";
444 lv2:default 0.0 ;
445 lv2:minimum -70.0 ;
446 lv2:maximum 4.0 ;
447 ] , [
448 a lv2:ControlPort, lv2:OutputPort ;
449 lv2:index 42 ;
450 lv2:symbol "V9" ;
451 lv2:name "V9";
452 lv2:default 0.0 ;
453 lv2:minimum -70.0 ;
454 lv2:maximum 4.0 ;
455 ] , [
456 a lv2:ControlPort, lv2:OutputPort ;
457 lv2:index 43 ;
458 lv2:symbol "V10" ;
459 lv2:name "V10";
460 lv2:default 0.0 ;
461 lv2:minimum -70.0 ;
462 lv2:maximum 4.0 ;
463 ] , [
464 a lv2:AudioPort ,
465 lv2:OutputPort ;
466 lv2:index 44 ;
467 lv2:symbol "out" ;
468 lv2:name "Out"
469 ] , [
470 a lv2:AudioPort ,
471 lv2:InputPort ;
472 lv2:index 45 ;
473 lv2:symbol "in" ;
474 lv2:name "In" ;
475 ].
476
477 <http://guitarix.sourceforge.net/plugins/gx_mbcompressor_#gui>
478 a guiext:GtkUI;
479 guiext:binary <gx_mbcompressor_gui.so>;
480 guiext:requiredFeature guiext:makeResident .
481
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include <string>
21 #include <iostream>
22
23 #include <gtkmm.h>
24 #include "gx_mbcompressor.h"
25 #include "widget.h"
26
27
28 #include <lv2.h>
29 #include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
30
31 using namespace std;
32
33 class Gx_mbcompressor_GUI
34 {
35 private:
36 Glib::ustring plugskin;
37 Glib::ustring addKnob;
38 Glib::ustring plug_name;
39 void set_knob(Glib::ustring knob);
40 void set_skin();
41 void set_plug_name(const char * plugin_uri);
42 GtkWidget* make_gui();
43 public:
44
45 Widget* widget;
46 static void set_plug_name_static(Gx_mbcompressor_GUI *self, const char * plugin_uri)
47 {
48 self->set_plug_name(plugin_uri);
49 }
50 static GtkWidget* make_gui_static(Gx_mbcompressor_GUI *self)
51 {
52 return self->make_gui();
53 }
54
55 Gx_mbcompressor_GUI () {};
56 ~Gx_mbcompressor_GUI () {};
57 } ;
58
59 void Gx_mbcompressor_GUI::set_knob( Glib::ustring knob)
60 {
61 addKnob = " style 'gx_";
62 addKnob += plug_name;
63 addKnob += "_dark_skin_icons'\n"
64 " { \n"
65 " stock['bigknob'] = {{'";
66 addKnob += knob;
67 addKnob += ".png'}}\n"
68 " stock['smallknob'] = {{'";
69 addKnob += knob;
70 addKnob += "-small.png'}}\n"
71 " stock['smallknobr'] = {{'";
72 addKnob += knob;
73 addKnob += "-middle.png'}}\n"
74 " stock['button_on'] = {{'"
75 "push-switch-on.png'}}\n"
76 " stock['button_off'] = {{'"
77 "push-switch-off.png'}}\n"
78 " }\n"
79 "widget '*.";
80 addKnob += plug_name;
81 addKnob += "' style 'gx_";
82 addKnob += plug_name;
83 addKnob += "_dark_skin_icons' \n"
84 "class '*GxToggleImage' style'gx_";
85 addKnob += plug_name;
86 addKnob += "_dark_skin_icons' \n";
87 }
88
89 void Gx_mbcompressor_GUI::set_skin()
90 {
91 Glib::ustring toparse = "pixmap_path ";
92 toparse += " '";
93 toparse += GX_LV2_STYLE_DIR;
94 toparse += "/'\n";
95 toparse += "style \"gx_";
96 toparse += plug_name;
97 toparse += "_dark-paintbox\"\n"
98 " { \n"
99 "GxPaintBox::skin-gradient = {\n"
100 "{ 65536, 0, 0, 13107, 52428 }, \n"
101 "{ 52428, 0, 0, 0, 52428 },\n"
102 "{ 13107, 0, 0, 13107, 13107 }}\n"
103 " GxPaintBox::box-gradient = {\n"
104 "{ 0, 61, 61, 61, 62428 }, \n"
105 "{ 22768, 80, 83, 80, 42428 }, \n"
106 "{ 52428, 8, 8, 80, 32428 }, \n"
107 "{ 65536, 4, 4, 4, 52428 }} \n"
108 " GxPaintBox::icon-set =11\n"
109 " }\n"
110 "\n"
111 "style 'gx_head_expander_box' \n"
112 " { \n"
113 " fg[NORMAL] = '#c0c6d0' \n"
114 "font_name = 'sans 7.5 bold' \n"
115 " }\n";
116 toparse += addKnob;
117
118 toparse += " widget '*.amplabel' style:highest 'gx_head_expander_box'\n"
119 "widget '*.";
120 toparse += plug_name;
121 toparse += "' style 'gx_";
122 toparse += plug_name;
123 toparse += "_dark-paintbox' ";
124 toparse += " style 'gx_selector_";
125 toparse += plug_name;
126 toparse += "'\n"
127 " {\n"
128 " fg[NORMAL] = '#c0c6d0'\n"
129 " GtkRange::trough-border = 2\n"
130 " GtkRange::stepper-size = 8\n"
131 " GtkRange::stepper-spacing = 2\n"
132 " GxRegler::value-border = { 2, 2, 2, 2 }\n"
133 " font_name = 'sans 7.5'\n"
134 " xthickness = 10\n"
135 " ythickness = 1\n"
136 " }\n"
137 "widget '*.";
138 toparse += plug_name;
139 toparse += "' style:highest 'gx_selector_";
140 toparse += plug_name;
141 toparse += "'\n";
142 toparse += "style 'gx_switch'\n"
143 "{\n"
144 "xthickness = 0\n"
145 "ythickness = 0\n"
146 "GtkButton::inner-border = {0, 0, 0, 0}\n"
147 "GtkButton::default-border = {0, 0, 0, 0}\n"
148 "GtkButton::focus-line-width = 0\n"
149 "GtkButton::focus-padding = 0\n"
150 "GtkButton::interior-focus = 0\n"
151 "GtkButton::child-displacement-x = 0\n"
152 "GtkButton::child-displacement-y = 0\n"
153 " }\n"
154 "widget '*.";
155 toparse += plug_name;
156 toparse += "' style:highest 'gx_switch'";
157 toparse += "style 'gx_fastmeter'\n"
158 " {\n"
159 " GxFastMeter::clr-bottom = '#003808'\n"
160 " GxFastMeter::clr-middle = '#00ff00'\n"
161 " GxFastMeter::clr-top = '#ff0000'\n"
162 " GxFastMeter::over = '#ff0000'\n"
163 " }\n"
164 " class '*GxFastMeter' style:highest 'gx_fastmeter'\n";
165
166 gtk_rc_parse_string (toparse.c_str());
167 }
168
169 void Gx_mbcompressor_GUI::set_plug_name( const char * plugin_uri)
170 {
171 addKnob = "";
172
173 if (strcmp("http://guitarix.sourceforge.net/plugins/gx_mbcompressor_#_mbcompressor_", plugin_uri) == 0)
174 {
175 plug_name = "_mbcompressor_";
176 set_knob("nm-knob");
177 }
178 else
179 {
180 plug_name = "_mbcompressor_";
181 }
182 }
183
184 GtkWidget* Gx_mbcompressor_GUI::make_gui()
185 {
186 // init the gxwmm library
187 Gxw::init();
188 set_skin();
189 GtkWidget* container = gtk_vbox_new(FALSE, 2);
190 widget = new Widget(plug_name);
191 GtkWidget* cWidget = GTK_WIDGET(widget->gobj());
192 gtk_container_add(GTK_CONTAINER(container), cWidget );
193
194 return container;
195 }
196
197
198 static LV2UI_Handle instantiate(const struct _LV2UI_Descriptor * descriptor,
199 const char * plugin_uri,
200 const char * bundle_path,
201 LV2UI_Write_Function write_function,
202 LV2UI_Controller controller,
203 LV2UI_Widget * widget,
204 const LV2_Feature * const * features)
205 {
206 Gx_mbcompressor_GUI* self = new Gx_mbcompressor_GUI();
207 if (self == NULL) return NULL;
208 self->set_plug_name_static(self, plugin_uri);
209 *widget = (LV2UI_Widget)self->make_gui_static(self);
210 self->widget->controller = controller;
211 self->widget->write_function = write_function;
212 return (LV2UI_Handle)self;
213 }
214
215 static void cleanup(LV2UI_Handle ui)
216 {
217 Gx_mbcompressor_GUI *pluginGui = static_cast<Gx_mbcompressor_GUI*>(ui);
218 delete pluginGui->widget;
219 delete pluginGui;
220 }
221
222 static void port_event(LV2UI_Handle ui,
223 uint32_t port_index,
224 uint32_t buffer_size,
225 uint32_t format,
226 const void * buffer)
227 {
228 Gx_mbcompressor_GUI *self = static_cast<Gx_mbcompressor_GUI*>(ui);
229 self->widget->set_value_static( port_index, buffer_size, format, buffer, self->widget);
230 return;
231 }
232
233 static LV2UI_Descriptor descriptors[] =
234 {
235 {GXPLUGIN_UI_URI, instantiate, cleanup, port_event, NULL}
236 };
237
238 const LV2UI_Descriptor * lv2ui_descriptor(uint32_t index)
239 {
240 //printf("lv2ui_descriptor(%u) called\n", (uint32_t)index);
241 if (index >= sizeof(descriptors) / sizeof(descriptors[0]))
242 {
243 return NULL;
244 }
245 return descriptors + index;
246 }
247
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_mbcompressor_#_mbcompressor_>
23 a lv2:Plugin ;
24 lv2:binary <gx_mbcompressor.so> ;
25 rdfs:seeAlso <gx_mbcompressor.ttl> .
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_mbcompressor_#_mbcompressor_>
23 a lv2:Plugin ;
24 lv2:binary <gx_mbcompressor@LIB_EXT@> ;
25 rdfs:seeAlso <gx_mbcompressor.ttl> .
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include "widget.h"
21
22 #include <iostream>
23
24 #define max(x, y) (((x) > (y)) ? (x) : (y))
25
26 /* @get controller by port
27 * this function is used by make_selector() make_controller_box()
28 * set_value() and on_value_changed()
29 * so controller widgets needs only here asined to a port,
30 * and all functions which need acess to the controller widget pointer
31 * can receive them by port number
32 */
33
34 /*
35 typedef enum
36 {
37 MODE1,
38 MODE2,
39 MODE3,
40 MODE4,
41 MODE5,
42 MAKEUP1,
43 MAKEUP2,
44 MAKEUP3,
45 MAKEUP4,
46 MAKEUP5,
47 MAKEUPTHRESHOLD1,
48 MAKEUPTHRESHOLD2,
49 MAKEUPTHRESHOLD3,
50 MAKEUPTHRESHOLD4,
51 MAKEUPTHRESHOLD5,
52 RATIO1,
53 RATIO2,
54 RATIO3,
55 RATIO4,
56 RATIO5,
57 ATTACK1,
58 ATTACK2,
59 ATTACK3,
60 ATTACK4,
61 ATTACK5,
62 RELEASE1,
63 RELEASE2,
64 RELEASE3,
65 RELEASE4,
66 RELEASE5,
67 CROSSOVER_B1_B2,
68 CROSSOVER_B2_B3,
69 CROSSOVER_B3_B4,
70 CROSSOVER_B4_B5,
71 V1,
72 V2,
73 V3,
74 V4,
75 V5,
76 } PortIndex;
77 */
78
79
80 Gtk::Widget* Widget::get_controller_by_port(uint32_t port_index)
81 {
82 switch ((PortIndex)port_index )
83 {
84 case MAKEUP1:
85 return &m_smallknob[0];
86 case MAKEUP2:
87 return &m_smallknob[1];
88 case MAKEUP3:
89 return &m_smallknob[2];
90 case MAKEUP4:
91 return &m_smallknob[3];
92 case MAKEUP5:
93 return &m_smallknob[4];
94 case MAKEUPTHRESHOLD1:
95 return &m_smallknob[5];
96 case MAKEUPTHRESHOLD2:
97 return &m_smallknob[6];
98 case MAKEUPTHRESHOLD3:
99 return &m_smallknob[7];
100 case MAKEUPTHRESHOLD4:
101 return &m_smallknob[8];
102 case MAKEUPTHRESHOLD5:
103 return &m_smallknob[9];
104
105 case RATIO1:
106 return &m_smallknob[10];
107 case RATIO2:
108 return &m_smallknob[11];
109 case RATIO3:
110 return &m_smallknob[12];
111 case RATIO4:
112 return &m_smallknob[13];
113 case RATIO5:
114 return &m_smallknob[14];
115
116 case ATTACK1:
117 return &m_smallknob[15];
118 case ATTACK2:
119 return &m_smallknob[16];
120 case ATTACK3:
121 return &m_smallknob[17];
122 case ATTACK4:
123 return &m_smallknob[18];
124 case ATTACK5:
125 return &m_smallknob[19];
126
127 case RELEASE1:
128 return &m_smallknob[20];
129 case RELEASE2:
130 return &m_smallknob[21];
131 case RELEASE3:
132 return &m_smallknob[22];
133 case RELEASE4:
134 return &m_smallknob[23];
135 case RELEASE5:
136 return &m_smallknob[24];
137
138 case MODE1:
139 return &select[0];
140 case MODE2:
141 return &select[1];
142 case MODE3:
143 return &select[2];
144 case MODE4:
145 return &select[3];
146 case MODE5:
147 return &select[4];
148
149 case CROSSOVER_B1_B2:
150 return &m_smallknob[25];
151 case CROSSOVER_B2_B3:
152 return &m_smallknob[26];
153 case CROSSOVER_B3_B4:
154 return &m_smallknob[27];
155 case CROSSOVER_B4_B5:
156 return &m_smallknob[28];
157 default:
158 return NULL;
159 }
160 }
161
162 Widget::Widget(Glib::ustring plugname):
163 plug_name(plugname)
164 {
165 m_fr[0].set_label("BAND 1");
166 m_fr[0].add(m_lbox[0]);
167 m_fr[1].set_label("BAND 2");
168 m_fr[1].add(m_lbox[1]);
169 m_fr[2].set_label("BAND 3");
170 m_fr[2].add(m_lbox[2]);
171 m_fr[3].set_label("BAND 4");
172 m_fr[3].add(m_lbox[3]);
173 m_fr[4].set_label("BAND 5");
174 m_fr[4].add(m_lbox[4]);
175 m_fr[5].set_label("BAND PASS");
176
177 // create controllers for port name
178
179 make_controller_box(&m_vbox[1], "RATIO ",
180 "Compression ratio", 1.0, 1e+02, 0.1, RATIO1, false);
181 make_controller_box(&m_vbox[2], "RATIO ",
182 "Compression ratio", 1.0, 1e+02, 0.1, RATIO2, false);
183 make_controller_box(&m_vbox[3], "RATIO ",
184 "Compression ratio", 1.0, 1e+02, 0.1, RATIO3, false);
185 make_controller_box(&m_vbox[4], "RATIO ",
186 "Compression ratio", 1.0, 1e+02, 0.1, RATIO4, false);
187 make_controller_box(&m_vbox[5], "RATIO ",
188 "Compression ratio", 1.0, 1e+02, 0.1, RATIO5, false);
189
190 make_controller_box(&m_vbox[1], "ATTACK ",
191 "Time before the compressor starts to kick in", 0.001, 1.0, 0.001, ATTACK1, false);
192 make_controller_box(&m_vbox[2], "ATTACK ",
193 "Time before the compressor starts to kick in", 0.001, 1.0, 0.001, ATTACK2, false);
194 make_controller_box(&m_vbox[3], "ATTACK ",
195 "Time before the compressor starts to kick in", 0.001, 1.0, 0.001, ATTACK3, false);
196 make_controller_box(&m_vbox[4], "ATTACK ",
197 "Time before the compressor starts to kick in", 0.001, 1.0, 0.001, ATTACK4, false);
198 make_controller_box(&m_vbox[5], "ATTACK ",
199 "Time before the compressor starts to kick in", 0.001, 1.0, 0.001, ATTACK5, false);
200
201 make_controller_box(&m_vbox[1], "RELEASE ",
202 "Time before the compressor releases the sound", 0.01, 1e+01, 0.01, RELEASE1, false);
203 make_controller_box(&m_vbox[2], "RELEASE ",
204 "Time before the compressor releases the sound", 0.01, 1e+01, 0.01, RELEASE2, false);
205 make_controller_box(&m_vbox[3], "RELEASE ",
206 "Time before the compressor releases the sound", 0.01, 1e+01, 0.01, RELEASE3, false);
207 make_controller_box(&m_vbox[4], "RELEASE ",
208 "Time before the compressor releases the sound", 0.01, 1e+01, 0.01, RELEASE4, false);
209 make_controller_box(&m_vbox[5], "RELEASE ",
210 "Time before the compressor releases the sound", 0.01, 1e+01, 0.01, RELEASE5, false);
211
212 make_controller_box(&m_vbox[1], "MAKEUP",
213 "Post amplification and threshold", -5e+01, 5e+01, 0.1, MAKEUP1, false);
214 make_controller_box(&m_vbox[2], "MAKEUP",
215 "Post amplification and threshold", -5e+01, 5e+01, 0.1, MAKEUP2, false);
216 make_controller_box(&m_vbox[3], "MAKEUP",
217 "Post amplification and threshold", -5e+01, 5e+01, 0.1, MAKEUP3, false);
218 make_controller_box(&m_vbox[4], "MAKEUP",
219 "Post amplification and threshold", -5e+01, 5e+01, 0.1, MAKEUP4, false);
220 make_controller_box(&m_vbox[5], "MAKEUP",
221 "Post amplification and threshold", -5e+01, 5e+01, 0.1, MAKEUP5, false);
222
223 make_controller_box(&m_vbox[1], "THRESHOLD ",
224 "Threshold correction, an anticlip measure", 0.0, 1e+01, 0.1, MAKEUPTHRESHOLD1, false);
225 make_controller_box(&m_vbox[2], "THRESHOLD ",
226 "Threshold correction, an anticlip measure", 0.0, 1e+01, 0.1, MAKEUPTHRESHOLD2, false);
227 make_controller_box(&m_vbox[3], "THRESHOLD ",
228 "Threshold correction, an anticlip measure", 0.0, 1e+01, 0.1, MAKEUPTHRESHOLD3, false);
229 make_controller_box(&m_vbox[4], "THRESHOLD ",
230 "Threshold correction, an anticlip measure", 0.0, 1e+01, 0.1, MAKEUPTHRESHOLD4, false);
231 make_controller_box(&m_vbox[5], "THRESHOLD ",
232 "Threshold correction, an anticlip measure", 0.0, 1e+01, 0.1, MAKEUPTHRESHOLD5, false);
233
234 Glib::ustring modes[] = {"Compress","Bypass","Mute"};
235 static const size_t _size = sizeof(modes) / sizeof(modes[0]);
236 make_selector(&m_vbox[1],"Compress or Mute the selected band, or Bypass The Compressor", modes, _size, 1.0, 1.0, MODE1);
237 make_selector(&m_vbox[2],"Compress or Mute the selected band, or Bypass The Compressor", modes, _size, 1.0, 1.0, MODE2);
238 make_selector(&m_vbox[3],"Compress or Mute the selected band, or Bypass The Compressor", modes, _size, 1.0, 1.0, MODE3);
239 make_selector(&m_vbox[4],"Compress or Mute the selected band, or Bypass The Compressor", modes, _size, 1.0, 1.0, MODE4);
240 make_selector(&m_vbox[5],"Compress or Mute the selected band, or Bypass The Compressor", modes, _size, 1.0, 1.0, MODE5);
241
242
243 make_controller_box(&m_vbox[7], "LOW PASS \n B1><B2", "Crossfrequency between Band1 and Band2",
244 2e+01, 2e+04, 1.08 , CROSSOVER_B1_B2, true);
245 make_controller_box(&m_vbox[8], "CROSSOVER \n B2><B3", "Crossfrequency between Band2 and Band3",
246 2e+01, 2e+04, 1.08 , CROSSOVER_B2_B3, true);
247 make_controller_box(&m_vbox[9], "CROSSOVER \n B3><B4 ", "Crossfrequency between Band3 and Band4",
248 2e+01, 2e+04, 1.08 , CROSSOVER_B3_B4, true);
249 make_controller_box(&m_vbox[10], "HIGH PASS \n B4><B5", "Crossfrequency between Band4 and Band5",
250 2e+01, 2e+04, 1.08 , CROSSOVER_B4_B5, true);
251
252 // set propertys for the main paintbox holding the skin
253 m_paintbox[0].set_border_width(10);
254 m_paintbox[0].set_spacing(6);
255 m_paintbox[0].set_homogeneous(false);
256 m_paintbox[0].set_name(plug_name);
257 m_paintbox[0].property_paint_func() = "gxhead_expose";
258 add(m_paintbox[0]);
259
260 // set propertys and stack fastmeters
261 for (uint32_t i = 0;i<5;i++) {
262 fastmeter[i].set_hold_count(12);
263 fastmeter[i].set_property("dimen",5);
264 fastmeter[i].set_tooltip_text("Output");
265 fastmeter[i+5].set_hold_count(12);
266 fastmeter[i+5].set_property("dimen",5);
267 fastmeter[i+5].set_tooltip_text("Input");
268 m_paintbox[i+1].property_paint_func() = "RackBox_expose";
269 m_paintbox[i+1].set_name(plug_name);
270 m_paintbox[i+1].set_border_width(5);
271 m_paintbox[i+1].set_spacing(2);
272 m_paintbox[i+1].pack_start(fastmeter[i+5]);
273 m_paintbox[i+1].pack_start(fastmeter[i]);
274 }
275
276 // set a vertical box in the paintbox
277 m_vbox[11].set_border_width(14);
278 m_vbox[12].set_border_width(14);
279 m_hbox[2].set_border_width(4);
280 m_paintbox[0].pack_start(m_vbox[0]);
281 // box for the controllers
282 m_hbox[0].set_spacing(4);
283 m_hbox[0].set_border_width(4);
284 m_hbox[0].set_homogeneous(false);
285 m_vbox[0].pack_start(m_hbox[0]);
286 m_fr[5].add(m_hbox[1]);
287 m_vbox[0].pack_start(m_fr[5]);
288 m_vbox[0].pack_start(m_hbox[2]);
289 // put boxed controllers into controller box
290 m_hbox[0].pack_start(m_vbox[11], Gtk::PACK_EXPAND_PADDING);
291 m_hbox[0].pack_start(m_fr[0]);
292 m_lbox[0].pack_start(m_vbox[1]);
293 m_lbox[0].pack_start(m_paintbox[1],Gtk::PACK_SHRINK);
294 m_hbox[0].pack_start(m_fr[1]);
295 m_lbox[1].pack_start(m_vbox[2]);
296 m_lbox[1].pack_start(m_paintbox[2],Gtk::PACK_SHRINK);
297 m_hbox[0].pack_start(m_fr[2]);
298 m_lbox[2].pack_start(m_vbox[3]);
299 m_lbox[2].pack_start(m_paintbox[3],Gtk::PACK_SHRINK);
300 m_hbox[0].pack_start(m_fr[3]);
301 m_lbox[3].pack_start(m_vbox[4]);
302 m_lbox[3].pack_start(m_paintbox[4],Gtk::PACK_SHRINK);
303 m_hbox[0].pack_start(m_fr[4]);
304 m_lbox[4].pack_start(m_vbox[5]);
305 m_lbox[4].pack_start(m_paintbox[5],Gtk::PACK_SHRINK);
306 m_hbox[0].pack_start(m_vbox[12], Gtk::PACK_EXPAND_PADDING);
307 // put boxed controllers into controller box
308 m_hbox[1].pack_start(m_vbox[13], Gtk::PACK_EXPAND_PADDING);
309 m_hbox[1].pack_start(m_vbox[7]);
310 m_hbox[1].pack_start(m_vbox[8]);
311 m_hbox[1].pack_start(m_vbox[9]);
312 m_hbox[1].pack_start(m_vbox[10]);
313 m_hbox[1].pack_start(m_vbox[15]);
314 m_hbox[1].pack_start(m_vbox[14], Gtk::PACK_EXPAND_PADDING);
315 // default disable tooltips
316 gtk_settings_set_long_property(
317 gtk_settings_get_default(), "gtk-enable-tooltips", false, "gx_mbcompressor");
318 make_switch_box(&m_vbox[15], "Tooltips");
319 m_switch.signal_toggled().connect(sigc::mem_fun(
320 *this, &Widget::set_tooltips));
321
322 set_app_paintable(true);
323 show_all();
324 }
325
326 Widget::~Widget()
327 {
328
329 }
330
331 // create selectors from gxwmm
332 void Widget::make_selector(Gtk::Box *box,
333 Glib::ustring labela,
334 Glib::ustring tables[],
335 size_t _size,
336 float min, float digits,
337 PortIndex port_name)
338 {
339 Gxw::Selector *regler = static_cast<Gxw::Selector*>
340 (get_controller_by_port(port_name));
341 if (regler)
342 {
343 float max = static_cast<float>(_size+2);
344
345 Gtk::TreeModelColumn<Glib::ustring> label;
346 Gtk::TreeModelColumnRecord rec;
347 rec.add(label);
348 Glib::RefPtr<Gtk::ListStore> ls = Gtk::ListStore::create(rec);
349
350 for (uint32_t i = 0 ; i< _size; ++i) {
351 ls->append()->set_value(0, tables[i]);
352 }
353 regler->set_model(ls);
354 regler->set_has_tooltip();
355 regler->set_tooltip_text(labela);
356 regler->cp_configure("SELECTOR", labela, min, max, digits);
357 regler->set_show_value(false);
358 regler->set_name(plug_name);
359 regler->signal_value_changed().connect(sigc::bind(sigc::mem_fun(
360 *this, &Widget::on_value_changed), port_name));
361 box->pack_start(*regler,Gtk::PACK_SHRINK);
362 }
363 }
364
365 // create stackboxes with controllers for port name
366 void Widget::make_controller_box(Gtk::Box *box,
367 Glib::ustring label,
368 Glib::ustring labela,
369 float min, float max,
370 float digits,
371 PortIndex port_name,
372 bool show_value)
373 {
374 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
375 get_controller_by_port(port_name));
376 if (regler)
377 {
378 Gtk::Label* pr = new Gtk::Label(label, 0);
379 pr->set_name("amplabel");
380 Gtk::VBox* b1 = new Gtk::VBox();
381 box->pack_start( *Gtk::manage(b1), Gtk::PACK_EXPAND_PADDING);
382 box->pack_start( *Gtk::manage(pr),Gtk::PACK_SHRINK);
383 regler->cp_configure("KNOB", label, min, max, digits);
384 regler->set_show_value(show_value);
385 regler->set_name(plug_name);
386 regler->set_tooltip_text(labela);
387 box->pack_start(*regler,Gtk::PACK_SHRINK);
388 Gtk::VBox* b2 = new Gtk::VBox();
389 box->pack_start( *Gtk::manage(b2), Gtk::PACK_EXPAND_PADDING);
390 regler->signal_value_changed().connect(sigc::bind(sigc::mem_fun(
391 *this, &Widget::on_value_changed), port_name));
392 }
393 }
394
395 // create stackboxes with switch controller for internal use only
396 void Widget::make_switch_box(Gtk::Box *box, Glib::ustring label)
397 {
398 Gxw::Switch *regler = static_cast<Gxw::Switch*>( &m_switch);
399 if (regler)
400 {
401 Gtk::Label* pr = new Gtk::Label(label, 0);
402 pr->set_name("amplabel");
403 regler->cp_configure("switch", label, 0, 1, 1);
404 regler->set_name(plug_name);
405 regler->set_base_name( "button" );
406 Gtk::VBox* b1 = new Gtk::VBox();
407 box->pack_start( *Gtk::manage(b1), Gtk::PACK_EXPAND_PADDING);
408 box->pack_start( *Gtk::manage(pr),Gtk::PACK_SHRINK);
409 box->pack_start(*regler,Gtk::PACK_SHRINK);
410 Gtk::VBox* b2 = new Gtk::VBox();
411 box->pack_start( *Gtk::manage(b2), Gtk::PACK_EXPAND_PADDING);
412 }
413 }
414
415 // receive controller value changes from host and set them to controller
416 void Widget::set_value(uint32_t port_index,
417 uint32_t format,
418 const void * buffer)
419 {
420 if ( format == 0 )
421 {
422 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
423 get_controller_by_port(port_index));
424 float value = *static_cast<const float*>(buffer);
425 if (regler) regler->cp_set_value(value);
426 if (port_index == V1) refresh_meter_level(0,value);
427 else if (port_index == V2) refresh_meter_level(1,value);
428 else if (port_index == V3) refresh_meter_level(2,value);
429 else if (port_index == V4) refresh_meter_level(3,value);
430 else if (port_index == V5) refresh_meter_level(4,value);
431 else if (port_index == V6) refresh_meter_level(5,value);
432 else if (port_index == V7) refresh_meter_level(6,value);
433 else if (port_index == V8) refresh_meter_level(7,value);
434 else if (port_index == V9) refresh_meter_level(8,value);
435 else if (port_index == V10) refresh_meter_level(9,value);
436 }
437 }
438
439 // write (UI) controller value changes to the host->engine
440 void Widget::on_value_changed(uint32_t port_index)
441 {
442 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
443 get_controller_by_port(port_index));
444 if (regler)
445 {
446 float value = regler->cp_get_value();
447 write_function(controller, port_index, sizeof(float), 0,
448 static_cast<const void*>(&value));
449 }
450 }
451
452 void Widget::refresh_meter_level(int m, float new_level) {
453 fastmeter[m].set_by_power(new_level);
454 }
455
456 void Widget::set_tooltips() {
457 gtk_settings_set_long_property(
458 gtk_settings_get_default(), "gtk-enable-tooltips", m_switch.get_active(), "gx_mbcompressor");
459 }
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_WIDGET_H_
22 #define SRC_HEADERS_WIDGET_H_
23
24 #include <gtkmm.h>
25 #include <gxwmm.h>
26 #include "gx_mbcompressor.h"
27 #include "../config.h" // for GX_STYLE_DIR
28 // LV2UI stuff
29 #include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
30
31 class Widget : public Gtk::HBox
32 {
33 private:
34 Gtk::Widget* get_controller_by_port(uint32_t port_index);
35 void refresh_meter_level(int meter,float new_level);
36 void set_tooltips();
37 void on_value_changed(uint32_t port_index);
38
39 void make_controller_box(Gtk::Box *box,
40 Glib::ustring label,
41 Glib::ustring labela,
42 float min, float max,
43 float digits,
44 PortIndex port_name,
45 bool show_value);
46
47
48 void make_selector(Gtk::Box *box,
49 Glib::ustring label,
50 Glib::ustring tables[],
51 size_t _size,
52 float min, float digits,
53 PortIndex port_name);
54
55 void make_switch_box(Gtk::Box *box,
56 Glib::ustring label);
57
58 void set_value(uint32_t port_index,
59 uint32_t format,
60 const void * buffer);
61 public:
62
63 // public Lv2 communication stuff
64 LV2UI_Controller controller;
65 LV2UI_Write_Function write_function;
66 static void set_value_static(uint32_t port_index,
67 uint32_t buffer_size,
68 uint32_t format,
69 const void * buffer, Widget *self)
70 {
71 self->set_value(port_index,format,buffer);
72 }
73
74 Widget(Glib::ustring plugname);
75 ~Widget();
76
77 protected:
78 Glib::ustring plug_name;
79 Gtk::VBox m_vbox[16];
80 Gtk::HBox m_hbox[3];
81 Gtk::HBox m_lbox[5];
82 Gtk::Frame m_fr[6];
83
84 Gxw::Switch m_switch;
85 Gxw::Selector select[5];
86 Gxw::SmallKnob m_smallknob[29];
87 Gxw::FastMeter fastmeter[10];
88 Gxw::PaintBox m_paintbox[6];
89 };
90
91 #endif //SRC_HEADERS_WIDGET_H_
0 #!/usr/bin/env python
1 # encoding: utf-8
2
3 import sys, os, TaskGen, ctypes
4
5 def configure(conf):
6 pass
7
8 def build(bld):
9 bundle = 'gx_mbcompressor.lv2'
10
11 src = ['gx_mbcompressor.cpp'
12 ]
13 incl = ['../faust','./', '../DSP']
14 lib = []
15 if sys.platform.startswith("linux"):
16 lib.append('dl')
17 uselib = ['LV2CORE']
18 cxxflag =[]
19 if not bld.env['OPT'] and bld.env['SSE2']:
20 cxxflag = [ "-msse2", "-mfpmath=sse"]
21 lv2_effects = bld(
22 features='cxx cshlib ',
23 includes = incl,
24 lib = lib,
25 uselib = uselib,
26 obj_ext = '_14.o',
27 cxxflags = cxxflag,
28 defines = ["LV2_SO"],
29 target = 'gx_mbcompressor',
30 source = src,
31 install_path = '${LV2DIR}/%s' % bundle,
32 chmod = 0o755,
33 )
34 lv2_effects.env['shlib_PATTERN'] = '%s.so'
35
36 uselib_local5 = []
37 libpath5 = []
38 lib5 = []
39 incl5 = ['../../../libgxwmm','../../../libgxw','../']
40 if sys.platform.startswith("linux"):
41 lib5.append('dl')
42 if bld.env["GX_LIB_SHARED"]:
43 lib5 += ['gxwmm','gxw']
44 libpath5 += [bld.path.find_dir("../../../libgxw/gxw").bldpath(bld.env),
45 bld.path.find_dir("../../../libgxwmm/gxwmm").bldpath(bld.env)]
46 else:
47 uselib_local5 += ['gxwmm','gxw']
48
49 lv2_effetcs_gui = bld(
50 features='cxx cshlib ',
51 includes = incl5,
52 lib = lib5,
53 uselib = 'LV2CORE GTKMM',
54 libpath = libpath5,
55 uselib_local = uselib_local5,
56 linkflags = '-Wl,-z,nodelete',
57 defines = ["LV2_GUI"],
58 target = 'gx_mbcompressor_gui',
59 source = 'widget.cpp gx_mbcompressor_gui.cpp',
60 install_path = '${LV2DIR}/%s' % bundle,
61 chmod = 0o755,
62 )
63 lv2_effetcs_gui.env['shlib_PATTERN'] = '%s.so'
64
65
66 install_path = '${LV2DIR}/%s' % bundle,
67 bld.install_files('${LV2DIR}/gx_mbcompressor.lv2', 'manifest.ttl')
68 bld.install_files('${LV2DIR}/gx_mbcompressor.lv2', 'gx_mbcompressor.ttl')
69
70 bld.install_files('${LV2DIR}/gx_mbcompressor.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 ////////////////////////////// LOCAL INCLUDES //////////////////////////
21
22 #include "gx_common.h" // faust support and denormal protection (SSE)
23 #include "gx_mbdelay.h" // define struct PortIndex
24 #include "gx_pluginlv2.h" // define struct PluginLV2
25 #include "mbdel.cc" // dsp class generated by faust -> dsp2cc
26
27 ////////////////////////////// PLUG-IN CLASS ///////////////////////////
28
29 class Gx_mbdelay_
30 {
31 private:
32 // pointer to buffer
33 float* output;
34 float* input;
35 // pointer to dsp class
36 PluginLV2* mbdelay;
37 // private functions
38 inline void run_dsp_(uint32_t n_samples);
39 inline void connect_(uint32_t port,void* data);
40 inline void init_dsp_(uint32_t rate);
41 inline void connect_all__ports(uint32_t port, void* data);
42 inline void activate_f();
43 inline void clean_up();
44 inline void deactivate_f();
45
46 public:
47 // LV2 Descriptor
48 static const LV2_Descriptor descriptor;
49 // static wrapper to private functions
50 static void deactivate(LV2_Handle instance);
51 static void cleanup(LV2_Handle instance);
52 static void run(LV2_Handle instance, uint32_t n_samples);
53 static void activate(LV2_Handle instance);
54 static void connect_port(LV2_Handle instance, uint32_t port, void* data);
55 static LV2_Handle instantiate(const LV2_Descriptor* descriptor,
56 double rate, const char* bundle_path,
57 const LV2_Feature* const* features);
58 Gx_mbdelay_();
59 ~Gx_mbdelay_();
60 };
61
62 // constructor
63 Gx_mbdelay_::Gx_mbdelay_() :
64 output(NULL),
65 input(NULL),
66 mbdelay(mbdel::plugin()) {};
67
68 // destructor
69 Gx_mbdelay_::~Gx_mbdelay_()
70 {
71 // just to be sure the plug have given free the allocated mem
72 // it didn't hurd if the mem is already given free by clean_up()
73 if (mbdelay->activate_plugin !=0)
74 mbdelay->activate_plugin(false, mbdelay);
75 // delete DSP class
76 mbdelay->delete_instance(mbdelay);
77 };
78
79 ///////////////////////// PRIVATE CLASS FUNCTIONS /////////////////////
80
81 void Gx_mbdelay_::init_dsp_(uint32_t rate)
82 {
83 AVOIDDENORMALS(); // init the SSE denormal protection
84 mbdelay->set_samplerate(rate, mbdelay); // init the DSP class
85 }
86
87 // connect the Ports used by the plug-in class
88 void Gx_mbdelay_::connect_(uint32_t port,void* data)
89 {
90 switch ((PortIndex)port)
91 {
92 case EFFECTS_OUTPUT:
93 output = static_cast<float*>(data);
94 break;
95 case EFFECTS_INPUT:
96 input = static_cast<float*>(data);
97 break;
98 default:
99 break;
100 }
101 }
102
103 void Gx_mbdelay_::activate_f()
104 {
105 // allocate the internal DSP mem
106 if (mbdelay->activate_plugin !=0)
107 mbdelay->activate_plugin(true, mbdelay);
108 }
109
110 void Gx_mbdelay_::clean_up()
111 {
112 // delete the internal DSP mem
113 if (mbdelay->activate_plugin !=0)
114 mbdelay->activate_plugin(false, mbdelay);
115 }
116
117 void Gx_mbdelay_::deactivate_f()
118 {
119 // delete the internal DSP mem
120 if (mbdelay->activate_plugin !=0)
121 mbdelay->activate_plugin(false, mbdelay);
122 }
123
124 void Gx_mbdelay_::run_dsp_(uint32_t n_samples)
125 {
126 mbdelay->mono_audio(static_cast<int>(n_samples), input, output, mbdelay);
127 }
128
129 void Gx_mbdelay_::connect_all__ports(uint32_t port, void* data)
130 {
131 // connect the Ports used by the plug-in class
132 connect_(port,data);
133 // connect the Ports used by the DSP class
134 mbdelay->connect_ports(port, data, mbdelay);
135 }
136
137 ////////////////////// STATIC CLASS FUNCTIONS ////////////////////////
138
139 LV2_Handle
140 Gx_mbdelay_::instantiate(const LV2_Descriptor* descriptor,
141 double rate, const char* bundle_path,
142 const LV2_Feature* const* features)
143 {
144 // init the plug-in class
145 Gx_mbdelay_ *self = new Gx_mbdelay_();
146 if (!self)
147 {
148 return NULL;
149 }
150
151 self->init_dsp_((uint32_t)rate);
152
153 return (LV2_Handle)self;
154 }
155
156 void Gx_mbdelay_::connect_port(LV2_Handle instance,
157 uint32_t port, void* data)
158 {
159 // connect all ports
160 static_cast<Gx_mbdelay_*>(instance)->connect_all__ports(port, data);
161 }
162
163 void Gx_mbdelay_::activate(LV2_Handle instance)
164 {
165 // allocate needed mem
166 static_cast<Gx_mbdelay_*>(instance)->activate_f();
167 }
168
169 void Gx_mbdelay_::run(LV2_Handle instance, uint32_t n_samples)
170 {
171 // run dsp
172 static_cast<Gx_mbdelay_*>(instance)->run_dsp_(n_samples);
173 }
174
175 void Gx_mbdelay_::deactivate(LV2_Handle instance)
176 {
177 // free allocated mem
178 static_cast<Gx_mbdelay_*>(instance)->deactivate_f();
179 }
180
181 void Gx_mbdelay_::cleanup(LV2_Handle instance)
182 {
183 // well, clean up after us
184 Gx_mbdelay_* self = static_cast<Gx_mbdelay_*>(instance);
185 self->clean_up();
186 delete self;
187 }
188
189 const LV2_Descriptor Gx_mbdelay_::descriptor =
190 {
191 GXPLUGIN_URI "#_mbdelay_",
192 Gx_mbdelay_::instantiate,
193 Gx_mbdelay_::connect_port,
194 Gx_mbdelay_::activate,
195 Gx_mbdelay_::run,
196 Gx_mbdelay_::deactivate,
197 Gx_mbdelay_::cleanup,
198 NULL
199 };
200
201 ////////////////////////// LV2 SYMBOL EXPORT ///////////////////////////
202
203 extern "C"
204 LV2_SYMBOL_EXPORT
205 const LV2_Descriptor*
206 lv2_descriptor(uint32_t index)
207 {
208 switch (index)
209 {
210 case 0:
211 return &Gx_mbdelay_::descriptor;
212 default:
213 return NULL;
214 }
215 }
216
217 ///////////////////////////// FIN //////////////////////////////////////
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_GXEFFECTS_H_
22 #define SRC_HEADERS_GXEFFECTS_H_
23
24 #include <lv2.h>
25
26 #define GXPLUGIN_URI "http://guitarix.sourceforge.net/plugins/gx_mbdelay_"
27 #define GXPLUGIN_UI_URI "http://guitarix.sourceforge.net/plugins/gx_mbdelay_#gui"
28
29
30 typedef enum
31 {
32 DELAY1,
33 DELAY2,
34 DELAY3,
35 DELAY4,
36 DELAY5,
37 GAIN1,
38 GAIN2,
39 GAIN3,
40 GAIN4,
41 GAIN5,
42 CROSSOVER_B1_B2,
43 CROSSOVER_B2_B3,
44 CROSSOVER_B3_B4,
45 CROSSOVER_B4_B5,
46 V1,
47 V2,
48 V3,
49 V4,
50 V5,
51 EFFECTS_OUTPUT,
52 EFFECTS_INPUT,
53 } PortIndex;
54
55 #endif //SRC_HEADERS_GXEFFECTS_H_
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19
20 @prefix doap: <http://usefulinc.com/ns/doap#> .
21 @prefix foaf: <http://xmlns.com/foaf/0.1/> .
22 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
23 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
24 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
25 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26
27 <http://guitarix.sourceforge.net#me>
28 a foaf:Person ;
29 foaf:name "Guitarix team" ;
30 foaf:mbox <mailto:brummer@web.de> ;
31 rdfs:seeAlso <http://guitarix.sourceforge.net> .
32
33 <http://guitarix.sourceforge.net/plugins/gx_mbdelay_>
34 a doap:Project ;
35 doap:maintainer <http://guitarix.sourceforge.net#me> ;
36 doap:name "Gx_mbdelay_" .
37
38 <http://guitarix.sourceforge.net/plugins/gx_mbdelay_#_mbdelay_>
39 a lv2:Plugin ,
40 lv2:DelayPlugin ;
41 doap:maintainer <http://guitarix.sourceforge.net#me> ;
42 doap:name "GxMultiBandDelay";
43 doap:license <http://opensource.org/licenses/isc> ;
44 lv2:project <http://guitarix.sourceforge.net/plugins/gx_mbdelay_> ;
45 lv2:optionalFeature lv2:hardRTCapable ;
46
47 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_mbdelay_#gui>;
48
49 lv2:minorVersion 28;
50 lv2:microVersion 3;
51
52 lv2:port [
53 a lv2:InputPort ,
54 lv2:ControlPort ;
55 lv2:index 0 ;
56 lv2:symbol "DELAY1" ;
57 lv2:name "DELAY1";
58 lv2:default 3e+01 ;
59 lv2:minimum 24.0 ;
60 lv2:maximum 3.6e+02 ;
61 ] , [
62 a lv2:InputPort ,
63 lv2:ControlPort ;
64 lv2:index 1 ;
65 lv2:symbol "DELAY2" ;
66 lv2:name "DELAY2";
67 lv2:default 6e+01 ;
68 lv2:minimum 24.0 ;
69 lv2:maximum 3.6e+02 ;
70 ] , [
71 a lv2:InputPort ,
72 lv2:ControlPort ;
73 lv2:index 2 ;
74 lv2:symbol "DELAY3" ;
75 lv2:name "DELAY3";
76 lv2:default 9e+01 ;
77 lv2:minimum 24.0 ;
78 lv2:maximum 3.6e+02 ;
79 ] , [
80 a lv2:InputPort ,
81 lv2:ControlPort ;
82 lv2:index 3 ;
83 lv2:symbol "DELAY4" ;
84 lv2:name "DELAY4";
85 lv2:default 1.2e+02 ;
86 lv2:minimum 24.0 ;
87 lv2:maximum 3.6e+02 ;
88 ] , [
89 a lv2:InputPort ,
90 lv2:ControlPort ;
91 lv2:index 4 ;
92 lv2:symbol "DELAY5" ;
93 lv2:name "DELAY5";
94 lv2:default 1.5e+02 ;
95 lv2:minimum 24.0 ;
96 lv2:maximum 3.6e+02 ;
97 ] , [
98 a lv2:InputPort ,
99 lv2:ControlPort ;
100 lv2:index 5 ;
101 lv2:symbol "GAIN1" ;
102 lv2:name "GAIN1";
103 lv2:default -1e+01 ;
104 lv2:minimum -4e+01 ;
105 lv2:maximum 2.0 ;
106 ] , [
107 a lv2:InputPort ,
108 lv2:ControlPort ;
109 lv2:index 6 ;
110 lv2:symbol "GAIN2" ;
111 lv2:name "GAIN2";
112 lv2:default -5.0 ;
113 lv2:minimum -4e+01 ;
114 lv2:maximum 2.0 ;
115 ] , [
116 a lv2:InputPort ,
117 lv2:ControlPort ;
118 lv2:index 7 ;
119 lv2:symbol "GAIN3" ;
120 lv2:name "GAIN3";
121 lv2:default -2.0 ;
122 lv2:minimum -4e+01 ;
123 lv2:maximum 2.0 ;
124 ] , [
125 a lv2:InputPort ,
126 lv2:ControlPort ;
127 lv2:index 8 ;
128 lv2:symbol "GAIN4" ;
129 lv2:name "GAIN4";
130 lv2:default 0.0 ;
131 lv2:minimum -4e+01 ;
132 lv2:maximum 2.0 ;
133 ] , [
134 a lv2:InputPort ,
135 lv2:ControlPort ;
136 lv2:index 9 ;
137 lv2:symbol "GAIN5" ;
138 lv2:name "GAIN5";
139 lv2:default -1e+01 ;
140 lv2:minimum -4e+01 ;
141 lv2:maximum 2.0 ;
142 ] , [
143 a lv2:InputPort ,
144 lv2:ControlPort ;
145 lv2:index 10 ;
146 lv2:symbol "CROSSOVER_B1_B2" ;
147 lv2:name "LOW SHELF";
148 lv2:default 8e+01 ;
149 lv2:minimum 2e+01 ;
150 lv2:maximum 2e+04 ;
151 ] , [
152 a lv2:InputPort ,
153 lv2:ControlPort ;
154 lv2:index 11 ;
155 lv2:symbol "CROSSOVER_B2_B3" ;
156 lv2:name "CROSSOVER_B2_B3";
157 lv2:default 2.1e+02 ;
158 lv2:minimum 2e+01 ;
159 lv2:maximum 2e+04 ;
160 ] , [
161 a lv2:InputPort ,
162 lv2:ControlPort ;
163 lv2:index 12 ;
164 lv2:symbol "CROSSOVER_B3_B4" ;
165 lv2:name "CROSSOVER_B3_B4";
166 lv2:default 1.7e+03 ;
167 lv2:minimum 2e+01 ;
168 lv2:maximum 2e+04 ;
169 ] , [
170 a lv2:InputPort ,
171 lv2:ControlPort ;
172 lv2:index 13 ;
173 lv2:symbol "CROSSOVER_B4_B5" ;
174 lv2:name "CROSSOVER_B4_B5";
175 lv2:default 5e+03 ;
176 lv2:minimum 2e+01 ;
177 lv2:maximum 2e+04 ;
178 ] , [
179 a lv2:ControlPort, lv2:OutputPort ;
180 lv2:index 14 ;
181 lv2:symbol "V1" ;
182 lv2:name "V1";
183 lv2:default 0.0 ;
184 lv2:minimum -70.0 ;
185 lv2:maximum 4.0 ;
186 ] , [
187 a lv2:ControlPort, lv2:OutputPort ;
188 lv2:index 15 ;
189 lv2:symbol "V2" ;
190 lv2:name "V2";
191 lv2:default 0.0 ;
192 lv2:minimum -70.0 ;
193 lv2:maximum 4.0 ;
194 ] , [
195 a lv2:ControlPort, lv2:OutputPort ;
196 lv2:index 16 ;
197 lv2:symbol "V3" ;
198 lv2:name "V3";
199 lv2:default 0.0 ;
200 lv2:minimum -70.0 ;
201 lv2:maximum 4.0 ;
202 ] , [
203 a lv2:ControlPort, lv2:OutputPort ;
204 lv2:index 17 ;
205 lv2:symbol "V4" ;
206 lv2:name "V4";
207 lv2:default 0.0 ;
208 lv2:minimum -70.0 ;
209 lv2:maximum 4.0 ;
210 ] , [
211 a lv2:ControlPort, lv2:OutputPort ;
212 lv2:index 18 ;
213 lv2:symbol "V5" ;
214 lv2:name "V5";
215 lv2:default 0.0 ;
216 lv2:minimum -70.0 ;
217 lv2:maximum 4.0 ;
218 ] , [
219 a lv2:AudioPort ,
220 lv2:OutputPort ;
221 lv2:index 19 ;
222 lv2:symbol "out" ;
223 lv2:name "Out"
224 ] , [
225 a lv2:AudioPort ,
226 lv2:InputPort ;
227 lv2:index 20 ;
228 lv2:symbol "in" ;
229 lv2:name "In" ;
230 ].
231
232 <http://guitarix.sourceforge.net/plugins/gx_mbdelay_#gui>
233 a guiext:GtkUI;
234 guiext:binary <gx_mbdelay_gui.so>;
235 guiext:requiredFeature guiext:makeResident .
236
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include <string>
21 #include <iostream>
22
23 #include <gtkmm.h>
24 #include "gx_mbdelay.h"
25 #include "widget.h"
26
27
28 #include <lv2.h>
29 #include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
30
31 using namespace std;
32
33 class Gx_mbdelay_GUI
34 {
35 private:
36 Glib::ustring plugskin;
37 Glib::ustring addKnob;
38 Glib::ustring plug_name;
39 void set_knob(Glib::ustring knob);
40 void set_skin();
41 void set_plug_name(const char * plugin_uri);
42 GtkWidget* make_gui();
43 public:
44
45 Widget* widget;
46 static void set_plug_name_static(Gx_mbdelay_GUI *self, const char * plugin_uri)
47 {
48 self->set_plug_name(plugin_uri);
49 }
50 static GtkWidget* make_gui_static(Gx_mbdelay_GUI *self)
51 {
52 return self->make_gui();
53 }
54
55 Gx_mbdelay_GUI () {};
56 ~Gx_mbdelay_GUI () {};
57 } ;
58
59 void Gx_mbdelay_GUI::set_knob( Glib::ustring knob)
60 {
61 addKnob = " style 'gx_";
62 addKnob += plug_name;
63 addKnob += "_dark_skin_icons'\n"
64 " { \n"
65 " stock['bigknob'] = {{'";
66 addKnob += knob;
67 addKnob += ".png'}}\n"
68 " stock['smallknob'] = {{'";
69 addKnob += knob;
70 addKnob += "-small.png'}}\n"
71 " stock['smallknobr'] = {{'";
72 addKnob += knob;
73 addKnob += "-middle.png'}}\n"
74 " stock['button_on'] = {{'"
75 "echo-switch_on.png'}}\n"
76 " stock['button_off'] = {{'"
77 "echo-switch_off.png'}}\n"
78 " }\n"
79 "widget '*.";
80 addKnob += plug_name;
81 addKnob += "' style 'gx_";
82 addKnob += plug_name;
83 addKnob += "_dark_skin_icons' \n"
84 "class '*GxToggleImage' style'gx_";
85 addKnob += plug_name;
86 addKnob += "_dark_skin_icons' \n";
87 }
88
89 void Gx_mbdelay_GUI::set_skin()
90 {
91 Glib::ustring toparse = "pixmap_path ";
92 toparse += " '";
93 toparse += GX_LV2_STYLE_DIR;
94 toparse += "/'\n";
95 toparse += "style \"gx_";
96 toparse += plug_name;
97 toparse += "_dark-paintbox\"\n"
98 " { \n"
99 "GxPaintBox::skin-gradient = {\n"
100 "{ 65536, 0, 0, 13107, 52428 }, \n"
101 "{ 52428, 0, 0, 0, 52428 },\n"
102 "{ 13107, 0, 0, 13107, 13107 }}\n"
103 " GxPaintBox::box-gradient = {\n"
104 "{ 0, 61, 61, 61, 62428 }, \n"
105 "{ 22768, 80, 83, 80, 42428 }, \n"
106 "{ 52428, 8, 8, 80, 32428 }, \n"
107 "{ 65536, 4, 4, 4, 52428 }} \n"
108 " GxPaintBox::icon-set =11\n"
109 " }\n"
110 "\n"
111 "style 'gx_head_expander_box' \n"
112 " { \n"
113 " fg[NORMAL] = '#c0c6d0' \n"
114 "font_name = 'sans 7.5 bold' \n"
115 " }\n";
116 toparse += addKnob;
117
118 toparse += " widget '*.amplabel' style:highest 'gx_head_expander_box'\n"
119 "widget '*.";
120 toparse += plug_name;
121 toparse += "' style 'gx_";
122 toparse += plug_name;
123 toparse += "_dark-paintbox' ";
124 toparse += " style 'gx_selector_";
125 toparse += plug_name;
126 toparse += "'\n"
127 " {\n"
128 " fg[NORMAL] = '#c0c6d0'\n"
129 " GtkRange::trough-border = 2\n"
130 " GtkRange::stepper-size = 8\n"
131 " GtkRange::stepper-spacing = 2\n"
132 " GxRegler::value-border = { 2, 2, 2, 2 }\n"
133 " font_name = 'sans 7.5'\n"
134 " xthickness = 10\n"
135 " ythickness = 1\n"
136 " }\n"
137 "widget '*.";
138 toparse += plug_name;
139 toparse += "' style:highest 'gx_selector_";
140 toparse += plug_name;
141 toparse += "'\n";
142 toparse += "style 'gx_switch'\n"
143 "{\n"
144 "xthickness = 0\n"
145 "ythickness = 0\n"
146 "GtkButton::inner-border = {0, 0, 0, 0}\n"
147 "GtkButton::default-border = {0, 0, 0, 0}\n"
148 "GtkButton::focus-line-width = 0\n"
149 "GtkButton::focus-padding = 0\n"
150 "GtkButton::interior-focus = 0\n"
151 "GtkButton::child-displacement-x = 0\n"
152 "GtkButton::child-displacement-y = 0\n"
153 " }\n"
154 "widget '*.";
155 toparse += plug_name;
156 toparse += "' style:highest 'gx_switch'";
157 toparse += "style 'gx_fastmeter'\n"
158 " {\n"
159 " GxFastMeter::clr-bottom = '#003808'\n"
160 " GxFastMeter::clr-middle = '#00ff00'\n"
161 " GxFastMeter::clr-top = '#ff0000'\n"
162 " GxFastMeter::over = '#ff0000'\n"
163 " }\n"
164 " class '*GxFastMeter' style:highest 'gx_fastmeter'\n";
165
166 gtk_rc_parse_string (toparse.c_str());
167 }
168
169 void Gx_mbdelay_GUI::set_plug_name( const char * plugin_uri)
170 {
171 addKnob = "";
172
173 if (strcmp("http://guitarix.sourceforge.net/plugins/gx_mbdelay_#_mbdelay_", plugin_uri) == 0)
174 {
175 plug_name = "_mbdelay_";
176 set_knob("nm-knob");
177 }
178 else
179 {
180 plug_name = "_mbdelay_";
181 }
182 }
183
184 GtkWidget* Gx_mbdelay_GUI::make_gui()
185 {
186 // init the gxwmm library
187 Gxw::init();
188 set_skin();
189 GtkWidget* container = gtk_vbox_new(FALSE, 2);
190 widget = new Widget(plug_name);
191 GtkWidget* cWidget = GTK_WIDGET(widget->gobj());
192 gtk_container_add(GTK_CONTAINER(container), cWidget );
193
194 return container;
195 }
196
197
198 static LV2UI_Handle instantiate(const struct _LV2UI_Descriptor * descriptor,
199 const char * plugin_uri,
200 const char * bundle_path,
201 LV2UI_Write_Function write_function,
202 LV2UI_Controller controller,
203 LV2UI_Widget * widget,
204 const LV2_Feature * const * features)
205 {
206 Gx_mbdelay_GUI* self = new Gx_mbdelay_GUI();
207 if (self == NULL) return NULL;
208 self->set_plug_name_static(self, plugin_uri);
209 *widget = (LV2UI_Widget)self->make_gui_static(self);
210 self->widget->controller = controller;
211 self->widget->write_function = write_function;
212 return (LV2UI_Handle)self;
213 }
214
215 static void cleanup(LV2UI_Handle ui)
216 {
217 Gx_mbdelay_GUI *pluginGui = static_cast<Gx_mbdelay_GUI*>(ui);
218 delete pluginGui->widget;
219 delete pluginGui;
220 }
221
222 static void port_event(LV2UI_Handle ui,
223 uint32_t port_index,
224 uint32_t buffer_size,
225 uint32_t format,
226 const void * buffer)
227 {
228 Gx_mbdelay_GUI *self = static_cast<Gx_mbdelay_GUI*>(ui);
229 self->widget->set_value_static( port_index, buffer_size, format, buffer, self->widget);
230 return;
231 }
232
233 static LV2UI_Descriptor descriptors[] =
234 {
235 {GXPLUGIN_UI_URI, instantiate, cleanup, port_event, NULL}
236 };
237
238 const LV2UI_Descriptor * lv2ui_descriptor(uint32_t index)
239 {
240 //printf("lv2ui_descriptor(%u) called\n", (uint32_t)index);
241 if (index >= sizeof(descriptors) / sizeof(descriptors[0]))
242 {
243 return NULL;
244 }
245 return descriptors + index;
246 }
247
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_mbdelay_#_mbdelay_>
23 a lv2:Plugin ;
24 lv2:binary <gx_mbdelay.so> ;
25 rdfs:seeAlso <gx_mbdelay.ttl> .
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_mbdelay_#_mbdelay_>
23 a lv2:Plugin ;
24 lv2:binary <gx_mbdelay@LIB_EXT@> ;
25 rdfs:seeAlso <gx_mbdelay.ttl> .
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include "widget.h"
21
22 #include <iostream>
23
24 #define max(x, y) (((x) > (y)) ? (x) : (y))
25
26 /* @get controller by port
27 * this function is used by make_selector() make_controller_box()
28 * set_value() and on_value_changed()
29 * so controller widgets needs only here asined to a port,
30 * and all functions which need acess to the controller widget pointer
31 * can receive them by port number
32 */
33
34 Gtk::Widget* Widget::get_controller_by_port(uint32_t port_index)
35 {
36 switch ((PortIndex)port_index )
37 {
38 case DELAY1:
39 return &m_smallknob[1];
40 case DELAY2:
41 return &m_smallknob[2];
42 case DELAY3:
43 return &m_smallknob[3];
44 case DELAY4:
45 return &m_smallknob[4];
46 case DELAY5:
47 return &m_smallknob[5];
48 // case GAIN:
49 // return &m_smallknob[6];
50 case GAIN1:
51 return &m_smallknob[7];
52 case GAIN2:
53 return &m_smallknob[8];
54 case GAIN3:
55 return &m_smallknob[9];
56 case GAIN4:
57 return &m_smallknob[10];
58 case GAIN5:
59 return &m_smallknob[11];
60 case CROSSOVER_B1_B2:
61 return &m_smallknob[12];
62 case CROSSOVER_B2_B3:
63 return &m_smallknob[13];
64 case CROSSOVER_B3_B4:
65 return &m_smallknob[14];
66 case CROSSOVER_B4_B5:
67 return &m_smallknob[15];
68 default:
69 return NULL;
70 }
71 }
72
73 Widget::Widget(Glib::ustring plugname):
74 plug_name(plugname)
75 {
76 m_fr[0].set_label("BAND 1");
77 m_fr[0].add(m_lbox[0]);
78 m_fr[1].set_label("BAND 2");
79 m_fr[1].add(m_lbox[1]);
80 m_fr[2].set_label("BAND 3");
81 m_fr[2].add(m_lbox[2]);
82 m_fr[3].set_label("BAND 4");
83 m_fr[3].add(m_lbox[3]);
84 m_fr[4].set_label("BAND 5");
85 m_fr[4].add(m_lbox[4]);
86 // m_fr[5].set_label("OUT");
87 m_fr[6].set_label("BAND PASS");
88
89 // make_controller_box(&m_vbox[6], "Gain ", -4e+01, 4.0, 0.1 , GAIN, false);
90 make_controller_box(&m_vbox[1], "GAIN ", -4e+01, 2.0, 0.1, GAIN1, false);
91 make_controller_box(&m_vbox[2], "GAIN ", -4e+01, 2.0, 0.1, GAIN2, false);
92 make_controller_box(&m_vbox[3], "GAIN ", -4e+01, 2.0, 0.1, GAIN3, false);
93 make_controller_box(&m_vbox[4], "GAIN ", -4e+01, 2.0, 0.1, GAIN4, false);
94 make_controller_box(&m_vbox[5], "GAIN ", -4e+01, 2.0, 0.1, GAIN5, false);
95
96 // create controllers for port name
97 make_controller_box(&m_vbox[1], "BPM", 24.0, 3.6e+02, 1.0, DELAY1, true);
98 make_controller_box(&m_vbox[2], "BPM", 24.0, 3.6e+02, 1.0, DELAY2, true);
99 make_controller_box(&m_vbox[3], "BPM", 24.0, 3.6e+02, 1.0, DELAY3, true);
100 make_controller_box(&m_vbox[4], "BPM", 24.0, 3.6e+02, 1.0, DELAY4, true);
101 make_controller_box(&m_vbox[5], "BPM", 24.0, 3.6e+02, 1.0, DELAY5, true);
102
103 make_controller_box(&m_vbox[7], "LOW PASS \n B1><B2",
104 2e+01, 2e+04, 1.08 , CROSSOVER_B1_B2, true);
105 make_controller_box(&m_vbox[8], "CROSSOVER \n B2><B3",
106 2e+01, 2e+04, 1.08 , CROSSOVER_B2_B3, true);
107 make_controller_box(&m_vbox[9], "CROSSOVER \n B3><B4 ",
108 2e+01, 2e+04, 1.08 , CROSSOVER_B3_B4, true);
109 make_controller_box(&m_vbox[10], "HIGH PASS \n B4><B5",
110 2e+01, 2e+04, 1.08 , CROSSOVER_B4_B5, true);
111
112 // set propertys for the main paintbox holding the skin
113 m_paintbox[0].set_border_width(10);
114 m_paintbox[0].set_spacing(6);
115 m_paintbox[0].set_homogeneous(false);
116 m_paintbox[0].set_name(plug_name);
117 m_paintbox[0].property_paint_func() = "gxhead_expose";
118 add(m_paintbox[0]);
119
120 for (uint32_t i = 0;i<5;i++) {
121 fastmeter[i].set_hold_count(12);
122 fastmeter[i].set_property("dimen",5);
123 m_paintbox[i+1].property_paint_func() = "RackBox_expose";
124 m_paintbox[i+1].set_name(plug_name);
125 m_paintbox[i+1].set_border_width(5);
126 m_paintbox[i+1].pack_start(fastmeter[i]);
127 }
128
129 // set a vertical box in the paintbox
130 m_vbox[11].set_border_width(14);
131 m_vbox[12].set_border_width(14);
132 m_hbox[2].set_border_width(4);
133 m_paintbox[0].pack_start(m_vbox[0]);
134 // box for the controllers
135 m_hbox[0].set_spacing(4);
136 m_hbox[0].set_border_width(4);
137 m_hbox[0].set_homogeneous(false);
138 m_vbox[0].pack_start(m_hbox[0]);
139 m_fr[6].add(m_hbox[1]);
140 m_vbox[0].pack_start(m_fr[6]);
141 m_vbox[0].pack_start(m_hbox[2]);
142 // put boxed controllers into controller box
143 m_hbox[0].pack_start(m_vbox[11], Gtk::PACK_EXPAND_PADDING);
144 m_hbox[0].pack_start(m_fr[0]);
145 m_lbox[0].pack_start(m_vbox[1]);
146 m_lbox[0].pack_start(m_paintbox[1],Gtk::PACK_SHRINK);
147 m_hbox[0].pack_start(m_fr[1]);
148 m_lbox[1].pack_start(m_vbox[2]);
149 m_lbox[1].pack_start(m_paintbox[2],Gtk::PACK_SHRINK);
150 m_hbox[0].pack_start(m_fr[2]);
151 m_lbox[2].pack_start(m_vbox[3]);
152 m_lbox[2].pack_start(m_paintbox[3],Gtk::PACK_SHRINK);
153 m_hbox[0].pack_start(m_fr[3]);
154 m_lbox[3].pack_start(m_vbox[4]);
155 m_lbox[3].pack_start(m_paintbox[4],Gtk::PACK_SHRINK);
156 m_hbox[0].pack_start(m_fr[4]);
157 m_lbox[4].pack_start(m_vbox[5]);
158 m_lbox[4].pack_start(m_paintbox[5],Gtk::PACK_SHRINK);
159 // m_hbox[0].pack_start(m_fr[5]);
160 // m_fr[5].add(m_vbox[6]);
161 m_hbox[0].pack_start(m_vbox[12], Gtk::PACK_EXPAND_PADDING);
162 // put boxed controllers into controller box
163 m_hbox[1].pack_start(m_vbox[13], Gtk::PACK_EXPAND_PADDING);
164 m_hbox[1].pack_start(m_vbox[7]);
165 m_hbox[1].pack_start(m_vbox[8]);
166 m_hbox[1].pack_start(m_vbox[9]);
167 m_hbox[1].pack_start(m_vbox[10]);
168 m_hbox[1].pack_start(m_vbox[14], Gtk::PACK_EXPAND_PADDING);
169
170 set_app_paintable(true);
171 show_all();
172 }
173
174 Widget::~Widget()
175 {
176
177 }
178
179 // create selectors from gxwmm
180 void Widget::make_selector(Glib::ustring labela,
181 Glib::ustring tables[],
182 size_t _size,
183 float min, float digits,
184 PortIndex port_name)
185 {
186 Gxw::Selector *regler = static_cast<Gxw::Selector*>
187 (get_controller_by_port(port_name));
188 if (regler)
189 {
190 float max = static_cast<float>(_size+1);
191
192 Gtk::TreeModelColumn<Glib::ustring> label;
193 Gtk::TreeModelColumnRecord rec;
194 rec.add(label);
195 Glib::RefPtr<Gtk::ListStore> ls = Gtk::ListStore::create(rec);
196
197 for (uint32_t i = 0 ; i< _size; ++i) {
198 ls->append()->set_value(0, tables[i]);
199 }
200 regler->set_model(ls);
201 regler->set_has_tooltip();
202 regler->set_tooltip_text(labela);
203 regler->cp_configure("SELECTOR", labela, min, max, digits);
204 regler->set_show_value(false);
205 regler->set_name(plug_name);
206 regler->signal_value_changed().connect(sigc::bind(sigc::mem_fun(
207 *this, &Widget::on_value_changed), port_name));
208 }
209 }
210
211 // create stackboxes with controllers for port name
212 void Widget::make_controller_box(Gtk::Box *box,
213 Glib::ustring label,
214 float min, float max,
215 float digits,
216 PortIndex port_name,
217 bool show_value)
218 {
219 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
220 get_controller_by_port(port_name));
221 if (regler)
222 {
223 Gtk::Label* pr = new Gtk::Label(label, 0);
224 pr->set_name("amplabel");
225 // use label images instead simple string labes
226 /*Glib::ustring label_image = GX_LV2_STYLE_DIR;
227 label_image += "/";
228 label_image += label;
229 label_image += "-label.png";
230 Gtk::Image *pr = new Gtk::Image(label_image);*/
231
232 Gtk::VBox* b1 = new Gtk::VBox();
233 box->pack_start( *Gtk::manage(b1), Gtk::PACK_EXPAND_PADDING);
234 box->pack_start( *Gtk::manage(pr),Gtk::PACK_SHRINK);
235 regler->cp_configure("KNOB", label, min, max, digits);
236 regler->set_show_value(show_value);
237 regler->set_name(plug_name);
238 box->pack_start(*regler,Gtk::PACK_SHRINK);
239 Gtk::VBox* b2 = new Gtk::VBox();
240 box->pack_start( *Gtk::manage(b2), Gtk::PACK_EXPAND_PADDING);
241 regler->signal_value_changed().connect(sigc::bind(sigc::mem_fun(
242 *this, &Widget::on_value_changed), port_name));
243 }
244 }
245
246 // create stackboxes with switch controller for port name
247 void Widget::make_switch_box(Gtk::Box *box,
248 Glib::ustring label,
249 PortIndex port_name)
250 {
251 Gxw::Switch *regler = static_cast<Gxw::Switch*>(
252 get_controller_by_port(port_name));
253 if (regler)
254 {
255 Gtk::Label* pr = new Gtk::Label(label, 0);
256 pr->set_name("amplabel");
257 // use label images instead simple string labes
258 /*Glib::ustring label_image = GX_LV2_STYLE_DIR;
259 label_image += "/"+plug_name+"-";
260 label_image += label;
261 label_image += "-label.png";
262 Gtk::Image *pr = new Gtk::Image(label_image);*/
263
264 regler->cp_configure("switch", label, 0, 1, 1);
265 regler->set_name(plug_name);
266 regler->set_base_name( "button" );
267 Gtk::VBox* b1 = new Gtk::VBox();
268 box->pack_start( *Gtk::manage(b1), Gtk::PACK_EXPAND_PADDING);
269 box->pack_start( *Gtk::manage(pr),Gtk::PACK_SHRINK);
270 box->pack_start(*regler,Gtk::PACK_SHRINK);
271 Gtk::VBox* b2 = new Gtk::VBox();
272 box->pack_start( *Gtk::manage(b2), Gtk::PACK_EXPAND_PADDING);
273 regler->signal_toggled().connect(sigc::bind(sigc::mem_fun(
274 *this, &Widget::on_value_changed), port_name));
275 }
276 }
277
278 // receive controller value changes from host and set them to controller
279 void Widget::set_value(uint32_t port_index,
280 uint32_t format,
281 const void * buffer)
282 {
283 if ( format == 0 )
284 {
285 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
286 get_controller_by_port(port_index));
287 float value = *static_cast<const float*>(buffer);
288 if (regler) regler->cp_set_value(value);
289 if (port_index == V1) refresh_meter_level(0,value);
290 else if (port_index == V2) refresh_meter_level(1,value);
291 else if (port_index == V3) refresh_meter_level(2,value);
292 else if (port_index == V4) refresh_meter_level(3,value);
293 else if (port_index == V5) refresh_meter_level(4,value);
294 }
295 }
296
297 // write (UI) controller value changes to the host->engine
298 void Widget::on_value_changed(uint32_t port_index)
299 {
300 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
301 get_controller_by_port(port_index));
302 if (regler)
303 {
304 float value = regler->cp_get_value();
305 write_function(controller, port_index, sizeof(float), 0,
306 static_cast<const void*>(&value));
307 }
308 }
309
310 void Widget::refresh_meter_level(int m, float new_level) {
311 fastmeter[m].set_by_power(new_level);
312 }
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_WIDGET_H_
22 #define SRC_HEADERS_WIDGET_H_
23
24 #include <gtkmm.h>
25 #include <gxwmm.h>
26 #include "gx_mbdelay.h"
27 #include "../config.h" // for GX_STYLE_DIR
28 // LV2UI stuff
29 #include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
30
31 class Widget : public Gtk::HBox
32 {
33 private:
34 Gtk::Widget* get_controller_by_port(uint32_t port_index);
35
36 void refresh_meter_level(int meter,float new_level);
37
38 void on_value_changed(uint32_t port_index);
39
40 void make_controller_box(Gtk::Box *box,
41 Glib::ustring label,
42 float min, float max,
43 float digits,
44 PortIndex port_name,
45 bool show_value);
46
47
48 void make_selector(Glib::ustring label,
49 Glib::ustring tables[],
50 size_t _size,
51 float min, float digits,
52 PortIndex port_name);
53
54 void make_switch_box(Gtk::Box *box,
55 Glib::ustring label,
56 PortIndex port_name);
57
58 void set_value(uint32_t port_index,
59 uint32_t format,
60 const void * buffer);
61 public:
62
63 // public Lv2 communication stuff
64 LV2UI_Controller controller;
65 LV2UI_Write_Function write_function;
66 static void set_value_static(uint32_t port_index,
67 uint32_t buffer_size,
68 uint32_t format,
69 const void * buffer, Widget *self)
70 {
71 self->set_value(port_index,format,buffer);
72 }
73
74 Widget(Glib::ustring plugname);
75 ~Widget();
76
77 protected:
78 Glib::ustring plug_name;
79 Gtk::VBox m_vbox[15];
80 Gtk::HBox m_hbox[3];
81 Gtk::HBox m_lbox[5];
82 Gtk::Frame m_fr[7];
83
84 Gxw::SmallKnob m_smallknob[16];
85 Gxw::FastMeter fastmeter[5];
86 Gxw::PaintBox m_paintbox[6];
87 };
88
89 #endif //SRC_HEADERS_WIDGET_H_
0 #!/usr/bin/env python
1 # encoding: utf-8
2
3 import sys, os, TaskGen, ctypes
4
5 def configure(conf):
6 pass
7
8 def build(bld):
9 bundle = 'gx_mbdelay.lv2'
10
11 src = ['gx_mbdelay.cpp'
12 ]
13 incl = ['../faust','./', '../DSP']
14 lib = []
15 if sys.platform.startswith("linux"):
16 lib.append('dl')
17 uselib = ['LV2CORE']
18 cxxflag =[]
19 if not bld.env['OPT'] and bld.env['SSE2']:
20 cxxflag = [ "-msse2", "-mfpmath=sse"]
21 lv2_effects = bld(
22 features='cxx cshlib ',
23 includes = incl,
24 lib = lib,
25 uselib = uselib,
26 obj_ext = '_14.o',
27 cxxflags = cxxflag,
28 defines = ["LV2_SO"],
29 target = 'gx_mbdelay',
30 source = src,
31 install_path = '${LV2DIR}/%s' % bundle,
32 chmod = 0o755,
33 )
34 lv2_effects.env['shlib_PATTERN'] = '%s.so'
35
36 uselib_local5 = []
37 libpath5 = []
38 lib5 = []
39 incl5 = ['../../../libgxwmm','../../../libgxw','../']
40 if sys.platform.startswith("linux"):
41 lib5.append('dl')
42 if bld.env["GX_LIB_SHARED"]:
43 lib5 += ['gxwmm','gxw']
44 libpath5 += [bld.path.find_dir("../../../libgxw/gxw").bldpath(bld.env),
45 bld.path.find_dir("../../../libgxwmm/gxwmm").bldpath(bld.env)]
46 else:
47 uselib_local5 += ['gxwmm','gxw']
48
49 lv2_effetcs_gui = bld(
50 features='cxx cshlib ',
51 includes = incl5,
52 lib = lib5,
53 uselib = 'LV2CORE GTKMM',
54 libpath = libpath5,
55 uselib_local = uselib_local5,
56 linkflags = '-Wl,-z,nodelete',
57 defines = ["LV2_GUI"],
58 target = 'gx_mbdelay_gui',
59 source = 'widget.cpp gx_mbdelay_gui.cpp',
60 install_path = '${LV2DIR}/%s' % bundle,
61 chmod = 0o755,
62 )
63 lv2_effetcs_gui.env['shlib_PATTERN'] = '%s.so'
64
65
66 install_path = '${LV2DIR}/%s' % bundle,
67 bld.install_files('${LV2DIR}/gx_mbdelay.lv2', 'manifest.ttl')
68 bld.install_files('${LV2DIR}/gx_mbdelay.lv2', 'gx_mbdelay.ttl')
69
70 bld.install_files('${LV2DIR}/gx_mbdelay.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 ////////////////////////////// LOCAL INCLUDES //////////////////////////
21
22 #include "gx_common.h" // faust support and denormal protection (SSE)
23 #include "gx_mbdistortion.h" // define struct PortIndex
24 #include "gx_pluginlv2.h" // define struct PluginLV2
25 #include "mbd.cc" // dsp class generated by faust -> dsp2cc
26
27 ////////////////////////////// PLUG-IN CLASS ///////////////////////////
28
29 class Gx_mbdistortion_
30 {
31 private:
32 // pointer to buffer
33 float* output;
34 float* input;
35 // pointer to dsp class
36 PluginLV2* mbdistortion;
37 // private functions
38 inline void run_dsp_(uint32_t n_samples);
39 inline void connect_(uint32_t port,void* data);
40 inline void init_dsp_(uint32_t rate);
41 inline void connect_all__ports(uint32_t port, void* data);
42 inline void activate_f();
43 inline void clean_up();
44 inline void deactivate_f();
45
46 public:
47 // LV2 Descriptor
48 static const LV2_Descriptor descriptor;
49 // static wrapper to private functions
50 static void deactivate(LV2_Handle instance);
51 static void cleanup(LV2_Handle instance);
52 static void run(LV2_Handle instance, uint32_t n_samples);
53 static void activate(LV2_Handle instance);
54 static void connect_port(LV2_Handle instance, uint32_t port, void* data);
55 static LV2_Handle instantiate(const LV2_Descriptor* descriptor,
56 double rate, const char* bundle_path,
57 const LV2_Feature* const* features);
58 Gx_mbdistortion_();
59 ~Gx_mbdistortion_();
60 };
61
62 // constructor
63 Gx_mbdistortion_::Gx_mbdistortion_() :
64 output(NULL),
65 input(NULL),
66 mbdistortion(mbd::plugin()) {};
67
68 // destructor
69 Gx_mbdistortion_::~Gx_mbdistortion_()
70 {
71 // just to be sure the plug have given free the allocated mem
72 // it didn't hurd if the mem is already given free by clean_up()
73 if (mbdistortion->activate_plugin !=0)
74 mbdistortion->activate_plugin(false, mbdistortion);
75 // delete DSP class
76 mbdistortion->delete_instance(mbdistortion);
77 };
78
79 ///////////////////////// PRIVATE CLASS FUNCTIONS /////////////////////
80
81 void Gx_mbdistortion_::init_dsp_(uint32_t rate)
82 {
83 AVOIDDENORMALS(); // init the SSE denormal protection
84 mbdistortion->set_samplerate(rate, mbdistortion); // init the DSP class
85 }
86
87 // connect the Ports used by the plug-in class
88 void Gx_mbdistortion_::connect_(uint32_t port,void* data)
89 {
90 switch ((PortIndex)port)
91 {
92 case EFFECTS_OUTPUT:
93 output = static_cast<float*>(data);
94 break;
95 case EFFECTS_INPUT:
96 input = static_cast<float*>(data);
97 break;
98 default:
99 break;
100 }
101 }
102
103 void Gx_mbdistortion_::activate_f()
104 {
105 // allocate the internal DSP mem
106 if (mbdistortion->activate_plugin !=0)
107 mbdistortion->activate_plugin(true, mbdistortion);
108 }
109
110 void Gx_mbdistortion_::clean_up()
111 {
112 // delete the internal DSP mem
113 if (mbdistortion->activate_plugin !=0)
114 mbdistortion->activate_plugin(false, mbdistortion);
115 }
116
117 void Gx_mbdistortion_::deactivate_f()
118 {
119 // delete the internal DSP mem
120 if (mbdistortion->activate_plugin !=0)
121 mbdistortion->activate_plugin(false, mbdistortion);
122 }
123
124 void Gx_mbdistortion_::run_dsp_(uint32_t n_samples)
125 {
126 mbdistortion->mono_audio(static_cast<int>(n_samples), input, output, mbdistortion);
127 }
128
129 void Gx_mbdistortion_::connect_all__ports(uint32_t port, void* data)
130 {
131 // connect the Ports used by the plug-in class
132 connect_(port,data);
133 // connect the Ports used by the DSP class
134 mbdistortion->connect_ports(port, data, mbdistortion);
135 }
136
137 ////////////////////// STATIC CLASS FUNCTIONS ////////////////////////
138
139 LV2_Handle
140 Gx_mbdistortion_::instantiate(const LV2_Descriptor* descriptor,
141 double rate, const char* bundle_path,
142 const LV2_Feature* const* features)
143 {
144 // init the plug-in class
145 Gx_mbdistortion_ *self = new Gx_mbdistortion_();
146 if (!self)
147 {
148 return NULL;
149 }
150
151 self->init_dsp_((uint32_t)rate);
152
153 return (LV2_Handle)self;
154 }
155
156 void Gx_mbdistortion_::connect_port(LV2_Handle instance,
157 uint32_t port, void* data)
158 {
159 // connect all ports
160 static_cast<Gx_mbdistortion_*>(instance)->connect_all__ports(port, data);
161 }
162
163 void Gx_mbdistortion_::activate(LV2_Handle instance)
164 {
165 // allocate needed mem
166 static_cast<Gx_mbdistortion_*>(instance)->activate_f();
167 }
168
169 void Gx_mbdistortion_::run(LV2_Handle instance, uint32_t n_samples)
170 {
171 // run dsp
172 static_cast<Gx_mbdistortion_*>(instance)->run_dsp_(n_samples);
173 }
174
175 void Gx_mbdistortion_::deactivate(LV2_Handle instance)
176 {
177 // free allocated mem
178 static_cast<Gx_mbdistortion_*>(instance)->deactivate_f();
179 }
180
181 void Gx_mbdistortion_::cleanup(LV2_Handle instance)
182 {
183 // well, clean up after us
184 Gx_mbdistortion_* self = static_cast<Gx_mbdistortion_*>(instance);
185 self->clean_up();
186 delete self;
187 }
188
189 const LV2_Descriptor Gx_mbdistortion_::descriptor =
190 {
191 GXPLUGIN_URI "#_mbdistortion_",
192 Gx_mbdistortion_::instantiate,
193 Gx_mbdistortion_::connect_port,
194 Gx_mbdistortion_::activate,
195 Gx_mbdistortion_::run,
196 Gx_mbdistortion_::deactivate,
197 Gx_mbdistortion_::cleanup,
198 NULL
199 };
200
201 ////////////////////////// LV2 SYMBOL EXPORT ///////////////////////////
202
203 extern "C"
204 LV2_SYMBOL_EXPORT
205 const LV2_Descriptor*
206 lv2_descriptor(uint32_t index)
207 {
208 switch (index)
209 {
210 case 0:
211 return &Gx_mbdistortion_::descriptor;
212 default:
213 return NULL;
214 }
215 }
216
217 ///////////////////////////// FIN //////////////////////////////////////
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_GXEFFECTS_H_
22 #define SRC_HEADERS_GXEFFECTS_H_
23
24 #include <lv2.h>
25
26 #define GXPLUGIN_URI "http://guitarix.sourceforge.net/plugins/gx_mbdistortion_"
27 #define GXPLUGIN_UI_URI "http://guitarix.sourceforge.net/plugins/gx_mbdistortion_#gui"
28
29
30 typedef enum
31 {
32 DRIVE1,
33 DRIVE2,
34 DRIVE3,
35 DRIVE4,
36 DRIVE5,
37 GAIN,
38 OFFSET1,
39 OFFSET2,
40 OFFSET3,
41 OFFSET4,
42 OFFSET5,
43 CROSSOVER_B1_B2,
44 CROSSOVER_B2_B3,
45 CROSSOVER_B3_B4,
46 CROSSOVER_B4_B5,
47 V1,
48 V2,
49 V3,
50 V4,
51 V5,
52 EFFECTS_OUTPUT,
53 EFFECTS_INPUT,
54 } PortIndex;
55
56 #endif //SRC_HEADERS_GXEFFECTS_H_
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19
20 @prefix doap: <http://usefulinc.com/ns/doap#> .
21 @prefix foaf: <http://xmlns.com/foaf/0.1/> .
22 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
23 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
24 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
25 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26
27 <http://guitarix.sourceforge.net#me>
28 a foaf:Person ;
29 foaf:name "Guitarix team" ;
30 foaf:mbox <mailto:brummer@web.de> ;
31 rdfs:seeAlso <http://guitarix.sourceforge.net> .
32
33 <http://guitarix.sourceforge.net/plugins/gx_mbdistortion_>
34 a doap:Project ;
35 doap:maintainer <http://guitarix.sourceforge.net#me> ;
36 doap:name "Gx_mbdistortion_" .
37
38 <http://guitarix.sourceforge.net/plugins/gx_mbdistortion_#_mbdistortion_>
39 a lv2:Plugin ,
40 lv2:DistortionPlugin ;
41 doap:maintainer <http://guitarix.sourceforge.net#me> ;
42 doap:name "GxMultiBandDistortion";
43 doap:license <http://opensource.org/licenses/isc> ;
44 lv2:project <http://guitarix.sourceforge.net/plugins/gx_mbdistortion_> ;
45 lv2:optionalFeature lv2:hardRTCapable ;
46
47 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_mbdistortion_#gui>;
48
49 lv2:minorVersion 28;
50 lv2:microVersion 3;
51
52 lv2:port [
53 a lv2:InputPort ,
54 lv2:ControlPort ;
55 lv2:index 0 ;
56 lv2:symbol "DRIVE1" ;
57 lv2:name "DRIVE1";
58 lv2:default 0.0 ;
59 lv2:minimum 0.0 ;
60 lv2:maximum 1.0 ;
61 ] , [
62 a lv2:InputPort ,
63 lv2:ControlPort ;
64 lv2:index 1 ;
65 lv2:symbol "DRIVE2" ;
66 lv2:name "DRIVE2";
67 lv2:default 0.25 ;
68 lv2:minimum 0.0 ;
69 lv2:maximum 1.0 ;
70 ] , [
71 a lv2:InputPort ,
72 lv2:ControlPort ;
73 lv2:index 2 ;
74 lv2:symbol "DRIVE3" ;
75 lv2:name "DRIVE3";
76 lv2:default 0.65 ;
77 lv2:minimum 0.0 ;
78 lv2:maximum 1.0 ;
79 ] , [
80 a lv2:InputPort ,
81 lv2:ControlPort ;
82 lv2:index 3 ;
83 lv2:symbol "DRIVE4" ;
84 lv2:name "DRIVE4";
85 lv2:default 0.25 ;
86 lv2:minimum 0.0 ;
87 lv2:maximum 1.0 ;
88 ] , [
89 a lv2:InputPort ,
90 lv2:ControlPort ;
91 lv2:index 4 ;
92 lv2:symbol "DRIVE5" ;
93 lv2:name "DRIVE5";
94 lv2:default 0.0 ;
95 lv2:minimum 0.0 ;
96 lv2:maximum 1.0 ;
97 ] , [
98 a lv2:InputPort ,
99 lv2:ControlPort ;
100 lv2:index 5 ;
101 lv2:symbol "GAIN" ;
102 lv2:name "GAIN";
103 lv2:default 0.0 ;
104 lv2:minimum -4e+01 ;
105 lv2:maximum 4.0 ;
106 ] , [
107 a lv2:InputPort ,
108 lv2:ControlPort ;
109 lv2:index 6 ;
110 lv2:symbol "OFFSET1" ;
111 lv2:name "OFFSET1";
112 lv2:default 0.17 ;
113 lv2:minimum 0.0 ;
114 lv2:maximum 0.5 ;
115 ] , [
116 a lv2:InputPort ,
117 lv2:ControlPort ;
118 lv2:index 7 ;
119 lv2:symbol "OFFSET2" ;
120 lv2:name "OFFSET2";
121 lv2:default 0.2 ;
122 lv2:minimum 0.0 ;
123 lv2:maximum 0.5 ;
124 ] , [
125 a lv2:InputPort ,
126 lv2:ControlPort ;
127 lv2:index 8 ;
128 lv2:symbol "OFFSET3" ;
129 lv2:name "OFFSET3";
130 lv2:default 0.2 ;
131 lv2:minimum 0.0 ;
132 lv2:maximum 0.5 ;
133 ] , [
134 a lv2:InputPort ,
135 lv2:ControlPort ;
136 lv2:index 9 ;
137 lv2:symbol "OFFSET4" ;
138 lv2:name "OFFSET4";
139 lv2:default 0.2 ;
140 lv2:minimum 0.0 ;
141 lv2:maximum 0.5 ;
142 ] , [
143 a lv2:InputPort ,
144 lv2:ControlPort ;
145 lv2:index 10 ;
146 lv2:symbol "OFFSET5" ;
147 lv2:name "OFFSET5";
148 lv2:default 0.17 ;
149 lv2:minimum 0.0 ;
150 lv2:maximum 0.5 ;
151 ] , [
152 a lv2:InputPort ,
153 lv2:ControlPort ;
154 lv2:index 11 ;
155 lv2:symbol "CROSSOVER_B1_B2" ;
156 lv2:name "LOW SHELF";
157 lv2:default 8e+01 ;
158 lv2:minimum 2e+01 ;
159 lv2:maximum 2e+04 ;
160 ] , [
161 a lv2:InputPort ,
162 lv2:ControlPort ;
163 lv2:index 12 ;
164 lv2:symbol "CROSSOVER_B2_B3" ;
165 lv2:name "CROSSOVER_B2_B3";
166 lv2:default 2.1e+02 ;
167 lv2:minimum 2e+01 ;
168 lv2:maximum 2e+04 ;
169 ] , [
170 a lv2:InputPort ,
171 lv2:ControlPort ;
172 lv2:index 13 ;
173 lv2:symbol "CROSSOVER_B3_B4" ;
174 lv2:name "CROSSOVER_B3_B4";
175 lv2:default 1.7e+03 ;
176 lv2:minimum 2e+01 ;
177 lv2:maximum 2e+04 ;
178 ] , [
179 a lv2:InputPort ,
180 lv2:ControlPort ;
181 lv2:index 14 ;
182 lv2:symbol "CROSSOVER_B4_B5" ;
183 lv2:name "CROSSOVER_B4_B5";
184 lv2:default 5e+03 ;
185 lv2:minimum 2e+01 ;
186 lv2:maximum 2e+04 ;
187 ] , [
188 a lv2:ControlPort, lv2:OutputPort ;
189 lv2:index 15 ;
190 lv2:symbol "V1" ;
191 lv2:name "V1";
192 lv2:default 0.0 ;
193 lv2:minimum -70.0 ;
194 lv2:maximum 4.0 ;
195 ] , [
196 a lv2:ControlPort, lv2:OutputPort ;
197 lv2:index 16 ;
198 lv2:symbol "V2" ;
199 lv2:name "V2";
200 lv2:default 0.0 ;
201 lv2:minimum -70.0 ;
202 lv2:maximum 4.0 ;
203 ] , [
204 a lv2:ControlPort, lv2:OutputPort ;
205 lv2:index 17 ;
206 lv2:symbol "V3" ;
207 lv2:name "V3";
208 lv2:default 0.0 ;
209 lv2:minimum -70.0 ;
210 lv2:maximum 4.0 ;
211 ] , [
212 a lv2:ControlPort, lv2:OutputPort ;
213 lv2:index 18 ;
214 lv2:symbol "V4" ;
215 lv2:name "V4";
216 lv2:default 0.0 ;
217 lv2:minimum -70.0 ;
218 lv2:maximum 4.0 ;
219 ] , [
220 a lv2:ControlPort, lv2:OutputPort ;
221 lv2:index 19 ;
222 lv2:symbol "V5" ;
223 lv2:name "V5";
224 lv2:default 0.0 ;
225 lv2:minimum -70.0 ;
226 lv2:maximum 4.0 ;
227 ] , [
228 a lv2:AudioPort ,
229 lv2:OutputPort ;
230 lv2:index 20 ;
231 lv2:symbol "out" ;
232 lv2:name "Out"
233 ] , [
234 a lv2:AudioPort ,
235 lv2:InputPort ;
236 lv2:index 21 ;
237 lv2:symbol "in" ;
238 lv2:name "In" ;
239 ].
240
241 <http://guitarix.sourceforge.net/plugins/gx_mbdistortion_#gui>
242 a guiext:GtkUI;
243 guiext:binary <gx_mbdistortion_gui.so>;
244 guiext:requiredFeature guiext:makeResident .
245
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include <string>
21 #include <iostream>
22
23 #include <gtkmm.h>
24 #include "gx_mbdistortion.h"
25 #include "widget.h"
26
27
28 #include <lv2.h>
29 #include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
30
31 using namespace std;
32
33 class Gx_mbdistortion_GUI
34 {
35 private:
36 Glib::ustring plugskin;
37 Glib::ustring addKnob;
38 Glib::ustring plug_name;
39 void set_knob(Glib::ustring knob);
40 void set_skin();
41 void set_plug_name(const char * plugin_uri);
42 GtkWidget* make_gui();
43 public:
44
45 Widget* widget;
46 static void set_plug_name_static(Gx_mbdistortion_GUI *self, const char * plugin_uri)
47 {
48 self->set_plug_name(plugin_uri);
49 }
50 static GtkWidget* make_gui_static(Gx_mbdistortion_GUI *self)
51 {
52 return self->make_gui();
53 }
54
55 Gx_mbdistortion_GUI () {};
56 ~Gx_mbdistortion_GUI () {};
57 } ;
58
59 void Gx_mbdistortion_GUI::set_knob( Glib::ustring knob)
60 {
61 addKnob = " style 'gx_";
62 addKnob += plug_name;
63 addKnob += "_dark_skin_icons'\n"
64 " { \n"
65 " stock['bigknob'] = {{'";
66 addKnob += knob;
67 addKnob += ".png'}}\n"
68 " stock['smallknob'] = {{'";
69 addKnob += knob;
70 addKnob += "-small.png'}}\n"
71 " stock['smallknobr'] = {{'";
72 addKnob += knob;
73 addKnob += "-middle.png'}}\n"
74 " stock['button_on'] = {{'"
75 "echo-switch_on.png'}}\n"
76 " stock['button_off'] = {{'"
77 "echo-switch_off.png'}}\n"
78 " }\n"
79 "widget '*.";
80 addKnob += plug_name;
81 addKnob += "' style 'gx_";
82 addKnob += plug_name;
83 addKnob += "_dark_skin_icons' \n"
84 "class '*GxToggleImage' style'gx_";
85 addKnob += plug_name;
86 addKnob += "_dark_skin_icons' \n";
87 }
88
89 void Gx_mbdistortion_GUI::set_skin()
90 {
91 Glib::ustring toparse = "pixmap_path ";
92 toparse += " '";
93 toparse += GX_LV2_STYLE_DIR;
94 toparse += "/'\n";
95 toparse += "style \"gx_";
96 toparse += plug_name;
97 toparse += "_dark-paintbox\"\n"
98 " { \n"
99 "GxPaintBox::skin-gradient = {\n"
100 "{ 65536, 0, 0, 13107, 52428 }, \n"
101 "{ 52428, 0, 0, 0, 52428 },\n"
102 "{ 13107, 0, 0, 13107, 13107 }}\n"
103 " GxPaintBox::box-gradient = {\n"
104 "{ 0, 61, 61, 61, 62428 }, \n"
105 "{ 22768, 80, 83, 80, 42428 }, \n"
106 "{ 52428, 8, 8, 80, 32428 }, \n"
107 "{ 65536, 4, 4, 4, 52428 }} \n"
108 " GxPaintBox::icon-set =11\n"
109 " }\n"
110 "\n"
111 "style 'gx_head_expander_box' \n"
112 " { \n"
113 " fg[NORMAL] = '#c0c6d0' \n"
114 "font_name = 'sans 7.5 bold' \n"
115 " }\n";
116 toparse += addKnob;
117
118 toparse += " widget '*.amplabel' style:highest 'gx_head_expander_box'\n"
119 "widget '*.";
120 toparse += plug_name;
121 toparse += "' style 'gx_";
122 toparse += plug_name;
123 toparse += "_dark-paintbox' ";
124 toparse += " style 'gx_selector_";
125 toparse += plug_name;
126 toparse += "'\n"
127 " {\n"
128 " fg[NORMAL] = '#c0c6d0'\n"
129 " GtkRange::trough-border = 2\n"
130 " GtkRange::stepper-size = 8\n"
131 " GtkRange::stepper-spacing = 2\n"
132 " GxRegler::value-border = { 2, 2, 2, 2 }\n"
133 " font_name = 'sans 7.5'\n"
134 " xthickness = 10\n"
135 " ythickness = 1\n"
136 " }\n"
137 "widget '*.";
138 toparse += plug_name;
139 toparse += "' style:highest 'gx_selector_";
140 toparse += plug_name;
141 toparse += "'\n";
142 toparse += "style 'gx_switch'\n"
143 "{\n"
144 "xthickness = 0\n"
145 "ythickness = 0\n"
146 "GtkButton::inner-border = {0, 0, 0, 0}\n"
147 "GtkButton::default-border = {0, 0, 0, 0}\n"
148 "GtkButton::focus-line-width = 0\n"
149 "GtkButton::focus-padding = 0\n"
150 "GtkButton::interior-focus = 0\n"
151 "GtkButton::child-displacement-x = 0\n"
152 "GtkButton::child-displacement-y = 0\n"
153 " }\n"
154 "widget '*.";
155 toparse += plug_name;
156 toparse += "' style:highest 'gx_switch'";
157 toparse += "style 'gx_fastmeter'\n"
158 " {\n"
159 " GxFastMeter::clr-bottom = '#003808'\n"
160 " GxFastMeter::clr-middle = '#00ff00'\n"
161 " GxFastMeter::clr-top = '#ff0000'\n"
162 " GxFastMeter::over = '#ff0000'\n"
163 " }\n"
164 " class '*GxFastMeter' style:highest 'gx_fastmeter'\n";
165
166 gtk_rc_parse_string (toparse.c_str());
167 }
168
169 void Gx_mbdistortion_GUI::set_plug_name( const char * plugin_uri)
170 {
171 addKnob = "";
172
173 if (strcmp("http://guitarix.sourceforge.net/plugins/gx_mbdistortion_#_mbdistortion_", plugin_uri) == 0)
174 {
175 plug_name = "_mbdistortion_";
176 //set_knob("nm-knob");
177 }
178 else
179 {
180 plug_name = "_mbdistortion_";
181 }
182 }
183
184 GtkWidget* Gx_mbdistortion_GUI::make_gui()
185 {
186 // init the gxwmm library
187 Gxw::init();
188 set_skin();
189 GtkWidget* container = gtk_vbox_new(FALSE, 2);
190 widget = new Widget(plug_name);
191 GtkWidget* cWidget = GTK_WIDGET(widget->gobj());
192 gtk_container_add(GTK_CONTAINER(container), cWidget );
193
194 return container;
195 }
196
197
198 static LV2UI_Handle instantiate(const struct _LV2UI_Descriptor * descriptor,
199 const char * plugin_uri,
200 const char * bundle_path,
201 LV2UI_Write_Function write_function,
202 LV2UI_Controller controller,
203 LV2UI_Widget * widget,
204 const LV2_Feature * const * features)
205 {
206 Gx_mbdistortion_GUI* self = new Gx_mbdistortion_GUI();
207 if (self == NULL) return NULL;
208 self->set_plug_name_static(self, plugin_uri);
209 *widget = (LV2UI_Widget)self->make_gui_static(self);
210 self->widget->controller = controller;
211 self->widget->write_function = write_function;
212 return (LV2UI_Handle)self;
213 }
214
215 static void cleanup(LV2UI_Handle ui)
216 {
217 Gx_mbdistortion_GUI *pluginGui = static_cast<Gx_mbdistortion_GUI*>(ui);
218 delete pluginGui->widget;
219 delete pluginGui;
220 }
221
222 static void port_event(LV2UI_Handle ui,
223 uint32_t port_index,
224 uint32_t buffer_size,
225 uint32_t format,
226 const void * buffer)
227 {
228 Gx_mbdistortion_GUI *self = static_cast<Gx_mbdistortion_GUI*>(ui);
229 self->widget->set_value_static( port_index, buffer_size, format, buffer, self->widget);
230 return;
231 }
232
233 static LV2UI_Descriptor descriptors[] =
234 {
235 {GXPLUGIN_UI_URI, instantiate, cleanup, port_event, NULL}
236 };
237
238 const LV2UI_Descriptor * lv2ui_descriptor(uint32_t index)
239 {
240 //printf("lv2ui_descriptor(%u) called\n", (uint32_t)index);
241 if (index >= sizeof(descriptors) / sizeof(descriptors[0]))
242 {
243 return NULL;
244 }
245 return descriptors + index;
246 }
247
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_mbdistortion_#_mbdistortion_>
23 a lv2:Plugin ;
24 lv2:binary <gx_mbdistortion.so> ;
25 rdfs:seeAlso <gx_mbdistortion.ttl> .
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_mbdistortion_#_mbdistortion_>
23 a lv2:Plugin ;
24 lv2:binary <gx_mbdistortion@LIB_EXT@> ;
25 rdfs:seeAlso <gx_mbdistortion.ttl> .
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include "widget.h"
21
22 #include <iostream>
23
24 #define max(x, y) (((x) > (y)) ? (x) : (y))
25
26 /* @get controller by port
27 * this function is used by make_selector() make_controller_box()
28 * set_value() and on_value_changed()
29 * so controller widgets needs only here asined to a port,
30 * and all functions which need acess to the controller widget pointer
31 * can receive them by port number
32 */
33
34 Gtk::Widget* Widget::get_controller_by_port(uint32_t port_index)
35 {
36 switch ((PortIndex)port_index )
37 {
38 case DRIVE1:
39 return &m_smallknob[1];
40 case DRIVE2:
41 return &m_smallknob[2];
42 case DRIVE3:
43 return &m_smallknob[3];
44 case DRIVE4:
45 return &m_smallknob[4];
46 case DRIVE5:
47 return &m_smallknob[5];
48 case GAIN:
49 return &m_smallknob[6];
50 case OFFSET1:
51 return &m_smallknob[7];
52 case OFFSET2:
53 return &m_smallknob[8];
54 case OFFSET3:
55 return &m_smallknob[9];
56 case OFFSET4:
57 return &m_smallknob[10];
58 case OFFSET5:
59 return &m_smallknob[11];
60 case CROSSOVER_B1_B2:
61 return &m_smallknob[12];
62 case CROSSOVER_B2_B3:
63 return &m_smallknob[13];
64 case CROSSOVER_B3_B4:
65 return &m_smallknob[14];
66 case CROSSOVER_B4_B5:
67 return &m_smallknob[15];
68 default:
69 return NULL;
70 }
71 }
72
73 Widget::Widget(Glib::ustring plugname):
74 plug_name(plugname)
75 {
76 m_fr[0].set_label("BAND 1");
77 m_fr[0].add(m_lbox[0]);
78 m_fr[1].set_label("BAND 2");
79 m_fr[1].add(m_lbox[1]);
80 m_fr[2].set_label("BAND 3");
81 m_fr[2].add(m_lbox[2]);
82 m_fr[3].set_label("BAND 4");
83 m_fr[3].add(m_lbox[3]);
84 m_fr[4].set_label("BAND 5");
85 m_fr[4].add(m_lbox[4]);
86 m_fr[5].set_label("OUT");
87 m_fr[6].set_label("BAND PASS");
88 // create controllers for port name
89 make_controller_box(&m_vbox[1], "DRIVE ", 0.0, 1.0, 0.01, DRIVE1, false);
90 make_controller_box(&m_vbox[2], "DRIVE ", 0.0, 1.0, 0.01, DRIVE2, false);
91 make_controller_box(&m_vbox[3], "DRIVE ", 0.0, 1.0, 0.01, DRIVE3, false);
92 make_controller_box(&m_vbox[4], "DRIVE ", 0.0, 1.0, 0.01, DRIVE4, false);
93 make_controller_box(&m_vbox[5], "DRIVE ", 0.0, 1.0, 0.01, DRIVE5, false);
94
95 make_controller_box(&m_vbox[6], "Gain ", -4e+01, 4.0, 0.1 , GAIN, false);
96
97 make_controller_box(&m_vbox[1], "OFFSET ", 0.0, 0.5, 0.01, OFFSET1, false);
98 make_controller_box(&m_vbox[2], "OFFSET ", 0.0, 0.5, 0.01, OFFSET2, false);
99 make_controller_box(&m_vbox[3], "OFFSET ", 0.0, 0.5, 0.01, OFFSET3, false);
100 make_controller_box(&m_vbox[4], "OFFSET ", 0.0, 0.5, 0.01, OFFSET4, false);
101 make_controller_box(&m_vbox[5], "OFFSET ", 0.0, 0.5, 0.01, OFFSET5, false);
102
103 make_controller_box(&m_vbox[7], "LOW PASS \n B1><B2",
104 2e+01, 2e+04, 1.08 , CROSSOVER_B1_B2, true);
105 make_controller_box(&m_vbox[8], "CROSSOVER \n B2><B3",
106 2e+01, 2e+04, 1.08 , CROSSOVER_B2_B3, true);
107 make_controller_box(&m_vbox[9], "CROSSOVER \n B3><B4 ",
108 2e+01, 2e+04, 1.08 , CROSSOVER_B3_B4, true);
109 make_controller_box(&m_vbox[10], "HIGH PASS \n B4><B5",
110 2e+01, 2e+04, 1.08 , CROSSOVER_B4_B5, true);
111
112 // set propertys for the main paintbox holding the skin
113 m_paintbox[0].set_border_width(10);
114 m_paintbox[0].set_spacing(6);
115 m_paintbox[0].set_homogeneous(false);
116 m_paintbox[0].set_name(plug_name);
117 m_paintbox[0].property_paint_func() = "gxhead_expose";
118 add(m_paintbox[0]);
119
120 for (uint32_t i = 0;i<5;i++) {
121 fastmeter[i].set_hold_count(12);
122 fastmeter[i].set_property("dimen",5);
123 m_paintbox[i+1].property_paint_func() = "RackBox_expose";
124 m_paintbox[i+1].set_name(plug_name);
125 m_paintbox[i+1].set_border_width(5);
126 m_paintbox[i+1].pack_start(fastmeter[i]);
127 }
128
129 // set a vertical box in the paintbox
130 m_vbox[11].set_border_width(14);
131 m_vbox[12].set_border_width(14);
132 m_hbox[2].set_border_width(4);
133 m_paintbox[0].pack_start(m_vbox[0]);
134 // box for the controllers
135 m_hbox[0].set_spacing(4);
136 m_hbox[0].set_border_width(4);
137 m_hbox[0].set_homogeneous(false);
138 m_vbox[0].pack_start(m_hbox[0]);
139 m_hbox[3].pack_start(m_hbox[4]);
140 m_hbox[3].pack_start(m_fr[6]);
141 m_hbox[3].pack_start(m_hbox[5]);
142 m_fr[6].add(m_hbox[1]);
143 m_vbox[0].pack_start(m_hbox[3]);
144 m_vbox[0].pack_start(m_hbox[2]);
145 // put boxed controllers into controller box
146 m_hbox[0].pack_start(m_vbox[11], Gtk::PACK_EXPAND_PADDING);
147 m_hbox[0].pack_start(m_fr[0]);
148 m_lbox[0].pack_start(m_vbox[1]);
149 m_lbox[0].pack_start(m_paintbox[1],Gtk::PACK_SHRINK);
150 m_hbox[0].pack_start(m_fr[1]);
151 m_lbox[1].pack_start(m_vbox[2]);
152 m_lbox[1].pack_start(m_paintbox[2],Gtk::PACK_SHRINK);
153 m_hbox[0].pack_start(m_fr[2]);
154 m_lbox[2].pack_start(m_vbox[3]);
155 m_lbox[2].pack_start(m_paintbox[3],Gtk::PACK_SHRINK);
156 m_hbox[0].pack_start(m_fr[3]);
157 m_lbox[3].pack_start(m_vbox[4]);
158 m_lbox[3].pack_start(m_paintbox[4],Gtk::PACK_SHRINK);
159 m_hbox[0].pack_start(m_fr[4]);
160 m_lbox[4].pack_start(m_vbox[5]);
161 m_lbox[4].pack_start(m_paintbox[5],Gtk::PACK_SHRINK);
162 m_hbox[0].pack_start(m_fr[5]);
163 m_fr[5].add(m_vbox[6]);
164 m_hbox[0].pack_start(m_vbox[12], Gtk::PACK_EXPAND_PADDING);
165 // put boxed controllers into controller box
166 m_hbox[1].pack_start(m_vbox[13], Gtk::PACK_EXPAND_PADDING);
167 m_hbox[1].pack_start(m_vbox[7]);
168 m_hbox[1].pack_start(m_vbox[8]);
169 m_hbox[1].pack_start(m_vbox[9]);
170 m_hbox[1].pack_start(m_vbox[10]);
171 m_hbox[1].pack_start(m_vbox[14], Gtk::PACK_EXPAND_PADDING);
172
173 set_app_paintable(true);
174 show_all();
175 }
176
177 Widget::~Widget()
178 {
179
180 }
181
182 // create selectors from gxwmm
183 void Widget::make_selector(Glib::ustring labela,
184 Glib::ustring tables[],
185 size_t _size,
186 float min, float digits,
187 PortIndex port_name)
188 {
189 Gxw::Selector *regler = static_cast<Gxw::Selector*>
190 (get_controller_by_port(port_name));
191 if (regler)
192 {
193 float max = static_cast<float>(_size+1);
194
195 Gtk::TreeModelColumn<Glib::ustring> label;
196 Gtk::TreeModelColumnRecord rec;
197 rec.add(label);
198 Glib::RefPtr<Gtk::ListStore> ls = Gtk::ListStore::create(rec);
199
200 for (uint32_t i = 0 ; i< _size; ++i) {
201 ls->append()->set_value(0, tables[i]);
202 }
203 regler->set_model(ls);
204 regler->set_has_tooltip();
205 regler->set_tooltip_text(labela);
206 regler->cp_configure("SELECTOR", labela, min, max, digits);
207 regler->set_show_value(false);
208 regler->set_name(plug_name);
209 regler->signal_value_changed().connect(sigc::bind(sigc::mem_fun(
210 *this, &Widget::on_value_changed), port_name));
211 }
212 }
213
214 // create stackboxes with controllers for port name
215 void Widget::make_controller_box(Gtk::Box *box,
216 Glib::ustring label,
217 float min, float max,
218 float digits,
219 PortIndex port_name,
220 bool show_value)
221 {
222 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
223 get_controller_by_port(port_name));
224 if (regler)
225 {
226 Gtk::Label* pr = new Gtk::Label(label, 0);
227 pr->set_name("amplabel");
228 // use label images instead simple string labes
229 /*Glib::ustring label_image = GX_LV2_STYLE_DIR;
230 label_image += "/";
231 label_image += label;
232 label_image += "-label.png";
233 Gtk::Image *pr = new Gtk::Image(label_image);*/
234
235 Gtk::VBox* b1 = new Gtk::VBox();
236 box->pack_start( *Gtk::manage(b1), Gtk::PACK_EXPAND_PADDING);
237 box->pack_start( *Gtk::manage(pr),Gtk::PACK_SHRINK);
238 regler->cp_configure("KNOB", label, min, max, digits);
239 regler->set_show_value(show_value);
240 regler->set_name(plug_name);
241 box->pack_start(*regler,Gtk::PACK_SHRINK);
242 Gtk::VBox* b2 = new Gtk::VBox();
243 box->pack_start( *Gtk::manage(b2), Gtk::PACK_EXPAND_PADDING);
244 regler->signal_value_changed().connect(sigc::bind(sigc::mem_fun(
245 *this, &Widget::on_value_changed), port_name));
246 }
247 }
248
249 // create stackboxes with switch controller for port name
250 void Widget::make_switch_box(Gtk::Box *box,
251 Glib::ustring label,
252 PortIndex port_name)
253 {
254 Gxw::Switch *regler = static_cast<Gxw::Switch*>(
255 get_controller_by_port(port_name));
256 if (regler)
257 {
258 Gtk::Label* pr = new Gtk::Label(label, 0);
259 pr->set_name("amplabel");
260 // use label images instead simple string labes
261 /*Glib::ustring label_image = GX_LV2_STYLE_DIR;
262 label_image += "/"+plug_name+"-";
263 label_image += label;
264 label_image += "-label.png";
265 Gtk::Image *pr = new Gtk::Image(label_image);*/
266
267 regler->cp_configure("switch", label, 0, 1, 1);
268 regler->set_name(plug_name);
269 regler->set_base_name( "button" );
270 Gtk::VBox* b1 = new Gtk::VBox();
271 box->pack_start( *Gtk::manage(b1), Gtk::PACK_EXPAND_PADDING);
272 box->pack_start( *Gtk::manage(pr),Gtk::PACK_SHRINK);
273 box->pack_start(*regler,Gtk::PACK_SHRINK);
274 Gtk::VBox* b2 = new Gtk::VBox();
275 box->pack_start( *Gtk::manage(b2), Gtk::PACK_EXPAND_PADDING);
276 regler->signal_toggled().connect(sigc::bind(sigc::mem_fun(
277 *this, &Widget::on_value_changed), port_name));
278 }
279 }
280
281 // receive controller value changes from host and set them to controller
282 void Widget::set_value(uint32_t port_index,
283 uint32_t format,
284 const void * buffer)
285 {
286 if ( format == 0 )
287 {
288 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
289 get_controller_by_port(port_index));
290 float value = *static_cast<const float*>(buffer);
291 if (regler) regler->cp_set_value(value);
292 else if (port_index == V1) refresh_meter_level(0,value);
293 else if (port_index == V2) refresh_meter_level(1,value);
294 else if (port_index == V3) refresh_meter_level(2,value);
295 else if (port_index == V4) refresh_meter_level(3,value);
296 else if (port_index == V5) refresh_meter_level(4,value);
297 }
298 }
299
300 // write (UI) controller value changes to the host->engine
301 void Widget::on_value_changed(uint32_t port_index)
302 {
303 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
304 get_controller_by_port(port_index));
305 if (regler)
306 {
307 float value = regler->cp_get_value();
308 write_function(controller, port_index, sizeof(float), 0,
309 static_cast<const void*>(&value));
310 }
311 }
312
313 void Widget::refresh_meter_level(int m, float new_level) {
314 fastmeter[m].set_by_power(new_level);
315 }
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_WIDGET_H_
22 #define SRC_HEADERS_WIDGET_H_
23
24 #include <gtkmm.h>
25 #include <gxwmm.h>
26 #include "gx_mbdistortion.h"
27 #include "../config.h" // for GX_STYLE_DIR
28 // LV2UI stuff
29 #include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
30
31 class Widget : public Gtk::HBox
32 {
33 private:
34 Gtk::Widget* get_controller_by_port(uint32_t port_index);
35
36 void refresh_meter_level(int meter,float new_level);
37
38 void on_value_changed(uint32_t port_index);
39
40 void make_controller_box(Gtk::Box *box,
41 Glib::ustring label,
42 float min, float max,
43 float digits,
44 PortIndex port_name,
45 bool show_value);
46
47
48 void make_selector(Glib::ustring label,
49 Glib::ustring tables[],
50 size_t _size,
51 float min, float digits,
52 PortIndex port_name);
53
54 void make_switch_box(Gtk::Box *box,
55 Glib::ustring label,
56 PortIndex port_name);
57
58 void set_value(uint32_t port_index,
59 uint32_t format,
60 const void * buffer);
61 public:
62
63 // public Lv2 communication stuff
64 LV2UI_Controller controller;
65 LV2UI_Write_Function write_function;
66 static void set_value_static(uint32_t port_index,
67 uint32_t buffer_size,
68 uint32_t format,
69 const void * buffer, Widget *self)
70 {
71 self->set_value(port_index,format,buffer);
72 }
73
74 Widget(Glib::ustring plugname);
75 ~Widget();
76
77 protected:
78 Glib::ustring plug_name;
79 Gtk::VBox m_vbox[15];
80 Gtk::HBox m_hbox[6];
81 Gtk::HBox m_lbox[5];
82 Gtk::Frame m_fr[7];
83
84 Gxw::SmallKnob m_smallknob[16];
85 Gxw::FastMeter fastmeter[5];
86 Gxw::PaintBox m_paintbox[6];
87 };
88
89 #endif //SRC_HEADERS_WIDGET_H_
0 #!/usr/bin/env python
1 # encoding: utf-8
2
3 import sys, os, TaskGen, ctypes
4
5 def configure(conf):
6 pass
7
8 def build(bld):
9 bundle = 'gx_mbdistortion.lv2'
10
11 src = ['gx_mbdistortion.cpp'
12 ]
13 incl = ['../faust','./', '../DSP']
14 lib = []
15 if sys.platform.startswith("linux"):
16 lib.append('dl')
17 uselib = ['LV2CORE']
18 cxxflag =[]
19 if not bld.env['OPT'] and bld.env['SSE2']:
20 cxxflag = [ "-msse2", "-mfpmath=sse"]
21 lv2_effects = bld(
22 features='cxx cshlib ',
23 includes = incl,
24 lib = lib,
25 uselib = uselib,
26 obj_ext = '_14.o',
27 cxxflags = cxxflag,
28 defines = ["LV2_SO"],
29 target = 'gx_mbdistortion',
30 source = src,
31 install_path = '${LV2DIR}/%s' % bundle,
32 chmod = 0o755,
33 )
34 lv2_effects.env['shlib_PATTERN'] = '%s.so'
35
36 uselib_local5 = []
37 libpath5 = []
38 lib5 = []
39 incl5 = ['../../../libgxwmm','../../../libgxw','../']
40 if sys.platform.startswith("linux"):
41 lib5.append('dl')
42 if bld.env["GX_LIB_SHARED"]:
43 lib5 += ['gxwmm','gxw']
44 libpath5 += [bld.path.find_dir("../../../libgxw/gxw").bldpath(bld.env),
45 bld.path.find_dir("../../../libgxwmm/gxwmm").bldpath(bld.env)]
46 else:
47 uselib_local5 += ['gxwmm','gxw']
48
49 lv2_effetcs_gui = bld(
50 features='cxx cshlib ',
51 includes = incl5,
52 lib = lib5,
53 uselib = 'LV2CORE GTKMM',
54 libpath = libpath5,
55 uselib_local = uselib_local5,
56 linkflags = '-Wl,-z,nodelete',
57 defines = ["LV2_GUI"],
58 target = 'gx_mbdistortion_gui',
59 source = 'widget.cpp gx_mbdistortion_gui.cpp',
60 install_path = '${LV2DIR}/%s' % bundle,
61 chmod = 0o755,
62 )
63 lv2_effetcs_gui.env['shlib_PATTERN'] = '%s.so'
64
65
66 install_path = '${LV2DIR}/%s' % bundle,
67 bld.install_files('${LV2DIR}/gx_mbdistortion.lv2', 'manifest.ttl')
68 bld.install_files('${LV2DIR}/gx_mbdistortion.lv2', 'gx_mbdistortion.ttl')
69
70 bld.install_files('${LV2DIR}/gx_mbdistortion.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 ////////////////////////////// LOCAL INCLUDES //////////////////////////
21
22 #include "gx_common.h" // faust support and denormal protection (SSE)
23 #include "gx_mbecho.h" // define struct PortIndex
24 #include "gx_pluginlv2.h" // define struct PluginLV2
25 #include "mbe.cc" // dsp class generated by faust -> dsp2cc
26
27 ////////////////////////////// PLUG-IN CLASS ///////////////////////////
28
29 class Gx_mbecho_
30 {
31 private:
32 // pointer to buffer
33 float* output;
34 float* input;
35 // pointer to dsp class
36 PluginLV2* mbecho;
37 // private functions
38 inline void run_dsp_(uint32_t n_samples);
39 inline void connect_(uint32_t port,void* data);
40 inline void init_dsp_(uint32_t rate);
41 inline void connect_all__ports(uint32_t port, void* data);
42 inline void activate_f();
43 inline void clean_up();
44 inline void deactivate_f();
45
46 public:
47 // LV2 Descriptor
48 static const LV2_Descriptor descriptor;
49 // static wrapper to private functions
50 static void deactivate(LV2_Handle instance);
51 static void cleanup(LV2_Handle instance);
52 static void run(LV2_Handle instance, uint32_t n_samples);
53 static void activate(LV2_Handle instance);
54 static void connect_port(LV2_Handle instance, uint32_t port, void* data);
55 static LV2_Handle instantiate(const LV2_Descriptor* descriptor,
56 double rate, const char* bundle_path,
57 const LV2_Feature* const* features);
58 Gx_mbecho_();
59 ~Gx_mbecho_();
60 };
61
62 // constructor
63 Gx_mbecho_::Gx_mbecho_() :
64 output(NULL),
65 input(NULL),
66 mbecho(mbe::plugin()) {};
67
68 // destructor
69 Gx_mbecho_::~Gx_mbecho_()
70 {
71 // just to be sure the plug have given free the allocated mem
72 // it didn't hurd if the mem is already given free by clean_up()
73 if (mbecho->activate_plugin !=0)
74 mbecho->activate_plugin(false, mbecho);
75 // delete DSP class
76 mbecho->delete_instance(mbecho);
77 };
78
79 ///////////////////////// PRIVATE CLASS FUNCTIONS /////////////////////
80
81 void Gx_mbecho_::init_dsp_(uint32_t rate)
82 {
83 AVOIDDENORMALS(); // init the SSE denormal protection
84 mbecho->set_samplerate(rate, mbecho); // init the DSP class
85 }
86
87 // connect the Ports used by the plug-in class
88 void Gx_mbecho_::connect_(uint32_t port,void* data)
89 {
90 switch ((PortIndex)port)
91 {
92 case EFFECTS_OUTPUT:
93 output = static_cast<float*>(data);
94 break;
95 case EFFECTS_INPUT:
96 input = static_cast<float*>(data);
97 break;
98 default:
99 break;
100 }
101 }
102
103 void Gx_mbecho_::activate_f()
104 {
105 // allocate the internal DSP mem
106 if (mbecho->activate_plugin !=0)
107 mbecho->activate_plugin(true, mbecho);
108 }
109
110 void Gx_mbecho_::clean_up()
111 {
112 // delete the internal DSP mem
113 if (mbecho->activate_plugin !=0)
114 mbecho->activate_plugin(false, mbecho);
115 }
116
117 void Gx_mbecho_::deactivate_f()
118 {
119 // delete the internal DSP mem
120 if (mbecho->activate_plugin !=0)
121 mbecho->activate_plugin(false, mbecho);
122 }
123
124 void Gx_mbecho_::run_dsp_(uint32_t n_samples)
125 {
126 mbecho->mono_audio(static_cast<int>(n_samples), input, output, mbecho);
127 }
128
129 void Gx_mbecho_::connect_all__ports(uint32_t port, void* data)
130 {
131 // connect the Ports used by the plug-in class
132 connect_(port,data);
133 // connect the Ports used by the DSP class
134 mbecho->connect_ports(port, data, mbecho);
135 }
136
137 ////////////////////// STATIC CLASS FUNCTIONS ////////////////////////
138
139 LV2_Handle
140 Gx_mbecho_::instantiate(const LV2_Descriptor* descriptor,
141 double rate, const char* bundle_path,
142 const LV2_Feature* const* features)
143 {
144 // init the plug-in class
145 Gx_mbecho_ *self = new Gx_mbecho_();
146 if (!self)
147 {
148 return NULL;
149 }
150
151 self->init_dsp_((uint32_t)rate);
152
153 return (LV2_Handle)self;
154 }
155
156 void Gx_mbecho_::connect_port(LV2_Handle instance,
157 uint32_t port, void* data)
158 {
159 // connect all ports
160 static_cast<Gx_mbecho_*>(instance)->connect_all__ports(port, data);
161 }
162
163 void Gx_mbecho_::activate(LV2_Handle instance)
164 {
165 // allocate needed mem
166 static_cast<Gx_mbecho_*>(instance)->activate_f();
167 }
168
169 void Gx_mbecho_::run(LV2_Handle instance, uint32_t n_samples)
170 {
171 // run dsp
172 static_cast<Gx_mbecho_*>(instance)->run_dsp_(n_samples);
173 }
174
175 void Gx_mbecho_::deactivate(LV2_Handle instance)
176 {
177 // free allocated mem
178 static_cast<Gx_mbecho_*>(instance)->deactivate_f();
179 }
180
181 void Gx_mbecho_::cleanup(LV2_Handle instance)
182 {
183 // well, clean up after us
184 Gx_mbecho_* self = static_cast<Gx_mbecho_*>(instance);
185 self->clean_up();
186 delete self;
187 }
188
189 const LV2_Descriptor Gx_mbecho_::descriptor =
190 {
191 GXPLUGIN_URI "#_mbecho_",
192 Gx_mbecho_::instantiate,
193 Gx_mbecho_::connect_port,
194 Gx_mbecho_::activate,
195 Gx_mbecho_::run,
196 Gx_mbecho_::deactivate,
197 Gx_mbecho_::cleanup,
198 NULL
199 };
200
201 ////////////////////////// LV2 SYMBOL EXPORT ///////////////////////////
202
203 extern "C"
204 LV2_SYMBOL_EXPORT
205 const LV2_Descriptor*
206 lv2_descriptor(uint32_t index)
207 {
208 switch (index)
209 {
210 case 0:
211 return &Gx_mbecho_::descriptor;
212 default:
213 return NULL;
214 }
215 }
216
217 ///////////////////////////// FIN //////////////////////////////////////
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_GXEFFECTS_H_
22 #define SRC_HEADERS_GXEFFECTS_H_
23
24 #include <lv2.h>
25
26 #define GXPLUGIN_URI "http://guitarix.sourceforge.net/plugins/gx_mbecho_"
27 #define GXPLUGIN_UI_URI "http://guitarix.sourceforge.net/plugins/gx_mbecho_#gui"
28
29
30 typedef enum
31 {
32 PERCENT1,
33 PERCENT2,
34 PERCENT3,
35 PERCENT4,
36 PERCENT5,
37 TIME1,
38 TIME2,
39 TIME3,
40 TIME4,
41 TIME5,
42 CROSSOVER_B1_B2,
43 CROSSOVER_B2_B3,
44 CROSSOVER_B3_B4,
45 CROSSOVER_B4_B5,
46 V1,
47 V2,
48 V3,
49 V4,
50 V5,
51 EFFECTS_OUTPUT,
52 EFFECTS_INPUT,
53 } PortIndex;
54
55 #endif //SRC_HEADERS_GXEFFECTS_H_
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19
20 @prefix doap: <http://usefulinc.com/ns/doap#> .
21 @prefix foaf: <http://xmlns.com/foaf/0.1/> .
22 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
23 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
24 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
25 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26
27 <http://guitarix.sourceforge.net#me>
28 a foaf:Person ;
29 foaf:name "Guitarix team" ;
30 foaf:mbox <mailto:brummer@web.de> ;
31 rdfs:seeAlso <http://guitarix.sourceforge.net> .
32
33 <http://guitarix.sourceforge.net/plugins/gx_mbecho_>
34 a doap:Project ;
35 doap:maintainer <http://guitarix.sourceforge.net#me> ;
36 doap:name "Gx_mbecho_" .
37
38 <http://guitarix.sourceforge.net/plugins/gx_mbecho_#_mbecho_>
39 a lv2:Plugin ,
40 lv2:DelayPlugin ;
41 doap:maintainer <http://guitarix.sourceforge.net#me> ;
42 doap:name "GxMultiBandEcho";
43 doap:license <http://opensource.org/licenses/isc> ;
44 lv2:project <http://guitarix.sourceforge.net/plugins/gx_mbecho_> ;
45 lv2:optionalFeature lv2:hardRTCapable ;
46
47 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_mbecho_#gui>;
48
49 lv2:minorVersion 28;
50 lv2:microVersion 3;
51
52 lv2:port [
53 a lv2:InputPort ,
54 lv2:ControlPort ;
55 lv2:index 0 ;
56 lv2:symbol "PERCENT1" ;
57 lv2:name "PERCENT1";
58 lv2:default 1e+01;
59 lv2:minimum 0.0 ;
60 lv2:maximum 1e+02 ;
61 ] , [
62 a lv2:InputPort ,
63 lv2:ControlPort ;
64 lv2:index 1 ;
65 lv2:symbol "PERCENT2" ;
66 lv2:name "PERCENT2";
67 lv2:default 3e+01 ;
68 lv2:minimum 0.0 ;
69 lv2:maximum 1e+02 ;
70 ] , [
71 a lv2:InputPort ,
72 lv2:ControlPort ;
73 lv2:index 2 ;
74 lv2:symbol "PERCENT3" ;
75 lv2:name "PERCENT3";
76 lv2:default 45.0 ;
77 lv2:minimum 0.0 ;
78 lv2:maximum 1e+02 ;
79 ] , [
80 a lv2:InputPort ,
81 lv2:ControlPort ;
82 lv2:index 3 ;
83 lv2:symbol "PERCENT4" ;
84 lv2:name "PERCENT4";
85 lv2:default 2e+01 ;
86 lv2:minimum 0.0 ;
87 lv2:maximum 1e+02 ;
88 ] , [
89 a lv2:InputPort ,
90 lv2:ControlPort ;
91 lv2:index 4 ;
92 lv2:symbol "PERCENT5" ;
93 lv2:name "PERCENT5";
94 lv2:default 0.0 ;
95 lv2:minimum 0.0 ;
96 lv2:maximum 1e+02 ;
97 ] , [
98 a lv2:InputPort ,
99 lv2:ControlPort ;
100 lv2:index 5 ;
101 lv2:symbol "TIME1" ;
102 lv2:name "TIME1";
103 lv2:default 3e+01;
104 lv2:minimum 24.0 ;
105 lv2:maximum 3.6e+02 ;
106 ] , [
107 a lv2:InputPort ,
108 lv2:ControlPort ;
109 lv2:index 6 ;
110 lv2:symbol "TIME2" ;
111 lv2:name "TIME2";
112 lv2:default 6e+01 ;
113 lv2:minimum 24.0 ;
114 lv2:maximum 3.6e+02 ;
115 ] , [
116 a lv2:InputPort ,
117 lv2:ControlPort ;
118 lv2:index 7 ;
119 lv2:symbol "TIME3" ;
120 lv2:name "TIME3";
121 lv2:default 1.2e+02 ;
122 lv2:minimum 24.0 ;
123 lv2:maximum 3.6e+02 ;
124 ] , [
125 a lv2:InputPort ,
126 lv2:ControlPort ;
127 lv2:index 8 ;
128 lv2:symbol "TIME4" ;
129 lv2:name "TIME4";
130 lv2:default 1.5e+02 ;
131 lv2:minimum 24.0 ;
132 lv2:maximum 3.6e+02 ;
133 ] , [
134 a lv2:InputPort ,
135 lv2:ControlPort ;
136 lv2:index 9 ;
137 lv2:symbol "TIME5" ;
138 lv2:name "TIME5";
139 lv2:default 2.4e+02 ;
140 lv2:minimum 24.0 ;
141 lv2:maximum 3.6e+02 ;
142 ] , [
143 a lv2:InputPort ,
144 lv2:ControlPort ;
145 lv2:index 10 ;
146 lv2:symbol "CROSSOVER_B1_B2" ;
147 lv2:name "LOW SHELF";
148 lv2:default 8e+01 ;
149 lv2:minimum 2e+01 ;
150 lv2:maximum 2e+04 ;
151 ] , [
152 a lv2:InputPort ,
153 lv2:ControlPort ;
154 lv2:index 11 ;
155 lv2:symbol "CROSSOVER_B2_B3" ;
156 lv2:name "CROSSOVER_B2_B3";
157 lv2:default 2.1e+02 ;
158 lv2:minimum 2e+01 ;
159 lv2:maximum 2e+04 ;
160 ] , [
161 a lv2:InputPort ,
162 lv2:ControlPort ;
163 lv2:index 12 ;
164 lv2:symbol "CROSSOVER_B3_B4" ;
165 lv2:name "CROSSOVER_B3_B4";
166 lv2:default 1.7e+03 ;
167 lv2:minimum 2e+01 ;
168 lv2:maximum 2e+04 ;
169 ] , [
170 a lv2:InputPort ,
171 lv2:ControlPort ;
172 lv2:index 13 ;
173 lv2:symbol "CROSSOVER_B4_B5" ;
174 lv2:name "CROSSOVER_B4_B5";
175 lv2:default 5e+03 ;
176 lv2:minimum 2e+01 ;
177 lv2:maximum 2e+04 ;
178 ] , [
179 a lv2:ControlPort, lv2:OutputPort ;
180 lv2:index 14 ;
181 lv2:symbol "V1" ;
182 lv2:name "V1";
183 lv2:default 0.0 ;
184 lv2:minimum -70.0 ;
185 lv2:maximum 4.0 ;
186 ] , [
187 a lv2:ControlPort, lv2:OutputPort ;
188 lv2:index 15 ;
189 lv2:symbol "V2" ;
190 lv2:name "V2";
191 lv2:default 0.0 ;
192 lv2:minimum -70.0 ;
193 lv2:maximum 4.0 ;
194 ] , [
195 a lv2:ControlPort, lv2:OutputPort ;
196 lv2:index 16 ;
197 lv2:symbol "V3" ;
198 lv2:name "V3";
199 lv2:default 0.0 ;
200 lv2:minimum -70.0 ;
201 lv2:maximum 4.0 ;
202 ] , [
203 a lv2:ControlPort, lv2:OutputPort ;
204 lv2:index 17 ;
205 lv2:symbol "V4" ;
206 lv2:name "V4";
207 lv2:default 0.0 ;
208 lv2:minimum -70.0 ;
209 lv2:maximum 4.0 ;
210 ] , [
211 a lv2:ControlPort, lv2:OutputPort ;
212 lv2:index 18 ;
213 lv2:symbol "V5" ;
214 lv2:name "V5";
215 lv2:default 0.0 ;
216 lv2:minimum -70.0 ;
217 lv2:maximum 4.0 ;
218 ] , [
219 a lv2:AudioPort ,
220 lv2:OutputPort ;
221 lv2:index 19 ;
222 lv2:symbol "out" ;
223 lv2:name "Out"
224 ] , [
225 a lv2:AudioPort ,
226 lv2:InputPort ;
227 lv2:index 20 ;
228 lv2:symbol "in" ;
229 lv2:name "In" ;
230 ].
231
232 <http://guitarix.sourceforge.net/plugins/gx_mbecho_#gui>
233 a guiext:GtkUI;
234 guiext:binary <gx_mbecho_gui.so>;
235 guiext:requiredFeature guiext:makeResident .
236
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include <string>
21 #include <iostream>
22
23 #include <gtkmm.h>
24 #include "gx_mbecho.h"
25 #include "widget.h"
26
27
28 #include <lv2.h>
29 #include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
30
31 using namespace std;
32
33 class Gx_mbecho_GUI
34 {
35 private:
36 Glib::ustring plugskin;
37 Glib::ustring addKnob;
38 Glib::ustring plug_name;
39 void set_knob(Glib::ustring knob);
40 void set_skin();
41 void set_plug_name(const char * plugin_uri);
42 GtkWidget* make_gui();
43 public:
44
45 Widget* widget;
46 static void set_plug_name_static(Gx_mbecho_GUI *self, const char * plugin_uri)
47 {
48 self->set_plug_name(plugin_uri);
49 }
50 static GtkWidget* make_gui_static(Gx_mbecho_GUI *self)
51 {
52 return self->make_gui();
53 }
54
55 Gx_mbecho_GUI () {};
56 ~Gx_mbecho_GUI () {};
57 } ;
58
59 void Gx_mbecho_GUI::set_knob( Glib::ustring knob)
60 {
61 addKnob = " style 'gx_";
62 addKnob += plug_name;
63 addKnob += "_dark_skin_icons'\n"
64 " { \n"
65 " stock['bigknob'] = {{'";
66 addKnob += knob;
67 addKnob += ".png'}}\n"
68 " stock['smallknob'] = {{'";
69 addKnob += knob;
70 addKnob += "-small.png'}}\n"
71 " stock['smallknobr'] = {{'";
72 addKnob += knob;
73 addKnob += "-middle.png'}}\n"
74 " stock['button_on'] = {{'"
75 "echo-switch_on.png'}}\n"
76 " stock['button_off'] = {{'"
77 "echo-switch_off.png'}}\n"
78 " }\n"
79 "widget '*.";
80 addKnob += plug_name;
81 addKnob += "' style 'gx_";
82 addKnob += plug_name;
83 addKnob += "_dark_skin_icons' \n"
84 "class '*GxToggleImage' style'gx_";
85 addKnob += plug_name;
86 addKnob += "_dark_skin_icons' \n";
87 }
88
89 void Gx_mbecho_GUI::set_skin()
90 {
91 Glib::ustring toparse = "pixmap_path ";
92 toparse += " '";
93 toparse += GX_LV2_STYLE_DIR;
94 toparse += "/'\n";
95 toparse += "style \"gx_";
96 toparse += plug_name;
97 toparse += "_dark-paintbox\"\n"
98 " { \n"
99 "GxPaintBox::skin-gradient = {\n"
100 "{ 65536, 0, 0, 13107, 52428 }, \n"
101 "{ 52428, 0, 0, 0, 52428 },\n"
102 "{ 13107, 0, 0, 13107, 13107 }}\n"
103 " GxPaintBox::box-gradient = {\n"
104 "{ 0, 61, 61, 61, 62428 }, \n"
105 "{ 22768, 80, 83, 80, 42428 }, \n"
106 "{ 52428, 8, 8, 80, 32428 }, \n"
107 "{ 65536, 4, 4, 4, 52428 }} \n"
108 " GxPaintBox::icon-set =11\n"
109 " }\n"
110 "\n"
111 "style 'gx_head_expander_box' \n"
112 " { \n"
113 " fg[NORMAL] = '#c0c6d0' \n"
114 "font_name = 'sans 7.5 bold' \n"
115 " }\n";
116 toparse += addKnob;
117
118 toparse += " widget '*.amplabel' style:highest 'gx_head_expander_box'\n"
119 "widget '*.";
120 toparse += plug_name;
121 toparse += "' style 'gx_";
122 toparse += plug_name;
123 toparse += "_dark-paintbox' ";
124 toparse += " style 'gx_selector_";
125 toparse += plug_name;
126 toparse += "'\n"
127 " {\n"
128 " fg[NORMAL] = '#c0c6d0'\n"
129 " GtkRange::trough-border = 2\n"
130 " GtkRange::stepper-size = 8\n"
131 " GtkRange::stepper-spacing = 2\n"
132 " GxRegler::value-border = { 2, 2, 2, 2 }\n"
133 " font_name = 'sans 7.5'\n"
134 " xthickness = 10\n"
135 " ythickness = 1\n"
136 " }\n"
137 "widget '*.";
138 toparse += plug_name;
139 toparse += "' style:highest 'gx_selector_";
140 toparse += plug_name;
141 toparse += "'\n";
142 toparse += "style 'gx_switch'\n"
143 "{\n"
144 "xthickness = 0\n"
145 "ythickness = 0\n"
146 "GtkButton::inner-border = {0, 0, 0, 0}\n"
147 "GtkButton::default-border = {0, 0, 0, 0}\n"
148 "GtkButton::focus-line-width = 0\n"
149 "GtkButton::focus-padding = 0\n"
150 "GtkButton::interior-focus = 0\n"
151 "GtkButton::child-displacement-x = 0\n"
152 "GtkButton::child-displacement-y = 0\n"
153 " }\n"
154 "widget '*.";
155 toparse += plug_name;
156 toparse += "' style:highest 'gx_switch'";
157 toparse += "style 'gx_fastmeter'\n"
158 " {\n"
159 " GxFastMeter::clr-bottom = '#003808'\n"
160 " GxFastMeter::clr-middle = '#00ff00'\n"
161 " GxFastMeter::clr-top = '#ff0000'\n"
162 " GxFastMeter::over = '#ff0000'\n"
163 " }\n"
164 " class '*GxFastMeter' style:highest 'gx_fastmeter'\n";
165
166 gtk_rc_parse_string (toparse.c_str());
167 }
168
169 void Gx_mbecho_GUI::set_plug_name( const char * plugin_uri)
170 {
171 addKnob = "";
172
173 if (strcmp("http://guitarix.sourceforge.net/plugins/gx_mbecho_#_mbecho_", plugin_uri) == 0)
174 {
175 plug_name = "_mbecho_";
176 set_knob("nm-knob");
177 }
178 else
179 {
180 plug_name = "_mbecho_";
181 }
182 }
183
184 GtkWidget* Gx_mbecho_GUI::make_gui()
185 {
186 // init the gxwmm library
187 Gxw::init();
188 set_skin();
189 GtkWidget* container = gtk_vbox_new(FALSE, 2);
190 widget = new Widget(plug_name);
191 GtkWidget* cWidget = GTK_WIDGET(widget->gobj());
192 gtk_container_add(GTK_CONTAINER(container), cWidget );
193
194 return container;
195 }
196
197
198 static LV2UI_Handle instantiate(const struct _LV2UI_Descriptor * descriptor,
199 const char * plugin_uri,
200 const char * bundle_path,
201 LV2UI_Write_Function write_function,
202 LV2UI_Controller controller,
203 LV2UI_Widget * widget,
204 const LV2_Feature * const * features)
205 {
206 Gx_mbecho_GUI* self = new Gx_mbecho_GUI();
207 if (self == NULL) return NULL;
208 self->set_plug_name_static(self, plugin_uri);
209 *widget = (LV2UI_Widget)self->make_gui_static(self);
210 self->widget->controller = controller;
211 self->widget->write_function = write_function;
212 return (LV2UI_Handle)self;
213 }
214
215 static void cleanup(LV2UI_Handle ui)
216 {
217 Gx_mbecho_GUI *pluginGui = static_cast<Gx_mbecho_GUI*>(ui);
218 delete pluginGui->widget;
219 delete pluginGui;
220 }
221
222 static void port_event(LV2UI_Handle ui,
223 uint32_t port_index,
224 uint32_t buffer_size,
225 uint32_t format,
226 const void * buffer)
227 {
228 Gx_mbecho_GUI *self = static_cast<Gx_mbecho_GUI*>(ui);
229 self->widget->set_value_static( port_index, buffer_size, format, buffer, self->widget);
230 return;
231 }
232
233 static LV2UI_Descriptor descriptors[] =
234 {
235 {GXPLUGIN_UI_URI, instantiate, cleanup, port_event, NULL}
236 };
237
238 const LV2UI_Descriptor * lv2ui_descriptor(uint32_t index)
239 {
240 //printf("lv2ui_descriptor(%u) called\n", (uint32_t)index);
241 if (index >= sizeof(descriptors) / sizeof(descriptors[0]))
242 {
243 return NULL;
244 }
245 return descriptors + index;
246 }
247
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_mbecho_#_mbecho_>
23 a lv2:Plugin ;
24 lv2:binary <gx_mbecho.so> ;
25 rdfs:seeAlso <gx_mbecho.ttl> .
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_mbecho_#_mbecho_>
23 a lv2:Plugin ;
24 lv2:binary <gx_mbecho@LIB_EXT@> ;
25 rdfs:seeAlso <gx_mbecho.ttl> .
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 #include "widget.h"
21
22 #include <iostream>
23
24 #define max(x, y) (((x) > (y)) ? (x) : (y))
25
26 /* @get controller by port
27 * this function is used by make_selector() make_controller_box()
28 * set_value() and on_value_changed()
29 * so controller widgets needs only here asined to a port,
30 * and all functions which need acess to the controller widget pointer
31 * can receive them by port number
32 */
33
34 Gtk::Widget* Widget::get_controller_by_port(uint32_t port_index)
35 {
36 switch ((PortIndex)port_index )
37 {
38 case PERCENT1:
39 return &m_smallknob[1];
40 case PERCENT2:
41 return &m_smallknob[2];
42 case PERCENT3:
43 return &m_smallknob[3];
44 case PERCENT4:
45 return &m_smallknob[4];
46 case PERCENT5:
47 return &m_smallknob[5];
48 // case TIME:
49 // return &m_smallknob[6];
50 case TIME1:
51 return &m_smallknob[7];
52 case TIME2:
53 return &m_smallknob[8];
54 case TIME3:
55 return &m_smallknob[9];
56 case TIME4:
57 return &m_smallknob[10];
58 case TIME5:
59 return &m_smallknob[11];
60 case CROSSOVER_B1_B2:
61 return &m_smallknob[12];
62 case CROSSOVER_B2_B3:
63 return &m_smallknob[13];
64 case CROSSOVER_B3_B4:
65 return &m_smallknob[14];
66 case CROSSOVER_B4_B5:
67 return &m_smallknob[15];
68 default:
69 return NULL;
70 }
71 }
72
73 Widget::Widget(Glib::ustring plugname):
74 plug_name(plugname)
75 {
76 m_fr[0].set_label("BAND 1");
77 m_fr[0].add(m_lbox[0]);
78 m_fr[1].set_label("BAND 2");
79 m_fr[1].add(m_lbox[1]);
80 m_fr[2].set_label("BAND 3");
81 m_fr[2].add(m_lbox[2]);
82 m_fr[3].set_label("BAND 4");
83 m_fr[3].add(m_lbox[3]);
84 m_fr[4].set_label("BAND 5");
85 m_fr[4].add(m_lbox[4]);
86 // m_fr[5].set_label("OUT");
87 m_fr[6].set_label("BAND PASS");
88 // create controllers for port name
89 make_controller_box(&m_vbox[1], "AMOUNT", 0.0, 1e+02, 0.1, PERCENT1, false);
90 make_controller_box(&m_vbox[2], "AMOUNT", 0.0, 1e+02, 0.1, PERCENT2, false);
91 make_controller_box(&m_vbox[3], "AMOUNT", 0.0, 1e+02, 0.1, PERCENT3, false);
92 make_controller_box(&m_vbox[4], "AMOUNT", 0.0, 1e+02, 0.1, PERCENT4, false);
93 make_controller_box(&m_vbox[5], "AMOUNT", 0.0, 1e+02, 0.1, PERCENT5, false);
94
95 // make_controller_box(&m_vbox[6], "Gain ", -4e+01, 4.0, 0.1 , TIME, false);
96
97 make_controller_box(&m_vbox[1], "BPM", 24.0, 3.6e+02, 1.0 , TIME1, true);
98 make_controller_box(&m_vbox[2], "BPM", 24.0, 3.6e+02, 1.0 , TIME2, true);
99 make_controller_box(&m_vbox[3], "BPM", 24.0, 3.6e+02, 1.0 , TIME3, true);
100 make_controller_box(&m_vbox[4], "BPM", 24.0, 3.6e+02, 1.0 , TIME4, true);
101 make_controller_box(&m_vbox[5], "BPM", 24.0, 3.6e+02, 1.0 , TIME5, true);
102
103 make_controller_box(&m_vbox[7], "LOW PASS \n B1><B2",
104 2e+01, 2e+04, 1.08 , CROSSOVER_B1_B2, true);
105 make_controller_box(&m_vbox[8], "CROSSOVER \n B2><B3",
106 2e+01, 2e+04, 1.08 , CROSSOVER_B2_B3, true);
107 make_controller_box(&m_vbox[9], "CROSSOVER \n B3><B4 ",
108 2e+01, 2e+04, 1.08 , CROSSOVER_B3_B4, true);
109 make_controller_box(&m_vbox[10], "HIGH PASS \n B4><B5",
110 2e+01, 2e+04, 1.08 , CROSSOVER_B4_B5, true);
111
112 // set propertys for the main paintbox holding the skin
113 m_paintbox[0].set_border_width(10);
114 m_paintbox[0].set_spacing(6);
115 m_paintbox[0].set_homogeneous(false);
116 m_paintbox[0].set_name(plug_name);
117 m_paintbox[0].property_paint_func() = "gxhead_expose";
118 add(m_paintbox[0]);
119
120 for (uint32_t i = 0;i<5;i++) {
121 fastmeter[i].set_hold_count(12);
122 fastmeter[i].set_property("dimen",5);
123 m_paintbox[i+1].property_paint_func() = "RackBox_expose";
124 m_paintbox[i+1].set_name(plug_name);
125 m_paintbox[i+1].set_border_width(5);
126 m_paintbox[i+1].pack_start(fastmeter[i]);
127 }
128
129 // set a vertical box in the paintbox
130 m_vbox[11].set_border_width(14);
131 m_vbox[12].set_border_width(14);
132 m_hbox[2].set_border_width(4);
133 m_paintbox[0].pack_start(m_vbox[0]);
134 // box for the controllers
135 m_hbox[0].set_spacing(4);
136 m_hbox[0].set_border_width(4);
137 m_hbox[0].set_homogeneous(false);
138 m_vbox[0].pack_start(m_hbox[0]);
139 m_fr[6].add(m_hbox[1]);
140 m_vbox[0].pack_start(m_fr[6]);
141 m_vbox[0].pack_start(m_hbox[2]);
142 // put boxed controllers into controller box
143 m_hbox[0].pack_start(m_vbox[11], Gtk::PACK_EXPAND_PADDING);
144 m_hbox[0].pack_start(m_fr[0]);
145 m_lbox[0].pack_start(m_vbox[1]);
146 m_lbox[0].pack_start(m_paintbox[1],Gtk::PACK_SHRINK);
147 m_hbox[0].pack_start(m_fr[1]);
148 m_lbox[1].pack_start(m_vbox[2]);
149 m_lbox[1].pack_start(m_paintbox[2],Gtk::PACK_SHRINK);
150 m_hbox[0].pack_start(m_fr[2]);
151 m_lbox[2].pack_start(m_vbox[3]);
152 m_lbox[2].pack_start(m_paintbox[3],Gtk::PACK_SHRINK);
153 m_hbox[0].pack_start(m_fr[3]);
154 m_lbox[3].pack_start(m_vbox[4]);
155 m_lbox[3].pack_start(m_paintbox[4],Gtk::PACK_SHRINK);
156 m_hbox[0].pack_start(m_fr[4]);
157 m_lbox[4].pack_start(m_vbox[5]);
158 m_lbox[4].pack_start(m_paintbox[5],Gtk::PACK_SHRINK);
159 // m_hbox[0].pack_start(m_fr[5]);
160 // m_fr[5].add(m_vbox[6]);
161 m_hbox[0].pack_start(m_vbox[12], Gtk::PACK_EXPAND_PADDING);
162 // put boxed controllers into controller box
163 m_hbox[1].pack_start(m_vbox[13], Gtk::PACK_EXPAND_PADDING);
164 m_hbox[1].pack_start(m_vbox[7]);
165 m_hbox[1].pack_start(m_vbox[8]);
166 m_hbox[1].pack_start(m_vbox[9]);
167 m_hbox[1].pack_start(m_vbox[10]);
168 m_hbox[1].pack_start(m_vbox[14], Gtk::PACK_EXPAND_PADDING);
169
170 set_app_paintable(true);
171 show_all();
172 }
173
174 Widget::~Widget()
175 {
176
177 }
178
179 // create selectors from gxwmm
180 void Widget::make_selector(Glib::ustring labela,
181 Glib::ustring tables[],
182 size_t _size,
183 float min, float digits,
184 PortIndex port_name)
185 {
186 Gxw::Selector *regler = static_cast<Gxw::Selector*>
187 (get_controller_by_port(port_name));
188 if (regler)
189 {
190 float max = static_cast<float>(_size+1);
191
192 Gtk::TreeModelColumn<Glib::ustring> label;
193 Gtk::TreeModelColumnRecord rec;
194 rec.add(label);
195 Glib::RefPtr<Gtk::ListStore> ls = Gtk::ListStore::create(rec);
196
197 for (uint32_t i = 0 ; i< _size; ++i) {
198 ls->append()->set_value(0, tables[i]);
199 }
200 regler->set_model(ls);
201 regler->set_has_tooltip();
202 regler->set_tooltip_text(labela);
203 regler->cp_configure("SELECTOR", labela, min, max, digits);
204 regler->set_show_value(false);
205 regler->set_name(plug_name);
206 regler->signal_value_changed().connect(sigc::bind(sigc::mem_fun(
207 *this, &Widget::on_value_changed), port_name));
208 }
209 }
210
211 // create stackboxes with controllers for port name
212 void Widget::make_controller_box(Gtk::Box *box,
213 Glib::ustring label,
214 float min, float max,
215 float digits,
216 PortIndex port_name,
217 bool show_value)
218 {
219 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
220 get_controller_by_port(port_name));
221 if (regler)
222 {
223 Gtk::Label* pr = new Gtk::Label(label, 0);
224 pr->set_name("amplabel");
225 // use label images instead simple string labes
226 /*Glib::ustring label_image = GX_LV2_STYLE_DIR;
227 label_image += "/";
228 label_image += label;
229 label_image += "-label.png";
230 Gtk::Image *pr = new Gtk::Image(label_image);*/
231
232 Gtk::VBox* b1 = new Gtk::VBox();
233 box->pack_start( *Gtk::manage(b1), Gtk::PACK_EXPAND_PADDING);
234 box->pack_start( *Gtk::manage(pr),Gtk::PACK_SHRINK);
235 regler->cp_configure("KNOB", label, min, max, digits);
236 regler->set_show_value(show_value);
237 regler->set_name(plug_name);
238 box->pack_start(*regler,Gtk::PACK_SHRINK);
239 Gtk::VBox* b2 = new Gtk::VBox();
240 box->pack_start( *Gtk::manage(b2), Gtk::PACK_EXPAND_PADDING);
241 regler->signal_value_changed().connect(sigc::bind(sigc::mem_fun(
242 *this, &Widget::on_value_changed), port_name));
243 }
244 }
245
246 // create stackboxes with switch controller for port name
247 void Widget::make_switch_box(Gtk::Box *box,
248 Glib::ustring label,
249 PortIndex port_name)
250 {
251 Gxw::Switch *regler = static_cast<Gxw::Switch*>(
252 get_controller_by_port(port_name));
253 if (regler)
254 {
255 Gtk::Label* pr = new Gtk::Label(label, 0);
256 pr->set_name("amplabel");
257 // use label images instead simple string labes
258 /*Glib::ustring label_image = GX_LV2_STYLE_DIR;
259 label_image += "/"+plug_name+"-";
260 label_image += label;
261 label_image += "-label.png";
262 Gtk::Image *pr = new Gtk::Image(label_image);*/
263
264 regler->cp_configure("switch", label, 0, 1, 1);
265 regler->set_name(plug_name);
266 regler->set_base_name( "button" );
267 Gtk::VBox* b1 = new Gtk::VBox();
268 box->pack_start( *Gtk::manage(b1), Gtk::PACK_EXPAND_PADDING);
269 box->pack_start( *Gtk::manage(pr),Gtk::PACK_SHRINK);
270 box->pack_start(*regler,Gtk::PACK_SHRINK);
271 Gtk::VBox* b2 = new Gtk::VBox();
272 box->pack_start( *Gtk::manage(b2), Gtk::PACK_EXPAND_PADDING);
273 regler->signal_toggled().connect(sigc::bind(sigc::mem_fun(
274 *this, &Widget::on_value_changed), port_name));
275 }
276 }
277
278 // receive controller value changes from host and set them to controller
279 void Widget::set_value(uint32_t port_index,
280 uint32_t format,
281 const void * buffer)
282 {
283 if ( format == 0 )
284 {
285 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
286 get_controller_by_port(port_index));
287 float value = *static_cast<const float*>(buffer);
288 if (regler) regler->cp_set_value(value);
289 if (port_index == V1) refresh_meter_level(0,value);
290 else if (port_index == V2) refresh_meter_level(1,value);
291 else if (port_index == V3) refresh_meter_level(2,value);
292 else if (port_index == V4) refresh_meter_level(3,value);
293 else if (port_index == V5) refresh_meter_level(4,value);
294 }
295 }
296
297 // write (UI) controller value changes to the host->engine
298 void Widget::on_value_changed(uint32_t port_index)
299 {
300 Gxw::Regler *regler = static_cast<Gxw::Regler*>(
301 get_controller_by_port(port_index));
302 if (regler)
303 {
304 float value = regler->cp_get_value();
305 write_function(controller, port_index, sizeof(float), 0,
306 static_cast<const void*>(&value));
307 }
308 }
309
310 void Widget::refresh_meter_level(int m, float new_level) {
311 fastmeter[m].set_by_power(new_level);
312 }
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_WIDGET_H_
22 #define SRC_HEADERS_WIDGET_H_
23
24 #include <gtkmm.h>
25 #include <gxwmm.h>
26 #include "gx_mbecho.h"
27 #include "../config.h" // for GX_STYLE_DIR
28 // LV2UI stuff
29 #include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
30
31 class Widget : public Gtk::HBox
32 {
33 private:
34 Gtk::Widget* get_controller_by_port(uint32_t port_index);
35
36 void refresh_meter_level(int meter,float new_level);
37
38 void on_value_changed(uint32_t port_index);
39
40 void make_controller_box(Gtk::Box *box,
41 Glib::ustring label,
42 float min, float max,
43 float digits,
44 PortIndex port_name,
45 bool show_value);
46
47
48 void make_selector(Glib::ustring label,
49 Glib::ustring tables[],
50 size_t _size,
51 float min, float digits,
52 PortIndex port_name);
53
54 void make_switch_box(Gtk::Box *box,
55 Glib::ustring label,
56 PortIndex port_name);
57
58 void set_value(uint32_t port_index,
59 uint32_t format,
60 const void * buffer);
61 public:
62
63 // public Lv2 communication stuff
64 LV2UI_Controller controller;
65 LV2UI_Write_Function write_function;
66 static void set_value_static(uint32_t port_index,
67 uint32_t buffer_size,
68 uint32_t format,
69 const void * buffer, Widget *self)
70 {
71 self->set_value(port_index,format,buffer);
72 }
73
74 Widget(Glib::ustring plugname);
75 ~Widget();
76
77 protected:
78 Glib::ustring plug_name;
79 Gtk::VBox m_vbox[15];
80 Gtk::HBox m_hbox[3];
81 Gtk::HBox m_lbox[5];
82 Gtk::Frame m_fr[7];
83
84 Gxw::SmallKnob m_smallknob[16];
85 Gxw::FastMeter fastmeter[5];
86 Gxw::PaintBox m_paintbox[6];
87 };
88
89 #endif //SRC_HEADERS_WIDGET_H_
0 #!/usr/bin/env python
1 # encoding: utf-8
2
3 import sys, os, TaskGen, ctypes
4
5 def configure(conf):
6 pass
7
8 def build(bld):
9 bundle = 'gx_mbecho.lv2'
10
11 src = ['gx_mbecho.cpp'
12 ]
13 incl = ['../faust','./', '../DSP']
14 lib = []
15 if sys.platform.startswith("linux"):
16 lib.append('dl')
17 uselib = ['LV2CORE']
18 cxxflag =[]
19 if not bld.env['OPT'] and bld.env['SSE2']:
20 cxxflag = [ "-msse2", "-mfpmath=sse"]
21 lv2_effects = bld(
22 features='cxx cshlib ',
23 includes = incl,
24 lib = lib,
25 uselib = uselib,
26 obj_ext = '_14.o',
27 cxxflags = cxxflag,
28 defines = ["LV2_SO"],
29 target = 'gx_mbecho',
30 source = src,
31 install_path = '${LV2DIR}/%s' % bundle,
32 chmod = 0o755,
33 )
34 lv2_effects.env['shlib_PATTERN'] = '%s.so'
35
36 uselib_local5 = []
37 libpath5 = []
38 lib5 = []
39 incl5 = ['../../../libgxwmm','../../../libgxw','../']
40 if sys.platform.startswith("linux"):
41 lib5.append('dl')
42 if bld.env["GX_LIB_SHARED"]:
43 lib5 += ['gxwmm','gxw']
44 libpath5 += [bld.path.find_dir("../../../libgxw/gxw").bldpath(bld.env),
45 bld.path.find_dir("../../../libgxwmm/gxwmm").bldpath(bld.env)]
46 else:
47 uselib_local5 += ['gxwmm','gxw']
48
49 lv2_effetcs_gui = bld(
50 features='cxx cshlib ',
51 includes = incl5,
52 lib = lib5,
53 uselib = 'LV2CORE GTKMM',
54 libpath = libpath5,
55 uselib_local = uselib_local5,
56 linkflags = '-Wl,-z,nodelete',
57 defines = ["LV2_GUI"],
58 target = 'gx_mbecho_gui',
59 source = 'widget.cpp gx_mbecho_gui.cpp',
60 install_path = '${LV2DIR}/%s' % bundle,
61 chmod = 0o755,
62 )
63 lv2_effetcs_gui.env['shlib_PATTERN'] = '%s.so'
64
65
66 install_path = '${LV2DIR}/%s' % bundle,
67 bld.install_files('${LV2DIR}/gx_mbecho.lv2', 'manifest.ttl')
68 bld.install_files('${LV2DIR}/gx_mbecho.lv2', 'gx_mbecho.ttl')
69
70 bld.install_files('${LV2DIR}/gx_mbecho.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
27 @prefix time: <http://lv2plug.in/ns/ext/time/#>.
28 @prefix units: <http://lv2plug.in/ns/extensions/units#> .
2629
2730 <http://guitarix.sourceforge.net#me>
2831 a foaf:Person ;
3740
3841 <http://guitarix.sourceforge.net/plugins/gx_phaser#_phaser>
3942 a lv2:Plugin ,
40 lv2:EffectPlugin ;
43 lv2:PhaserPlugin ;
4144 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4245 doap:name "GxPhaser";
4346 doap:license <http://opensource.org/licenses/isc> ;
4649
4750 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_phaser#gui>;
4851
52 lv2:minorVersion 28;
53 lv2:microVersion 3;
54
4955 lv2:port [
5056 a lv2:InputPort ,
5157 lv2:ControlPort ;
7379 lv2:default 0.5 ;
7480 lv2:minimum 0.0 ;
7581 lv2:maximum 10.0 ;
82 lv2:designation time:beatsPerMinute;
83 units:unit units:hz ;
7684 ] , [
7785 a lv2:AudioPort ,
7886 lv2:OutputPort ;
8593 lv2:index 4 ;
8694 lv2:symbol "in" ;
8795 lv2:name "In" ;
88 ].
96 ] ;
97 mod:gui [
98 a mod:Gui;
99 mod:resourcesDirectory <modgui>;
100 mod:iconTemplate <modgui/gx_phaser.html>;
101 mod:templateData <modgui/gx_phaser.json>;
102 mod:screenshot <modgui/gx_phaser.png>;
103 mod:thumbnail <modgui/gx_phaser-thumb.png>;
104 ] .
89105
90106 <http://guitarix.sourceforge.net/plugins/gx_phaser#gui>
91107 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-boxy mod-three-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "GX",
2 "color": "purple",
3 "controls": [
4 {
5 "name": "SPEED",
6 "symbol": "speed"
7 },
8 {
9 "name": "LEVEL",
10 "symbol": "level"
11 },
12 {
13 "name": "Dry/Wet",
14 "symbol": "dry_wet"
15 }
16 ],
17 "label": "Phaser"
18 }
6767 bld.install_files('${LV2DIR}/gx_phaser.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gx_phaser.lv2', 'gx_phaser.ttl')
6969
70 bld.install_files('${LV2DIR}/gx_phaser.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
5858
5959 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_redeye#gui>;
6060
61 lv2:minorVersion 28;
62 lv2:microVersion 3;
63
6164 lv2:port [
6265 a lv2:InputPort ,
6366 lv2:ControlPort ;
7474 bld.install_files('${LV2DIR}/gx_redeye.lv2', 'manifest.ttl')
7575 bld.install_files('${LV2DIR}/gx_redeye.lv2', 'gx_redeye.ttl')
7676
77 bld.install_files('${LV2DIR}/gx_redeye.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
2627
2728 <http://guitarix.sourceforge.net#me>
2829 a foaf:Person ;
3738
3839 <http://guitarix.sourceforge.net/plugins/gx_reverb_stereo#_reverb_stereo>
3940 a lv2:Plugin ,
40 lv2:EffectPlugin ;
41 lv2:ReverbPlugin ;
4142 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4243 doap:name "GxReverb-Stereo";
4344 doap:license <http://opensource.org/licenses/isc> ;
4647
4748 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_reverb_stereo#gui>;
4849
50 lv2:minorVersion 28;
51 lv2:microVersion 3;
52
4953 lv2:port [
5054 a lv2:InputPort ,
5155 lv2:ControlPort ;
119123 lv2:index 8 ;
120124 lv2:symbol "in1" ;
121125 lv2:name "In1" ;
122 ].
126 ] ;
127 mod:gui [
128 a mod:Gui;
129 mod:resourcesDirectory <modgui>;
130 mod:iconTemplate <modgui/gx_reverb.html>;
131 mod:templateData <modgui/gx_reverb.json>;
132 mod:screenshot <modgui/gx_reverb.png>;
133 mod:thumbnail <modgui/gx_reverb-thumb.png>;
134 ] .
123135
124136 <http://guitarix.sourceforge.net/plugins/gx_reverb_stereo#gui>
125137 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-japanese mod-four-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group mod-{{knob}} clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "cream",
3 "controls": [
4 {
5 "name": "Roomsize",
6 "symbol": "roomsize"
7 },
8 {
9 "name": "Damp",
10 "symbol": "damp"
11 },
12 {
13 "name": "LFO",
14 "symbol": "lfo"
15 },
16 {
17 "name": "Dry/Wet",
18 "symbol": "dry_wet"
19 }
20 ],
21 "knob": "cream",
22 "label": "Stereo Reverb"
23 }
6767 bld.install_files('${LV2DIR}/gx_reverb.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gx_reverb.lv2', 'gx_reverb.ttl')
6969
70 bld.install_files('${LV2DIR}/gx_reverb.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
0
1 # check if user is root
2 user = $(shell whoami)
3 ifeq ($(user),root)
4 INSTALL_DIR = /usr/lib/lv2
5 else
6 INSTALL_DIR = ~/.lv2
7 endif
8
9 ifneq (cat /proc/cpuinfo | grep sse2 >/dev/null,)
10 SSE_CFLAGS = -msse2 -mfpmath=sse
11 else ifneq (cat /proc/cpuinfo | grep sse >/dev/null,)
12 SSE_CFLAGS = -msse -mfpmath=sse
13 else
14 SSE_CFLAGS = ""
15 endif
16
17 # set bundle name
18 NAME = gx_sceleton
19 BUNDLE = $(NAME).lv2
20 VER = 0.1
21 # set compile flags
22 CXXFLAGS = -I. -I../DSP -O2 -Wall -funroll-loops -ffast-math -fomit-frame-pointer -fstrength-reduce $(SSE_CFLAGS)
23 LDFLAGS = -I. -I../DSP -shared -Llibrary -lc -lm -fPIC -DPIC
24 # invoke build files
25 OBJECTS = $(NAME).cpp
26 ## output style (bash colours)
27 BLUE = "\033[1;34m"
28 RED = "\033[1;31m"
29 NONE = "\033[0m"
30
31 .PHONY : all clean install uninstall
32
33 all : $(NAME)
34 @mkdir -p ./$(BUNDLE)
35 @cp ./*.ttl ./$(BUNDLE)
36 @mv ./*.so ./$(BUNDLE)
37 @if [ -f ./$(BUNDLE)/$(NAME).so ]; then echo $(BLUE)"build finish, now run make install"; \
38 else echo $(RED)"sorry, build failed"; fi
39 @echo $(NONE)
40
41 clean :
42 @rm -f $(NAME).so
43 @rm -rf ./$(BUNDLE)
44 @echo ". ." $(BLUE)", done"$(NONE)
45
46 install : all
47 @mkdir -p $(DESTDIR)$(INSTALL_DIR)/$(BUNDLE)
48 install ./$(BUNDLE)/* $(DESTDIR)$(INSTALL_DIR)/$(BUNDLE)
49 @echo ". ." $(BLUE)", done"$(NONE)
50
51 uninstall :
52 @rm -rf $(INSTALL_DIR)/$(BUNDLE)
53 @echo ". ." $(BLUE)", done"$(NONE)
54
55 $(NAME) :
56 $(CXX) $(CXXFLAGS) $(OBJECTS) $(LDFLAGS) -o $(NAME).so
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 ////////////////////////////// LOCAL INCLUDES //////////////////////////
21
22 #include "gx_common.h" // faust support and denormal protection (SSE)
23 #include "gx_sceleton.h" // define struct PortIndex
24 #include "gx_pluginlv2.h" // define struct PluginLV2
25 #include "sceleton.cc" // dsp class generated by faust -> dsp2cc
26
27 ////////////////////////////// PLUG-IN CLASS ///////////////////////////
28
29 namespace sceleton {
30
31 class Gx_sceleton_
32 {
33 private:
34 // pointer to buffer
35 float* output;
36 float* input;
37 // pointer to dsp class
38 PluginLV2* sceleton;
39 // private functions
40 inline void run_dsp_(uint32_t n_samples);
41 inline void connect_(uint32_t port,void* data);
42 inline void init_dsp_(uint32_t rate);
43 inline void connect_all__ports(uint32_t port, void* data);
44 inline void activate_f();
45 inline void clean_up();
46 inline void deactivate_f();
47
48 public:
49 // LV2 Descriptor
50 static const LV2_Descriptor descriptor;
51 // static wrapper to private functions
52 static void deactivate(LV2_Handle instance);
53 static void cleanup(LV2_Handle instance);
54 static void run(LV2_Handle instance, uint32_t n_samples);
55 static void activate(LV2_Handle instance);
56 static void connect_port(LV2_Handle instance, uint32_t port, void* data);
57 static LV2_Handle instantiate(const LV2_Descriptor* descriptor,
58 double rate, const char* bundle_path,
59 const LV2_Feature* const* features);
60 Gx_sceleton_();
61 ~Gx_sceleton_();
62 };
63
64 // constructor
65 Gx_sceleton_::Gx_sceleton_() :
66 output(NULL),
67 input(NULL),
68 sceleton(sceleton::plugin()) {};
69
70 // destructor
71 Gx_sceleton_::~Gx_sceleton_()
72 {
73 // just to be sure the plug have given free the allocated mem
74 // it didn't hurd if the mem is already given free by clean_up()
75 if (sceleton->activate_plugin !=0)
76 sceleton->activate_plugin(false, sceleton);
77 // delete DSP class
78 sceleton->delete_instance(sceleton);
79 };
80
81 ///////////////////////// PRIVATE CLASS FUNCTIONS /////////////////////
82
83 void Gx_sceleton_::init_dsp_(uint32_t rate)
84 {
85 AVOIDDENORMALS(); // init the SSE denormal protection
86 sceleton->set_samplerate(rate, sceleton); // init the DSP class
87 }
88
89 // connect the Ports used by the plug-in class
90 void Gx_sceleton_::connect_(uint32_t port,void* data)
91 {
92 switch ((PortIndex)port)
93 {
94 case EFFECTS_OUTPUT:
95 output = static_cast<float*>(data);
96 break;
97 case EFFECTS_INPUT:
98 input = static_cast<float*>(data);
99 break;
100 default:
101 break;
102 }
103 }
104
105 void Gx_sceleton_::activate_f()
106 {
107 // allocate the internal DSP mem
108 if (sceleton->activate_plugin !=0)
109 sceleton->activate_plugin(true, sceleton);
110 }
111
112 void Gx_sceleton_::clean_up()
113 {
114 // delete the internal DSP mem
115 if (sceleton->activate_plugin !=0)
116 sceleton->activate_plugin(false, sceleton);
117 }
118
119 void Gx_sceleton_::deactivate_f()
120 {
121 // delete the internal DSP mem
122 if (sceleton->activate_plugin !=0)
123 sceleton->activate_plugin(false, sceleton);
124 }
125
126 void Gx_sceleton_::run_dsp_(uint32_t n_samples)
127 {
128 sceleton->mono_audio(static_cast<int>(n_samples), input, output, sceleton);
129 }
130
131 void Gx_sceleton_::connect_all__ports(uint32_t port, void* data)
132 {
133 // connect the Ports used by the plug-in class
134 connect_(port,data);
135 // connect the Ports used by the DSP class
136 sceleton->connect_ports(port, data, sceleton);
137 }
138
139 ////////////////////// STATIC CLASS FUNCTIONS ////////////////////////
140
141 LV2_Handle
142 Gx_sceleton_::instantiate(const LV2_Descriptor* descriptor,
143 double rate, const char* bundle_path,
144 const LV2_Feature* const* features)
145 {
146 // init the plug-in class
147 Gx_sceleton_ *self = new Gx_sceleton_();
148 if (!self)
149 {
150 return NULL;
151 }
152
153 self->init_dsp_((uint32_t)rate);
154
155 return (LV2_Handle)self;
156 }
157
158 void Gx_sceleton_::connect_port(LV2_Handle instance,
159 uint32_t port, void* data)
160 {
161 // connect all ports
162 static_cast<Gx_sceleton_*>(instance)->connect_all__ports(port, data);
163 }
164
165 void Gx_sceleton_::activate(LV2_Handle instance)
166 {
167 // allocate needed mem
168 static_cast<Gx_sceleton_*>(instance)->activate_f();
169 }
170
171 void Gx_sceleton_::run(LV2_Handle instance, uint32_t n_samples)
172 {
173 // run dsp
174 static_cast<Gx_sceleton_*>(instance)->run_dsp_(n_samples);
175 }
176
177 void Gx_sceleton_::deactivate(LV2_Handle instance)
178 {
179 // free allocated mem
180 static_cast<Gx_sceleton_*>(instance)->deactivate_f();
181 }
182
183 void Gx_sceleton_::cleanup(LV2_Handle instance)
184 {
185 // well, clean up after us
186 Gx_sceleton_* self = static_cast<Gx_sceleton_*>(instance);
187 self->clean_up();
188 delete self;
189 }
190
191 const LV2_Descriptor Gx_sceleton_::descriptor =
192 {
193 GXPLUGIN_URI "#_sceleton_",
194 Gx_sceleton_::instantiate,
195 Gx_sceleton_::connect_port,
196 Gx_sceleton_::activate,
197 Gx_sceleton_::run,
198 Gx_sceleton_::deactivate,
199 Gx_sceleton_::cleanup,
200 NULL
201 };
202
203
204 } // end namespace sceleton
205
206 ////////////////////////// LV2 SYMBOL EXPORT ///////////////////////////
207
208 extern "C"
209 LV2_SYMBOL_EXPORT
210 const LV2_Descriptor*
211 lv2_descriptor(uint32_t index)
212 {
213 switch (index)
214 {
215 case 0:
216 return &sceleton::Gx_sceleton_::descriptor;
217 default:
218 return NULL;
219 }
220 }
221
222 ///////////////////////////// FIN //////////////////////////////////////
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_GXEFFECTS_H_
22 #define SRC_HEADERS_GXEFFECTS_H_
23
24 #include <lv2.h>
25
26 #define GXPLUGIN_URI "http://guitarix.sourceforge.net/plugins/gx_sceleton_"
27 #define GXPLUGIN_UI_URI "http://guitarix.sourceforge.net/plugins/gx_sceleton_#gui"
28
29
30 typedef enum
31 {
32 EFFECTS_OUTPUT,
33 EFFECTS_INPUT,
34 } PortIndex;
35
36 #endif //SRC_HEADERS_GXEFFECTS_H_
0 #
1 # Copyright (C) 2014 Guitarix project MOD project
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19
20 @prefix doap: <http://usefulinc.com/ns/doap#> .
21 @prefix foaf: <http://xmlns.com/foaf/0.1/> .
22 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
23 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
24 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
25 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#>.
27 @prefix time: <http://lv2plug.in/ns/ext/time/#>.
28 @prefix units: <http://lv2plug.in/ns/extensions/units#> .
29
30 <http://guitarix.sourceforge.net#me>
31 a foaf:Person ;
32 foaf:name "Guitarix team" ;
33 foaf:mbox <mailto:guitarix-developer@lists.sourceforge.net> ;
34 rdfs:seeAlso <http://guitarix.sourceforge.net> .
35
36 <http://guitarix.sourceforge.net/plugins/gx_sceleton_>
37 a doap:Project ;
38 doap:maintainer <http://guitarix.sourceforge.net#me> ;
39 doap:name "Gx_sceleton_" .
40
41 <http://guitarix.sourceforge.net/plugins/gx_sceleton_#_sceleton_>
42 a lv2:Plugin ,
43 lv2:EffectPlugin ;
44 doap:maintainer <http://guitarix.sourceforge.net#me> ;
45 doap:name "Gxsceleton";
46 doap:license <http://opensource.org/licenses/isc> ;
47 lv2:project <http://guitarix.sourceforge.net/plugins/gx_sceleton_> ;
48 lv2:optionalFeature lv2:hardRTCapable ;
49
50 lv2:minorVersion 28;
51 lv2:microVersion 3;
52
53 lv2:port [
54 a lv2:AudioPort ,
55 lv2:OutputPort ;
56 lv2:index 0 ;
57 lv2:symbol "out" ;
58 lv2:name "Out"
59 ] , [
60 a lv2:AudioPort ,
61 lv2:InputPort ;
62 lv2:index 1 ;
63 lv2:symbol "in" ;
64 lv2:name "In" ;
65 ]
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_sceleton_#_sceleton_>
23 a lv2:Plugin ;
24 lv2:binary <gx_sceleton.so> ;
25 rdfs:seeAlso <gx_sceleton.ttl> .
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_sceleton_#_sceleton_>
23 a lv2:Plugin ;
24 lv2:binary <gx_sceleton@LIB_EXT@> ;
25 rdfs:seeAlso <gx_sceleton.ttl> .
0 #!/usr/bin/env python
1 # encoding: utf-8
2
3 import sys, os, TaskGen, ctypes
4
5 def configure(conf):
6 pass
7
8 def build(bld):
9 bundle = 'gx_sceleton.lv2'
10
11 src = ['gx_sceleton.cpp'
12 ]
13 incl = ['../faust','./', '../DSP']
14 lib = []
15 if sys.platform.startswith("linux"):
16 lib.append('dl')
17 uselib = ['LV2CORE']
18 cxxflag =[]
19 if not bld.env['OPT'] and bld.env['SSE2']:
20 cxxflag = [ "-msse2", "-mfpmath=sse"]
21 lv2_effects = bld(
22 features='cxx cshlib ',
23 includes = incl,
24 lib = lib,
25 uselib = uselib,
26 obj_ext = '_14.o',
27 cxxflags = cxxflag,
28 defines = ["LV2_SO"],
29 target = 'gx_sceleton',
30 source = src,
31 install_path = '${LV2DIR}/%s' % bundle,
32 chmod = 0o755,
33 )
34 lv2_effects.env['shlib_PATTERN'] = '%s.so'
35
36 install_path = '${LV2DIR}/%s' % bundle,
37 bld.install_files('${LV2DIR}/gx_sceleton.lv2', 'manifest.ttl')
38 bld.install_files('${LV2DIR}/gx_sceleton.lv2', 'gx_sceleton.ttl')
39
40 bld.install_files('${LV2DIR}/gx_sceleton.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
0
1 # check if user is root
2 user = $(shell whoami)
3 ifeq ($(user),root)
4 INSTALL_DIR = /usr/lib/lv2
5 else
6 INSTALL_DIR = ~/.lv2
7 endif
8
9 ifneq (cat /proc/cpuinfo | grep sse2 >/dev/null,)
10 SSE_CFLAGS = -msse2 -mfpmath=sse
11 else ifneq (cat /proc/cpuinfo | grep sse >/dev/null,)
12 SSE_CFLAGS = -msse -mfpmath=sse
13 else
14 SSE_CFLAGS = ""
15 endif
16
17 # set bundle name
18 NAME = gx_sceleton
19 BUNDLE = $(NAME).lv2
20 VER = 0.1
21 # set compile flags
22 CXXFLAGS = -I. -I../DSP -O2 -Wall -funroll-loops -ffast-math -fomit-frame-pointer -fstrength-reduce $(SSE_CFLAGS)
23 LDFLAGS = -I. -I../DSP -shared -Llibrary -lc -lm -fPIC -DPIC
24 # invoke build files
25 OBJECTS = $(NAME).cpp
26 ## output style (bash colours)
27 BLUE = "\033[1;34m"
28 RED = "\033[1;31m"
29 NONE = "\033[0m"
30
31 .PHONY : all clean install uninstall
32
33 all : $(NAME)
34 @mkdir -p ./$(BUNDLE)
35 @cp ./*.ttl ./$(BUNDLE)
36 @mv ./*.so ./$(BUNDLE)
37 @if [ -f ./$(BUNDLE)/$(NAME).so ]; then echo $(BLUE)"build finish, now run make install"; \
38 else echo $(RED)"sorry, build failed"; fi
39 @echo $(NONE)
40
41 clean :
42 @rm -f $(NAME).so
43 @rm -rf ./$(BUNDLE)
44 @echo ". ." $(BLUE)", done"$(NONE)
45
46 install : all
47 @mkdir -p $(DESTDIR)$(INSTALL_DIR)/$(BUNDLE)
48 install ./$(BUNDLE)/* $(DESTDIR)$(INSTALL_DIR)/$(BUNDLE)
49 @echo ". ." $(BLUE)", done"$(NONE)
50
51 uninstall :
52 @rm -rf $(INSTALL_DIR)/$(BUNDLE)
53 @echo ". ." $(BLUE)", done"$(NONE)
54
55 $(NAME) :
56 $(CXX) $(CXXFLAGS) $(OBJECTS) $(LDFLAGS) -o $(NAME).so
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19
20 ////////////////////////////// LOCAL INCLUDES //////////////////////////
21
22 #include "gx_common.h" // faust support and denormal protection (SSE)
23 #include "gx_sceleton.h" // define struct PortIndex
24 #include "gx_pluginlv2.h" // define struct PluginLV2
25 #include "sceleton.cc" // dsp class generated by faust -> dsp2cc
26
27 ////////////////////////////// PLUG-IN CLASS ///////////////////////////
28
29 namespace sceleton {
30
31 class Gx_sceleton_
32 {
33 private:
34 // pointer to buffer
35 float* output;
36 float* input;
37 float* output1;
38 float* input1;
39 // pointer to dsp class
40 PluginLV2* sceleton;
41 // private functions
42 inline void run_dsp_(uint32_t n_samples);
43 inline void connect_(uint32_t port,void* data);
44 inline void init_dsp_(uint32_t rate);
45 inline void connect_all__ports(uint32_t port, void* data);
46 inline void activate_f();
47 inline void clean_up();
48 inline void deactivate_f();
49
50 public:
51 // LV2 Descriptor
52 static const LV2_Descriptor descriptor;
53 // static wrapper to private functions
54 static void deactivate(LV2_Handle instance);
55 static void cleanup(LV2_Handle instance);
56 static void run(LV2_Handle instance, uint32_t n_samples);
57 static void activate(LV2_Handle instance);
58 static void connect_port(LV2_Handle instance, uint32_t port, void* data);
59 static LV2_Handle instantiate(const LV2_Descriptor* descriptor,
60 double rate, const char* bundle_path,
61 const LV2_Feature* const* features);
62 Gx_sceleton_();
63 ~Gx_sceleton_();
64 };
65
66 // constructor
67 Gx_sceleton_::Gx_sceleton_() :
68 output(NULL),
69 input(NULL),
70 sceleton(sceleton::plugin()) {};
71
72 // destructor
73 Gx_sceleton_::~Gx_sceleton_()
74 {
75 // just to be sure the plug have given free the allocated mem
76 // it didn't hurd if the mem is already given free by clean_up()
77 if (sceleton->activate_plugin !=0)
78 sceleton->activate_plugin(false, sceleton);
79 // delete DSP class
80 sceleton->delete_instance(sceleton);
81 };
82
83 ///////////////////////// PRIVATE CLASS FUNCTIONS /////////////////////
84
85 void Gx_sceleton_::init_dsp_(uint32_t rate)
86 {
87 AVOIDDENORMALS(); // init the SSE denormal protection
88 sceleton->set_samplerate(rate, sceleton); // init the DSP class
89 }
90
91 // connect the Ports used by the plug-in class
92 void Gx_sceleton_::connect_(uint32_t port,void* data)
93 {
94 switch ((PortIndex)port)
95 {
96 case EFFECTS_OUTPUT:
97 output = static_cast<float*>(data);
98 break;
99 case EFFECTS_INPUT:
100 input = static_cast<float*>(data);
101 break;
102 case EFFECTS_OUTPUT1:
103 output1 = static_cast<float*>(data);
104 break;
105 case EFFECTS_INPUT1:
106 input1 = static_cast<float*>(data);
107 break;
108 default:
109 break;
110 }
111 }
112
113 void Gx_sceleton_::activate_f()
114 {
115 // allocate the internal DSP mem
116 if (sceleton->activate_plugin !=0)
117 sceleton->activate_plugin(true, sceleton);
118 }
119
120 void Gx_sceleton_::clean_up()
121 {
122 // delete the internal DSP mem
123 if (sceleton->activate_plugin !=0)
124 sceleton->activate_plugin(false, sceleton);
125 }
126
127 void Gx_sceleton_::deactivate_f()
128 {
129 // delete the internal DSP mem
130 if (sceleton->activate_plugin !=0)
131 sceleton->activate_plugin(false, sceleton);
132 }
133
134 void Gx_sceleton_::run_dsp_(uint32_t n_samples)
135 {
136 sceleton->stereo_audio(static_cast<int>(n_samples), input, input1, output, output1, sceleton);
137 }
138
139 void Gx_sceleton_::connect_all__ports(uint32_t port, void* data)
140 {
141 // connect the Ports used by the plug-in class
142 connect_(port,data);
143 // connect the Ports used by the DSP class
144 sceleton->connect_ports(port, data, sceleton);
145 }
146
147 ////////////////////// STATIC CLASS FUNCTIONS ////////////////////////
148
149 LV2_Handle
150 Gx_sceleton_::instantiate(const LV2_Descriptor* descriptor,
151 double rate, const char* bundle_path,
152 const LV2_Feature* const* features)
153 {
154 // init the plug-in class
155 Gx_sceleton_ *self = new Gx_sceleton_();
156 if (!self)
157 {
158 return NULL;
159 }
160
161 self->init_dsp_((uint32_t)rate);
162
163 return (LV2_Handle)self;
164 }
165
166 void Gx_sceleton_::connect_port(LV2_Handle instance,
167 uint32_t port, void* data)
168 {
169 // connect all ports
170 static_cast<Gx_sceleton_*>(instance)->connect_all__ports(port, data);
171 }
172
173 void Gx_sceleton_::activate(LV2_Handle instance)
174 {
175 // allocate needed mem
176 static_cast<Gx_sceleton_*>(instance)->activate_f();
177 }
178
179 void Gx_sceleton_::run(LV2_Handle instance, uint32_t n_samples)
180 {
181 // run dsp
182 static_cast<Gx_sceleton_*>(instance)->run_dsp_(n_samples);
183 }
184
185 void Gx_sceleton_::deactivate(LV2_Handle instance)
186 {
187 // free allocated mem
188 static_cast<Gx_sceleton_*>(instance)->deactivate_f();
189 }
190
191 void Gx_sceleton_::cleanup(LV2_Handle instance)
192 {
193 // well, clean up after us
194 Gx_sceleton_* self = static_cast<Gx_sceleton_*>(instance);
195 self->clean_up();
196 delete self;
197 }
198
199 const LV2_Descriptor Gx_sceleton_::descriptor =
200 {
201 GXPLUGIN_URI "#_sceleton_",
202 Gx_sceleton_::instantiate,
203 Gx_sceleton_::connect_port,
204 Gx_sceleton_::activate,
205 Gx_sceleton_::run,
206 Gx_sceleton_::deactivate,
207 Gx_sceleton_::cleanup,
208 NULL
209 };
210
211 } // end namespace sceleton
212
213 ////////////////////////// LV2 SYMBOL EXPORT ///////////////////////////
214
215 extern "C"
216 LV2_SYMBOL_EXPORT
217 const LV2_Descriptor*
218 lv2_descriptor(uint32_t index)
219 {
220 switch (index)
221 {
222 case 0:
223 return &sceleton::Gx_sceleton_::descriptor;
224 default:
225 return NULL;
226 }
227 }
228
229 ///////////////////////////// FIN //////////////////////////////////////
0 /*
1 * Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 */
18
19 #pragma once
20
21 #ifndef SRC_HEADERS_GXEFFECTS_H_
22 #define SRC_HEADERS_GXEFFECTS_H_
23
24 #include <lv2.h>
25
26 #define GXPLUGIN_URI "http://guitarix.sourceforge.net/plugins/gx_sceleton_"
27 #define GXPLUGIN_UI_URI "http://guitarix.sourceforge.net/plugins/gx_sceleton_#gui"
28
29
30 typedef enum
31 {
32 EFFECTS_OUTPUT,
33 EFFECTS_INPUT,
34 EFFECTS_OUTPUT1,
35 EFFECTS_INPUT1,
36 } PortIndex;
37
38 #endif //SRC_HEADERS_GXEFFECTS_H_
0 #
1 # Copyright (C) 2014 guitarix project MOD project
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19
20 @prefix doap: <http://usefulinc.com/ns/doap#> .
21 @prefix foaf: <http://xmlns.com/foaf/0.1/> .
22 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
23 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
24 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
25 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#>.
27 @prefix time: <http://lv2plug.in/ns/ext/time/#>.
28 @prefix units: <http://lv2plug.in/ns/extensions/units#> .
29
30 <http://guitarix.sourceforge.net#me>
31 a foaf:Person ;
32 foaf:name "Guitarix team" ;
33 foaf:mbox <mailto:guitarix-developer@lists.sourceforge.net> ;
34 rdfs:seeAlso <http://guitarix.sourceforge.net> .
35
36 <http://guitarix.sourceforge.net/plugins/gx_sceleton_>
37 a doap:Project ;
38 doap:maintainer <http://guitarix.sourceforge.net#me> ;
39 doap:name "Gx_sceleton_" .
40
41 <http://guitarix.sourceforge.net/plugins/gx_sceleton_#_sceleton_>
42 a lv2:Plugin ,
43 lv2:EffectPlugin ;
44 doap:maintainer <http://guitarix.sourceforge.net#me> ;
45 doap:name "Gxsceleton";
46 doap:license <http://opensource.org/licenses/isc> ;
47 lv2:project <http://guitarix.sourceforge.net/plugins/gx_sceleton_> ;
48 lv2:optionalFeature lv2:hardRTCapable ;
49
50 lv2:minorVersion 28;
51 lv2:microVersion 3;
52
53 lv2:port [
54 a lv2:AudioPort ,
55 lv2:OutputPort ;
56 lv2:index 0 ;
57 lv2:symbol "out" ;
58 lv2:name "Out"
59 ] , [
60 a lv2:AudioPort ,
61 lv2:InputPort ;
62 lv2:index 1 ;
63 lv2:symbol "in" ;
64 lv2:name "In" ;
65 ] , [
66 a lv2:AudioPort ,
67 lv2:OutputPort ;
68 lv2:index 2 ;
69 lv2:symbol "out1" ;
70 lv2:name "Out1"
71 ] , [
72 a lv2:AudioPort ,
73 lv2:InputPort ;
74 lv2:index 3 ;
75 lv2:symbol "in1" ;
76 lv2:name "In1" ;
77 ]
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_sceleton_#_sceleton_>
23 a lv2:Plugin ;
24 lv2:binary <gx_sceleton.so> ;
25 rdfs:seeAlso <gx_sceleton.ttl> .
0 #
1 # Copyright (C) 2012 Hermann Meyer, Andreas Degert, Pete Shorthose, Steve Poskitt
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 # --------------------------------------------------------------------------
17 #
18
19 @prefix lv2: <http://lv2plug.in/ns/lv2core#> .
20 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
21
22 <http://guitarix.sourceforge.net/plugins/gx_sceleton_#_sceleton_>
23 a lv2:Plugin ;
24 lv2:binary <gx_sceleton@LIB_EXT@> ;
25 rdfs:seeAlso <gx_sceleton.ttl> .
0 #!/usr/bin/env python
1 # encoding: utf-8
2
3 import sys, os, TaskGen, ctypes
4
5 def configure(conf):
6 pass
7
8 def build(bld):
9 bundle = 'gx_sceleton.lv2'
10
11 src = ['gx_sceleton.cpp'
12 ]
13 incl = ['../faust','./', '../DSP']
14 lib = []
15 if sys.platform.startswith("linux"):
16 lib.append('dl')
17 uselib = ['LV2CORE']
18 cxxflag =[]
19 if not bld.env['OPT'] and bld.env['SSE2']:
20 cxxflag = [ "-msse2", "-mfpmath=sse"]
21 lv2_effects = bld(
22 features='cxx cshlib ',
23 includes = incl,
24 lib = lib,
25 uselib = uselib,
26 obj_ext = '_14.o',
27 cxxflags = cxxflag,
28 defines = ["LV2_SO"],
29 target = 'gx_sceleton',
30 source = src,
31 install_path = '${LV2DIR}/%s' % bundle,
32 chmod = 0o755,
33 )
34 lv2_effects.env['shlib_PATTERN'] = '%s.so'
35
36 install_path = '${LV2DIR}/%s' % bundle,
37 bld.install_files('${LV2DIR}/gx_sceleton.lv2', 'manifest.ttl')
38 bld.install_files('${LV2DIR}/gx_sceleton.lv2', 'gx_sceleton.ttl')
39
40 bld.install_files('${LV2DIR}/gx_sceleton.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
2627
2728 <http://guitarix.sourceforge.net#me>
2829 a foaf:Person ;
3738
3839 <http://guitarix.sourceforge.net/plugins/gx_studiopre#studiopre>
3940 a lv2:Plugin ,
40 lv2:EffectPlugin ;
41 lv2:SimulatorPlugin ;
4142 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4243 doap:name "Gx Alembic Mono";
4344 doap:license <http://opensource.org/licenses/isc> ;
4647
4748 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_studiopre#gui>;
4849
50 lv2:minorVersion 28;
51 lv2:microVersion 3;
52
4953 lv2:port [
5054 a lv2:InputPort ,
5155 lv2:ControlPort ;
5357 lv2:symbol "bright" ;
5458 lv2:name "Bright";
5559 lv2:portProperty lv2:integer;
56 lv2:portProperty lv2:enumeration ;
60 lv2:portProperty lv2:toggled ;
5761 lv2:default 0 ;
5862 lv2:minimum 0 ;
5963 lv2:maximum 1 ;
105109 lv2:index 6 ;
106110 lv2:symbol "in" ;
107111 lv2:name "In"
108 ].
109
110
112 ] ;
113 mod:gui [
114 a mod:Gui;
115 mod:resourcesDirectory <modgui>;
116 mod:iconTemplate <modgui/gx_studiopre.html>;
117 mod:templateData <modgui/gx_studiopre.json>;
118 mod:screenshot <modgui/gx_studiopre.png>;
119 mod:thumbnail <modgui/gx_studiopre-thumb.png>;
120 ] .
111121
112122 <http://guitarix.sourceforge.net/plugins/gx_studiopre#gui>
113123 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-british mod-four-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group {{knob}} clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "metallic",
3 "controls": [
4 {
5 "name": "Volume",
6 "symbol": "volume"
7 },
8 {
9 "name": "Bass",
10 "symbol": "bass"
11 },
12 {
13 "name": "Middle",
14 "symbol": "middle"
15 },
16 {
17 "name": "Treble",
18 "symbol": "treble"
19 }
20 ],
21 "label": "Alembic Mono"
22 }
6767 bld.install_files('${LV2DIR}/gx_studiopre.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gx_studiopre.lv2', 'gx_studiopre.ttl')
6969
70 bld.install_files('${LV2DIR}/gx_studiopre.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
2627
2728 <http://guitarix.sourceforge.net#me>
2829 a foaf:Person ;
3738
3839 <http://guitarix.sourceforge.net/plugins/gx_studiopre_st#studiopre_st>
3940 a lv2:Plugin ,
40 lv2:EffectPlugin ;
41 lv2:SimulatorPlugin ;
4142 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4243 doap:name "Gx Studio Preamp Stereo";
4344 doap:license <http://opensource.org/licenses/isc> ;
4647
4748 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_studiopre_st#gui>;
4849
50 lv2:minorVersion 28;
51 lv2:microVersion 3;
52
4953 lv2:port [
5054 a lv2:InputPort ,
5155 lv2:ControlPort ;
5357 lv2:symbol "bright_l" ;
5458 lv2:name "Bright_L";
5559 lv2:portProperty lv2:integer;
56 lv2:portProperty lv2:enumeration ;
60 lv2:portProperty lv2:toggled ;
5761 lv2:default 0 ;
5862 lv2:minimum 0 ;
5963 lv2:maximum 1 ;
98102 lv2:ControlPort ;
99103 lv2:index 5 ;
100104 lv2:symbol "bright_r" ;
101 lv2:name "Bright_L";
105 lv2:name "Bright_R";
102106 lv2:portProperty lv2:integer;
103 lv2:portProperty lv2:enumeration ;
107 lv2:portProperty lv2:toggled ;
104108 lv2:default 0 ;
105109 lv2:minimum 0 ;
106110 lv2:maximum 1 ;
164168 lv2:index 13 ;
165169 lv2:symbol "in1" ;
166170 lv2:name "In1"
167 ].
168
171 ] ;
172 mod:gui [
173 a mod:Gui;
174 mod:resourcesDirectory <modgui>;
175 mod:iconTemplate <modgui/gx_studiopre_st.html>;
176 mod:templateData <modgui/gx_studiopre_st.json>;
177 mod:screenshot <modgui/gx_studiopre_st.png>;
178 mod:thumbnail <modgui/gx_studiopre_st-thumb.png>;
179 ] .
169180
170181 <http://guitarix.sourceforge.net/plugins/gx_studiopre_st#gui>
171182 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-boxy mod-eight-knobs mod-boxy75 mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "gray",
3 "controls": [
4 {
5 "name": "Volume_L",
6 "symbol": "volume_l"
7 },
8 {
9 "name": "Bass_L",
10 "symbol": "bass_l"
11 },
12 {
13 "name": "Middle_L",
14 "symbol": "middle_l"
15 },
16 {
17 "name": "Treble_L",
18 "symbol": "treble_l"
19 },
20 {
21 "name": "Volume_R",
22 "symbol": "volume_r"
23 },
24 {
25 "name": "Bass_L",
26 "symbol": "bass_l"
27 },
28 {
29 "name": "Middle_R",
30 "symbol": "middle_r"
31 },
32 {
33 "name": "Treble_R",
34 "symbol": "treble_r"
35 }
36 ],
37 "label": "Stereo Studio Preamp"
38 }
6767 bld.install_files('${LV2DIR}/gx_studiopre_st.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gx_studiopre_st.lv2', 'gx_studiopre_st.ttl')
6969
70 bld.install_files('${LV2DIR}/gx_studiopre_st.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
27 @prefix time: <http://lv2plug.in/ns/ext/time/#>.
28 @prefix units: <http://lv2plug.in/ns/extensions/units#> .
2629
2730 <http://guitarix.sourceforge.net#me>
2831 a foaf:Person ;
3740
3841 <http://guitarix.sourceforge.net/plugins/gx_tremolo#_tremolo>
3942 a lv2:Plugin ,
40 lv2:EffectPlugin ;
43 lv2:ModulatorPlugin ;
4144 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4245 doap:name "GxTremolo";
4346 doap:license <http://opensource.org/licenses/isc> ;
4649
4750 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_tremolo#gui>;
4851
52 lv2:minorVersion 28;
53 lv2:microVersion 3;
54
4955 lv2:port [
5056 a lv2:InputPort ,
5157 lv2:ControlPort ;
8692 lv2:default 5.0 ;
8793 lv2:minimum 0.1 ;
8894 lv2:maximum 50.0 ;
95 lv2:designation time:beatsPerMinute;
96 units:unit units:hz ;
8997 ] , [
9098 a lv2:AudioPort ,
9199 lv2:OutputPort ;
98106 lv2:index 5 ;
99107 lv2:symbol "in" ;
100108 lv2:name "In" ;
101 ].
109 ] ;
110 mod:gui [
111 a mod:Gui;
112 mod:resourcesDirectory <modgui>;
113 mod:iconTemplate <modgui/gx_tremolo.html>;
114 mod:templateData <modgui/gx_tremolo.json>;
115 mod:screenshot <modgui/gx_tremolo.png>;
116 mod:thumbnail <modgui/gx_tremolo-thumb.png>;
117 ] .
102118
103119 <http://guitarix.sourceforge.net/plugins/gx_tremolo#gui>
104120 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-japanese mod-four-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group mod-{{knob}} clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "purple",
3 "controls": [
4 {
5 "name": "Freq",
6 "symbol": "freq"
7 },
8 {
9 "name": "Depth",
10 "symbol": "depth"
11 },
12 {
13 "name": "Mode",
14 "symbol": "mode"
15 },
16 {
17 "name": "Dry/Wet",
18 "symbol": "dry_wet"
19 }
20 ],
21 "knob": "red",
22 "label": "Tremolo"
23 }
6767 bld.install_files('${LV2DIR}/gx_tremolo.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gx_tremolo.lv2', 'gx_tremolo.ttl')
6969
70 bld.install_files('${LV2DIR}/gx_tremolo.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
3737
3838 <http://guitarix.sourceforge.net/plugins/gx_zita_rev1_stereo#_zita_rev1_stereo>
3939 a lv2:Plugin ,
40 lv2:EffectPlugin ;
40 lv2:ReverbPlugin ;
4141 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4242 doap:name "GxZita_rev1-Stereo";
4343 doap:license <http://opensource.org/licenses/isc> ;
4646
4747 guiext:ui <http://guitarix.sourceforge.net/plugins/gx_zita_rev1_stereo#gui>;
4848
49 lv2:minorVersion 28;
50 lv2:microVersion 3;
51
4952 lv2:port [
5053 a lv2:InputPort ,
5154 lv2:ControlPort ;
6767 bld.install_files('${LV2DIR}/gx_zita_rev1.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gx_zita_rev1.lv2', 'gx_zita_rev1.ttl')
6969
70 bld.install_files('${LV2DIR}/gx_zita_rev1.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
2627
2728 <http://guitarix.sourceforge.net#me>
2829 a foaf:Person ;
3738
3839 <http://guitarix.sourceforge.net/plugins/gxautowah#autowah>
3940 a lv2:Plugin ,
40 lv2:EffectPlugin ;
41 lv2:FilterPlugin ;
4142 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4243 doap:name "GxAutoWah";
4344 doap:license <http://opensource.org/licenses/isc> ;
4647
4748 guiext:ui <http://guitarix.sourceforge.net/plugins/gxautowah#gui>;
4849
50 lv2:minorVersion 28;
51 lv2:microVersion 3;
52
4953 lv2:port [
5054 a lv2:AudioPort ,
5155 lv2:OutputPort ;
6266
6367 <http://guitarix.sourceforge.net/plugins/gxautowah#wah>
6468 a lv2:Plugin ,
65 lv2:EffectPlugin ;
69 lv2:FilterPlugin ;
6670 doap:maintainer <http://guitarix.sourceforge.net#me> ;
6771 doap:name "GxWah";
6872 doap:license <http://opensource.org/licenses/isc> ;
9296 lv2:default 0.0 ;
9397 lv2:minimum 0.0 ;
9498 lv2:maximum 1.0 ;
95 ].
99 ] ;
100 mod:gui [
101 a mod:Gui;
102 mod:resourcesDirectory <modgui>;
103 mod:iconTemplate <modgui/gxautowah.html>;
104 mod:templateData <modgui/gxautowah.json>;
105 mod:screenshot <modgui/gxautowah.png>;
106 mod:thumbnail <modgui/gxautowah-thumb.png>;
107 ] .
108
96109
97110 <http://guitarix.sourceforge.net/plugins/gxautowah#gui>
98111 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-boxy mod-one-knob mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "yellow",
3 "controls": [
4 {
5 "name": "Wah",
6 "symbol": "fslider1_"
7 }
8 ],
9 "label": "Wah"
10 }
6767 bld.install_files('${LV2DIR}/gxautowah.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gxautowah.lv2', 'gxautowah.ttl')
6969
70 bld.install_files('${LV2DIR}/gxautowah.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
2627
2728 <http://guitarix.sourceforge.net#me>
2829 a foaf:Person ;
3738
3839 <http://guitarix.sourceforge.net/plugins/gxbooster#booster>
3940 a lv2:Plugin ,
40 lv2:EffectPlugin ;
41 lv2:UtilityPlugin ;
4142 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4243 doap:name "GxBooster";
4344 doap:license <http://opensource.org/licenses/isc> ;
4647
4748 guiext:ui <http://guitarix.sourceforge.net/plugins/gxbooster#gui>;
4849
50 lv2:minorVersion 28;
51 lv2:microVersion 3;
52
4953 lv2:port [
5054 a lv2:InputPort ,
5155 lv2:ControlPort ;
7680 lv2:index 3 ;
7781 lv2:symbol "in" ;
7882 lv2:name "in"
79 ].
83 ] ;
84 mod:gui [
85 a mod:Gui;
86 mod:resourcesDirectory <modgui>;
87 mod:iconTemplate <modgui/gxbooster.html>;
88 mod:templateData <modgui/gxbooster.json>;
89 mod:screenshot <modgui/gxbooster.png>;
90 mod:thumbnail <modgui/gxbooster-thumb.png>;
91 ] .
92
8093
8194 <http://guitarix.sourceforge.net/plugins/gxbooster#gui>
8295 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-boxy mod-two-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "gray",
3 "controls": [
4 {
5 "name": "B Level",
6 "symbol": "fslider1_"
7 },
8 {
9 "name": "H Level",
10 "symbol": "fslider0_"
11 }
12 ],
13 "label": "Booster"
14 }
6767 bld.install_files('${LV2DIR}/gxbooster.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gxbooster.lv2', 'gxbooster.ttl')
6969
70 bld.install_files('${LV2DIR}/gxbooster.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
2627
2728 <http://guitarix.sourceforge.net#me>
2829 a foaf:Person ;
3738
3839 <http://guitarix.sourceforge.net/plugins/gxechocat#echocat>
3940 a lv2:Plugin ,
40 lv2:EffectPlugin ;
41 lv2:DelayPlugin ;
4142 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4243 doap:name "GxEchoCat";
4344 doap:license <http://opensource.org/licenses/isc> ;
4647
4748 guiext:ui <http://guitarix.sourceforge.net/plugins/gxechocat#gui>;
4849
50 lv2:minorVersion 28;
51 lv2:microVersion 3;
52
4953 lv2:port [
5054 a lv2:InputPort ,
5155 lv2:ControlPort ;
127131 lv2:index 8 ;
128132 lv2:symbol "in" ;
129133 lv2:name "In"
130 ].
134 ] ;
135 mod:gui [
136 a mod:Gui;
137 mod:resourcesDirectory <modgui>;
138 mod:iconTemplate <modgui/gxechocat.html>;
139 mod:templateData <modgui/gxechocat.json>;
140 mod:screenshot <modgui/gxechocat.png>;
141 mod:thumbnail <modgui/gxechocat-thumb.png>;
142 ] .
143
131144
132145 <http://guitarix.sourceforge.net/plugins/gxechocat#gui>
133146 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-japanese mod-seven-a-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group mod-{{knob}} clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <span class="mod-knob-title">{{name}}</span>
9 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "white",
3 "controls": [
4 {
5 "name": "Head 1",
6 "symbol": "head1"
7 },
8 {
9 "name": "Head 2",
10 "symbol": "head2"
11 },
12 {
13 "name": "Head 3",
14 "symbol": "head3"
15 },
16 {
17 "name": "Input Gain",
18 "symbol": "input_gain"
19 },
20 {
21 "name": "Swell",
22 "symbol": "swell"
23 },
24 {
25 "name": "Sustain",
26 "symbol": "sustain"
27 },
28 {
29 "name": "OutputGain",
30 "symbol": "outputgain"
31 }
32 ],
33 "knob": "red",
34 "label": "Echo Cat"
35 }
6767 bld.install_files('${LV2DIR}/gxechocat.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gxechocat.lv2', 'gxechocat.ttl')
6969
70 bld.install_files('${LV2DIR}/gxechocat.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2424 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2525 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2626 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
27 @prefix mod: <http://portalmod.com/ns/modgui#> .
2728
2829 <http://guitarix.sourceforge.net#me>
2930 a foaf:Person ;
3839
3940 <http://guitarix.sourceforge.net/plugins/gxmetal_amp#metal_amp>
4041 a lv2:Plugin ,
41 lv2:EffectPlugin ;
42 lv2:SimulatorPlugin ;
4243 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4344 doap:name "GxMetalAmp";
4445 doap:license <http://opensource.org/licenses/isc> ;
5051
5152 guiext:ui <http://guitarix.sourceforge.net/plugins/gxmetal_amp#gui>;
5253
54 lv2:minorVersion 28;
55 lv2:microVersion 3;
56
5357 lv2:port [
5458 a lv2:InputPort ,
5559 lv2:ControlPort ;
98102 lv2:index 5 ;
99103 lv2:symbol "in" ;
100104 lv2:name "In" ;
101 ].
105 ] ;
106 mod:gui [
107 a mod:Gui;
108 mod:resourcesDirectory <modgui>;
109 mod:iconTemplate <modgui/gxmetal_amp.html>;
110 mod:templateData <modgui/gxmetal_amp.json>;
111 mod:screenshot <modgui/gxmetal_amp.png>;
112 mod:thumbnail <modgui/gxmetal_amp-thumb.png>;
113 ] .
102114
103115 <http://guitarix.sourceforge.net/plugins/gxmetal_amp#gui>
104116 a guiext:GtkUI;
0 <div class="mod-pedal mod-combo-model-001 mod-combo-model-001-0550">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-control-group clearfix">
5 <div class="mod-switch" mod-role="bypass">
6 <div class="mod-switch-image" mod-role="bypass-light"></div>
7 </div>
8 <div class="mod-separator"></div>
9 {{#controls.0}}
10 <div class="mod-chicken-head">
11 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
12 <span class="mod-chicken-head-title">{{name}}</span>
13 </div>
14 {{/controls.0}}
15 {{#controls.1}}
16 <div class="mod-chicken-head">
17 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
18 <span class="mod-chicken-head-title">{{name}}</span>
19 </div>
20 {{/controls.1}}
21 {{#controls.2}}
22 <div class="mod-chicken-head">
23 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
24 <span class="mod-chicken-head-title">{{name}}</span>
25 </div>
26 {{/controls.2}}
27 {{#controls.3}}
28 <div class="mod-chicken-head">
29 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
30 <span class="mod-chicken-head-title">{{name}}</span>
31 </div>
32 {{/controls.3}}
33 </div>
34 <div class="mod-pedal-input">
35 {{#effect.ports.audio.input}}
36 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
37 <div class="mod-pedal-input-image"></div>
38 </div>
39 {{/effect.ports.audio.input}}
40 {{#effect.ports.midi.input}}
41 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
42 <div class="mod-pedal-input-image"></div>
43 </div>
44 {{/effect.ports.midi.input}}
45 </div>
46 <div class="mod-pedal-output">
47 {{#effect.ports.audio.output}}
48 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
49 <div class="mod-pedal-output-image"></div>
50 </div>
51 {{/effect.ports.audio.output}}
52 {{#effect.ports.midi.output}}
53 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
54 <div class="mod-pedal-input-image"></div>
55 </div>
56 {{/effect.ports.midi.output}}
57 </div>
58 </div>
0 {
1 "author": "Guitarix",
2 "controls": [
3 {
4 "name": "PREGAIN",
5 "symbol": "PREGAIN"
6 },
7 {
8 "name": "DRIVE",
9 "symbol": "DRIVE"
10 },
11 {
12 "name": "TONE",
13 "symbol": "TONE"
14 },
15 {
16 "name": "GAIN1",
17 "symbol": "GAIN1"
18 }
19 ],
20 "label": "Metal Amp"
21 }
8181 bld.install_files('${LV2DIR}/gxmetal_amp.lv2', 'manifest.ttl')
8282 bld.install_files('${LV2DIR}/gxmetal_amp.lv2', 'gxmetal_amp.ttl')
8383
84 bld.install_files('${LV2DIR}/gxmetal_amp.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2424 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2525 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2626 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
27 @prefix mod: <http://portalmod.com/ns/modgui#> .
2728
2829 <http://guitarix.sourceforge.net#me>
2930 a foaf:Person ;
3839
3940 <http://guitarix.sourceforge.net/plugins/gxmetal_head#metal_head>
4041 a lv2:Plugin ,
41 lv2:EffectPlugin ;
42 lv2:SimulatorPlugin ;
4243 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4344 doap:name "GxMetalHead";
4445 doap:license <http://opensource.org/licenses/isc> ;
5051
5152 guiext:ui <http://guitarix.sourceforge.net/plugins/gxmetal_head#gui>;
5253
54 lv2:minorVersion 28;
55 lv2:microVersion 3;
56
5357 lv2:port [
5458 a lv2:InputPort ,
5559 lv2:ControlPort ;
98102 lv2:index 5 ;
99103 lv2:symbol "in" ;
100104 lv2:name "In" ;
101 ].
105 ] ;
106 mod:gui [
107 a mod:Gui;
108 mod:resourcesDirectory <modgui>;
109 mod:iconTemplate <modgui/gxmetal_head.html>;
110 mod:templateData <modgui/gxmetal_head.json>;
111 mod:screenshot <modgui/gxmetal_head.png>;
112 mod:thumbnail <modgui/gxmetal_head-thumb.png>;
113 ] .
102114
103115 <http://guitarix.sourceforge.net/plugins/gxmetal_head#gui>
104116 a guiext:GtkUI;
0 <div class="mod-pedal mod-head-model-001 mod-head-model-001-0550">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-control-group clearfix">
5 {{#controls.0}}
6 <div class="mod-enumerated clearfix" mod-role="input-control-port" mod-port-symbol="{{symbol}}" mod-widget="custom-select">
7 <div mod-role="input-control-value" mod-port-symbol="{{symbol}}" class="mod-enumerated-selected"></div>
8 <div class="mod-enumerated-list" mod-widget-property="hidden">
9 {{#scalePoints}}
10 <div mod-role="enumeration-option" mod-port-value="{{value}}">{{label}}</div>
11 {{/scalePoints}}
12 </div>
13 </div>
14 {{/controls.0}}
15 <div class="mod-switch" mod-role="bypass">
16 <div class="mod-switch-image" mod-role="bypass-light"></div>
17 </div>
18 <div class="mod-separator"></div>
19 {{#controls.1}}
20 <div class="mod-chicken-head">
21 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
22 <span class="mod-chicken-head-title">{{name}}</span>
23 </div>
24 {{/controls.1}}
25 {{#controls.2}}
26 <div class="mod-chicken-head">
27 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
28 <span class="mod-chicken-head-title">{{name}}</span>
29 </div>
30 {{/controls.2}}
31 {{#controls.3}}
32 <div class="mod-chicken-head">
33 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
34 <span class="mod-chicken-head-title">{{name}}</span>
35 </div>
36 {{/controls.3}}
37 {{#controls.4}}
38 <div class="mod-chicken-head">
39 <div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
40 <span class="mod-chicken-head-title">{{name}}</span>
41 </div>
42 {{/controls.4}}
43 </div>
44 <div class="mod-pedal-input">
45 {{#effect.ports.audio.input}}
46 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
47 <div class="mod-pedal-input-image"></div>
48 </div>
49 {{/effect.ports.audio.input}}
50 {{#effect.ports.midi.input}}
51 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
52 <div class="mod-pedal-input-image"></div>
53 </div>
54 {{/effect.ports.midi.input}}
55 </div>
56 <div class="mod-pedal-output">
57 {{#effect.ports.audio.output}}
58 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
59 <div class="mod-pedal-output-image"></div>
60 </div>
61 {{/effect.ports.audio.output}}
62 {{#effect.ports.midi.output}}
63 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
64 <div class="mod-pedal-input-image"></div>
65 </div>
66 {{/effect.ports.midi.output}}
67 </div>
68 </div>
0 {
1 "author": "Guitarix",
2 "controls": [
3 {
4 "name": "TONE",
5 "symbol": "TONE"
6 },
7 {
8 "name": "DRIVE",
9 "symbol": "DRIVE"
10 },
11 {
12 "name": "PREGAIN",
13 "symbol": "PREGAIN"
14 },
15 {
16 "name": "GAIN1",
17 "symbol": "GAIN1"
18 }
19 ],
20 "label": "Metal Head"
21 }
7676 bld.install_files('${LV2DIR}/gxmetal_head.lv2', 'manifest.ttl')
7777 bld.install_files('${LV2DIR}/gxmetal_head.lv2', 'gxmetal_head.ttl')
7878
79 bld.install_files('${LV2DIR}/gxmetal_head.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2828 @prefix opt: <http://lv2plug.in/ns/ext/options#> .
2929 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
3030 @prefix work: <http://lv2plug.in/ns/ext/worker#> .
31 @prefix mod: <http://portalmod.com/ns/modgui#> .
3132
3233 <http://guitarix.sourceforge.net#me>
3334 a foaf:Person ;
4243
4344 <http://guitarix.sourceforge.net/plugins/gxpreamp#preampmono>
4445 a lv2:Plugin ,
45 lv2:AmplifierPlugin ;
46 lv2:SimulatorPlugin ;
4647 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4748 doap:name "GxPreAmplifier Mono";
4849 doap:license <http://opensource.org/licenses/isc> ;
5758
5859 guiext:ui <http://guitarix.sourceforge.net/plugins/gxpreamp#gui>;
5960
61 lv2:minorVersion 28;
62 lv2:microVersion 3;
63
6064 lv2:port [
6165 a lv2:InputPort ,
6266 lv2:ControlPort ;
131135 lv2:index 8 ;
132136 lv2:symbol "in" ;
133137 lv2:name "In" ;
138 ] ;
139 mod:gui [
140 a mod:Gui;
141 mod:resourcesDirectory <modgui>;
142 mod:iconTemplate <modgui/gxpreamp.html>;
143 mod:templateData <modgui/gxpreamp.json>;
144 mod:screenshot <modgui/gxpreamp.png>;
145 mod:thumbnail <modgui/gxpreamp-thumb.png>;
134146 ] .
135147
136148 <http://guitarix.sourceforge.net/plugins/gxpreamp#gui>
0 <div class="mod-pedal mod-pedal-japanese mod-eight-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group mod-{{knob}} clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "brown",
3 "controls": [
4 {
5 "name": "Input",
6 "symbol": "fslider2_"
7 },
8 {
9 "name": "Drive",
10 "symbol": "fslider1_"
11 },
12 {
13 "name": "Resonance",
14 "symbol": "fslider3_"
15 },
16 {
17 "name": "Presence",
18 "symbol": "fslider4_"
19 },
20 {
21 "name": "Output",
22 "symbol": "fslider0_"
23 }
24 ],
25 "knob": "brown",
26 "label": "Pre Amplifier"
27 }
6969 bld.install_files('${LV2DIR}/gxpreamp.lv2', 'manifest.ttl')
7070 bld.install_files('${LV2DIR}/gxpreamp.lv2', 'gxpreamp.ttl')
7171
72 bld.install_files('${LV2DIR}/gxpreamp.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
2627
2728 <http://guitarix.sourceforge.net#me>
2829 a foaf:Person ;
3738
3839 <http://guitarix.sourceforge.net/plugins/gxtilttone#tilttone>
3940 a lv2:Plugin ,
40 lv2:EffectPlugin ;
41 lv2:DistortionPlugin ;
4142 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4243 doap:name "GxTiltTone";
4344 doap:license <http://opensource.org/licenses/isc> ;
4647
4748 guiext:ui <http://guitarix.sourceforge.net/plugins/gxtilttone#gui>;
4849
50 lv2:minorVersion 28;
51 lv2:microVersion 3;
52
4953 lv2:port [
5054 a lv2:InputPort ,
5155 lv2:ControlPort ;
8589 lv2:index 4 ;
8690 lv2:symbol "in" ;
8791 lv2:name "In"
88 ].
92 ] ;
93 mod:gui [
94 a mod:Gui;
95 mod:resourcesDirectory <modgui>;
96 mod:iconTemplate <modgui/gxtilttone.html>;
97 mod:templateData <modgui/gxtilttone.json>;
98 mod:screenshot <modgui/gxtilttone.png>;
99 mod:thumbnail <modgui/gxtilttone-thumb.png>;
100 ] .
89101
90102 <http://guitarix.sourceforge.net/plugins/gxtilttone#gui>
91103 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-boxy mod-three-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "orange",
3 "controls": [
4 {
5 "name": "Drive",
6 "symbol": "drive"
7 },
8 {
9 "name": "Tone",
10 "symbol": "tone"
11 },
12 {
13 "name": "Gain",
14 "symbol": "gain"
15 }
16 ],
17 "label": "Tilt Tone"
18 }
6767 bld.install_files('${LV2DIR}/gxtilttone.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gxtilttone.lv2', 'gxtilttone.ttl')
6969
70 bld.install_files('${LV2DIR}/gxtilttone.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
2627
2728 <http://guitarix.sourceforge.net#me>
2829 a foaf:Person ;
3738
3839 <http://guitarix.sourceforge.net/plugins/gxts9#ts9sim>
3940 a lv2:Plugin ,
40 lv2:EffectPlugin ;
41 lv2:DistortionPlugin ;
4142 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4243 doap:name "GxTubeScreamer";
4344 doap:license <http://opensource.org/licenses/isc> ;
4647
4748 guiext:ui <http://guitarix.sourceforge.net/plugins/gxts9#gui>;
4849
50 lv2:minorVersion 28;
51 lv2:microVersion 3;
52
4953 lv2:port [
5054 a lv2:InputPort ,
5155 lv2:ControlPort ;
8589 lv2:index 4 ;
8690 lv2:symbol "in" ;
8791 lv2:name "in"
88 ].
92 ] ;
93 mod:gui [
94 a mod:Gui;
95 mod:resourcesDirectory <modgui>;
96 mod:iconTemplate <modgui/gxts9.html>;
97 mod:templateData <modgui/gxts9.json>;
98 mod:screenshot <modgui/gxts9.png>;
99 mod:thumbnail <modgui/gxts9-thumb.png>;
100 ] .
89101
90102 <http://guitarix.sourceforge.net/plugins/gxts9#gui>
91103 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-boxy mod-three-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "orange",
3 "controls": [
4 {
5 "name": "Level",
6 "symbol": "fslider0_"
7 },
8 {
9 "name": "Tone",
10 "symbol": "fslider1_"
11 },
12 {
13 "name": "Drive",
14 "symbol": "fslider2_"
15 }
16 ],
17 "label": "Tube Screamer"
18 }
6767 bld.install_files('${LV2DIR}/gxts9.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gxts9.lv2', 'gxts9.ttl')
6969
70 bld.install_files('${LV2DIR}/gxts9.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
2627
2728 <http://guitarix.sourceforge.net#me>
2829 a foaf:Person ;
4647
4748 guiext:ui <http://guitarix.sourceforge.net/plugins/gxtubedelay#gui>;
4849
50 lv2:minorVersion 28;
51 lv2:microVersion 3;
52
4953 lv2:port [
5054 a lv2:InputPort ,
5155 lv2:ControlPort ;
9498 lv2:index 5 ;
9599 lv2:symbol "in" ;
96100 lv2:name "in"
97 ].
101 ] ;
102 mod:gui [
103 a mod:Gui;
104 mod:resourcesDirectory <modgui>;
105 mod:iconTemplate <modgui/gxtubedelay.html>;
106 mod:templateData <modgui/gxtubedelay.json>;
107 mod:screenshot <modgui/gxtubedelay.png>;
108 mod:thumbnail <modgui/gxtubedelay-thumb.png>;
109 ] .
98110
99111 <http://guitarix.sourceforge.net/plugins/gxtubedelay#gui>
100112 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-japanese mod-four-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group mod-{{knob}} clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "white",
3 "controls": [
4 {
5 "name": "delay",
6 "symbol": "fslider2_"
7 },
8 {
9 "name": "feedback",
10 "symbol": "fslider1_"
11 },
12 {
13 "name": "gain",
14 "symbol": "fslider0_"
15 },
16 {
17 "name": "level",
18 "symbol": "fslider3_"
19 }
20 ],
21 "knob": "orange",
22 "label": "Tube Delay"
23 }
6767 bld.install_files('${LV2DIR}/gxtubedelay.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gxtubedelay.lv2', 'gxtubedelay.ttl')
6969
70 bld.install_files('${LV2DIR}/gxtubedelay.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
2627
2728 <http://guitarix.sourceforge.net#me>
2829 a foaf:Person ;
3738
3839 <http://guitarix.sourceforge.net/plugins/gxtubetremelo#tubetremelo>
3940 a lv2:Plugin ,
40 lv2:EffectPlugin ;
41 lv2:ModulatorPlugin ;
4142 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4243 doap:name "GxTubeTremelo";
4344 doap:license <http://opensource.org/licenses/isc> ;
4647
4748 guiext:ui <http://guitarix.sourceforge.net/plugins/gxtubetremelo#gui>;
4849
50 lv2:minorVersion 28;
51 lv2:microVersion 3;
52
4953 lv2:port [
5054 a lv2:InputPort ,
5155 lv2:ControlPort ;
96100 lv2:index 5 ;
97101 lv2:symbol "in" ;
98102 lv2:name "In"
99 ].
103 ];
104 mod:gui [
105 a mod:Gui;
106 mod:resourcesDirectory <modgui>;
107 mod:iconTemplate <modgui/gxtubetremelo.html>;
108 mod:templateData <modgui/gxtubetremelo.json>;
109 mod:screenshot <modgui/gxtubetremelo.png>;
110 mod:thumbnail <modgui/gxtubetremelo-thumb.png>;
111 ] .
100112
101113 <http://guitarix.sourceforge.net/plugins/gxtubetremelo#gui>
102114 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-japanese mod-four-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group mod-{{knob}} clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "purple",
3 "controls": [
4 {
5 "name": "Depth",
6 "symbol": "depth"
7 },
8 {
9 "name": "Speed",
10 "symbol": "speed"
11 },
12 {
13 "name": "SineWave",
14 "symbol": "sinewave"
15 },
16 {
17 "name": "Gain",
18 "symbol": "gain"
19 }
20 ],
21 "knob": "orange",
22 "label": "Tube Tremelo"
23 }
6767 bld.install_files('${LV2DIR}/gxtubetremelo.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gxtubetremelo.lv2', 'gxtubetremelo.ttl')
6969
70 bld.install_files('${LV2DIR}/gxtubetremelo.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
2323 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2424 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2525 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
26 @prefix mod: <http://portalmod.com/ns/modgui#> .
27 @prefix time: <http://lv2plug.in/ns/ext/time/#>.
28 @prefix units: <http://lv2plug.in/ns/extensions/units#> .
2629
2730 <http://guitarix.sourceforge.net#me>
2831 a foaf:Person ;
3740
3841 <http://guitarix.sourceforge.net/plugins/gxtubevibrato#tubevibrato>
3942 a lv2:Plugin ,
40 lv2:EffectPlugin ;
43 lv2:ModulatorPlugin ;
4144 doap:maintainer <http://guitarix.sourceforge.net#me> ;
4245 doap:name "GxTubeVibrato";
4346 doap:license <http://opensource.org/licenses/isc> ;
4649
4750 guiext:ui <http://guitarix.sourceforge.net/plugins/gxtubevibrato#gui>;
4851
52 lv2:minorVersion 28;
53 lv2:microVersion 3;
54
4955 lv2:port [
5056 a lv2:InputPort ,
5157 lv2:ControlPort ;
5359 lv2:symbol "sinewave" ;
5460 lv2:name "SineWave";
5561 lv2:portProperty lv2:integer;
56 lv2:portProperty lv2:enumeration ;
5762 lv2:default 0 ;
5863 lv2:minimum 0 ;
5964 lv2:maximum 1 ;
7580 lv2:default 0.1 ;
7681 lv2:minimum 0.1 ;
7782 lv2:maximum 14.0 ;
83 lv2:designation time:beatsPerMinute;
84 units:unit units:hz ;
7885 ] , [
7986 a lv2:InputPort ,
8087 lv2:ControlPort ;
96103 lv2:index 5 ;
97104 lv2:symbol "in" ;
98105 lv2:name "In"
99 ].
106 ] ;
107 mod:gui [
108 a mod:Gui;
109 mod:resourcesDirectory <modgui>;
110 mod:iconTemplate <modgui/gxtubevibrato.html>;
111 mod:templateData <modgui/gxtubevibrato.json>;
112 mod:screenshot <modgui/gxtubevibrato.png>;
113 mod:thumbnail <modgui/gxtubevibrato-thumb.png>;
114 ] .
100115
101116 <http://guitarix.sourceforge.net/plugins/gxtubevibrato#gui>
102117 a guiext:GtkUI;
0 <div class="mod-pedal mod-pedal-japanese mod-four-knobs mod-{{color}}">
1 <div mod-role="drag-handle" class="mod-drag-handle"></div>
2 <div class="mod-plugin-author"><h1>{{author}}</h1></div>
3 <div class="mod-plugin-name"><h1>{{label}}</h1></div>
4 <div class="mod-light on" mod-role="bypass-light"></div>
5 <div class="mod-control-group mod-{{knob}} clearfix">
6 {{#controls}}
7 <div class="mod-knob">
8 <div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div>
9 <span class="mod-knob-title">{{name}}</span>
10 </div>
11 {{/controls}}
12 </div>
13 <div class="mod-footswitch" mod-role="bypass"></div>
14 <div class="mod-pedal-input">
15 {{#effect.ports.audio.input}}
16 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}">
17 <div class="mod-pedal-input-image"></div>
18 </div>
19 {{/effect.ports.audio.input}}
20 {{#effect.ports.midi.input}}
21 <div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}">
22 <div class="mod-pedal-input-image"></div>
23 </div>
24 {{/effect.ports.midi.input}}
25 </div>
26 <div class="mod-pedal-output">
27 {{#effect.ports.audio.output}}
28 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}">
29 <div class="mod-pedal-output-image"></div>
30 </div>
31 {{/effect.ports.audio.output}}
32 {{#effect.ports.midi.output}}
33 <div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}">
34 <div class="mod-pedal-input-image"></div>
35 </div>
36 {{/effect.ports.midi.output}}
37 </div>
38 </div>
0 {
1 "author": "Guitarix",
2 "color": "purple",
3 "controls": [
4 {
5 "name": "Depth",
6 "symbol": "depth"
7 },
8 {
9 "name": "Speed",
10 "symbol": "speed"
11 },
12 {
13 "name": "SineWave",
14 "symbol": "sinewave"
15 },
16 {
17 "name": "Gain",
18 "symbol": "gain"
19 }
20 ],
21 "knob": "red",
22 "label": "Tube Vibrato"
23 }
6767 bld.install_files('${LV2DIR}/gxtubevibrato.lv2', 'manifest.ttl')
6868 bld.install_files('${LV2DIR}/gxtubevibrato.lv2', 'gxtubevibrato.ttl')
6969
70 bld.install_files('${LV2DIR}/gxtubevibrato.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
7878
7979 ////////////////////////////// PLUG-IN CLASS ///////////////////////////
8080
81
8182 class Gxtuner
8283 {
8384 protected:
8485 // MIDI stuff
85 int midi_event;
86 LV2_Event_Buffer *MidiOut;
87 LV2_Event_Iterator out_iter;
86
87 LV2_URID_Map* urid_map;
88 LV2_URID midi_event;
89 LV2_Atom midiatom;
90 LV2_Atom_Forge forge;
91 LV2_Atom_Forge_Frame frame;
92 LV2_Atom_Sequence* MidiOut;
8893 uint8_t note;
8994 float fnote;
9095 uint8_t lastnote;
9297 float nolevel;
9398 float *nolevel_;
9499 float fallback;
95 uint8_t midi_data[3];
100 uint8_t data[3];
101 size_t dat;
102 size_t at;
96103 bool noteoff;
97104 float *channel_;
98105 uint8_t channel;
167174
168175 // constructor
169176 Gxtuner::Gxtuner() :
170 midi_event(0),
171177 MidiOut(NULL),
172178 note(0),
173179 lastnote(0),
243249 void Gxtuner::send_midi_data(int count, uint8_t controller,
244250 uint8_t note, uint8_t velocity)
245251 {
246 midi_data[0] = controller; // note on/off
247 midi_data[1] = note; // note
248 midi_data[2] = velocity; // velocity
249252 if(! MidiOut) return;
250 if(!lv2_event_write(&out_iter, count, 0, midi_event, 3, midi_data)) {
251 printf("Error! midi event fail!\n");
252 }
253 data[0] = controller;
254 data[1] = note;
255 data[2] = velocity;
256 lv2_atom_forge_frame_time(&forge,count);
257 lv2_atom_forge_raw(&forge,&midiatom,at);
258 lv2_atom_forge_raw(&forge,data,dat);
259 lv2_atom_forge_pad(&forge,dat+at);
253260 }
254261
255262 void Gxtuner::play_midi(tuner& self)
256263 {
264 lv2_atom_forge_set_buffer(&forge,(uint8_t*)MidiOut, MidiOut->atom.size);
265 lv2_atom_forge_sequence_head(&forge, &frame, 0);
257266 MaxLevel& lev = *static_cast<MaxLevel*>(vu_adapter);
258 lv2_event_begin(&out_iter,MidiOut);
259 //fnote = self.get_note(self);
260267 level = lev.get_midi_level(lev);
261268 nolevel = pow(10.,*(nolevel_)*0.05);
262269 count_frame++;
393400 gain_ = static_cast<float*>(data) ;
394401 break;
395402 case MIDIOUT:
396 MidiOut = static_cast<LV2_Event_Buffer*>(data) ;
403 MidiOut = (LV2_Atom_Sequence*)data;
404 // MidiOut = static_cast<LV2_Atom_Event*>(data); //static_cast<LV2_Event_Buffer*>(data) ;
397405 break;
398406 case EFFECTS_OUTPUT:
399407 output = static_cast<float*>(data);
453461 if (fastnote > 0) self.set_fast_note(self, true);
454462 else self.set_fast_note(self, false);
455463 }
456 if (*(playmidi_) > 0) {
464 if (*(playmidi_) > 0) {
457465 verify = *(verify_);
458466 play_midi(self);
459467 bow->mono_audio(static_cast<int>(n_samples), input, output, bow);
482490 {
483491 // init the plug-in class
484492 Gxtuner *self = new Gxtuner();
485 if (!self)
486 {
493 if (!self) {
487494 return NULL;
488495 }
489 LV2_URI_Map_Feature *map_feature;
490 for (int32_t i = 0; features[i]; ++i)
491 {
492 if (!strcmp(features[i]->URI, "http://lv2plug.in/ns/ext/uri-map"))
496
497 for (int32_t i = 0; features[i]; i++) {
498 if (strcmp(features[i]->URI, LV2_URID__map) == 0)
493499 {
494 map_feature = static_cast<LV2_URI_Map_Feature*>(features[i]->data);
495 self->midi_event = map_feature->uri_to_id(map_feature->callback_data,
496 "http://lv2plug.in/ns/ext/event",
497 "http://lv2plug.in/ns/ext/midi#MidiEvent");
500 self->urid_map = (LV2_URID_Map *) features[i]->data;
501 self->midi_event = self->urid_map->map(self->urid_map->handle, LV2_MIDI__MidiEvent);
502 break;
498503 }
499504 }
500 if (self->midi_event == 0)
501 {
505 if (self->midi_event == 0) {
502506 fprintf(stderr, "GxTuner: No MIDI Out support in host...\n");
507 } else {
508 lv2_atom_forge_init(&self->forge,self->urid_map);
509 self->midiatom.type = self->midi_event;
510 self->dat = sizeof(self->data);
511 self->at = sizeof(LV2_Atom);
512 self->midiatom.size = self->dat;
503513 }
504514
505515 self->init_dsp_mono((uint32_t)rate);
2727 #include <lv2/lv2plug.in/ns/ext/buf-size/buf-size.h>
2828 #include <lv2/lv2plug.in/ns/ext/options/options.h>
2929 #include <lv2/lv2plug.in/ns/ext/atom/atom.h>
30 #include "lv2/lv2plug.in/ns/ext/atom/util.h"
31 #include "lv2/lv2plug.in/ns/ext/midi/midi.h"
3032 #include <lv2/lv2plug.in/ns/ext/log/log.h>
3133 #include <lv2/lv2plug.in/ns/ext/urid/urid.h>
32 #include <lv2/lv2plug.in/ns/ext/event/event.h>
33 #include <lv2/lv2plug.in/ns/ext/event/event-helpers.h>
34 #include <lv2/lv2plug.in/ns/ext/uri-map/uri-map.h>
34 #include "lv2/lv2plug.in/ns/ext/atom/forge.h"
3535
3636 #define GXPLUGIN_URI "http://guitarix.sourceforge.net/plugins/gxtuner"
3737 #define GXPLUGIN_UI_URI "http://guitarix.sourceforge.net/plugins/gxtuner#gui"
2424 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2525 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2626 @prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
27 @prefix ev: <http://lv2plug.in/ns/ext/event#>.
27 @prefix midi: <http://lv2plug.in/ns/ext/midi#> .
28 @prefix urid: <http://lv2plug.in/ns/ext/urid#> .
29 @prefix atom: <http://lv2plug.in/ns/ext/atom#> .
2830
2931 <http://guitarix.sourceforge.net#me>
3032 a foaf:Person ;
4850
4951 guiext:ui <http://guitarix.sourceforge.net/plugins/gxtuner#gui>;
5052
53 lv2:minorVersion 28;
54 lv2:microVersion 3;
55
5156 lv2:port [
5257 a lv2:ControlPort, lv2:OutputPort ;
5358 lv2:index 0 ;
7580 lv2:portProperty lv2:enumeration ;
7681 lv2:default 0 ;
7782 lv2:minimum 0 ;
78 lv2:maximum 1 ;
83 lv2:maximum 3 ;
7984 lv2:scalePoint [rdfs:label "(Chromatic)"; rdf:value 0];
8085 lv2:scalePoint [rdfs:label "Standard/E"; rdf:value 1];
8186 lv2:scalePoint [rdfs:label "Standard/Es"; rdf:value 2];
8287 lv2:scalePoint [rdfs:label "Open E"; rdf:value 3];
88 lv2:scalePoint [rdfs:label "Drop D"; rdf:value 4];
89 lv2:scalePoint [rdfs:label "Half Step Down"; rdf:value 5];
90 lv2:scalePoint [rdfs:label "Full Step Down"; rdf:value 6];
91 lv2:scalePoint [rdfs:label "1 and 1/2 Steps Down"; rdf:value 7];
92 lv2:scalePoint [rdfs:label "Double Drop D"; rdf:value 8];
93 lv2:scalePoint [rdfs:label "Drop C"; rdf:value 9];
94 lv2:scalePoint [rdfs:label "Drop C#"; rdf:value 10];
95 lv2:scalePoint [rdfs:label "Drop B"; rdf:value 11];
96 lv2:scalePoint [rdfs:label "Drop A#"; rdf:value 12];
97 lv2:scalePoint [rdfs:label "Drop A"; rdf:value 13];
98 lv2:scalePoint [rdfs:label "Open D"; rdf:value 14];
99 lv2:scalePoint [rdfs:label "Open D Minor"; rdf:value 15];
100 lv2:scalePoint [rdfs:label "Open G"; rdf:value 16];
101 lv2:scalePoint [rdfs:label "Open G Minor"; rdf:value 17];
102 lv2:scalePoint [rdfs:label "Open C"; rdf:value 18];
103 lv2:scalePoint [rdfs:label "Open C#"; rdf:value 19];
104 lv2:scalePoint [rdfs:label "Open C Minor"; rdf:value 20];
105 lv2:scalePoint [rdfs:label "Open E7"; rdf:value 21];
106 lv2:scalePoint [rdfs:label "Open E Minor7"; rdf:value 22];
107 lv2:scalePoint [rdfs:label "Open G Major7"; rdf:value 23];
108 lv2:scalePoint [rdfs:label "Open A Minor"; rdf:value 24];
109 lv2:scalePoint [rdfs:label "Open A Minor7"; rdf:value 25];
110 lv2:scalePoint [rdfs:label "Open A"; rdf:value 26];
111 lv2:scalePoint [rdfs:label "C Tuning"; rdf:value 27];
112 lv2:scalePoint [rdfs:label "C# Tuning"; rdf:value 28];
113 lv2:scalePoint [rdfs:label "Bb Tuning"; rdf:value 29];
114 lv2:scalePoint [rdfs:label "A to A (Baritone)"; rdf:value 30];
115 lv2:scalePoint [rdfs:label "Open Dsus2"; rdf:value 31];
116 lv2:scalePoint [rdfs:label "Open Gsus2"; rdf:value 32];
117 lv2:scalePoint [rdfs:label "G6","Modal G"; rdf:value 33];
118 lv2:scalePoint [rdfs:label "Overtone"; rdf:value 34];
119 lv2:scalePoint [rdfs:label "Pentatonic"; rdf:value 35];
120 lv2:scalePoint [rdfs:label "Minor Third"; rdf:value 36];
121 lv2:scalePoint [rdfs:label "Major Third"; rdf:value 37];
122 lv2:scalePoint [rdfs:label "All Fourths"; rdf:value 38];
123 lv2:scalePoint [rdfs:label "Augmented Fourths"; rdf:value 39];
124 lv2:scalePoint [rdfs:label "Slow Motion"; rdf:value 40];
125 lv2:scalePoint [rdfs:label "Admiral"; rdf:value 41];
126 lv2:scalePoint [rdfs:label "Buzzard"; rdf:value 42];
127 lv2:scalePoint [rdfs:label "Face"; rdf:value 43];
128 lv2:scalePoint [rdfs:label "Four and Twenty"; rdf:value 44];
129 lv2:scalePoint [rdfs:label "Ostrich"; rdf:value 45];
130 lv2:scalePoint [rdfs:label "Capo 200"; rdf:value 46];
131 lv2:scalePoint [rdfs:label "Balalaika"; rdf:value 47];
132 lv2:scalePoint [rdfs:label "Cittern One"; rdf:value 48];
133 lv2:scalePoint [rdfs:label "Cittern Two"; rdf:value 49];
134 lv2:scalePoint [rdfs:label "Dobro"; rdf:value 50];
135 lv2:scalePoint [rdfs:label "Lefty"; rdf:value 51];
136 lv2:scalePoint [rdfs:label "Mandoguitar"; rdf:value 52];
137 lv2:scalePoint [rdfs:label "Rusty Cage"; rdf:value 53];
138 lv2:scalePoint [rdfs:label "Hardcore"; rdf:value 54];
83139 ] , [
84140 a lv2:InputPort ,
85141 lv2:ControlPort ;
240296 lv2:minimum 0 ;
241297 lv2:maximum 1 ;
242298 ] , [
243 a ev:EventPort, lv2:OutputPort;
244 lv2:index 18;
245 ev:supportsEvent <http://lv2plug.in/ns/ext/midi#MidiEvent>;
246 lv2:symbol "midi_out";
247 lv2:name "MIDI Out";
248 lv2:portProperty lv2:connectionOptional;
299 a lv2:OutputPort ,
300 atom:AtomPort ;
301 atom:bufferType atom:Sequence ;
302 atom:supports midi:MidiEvent ;
303 lv2:designation lv2:control ;
304 lv2:index 18 ;
305 lv2:symbol "midi_out" ;
306 lv2:name "MIDI Out"
249307 ] , [
250308 a lv2:AudioPort ,
251309 lv2:OutputPort ;
170170 " GxFastMeter::over = '#ff0000'\n"
171171 " }\n"
172172 " class '*GxFastMeter' style:highest 'gx_fastmeter'\n";
173
174 toparse += "style 'gx_notes_style'\n"
173 toparse += " style \"gx_";
174 toparse += plug_name;
175 toparse += "_slevel\"\n"
176 "{\n"
177 "stock['levelslider'] = {{'simplelevelslider.png'}}\n"
178 "GxLevelSlider::slider-width = 3\n"
179 "GxRegler::show-value = 0\n"
180 "}\n"
181 "widget '*.";
182 toparse += plug_name;
183 toparse += "' style 'gx_";
184 toparse += plug_name;
185 toparse += "_slevel' ";
186
187 toparse += "style 'gx_notes_style'\n"
175188 "{\n"
176189
177190 " bg[ACTIVE] = '#000000'\n"
6666 {
6767 // create controllers for port name
6868
69 Glib::ustring modes[] = {"(Chromatic)","Standard/E","Standard/Es", "Open E"};
69 Glib::ustring modes[] = {"(Chromatic)","Standard", "Standard/Es", "Open E",
70 "Drop D","Half Step Down","Full Step Down","1 and 1/2 Steps Down","Double Drop D","Drop C",
71 "Drop C#","Drop B","Drop A#","Drop A","Open D","Open D Minor", "Open G","Open G Minor",
72 "Open C","Open C#","Open C Minor","Open E7","Open E Minor7","Open G Major7","Open A Minor",
73 "Open A Minor7","Open A","C Tuning","C# Tuning","Bb Tuning","A to A (Baritone)","Open Dsus2",
74 "Open Gsus2","G6","Modal G","Overtone","Pentatonic","Minor Third","Major Third","All Fourths",
75 "Augmented Fourths","Slow Motion","Admiral","Buzzard","Face","Four and Twenty","Ostrich","Capo 200",
76 "Balalaika","Cittern One","Cittern Two","Dobro","Lefty","Mandoguitar","Rusty Cage","Hardcore"};
7077 static const size_t _size = sizeof(modes) / sizeof(modes[0]);
7178 make_selector("Tunning Modes", modes, _size, 0, 1.0, TUNEMODE);
7279 m_vbox8.pack_start(tuner_tuning);
154161 levelslider.set_tooltip_text("Set Note ON level");
155162 //m_paintbox2.pack_start(levelslider,Gtk::PACK_SHRINK);
156163 levelslider.set_show_value(false);
164 levelslider.set_name(plug_name);
157165 fastmeter.set_hold_count(8);
158166 fastmeter.set_property("dimen",5);
159167 //m_paintbox.set_size_request( 425, 160 ) ;
354362 bool flat;
355363 int notes[6];
356364 } tuning_tab[] = {
357 { "Standard", "E", false, {40, 45, 50, 55, 59, 64}},
358 { "Standard/Es", "Es", true, {39, 44, 49, 54, 58, 63}},
359 { "Open E", "E", false, {40, 47, 52, 56, 59, 64}},
365 { "Standard", "E", false, {40, 45, 50, 55, 59, 64}},
366 { "Standard/Es", "Es", true, {39, 44, 49, 54, 58, 63}},
367 { "Open E", "E", false, {40, 47, 52, 56, 59, 64}},
368 { "Drop D", "D", false, {38, 45, 50, 55, 59, 64}},
369 { "Half Step Down", "E", false, {39, 44, 49, 54, 58, 63}},
370 { "Full Step Down", "D", false, {38, 43, 48, 53, 57, 62}},
371 { "1 and 1/2 Steps Down", "E", false, {37, 42, 47, 52, 56, 61}},
372 { "Double Drop D", "D", false, {38, 45, 50, 55, 59, 62}},
373 { "Drop C", "C", false, {36, 43, 48, 53, 57, 62}},
374 { "Drop C#", "C#", false, {37, 44, 49, 54, 58, 63}},
375 { "Drop B", "B", false, {35, 42, 47, 52, 56, 61}},
376 { "Drop A#", "A#", false, {34, 41, 46, 51, 55, 60}},
377 { "Drop A", "A", false, {33, 40, 45, 50, 54, 59}},
378 { "Open D", "D", false, {38, 45, 50, 54, 57, 62}},
379 { "Open D Minor", "D", false, {38, 45, 50, 53, 57, 62}},
380 { "Open G", "G", false, {38, 43, 50, 55, 59, 62}},
381 { "Open G Minor", "G", false, {38, 43, 50, 55, 58, 62}},
382 { "Open C", "C", false, {36, 43, 48, 55, 60, 64}},
383 { "Open C#", "C#", false, {37, 42, 59, 52, 56, 61}},
384 { "Open C Minor", "C", false, {36, 43, 48, 55, 60, 63}},
385 { "Open E7", "E7", false, {40, 44, 50, 52, 59, 64}},
386 { "Open E Minor7", "E", false, {40, 47, 50, 55, 59, 64}},
387 { "Open G Major7", "G", false, {38, 43, 50, 54, 59, 62}},
388 { "Open A Minor", "A", false, {40, 45, 52, 57, 60, 64}},
389 { "Open A Minor7", "A", false, {40, 45, 52, 55, 60, 64}},
390 { "Open A", "A", false, {40, 45, 49, 52, 57, 64}},
391 { "C Tuning", "C", false, {36, 41, 46, 51, 55, 60}},
392 { "C# Tuning", "C#", false, {37, 42, 47, 52, 56, 61}},
393 { "Bb Tuning", "Bb", false, {34, 39, 44, 49, 53, 58}},
394 { "A to A (Baritone)", "A", false, {33, 38, 43, 48, 52, 57}},
395 { "Open Dsus2", "D", false, {38, 45, 50, 55, 57, 62}},
396 { "Open Gsus2", "G", false, {38, 43, 50, 55, 60, 62}},
397 { "G6", "G6", false, {38, 43, 50, 55, 59, 64}},
398 { "Modal G", "G", false, {38, 43, 50, 55, 60, 62}},
399 { "Overtone", "E", false, {48, 52, 55, 58, 60, 62}},
400 { "Pentatonic", "E", false, {45, 48, 50, 52, 55, 69}},
401 { "Minor Third", "E", false, {48, 51, 54, 57, 60, 63}},
402 { "Major Third", "E", false, {48, 52, 56, 60, 64, 68}},
403 { "All Fourths", "E", false, {40, 45, 50, 55, 60, 65}},
404 { "Augmented Fourths", "E", false, {36, 42, 48, 54, 60, 66}},
405 { "Slow Motion", "E", false, {38, 43, 50, 53, 60, 62}},
406 { "Admiral", "E", false, {36, 43, 50, 55, 59, 60}},
407 { "Buzzard", "E", false, {36, 41, 48, 55, 58, 65}},
408 { "Face", "E", false, {36, 43, 50, 55, 57, 62}},
409 { "Four and Twenty", "E", false, {38, 45, 50, 50, 57, 62}},
410 { "Ostrich", "E", false, {38, 50, 50, 50, 62, 62}},
411 { "Capo 200", "E", false, {36, 43, 50, 51, 62, 63}},
412 { "Balalaika", "E", false, {40, 45, 50, 52, 52, 57}},
413 { "Cittern One", "E", false, {36, 41, 48, 55, 60, 62}},
414 { "Cittern Two", "E", false, {36, 43, 48, 55, 60, 67}},
415 { "Dobro", "E", false, {43, 47, 50, 55, 59, 62}},
416 { "Lefty", "E", false, {64, 59, 55, 50, 45, 40}},
417 { "Mandoguitar", "E", false, {36, 43, 50, 57, 64, 71}},
418 { "Rusty Cage", "E", false, {35, 45, 50, 55, 59, 64}},
419 { "Hardcore", "C", false, {36, 43, 48, 53, 57, 58}},
360420 };
361421 int mode = static_cast<int>(mode_);
362422 m_tuner.clear_notes();
7272 bld.install_files('${LV2DIR}/gxtuner.lv2', 'manifest.ttl')
7373 bld.install_files('${LV2DIR}/gxtuner.lv2', 'gxtuner.ttl')
7474
75 bld.install_files('${LV2DIR}/gxtuner.lv2/', bld.path.ant_glob('modgui/**/*'), relative_trick=True)
0 #! /bin/bash
1
2 # use to copy the LV2 bundle gx_sceleton.lv2 to gx_${name}.lv2
3 # generate a C++ file from the faust.dsp source (by dsp2cc)
4 # generate a acording name.ttl file
5 # were ${name} is the first arg on comandline, usualy the dsp file.
6 # the dsp file needs to be stored in the faust folder.
7
8 ########################## functions ###################################
9
10 function usage() {
11 echo "usage: make_lv2_bundle {options} <cc|cpp|dsp-file> [<plugin class>] "
12 echo "options:"
13 echo " -h: show this help"
14 echo " -s: faust use single precision"
15 echo " -d: faust use double precision (default)"
16 echo " -V: faust use vectorize"
17 echo " -S x: faust use vector size x"
18 echo " -p /: path to source file"
19 exit 1
20 }
21
22 function get_basename_ext() {
23 case "$extension" in
24 dsp)
25 if [ "$2" = "" ]; then
26 bname="$(basename "$1" .dsp)"
27 else
28 bname="$(basename "$1" .dsp)"
29 effect_name="$2"
30 fi;;
31 cc)
32 if [ "$2" = "" ]; then
33 bname="$(basename "$1" .cc)"
34 else
35 bname="$(basename "$1" .cc)"
36 effect_name="$2"
37 fi;;
38 cpp)
39 if [ "$2" = "" ]; then
40 bname="$(basename "$1" .cpp)"
41 else
42 bname="$(basename "$1" .cpp)"
43 effect_name="$2"
44 fi;;
45 *)
46 echo -e $RED"file extension not supported"$NONE ; usage;;
47 esac
48 }
49
50 function select_plugin_type() {
51 echo -e $RED'Please select a Plugin type from the list'$NONE
52 select type in "${Plugin_types[@]}" ; do
53 if [[ $type == "quit" ]]; then
54 break
55 fi
56 effect_name="$type"
57 if [ ! -z "$type" ]; then
58 break;
59 else
60 echo -e $RED"Select a number from the list!"$NONE
61 fi
62 done
63 }
64
65 function check_plugin_type() {
66 for I in "${Plugin_types[@]}"; do
67 [[ $I == $effect_name ]] && return 0
68 done
69 select_plugin_type
70 return 0
71 }
72
73 function check_dir() {
74 if [ ! -d gx_${bname}.lv2 ]; then
75 mkdir -p gx_${bname}.lv2
76 else
77 echo -e $RED"Directory gx_${bname}.lv2 allready exist, should we remove it? Yes/No"$NONE
78 select yn in "Yes" "No"; do
79 case $yn in
80 Yes ) rm -rf gx_${bname}.lv2; mkdir -p gx_${bname}.lv2; break;;
81 No ) echo -e $RED"exit"$NONE; exit;;
82 esac
83 done
84 fi
85 }
86
87 function dsptocc() {
88 if [ -f ${faustdir}/"$bname.$extension" ] ; then
89 if [ $extension == "dsp" ] ; then
90 echo -e $BLUE"generate $bname.cc and copy to gx_$bname.lv2"$NONE
91 set -e
92 "$tooldir"/dsp2cc --init-type=plugin-lv2 \
93 $prec "${faustopt[@]}" -o gx_${bname}.lv2/"$bname.cc" ${faustdir}/"$bname.dsp"
94 else
95 echo -e $BLUE"copy $bname.$extension to gx_$bname.lv2/$bname.cc"$NONE
96 cp -r ${faustdir}/"$bname.$extension" gx_${bname}.lv2/"$bname.cc"
97 fi
98 else
99 echo -e $RED"error: "${faustdir}/"$bname.$extension not found"$NONE; exit;
100 fi
101 }
102
103
104 function copy_sceleton() {
105 grep 'stereo_audio' gx_${bname}.lv2/$bname.cc >/dev/null && stereo="true" || stereo="false"
106 if [ "$stereo" == "true" ] ; then
107 grep 'stereo_audio = 0;' gx_${bname}.lv2/$bname.cc >/dev/null && stereo="false" || stereo="true"
108 fi
109
110 if [ "$stereo" == "false" ] ; then
111 echo "copy gx_sceleton.lv2 to gx_$bname.lv2 and rename/replace strings to $bname"
112 cp -r gx_sceleton.lv2/* gx_${bname}.lv2/
113 j=2
114 else
115 echo "copy gx_sceleton_stereo.lv2 to gx_$bname.lv2 and rename/replace strings to $bname"
116 cp -r gx_sceleton_stereo.lv2/* gx_${bname}.lv2/
117 j=4
118 fi
119 cd ./gx_${bname}.lv2 && rename 's/sceleton/'${bname}'/g' * && sed -i 's/sceleton/'${bname}'/g' *
120 }
121
122 function grep_ports_enums() {
123 echo "grep ports and copy them to gx_$bname.h"
124 cat "$bname.cc" | sed -n '/enum/,/PortIndex/p' | sed '/enum/d;/PortIndex/d;/{/d;/}/d'>ports
125
126 if [ "$stereo" == "false" ] ; then
127 sed -i -e '/EFFECTS_INPUT/r ports' "gx_$bname.h"
128 else
129 sed -i -e '/EFFECTS_INPUT1/r ports' "gx_$bname.h"
130 fi
131 echo "grep ports values and enums and copy them to gx_$bname.ttl"
132 cat "$bname.cc" | sed -n '/data;/{p;g;1!p;};h' | sed 's/ , /\n/;s/.*\n//;s/case//g;s/,/ ;/g;s/://g;s/ //g;s/ //g;s/ //g;s/$/;/' | sed '$!N;s/\n//'>ports
133 cat "$bname.cc" | sed -n '/value_pair/{p;n;1!p;};h' | sed 's/{/\n/;s/.*\n//;s/ , /\n/;s/.*\n//;s/case//g;s/}//g;s/{//g;s/;//g;s/,/ ;/g;s/://g;s/ //g;s/;0//g;s/ //g;s/ //g;s/$/;/' > enums
134 }
135
136 function make_ttl() {
137 match=0
138
139 while IFS=$';' read -r -a myPorts; do
140 while IFS=$';' read -r -a myEnum; do
141 if [ -z "${myEnum[0]}" ]; then
142 match=0
143 else
144 a=${#myEnum[@]}
145 if (($a==1)); then
146 if [ ${myPorts[4]} == ${myEnum[0]} ]; then
147 match=1
148 sed -i -e "1,2d" enums
149 break
150 fi
151 else
152 match=0
153 FLOAT=${myPorts[1]}
154 i=${FLOAT/\.*}
155 for (( c=0; c<a; c++ )); do
156 enum_var1+=" lv2:scalePoint [rdfs:label "${myEnum[c]}"; rdf:value "${i}"];\n"
157 i=$[i+1]
158 done
159 fi
160 fi
161 done < enums
162 echo ' , [
163 a lv2:InputPort ,
164 lv2:ControlPort ;
165 lv2:index' $j' ;
166 lv2:symbol "'${myPorts[4]}'" ;
167 lv2:name "'${myPorts[4]}'" ;'
168 echo ' lv2:default '${myPorts[0]}' ;
169 lv2:minimum '${myPorts[1]}' ;
170 lv2:maximum '${myPorts[2]}' ;'
171 if (($match==1)); then
172 echo ' lv2:portProperty lv2:integer;
173 lv2:portProperty lv2:enumeration ; '
174 echo -e "$enum_var1"
175 enum_var1=""
176 match=0
177 fi
178 echo -n ' ]'
179 j=$[j+1]
180 enum_var1=""
181 done < ports >> gx_$bname.ttl
182 echo ";
183 mod:gui [
184 a mod:Gui;
185 mod:resourcesDirectory <modgui>;
186 mod:iconTemplate <modgui/icon-gx$bname.html>;
187 mod:templateData <modgui/data-gx$bname.json>;
188 mod:screenshot <modgui/screenshot-gx$bname.png>;
189 mod:thumbnail <modgui/thumb-gx$bname.png>;
190 ]." >> gx_$bname.ttl
191 if [ ! -z "$effect_name" ]; then
192 sed -i 's/EffectPlugin/'${effect_name}'/g' gx_$bname.ttl
193 echo -e "set plugin class to "$BLUE"$effect_name"$NONE
194 fi
195 rm -rf ports
196 rm -rf enums
197 }
198
199 function byby() {
200 echo -e $BLUE"Okay, gx_${bname}.lv2 is done"$NONE
201 echo -e $BLUE"Please add gx_${bname}.lv2 to the wscript in the LV2 directory
202 and run ./waf build in order to build the plug"$NONE
203 }
204
205 ########################## supported plugin types ######################
206
207 Plugin_types=(
208 'DelayPlugin'
209 'ReverbPlugin'
210 'DistortionPlugin'
211 'WaveshaperPlugin'
212 'DynamicsPlugin'
213 'AmplifierPlugin'
214 'CompressorPlugin'
215 'EnvelopePlugin'
216 'ExpanderPlugin'
217 'GatePlugin'
218 'LimiterPlugin'
219 'FilterPlugin'
220 'AllpassPlugin'
221 'BandpassPlugin'
222 'CombPlugin'
223 'EQPlugin'
224 'MultiEQPlugin'
225 'ParaEQPlugin'
226 'HighpassPlugin'
227 'LowpassPlugin'
228 'GeneratorPlugin'
229 'ConstantPlugin'
230 'InstrumentPlugin'
231 'OscillatorPlugin'
232 'ModulatorPlugin'
233 'ChorusPlugin'
234 'FlangerPlugin'
235 'PhaserPlugin'
236 'ReverbPlugin'
237 'SimulatorPlugin'
238 'ReverbPlugin'
239 'SpatialPlugin'
240 'SpectralPlugin'
241 'PitchPlugin'
242 'UtilityPlugin'
243 'AnalyserPlugin'
244 'ConverterPlugin'
245 'FunctionPlugin'
246 'MixerPlugin' )
247
248
249
250 ###################### global variables ################################
251
252 BLUE="\033[1;34m"
253 RED="\033[1;31m"
254 NONE="\033[0m"
255
256 tooldir=../../tools
257 faustdir=./faust
258 instdir="$tooldir"/.."$(dirname "$0")"
259 prec="--double"
260 faustopt=()
261 copy=0
262 bname=""
263 effect_name=""
264
265 ############################# main #####################################
266
267 while getopts hsdVSp:c OPT; do
268 case "$OPT" in
269 h) usage;;
270 s) prec="--float";;
271 d) prec="--double";;
272 V) faustopt+=(--vectorize);;
273 S) faustopt+=(--add="-vs $OPTARG");;
274 p) faustdir=$OPTARG;;
275 c) copy=1;;
276 \?) usage;;
277 esac
278 done
279
280 shift $(expr $OPTIND - 1)
281 [ "$1" = "" ] && usage
282 extension="${1##*.}"
283
284 ######################## function calls ################################
285
286 get_basename_ext "$1" "$2"
287 check_plugin_type && echo -e "Plugin type "$BLUE"$effect_name"$NONE
288 check_dir
289 dsptocc
290 copy_sceleton
291 grep_ports_enums
292 make_ttl
293 byby
294
295 ############################ EOF #######################################
296
297 exit
7070 'gxtubetremelo.lv2',
7171 'gxtubevibrato.lv2',
7272 'gxtuner.lv2',
73 'gx_zita_rev1.lv2'
73 'gx_zita_rev1.lv2',
74 'gx_mbdistortion.lv2',
75 'gx_mbdelay.lv2',
76 'gx_mbecho.lv2',
77 'gx_mbcompressor.lv2',
78 'gx_fuzz.lv2',
79 'gx_graphiceq.lv2',
80 'gx_duck_delay.lv2',
81 'gx_duck_delay_st.lv2',
82 'gx_barkgraphiceq.lv2',
7483
7584 ]
7685
0 declare id "bassEnhancer";
1 declare name "Bass Enhancer";
2 declare category "Misc";
3
4 //------------------------------------
5 //Based at:
6 //"LOW COMPLEXITY VIRTUAL BASS ENHANCEMENT ALGORITHM FOR PORTABLE MULTIMEDIA DEVICE"
7 //MANISH ARORA, HAN-GIL MOON, AND SEONGCHEOL JANG
8 //Audio lab, DM R&D Center, Samsung Electronics co. Ltd, Suwon, South Korea
9 //------------------------------------
10
11 import("filter.lib");
12 import("effect.lib");
13
14 //Controls
15 lp_freq = hslider("Frequency",100,60,240,5);
16 harmonics_volume = hslider("HarmonicsdB",0, -16, +32, 0.1): db2linear : smooth(0.999);
17
18 //Can be moved to .lib
19 X = (_,_)<:(!,_,_,!);
20 switch(c,x,y) = sel(c,x,y)
21 with {
22 sel(c,x,y) = (1-c)*x + c*y;
23 };
24
25 //NLD and consts
26 harm1 = 0.03;
27 harm2 = 0.015;
28 get_const(a,b,x,y) = (x <= y)*a + (x > y)*b;
29 nld1(a,b) = _<:(_,_,X,_,_:_,X,_,_,_:((get_const(a,b):1-_),_,get_const(a,b),_):(_*_,_*_:(_+_)))~_~_~_;
30
31 process = _,_<:hp_branch,(_,_:>lp_branch<:_,_),(_,_:>be_branch<:_,_),hp_branch:>_,_
32 with {
33 hp_branch = dcblockerat(20) : highpass(8, lp_freq);
34 lp_branch = dcblockerat(20) : lowpass(8,lp_freq);
35 be_branch = lowpass(8,lp_freq) : nld1(harm1,harm2) : _*harmonics_volume;
36 };
37
38
0 // ----- bass enhancer
1 b.openHorizontalhideBox("");
2 b.closeBox();
3 b.openVerticalBox("");
4 {
5 b.openHorizontalTableBox("");
6 {
7 b.create_small_rackknob(PARAM("Frequency"), _(" frequency "));
8 b.create_small_rackknob(PARAM("HarmonicsdB"), _(" harmonics dB "));
9 }
10 b.closeBox();
11 }
12 b.closeBox();
13
1414 dtime = hslider("delay", 0.02, 0, 0.2, 0.01): smooth(0.999);
1515 depth = hslider("depth", 0.02, 0, 1, 0.01);
1616
17 tblosc(n,f,freq,mod) = (1-d)*rdtable(n,waveform,i&(n-1)) +
18 d*rdtable(n,waveform,(i+1)&(n-1))
17 tblosc(n,f,freq,mod) = (1-d)*rdtable(n,wform,i&(n-1)) +
18 d*rdtable(n,wform,(i+1)&(n-1))
1919 with {
20 waveform = time*(2.0*PI)/n : f;
20 wform = time*(2.0*PI)/n : f;
2121 phase = freq/SR : (+ : decimal) ~ _;
2222 modphase = decimal(phase+mod/(2*PI))*n;
2323 i = int(floor(modphase));
0 declare id "dattorros_progenitor";
1 declare name "Plate reverb";
2 declare category "Reverb";
3
4 //------------------------------------
5 //Based at:
6 //Effect Design Part 1: Reverberator and Other Filters
7 //JON DATTORRO, AES Member
8 //CCRMA, Stanford University, Stanford, CA, USA
9 //------------------------------------
10
11 import ("music.lib");
12
13 //Controls
14 max_predelay_ms = 200;
15 predelay = hslider("predelay ms", 0, 0, max_predelay_ms, 10);
16 excursion = hslider("excursion", 0, 0, 16, 0.5);
17 decay = hslider("decay", 0.1, 0, 0.5, 0.01);
18 decay_diffusion1 = hslider("decay diff 1", 0.1, 0, 0.7, 0.01);
19 decay_diffusion2 = hslider("decay diff 2", 0.1, 0, 0.5, 0.01);
20 input_diffusion1 = hslider("input diff 1", 0.1, 0, 0.75, 0.01);
21 input_diffusion2 = hslider("input diff 2", 0.1, 0, 0.625, 0.01);
22 bandwidth = hslider("bandwidth", 0.9, 0.1, 0.95, 0.0005);
23 damping = hslider("damping", 0.0005, 0.1, 0.95, 0.0005);
24 dry_wet = hslider("dry/wet", 0.5, 0, 1, 0.05);
25
26 //Will be moved to .lib
27 X = (_,_)<:(!,_,_,!);
28 opf(a) = (_+_*(1-a)~@(1)*a);
29 allpass(dt,fb) = (_,_ <: (*(fb),_:+:@(dt)), -) ~ _ : (!,_);
30 allpass_with_fdelay(dt1,coef,dt2,dt2pos) = (_,_ <: (*(coef),_:+:@(dt1):fdelay(dt2,dt2pos)), -) ~ _ : (!,_);
31 mixer(c,x0,y0,x1,y1) = sel(c,x0,y0), sel(c,x1,y1)
32 with {
33 sel(c,x,y) = (1-c)*x + c*y;
34 };
35
36 //Consts
37 orig_sr = 29761.0; //Original sample rate, described in paper
38
39 //Correct delay lines according sample rate
40 get_length(x) = x/orig_sr:_*SR:int;
41 get_predelay_length(x) = x*SR:_*0.001;
42
43 input_chain(predelay, bw, input_diffusion1, input_diffusion2) =
44 (_+_)*0.5:fdelay(65536,get_predelay_length(predelay)):opf(bw):
45 allpass(get_length(142),input_diffusion1):allpass(get_length(107),input_diffusion1):
46 allpass(get_length(379),input_diffusion2):allpass(get_length(277),input_diffusion2);
47
48 left_branch(excursion,decay_diffusion1,damping,decay,decay_diffusion2) = _*0.5+_*0.3:allpass_with_fdelay(get_length(656),decay_diffusion1,17,0.5*(osc(1)+1)*excursion)<:@(get_length(4453)),_:
49 opf(damping),_:_*decay,_:allpass(get_length(1800),decay_diffusion2),_:@(get_length(3720)),_:_*decay,_;
50
51 right_branch(excursion,decay_diffusion1,damping,decay,decay_diffusion2) =
52 _*0.5+_*0.3:allpass_with_fdelay(get_length(892),decay_diffusion1,17,0.5*(osc(1)+1)*excursion)<:@(get_length(4217)),_:
53 opf(damping),_:_*decay,_:allpass(get_length(2656),decay_diffusion2),_:@(get_length(3163)),_:_*decay,_;
54
55 process = _,_<:
56 (_,(input_chain(predelay,1 - bandwidth, input_diffusion1,input_diffusion2)<:_,_),_):>
57 (_,(_,X,_:(left_branch(excursion,decay_diffusion1,damping,decay,decay_diffusion2),
58 right_branch(excursion,decay_diffusion1,damping,decay,decay_diffusion2)):_,X,_)~X),_:_,_,X,_,_:
59 _,(_,_:>_),(_,_:>_),_:X,_,_:mixer(1 - dry_wet);
60
0 // dattorros progenitor (Plate reverb)
1
2 b.openHorizontalhideBox("");
3 b.create_master_slider(PARAM("dry/wet"), _("drt/wet"));
4 b.closeBox();
5
6 b.openHorizontalBox("");
7 b.openVerticalBox("");
8 b.openHorizontalBox("");
9 {
10 b.create_small_rackknob(PARAM("predelay ms"), _("predelay ms"));
11 b.create_small_rackknob(PARAM("bandwidth"), _(" bandwidth "));
12 b.create_small_rackknob(PARAM("input diff 1"), _(" in diff 1 "));
13 b.create_small_rackknob(PARAM("input diff 2"), _(" in diff 2 "));
14 b.create_small_rackknob(PARAM("excursion"), _(" excursion "));
15
16
17 }
18 b.closeBox();
19 b.openHorizontalBox("");
20 {
21 b.create_small_rackknob(PARAM("decay"), _(" decay "));
22 b.create_small_rackknob(PARAM("decay diff 1"), _("dec diff 1"));
23 b.create_small_rackknob(PARAM("decay diff 2"), _("dec diff 2"));
24 b.create_small_rackknob(PARAM("damping"), _("HF damping"));
25 b.create_small_rackknobr(PARAM("dry/wet"), _(" dry/wet "));
26 }
27 b.closeBox();
28 b.closeBox();
29 b.closeBox();
2929 tempo2note = ffunction(float B2N(int,float), "beat.h", "");
3030
3131 dide = _<:*(dry),(*(wet) : digd):>_ with {
32 digd = (+:_<:_ ,(delayed:*(level)) :>_)~(*(feedback): highpass(2,hifr1):lowpass(2,lofr1) : selfilter(sl)) with {
32 digd = (+:(delayed:*(level)))~(*(feedback): highpass(2,hifr1):lowpass(2,lofr1) : selfilter(sl)) with {
3333 sl = hslider("mode[enum:plain|presence|tape|tape2]",0,0,3,1);
3434 delayed = sdelay(N, interp, min(2^19,(tempo2note(tact,dbpm)))) with {
3535 dtime = hslider("delay[tooltip:Delay Time in ms]", 2500, 0.1, 5000, 0.1)*SR/1000.0;
4242 interp = 100*SR/1000.0;
4343 N = int( 2^19 ) ;
4444 };
45 level = vslider("level[tooltip:percentage of the delay gain level]", 50, 0, 100, 1)/100 ;
46 feedback = vslider("feedback[tooltip:percentage of the feedback level in the delay loop]", 50, 0, 100, 1)/100 ;
45 level = vslider("level[tooltip:percentage of the delay gain level]", 50, 1, 100, 1)/100 ;
46 feedback = vslider("feedback[tooltip:percentage of the feedback level in the delay loop]", 50, 1, 100, 1)/100 ;
4747 hifr1 = hslider("highpass [name:highpass (hz)][tooltip: highpass filter frequency in the feddback loop]" ,120 , 20, 20000, 1);
4848 lofr1 = hslider("howpass [name:lowpass (hz)][tooltip: lowpass filter frequency in the feddback loop]" ,12000 , 20, 20000, 1);
4949 };
5050 wet = vslider("gain[tooltip:overall gain of the delay line in percent]", 100, 0, 120, 1) : /(100);
51 dry = 1 - wet;
51 dry = 1 ;
5252 };
5353
5454 process = dide;
2424 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_TOP);
2525 b.create_small_rackknob(PARAM("highpass"), _("highpass (hz)"));
2626 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_TOP);
27 b.create_small_rackknob(PARAM("howpass"), _("howpass (hz)"));
27 b.create_small_rackknob(PARAM("howpass"), _("lowpass (hz)"));
2828 }
2929 b.closeBox();
3030 }
2424 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_TOP);
2525 b.create_small_rackknob(PARAM("highpass"), _("highpass(hz)"));
2626 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_TOP);
27 b.create_small_rackknob(PARAM("howpass"), _("howpass(hz)"));
27 b.create_small_rackknob(PARAM("howpass"), _("lowpass(hz)"));
2828 }
2929 b.closeBox();
3030 }
0 declare id "duckDelay";
1 declare name "Duck Delay";
2 declare category "Echo / Delay";
3
4 //------------------------------------
5 //Inspired by:
6 //http://www.gvst.co.uk/gduckdly.htm
7 //Axe-FX II Owner's manual:5.6
8 //------------------------------------
9
10 //------------------------------------
11 //Description:
12 //The delayed signal added to output dependent of input signal amplitude.
13 //If the input signal is high. The delayed signall turned off, and vise versa.
14 //The switching controlled by envelope follower
15 //(parameters: "attack", "release", and main - "amount", what controls envelope follower influence).
16 //
17 //Parameters description:
18 //time - delay time in milliseconds
19 //feedback - delay feedback
20 //attack, release - envelope follower time in seconds controls
21 //amount dB - envelope follower influence
22 //------------------------------------
23
24 import("music.lib");
25 import("effect.lib");
26
27 //Constrols
28 p_time = hslider("time", 500, 1, 2000, 1):smooth(tau2pole(0.1));
29 p_feedback = hslider("feedback", 0, 0, 1, 0.05);
30 p_attack_time = hslider("attack", 0.1, 0.05, 0.5, 0.05);
31 p_release_time = hslider("relese", 0.1, 0.05, 2, 0.05);
32 p_amount = hslider("amount", 0.5, 0,56, 0.05):db2linear;
33
34 //Consts
35 c_channels_sw_time = 0.1;
36 c_fdelay_max_len = 393216;
37
38 get_delay_length(x) = x*SR:_*0.001;
39
40 process = _<:
41 _,(_<:(_+_:fdelay(c_fdelay_max_len,get_delay_length(p_time)))~_*p_feedback,
42 (amp_follower_ud(p_attack_time,p_release_time):_*p_amount:_>1:(1 - _):
43 smooth(tau2pole(c_channels_sw_time)))):_,_*_
44 :>_;
0 declare id "duckDelaySt";
1 declare name "Duck Delay St";
2 declare category "Echo / Delay";
3
4 //------------------------------------
5 //Description:
6 //The delayed signal added to output dependent of input signal amplitude.
7 //If the input signal is high. The delayed signall turned off, and vise versa.
8 //The switching controlled by envelope follower
9 //(parameters: "attack", "release", and main - "amount", what is controls envelope follower influence).
10 //
11 //Parameters description:
12 //time - delay time in milliseconds
13 //feedback - delay feedback
14 //pingpong - changes feedback character
15 //coloration - LP/HP coloration filter
16 //attack, release - envelope follower time in seconds controls
17 //amount dB - envelope follower influence
18 //effect - amplitude of effect signal in mix
19 //------------------------------------
20
21 import("music.lib");
22 import("effect.lib");
23
24 //Constrols
25 p_time = hslider("time", 500, 1, 2000, 1):smooth(tau2pole(0.1));
26 p_feedback = hslider("feedback", 0, 0, 1, 0.05);
27 p_pingpong = hslider("pingpong", 0, 0, 1, 0.05);
28 coloration = hslider("coloration", 0, -1, 1, 0.05);
29
30 p_attack_time = hslider("attack", 0.1, 0.05, 0.5, 0.05);
31 p_release_time = hslider("release", 0.1, 0.05, 2, 0.05);
32 p_amount = hslider("amount", 0.5, 0,56, 0.05):db2linear;
33
34 p_effect = hslider("effect", 0, -16, +4, 0.1) : db2linear : smooth(0.999);
35
36 //Consts
37 c_fdelay_max_len = 393216;
38 c_channels_sw_time = 0.1;
39
40 //Funcs
41 X = (_,_)<:(!,_,_,!);
42 get_delay_length(x) = x*SR:_*0.001;
43 coloration_filter(coloration) = _<:(lowshelf(5,(1 - coloration)*12,440),
44 highshelf(5,coloration*12,880)):>_*db2linear(-15);
45
46 pp_delay(time,fb_coef,pp_fb_coef) = _,_*(1 - pp_fb_coef):
47 (_,X,_:(X:(pp_fb_delay(time, fb_coef,pp_fb_coef))),
48 (X:(pp_fb_delay(time, fb_coef,pp_fb_coef))):_,_)~X
49 :>_,_
50 with {
51 pp_fb_delay(time,fb_coef,pp_fb_coef) = _+_*pp_fb_coef:
52 (_+_:fdelay(c_fdelay_max_len,get_delay_length(p_time)))~_*fb_coef;
53 };
54
55 switcher(att, rel, amount) = amp_follower_ud(att,rel):
56 _*amount:_>1:(1 - _):
57 smooth(tau2pole(c_channels_sw_time));
58
59 process = (_<:_,_,_),(_<:_,_,_):
60 _,
61 switcher(p_attack_time, p_release_time, p_amount),
62 (pp_delay(p_time,p_feedback*(1 - p_pingpong),p_pingpong*p_feedback):
63 coloration_filter(coloration),coloration_filter(coloration)),
64 switcher(p_attack_time, p_release_time, p_amount),
65 _:
66 _,_*_,_*_,_:(_,_*p_effect:>_),(_*p_effect,_:>_);
67
0 // ducking delay stereo
1
2 b.openHorizontalhideBox("");
3 b.create_master_slider(PARAM("effect"), _("effect"));
4 b.closeBox();
5
6
7 b.openHorizontalBox("");
8 b.openVerticalBox("");
9 b.openHorizontalBox("");
10 {
11 b.create_small_rackknob(PARAM("time"), _(" time ms "));
12 b.create_small_rackknob(PARAM("feedback"), _(" feedback "));
13 b.create_small_rackknob(PARAM("pingpong"), _(" ping-pong"));
14 b.create_small_rackknob(PARAM("coloration"), _("coloration"));
15 }
16 b.closeBox();
17 b.openHorizontalBox("");
18 {
19 b.create_small_rackknob(PARAM("attack"), _(" attack "));
20 b.create_small_rackknob(PARAM("release"), _(" release "));
21 b.create_small_rackknob(PARAM("amount"), _(" amount "));
22 b.create_small_rackknobr(PARAM("effect"), _(" effect "));
23 }
24 b.closeBox();
25 b.closeBox();
26 b.closeBox();
0 // ----- ducking delay
1 b.openHorizontalhideBox("");
2 b.closeBox();
3 b.openVerticalBox("");
4 {
5 b.openHorizontalTableBox("");
6 {
7 b.create_small_rackknob(PARAM("time"), _(" time ms "));
8 b.create_small_rackknob(PARAM("feedback"), _(" feedback "));
9 b.create_small_rackknob(PARAM("attack"), _(" attack s "));
10 b.create_small_rackknob(PARAM("relese"), _(" release s "));
11 b.create_small_rackknob(PARAM("amount"), _(" amount dB "));
12 }
13 b.closeBox();
14 }
15 b.closeBox();
16
0 declare id "gain";
1 declare name "Volume";
2 declare category "Tone control";
3 declare description "simple volume control";
4
5 import("music.lib");
6 import("guitarix.lib");
7
8 gain = vslider("gain[tooltip:gain (dB)]", 0, -40, 40, 0.1) : db2linear : smoothi(0.999);
9 process = *(gain);
0 // ----- gain
1 b.openHorizontalhideBox("");
2 b.create_master_slider(PARAM("gain"), _("gain"));
3 b.closeBox();
4 b.openHorizontalBox("");
5 {
6 b.create_small_rackknob(PARAM("gain"), _("gain"));
7 }
8 b.closeBox();
0 declare id "graphiceq";
1 declare name "Graphic EQ";
2 declare category "Tone control";
3 declare description "Graphic EQ";
4
5
6 import("filter.lib");
7 import("reduce.lib");
8
9
10 //geq = filterbank(3, (31.25, 62.5, 125., 250., 500., 1000., 2000., 4000., 8000., 16000.));
11 geq = filterbank(3, (44., 88., 177., 354., 707., 1414., 2828., 5657., 11384., 18110.));
12
13 g1 = vslider("g1[tooltip:gain (dB) below 31.25 Hz]", 0, -60, 20, 0.1) : db2linear : smooth(0.999);
14 g2 = vslider("g2 [tooltip:gain (dB) at 62.5 Hz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
15 g3 = vslider("g3 [tooltip:gain (dB) at 125 Hz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
16 g4 = vslider("g4 [tooltip:gain (dB) at 250 Hz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
17 g5 = vslider("g5 [tooltip:gain (dB) at 500 Hz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
18 g6 = vslider("g6 [tooltip:gain (dB) at 1 kHz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
19 g7 = vslider("g7 [tooltip:gain (dB) at 2 kHz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
20 g8 = vslider("g8 [tooltip:gain (dB) at 4 kHz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
21 g9 = vslider("g9 [tooltip:gain (dB) at 8 kHz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
22 g10 = vslider("g10 [tooltip:gain (dB) at 16 kHz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
23 g11 = vslider("g11 [tooltip:gain (dB) above 16 kHz]", 0, -30, 20, 0.1) : db2linear : smooth(0.999);
24
25
26 v1(x) = attach(x, envelop(x) : vbargraph("v1[nomidi:no]", -70, +5));
27 v2(x) = attach(x, envelop(x) : vbargraph("v2[nomidi:no]", -70, +5));
28 v3(x) = attach(x, envelop(x) : vbargraph("v3[nomidi:no]", -70, +5));
29 v4(x) = attach(x, envelop(x) : vbargraph("v4[nomidi:no]", -70, +5));
30 v5(x) = attach(x, envelop(x) : vbargraph("v5[nomidi:no]", -70, +5));
31
32 v6(x) = attach(x, envelop(x) : vbargraph("v6[nomidi:no]", -70, +5));
33 v7(x) = attach(x, envelop(x) : vbargraph("v7[nomidi:no]", -70, +5));
34 v8(x) = attach(x, envelop(x) : vbargraph("v8[nomidi:no]", -70, +5));
35 v9(x) = attach(x, envelop(x) : vbargraph("v9[nomidi:no]", -70, +5));
36 v10(x) = attach(x, envelop(x) : vbargraph("v10[nomidi:no]", -70, +5));
37 v11(x) = attach(x, envelop(x) : vbargraph("v11[nomidi:no]", -70, +5));
38
39 envelop = abs : max ~ (1.0/SR) : reduce(max,4096) ;
40
41 process = geq :(*(g11):v11), (*(g10):v10),(*(g9):v9),(*(g8):v8),(*(g7):v7),(*(g6):v6),
42 (*(g5):v5),(*(g4):v4),(*(g3):v3),(*(g2):v2),(*(g1):v1) :>_;
0 // ----- graphiceq
1 b.openHorizontalhideBox("");
2 b.closeBox();
3 b.openHorizontalBox("");
4 {
5 b.openFrameBox("");
6 b.closeBox();
7 b.openHorizontalBox("");
8 {
9 b.create_simple_c_meter(PARAM("v1"), PARAM("g1"),"<31");
10 }
11 b.closeBox();
12 b.openHorizontalBox("");
13 {
14 b.create_simple_c_meter(PARAM("v2"), PARAM("g2"),"62");
15 }
16 b.closeBox();
17 b.openHorizontalBox("");
18 {
19 b.create_simple_c_meter(PARAM("v3"), PARAM("g3"),"125");
20 }
21 b.closeBox();
22 b.openHorizontalBox("");
23 {
24 b.create_simple_c_meter(PARAM("v4"), PARAM("g4"),"250");
25 }
26 b.closeBox();
27 b.openHorizontalBox("");
28 {
29 b.create_simple_c_meter(PARAM("v5"), PARAM("g5"),"500");
30 }
31 b.closeBox();
32 b.openHorizontalBox("");
33 {
34 b.create_simple_c_meter(PARAM("v6"), PARAM("g6"),"1k");
35 }
36 b.closeBox();
37 b.openHorizontalBox("");
38 {
39 b.create_simple_c_meter(PARAM("v7"), PARAM("g7"),"2k");
40 }
41 b.closeBox();
42 b.openHorizontalBox("");
43 {
44 b.create_simple_c_meter(PARAM("v8"), PARAM("g8"),"4k");
45 }
46 b.closeBox();
47 b.openHorizontalBox("");
48 {
49 b.create_simple_c_meter(PARAM("v9"), PARAM("g9"),"8k");
50 }
51 b.closeBox();
52 b.openHorizontalBox("");
53 {
54 b.create_simple_c_meter(PARAM("v10"), PARAM("g10"),"16k");
55 }
56 b.closeBox();
57 b.openHorizontalBox("");
58 {
59 b.create_simple_c_meter(PARAM("v11"), PARAM("g11"),"<");
60 }
61 b.closeBox();
62 b.openFrameBox("");
63 b.closeBox();
64 }
65 b.closeBox();
0 declare id "panoram_enhancer";
1 declare name "Panoram enhancer";
2 declare shortname "Panoram";
3 declare category "Misc";
4
5 //------------------------------------
6 //Based at:
7 //ECE542 T. Tran; Rice University; Spring 2005
8 //"Title: Stereo Enhancement Algorithm"
9 //------------------------------------
10
11 import("filter.lib");
12 import("music.lib");
13
14 //Controls
15 delay_width = hslider("Delay width",0,0,1,0.01):smooth(0.999);
16 freq_width = hslider("Frequency width",0,0,1,0.01);
17
18 //Constants
19 dt_max_const = 65536; //Max length of all delay lines, to provide 200 ms at 192 kHz
20 dt_max = 0.2 * SR; //Real max length, 200 ms
21 filters_order = 6; //Filters order in filter-banks
22 fmain = 1800; //Main filter fhi
23 f1 = 3600; f2 = 6400; f3 = 20000; //Border freqs of filters in filter-banks
24 freq_shift = 1500; //Filters freq difference between filter-banks
25 fbank_coef_gap = 0.6; //Filters in filter-banks gain coefs min value
26
27 //Random changed values emulation
28 rv1 = _; rv2 = _*0.7; rv3 = _ + 0.3:sqrt(_);
29 rv4 = _*3.14:sin; rv5 = _*1.23:cos; rv6 = _+9:log10;
30
31 pa_filter(dt,flo,fhi,coef) = fdelay(dt_max_const,dt):highpass(filters_order,flo):lowpass(filters_order,fhi):_*coef;
32
33 gain_coef = _*(1 - fbank_coef_gap):_+fbank_coef_gap;
34
35 pa_filter_bank1(delay_width,filter_width) = _<:
36 pa_filter(dt_max:rv1:_*delay_width,fmain,f1,freq_width:rv5:gain_coef),
37 pa_filter(dt_max:rv3:_*delay_width,f1,f2, freq_width:rv2:gain_coef),
38 pa_filter(dt_max:rv2:_*delay_width,f2,f3, freq_width:rv4:gain_coef)
39 :>_;
40
41 pa_filter_bank2(delay_width,filter_width) = _<:
42 pa_filter(dt_max:rv5:_*delay_width,fmain - freq_shift*freq_width,f1 - freq_shift*freq_width,freq_width:rv3:gain_coef),
43 pa_filter(dt_max:rv1:_*delay_width,f1 - freq_shift*freq_width,f2 - freq_shift*freq_width,freq_width:rv4:gain_coef),
44 pa_filter(dt_max:rv6:_*delay_width,f2 - freq_shift*freq_width,f3 - freq_shift*freq_width,freq_width:rv2:gain_coef)
45 :>_;
46
47 process = _,_<:
48 pa_filter_bank1(delay_width,freq_width),
49 (_,_:(_*0.5,_*0.5:>lowpass(4,fmain))<:_,_),
50 pa_filter_bank2(delay_width,freq_width)
51 :>_,_;
52
0 // ----- panoram enhancer
1 b.openHorizontalhideBox("");
2 b.closeBox();
3 b.openVerticalBox("");
4 {
5 b.openHorizontalTableBox("");
6 {
7 b.create_small_rackknob(PARAM("Delay width"), _(" delay width "));
8 b.create_small_rackknob(PARAM("Frequency width"), _(" freq width "));
9 }
10 b.closeBox();
11 }
12 b.closeBox();
13
0 declare id "ring_modulator";
1 declare name "Ring Modulator Mono";
2 declare shortname "Ring Modulator";
3 declare category "Modulation";
4
5 import("music.lib");
6
7 freq = hslider("freq", 240, 120, 1600, 0.5);
8 wet_dry = hslider("dry/wet", 0.5, 0, 1, 0.05);
9
10 process = _<:((1 - wet_dry)*_,(_*osc(freq))*wet_dry):>_;
0 declare id "ringModulatorSt";
1 declare name "Ring Modulator";
2 declare category "Modulation";
3 declare description "Ring Modulator Stereo Version";
4
5 rm = component("ring_modulator.dsp");
6
7 process = rm,rm;
8
0 // ----- ring - modulator
1 b.openHorizontalhideBox("");
2 b.create_master_slider(PARAM("freq"), "Hz");
3 b.closeBox();
4 b.openVerticalBox("");
5 {
6 b.openHorizontalTableBox("");
7 {
8 b.create_small_rackknob(PARAM("freq"), _("Frequency"));
9 b.create_small_rackknobr(PARAM("dry/wet"), _(" Mix "));
10 }
11 b.closeBox();
12 }
13 b.closeBox();
14
0 // ----- ring - modulator
1 b.openHorizontalhideBox("");
2 b.create_master_slider(PARAM("freq"), "Hz");
3 b.closeBox();
4 b.openVerticalBox("");
5 {
6 b.openHorizontalTableBox("");
7 {
8 b.create_small_rackknob(PARAM("freq"), _("Frequency"));
9 b.create_small_rackknobr(PARAM("dry/wet"), _(" Mix "));
10 }
11 b.closeBox();
12 }
13 b.closeBox();
14
1515 // vectorization makes code slower (tested on ARM NEON).
1616
1717 process = ifilter(vslider("Qs31_25", 50, 1, 100, 1),
18 vslider("freq31_25 [tooltip:Hz]",31., 20, 20000, 1),
18 vslider("freq31_25 [tooltip:Hz]",31.25, 20, 20000, 1),
1919 vslider("fs31_25[tooltip:gain (dB) at 31.25 Hz]", 0, -40, 30, 0.1)
2020 : db2linear : smoothi(0.999))
2121
2222 : ifilter(vslider("Qs62_5", 50, 1, 100, 1),
23 vslider("freq62_5 [tooltip:Hz]",62., 20, 20000, 1),
23 vslider("freq62_5 [tooltip:Hz]",62.5, 20, 20000, 1),
2424 vslider("fs62_5 [tooltip:gain (dB) at 62.5 Hz]", 0, -40, 30, 0.1)
2525 : db2linear : smoothi(0.999))
2626
120120 'gxfeed.dsp',
121121 'highbooster.dsp',
122122 'peak_eq.dsp',
123 'dattorros_progenitor.dsp',
124 'ring_modulator.dsp',
125 'ring_modulator_st.dsp',
126 'panoram_enhancer.dsp',
127 'graphiceq.dsp',
128 'bass_enhancer.dsp',
129 'gain.dsp',
130 'duck_delay.dsp',
131 'duck_delay_st.dsp',
132
123133
124134 # amps
125135 'gxamp.dsp',
2727 float fRec0[3];
2828 void clear_state_f();
2929 void init(unsigned int samplingFreq);
30 void compute(int count, float *input0, float *output0);
30 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
3131 int register_par(const ParamReg& reg);
3232
3333 static void clear_state_f_static(PluginDef*);
3434 static void init_static(unsigned int samplingFreq, PluginDef*);
35 static void compute_static(int count, float *input0, float *output0, PluginDef*);
35 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
3636 static int register_params_static(const ParamReg& reg);
3737 static void del_instance(PluginDef *p);
3838 public:
9898 static_cast<Dsp*>(p)->init(samplingFreq);
9999 }
100100
101 void always_inline Dsp::compute(int count, float *input0, float *output0)
101 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
102102 {
103103 #define fslider0 (*fslider0_)
104104 #define fslider1 (*fslider1_)
133133 #undef fslider2
134134 }
135135
136 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
136 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
137137 {
138138 static_cast<Dsp*>(p)->compute(count, input0, output0);
139139 }
1111 double fRec0[2];
1212 void clear_state_f();
1313 void init(unsigned int samplingFreq);
14 void compute(int count, float *input0, float *input1, float *output0, float *output1);
14 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
1515 int register_par(const ParamReg& reg);
1616
1717 static void clear_state_f_static(PluginDef*);
1818 static void init_static(unsigned int samplingFreq, PluginDef*);
19 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
19 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
2020 static int register_params_static(const ParamReg& reg);
2121 static void del_instance(PluginDef *p);
2222 public:
7070 static_cast<Dsp*>(p)->init(samplingFreq);
7171 }
7272
73 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
73 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
7474 {
7575 #define fslider0 (*fslider0_)
7676 double fSlow0 = (0.0010000000000000009 * fslider0);
8484 #undef fslider0
8585 }
8686
87 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *p)
87 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
8888 {
8989 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
9090 }
0 // generated from file '../src/faust/bass_enhancer.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.46 (http://faust.grame.fr)
2
3
4 namespace bass_enhancer {
5
6 class Dsp: public PluginDef {
7 private:
8 int fSamplingFreq;
9 FAUSTFLOAT fslider0;
10 int iConst0;
11 double fConst1;
12 double fConst2;
13 double fConst3;
14 double fVec0[2];
15 double fConst4;
16 double fRec4[2];
17 double fRec3[3];
18 double fRec2[3];
19 double fRec1[3];
20 double fRec0[3];
21 double fVec1[2];
22 double fVec2[2];
23 double fRec9[2];
24 double fRec8[3];
25 double fRec7[3];
26 double fRec6[3];
27 double fRec5[3];
28 FAUSTFLOAT fslider1;
29 double fRec10[2];
30 double fRec17[3];
31 double fRec16[3];
32 double fRec15[3];
33 double fRec14[3];
34 double fRec13[2];
35 double fRec12[2];
36 double fRec11[2];
37 double fRec22[2];
38 double fRec21[3];
39 double fRec20[3];
40 double fRec19[3];
41 double fRec18[3];
42 void clear_state_f();
43 int load_ui_f(const UiBuilder& b, int form);
44 void init(unsigned int samplingFreq);
45 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
46 int register_par(const ParamReg& reg);
47
48 static void clear_state_f_static(PluginDef*);
49 static int load_ui_f_static(const UiBuilder& b, int form);
50 static void init_static(unsigned int samplingFreq, PluginDef*);
51 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
52 static int register_params_static(const ParamReg& reg);
53 static void del_instance(PluginDef *p);
54 public:
55 Dsp();
56 ~Dsp();
57 };
58
59
60
61 Dsp::Dsp()
62 : PluginDef() {
63 version = PLUGINDEF_VERSION;
64 flags = 0;
65 id = "bassEnhancer";
66 name = N_("Bass Enhancer");
67 groups = 0;
68 description = ""; // description (tooltip)
69 category = N_("Misc"); // category
70 shortname = ""; // shortname
71 mono_audio = 0;
72 stereo_audio = compute_static;
73 set_samplerate = init_static;
74 activate_plugin = 0;
75 register_params = register_params_static;
76 load_ui = load_ui_f_static;
77 clear_state = clear_state_f_static;
78 delete_instance = del_instance;
79 }
80
81 Dsp::~Dsp() {
82 }
83
84 inline void Dsp::clear_state_f()
85 {
86 for (int i=0; i<2; i++) fVec0[i] = 0;
87 for (int i=0; i<2; i++) fRec4[i] = 0;
88 for (int i=0; i<3; i++) fRec3[i] = 0;
89 for (int i=0; i<3; i++) fRec2[i] = 0;
90 for (int i=0; i<3; i++) fRec1[i] = 0;
91 for (int i=0; i<3; i++) fRec0[i] = 0;
92 for (int i=0; i<2; i++) fVec1[i] = 0;
93 for (int i=0; i<2; i++) fVec2[i] = 0;
94 for (int i=0; i<2; i++) fRec9[i] = 0;
95 for (int i=0; i<3; i++) fRec8[i] = 0;
96 for (int i=0; i<3; i++) fRec7[i] = 0;
97 for (int i=0; i<3; i++) fRec6[i] = 0;
98 for (int i=0; i<3; i++) fRec5[i] = 0;
99 for (int i=0; i<2; i++) fRec10[i] = 0;
100 for (int i=0; i<3; i++) fRec17[i] = 0;
101 for (int i=0; i<3; i++) fRec16[i] = 0;
102 for (int i=0; i<3; i++) fRec15[i] = 0;
103 for (int i=0; i<3; i++) fRec14[i] = 0;
104 for (int i=0; i<2; i++) fRec13[i] = 0;
105 for (int i=0; i<2; i++) fRec12[i] = 0;
106 for (int i=0; i<2; i++) fRec11[i] = 0;
107 for (int i=0; i<2; i++) fRec22[i] = 0;
108 for (int i=0; i<3; i++) fRec21[i] = 0;
109 for (int i=0; i<3; i++) fRec20[i] = 0;
110 for (int i=0; i<3; i++) fRec19[i] = 0;
111 for (int i=0; i<3; i++) fRec18[i] = 0;
112 }
113
114 void Dsp::clear_state_f_static(PluginDef *p)
115 {
116 static_cast<Dsp*>(p)->clear_state_f();
117 }
118
119 inline void Dsp::init(unsigned int samplingFreq)
120 {
121 fSamplingFreq = samplingFreq;
122 iConst0 = min(192000, max(1, fSamplingFreq));
123 fConst1 = (3.141592653589793 / iConst0);
124 fConst2 = (62.83185307179586 / iConst0);
125 fConst3 = (1 - fConst2);
126 fConst4 = (1.0 / (1 + fConst2));
127 clear_state_f();
128 }
129
130 void Dsp::init_static(unsigned int samplingFreq, PluginDef *p)
131 {
132 static_cast<Dsp*>(p)->init(samplingFreq);
133 }
134
135 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
136 {
137 double fSlow0 = tan((fConst1 * fslider0));
138 double fSlow1 = (1.0 / faustpower<2>(fSlow0));
139 double fSlow2 = (2 * (1 - fSlow1));
140 double fSlow3 = (1.0 / fSlow0);
141 double fSlow4 = (1 + ((fSlow3 - 0.39018064403225594) / fSlow0));
142 double fSlow5 = (1.0 / (1 + ((0.39018064403225594 + fSlow3) / fSlow0)));
143 double fSlow6 = (1 + ((fSlow3 - 1.111140466039204) / fSlow0));
144 double fSlow7 = (1.0 / (1 + ((fSlow3 + 1.111140466039204) / fSlow0)));
145 double fSlow8 = (1 + ((fSlow3 - 1.66293922460509) / fSlow0));
146 double fSlow9 = (1.0 / (1 + ((fSlow3 + 1.66293922460509) / fSlow0)));
147 double fSlow10 = (1 + ((fSlow3 - 1.9615705608064609) / fSlow0));
148 double fSlow11 = (1.0 / (1 + ((fSlow3 + 1.9615705608064609) / fSlow0)));
149 double fSlow12 = (2 * (0 - fSlow1));
150 double fSlow13 = (0.0010000000000000009 * pow(10,(0.05 * fslider1)));
151 for (int i=0; i<count; i++) {
152 double fTemp0 = (double)input0[i];
153 fVec0[0] = fTemp0;
154 fRec4[0] = (fConst4 * ((fVec0[0] - fVec0[1]) + (fConst3 * fRec4[1])));
155 fRec3[0] = (fRec4[0] - (fSlow11 * ((fSlow10 * fRec3[2]) + (fSlow2 * fRec3[1]))));
156 fRec2[0] = ((fSlow11 * (((fSlow1 * fRec3[0]) + (fSlow12 * fRec3[1])) + (fSlow1 * fRec3[2]))) - (fSlow9 * ((fSlow8 * fRec2[2]) + (fSlow2 * fRec2[1]))));
157 fRec1[0] = ((fSlow9 * (((fSlow1 * fRec2[0]) + (fSlow12 * fRec2[1])) + (fSlow1 * fRec2[2]))) - (fSlow7 * ((fSlow6 * fRec1[2]) + (fSlow2 * fRec1[1]))));
158 fRec0[0] = ((fSlow7 * (((fSlow1 * fRec1[0]) + (fSlow12 * fRec1[1])) + (fSlow1 * fRec1[2]))) - (fSlow5 * ((fSlow4 * fRec0[2]) + (fSlow2 * fRec0[1]))));
159 double fTemp1 = (double)input1[i];
160 fVec1[0] = fTemp1;
161 double fTemp2 = (fVec0[0] + fVec1[0]);
162 fVec2[0] = fTemp2;
163 fRec9[0] = (fConst4 * ((fVec2[0] - fVec2[1]) + (fConst3 * fRec9[1])));
164 fRec8[0] = (fRec9[0] - (fSlow11 * ((fSlow10 * fRec8[2]) + (fSlow2 * fRec8[1]))));
165 fRec7[0] = ((fSlow11 * (fRec8[2] + (fRec8[0] + (2 * fRec8[1])))) - (fSlow9 * ((fSlow8 * fRec7[2]) + (fSlow2 * fRec7[1]))));
166 fRec6[0] = ((fSlow9 * (fRec7[2] + (fRec7[0] + (2 * fRec7[1])))) - (fSlow7 * ((fSlow6 * fRec6[2]) + (fSlow2 * fRec6[1]))));
167 fRec5[0] = ((fSlow7 * (fRec6[2] + (fRec6[0] + (2 * fRec6[1])))) - (fSlow5 * ((fSlow4 * fRec5[2]) + (fSlow2 * fRec5[1]))));
168 double fTemp3 = (fRec5[2] + (fRec5[0] + (2 * fRec5[1])));
169 fRec10[0] = (fSlow13 + (0.999 * fRec10[1]));
170 fRec17[0] = (fVec2[0] - (fSlow11 * ((fSlow10 * fRec17[2]) + (fSlow2 * fRec17[1]))));
171 fRec16[0] = ((fSlow11 * (fRec17[2] + (fRec17[0] + (2 * fRec17[1])))) - (fSlow9 * ((fSlow8 * fRec16[2]) + (fSlow2 * fRec16[1]))));
172 fRec15[0] = ((fSlow9 * (fRec16[2] + (fRec16[0] + (2 * fRec16[1])))) - (fSlow7 * ((fSlow6 * fRec15[2]) + (fSlow2 * fRec15[1]))));
173 fRec14[0] = ((fSlow7 * (fRec15[2] + (fRec15[0] + (2 * fRec15[1])))) - (fSlow5 * ((fSlow4 * fRec14[2]) + (fSlow2 * fRec14[1]))));
174 double fTemp4 = (fRec14[2] + (fRec14[0] + (2 * fRec14[1])));
175 double fTemp5 = (fSlow5 * fTemp4);
176 fRec13[0] = ((fSlow5 * (fTemp4 * ((0.015 * (fRec11[1] > fTemp5)) + (0.03 * (fRec11[1] <= fTemp5))))) + (fRec12[1] * (1 - ((0.015 * (fRec13[1] > fTemp5)) + (0.03 * (fRec13[1] <= fTemp5))))));
177 fRec12[0] = fRec13[0];
178 fRec11[0] = fRec12[0];
179 double fTemp6 = (fRec11[0] * fRec10[0]);
180 output0[i] = (FAUSTFLOAT)(fTemp6 + (fSlow5 * (fTemp3 + (((fSlow1 * fRec0[0]) + (fSlow12 * fRec0[1])) + (fSlow1 * fRec0[2])))));
181 fRec22[0] = (fConst4 * ((fVec1[0] - fVec1[1]) + (fConst3 * fRec22[1])));
182 fRec21[0] = (fRec22[0] - (fSlow11 * ((fSlow10 * fRec21[2]) + (fSlow2 * fRec21[1]))));
183 fRec20[0] = ((fSlow11 * (((fSlow1 * fRec21[0]) + (fSlow12 * fRec21[1])) + (fSlow1 * fRec21[2]))) - (fSlow9 * ((fSlow8 * fRec20[2]) + (fSlow2 * fRec20[1]))));
184 fRec19[0] = ((fSlow9 * (((fSlow1 * fRec20[0]) + (fSlow12 * fRec20[1])) + (fSlow1 * fRec20[2]))) - (fSlow7 * ((fSlow6 * fRec19[2]) + (fSlow2 * fRec19[1]))));
185 fRec18[0] = ((fSlow7 * (((fSlow1 * fRec19[0]) + (fSlow12 * fRec19[1])) + (fSlow1 * fRec19[2]))) - (fSlow5 * ((fSlow4 * fRec18[2]) + (fSlow2 * fRec18[1]))));
186 output1[i] = (FAUSTFLOAT)(fTemp6 + (fSlow5 * ((((fSlow1 * fRec18[0]) + (fSlow12 * fRec18[1])) + (fSlow1 * fRec18[2])) + fTemp3)));
187 // post processing
188 fRec18[2] = fRec18[1]; fRec18[1] = fRec18[0];
189 fRec19[2] = fRec19[1]; fRec19[1] = fRec19[0];
190 fRec20[2] = fRec20[1]; fRec20[1] = fRec20[0];
191 fRec21[2] = fRec21[1]; fRec21[1] = fRec21[0];
192 fRec22[1] = fRec22[0];
193 fRec11[1] = fRec11[0];
194 fRec12[1] = fRec12[0];
195 fRec13[1] = fRec13[0];
196 fRec14[2] = fRec14[1]; fRec14[1] = fRec14[0];
197 fRec15[2] = fRec15[1]; fRec15[1] = fRec15[0];
198 fRec16[2] = fRec16[1]; fRec16[1] = fRec16[0];
199 fRec17[2] = fRec17[1]; fRec17[1] = fRec17[0];
200 fRec10[1] = fRec10[0];
201 fRec5[2] = fRec5[1]; fRec5[1] = fRec5[0];
202 fRec6[2] = fRec6[1]; fRec6[1] = fRec6[0];
203 fRec7[2] = fRec7[1]; fRec7[1] = fRec7[0];
204 fRec8[2] = fRec8[1]; fRec8[1] = fRec8[0];
205 fRec9[1] = fRec9[0];
206 fVec2[1] = fVec2[0];
207 fVec1[1] = fVec1[0];
208 fRec0[2] = fRec0[1]; fRec0[1] = fRec0[0];
209 fRec1[2] = fRec1[1]; fRec1[1] = fRec1[0];
210 fRec2[2] = fRec2[1]; fRec2[1] = fRec2[0];
211 fRec3[2] = fRec3[1]; fRec3[1] = fRec3[0];
212 fRec4[1] = fRec4[0];
213 fVec0[1] = fVec0[0];
214 }
215 }
216
217 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
218 {
219 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
220 }
221
222 int Dsp::register_par(const ParamReg& reg)
223 {
224 reg.registerVar("bassEnhancer.Frequency","","S","",&fslider0, 1e+02, 6e+01, 2.4e+02, 5.0);
225 reg.registerVar("bassEnhancer.HarmonicsdB","","S","",&fslider1, 0.0, -16.0, 32.0, 0.1);
226 return 0;
227 }
228
229 int Dsp::register_params_static(const ParamReg& reg)
230 {
231 return static_cast<Dsp*>(reg.plugin)->register_par(reg);
232 }
233
234 inline int Dsp::load_ui_f(const UiBuilder& b, int form)
235 {
236 if (form & UI_FORM_STACK) {
237 #define PARAM(p) ("bassEnhancer" "." p)
238 // ----- bass enhancer
239 b.openHorizontalhideBox("");
240 b.closeBox();
241 b.openVerticalBox("");
242 {
243 b.openHorizontalTableBox("");
244 {
245 b.create_small_rackknob(PARAM("Frequency"), _(" frequency "));
246 b.create_small_rackknob(PARAM("HarmonicsdB"), _(" harmonics dB "));
247 }
248 b.closeBox();
249 }
250 b.closeBox();
251
252
253 #undef PARAM
254 return 0;
255 }
256 return -1;
257 }
258
259 int Dsp::load_ui_f_static(const UiBuilder& b, int form)
260 {
261 return static_cast<Dsp*>(b.plugin)->load_ui_f(b, form);
262 }
263 PluginDef *plugin() {
264 return new Dsp();
265 }
266
267 void Dsp::del_instance(PluginDef *p)
268 {
269 delete static_cast<Dsp*>(p);
270 }
271
272 } // end namespace bass_enhancer
1616 double fRec1[3];
1717 void clear_state_f();
1818 void init(unsigned int samplingFreq);
19 void compute(int count, float *input0, float *output0);
19 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2020 int register_par(const ParamReg& reg);
2121
2222 static void clear_state_f_static(PluginDef*);
2323 static void init_static(unsigned int samplingFreq, PluginDef*);
24 static void compute_static(int count, float *input0, float *output0, PluginDef*);
24 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2525 static int register_params_static(const ParamReg& reg);
2626 static void del_instance(PluginDef *p);
2727 public:
8686 static_cast<Dsp*>(p)->init(samplingFreq);
8787 }
8888
89 void always_inline Dsp::compute(int count, float *input0, float *output0)
89 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
9090 {
9191 double fSlow0 = (9.999999999998899e-05 * fslider0);
9292 for (int i=0; i<count; i++) {
102102 }
103103 }
104104
105 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
105 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
106106 {
107107 static_cast<Dsp*>(p)->compute(count, input0, output0);
108108 }
1212 void clear_state_f();
1313 int load_ui_f(const UiBuilder& b, int form);
1414 void init(unsigned int samplingFreq);
15 void compute(int count, float *input0, float *output0);
15 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1616 int register_par(const ParamReg& reg);
1717
1818 static void clear_state_f_static(PluginDef*);
1919 static int load_ui_f_static(const UiBuilder& b, int form);
2020 static void init_static(unsigned int samplingFreq, PluginDef*);
21 static void compute_static(int count, float *input0, float *output0, PluginDef*);
21 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2222 static int register_params_static(const ParamReg& reg);
2323 static void del_instance(PluginDef *p);
2424 public:
7373 static_cast<Dsp*>(p)->init(samplingFreq);
7474 }
7575
76 void always_inline Dsp::compute(int count, float *input0, float *output0)
76 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7777 {
7878 double fSlow0 = log((fConst0 * fslider0));
7979 double fSlow1 = (0 - (1.8442 * cos(exp((0.07238887 + (fSlow0 * (1.31282248 + (fSlow0 * (0.43359433 + (fSlow0 * (0.27547621 + (fSlow0 * (0.06446806 + (0.00506158 * fSlow0))))))))))))));
8585 }
8686 }
8787
88 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
88 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
8989 {
9090 static_cast<Dsp*>(p)->compute(count, input0, output0);
9191 }
3030 clear_state_f();
3131 }
3232
33 void always_inline Dsp::compute(int count, float *input0, float *output0)
33 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
3434 {
3535 #define fslider0 (*fslider0_)
3636 #define fslider1 (*fslider1_)
2727 public:
2828 void clear_state_f();
2929 void init(unsigned int samplingFreq);
30 void compute(int count, float *input0, float *output0);
30 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
3131 int register_par(const ParamReg& reg);
3232 Dsp();
3333 ~Dsp();
4646 int activate(bool start);
4747 int load_ui_f(const UiBuilder& b, int form);
4848 void init(unsigned int samplingFreq);
49 void compute(int count, float *input0, float *input1, float *output0, float *output1);
49 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
5050 int register_par(const ParamReg& reg);
5151
5252 static void clear_state_f_static(PluginDef*);
5353 static int activate_static(bool start, PluginDef*);
5454 static int load_ui_f_static(const UiBuilder& b, int form);
5555 static void init_static(unsigned int samplingFreq, PluginDef*);
56 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
56 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
5757 static int register_params_static(const ParamReg& reg);
5858 static void del_instance(PluginDef *p);
5959 public:
152152 return static_cast<Dsp*>(p)->activate(start);
153153 }
154154
155 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
155 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
156156 {
157157 float fSlow0 = (fConst1 * fslider0);
158158 float fSlow1 = fslider1;
188188 }
189189 }
190190
191 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *p)
191 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
192192 {
193193 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
194194 }
4343 int activate(bool start);
4444 int load_ui_f(const UiBuilder& b, int form);
4545 void init(unsigned int samplingFreq);
46 void compute(int count, float *input0, float *output0);
46 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
4747 int register_par(const ParamReg& reg);
4848
4949 static void clear_state_f_static(PluginDef*);
5050 static int activate_static(bool start, PluginDef*);
5151 static int load_ui_f_static(const UiBuilder& b, int form);
5252 static void init_static(unsigned int samplingFreq, PluginDef*);
53 static void compute_static(int count, float *input0, float *output0, PluginDef*);
53 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
5454 static int register_params_static(const ParamReg& reg);
5555 static void del_instance(PluginDef *p);
5656 public:
144144 return static_cast<Dsp*>(p)->activate(start);
145145 }
146146
147 void always_inline Dsp::compute(int count, float *input0, float *output0)
147 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
148148 {
149149 float fSlow0 = (0.01f * fslider0);
150150 float fSlow1 = (fSlow0 + (1 - fSlow0));
169169 }
170170 }
171171
172 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
172 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
173173 {
174174 static_cast<Dsp*>(p)->compute(count, input0, output0);
175175 }
2020 void clear_state_f();
2121 int load_ui_f(const UiBuilder& b, int form);
2222 void init(unsigned int samplingFreq);
23 void compute(int count, float *input0, float *output0);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2424 int register_par(const ParamReg& reg);
2525
2626 static void clear_state_f_static(PluginDef*);
2727 static int load_ui_f_static(const UiBuilder& b, int form);
2828 static void init_static(unsigned int samplingFreq, PluginDef*);
29 static void compute_static(int count, float *input0, float *output0, PluginDef*);
29 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
3030 static int register_params_static(const ParamReg& reg);
3131 static void del_instance(PluginDef *p);
3232 public:
8585 static_cast<Dsp*>(p)->init(samplingFreq);
8686 }
8787
88 void always_inline Dsp::compute(int count, float *input0, float *output0)
88 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8989 {
9090 double fSlow0 = fentry1;
9191 double fSlow1 = (fSlow0 - fentry0);
107107 }
108108 }
109109
110 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
110 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
111111 {
112112 static_cast<Dsp*>(p)->compute(count, input0, output0);
113113 }
2121 float fRec0[3];
2222 void clear_state_f();
2323 void init(unsigned int samplingFreq);
24 void compute(int count, float *input0, float *output0);
24 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2525 int register_par(const ParamReg& reg);
2626
2727 static void clear_state_f_static(PluginDef*);
2828 static void init_static(unsigned int samplingFreq, PluginDef*);
29 static void compute_static(int count, float *input0, float *output0, PluginDef*);
29 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
3030 static int register_params_static(const ParamReg& reg);
3131 static void del_instance(PluginDef *p);
3232 public:
8686 static_cast<Dsp*>(p)->init(samplingFreq);
8787 }
8888
89 void always_inline Dsp::compute(int count, float *input0, float *output0)
89 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
9090 {
9191 #define fslider0 (*fslider0_)
9292 #define fslider1 (*fslider1_)
118118 #undef fslider2
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
0 // generated from file '../src/faust/dattorros_progenitor.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.58 (http://faust.grame.fr)
2
3
4 namespace dattorros_progenitor {
5
6 class Dsp: public PluginDef {
7 private:
8 int fSamplingFreq;
9 class SIG0 {
10 private:
11 int fSamplingFreq;
12 int iRec18[2];
13 public:
14 int getNumInputs() { return 0; }
15 int getNumOutputs() { return 1; }
16 void init(int samplingFreq) {
17 fSamplingFreq = samplingFreq;
18 for (int i=0; i<2; i++) iRec18[i] = 0;
19 }
20 void fill (int count, double output[]) {
21 for (int i=0; i<count; i++) {
22 iRec18[0] = (1 + iRec18[1]);
23 output[i] = sin((9.587379924285257e-05 * double((iRec18[0] - 1))));
24 // post processing
25 iRec18[1] = iRec18[0];
26 }
27 }
28 };
29 FAUSTFLOAT fslider0;
30 FAUSTFLOAT fslider1;
31 FAUSTFLOAT fslider2;
32 FAUSTFLOAT fslider3;
33 FAUSTFLOAT fslider4;
34 FAUSTFLOAT fslider5;
35 int IOTA;
36 double fVec0[65536];
37 FAUSTFLOAT fslider6;
38 int iConst0;
39 double fConst1;
40 double fRec17[3];
41 double fVec1[1024];
42 int iConst2;
43 double fRec15[2];
44 double fVec2[1024];
45 int iConst3;
46 double fRec13[2];
47 double fVec3[4096];
48 int iConst4;
49 double fRec11[2];
50 double fVec4[2048];
51 int iConst5;
52 double fRec9[2];
53 double fVec5[8192];
54 static double ftbl0[65536];
55 double fConst6;
56 double fRec19[2];
57 FAUSTFLOAT fslider7;
58 int iConst7;
59 double fRec7[2];
60 double fRec8[32768];
61 int iConst8;
62 double fRec6[3];
63 FAUSTFLOAT fslider8;
64 double fVec6[16384];
65 int iConst9;
66 double fRec4[2];
67 double fRec5[32768];
68 int iConst10;
69 double fRec0[2];
70 double fVec7[8192];
71 int iConst11;
72 double fRec23[2];
73 double fRec24[32768];
74 int iConst12;
75 double fRec22[3];
76 double fVec8[32768];
77 int iConst13;
78 double fRec20[2];
79 double fRec21[32768];
80 int iConst14;
81 double fRec1[2];
82 FAUSTFLOAT fslider9;
83 void clear_state_f();
84 int load_ui_f(const UiBuilder& b, int form);
85 void init(unsigned int samplingFreq);
86 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
87 int register_par(const ParamReg& reg);
88
89 static void clear_state_f_static(PluginDef*);
90 static int load_ui_f_static(const UiBuilder& b, int form);
91 static void init_static(unsigned int samplingFreq, PluginDef*);
92 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
93 static int register_params_static(const ParamReg& reg);
94 static void del_instance(PluginDef *p);
95 public:
96 Dsp();
97 ~Dsp();
98 };
99
100
101 double Dsp::ftbl0[65536];
102
103 Dsp::Dsp()
104 : PluginDef() {
105 version = PLUGINDEF_VERSION;
106 flags = 0;
107 id = "dattorros_progenitor";
108 name = N_("Plate reverb");
109 groups = 0;
110 description = ""; // description (tooltip)
111 category = N_("Reverb"); // category
112 shortname = ""; // shortname
113 mono_audio = 0;
114 stereo_audio = compute_static;
115 set_samplerate = init_static;
116 activate_plugin = 0;
117 register_params = register_params_static;
118 load_ui = load_ui_f_static;
119 clear_state = clear_state_f_static;
120 delete_instance = del_instance;
121 }
122
123 Dsp::~Dsp() {
124 }
125
126 inline void Dsp::clear_state_f()
127 {
128 for (int i=0; i<65536; i++) fVec0[i] = 0;
129 for (int i=0; i<3; i++) fRec17[i] = 0;
130 for (int i=0; i<1024; i++) fVec1[i] = 0;
131 for (int i=0; i<2; i++) fRec15[i] = 0;
132 for (int i=0; i<1024; i++) fVec2[i] = 0;
133 for (int i=0; i<2; i++) fRec13[i] = 0;
134 for (int i=0; i<4096; i++) fVec3[i] = 0;
135 for (int i=0; i<2; i++) fRec11[i] = 0;
136 for (int i=0; i<2048; i++) fVec4[i] = 0;
137 for (int i=0; i<2; i++) fRec9[i] = 0;
138 for (int i=0; i<8192; i++) fVec5[i] = 0;
139 for (int i=0; i<2; i++) fRec19[i] = 0;
140 for (int i=0; i<2; i++) fRec7[i] = 0;
141 for (int i=0; i<32768; i++) fRec8[i] = 0;
142 for (int i=0; i<3; i++) fRec6[i] = 0;
143 for (int i=0; i<16384; i++) fVec6[i] = 0;
144 for (int i=0; i<2; i++) fRec4[i] = 0;
145 for (int i=0; i<32768; i++) fRec5[i] = 0;
146 for (int i=0; i<2; i++) fRec0[i] = 0;
147 for (int i=0; i<8192; i++) fVec7[i] = 0;
148 for (int i=0; i<2; i++) fRec23[i] = 0;
149 for (int i=0; i<32768; i++) fRec24[i] = 0;
150 for (int i=0; i<3; i++) fRec22[i] = 0;
151 for (int i=0; i<32768; i++) fVec8[i] = 0;
152 for (int i=0; i<2; i++) fRec20[i] = 0;
153 for (int i=0; i<32768; i++) fRec21[i] = 0;
154 for (int i=0; i<2; i++) fRec1[i] = 0;
155 }
156
157 void Dsp::clear_state_f_static(PluginDef *p)
158 {
159 static_cast<Dsp*>(p)->clear_state_f();
160 }
161
162 inline void Dsp::init(unsigned int samplingFreq)
163 {
164 SIG0 sig0;
165 sig0.init(samplingFreq);
166 sig0.fill(65536,ftbl0);
167 fSamplingFreq = samplingFreq;
168 IOTA = 0;
169 iConst0 = min(192000, max(1, fSamplingFreq));
170 fConst1 = (0.001 * iConst0);
171 iConst2 = int((0.004771345048889486 * iConst0));
172 iConst3 = int((0.0035953092974026412 * iConst0));
173 iConst4 = int((0.01273478713752898 * iConst0));
174 iConst5 = int((0.009307482947481604 * iConst0));
175 fConst6 = (1.0 / double(iConst0));
176 iConst7 = int((0.022042270085010585 * iConst0));
177 iConst8 = int((0.14962534861059776 * iConst0));
178 iConst9 = int((0.060481838647894894 * iConst0));
179 iConst10 = int((0.12499579987231611 * iConst0));
180 iConst11 = int((0.029972111152179026 * iConst0));
181 iConst12 = int((0.14169550754342933 * iConst0));
182 iConst13 = int((0.08924431302711602 * iConst0));
183 iConst14 = int((0.10628003091293975 * iConst0));
184 clear_state_f();
185 }
186
187 void Dsp::init_static(unsigned int samplingFreq, PluginDef *p)
188 {
189 static_cast<Dsp*>(p)->init(samplingFreq);
190 }
191
192 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
193 {
194 double fSlow0 = fslider0;
195 double fSlow1 = fslider1;
196 double fSlow2 = fslider2;
197 double fSlow3 = fslider3;
198 double fSlow4 = fslider4;
199 double fSlow5 = fslider5;
200 double fSlow6 = (1 - fSlow5);
201 double fSlow7 = (fConst1 * fslider6);
202 int iSlow8 = int(fSlow7);
203 int iSlow9 = int((iSlow8 & 65535));
204 int iSlow10 = (1 + iSlow8);
205 double fSlow11 = (iSlow10 - fSlow7);
206 int iSlow12 = int((int(iSlow10) & 65535));
207 double fSlow13 = (fSlow7 - iSlow8);
208 double fSlow14 = (0.5 * fSlow5);
209 double fSlow15 = (0.5 * fslider7);
210 double fSlow16 = (1 - fSlow1);
211 double fSlow17 = fslider8;
212 double fSlow18 = fslider9;
213 double fSlow19 = (1 - fSlow18);
214 for (int i=0; i<count; i++) {
215 double fTemp0 = (double)input1[i];
216 double fTemp1 = (double)input0[i];
217 double fTemp2 = (fTemp1 + fTemp0);
218 fVec0[IOTA&65535] = fTemp2;
219 fRec17[0] = ((fSlow14 * ((fSlow13 * fVec0[(IOTA-iSlow12)&65535]) + (fSlow11 * fVec0[(IOTA-iSlow9)&65535]))) + (fSlow6 * fRec17[2]));
220 fVec1[IOTA&1023] = (fRec17[0] + (fSlow4 * fRec15[1]));
221 fRec15[0] = fVec1[(IOTA-iConst2)&1023];
222 double fRec16 = (fRec15[1] - fRec17[0]);
223 fVec2[IOTA&1023] = (fRec16 + (fSlow4 * fRec13[1]));
224 fRec13[0] = fVec2[(IOTA-iConst3)&1023];
225 double fRec14 = (fRec13[1] - fRec16);
226 fVec3[IOTA&4095] = (fRec14 + (fSlow3 * fRec11[1]));
227 fRec11[0] = fVec3[(IOTA-iConst4)&4095];
228 double fRec12 = (fRec11[1] - fRec14);
229 fVec4[IOTA&2047] = (fRec12 + (fSlow3 * fRec9[1]));
230 fRec9[0] = fVec4[(IOTA-iConst5)&2047];
231 double fRec10 = (fRec9[1] - fRec12);
232 double fTemp3 = (0.3 * fRec10);
233 double fTemp4 = (fTemp3 + (0.5 * fRec1[1]));
234 double fTemp5 = (fTemp4 + (fSlow2 * fRec7[1]));
235 fVec5[IOTA&8191] = fTemp5;
236 double fTemp6 = (fConst6 + fRec19[1]);
237 fRec19[0] = (fTemp6 - floor(fTemp6));
238 double fTemp7 = (fSlow15 * (1 + ftbl0[int((65536.0 * fRec19[0]))]));
239 int iTemp8 = int(fTemp7);
240 int iTemp9 = int((iTemp8 & 16));
241 int iTemp10 = (1 + iTemp8);
242 double fTemp11 = (iTemp10 - fTemp7);
243 int iTemp12 = int((int(iTemp10) & 16));
244 double fTemp13 = (fTemp7 - iTemp8);
245 fRec7[0] = ((fTemp13 * fVec5[(IOTA-int((iConst7 + iTemp12)))&8191]) + (fTemp11 * fVec5[(IOTA-int((iConst7 + iTemp9)))&8191]));
246 fRec8[IOTA&32767] = (fRec7[1] - fTemp4);
247 fRec6[0] = ((fSlow16 * fRec8[(IOTA-iConst8)&32767]) + (fSlow1 * fRec6[2]));
248 double fTemp14 = (fSlow17 * fRec6[0]);
249 fVec6[IOTA&16383] = (fTemp14 + (fSlow0 * fRec4[1]));
250 fRec4[0] = fVec6[(IOTA-iConst9)&16383];
251 fRec5[IOTA&32767] = (fRec4[1] - fTemp14);
252 fRec0[0] = (fSlow17 * fRec5[(IOTA-iConst10)&32767]);
253 double fTemp15 = (fTemp3 + (0.5 * fRec0[1]));
254 double fTemp16 = (fTemp15 + (fSlow2 * fRec23[1]));
255 fVec7[IOTA&8191] = fTemp16;
256 fRec23[0] = ((fTemp13 * fVec7[(IOTA-int((iConst11 + iTemp12)))&8191]) + (fTemp11 * fVec7[(IOTA-int((iConst11 + iTemp9)))&8191]));
257 fRec24[IOTA&32767] = (fRec23[1] - fTemp15);
258 fRec22[0] = ((fSlow16 * fRec24[(IOTA-iConst12)&32767]) + (fSlow1 * fRec22[2]));
259 double fTemp17 = (fSlow17 * fRec22[0]);
260 fVec8[IOTA&32767] = (fTemp17 + (fSlow0 * fRec20[1]));
261 fRec20[0] = fVec8[(IOTA-iConst13)&32767];
262 fRec21[IOTA&32767] = (fRec20[1] - fTemp17);
263 fRec1[0] = (fSlow17 * fRec21[(IOTA-iConst14)&32767]);
264 double fRec2 = fRec8[(IOTA-0)&32767];
265 double fRec3 = fRec24[(IOTA-0)&32767];
266 output0[i] = (FAUSTFLOAT)((fSlow19 * fTemp1) + (fSlow18 * (fRec0[0] + fRec2)));
267 output1[i] = (FAUSTFLOAT)((fSlow19 * fTemp0) + (fSlow18 * (fRec1[0] + fRec3)));
268 // post processing
269 fRec1[1] = fRec1[0];
270 fRec20[1] = fRec20[0];
271 fRec22[2] = fRec22[1]; fRec22[1] = fRec22[0];
272 fRec23[1] = fRec23[0];
273 fRec0[1] = fRec0[0];
274 fRec4[1] = fRec4[0];
275 fRec6[2] = fRec6[1]; fRec6[1] = fRec6[0];
276 fRec7[1] = fRec7[0];
277 fRec19[1] = fRec19[0];
278 fRec9[1] = fRec9[0];
279 fRec11[1] = fRec11[0];
280 fRec13[1] = fRec13[0];
281 fRec15[1] = fRec15[0];
282 fRec17[2] = fRec17[1]; fRec17[1] = fRec17[0];
283 IOTA = IOTA+1;
284 }
285 }
286
287 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
288 {
289 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
290 }
291
292 int Dsp::register_par(const ParamReg& reg)
293 {
294 reg.registerVar("dattorros_progenitor.bandwidth","","S","",&fslider5, 0.9, 0.1, 0.95, 0.0005);
295 reg.registerVar("dattorros_progenitor.damping","","S","",&fslider1, 0.0005, 0.1, 0.95, 0.0005);
296 reg.registerVar("dattorros_progenitor.decay","","S","",&fslider8, 0.1, 0.0, 0.5, 0.01);
297 reg.registerVar("dattorros_progenitor.decay diff 1","","S","",&fslider2, 0.1, 0.0, 0.7, 0.01);
298 reg.registerVar("dattorros_progenitor.decay diff 2","","S","",&fslider0, 0.1, 0.0, 0.5, 0.01);
299 reg.registerVar("dattorros_progenitor.dry/wet","","S","",&fslider9, 0.5, 0.0, 1.0, 0.05);
300 reg.registerVar("dattorros_progenitor.excursion","","S","",&fslider7, 0.0, 0.0, 16.0, 0.5);
301 reg.registerVar("dattorros_progenitor.input diff 1","","S","",&fslider4, 0.1, 0.0, 0.75, 0.01);
302 reg.registerVar("dattorros_progenitor.input diff 2","","S","",&fslider3, 0.1, 0.0, 0.625, 0.01);
303 reg.registerVar("dattorros_progenitor.predelay ms","","S","",&fslider6, 0.0, 0.0, 2e+02, 1e+01);
304 return 0;
305 }
306
307 int Dsp::register_params_static(const ParamReg& reg)
308 {
309 return static_cast<Dsp*>(reg.plugin)->register_par(reg);
310 }
311
312 inline int Dsp::load_ui_f(const UiBuilder& b, int form)
313 {
314 if (form & UI_FORM_STACK) {
315 #define PARAM(p) ("dattorros_progenitor" "." p)
316 // dattorros progenitor (Plate reverb)
317
318 b.openHorizontalhideBox("");
319 b.create_master_slider(PARAM("dry/wet"), _("drt/wet"));
320 b.closeBox();
321
322 b.openHorizontalBox("");
323 b.openVerticalBox("");
324 b.openHorizontalBox("");
325 {
326 b.create_small_rackknob(PARAM("predelay ms"), _("predelay ms"));
327 b.create_small_rackknob(PARAM("bandwidth"), _(" bandwidth "));
328 b.create_small_rackknob(PARAM("input diff 1"), _(" in diff 1 "));
329 b.create_small_rackknob(PARAM("input diff 2"), _(" in diff 2 "));
330 b.create_small_rackknob(PARAM("excursion"), _(" excursion "));
331
332
333 }
334 b.closeBox();
335 b.openHorizontalBox("");
336 {
337 b.create_small_rackknob(PARAM("decay"), _(" decay "));
338 b.create_small_rackknob(PARAM("decay diff 1"), _("dec diff 1"));
339 b.create_small_rackknob(PARAM("decay diff 2"), _("dec diff 2"));
340 b.create_small_rackknob(PARAM("damping"), _("HF damping"));
341 b.create_small_rackknobr(PARAM("dry/wet"), _(" dry/wet "));
342 }
343 b.closeBox();
344 b.closeBox();
345 b.closeBox();
346
347 #undef PARAM
348 return 0;
349 }
350 return -1;
351 }
352
353 int Dsp::load_ui_f_static(const UiBuilder& b, int form)
354 {
355 return static_cast<Dsp*>(b.plugin)->load_ui_f(b, form);
356 }
357 PluginDef *plugin() {
358 return new Dsp();
359 }
360
361 void Dsp::del_instance(PluginDef *p)
362 {
363 delete static_cast<Dsp*>(p);
364 }
365
366 } // end namespace dattorros_progenitor
2626 int activate(bool start);
2727 int load_ui_f(const UiBuilder& b, int form);
2828 void init(unsigned int samplingFreq);
29 void compute(int count, float *input0, float *output0);
29 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
3030 int register_par(const ParamReg& reg);
3131
3232 static void clear_state_f_static(PluginDef*);
3333 static int activate_static(bool start, PluginDef*);
3434 static int load_ui_f_static(const UiBuilder& b, int form);
3535 static void init_static(unsigned int samplingFreq, PluginDef*);
36 static void compute_static(int count, float *input0, float *output0, PluginDef*);
36 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
3737 static int register_params_static(const ParamReg& reg);
3838 static void del_instance(PluginDef *p);
3939 public:
128128 return static_cast<Dsp*>(p)->activate(start);
129129 }
130130
131 void always_inline Dsp::compute(int count, float *input0, float *output0)
131 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
132132 {
133133 float fSlow0 = (fConst3 * fslider0);
134134 float fSlow1 = (0.0010000000000000009f * powf(10,(0.05f * fslider1)));
152152 }
153153 }
154154
155 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
155 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
156156 {
157157 static_cast<Dsp*>(p)->compute(count, input0, output0);
158158 }
88 private:
99 int fSamplingFreq;
1010 FAUSTFLOAT fslider0;
11 FAUSTFLOAT fslider1;
1211 int iConst0;
1312 float fConst1;
13 FAUSTFLOAT fslider1;
1414 FAUSTFLOAT fslider2;
15 FAUSTFLOAT fslider3;
1615 float fRec2[3];
1716 float fRec1[3];
1817 float fVec0[2];
9998 float fRec4[2];
10099 float fRec3[3];
101100 float fConst74;
102 FAUSTFLOAT fslider4;
101 FAUSTFLOAT fslider3;
103102 float fRec18[2];
104103 float fRec16[2];
105104 float fRec14[2];
108107 float fRec24[2];
109108 float fRec22[2];
110109 float fRec20[2];
110 FAUSTFLOAT fslider4;
111111 int IOTA;
112112 float *fVec2;
113113 float fConst75;
128128 int activate(bool start);
129129 int load_ui_f(const UiBuilder& b, int form);
130130 void init(unsigned int samplingFreq);
131 void compute(int count, float *input0, float *output0);
131 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
132132 int register_par(const ParamReg& reg);
133133
134134 static void clear_state_f_static(PluginDef*);
135135 static int activate_static(bool start, PluginDef*);
136136 static int load_ui_f_static(const UiBuilder& b, int form);
137137 static void init_static(unsigned int samplingFreq, PluginDef*);
138 static void compute_static(int count, float *input0, float *output0, PluginDef*);
138 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
139139 static int register_params_static(const ParamReg& reg);
140140 static void del_instance(PluginDef *p);
141141 public:
325325 return static_cast<Dsp*>(p)->activate(start);
326326 }
327327
328 void always_inline Dsp::compute(int count, float *input0, float *output0)
329 {
330 float fSlow0 = fslider0;
331 float fSlow1 = (0.01f * fSlow0);
332 float fSlow2 = (1 - fSlow1);
333 float fSlow3 = tanf((fConst1 * fslider1));
334 float fSlow4 = (2 * (1 - (1.0f / faustpower<2>(fSlow3))));
335 float fSlow5 = (1.0f / fSlow3);
336 float fSlow6 = (1 + ((fSlow5 - 1.414213562373095f) / fSlow3));
337 float fSlow7 = (1 + ((1.414213562373095f + fSlow5) / fSlow3));
338 float fSlow8 = (1.0f / fSlow7);
339 float fSlow9 = tanf((fConst1 * fslider2));
340 float fSlow10 = (1.0f / faustpower<2>(fSlow9));
341 float fSlow11 = (2 * (1 - fSlow10));
342 float fSlow12 = (1.0f / fSlow9);
343 float fSlow13 = (1 + ((fSlow12 - 1.414213562373095f) / fSlow9));
344 float fSlow14 = (1.0f / (1 + ((1.414213562373095f + fSlow12) / fSlow9)));
345 float fSlow15 = (0.01f * fslider3);
346 float fSlow16 = (2 * (0 - fSlow10));
347 float fSlow17 = (fConst50 / fSlow7);
348 float fSlow18 = fslider4;
349 int iSlow19 = int(min((float)2, max((float)0, fSlow18)));
350 int iSlow20 = int(min((float)2, max((float)0, (fSlow18 - 1))));
351 int iSlow21 = int(min((float)2, max((float)0, (fSlow18 - 2))));
352 float fSlow22 = min(524288.0f, B2N(fslider5, (float(iConst77) / fslider6)));
353 float fSlow23 = fslider7;
328 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
329 {
330 float fSlow0 = tanf((fConst1 * fslider0));
331 float fSlow1 = (2 * (1 - (1.0f / faustpower<2>(fSlow0))));
332 float fSlow2 = (1.0f / fSlow0);
333 float fSlow3 = (1 + ((fSlow2 - 1.414213562373095f) / fSlow0));
334 float fSlow4 = (1 + ((1.414213562373095f + fSlow2) / fSlow0));
335 float fSlow5 = (1.0f / fSlow4);
336 float fSlow6 = tanf((fConst1 * fslider1));
337 float fSlow7 = (1.0f / faustpower<2>(fSlow6));
338 float fSlow8 = (2 * (1 - fSlow7));
339 float fSlow9 = (1.0f / fSlow6);
340 float fSlow10 = (1 + ((fSlow9 - 1.414213562373095f) / fSlow6));
341 float fSlow11 = (1.0f / (1 + ((1.414213562373095f + fSlow9) / fSlow6)));
342 float fSlow12 = (0.01f * fslider2);
343 float fSlow13 = (2 * (0 - fSlow7));
344 float fSlow14 = (fConst50 / fSlow4);
345 float fSlow15 = fslider3;
346 int iSlow16 = int(min((float)2, max((float)0, fSlow15)));
347 int iSlow17 = int(min((float)2, max((float)0, (fSlow15 - 1))));
348 int iSlow18 = int(min((float)2, max((float)0, (fSlow15 - 2))));
349 float fSlow19 = (0.01f * fslider4);
350 float fSlow20 = min(524288.0f, B2N(fslider5, (float(iConst77) / fslider6)));
351 float fSlow21 = (0.01f * fslider7);
354352 for (int i=0; i<count; i++) {
355 float fTemp0 = (float)input0[i];
356 fRec2[0] = ((fSlow15 * fRec0[1]) - (fSlow14 * ((fSlow13 * fRec2[2]) + (fSlow11 * fRec2[1]))));
357 fRec1[0] = ((fSlow14 * (((fSlow10 * fRec2[0]) + (fSlow16 * fRec2[1])) + (fSlow10 * fRec2[2]))) - (fSlow8 * ((fSlow6 * fRec1[2]) + (fSlow4 * fRec1[1]))));
358 float fTemp1 = (fRec1[2] + (fRec1[0] + (2 * fRec1[1])));
359 float fTemp2 = (fSlow8 * fTemp1);
360 fVec0[0] = fTemp2;
361 float fTemp3 = (fConst11 * fRec5[1]);
362 float fTemp4 = (fConst20 * fRec6[1]);
363 float fTemp5 = (fConst27 * fRec7[1]);
364 float fTemp6 = (fConst34 * fRec8[1]);
365 float fTemp7 = (fConst41 * fRec9[1]);
366 fRec11[0] = ((fConst56 * ((fConst55 * fVec0[1]) + (fSlow17 * fTemp1))) + (fConst54 * fRec11[1]));
353 fRec2[0] = ((fSlow12 * fRec0[1]) - (fSlow11 * ((fSlow10 * fRec2[2]) + (fSlow8 * fRec2[1]))));
354 fRec1[0] = ((fSlow11 * (((fSlow7 * fRec2[0]) + (fSlow13 * fRec2[1])) + (fSlow7 * fRec2[2]))) - (fSlow5 * ((fSlow3 * fRec1[2]) + (fSlow1 * fRec1[1]))));
355 float fTemp0 = (fRec1[2] + (fRec1[0] + (2 * fRec1[1])));
356 float fTemp1 = (fSlow5 * fTemp0);
357 fVec0[0] = fTemp1;
358 float fTemp2 = (fConst11 * fRec5[1]);
359 float fTemp3 = (fConst20 * fRec6[1]);
360 float fTemp4 = (fConst27 * fRec7[1]);
361 float fTemp5 = (fConst34 * fRec8[1]);
362 float fTemp6 = (fConst41 * fRec9[1]);
363 fRec11[0] = ((fConst56 * ((fConst55 * fVec0[1]) + (fSlow14 * fTemp0))) + (fConst54 * fRec11[1]));
367364 fRec10[0] = (fRec11[0] - (fConst52 * ((fConst51 * fRec10[2]) + (fConst49 * fRec10[1]))));
368 fRec9[0] = ((fConst52 * (((fConst48 * fRec10[0]) + (fConst57 * fRec10[1])) + (fConst48 * fRec10[2]))) - (fConst46 * ((fConst45 * fRec9[2]) + fTemp7)));
369 fRec8[0] = ((fConst46 * ((fTemp7 + (fConst60 * fRec9[0])) + (fConst59 * fRec9[2]))) - (fConst39 * ((fConst38 * fRec8[2]) + fTemp6)));
370 fRec7[0] = ((fConst39 * ((fTemp6 + (fConst63 * fRec8[0])) + (fConst62 * fRec8[2]))) - (fConst32 * ((fConst31 * fRec7[2]) + fTemp5)));
371 fRec6[0] = ((fConst32 * ((fTemp5 + (fConst66 * fRec7[0])) + (fConst65 * fRec7[2]))) - (fConst25 * ((fConst24 * fRec6[2]) + fTemp4)));
372 fRec5[0] = ((fConst25 * ((fTemp4 + (fConst69 * fRec6[0])) + (fConst68 * fRec6[2]))) - (fConst18 * ((fConst16 * fRec5[2]) + fTemp3)));
373 float fTemp8 = ((fTemp3 + (fConst72 * fRec5[0])) + (fConst71 * fRec5[2]));
374 fVec1[0] = fTemp8;
365 fRec9[0] = ((fConst52 * (((fConst48 * fRec10[0]) + (fConst57 * fRec10[1])) + (fConst48 * fRec10[2]))) - (fConst46 * ((fConst45 * fRec9[2]) + fTemp6)));
366 fRec8[0] = ((fConst46 * ((fTemp6 + (fConst60 * fRec9[0])) + (fConst59 * fRec9[2]))) - (fConst39 * ((fConst38 * fRec8[2]) + fTemp5)));
367 fRec7[0] = ((fConst39 * ((fTemp5 + (fConst63 * fRec8[0])) + (fConst62 * fRec8[2]))) - (fConst32 * ((fConst31 * fRec7[2]) + fTemp4)));
368 fRec6[0] = ((fConst32 * ((fTemp4 + (fConst66 * fRec7[0])) + (fConst65 * fRec7[2]))) - (fConst25 * ((fConst24 * fRec6[2]) + fTemp3)));
369 fRec5[0] = ((fConst25 * ((fTemp3 + (fConst69 * fRec6[0])) + (fConst68 * fRec6[2]))) - (fConst18 * ((fConst16 * fRec5[2]) + fTemp2)));
370 float fTemp7 = ((fTemp2 + (fConst72 * fRec5[0])) + (fConst71 * fRec5[2]));
371 fVec1[0] = fTemp7;
375372 fRec4[0] = ((fConst73 * (fVec1[0] + fVec1[1])) + (fConst9 * fRec4[1]));
376373 fRec3[0] = (fRec4[0] - (fConst7 * ((fConst5 * fRec3[2]) + (fConst3 * fRec3[1]))));
377 float fTemp9 = ((iSlow19==0)? fVec0[0] : ((iSlow19==1)?(fConst74 * (fRec3[2] + (fRec3[0] + (2 * fRec3[1])))):fVec0[0]) );
378 float fTemp10 = (0.1f * fRec12[1]);
379 float fTemp11 = (fTemp10 + (0.4f * fRec16[1]));
380 float fTemp12 = (fTemp9 + (0.2f * fRec14[1]));
381 float fTemp13 = ((fTemp12 + (0.6f * fRec18[1])) - fTemp11);
382 fRec18[0] = fTemp13;
383 float fRec19 = (0 - (0.6f * fTemp13));
374 float fTemp8 = ((iSlow16==0)? fVec0[0] : ((iSlow16==1)?(fConst74 * (fRec3[2] + (fRec3[0] + (2 * fRec3[1])))):fVec0[0]) );
375 float fTemp9 = (0.1f * fRec12[1]);
376 float fTemp10 = (fTemp9 + (0.4f * fRec16[1]));
377 float fTemp11 = (fTemp8 + (0.2f * fRec14[1]));
378 float fTemp12 = ((fTemp11 + (0.6f * fRec18[1])) - fTemp10);
379 fRec18[0] = fTemp12;
380 float fRec19 = (0 - (0.6f * fTemp12));
384381 fRec16[0] = (fRec19 + fRec18[1]);
385 float fRec17 = (0.4f * (fTemp12 - fTemp11));
382 float fRec17 = (0.4f * (fTemp11 - fTemp10));
386383 fRec14[0] = (fRec17 + fRec16[1]);
387 float fRec15 = (0 - (0.2f * (fTemp12 - fTemp10)));
384 float fRec15 = (0 - (0.2f * (fTemp11 - fTemp9)));
388385 fRec12[0] = (fRec15 + fRec14[1]);
389 float fRec13 = (0.1f * (fTemp9 - fTemp10));
390 float fTemp14 = ((iSlow20==0)? fTemp9 : ((iSlow20==1)?(fRec13 + fRec12[1]):fTemp9) );
391 float fTemp15 = (0.5f * fRec20[1]);
392 float fTemp16 = (fTemp15 + (0.4f * fRec22[1]));
393 float fTemp17 = (fTemp14 + (0.3f * fRec24[1]));
394 float fTemp18 = ((fTemp17 + (0.2f * fRec26[1])) - fTemp16);
395 fRec26[0] = fTemp18;
396 float fRec27 = (0 - (0.2f * fTemp18));
386 float fRec13 = (0.1f * (fTemp8 - fTemp9));
387 float fTemp13 = ((iSlow17==0)? fTemp8 : ((iSlow17==1)?(fRec13 + fRec12[1]):fTemp8) );
388 float fTemp14 = (0.5f * fRec20[1]);
389 float fTemp15 = (fTemp14 + (0.4f * fRec22[1]));
390 float fTemp16 = (fTemp13 + (0.3f * fRec24[1]));
391 float fTemp17 = ((fTemp16 + (0.2f * fRec26[1])) - fTemp15);
392 fRec26[0] = fTemp17;
393 float fRec27 = (0 - (0.2f * fTemp17));
397394 fRec24[0] = (fRec27 + fRec26[1]);
398 float fRec25 = (0 - (0.3f * (fTemp17 - fTemp16)));
395 float fRec25 = (0 - (0.3f * (fTemp16 - fTemp15)));
399396 fRec22[0] = (fRec25 + fRec24[1]);
400 float fRec23 = (0.4f * (fTemp14 - fTemp16));
397 float fRec23 = (0.4f * (fTemp13 - fTemp15));
401398 fRec20[0] = (fRec23 + fRec22[1]);
402 float fRec21 = (0.5f * (fTemp14 - fTemp15));
403 float fTemp19 = ((iSlow21==0)? fTemp14 : ((iSlow21==1)?(fRec21 + fRec20[1]):fTemp14) );
404 float fTemp20 = ((fSlow1 * fTemp0) + fTemp19);
405 fVec2[IOTA&524287] = fTemp20;
406 float fTemp21 = ((int((fRec28[1] != 0.0f)))?((int(((fRec29[1] > 0.0f) & (fRec29[1] < 1.0f))))?fRec28[1]:0):((int(((fRec29[1] == 0.0f) & (fSlow22 != fRec30[1]))))?fConst75:((int(((fRec29[1] == 1.0f) & (fSlow22 != fRec31[1]))))?fConst76:0)));
407 fRec28[0] = fTemp21;
408 fRec29[0] = max(0.0f, min(1.0f, (fRec29[1] + fTemp21)));
409 fRec30[0] = ((int(((fRec29[1] >= 1.0f) & (fRec31[1] != fSlow22))))?fSlow22:fRec30[1]);
410 fRec31[0] = ((int(((fRec29[1] <= 0.0f) & (fRec30[1] != fSlow22))))?fSlow22:fRec31[1]);
411 fRec0[0] = (0.01f * ((fSlow23 * ((fRec29[0] * fVec2[(IOTA-int((int(fRec31[0]) & 524287)))&524287]) + ((1.0f - fRec29[0]) * fVec2[(IOTA-int((int(fRec30[0]) & 524287)))&524287]))) + ((fSlow0 * fTemp0) + (1e+02f * fTemp19))));
412 output0[i] = (FAUSTFLOAT)(fRec0[0] + (fSlow2 * fTemp0));
399 float fRec21 = (0.5f * (fTemp13 - fTemp14));
400 float fTemp18 = (float)input0[i];
401 float fTemp19 = ((fSlow19 * fTemp18) + ((iSlow18==0)? fTemp13 : ((iSlow18==1)?(fRec21 + fRec20[1]):fTemp13) ));
402 fVec2[IOTA&524287] = fTemp19;
403 float fTemp20 = ((int((fRec28[1] != 0.0f)))?((int(((fRec29[1] > 0.0f) & (fRec29[1] < 1.0f))))?fRec28[1]:0):((int(((fRec29[1] == 0.0f) & (fSlow20 != fRec30[1]))))?fConst75:((int(((fRec29[1] == 1.0f) & (fSlow20 != fRec31[1]))))?fConst76:0)));
404 fRec28[0] = fTemp20;
405 fRec29[0] = max(0.0f, min(1.0f, (fRec29[1] + fTemp20)));
406 fRec30[0] = ((int(((fRec29[1] >= 1.0f) & (fRec31[1] != fSlow20))))?fSlow20:fRec30[1]);
407 fRec31[0] = ((int(((fRec29[1] <= 0.0f) & (fRec30[1] != fSlow20))))?fSlow20:fRec31[1]);
408 fRec0[0] = (fSlow21 * ((fRec29[0] * fVec2[(IOTA-int((int(fRec31[0]) & 524287)))&524287]) + ((1.0f - fRec29[0]) * fVec2[(IOTA-int((int(fRec30[0]) & 524287)))&524287])));
409 output0[i] = (FAUSTFLOAT)(fTemp18 + fRec0[0]);
413410 // post processing
414411 fRec0[1] = fRec0[0];
415412 fRec31[1] = fRec31[0];
441438 }
442439 }
443440
444 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
441 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
445442 {
446443 static_cast<Dsp*>(p)->compute(count, input0, output0);
447444 }
449446 int Dsp::register_par(const ParamReg& reg)
450447 {
451448 reg.registerVar("dide.bpm",N_("delay (bpm)"),"S",N_("Delay in Beats per Minute"),&fslider6, 1.2e+02f, 24.0f, 3.6e+02f, 1.0f);
452 reg.registerVar("dide.feedback","","S",N_("percentage of the feedback level in the delay loop"),&fslider3, 5e+01f, 0.0f, 1e+02f, 1.0f);
453 reg.registerVar("dide.gain","","S",N_("overall gain of the delay line in percent"),&fslider0, 1e+02f, 0.0f, 1.2e+02f, 1.0f);
454 reg.registerVar("dide.highpass",N_("highpass (hz)"),"S",N_("highpass filter frequency in the feddback loop"),&fslider2, 1.2e+02f, 2e+01f, 2e+04f, 1.0f);
455 reg.registerVar("dide.howpass",N_("lowpass (hz)"),"S",N_("lowpass filter frequency in the feddback loop"),&fslider1, 1.2e+04f, 2e+01f, 2e+04f, 1.0f);
456 reg.registerVar("dide.level","","S",N_("percentage of the delay gain level"),&fslider7, 5e+01f, 0.0f, 1e+02f, 1.0f);
457 static const value_pair fslider4_values[] = {{"plain"},{"presence"},{"tape"},{"tape2"},{0}};
458 reg.registerEnumVar("dide.mode","","S","",fslider4_values,&fslider4, 0.0f, 0.0f, 3.0f, 1.0f);
449 reg.registerVar("dide.feedback","","S",N_("percentage of the feedback level in the delay loop"),&fslider2, 5e+01f, 1.0f, 1e+02f, 1.0f);
450 reg.registerVar("dide.gain","","S",N_("overall gain of the delay line in percent"),&fslider4, 1e+02f, 0.0f, 1.2e+02f, 1.0f);
451 reg.registerVar("dide.highpass",N_("highpass (hz)"),"S",N_("highpass filter frequency in the feddback loop"),&fslider1, 1.2e+02f, 2e+01f, 2e+04f, 1.0f);
452 reg.registerVar("dide.howpass",N_("lowpass (hz)"),"S",N_("lowpass filter frequency in the feddback loop"),&fslider0, 1.2e+04f, 2e+01f, 2e+04f, 1.0f);
453 reg.registerVar("dide.level","","S",N_("percentage of the delay gain level"),&fslider7, 5e+01f, 1.0f, 1e+02f, 1.0f);
454 static const value_pair fslider3_values[] = {{"plain"},{"presence"},{"tape"},{"tape2"},{0}};
455 reg.registerEnumVar("dide.mode","","S","",fslider3_values,&fslider3, 0.0f, 0.0f, 3.0f, 1.0f);
459456 static const value_pair fslider5_values[] = {{"Dotted 1/2 note"},{"1/2 note"},{"1/2 note triplets"},{" Dotted 1/4 note"},{"1/4 note"},{"1/4 note triplets"},{"Dotted 1/8 note"},{"1/8 note"},{"1/8 note triplets"},{" Dotted 1/16 note"},{"1/16 note"},{"1/16 note triplets"},{"Dotted 1/32 note"},{"1/32 note"},{"1/32 note triplets"},{" Dotted 1/64 note"},{"1/64 note"},{"1/64 note triplets"},{0}};
460457 reg.registerEnumVar("dide.notes",N_("tact"),"S",N_("note setting for bpm"),fslider5_values,&fslider5, 5.0f, 1.0f, 18.0f, 1.0f);
461458 return 0;
497494 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_TOP);
498495 b.create_small_rackknob(PARAM("highpass"), _("highpass(hz)"));
499496 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_TOP);
500 b.create_small_rackknob(PARAM("howpass"), _("howpass(hz)"));
497 b.create_small_rackknob(PARAM("howpass"), _("lowpass(hz)"));
501498 }
502499 b.closeBox();
503500 }
88 private:
99 int fSamplingFreq;
1010 FAUSTFLOAT fslider0;
11 FAUSTFLOAT fslider1;
1211 int iConst0;
1312 float fConst1;
13 FAUSTFLOAT fslider1;
1414 FAUSTFLOAT fslider2;
15 FAUSTFLOAT fslider3;
1615 float fRec2[3];
1716 float fRec1[3];
1817 float fVec0[2];
9998 float fRec4[2];
10099 float fRec3[3];
101100 float fConst74;
102 FAUSTFLOAT fslider4;
101 FAUSTFLOAT fslider3;
103102 float fRec18[2];
104103 float fRec16[2];
105104 float fRec14[2];
108107 float fRec24[2];
109108 float fRec22[2];
110109 float fRec20[2];
110 FAUSTFLOAT fslider4;
111111 int IOTA;
112112 float *fVec2;
113113 float fConst75;
151151 int activate(bool start);
152152 int load_ui_f(const UiBuilder& b, int form);
153153 void init(unsigned int samplingFreq);
154 void compute(int count, float *input0, float *input1, float *output0, float *output1);
154 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
155155 int register_par(const ParamReg& reg);
156156
157157 static void clear_state_f_static(PluginDef*);
158158 static int activate_static(bool start, PluginDef*);
159159 static int load_ui_f_static(const UiBuilder& b, int form);
160160 static void init_static(unsigned int samplingFreq, PluginDef*);
161 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
161 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
162162 static int register_params_static(const ParamReg& reg);
163163 static void del_instance(PluginDef *p);
164164 public:
374374 return static_cast<Dsp*>(p)->activate(start);
375375 }
376376
377 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
378 {
379 float fSlow0 = fslider0;
380 float fSlow1 = (0.01f * fSlow0);
381 float fSlow2 = (1 - fSlow1);
382 float fSlow3 = tanf((fConst1 * fslider1));
383 float fSlow4 = (2 * (1 - (1.0f / faustpower<2>(fSlow3))));
384 float fSlow5 = (1.0f / fSlow3);
385 float fSlow6 = (1 + ((fSlow5 - 1.414213562373095f) / fSlow3));
386 float fSlow7 = (1 + ((1.414213562373095f + fSlow5) / fSlow3));
387 float fSlow8 = (1.0f / fSlow7);
388 float fSlow9 = tanf((fConst1 * fslider2));
389 float fSlow10 = (1.0f / faustpower<2>(fSlow9));
390 float fSlow11 = (2 * (1 - fSlow10));
391 float fSlow12 = (1.0f / fSlow9);
392 float fSlow13 = (1 + ((fSlow12 - 1.414213562373095f) / fSlow9));
393 float fSlow14 = (1.0f / (1 + ((1.414213562373095f + fSlow12) / fSlow9)));
394 float fSlow15 = (0.01f * fslider3);
395 float fSlow16 = (2 * (0 - fSlow10));
396 float fSlow17 = (fConst50 / fSlow7);
397 float fSlow18 = fslider4;
398 int iSlow19 = int(min((float)2, max((float)0, fSlow18)));
399 int iSlow20 = int(min((float)2, max((float)0, (fSlow18 - 1))));
400 int iSlow21 = int(min((float)2, max((float)0, (fSlow18 - 2))));
401 float fSlow22 = min(524288.0f, B2N(fslider5, (float(iConst77) / fslider6)));
402 float fSlow23 = fslider7;
377 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
378 {
379 float fSlow0 = tanf((fConst1 * fslider0));
380 float fSlow1 = (2 * (1 - (1.0f / faustpower<2>(fSlow0))));
381 float fSlow2 = (1.0f / fSlow0);
382 float fSlow3 = (1 + ((fSlow2 - 1.414213562373095f) / fSlow0));
383 float fSlow4 = (1 + ((1.414213562373095f + fSlow2) / fSlow0));
384 float fSlow5 = (1.0f / fSlow4);
385 float fSlow6 = tanf((fConst1 * fslider1));
386 float fSlow7 = (1.0f / faustpower<2>(fSlow6));
387 float fSlow8 = (2 * (1 - fSlow7));
388 float fSlow9 = (1.0f / fSlow6);
389 float fSlow10 = (1 + ((fSlow9 - 1.414213562373095f) / fSlow6));
390 float fSlow11 = (1.0f / (1 + ((1.414213562373095f + fSlow9) / fSlow6)));
391 float fSlow12 = (0.01f * fslider2);
392 float fSlow13 = (2 * (0 - fSlow7));
393 float fSlow14 = (fConst50 / fSlow4);
394 float fSlow15 = fslider3;
395 int iSlow16 = int(min((float)2, max((float)0, fSlow15)));
396 int iSlow17 = int(min((float)2, max((float)0, (fSlow15 - 1))));
397 int iSlow18 = int(min((float)2, max((float)0, (fSlow15 - 2))));
398 float fSlow19 = (0.01f * fslider4);
399 float fSlow20 = min(524288.0f, B2N(fslider5, (float(iConst77) / fslider6)));
400 float fSlow21 = (0.01f * fslider7);
403401 for (int i=0; i<count; i++) {
404 float fTemp0 = (float)input0[i];
405 fRec2[0] = ((fSlow15 * fRec0[1]) - (fSlow14 * ((fSlow13 * fRec2[2]) + (fSlow11 * fRec2[1]))));
406 fRec1[0] = ((fSlow14 * (((fSlow10 * fRec2[0]) + (fSlow16 * fRec2[1])) + (fSlow10 * fRec2[2]))) - (fSlow8 * ((fSlow6 * fRec1[2]) + (fSlow4 * fRec1[1]))));
407 float fTemp1 = (fRec1[2] + (fRec1[0] + (2 * fRec1[1])));
408 float fTemp2 = (fSlow8 * fTemp1);
409 fVec0[0] = fTemp2;
410 float fTemp3 = (fConst11 * fRec5[1]);
411 float fTemp4 = (fConst20 * fRec6[1]);
412 float fTemp5 = (fConst27 * fRec7[1]);
413 float fTemp6 = (fConst34 * fRec8[1]);
414 float fTemp7 = (fConst41 * fRec9[1]);
415 fRec11[0] = ((fConst56 * ((fConst55 * fVec0[1]) + (fSlow17 * fTemp1))) + (fConst54 * fRec11[1]));
402 fRec2[0] = ((fSlow12 * fRec0[1]) - (fSlow11 * ((fSlow10 * fRec2[2]) + (fSlow8 * fRec2[1]))));
403 fRec1[0] = ((fSlow11 * (((fSlow7 * fRec2[0]) + (fSlow13 * fRec2[1])) + (fSlow7 * fRec2[2]))) - (fSlow5 * ((fSlow3 * fRec1[2]) + (fSlow1 * fRec1[1]))));
404 float fTemp0 = (fRec1[2] + (fRec1[0] + (2 * fRec1[1])));
405 float fTemp1 = (fSlow5 * fTemp0);
406 fVec0[0] = fTemp1;
407 float fTemp2 = (fConst11 * fRec5[1]);
408 float fTemp3 = (fConst20 * fRec6[1]);
409 float fTemp4 = (fConst27 * fRec7[1]);
410 float fTemp5 = (fConst34 * fRec8[1]);
411 float fTemp6 = (fConst41 * fRec9[1]);
412 fRec11[0] = ((fConst56 * ((fConst55 * fVec0[1]) + (fSlow14 * fTemp0))) + (fConst54 * fRec11[1]));
416413 fRec10[0] = (fRec11[0] - (fConst52 * ((fConst51 * fRec10[2]) + (fConst49 * fRec10[1]))));
417 fRec9[0] = ((fConst52 * (((fConst48 * fRec10[0]) + (fConst57 * fRec10[1])) + (fConst48 * fRec10[2]))) - (fConst46 * ((fConst45 * fRec9[2]) + fTemp7)));
418 fRec8[0] = ((fConst46 * ((fTemp7 + (fConst60 * fRec9[0])) + (fConst59 * fRec9[2]))) - (fConst39 * ((fConst38 * fRec8[2]) + fTemp6)));
419 fRec7[0] = ((fConst39 * ((fTemp6 + (fConst63 * fRec8[0])) + (fConst62 * fRec8[2]))) - (fConst32 * ((fConst31 * fRec7[2]) + fTemp5)));
420 fRec6[0] = ((fConst32 * ((fTemp5 + (fConst66 * fRec7[0])) + (fConst65 * fRec7[2]))) - (fConst25 * ((fConst24 * fRec6[2]) + fTemp4)));
421 fRec5[0] = ((fConst25 * ((fTemp4 + (fConst69 * fRec6[0])) + (fConst68 * fRec6[2]))) - (fConst18 * ((fConst16 * fRec5[2]) + fTemp3)));
422 float fTemp8 = ((fTemp3 + (fConst72 * fRec5[0])) + (fConst71 * fRec5[2]));
423 fVec1[0] = fTemp8;
414 fRec9[0] = ((fConst52 * (((fConst48 * fRec10[0]) + (fConst57 * fRec10[1])) + (fConst48 * fRec10[2]))) - (fConst46 * ((fConst45 * fRec9[2]) + fTemp6)));
415 fRec8[0] = ((fConst46 * ((fTemp6 + (fConst60 * fRec9[0])) + (fConst59 * fRec9[2]))) - (fConst39 * ((fConst38 * fRec8[2]) + fTemp5)));
416 fRec7[0] = ((fConst39 * ((fTemp5 + (fConst63 * fRec8[0])) + (fConst62 * fRec8[2]))) - (fConst32 * ((fConst31 * fRec7[2]) + fTemp4)));
417 fRec6[0] = ((fConst32 * ((fTemp4 + (fConst66 * fRec7[0])) + (fConst65 * fRec7[2]))) - (fConst25 * ((fConst24 * fRec6[2]) + fTemp3)));
418 fRec5[0] = ((fConst25 * ((fTemp3 + (fConst69 * fRec6[0])) + (fConst68 * fRec6[2]))) - (fConst18 * ((fConst16 * fRec5[2]) + fTemp2)));
419 float fTemp7 = ((fTemp2 + (fConst72 * fRec5[0])) + (fConst71 * fRec5[2]));
420 fVec1[0] = fTemp7;
424421 fRec4[0] = ((fConst73 * (fVec1[0] + fVec1[1])) + (fConst9 * fRec4[1]));
425422 fRec3[0] = (fRec4[0] - (fConst7 * ((fConst5 * fRec3[2]) + (fConst3 * fRec3[1]))));
426 float fTemp9 = ((iSlow19==0)? fVec0[0] : ((iSlow19==1)?(fConst74 * (fRec3[2] + (fRec3[0] + (2 * fRec3[1])))):fVec0[0]) );
427 float fTemp10 = (0.1f * fRec12[1]);
428 float fTemp11 = (fTemp10 + (0.4f * fRec16[1]));
429 float fTemp12 = (fTemp9 + (0.2f * fRec14[1]));
430 float fTemp13 = ((fTemp12 + (0.6f * fRec18[1])) - fTemp11);
431 fRec18[0] = fTemp13;
432 float fRec19 = (0 - (0.6f * fTemp13));
423 float fTemp8 = ((iSlow16==0)? fVec0[0] : ((iSlow16==1)?(fConst74 * (fRec3[2] + (fRec3[0] + (2 * fRec3[1])))):fVec0[0]) );
424 float fTemp9 = (0.1f * fRec12[1]);
425 float fTemp10 = (fTemp9 + (0.4f * fRec16[1]));
426 float fTemp11 = (fTemp8 + (0.2f * fRec14[1]));
427 float fTemp12 = ((fTemp11 + (0.6f * fRec18[1])) - fTemp10);
428 fRec18[0] = fTemp12;
429 float fRec19 = (0 - (0.6f * fTemp12));
433430 fRec16[0] = (fRec19 + fRec18[1]);
434 float fRec17 = (0.4f * (fTemp12 - fTemp11));
431 float fRec17 = (0.4f * (fTemp11 - fTemp10));
435432 fRec14[0] = (fRec17 + fRec16[1]);
436 float fRec15 = (0 - (0.2f * (fTemp12 - fTemp10)));
433 float fRec15 = (0 - (0.2f * (fTemp11 - fTemp9)));
437434 fRec12[0] = (fRec15 + fRec14[1]);
438 float fRec13 = (0.1f * (fTemp9 - fTemp10));
439 float fTemp14 = ((iSlow20==0)? fTemp9 : ((iSlow20==1)?(fRec13 + fRec12[1]):fTemp9) );
440 float fTemp15 = (0.5f * fRec20[1]);
441 float fTemp16 = (fTemp15 + (0.4f * fRec22[1]));
442 float fTemp17 = (fTemp14 + (0.3f * fRec24[1]));
443 float fTemp18 = ((fTemp17 + (0.2f * fRec26[1])) - fTemp16);
444 fRec26[0] = fTemp18;
445 float fRec27 = (0 - (0.2f * fTemp18));
435 float fRec13 = (0.1f * (fTemp8 - fTemp9));
436 float fTemp13 = ((iSlow17==0)? fTemp8 : ((iSlow17==1)?(fRec13 + fRec12[1]):fTemp8) );
437 float fTemp14 = (0.5f * fRec20[1]);
438 float fTemp15 = (fTemp14 + (0.4f * fRec22[1]));
439 float fTemp16 = (fTemp13 + (0.3f * fRec24[1]));
440 float fTemp17 = ((fTemp16 + (0.2f * fRec26[1])) - fTemp15);
441 fRec26[0] = fTemp17;
442 float fRec27 = (0 - (0.2f * fTemp17));
446443 fRec24[0] = (fRec27 + fRec26[1]);
447 float fRec25 = (0 - (0.3f * (fTemp17 - fTemp16)));
444 float fRec25 = (0 - (0.3f * (fTemp16 - fTemp15)));
448445 fRec22[0] = (fRec25 + fRec24[1]);
449 float fRec23 = (0.4f * (fTemp14 - fTemp16));
446 float fRec23 = (0.4f * (fTemp13 - fTemp15));
450447 fRec20[0] = (fRec23 + fRec22[1]);
451 float fRec21 = (0.5f * (fTemp14 - fTemp15));
452 float fTemp19 = ((iSlow21==0)? fTemp14 : ((iSlow21==1)?(fRec21 + fRec20[1]):fTemp14) );
453 float fTemp20 = ((fSlow1 * fTemp0) + fTemp19);
454 fVec2[IOTA&524287] = fTemp20;
455 float fTemp21 = ((int((fRec28[1] != 0.0f)))?((int(((fRec29[1] > 0.0f) & (fRec29[1] < 1.0f))))?fRec28[1]:0):((int(((fRec29[1] == 0.0f) & (fSlow22 != fRec30[1]))))?fConst75:((int(((fRec29[1] == 1.0f) & (fSlow22 != fRec31[1]))))?fConst76:0)));
456 fRec28[0] = fTemp21;
457 fRec29[0] = max(0.0f, min(1.0f, (fRec29[1] + fTemp21)));
458 fRec30[0] = ((int(((fRec29[1] >= 1.0f) & (fRec31[1] != fSlow22))))?fSlow22:fRec30[1]);
459 fRec31[0] = ((int(((fRec29[1] <= 0.0f) & (fRec30[1] != fSlow22))))?fSlow22:fRec31[1]);
460 int iTemp22 = int((int(fRec30[0]) & 524287));
461 float fTemp23 = (1.0f - fRec29[0]);
462 int iTemp24 = int((int(fRec31[0]) & 524287));
463 fRec0[0] = (0.01f * ((fSlow23 * ((fRec29[0] * fVec2[(IOTA-iTemp24)&524287]) + (fTemp23 * fVec2[(IOTA-iTemp22)&524287]))) + ((fSlow0 * fTemp0) + (1e+02f * fTemp19))));
464 output0[i] = (FAUSTFLOAT)(fRec0[0] + (fSlow2 * fTemp0));
465 float fTemp25 = (float)input1[i];
466 fRec34[0] = ((fSlow15 * fRec32[1]) - (fSlow14 * ((fSlow13 * fRec34[2]) + (fSlow11 * fRec34[1]))));
467 fRec33[0] = ((fSlow14 * (((fSlow10 * fRec34[0]) + (fSlow16 * fRec34[1])) + (fSlow10 * fRec34[2]))) - (fSlow8 * ((fSlow6 * fRec33[2]) + (fSlow4 * fRec33[1]))));
468 float fTemp26 = (fRec33[2] + (fRec33[0] + (2 * fRec33[1])));
469 float fTemp27 = (fSlow8 * fTemp26);
470 fVec3[0] = fTemp27;
471 float fTemp28 = (fConst11 * fRec37[1]);
472 float fTemp29 = (fConst20 * fRec38[1]);
473 float fTemp30 = (fConst27 * fRec39[1]);
474 float fTemp31 = (fConst34 * fRec40[1]);
475 float fTemp32 = (fConst41 * fRec41[1]);
476 fRec43[0] = ((fConst56 * ((fConst55 * fVec3[1]) + (fSlow17 * fTemp26))) + (fConst54 * fRec43[1]));
448 float fRec21 = (0.5f * (fTemp13 - fTemp14));
449 float fTemp18 = (float)input0[i];
450 float fTemp19 = ((fSlow19 * fTemp18) + ((iSlow18==0)? fTemp13 : ((iSlow18==1)?(fRec21 + fRec20[1]):fTemp13) ));
451 fVec2[IOTA&524287] = fTemp19;
452 float fTemp20 = ((int((fRec28[1] != 0.0f)))?((int(((fRec29[1] > 0.0f) & (fRec29[1] < 1.0f))))?fRec28[1]:0):((int(((fRec29[1] == 0.0f) & (fSlow20 != fRec30[1]))))?fConst75:((int(((fRec29[1] == 1.0f) & (fSlow20 != fRec31[1]))))?fConst76:0)));
453 fRec28[0] = fTemp20;
454 fRec29[0] = max(0.0f, min(1.0f, (fRec29[1] + fTemp20)));
455 fRec30[0] = ((int(((fRec29[1] >= 1.0f) & (fRec31[1] != fSlow20))))?fSlow20:fRec30[1]);
456 fRec31[0] = ((int(((fRec29[1] <= 0.0f) & (fRec30[1] != fSlow20))))?fSlow20:fRec31[1]);
457 int iTemp21 = int((int(fRec30[0]) & 524287));
458 float fTemp22 = (1.0f - fRec29[0]);
459 int iTemp23 = int((int(fRec31[0]) & 524287));
460 fRec0[0] = (fSlow21 * ((fRec29[0] * fVec2[(IOTA-iTemp23)&524287]) + (fTemp22 * fVec2[(IOTA-iTemp21)&524287])));
461 output0[i] = (FAUSTFLOAT)(fTemp18 + fRec0[0]);
462 fRec34[0] = ((fSlow12 * fRec32[1]) - (fSlow11 * ((fSlow10 * fRec34[2]) + (fSlow8 * fRec34[1]))));
463 fRec33[0] = ((fSlow11 * (((fSlow7 * fRec34[0]) + (fSlow13 * fRec34[1])) + (fSlow7 * fRec34[2]))) - (fSlow5 * ((fSlow3 * fRec33[2]) + (fSlow1 * fRec33[1]))));
464 float fTemp24 = (fRec33[2] + (fRec33[0] + (2 * fRec33[1])));
465 float fTemp25 = (fSlow5 * fTemp24);
466 fVec3[0] = fTemp25;
467 float fTemp26 = (fConst11 * fRec37[1]);
468 float fTemp27 = (fConst20 * fRec38[1]);
469 float fTemp28 = (fConst27 * fRec39[1]);
470 float fTemp29 = (fConst34 * fRec40[1]);
471 float fTemp30 = (fConst41 * fRec41[1]);
472 fRec43[0] = ((fConst56 * ((fConst55 * fVec3[1]) + (fSlow14 * fTemp24))) + (fConst54 * fRec43[1]));
477473 fRec42[0] = (fRec43[0] - (fConst52 * ((fConst51 * fRec42[2]) + (fConst49 * fRec42[1]))));
478 fRec41[0] = ((fConst52 * (((fConst48 * fRec42[0]) + (fConst57 * fRec42[1])) + (fConst48 * fRec42[2]))) - (fConst46 * ((fConst45 * fRec41[2]) + fTemp32)));
479 fRec40[0] = ((fConst46 * ((fTemp32 + (fConst60 * fRec41[0])) + (fConst59 * fRec41[2]))) - (fConst39 * ((fConst38 * fRec40[2]) + fTemp31)));
480 fRec39[0] = ((fConst39 * ((fTemp31 + (fConst63 * fRec40[0])) + (fConst62 * fRec40[2]))) - (fConst32 * ((fConst31 * fRec39[2]) + fTemp30)));
481 fRec38[0] = ((fConst32 * ((fTemp30 + (fConst66 * fRec39[0])) + (fConst65 * fRec39[2]))) - (fConst25 * ((fConst24 * fRec38[2]) + fTemp29)));
482 fRec37[0] = ((fConst25 * ((fTemp29 + (fConst69 * fRec38[0])) + (fConst68 * fRec38[2]))) - (fConst18 * ((fConst16 * fRec37[2]) + fTemp28)));
483 float fTemp33 = ((fTemp28 + (fConst72 * fRec37[0])) + (fConst71 * fRec37[2]));
484 fVec4[0] = fTemp33;
474 fRec41[0] = ((fConst52 * (((fConst48 * fRec42[0]) + (fConst57 * fRec42[1])) + (fConst48 * fRec42[2]))) - (fConst46 * ((fConst45 * fRec41[2]) + fTemp30)));
475 fRec40[0] = ((fConst46 * ((fTemp30 + (fConst60 * fRec41[0])) + (fConst59 * fRec41[2]))) - (fConst39 * ((fConst38 * fRec40[2]) + fTemp29)));
476 fRec39[0] = ((fConst39 * ((fTemp29 + (fConst63 * fRec40[0])) + (fConst62 * fRec40[2]))) - (fConst32 * ((fConst31 * fRec39[2]) + fTemp28)));
477 fRec38[0] = ((fConst32 * ((fTemp28 + (fConst66 * fRec39[0])) + (fConst65 * fRec39[2]))) - (fConst25 * ((fConst24 * fRec38[2]) + fTemp27)));
478 fRec37[0] = ((fConst25 * ((fTemp27 + (fConst69 * fRec38[0])) + (fConst68 * fRec38[2]))) - (fConst18 * ((fConst16 * fRec37[2]) + fTemp26)));
479 float fTemp31 = ((fTemp26 + (fConst72 * fRec37[0])) + (fConst71 * fRec37[2]));
480 fVec4[0] = fTemp31;
485481 fRec36[0] = ((fConst73 * (fVec4[0] + fVec4[1])) + (fConst9 * fRec36[1]));
486482 fRec35[0] = (fRec36[0] - (fConst7 * ((fConst5 * fRec35[2]) + (fConst3 * fRec35[1]))));
487 float fTemp34 = ((iSlow19==0)? fVec3[0] : ((iSlow19==1)?(fConst74 * (fRec35[2] + (fRec35[0] + (2 * fRec35[1])))):fVec3[0]) );
488 float fTemp35 = (0.1f * fRec44[1]);
489 float fTemp36 = (fTemp35 + (0.4f * fRec48[1]));
490 float fTemp37 = (fTemp34 + (0.2f * fRec46[1]));
491 float fTemp38 = ((fTemp37 + (0.6f * fRec50[1])) - fTemp36);
492 fRec50[0] = fTemp38;
493 float fRec51 = (0 - (0.6f * fTemp38));
483 float fTemp32 = ((iSlow16==0)? fVec3[0] : ((iSlow16==1)?(fConst74 * (fRec35[2] + (fRec35[0] + (2 * fRec35[1])))):fVec3[0]) );
484 float fTemp33 = (0.1f * fRec44[1]);
485 float fTemp34 = (fTemp33 + (0.4f * fRec48[1]));
486 float fTemp35 = (fTemp32 + (0.2f * fRec46[1]));
487 float fTemp36 = ((fTemp35 + (0.6f * fRec50[1])) - fTemp34);
488 fRec50[0] = fTemp36;
489 float fRec51 = (0 - (0.6f * fTemp36));
494490 fRec48[0] = (fRec51 + fRec50[1]);
495 float fRec49 = (0.4f * (fTemp37 - fTemp36));
491 float fRec49 = (0.4f * (fTemp35 - fTemp34));
496492 fRec46[0] = (fRec49 + fRec48[1]);
497 float fRec47 = (0 - (0.2f * (fTemp37 - fTemp35)));
493 float fRec47 = (0 - (0.2f * (fTemp35 - fTemp33)));
498494 fRec44[0] = (fRec47 + fRec46[1]);
499 float fRec45 = (0.1f * (fTemp34 - fTemp35));
500 float fTemp39 = ((iSlow20==0)? fTemp34 : ((iSlow20==1)?(fRec45 + fRec44[1]):fTemp34) );
501 float fTemp40 = (0.5f * fRec52[1]);
502 float fTemp41 = (fTemp40 + (0.4f * fRec54[1]));
503 float fTemp42 = (fTemp39 + (0.3f * fRec56[1]));
504 float fTemp43 = ((fTemp42 + (0.2f * fRec58[1])) - fTemp41);
505 fRec58[0] = fTemp43;
506 float fRec59 = (0 - (0.2f * fTemp43));
495 float fRec45 = (0.1f * (fTemp32 - fTemp33));
496 float fTemp37 = ((iSlow17==0)? fTemp32 : ((iSlow17==1)?(fRec45 + fRec44[1]):fTemp32) );
497 float fTemp38 = (0.5f * fRec52[1]);
498 float fTemp39 = (fTemp38 + (0.4f * fRec54[1]));
499 float fTemp40 = (fTemp37 + (0.3f * fRec56[1]));
500 float fTemp41 = ((fTemp40 + (0.2f * fRec58[1])) - fTemp39);
501 fRec58[0] = fTemp41;
502 float fRec59 = (0 - (0.2f * fTemp41));
507503 fRec56[0] = (fRec59 + fRec58[1]);
508 float fRec57 = (0 - (0.3f * (fTemp42 - fTemp41)));
504 float fRec57 = (0 - (0.3f * (fTemp40 - fTemp39)));
509505 fRec54[0] = (fRec57 + fRec56[1]);
510 float fRec55 = (0.4f * (fTemp39 - fTemp41));
506 float fRec55 = (0.4f * (fTemp37 - fTemp39));
511507 fRec52[0] = (fRec55 + fRec54[1]);
512 float fRec53 = (0.5f * (fTemp39 - fTemp40));
513 float fTemp44 = ((iSlow21==0)? fTemp39 : ((iSlow21==1)?(fRec53 + fRec52[1]):fTemp39) );
514 float fTemp45 = ((fSlow1 * fTemp25) + fTemp44);
515 fVec5[IOTA&524287] = fTemp45;
516 fRec32[0] = (0.01f * ((fSlow23 * ((fRec29[0] * fVec5[(IOTA-iTemp24)&524287]) + (fTemp23 * fVec5[(IOTA-iTemp22)&524287]))) + ((fSlow0 * fTemp25) + (1e+02f * fTemp44))));
517 output1[i] = (FAUSTFLOAT)(fRec32[0] + (fSlow2 * fTemp25));
508 float fRec53 = (0.5f * (fTemp37 - fTemp38));
509 float fTemp42 = (float)input1[i];
510 float fTemp43 = ((fSlow19 * fTemp42) + ((iSlow18==0)? fTemp37 : ((iSlow18==1)?(fRec53 + fRec52[1]):fTemp37) ));
511 fVec5[IOTA&524287] = fTemp43;
512 fRec32[0] = (fSlow21 * ((fRec29[0] * fVec5[(IOTA-iTemp23)&524287]) + (fTemp22 * fVec5[(IOTA-iTemp21)&524287])));
513 output1[i] = (FAUSTFLOAT)(fTemp42 + fRec32[0]);
518514 // post processing
519515 fRec32[1] = fRec32[0];
520516 fRec52[1] = fRec52[0];
568564 }
569565 }
570566
571 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *p)
567 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
572568 {
573569 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
574570 }
576572 int Dsp::register_par(const ParamReg& reg)
577573 {
578574 reg.registerVar("didest.bpm",N_("delay (bpm)"),"S",N_("Delay in Beats per Minute"),&fslider6, 1.2e+02f, 24.0f, 3.6e+02f, 1.0f);
579 reg.registerVar("didest.feedback","","S",N_("percentage of the feedback level in the delay loop"),&fslider3, 5e+01f, 0.0f, 1e+02f, 1.0f);
580 reg.registerVar("didest.gain","","S",N_("overall gain of the delay line in percent"),&fslider0, 1e+02f, 0.0f, 1.2e+02f, 1.0f);
581 reg.registerVar("didest.highpass",N_("highpass (hz)"),"S",N_("highpass filter frequency in the feddback loop"),&fslider2, 1.2e+02f, 2e+01f, 2e+04f, 1.0f);
582 reg.registerVar("didest.howpass",N_("lowpass (hz)"),"S",N_("lowpass filter frequency in the feddback loop"),&fslider1, 1.2e+04f, 2e+01f, 2e+04f, 1.0f);
583 reg.registerVar("didest.level","","S",N_("percentage of the delay gain level"),&fslider7, 5e+01f, 0.0f, 1e+02f, 1.0f);
584 static const value_pair fslider4_values[] = {{"plain"},{"presence"},{"tape"},{"tape2"},{0}};
585 reg.registerEnumVar("didest.mode","","S","",fslider4_values,&fslider4, 0.0f, 0.0f, 3.0f, 1.0f);
575 reg.registerVar("didest.feedback","","S",N_("percentage of the feedback level in the delay loop"),&fslider2, 5e+01f, 1.0f, 1e+02f, 1.0f);
576 reg.registerVar("didest.gain","","S",N_("overall gain of the delay line in percent"),&fslider4, 1e+02f, 0.0f, 1.2e+02f, 1.0f);
577 reg.registerVar("didest.highpass",N_("highpass (hz)"),"S",N_("highpass filter frequency in the feddback loop"),&fslider1, 1.2e+02f, 2e+01f, 2e+04f, 1.0f);
578 reg.registerVar("didest.howpass",N_("lowpass (hz)"),"S",N_("lowpass filter frequency in the feddback loop"),&fslider0, 1.2e+04f, 2e+01f, 2e+04f, 1.0f);
579 reg.registerVar("didest.level","","S",N_("percentage of the delay gain level"),&fslider7, 5e+01f, 1.0f, 1e+02f, 1.0f);
580 static const value_pair fslider3_values[] = {{"plain"},{"presence"},{"tape"},{"tape2"},{0}};
581 reg.registerEnumVar("didest.mode","","S","",fslider3_values,&fslider3, 0.0f, 0.0f, 3.0f, 1.0f);
586582 static const value_pair fslider5_values[] = {{"Dotted 1/2 note"},{"1/2 note"},{"1/2 note triplets"},{" Dotted 1/4 note"},{"1/4 note"},{"1/4 note triplets"},{"Dotted 1/8 note"},{"1/8 note"},{"1/8 note triplets"},{" Dotted 1/16 note"},{"1/16 note"},{"1/16 note triplets"},{"Dotted 1/32 note"},{"1/32 note"},{"1/32 note triplets"},{" Dotted 1/64 note"},{"1/64 note"},{"1/64 note triplets"},{0}};
587583 reg.registerEnumVar("didest.notes",N_("tact"),"S",N_("note setting for bpm"),fslider5_values,&fslider5, 5.0f, 1.0f, 18.0f, 1.0f);
588584 return 0;
624620 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_TOP);
625621 b.create_small_rackknob(PARAM("highpass"), _("highpass (hz)"));
626622 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_TOP);
627 b.create_small_rackknob(PARAM("howpass"), _("howpass (hz)"));
623 b.create_small_rackknob(PARAM("howpass"), _("lowpass (hz)"));
628624 }
629625 b.closeBox();
630626 }
0 // generated from file '../src/faust/duck_delay.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.46 (http://faust.grame.fr)
2
3
4 namespace duck_delay {
5
6 class Dsp: public PluginDef {
7 private:
8 int fSamplingFreq;
9 int iConst0;
10 double fConst1;
11 FAUSTFLOAT fslider0;
12 double fConst2;
13 FAUSTFLOAT fslider1;
14 double fRec2[2];
15 double fRec1[2];
16 FAUSTFLOAT fslider2;
17 double fConst3;
18 double fRec0[2];
19 FAUSTFLOAT fslider3;
20 int IOTA;
21 double fVec0[524288];
22 FAUSTFLOAT fslider4;
23 double fRec4[2];
24 double fConst4;
25 double fRec3[2];
26 void clear_state_f();
27 int load_ui_f(const UiBuilder& b, int form);
28 void init(unsigned int samplingFreq);
29 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
30 int register_par(const ParamReg& reg);
31
32 static void clear_state_f_static(PluginDef*);
33 static int load_ui_f_static(const UiBuilder& b, int form);
34 static void init_static(unsigned int samplingFreq, PluginDef*);
35 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
36 static int register_params_static(const ParamReg& reg);
37 static void del_instance(PluginDef *p);
38 public:
39 Dsp();
40 ~Dsp();
41 };
42
43
44
45 Dsp::Dsp()
46 : PluginDef() {
47 version = PLUGINDEF_VERSION;
48 flags = 0;
49 id = "duckDelay";
50 name = N_("Duck Delay");
51 groups = 0;
52 description = ""; // description (tooltip)
53 category = N_("Echo / Delay"); // category
54 shortname = ""; // shortname
55 mono_audio = compute_static;
56 stereo_audio = 0;
57 set_samplerate = init_static;
58 activate_plugin = 0;
59 register_params = register_params_static;
60 load_ui = load_ui_f_static;
61 clear_state = clear_state_f_static;
62 delete_instance = del_instance;
63 }
64
65 Dsp::~Dsp() {
66 }
67
68 inline void Dsp::clear_state_f()
69 {
70 for (int i=0; i<2; i++) fRec2[i] = 0;
71 for (int i=0; i<2; i++) fRec1[i] = 0;
72 for (int i=0; i<2; i++) fRec0[i] = 0;
73 for (int i=0; i<524288; i++) fVec0[i] = 0;
74 for (int i=0; i<2; i++) fRec4[i] = 0;
75 for (int i=0; i<2; i++) fRec3[i] = 0;
76 }
77
78 void Dsp::clear_state_f_static(PluginDef *p)
79 {
80 static_cast<Dsp*>(p)->clear_state_f();
81 }
82
83 inline void Dsp::init(unsigned int samplingFreq)
84 {
85 fSamplingFreq = samplingFreq;
86 iConst0 = min(192000, max(1, fSamplingFreq));
87 fConst1 = exp((0 - (1e+01 / iConst0)));
88 fConst2 = (1.0 / iConst0);
89 fConst3 = (1.0 - fConst1);
90 IOTA = 0;
91 fConst4 = (0.001 * iConst0);
92 clear_state_f();
93 }
94
95 void Dsp::init_static(unsigned int samplingFreq, PluginDef *p)
96 {
97 static_cast<Dsp*>(p)->init(samplingFreq);
98 }
99
100 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
101 {
102 double fSlow0 = exp((0 - (fConst2 / fslider0)));
103 double fSlow1 = exp((0 - (fConst2 / fslider1)));
104 double fSlow2 = (1.0 - fSlow1);
105 double fSlow3 = (1.0 - fSlow0);
106 double fSlow4 = pow(10,(0.05 * fslider2));
107 double fSlow5 = fslider3;
108 double fSlow6 = (fConst3 * fslider4);
109 for (int i=0; i<count; i++) {
110 double fTemp0 = (double)input0[i];
111 double fTemp1 = fabs(fTemp0);
112 fRec2[0] = ((fSlow2 * fTemp1) + (fSlow1 * max(fTemp1, fRec2[1])));
113 fRec1[0] = ((fSlow3 * fRec2[0]) + (fSlow0 * fRec1[1]));
114 fRec0[0] = ((fConst3 * (1 - ((fSlow4 * fRec1[0]) > 1))) + (fConst1 * fRec0[1]));
115 double fTemp2 = (fTemp0 + (fSlow5 * fRec3[1]));
116 fVec0[IOTA&524287] = fTemp2;
117 fRec4[0] = (fSlow6 + (fConst1 * fRec4[1]));
118 double fTemp3 = (fConst4 * fRec4[0]);
119 int iTemp4 = int(fTemp3);
120 int iTemp5 = (1 + iTemp4);
121 fRec3[0] = (((fTemp3 - iTemp4) * fVec0[(IOTA-int((int(iTemp5) & 393215)))&524287]) + ((iTemp5 - fTemp3) * fVec0[(IOTA-int((iTemp4 & 393215)))&524287]));
122 output0[i] = (FAUSTFLOAT)(fTemp0 + (fRec3[0] * fRec0[0]));
123 // post processing
124 fRec3[1] = fRec3[0];
125 fRec4[1] = fRec4[0];
126 IOTA = IOTA+1;
127 fRec0[1] = fRec0[0];
128 fRec1[1] = fRec1[0];
129 fRec2[1] = fRec2[0];
130 }
131 }
132
133 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
134 {
135 static_cast<Dsp*>(p)->compute(count, input0, output0);
136 }
137
138 int Dsp::register_par(const ParamReg& reg)
139 {
140 reg.registerVar("duckDelay.amount","","S","",&fslider2, 0.5, 0.0, 56.0, 0.05);
141 reg.registerVar("duckDelay.attack","","S","",&fslider0, 0.1, 0.05, 0.5, 0.05);
142 reg.registerVar("duckDelay.feedback","","S","",&fslider3, 0.0, 0.0, 1.0, 0.05);
143 reg.registerVar("duckDelay.relese","","S","",&fslider1, 0.1, 0.05, 2.0, 0.05);
144 reg.registerVar("duckDelay.time","","S","",&fslider4, 5e+02, 1.0, 2e+03, 1.0);
145 return 0;
146 }
147
148 int Dsp::register_params_static(const ParamReg& reg)
149 {
150 return static_cast<Dsp*>(reg.plugin)->register_par(reg);
151 }
152
153 inline int Dsp::load_ui_f(const UiBuilder& b, int form)
154 {
155 if (form & UI_FORM_STACK) {
156 #define PARAM(p) ("duckDelay" "." p)
157 // ----- ducking delay
158 b.openHorizontalhideBox("");
159 b.closeBox();
160 b.openVerticalBox("");
161 {
162 b.openHorizontalTableBox("");
163 {
164 b.create_small_rackknob(PARAM("time"), _(" time ms "));
165 b.create_small_rackknob(PARAM("feedback"), _(" feedback "));
166 b.create_small_rackknob(PARAM("attack"), _(" attack s "));
167 b.create_small_rackknob(PARAM("relese"), _(" release s "));
168 b.create_small_rackknob(PARAM("amount"), _(" amount dB "));
169 }
170 b.closeBox();
171 }
172 b.closeBox();
173
174
175 #undef PARAM
176 return 0;
177 }
178 return -1;
179 }
180
181 int Dsp::load_ui_f_static(const UiBuilder& b, int form)
182 {
183 return static_cast<Dsp*>(b.plugin)->load_ui_f(b, form);
184 }
185 PluginDef *plugin() {
186 return new Dsp();
187 }
188
189 void Dsp::del_instance(PluginDef *p)
190 {
191 delete static_cast<Dsp*>(p);
192 }
193
194 } // end namespace duck_delay
0 // generated from file '../src/faust/duck_delay_st.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.46 (http://faust.grame.fr)
2
3
4 namespace duck_delay_st {
5
6 class Dsp: public PluginDef {
7 private:
8 int fSamplingFreq;
9 FAUSTFLOAT fslider0;
10 FAUSTFLOAT fslider1;
11 int IOTA;
12 double fVec0[524288];
13 int iConst0;
14 double fConst1;
15 FAUSTFLOAT fslider2;
16 double fConst2;
17 double fRec3[2];
18 double fConst3;
19 double fRec2[2];
20 double fRec0[2];
21 double fVec1[524288];
22 double fRec4[2];
23 double fRec1[2];
24 double fConst4;
25 double fConst5;
26 double fConst6;
27 double fConst7;
28 double fConst8;
29 double fConst9;
30 double fConst10;
31 double fConst11;
32 double fConst12;
33 double fConst13;
34 double fConst14;
35 double fConst15;
36 double fRec7[2];
37 double fRec6[3];
38 double fConst16;
39 double fRec5[3];
40 FAUSTFLOAT fslider3;
41 double fConst17;
42 double fConst18;
43 double fConst19;
44 double fConst20;
45 double fConst21;
46 double fConst22;
47 double fConst23;
48 double fConst24;
49 double fConst25;
50 double fConst26;
51 double fRec10[2];
52 double fRec9[3];
53 double fRec8[3];
54 FAUSTFLOAT fslider4;
55 double fRec11[2];
56 FAUSTFLOAT fslider5;
57 double fConst27;
58 FAUSTFLOAT fslider6;
59 double fRec14[2];
60 double fRec13[2];
61 FAUSTFLOAT fslider7;
62 double fRec12[2];
63 double fRec17[2];
64 double fRec16[3];
65 double fRec15[3];
66 double fRec20[2];
67 double fRec19[3];
68 double fRec18[3];
69 double fRec23[2];
70 double fRec22[2];
71 double fRec21[2];
72 void clear_state_f();
73 int load_ui_f(const UiBuilder& b, int form);
74 void init(unsigned int samplingFreq);
75 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
76 int register_par(const ParamReg& reg);
77
78 static void clear_state_f_static(PluginDef*);
79 static int load_ui_f_static(const UiBuilder& b, int form);
80 static void init_static(unsigned int samplingFreq, PluginDef*);
81 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
82 static int register_params_static(const ParamReg& reg);
83 static void del_instance(PluginDef *p);
84 public:
85 Dsp();
86 ~Dsp();
87 };
88
89
90
91 Dsp::Dsp()
92 : PluginDef() {
93 version = PLUGINDEF_VERSION;
94 flags = 0;
95 id = "duckDelaySt";
96 name = N_("Duck Delay St");
97 groups = 0;
98 description = ""; // description (tooltip)
99 category = N_("Echo / Delay"); // category
100 shortname = ""; // shortname
101 mono_audio = 0;
102 stereo_audio = compute_static;
103 set_samplerate = init_static;
104 activate_plugin = 0;
105 register_params = register_params_static;
106 load_ui = load_ui_f_static;
107 clear_state = clear_state_f_static;
108 delete_instance = del_instance;
109 }
110
111 Dsp::~Dsp() {
112 }
113
114 inline void Dsp::clear_state_f()
115 {
116 for (int i=0; i<524288; i++) fVec0[i] = 0;
117 for (int i=0; i<2; i++) fRec3[i] = 0;
118 for (int i=0; i<2; i++) fRec2[i] = 0;
119 for (int i=0; i<2; i++) fRec0[i] = 0;
120 for (int i=0; i<524288; i++) fVec1[i] = 0;
121 for (int i=0; i<2; i++) fRec4[i] = 0;
122 for (int i=0; i<2; i++) fRec1[i] = 0;
123 for (int i=0; i<2; i++) fRec7[i] = 0;
124 for (int i=0; i<3; i++) fRec6[i] = 0;
125 for (int i=0; i<3; i++) fRec5[i] = 0;
126 for (int i=0; i<2; i++) fRec10[i] = 0;
127 for (int i=0; i<3; i++) fRec9[i] = 0;
128 for (int i=0; i<3; i++) fRec8[i] = 0;
129 for (int i=0; i<2; i++) fRec11[i] = 0;
130 for (int i=0; i<2; i++) fRec14[i] = 0;
131 for (int i=0; i<2; i++) fRec13[i] = 0;
132 for (int i=0; i<2; i++) fRec12[i] = 0;
133 for (int i=0; i<2; i++) fRec17[i] = 0;
134 for (int i=0; i<3; i++) fRec16[i] = 0;
135 for (int i=0; i<3; i++) fRec15[i] = 0;
136 for (int i=0; i<2; i++) fRec20[i] = 0;
137 for (int i=0; i<3; i++) fRec19[i] = 0;
138 for (int i=0; i<3; i++) fRec18[i] = 0;
139 for (int i=0; i<2; i++) fRec23[i] = 0;
140 for (int i=0; i<2; i++) fRec22[i] = 0;
141 for (int i=0; i<2; i++) fRec21[i] = 0;
142 }
143
144 void Dsp::clear_state_f_static(PluginDef *p)
145 {
146 static_cast<Dsp*>(p)->clear_state_f();
147 }
148
149 inline void Dsp::init(unsigned int samplingFreq)
150 {
151 fSamplingFreq = samplingFreq;
152 IOTA = 0;
153 iConst0 = min(192000, max(1, fSamplingFreq));
154 fConst1 = exp((0 - (1e+01 / iConst0)));
155 fConst2 = (1.0 - fConst1);
156 fConst3 = (0.001 * iConst0);
157 fConst4 = tan((2764.601535159018 / iConst0));
158 fConst5 = (1.0 / faustpower<2>(fConst4));
159 fConst6 = (2 * (1 - fConst5));
160 fConst7 = (1.0 / fConst4);
161 fConst8 = (1 + ((fConst7 - 0.6180339887498947) / fConst4));
162 fConst9 = (1.0 / (1 + ((0.6180339887498947 + fConst7) / fConst4)));
163 fConst10 = (1 + ((fConst7 - 1.6180339887498947) / fConst4));
164 fConst11 = (1.0 / (1 + ((1.6180339887498947 + fConst7) / fConst4)));
165 fConst12 = (1 + fConst7);
166 fConst13 = (0 - ((1 - fConst7) / fConst12));
167 fConst14 = (0 - fConst7);
168 fConst15 = (1.0 / fConst12);
169 fConst16 = (2 * (0 - fConst5));
170 fConst17 = tan((1382.300767579509 / iConst0));
171 fConst18 = (2 * (1 - (1.0 / faustpower<2>(fConst17))));
172 fConst19 = (1.0 / fConst17);
173 fConst20 = (1 + ((fConst19 - 0.6180339887498947) / fConst17));
174 fConst21 = (1.0 / (1 + ((0.6180339887498947 + fConst19) / fConst17)));
175 fConst22 = (1 + ((fConst19 - 1.6180339887498947) / fConst17));
176 fConst23 = (1.0 / (1 + ((fConst19 + 1.6180339887498947) / fConst17)));
177 fConst24 = (1 + fConst19);
178 fConst25 = (0 - ((1 - fConst19) / fConst24));
179 fConst26 = (1.0 / fConst24);
180 fConst27 = (1.0 / iConst0);
181 clear_state_f();
182 }
183
184 void Dsp::init_static(unsigned int samplingFreq, PluginDef *p)
185 {
186 static_cast<Dsp*>(p)->init(samplingFreq);
187 }
188
189 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
190 {
191 double fSlow0 = fslider0;
192 double fSlow1 = (1 - fSlow0);
193 double fSlow2 = fslider1;
194 double fSlow3 = (fConst2 * fslider2);
195 double fSlow4 = (1 - (fSlow0 * fSlow2));
196 double fSlow5 = fslider3;
197 double fSlow6 = (fConst9 * (pow(10,(0.6 * fSlow5)) - 1));
198 double fSlow7 = (fConst21 * (pow(10,(0.6 * (1 - fSlow5))) - 1));
199 double fSlow8 = (0.0010000000000000009 * pow(10,(0.05 * fslider4)));
200 double fSlow9 = exp((0 - (fConst27 / fslider5)));
201 double fSlow10 = exp((0 - (fConst27 / fslider6)));
202 double fSlow11 = (1.0 - fSlow10);
203 double fSlow12 = (1.0 - fSlow9);
204 double fSlow13 = pow(10,(0.05 * fslider7));
205 for (int i=0; i<count; i++) {
206 double fTemp0 = (double)input0[i];
207 double fTemp1 = (fTemp0 + (fSlow2 * ((fSlow0 * fRec1[1]) + (fSlow1 * fRec2[1]))));
208 fVec0[IOTA&524287] = fTemp1;
209 fRec3[0] = (fSlow3 + (fConst1 * fRec3[1]));
210 double fTemp2 = (fConst3 * fRec3[0]);
211 int iTemp3 = int(fTemp2);
212 int iTemp4 = int((iTemp3 & 393215));
213 int iTemp5 = (1 + iTemp3);
214 double fTemp6 = (iTemp5 - fTemp2);
215 int iTemp7 = int((int(iTemp5) & 393215));
216 double fTemp8 = (fTemp2 - iTemp3);
217 fRec2[0] = ((fTemp8 * fVec0[(IOTA-iTemp7)&524287]) + (fTemp6 * fVec0[(IOTA-iTemp4)&524287]));
218 fRec0[0] = fRec2[0];
219 double fTemp9 = (double)input1[i];
220 double fTemp10 = ((fSlow4 * fTemp9) + (fSlow2 * ((fSlow0 * fRec0[1]) + (fSlow1 * fRec4[1]))));
221 fVec1[IOTA&524287] = fTemp10;
222 fRec4[0] = ((fTemp8 * fVec1[(IOTA-iTemp7)&524287]) + (fTemp6 * fVec1[(IOTA-iTemp4)&524287]));
223 fRec1[0] = fRec4[0];
224 fRec7[0] = ((fConst15 * ((fConst14 * fRec0[1]) + (fConst7 * fRec0[0]))) + (fConst13 * fRec7[1]));
225 fRec6[0] = (fRec7[0] - (fConst11 * ((fConst10 * fRec6[2]) + (fConst6 * fRec6[1]))));
226 fRec5[0] = ((fConst11 * (((fConst5 * fRec6[0]) + (fConst16 * fRec6[1])) + (fConst5 * fRec6[2]))) - (fConst9 * ((fConst8 * fRec5[2]) + (fConst6 * fRec5[1]))));
227 fRec10[0] = ((fConst26 * (fRec0[0] + fRec0[1])) + (fConst25 * fRec10[1]));
228 fRec9[0] = (fRec10[0] - (fConst23 * ((fConst22 * fRec9[2]) + (fConst18 * fRec9[1]))));
229 fRec8[0] = ((fConst23 * (fRec9[2] + (fRec9[0] + (2 * fRec9[1])))) - (fConst21 * ((fConst20 * fRec8[2]) + (fConst18 * fRec8[1]))));
230 fRec11[0] = (fSlow8 + (0.999 * fRec11[1]));
231 double fTemp11 = fabs(fTemp0);
232 fRec14[0] = ((fSlow11 * fTemp11) + (fSlow10 * max(fTemp11, fRec14[1])));
233 fRec13[0] = ((fSlow12 * fRec14[0]) + (fSlow9 * fRec13[1]));
234 fRec12[0] = ((fConst2 * (1 - ((fSlow13 * fRec13[0]) > 1))) + (fConst1 * fRec12[1]));
235 output0[i] = (FAUSTFLOAT)(fTemp0 + (0.1778279410038923 * ((fRec12[0] * fRec11[0]) * ((fSlow7 * (fRec8[2] + (fRec8[0] + (2 * fRec8[1])))) + ((fSlow6 * (((fConst5 * fRec5[0]) + (fConst16 * fRec5[1])) + (fConst5 * fRec5[2]))) + (2 * fRec0[0]))))));
236 fRec17[0] = ((fConst15 * ((fConst14 * fRec1[1]) + (fConst7 * fRec1[0]))) + (fConst13 * fRec17[1]));
237 fRec16[0] = (fRec17[0] - (fConst11 * ((fConst10 * fRec16[2]) + (fConst6 * fRec16[1]))));
238 fRec15[0] = ((fConst11 * (((fConst5 * fRec16[0]) + (fConst16 * fRec16[1])) + (fConst5 * fRec16[2]))) - (fConst9 * ((fConst8 * fRec15[2]) + (fConst6 * fRec15[1]))));
239 fRec20[0] = ((fConst26 * (fRec1[0] + fRec1[1])) + (fConst25 * fRec20[1]));
240 fRec19[0] = (fRec20[0] - (fConst23 * ((fConst22 * fRec19[2]) + (fConst18 * fRec19[1]))));
241 fRec18[0] = ((fConst23 * (fRec19[2] + (fRec19[0] + (2 * fRec19[1])))) - (fConst21 * ((fConst20 * fRec18[2]) + (fConst18 * fRec18[1]))));
242 double fTemp12 = fabs(fTemp9);
243 fRec23[0] = ((fSlow11 * fTemp12) + (fSlow10 * max(fTemp12, fRec23[1])));
244 fRec22[0] = ((fSlow12 * fRec23[0]) + (fSlow9 * fRec22[1]));
245 fRec21[0] = ((fConst2 * (1 - ((fSlow13 * fRec22[0]) > 1))) + (fConst1 * fRec21[1]));
246 output1[i] = (FAUSTFLOAT)(fTemp9 + (0.1778279410038923 * ((fRec11[0] * fRec21[0]) * ((fSlow7 * (fRec18[2] + (fRec18[0] + (2 * fRec18[1])))) + ((fSlow6 * (((fConst5 * fRec15[0]) + (fConst16 * fRec15[1])) + (fConst5 * fRec15[2]))) + (2 * fRec1[0]))))));
247 // post processing
248 fRec21[1] = fRec21[0];
249 fRec22[1] = fRec22[0];
250 fRec23[1] = fRec23[0];
251 fRec18[2] = fRec18[1]; fRec18[1] = fRec18[0];
252 fRec19[2] = fRec19[1]; fRec19[1] = fRec19[0];
253 fRec20[1] = fRec20[0];
254 fRec15[2] = fRec15[1]; fRec15[1] = fRec15[0];
255 fRec16[2] = fRec16[1]; fRec16[1] = fRec16[0];
256 fRec17[1] = fRec17[0];
257 fRec12[1] = fRec12[0];
258 fRec13[1] = fRec13[0];
259 fRec14[1] = fRec14[0];
260 fRec11[1] = fRec11[0];
261 fRec8[2] = fRec8[1]; fRec8[1] = fRec8[0];
262 fRec9[2] = fRec9[1]; fRec9[1] = fRec9[0];
263 fRec10[1] = fRec10[0];
264 fRec5[2] = fRec5[1]; fRec5[1] = fRec5[0];
265 fRec6[2] = fRec6[1]; fRec6[1] = fRec6[0];
266 fRec7[1] = fRec7[0];
267 fRec1[1] = fRec1[0];
268 fRec4[1] = fRec4[0];
269 fRec0[1] = fRec0[0];
270 fRec2[1] = fRec2[0];
271 fRec3[1] = fRec3[0];
272 IOTA = IOTA+1;
273 }
274 }
275
276 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
277 {
278 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
279 }
280
281 int Dsp::register_par(const ParamReg& reg)
282 {
283 reg.registerVar("duckDelaySt.amount","","S","",&fslider7, 0.5, 0.0, 56.0, 0.05);
284 reg.registerVar("duckDelaySt.attack","","S","",&fslider5, 0.1, 0.05, 0.5, 0.05);
285 reg.registerVar("duckDelaySt.coloration","","S","",&fslider3, 0.0, -1.0, 1.0, 0.05);
286 reg.registerVar("duckDelaySt.effect","","S","",&fslider4, 0.0, -16.0, 4.0, 0.1);
287 reg.registerVar("duckDelaySt.feedback","","S","",&fslider1, 0.0, 0.0, 1.0, 0.05);
288 reg.registerVar("duckDelaySt.pingpong","","S","",&fslider0, 0.0, 0.0, 1.0, 0.05);
289 reg.registerVar("duckDelaySt.release","","S","",&fslider6, 0.1, 0.05, 2.0, 0.05);
290 reg.registerVar("duckDelaySt.time","","S","",&fslider2, 5e+02, 1.0, 2e+03, 1.0);
291 return 0;
292 }
293
294 int Dsp::register_params_static(const ParamReg& reg)
295 {
296 return static_cast<Dsp*>(reg.plugin)->register_par(reg);
297 }
298
299 inline int Dsp::load_ui_f(const UiBuilder& b, int form)
300 {
301 if (form & UI_FORM_STACK) {
302 #define PARAM(p) ("duckDelaySt" "." p)
303 // ducking delay stereo
304
305 b.openHorizontalhideBox("");
306 b.create_master_slider(PARAM("effect"), _("effect"));
307 b.closeBox();
308
309
310 b.openHorizontalBox("");
311 b.openVerticalBox("");
312 b.openHorizontalBox("");
313 {
314 b.create_small_rackknob(PARAM("time"), _(" time ms "));
315 b.create_small_rackknob(PARAM("feedback"), _(" feedback "));
316 b.create_small_rackknob(PARAM("pingpong"), _(" ping-pong"));
317 b.create_small_rackknob(PARAM("coloration"), _("coloration"));
318 }
319 b.closeBox();
320 b.openHorizontalBox("");
321 {
322 b.create_small_rackknob(PARAM("attack"), _(" attack "));
323 b.create_small_rackknob(PARAM("release"), _(" release "));
324 b.create_small_rackknob(PARAM("amount"), _(" amount "));
325 b.create_small_rackknobr(PARAM("effect"), _(" effect "));
326 }
327 b.closeBox();
328 b.closeBox();
329 b.closeBox();
330
331 #undef PARAM
332 return 0;
333 }
334 return -1;
335 }
336
337 int Dsp::load_ui_f_static(const UiBuilder& b, int form)
338 {
339 return static_cast<Dsp*>(b.plugin)->load_ui_f(b, form);
340 }
341 PluginDef *plugin() {
342 return new Dsp();
343 }
344
345 void Dsp::del_instance(PluginDef *p)
346 {
347 delete static_cast<Dsp*>(p);
348 }
349
350 } // end namespace duck_delay_st
2626 int activate(bool start);
2727 int load_ui_f(const UiBuilder& b, int form);
2828 void init(unsigned int samplingFreq);
29 void compute(int count, float *input0, float *output0);
29 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
3030 int register_par(const ParamReg& reg);
3131
3232 static void clear_state_f_static(PluginDef*);
3333 static int activate_static(bool start, PluginDef*);
3434 static int load_ui_f_static(const UiBuilder& b, int form);
3535 static void init_static(unsigned int samplingFreq, PluginDef*);
36 static void compute_static(int count, float *input0, float *output0, PluginDef*);
36 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
3737 static int register_params_static(const ParamReg& reg);
3838 static void del_instance(PluginDef *p);
3939 public:
128128 return static_cast<Dsp*>(p)->activate(start);
129129 }
130130
131 void always_inline Dsp::compute(int count, float *input0, float *output0)
131 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
132132 {
133133 int iSlow0 = (int((fConst3 * fslider0)) - 1);
134134 float fSlow1 = (1.000000000000001e-05f * fslider1);
151151 }
152152 }
153153
154 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
154 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
155155 {
156156 static_cast<Dsp*>(p)->compute(count, input0, output0);
157157 }
2020 void clear_state_f();
2121 int load_ui_f(const UiBuilder& b, int form);
2222 void init(unsigned int samplingFreq);
23 void compute(int count, float *input0, float *output0);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2424 int register_par(const ParamReg& reg);
2525
2626 static void clear_state_f_static(PluginDef*);
2727 static int load_ui_f_static(const UiBuilder& b, int form);
2828 static void init_static(unsigned int samplingFreq, PluginDef*);
29 static void compute_static(int count, float *input0, float *output0, PluginDef*);
29 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
3030 static int register_params_static(const ParamReg& reg);
3131 static void del_instance(PluginDef *p);
3232 public:
8585 static_cast<Dsp*>(p)->init(samplingFreq);
8686 }
8787
88 void always_inline Dsp::compute(int count, float *input0, float *output0)
88 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8989 {
9090 double fSlow0 = exp((0 - (fConst3 / max(fConst3, fslider0))));
9191 double fSlow1 = exp((0 - (fConst3 / max(fConst3, fslider1))));
107107 }
108108 }
109109
110 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
110 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
111111 {
112112 static_cast<Dsp*>(p)->compute(count, input0, output0);
113113 }
2626 void clear_state_f();
2727 int load_ui_f(const UiBuilder& b, int form);
2828 void init(unsigned int samplingFreq);
29 void compute(int count, float *input0, float *input1, float *output0, float *output1);
29 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
3030 int register_par(const ParamReg& reg);
3131
3232 static void clear_state_f_static(PluginDef*);
3333 static int load_ui_f_static(const UiBuilder& b, int form);
3434 static void init_static(unsigned int samplingFreq, PluginDef*);
35 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
35 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
3636 static int register_params_static(const ParamReg& reg);
3737 static void del_instance(PluginDef *p);
3838 public:
9595 static_cast<Dsp*>(p)->init(samplingFreq);
9696 }
9797
98 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
98 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
9999 {
100100 double fSlow0 = pow(10,(0.05 * fslider0));
101101 double fSlow1 = fslider1;
137137 }
138138 }
139139
140 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *p)
140 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
141141 {
142142 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
143143 }
2020 void clear_state_f();
2121 int load_ui_f(const UiBuilder& b, int form);
2222 void init(unsigned int samplingFreq);
23 void compute(int count, float *input0, float *output0);
23 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2424 int register_par(const ParamReg& reg);
2525
2626 static void clear_state_f_static(PluginDef*);
2727 static int load_ui_f_static(const UiBuilder& b, int form);
2828 static void init_static(unsigned int samplingFreq, PluginDef*);
29 static void compute_static(int count, float *input0, float *output0, PluginDef*);
29 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
3030 static int register_params_static(const ParamReg& reg);
3131 static void del_instance(PluginDef *p);
3232 public:
8787 static_cast<Dsp*>(p)->init(samplingFreq);
8888 }
8989
90 void always_inline Dsp::compute(int count, float *input0, float *output0)
90 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
9191 {
9292 double fSlow0 = fslider0;
9393 double fSlow1 = (1 - (0.01 * fSlow0));
118118 }
119119 }
120120
121 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
121 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
122122 {
123123 static_cast<Dsp*>(p)->compute(count, input0, output0);
124124 }
4545 void clear_state_f();
4646 int load_ui_f(const UiBuilder& b, int form);
4747 void init(unsigned int samplingFreq);
48 void compute(int count, float *input0, float *output0);
48 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
4949 int register_par(const ParamReg& reg);
5050
5151 static void clear_state_f_static(PluginDef*);
5252 static int load_ui_f_static(const UiBuilder& b, int form);
5353 static void init_static(unsigned int samplingFreq, PluginDef*);
54 static void compute_static(int count, float *input0, float *output0, PluginDef*);
54 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
5555 static int register_params_static(const ParamReg& reg);
5656 static void del_instance(PluginDef *p);
5757 public:
137137 static_cast<Dsp*>(p)->init(samplingFreq);
138138 }
139139
140 void always_inline Dsp::compute(int count, float *input0, float *output0)
140 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
141141 {
142142 double fSlow0 = fslider0;
143143 double fSlow1 = (1 - (0.01 * fSlow0));
212212 }
213213 }
214214
215 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
215 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
216216 {
217217 static_cast<Dsp*>(p)->compute(count, input0, output0);
218218 }
0 // generated from file '../src/faust/gain.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.65 (http://faust.grame.fr)
2
3
4 namespace gain {
5
6 class Dsp: public PluginDef {
7 private:
8 int fSamplingFreq;
9 FAUSTFLOAT fslider0;
10 double fRec0[2];
11 void clear_state_f();
12 int load_ui_f(const UiBuilder& b, int form);
13 void init(unsigned int samplingFreq);
14 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
15 int register_par(const ParamReg& reg);
16
17 static void clear_state_f_static(PluginDef*);
18 static int load_ui_f_static(const UiBuilder& b, int form);
19 static void init_static(unsigned int samplingFreq, PluginDef*);
20 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
21 static int register_params_static(const ParamReg& reg);
22 static void del_instance(PluginDef *p);
23 public:
24 Dsp();
25 ~Dsp();
26 };
27
28
29
30 Dsp::Dsp()
31 : PluginDef() {
32 version = PLUGINDEF_VERSION;
33 flags = 0;
34 id = "gain";
35 name = N_("Volume");
36 groups = 0;
37 description = N_("simple volume control"); // description (tooltip)
38 category = N_("Tone control"); // category
39 shortname = ""; // shortname
40 mono_audio = compute_static;
41 stereo_audio = 0;
42 set_samplerate = init_static;
43 activate_plugin = 0;
44 register_params = register_params_static;
45 load_ui = load_ui_f_static;
46 clear_state = clear_state_f_static;
47 delete_instance = del_instance;
48 }
49
50 Dsp::~Dsp() {
51 }
52
53 inline void Dsp::clear_state_f()
54 {
55 for (int i=0; i<2; i++) fRec0[i] = 0;
56 }
57
58 void Dsp::clear_state_f_static(PluginDef *p)
59 {
60 static_cast<Dsp*>(p)->clear_state_f();
61 }
62
63 inline void Dsp::init(unsigned int samplingFreq)
64 {
65 fSamplingFreq = samplingFreq;
66 clear_state_f();
67 }
68
69 void Dsp::init_static(unsigned int samplingFreq, PluginDef *p)
70 {
71 static_cast<Dsp*>(p)->init(samplingFreq);
72 }
73
74 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
75 {
76 double fSlow0 = (0.0010000000000000009 * pow(10,(0.05 * double(fslider0))));
77 for (int i=0; i<count; i++) {
78 fRec0[0] = ((0.999 * fRec0[1]) + fSlow0);
79 output0[i] = (FAUSTFLOAT)((double)input0[i] * fRec0[0]);
80 // post processing
81 fRec0[1] = fRec0[0];
82 }
83 }
84
85 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
86 {
87 static_cast<Dsp*>(p)->compute(count, input0, output0);
88 }
89
90 int Dsp::register_par(const ParamReg& reg)
91 {
92 reg.registerVar("gain.gain","","S",N_("gain (dB)"),&fslider0, 0.0, -4e+01, 4e+01, 0.1);
93 return 0;
94 }
95
96 int Dsp::register_params_static(const ParamReg& reg)
97 {
98 return static_cast<Dsp*>(reg.plugin)->register_par(reg);
99 }
100
101 inline int Dsp::load_ui_f(const UiBuilder& b, int form)
102 {
103 if (form & UI_FORM_STACK) {
104 #define PARAM(p) ("gain" "." p)
105 // ----- gain
106 b.openHorizontalhideBox("");
107 b.create_master_slider(PARAM("gain"), _("gain"));
108 b.closeBox();
109 b.openHorizontalBox("");
110 {
111 b.create_small_rackknob(PARAM("gain"), _("gain"));
112 }
113 b.closeBox();
114
115 #undef PARAM
116 return 0;
117 }
118 return -1;
119 }
120
121 int Dsp::load_ui_f_static(const UiBuilder& b, int form)
122 {
123 return static_cast<Dsp*>(b.plugin)->load_ui_f(b, form);
124 }
125 PluginDef *plugin() {
126 return new Dsp();
127 }
128
129 void Dsp::del_instance(PluginDef *p)
130 {
131 delete static_cast<Dsp*>(p);
132 }
133
134 } // end namespace gain
0 // generated from file '../src/faust/graphiceq.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.58 (http://faust.grame.fr)
2
3
4 namespace graphiceq {
5
6 class Dsp: public PluginDef {
7 private:
8 int fSamplingFreq;
9 int iConst0;
10 double fConst1;
11 double fConst2;
12 double fConst3;
13 double fConst4;
14 double fConst5;
15 double fConst6;
16 double fConst7;
17 double fConst8;
18 double fConst9;
19 double fConst10;
20 double fConst11;
21 double fConst12;
22 double fConst13;
23 double fConst14;
24 double fConst15;
25 double fConst16;
26 double fConst17;
27 double fConst18;
28 double fConst19;
29 double fConst20;
30 double fConst21;
31 double fConst22;
32 double fConst23;
33 double fConst24;
34 double fConst25;
35 double fConst26;
36 double fConst27;
37 double fConst28;
38 double fConst29;
39 double fConst30;
40 double fConst31;
41 double fConst32;
42 double fConst33;
43 double fConst34;
44 double fConst35;
45 double fConst36;
46 double fConst37;
47 double fConst38;
48 double fConst39;
49 double fConst40;
50 double fConst41;
51 double fConst42;
52 double fConst43;
53 double fConst44;
54 double fConst45;
55 double fConst46;
56 double fConst47;
57 double fConst48;
58 double fConst49;
59 double fConst50;
60 double fConst51;
61 double fConst52;
62 double fConst53;
63 double fConst54;
64 double fConst55;
65 double fConst56;
66 double fConst57;
67 double fConst58;
68 double fConst59;
69 double fConst60;
70 double fConst61;
71 double fConst62;
72 double fConst63;
73 double fConst64;
74 double fConst65;
75 double fConst66;
76 double fConst67;
77 double fConst68;
78 double fConst69;
79 double fConst70;
80 double fConst71;
81 double fConst72;
82 double fConst73;
83 double fConst74;
84 double fConst75;
85 double fConst76;
86 double fConst77;
87 double fConst78;
88 double fConst79;
89 double fConst80;
90 double fConst81;
91 double fConst82;
92 double fConst83;
93 double fConst84;
94 double fConst85;
95 double fConst86;
96 double fConst87;
97 double fConst88;
98 double fConst89;
99 double fConst90;
100 double fVec0[2];
101 double fConst91;
102 double fRec23[2];
103 double fRec22[3];
104 double fVec1[2];
105 double fConst92;
106 double fRec21[2];
107 double fRec20[3];
108 double fVec2[2];
109 double fConst93;
110 double fRec19[2];
111 double fRec18[3];
112 double fVec3[2];
113 double fConst94;
114 double fRec17[2];
115 double fRec16[3];
116 double fVec4[2];
117 double fConst95;
118 double fRec15[2];
119 double fRec14[3];
120 double fVec5[2];
121 double fConst96;
122 double fRec13[2];
123 double fRec12[3];
124 double fVec6[2];
125 double fConst97;
126 double fRec11[2];
127 double fRec10[3];
128 double fVec7[2];
129 double fConst98;
130 double fRec9[2];
131 double fRec8[3];
132 double fVec8[2];
133 double fConst99;
134 double fRec7[2];
135 double fRec6[3];
136 double fVec9[2];
137 double fConst100;
138 double fConst101;
139 double fRec5[2];
140 double fRec4[3];
141 double fConst102;
142 FAUSTFLOAT fslider0;
143 double fRec24[2];
144 double fRec0[2];
145 int iRec1[2];
146 double fRec2[2];
147 FAUSTFLOAT fbargraph0;
148 double fRec30[2];
149 double fRec29[3];
150 FAUSTFLOAT fslider1;
151 double fRec31[2];
152 double fRec25[2];
153 int iRec26[2];
154 double fRec27[2];
155 FAUSTFLOAT fbargraph1;
156 double fConst103;
157 double fConst104;
158 double fConst105;
159 double fRec38[2];
160 double fRec37[3];
161 double fConst106;
162 double fRec36[3];
163 FAUSTFLOAT fslider2;
164 double fRec39[2];
165 double fRec32[2];
166 int iRec33[2];
167 double fRec34[2];
168 FAUSTFLOAT fbargraph2;
169 double fConst107;
170 double fConst108;
171 double fConst109;
172 double fRec47[2];
173 double fRec46[3];
174 double fConst110;
175 double fRec45[3];
176 double fRec44[3];
177 FAUSTFLOAT fslider3;
178 double fRec48[2];
179 double fRec40[2];
180 int iRec41[2];
181 double fRec42[2];
182 FAUSTFLOAT fbargraph3;
183 double fConst111;
184 double fConst112;
185 double fConst113;
186 double fRec57[2];
187 double fRec56[3];
188 double fConst114;
189 double fRec55[3];
190 double fRec54[3];
191 double fRec53[3];
192 FAUSTFLOAT fslider4;
193 double fRec58[2];
194 double fRec49[2];
195 int iRec50[2];
196 double fRec51[2];
197 FAUSTFLOAT fbargraph4;
198 double fConst115;
199 double fConst116;
200 double fConst117;
201 double fRec68[2];
202 double fRec67[3];
203 double fConst118;
204 double fRec66[3];
205 double fRec65[3];
206 double fRec64[3];
207 double fRec63[3];
208 FAUSTFLOAT fslider5;
209 double fRec69[2];
210 double fRec59[2];
211 int iRec60[2];
212 double fRec61[2];
213 FAUSTFLOAT fbargraph5;
214 double fConst119;
215 double fConst120;
216 double fConst121;
217 double fRec80[2];
218 double fRec79[3];
219 double fConst122;
220 double fRec78[3];
221 double fRec77[3];
222 double fRec76[3];
223 double fRec75[3];
224 double fRec74[3];
225 FAUSTFLOAT fslider6;
226 double fRec81[2];
227 double fRec70[2];
228 int iRec71[2];
229 double fRec72[2];
230 FAUSTFLOAT fbargraph6;
231 double fConst123;
232 double fConst124;
233 double fConst125;
234 double fRec93[2];
235 double fRec92[3];
236 double fConst126;
237 double fRec91[3];
238 double fRec90[3];
239 double fRec89[3];
240 double fRec88[3];
241 double fRec87[3];
242 double fRec86[3];
243 FAUSTFLOAT fslider7;
244 double fRec94[2];
245 double fRec82[2];
246 int iRec83[2];
247 double fRec84[2];
248 FAUSTFLOAT fbargraph7;
249 double fConst127;
250 double fConst128;
251 double fConst129;
252 double fRec107[2];
253 double fRec106[3];
254 double fConst130;
255 double fRec105[3];
256 double fRec104[3];
257 double fRec103[3];
258 double fRec102[3];
259 double fRec101[3];
260 double fRec100[3];
261 double fRec99[3];
262 FAUSTFLOAT fslider8;
263 double fRec108[2];
264 double fRec95[2];
265 int iRec96[2];
266 double fRec97[2];
267 FAUSTFLOAT fbargraph8;
268 double fConst131;
269 double fConst132;
270 double fConst133;
271 double fRec122[2];
272 double fRec121[3];
273 double fConst134;
274 double fRec120[3];
275 double fRec119[3];
276 double fRec118[3];
277 double fRec117[3];
278 double fRec116[3];
279 double fRec115[3];
280 double fRec114[3];
281 double fRec113[3];
282 FAUSTFLOAT fslider9;
283 double fRec123[2];
284 double fRec109[2];
285 int iRec110[2];
286 double fRec111[2];
287 FAUSTFLOAT fbargraph9;
288 double fConst135;
289 double fConst136;
290 double fConst137;
291 double fRec138[2];
292 double fRec137[3];
293 double fConst138;
294 double fRec136[3];
295 double fRec135[3];
296 double fRec134[3];
297 double fRec133[3];
298 double fRec132[3];
299 double fRec131[3];
300 double fRec130[3];
301 double fRec129[3];
302 double fRec128[3];
303 FAUSTFLOAT fslider10;
304 double fRec139[2];
305 double fRec124[2];
306 int iRec125[2];
307 double fRec126[2];
308 FAUSTFLOAT fbargraph10;
309 void clear_state_f();
310 int load_ui_f(const UiBuilder& b, int form);
311 void init(unsigned int samplingFreq);
312 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
313 int register_par(const ParamReg& reg);
314
315 static void clear_state_f_static(PluginDef*);
316 static int load_ui_f_static(const UiBuilder& b, int form);
317 static void init_static(unsigned int samplingFreq, PluginDef*);
318 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
319 static int register_params_static(const ParamReg& reg);
320 static void del_instance(PluginDef *p);
321 public:
322 Dsp();
323 ~Dsp();
324 };
325
326
327
328 Dsp::Dsp()
329 : PluginDef() {
330 version = PLUGINDEF_VERSION;
331 flags = 0;
332 id = "graphiceq";
333 name = N_("Graphic EQ");
334 groups = 0;
335 description = N_("Graphic EQ"); // description (tooltip)
336 category = N_("Tone control"); // category
337 shortname = ""; // shortname
338 mono_audio = compute_static;
339 stereo_audio = 0;
340 set_samplerate = init_static;
341 activate_plugin = 0;
342 register_params = register_params_static;
343 load_ui = load_ui_f_static;
344 clear_state = clear_state_f_static;
345 delete_instance = del_instance;
346 }
347
348 Dsp::~Dsp() {
349 }
350
351 inline void Dsp::clear_state_f()
352 {
353 for (int i=0; i<2; i++) fVec0[i] = 0;
354 for (int i=0; i<2; i++) fRec23[i] = 0;
355 for (int i=0; i<3; i++) fRec22[i] = 0;
356 for (int i=0; i<2; i++) fVec1[i] = 0;
357 for (int i=0; i<2; i++) fRec21[i] = 0;
358 for (int i=0; i<3; i++) fRec20[i] = 0;
359 for (int i=0; i<2; i++) fVec2[i] = 0;
360 for (int i=0; i<2; i++) fRec19[i] = 0;
361 for (int i=0; i<3; i++) fRec18[i] = 0;
362 for (int i=0; i<2; i++) fVec3[i] = 0;
363 for (int i=0; i<2; i++) fRec17[i] = 0;
364 for (int i=0; i<3; i++) fRec16[i] = 0;
365 for (int i=0; i<2; i++) fVec4[i] = 0;
366 for (int i=0; i<2; i++) fRec15[i] = 0;
367 for (int i=0; i<3; i++) fRec14[i] = 0;
368 for (int i=0; i<2; i++) fVec5[i] = 0;
369 for (int i=0; i<2; i++) fRec13[i] = 0;
370 for (int i=0; i<3; i++) fRec12[i] = 0;
371 for (int i=0; i<2; i++) fVec6[i] = 0;
372 for (int i=0; i<2; i++) fRec11[i] = 0;
373 for (int i=0; i<3; i++) fRec10[i] = 0;
374 for (int i=0; i<2; i++) fVec7[i] = 0;
375 for (int i=0; i<2; i++) fRec9[i] = 0;
376 for (int i=0; i<3; i++) fRec8[i] = 0;
377 for (int i=0; i<2; i++) fVec8[i] = 0;
378 for (int i=0; i<2; i++) fRec7[i] = 0;
379 for (int i=0; i<3; i++) fRec6[i] = 0;
380 for (int i=0; i<2; i++) fVec9[i] = 0;
381 for (int i=0; i<2; i++) fRec5[i] = 0;
382 for (int i=0; i<3; i++) fRec4[i] = 0;
383 for (int i=0; i<2; i++) fRec24[i] = 0;
384 for (int i=0; i<2; i++) fRec0[i] = 0;
385 for (int i=0; i<2; i++) iRec1[i] = 0;
386 for (int i=0; i<2; i++) fRec2[i] = 0;
387 for (int i=0; i<2; i++) fRec30[i] = 0;
388 for (int i=0; i<3; i++) fRec29[i] = 0;
389 for (int i=0; i<2; i++) fRec31[i] = 0;
390 for (int i=0; i<2; i++) fRec25[i] = 0;
391 for (int i=0; i<2; i++) iRec26[i] = 0;
392 for (int i=0; i<2; i++) fRec27[i] = 0;
393 for (int i=0; i<2; i++) fRec38[i] = 0;
394 for (int i=0; i<3; i++) fRec37[i] = 0;
395 for (int i=0; i<3; i++) fRec36[i] = 0;
396 for (int i=0; i<2; i++) fRec39[i] = 0;
397 for (int i=0; i<2; i++) fRec32[i] = 0;
398 for (int i=0; i<2; i++) iRec33[i] = 0;
399 for (int i=0; i<2; i++) fRec34[i] = 0;
400 for (int i=0; i<2; i++) fRec47[i] = 0;
401 for (int i=0; i<3; i++) fRec46[i] = 0;
402 for (int i=0; i<3; i++) fRec45[i] = 0;
403 for (int i=0; i<3; i++) fRec44[i] = 0;
404 for (int i=0; i<2; i++) fRec48[i] = 0;
405 for (int i=0; i<2; i++) fRec40[i] = 0;
406 for (int i=0; i<2; i++) iRec41[i] = 0;
407 for (int i=0; i<2; i++) fRec42[i] = 0;
408 for (int i=0; i<2; i++) fRec57[i] = 0;
409 for (int i=0; i<3; i++) fRec56[i] = 0;
410 for (int i=0; i<3; i++) fRec55[i] = 0;
411 for (int i=0; i<3; i++) fRec54[i] = 0;
412 for (int i=0; i<3; i++) fRec53[i] = 0;
413 for (int i=0; i<2; i++) fRec58[i] = 0;
414 for (int i=0; i<2; i++) fRec49[i] = 0;
415 for (int i=0; i<2; i++) iRec50[i] = 0;
416 for (int i=0; i<2; i++) fRec51[i] = 0;
417 for (int i=0; i<2; i++) fRec68[i] = 0;
418 for (int i=0; i<3; i++) fRec67[i] = 0;
419 for (int i=0; i<3; i++) fRec66[i] = 0;
420 for (int i=0; i<3; i++) fRec65[i] = 0;
421 for (int i=0; i<3; i++) fRec64[i] = 0;
422 for (int i=0; i<3; i++) fRec63[i] = 0;
423 for (int i=0; i<2; i++) fRec69[i] = 0;
424 for (int i=0; i<2; i++) fRec59[i] = 0;
425 for (int i=0; i<2; i++) iRec60[i] = 0;
426 for (int i=0; i<2; i++) fRec61[i] = 0;
427 for (int i=0; i<2; i++) fRec80[i] = 0;
428 for (int i=0; i<3; i++) fRec79[i] = 0;
429 for (int i=0; i<3; i++) fRec78[i] = 0;
430 for (int i=0; i<3; i++) fRec77[i] = 0;
431 for (int i=0; i<3; i++) fRec76[i] = 0;
432 for (int i=0; i<3; i++) fRec75[i] = 0;
433 for (int i=0; i<3; i++) fRec74[i] = 0;
434 for (int i=0; i<2; i++) fRec81[i] = 0;
435 for (int i=0; i<2; i++) fRec70[i] = 0;
436 for (int i=0; i<2; i++) iRec71[i] = 0;
437 for (int i=0; i<2; i++) fRec72[i] = 0;
438 for (int i=0; i<2; i++) fRec93[i] = 0;
439 for (int i=0; i<3; i++) fRec92[i] = 0;
440 for (int i=0; i<3; i++) fRec91[i] = 0;
441 for (int i=0; i<3; i++) fRec90[i] = 0;
442 for (int i=0; i<3; i++) fRec89[i] = 0;
443 for (int i=0; i<3; i++) fRec88[i] = 0;
444 for (int i=0; i<3; i++) fRec87[i] = 0;
445 for (int i=0; i<3; i++) fRec86[i] = 0;
446 for (int i=0; i<2; i++) fRec94[i] = 0;
447 for (int i=0; i<2; i++) fRec82[i] = 0;
448 for (int i=0; i<2; i++) iRec83[i] = 0;
449 for (int i=0; i<2; i++) fRec84[i] = 0;
450 for (int i=0; i<2; i++) fRec107[i] = 0;
451 for (int i=0; i<3; i++) fRec106[i] = 0;
452 for (int i=0; i<3; i++) fRec105[i] = 0;
453 for (int i=0; i<3; i++) fRec104[i] = 0;
454 for (int i=0; i<3; i++) fRec103[i] = 0;
455 for (int i=0; i<3; i++) fRec102[i] = 0;
456 for (int i=0; i<3; i++) fRec101[i] = 0;
457 for (int i=0; i<3; i++) fRec100[i] = 0;
458 for (int i=0; i<3; i++) fRec99[i] = 0;
459 for (int i=0; i<2; i++) fRec108[i] = 0;
460 for (int i=0; i<2; i++) fRec95[i] = 0;
461 for (int i=0; i<2; i++) iRec96[i] = 0;
462 for (int i=0; i<2; i++) fRec97[i] = 0;
463 for (int i=0; i<2; i++) fRec122[i] = 0;
464 for (int i=0; i<3; i++) fRec121[i] = 0;
465 for (int i=0; i<3; i++) fRec120[i] = 0;
466 for (int i=0; i<3; i++) fRec119[i] = 0;
467 for (int i=0; i<3; i++) fRec118[i] = 0;
468 for (int i=0; i<3; i++) fRec117[i] = 0;
469 for (int i=0; i<3; i++) fRec116[i] = 0;
470 for (int i=0; i<3; i++) fRec115[i] = 0;
471 for (int i=0; i<3; i++) fRec114[i] = 0;
472 for (int i=0; i<3; i++) fRec113[i] = 0;
473 for (int i=0; i<2; i++) fRec123[i] = 0;
474 for (int i=0; i<2; i++) fRec109[i] = 0;
475 for (int i=0; i<2; i++) iRec110[i] = 0;
476 for (int i=0; i<2; i++) fRec111[i] = 0;
477 for (int i=0; i<2; i++) fRec138[i] = 0;
478 for (int i=0; i<3; i++) fRec137[i] = 0;
479 for (int i=0; i<3; i++) fRec136[i] = 0;
480 for (int i=0; i<3; i++) fRec135[i] = 0;
481 for (int i=0; i<3; i++) fRec134[i] = 0;
482 for (int i=0; i<3; i++) fRec133[i] = 0;
483 for (int i=0; i<3; i++) fRec132[i] = 0;
484 for (int i=0; i<3; i++) fRec131[i] = 0;
485 for (int i=0; i<3; i++) fRec130[i] = 0;
486 for (int i=0; i<3; i++) fRec129[i] = 0;
487 for (int i=0; i<3; i++) fRec128[i] = 0;
488 for (int i=0; i<2; i++) fRec139[i] = 0;
489 for (int i=0; i<2; i++) fRec124[i] = 0;
490 for (int i=0; i<2; i++) iRec125[i] = 0;
491 for (int i=0; i<2; i++) fRec126[i] = 0;
492 }
493
494 void Dsp::clear_state_f_static(PluginDef *p)
495 {
496 static_cast<Dsp*>(p)->clear_state_f();
497 }
498
499 inline void Dsp::init(unsigned int samplingFreq)
500 {
501 fSamplingFreq = samplingFreq;
502 iConst0 = min(192000, max(1, fSamplingFreq));
503 fConst1 = (1.0 / double(iConst0));
504 fConst2 = tan((138.23007675795088 / double(iConst0)));
505 fConst3 = (1.0 / faustpower<2>(fConst2));
506 fConst4 = (2 * (1 - fConst3));
507 fConst5 = (1.0 / fConst2);
508 fConst6 = (1 + ((fConst5 - 1.0000000000000004) / fConst2));
509 fConst7 = (1.0 / (1 + ((fConst5 + 1.0000000000000004) / fConst2)));
510 fConst8 = (1 + fConst5);
511 fConst9 = (0 - ((1 - fConst5) / fConst8));
512 fConst10 = tan((276.46015351590177 / double(iConst0)));
513 fConst11 = (1.0 / faustpower<2>(fConst10));
514 fConst12 = (2 * (1 - fConst11));
515 fConst13 = (1.0 / fConst10);
516 fConst14 = (1 + ((fConst13 - 1.0000000000000004) / fConst10));
517 fConst15 = (1 + ((fConst13 + 1.0000000000000004) / fConst10));
518 fConst16 = (1.0 / fConst15);
519 fConst17 = (1 + fConst13);
520 fConst18 = (0 - ((1 - fConst13) / fConst17));
521 fConst19 = tan((556.0618996853934 / double(iConst0)));
522 fConst20 = (1.0 / faustpower<2>(fConst19));
523 fConst21 = (2 * (1 - fConst20));
524 fConst22 = (1.0 / fConst19);
525 fConst23 = (1 + ((fConst22 - 1.0000000000000004) / fConst19));
526 fConst24 = (1 + ((fConst22 + 1.0000000000000004) / fConst19));
527 fConst25 = (1.0 / fConst24);
528 fConst26 = (1 + fConst22);
529 fConst27 = (0 - ((1 - fConst22) / fConst26));
530 fConst28 = tan((1112.1237993707869 / double(iConst0)));
531 fConst29 = (1.0 / faustpower<2>(fConst28));
532 fConst30 = (2 * (1 - fConst29));
533 fConst31 = (1.0 / fConst28);
534 fConst32 = (1 + ((fConst31 - 1.0000000000000004) / fConst28));
535 fConst33 = (1 + ((fConst31 + 1.0000000000000004) / fConst28));
536 fConst34 = (1.0 / fConst33);
537 fConst35 = (1 + fConst31);
538 fConst36 = (0 - ((1 - fConst31) / fConst35));
539 fConst37 = tan((2221.1060060879836 / double(iConst0)));
540 fConst38 = (1.0 / faustpower<2>(fConst37));
541 fConst39 = (2 * (1 - fConst38));
542 fConst40 = (1.0 / fConst37);
543 fConst41 = (1 + ((fConst40 - 1.0000000000000004) / fConst37));
544 fConst42 = (1 + ((fConst40 + 1.0000000000000004) / fConst37));
545 fConst43 = (1.0 / fConst42);
546 fConst44 = (1 + fConst40);
547 fConst45 = (0 - ((1 - fConst40) / fConst44));
548 fConst46 = tan((4442.212012175967 / double(iConst0)));
549 fConst47 = (1.0 / faustpower<2>(fConst46));
550 fConst48 = (2 * (1 - fConst47));
551 fConst49 = (1.0 / fConst46);
552 fConst50 = (1 + ((fConst49 - 1.0000000000000004) / fConst46));
553 fConst51 = (1 + ((fConst49 + 1.0000000000000004) / fConst46));
554 fConst52 = (1.0 / fConst51);
555 fConst53 = (1 + fConst49);
556 fConst54 = (0 - ((1 - fConst49) / fConst53));
557 fConst55 = tan((8884.424024351934 / double(iConst0)));
558 fConst56 = (1.0 / faustpower<2>(fConst55));
559 fConst57 = (2 * (1 - fConst56));
560 fConst58 = (1.0 / fConst55);
561 fConst59 = (1 + ((fConst58 - 1.0000000000000004) / fConst55));
562 fConst60 = (1 + ((fConst58 + 1.0000000000000004) / fConst55));
563 fConst61 = (1.0 / fConst60);
564 fConst62 = (1 + fConst58);
565 fConst63 = (0 - ((1 - fConst58) / fConst62));
566 fConst64 = tan((17771.98964135746 / double(iConst0)));
567 fConst65 = (1.0 / faustpower<2>(fConst64));
568 fConst66 = (2 * (1 - fConst65));
569 fConst67 = (1.0 / fConst64);
570 fConst68 = (1 + ((fConst67 - 1.0000000000000004) / fConst64));
571 fConst69 = (1 + ((fConst67 + 1.0000000000000004) / fConst64));
572 fConst70 = (1.0 / fConst69);
573 fConst71 = (1 + fConst67);
574 fConst72 = (0 - ((1 - fConst67) / fConst71));
575 fConst73 = tan((35763.890768466204 / double(iConst0)));
576 fConst74 = (1.0 / faustpower<2>(fConst73));
577 fConst75 = (2 * (1 - fConst74));
578 fConst76 = (1.0 / fConst73);
579 fConst77 = (1 + ((fConst76 - 1.0000000000000004) / fConst73));
580 fConst78 = (1 + ((fConst76 + 1.0000000000000004) / fConst73));
581 fConst79 = (1.0 / fConst78);
582 fConst80 = (1 + fConst76);
583 fConst81 = (0 - ((1 - fConst76) / fConst80));
584 fConst82 = tan((56894.24295651115 / double(iConst0)));
585 fConst83 = (1.0 / faustpower<2>(fConst82));
586 fConst84 = (2 * (1 - fConst83));
587 fConst85 = (1.0 / fConst82);
588 fConst86 = (1 + ((fConst85 - 1.0000000000000004) / fConst82));
589 fConst87 = (1 + ((1.0000000000000004 + fConst85) / fConst82));
590 fConst88 = (1.0 / fConst87);
591 fConst89 = (1 + fConst85);
592 fConst90 = (0 - ((1 - fConst85) / fConst89));
593 fConst91 = (1.0 / fConst89);
594 fConst92 = (1.0 / (fConst80 * fConst87));
595 fConst93 = (1.0 / (fConst71 * fConst78));
596 fConst94 = (1.0 / (fConst62 * fConst69));
597 fConst95 = (1.0 / (fConst53 * fConst60));
598 fConst96 = (1.0 / (fConst44 * fConst51));
599 fConst97 = (1.0 / (fConst35 * fConst42));
600 fConst98 = (1.0 / (fConst26 * fConst33));
601 fConst99 = (1.0 / (fConst17 * fConst24));
602 fConst100 = (0 - fConst5);
603 fConst101 = (1.0 / (fConst8 * fConst15));
604 fConst102 = (2 * (0 - fConst3));
605 fConst103 = (1 + ((fConst5 - 1.0) / fConst2));
606 fConst104 = (1.0 / (1 + ((1.0 + fConst5) / fConst2)));
607 fConst105 = (0 - fConst13);
608 fConst106 = (2 * (0 - fConst11));
609 fConst107 = (1 + ((fConst13 - 1.0) / fConst10));
610 fConst108 = (1.0 / (1 + ((1.0 + fConst13) / fConst10)));
611 fConst109 = (0 - fConst22);
612 fConst110 = (2 * (0 - fConst20));
613 fConst111 = (1 + ((fConst22 - 1.0) / fConst19));
614 fConst112 = (1.0 / (1 + ((1.0 + fConst22) / fConst19)));
615 fConst113 = (0 - fConst31);
616 fConst114 = (2 * (0 - fConst29));
617 fConst115 = (1 + ((fConst31 - 1.0) / fConst28));
618 fConst116 = (1.0 / (1 + ((1.0 + fConst31) / fConst28)));
619 fConst117 = (0 - fConst40);
620 fConst118 = (2 * (0 - fConst38));
621 fConst119 = (1 + ((fConst40 - 1.0) / fConst37));
622 fConst120 = (1.0 / (1 + ((1.0 + fConst40) / fConst37)));
623 fConst121 = (0 - fConst49);
624 fConst122 = (2 * (0 - fConst47));
625 fConst123 = (1 + ((fConst49 - 1.0) / fConst46));
626 fConst124 = (1.0 / (1 + ((1.0 + fConst49) / fConst46)));
627 fConst125 = (0 - fConst58);
628 fConst126 = (2 * (0 - fConst56));
629 fConst127 = (1 + ((fConst58 - 1.0) / fConst55));
630 fConst128 = (1.0 / (1 + ((1.0 + fConst58) / fConst55)));
631 fConst129 = (0 - fConst67);
632 fConst130 = (2 * (0 - fConst65));
633 fConst131 = (1 + ((fConst67 - 1.0) / fConst64));
634 fConst132 = (1.0 / (1 + ((1.0 + fConst67) / fConst64)));
635 fConst133 = (0 - fConst76);
636 fConst134 = (2 * (0 - fConst74));
637 fConst135 = (1 + ((fConst76 - 1.0) / fConst73));
638 fConst136 = (1.0 / (1 + ((1.0 + fConst76) / fConst73)));
639 fConst137 = (0 - fConst85);
640 fConst138 = (2 * (0 - fConst83));
641 clear_state_f();
642 }
643
644 void Dsp::init_static(unsigned int samplingFreq, PluginDef *p)
645 {
646 static_cast<Dsp*>(p)->init(samplingFreq);
647 }
648
649 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
650 {
651 double fSlow0 = (0.0010000000000000009 * pow(10,(0.05 * fslider0)));
652 double fSlow1 = (0.0010000000000000009 * pow(10,(0.05 * fslider1)));
653 double fSlow2 = (0.0010000000000000009 * pow(10,(0.05 * fslider2)));
654 double fSlow3 = (0.0010000000000000009 * pow(10,(0.05 * fslider3)));
655 double fSlow4 = (0.0010000000000000009 * pow(10,(0.05 * fslider4)));
656 double fSlow5 = (0.0010000000000000009 * pow(10,(0.05 * fslider5)));
657 double fSlow6 = (0.0010000000000000009 * pow(10,(0.05 * fslider6)));
658 double fSlow7 = (0.0010000000000000009 * pow(10,(0.05 * fslider7)));
659 double fSlow8 = (0.0010000000000000009 * pow(10,(0.05 * fslider8)));
660 double fSlow9 = (0.0010000000000000009 * pow(10,(0.05 * fslider9)));
661 double fSlow10 = (0.0010000000000000009 * pow(10,(0.05 * fslider10)));
662 for (int i=0; i<count; i++) {
663 double fTemp0 = (double)input0[i];
664 fVec0[0] = fTemp0;
665 fRec23[0] = ((fConst91 * (fVec0[0] + fVec0[1])) + (fConst90 * fRec23[1]));
666 fRec22[0] = (fRec23[0] - (fConst88 * ((fConst86 * fRec22[2]) + (fConst84 * fRec22[1]))));
667 double fTemp1 = (fRec22[2] + (fRec22[0] + (2 * fRec22[1])));
668 fVec1[0] = fTemp1;
669 fRec21[0] = ((fConst92 * (fVec1[0] + fVec1[1])) + (fConst81 * fRec21[1]));
670 fRec20[0] = (fRec21[0] - (fConst79 * ((fConst77 * fRec20[2]) + (fConst75 * fRec20[1]))));
671 double fTemp2 = (fRec20[2] + (fRec20[0] + (2 * fRec20[1])));
672 fVec2[0] = fTemp2;
673 fRec19[0] = ((fConst93 * (fVec2[0] + fVec2[1])) + (fConst72 * fRec19[1]));
674 fRec18[0] = (fRec19[0] - (fConst70 * ((fConst68 * fRec18[2]) + (fConst66 * fRec18[1]))));
675 double fTemp3 = (fRec18[2] + (fRec18[0] + (2 * fRec18[1])));
676 fVec3[0] = fTemp3;
677 fRec17[0] = ((fConst94 * (fVec3[0] + fVec3[1])) + (fConst63 * fRec17[1]));
678 fRec16[0] = (fRec17[0] - (fConst61 * ((fConst59 * fRec16[2]) + (fConst57 * fRec16[1]))));
679 double fTemp4 = (fRec16[2] + (fRec16[0] + (2 * fRec16[1])));
680 fVec4[0] = fTemp4;
681 fRec15[0] = ((fConst95 * (fVec4[0] + fVec4[1])) + (fConst54 * fRec15[1]));
682 fRec14[0] = (fRec15[0] - (fConst52 * ((fConst50 * fRec14[2]) + (fConst48 * fRec14[1]))));
683 double fTemp5 = (fRec14[2] + (fRec14[0] + (2 * fRec14[1])));
684 fVec5[0] = fTemp5;
685 fRec13[0] = ((fConst96 * (fVec5[0] + fVec5[1])) + (fConst45 * fRec13[1]));
686 fRec12[0] = (fRec13[0] - (fConst43 * ((fConst41 * fRec12[2]) + (fConst39 * fRec12[1]))));
687 double fTemp6 = (fRec12[2] + (fRec12[0] + (2 * fRec12[1])));
688 fVec6[0] = fTemp6;
689 fRec11[0] = ((fConst97 * (fVec6[0] + fVec6[1])) + (fConst36 * fRec11[1]));
690 fRec10[0] = (fRec11[0] - (fConst34 * ((fConst32 * fRec10[2]) + (fConst30 * fRec10[1]))));
691 double fTemp7 = (fRec10[2] + (fRec10[0] + (2 * fRec10[1])));
692 fVec7[0] = fTemp7;
693 fRec9[0] = ((fConst98 * (fVec7[0] + fVec7[1])) + (fConst27 * fRec9[1]));
694 fRec8[0] = (fRec9[0] - (fConst25 * ((fConst23 * fRec8[2]) + (fConst21 * fRec8[1]))));
695 double fTemp8 = (fRec8[2] + (fRec8[0] + (2 * fRec8[1])));
696 fVec8[0] = fTemp8;
697 fRec7[0] = ((fConst99 * (fVec8[0] + fVec8[1])) + (fConst18 * fRec7[1]));
698 fRec6[0] = (fRec7[0] - (fConst16 * ((fConst14 * fRec6[2]) + (fConst12 * fRec6[1]))));
699 double fTemp9 = (fRec6[2] + (fRec6[0] + (2 * fRec6[1])));
700 fVec9[0] = fTemp9;
701 fRec5[0] = ((fConst101 * ((fConst100 * fVec9[1]) + (fConst5 * fVec9[0]))) + (fConst9 * fRec5[1]));
702 fRec4[0] = (fRec5[0] - (fConst7 * ((fConst6 * fRec4[2]) + (fConst4 * fRec4[1]))));
703 fRec24[0] = (fSlow0 + (0.999 * fRec24[1]));
704 double fTemp10 = (fConst7 * (fRec24[0] * (((fConst3 * fRec4[0]) + (fConst102 * fRec4[1])) + (fConst3 * fRec4[2]))));
705 double fRec3 = max(fConst1, fabs(fTemp10));
706 int iTemp11 = int((iRec1[1] < 4096));
707 fRec0[0] = ((iTemp11)?max(fRec0[1], fRec3):fRec3);
708 iRec1[0] = ((iTemp11)?(1 + iRec1[1]):1);
709 fRec2[0] = ((iTemp11)?fRec2[1]:fRec0[1]);
710 fbargraph0 = fRec2[0];
711 fRec30[0] = ((fConst101 * (fVec9[0] + fVec9[1])) + (fConst9 * fRec30[1]));
712 fRec29[0] = (fRec30[0] - (fConst7 * ((fConst6 * fRec29[2]) + (fConst4 * fRec29[1]))));
713 fRec31[0] = (fSlow1 + (0.999 * fRec31[1]));
714 double fTemp12 = (fConst7 * (fRec31[0] * (fRec29[2] + (fRec29[0] + (2 * fRec29[1])))));
715 double fRec28 = max(fConst1, fabs(fTemp12));
716 int iTemp13 = int((iRec26[1] < 4096));
717 fRec25[0] = ((iTemp13)?max(fRec25[1], fRec28):fRec28);
718 iRec26[0] = ((iTemp13)?(1 + iRec26[1]):1);
719 fRec27[0] = ((iTemp13)?fRec27[1]:fRec25[1]);
720 fbargraph1 = fRec27[0];
721 double fTemp14 = (fConst4 * fRec36[1]);
722 fRec38[0] = ((fConst99 * ((fConst105 * fVec8[1]) + (fConst13 * fVec8[0]))) + (fConst18 * fRec38[1]));
723 fRec37[0] = (fRec38[0] - (fConst16 * ((fConst14 * fRec37[2]) + (fConst12 * fRec37[1]))));
724 fRec36[0] = ((fConst16 * (((fConst11 * fRec37[0]) + (fConst106 * fRec37[1])) + (fConst11 * fRec37[2]))) - (fConst104 * ((fConst103 * fRec36[2]) + fTemp14)));
725 fRec39[0] = (fSlow2 + (0.999 * fRec39[1]));
726 double fTemp15 = (fRec39[0] * (fRec36[2] + (fConst104 * (fTemp14 + (fConst103 * fRec36[0])))));
727 double fRec35 = max(fConst1, fabs(fTemp15));
728 int iTemp16 = int((iRec33[1] < 4096));
729 fRec32[0] = ((iTemp16)?max(fRec32[1], fRec35):fRec35);
730 iRec33[0] = ((iTemp16)?(1 + iRec33[1]):1);
731 fRec34[0] = ((iTemp16)?fRec34[1]:fRec32[1]);
732 fbargraph2 = fRec34[0];
733 double fTemp17 = (fConst4 * fRec44[1]);
734 double fTemp18 = (fConst12 * fRec45[1]);
735 fRec47[0] = ((fConst98 * ((fConst109 * fVec7[1]) + (fConst22 * fVec7[0]))) + (fConst27 * fRec47[1]));
736 fRec46[0] = (fRec47[0] - (fConst25 * ((fConst23 * fRec46[2]) + (fConst21 * fRec46[1]))));
737 fRec45[0] = ((fConst25 * (((fConst20 * fRec46[0]) + (fConst110 * fRec46[1])) + (fConst20 * fRec46[2]))) - (fConst108 * ((fConst107 * fRec45[2]) + fTemp18)));
738 fRec44[0] = ((fRec45[2] + (fConst108 * (fTemp18 + (fConst107 * fRec45[0])))) - (fConst104 * ((fConst103 * fRec44[2]) + fTemp17)));
739 fRec48[0] = (fSlow3 + (0.999 * fRec48[1]));
740 double fTemp19 = (fRec48[0] * (fRec44[2] + (fConst104 * (fTemp17 + (fConst103 * fRec44[0])))));
741 double fRec43 = max(fConst1, fabs(fTemp19));
742 int iTemp20 = int((iRec41[1] < 4096));
743 fRec40[0] = ((iTemp20)?max(fRec40[1], fRec43):fRec43);
744 iRec41[0] = ((iTemp20)?(1 + iRec41[1]):1);
745 fRec42[0] = ((iTemp20)?fRec42[1]:fRec40[1]);
746 fbargraph3 = fRec42[0];
747 double fTemp21 = (fConst4 * fRec53[1]);
748 double fTemp22 = (fConst12 * fRec54[1]);
749 double fTemp23 = (fConst21 * fRec55[1]);
750 fRec57[0] = ((fConst97 * ((fConst113 * fVec6[1]) + (fConst31 * fVec6[0]))) + (fConst36 * fRec57[1]));
751 fRec56[0] = (fRec57[0] - (fConst34 * ((fConst32 * fRec56[2]) + (fConst30 * fRec56[1]))));
752 fRec55[0] = ((fConst34 * (((fConst29 * fRec56[0]) + (fConst114 * fRec56[1])) + (fConst29 * fRec56[2]))) - (fConst112 * ((fConst111 * fRec55[2]) + fTemp23)));
753 fRec54[0] = ((fRec55[2] + (fConst112 * (fTemp23 + (fConst111 * fRec55[0])))) - (fConst108 * ((fConst107 * fRec54[2]) + fTemp22)));
754 fRec53[0] = ((fRec54[2] + (fConst108 * (fTemp22 + (fConst107 * fRec54[0])))) - (fConst104 * ((fConst103 * fRec53[2]) + fTemp21)));
755 fRec58[0] = (fSlow4 + (0.999 * fRec58[1]));
756 double fTemp24 = (fRec58[0] * (fRec53[2] + (fConst104 * (fTemp21 + (fConst103 * fRec53[0])))));
757 double fRec52 = max(fConst1, fabs(fTemp24));
758 int iTemp25 = int((iRec50[1] < 4096));
759 fRec49[0] = ((iTemp25)?max(fRec49[1], fRec52):fRec52);
760 iRec50[0] = ((iTemp25)?(1 + iRec50[1]):1);
761 fRec51[0] = ((iTemp25)?fRec51[1]:fRec49[1]);
762 fbargraph4 = fRec51[0];
763 double fTemp26 = (fConst4 * fRec63[1]);
764 double fTemp27 = (fConst12 * fRec64[1]);
765 double fTemp28 = (fConst21 * fRec65[1]);
766 double fTemp29 = (fConst30 * fRec66[1]);
767 fRec68[0] = ((fConst96 * ((fConst117 * fVec5[1]) + (fConst40 * fVec5[0]))) + (fConst45 * fRec68[1]));
768 fRec67[0] = (fRec68[0] - (fConst43 * ((fConst41 * fRec67[2]) + (fConst39 * fRec67[1]))));
769 fRec66[0] = ((fConst43 * (((fConst38 * fRec67[0]) + (fConst118 * fRec67[1])) + (fConst38 * fRec67[2]))) - (fConst116 * ((fConst115 * fRec66[2]) + fTemp29)));
770 fRec65[0] = ((fRec66[2] + (fConst116 * (fTemp29 + (fConst115 * fRec66[0])))) - (fConst112 * ((fConst111 * fRec65[2]) + fTemp28)));
771 fRec64[0] = ((fRec65[2] + (fConst112 * (fTemp28 + (fConst111 * fRec65[0])))) - (fConst108 * ((fConst107 * fRec64[2]) + fTemp27)));
772 fRec63[0] = ((fRec64[2] + (fConst108 * (fTemp27 + (fConst107 * fRec64[0])))) - (fConst104 * ((fConst103 * fRec63[2]) + fTemp26)));
773 fRec69[0] = (fSlow5 + (0.999 * fRec69[1]));
774 double fTemp30 = (fRec69[0] * (fRec63[2] + (fConst104 * (fTemp26 + (fConst103 * fRec63[0])))));
775 double fRec62 = max(fConst1, fabs(fTemp30));
776 int iTemp31 = int((iRec60[1] < 4096));
777 fRec59[0] = ((iTemp31)?max(fRec59[1], fRec62):fRec62);
778 iRec60[0] = ((iTemp31)?(1 + iRec60[1]):1);
779 fRec61[0] = ((iTemp31)?fRec61[1]:fRec59[1]);
780 fbargraph5 = fRec61[0];
781 double fTemp32 = (fConst4 * fRec74[1]);
782 double fTemp33 = (fConst12 * fRec75[1]);
783 double fTemp34 = (fConst21 * fRec76[1]);
784 double fTemp35 = (fConst30 * fRec77[1]);
785 double fTemp36 = (fConst39 * fRec78[1]);
786 fRec80[0] = ((fConst95 * ((fConst121 * fVec4[1]) + (fConst49 * fVec4[0]))) + (fConst54 * fRec80[1]));
787 fRec79[0] = (fRec80[0] - (fConst52 * ((fConst50 * fRec79[2]) + (fConst48 * fRec79[1]))));
788 fRec78[0] = ((fConst52 * (((fConst47 * fRec79[0]) + (fConst122 * fRec79[1])) + (fConst47 * fRec79[2]))) - (fConst120 * ((fConst119 * fRec78[2]) + fTemp36)));
789 fRec77[0] = ((fRec78[2] + (fConst120 * (fTemp36 + (fConst119 * fRec78[0])))) - (fConst116 * ((fConst115 * fRec77[2]) + fTemp35)));
790 fRec76[0] = ((fRec77[2] + (fConst116 * (fTemp35 + (fConst115 * fRec77[0])))) - (fConst112 * ((fConst111 * fRec76[2]) + fTemp34)));
791 fRec75[0] = ((fRec76[2] + (fConst112 * (fTemp34 + (fConst111 * fRec76[0])))) - (fConst108 * ((fConst107 * fRec75[2]) + fTemp33)));
792 fRec74[0] = ((fRec75[2] + (fConst108 * (fTemp33 + (fConst107 * fRec75[0])))) - (fConst104 * ((fConst103 * fRec74[2]) + fTemp32)));
793 fRec81[0] = (fSlow6 + (0.999 * fRec81[1]));
794 double fTemp37 = (fRec81[0] * (fRec74[2] + (fConst104 * (fTemp32 + (fConst103 * fRec74[0])))));
795 double fRec73 = max(fConst1, fabs(fTemp37));
796 int iTemp38 = int((iRec71[1] < 4096));
797 fRec70[0] = ((iTemp38)?max(fRec70[1], fRec73):fRec73);
798 iRec71[0] = ((iTemp38)?(1 + iRec71[1]):1);
799 fRec72[0] = ((iTemp38)?fRec72[1]:fRec70[1]);
800 fbargraph6 = fRec72[0];
801 double fTemp39 = (fConst4 * fRec86[1]);
802 double fTemp40 = (fConst12 * fRec87[1]);
803 double fTemp41 = (fConst21 * fRec88[1]);
804 double fTemp42 = (fConst30 * fRec89[1]);
805 double fTemp43 = (fConst39 * fRec90[1]);
806 double fTemp44 = (fConst48 * fRec91[1]);
807 fRec93[0] = ((fConst94 * ((fConst125 * fVec3[1]) + (fConst58 * fVec3[0]))) + (fConst63 * fRec93[1]));
808 fRec92[0] = (fRec93[0] - (fConst61 * ((fConst59 * fRec92[2]) + (fConst57 * fRec92[1]))));
809 fRec91[0] = ((fConst61 * (((fConst56 * fRec92[0]) + (fConst126 * fRec92[1])) + (fConst56 * fRec92[2]))) - (fConst124 * ((fConst123 * fRec91[2]) + fTemp44)));
810 fRec90[0] = ((fRec91[2] + (fConst124 * (fTemp44 + (fConst123 * fRec91[0])))) - (fConst120 * ((fConst119 * fRec90[2]) + fTemp43)));
811 fRec89[0] = ((fRec90[2] + (fConst120 * (fTemp43 + (fConst119 * fRec90[0])))) - (fConst116 * ((fConst115 * fRec89[2]) + fTemp42)));
812 fRec88[0] = ((fRec89[2] + (fConst116 * (fTemp42 + (fConst115 * fRec89[0])))) - (fConst112 * ((fConst111 * fRec88[2]) + fTemp41)));
813 fRec87[0] = ((fRec88[2] + (fConst112 * (fTemp41 + (fConst111 * fRec88[0])))) - (fConst108 * ((fConst107 * fRec87[2]) + fTemp40)));
814 fRec86[0] = ((fRec87[2] + (fConst108 * (fTemp40 + (fConst107 * fRec87[0])))) - (fConst104 * ((fConst103 * fRec86[2]) + fTemp39)));
815 fRec94[0] = (fSlow7 + (0.999 * fRec94[1]));
816 double fTemp45 = (fRec94[0] * (fRec86[2] + (fConst104 * (fTemp39 + (fConst103 * fRec86[0])))));
817 double fRec85 = max(fConst1, fabs(fTemp45));
818 int iTemp46 = int((iRec83[1] < 4096));
819 fRec82[0] = ((iTemp46)?max(fRec82[1], fRec85):fRec85);
820 iRec83[0] = ((iTemp46)?(1 + iRec83[1]):1);
821 fRec84[0] = ((iTemp46)?fRec84[1]:fRec82[1]);
822 fbargraph7 = fRec84[0];
823 double fTemp47 = (fConst4 * fRec99[1]);
824 double fTemp48 = (fConst12 * fRec100[1]);
825 double fTemp49 = (fConst21 * fRec101[1]);
826 double fTemp50 = (fConst30 * fRec102[1]);
827 double fTemp51 = (fConst39 * fRec103[1]);
828 double fTemp52 = (fConst48 * fRec104[1]);
829 double fTemp53 = (fConst57 * fRec105[1]);
830 fRec107[0] = ((fConst93 * ((fConst129 * fVec2[1]) + (fConst67 * fVec2[0]))) + (fConst72 * fRec107[1]));
831 fRec106[0] = (fRec107[0] - (fConst70 * ((fConst68 * fRec106[2]) + (fConst66 * fRec106[1]))));
832 fRec105[0] = ((fConst70 * (((fConst65 * fRec106[0]) + (fConst130 * fRec106[1])) + (fConst65 * fRec106[2]))) - (fConst128 * ((fConst127 * fRec105[2]) + fTemp53)));
833 fRec104[0] = ((fRec105[2] + (fConst128 * (fTemp53 + (fConst127 * fRec105[0])))) - (fConst124 * ((fConst123 * fRec104[2]) + fTemp52)));
834 fRec103[0] = ((fRec104[2] + (fConst124 * (fTemp52 + (fConst123 * fRec104[0])))) - (fConst120 * ((fConst119 * fRec103[2]) + fTemp51)));
835 fRec102[0] = ((fRec103[2] + (fConst120 * (fTemp51 + (fConst119 * fRec103[0])))) - (fConst116 * ((fConst115 * fRec102[2]) + fTemp50)));
836 fRec101[0] = ((fRec102[2] + (fConst116 * (fTemp50 + (fConst115 * fRec102[0])))) - (fConst112 * ((fConst111 * fRec101[2]) + fTemp49)));
837 fRec100[0] = ((fRec101[2] + (fConst112 * (fTemp49 + (fConst111 * fRec101[0])))) - (fConst108 * ((fConst107 * fRec100[2]) + fTemp48)));
838 fRec99[0] = ((fRec100[2] + (fConst108 * (fTemp48 + (fConst107 * fRec100[0])))) - (fConst104 * ((fConst103 * fRec99[2]) + fTemp47)));
839 fRec108[0] = (fSlow8 + (0.999 * fRec108[1]));
840 double fTemp54 = (fRec108[0] * (fRec99[2] + (fConst104 * (fTemp47 + (fConst103 * fRec99[0])))));
841 double fRec98 = max(fConst1, fabs(fTemp54));
842 int iTemp55 = int((iRec96[1] < 4096));
843 fRec95[0] = ((iTemp55)?max(fRec95[1], fRec98):fRec98);
844 iRec96[0] = ((iTemp55)?(1 + iRec96[1]):1);
845 fRec97[0] = ((iTemp55)?fRec97[1]:fRec95[1]);
846 fbargraph8 = fRec97[0];
847 double fTemp56 = (fConst4 * fRec113[1]);
848 double fTemp57 = (fConst12 * fRec114[1]);
849 double fTemp58 = (fConst21 * fRec115[1]);
850 double fTemp59 = (fConst30 * fRec116[1]);
851 double fTemp60 = (fConst39 * fRec117[1]);
852 double fTemp61 = (fConst48 * fRec118[1]);
853 double fTemp62 = (fConst57 * fRec119[1]);
854 double fTemp63 = (fConst66 * fRec120[1]);
855 fRec122[0] = ((fConst92 * ((fConst133 * fVec1[1]) + (fConst76 * fVec1[0]))) + (fConst81 * fRec122[1]));
856 fRec121[0] = (fRec122[0] - (fConst79 * ((fConst77 * fRec121[2]) + (fConst75 * fRec121[1]))));
857 fRec120[0] = ((fConst79 * (((fConst74 * fRec121[0]) + (fConst134 * fRec121[1])) + (fConst74 * fRec121[2]))) - (fConst132 * ((fConst131 * fRec120[2]) + fTemp63)));
858 fRec119[0] = ((fRec120[2] + (fConst132 * (fTemp63 + (fConst131 * fRec120[0])))) - (fConst128 * ((fConst127 * fRec119[2]) + fTemp62)));
859 fRec118[0] = ((fRec119[2] + (fConst128 * (fTemp62 + (fConst127 * fRec119[0])))) - (fConst124 * ((fConst123 * fRec118[2]) + fTemp61)));
860 fRec117[0] = ((fRec118[2] + (fConst124 * (fTemp61 + (fConst123 * fRec118[0])))) - (fConst120 * ((fConst119 * fRec117[2]) + fTemp60)));
861 fRec116[0] = ((fRec117[2] + (fConst120 * (fTemp60 + (fConst119 * fRec117[0])))) - (fConst116 * ((fConst115 * fRec116[2]) + fTemp59)));
862 fRec115[0] = ((fRec116[2] + (fConst116 * (fTemp59 + (fConst115 * fRec116[0])))) - (fConst112 * ((fConst111 * fRec115[2]) + fTemp58)));
863 fRec114[0] = ((fRec115[2] + (fConst112 * (fTemp58 + (fConst111 * fRec115[0])))) - (fConst108 * ((fConst107 * fRec114[2]) + fTemp57)));
864 fRec113[0] = ((fRec114[2] + (fConst108 * (fTemp57 + (fConst107 * fRec114[0])))) - (fConst104 * ((fConst103 * fRec113[2]) + fTemp56)));
865 fRec123[0] = (fSlow9 + (0.999 * fRec123[1]));
866 double fTemp64 = (fRec123[0] * (fRec113[2] + (fConst104 * (fTemp56 + (fConst103 * fRec113[0])))));
867 double fRec112 = max(fConst1, fabs(fTemp64));
868 int iTemp65 = int((iRec110[1] < 4096));
869 fRec109[0] = ((iTemp65)?max(fRec109[1], fRec112):fRec112);
870 iRec110[0] = ((iTemp65)?(1 + iRec110[1]):1);
871 fRec111[0] = ((iTemp65)?fRec111[1]:fRec109[1]);
872 fbargraph9 = fRec111[0];
873 double fTemp66 = (fConst4 * fRec128[1]);
874 double fTemp67 = (fConst12 * fRec129[1]);
875 double fTemp68 = (fConst21 * fRec130[1]);
876 double fTemp69 = (fConst30 * fRec131[1]);
877 double fTemp70 = (fConst39 * fRec132[1]);
878 double fTemp71 = (fConst48 * fRec133[1]);
879 double fTemp72 = (fConst57 * fRec134[1]);
880 double fTemp73 = (fConst66 * fRec135[1]);
881 double fTemp74 = (fConst75 * fRec136[1]);
882 fRec138[0] = ((fConst91 * ((fConst137 * fVec0[1]) + (fConst85 * fVec0[0]))) + (fConst90 * fRec138[1]));
883 fRec137[0] = (fRec138[0] - (fConst88 * ((fConst86 * fRec137[2]) + (fConst84 * fRec137[1]))));
884 fRec136[0] = ((fConst88 * (((fConst83 * fRec137[0]) + (fConst138 * fRec137[1])) + (fConst83 * fRec137[2]))) - (fConst136 * ((fConst135 * fRec136[2]) + fTemp74)));
885 fRec135[0] = ((fRec136[2] + (fConst136 * (fTemp74 + (fConst135 * fRec136[0])))) - (fConst132 * ((fConst131 * fRec135[2]) + fTemp73)));
886 fRec134[0] = ((fRec135[2] + (fConst132 * (fTemp73 + (fConst131 * fRec135[0])))) - (fConst128 * ((fConst127 * fRec134[2]) + fTemp72)));
887 fRec133[0] = ((fRec134[2] + (fConst128 * (fTemp72 + (fConst127 * fRec134[0])))) - (fConst124 * ((fConst123 * fRec133[2]) + fTemp71)));
888 fRec132[0] = ((fRec133[2] + (fConst124 * (fTemp71 + (fConst123 * fRec133[0])))) - (fConst120 * ((fConst119 * fRec132[2]) + fTemp70)));
889 fRec131[0] = ((fRec132[2] + (fConst120 * (fTemp70 + (fConst119 * fRec132[0])))) - (fConst116 * ((fConst115 * fRec131[2]) + fTemp69)));
890 fRec130[0] = ((fRec131[2] + (fConst116 * (fTemp69 + (fConst115 * fRec131[0])))) - (fConst112 * ((fConst111 * fRec130[2]) + fTemp68)));
891 fRec129[0] = ((fRec130[2] + (fConst112 * (fTemp68 + (fConst111 * fRec130[0])))) - (fConst108 * ((fConst107 * fRec129[2]) + fTemp67)));
892 fRec128[0] = ((fRec129[2] + (fConst108 * (fTemp67 + (fConst107 * fRec129[0])))) - (fConst104 * ((fConst103 * fRec128[2]) + fTemp66)));
893 fRec139[0] = (fSlow10 + (0.999 * fRec139[1]));
894 double fTemp75 = (fRec139[0] * (fRec128[2] + (fConst104 * (fTemp66 + (fConst103 * fRec128[0])))));
895 double fRec127 = max(fConst1, fabs(fTemp75));
896 int iTemp76 = int((iRec125[1] < 4096));
897 fRec124[0] = ((iTemp76)?max(fRec124[1], fRec127):fRec127);
898 iRec125[0] = ((iTemp76)?(1 + iRec125[1]):1);
899 fRec126[0] = ((iTemp76)?fRec126[1]:fRec124[1]);
900 fbargraph10 = fRec126[0];
901 output0[i] = (FAUSTFLOAT)(fTemp75 + (fTemp64 + (fTemp54 + (fTemp45 + (fTemp37 + (fTemp30 + (fTemp24 + (fTemp19 + (fTemp15 + (fTemp12 + fTemp10))))))))));
902 // post processing
903 fRec126[1] = fRec126[0];
904 iRec125[1] = iRec125[0];
905 fRec124[1] = fRec124[0];
906 fRec139[1] = fRec139[0];
907 fRec128[2] = fRec128[1]; fRec128[1] = fRec128[0];
908 fRec129[2] = fRec129[1]; fRec129[1] = fRec129[0];
909 fRec130[2] = fRec130[1]; fRec130[1] = fRec130[0];
910 fRec131[2] = fRec131[1]; fRec131[1] = fRec131[0];
911 fRec132[2] = fRec132[1]; fRec132[1] = fRec132[0];
912 fRec133[2] = fRec133[1]; fRec133[1] = fRec133[0];
913 fRec134[2] = fRec134[1]; fRec134[1] = fRec134[0];
914 fRec135[2] = fRec135[1]; fRec135[1] = fRec135[0];
915 fRec136[2] = fRec136[1]; fRec136[1] = fRec136[0];
916 fRec137[2] = fRec137[1]; fRec137[1] = fRec137[0];
917 fRec138[1] = fRec138[0];
918 fRec111[1] = fRec111[0];
919 iRec110[1] = iRec110[0];
920 fRec109[1] = fRec109[0];
921 fRec123[1] = fRec123[0];
922 fRec113[2] = fRec113[1]; fRec113[1] = fRec113[0];
923 fRec114[2] = fRec114[1]; fRec114[1] = fRec114[0];
924 fRec115[2] = fRec115[1]; fRec115[1] = fRec115[0];
925 fRec116[2] = fRec116[1]; fRec116[1] = fRec116[0];
926 fRec117[2] = fRec117[1]; fRec117[1] = fRec117[0];
927 fRec118[2] = fRec118[1]; fRec118[1] = fRec118[0];
928 fRec119[2] = fRec119[1]; fRec119[1] = fRec119[0];
929 fRec120[2] = fRec120[1]; fRec120[1] = fRec120[0];
930 fRec121[2] = fRec121[1]; fRec121[1] = fRec121[0];
931 fRec122[1] = fRec122[0];
932 fRec97[1] = fRec97[0];
933 iRec96[1] = iRec96[0];
934 fRec95[1] = fRec95[0];
935 fRec108[1] = fRec108[0];
936 fRec99[2] = fRec99[1]; fRec99[1] = fRec99[0];
937 fRec100[2] = fRec100[1]; fRec100[1] = fRec100[0];
938 fRec101[2] = fRec101[1]; fRec101[1] = fRec101[0];
939 fRec102[2] = fRec102[1]; fRec102[1] = fRec102[0];
940 fRec103[2] = fRec103[1]; fRec103[1] = fRec103[0];
941 fRec104[2] = fRec104[1]; fRec104[1] = fRec104[0];
942 fRec105[2] = fRec105[1]; fRec105[1] = fRec105[0];
943 fRec106[2] = fRec106[1]; fRec106[1] = fRec106[0];
944 fRec107[1] = fRec107[0];
945 fRec84[1] = fRec84[0];
946 iRec83[1] = iRec83[0];
947 fRec82[1] = fRec82[0];
948 fRec94[1] = fRec94[0];
949 fRec86[2] = fRec86[1]; fRec86[1] = fRec86[0];
950 fRec87[2] = fRec87[1]; fRec87[1] = fRec87[0];
951 fRec88[2] = fRec88[1]; fRec88[1] = fRec88[0];
952 fRec89[2] = fRec89[1]; fRec89[1] = fRec89[0];
953 fRec90[2] = fRec90[1]; fRec90[1] = fRec90[0];
954 fRec91[2] = fRec91[1]; fRec91[1] = fRec91[0];
955 fRec92[2] = fRec92[1]; fRec92[1] = fRec92[0];
956 fRec93[1] = fRec93[0];
957 fRec72[1] = fRec72[0];
958 iRec71[1] = iRec71[0];
959 fRec70[1] = fRec70[0];
960 fRec81[1] = fRec81[0];
961 fRec74[2] = fRec74[1]; fRec74[1] = fRec74[0];
962 fRec75[2] = fRec75[1]; fRec75[1] = fRec75[0];
963 fRec76[2] = fRec76[1]; fRec76[1] = fRec76[0];
964 fRec77[2] = fRec77[1]; fRec77[1] = fRec77[0];
965 fRec78[2] = fRec78[1]; fRec78[1] = fRec78[0];
966 fRec79[2] = fRec79[1]; fRec79[1] = fRec79[0];
967 fRec80[1] = fRec80[0];
968 fRec61[1] = fRec61[0];
969 iRec60[1] = iRec60[0];
970 fRec59[1] = fRec59[0];
971 fRec69[1] = fRec69[0];
972 fRec63[2] = fRec63[1]; fRec63[1] = fRec63[0];
973 fRec64[2] = fRec64[1]; fRec64[1] = fRec64[0];
974 fRec65[2] = fRec65[1]; fRec65[1] = fRec65[0];
975 fRec66[2] = fRec66[1]; fRec66[1] = fRec66[0];
976 fRec67[2] = fRec67[1]; fRec67[1] = fRec67[0];
977 fRec68[1] = fRec68[0];
978 fRec51[1] = fRec51[0];
979 iRec50[1] = iRec50[0];
980 fRec49[1] = fRec49[0];
981 fRec58[1] = fRec58[0];
982 fRec53[2] = fRec53[1]; fRec53[1] = fRec53[0];
983 fRec54[2] = fRec54[1]; fRec54[1] = fRec54[0];
984 fRec55[2] = fRec55[1]; fRec55[1] = fRec55[0];
985 fRec56[2] = fRec56[1]; fRec56[1] = fRec56[0];
986 fRec57[1] = fRec57[0];
987 fRec42[1] = fRec42[0];
988 iRec41[1] = iRec41[0];
989 fRec40[1] = fRec40[0];
990 fRec48[1] = fRec48[0];
991 fRec44[2] = fRec44[1]; fRec44[1] = fRec44[0];
992 fRec45[2] = fRec45[1]; fRec45[1] = fRec45[0];
993 fRec46[2] = fRec46[1]; fRec46[1] = fRec46[0];
994 fRec47[1] = fRec47[0];
995 fRec34[1] = fRec34[0];
996 iRec33[1] = iRec33[0];
997 fRec32[1] = fRec32[0];
998 fRec39[1] = fRec39[0];
999 fRec36[2] = fRec36[1]; fRec36[1] = fRec36[0];
1000 fRec37[2] = fRec37[1]; fRec37[1] = fRec37[0];
1001 fRec38[1] = fRec38[0];
1002 fRec27[1] = fRec27[0];
1003 iRec26[1] = iRec26[0];
1004 fRec25[1] = fRec25[0];
1005 fRec31[1] = fRec31[0];
1006 fRec29[2] = fRec29[1]; fRec29[1] = fRec29[0];
1007 fRec30[1] = fRec30[0];
1008 fRec2[1] = fRec2[0];
1009 iRec1[1] = iRec1[0];
1010 fRec0[1] = fRec0[0];
1011 fRec24[1] = fRec24[0];
1012 fRec4[2] = fRec4[1]; fRec4[1] = fRec4[0];
1013 fRec5[1] = fRec5[0];
1014 fVec9[1] = fVec9[0];
1015 fRec6[2] = fRec6[1]; fRec6[1] = fRec6[0];
1016 fRec7[1] = fRec7[0];
1017 fVec8[1] = fVec8[0];
1018 fRec8[2] = fRec8[1]; fRec8[1] = fRec8[0];
1019 fRec9[1] = fRec9[0];
1020 fVec7[1] = fVec7[0];
1021 fRec10[2] = fRec10[1]; fRec10[1] = fRec10[0];
1022 fRec11[1] = fRec11[0];
1023 fVec6[1] = fVec6[0];
1024 fRec12[2] = fRec12[1]; fRec12[1] = fRec12[0];
1025 fRec13[1] = fRec13[0];
1026 fVec5[1] = fVec5[0];
1027 fRec14[2] = fRec14[1]; fRec14[1] = fRec14[0];
1028 fRec15[1] = fRec15[0];
1029 fVec4[1] = fVec4[0];
1030 fRec16[2] = fRec16[1]; fRec16[1] = fRec16[0];
1031 fRec17[1] = fRec17[0];
1032 fVec3[1] = fVec3[0];
1033 fRec18[2] = fRec18[1]; fRec18[1] = fRec18[0];
1034 fRec19[1] = fRec19[0];
1035 fVec2[1] = fVec2[0];
1036 fRec20[2] = fRec20[1]; fRec20[1] = fRec20[0];
1037 fRec21[1] = fRec21[0];
1038 fVec1[1] = fVec1[0];
1039 fRec22[2] = fRec22[1]; fRec22[1] = fRec22[0];
1040 fRec23[1] = fRec23[0];
1041 fVec0[1] = fVec0[0];
1042 }
1043 }
1044
1045 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
1046 {
1047 static_cast<Dsp*>(p)->compute(count, input0, output0);
1048 }
1049
1050 int Dsp::register_par(const ParamReg& reg)
1051 {
1052 reg.registerVar("graphiceq.g10","","S",N_("gain (dB) at 16 kHz"),&fslider9, 0.0, -3e+01, 2e+01, 0.1);
1053 reg.registerVar("graphiceq.g11","","S",N_("gain (dB) above 16 kHz"),&fslider10, 0.0, -3e+01, 2e+01, 0.1);
1054 reg.registerVar("graphiceq.g1","","S",N_("gain (dB) below 31.25 Hz"),&fslider1, 0.0, -6e+01, 2e+01, 0.1);
1055 reg.registerVar("graphiceq.g2","","S",N_("gain (dB) at 62.5 Hz"),&fslider0, 0.0, -3e+01, 2e+01, 0.1);
1056 reg.registerVar("graphiceq.g3","","S",N_("gain (dB) at 125 Hz"),&fslider2, 0.0, -3e+01, 2e+01, 0.1);
1057 reg.registerVar("graphiceq.g4","","S",N_("gain (dB) at 250 Hz"),&fslider3, 0.0, -3e+01, 2e+01, 0.1);
1058 reg.registerVar("graphiceq.g5","","S",N_("gain (dB) at 500 Hz"),&fslider4, 0.0, -3e+01, 2e+01, 0.1);
1059 reg.registerVar("graphiceq.g6","","S",N_("gain (dB) at 1 kHz"),&fslider5, 0.0, -3e+01, 2e+01, 0.1);
1060 reg.registerVar("graphiceq.g7","","S",N_("gain (dB) at 2 kHz"),&fslider6, 0.0, -3e+01, 2e+01, 0.1);
1061 reg.registerVar("graphiceq.g8","","S",N_("gain (dB) at 4 kHz"),&fslider7, 0.0, -3e+01, 2e+01, 0.1);
1062 reg.registerVar("graphiceq.g9","","S",N_("gain (dB) at 8 kHz"),&fslider8, 0.0, -3e+01, 2e+01, 0.1);
1063 reg.registerNonMidiFloatVar("graphiceq.v10",&fbargraph9, false, true, -70.0, -70.0, 4.0, 0.00001);
1064 reg.registerNonMidiFloatVar("graphiceq.v11",&fbargraph10, false, true, -70.0, -70.0, 4.0, 0.00001);
1065 reg.registerNonMidiFloatVar("graphiceq.v1",&fbargraph1, false, true, -70.0, -70.0, 4.0, 0.00001);
1066 reg.registerNonMidiFloatVar("graphiceq.v2",&fbargraph0, false, true, -70.0, -70.0, 4.0, 0.00001);
1067 reg.registerNonMidiFloatVar("graphiceq.v3",&fbargraph2, false, true, -70.0, -70.0, 4.0, 0.00001);
1068 reg.registerNonMidiFloatVar("graphiceq.v4",&fbargraph3, false, true, -70.0, -70.0, 4.0, 0.00001);
1069 reg.registerNonMidiFloatVar("graphiceq.v5",&fbargraph4, false, true, -70.0, -70.0, 4.0, 0.00001);
1070 reg.registerNonMidiFloatVar("graphiceq.v6",&fbargraph5, false, true, -70.0, -70.0, 4.0, 0.00001);
1071 reg.registerNonMidiFloatVar("graphiceq.v7",&fbargraph6, false, true, -70.0, -70.0, 4.0, 0.00001);
1072 reg.registerNonMidiFloatVar("graphiceq.v8",&fbargraph7, false, true, -70.0, -70.0, 4.0, 0.00001);
1073 reg.registerNonMidiFloatVar("graphiceq.v9",&fbargraph8, false, true, -70.0, -70.0, 4.0, 0.00001);
1074 return 0;
1075 }
1076
1077 int Dsp::register_params_static(const ParamReg& reg)
1078 {
1079 return static_cast<Dsp*>(reg.plugin)->register_par(reg);
1080 }
1081
1082 inline int Dsp::load_ui_f(const UiBuilder& b, int form)
1083 {
1084 if (form & UI_FORM_STACK) {
1085 #define PARAM(p) ("graphiceq" "." p)
1086 // ----- graphiceq
1087 b.openHorizontalhideBox("");
1088 b.closeBox();
1089 b.openHorizontalBox("");
1090 {
1091 b.openFrameBox("");
1092 b.closeBox();
1093 b.openHorizontalBox("");
1094 {
1095 b.create_simple_c_meter(PARAM("v1"), PARAM("g1"),"<31");
1096 }
1097 b.closeBox();
1098 b.openHorizontalBox("");
1099 {
1100 b.create_simple_c_meter(PARAM("v2"), PARAM("g2"),"62");
1101 }
1102 b.closeBox();
1103 b.openHorizontalBox("");
1104 {
1105 b.create_simple_c_meter(PARAM("v3"), PARAM("g3"),"125");
1106 }
1107 b.closeBox();
1108 b.openHorizontalBox("");
1109 {
1110 b.create_simple_c_meter(PARAM("v4"), PARAM("g4"),"250");
1111 }
1112 b.closeBox();
1113 b.openHorizontalBox("");
1114 {
1115 b.create_simple_c_meter(PARAM("v5"), PARAM("g5"),"500");
1116 }
1117 b.closeBox();
1118 b.openHorizontalBox("");
1119 {
1120 b.create_simple_c_meter(PARAM("v6"), PARAM("g6"),"1k");
1121 }
1122 b.closeBox();
1123 b.openHorizontalBox("");
1124 {
1125 b.create_simple_c_meter(PARAM("v7"), PARAM("g7"),"2k");
1126 }
1127 b.closeBox();
1128 b.openHorizontalBox("");
1129 {
1130 b.create_simple_c_meter(PARAM("v8"), PARAM("g8"),"4k");
1131 }
1132 b.closeBox();
1133 b.openHorizontalBox("");
1134 {
1135 b.create_simple_c_meter(PARAM("v9"), PARAM("g9"),"8k");
1136 }
1137 b.closeBox();
1138 b.openHorizontalBox("");
1139 {
1140 b.create_simple_c_meter(PARAM("v10"), PARAM("g10"),"16k");
1141 }
1142 b.closeBox();
1143 b.openHorizontalBox("");
1144 {
1145 b.create_simple_c_meter(PARAM("v11"), PARAM("g11"),"<");
1146 }
1147 b.closeBox();
1148 b.openFrameBox("");
1149 b.closeBox();
1150 }
1151 b.closeBox();
1152
1153 #undef PARAM
1154 return 0;
1155 }
1156 return -1;
1157 }
1158
1159 int Dsp::load_ui_f_static(const UiBuilder& b, int form)
1160 {
1161 return static_cast<Dsp*>(b.plugin)->load_ui_f(b, form);
1162 }
1163 PluginDef *plugin() {
1164 return new Dsp();
1165 }
1166
1167 void Dsp::del_instance(PluginDef *p)
1168 {
1169 delete static_cast<Dsp*>(p);
1170 }
1171
1172 } // end namespace graphiceq
6767 void clear_state_f();
6868 int load_ui_f(const UiBuilder& b, int form);
6969 void init(unsigned int samplingFreq);
70 void compute(int count, float *input0, float *input1, float *output0, float *output1);
70 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
7171 int register_par(const ParamReg& reg);
7272
7373 static void clear_state_f_static(PluginDef*);
7474 static int load_ui_f_static(const UiBuilder& b, int form);
7575 static void init_static(unsigned int samplingFreq, PluginDef*);
76 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
76 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
7777 static int register_params_static(const ParamReg& reg);
7878 static void del_instance(PluginDef *p);
7979 public:
183183 static_cast<Dsp*>(p)->init(samplingFreq);
184184 }
185185
186 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
186 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
187187 {
188188 double fSlow0 = fslider0;
189189 double fSlow1 = fslider1;
260260 }
261261 }
262262
263 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *p)
263 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
264264 {
265265 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
266266 }
1010 double fRec0[2];
1111 void clear_state_f();
1212 void init(unsigned int samplingFreq);
13 void compute(int count, float *input0, float *output0);
13 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1414 int register_par(const ParamReg& reg);
1515
1616 static void clear_state_f_static(PluginDef*);
1717 static void init_static(unsigned int samplingFreq, PluginDef*);
18 static void compute_static(int count, float *input0, float *output0, PluginDef*);
18 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
1919 static int register_params_static(const ParamReg& reg);
2020 static void del_instance(PluginDef *p);
2121 public:
6969 static_cast<Dsp*>(p)->init(samplingFreq);
7070 }
7171
72 void always_inline Dsp::compute(int count, float *input0, float *output0)
72 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7373 {
7474 double fSlow0 = (0.0010000000000000009 * pow(10,(0.05 * fslider0)));
7575 for (int i=0; i<count; i++) {
8080 }
8181 }
8282
83 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
83 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
8484 {
8585 static_cast<Dsp*>(p)->compute(count, input0, output0);
8686 }
1212 double fRec0[2];
1313 void clear_state_f();
1414 void init(unsigned int samplingFreq);
15 void compute(int count, float *input0, float *output0);
15 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1616 int register_par(const ParamReg& reg);
1717
1818 static void clear_state_f_static(PluginDef*);
1919 static void init_static(unsigned int samplingFreq, PluginDef*);
20 static void compute_static(int count, float *input0, float *output0, PluginDef*);
20 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2121 static int register_params_static(const ParamReg& reg);
2222 static void del_instance(PluginDef *p);
2323 public:
7676 static_cast<Dsp*>(p)->init(samplingFreq);
7777 }
7878
79 void always_inline Dsp::compute(int count, float *input0, float *output0)
79 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8080 {
8181 double fSlow0 = fslider0;
8282 double fSlow1 = (0.0010000000000000009 * pow(10,(0.05 * ((int(fcheckbox0))?(fSlow0 + fslider1):fSlow0))));
8888 }
8989 }
9090
91 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
91 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
9292 {
9393 static_cast<Dsp*>(p)->compute(count, input0, output0);
9494 }
7676 void clear_state_f();
7777 int load_ui_f(const UiBuilder& b, int form);
7878 void init(unsigned int samplingFreq);
79 void compute(int count, float *input0, float *output0);
79 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
8080 int register_par(const ParamReg& reg);
8181
8282 static void clear_state_f_static(PluginDef*);
8383 static int load_ui_f_static(const UiBuilder& b, int form);
8484 static void init_static(unsigned int samplingFreq, PluginDef*);
85 static void compute_static(int count, float *input0, float *output0, PluginDef*);
85 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
8686 static int register_params_static(const ParamReg& reg);
8787 static void del_instance(PluginDef *p);
8888 public:
189189 static_cast<Dsp*>(p)->init(samplingFreq);
190190 }
191191
192 void always_inline Dsp::compute(int count, float *input0, float *output0)
192 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
193193 {
194194 double fSlow0 = (0.01 * fslider0);
195195 double fSlow1 = (1 - fSlow0);
335335 }
336336 }
337337
338 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
338 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
339339 {
340340 static_cast<Dsp*>(p)->compute(count, input0, output0);
341341 }
1212 void clear_state_f();
1313 int load_ui_f(const UiBuilder& b, int form);
1414 void init(unsigned int samplingFreq);
15 void compute(int count, float *input0, float *output0);
15 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1616 int register_par(const ParamReg& reg);
1717
1818 static void clear_state_f_static(PluginDef*);
1919 static int load_ui_f_static(const UiBuilder& b, int form);
2020 static void init_static(unsigned int samplingFreq, PluginDef*);
21 static void compute_static(int count, float *input0, float *output0, PluginDef*);
21 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2222 static int register_params_static(const ParamReg& reg);
2323 static void del_instance(PluginDef *p);
2424 public:
7272 static_cast<Dsp*>(p)->init(samplingFreq);
7373 }
7474
75 void always_inline Dsp::compute(int count, float *input0, float *output0)
75 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7676 {
7777 double fSlow0 = (0.01 * fslider0);
7878 double fSlow1 = (1 - fSlow0);
8686 }
8787 }
8888
89 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
89 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
9090 {
9191 static_cast<Dsp*>(p)->compute(count, input0, output0);
9292 }
1010 double fRec0[2];
1111 void clear_state_f();
1212 void init(unsigned int samplingFreq);
13 void compute(int count, float *input0, float *input1, float *output0, float *output1);
13 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
1414 int register_par(const ParamReg& reg);
1515
1616 static void clear_state_f_static(PluginDef*);
1717 static void init_static(unsigned int samplingFreq, PluginDef*);
18 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
18 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
1919 static int register_params_static(const ParamReg& reg);
2020 static void del_instance(PluginDef *p);
2121 public:
6969 static_cast<Dsp*>(p)->init(samplingFreq);
7070 }
7171
72 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
72 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
7373 {
7474 double fSlow0 = (0.0010000000000000009 * pow(10,(0.05 * fslider0)));
7575 for (int i=0; i<count; i++) {
8181 }
8282 }
8383
84 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *p)
84 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
8585 {
8686 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
8787 }
1111 double fRec0[2];
1212 void clear_state_f();
1313 void init(unsigned int samplingFreq);
14 void compute(int count, float *input0, float *input1, float *output0, float *output1);
14 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
1515 int register_par(const ParamReg& reg);
1616
1717 static void clear_state_f_static(PluginDef*);
1818 static void init_static(unsigned int samplingFreq, PluginDef*);
19 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
19 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
2020 static int register_params_static(const ParamReg& reg);
2121 static void del_instance(PluginDef *p);
2222 public:
7575 static_cast<Dsp*>(p)->init(samplingFreq);
7676 }
7777
78 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
78 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
7979 {
8080 double fSlow0 = (0.0010000000000000009 * pow(10,(0.05 * (fslider1 + fslider0))));
8181 for (int i=0; i<count; i++) {
8787 }
8888 }
8989
90 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *p)
90 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
9191 {
9292 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
9393 }
123123 double fRec1[2];
124124 void clear_state_f();
125125 void init(unsigned int samplingFreq);
126 void compute(int count, float *input0, float *output0);
126 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
127127 int register_par(const ParamReg& reg);
128128
129129 static void clear_state_f_static(PluginDef*);
130130 static void init_static(unsigned int samplingFreq, PluginDef*);
131 static void compute_static(int count, float *input0, float *output0, PluginDef*);
131 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
132132 static int register_params_static(const ParamReg& reg);
133133 static void del_instance(PluginDef *p);
134134 public:
287287 static_cast<Dsp*>(p)->init(samplingFreq);
288288 }
289289
290 void always_inline Dsp::compute(int count, float *input0, float *output0)
290 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
291291 {
292292 #define fslider0 (*fslider0_)
293293 #define fslider1 (*fslider1_)
406406 #undef fslider3
407407 }
408408
409 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
409 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
410410 {
411411 static_cast<Dsp*>(p)->compute(count, input0, output0);
412412 }
126126 double fRec32[2];
127127 void clear_state_f();
128128 void init(unsigned int samplingFreq);
129 void compute(int count, float *input0, float *output0);
129 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
130130 int register_par(const ParamReg& reg);
131131
132132 static void clear_state_f_static(PluginDef*);
133133 static void init_static(unsigned int samplingFreq, PluginDef*);
134 static void compute_static(int count, float *input0, float *output0, PluginDef*);
134 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
135135 static int register_params_static(const ParamReg& reg);
136136 static void del_instance(PluginDef *p);
137137 public:
293293 static_cast<Dsp*>(p)->init(samplingFreq);
294294 }
295295
296 void always_inline Dsp::compute(int count, float *input0, float *output0)
296 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
297297 {
298298 #define fslider0 (*fslider0_)
299299 #define fslider1 (*fslider1_)
418418 #undef fslider3
419419 }
420420
421 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
421 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
422422 {
423423 static_cast<Dsp*>(p)->compute(count, input0, output0);
424424 }
137137 double fRec1[2];
138138 void clear_state_f();
139139 void init(unsigned int samplingFreq);
140 void compute(int count, float *input0, float *output0);
140 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
141141 int register_par(const ParamReg& reg);
142142
143143 static void clear_state_f_static(PluginDef*);
144144 static void init_static(unsigned int samplingFreq, PluginDef*);
145 static void compute_static(int count, float *input0, float *output0, PluginDef*);
145 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
146146 static int register_params_static(const ParamReg& reg);
147147 static void del_instance(PluginDef *p);
148148 public:
315315 static_cast<Dsp*>(p)->init(samplingFreq);
316316 }
317317
318 void always_inline Dsp::compute(int count, float *input0, float *output0)
318 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
319319 {
320320 #define fslider0 (*fslider0_)
321321 #define fslider1 (*fslider1_)
470470 #undef fslider3
471471 }
472472
473 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
473 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
474474 {
475475 static_cast<Dsp*>(p)->compute(count, input0, output0);
476476 }
130130 double fRec35[2];
131131 void clear_state_f();
132132 void init(unsigned int samplingFreq);
133 void compute(int count, float *input0, float *output0);
133 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
134134 int register_par(const ParamReg& reg);
135135
136136 static void clear_state_f_static(PluginDef*);
137137 static void init_static(unsigned int samplingFreq, PluginDef*);
138 static void compute_static(int count, float *input0, float *output0, PluginDef*);
138 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
139139 static int register_params_static(const ParamReg& reg);
140140 static void del_instance(PluginDef *p);
141141 public:
301301 static_cast<Dsp*>(p)->init(samplingFreq);
302302 }
303303
304 void always_inline Dsp::compute(int count, float *input0, float *output0)
304 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
305305 {
306306 #define fslider0 (*fslider0_)
307307 #define fslider1 (*fslider1_)
429429 #undef fslider3
430430 }
431431
432 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
432 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
433433 {
434434 static_cast<Dsp*>(p)->compute(count, input0, output0);
435435 }
137137 double fRec1[2];
138138 void clear_state_f();
139139 void init(unsigned int samplingFreq);
140 void compute(int count, float *input0, float *output0);
140 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
141141 int register_par(const ParamReg& reg);
142142
143143 static void clear_state_f_static(PluginDef*);
144144 static void init_static(unsigned int samplingFreq, PluginDef*);
145 static void compute_static(int count, float *input0, float *output0, PluginDef*);
145 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
146146 static int register_params_static(const ParamReg& reg);
147147 static void del_instance(PluginDef *p);
148148 public:
315315 static_cast<Dsp*>(p)->init(samplingFreq);
316316 }
317317
318 void always_inline Dsp::compute(int count, float *input0, float *output0)
318 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
319319 {
320320 #define fslider0 (*fslider0_)
321321 #define fslider1 (*fslider1_)
470470 #undef fslider3
471471 }
472472
473 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
473 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
474474 {
475475 static_cast<Dsp*>(p)->compute(count, input0, output0);
476476 }
123123 double fRec1[2];
124124 void clear_state_f();
125125 void init(unsigned int samplingFreq);
126 void compute(int count, float *input0, float *output0);
126 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
127127 int register_par(const ParamReg& reg);
128128
129129 static void clear_state_f_static(PluginDef*);
130130 static void init_static(unsigned int samplingFreq, PluginDef*);
131 static void compute_static(int count, float *input0, float *output0, PluginDef*);
131 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
132132 static int register_params_static(const ParamReg& reg);
133133 static void del_instance(PluginDef *p);
134134 public:
287287 static_cast<Dsp*>(p)->init(samplingFreq);
288288 }
289289
290 void always_inline Dsp::compute(int count, float *input0, float *output0)
290 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
291291 {
292292 #define fslider0 (*fslider0_)
293293 #define fslider1 (*fslider1_)
406406 #undef fslider3
407407 }
408408
409 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
409 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
410410 {
411411 static_cast<Dsp*>(p)->compute(count, input0, output0);
412412 }
129129 double fRec35[2];
130130 void clear_state_f();
131131 void init(unsigned int samplingFreq);
132 void compute(int count, float *input0, float *output0);
132 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
133133 int register_par(const ParamReg& reg);
134134
135135 static void clear_state_f_static(PluginDef*);
136136 static void init_static(unsigned int samplingFreq, PluginDef*);
137 static void compute_static(int count, float *input0, float *output0, PluginDef*);
137 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
138138 static int register_params_static(const ParamReg& reg);
139139 static void del_instance(PluginDef *p);
140140 public:
299299 static_cast<Dsp*>(p)->init(samplingFreq);
300300 }
301301
302 void always_inline Dsp::compute(int count, float *input0, float *output0)
302 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
303303 {
304304 #define fslider0 (*fslider0_)
305305 #define fslider1 (*fslider1_)
427427 #undef fslider3
428428 }
429429
430 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
430 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
431431 {
432432 static_cast<Dsp*>(p)->compute(count, input0, output0);
433433 }
163163 double fRec0[2];
164164 void clear_state_f();
165165 void init(unsigned int samplingFreq);
166 void compute(int count, float *input0, float *output0);
166 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
167167 int register_par(const ParamReg& reg);
168168
169169 static void clear_state_f_static(PluginDef*);
170170 static void init_static(unsigned int samplingFreq, PluginDef*);
171 static void compute_static(int count, float *input0, float *output0, PluginDef*);
171 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
172172 static int register_params_static(const ParamReg& reg);
173173 static void del_instance(PluginDef *p);
174174 public:
367367 static_cast<Dsp*>(p)->init(samplingFreq);
368368 }
369369
370 void always_inline Dsp::compute(int count, float *input0, float *output0)
370 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
371371 {
372372 #define fslider0 (*fslider0_)
373373 #define fslider1 (*fslider1_)
560560 #undef fslider3
561561 }
562562
563 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
563 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
564564 {
565565 static_cast<Dsp*>(p)->compute(count, input0, output0);
566566 }
137137 double fRec1[2];
138138 void clear_state_f();
139139 void init(unsigned int samplingFreq);
140 void compute(int count, float *input0, float *output0);
140 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
141141 int register_par(const ParamReg& reg);
142142
143143 static void clear_state_f_static(PluginDef*);
144144 static void init_static(unsigned int samplingFreq, PluginDef*);
145 static void compute_static(int count, float *input0, float *output0, PluginDef*);
145 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
146146 static int register_params_static(const ParamReg& reg);
147147 static void del_instance(PluginDef *p);
148148 public:
315315 static_cast<Dsp*>(p)->init(samplingFreq);
316316 }
317317
318 void always_inline Dsp::compute(int count, float *input0, float *output0)
318 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
319319 {
320320 #define fslider0 (*fslider0_)
321321 #define fslider1 (*fslider1_)
470470 #undef fslider3
471471 }
472472
473 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
473 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
474474 {
475475 static_cast<Dsp*>(p)->compute(count, input0, output0);
476476 }
123123 double fRec1[2];
124124 void clear_state_f();
125125 void init(unsigned int samplingFreq);
126 void compute(int count, float *input0, float *output0);
126 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
127127 int register_par(const ParamReg& reg);
128128
129129 static void clear_state_f_static(PluginDef*);
130130 static void init_static(unsigned int samplingFreq, PluginDef*);
131 static void compute_static(int count, float *input0, float *output0, PluginDef*);
131 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
132132 static int register_params_static(const ParamReg& reg);
133133 static void del_instance(PluginDef *p);
134134 public:
287287 static_cast<Dsp*>(p)->init(samplingFreq);
288288 }
289289
290 void always_inline Dsp::compute(int count, float *input0, float *output0)
290 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
291291 {
292292 #define fslider0 (*fslider0_)
293293 #define fslider1 (*fslider1_)
406406 #undef fslider3
407407 }
408408
409 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
409 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
410410 {
411411 static_cast<Dsp*>(p)->compute(count, input0, output0);
412412 }
125125 double fRec0[2];
126126 void clear_state_f();
127127 void init(unsigned int samplingFreq);
128 void compute(int count, float *input0, float *output0);
128 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
129129 int register_par(const ParamReg& reg);
130130
131131 static void clear_state_f_static(PluginDef*);
132132 static void init_static(unsigned int samplingFreq, PluginDef*);
133 static void compute_static(int count, float *input0, float *output0, PluginDef*);
133 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
134134 static int register_params_static(const ParamReg& reg);
135135 static void del_instance(PluginDef *p);
136136 public:
291291 static_cast<Dsp*>(p)->init(samplingFreq);
292292 }
293293
294 void always_inline Dsp::compute(int count, float *input0, float *output0)
294 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
295295 {
296296 #define fslider0 (*fslider0_)
297297 #define fslider1 (*fslider1_)
406406 #undef fslider3
407407 }
408408
409 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
409 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
410410 {
411411 static_cast<Dsp*>(p)->compute(count, input0, output0);
412412 }
124124 double fRec1[2];
125125 void clear_state_f();
126126 void init(unsigned int samplingFreq);
127 void compute(int count, float *input0, float *output0);
127 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
128128 int register_par(const ParamReg& reg);
129129
130130 static void clear_state_f_static(PluginDef*);
131131 static void init_static(unsigned int samplingFreq, PluginDef*);
132 static void compute_static(int count, float *input0, float *output0, PluginDef*);
132 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
133133 static int register_params_static(const ParamReg& reg);
134134 static void del_instance(PluginDef *p);
135135 public:
289289 static_cast<Dsp*>(p)->init(samplingFreq);
290290 }
291291
292 void always_inline Dsp::compute(int count, float *input0, float *output0)
292 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
293293 {
294294 #define fslider0 (*fslider0_)
295295 #define fslider1 (*fslider1_)
408408 #undef fslider3
409409 }
410410
411 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
411 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
412412 {
413413 static_cast<Dsp*>(p)->compute(count, input0, output0);
414414 }
130130 double fRec35[2];
131131 void clear_state_f();
132132 void init(unsigned int samplingFreq);
133 void compute(int count, float *input0, float *output0);
133 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
134134 int register_par(const ParamReg& reg);
135135
136136 static void clear_state_f_static(PluginDef*);
137137 static void init_static(unsigned int samplingFreq, PluginDef*);
138 static void compute_static(int count, float *input0, float *output0, PluginDef*);
138 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
139139 static int register_params_static(const ParamReg& reg);
140140 static void del_instance(PluginDef *p);
141141 public:
301301 static_cast<Dsp*>(p)->init(samplingFreq);
302302 }
303303
304 void always_inline Dsp::compute(int count, float *input0, float *output0)
304 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
305305 {
306306 #define fslider0 (*fslider0_)
307307 #define fslider1 (*fslider1_)
429429 #undef fslider3
430430 }
431431
432 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
432 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
433433 {
434434 static_cast<Dsp*>(p)->compute(count, input0, output0);
435435 }
129129 double fRec35[2];
130130 void clear_state_f();
131131 void init(unsigned int samplingFreq);
132 void compute(int count, float *input0, float *output0);
132 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
133133 int register_par(const ParamReg& reg);
134134
135135 static void clear_state_f_static(PluginDef*);
136136 static void init_static(unsigned int samplingFreq, PluginDef*);
137 static void compute_static(int count, float *input0, float *output0, PluginDef*);
137 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
138138 static int register_params_static(const ParamReg& reg);
139139 static void del_instance(PluginDef *p);
140140 public:
299299 static_cast<Dsp*>(p)->init(samplingFreq);
300300 }
301301
302 void always_inline Dsp::compute(int count, float *input0, float *output0)
302 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
303303 {
304304 #define fslider0 (*fslider0_)
305305 #define fslider1 (*fslider1_)
344344 fVec1[0] = fTemp3;
345345 fRec20[0] = ((fConst56 * ((fConst55 * fVec1[1]) + (fConst32 * fVec1[0]))) + (fConst37 * fRec20[1]));
346346 fRec19[0] = (fRec20[0] - (fConst35 * ((fConst33 * fRec19[2]) + (fConst31 * fRec19[1]))));
347 fRec18[0] = ((fConst35 * ((fConst30 * fRec19[2]) + ((fConst30 * fRec19[0]) + (fConst57 * fRec19[1])))) - (fConst28 * ((fConst27 * fRec18[2]) + fTemp1)));
347 fRec18[0] = ((fConst35 * (((fConst30 * fRec19[0]) + (fConst57 * fRec19[1])) + (fConst30 * fRec19[2]))) - (fConst28 * ((fConst27 * fRec18[2]) + fTemp1)));
348348 double fTemp4 = max((double)-1, min((double)1, (fSlow7 * (fRec18[2] + (fConst28 * (fTemp1 + (fConst27 * fRec18[0])))))));
349349 fRec28[0] = ((fConst56 * (fVec1[0] + fVec1[1])) + (fConst37 * fRec28[1]));
350350 fRec27[0] = (fRec28[0] - (fConst35 * ((fConst33 * fRec27[2]) + (fConst31 * fRec27[1]))));
427427 #undef fslider3
428428 }
429429
430 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
430 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
431431 {
432432 static_cast<Dsp*>(p)->compute(count, input0, output0);
433433 }
164164 double fRec0[2];
165165 void clear_state_f();
166166 void init(unsigned int samplingFreq);
167 void compute(int count, float *input0, float *output0);
167 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
168168 int register_par(const ParamReg& reg);
169169
170170 static void clear_state_f_static(PluginDef*);
171171 static void init_static(unsigned int samplingFreq, PluginDef*);
172 static void compute_static(int count, float *input0, float *output0, PluginDef*);
172 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
173173 static int register_params_static(const ParamReg& reg);
174174 static void del_instance(PluginDef *p);
175175 public:
369369 static_cast<Dsp*>(p)->init(samplingFreq);
370370 }
371371
372 void always_inline Dsp::compute(int count, float *input0, float *output0)
372 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
373373 {
374374 #define fslider0 (*fslider0_)
375375 #define fslider1 (*fslider1_)
562562 #undef fslider3
563563 }
564564
565 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
565 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
566566 {
567567 static_cast<Dsp*>(p)->compute(count, input0, output0);
568568 }
163163 double fRec0[2];
164164 void clear_state_f();
165165 void init(unsigned int samplingFreq);
166 void compute(int count, float *input0, float *output0);
166 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
167167 int register_par(const ParamReg& reg);
168168
169169 static void clear_state_f_static(PluginDef*);
170170 static void init_static(unsigned int samplingFreq, PluginDef*);
171 static void compute_static(int count, float *input0, float *output0, PluginDef*);
171 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
172172 static int register_params_static(const ParamReg& reg);
173173 static void del_instance(PluginDef *p);
174174 public:
367367 static_cast<Dsp*>(p)->init(samplingFreq);
368368 }
369369
370 void always_inline Dsp::compute(int count, float *input0, float *output0)
370 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
371371 {
372372 #define fslider0 (*fslider0_)
373373 #define fslider1 (*fslider1_)
560560 #undef fslider3
561561 }
562562
563 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
563 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
564564 {
565565 static_cast<Dsp*>(p)->compute(count, input0, output0);
566566 }
166166 double fRec0[2];
167167 void clear_state_f();
168168 void init(unsigned int samplingFreq);
169 void compute(int count, float *input0, float *output0);
169 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
170170 int register_par(const ParamReg& reg);
171171
172172 static void clear_state_f_static(PluginDef*);
173173 static void init_static(unsigned int samplingFreq, PluginDef*);
174 static void compute_static(int count, float *input0, float *output0, PluginDef*);
174 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
175175 static int register_params_static(const ParamReg& reg);
176176 static void del_instance(PluginDef *p);
177177 public:
373373 static_cast<Dsp*>(p)->init(samplingFreq);
374374 }
375375
376 void always_inline Dsp::compute(int count, float *input0, float *output0)
376 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
377377 {
378378 #define fslider0 (*fslider0_)
379379 #define fslider1 (*fslider1_)
566566 #undef fslider3
567567 }
568568
569 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
569 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
570570 {
571571 static_cast<Dsp*>(p)->compute(count, input0, output0);
572572 }
137137 double fRec1[2];
138138 void clear_state_f();
139139 void init(unsigned int samplingFreq);
140 void compute(int count, float *input0, float *output0);
140 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
141141 int register_par(const ParamReg& reg);
142142
143143 static void clear_state_f_static(PluginDef*);
144144 static void init_static(unsigned int samplingFreq, PluginDef*);
145 static void compute_static(int count, float *input0, float *output0, PluginDef*);
145 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
146146 static int register_params_static(const ParamReg& reg);
147147 static void del_instance(PluginDef *p);
148148 public:
315315 static_cast<Dsp*>(p)->init(samplingFreq);
316316 }
317317
318 void always_inline Dsp::compute(int count, float *input0, float *output0)
318 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
319319 {
320320 #define fslider0 (*fslider0_)
321321 #define fslider1 (*fslider1_)
470470 #undef fslider3
471471 }
472472
473 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
473 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
474474 {
475475 static_cast<Dsp*>(p)->compute(count, input0, output0);
476476 }
2525 FAUSTFLOAT fcheckbox0;
2626 void clear_state_f();
2727 void init(unsigned int samplingFreq);
28 void compute(int count, float *input0, float *input1, float *output0, float *output1);
28 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2929 int register_par(const ParamReg& reg);
3030
3131 static void clear_state_f_static(PluginDef*);
3232 static void init_static(unsigned int samplingFreq, PluginDef*);
33 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
33 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
3434 static int register_params_static(const ParamReg& reg);
3535 static void del_instance(PluginDef *p);
3636 public:
9898 static_cast<Dsp*>(p)->init(samplingFreq);
9999 }
100100
101 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
101 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
102102 {
103103 double fSlow0 = fslider0;
104104 double fSlow1 = (1 - max((double)0, fSlow0));
151151 }
152152 }
153153
154 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *p)
154 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
155155 {
156156 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
157157 }
1111 double fRec0[2];
1212 void clear_state_f();
1313 void init(unsigned int samplingFreq);
14 void compute(int count, float *input0, float *output0);
14 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1515 int register_par(const ParamReg& reg);
1616
1717 static void clear_state_f_static(PluginDef*);
1818 static void init_static(unsigned int samplingFreq, PluginDef*);
19 static void compute_static(int count, float *input0, float *output0, PluginDef*);
19 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2020 static int register_params_static(const ParamReg& reg);
2121 static void del_instance(PluginDef *p);
2222 public:
7070 static_cast<Dsp*>(p)->init(samplingFreq);
7171 }
7272
73 void always_inline Dsp::compute(int count, float *input0, float *output0)
73 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7474 {
7575 #define fslider0 (*fslider0_)
7676 double fSlow0 = (0.0010000000000000009 * pow(10,(0.05 * fslider0)));
8383 #undef fslider0
8484 }
8585
86 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
86 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
8787 {
8888 static_cast<Dsp*>(p)->compute(count, input0, output0);
8989 }
1717 void clear_state_f();
1818 int load_ui_f(const UiBuilder& b, int form);
1919 void init(unsigned int samplingFreq);
20 void compute(int count, float *input0, float *output0);
20 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2121 int register_par(const ParamReg& reg);
2222
2323 static void clear_state_f_static(PluginDef*);
2424 static int load_ui_f_static(const UiBuilder& b, int form);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8383 static_cast<Dsp*>(p)->init(samplingFreq);
8484 }
8585
86 void always_inline Dsp::compute(int count, float *input0, float *output0)
86 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8787 {
8888 double fSlow0 = (pow(10,(0.05 * fslider0)) - 1);
8989 for (int i=0; i<count; i++) {
9797 }
9898 }
9999
100 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
100 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
101101 {
102102 static_cast<Dsp*>(p)->compute(count, input0, output0);
103103 }
1818 void clear_state_f();
1919 int load_ui_f(const UiBuilder& b, int form);
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static int load_ui_f_static(const UiBuilder& b, int form);
2626 static void init_static(unsigned int samplingFreq, PluginDef*);
27 static void compute_static(int count, float *input0, float *output0, PluginDef*);
27 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2828 static int register_params_static(const ParamReg& reg);
2929 static void del_instance(PluginDef *p);
3030 public:
8282 static_cast<Dsp*>(p)->init(samplingFreq);
8383 }
8484
85 void always_inline Dsp::compute(int count, float *input0, float *output0)
85 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8686 {
8787 double fSlow0 = exp((0 - (fConst1 * fslider0)));
8888 double fSlow1 = (2 * cos((fConst2 * fslider1)));
9999 }
100100 }
101101
102 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
102 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
103103 {
104104 static_cast<Dsp*>(p)->compute(count, input0, output0);
105105 }
5757 return 0;
5858 }
5959
60 void always_inline Dsp::compute(int count, float *input0, float *input1, float *input2, float *input3, float *output0, float *output1)
60 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *input2, FAUSTFLOAT *input3, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
6161 {
6262 #define fslider4 (*fslider4_)
6363 float fSlow0 = (0.01f * fslider0);
2929 void clear_state_f();
3030 int activate(bool start);
3131 void init(unsigned int samplingFreq);
32 void compute(int count, float *input0, float *input1, float *input2, float *input3, float *output0, float *output1);
32 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *input2, FAUSTFLOAT *input3, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
3333 int register_par(const ParamReg& reg);
3434 Dsp();
3535 ~Dsp();
2121 clear_state_f();
2222 }
2323
24 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0)
24 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0)
2525 {
2626 double fSlow0 = (0.01 * fslider0);
2727 double fSlow1 = (1 - fSlow0);
1414 public:
1515 void clear_state_f();
1616 void init(unsigned int samplingFreq);
17 void compute(int count, float *input0, float *input1, float *output0);
17 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0);
1818 int register_par(const ParamReg& reg);
1919 Dsp();
2020 ~Dsp();
2727 void clear_state_f();
2828 int load_ui_f(const UiBuilder& b, int form);
2929 void init(unsigned int samplingFreq);
30 void compute(int count, float *input0, float *output0);
30 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
3131 int register_par(const ParamReg& reg);
3232
3333 static void clear_state_f_static(PluginDef*);
3434 static int load_ui_f_static(const UiBuilder& b, int form);
3535 static void init_static(unsigned int samplingFreq, PluginDef*);
36 static void compute_static(int count, float *input0, float *output0, PluginDef*);
36 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
3737 static int register_params_static(const ParamReg& reg);
3838 static void del_instance(PluginDef *p);
3939 public:
104104 static_cast<Dsp*>(p)->init(samplingFreq);
105105 }
106106
107 void always_inline Dsp::compute(int count, float *input0, float *output0)
107 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
108108 {
109109 double fSlow0 = (1.0 / tan((fConst0 * fentry0)));
110110 double fSlow1 = (1 + fSlow0);
159159 }
160160 }
161161
162 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
162 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
163163 {
164164 static_cast<Dsp*>(p)->compute(count, input0, output0);
165165 }
2525 void clear_state_f();
2626 int load_ui_f(const UiBuilder& b, int form);
2727 void init(unsigned int samplingFreq);
28 void compute(int count, float *input0, float *input1, float *output0, float *output1);
28 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
2929 int register_par(const ParamReg& reg);
3030
3131 static void clear_state_f_static(PluginDef*);
3232 static int load_ui_f_static(const UiBuilder& b, int form);
3333 static void init_static(unsigned int samplingFreq, PluginDef*);
34 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
34 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
3535 static int register_params_static(const ParamReg& reg);
3636 static void del_instance(PluginDef *p);
3737 public:
9898 static_cast<Dsp*>(p)->init(samplingFreq);
9999 }
100100
101 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
101 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
102102 {
103103 double fSlow0 = (0.0010000000000000009 * fslider0);
104104 double fSlow1 = (0 - fslider1);
138138 }
139139 }
140140
141 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *p)
141 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
142142 {
143143 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
144144 }
1313 FAUSTFLOAT fslider0;
1414 void clear_state_f();
1515 void init(unsigned int samplingFreq);
16 void compute(int count, float *input0, float *output0);
16 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1717 int register_par(const ParamReg& reg);
1818
1919 static void clear_state_f_static(PluginDef*);
2020 static void init_static(unsigned int samplingFreq, PluginDef*);
21 static void compute_static(int count, float *input0, float *output0, PluginDef*);
21 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2222 static int register_params_static(const ParamReg& reg);
2323 static void del_instance(PluginDef *p);
2424 public:
7575 static_cast<Dsp*>(p)->init(samplingFreq);
7676 }
7777
78 void always_inline Dsp::compute(int count, float *input0, float *output0)
78 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7979 {
8080 double fSlow0 = fslider0;
8181 double fSlow1 = (5 * fSlow0);
9292 }
9393 }
9494
95 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
95 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
9696 {
9797 static_cast<Dsp*>(p)->compute(count, input0, output0);
9898 }
1212 void clear_state_f();
1313 int load_ui_f(const UiBuilder& b, int form);
1414 void init(unsigned int samplingFreq);
15 void compute(int count, float *input0, float *output0);
15 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1616 int register_par(const ParamReg& reg);
1717
1818 static void clear_state_f_static(PluginDef*);
1919 static int load_ui_f_static(const UiBuilder& b, int form);
2020 static void init_static(unsigned int samplingFreq, PluginDef*);
21 static void compute_static(int count, float *input0, float *output0, PluginDef*);
21 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2222 static int register_params_static(const ParamReg& reg);
2323 static void del_instance(PluginDef *p);
2424 public:
7272 static_cast<Dsp*>(p)->init(samplingFreq);
7373 }
7474
75 void always_inline Dsp::compute(int count, float *input0, float *output0)
75 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
7676 {
7777 double fSlow0 = fslider0;
7878 double fSlow1 = (0.0001 * faustpower<2>(fSlow0));
9191 }
9292 }
9393
94 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
94 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
9595 {
9696 static_cast<Dsp*>(p)->compute(count, input0, output0);
9797 }
0 // generated from file '../src/faust/panoram_enhancer.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.58 (http://faust.grame.fr)
2
3
4 namespace panoram_enhancer {
5
6 class Dsp: public PluginDef {
7 private:
8 int fSamplingFreq;
9 int iConst0;
10 double fConst1;
11 double fConst2;
12 double fConst3;
13 double fConst4;
14 double fConst5;
15 double fConst6;
16 double fConst7;
17 double fConst8;
18 double fConst9;
19 double fConst10;
20 double fConst11;
21 double fConst12;
22 double fConst13;
23 double fConst14;
24 double fConst15;
25 double fConst16;
26 double fConst17;
27 double fConst18;
28 double fConst19;
29 int IOTA;
30 double fVec0[65536];
31 FAUSTFLOAT fslider0;
32 double fRec6[2];
33 double fConst20;
34 double fRec5[3];
35 double fConst21;
36 double fRec4[3];
37 double fRec3[3];
38 double fRec2[3];
39 double fRec1[3];
40 double fRec0[3];
41 FAUSTFLOAT fslider1;
42 double fConst22;
43 double fConst23;
44 double fConst24;
45 double fConst25;
46 double fConst26;
47 double fConst27;
48 double fConst28;
49 double fConst29;
50 double fVec1[65536];
51 double fRec8[3];
52 double fRec7[3];
53 double fConst30;
54 double fConst31;
55 double fConst32;
56 double fConst33;
57 double fConst34;
58 double fConst35;
59 double fConst36;
60 double fConst37;
61 double fConst38;
62 double fConst39;
63 double fConst40;
64 double fConst41;
65 double fRec14[3];
66 double fConst42;
67 double fRec13[3];
68 double fRec12[3];
69 double fRec11[3];
70 double fRec10[3];
71 double fRec9[3];
72 double fConst43;
73 double fConst44;
74 double fConst45;
75 double fConst46;
76 double fConst47;
77 double fConst48;
78 double fRec20[3];
79 double fConst49;
80 double fRec19[3];
81 double fRec18[3];
82 double fRec17[3];
83 double fRec16[3];
84 double fRec15[3];
85 double fConst50;
86 double fRec26[3];
87 double fRec25[3];
88 double fRec24[3];
89 double fRec23[3];
90 double fRec22[3];
91 double fRec21[3];
92 double fConst51;
93 double fRec32[3];
94 double fRec31[3];
95 double fRec30[3];
96 double fRec29[3];
97 double fRec28[3];
98 double fRec27[3];
99 double fConst52;
100 double fRec38[3];
101 double fRec37[3];
102 double fRec36[3];
103 double fRec35[3];
104 double fRec34[3];
105 double fRec33[3];
106 void clear_state_f();
107 int load_ui_f(const UiBuilder& b, int form);
108 void init(unsigned int samplingFreq);
109 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
110 int register_par(const ParamReg& reg);
111
112 static void clear_state_f_static(PluginDef*);
113 static int load_ui_f_static(const UiBuilder& b, int form);
114 static void init_static(unsigned int samplingFreq, PluginDef*);
115 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
116 static int register_params_static(const ParamReg& reg);
117 static void del_instance(PluginDef *p);
118 public:
119 Dsp();
120 ~Dsp();
121 };
122
123
124
125 Dsp::Dsp()
126 : PluginDef() {
127 version = PLUGINDEF_VERSION;
128 flags = 0;
129 id = "panoram_enhancer";
130 name = N_("Panoram enhancer");
131 groups = 0;
132 description = ""; // description (tooltip)
133 category = N_("Misc"); // category
134 shortname = N_("Panoram"); // shortname
135 mono_audio = 0;
136 stereo_audio = compute_static;
137 set_samplerate = init_static;
138 activate_plugin = 0;
139 register_params = register_params_static;
140 load_ui = load_ui_f_static;
141 clear_state = clear_state_f_static;
142 delete_instance = del_instance;
143 }
144
145 Dsp::~Dsp() {
146 }
147
148 inline void Dsp::clear_state_f()
149 {
150 for (int i=0; i<65536; i++) fVec0[i] = 0;
151 for (int i=0; i<2; i++) fRec6[i] = 0;
152 for (int i=0; i<3; i++) fRec5[i] = 0;
153 for (int i=0; i<3; i++) fRec4[i] = 0;
154 for (int i=0; i<3; i++) fRec3[i] = 0;
155 for (int i=0; i<3; i++) fRec2[i] = 0;
156 for (int i=0; i<3; i++) fRec1[i] = 0;
157 for (int i=0; i<3; i++) fRec0[i] = 0;
158 for (int i=0; i<65536; i++) fVec1[i] = 0;
159 for (int i=0; i<3; i++) fRec8[i] = 0;
160 for (int i=0; i<3; i++) fRec7[i] = 0;
161 for (int i=0; i<3; i++) fRec14[i] = 0;
162 for (int i=0; i<3; i++) fRec13[i] = 0;
163 for (int i=0; i<3; i++) fRec12[i] = 0;
164 for (int i=0; i<3; i++) fRec11[i] = 0;
165 for (int i=0; i<3; i++) fRec10[i] = 0;
166 for (int i=0; i<3; i++) fRec9[i] = 0;
167 for (int i=0; i<3; i++) fRec20[i] = 0;
168 for (int i=0; i<3; i++) fRec19[i] = 0;
169 for (int i=0; i<3; i++) fRec18[i] = 0;
170 for (int i=0; i<3; i++) fRec17[i] = 0;
171 for (int i=0; i<3; i++) fRec16[i] = 0;
172 for (int i=0; i<3; i++) fRec15[i] = 0;
173 for (int i=0; i<3; i++) fRec26[i] = 0;
174 for (int i=0; i<3; i++) fRec25[i] = 0;
175 for (int i=0; i<3; i++) fRec24[i] = 0;
176 for (int i=0; i<3; i++) fRec23[i] = 0;
177 for (int i=0; i<3; i++) fRec22[i] = 0;
178 for (int i=0; i<3; i++) fRec21[i] = 0;
179 for (int i=0; i<3; i++) fRec32[i] = 0;
180 for (int i=0; i<3; i++) fRec31[i] = 0;
181 for (int i=0; i<3; i++) fRec30[i] = 0;
182 for (int i=0; i<3; i++) fRec29[i] = 0;
183 for (int i=0; i<3; i++) fRec28[i] = 0;
184 for (int i=0; i<3; i++) fRec27[i] = 0;
185 for (int i=0; i<3; i++) fRec38[i] = 0;
186 for (int i=0; i<3; i++) fRec37[i] = 0;
187 for (int i=0; i<3; i++) fRec36[i] = 0;
188 for (int i=0; i<3; i++) fRec35[i] = 0;
189 for (int i=0; i<3; i++) fRec34[i] = 0;
190 for (int i=0; i<3; i++) fRec33[i] = 0;
191 }
192
193 void Dsp::clear_state_f_static(PluginDef *p)
194 {
195 static_cast<Dsp*>(p)->clear_state_f();
196 }
197
198 inline void Dsp::init(unsigned int samplingFreq)
199 {
200 fSamplingFreq = samplingFreq;
201 iConst0 = min(192000, max(1, fSamplingFreq));
202 fConst1 = tan((62831.853071795864 / double(iConst0)));
203 fConst2 = (2 * (1 - (1.0 / faustpower<2>(fConst1))));
204 fConst3 = (1.0 / fConst1);
205 fConst4 = (1 + ((fConst3 - 0.5176380902050413) / fConst1));
206 fConst5 = (1.0 / (1 + ((0.5176380902050413 + fConst3) / fConst1)));
207 fConst6 = (1 + ((fConst3 - 1.414213562373095) / fConst1));
208 fConst7 = (1.0 / (1 + ((1.414213562373095 + fConst3) / fConst1)));
209 fConst8 = (1 + ((fConst3 - 1.9318516525781364) / fConst1));
210 fConst9 = (1.0 / (1 + ((1.9318516525781364 + fConst3) / fConst1)));
211 fConst10 = tan((20106.192982974677 / double(iConst0)));
212 fConst11 = (1.0 / faustpower<2>(fConst10));
213 fConst12 = (2 * (1 - fConst11));
214 fConst13 = (1.0 / fConst10);
215 fConst14 = (1 + ((fConst13 - 0.5176380902050413) / fConst10));
216 fConst15 = (1.0 / (1 + ((0.5176380902050413 + fConst13) / fConst10)));
217 fConst16 = (1 + ((fConst13 - 1.414213562373095) / fConst10));
218 fConst17 = (1.0 / (1 + ((1.414213562373095 + fConst13) / fConst10)));
219 fConst18 = (1 + ((fConst13 - 1.9318516525781364) / fConst10));
220 fConst19 = (1.0 / (1 + ((1.9318516525781364 + fConst13) / fConst10)));
221 IOTA = 0;
222 fConst20 = (0.13999999999999999 * iConst0);
223 fConst21 = (2 * (0 - fConst11));
224 fConst22 = tan((5654.8667764616275 / double(iConst0)));
225 fConst23 = (1.0 / faustpower<2>(fConst22));
226 fConst24 = (2 * (1 - fConst23));
227 fConst25 = (1.0 / fConst22);
228 fConst26 = (1 + ((fConst25 - 0.7653668647301795) / fConst22));
229 fConst27 = (1.0 / (1 + ((0.7653668647301795 + fConst25) / fConst22)));
230 fConst28 = (1 + ((fConst25 - 1.8477590650225735) / fConst22));
231 fConst29 = (1.0 / (1 + ((fConst25 + 1.8477590650225735) / fConst22)));
232 fConst30 = tan((11309.733552923255 / double(iConst0)));
233 fConst31 = (1.0 / faustpower<2>(fConst30));
234 fConst32 = (2 * (1 - fConst31));
235 fConst33 = (1.0 / fConst30);
236 fConst34 = (1 + ((fConst33 - 0.5176380902050413) / fConst30));
237 fConst35 = (1.0 / (1 + ((0.5176380902050413 + fConst33) / fConst30)));
238 fConst36 = (1 + ((fConst33 - 1.414213562373095) / fConst30));
239 fConst37 = (1.0 / (1 + ((1.414213562373095 + fConst33) / fConst30)));
240 fConst38 = (1 + ((fConst33 - 1.9318516525781364) / fConst30));
241 fConst39 = (1.0 / (1 + ((1.9318516525781364 + fConst33) / fConst30)));
242 fConst40 = (0.2 * iConst0);
243 fConst41 = sqrt((0.3 + fConst40));
244 fConst42 = (2 * (0 - fConst31));
245 fConst43 = (1 + ((fConst25 - 0.5176380902050413) / fConst22));
246 fConst44 = (1.0 / (1 + ((0.5176380902050413 + fConst25) / fConst22)));
247 fConst45 = (1 + ((fConst25 - 1.414213562373095) / fConst22));
248 fConst46 = (1.0 / (1 + ((1.414213562373095 + fConst25) / fConst22)));
249 fConst47 = (1 + ((fConst25 - 1.9318516525781364) / fConst22));
250 fConst48 = (1.0 / (1 + ((1.9318516525781364 + fConst25) / fConst22)));
251 fConst49 = (2 * (0 - fConst23));
252 fConst50 = (3.141592653589793 / double(iConst0));
253 fConst51 = log10((9 + fConst40));
254 fConst52 = cos((0.246 * iConst0));
255 clear_state_f();
256 }
257
258 void Dsp::init_static(unsigned int samplingFreq, PluginDef *p)
259 {
260 static_cast<Dsp*>(p)->init(samplingFreq);
261 }
262
263 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
264 {
265 double fSlow0 = (0.0010000000000000009 * fslider0);
266 double fSlow1 = fslider1;
267 double fSlow2 = (0.6 + (0.4 * sin((3.14 * fSlow1))));
268 double fSlow3 = (fConst5 * fSlow2);
269 double fSlow4 = (0.6 + (0.27999999999999997 * fSlow1));
270 double fSlow5 = (fConst15 * fSlow4);
271 double fSlow6 = (fConst35 * (0.6 + (0.4 * cos((1.23 * fSlow1)))));
272 double fSlow7 = (1500 * fSlow1);
273 double fSlow8 = tan((fConst50 * (6400 - fSlow7)));
274 double fSlow9 = (1.0 / faustpower<2>(fSlow8));
275 double fSlow10 = (2 * (1 - fSlow9));
276 double fSlow11 = (1.0 / fSlow8);
277 double fSlow12 = (1 + ((fSlow11 - 0.5176380902050413) / fSlow8));
278 double fSlow13 = (1 + ((0.5176380902050413 + fSlow11) / fSlow8));
279 double fSlow14 = (1.0 / fSlow13);
280 double fSlow15 = (1 + ((fSlow11 - 1.414213562373095) / fSlow8));
281 double fSlow16 = (1.0 / (1 + ((1.414213562373095 + fSlow11) / fSlow8)));
282 double fSlow17 = (1 + ((fSlow11 - 1.9318516525781364) / fSlow8));
283 double fSlow18 = (1.0 / (1 + ((1.9318516525781364 + fSlow11) / fSlow8)));
284 double fSlow19 = tan((fConst50 * (3600 - fSlow7)));
285 double fSlow20 = (1.0 / faustpower<2>(fSlow19));
286 double fSlow21 = (2 * (1 - fSlow20));
287 double fSlow22 = (1.0 / fSlow19);
288 double fSlow23 = (1 + ((fSlow22 - 0.5176380902050413) / fSlow19));
289 double fSlow24 = (1 + ((0.5176380902050413 + fSlow22) / fSlow19));
290 double fSlow25 = (1.0 / fSlow24);
291 double fSlow26 = (1 + ((fSlow22 - 1.414213562373095) / fSlow19));
292 double fSlow27 = (1.0 / (1 + ((1.414213562373095 + fSlow22) / fSlow19)));
293 double fSlow28 = (1 + ((fSlow22 - 1.9318516525781364) / fSlow19));
294 double fSlow29 = (1.0 / (1 + ((1.9318516525781364 + fSlow22) / fSlow19)));
295 double fSlow30 = (2 * (0 - fSlow20));
296 double fSlow31 = (fSlow2 / fSlow13);
297 double fSlow32 = tan((fConst50 * (20000 - fSlow7)));
298 double fSlow33 = (2 * (1 - (1.0 / faustpower<2>(fSlow32))));
299 double fSlow34 = (1.0 / fSlow32);
300 double fSlow35 = (1 + ((fSlow34 - 0.5176380902050413) / fSlow32));
301 double fSlow36 = (1 + ((0.5176380902050413 + fSlow34) / fSlow32));
302 double fSlow37 = (1.0 / fSlow36);
303 double fSlow38 = (1 + ((fSlow34 - 1.414213562373095) / fSlow32));
304 double fSlow39 = (1.0 / (1 + ((fSlow34 + 1.414213562373095) / fSlow32)));
305 double fSlow40 = (1 + ((fSlow34 - 1.9318516525781364) / fSlow32));
306 double fSlow41 = (1.0 / (1 + ((fSlow34 + 1.9318516525781364) / fSlow32)));
307 double fSlow42 = (2 * (0 - fSlow9));
308 double fSlow43 = (fSlow4 / fSlow36);
309 double fSlow44 = tan((fConst50 * (1800 - fSlow7)));
310 double fSlow45 = (1.0 / faustpower<2>(fSlow44));
311 double fSlow46 = (2 * (1 - fSlow45));
312 double fSlow47 = (1.0 / fSlow44);
313 double fSlow48 = (1 + ((fSlow47 - 0.5176380902050413) / fSlow44));
314 double fSlow49 = (1.0 / (1 + ((0.5176380902050413 + fSlow47) / fSlow44)));
315 double fSlow50 = (1 + ((fSlow47 - 1.414213562373095) / fSlow44));
316 double fSlow51 = (1.0 / (1 + ((1.414213562373095 + fSlow47) / fSlow44)));
317 double fSlow52 = (1 + ((fSlow47 - 1.9318516525781364) / fSlow44));
318 double fSlow53 = (1.0 / (1 + ((1.9318516525781364 + fSlow47) / fSlow44)));
319 double fSlow54 = (2 * (0 - fSlow45));
320 double fSlow55 = ((0.6 + (0.4 * sqrt((0.3 + fSlow1)))) / fSlow24);
321 for (int i=0; i<count; i++) {
322 double fTemp0 = (double)input0[i];
323 fVec0[IOTA&65535] = fTemp0;
324 fRec6[0] = (fSlow0 + (0.999 * fRec6[1]));
325 double fTemp1 = (fConst20 * fRec6[0]);
326 int iTemp2 = int(fTemp1);
327 int iTemp3 = (1 + iTemp2);
328 fRec5[0] = ((((fTemp1 - iTemp2) * fVec0[(IOTA-int((int(iTemp3) & 65535)))&65535]) + ((iTemp3 - fTemp1) * fVec0[(IOTA-int((iTemp2 & 65535)))&65535])) - (fConst19 * ((fConst18 * fRec5[2]) + (fConst12 * fRec5[1]))));
329 fRec4[0] = ((fConst19 * (((fConst11 * fRec5[0]) + (fConst21 * fRec5[1])) + (fConst11 * fRec5[2]))) - (fConst17 * ((fConst16 * fRec4[2]) + (fConst12 * fRec4[1]))));
330 fRec3[0] = ((fConst17 * (((fConst11 * fRec4[0]) + (fConst21 * fRec4[1])) + (fConst11 * fRec4[2]))) - (fConst15 * ((fConst14 * fRec3[2]) + (fConst12 * fRec3[1]))));
331 fRec2[0] = ((fConst15 * (((fConst11 * fRec3[0]) + (fConst21 * fRec3[1])) + (fConst11 * fRec3[2]))) - (fConst9 * ((fConst8 * fRec2[2]) + (fConst2 * fRec2[1]))));
332 fRec1[0] = ((fConst9 * (fRec2[2] + (fRec2[0] + (2 * fRec2[1])))) - (fConst7 * ((fConst6 * fRec1[2]) + (fConst2 * fRec1[1]))));
333 fRec0[0] = ((fConst7 * (fRec1[2] + (fRec1[0] + (2 * fRec1[1])))) - (fConst5 * ((fConst4 * fRec0[2]) + (fConst2 * fRec0[1]))));
334 double fTemp4 = (double)input1[i];
335 fVec1[IOTA&65535] = fTemp4;
336 fRec8[0] = ((0.5 * (fVec0[IOTA&65535] + fVec1[IOTA&65535])) - (fConst29 * ((fConst28 * fRec8[2]) + (fConst24 * fRec8[1]))));
337 fRec7[0] = ((fConst29 * (fRec8[2] + (fRec8[0] + (2 * fRec8[1])))) - (fConst27 * ((fConst26 * fRec7[2]) + (fConst24 * fRec7[1]))));
338 double fTemp5 = (fConst27 * (fRec7[2] + (fRec7[0] + (2 * fRec7[1]))));
339 double fTemp6 = (fConst41 * fRec6[0]);
340 int iTemp7 = int(fTemp6);
341 int iTemp8 = (1 + iTemp7);
342 fRec14[0] = ((((fTemp6 - iTemp7) * fVec0[(IOTA-int((int(iTemp8) & 65535)))&65535]) + ((iTemp8 - fTemp6) * fVec0[(IOTA-int((iTemp7 & 65535)))&65535])) - (fConst39 * ((fConst38 * fRec14[2]) + (fConst32 * fRec14[1]))));
343 fRec13[0] = ((fConst39 * (((fConst31 * fRec14[0]) + (fConst42 * fRec14[1])) + (fConst31 * fRec14[2]))) - (fConst37 * ((fConst36 * fRec13[2]) + (fConst32 * fRec13[1]))));
344 fRec12[0] = ((fConst37 * (((fConst31 * fRec13[0]) + (fConst42 * fRec13[1])) + (fConst31 * fRec13[2]))) - (fConst35 * ((fConst34 * fRec12[2]) + (fConst32 * fRec12[1]))));
345 fRec11[0] = ((fConst35 * (((fConst31 * fRec12[0]) + (fConst42 * fRec12[1])) + (fConst31 * fRec12[2]))) - (fConst19 * ((fConst18 * fRec11[2]) + (fConst12 * fRec11[1]))));
346 fRec10[0] = ((fConst19 * (fRec11[2] + (fRec11[0] + (2 * fRec11[1])))) - (fConst17 * ((fConst16 * fRec10[2]) + (fConst12 * fRec10[1]))));
347 fRec9[0] = ((fConst17 * (fRec10[2] + (fRec10[0] + (2 * fRec10[1])))) - (fConst15 * ((fConst14 * fRec9[2]) + (fConst12 * fRec9[1]))));
348 double fTemp9 = (fConst40 * fRec6[0]);
349 int iTemp10 = int(fTemp9);
350 int iTemp11 = int((iTemp10 & 65535));
351 int iTemp12 = (1 + iTemp10);
352 double fTemp13 = (iTemp12 - fTemp9);
353 int iTemp14 = int((int(iTemp12) & 65535));
354 double fTemp15 = (fTemp9 - iTemp10);
355 fRec20[0] = (((fTemp15 * fVec0[(IOTA-iTemp14)&65535]) + (fTemp13 * fVec0[(IOTA-iTemp11)&65535])) - (fConst48 * ((fConst47 * fRec20[2]) + (fConst24 * fRec20[1]))));
356 fRec19[0] = ((fConst48 * (((fConst23 * fRec20[0]) + (fConst49 * fRec20[1])) + (fConst23 * fRec20[2]))) - (fConst46 * ((fConst45 * fRec19[2]) + (fConst24 * fRec19[1]))));
357 fRec18[0] = ((fConst46 * (((fConst23 * fRec19[0]) + (fConst49 * fRec19[1])) + (fConst23 * fRec19[2]))) - (fConst44 * ((fConst43 * fRec18[2]) + (fConst24 * fRec18[1]))));
358 fRec17[0] = ((fConst44 * (((fConst23 * fRec18[0]) + (fConst49 * fRec18[1])) + (fConst23 * fRec18[2]))) - (fConst39 * ((fConst38 * fRec17[2]) + (fConst32 * fRec17[1]))));
359 fRec16[0] = ((fConst39 * (fRec17[2] + (fRec17[0] + (2 * fRec17[1])))) - (fConst37 * ((fConst36 * fRec16[2]) + (fConst32 * fRec16[1]))));
360 fRec15[0] = ((fConst37 * (fRec16[2] + (fRec16[0] + (2 * fRec16[1])))) - (fConst35 * ((fConst34 * fRec15[2]) + (fConst32 * fRec15[1]))));
361 output0[i] = (FAUSTFLOAT)((fSlow6 * (fRec15[2] + (fRec15[0] + (2 * fRec15[1])))) + ((fSlow5 * (fRec9[2] + (fRec9[0] + (2 * fRec9[1])))) + (fTemp5 + (fSlow3 * (fRec0[2] + (fRec0[0] + (2 * fRec0[1])))))));
362 fRec26[0] = (((fTemp15 * fVec1[(IOTA-iTemp14)&65535]) + (fTemp13 * fVec1[(IOTA-iTemp11)&65535])) - (fSlow29 * ((fSlow28 * fRec26[2]) + (fSlow21 * fRec26[1]))));
363 fRec25[0] = ((fSlow29 * (((fSlow20 * fRec26[0]) + (fSlow30 * fRec26[1])) + (fSlow20 * fRec26[2]))) - (fSlow27 * ((fSlow26 * fRec25[2]) + (fSlow21 * fRec25[1]))));
364 fRec24[0] = ((fSlow27 * (((fSlow20 * fRec25[0]) + (fSlow30 * fRec25[1])) + (fSlow20 * fRec25[2]))) - (fSlow25 * ((fSlow23 * fRec24[2]) + (fSlow21 * fRec24[1]))));
365 fRec23[0] = ((fSlow25 * (((fSlow20 * fRec24[0]) + (fSlow30 * fRec24[1])) + (fSlow20 * fRec24[2]))) - (fSlow18 * ((fSlow17 * fRec23[2]) + (fSlow10 * fRec23[1]))));
366 fRec22[0] = ((fSlow18 * (fRec23[2] + (fRec23[0] + (2 * fRec23[1])))) - (fSlow16 * ((fSlow15 * fRec22[2]) + (fSlow10 * fRec22[1]))));
367 fRec21[0] = ((fSlow16 * (fRec22[2] + (fRec22[0] + (2 * fRec22[1])))) - (fSlow14 * ((fSlow12 * fRec21[2]) + (fSlow10 * fRec21[1]))));
368 double fTemp16 = (fConst51 * fRec6[0]);
369 int iTemp17 = int(fTemp16);
370 int iTemp18 = (1 + iTemp17);
371 fRec32[0] = ((((fTemp16 - iTemp17) * fVec1[(IOTA-int((int(iTemp18) & 65535)))&65535]) + ((iTemp18 - fTemp16) * fVec1[(IOTA-int((iTemp17 & 65535)))&65535])) - (fSlow18 * ((fSlow17 * fRec32[2]) + (fSlow10 * fRec32[1]))));
372 fRec31[0] = ((fSlow18 * (((fSlow9 * fRec32[0]) + (fSlow42 * fRec32[1])) + (fSlow9 * fRec32[2]))) - (fSlow16 * ((fSlow15 * fRec31[2]) + (fSlow10 * fRec31[1]))));
373 fRec30[0] = ((fSlow16 * (((fSlow9 * fRec31[0]) + (fSlow42 * fRec31[1])) + (fSlow9 * fRec31[2]))) - (fSlow14 * ((fSlow12 * fRec30[2]) + (fSlow10 * fRec30[1]))));
374 fRec29[0] = ((fSlow14 * (((fSlow9 * fRec30[0]) + (fSlow42 * fRec30[1])) + (fSlow9 * fRec30[2]))) - (fSlow41 * ((fSlow40 * fRec29[2]) + (fSlow33 * fRec29[1]))));
375 fRec28[0] = ((fSlow41 * (fRec29[2] + (fRec29[0] + (2 * fRec29[1])))) - (fSlow39 * ((fSlow38 * fRec28[2]) + (fSlow33 * fRec28[1]))));
376 fRec27[0] = ((fSlow39 * (fRec28[2] + (fRec28[0] + (2 * fRec28[1])))) - (fSlow37 * ((fSlow35 * fRec27[2]) + (fSlow33 * fRec27[1]))));
377 double fTemp19 = (fConst52 * fRec6[0]);
378 int iTemp20 = int(fTemp19);
379 int iTemp21 = (1 + iTemp20);
380 fRec38[0] = ((((fTemp19 - iTemp20) * fVec1[(IOTA-int((int(iTemp21) & 65535)))&65535]) + ((iTemp21 - fTemp19) * fVec1[(IOTA-int((iTemp20 & 65535)))&65535])) - (fSlow53 * ((fSlow52 * fRec38[2]) + (fSlow46 * fRec38[1]))));
381 fRec37[0] = ((fSlow53 * (((fSlow45 * fRec38[0]) + (fSlow54 * fRec38[1])) + (fSlow45 * fRec38[2]))) - (fSlow51 * ((fSlow50 * fRec37[2]) + (fSlow46 * fRec37[1]))));
382 fRec36[0] = ((fSlow51 * (((fSlow45 * fRec37[0]) + (fSlow54 * fRec37[1])) + (fSlow45 * fRec37[2]))) - (fSlow49 * ((fSlow48 * fRec36[2]) + (fSlow46 * fRec36[1]))));
383 fRec35[0] = ((fSlow49 * (((fSlow45 * fRec36[0]) + (fSlow54 * fRec36[1])) + (fSlow45 * fRec36[2]))) - (fSlow29 * ((fSlow28 * fRec35[2]) + (fSlow21 * fRec35[1]))));
384 fRec34[0] = ((fSlow29 * (fRec35[2] + (fRec35[0] + (2 * fRec35[1])))) - (fSlow27 * ((fSlow26 * fRec34[2]) + (fSlow21 * fRec34[1]))));
385 fRec33[0] = ((fSlow27 * (fRec34[2] + (fRec34[0] + (2 * fRec34[1])))) - (fSlow25 * ((fSlow23 * fRec33[2]) + (fSlow21 * fRec33[1]))));
386 output1[i] = (FAUSTFLOAT)(((fSlow55 * (fRec33[2] + (fRec33[0] + (2 * fRec33[1])))) + ((fSlow43 * (fRec27[2] + (fRec27[0] + (2 * fRec27[1])))) + (fSlow31 * (fRec21[2] + (fRec21[0] + (2 * fRec21[1])))))) + fTemp5);
387 // post processing
388 fRec33[2] = fRec33[1]; fRec33[1] = fRec33[0];
389 fRec34[2] = fRec34[1]; fRec34[1] = fRec34[0];
390 fRec35[2] = fRec35[1]; fRec35[1] = fRec35[0];
391 fRec36[2] = fRec36[1]; fRec36[1] = fRec36[0];
392 fRec37[2] = fRec37[1]; fRec37[1] = fRec37[0];
393 fRec38[2] = fRec38[1]; fRec38[1] = fRec38[0];
394 fRec27[2] = fRec27[1]; fRec27[1] = fRec27[0];
395 fRec28[2] = fRec28[1]; fRec28[1] = fRec28[0];
396 fRec29[2] = fRec29[1]; fRec29[1] = fRec29[0];
397 fRec30[2] = fRec30[1]; fRec30[1] = fRec30[0];
398 fRec31[2] = fRec31[1]; fRec31[1] = fRec31[0];
399 fRec32[2] = fRec32[1]; fRec32[1] = fRec32[0];
400 fRec21[2] = fRec21[1]; fRec21[1] = fRec21[0];
401 fRec22[2] = fRec22[1]; fRec22[1] = fRec22[0];
402 fRec23[2] = fRec23[1]; fRec23[1] = fRec23[0];
403 fRec24[2] = fRec24[1]; fRec24[1] = fRec24[0];
404 fRec25[2] = fRec25[1]; fRec25[1] = fRec25[0];
405 fRec26[2] = fRec26[1]; fRec26[1] = fRec26[0];
406 fRec15[2] = fRec15[1]; fRec15[1] = fRec15[0];
407 fRec16[2] = fRec16[1]; fRec16[1] = fRec16[0];
408 fRec17[2] = fRec17[1]; fRec17[1] = fRec17[0];
409 fRec18[2] = fRec18[1]; fRec18[1] = fRec18[0];
410 fRec19[2] = fRec19[1]; fRec19[1] = fRec19[0];
411 fRec20[2] = fRec20[1]; fRec20[1] = fRec20[0];
412 fRec9[2] = fRec9[1]; fRec9[1] = fRec9[0];
413 fRec10[2] = fRec10[1]; fRec10[1] = fRec10[0];
414 fRec11[2] = fRec11[1]; fRec11[1] = fRec11[0];
415 fRec12[2] = fRec12[1]; fRec12[1] = fRec12[0];
416 fRec13[2] = fRec13[1]; fRec13[1] = fRec13[0];
417 fRec14[2] = fRec14[1]; fRec14[1] = fRec14[0];
418 fRec7[2] = fRec7[1]; fRec7[1] = fRec7[0];
419 fRec8[2] = fRec8[1]; fRec8[1] = fRec8[0];
420 fRec0[2] = fRec0[1]; fRec0[1] = fRec0[0];
421 fRec1[2] = fRec1[1]; fRec1[1] = fRec1[0];
422 fRec2[2] = fRec2[1]; fRec2[1] = fRec2[0];
423 fRec3[2] = fRec3[1]; fRec3[1] = fRec3[0];
424 fRec4[2] = fRec4[1]; fRec4[1] = fRec4[0];
425 fRec5[2] = fRec5[1]; fRec5[1] = fRec5[0];
426 fRec6[1] = fRec6[0];
427 IOTA = IOTA+1;
428 }
429 }
430
431 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
432 {
433 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
434 }
435
436 int Dsp::register_par(const ParamReg& reg)
437 {
438 reg.registerVar("panoram_enhancer.Delay width","","S","",&fslider0, 0.0, 0.0, 1.0, 0.01);
439 reg.registerVar("panoram_enhancer.Frequency width","","S","",&fslider1, 0.0, 0.0, 1.0, 0.01);
440 return 0;
441 }
442
443 int Dsp::register_params_static(const ParamReg& reg)
444 {
445 return static_cast<Dsp*>(reg.plugin)->register_par(reg);
446 }
447
448 inline int Dsp::load_ui_f(const UiBuilder& b, int form)
449 {
450 if (form & UI_FORM_STACK) {
451 #define PARAM(p) ("panoram_enhancer" "." p)
452 // ----- panoram enhancer
453 b.openHorizontalhideBox("");
454 b.closeBox();
455 b.openVerticalBox("");
456 {
457 b.openHorizontalTableBox("");
458 {
459 b.create_small_rackknob(PARAM("Delay width"), _(" delay width "));
460 b.create_small_rackknob(PARAM("Frequency width"), _(" freq width "));
461 }
462 b.closeBox();
463 }
464 b.closeBox();
465
466
467 #undef PARAM
468 return 0;
469 }
470 return -1;
471 }
472
473 int Dsp::load_ui_f_static(const UiBuilder& b, int form)
474 {
475 return static_cast<Dsp*>(b.plugin)->load_ui_f(b, form);
476 }
477 PluginDef *plugin() {
478 return new Dsp();
479 }
480
481 void Dsp::del_instance(PluginDef *p)
482 {
483 delete static_cast<Dsp*>(p);
484 }
485
486 } // end namespace panoram_enhancer
3030 void clear_state_f();
3131 int load_ui_f(const UiBuilder& b, int form);
3232 void init(unsigned int samplingFreq);
33 void compute(int count, float *input0, float *output0);
33 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
3434 int register_par(const ParamReg& reg);
3535
3636 static void clear_state_f_static(PluginDef*);
3737 static int load_ui_f_static(const UiBuilder& b, int form);
3838 static void init_static(unsigned int samplingFreq, PluginDef*);
39 static void compute_static(int count, float *input0, float *output0, PluginDef*);
39 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
4040 static int register_params_static(const ParamReg& reg);
4141 static void del_instance(PluginDef *p);
4242 public:
9898 static_cast<Dsp*>(p)->init(samplingFreq);
9999 }
100100
101 void always_inline Dsp::compute(int count, float *input0, float *output0)
101 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
102102 {
103103 double fSlow0 = fslider0;
104104 double fSlow1 = tan((fConst1 * fSlow0));
182182 }
183183 }
184184
185 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
185 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
186186 {
187187 static_cast<Dsp*>(p)->compute(count, input0, output0);
188188 }
3535 void clear_state_f();
3636 int load_ui_f(const UiBuilder& b, int form);
3737 void init(unsigned int samplingFreq);
38 void compute(int count, float *input0, float *input1, float *output0, float *output1);
38 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
3939 int register_par(const ParamReg& reg);
4040
4141 static void clear_state_f_static(PluginDef*);
4242 static int load_ui_f_static(const UiBuilder& b, int form);
4343 static void init_static(unsigned int samplingFreq, PluginDef*);
44 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
44 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
4545 static int register_params_static(const ParamReg& reg);
4646 static void del_instance(PluginDef *p);
4747 public:
110110 static_cast<Dsp*>(p)->init(samplingFreq);
111111 }
112112
113 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
113 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
114114 {
115115 float fSlow0 = (0.5f * ((int(fcheckbox0))?2:fslider0));
116116 float fSlow1 = (1 - fSlow0);
177177 }
178178 }
179179
180 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *p)
180 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
181181 {
182182 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
183183 }
2929 void clear_state_f();
3030 int load_ui_f(const UiBuilder& b, int form);
3131 void init(unsigned int samplingFreq);
32 void compute(int count, float *input0, float *output0);
32 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
3333 int register_par(const ParamReg& reg);
3434
3535 static void clear_state_f_static(PluginDef*);
3636 static int load_ui_f_static(const UiBuilder& b, int form);
3737 static void init_static(unsigned int samplingFreq, PluginDef*);
38 static void compute_static(int count, float *input0, float *output0, PluginDef*);
38 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
3939 static int register_params_static(const ParamReg& reg);
4040 static void del_instance(PluginDef *p);
4141 public:
105105 static_cast<Dsp*>(p)->init(samplingFreq);
106106 }
107107
108 void always_inline Dsp::compute(int count, float *input0, float *output0)
108 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
109109 {
110110 float fSlow0 = (fConst1 * fslider0);
111111 float fSlow1 = sinf(fSlow0);
142142 }
143143 }
144144
145 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
145 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
146146 {
147147 static_cast<Dsp*>(p)->compute(count, input0, output0);
148148 }
3030 clear_state_f();
3131 }
3232
33 void always_inline Dsp::compute(int count, float *input0, float *output0)
33 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
3434 {
3535 #define fslider0 (*fslider0_)
3636 #define fslider1 (*fslider1_)
2727 public:
2828 void clear_state_f();
2929 void init(unsigned int samplingFreq);
30 void compute(int count, float *input0, float *output0);
30 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
3131 int register_par(const ParamReg& reg);
3232 Dsp();
3333 ~Dsp();
1515 fSamplingFreq = samplingFreq;
1616 }
1717
18 void always_inline Dsp::compute(int count, float *input0, float *output0)
18 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
1919 {
2020 #define fslider0 (*fslider0_)
2121 double fSlow0 = fslider0;
1212
1313 public:
1414 void init(unsigned int samplingFreq);
15 void compute(int count, float *input0, float *output0);
15 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1616 int register_par(const ParamReg& reg);
1717 Dsp();
1818 ~Dsp();
0 // generated from file '../src/faust/ring_modulator.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.58 (http://faust.grame.fr)
2
3
4 namespace ring_modulator {
5
6 class Dsp: public PluginDef {
7 private:
8 int fSamplingFreq;
9 class SIG0 {
10 private:
11 int fSamplingFreq;
12 int iRec0[2];
13 public:
14 int getNumInputs() { return 0; }
15 int getNumOutputs() { return 1; }
16 void init(int samplingFreq) {
17 fSamplingFreq = samplingFreq;
18 for (int i=0; i<2; i++) iRec0[i] = 0;
19 }
20 void fill (int count, double output[]) {
21 for (int i=0; i<count; i++) {
22 iRec0[0] = (1 + iRec0[1]);
23 output[i] = sin((9.587379924285257e-05 * double((iRec0[0] - 1))));
24 // post processing
25 iRec0[1] = iRec0[0];
26 }
27 }
28 };
29 static double ftbl0[65536];
30 FAUSTFLOAT fslider0;
31 double fConst0;
32 double fRec1[2];
33 FAUSTFLOAT fslider1;
34 void clear_state_f();
35 int load_ui_f(const UiBuilder& b, int form);
36 void init(unsigned int samplingFreq);
37 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
38 int register_par(const ParamReg& reg);
39
40 static void clear_state_f_static(PluginDef*);
41 static int load_ui_f_static(const UiBuilder& b, int form);
42 static void init_static(unsigned int samplingFreq, PluginDef*);
43 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
44 static int register_params_static(const ParamReg& reg);
45 static void del_instance(PluginDef *p);
46 public:
47 Dsp();
48 ~Dsp();
49 };
50
51
52 double Dsp::ftbl0[65536];
53
54 Dsp::Dsp()
55 : PluginDef() {
56 version = PLUGINDEF_VERSION;
57 flags = 0;
58 id = "ring_modulator";
59 name = N_("Ring Modulator Mono");
60 groups = 0;
61 description = ""; // description (tooltip)
62 category = N_("Modulation"); // category
63 shortname = N_("Ring Modulator"); // shortname
64 mono_audio = compute_static;
65 stereo_audio = 0;
66 set_samplerate = init_static;
67 activate_plugin = 0;
68 register_params = register_params_static;
69 load_ui = load_ui_f_static;
70 clear_state = clear_state_f_static;
71 delete_instance = del_instance;
72 }
73
74 Dsp::~Dsp() {
75 }
76
77 inline void Dsp::clear_state_f()
78 {
79 for (int i=0; i<2; i++) fRec1[i] = 0;
80 }
81
82 void Dsp::clear_state_f_static(PluginDef *p)
83 {
84 static_cast<Dsp*>(p)->clear_state_f();
85 }
86
87 inline void Dsp::init(unsigned int samplingFreq)
88 {
89 SIG0 sig0;
90 sig0.init(samplingFreq);
91 sig0.fill(65536,ftbl0);
92 fSamplingFreq = samplingFreq;
93 fConst0 = (1.0 / double(min(192000, max(1, fSamplingFreq))));
94 clear_state_f();
95 }
96
97 void Dsp::init_static(unsigned int samplingFreq, PluginDef *p)
98 {
99 static_cast<Dsp*>(p)->init(samplingFreq);
100 }
101
102 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
103 {
104 double fSlow0 = (fConst0 * fslider0);
105 double fSlow1 = fslider1;
106 double fSlow2 = (1 - fSlow1);
107 for (int i=0; i<count; i++) {
108 double fTemp0 = (fSlow0 + fRec1[1]);
109 fRec1[0] = (fTemp0 - floor(fTemp0));
110 output0[i] = (FAUSTFLOAT)((double)input0[i] * (fSlow2 + (fSlow1 * ftbl0[int((65536.0 * fRec1[0]))])));
111 // post processing
112 fRec1[1] = fRec1[0];
113 }
114 }
115
116 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
117 {
118 static_cast<Dsp*>(p)->compute(count, input0, output0);
119 }
120
121 int Dsp::register_par(const ParamReg& reg)
122 {
123 reg.registerVar("ring_modulator.dry/wet","","S","",&fslider1, 0.5, 0.0, 1.0, 0.05);
124 reg.registerVar("ring_modulator.freq","","S","",&fslider0, 2.4e+02, 1.2e+02, 1.6e+03, 0.5);
125 return 0;
126 }
127
128 int Dsp::register_params_static(const ParamReg& reg)
129 {
130 return static_cast<Dsp*>(reg.plugin)->register_par(reg);
131 }
132
133 inline int Dsp::load_ui_f(const UiBuilder& b, int form)
134 {
135 if (form & UI_FORM_STACK) {
136 #define PARAM(p) ("ring_modulator" "." p)
137 // ----- ring - modulator
138 b.openHorizontalhideBox("");
139 b.create_master_slider(PARAM("freq"), "Hz");
140 b.closeBox();
141 b.openVerticalBox("");
142 {
143 b.openHorizontalTableBox("");
144 {
145 b.create_small_rackknob(PARAM("freq"), _("Frequency"));
146 b.create_small_rackknobr(PARAM("dry/wet"), _(" Mix "));
147 }
148 b.closeBox();
149 }
150 b.closeBox();
151
152
153 #undef PARAM
154 return 0;
155 }
156 return -1;
157 }
158
159 int Dsp::load_ui_f_static(const UiBuilder& b, int form)
160 {
161 return static_cast<Dsp*>(b.plugin)->load_ui_f(b, form);
162 }
163 PluginDef *plugin() {
164 return new Dsp();
165 }
166
167 void Dsp::del_instance(PluginDef *p)
168 {
169 delete static_cast<Dsp*>(p);
170 }
171
172 } // end namespace ring_modulator
0 // generated from file '../src/faust/ring_modulator_st.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.46 (http://faust.grame.fr)
2
3
4 namespace ring_modulator_st {
5
6 class Dsp: public PluginDef {
7 private:
8 int fSamplingFreq;
9 class SIG0 {
10 private:
11 int fSamplingFreq;
12 int iRec0[2];
13 public:
14 int getNumInputs() { return 0; }
15 int getNumOutputs() { return 1; }
16 void init(int samplingFreq) {
17 fSamplingFreq = samplingFreq;
18 for (int i=0; i<2; i++) iRec0[i] = 0;
19 }
20 void fill (int count, double output[]) {
21 for (int i=0; i<count; i++) {
22 iRec0[0] = (1 + iRec0[1]);
23 output[i] = sin((9.587379924285257e-05 * double((iRec0[0] - 1))));
24 // post processing
25 iRec0[1] = iRec0[0];
26 }
27 }
28 };
29 static double ftbl0[65536];
30 FAUSTFLOAT fslider0;
31 double fConst0;
32 double fRec1[2];
33 FAUSTFLOAT fslider1;
34 void clear_state_f();
35 int load_ui_f(const UiBuilder& b, int form);
36 void init(unsigned int samplingFreq);
37 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
38 int register_par(const ParamReg& reg);
39
40 static void clear_state_f_static(PluginDef*);
41 static int load_ui_f_static(const UiBuilder& b, int form);
42 static void init_static(unsigned int samplingFreq, PluginDef*);
43 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
44 static int register_params_static(const ParamReg& reg);
45 static void del_instance(PluginDef *p);
46 public:
47 Dsp();
48 ~Dsp();
49 };
50
51
52 double Dsp::ftbl0[65536];
53
54 Dsp::Dsp()
55 : PluginDef() {
56 version = PLUGINDEF_VERSION;
57 flags = 0;
58 id = "ringModulatorSt";
59 name = N_("Ring Modulator");
60 groups = 0;
61 description = N_("Ring Modulator Stereo Version"); // description (tooltip)
62 category = N_("Modulation"); // category
63 shortname = ""; // shortname
64 mono_audio = 0;
65 stereo_audio = compute_static;
66 set_samplerate = init_static;
67 activate_plugin = 0;
68 register_params = register_params_static;
69 load_ui = load_ui_f_static;
70 clear_state = clear_state_f_static;
71 delete_instance = del_instance;
72 }
73
74 Dsp::~Dsp() {
75 }
76
77 inline void Dsp::clear_state_f()
78 {
79 for (int i=0; i<2; i++) fRec1[i] = 0;
80 }
81
82 void Dsp::clear_state_f_static(PluginDef *p)
83 {
84 static_cast<Dsp*>(p)->clear_state_f();
85 }
86
87 inline void Dsp::init(unsigned int samplingFreq)
88 {
89 SIG0 sig0;
90 sig0.init(samplingFreq);
91 sig0.fill(65536,ftbl0);
92 fSamplingFreq = samplingFreq;
93 fConst0 = (1.0 / double(min(192000, max(1, fSamplingFreq))));
94 clear_state_f();
95 }
96
97 void Dsp::init_static(unsigned int samplingFreq, PluginDef *p)
98 {
99 static_cast<Dsp*>(p)->init(samplingFreq);
100 }
101
102 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
103 {
104 double fSlow0 = (fConst0 * fslider0);
105 double fSlow1 = fslider1;
106 double fSlow2 = (1 - fSlow1);
107 for (int i=0; i<count; i++) {
108 double fTemp0 = (fSlow0 + fRec1[1]);
109 fRec1[0] = (fTemp0 - floor(fTemp0));
110 double fTemp1 = (fSlow2 + (fSlow1 * ftbl0[int((65536.0 * fRec1[0]))]));
111 output0[i] = (FAUSTFLOAT)((double)input0[i] * fTemp1);
112 output1[i] = (FAUSTFLOAT)((double)input1[i] * fTemp1);
113 // post processing
114 fRec1[1] = fRec1[0];
115 }
116 }
117
118 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
119 {
120 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
121 }
122
123 int Dsp::register_par(const ParamReg& reg)
124 {
125 reg.registerVar("ringModulatorSt.dry/wet","","S","",&fslider1, 0.5, 0.0, 1.0, 0.05);
126 reg.registerVar("ringModulatorSt.freq","","S","",&fslider0, 2.4e+02, 1.2e+02, 1.6e+03, 0.5);
127 return 0;
128 }
129
130 int Dsp::register_params_static(const ParamReg& reg)
131 {
132 return static_cast<Dsp*>(reg.plugin)->register_par(reg);
133 }
134
135 inline int Dsp::load_ui_f(const UiBuilder& b, int form)
136 {
137 if (form & UI_FORM_STACK) {
138 #define PARAM(p) ("ringModulatorSt" "." p)
139 // ----- ring - modulator
140 b.openHorizontalhideBox("");
141 b.create_master_slider(PARAM("freq"), "Hz");
142 b.closeBox();
143 b.openVerticalBox("");
144 {
145 b.openHorizontalTableBox("");
146 {
147 b.create_small_rackknob(PARAM("freq"), _("Frequency"));
148 b.create_small_rackknobr(PARAM("dry/wet"), _(" Mix "));
149 }
150 b.closeBox();
151 }
152 b.closeBox();
153
154
155 #undef PARAM
156 return 0;
157 }
158 return -1;
159 }
160
161 int Dsp::load_ui_f_static(const UiBuilder& b, int form)
162 {
163 return static_cast<Dsp*>(b.plugin)->load_ui_f(b, form);
164 }
165 PluginDef *plugin() {
166 return new Dsp();
167 }
168
169 void Dsp::del_instance(PluginDef *p)
170 {
171 delete static_cast<Dsp*>(p);
172 }
173
174 } // end namespace ring_modulator_st
6060 void clear_state_f();
6161 int load_ui_f(const UiBuilder& b, int form);
6262 void init(unsigned int samplingFreq);
63 void compute(int count, float *input0, float *output0);
63 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
6464 int register_par(const ParamReg& reg);
6565
6666 static void clear_state_f_static(PluginDef*);
6767 static int load_ui_f_static(const UiBuilder& b, int form);
6868 static void init_static(unsigned int samplingFreq, PluginDef*);
69 static void compute_static(int count, float *input0, float *output0, PluginDef*);
69 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
7070 static int register_params_static(const ParamReg& reg);
7171 static void del_instance(PluginDef *p);
7272 public:
140140 static_cast<Dsp*>(p)->init(samplingFreq);
141141 }
142142
143 void always_inline Dsp::compute(int count, float *input0, float *output0)
143 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
144144 {
145145 double fSlow0 = (0.0010000000000000009 * pow(10,(0.05 * fslider0)));
146146 double fSlow1 = (1.0 / fslider1);
278278 }
279279 }
280280
281 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
281 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
282282 {
283283 static_cast<Dsp*>(p)->compute(count, input0, output0);
284284 }
300300 reg.registerVar("eqs.freq1k","","S",N_("Hz"),&fslider14, 1e+03, 2e+01, 2e+04, 1.0);
301301 reg.registerVar("eqs.freq250","","S",N_("Hz"),&fslider20, 2.5e+02, 2e+01, 2e+04, 1.0);
302302 reg.registerVar("eqs.freq2k","","S",N_("Hz"),&fslider11, 2e+03, 2e+01, 2e+04, 1.0);
303 reg.registerVar("eqs.freq31_25","","S",N_("Hz"),&fslider29, 31.0, 2e+01, 2e+04, 1.0);
303 reg.registerVar("eqs.freq31_25","","S",N_("Hz"),&fslider29, 31.25, 2e+01, 2e+04, 1.0);
304304 reg.registerVar("eqs.freq4k","","S",N_("Hz"),&fslider8, 4e+03, 2e+01, 2e+04, 1.0);
305305 reg.registerVar("eqs.freq500","","S",N_("Hz"),&fslider17, 5e+02, 2e+01, 2e+04, 1.0);
306 reg.registerVar("eqs.freq62_5","","S",N_("Hz"),&fslider26, 62.0, 2e+01, 2e+04, 1.0);
306 reg.registerVar("eqs.freq62_5","","S",N_("Hz"),&fslider26, 62.5, 2e+01, 2e+04, 1.0);
307307 reg.registerVar("eqs.freq8k","","S",N_("Hz"),&fslider5, 8e+03, 2e+01, 2e+04, 1.0);
308308 reg.registerVar("eqs.fs125","","S",N_("gain (dB) at 125 Hz"),&fslider21, 0.0, -4e+01, 3e+01, 0.1);
309309 reg.registerVar("eqs.fs16k","","S",N_("gain (dB) at 16 kHz"),&fslider0, 0.0, -4e+01, 3e+01, 0.1);
88 int fSamplingFreq;
99 FAUSTFLOAT fslider0;
1010 void init(unsigned int samplingFreq);
11 void compute(int count, float *input0, float *output0);
11 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
1212 int register_par(const ParamReg& reg);
1313
1414 static void init_static(unsigned int samplingFreq, PluginDef*);
15 static void compute_static(int count, float *input0, float *output0, PluginDef*);
15 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
1616 static int register_params_static(const ParamReg& reg);
1717 static void del_instance(PluginDef *p);
1818 public:
5555 static_cast<Dsp*>(p)->init(samplingFreq);
5656 }
5757
58 void always_inline Dsp::compute(int count, float *input0, float *output0)
58 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
5959 {
6060 double fSlow0 = (0.88 * (2 - fslider0));
6161 double fSlow1 = (0 - fSlow0);
6666 }
6767 }
6868
69 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
69 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
7070 {
7171 static_cast<Dsp*>(p)->compute(count, input0, output0);
7272 }
3838 int activate(bool start);
3939 int load_ui_f(const UiBuilder& b, int form);
4040 void init(unsigned int samplingFreq);
41 void compute(int count, float *input0, float *input1, float *output0, float *output1);
41 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
4242 int register_par(const ParamReg& reg);
4343
4444 static void clear_state_f_static(PluginDef*);
4545 static int activate_static(bool start, PluginDef*);
4646 static int load_ui_f_static(const UiBuilder& b, int form);
4747 static void init_static(unsigned int samplingFreq, PluginDef*);
48 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
48 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
4949 static int register_params_static(const ParamReg& reg);
5050 static void del_instance(PluginDef *p);
5151 public:
151151 return static_cast<Dsp*>(p)->activate(start);
152152 }
153153
154 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
154 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
155155 {
156156 float fSlow0 = (fConst1 * fslider0);
157157 float fSlow1 = (fConst2 * fslider1);
202202 }
203203 }
204204
205 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *p)
205 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
206206 {
207207 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
208208 }
3636 int activate(bool start);
3737 int load_ui_f(const UiBuilder& b, int form);
3838 void init(unsigned int samplingFreq);
39 void compute(int count, float *input0, float *input1, float *output0, float *output1);
39 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
4040 int register_par(const ParamReg& reg);
4141
4242 static void clear_state_f_static(PluginDef*);
4343 static int activate_static(bool start, PluginDef*);
4444 static int load_ui_f_static(const UiBuilder& b, int form);
4545 static void init_static(unsigned int samplingFreq, PluginDef*);
46 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
46 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
4747 static int register_params_static(const ParamReg& reg);
4848 static void del_instance(PluginDef *p);
4949 public:
147147 return static_cast<Dsp*>(p)->activate(start);
148148 }
149149
150 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
150 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
151151 {
152152 int iSlow0 = (int((fConst1 * fslider0)) - 1);
153153 float fSlow1 = (fConst2 * fslider1);
192192 }
193193 }
194194
195 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *p)
195 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
196196 {
197197 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
198198 }
8383 void clear_state_f();
8484 int load_ui_f(const UiBuilder& b, int form);
8585 void init(unsigned int samplingFreq);
86 void compute(int count, float *input0, float *input1, float *output0, float *output1);
86 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
8787 int register_par(const ParamReg& reg);
8888
8989 static void clear_state_f_static(PluginDef*);
9090 static int load_ui_f_static(const UiBuilder& b, int form);
9191 static void init_static(unsigned int samplingFreq, PluginDef*);
92 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
92 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
9393 static int register_params_static(const ParamReg& reg);
9494 static void del_instance(PluginDef *p);
9595 public:
211211 static_cast<Dsp*>(p)->init(samplingFreq);
212212 }
213213
214 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
214 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
215215 {
216216 double fSlow0 = fslider0;
217217 double fSlow1 = (1 - (0.01 * fSlow0));
357357 }
358358 }
359359
360 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *p)
360 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
361361 {
362362 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
363363 }
6969 void clear_state_f();
7070 int load_ui_f(const UiBuilder& b, int form);
7171 void init(unsigned int samplingFreq);
72 void compute(int count, float *input0, float *input1, float *output0, float *output1);
72 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
7373 int register_par(const ParamReg& reg);
7474
7575 static void clear_state_f_static(PluginDef*);
7676 static int load_ui_f_static(const UiBuilder& b, int form);
7777 static void init_static(unsigned int samplingFreq, PluginDef*);
78 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
78 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
7979 static int register_params_static(const ParamReg& reg);
8080 static void del_instance(PluginDef *p);
8181 public:
183183 static_cast<Dsp*>(p)->init(samplingFreq);
184184 }
185185
186 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
186 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
187187 {
188188 double fSlow0 = (0.0010000000000000009 * pow(10,(0.05 * fslider0)));
189189 double fSlow1 = (0.0010000000000000009 * pow(10,(0.05 * fslider1)));
268268 }
269269 }
270270
271 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *p)
271 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
272272 {
273273 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
274274 }
2222 double fConst6;
2323 void clear_state_f();
2424 void init(unsigned int samplingFreq);
25 void compute(int count, float *input0, float *output0);
25 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2626 int register_par(const ParamReg& reg);
2727
2828 static void clear_state_f_static(PluginDef*);
2929 static void init_static(unsigned int samplingFreq, PluginDef*);
30 static void compute_static(int count, float *input0, float *output0, PluginDef*);
30 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
3131 static int register_params_static(const ParamReg& reg);
3232 static void del_instance(PluginDef *p);
3333 public:
8888 static_cast<Dsp*>(p)->init(samplingFreq);
8989 }
9090
91 void always_inline Dsp::compute(int count, float *input0, float *output0)
91 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
9292 {
9393 #define fslider0 (*fslider0_)
9494 #define fslider1 (*fslider1_)
129129 #undef fslider2
130130 }
131131
132 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
132 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
133133 {
134134 static_cast<Dsp*>(p)->compute(count, input0, output0);
135135 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
2626 double fRec0[3];
2727 void clear_state_f();
2828 void init(unsigned int samplingFreq);
29 void compute(int count, float *input0, float *output0);
29 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
3030 int register_par(const ParamReg& reg);
3131
3232 static void clear_state_f_static(PluginDef*);
3333 static void init_static(unsigned int samplingFreq, PluginDef*);
34 static void compute_static(int count, float *input0, float *output0, PluginDef*);
34 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
3535 static int register_params_static(const ParamReg& reg);
3636 static void del_instance(PluginDef *p);
3737 public:
9696 static_cast<Dsp*>(p)->init(samplingFreq);
9797 }
9898
99 void always_inline Dsp::compute(int count, float *input0, float *output0)
99 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
100100 {
101101 #define fslider0 (*fslider0_)
102102 #define fslider1 (*fslider1_)
171171 #undef fslider2
172172 }
173173
174 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
174 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
175175 {
176176 static_cast<Dsp*>(p)->compute(count, input0, output0);
177177 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
1818 FAUSTFLOAT *fslider2_;
1919 void clear_state_f();
2020 void init(unsigned int samplingFreq);
21 void compute(int count, float *input0, float *output0);
21 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2222 int register_par(const ParamReg& reg);
2323
2424 static void clear_state_f_static(PluginDef*);
2525 static void init_static(unsigned int samplingFreq, PluginDef*);
26 static void compute_static(int count, float *input0, float *output0, PluginDef*);
26 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
2727 static int register_params_static(const ParamReg& reg);
2828 static void del_instance(PluginDef *p);
2929 public:
8080 static_cast<Dsp*>(p)->init(samplingFreq);
8181 }
8282
83 void always_inline Dsp::compute(int count, float *input0, float *output0)
83 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
8484 {
8585 #define fslider0 (*fslider0_)
8686 #define fslider1 (*fslider1_)
124124 #undef fslider2
125125 }
126126
127 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
127 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
128128 {
129129 static_cast<Dsp*>(p)->compute(count, input0, output0);
130130 }
2424 void clear_state_f();
2525 int load_ui_f(const UiBuilder& b, int form);
2626 void init(unsigned int samplingFreq);
27 void compute(int count, float *input0, float *output0);
27 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
2828 int register_par(const ParamReg& reg);
2929
3030 static void clear_state_f_static(PluginDef*);
3131 static int load_ui_f_static(const UiBuilder& b, int form);
3232 static void init_static(unsigned int samplingFreq, PluginDef*);
33 static void compute_static(int count, float *input0, float *output0, PluginDef*);
33 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
3434 static int register_params_static(const ParamReg& reg);
3535 static void del_instance(PluginDef *p);
3636 public:
9494 static_cast<Dsp*>(p)->init(samplingFreq);
9595 }
9696
97 void always_inline Dsp::compute(int count, float *input0, float *output0)
97 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
9898 {
9999 double fSlow0 = fslider0;
100100 int iSlow1 = int((fConst2 / double(fSlow0)));
126126 }
127127 }
128128
129 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
129 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
130130 {
131131 static_cast<Dsp*>(p)->compute(count, input0, output0);
132132 }
2525 clear_state_f();
2626 }
2727
28 void compute(int count, float *output0, float *output1)
28 void compute(int count, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
2929 {
3030 #define fslider0 (*fslider0_)
3131 #define fslider1 (*fslider1_)
2525 clear_state_f();
2626 }
2727
28 void compute(int count, float *output0)
28 void compute(int count, FAUSTFLOAT *output0)
2929 {
3030 #define fslider0 (*fslider0_)
3131 double fSlow0 = (fConst0 * fslider0);
1919 <property name="can_focus">True</property>
2020 <property name="receives_default">True</property>
2121 <property name="var_id">crybaby.wah</property>
22 <property name="show_value">False</property>
2223 <property name="label_ref">label4:rack_label</property>
2324 </object>
2425 <packing>
196196 stereo_convolver(*this, sigc::mem_fun(stereo_chain, &StereoModuleChain::sync), get_param()),
197197 cabinet(*this, sigc::mem_fun(mono_chain, &MonoModuleChain::sync), resamp),
198198 preamp(*this, sigc::mem_fun(mono_chain, &MonoModuleChain::sync), resamp),
199 contrast(*this, sigc::mem_fun(mono_chain, &MonoModuleChain::sync), resamp) {
199 contrast(*this, sigc::mem_fun(mono_chain, &MonoModuleChain::sync), resamp),
200 loop(get_param(), sigc::mem_fun(mono_chain,&MonoModuleChain::sync),options.get_loop_dir()),
201 record(*this, 1), record_st(*this, 2) {
200202 set_overload_interval(options.get_sporadic_overload());
201203 if (!options.get_convolver_watchdog()) {
202204 ov_disabled |= ov_Convolver;
280282 pl.add(builtin_tonestack_plugins, PLUGIN_POS_RACK, PGN_ALTERNATIVE);
281283
282284 // mono
285 pl.add(gx_effects::gain::plugin(), PLUGIN_POS_RACK, PGN_GUI);
283286 pl.add(gx_effects::low_high_pass::plugin(), PLUGIN_POS_RACK, PGN_GUI);
284287 pl.add(gx_effects::highbooster::plugin(), PLUGIN_POS_RACK, PGN_GUI);
285288 pl.add(gx_effects::selecteq::plugin(), PLUGIN_POS_RACK, PGN_GUI);
286289 pl.add(&crybaby.plugin, PLUGIN_POS_RACK, PGN_GUI);
290 pl.add(&loop.plugin, PLUGIN_POS_RACK, PGN_GUI);
291 pl.add(&record.plugin, PLUGIN_POS_RACK, PGN_GUI);
287292 pl.add(gx_effects::gx_distortion::plugin(), PLUGIN_POS_RACK, PGN_GUI);
288293 pl.add(pluginlib::ts9sim::plugin(), PLUGIN_POS_RACK, PGN_GUI);
289294 pl.add(gx_effects::impulseresponse::plugin(), PLUGIN_POS_RACK, PGN_GUI);
308313 pl.add(&cabinet.plugin, PLUGIN_POS_RACK, PGN_GUI);
309314 pl.add(&preamp.plugin, PLUGIN_POS_RACK, PGN_GUI);
310315 pl.add(pluginlib::abgate::plugin(), PLUGIN_POS_RACK);
316 pl.add(gx_effects::ring_modulator::plugin(), PLUGIN_POS_RACK, PGN_GUI);
317 pl.add(gx_effects::graphiceq::plugin(), PLUGIN_POS_RACK, PGN_GUI);
311318 pl.add(pluginlib::vibe::plugin_mono(), PLUGIN_POS_RACK);
312 pl.add(pluginlib::mbc::plugin(), PLUGIN_POS_RACK);
319 pl.add(pluginlib::mbc::plugin(), PLUGIN_POS_RACK, PGN_GUI);
320 pl.add(pluginlib::mbd::plugin(), PLUGIN_POS_RACK, PGN_GUI);
321 pl.add(pluginlib::mbe::plugin(), PLUGIN_POS_RACK, PGN_GUI);
322 pl.add(pluginlib::mbdel::plugin(), PLUGIN_POS_RACK, PGN_GUI);
323 pl.add(pluginlib::mbchor::plugin(), PLUGIN_POS_RACK, PGN_GUI);
324 pl.add(pluginlib::jcm800pre::plugin(), PLUGIN_POS_RACK, PGN_GUI);
325 pl.add(pluginlib::gcb_95::plugin(), PLUGIN_POS_RACK, PGN_GUI);
326 pl.add(gx_effects::duck_delay::plugin(), PLUGIN_POS_RACK, PGN_GUI);
327 pl.add(pluginlib::reversedelay::plugin(), PLUGIN_POS_RACK);
313328 // stereo
314329 pl.add(gx_effects::chorus::plugin(), PLUGIN_POS_RACK, PGN_GUI);
315330 pl.add(gx_effects::flanger::plugin(), PLUGIN_POS_RACK, PGN_GUI);
321336 pl.add(gx_effects::tonecontroll::plugin(), PLUGIN_POS_RACK, PGN_GUI);
322337 pl.add(gx_effects::digital_delay_st::plugin(),PLUGIN_POS_RACK, PGN_GUI);
323338 pl.add(&stereo_convolver.plugin, PLUGIN_POS_RACK, PGN_GUI);
339 pl.add(&record_st.plugin, PLUGIN_POS_RACK, PGN_GUI);
324340 pl.add(gx_effects::stereoverb::plugin(), PLUGIN_POS_RACK, PGN_GUI);
325341 pl.add(pluginlib::zita_rev1::plugin(), PLUGIN_POS_RACK);
326342 pl.add(pluginlib::vibe::plugin_stereo(), PLUGIN_POS_RACK);
327 pl.add(pluginlib::mbcs::plugin(), PLUGIN_POS_RACK);
343 pl.add(pluginlib::mbcs::plugin(), PLUGIN_POS_RACK, PGN_GUI);
344 pl.add(gx_effects::dattorros_progenitor::plugin(),PLUGIN_POS_RACK, PGN_GUI);
345 pl.add(gx_effects::panoram_enhancer::plugin(),PLUGIN_POS_RACK, PGN_GUI);
346 pl.add(gx_effects::bass_enhancer::plugin(), PLUGIN_POS_RACK, PGN_GUI);
347 pl.add(gx_effects::ring_modulator_st::plugin(),PLUGIN_POS_RACK, PGN_GUI);
348 pl.add(gx_effects::duck_delay_st::plugin(), PLUGIN_POS_RACK, PGN_GUI);
328349 }
329350
330351 static LadspaLoader::pluginarray::iterator find_plugin(LadspaLoader::pluginarray& ml, plugdesc *pl) {
116116 #include "faust/peak_eq.cc"
117117 #include "faust/digital_delay.cc"
118118 #include "faust/digital_delay_st.cc"
119 #include "faust/dattorros_progenitor.cc"
120 #include "faust/ring_modulator.cc"
121 #include "faust/ring_modulator_st.cc"
122 #include "faust/panoram_enhancer.cc"
123 #include "faust/graphiceq.cc"
124 #include "faust/bass_enhancer.cc"
125 #include "faust/gain.cc"
126 #include "faust/duck_delay.cc"
127 #include "faust/duck_delay_st.cc"
128
119129 }
120130
121131 #include "faust/balance.cc"
799799 impf.init(cab.ir_sr);
800800 }
801801 float cab_irdata_c[cab.ir_count];
802 impf.clear_state_f();
802803 impf.compute(cab.ir_count,cab.ir_data,cab_irdata_c);
803804 while (!conv.checkstate());
804805 if (configure) {
813814 update_cabinet();
814815 update_sum();
815816 return conv_start();
816 }
817
818 bool CabinetConvolver::do_only_update() {
819 CabDesc& cab = *getCabEntry(cabinet).data;
820 float cab_irdata_c[cab.ir_count];
821 impf.compute(cab.ir_count,cab.ir_data,cab_irdata_c);
822
823 if (!conv.update(cab.ir_count, cab_irdata_c, cab.ir_sr)) {
824 return false;
825 }
826 update_sum();
827 return true;
828817 }
829818
830819 bool CabinetConvolver::start(bool force) {
975964 impf.init(pre.ir_sr);
976965 }
977966 float pre_irdata_c[pre.ir_count];
967 impf.clear_state_f();
978968 impf.compute(pre.ir_count,pre.ir_data,pre_irdata_c);
979969 while (!conv.checkstate());
980970 if (configure) {
989979 update_preamp();
990980 update_sum();
991981 return conv_start();
992 }
993
994 bool PreampConvolver::do_only_update() {
995 PreDesc& pre = *getPreEntry(preamp).data;
996 float pre_irdata_c[pre.ir_count];
997 impf.compute(pre.ir_count,pre.ir_data,pre_irdata_c);
998 if (!conv.update(pre.ir_count, pre_irdata_c, pre.ir_sr)) {
999 return false;
1000 }
1001 update_sum();
1002 return true;
1003982 }
1004983
1005984 bool PreampConvolver::start(bool force) {
10861065 return conv_start();
10871066 }
10881067
1089 bool ContrastConvolver::do_only_update() {
1090 float contrast_irdata_c[contrast_ir_desc.ir_count];
1091 presl.compute(contrast_ir_desc.ir_count,contrast_ir_desc.ir_data,contrast_irdata_c);
1092
1093 if (!conv.update(contrast_ir_desc.ir_count, contrast_irdata_c, contrast_ir_desc.ir_sr)) {
1094 return false;
1095 }
1096 update_sum();
1097 return true;
1098 }
1099
11001068 bool ContrastConvolver::start(bool force) {
11011069 if (force) {
11021070 sum = no_sum;
11321100 }
11331101 }
11341102
1103 /****************************************************************
1104 ** class LiveLooper
1105 */
1106
1107 #include "gx_livelooper.cc"
1108
1109 /****************************************************************
1110 ** class SCapture
1111 */
1112
1113 #include "gx_record.cc"
1114
11351115 } // namespace gx_engine
104104
105105 template<class T> static inline T fp_sanitize(T v) {
106106 switch (fpclassify(v)) {
107 case FP_NORMAL: return v;
107108 case FP_NAN: assert(false); return 1e50;
108109 case FP_INFINITE: assert(false); return (v < 0 ? -1e50 : 1e50);
109110 case FP_SUBNORMAL: return 0;
416417 return value_false;
417418 }
418419 // sanitize bad input
419 if (next_str == "nan" && next_str == "inf") {
420 if (next_str == "nan" || next_str == "inf") {
420421 assert(false);
421422 next_str = "1e50";
422423 return value_number;
423424 }
424 if (next_str == "-inf") {
425 if (next_str == "-nan" || next_str == "-inf") {
425426 assert(false);
426427 next_str = "-1e50";
427428 return value_number;
0 /*
1 * Copyright (C) 2013 Hermann Meyer, Andreas Degert
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 *
18 *
19 * This is part of the Guitarix Audio Engine
20 *
21 *
22 *
23 * --------------------------------------------------------------------------
24 */
25
26
27
28 LiveLooper::LiveLooper(ParamMap& param_, sigc::slot<void> sync_, const string& loop_dir_)
29 : PluginDef(),
30 tape1(0),
31 tape2(0),
32 tape3(0),
33 tape4(0),
34 save1(false),
35 save2(false),
36 save3(false),
37 save4(false),
38 RP1(false),
39 RP2(false),
40 RP3(false),
41 RP4(false),
42 preset_name("tape"),
43 cur_name("tape"),
44 loop_dir(loop_dir_),
45 save_p(false),
46 param(param_),
47 mem_allocated(false),
48 sync(sync_),
49 ready(false),
50 plugin() {
51 version = PLUGINDEF_VERSION;
52 id = "dubber";
53 name = N_("Dubber");
54 groups = 0;
55 description = N_("Live Looper"); // description (tooltip)
56 category = N_("Echo / Delay"); // category
57 shortname = ""; // shortname
58 mono_audio = compute_static;
59 stereo_audio = 0;
60 set_samplerate = init_static;
61 activate_plugin = activate_static;
62 register_params = register_params_static;
63 load_ui = load_ui_f_static;
64 clear_state = clear_state_f_static;
65 delete_instance = del_instance;
66 plugin = this;
67 }
68
69 LiveLooper::~LiveLooper() {
70 activate(false);
71 }
72
73 inline void LiveLooper::clear_state_f()
74 {
75 for (int i=0; i<2; i++) fRec0[i] = 0;
76 for (int i=0; i<2; i++) iVec0[i] = 0;
77 for (int i=0; i<4194304; i++) tape1[i] = 0;
78 for (int i=0; i<2; i++) RecSize1[i] = 0;
79 for (int i=0; i<2; i++) fRec1[i] = 0;
80 for (int i=0; i<2; i++) fRec2[i] = 0;
81 for (int i=0; i<2; i++) iRec3[i] = 0;
82 for (int i=0; i<2; i++) iRec4[i] = 0;
83 for (int i=0; i<2; i++) iVec2[i] = 0;
84 for (int i=0; i<4194304; i++) tape2[i] = 0;
85 for (int i=0; i<2; i++) RecSize2[i] = 0;
86 for (int i=0; i<2; i++) fRec6[i] = 0;
87 for (int i=0; i<2; i++) fRec7[i] = 0;
88 for (int i=0; i<2; i++) iRec8[i] = 0;
89 for (int i=0; i<2; i++) iRec9[i] = 0;
90 for (int i=0; i<2; i++) iVec4[i] = 0;
91 for (int i=0; i<4194304; i++) tape3[i] = 0;
92 for (int i=0; i<2; i++) RecSize3[i] = 0;
93 for (int i=0; i<2; i++) fRec11[i] = 0;
94 for (int i=0; i<2; i++) fRec12[i] = 0;
95 for (int i=0; i<2; i++) iRec13[i] = 0;
96 for (int i=0; i<2; i++) iRec14[i] = 0;
97 for (int i=0; i<2; i++) iVec6[i] = 0;
98 for (int i=0; i<4194304; i++) tape4[i] = 0;
99 for (int i=0; i<2; i++) RecSize4[i] = 0;
100 for (int i=0; i<2; i++) fRec16[i] = 0;
101 for (int i=0; i<2; i++) fRec17[i] = 0;
102 for (int i=0; i<2; i++) iRec18[i] = 0;
103 for (int i=0; i<2; i++) iRec19[i] = 0;
104 }
105
106 void LiveLooper::clear_state_f_static(PluginDef *p)
107 {
108 static_cast<LiveLooper*>(p)->clear_state_f();
109 }
110
111 inline void LiveLooper::init(unsigned int samplingFreq)
112 {
113 fSamplingFreq = samplingFreq;
114 IOTA1 = 0;
115 IOTA2 = 0;
116 IOTA3 = 0;
117 IOTA4 = 0;
118 IOTAR1 = 0;
119 IOTAR2 = 0;
120 IOTAR3 = 0;
121 IOTAR4 = 0;
122 fConst0 = (1e+01f / float(fmin(192000, fmax(1, fSamplingFreq))));
123 fConst1 = (0 - fConst0);
124 fConst2 = (1.0 / float(fmin(192000, fmax(1, fSamplingFreq))));
125 }
126
127 void LiveLooper::init_static(unsigned int samplingFreq, PluginDef *p)
128 {
129 static_cast<LiveLooper*>(p)->init(samplingFreq);
130 }
131
132 void LiveLooper::mem_alloc()
133 {
134 try {
135 if (!tape1) tape1 = new float[4194304];
136 if (!tape2) tape2 = new float[4194304];
137 if (!tape3) tape3 = new float[4194304];
138 if (!tape4) tape4 = new float[4194304];
139 } catch(...) {
140 gx_print_error("dubber", "out of memory");
141 return;
142 }
143 mem_allocated = true;
144 ready = true;
145 }
146
147 void LiveLooper::mem_free()
148 {
149 ready = false;
150 mem_allocated = false;
151 if (tape1) { delete tape1; tape1 = 0; }
152 if (tape2) { delete tape2; tape2 = 0; }
153 if (tape3) { delete tape3; tape3 = 0; }
154 if (tape4) { delete tape4; tape4 = 0; }
155 }
156
157 inline int LiveLooper::load_from_wave(std::string fname, float *tape)
158 {
159 SF_INFO sfinfo;
160 int n,f,c;
161 int fSize = 0;
162 sfinfo.format = 0;
163 SNDFILE *sf = sf_open(fname.c_str(),SFM_READ,&sfinfo);
164 if (sf ) {
165 f = sfinfo.frames;
166 c = sfinfo.channels;
167 n = f*c;
168 fSize = sf_read_float(sf,tape,n);
169 }
170 sf_close(sf);
171 return fSize;
172 }
173
174 inline void LiveLooper::load_array(std::string name)
175 {
176 RecSize1[1] = load_from_wave(loop_dir+name+"1.wav", tape1);
177 IOTAR1= RecSize1[1] - int(RecSize1[1]*(100-fclips1)*0.01);
178
179 RecSize2[1] = load_from_wave(loop_dir+name+"2.wav", tape2);
180 IOTAR2= RecSize2[1] - int(RecSize2[1]*(100-fclips2)*0.01);
181
182 RecSize3[1] = load_from_wave(loop_dir+name+"3.wav", tape3);
183 IOTAR3= RecSize3[1] - int(RecSize3[1]*(100-fclips3)*0.01);
184
185 RecSize4[1] = load_from_wave(loop_dir+name+"4.wav", tape4);
186 IOTAR4= RecSize4[1] - int(RecSize4[1]*(100-fclips4)*0.01);
187
188 cur_name = preset_name;
189 }
190
191 inline void LiveLooper::save_to_wave(std::string fname, float *tape, float fSize)
192 {
193 SF_INFO sfinfo ;
194 sfinfo.channels = 1;
195 sfinfo.samplerate = fSamplingFreq;
196 sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_FLOAT;
197
198 SNDFILE * sf = sf_open(fname.c_str(), SFM_WRITE, &sfinfo);
199 if (sf) {
200 size_t lSize = 4194304 - int(fSize/fConst2);
201 sf_write_float(sf,tape, lSize);
202 sf_write_sync(sf);
203 }
204 sf_close(sf);
205 }
206
207 inline void LiveLooper::save_array(std::string name)
208 {
209 if (name.compare("tape")==0 || save_p) {
210 if (save1) {
211 save_to_wave(loop_dir+name+"1.wav",tape1,rectime0);
212 save1 = false;
213 }
214 if (save2) {
215 save_to_wave(loop_dir+name+"2.wav",tape2,rectime1);
216 save2 = false;
217 }
218 if (save3) {
219 save_to_wave(loop_dir+name+"3.wav",tape3,rectime2);
220 save3 = false;
221 }
222 if (save4) {
223 save_to_wave(loop_dir+name+"4.wav",tape4,rectime3);
224 save4 = false;
225 }
226 }
227 }
228
229 int LiveLooper::activate(bool start)
230 {
231 if (start) {
232 if (!mem_allocated) {
233 mem_alloc();
234 clear_state_f();
235 load_array(preset_name);
236 }
237 } else if (mem_allocated) {
238 save_array(cur_name);
239 mem_free();
240 }
241 return 0;
242 }
243
244 int LiveLooper::activate_static(bool start, PluginDef *p)
245 {
246 return static_cast<LiveLooper*>(p)->activate(start);
247 }
248
249 void LiveLooper::set_p_state() {
250 if (!preset_name.empty()) {
251 ready = false;
252 sync();
253 activate(true);
254 if(save_p) {
255 save1 = true;
256 save2 = true;
257 save3 = true;
258 save4 = true;
259 cur_name = preset_name;
260 // fprintf (stderr,"save_p: %s\n",cur_name.c_str());
261 }
262 activate(false);
263 activate(true);
264 ready = true;
265 save_p = false;
266 }
267 //fprintf (stderr,"set_p_state: %s\n",preset_name.c_str());
268 }
269
270 void always_inline LiveLooper::compute(int count, float *input0, float *output0)
271 {
272 if (!ready) {
273 memcpy(output0, input0, count * sizeof(float));
274 return;
275 }
276 // trigger save array on exit
277 if(record1 || reset1) save1 = true;
278 if(record2 || reset2) save2 = true;
279 if(record3 || reset3) save3 = true;
280 if(record4 || reset4) save4 = true;
281 // make play/ reverse play button act as radio button
282 if (rplay1 && !RP1) {play1 = 0.0;RP1=true;}
283 else if (play1 && RP1) {rplay1 = 0.0;RP1=false;}
284 if (rplay2 && !RP2) {play2 = 0.0;RP2=true;}
285 else if (play2 && RP2) {rplay2 = 0.0;RP2=false;}
286 if (rplay3 && !RP3) {play3 = 0.0;RP3=true;}
287 else if (play3 && RP3) {rplay3 = 0.0;RP3=false;}
288 if (rplay4 && !RP4) {play4 = 0.0;RP4=true;}
289 else if (play4 && RP4) {rplay4 = 0.0;RP4=false;}
290 // switch off record when buffer is full
291 record1 = rectime0? record1 : 0.0;
292 record2 = rectime1? record2 : 0.0;
293 record3 = rectime2? record3 : 0.0;
294 record4 = rectime3? record4 : 0.0;
295 // reset clip when reset is pressed
296 if (reset1) {fclip1=100.0;fclips1=0.0;}
297 if (reset2) {fclip2=100.0;fclips2=0.0;}
298 if (reset3) {fclip3=100.0;fclips3=0.0;}
299 if (reset4) {fclip4=100.0;fclips4=0.0;}
300 // switch off reset button when buffer is empty
301 reset1 = (rectime0 < 4194304*fConst2)? reset1 : 0.0;
302 reset2 = (rectime1 < 4194304*fConst2)? reset2 : 0.0;
303 reset3 = (rectime2 < 4194304*fConst2)? reset3 : 0.0;
304 reset4 = (rectime3 < 4194304*fConst2)? reset4 : 0.0;
305 // set play head position
306 float ph1 = 1.0/(RecSize1[0] * 0.001);
307 playh1 = (1-iVec0[0]) * fmin(1000,fmax(0,float(IOTAR1*ph1)));
308 float ph2 = 1.0/(RecSize2[0] * 0.001);
309 playh2 = (1-iVec2[0]) * fmin(1000,fmax(0,float(IOTAR2*ph2)));
310 float ph3 = 1.0/(RecSize3[0] * 0.001);
311 playh3 = (1-iVec4[0]) * fmin(1000,fmax(0,float(IOTAR3*ph3)));
312 float ph4 = 1.0/(RecSize4[0] * 0.001);
313 playh4 = (1-iVec6[0]) * fmin(1000,fmax(0,float(IOTAR4*ph4)));
314 // playback speed
315 float speed1 = fspeed1;
316 float speed2 = fspeed2;
317 float speed3 = fspeed3;
318 float speed4 = fspeed4;
319 // engine var settings
320 float fSlow0 = (0.0010000000000000009f * powf(10,(0.05f * gain)));
321 float fSlow1 = gain_out;
322 int iSlow3 = int(record1);
323 int iSlow4 = int((1 - reset1));
324 float fSlow5 = (((1 - iSlow3) * gain1) * (play1+rplay1));
325 int iSlow6 = int(record2);
326 int iSlow7 = int((1 - reset2));
327 float fSlow8 = (((1 - iSlow6) * gain2) * (play2+rplay2));
328 int iSlow9 = int(record3);
329 int iSlow10 = int((1 - reset3));
330 float fSlow11 = (((1 - iSlow9) * gain3) * (play3+rplay3));
331 int iSlow12 = int(record4);
332 int iSlow13 = int((1 - reset4));
333 float fSlow14 = (((1 - iSlow12) * gain4) * (play4+rplay4));
334 float fSlow15 = (0.0001f * fSlow1);
335 float iClip1 = fclip1*0.01;
336 float iClip2 = fclip2*0.01;
337 float iClip3 = fclip3*0.01;
338 float iClip4 = fclip4*0.01;
339 float iClips1 = (100-fclips1)*0.01;
340 float iClips2 = (100-fclips2)*0.01;
341 float iClips3 = (100-fclips3)*0.01;
342 float iClips4 = (100-fclips4)*0.01;
343 // run loop
344 for (int i=0; i<count; i++) {
345 fRec0[0] = (fSlow0 + (0.999f * fRec0[1]));
346 float fTemp0 = ((float)input0[i] * fRec0[0]);
347 iVec0[0] = iSlow3;
348 float fTemp1 = (iSlow3 * fTemp0);
349 RecSize1[0] = fmin(4194304, (int)(iSlow4 * (((iSlow3 - iVec0[1]) <= 0) * (iSlow3 + RecSize1[1]))));
350 int iTemp2 = (4194304 - RecSize1[0]);
351 rectime0 = iTemp2*fConst2;
352 int iTemp3 = fmin(4194304-1, (int)(4194304 - iTemp2));
353 if (iSlow3 == 1) {
354 IOTA1 = IOTA1>int(iTemp3*iClip1)? iTemp3 - int(iTemp3*iClips1):IOTA1+1;
355 tape1[IOTA1] = fTemp1;
356 }
357 if (rplay1) {
358 IOTAR1 = IOTAR1-speed1< (iTemp3 - int(iTemp3*iClips1))? int(iTemp3*iClip1):(IOTAR1-speed1)-1;
359 } else if (play1) {
360 IOTAR1 = IOTAR1+speed1>int(iTemp3*iClip1)? iTemp3 - int(iTemp3*iClips1):(IOTAR1+speed1)+1;
361 }
362
363 float fTemp4 = ((int((fRec1[1] != 0.0f)))?((int(((fRec2[1] > 0.0f) & (fRec2[1] < 1.0f))))?fRec1[1]:0):((int(((fRec2[1] == 0.0f) & (iTemp3 != iRec3[1]))))?fConst0:((int(((fRec2[1] == 1.0f) & (iTemp3 != iRec4[1]))))?fConst1:0)));
364 fRec1[0] = fTemp4;
365 fRec2[0] = fmax(0.0f, fmin(1.0f, (fRec2[1] + fTemp4)));
366 iRec3[0] = ((int(((fRec2[1] >= 1.0f) & (iRec4[1] != iTemp3))))?iTemp3:iRec3[1]);
367 iRec4[0] = ((int(((fRec2[1] <= 0.0f) & (iRec3[1] != iTemp3))))?iTemp3:iRec4[1]);
368 iVec2[0] = iSlow6;
369 float fTemp5 = (iSlow6 * fTemp0);
370 RecSize2[0] = fmin(4194304, (int)(iSlow7 * (((iSlow6 - iVec2[1]) <= 0) * (iSlow6 + RecSize2[1]))));
371 int iTemp6 = (4194304 - RecSize2[0]);
372 rectime1 = iTemp6*fConst2;
373 int iTemp7 = fmin(4194304-1, (int)(4194304 - iTemp6));
374 if (iSlow6 == 1) {
375 IOTA2 = IOTA2>int(iTemp7*iClip2)? iTemp7 - int(iTemp7*iClips2):IOTA2+1;
376 tape2[IOTA2] = fTemp5;
377 }
378 if (rplay2) {
379 IOTAR2 = IOTAR2-speed2< (iTemp7 - int(iTemp7*iClips2))? int(iTemp7*iClip2):(IOTAR2-speed2)-1;
380 } else if (play2) {
381 IOTAR2 = IOTAR2+speed2>int(iTemp7*iClip2)? iTemp7 - int(iTemp7*iClips2):(IOTAR2+speed2)+1;
382 }
383
384 float fTemp8 = ((int((fRec6[1] != 0.0f)))?((int(((fRec7[1] > 0.0f) & (fRec7[1] < 1.0f))))?fRec6[1]:0):((int(((fRec7[1] == 0.0f) & (iTemp7 != iRec8[1]))))?fConst0:((int(((fRec7[1] == 1.0f) & (iTemp7 != iRec9[1]))))?fConst1:0)));
385 fRec6[0] = fTemp8;
386 fRec7[0] = fmax(0.0f, fmin(1.0f, (fRec7[1] + fTemp8)));
387 iRec8[0] = ((int(((fRec7[1] >= 1.0f) & (iRec9[1] != iTemp7))))?iTemp7:iRec8[1]);
388 iRec9[0] = ((int(((fRec7[1] <= 0.0f) & (iRec8[1] != iTemp7))))?iTemp7:iRec9[1]);
389 iVec4[0] = iSlow9;
390 float fTemp9 = (iSlow9 * fTemp0);
391 RecSize3[0] = fmin(4194304, (int)(iSlow10 * (((iSlow9 - iVec4[1]) <= 0) * (iSlow9 + RecSize3[1]))));
392 int iTemp10 = (4194304 - RecSize3[0]);
393 rectime2 = iTemp10*fConst2;
394 int iTemp11 = fmin(4194304-1, (int)(4194304 - iTemp10));
395 if (iSlow9 == 1) {
396 IOTA3 = IOTA3>int(iTemp11*iClip3)? iTemp11 - int(iTemp11*iClips3):IOTA3+1;
397 tape3[IOTA3] = fTemp9;
398 }
399 if (rplay3) {
400 IOTAR3 = IOTAR3-speed3< (iTemp11 - int(iTemp11*iClips3))? int(iTemp11*iClip3):(IOTAR3-speed3)-1;
401 } else if (play3) {
402 IOTAR3 = IOTAR3+speed3>int(iTemp11*iClip3)? iTemp11 - int(iTemp11*iClips3):(IOTAR3+speed3)+1;
403 }
404
405 float fTemp12 = ((int((fRec11[1] != 0.0f)))?((int(((fRec12[1] > 0.0f) & (fRec12[1] < 1.0f))))?fRec11[1]:0):((int(((fRec12[1] == 0.0f) & (iTemp11 != iRec13[1]))))?fConst0:((int(((fRec12[1] == 1.0f) & (iTemp11 != iRec14[1]))))?fConst1:0)));
406 fRec11[0] = fTemp12;
407 fRec12[0] = fmax(0.0f, fmin(1.0f, (fRec12[1] + fTemp12)));
408 iRec13[0] = ((int(((fRec12[1] >= 1.0f) & (iRec14[1] != iTemp11))))?iTemp11:iRec13[1]);
409 iRec14[0] = ((int(((fRec12[1] <= 0.0f) & (iRec13[1] != iTemp11))))?iTemp11:iRec14[1]);
410 iVec6[0] = iSlow12;
411 float fTemp13 = (iSlow12 * fTemp0);
412 RecSize4[0] = fmin(4194304, (int)(iSlow13 * (((iSlow12 - iVec6[1]) <= 0) * (iSlow12 + RecSize4[1]))));
413 int iTemp14 = (4194304 - RecSize4[0]);
414 rectime3 = iTemp14*fConst2;
415 int iTemp15 = fmin(4194304-1, (int)(4194304 - iTemp14));
416 if (iSlow12 == 1) {
417 IOTA4 = IOTA4>int(iTemp15*iClip4)? iTemp15 - int(iTemp15*iClips4):IOTA4+1;
418 tape4[IOTA4] = fTemp13;
419 }
420 if (rplay4) {
421 IOTAR4 = IOTAR4-speed4< (iTemp15 - int(iTemp15*iClips4))? int(iTemp15*iClip4):(IOTAR4-speed4)-1;
422 } else if (play4) {
423 IOTAR4 = IOTAR4+speed4>int(iTemp15*iClip4)? iTemp15 - int(iTemp15*iClips4):(IOTAR4+speed4)+1;
424 }
425
426 float fTemp16 = ((int((fRec16[1] != 0.0f)))?((int(((fRec17[1] > 0.0f) & (fRec17[1] < 1.0f))))?fRec16[1]:0):((int(((fRec17[1] == 0.0f) & (iTemp15 != iRec18[1]))))?fConst0:((int(((fRec17[1] == 1.0f) & (iTemp15 != iRec19[1]))))?fConst1:0)));
427 fRec16[0] = fTemp16;
428 fRec17[0] = fmax(0.0f, fmin(1.0f, (fRec17[1] + fTemp16)));
429 iRec18[0] = ((int(((fRec17[1] >= 1.0f) & (iRec19[1] != iTemp15))))?iTemp15:iRec18[1]);
430 iRec19[0] = ((int(((fRec17[1] <= 0.0f) & (iRec18[1] != iTemp15))))?iTemp15:iRec19[1]);
431 output0[i] = (float)((fSlow15 * ((fSlow14 * ((fRec17[0] * tape4[int(IOTAR4)]) + ((1.0f - fRec17[0]) * tape4[int(IOTAR4)]))) + ((fSlow11 * ((fRec12[0] * tape3[int(IOTAR3)]) + ((1.0f - fRec12[0]) * tape3[int(IOTAR3)]))) + ((fSlow8 * ((fRec7[0] * tape2[int(IOTAR2)]) + ((1.0f - fRec7[0]) * tape2[int(IOTAR2)]))) + (fSlow5 * ((fRec2[0] * tape1[int(IOTAR1)]) + ((1.0f - fRec2[0]) * tape1[int(IOTAR1)]))))))) + (fTemp0));
432 // post processing
433 iRec19[1] = iRec19[0];
434 iRec18[1] = iRec18[0];
435 fRec17[1] = fRec17[0];
436 fRec16[1] = fRec16[0];
437 RecSize4[1] = RecSize4[0];
438 iVec6[1] = iVec6[0];
439 iRec14[1] = iRec14[0];
440 iRec13[1] = iRec13[0];
441 fRec12[1] = fRec12[0];
442 fRec11[1] = fRec11[0];
443 RecSize3[1] = RecSize3[0];
444 iVec4[1] = iVec4[0];
445 iRec9[1] = iRec9[0];
446 iRec8[1] = iRec8[0];
447 fRec7[1] = fRec7[0];
448 fRec6[1] = fRec6[0];
449 RecSize2[1] = RecSize2[0];
450 iVec2[1] = iVec2[0];
451 iRec4[1] = iRec4[0];
452 iRec3[1] = iRec3[0];
453 fRec2[1] = fRec2[0];
454 fRec1[1] = fRec1[0];
455 RecSize1[1] = RecSize1[0];
456 iVec0[1] = iVec0[0];
457 fRec0[1] = fRec0[0];
458 }
459 }
460
461 void __rt_func LiveLooper::compute_static(int count, float *input0, float *output0, PluginDef *p)
462 {
463 static_cast<LiveLooper*>(p)->compute(count, input0, output0);
464 }
465
466 int LiveLooper::register_par(const ParamReg& reg)
467 {
468 reg.registerVar("dubber.clip1","","S",N_("percentage clip at the delay length "),&fclip1, 1e+02f, 0.0f, 1e+02f, 1.0f);
469 reg.registerVar("dubber.clip2","","S",N_("percentage clip at the delay length "),&fclip2, 1e+02f, 0.0f, 1e+02f, 1.0f);
470 reg.registerVar("dubber.clip3","","S",N_("percentage clip at the delay length "),&fclip3, 1e+02f, 0.0f, 1e+02f, 1.0f);
471 reg.registerVar("dubber.clip4","","S",N_("percentage clip at the delay length "),&fclip4, 1e+02f, 0.0f, 1e+02f, 1.0f);
472 reg.registerVar("dubber.clips1","","S",N_("percentage cut on the delay start "),&fclips1, 0.0f, 0.0f, 1e+02f, 1.0f);
473 reg.registerVar("dubber.clips2","","S",N_("percentage cut on the delay start "),&fclips2, 0.0f, 0.0f, 1e+02f, 1.0f);
474 reg.registerVar("dubber.clips3","","S",N_("percentage cut on the delay start "),&fclips3, 0.0f, 0.0f, 1e+02f, 1.0f);
475 reg.registerVar("dubber.clips4","","S",N_("percentage cut on the delay start "),&fclips4, 0.0f, 0.0f, 1e+02f, 1.0f);
476 reg.registerVar("dubber.speed1","","S",N_("playback speed "),&fspeed1, 0.0f, -0.9f, 0.9f, 0.01f);
477 reg.registerVar("dubber.speed2","","S",N_("playback speed "),&fspeed2, 0.0f, -0.9f, 0.9f, 0.01f);
478 reg.registerVar("dubber.speed3","","S",N_("playback speed "),&fspeed3, 0.0f, -0.9f, 0.9f, 0.01f);
479 reg.registerVar("dubber.speed4","","S",N_("playback speed "),&fspeed4, 0.0f, -0.9f, 0.9f, 0.01f);
480 reg.registerNonMidiFloatVar("dubber.bar1",&rectime0, false, true, 0.0, 0.0, 96.0, 1.0);
481 reg.registerNonMidiFloatVar("dubber.bar2",&rectime1, false, true, 0.0, 0.0, 96.0, 1.0);
482 reg.registerNonMidiFloatVar("dubber.bar3",&rectime2, false, true, 0.0, 0.0, 96.0, 1.0);
483 reg.registerNonMidiFloatVar("dubber.bar4",&rectime3, false, true, 0.0, 0.0, 96.0, 1.0);
484 reg.registerVar("dubber.gain","","S",N_("overall gain of the input"),&gain, 0.0f, -2e+01f, 12.0f, 0.1f);
485 reg.registerVar("dubber.level1","","S",N_("percentage of the delay gain level"),&gain1, 5e+01f, 0.0f, 1e+02f, 1.0f);
486 reg.registerVar("dubber.level2","","S",N_("percentage of the delay gain level"),&gain2, 5e+01f, 0.0f, 1e+02f, 1.0f);
487 reg.registerVar("dubber.level3","","S",N_("percentage of the delay gain level"),&gain3, 5e+01f, 0.0f, 1e+02f, 1.0f);
488 reg.registerVar("dubber.level4","","S",N_("percentage of the delay gain level"),&gain4, 5e+01f, 0.0f, 1e+02f, 1.0f);
489 reg.registerVar("dubber.mix","","S",N_("overall gain_out of the delay line in percent"),&gain_out, 1e+02f, 0.0f, 1.5e+02f, 1.0f);
490 reg.registerVar("dubber.play1","","B",N_("play tape 1"),&play1, 0.0, 0.0, 1.0, 1.0);
491 reg.registerVar("dubber.play2","","B",N_("play tape 2"),&play2, 0.0, 0.0, 1.0, 1.0);
492 reg.registerVar("dubber.play3","","B",N_("play tape 3"),&play3, 0.0, 0.0, 1.0, 1.0);
493 reg.registerVar("dubber.play4","","B",N_("play tape 4"),&play4, 0.0, 0.0, 1.0, 1.0);
494 reg.registerVar("dubber.rplay1","","B",N_("play reverse"),&rplay1, 0.0, 0.0, 1.0, 1.0);
495 reg.registerVar("dubber.rplay2","","B",N_("play reverse"),&rplay2, 0.0, 0.0, 1.0, 1.0);
496 reg.registerVar("dubber.rplay3","","B",N_("play reverse"),&rplay3, 0.0, 0.0, 1.0, 1.0);
497 reg.registerVar("dubber.rplay4","","B",N_("play reverse"),&rplay4, 0.0, 0.0, 1.0, 1.0);
498 reg.registerNonMidiFloatVar("dubber.playh1",&playh1, false, true, 0.0, 0.0, 1000.0, 1.0);
499 reg.registerNonMidiFloatVar("dubber.playh2",&playh2, false, true, 0.0, 0.0, 1000.0, 1.0);
500 reg.registerNonMidiFloatVar("dubber.playh3",&playh3, false, true, 0.0, 0.0, 1000.0, 1.0);
501 reg.registerNonMidiFloatVar("dubber.playh4",&playh4, false, true, 0.0, 0.0, 1000.0, 1.0);
502 reg.registerVar("dubber.rec1","","B",N_("record"),&record1, 0.0, 0.0, 1.0, 1.0);
503 reg.registerVar("dubber.rec2","","B",N_("record"),&record2, 0.0, 0.0, 1.0, 1.0);
504 reg.registerVar("dubber.rec3","","B",N_("record"),&record3, 0.0, 0.0, 1.0, 1.0);
505 reg.registerVar("dubber.rec4","","B",N_("record"),&record4, 0.0, 0.0, 1.0, 1.0);
506 reg.registerVar("dubber.reset1","","B",N_("erase"),&reset1, 0.0, 0.0, 1.0, 1.0);
507 reg.registerVar("dubber.reset2","","B",N_("erase"),&reset2, 0.0, 0.0, 1.0, 1.0);
508 reg.registerVar("dubber.reset3","","B",N_("erase"),&reset3, 0.0, 0.0, 1.0, 1.0);
509 reg.registerVar("dubber.reset4","","B",N_("erase"),&reset4, 0.0, 0.0, 1.0, 1.0);
510 param.reg_non_midi_par("dubber.savefile", &save_p, false);
511 param.reg_preset_string("dubber.filename", "", &preset_name, "tape");
512 param["dubber.filename"].signal_changed_string().connect(
513 sigc::hide(sigc::mem_fun(this, &LiveLooper::set_p_state)));
514 return 0;
515 }
516
517 int LiveLooper::register_params_static(const ParamReg& reg)
518 {
519 return static_cast<LiveLooper*>(reg.plugin)->register_par(reg);
520 }
521
522 inline int LiveLooper::load_ui_f(const UiBuilder& b, int form)
523 {
524 if (form & UI_FORM_STACK) {
525 #define PARAM(p) ("dubber" "." p)
526 b.openHorizontalhideBox("");
527 b.create_feedback_switch(sw_pbutton,PARAM("play1"));
528 b.create_feedback_switch(sw_pbutton,PARAM("play2"));
529 b.create_feedback_switch(sw_pbutton,PARAM("play3"));
530 b.create_feedback_switch(sw_pbutton,PARAM("play4"));
531 b.closeBox();
532
533 b.openHorizontalBox("");
534 b.create_small_rackknob(PARAM("gain"), 0);
535
536 b.openTabBox("");
537
538 b.openHorizontalBox(N_("Tape 1"));
539 b.openpaintampBox("");
540
541 b.openVerticalBox("");
542 b.openHorizontalBox("");
543 b.insertSpacer();
544 b.openVerticalBox("");
545 b.insertSpacer();
546 b.create_p_display(PARAM("playh1"),PARAM("clips1"),PARAM("clip1"));
547 b.insertSpacer();
548 b.openHorizontalBox("");
549 b.create_feedback_switch(sw_rbutton,PARAM("rec1"));
550 b.create_feedback_switch(sw_pbutton,PARAM("play1"));
551 b.create_feedback_switch(sw_prbutton,PARAM("rplay1"));
552 b.create_feedback_switch(sw_button,PARAM("reset1"));
553 b.closeBox();
554 b.closeBox();
555
556 b.insertSpacer();
557 b.create_port_display(PARAM("bar1"), "buffer");
558 b.insertSpacer();
559 b.closeBox();
560 b.create_feedback_slider(PARAM("clips1"), "cut");
561 b.create_feedback_slider(PARAM("clip1"), "clip");
562 b.create_master_slider(PARAM("speed1"), "speed");
563
564 b.closeBox();
565 b.create_small_rackknob(PARAM("level1"), "level");
566
567 b.closeBox();
568 b.closeBox();
569
570 b.openHorizontalBox(N_("Tape 2"));
571 b.openpaintampBox("");
572 b.openVerticalBox("");
573
574 b.openHorizontalBox("");
575 b.insertSpacer();
576 b.openVerticalBox("");
577 b.insertSpacer();
578 b.create_p_display(PARAM("playh2"),PARAM("clips2"),PARAM("clip2"));
579 b.insertSpacer();
580 b.openHorizontalBox("");
581 b.create_feedback_switch(sw_rbutton,PARAM("rec2"));
582 b.create_feedback_switch(sw_pbutton,PARAM("play2"));
583 b.create_feedback_switch(sw_prbutton,PARAM("rplay2"));
584 b.create_feedback_switch(sw_button,PARAM("reset2"));
585 b.closeBox();
586 b.closeBox();
587 b.insertSpacer();
588 b.create_port_display(PARAM("bar2"), "buffer");
589 b.insertSpacer();
590 b.closeBox();
591 b.create_feedback_slider(PARAM("clips2"), "cut");
592 b.create_feedback_slider(PARAM("clip2"), "clip");
593 b.create_master_slider(PARAM("speed2"), "speed");
594
595 b.closeBox();
596
597 b.create_small_rackknob(PARAM("level2"), "level");
598 b.closeBox();
599 b.closeBox();
600
601 b.openHorizontalBox(N_("Tape 3"));
602 b.openpaintampBox("");
603 b.openVerticalBox("");
604
605 b.openHorizontalBox("");
606 b.insertSpacer();
607 b.openVerticalBox("");
608 b.insertSpacer();
609 b.create_p_display(PARAM("playh3"),PARAM("clips3"),PARAM("clip3"));
610 b.insertSpacer();
611 b.openHorizontalBox("");
612 b.create_feedback_switch(sw_rbutton,PARAM("rec3"));
613 b.create_feedback_switch(sw_pbutton,PARAM("play3"));
614 b.create_feedback_switch(sw_prbutton,PARAM("rplay3"));
615 b.create_feedback_switch(sw_button,PARAM("reset3"));
616 b.closeBox();
617 b.closeBox();
618 b.insertSpacer();
619 b.create_port_display(PARAM("bar3"), "buffer");
620 b.insertSpacer();
621 b.closeBox();
622 b.create_feedback_slider(PARAM("clips3"), "cut");
623 b.create_feedback_slider(PARAM("clip3"), "clip");
624 b.create_master_slider(PARAM("speed3"), "speed");
625
626 b.closeBox();
627 b.create_small_rackknob(PARAM("level3"), "level");
628 b.closeBox();
629 b.closeBox();
630
631 b.openHorizontalBox(N_("Tape 4"));
632 b.openpaintampBox("");
633 b.openVerticalBox("");
634
635 b.openHorizontalBox("");
636 b.insertSpacer();
637 b.openVerticalBox("");
638 b.insertSpacer();
639 b.create_p_display(PARAM("playh4"),PARAM("clips4"),PARAM("clip4"));
640 b.insertSpacer();
641 b.openHorizontalBox("");
642 b.create_feedback_switch(sw_rbutton,PARAM("rec4"));
643 b.create_feedback_switch(sw_pbutton,PARAM("play4"));
644 b.create_feedback_switch(sw_prbutton,PARAM("rplay4"));
645 b.create_feedback_switch(sw_button,PARAM("reset4"));
646 b.closeBox();
647 b.closeBox();
648 b.insertSpacer();
649 b.create_port_display(PARAM("bar4"), "buffer");
650 b.insertSpacer();
651 b.closeBox();
652 b.create_feedback_slider(PARAM("clips4"), "cut");
653 b.create_feedback_slider(PARAM("clip4"), "clip");
654 b.create_master_slider(PARAM("speed4"), "speed");
655
656 b.closeBox();
657 b.create_small_rackknob(PARAM("level4"), "level");
658 b.closeBox();
659 b.closeBox();
660
661 b.closeBox();
662
663 b.create_small_rackknob(PARAM("mix"), 0);
664 b.closeBox();
665
666 #undef PARAM
667 return 0;
668 }
669 return -1;
670 }
671
672 int LiveLooper::load_ui_f_static(const UiBuilder& b, int form)
673 {
674 return static_cast<LiveLooper*>(b.plugin)->load_ui_f(b, form);
675 }
676
677 void LiveLooper::del_instance(PluginDef *p)
678 {
679 delete static_cast<LiveLooper*>(p);
680 }
6363 int MidiAudioBuffer::activate(bool start, PluginDef *plugin) {
6464 #ifdef USE_MIDI_OUT
6565 MidiAudioBuffer& self = *static_cast<MidiAudioBuffer*>(plugin);
66 self.jack_overload = start ? load_normal : load_off;
66 self.jack_overload = start ? load_low : load_off;
6767 self.overload_change();
6868 return 0;
6969 #else
7878 sem_init(&m_trig, 0, 0);
7979
8080 if (!m_buffer || !m_input || !m_fftwBufferTime || !m_fftwBufferFreq) {
81 gx_print_error("PitchTracker", "out of memory");
8182 error = true;
8283 }
8384 }
129130
130131 if (!m_fftwPlanFFT || !m_fftwPlanIFFT) {
131132 error = true;
133 gx_print_error("PitchTracker", "can't allocate FFTW plan");
132134 return false;
133135 }
134136
161163 if (pthread_create(&m_pthr, &attr, static_run,
162164 reinterpret_cast<void*>(this))) {
163165 error = true;
166 if (errno == EPERM) {
167 gx_print_error(
168 "PitchTracker",
169 _("no permission to create realtime thread - please check your system configuration - tuner not started"));
170 } else {
171 gx_print_error(
172 "PitchTracker",
173 _("error creating realtime thread - tuner not started"));
174 }
164175 }
165176 pthread_attr_destroy(&attr);
166177 }
3434 registerVar = registerVar_;
3535 registerBoolVar = registerBoolVar_;
3636 registerNonMidiVar = registerNonMidiVar_;
37 registerNonMidiFloatVar = registerNonMidiFloatVar_;
3738 registerEnumVar = registerEnumVar_;
3839 registerIEnumVar = registerIEnumVar_;
3940 }
123124
124125 void ParamRegImpl::registerNonMidiVar_(const char * id, bool*var, bool preset, bool nosave) {
125126 BoolParameter *p = pmap->reg_non_midi_par(id, var, preset);
127 if (nosave) {
128 p->setSavable(false);
129 }
130 }
131
132 void ParamRegImpl::registerNonMidiFloatVar_(const char * id, float *var, bool preset, bool nosave,
133 float val, float low, float up, float step) {
134 FloatParameter *p = pmap->reg_non_midi_par(id, var, preset, val, low, up, step);
126135 if (nosave) {
127136 p->setSavable(false);
128137 }
10431043 check_create_config_dir(opt.get_preset_dir());
10441044 check_create_config_dir(opt.get_plugin_dir());
10451045 check_create_config_dir(opt.get_pluginpreset_dir());
1046 check_create_config_dir(opt.get_loop_dir());
10461047 check_create_config_dir(opt.get_user_IR_dir());
10471048 check_create_config_dir(opt.get_temp_dir());
10481049 std::string fname = gx_jack::GxJack::get_default_instancename() + statename_postfix;
10731074 check_create_config_dir(opt.get_preset_dir());
10741075 check_create_config_dir(opt.get_plugin_dir());
10751076 check_create_config_dir(opt.get_pluginpreset_dir());
1077 check_create_config_dir(opt.get_loop_dir());
10761078 check_create_config_dir(opt.get_user_IR_dir());
10771079 check_create_config_dir(opt.get_temp_dir());
10781080 }
11661168 }
11671169
11681170 void GxSettings::plugin_preset_list_remove(const PluginDef *pdef, const Glib::ustring& name) {
1171 // remove loop files when delete a plugin preset
1172 if(strcmp(pdef->id,"dubber")==0) {
1173 std::string pPath = options.get_loop_dir();
1174 pPath += name;
1175 std::remove((pPath + "1.wav").c_str());
1176 std::remove((pPath + "2.wav").c_str());
1177 std::remove((pPath + "3.wav").c_str());
1178 std::remove((pPath + "4.wav").c_str());
1179 }
11691180 PluginPresetList(options.get_pluginpreset_filepath(pdef->id, false), param, mctrl).remove(name);
11701181 }
11711182
0 /*
1 * Copyright (C) 2013 Hermann Meyer, Andreas Degert
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 * --------------------------------------------------------------------------
17 *
18 *
19 * This is part of the Guitarix Audio Engine
20 *
21 *
22 *
23 * --------------------------------------------------------------------------
24 */
25
26
27
28 #define MAXRECSIZE 131072
29 #define MAXFILESIZE INT_MAX-MAXRECSIZE // 2147352576 //2147483648-MAXRECSIZE
30
31 SCapture::SCapture(EngineControl& engine_, int channel_)
32 : PluginDef(),
33 recfile(NULL),
34 engine(engine_),
35 channel(channel_),
36 fRec0(0),
37 fRec1(0),
38 tape(fRec0),
39 m_pthr(0),
40 keep_stream(false),
41 mem_allocated(false),
42 err(false) {
43 version = PLUGINDEF_VERSION;
44 flags = PGN_NO_PRESETS;
45 if (channel == 1) {
46 id = "recorder";
47 name = N_("Recorder");
48 groups = 0;
49 description = N_("Digital Record"); // description (tooltip)
50 category = N_("Misc"); // category
51 shortname = ""; // shortname
52 mono_audio = compute_static;
53 stereo_audio = 0;
54 } else {
55 id = "st_recorder";
56 name = N_("Stereo Recorder");
57 groups = 0;
58 description = N_("Digital Record"); // description (tooltip)
59 category = N_("Misc"); // category
60 shortname = N_("St-Recorder"); // shortname
61 mono_audio = 0;
62 stereo_audio = compute_static_st;
63 }
64 set_samplerate = init_static;
65 activate_plugin = activate_static;
66 register_params = register_params_static;
67 load_ui = load_ui_f_static;
68 clear_state = clear_state_f_static;
69 delete_instance = del_instance;
70 plugin = this;
71 sem_init(&m_trig, 0, 0);
72 start_thread();
73 }
74
75 SCapture::~SCapture() {
76 stop_thread();
77 activate(false);
78 }
79
80 inline std::string SCapture::get_ffilename() {
81 struct stat buffer;
82 struct stat sb;
83 std::string pPath = getenv("HOME");
84 is_wav = int(fformat) ? false : true;
85 pPath +="/gxrecord/";
86 if (!(stat(pPath.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode))) {
87 mkdir(pPath.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
88 }
89 std::string name = is_wav ? "guitarix_session0.wav" : "guitarix_session0.ogg" ;
90 int i = 0;
91 while (stat ((pPath+name).c_str(), &buffer) == 0) {
92 name.replace(name.begin()+16,name.end()-4,gx_system::to_string(i));
93 i+=1;
94 }
95 return pPath+name;
96 }
97
98 void SCapture::disc_stream() {
99 for (;;) {
100 sem_wait(&m_trig);
101 if (!recfile) {
102 recfile = open_stream(get_ffilename());
103 }
104 save_to_wave(recfile, tape, savesize);
105 filesize +=savesize;
106 if ((!keep_stream && recfile) || (filesize >MAXFILESIZE && is_wav)) {
107 close_stream(&recfile);
108 filesize = 0;
109 }
110 }
111 }
112
113 void *SCapture::run_thread(void *p) {
114 (reinterpret_cast<SCapture *>(p))->disc_stream();
115 return NULL;
116 }
117
118 void SCapture::stop_thread() {
119 pthread_cancel (m_pthr);
120 pthread_join (m_pthr, NULL);
121 }
122
123 void SCapture::start_thread() {
124 pthread_attr_t attr;
125 struct sched_param spar;
126 int priority, policy;
127 engine.get_sched_priority(policy, priority, 12);
128 spar.sched_priority = priority;
129 pthread_attr_init(&attr);
130 pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_JOINABLE );
131 pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL);
132 pthread_attr_setschedpolicy(&attr, policy);
133 pthread_attr_setschedparam(&attr, &spar);
134 pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
135 pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
136 // pthread_attr_setstacksize(&attr, 0x10000);
137 if (pthread_create(&m_pthr, &attr, run_thread,
138 reinterpret_cast<void*>(this))) {
139 err = true;
140 }
141 pthread_attr_destroy(&attr);
142 }
143
144 inline void SCapture::clear_state_f()
145 {
146 for (int i=0; i<MAXRECSIZE; i++) fRec0[i] = 0;
147 for (int i=0; i<MAXRECSIZE; i++) fRec1[i] = 0;
148 for (int i=0; i<2; i++) fRecb0[i] = 0;
149 for (int i=0; i<2; i++) iRecb1[i] = 0;
150 for (int i=0; i<2; i++) fRecb2[i] = 0;
151 for (int i=0; i<2; i++) fRecC0[i] = 0;
152 }
153
154 void SCapture::clear_state_f_static(PluginDef *p)
155 {
156 static_cast<SCapture*>(p)->clear_state_f();
157 }
158
159 inline void SCapture::init(unsigned int samplingFreq)
160 {
161 fSamplingFreq = samplingFreq;
162 IOTA = 0;
163 fConst0 = (1.0f / float(fmin(192000, fmax(1, fSamplingFreq))));
164 }
165
166 void SCapture::init_static(unsigned int samplingFreq, PluginDef *p)
167 {
168 static_cast<SCapture*>(p)->init(samplingFreq);
169 }
170
171 inline void SCapture::save_to_wave(SNDFILE * sf, float *tape, int lSize)
172 {
173 if (sf) {
174 sf_write_float(sf,tape, lSize);
175 sf_write_sync(sf);
176 }
177 }
178
179 SNDFILE *SCapture::open_stream(std::string fname)
180 {
181 SF_INFO sfinfo ;
182 sfinfo.channels = channel;
183 sfinfo.samplerate = fSamplingFreq;
184 sfinfo.format = is_wav ? SF_FORMAT_WAV | SF_FORMAT_FLOAT : SF_FORMAT_OGG | SF_FORMAT_VORBIS;
185
186 SNDFILE * sf = sf_open(fname.c_str(), SFM_WRITE, &sfinfo);
187 if (sf) return sf;
188 else return NULL;
189 }
190
191 inline void SCapture::close_stream(SNDFILE **sf)
192 {
193 if (*sf) sf_close(*sf);
194 *sf = NULL;
195 }
196
197 void SCapture::mem_alloc()
198 {
199 if (!fRec0) fRec0 = new float[MAXRECSIZE];
200 if (!fRec1) fRec1 = new float[MAXRECSIZE];
201 mem_allocated = true;
202 }
203
204 void SCapture::mem_free()
205 {
206 mem_allocated = false;
207 if (fRec0) { delete fRec0; fRec0 = 0; }
208 if (fRec1) { delete fRec1; fRec1 = 0; }
209 }
210
211 int SCapture::activate(bool start)
212 {
213 if (start) {
214 if (!mem_allocated) {
215 mem_alloc();
216 clear_state_f();
217 }
218 } else if (mem_allocated) {
219 mem_free();
220 }
221 return 0;
222 }
223
224 int SCapture::activate_static(bool start, PluginDef *p)
225 {
226 return static_cast<SCapture*>(p)->activate(start);
227 }
228
229 void always_inline SCapture::compute(int count, float *input0, float *output0)
230 {
231 if (err) fcheckbox0 = 0.0;
232 int iSlow0 = int(fcheckbox0);
233 fcheckbox1 = 1-int(fRecb2[0]);
234 float fSlow0 = (0.0010000000000000009f * powf(10,(0.05f * fslider0)));
235 for (int i=0; i<count; i++) {
236 float fTemp0 = (float)input0[i];
237 fRecC0[0] = (fSlow0 + (0.999f * fRecC0[1]));
238 float fTemp1 = fTemp0 * fRecC0[0];
239 // check if we run into clipping
240 float fRec3 = fmax(fConst0, fabsf(fTemp1));
241 int iTemp1 = int((iRecb1[1] < 4096));
242 fRecb0[0] = ((iTemp1)?fmax(fRecb0[1], fRec3):fRec3);
243 iRecb1[0] = ((iTemp1)?(1 + iRecb1[1]):1);
244 fRecb2[0] = ((iTemp1)?fRecb2[1]:fRecb0[1]);
245
246 if (iSlow0) { //record
247 if (iA) {
248 fRec1[IOTA] = fTemp1;
249 } else {
250 fRec0[IOTA] = fTemp1;
251 }
252 IOTA = (IOTA<MAXRECSIZE-1) ? IOTA+1 : 0;
253 if (!IOTA) { // when buffer is full, flush to stream
254 iA = iA ? 0 : 1 ;
255 tape = iA ? fRec0 : fRec1;
256 keep_stream = true;
257 savesize = MAXRECSIZE;
258 sem_post(&m_trig);
259 }
260 } else if (IOTA) { // when record stoped, flush the rest to stream
261 tape = iA ? fRec1 : fRec0;
262 savesize = IOTA;
263 keep_stream = false;
264 sem_post(&m_trig);
265 IOTA = 0;
266 iA = 0;
267 }
268 output0[i] = fTemp0;
269 // post processing
270 fRecb2[1] = fRecb2[0];
271 iRecb1[1] = iRecb1[0];
272 fRecb0[1] = fRecb0[0];
273 fRecC0[1] = fRecC0[0];
274 }
275 }
276
277 void __rt_func SCapture::compute_static(int count, float *input0, float *output0, PluginDef *p)
278 {
279 static_cast<SCapture*>(p)->compute(count, input0, output0);
280 }
281
282 void always_inline SCapture::compute_st(int count, float *input0, float *input1, float *output0, float *output1)
283 {
284 if (err) fcheckbox0 = 0.0;
285 int iSlow0 = int(fcheckbox0);
286 fcheckbox1 = 1-int(fRecb2[0]);
287 float fSlow0 = (0.0010000000000000009f * powf(10,(0.05f * fslider0)));
288 for (int i=0; i<count; i++) {
289 float fTemp0 = (float)input0[i];
290 float fTemp1 = (float)input1[i];
291 fRecC0[0] = (fSlow0 + (0.999f * fRecC0[1]));
292 float fTemp2 = fTemp0 * fRecC0[0];
293 float fTemp3 = fTemp1 * fRecC0[0];
294 // check if we run into clipping
295 float fRec3 = fmax(fConst0,fmax(fabsf(fTemp2),fabsf(fTemp3)));
296 int iTemp1 = int((iRecb1[1] < 4096));
297 fRecb0[0] = ((iTemp1)?fmax(fRecb0[1], fRec3):fRec3);
298 iRecb1[0] = ((iTemp1)?(1 + iRecb1[1]):1);
299 fRecb2[0] = ((iTemp1)?fRecb2[1]:fRecb0[1]);
300
301 if (iSlow0) { //record
302 if (iA) {
303 fRec1[IOTA] = fTemp2;
304 fRec1[IOTA+1] = fTemp3;
305 } else {
306 fRec0[IOTA] = fTemp2;
307 fRec0[IOTA+1] = fTemp3;
308 }
309 IOTA = (IOTA<MAXRECSIZE-2) ? IOTA+2 : 0;
310 if (!IOTA) { // when buffer is full, flush to stream
311 iA = iA ? 0 : 1 ;
312 tape = iA ? fRec0 : fRec1;
313 keep_stream = true;
314 savesize = MAXRECSIZE;
315 sem_post(&m_trig);
316 }
317 } else if (IOTA) { // when record stoped, flush the rest to stream
318 tape = iA ? fRec1 : fRec0;
319 savesize = IOTA;
320 keep_stream = false;
321 sem_post(&m_trig);
322 IOTA = 0;
323 iA = 0;
324 }
325 output0[i] = fTemp0;
326 output1[i] = fTemp1;
327 // post processing
328 fRecb2[1] = fRecb2[0];
329 iRecb1[1] = iRecb1[0];
330 fRecb0[1] = fRecb0[0];
331 fRecC0[1] = fRecC0[0];
332 }
333 }
334
335 void SCapture::compute_static_st(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *p)
336 {
337 static_cast<SCapture*>(p)->compute_st(count, input0, input1, output0, output1);
338 }
339
340 int SCapture::register_par(const ParamReg& reg)
341 {
342 static const value_pair fformat_values[] = {{"wav"},{"ogg"},{0}};
343 if (channel == 1) {
344 reg.registerEnumVar("recorder.file","","S",N_("select file format"),fformat_values,&fformat, 0.0, 0.0, 1.0, 1.0);
345 reg.registerVar("recorder.rec","","B","",&fcheckbox0, 0.0, 0.0, 1.0, 1.0);
346 reg.registerVar("recorder.gain","","S","",&fslider0, 0.0f, -7e+01f, 4.0f, 0.1f);
347 reg.registerNonMidiFloatVar("recorder.clip",&fcheckbox1, false, true, 0.0, 0.0, 1.0, 1.0);
348 } else {
349 reg.registerEnumVar("st_recorder.file","","S",N_("select file format"),fformat_values,&fformat, 0.0, 0.0, 1.0, 1.0);
350 reg.registerVar("st_recorder.rec","","B","",&fcheckbox0, 0.0, 0.0, 1.0, 1.0);
351 reg.registerVar("st_recorder.gain","","S","",&fslider0, 0.0f, -7e+01f, 4.0f, 0.1f);
352 reg.registerNonMidiFloatVar("st_recorder.clip",&fcheckbox1, false, true, 0.0, 0.0, 1.0, 1.0);
353 }
354
355 return 0;
356 }
357
358 int SCapture::register_params_static(const ParamReg& reg)
359 {
360 return static_cast<SCapture*>(reg.plugin)->register_par(reg);
361 }
362
363 inline int SCapture::load_ui_f(const UiBuilder& b, int form)
364 {
365 if (form & UI_FORM_STACK) {
366
367 if (channel == 1) {
368 #define PARAM(p) ("recorder" "." p)
369 b.openHorizontalhideBox("");
370 b.create_feedback_switch(sw_rbutton,PARAM("rec"));
371
372 b.closeBox();
373
374 b.openHorizontalBox("");
375 b.create_small_rackknob(PARAM("gain"), N_("gain(db)"));
376 b.create_feedback_switch(sw_rbutton,PARAM("rec"));
377 b.create_feedback_switch(sw_led,PARAM("clip"));
378 b.create_selector_no_caption(PARAM("file"));
379
380 b.closeBox();
381
382 #undef PARAM
383 } else {
384 #define PARAM(p) ("st_recorder" "." p)
385 b.openHorizontalhideBox("");
386 b.create_feedback_switch(sw_rbutton,PARAM("rec"));
387
388 b.closeBox();
389
390 b.openHorizontalBox("");
391 b.create_small_rackknob(PARAM("gain"), N_("gain(db)"));
392 b.create_feedback_switch(sw_rbutton,PARAM("rec"));
393 b.create_feedback_switch(sw_led,PARAM("clip"));
394 b.create_selector_no_caption(PARAM("file"));
395
396 b.closeBox();
397
398 #undef PARAM
399 }
400 return 0;
401 }
402 return -1;
403 }
404
405 int SCapture::load_ui_f_static(const UiBuilder& b, int form)
406 {
407 return static_cast<SCapture*>(b.plugin)->load_ui_f(b, form);
408 }
409
410 void SCapture::del_instance(PluginDef *p)
411 {
412 delete static_cast<SCapture*>(p);
413 }
414
450450 pluginpreset_dir(),
451451 temp_dir(),
452452 plugin_dir(),
453 loop_dir(),
453454 rcset(shellvar("GUITARIX_RC_STYLE")),
454455 nogui(false),
455456 rpcport(RPCPORT_DEFAULT),
489490 plugin_dir = Glib::build_filename(get_user_dir(), "plugins");
490491 preset_dir = Glib::build_filename(get_user_dir(), "banks");
491492 pluginpreset_dir = Glib::build_filename(get_user_dir(), "pluginpresets");
493 loop_dir = Glib::build_filename(get_pluginpreset_dir(), "loops");
492494 temp_dir = Glib::build_filename(get_user_dir(), "temp");
493495 const char *tmp = getenv("GUITARIX2JACK_OUTPUTS1");
494496 if (tmp && *tmp) {
860862 make_ending_slash(pixmap_dir);
861863 make_ending_slash(preset_dir);
862864 make_ending_slash(pluginpreset_dir);
865 make_ending_slash(loop_dir);
863866 make_ending_slash(temp_dir);
864867 make_ending_slash(plugin_dir);
865868
1818 #include "jsonrpc.h"
1919 #include <netinet/in.h>
2020 #include <netinet/tcp.h>
21 #if HAVE_BLUEZ
22 #include <bluetooth/bluetooth.h>
23 #include <bluetooth/rfcomm.h>
24 #endif
2125
2226 #include "jsonrpc_methods.cc"
2327
194198 static void create_small_rackknob_(const char *id, const char *label);
195199 static void create_small_rackknobr_(const char *id, const char *label);
196200 static void create_master_slider_(const char *id, const char *label);
201 static void create_feedback_slider_(const char *id, const char *label);
197202 static void create_selector_no_caption_(const char *id);
198203 static void create_selector_(const char *id, const char *label);
204 static void create_simple_meter_(const char *id);
205 static void create_simple_c_meter_(const char *id,const char *idl, const char *label);
199206 static void create_spin_value_(const char *id, const char *label);
200207 static void create_switch_no_caption_(const char *sw_type,const char * id);
208 static void create_feedback_switch_(const char *sw_type,const char * id);
201209 static void create_switch_(const char *sw_type,const char * id, const char *label);
202210 static void create_wheel_(const char * id, const char *label);
203211 static void create_port_display_(const char *id, const char *label);
212 static void create_p_display_(const char *id, const char *idl, const char *idh);
204213 static void create_simple_spin_value_(const char *id);
205214 static void create_eq_rackslider_no_caption_(const char *id);
206215 static void closeBox_();
287296 cerr << "unknown listen token: " << tp << endl;
288297 return;
289298 }
290 for (int i = start; i < end; ++i) {
299 for (int i = start; i <= end; i++) {
291300 activate(i, false);
292301 }
293302 }
13311340 load_glade = load_glade_;
13321341 load_glade_file = load_glade_file_;
13331342 create_master_slider = create_master_slider_;
1343 create_feedback_slider = create_feedback_slider_;
13341344 create_small_rackknob = create_small_rackknob_;
13351345 create_small_rackknobr = create_small_rackknobr_;
1346 create_simple_meter = create_simple_meter_;
1347 create_simple_c_meter = create_simple_c_meter_;
13361348 create_spin_value = create_spin_value_;
13371349 create_switch = create_switch_;
13381350 create_wheel = create_wheel_;
13391351 create_switch_no_caption = create_switch_no_caption_;
1352 create_feedback_switch = create_feedback_switch_;
13401353 create_selector = create_selector_;
13411354 create_selector_no_caption = create_selector_no_caption_;
13421355 create_port_display = create_port_display_;
1356 create_p_display = create_p_display_;
13431357 create_simple_spin_value = create_simple_spin_value_;
13441358 create_eq_rackslider_no_caption = create_eq_rackslider_no_caption_;
13451359 insertSpacer = insertSpacer_;
14481462 jw->end_array();
14491463 }
14501464
1465 void UiBuilderVirt::create_feedback_slider_(const char *id, const char *label) {
1466 jw->begin_array();
1467 jw->write("create_feedback_slider");
1468 jw->write(id);
1469 jw->write(label);
1470 jw->end_array();
1471 }
1472
14511473 void UiBuilderVirt::create_master_slider_(const char *id, const char *label) {
14521474 jw->begin_array();
14531475 jw->write("create_master_slider");
14711493 jw->end_array();
14721494 }
14731495
1496 void UiBuilderVirt::create_simple_meter_(const char *id) {
1497 jw->begin_array();
1498 jw->write("create_simple_meter");
1499 jw->write(id);
1500 jw->end_array();
1501 }
1502 void UiBuilderVirt::create_simple_c_meter_(const char *id, const char *idl, const char *label) {
1503 jw->begin_array();
1504 jw->write("create_simple_c_meter");
1505 jw->write(id);
1506 jw->write(idl);
1507 jw->write(label);
1508 jw->end_array();
1509 }
1510
14741511 void UiBuilderVirt::create_spin_value_(const char *id, const char *label) {
14751512 jw->begin_array();
14761513 jw->write("create_spin_value");
14821519 void UiBuilderVirt::create_switch_no_caption_(const char *sw_type, const char * id) {
14831520 jw->begin_array();
14841521 jw->write("create_switch_no_caption");
1522 jw->write(sw_type);
1523 jw->write(id);
1524 jw->end_array();
1525 }
1526
1527 void UiBuilderVirt::create_feedback_switch_(const char *sw_type, const char * id) {
1528 jw->begin_array();
1529 jw->write("create_feedback_switch");
14851530 jw->write(sw_type);
14861531 jw->write(id);
14871532 jw->end_array();
15091554 jw->write("create_port_display");
15101555 jw->write(id);
15111556 jw->write(label);
1557 jw->end_array();
1558 }
1559
1560 void UiBuilderVirt::create_p_display_(const char *id, const char *idl, const char *idh) {
1561 jw->begin_array();
1562 jw->write("create_p_display");
1563 jw->write(id);
1564 jw->write(idl);
1565 jw->write(idh);
15121566 jw->end_array();
15131567 }
15141568
15561610 */
15571611
15581612 GxService::GxService(gx_preset::GxSettings& settings_, gx_jack::GxJack& jack_,
1559 TunerSwitcher& tunerswitcher_, sigc::slot<void> quit_mainloop_, int *port)
1613 TunerSwitcher& tunerswitcher_, sigc::slot<void> quit_mainloop_,
1614 const Glib::ustring& host, int *port)
15601615 : Gio::SocketService(),
15611616 settings(settings_),
15621617 jack(jack_),
15731628 *port = add_any_inet_port();
15741629 } else {
15751630 add_inet_port(*port);
1631 }
1632 if (host.compare(0, 3, "BT:") == 0) {
1633 create_bluetooth_sockets(host.substr(3));
15761634 }
15771635 settings.signal_selection_changed().connect(
15781636 sigc::mem_fun(*this, &GxService::preset_changed));
16201678 }
16211679 }
16221680
1681 #if HAVE_BLUEZ
1682 static Glib::RefPtr<Gio::Socket> create_one_bluetooth_socket(
1683 const Glib::ustring& device, int channel) {
1684 sockaddr_rc loc_addr = { 0 };
1685 int s = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
1686 loc_addr.rc_family = AF_BLUETOOTH;
1687 // bind socket to the first available local bluetooth adapter
1688 bdaddr_t bdaddr = {{0, 0, 0, 0, 0, 0}}; //*BDADDR_ANY;
1689 loc_addr.rc_bdaddr = bdaddr;
1690 loc_addr.rc_channel = (uint8_t)channel;
1691 bind(s, (struct sockaddr *)&loc_addr, sizeof(loc_addr));
1692 listen(s, 1);
1693 return Gio::Socket::create_from_fd(s);
1694 }
1695
1696 void GxService::create_bluetooth_sockets(const Glib::ustring& host) {
1697 int channels = 1;
1698 if (host.size() > 3) {
1699 channels = host[3] - '0';
1700 if (channels < 1) {
1701 channels = 1;
1702 } else if (channels > 9) {
1703 channels = 9;
1704 }
1705 }
1706 for (int i = 1; i <= channels; i++) {
1707 add_socket(create_one_bluetooth_socket(host, i));
1708 }
1709 gx_print_info(
1710 _("server"),
1711 Glib::ustring::compose(
1712 _("listening on bluetooth socket (%1 channel)"),
1713 channels));
1714 }
1715 #else // !HAVE_BLUEZ
1716 void GxService::create_bluetooth_sockets(const Glib::ustring& host) {
1717 gx_print_fatal(
1718 _("server"),
1719 _("Bluetooth not available; rebuild Guitarix with Bluetooth support"));
1720 }
1721 #endif // HAVE_BLUEZ
1722
16231723 void GxService::ladspaloader_write_changes(gx_system::JsonWriter& jw, std::vector<ChangedPlugin>& changed_plugins) {
16241724 serialize_parameter_change(jw);
16251725 // updated plugins
00 /* generated by make_jsonrpc_methods.py */
11
2 /* ANSI-C code produced by gperf version 3.0.3 */
2 /* ANSI-C code produced by gperf version 3.0.4 */
33 /* Command-line: gperf */
44 /* Computed positions: -k'1,6,$' */
55
7878
7979 #ifdef __GNUC__
8080 __inline
81 #ifdef __GNUC_STDC_INLINE__
81 #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
8282 __attribute__ ((__gnu_inline__))
8383 #endif
8484 #endif
14101410 char buf[100];
14111411 char *p = strerror_r(errno, buf, sizeof(buf));
14121412 gx_print_error(
1413 "ladspalist",ustring::compose(_("error renaming LADSPA config file '%1': %2\n"), fname, p));
1413 "ladspalist",ustring::compose(_("error renaming LADSPA config file '%1': %2"), fname, p));
14141414 return;
14151415 }
14161416 for (std::vector<std::pair<std::string,std::string> >::iterator i = fl.begin(); i != fl.end(); ++i) {
550550 d.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
551551 d.add_shortcut_folder(GX_SOUND_BPA_DIR);
552552 d.add_shortcut_folder(GX_SOUND_BPB_DIR);
553 d.add_shortcut_folder(string(getenv("HOME")) + string("/.config/guitarix/IR"));
553554 Gtk::FileFilter wav;
554555 wav.set_name("WAV Files");
555556 wav.add_pattern("*.wav");
393393 port = 7000;
394394 }
395395 if (port != RPCPORT_NONE) {
396 machine.start_socket(sigc::mem_fun(loop.operator->(),&Glib::MainLoop::quit), port);
396 machine.start_socket(sigc::mem_fun(loop.operator->(),&Glib::MainLoop::quit), options.get_rpcaddress(), port);
397397 loop->run();
398398 } else {
399399 loop->run();
401401 gx_child_process::childprocs.killall();
402402 }
403403
404 static void exception_handler() {
405 try {
406 throw; // re-throw current exception
407 } catch (const GxFatalError& error) {
408 cerr << error.what() << endl;
409 gx_print_fatal(_("Guitarix fatal error"), error.what());
410 } catch (const Glib::OptionError &error) {
411 cerr << error.what() << endl;
412 cerr << _("use \"guitarix -h\" to get a help text") << endl;
413 gx_print_fatal(_("Guitarix Commandline Option Error"),
414 Glib::ustring::compose(
415 "%1\n%2",
416 error.what(),
417 _("use \"guitarix -h\" to get a help text")));
418 } catch (const Glib::Error& error) {
419 const GError *perr = error.gobj();
420 Glib::ustring msg = Glib::ustring::compose(
421 "Glib::Error[%1/%2]: %3",
422 g_quark_to_string(perr->domain),
423 perr->code,
424 (perr->message) ? perr->message : "(null)");
425 cerr << msg << endl;
426 gx_print_fatal(_("Guitarix fatal error"), msg);
427 } catch (const std::exception& except) {
428 Glib::ustring msg = Glib::ustring::compose(
429 "std::exception: %1", except.what());
430 cerr << msg << endl;
431 gx_print_fatal(_("Guitarix fatal error"), msg);
432 } catch(...) {
433 cerr << _("unknown error") << endl;
434 gx_print_fatal(_("Guitarix fatal error"),_("unknown error"));
435 }
436 }
437
404438 static void mainGtk(int argc, char *argv[]) {
405439 Glib::init();
406440 Gxw::init();
407441
408442 PosixSignals posixsig(true); // catch unix signals in special thread
443 Glib::add_exception_handler(sigc::ptr_fun(exception_handler));
409444 gx_system::CmdlineOptions options;
410445 Gtk::Main main(argc, argv, options);
411446 options.process(argc, argv);
458493 Gxw::init();
459494
460495 PosixSignals posixsig(true); // catch unix signals in special thread
496 Glib::add_exception_handler(sigc::ptr_fun(exception_handler));
461497 gx_system::CmdlineOptions options;
462498 Gtk::Main main(argc, argv, options);
463499 options.process(argc, argv);
569605 } else {
570606 mainGtk(argc, argv);
571607 }
572 } catch (const Glib::OptionError &e) {
573 cerr << e.what() << endl;
574 cerr << _("use \"guitarix -h\" to get a help text") << endl;
575 return 1;
576 } catch (const GxFatalError &e) {
577 cerr << e.what() << endl;
578 return 1;
579 } catch (const Glib::Exception &e) {
580 cerr << "unknown Glib Exception: " << e.what() << endl;
581 return 1;
608 } catch (...) {
609 exception_handler();
582610 }
583611 return 0;
584612 }
13231323 midi_out_box->set_visible(true);
13241324 } else {
13251325 midi_out_box->set_visible(false);
1326 engine.midiaudiobuffer.plugin.on_off = false;
1326 machine.pluginlist_lookup_plugin("midi_out")->set_on_off(false);
13271327 }
13281328 #endif
13291329 }
20012001 bool flat;
20022002 int notes[6];
20032003 } tuning_tab[] = {
2004 { "Standard", "E", false, {40, 45, 50, 55, 59, 64}},
2005 { "Standard/Es", "Es", true, {39, 44, 49, 54, 58, 63}},
2006 { "Open E", "E", false, {40, 47, 52, 56, 59, 64}},
2004 { "Standard", "E", false, {40, 45, 50, 55, 59, 64}},
2005 { "Standard/Es", "Es", true, {39, 44, 49, 54, 58, 63}},
2006 { "Open E", "E", false, {40, 47, 52, 56, 59, 64}},
2007 { "Drop D", "D", false, {38, 45, 50, 55, 59, 64}},
2008 { "Half Step Down", "E", false, {39, 44, 49, 54, 58, 63}},
2009 { "Full Step Down", "D", false, {38, 43, 48, 53, 57, 62}},
2010 { "1 and 1/2 Steps Down", "E", false, {37, 42, 47, 52, 56, 61}},
2011 { "Double Drop D", "D", false, {38, 45, 50, 55, 59, 62}},
2012 { "Drop C", "C", false, {36, 43, 48, 53, 57, 62}},
2013 { "Drop C#", "C#", false, {37, 44, 49, 54, 58, 63}},
2014 { "Drop B", "B", false, {35, 42, 47, 52, 56, 61}},
2015 { "Drop A#", "A#", false, {34, 41, 46, 51, 55, 60}},
2016 { "Drop A", "A", false, {33, 40, 45, 50, 54, 59}},
2017 { "Open D", "D", false, {38, 45, 50, 54, 57, 62}},
2018 { "Open D Minor", "D", false, {38, 45, 50, 53, 57, 62}},
2019 { "Open G", "G", false, {38, 43, 50, 55, 59, 62}},
2020 { "Open G Minor", "G", false, {38, 43, 50, 55, 58, 62}},
2021 { "Open C", "C", false, {36, 43, 48, 55, 60, 64}},
2022 { "Open C#", "C#", false, {37, 42, 59, 52, 56, 61}},
2023 { "Open C Minor", "C", false, {36, 43, 48, 55, 60, 63}},
2024 { "Open E7", "E7", false, {40, 44, 50, 52, 59, 64}},
2025 { "Open E Minor7", "E", false, {40, 47, 50, 55, 59, 64}},
2026 { "Open G Major7", "G", false, {38, 43, 50, 54, 59, 62}},
2027 { "Open A Minor", "A", false, {40, 45, 52, 57, 60, 64}},
2028 { "Open A Minor7", "A", false, {40, 45, 52, 55, 60, 64}},
2029 { "Open A", "A", false, {40, 45, 49, 52, 57, 64}},
2030 { "C Tuning", "C", false, {36, 41, 46, 51, 55, 60}},
2031 { "C# Tuning", "C#", false, {37, 42, 47, 52, 56, 61}},
2032 { "Bb Tuning", "Bb", false, {34, 39, 44, 49, 53, 58}},
2033 { "A to A (Baritone)", "A", false, {33, 38, 43, 48, 52, 57}},
2034 { "Open Dsus2", "D", false, {38, 45, 50, 55, 57, 62}},
2035 { "Open Gsus2", "G", false, {38, 43, 50, 55, 60, 62}},
2036 { "G6", "G6", false, {38, 43, 50, 55, 59, 64}},
2037 { "Modal G", "G", false, {38, 43, 50, 55, 60, 62}},
2038 { "Overtone", "E", false, {48, 52, 55, 58, 60, 62}},
2039 { "Pentatonic", "E", false, {45, 48, 50, 52, 55, 69}},
2040 { "Minor Third", "E", false, {48, 51, 54, 57, 60, 63}},
2041 { "Major Third", "E", false, {48, 52, 56, 60, 64, 68}},
2042 { "All Fourths", "E", false, {40, 45, 50, 55, 60, 65}},
2043 { "Augmented Fourths", "E", false, {36, 42, 48, 54, 60, 66}},
2044 { "Slow Motion", "E", false, {38, 43, 50, 53, 60, 62}},
2045 { "Admiral", "E", false, {36, 43, 50, 55, 59, 60}},
2046 { "Buzzard", "E", false, {36, 41, 48, 55, 58, 65}},
2047 { "Face", "E", false, {36, 43, 50, 55, 57, 62}},
2048 { "Four and Twenty", "E", false, {38, 45, 50, 50, 57, 62}},
2049 { "Ostrich", "E", false, {38, 50, 50, 50, 62, 62}},
2050 { "Capo 200", "E", false, {36, 43, 50, 51, 62, 63}},
2051 { "Balalaika", "E", false, {40, 45, 50, 52, 52, 57}},
2052 { "Cittern One", "E", false, {36, 41, 48, 55, 60, 62}},
2053 { "Cittern Two", "E", false, {36, 43, 48, 55, 60, 67}},
2054 { "Dobro", "E", false, {43, 47, 50, 55, 59, 62}},
2055 { "Lefty", "E", false, {64, 59, 55, 50, 45, 40}},
2056 { "Mandoguitar", "E", false, {36, 43, 50, 57, 64, 71}},
2057 { "Rusty Cage", "E", false, {35, 45, 50, 55, 59, 64}},
2058 { "Hardcore", "C", false, {36, 43, 48, 53, 57, 58}},
20072059 };
20082060 int mode = tuner_tuning->get_value();
20092061 tuner.clear_notes();
23552407 }
23562408 }
23572409
2410 //bool MainWindow::ui_sleep() {
2411 // usleep(1900);
2412 //cout<<"timeout"<<endl;
2413 // return true;
2414 //}
2415
23582416 void MainWindow::run() {
23592417 int port = options.get_rpcport();
23602418 if (machine.get_jack() && port != RPCPORT_DEFAULT && port != RPCPORT_NONE) {
2361 machine.start_socket(sigc::ptr_fun(Gtk::Main::quit), port);
2419 machine.start_socket(sigc::ptr_fun(Gtk::Main::quit), options.get_rpcaddress(), port);
23622420 window->show();
23632421 Gtk::Main::run();
23642422 } else {
23652423 window->show();
2424 // Glib::signal_timeout().connect (mem_fun (*this, &MainWindow::ui_sleep), 2);
23662425 Gtk::Main::run();
23672426 }
23682427 }
294294 next_flags = flags;
295295 }
296296
297 bool StackBoxBuilder::set_simple(Gxw::FastMeter *fastmeter,const std::string id) {
298 if (machine.get_parameter_value<bool>(id.substr(0,id.find_last_of(".")+1)+"on_off"))
299 fastmeter->set_by_power(machine.get_parameter_value<float>(id));
300 else
301 fastmeter->set_by_power(0.0001);
302 return true;
303 }
304
305 void StackBoxBuilder::create_simple_meter(const std::string& id) {
306 Gxw::FastMeter *fastmeter = new Gxw::FastMeter();
307 fastmeter->set_hold_count(5);
308 fastmeter->set_property("dimen",5);
309 Glib::signal_timeout().connect(sigc::bind<Gxw::FastMeter*>(sigc::bind<const std::string>(
310 sigc::mem_fun(*this, &StackBoxBuilder::set_simple),id), fastmeter), 60);
311 fastmeter->set_by_power(0.0001);
312 GxPaintBox *box = new GxPaintBox(pb_amp_expose);
313 box->set_border_width(2);
314 box->pack_start(*Gtk::manage(static_cast<Gtk::Widget*>(fastmeter)),Gtk::PACK_SHRINK);
315 box->show_all();
316 fBox.box_pack_start(manage(box),false);
317 }
318
319 void StackBoxBuilder::create_simple_c_meter(const std::string& id, const std::string& idm, const char *label) {
320 Gxw::FastMeter *fastmeter = new Gxw::FastMeter();
321 fastmeter->set_hold_count(5);
322 fastmeter->set_property("dimen",5);
323 Glib::signal_timeout().connect(sigc::bind<Gxw::FastMeter*>(sigc::bind<const std::string>(
324 sigc::mem_fun(*this, &StackBoxBuilder::set_simple),id), fastmeter), 60);
325 fastmeter->set_by_power(0.0001);
326 Gxw::LevelSlider *w = new UiRegler<Gxw::LevelSlider>(machine, idm);
327 w->set_name("lmw");
328 GxPaintBox *box = new GxPaintBox("simple_level_meter_expose");
329 box->set_border_width(2);
330 box->pack_start(*Gtk::manage(static_cast<Gtk::Widget*>(fastmeter)),Gtk::PACK_SHRINK);
331 box->add(*Gtk::manage(static_cast<Gtk::Widget*>(w)));
332 if (label && label[0]) {
333 GxPaintBox *boxv = new GxPaintBox(pb_eq_expose);
334 boxv->set_property("orientation",Gtk::ORIENTATION_VERTICAL);
335 boxv->set_homogeneous(false);
336 boxv->set_spacing(0);
337 boxv->set_border_width(4);
338 Gtk::Label *lab = new Gtk::Label(label);
339 Pango::FontDescription font = lab->get_style()->get_font();
340 font.set_size(6*Pango::SCALE);
341 font.set_weight(Pango::WEIGHT_NORMAL);
342 lab->modify_font(font);
343 lab->set_name("beffekt_label");
344 boxv->add(*manage(lab));
345 Gtk::VBox *boxvv = new Gtk::VBox();
346 Gtk::HBox *boxl = new Gtk::HBox();
347 boxl->set_homogeneous(false);
348 boxl->set_spacing(0);
349 boxl->set_border_width(0);
350 Gtk::HBox *boxr = new Gtk::HBox();
351 Gtk::HBox *boxs = new Gtk::HBox();
352 boxl->pack_start(*manage(boxr), Gtk::PACK_EXPAND_WIDGET);
353 boxl->add(*manage(box));
354 boxl->pack_end(*manage(boxs), Gtk::PACK_EXPAND_WIDGET);
355 boxvv->add(*manage(boxv));
356 boxvv->add(*manage(boxl));
357 boxvv->show_all();
358 fBox.box_pack_start(manage(boxvv),false);
359 } else {
360 box->show_all();
361 fBox.box_pack_start(manage(box),false);
362 }
363 }
364
365 bool StackBoxBuilder::set_engine_value(const std::string id) {
366 if (machine.get_parameter_value<bool>(id.substr(0,id.find_last_of(".")+1)+"on_off"))
367 machine.signal_parameter_value<float>(id)(machine.get_parameter_value<float>(id));
368 return true;
369 }
370
371 void StackBoxBuilder::create_port_display(const std::string& id, const char *label) {
372 CpBaseCaption *w = new UiReglerWithCaption<Gxw::PortDisplay>(machine, id);
373 Glib::signal_timeout().connect(sigc::bind<const std::string>(
374 sigc::mem_fun(*this, &StackBoxBuilder::set_engine_value),id), 60);
375 w->set_rack_label(label);
376 addwidget(w);
377 }
378
379 bool StackBoxBuilder::set_pd_value(Gxw::PortDisplay *w, const std::string id, const std::string& idl, const std::string& idh) {
380 if (machine.get_parameter_value<bool>(id.substr(0,id.find_last_of(".")+1)+"on_off")) {
381 float low = machine.get_parameter_value<float>(idl);
382 float high = 100-machine.get_parameter_value<float>(idh);
383 w->set_state(int(low),int(high));
384 float set = (low + high)*0.001;
385 machine.signal_parameter_value<float>(id)(machine.get_parameter_value<float>(id)+set);
386 }
387 return true;
388 }
389
390 void StackBoxBuilder::create_p_display(const std::string& id, const std::string& idl, const std::string& idh) {
391 Gxw::PortDisplay *w = new UiRegler<Gxw::PortDisplay>(machine, id);
392 Glib::signal_timeout().connect(sigc::bind<Gxw::PortDisplay*>(sigc::bind<const std::string>(
393 sigc::bind<const std::string>(sigc::bind<const std::string>(
394 sigc::mem_fun(*this, &StackBoxBuilder::set_pd_value),idh),idl),id),w ), 60);
395 w->set_name("playhead");
396 Gtk::EventBox* e_box = new Gtk::EventBox();
397 e_box->set_size_request(-1, -1);
398 e_box->set_border_width(0);
399 e_box->set_visible_window(true);
400 e_box->set_above_child(true);
401 e_box->add(*manage(static_cast<Gtk::Widget*>(w)));
402 addwidget(e_box);
403 e_box->show_all();
404 }
405
406 void StackBoxBuilder::create_feedback_switch(const char *sw_type, const std::string& id) {
407 addwidget(UiSwitch::create(machine, sw_type, id));
408 Glib::signal_timeout().connect(sigc::bind<const std::string>(
409 sigc::mem_fun(*this, &StackBoxBuilder::set_engine_value),id), 60);
410 }
411
412 void StackBoxBuilder::create_feedback_slider(const std::string& id, const char *label) {
413 UiMasterReglerWithCaption<Gxw::HSlider> *w = new UiMasterReglerWithCaption<Gxw::HSlider>(machine, id);
414 Glib::signal_timeout().connect(sigc::bind<const std::string>(
415 sigc::mem_fun(*this, &StackBoxBuilder::set_engine_value),id), 60);
416 w->set_label(label);
417 addwidget(w);
418 }
419
297420 void StackBoxBuilder::create_selector(const std::string& id, const char *widget_name) {
298421 gx_engine::Parameter& p = machine.get_parameter(id);
299422 Gxw::Selector *s;
403526 }
404527
405528 void StackBoxBuilder::openVerticalBox2(const char* label) {
406 GxVBox * box = new GxVBox();
407 box->set_homogeneous(false);
408 box->set_spacing(0);
409 box->set_border_width(0);
410
529 Gtk::VPaned * box = new Gtk::VPaned();
530 box->set_border_width(0);
531 GxHBox * pbox = new GxHBox();
411532 if (!fBox.top_is_notebook() && label && label[0]) {
412 box->m_label.set_text(label);
413 box->m_label.set_name("rack_label");
414 box->pack_start(box->m_label, false, false, 0 );
415 fBox.box_pack_start(manage(box));
416 box->show();
417 box->m_label.show();
418 fBox.push(box);
419 } else {
420 fBox.push(fBox.add(manage(box), label));
421 }
533 pbox->m_label.set_text(label);
534 pbox->m_label.set_name("rack_label");
535 pbox->pack_start(pbox->m_label, false, false, 0 );
536 }
537 pbox->set_border_width(0);
538 box->pack1(*Gtk::manage(static_cast<Gtk::Widget*>(pbox)),true,true);
539 GxHBox * hbox = new GxHBox();
540 hbox->set_homogeneous(false);
541 hbox->set_spacing(0);
542 hbox->set_border_width(0);
543 box->pack2(*Gtk::manage(static_cast<Gtk::Widget*>(hbox)),true,true);
544 box->set_position(200);
545 fBox.box_pack_start(manage(box), false, false, 0);
546 box->show_all();
547 fBox.push(hbox);
422548 }
423549
424550 void StackBoxBuilder::openFlipLabelBox(const char* label) {
653779 }
654780
655781 void StackBoxBuilder::openpaintampBox(const char* label) {
656 GxPaintBox *box = new GxPaintBox(pb_RackBox_expose);
782 GxPaintBox *box = new GxPaintBox("rectangle_skin_color_expose");
657783 box->m_hbox.set_border_width(4);
658784 box->set_name(label);
659785 box->set_tooltip_text(label);
7474 load_glade = load_glade_;
7575 load_glade_file = load_glade_file_;
7676 create_master_slider = create_master_slider_;
77 create_feedback_slider = create_feedback_slider_;
7778 create_small_rackknob = create_small_rackknob_;
7879 create_small_rackknobr = create_small_rackknobr_;
7980 create_spin_value = create_spin_value_;
8081 create_switch = create_switch_;
8182 create_switch_no_caption = create_switch_no_caption_;
83 create_feedback_switch = create_feedback_switch_;
8284 create_wheel = create_wheel_;
8385 create_selector = create_selector_;
86 create_simple_meter = create_simple_meter_;
87 create_simple_c_meter = create_simple_c_meter_;
8488 create_selector_no_caption = create_selector_no_caption_;
8589 create_port_display = create_port_display_;
90 create_p_display = create_p_display_;
8691 create_simple_spin_value = create_simple_spin_value_;
8792 create_eq_rackslider_no_caption = create_eq_rackslider_no_caption_;
8893 insertSpacer = insertSpacer_;
160165 intf->create_master_slider(id, label);
161166 }
162167
168 void UiBuilderImpl::create_feedback_slider_(const char *id, const char *label) {
169 intf->create_feedback_slider(id, label);
170 }
171
163172 void UiBuilderImpl::create_selector_no_caption_(const char *id) {
164173 intf->create_selector(id, "");
165174 }
168177 intf->create_selector_with_caption(id, label);
169178 }
170179
180 void UiBuilderImpl::create_simple_meter_(const char *id) {
181 intf->create_simple_meter(id);
182 }
183
184 void UiBuilderImpl::create_simple_c_meter_(const char *id, const char *idl, const char *label) {
185 intf->create_simple_c_meter(id, idl, label);
186 }
187
171188 void UiBuilderImpl::create_spin_value_(const char *id, const char *label) {
172189 intf->create_spin_value(id, label);
173190 }
176193 intf->create_switch_no_caption(sw_type, id);
177194 }
178195
196 void UiBuilderImpl::create_feedback_switch_(const char *sw_type, const char * id) {
197 intf->create_feedback_switch(sw_type, id);
198 }
199
179200 void UiBuilderImpl::create_switch_(const char *sw_type, const char * id, const char *label) {
180201 intf->create_v_switch(sw_type, id, label);
181202 }
186207
187208 void UiBuilderImpl::create_port_display_(const char *id, const char *label) {
188209 intf->create_port_display(id, label);
210 }
211
212 void UiBuilderImpl::create_p_display_(const char *id, const char *idl, const char *idh) {
213 intf->create_p_display(id, idl, idh);
189214 }
190215
191216 void UiBuilderImpl::create_simple_spin_value_(const char *id) {
2121 #include <netinet/in.h>
2222 #include <netinet/tcp.h>
2323 #include <sys/ioctl.h>
24 #ifdef HAVE_BLUEZ
25 #include <bluetooth/bluetooth.h>
26 #include <bluetooth/rfcomm.h>
27 #endif
2428
2529 void lock_rt_memory() {
2630 extern char __rt_text__start[], __rt_text__end[];
9094 gx_engine::get_group_table().insert("racktuner", N_("Rack Tuner"));
9195 static const value_pair streaming_labels[] = {{"scale"}, {"stream"}, {0}};
9296 pmap.reg_non_midi_enum_par("racktuner.streaming", "Streaming Mode", streaming_labels, (int*)0, false, 1);
93 static const value_pair tuning_labels[] = {{"(Chromatic)"},{"Standard"}, {"Standard/Es"}, {"Open E"}, {0}};
97 static const value_pair tuning_labels[] = {{"(Chromatic)"},{"Standard"}, {"Standard/Es"}, {"Open E"},
98 {"Drop D"},{"Half Step Down"},{"Full Step Down"},{"1 and 1/2 Steps Down"},{"Double Drop D"},{"Drop C"},
99 {"Drop C#"},{"Drop B"},{"Drop A#"},{"Drop A"},{"Open D"},{"Open D Minor"}, {"Open G"},{"Open G Minor"},
100 {"Open C"},{"Open C#"},{"Open C Minor"},{"Open E7"},{"Open E Minor7"},{"Open G Major7"},{"Open A Minor"},
101 {"Open A Minor7"},{"Open A"},{"C Tuning"},{"C# Tuning"},{"Bb Tuning"},{"A to A (Baritone)"},{"Open Dsus2"},
102 {"Open Gsus2"},{"G6"},{"Modal G"},{"Overtone"},{"Pentatonic"},{"Minor Third"},{"Major Third"},{"All Fourths"},
103 {"Augmented Fourths"},{"Slow Motion"},{"Admiral"},{"Buzzard"},{"Face"},{"Four and Twenty"},{"Ostrich"},{"Capo 200"},
104 {"Balalaika"},{"Cittern One"},{"Cittern Two"},{"Dobro"},{"Lefty"},{"Mandoguitar"},{"Rusty Cage"},{"Hardcore"}, {0}};
94105 pmap.reg_non_midi_enum_par("racktuner.tuning", "Tuning", tuning_labels, (int*)0, false, 0);
95106 pmap.reg_par_non_preset("racktuner.scale_lim", "Limit", 0, 3.0, 1.0, 10.0, 1.0);
96107 pmap.reg_par_non_preset("ui.tuner_reference_pitch", "?Tuner Reference Pitch", 0, 440, 427, 453, 0.1);
280291 sock = 0;
281292 }
282293
283 void GxMachine::start_socket(sigc::slot<void> quit_mainloop, int port) {
294 void GxMachine::start_socket(sigc::slot<void> quit_mainloop, const Glib::ustring& host, int port) {
284295 if (sock) {
285296 return;
286297 }
287 sock = new GxService(settings, jack, tuner_switcher, quit_mainloop, &port);
298 sock = new GxService(settings, jack, tuner_switcher, quit_mainloop, host, &port);
288299 sock->start();
289300 GxExit::get_instance().signal_exit().connect(
290301 sigc::mem_fun(*this, &GxMachine::exit_handler));
291302 #ifdef HAVE_AVAHI
292 std::string name = "Guitarix";
293 if (jack.get_default_instancename() != jack.get_instancename()) {
294 name += ": " + jack.get_instancename();
295 }
296 avahi_service = new AvahiService;
297 avahi_service->register_service(name, port);
303 if (port > 0) {
304 std::string name = "Guitarix";
305 if (jack.get_default_instancename() != jack.get_instancename()) {
306 name += ": " + jack.get_instancename();
307 }
308 avahi_service = new AvahiService;
309 avahi_service->register_service(name, port);
310 }
298311 #endif
299312 }
300313
574587 pmap[id].getBool().set(value);
575588 }
576589
590 //bool GxMachine::ui_f_update(const std::string& id, float value) {
591 // pmap[id].getFloat().set(value);
592 // return false;
593 //}
594
577595 void GxMachine::set_parameter_value(const std::string& id, float value) {
596 // Glib::signal_timeout().connect(
597 // sigc::bind<const std::string&>(sigc::bind<float>(
598 // sigc::mem_fun (*this, &GxMachine::ui_f_update),value),id), 20);
578599 pmap[id].getFloat().set(value);
579600 }
580601
734755 tuner_switcher_display(),
735756 tuner_switcher_set_state(),
736757 tuner_switcher_selection_done() {
737 socket = Gio::Socket::create(Gio::SOCKET_FAMILY_IPV4, Gio::SOCKET_TYPE_STREAM, Gio::SOCKET_PROTOCOL_TCP);
738 int flag = 1;
739 setsockopt(socket->get_fd(), IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int));
740 typedef std::vector< Glib::RefPtr<Gio::InetAddress> > adr_list;
741 adr_list al;
742 try {
743 al = Gio::Resolver::get_default()->lookup_by_name(options.get_rpcaddress());
744 } catch (Glib::Error e) {
745 gx_print_fatal(_("Remote Connection"), e.what());
746 }
747 Glib::ustring msg;
748 bool error = true;
749 for (adr_list::iterator i = al.begin(); i != al.end(); ++i) {
750 try {
751 socket->connect(Gio::InetSocketAddress::create(*i, options.get_rpcport()));
752 error = false;
753 } catch (Gio::Error e) {
754 msg = e.what();
755 error = true;
756 }
757 }
758 if (error) {
759 gx_print_fatal(_("Remote Connection"), msg);
758 if (options.get_rpcaddress().compare(0, 3, "BT:") == 0) {
759 create_bluetooth_socket(options.get_rpcaddress().substr(3));
760 } else {
761 create_tcp_socket();
760762 }
761763 socket->set_blocking(true);
762764 writebuf = new __gnu_cxx::stdio_filebuf<char>(socket->get_fd(), std::ios::out);
838840 cerr << endl;
839841 }
840842 #endif
843
844 #if HAVE_BLUEZ
845 void GxMachineRemote::create_bluetooth_socket(const Glib::ustring& bdaddr) {
846 struct sockaddr_rc addr = { 0 };
847 addr.rc_family = AF_BLUETOOTH;
848 str2ba(bdaddr.c_str(), &addr.rc_bdaddr);
849 int error = EBUSY;
850 for (int channel = 1; channel <= 9; channel++) {
851 addr.rc_channel = (uint8_t)channel;
852 int s = ::socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
853 if (connect(s, (const struct sockaddr *)&addr, sizeof(addr)) < 0) {
854 error = errno;
855 close(s);
856 if (error != EBUSY) {
857 break;
858 }
859 } else {
860 socket = Gio::Socket::create_from_fd(s);
861 return;
862 }
863 }
864 char buf[100];
865 throw GxFatalError(
866 Glib::ustring::compose(
867 _("Remote Connection: cannot connect to bluetooth %1: %2"),
868 bdaddr, strerror_r(error, buf, sizeof(buf))));
869 }
870 #else // !HAVE_BLUEZ
871 void GxMachineRemote::create_bluetooth_socket(const Glib::ustring& bdaddr) {
872 gx_print_fatal(
873 _("frontend"),
874 _("Bluetooth not available; rebuild Guitarix with Bluetooth support"));
875 }
876 #endif // HAVE_BLUEZ
877
878 void GxMachineRemote::create_tcp_socket() {
879 socket = Gio::Socket::create(Gio::SOCKET_FAMILY_IPV4, Gio::SOCKET_TYPE_STREAM, Gio::SOCKET_PROTOCOL_TCP);
880 int flag = 1;
881 setsockopt(socket->get_fd(), IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int));
882 typedef std::vector< Glib::RefPtr<Gio::InetAddress> > adr_list;
883 adr_list al;
884 try {
885 al = Gio::Resolver::get_default()->lookup_by_name(options.get_rpcaddress());
886 } catch (Glib::Error e) {
887 gx_print_fatal(_("Remote Connection"), e.what());
888 }
889 Glib::ustring msg;
890 bool error = true;
891 for (adr_list::iterator i = al.begin(); i != al.end(); ++i) {
892 try {
893 socket->connect(Gio::InetSocketAddress::create(*i, options.get_rpcport()));
894 error = false;
895 } catch (Gio::Error e) {
896 msg = e.what();
897 error = true;
898 }
899 }
900 if (error) {
901 gx_print_fatal(_("Remote Connection"), msg);
902 }
903 }
841904
842905 void GxMachineRemote::param_signal(Parameter *p) {
843906 debug_trace_param(p);
14101473 } else if (jp->current_value() == "create_master_slider") {
14111474 std::string id = next_string(jp);
14121475 builder.create_master_slider(id.c_str(), next_char_pointer(jp));
1476 } else if (jp->current_value() == "create_feedback_slider") {
1477 std::string id = next_string(jp);
1478 builder.create_feedback_slider(id.c_str(), next_char_pointer(jp));
14131479 } else if (jp->current_value() == "create_selector_no_caption") {
14141480 builder.create_selector_no_caption(next_char_pointer(jp));
14151481 } else if (jp->current_value() == "create_selector") {
14161482 std::string id = next_string(jp);
14171483 builder.create_selector(id.c_str(), next_char_pointer(jp));
1484 } else if (jp->current_value() == "create_simple_meter") {
1485 builder.create_simple_meter(next_char_pointer(jp));
1486 } else if (jp->current_value() == "create_simple_c_meter") {
1487 std::string id = next_char_pointer(jp);
1488 std::string idl = next_char_pointer(jp);
1489 builder.create_simple_c_meter(id.c_str(),idl.c_str(), next_char_pointer(jp));
14181490 } else if (jp->current_value() == "create_spin_value") {
14191491 std::string id = next_char_pointer(jp);
14201492 builder.create_spin_value(id.c_str(), next_char_pointer(jp));
14211493 } else if (jp->current_value() == "create_switch_no_caption") {
14221494 std::string sw_type = next_char_pointer(jp);
14231495 builder.create_switch_no_caption(sw_type.c_str(), next_char_pointer(jp));
1496 } else if (jp->current_value() == "create_feedback_switch") {
1497 std::string sw_type = next_char_pointer(jp);
1498 builder.create_feedback_switch(sw_type.c_str(), next_char_pointer(jp));
14241499 } else if (jp->current_value() == "create_switch") {
14251500 std::string sw_type = next_char_pointer(jp);
14261501 std::string id = next_char_pointer(jp);
14311506 } else if (jp->current_value() == "create_port_display") {
14321507 std::string id = next_char_pointer(jp);
14331508 builder.create_port_display(id.c_str(), next_char_pointer(jp));
1509 } else if (jp->current_value() == "create_p_display") {
1510 std::string id = next_char_pointer(jp);
1511 std::string idl = next_char_pointer(jp);
1512 std::string idh = next_char_pointer(jp);
1513 builder.create_p_display(id.c_str(),idl.c_str(),idh.c_str());
14341514 } else if (jp->current_value() == "create_simple_spin_value") {
14351515 builder.create_simple_spin_value(next_char_pointer(jp));
14361516 } else if (jp->current_value() == "create_eq_rackslider_no_caption") {
15621642 return options;
15631643 }
15641644
1565 void GxMachineRemote::start_socket(sigc::slot<void> quit_mainloop, int port) {
1645 void GxMachineRemote::start_socket(sigc::slot<void> quit_mainloop, const Glib::ustring& host, int port) {
15661646 assert(false);
15671647 }
15681648
654654 InputWindow *w = InputWindow::create(machine.get_options(), save_name_default);
655655 w->run();
656656 if (!w->get_name().empty()) {
657 machine.plugin_preset_list_save(pdef, w->get_name());
657 // save loop file to plugin preset name
658 if(strcmp(pdef->id,"dubber")==0) {
659 Glib::ustring name = "";
660 machine.set_parameter_value("dubber.filename", name);
661 machine.set_parameter_value("dubber.savefile", true);
662 machine.set_parameter_value("dubber.filename", w->get_name());
663 }
664 machine.plugin_preset_list_save(pdef, w->get_name());
658665 }
659666 delete w;
660667 }
1717 conf.check_cfg(package='avahi-glib', args='--cflags --libs', uselib_store='AVAHI_GLIB', mandatory=1)
1818 conf.check_cfg(package='avahi-client', args='--cflags --libs', uselib_store='AVAHI_CLIENT', mandatory=1)
1919 conf.define("HAVE_AVAHI", 1)
20 conf.check_cfg(package='bluez', args='--cflags --libs', uselib_store='BLUEZ', mandatory=0)
2021
2122 def gperf2cc(task):
2223 out_c = task.outputs[0].bldpath(task.env)
136137 'GTK2', 'GTKMM', 'GIOMM', 'FFTW3', 'LRDF', 'BOOST_SYSTEM']
137138 if bld.env["HAVE_AVAHI"]:
138139 uselib += ['AVAHI_GOBJECT', 'AVAHI_GLIB', 'AVAHI_CLIENT']
140 uselib.append('BLUEZ')
139141 uselib_local = []
140142 wscript_helper.add_zita_convolver(bld, uselib, sources, incl)
141143 wscript_helper.add_zita_resampler(bld, uselib, sources, incl)
3535 #include <vector>
3636 #include <map>
3737 #include <algorithm>
38 #include <sys/stat.h>
3839 #include <boost/format.hpp>
3940 #include <boost/thread/mutex.hpp>
4041 #include <glibmm/i18n.h> // NOLINT
9090 CabinetConvolver cabinet;
9191 PreampConvolver preamp;
9292 ContrastConvolver contrast;
93 LiveLooper loop;
94 SCapture record;
95 SCapture record_st;
9396 //
9497 public:
9598 GxEngine(const string& plugin_dir, ParameterGroups& groups, const gx_system::CmdlineOptions& options);
116116 declare(peak_eq)
117117 declare(digital_delay)
118118 declare(digital_delay_st)
119 declare(dattorros_progenitor)
120 declare(ring_modulator)
121 declare(ring_modulator_st)
122 declare(panoram_enhancer)
123 declare(graphiceq)
124 declare(bass_enhancer)
125 declare(gain)
126 declare(duck_delay)
127 declare(duck_delay_st)
119128 }
120129
121130 declare(balance)
443443 static void run_cab_conf(int count, float *input, float *output, PluginDef*);
444444 static int register_cab(const ParamReg& reg);
445445 bool do_update();
446 bool do_only_update();
447446 virtual void check_update();
448447 virtual bool start(bool force = false);
449448 bool cabinet_changed() { return current_cab != cabinet; }
475474 static void run_pre_conf(int count, float *input, float *output, PluginDef*);
476475 static int register_pre(const ParamReg& reg);
477476 bool do_update();
478 bool do_only_update();
479477 virtual void check_update();
480478 virtual bool start(bool force = false);
481479 bool preamp_changed() { return current_pre != preamp; }
503501 inline void update_sum() { sum = level; }
504502 virtual void check_update();
505503 bool do_update();
506 bool do_only_update();
507504 inline bool sum_changed() { return abs(sum - level) > 0.01; }
508505 virtual bool start(bool force = false);
509506 public:
586583 { return "ladspa"+gx_system::to_string(uid)+".js"; }
587584 };
588585
586
587 /****************************************************************
588 ** class LiveLooper
589 */
590
591
592 class LiveLooper: public PluginDef {
593 private:
594 int fSamplingFreq;
595 float gain;
596 float fRec0[2];
597 float gain_out;
598 float fclip1;
599 float fclip2;
600 float fclip3;
601 float fclip4;
602 float fclips1;
603 float fclips2;
604 float fclips3;
605 float fclips4;
606 float fspeed1;
607 float fspeed2;
608 float fspeed3;
609 float fspeed4;
610 float rplay1;
611 float rplay2;
612 float rplay3;
613 float rplay4;
614 float record1;
615 int iVec0[2];
616 int IOTA1;
617 int IOTA2;
618 int IOTA3;
619 int IOTA4;
620 float IOTAR1;
621 float IOTAR2;
622 float IOTAR3;
623 float IOTAR4;
624 float *tape1;
625 float fConst0;
626 float fConst1;
627 float fConst2;
628 float reset1;
629 int RecSize1[2];
630 float rectime0;
631 float fRec1[2];
632 float fRec2[2];
633 int iRec3[2];
634 int iRec4[2];
635 float play1;
636 float playh1;
637 float gain1;
638 float record2;
639 int iVec2[2];
640 float *tape2;
641 float reset2;
642 int RecSize2[2];
643 float rectime1;
644 float fRec6[2];
645 float fRec7[2];
646 int iRec8[2];
647 int iRec9[2];
648 float play2;
649 float playh2;
650 float gain2;
651 float record3;
652 int iVec4[2];
653 float *tape3;
654 float reset3;
655 int RecSize3[2];
656 float rectime2;
657 float fRec11[2];
658 float fRec12[2];
659 int iRec13[2];
660 int iRec14[2];
661 float play3;
662 float playh3;
663 float gain3;
664 float record4;
665 int iVec6[2];
666 float *tape4;
667 float reset4;
668 int RecSize4[2];
669 float rectime3;
670 float fRec16[2];
671 float fRec17[2];
672 int iRec18[2];
673 int iRec19[2];
674 float play4;
675 float playh4;
676 float gain4;
677 bool save1;
678 bool save2;
679 bool save3;
680 bool save4;
681 bool RP1;
682 bool RP2;
683 bool RP3;
684 bool RP4;
685 Glib::ustring preset_name;
686 Glib::ustring cur_name;
687 Glib::ustring loop_dir;
688 bool save_p;
689 ParamMap& param;
690 bool mem_allocated;
691 sigc::slot<void> sync;
692 volatile bool ready;
693 void mem_alloc();
694 void mem_free();
695 void clear_state_f();
696 int activate(bool start);
697 int load_ui_f(const UiBuilder& b, int form);
698 void init(unsigned int samplingFreq);
699 void compute(int count, float *input0, float *output0);
700 int register_par(const ParamReg& reg);
701 void save_array(std::string name);
702 void load_array(std::string name);
703 void save_to_wave(std::string fname, float *tape, float fSize);
704 int load_from_wave(std::string fname, float *tape);
705 void set_p_state();
706
707 static void clear_state_f_static(PluginDef*);
708 static int activate_static(bool start, PluginDef*);
709 static int load_ui_f_static(const UiBuilder& b, int form);
710 static void init_static(unsigned int samplingFreq, PluginDef*);
711 static void compute_static(int count, float *input0, float *output0, PluginDef*);
712 static int register_params_static(const ParamReg& reg);
713 static void del_instance(PluginDef *p);
714 public:
715 Plugin plugin;
716 LiveLooper(ParamMap& param_, sigc::slot<void> sync, const string& loop_dir_);
717 ~LiveLooper();
718 };
719
720
721 /****************************************************************
722 ** class SCapture
723 */
724
725
726 class SCapture: public PluginDef {
727 private:
728 SNDFILE * recfile;
729 EngineControl& engine;
730 int fSamplingFreq;
731 int channel;
732 float fcheckbox0;
733 float fcheckbox1;
734 float fslider0;
735 float fRecC0[2];
736 float fformat;
737 int IOTA;
738 int iA;
739 int savesize;
740 int filesize;
741 float *fRec0;
742 float *fRec1;
743 float *tape;
744 sem_t m_trig;
745 pthread_t m_pthr;
746 volatile bool keep_stream;
747 bool mem_allocated;
748 bool is_wav;
749 bool err;
750 float fConst0;
751 float fRecb0[2];
752 int iRecb1[2];
753 float fRecb2[2];
754 void mem_alloc();
755 void mem_free();
756 void clear_state_f();
757 int activate(bool start);
758 int load_ui_f(const UiBuilder& b, int form);
759 void init(unsigned int samplingFreq);
760 void compute(int count, float *input0, float *output0);
761 void compute_st(int count, float *input0, float *input1, float *output0, float *output1);
762 int register_par(const ParamReg& reg);
763 void save_to_wave(SNDFILE * sf, float *tape, int lSize);
764 SNDFILE *open_stream(std::string fname);
765 void close_stream(SNDFILE **sf);
766 void stop_thread();
767 void start_thread();
768 void disc_stream();
769 inline std::string get_ffilename();
770
771 static void *run_thread(void* p);
772 static void clear_state_f_static(PluginDef*);
773 static int activate_static(bool start, PluginDef*);
774 static int load_ui_f_static(const UiBuilder& b, int form);
775 static void init_static(unsigned int samplingFreq, PluginDef*);
776 static void compute_static(int count, float *input0, float *output0, PluginDef*);
777 static void compute_static_st(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
778 static int register_params_static(const ParamReg& reg);
779 static void del_instance(PluginDef *p);
780 public:
781 Plugin plugin;
782 SCapture(EngineControl& engine, int channel_);
783 ~SCapture();
784 };
785
786
589787 } // namespace gx_engine
564564 RackContainer stereorackcontainer;
565565 int pre_act;
566566 bool is_visible;
567 // bool ui_sleep();
567568 DragIcon *drag_icon;
568569 Glib::ustring preset_list_menu_bank;
569570 Gtk::UIManager::ui_merge_id preset_list_merge_id;
609609 insert(p);
610610 return p;
611611 }
612 inline StringParameter *reg_preset_string(const string& id, const string& name, Glib::ustring *var, const string& sv, bool preset=true) {
613 StringParameter *p = new StringParameter(id, name, var, sv, preset);
614 insert(p);
615 return p;
616 }
612617
613618 #ifndef NDEBUG
614619 void dump(const string& fmt);
5151 #define sw_button "button"
5252 #define sw_pbutton "pbutton"
5353 #define sw_rbutton "rbutton"
54 #define sw_prbutton "prbutton"
5455
5556 #define UI_FORM_STACK 0x01
5657 #define UI_FORM_GLADE 0x02
7778 // functions by the prefix create_ so please stick to this
7879 // prefix or change the checker
7980 void (*create_master_slider)(const char *id, const char *label);
81 void (*create_feedback_slider)(const char *id, const char *label);
8082 void (*create_small_rackknob)(const char *id, const char *label);
8183 void (*create_selector_no_caption)(const char *id);
8284 void (*create_switch_no_caption)(const char *sw_type,const char * id);
85 void (*create_feedback_switch)(const char *sw_type,const char * id);
8386 void (*create_spin_value)(const char * id, const char *label);
8487 void (*create_port_display)(const char * id, const char *label);
88 void (*create_p_display)(const char * id, const char * idl, const char * idh);
8589 void (*create_switch)(const char *sw_type,const char * id, const char *label);
8690 void (*create_selector)(const char *id, const char *label);
91 void (*create_simple_meter)(const char *id);
92 void (*create_simple_c_meter)(const char *id, const char *idl, const char *label);
8793 void (*create_small_rackknobr)(const char *id, const char *label);
8894 void (*create_wheel)(const char *id, const char *label);
8995 void (*create_simple_spin_value)(const char *id);
114120 void (*registerBoolVar)(const char* id, const char* name, const char* tp,
115121 const char* tooltip, bool* var, bool val);
116122 void (*registerNonMidiVar)(const char * id, bool*var, bool preset, bool nosave);
123 void (*registerNonMidiFloatVar)(const char * id, float *var, bool preset, bool nosave,
124 float val, float low, float up, float step);
117125 void (*registerEnumVar)(const char *id, const char* name, const char* tp,
118126 const char* tooltip, const value_pair* values, float *var, float val,
119127 float low, float up, float step);
100100 static void registerBoolVar_(const char* id, const char* name, const char* tp,
101101 const char* tooltip, bool* var, bool val);
102102 static void registerNonMidiVar_(const char * id, bool*var, bool preset, bool nosave);
103 static void registerNonMidiFloatVar_(const char * id, float *var, bool preset, bool nosave,
104 float val, float low, float up, float step);
103105 static void registerEnumVar_(const char *id, const char* name, const char* tp,
104106 const char* tooltip, const value_pair* values, float *var, float val,
105107 float low, float up, float step);
7171 void openSpaceBox(const char* label = "");
7272
7373 void check_set_flags(Gxw::Regler *r);
74 void create_simple_meter(const std::string& id);
75 void create_simple_c_meter(const std::string& id, const std::string& idl, const char *label);
76 bool set_simple(Gxw::FastMeter *fastmeter, const std::string id);
7477 void create_small_rackknob(const std::string& id, const char *label);
7578 void create_small_rackknobr(const std::string& id);
7679 void create_small_rackknobr(const std::string& id, const char *label);
111114 void create_eq_rackslider_no_caption(const std::string& id) {
112115 addwidget(new UiRegler<Gxw::EqSlider>(machine, id, true));
113116 }
114 void create_port_display(const std::string& id, const char *label) {
115 CpBaseCaption *w = new UiReglerWithCaption<Gxw::PortDisplay>(machine, id);
116 w->set_rack_label(label);
117 addwidget(w);
118 }
117 bool set_engine_value(const std::string id);
118 bool set_pd_value(Gxw::PortDisplay *w, const std::string id, const std::string& idl, const std::string& idh);
119 void create_port_display(const std::string& id, const char *label);
120 void create_p_display(const std::string& id, const std::string& idl, const std::string& idh);
121 void create_feedback_switch(const char *sw_type, const std::string& id);
122 void create_feedback_slider(const std::string& id, const char *label);
119123 void create_selector(const std::string& id, const char *widget_name=0);
120124 void create_selector_with_caption(const std::string& id, const char *label);
121125 void openFlipLabelBox(const char* = 0);
400400 std::string pluginpreset_dir;
401401 std::string temp_dir;
402402 std::string plugin_dir;
403 std::string loop_dir;
403404 Glib::ustring rcset;
404405 bool nogui;
405406 int rpcport;
456457 const std::string& get_plugin_dir() const { return plugin_dir; }
457458 const std::string& get_preset_dir() const { return preset_dir; }
458459 const std::string& get_pluginpreset_dir() const { return pluginpreset_dir; }
460 const std::string& get_loop_dir() const { return loop_dir; }
459461 const std::string& get_temp_dir() const { return temp_dir; }
460462 const std::string& get_factory_dir() const { return factory_dir; }
461463 std::string get_ladspa_config_filename() const { return get_user_filepath("ladspa_defs.js"); }
216216 static void create_small_rackknob_(const char *id, const char *label);
217217 static void create_small_rackknobr_(const char *id, const char *label);
218218 static void create_master_slider_(const char *id, const char *label);
219 static void create_feedback_slider_(const char *id, const char *label);
219220 static void create_selector_no_caption_(const char *id);
220221 static void create_selector_(const char *id, const char *label);
222 static void create_simple_meter_(const char *id);
223 static void create_simple_c_meter_(const char *id, const char *idl, const char *label);
221224 static void create_spin_value_(const char *id, const char *label);
222225 static void create_switch_no_caption_(const char *sw_type,const char * id);
226 static void create_feedback_switch_(const char *sw_type,const char * id);
223227 static void create_switch_(const char *sw_type,const char * id, const char *label);
224228 static void create_wheel_(const char * id, const char *label);
225229 static void create_port_display_(const char *id, const char *label);
230 static void create_p_display_(const char *id, const char *idl, const char *idh);
226231 static void create_simple_spin_value_(const char *id);
227232 static void create_eq_rackslider_no_caption_(const char *id);
228233 static void closeBox_();
162162 int on_osc_activation(bool v);
163163 void on_jack_load_changed();
164164 void on_rack_unit_changed(bool stereo);
165 static void add_changed_plugin(gx_engine::Plugin* pl, gx_engine::PluginChange::pc v, std::vector<ChangedPlugin>& vec);
165 static void add_changed_plugin(gx_engine::Plugin* pl, gx_engine::PluginChange::pc v,
166 std::vector<ChangedPlugin>& vec);
167 void create_bluetooth_sockets(const Glib::ustring& host);
166168
167169 friend class CmdConnection;
168170 public:
169171 GxService(gx_preset::GxSettings& settings_, gx_jack::GxJack& jack_,
170 TunerSwitcher& tunerswitcher, sigc::slot<void> quit_mainloop_, int *port);
172 TunerSwitcher& tunerswitcher, sigc::slot<void> quit_mainloop_,
173 const Glib::ustring& host, int *port);
171174 ~GxService();
172175 void send_rack_changed(bool stereo, CmdConnection *cmd);
173176 void ladspaloader_update_plugins(gx_system::JsonWriter *jw, CmdConnection *cmd);
8686 virtual void maxlevel_get(int channels, float *values) = 0;
8787 virtual void get_oscilloscope_info(int& load, int& frames, bool& is_rt, jack_nframes_t& bsize) = 0;
8888 virtual gx_system::CmdlineOptions& get_options() const = 0;
89 virtual void start_socket(sigc::slot<void> quit_mainloop, int port) = 0;
89 virtual void start_socket(sigc::slot<void> quit_mainloop, const Glib::ustring& host, int port) = 0;
9090 virtual void stop_socket() = 0;
9191 virtual sigc::signal<void,GxEngineState>& signal_state_change() = 0;
9292 sigc::signal<void,MidiAudioBuffer::Load>& signal_jack_load_change() { return jack_load_change; }
261261 virtual void maxlevel_get(int channels, float *values);
262262 virtual void get_oscilloscope_info(int& load, int& frames, bool& is_rt, jack_nframes_t& bsize);
263263 virtual gx_system::CmdlineOptions& get_options() const;
264 virtual void start_socket(sigc::slot<void> quit_mainloop, int port);
264 virtual void start_socket(sigc::slot<void> quit_mainloop, const Glib::ustring& host, int port);
265265 virtual void stop_socket();
266266 virtual sigc::signal<void,GxEngineState>& signal_state_change();
267267 virtual void tuner_used_for_display(bool on);
333333 virtual void set_parameter_value(const std::string& id, bool value);
334334 virtual void set_parameter_value(const std::string& id, float value);
335335 virtual void set_parameter_value(const std::string& id, const std::string& value);
336
336 // bool ui_f_update(const std::string& id, float value);
337337 // MidiControllerList
338338 virtual bool midi_get_config_mode(int *ctl = 0);
339339 virtual void midi_set_config_mode(bool v, int ctl=-1);
402402 void throw_error(gx_system::JsonStringParser *jp);
403403 void param_signal(Parameter *p);
404404 void update_plugins(gx_system::JsonParser *jp);
405 void create_bluetooth_socket(const Glib::ustring& bdaddr);
406 void create_tcp_socket();
405407 virtual int _get_parameter_value_int(const std::string& id);
406408 virtual int _get_parameter_value_bool(const std::string& id);
407409 virtual float _get_parameter_value_float(const std::string& id);
435437 virtual void maxlevel_get(int channels, float *values);
436438 virtual void get_oscilloscope_info(int& load, int& frames, bool& is_rt, jack_nframes_t& bsize);
437439 virtual gx_system::CmdlineOptions& get_options() const;
438 virtual void start_socket(sigc::slot<void> quit_mainloop, int port);
440 virtual void start_socket(sigc::slot<void> quit_mainloop, const Glib::ustring& host, int port);
439441 virtual void stop_socket();
440442 virtual sigc::signal<void,GxEngineState>& signal_state_change();
441443 virtual void tuner_used_for_display(bool on);
745745 CabinetConvolver cabinet;
746746 PreampConvolver preamp;
747747 ContrastConvolver contrast;
748 LiveLooper loop;
749 SCapture record;
748750 public:
749 MonoEngine(const string& plugin_dir, ParameterGroups& groups);
751 MonoEngine(const string& plugin_dir, const string& loop_dir, ParameterGroups& groups);
750752 ~MonoEngine();
751753 virtual void wait_ramp_down_finished();
752754 virtual bool update_module_lists();
888890 0
889891 };
890892
891 MonoEngine::MonoEngine(const string& plugin_dir, ParameterGroups& groups)
893 MonoEngine::MonoEngine(const string& plugin_dir, const string& loop_dir, ParameterGroups& groups)
892894 : EngineControl(),
893895 resamp(),
894896 // ModuleSelector's
907909 mono_convolver(*this, sigc::mem_fun(mono_chain, &MonoModuleChain::sync), get_param()),
908910 cabinet(*this, sigc::mem_fun(mono_chain, &MonoModuleChain::sync), resamp),
909911 preamp(*this, sigc::mem_fun(mono_chain, &MonoModuleChain::sync), resamp),
910 contrast(*this, sigc::mem_fun(mono_chain, &MonoModuleChain::sync), resamp) {
912 contrast(*this, sigc::mem_fun(mono_chain, &MonoModuleChain::sync), resamp),
913 loop(get_param(), sigc::mem_fun(mono_chain, &MonoModuleChain::sync), loop_dir),
914 record(*this, 1) {
911915
912916 mono_convolver.set_sync(true);
913917 cabinet.set_sync(true);
980984 pl.add(builtin_tonestack_plugins, PLUGIN_POS_RACK, PGN_ALTERNATIVE);
981985
982986 // mono
987 pl.add(gx_effects::gain::plugin(), PLUGIN_POS_RACK, PGN_GUI);
983988 pl.add(gx_effects::low_high_pass::plugin(), PLUGIN_POS_RACK, PGN_GUI);
984989 pl.add(gx_effects::highbooster::plugin(), PLUGIN_POS_RACK, PGN_GUI);
985990 pl.add(gx_effects::selecteq::plugin(), PLUGIN_POS_RACK, PGN_GUI);
986991 pl.add(&crybaby.plugin, PLUGIN_POS_RACK, PGN_GUI);
992 pl.add(&loop.plugin, PLUGIN_POS_RACK, PGN_GUI);
993 pl.add(&record.plugin, PLUGIN_POS_RACK, PGN_GUI);
987994 pl.add(gx_effects::gx_distortion::plugin(), PLUGIN_POS_RACK, PGN_GUI);
988995 pl.add(pluginlib::ts9sim::plugin(), PLUGIN_POS_RACK, PGN_GUI);
989996 pl.add(gx_effects::impulseresponse::plugin(), PLUGIN_POS_RACK, PGN_GUI);
10011008 pl.add(gx_effects::gx_feedback::plugin(), PLUGIN_POS_RACK, PGN_GUI);
10021009 pl.add(gx_effects::peak_eq::plugin(), PLUGIN_POS_RACK, PGN_GUI);
10031010 pl.add(gx_effects::digital_delay::plugin(), PLUGIN_POS_RACK, PGN_GUI);
1011 pl.add(gx_effects::graphiceq::plugin(), PLUGIN_POS_RACK, PGN_GUI);
1012 pl.add(gx_effects::ring_modulator::plugin(), PLUGIN_POS_RACK, PGN_GUI);
1013 pl.add(gx_effects::duck_delay::plugin(), PLUGIN_POS_RACK);
1014 pl.add(pluginlib::reversedelay::plugin(), PLUGIN_POS_RACK);
10041015 pl.add(&tonestack.plugin, PLUGIN_POS_RACK, PGN_GUI);
10051016 pl.add(&mono_convolver.plugin, PLUGIN_POS_RACK, PGN_GUI);
10061017 pl.add(&cabinet.plugin, PLUGIN_POS_RACK, PGN_GUI);
10081019 pl.add(pluginlib::abgate::plugin(), PLUGIN_POS_RACK);
10091020 pl.add(pluginlib::vibe::plugin_mono(), PLUGIN_POS_RACK);
10101021 pl.add(pluginlib::mbc::plugin(), PLUGIN_POS_RACK);
1022 pl.add(pluginlib::mbd::plugin(), PLUGIN_POS_RACK);
1023 pl.add(pluginlib::mbe::plugin(), PLUGIN_POS_RACK);
1024 pl.add(pluginlib::mbdel::plugin(), PLUGIN_POS_RACK);
1025 pl.add(pluginlib::mbchor::plugin(), PLUGIN_POS_RACK);
10111026 }
10121027
10131028
10931108
10941109 LadspaGuitarixMono::LadspaGuitarixMono(unsigned long sr)
10951110 : LadspaGuitarix(engine, 0, &engine.mono_convolver, control_parameter, "LADSPA_GUITARIX_MONO_PRESET"),
1096 engine(Glib::build_filename(Glib::get_user_config_dir(), "guitarix/plugins/"), get_group_table()),
1111 engine(Glib::build_filename(Glib::get_user_config_dir(), "guitarix/plugins/"),
1112 Glib::build_filename(Glib::get_user_config_dir(), "guitarix/pluginpresets/loops/"), get_group_table()),
10971113 control_parameter(GUITARIX_PARAM_COUNT),
10981114 rebuffer(),
10991115 volume_port(),
13821398 public:
13831399 StereoModuleChain stereo_chain;
13841400 ConvolverStereoAdapter stereo_convolver;
1401 SCapture record_st;
13851402 public:
13861403 StereoEngine(const string& plugin_dir, ParameterGroups& groups);
13871404 ~StereoEngine();
14611478 StereoEngine::StereoEngine(const string& plugin_dir, ParameterGroups& groups)
14621479 : EngineControl(),
14631480 // internal audio modules
1464 stereo_convolver(*this, sigc::mem_fun(stereo_chain, &StereoModuleChain::sync), get_param()) {
1481 stereo_convolver(*this, sigc::mem_fun(stereo_chain, &StereoModuleChain::sync), get_param()),
1482 record_st(*this, 2) {
14651483
14661484 stereo_convolver.set_sync(true);
14671485
15071525 pl.add(gx_effects::tonecontroll::plugin(), PLUGIN_POS_RACK, PGN_GUI);
15081526 pl.add(gx_effects::digital_delay_st::plugin(),PLUGIN_POS_RACK, PGN_GUI);
15091527 pl.add(&stereo_convolver.plugin, PLUGIN_POS_RACK, PGN_GUI);
1528 pl.add(&record_st.plugin, PLUGIN_POS_RACK, PGN_GUI);
15101529 pl.add(gx_effects::stereoverb::plugin(), PLUGIN_POS_RACK, PGN_GUI);
15111530 pl.add(pluginlib::zita_rev1::plugin(), PLUGIN_POS_RACK);
15121531 pl.add(pluginlib::vibe::plugin_stereo(), PLUGIN_POS_RACK);
15131532 pl.add(pluginlib::mbcs::plugin(), PLUGIN_POS_RACK);
1533 pl.add(gx_effects::ring_modulator_st::plugin(),PLUGIN_POS_RACK, PGN_GUI);
1534 pl.add(gx_effects::duck_delay_st::plugin(), PLUGIN_POS_RACK, PGN_GUI);
1535 pl.add(gx_effects::dattorros_progenitor::plugin(),PLUGIN_POS_RACK, PGN_GUI);
1536 pl.add(gx_effects::panoram_enhancer::plugin(),PLUGIN_POS_RACK, PGN_GUI);
1537 pl.add(gx_effects::bass_enhancer::plugin(), PLUGIN_POS_RACK, PGN_GUI);
15141538 }
15151539
15161540
3535 '../plugins/flanger_gx.cc',
3636 '../plugins/mbc.cc',
3737 '../plugins/mbcs.cc',
38 '../plugins/mbd.cc',
39 '../plugins/mbe.cc',
40 '../plugins/mbdel.cc',
41 '../plugins/mbchor.cc',
42 '../plugins/reversedelay.cc',
43 #'../plugins/dubbe.cc',
3844 ]
3945
4046 src = ['ladspa_guitarix.cpp'] + bsources
0 // generated by scripts/build_GCB_95.py
1 // DO NOT MODIFY!
2 declare id "GCB_95";
3 declare name "GCB 95";
4 declare category "Guitar Effects";
5 declare description "Linear filter simulating the GCB 95 crybaby circuit";
6
7 import("filter.lib");
8
9 process = pre : iir((b0/a0,b1/a0,b2/a0,b3/a0,b4/a0),(a1/a0,a2/a0,a3/a0,a4/a0)) with {
10 LogPot(a, x) = if(a, (exp(a * x) - 1) / (exp(a) - 1), x);
11 Inverted(b, x) = if(b, 1 - x, x);
12 s = 0.993;
13 fs = float(SR);
14 pre = dcblockerat(228.105325695);
15
16
17 hotpotz = vslider("hotpotz[name:Wah]", 0.5, 0, 1, 0.01) : Inverted(1) : LogPot(5) : smooth(s);
18
19 b0 = fs*(fs*(fs*(-7.41350388334374e-21*fs - 2.47418541205506e-16) - 3.69672787496925e-13) - 1.8397056665289e-12) + hotpotz*(pow(fs,2)*hotpotz*(fs*(1.96834437163512e-21*fs + 5.48587515516469e-17) + 8.09470493272714e-14) + fs*(fs*(fs*(-1.96653248770188e-21*fs - 5.48942867863191e-17) - 8.21432353321142e-14) - 1.78155704878595e-12));
20
21 b1 = fs*(pow(fs,2)*(2.9654015533375e-20*fs + 4.94837082411013e-16) - 3.67941133305779e-12) + hotpotz*(pow(fs,3)*hotpotz*(-7.87337748654046e-21*fs - 1.09717503103294e-16) + fs*(pow(fs,2)*(7.86612995080753e-21*fs + 1.09788573572638e-16) - 3.56311409757189e-12));
22
23 b2 = pow(fs,2)*(-4.44810233000624e-20*pow(fs,2) + 7.39345574993849e-13) + hotpotz*(pow(fs,2)*hotpotz*(1.18100662298107e-20*pow(fs,2) - 1.61894098654543e-13) + pow(fs,2)*(-1.17991949262113e-20*pow(fs,2) + 1.64286470664228e-13));
24
25 b3 = fs*(pow(fs,2)*(2.9654015533375e-20*fs - 4.94837082411013e-16) + 3.67941133305779e-12) + hotpotz*(pow(fs,3)*hotpotz*(-7.87337748654046e-21*fs + 1.09717503103294e-16) + fs*(pow(fs,2)*(7.86612995080753e-21*fs - 1.09788573572638e-16) + 3.56311409757189e-12));
26
27 b4 = fs*(fs*(fs*(-7.41350388334374e-21*fs + 2.47418541205506e-16) - 3.69672787496925e-13) + 1.8397056665289e-12) + hotpotz*(pow(fs,2)*hotpotz*(fs*(1.96834437163512e-21*fs - 5.48587515516469e-17) + 8.09470493272714e-14) + fs*(fs*(fs*(-1.96653248770188e-21*fs + 5.48942867863191e-17) - 8.21432353321142e-14) + 1.78155704878595e-12));
28
29 a0 = fs*(fs*(fs*(1.08819023657393e-20*fs + 2.80985481683452e-17) + 5.44712113689982e-13) + 1.29191360120173e-11) + hotpotz*(pow(fs,2)*hotpotz*(fs*(-6.9672955745145e-20*fs - 9.30061422376548e-18) - 9.53707992555105e-14) + fs*(fs*(fs*(3.8766476861454e-19*fs + 2.92076464853813e-17) + 7.68323461702748e-14) + 2.16751816489796e-12)) + 4.92617764749537e-11;
30
31 a1 = fs*(pow(fs,2)*(-4.3527609462957e-20*fs - 5.61970963366905e-17) + 2.58382720240347e-11) + hotpotz*(pow(fs,3)*hotpotz*(2.7869182298058e-19*fs + 1.8601228447531e-17) + fs*(pow(fs,2)*(-1.55065907445816e-18*fs - 5.84152929707626e-17) + 4.33503632979593e-12)) + 1.97047105899815e-10;
32
33 a2 = pow(fs,2)*(6.52914141944355e-20*pow(fs,2) - 1.08942422737996e-12) + hotpotz*(pow(fs,2)*hotpotz*(-4.1803773447087e-19*pow(fs,2) + 1.90741598511021e-13) + pow(fs,2)*(2.32598861168724e-18*pow(fs,2) - 1.5366469234055e-13)) + 2.95570658849723e-10;
34
35 a3 = fs*(pow(fs,2)*(-4.3527609462957e-20*fs + 5.61970963366905e-17) - 2.58382720240347e-11) + hotpotz*(pow(fs,3)*hotpotz*(2.7869182298058e-19*fs - 1.8601228447531e-17) + fs*(pow(fs,2)*(-1.55065907445816e-18*fs + 5.84152929707626e-17) - 4.33503632979593e-12)) + 1.97047105899815e-10;
36
37 a4 = fs*(fs*(fs*(1.08819023657393e-20*fs - 2.80985481683452e-17) + 5.44712113689982e-13) - 1.29191360120173e-11) + hotpotz*(pow(fs,2)*hotpotz*(fs*(-6.9672955745145e-20*fs + 9.30061422376548e-18) - 9.53707992555105e-14) + fs*(fs*(fs*(3.8766476861454e-19*fs - 2.92076464853813e-17) + 7.68323461702748e-14) - 2.16751816489796e-12)) + 4.92617764749537e-11;
38 };
0
1 b.openHorizontalhideBox("");
2 b.create_master_slider(PARAM("hotpotz"), 0);
3 b.closeBox();
4 b.openHorizontalBox("");
5
6 b.create_small_rackknobr(PARAM("hotpotz"), 0);
7 b.closeBox();
3030 void clear_state_f();
3131 int load_ui_f(const UiBuilder& b, int form);
3232 void init(unsigned int samplingFreq);
33 void compute(int count, float *input0, float *output0);
33 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
3434 int register_par(const ParamReg& reg);
3535
3636 static void clear_state_f_static(PluginDef*);
3737 static int load_ui_f_static(const UiBuilder& b, int form);
3838 static void init_static(unsigned int samplingFreq, PluginDef*);
39 static void compute_static(int count, float *input0, float *output0, PluginDef*);
39 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
4040 static int register_params_static(const ParamReg& reg);
4141 static void del_instance(PluginDef *p);
4242 public:
101101 static_cast<Dsp*>(p)->init(samplingFreq);
102102 }
103103
104 void always_inline Dsp::compute(int count, float *input0, float *output0)
104 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
105105 {
106106 double fSlow0 = fslider0;
107107 double fSlow1 = fslider1;
152152 }
153153 }
154154
155 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
155 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
156156 {
157157 static_cast<Dsp*>(p)->compute(count, input0, output0);
158158 }
0 // generated from file '../src/plugins/gcb_95.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.58 (http://faust.grame.fr)
2
3 #include "gx_faust_support.h"
4 #include "gx_plugin.h"
5
6 namespace pluginlib {
7 namespace gcb_95 {
8
9 class Dsp: public PluginDef {
10 private:
11 int fSamplingFreq;
12 int iConst0;
13 double fConst1;
14 double fConst2;
15 double fConst3;
16 FAUSTFLOAT fslider0;
17 double fRec0[2];
18 double fConst4;
19 double fConst5;
20 double fConst6;
21 double fConst7;
22 double fConst8;
23 double fConst9;
24 double fConst10;
25 double fConst11;
26 double fConst12;
27 double fConst13;
28 double fConst14;
29 double fConst15;
30 double fConst16;
31 double fConst17;
32 double fConst18;
33 double fConst19;
34 double fConst20;
35 double fConst21;
36 double fConst22;
37 double fConst23;
38 double fConst24;
39 double fConst25;
40 double fConst26;
41 double fConst27;
42 double fConst28;
43 double fVec0[2];
44 double fConst29;
45 double fRec2[2];
46 double fRec1[5];
47 double fConst30;
48 double fConst31;
49 double fConst32;
50 double fConst33;
51 double fConst34;
52 double fConst35;
53 double fConst36;
54 double fConst37;
55 double fConst38;
56 double fConst39;
57 double fConst40;
58 double fConst41;
59 double fConst42;
60 double fConst43;
61 double fConst44;
62 double fConst45;
63 double fConst46;
64 double fConst47;
65 void clear_state_f();
66 int load_ui_f(const UiBuilder& b, int form);
67 void init(unsigned int samplingFreq);
68 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
69 int register_par(const ParamReg& reg);
70
71 static void clear_state_f_static(PluginDef*);
72 static int load_ui_f_static(const UiBuilder& b, int form);
73 static void init_static(unsigned int samplingFreq, PluginDef*);
74 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
75 static int register_params_static(const ParamReg& reg);
76 static void del_instance(PluginDef *p);
77 public:
78 Dsp();
79 ~Dsp();
80 };
81
82
83
84 Dsp::Dsp()
85 : PluginDef() {
86 version = PLUGINDEF_VERSION;
87 flags = 0;
88 id = "GCB_95";
89 name = N_("GCB 95");
90 groups = 0;
91 description = N_("Linear filter simulating the GCB 95 crybaby circuit"); // description (tooltip)
92 category = N_("Guitar Effects"); // category
93 shortname = ""; // shortname
94 mono_audio = compute_static;
95 stereo_audio = 0;
96 set_samplerate = init_static;
97 activate_plugin = 0;
98 register_params = register_params_static;
99 load_ui = load_ui_f_static;
100 clear_state = clear_state_f_static;
101 delete_instance = del_instance;
102 }
103
104 Dsp::~Dsp() {
105 }
106
107 inline void Dsp::clear_state_f()
108 {
109 for (int i=0; i<2; i++) fRec0[i] = 0;
110 for (int i=0; i<2; i++) fVec0[i] = 0;
111 for (int i=0; i<2; i++) fRec2[i] = 0;
112 for (int i=0; i<5; i++) fRec1[i] = 0;
113 }
114
115 void Dsp::clear_state_f_static(PluginDef *p)
116 {
117 static_cast<Dsp*>(p)->clear_state_f();
118 }
119
120 inline void Dsp::init(unsigned int samplingFreq)
121 {
122 fSamplingFreq = samplingFreq;
123 iConst0 = min(192000, max(1, fSamplingFreq));
124 fConst1 = double(iConst0);
125 fConst2 = (1.08819023657393e-20 * fConst1);
126 fConst3 = (1.29191360120173e-11 + (fConst1 * (5.44712113689982e-13 + (fConst1 * (2.80985481683452e-17 + fConst2)))));
127 fConst4 = (6.9672955745145e-20 * fConst1);
128 fConst5 = (fConst1 * ((fConst1 * (0 - (9.30061422376548e-18 + fConst4))) - 9.53707992555105e-14));
129 fConst6 = (3.8766476861454e-19 * fConst1);
130 fConst7 = (2.16751816489796e-12 + (fConst1 * (7.68323461702748e-14 + (fConst1 * (2.92076464853813e-17 + fConst6)))));
131 fConst8 = faustpower<2>(fConst1);
132 fConst9 = (7.39345574993849e-13 - (4.44810233000624e-20 * fConst8));
133 fConst10 = ((1.18100662298107e-20 * fConst8) - 1.61894098654543e-13);
134 fConst11 = (1.64286470664228e-13 - (1.17991949262113e-20 * fConst8));
135 fConst12 = (4.3527609462957e-20 * fConst1);
136 fConst13 = (2.58382720240347e-11 + (fConst8 * (0 - (5.61970963366905e-17 + fConst12))));
137 fConst14 = (2.7869182298058e-19 * fConst1);
138 fConst15 = (fConst8 * (1.8601228447531e-17 + fConst14));
139 fConst16 = (1.55065907445816e-18 * fConst1);
140 fConst17 = (4.33503632979593e-12 + (fConst8 * (0 - (5.84152929707626e-17 + fConst16))));
141 fConst18 = (1.90741598511021e-13 - (4.1803773447087e-19 * fConst8));
142 fConst19 = ((2.32598861168724e-18 * fConst8) - 1.5366469234055e-13);
143 fConst20 = ((6.52914141944355e-20 * fConst8) - 1.08942422737996e-12);
144 fConst21 = ((fConst8 * (5.61970963366905e-17 - fConst12)) - 2.58382720240347e-11);
145 fConst22 = (fConst8 * (fConst14 - 1.8601228447531e-17));
146 fConst23 = ((fConst8 * (5.84152929707626e-17 - fConst16)) - 4.33503632979593e-12);
147 fConst24 = ((fConst1 * (5.44712113689982e-13 + (fConst1 * (fConst2 - 2.80985481683452e-17)))) - 1.29191360120173e-11);
148 fConst25 = (fConst1 * ((fConst1 * (9.30061422376548e-18 - fConst4)) - 9.53707992555105e-14));
149 fConst26 = ((fConst1 * (7.68323461702748e-14 + (fConst1 * (fConst6 - 2.92076464853813e-17)))) - 2.16751816489796e-12);
150 fConst27 = (716.6140154481191 / double(iConst0));
151 fConst28 = (1 - fConst27);
152 fConst29 = (1.0 / (1 + fConst27));
153 fConst30 = (7.41350388334374e-21 * fConst1);
154 fConst31 = ((fConst1 * ((fConst1 * (0 - (2.47418541205506e-16 + fConst30))) - 3.69672787496925e-13)) - 1.8397056665289e-12);
155 fConst32 = (1.96834437163512e-21 * fConst1);
156 fConst33 = (fConst1 * (8.09470493272714e-14 + (fConst1 * (5.48587515516469e-17 + fConst32))));
157 fConst34 = (1.96653248770188e-21 * fConst1);
158 fConst35 = ((fConst1 * ((fConst1 * (0 - (5.48942867863191e-17 + fConst34))) - 8.21432353321142e-14)) - 1.78155704878595e-12);
159 fConst36 = (2.9654015533375e-20 * fConst1);
160 fConst37 = ((fConst8 * (4.94837082411013e-16 + fConst36)) - 3.67941133305779e-12);
161 fConst38 = (7.87337748654046e-21 * fConst1);
162 fConst39 = (fConst8 * (0 - (1.09717503103294e-16 + fConst38)));
163 fConst40 = (7.86612995080753e-21 * fConst1);
164 fConst41 = ((fConst8 * (1.09788573572638e-16 + fConst40)) - 3.56311409757189e-12);
165 fConst42 = (3.67941133305779e-12 + (fConst8 * (fConst36 - 4.94837082411013e-16)));
166 fConst43 = (fConst8 * (1.09717503103294e-16 - fConst38));
167 fConst44 = (3.56311409757189e-12 + (fConst8 * (fConst40 - 1.09788573572638e-16)));
168 fConst45 = (1.8397056665289e-12 + (fConst1 * ((fConst1 * (2.47418541205506e-16 - fConst30)) - 3.69672787496925e-13)));
169 fConst46 = (fConst1 * (8.09470493272714e-14 + (fConst1 * (fConst32 - 5.48587515516469e-17))));
170 fConst47 = (1.78155704878595e-12 + (fConst1 * ((fConst1 * (5.48942867863191e-17 - fConst34)) - 8.21432353321142e-14)));
171 clear_state_f();
172 }
173
174 void Dsp::init_static(unsigned int samplingFreq, PluginDef *p)
175 {
176 static_cast<Dsp*>(p)->init(samplingFreq);
177 }
178
179 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
180 {
181 double fSlow0 = (4.748558434412966e-05 * (exp((5 * (1 - fslider0))) - 1));
182 for (int i=0; i<count; i++) {
183 fRec0[0] = (fSlow0 + (0.993 * fRec0[1]));
184 double fTemp0 = (4.92617764749537e-11 + (fConst1 * ((fRec0[0] * (fConst7 + (fConst5 * fRec0[0]))) + fConst3)));
185 double fTemp1 = (double)input0[i];
186 fVec0[0] = fTemp1;
187 fRec2[0] = (fConst29 * ((fVec0[0] - fVec0[1]) + (fConst28 * fRec2[1])));
188 fRec1[0] = (fRec2[0] - (((fRec1[4] * (4.92617764749537e-11 + (fConst1 * ((fRec0[0] * (fConst26 + (fConst25 * fRec0[0]))) + fConst24)))) + ((fRec1[3] * (1.97047105899815e-10 + (fConst1 * ((fRec0[0] * (fConst23 + (fConst22 * fRec0[0]))) + fConst21)))) + ((fRec1[2] * (2.95570658849723e-10 + (fConst8 * (fConst20 + (fRec0[0] * (fConst19 + (fConst18 * fRec0[0]))))))) + (fRec1[1] * (1.97047105899815e-10 + (fConst1 * ((fRec0[0] * (fConst17 + (fConst15 * fRec0[0]))) + fConst13))))))) / fTemp0));
189 output0[i] = (FAUSTFLOAT)(fConst1 * (((fRec1[4] * ((fRec0[0] * (fConst47 + (fConst46 * fRec0[0]))) + fConst45)) + ((fRec1[3] * ((fRec0[0] * (fConst44 + (fConst43 * fRec0[0]))) + fConst42)) + (((fRec1[1] * ((fRec0[0] * (fConst41 + (fConst39 * fRec0[0]))) + fConst37)) + (fRec1[0] * ((fRec0[0] * (fConst35 + (fConst33 * fRec0[0]))) + fConst31))) + (fConst1 * (fRec1[2] * ((fRec0[0] * (fConst11 + (fConst10 * fRec0[0]))) + fConst9)))))) / fTemp0));
190 // post processing
191 for (int i=4; i>0; i--) fRec1[i] = fRec1[i-1];
192 fRec2[1] = fRec2[0];
193 fVec0[1] = fVec0[0];
194 fRec0[1] = fRec0[0];
195 }
196 }
197
198 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
199 {
200 static_cast<Dsp*>(p)->compute(count, input0, output0);
201 }
202
203 int Dsp::register_par(const ParamReg& reg)
204 {
205 reg.registerVar("GCB_95.hotpotz",N_("Wah"),"S","",&fslider0, 0.5, 0.0, 1.0, 0.01);
206 return 0;
207 }
208
209 int Dsp::register_params_static(const ParamReg& reg)
210 {
211 return static_cast<Dsp*>(reg.plugin)->register_par(reg);
212 }
213
214 inline int Dsp::load_ui_f(const UiBuilder& b, int form)
215 {
216 if (form & UI_FORM_STACK) {
217 #define PARAM(p) ("GCB_95" "." p)
218
219 b.openHorizontalhideBox("");
220 b.create_master_slider(PARAM("hotpotz"), 0);
221 b.closeBox();
222 b.openHorizontalBox("");
223
224 b.create_small_rackknobr(PARAM("hotpotz"), 0);
225 b.closeBox();
226
227 #undef PARAM
228 return 0;
229 }
230 return -1;
231 }
232
233 int Dsp::load_ui_f_static(const UiBuilder& b, int form)
234 {
235 return static_cast<Dsp*>(b.plugin)->load_ui_f(b, form);
236 }
237 PluginDef *plugin() {
238 return new Dsp();
239 }
240
241 void Dsp::del_instance(PluginDef *p)
242 {
243 delete static_cast<Dsp*>(p);
244 }
245
246 } // end namespace gcb_95
247 } // end namespace pluginlib
99 class Dsp: public PluginDef {
1010 private:
1111 int fSamplingFreq;
12 FAUSTFLOAT fslider0;
1312 int iConst0;
1413 double fConst1;
14 FAUSTFLOAT fslider0;
1515 double fConst2;
1616 FAUSTFLOAT fslider1;
1717 double fConst3;
1818 FAUSTFLOAT fslider2;
19 double fVec0[2];
20 double fRec6[2];
21 double fRec5[3];
22 double fVec1[2];
23 double fRec4[2];
24 double fRec3[3];
2519 FAUSTFLOAT fslider3;
2620 FAUSTFLOAT fslider4;
27 double fRec2[2];
28 double fRec1[2];
21 double fVec0[2];
22 double fRec14[2];
23 double fRec13[3];
24 double fVec1[2];
25 double fRec12[2];
26 double fRec11[3];
27 double fVec2[2];
28 double fRec10[2];
29 double fRec9[3];
30 double fVec3[2];
31 double fRec8[2];
32 double fRec7[3];
2933 FAUSTFLOAT fslider5;
3034 FAUSTFLOAT fslider6;
35 double fRec6[2];
36 double fRec5[2];
37 FAUSTFLOAT fslider7;
38 FAUSTFLOAT fslider8;
39 double fRec4[2];
40 FAUSTFLOAT fslider9;
41 double fRec15[2];
3142 double fRec0[2];
32 FAUSTFLOAT fslider7;
33 double fRec7[2];
34 FAUSTFLOAT fslider8;
35 double fRec12[2];
36 double fRec11[3];
37 FAUSTFLOAT fslider9;
43 int iRec1[2];
44 double fRec2[2];
45 FAUSTFLOAT fbargraph0;
3846 FAUSTFLOAT fslider10;
39 double fRec10[2];
40 double fRec9[2];
47 double fRec24[2];
48 double fRec23[3];
4149 FAUSTFLOAT fslider11;
4250 FAUSTFLOAT fslider12;
43 double fRec8[2];
51 double fRec22[2];
52 double fRec21[2];
4453 FAUSTFLOAT fslider13;
45 double fRec13[2];
4654 FAUSTFLOAT fslider14;
55 double fRec20[2];
4756 FAUSTFLOAT fslider15;
48 double fRec20[2];
49 double fRec19[3];
50 double fVec2[2];
57 double fRec25[2];
58 double fRec16[2];
59 int iRec17[2];
5160 double fRec18[2];
52 double fRec17[3];
61 FAUSTFLOAT fbargraph1;
5362 FAUSTFLOAT fslider16;
63 double fRec35[2];
64 double fRec34[3];
65 double fRec33[3];
5466 FAUSTFLOAT fslider17;
55 double fRec16[2];
56 double fRec15[2];
5767 FAUSTFLOAT fslider18;
68 double fRec32[2];
69 double fRec31[2];
5870 FAUSTFLOAT fslider19;
59 double fRec14[2];
6071 FAUSTFLOAT fslider20;
61 double fRec21[2];
72 double fRec30[2];
6273 FAUSTFLOAT fslider21;
74 double fRec36[2];
75 double fRec26[2];
76 int iRec27[2];
77 double fRec28[2];
78 FAUSTFLOAT fbargraph2;
6379 FAUSTFLOAT fslider22;
64 double fRec28[2];
65 double fRec27[3];
66 double fVec3[2];
67 double fRec26[2];
68 double fRec25[3];
80 double fRec47[2];
81 double fRec46[3];
82 double fRec45[3];
83 double fRec44[3];
6984 FAUSTFLOAT fslider23;
7085 FAUSTFLOAT fslider24;
71 double fRec24[2];
72 double fRec23[2];
86 double fRec43[2];
87 double fRec42[2];
7388 FAUSTFLOAT fslider25;
7489 FAUSTFLOAT fslider26;
75 double fRec22[2];
90 double fRec41[2];
7691 FAUSTFLOAT fslider27;
77 double fRec29[2];
92 double fRec48[2];
93 double fRec37[2];
94 int iRec38[2];
95 double fRec39[2];
96 FAUSTFLOAT fbargraph3;
7897 FAUSTFLOAT fslider28;
79 double fRec34[2];
80 double fRec33[3];
98 double fRec60[2];
99 double fRec59[3];
100 double fRec58[3];
101 double fRec57[3];
102 double fRec56[3];
81103 FAUSTFLOAT fslider29;
82104 FAUSTFLOAT fslider30;
83 double fRec32[2];
84 double fRec31[2];
105 double fRec55[2];
106 double fRec54[2];
85107 FAUSTFLOAT fslider31;
86108 FAUSTFLOAT fslider32;
87 double fRec30[2];
109 double fRec53[2];
88110 FAUSTFLOAT fslider33;
89 double fRec35[2];
111 double fRec61[2];
112 double fRec49[2];
113 int iRec50[2];
114 double fRec51[2];
115 FAUSTFLOAT fbargraph4;
90116 void clear_state_f();
91117 int load_ui_f(const UiBuilder& b, int form);
92118 void init(unsigned int samplingFreq);
93 void compute(int count, float *input0, float *output0);
119 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
94120 int register_par(const ParamReg& reg);
95121
96122 static void clear_state_f_static(PluginDef*);
97123 static int load_ui_f_static(const UiBuilder& b, int form);
98124 static void init_static(unsigned int samplingFreq, PluginDef*);
99 static void compute_static(int count, float *input0, float *output0, PluginDef*);
125 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
100126 static int register_params_static(const ParamReg& reg);
101127 static void del_instance(PluginDef *p);
102128 public:
132158 inline void Dsp::clear_state_f()
133159 {
134160 for (int i=0; i<2; i++) fVec0[i] = 0;
135 for (int i=0; i<2; i++) fRec6[i] = 0;
136 for (int i=0; i<3; i++) fRec5[i] = 0;
161 for (int i=0; i<2; i++) fRec14[i] = 0;
162 for (int i=0; i<3; i++) fRec13[i] = 0;
137163 for (int i=0; i<2; i++) fVec1[i] = 0;
138 for (int i=0; i<2; i++) fRec4[i] = 0;
139 for (int i=0; i<3; i++) fRec3[i] = 0;
140 for (int i=0; i<2; i++) fRec2[i] = 0;
141 for (int i=0; i<2; i++) fRec1[i] = 0;
142 for (int i=0; i<2; i++) fRec0[i] = 0;
143 for (int i=0; i<2; i++) fRec7[i] = 0;
144164 for (int i=0; i<2; i++) fRec12[i] = 0;
145165 for (int i=0; i<3; i++) fRec11[i] = 0;
166 for (int i=0; i<2; i++) fVec2[i] = 0;
146167 for (int i=0; i<2; i++) fRec10[i] = 0;
147 for (int i=0; i<2; i++) fRec9[i] = 0;
168 for (int i=0; i<3; i++) fRec9[i] = 0;
169 for (int i=0; i<2; i++) fVec3[i] = 0;
148170 for (int i=0; i<2; i++) fRec8[i] = 0;
149 for (int i=0; i<2; i++) fRec13[i] = 0;
171 for (int i=0; i<3; i++) fRec7[i] = 0;
172 for (int i=0; i<2; i++) fRec6[i] = 0;
173 for (int i=0; i<2; i++) fRec5[i] = 0;
174 for (int i=0; i<2; i++) fRec4[i] = 0;
175 for (int i=0; i<2; i++) fRec15[i] = 0;
176 for (int i=0; i<2; i++) fRec0[i] = 0;
177 for (int i=0; i<2; i++) iRec1[i] = 0;
178 for (int i=0; i<2; i++) fRec2[i] = 0;
179 for (int i=0; i<2; i++) fRec24[i] = 0;
180 for (int i=0; i<3; i++) fRec23[i] = 0;
181 for (int i=0; i<2; i++) fRec22[i] = 0;
182 for (int i=0; i<2; i++) fRec21[i] = 0;
150183 for (int i=0; i<2; i++) fRec20[i] = 0;
151 for (int i=0; i<3; i++) fRec19[i] = 0;
152 for (int i=0; i<2; i++) fVec2[i] = 0;
184 for (int i=0; i<2; i++) fRec25[i] = 0;
185 for (int i=0; i<2; i++) fRec16[i] = 0;
186 for (int i=0; i<2; i++) iRec17[i] = 0;
153187 for (int i=0; i<2; i++) fRec18[i] = 0;
154 for (int i=0; i<3; i++) fRec17[i] = 0;
155 for (int i=0; i<2; i++) fRec16[i] = 0;
156 for (int i=0; i<2; i++) fRec15[i] = 0;
157 for (int i=0; i<2; i++) fRec14[i] = 0;
158 for (int i=0; i<2; i++) fRec21[i] = 0;
159 for (int i=0; i<2; i++) fRec28[i] = 0;
160 for (int i=0; i<3; i++) fRec27[i] = 0;
161 for (int i=0; i<2; i++) fVec3[i] = 0;
162 for (int i=0; i<2; i++) fRec26[i] = 0;
163 for (int i=0; i<3; i++) fRec25[i] = 0;
164 for (int i=0; i<2; i++) fRec24[i] = 0;
165 for (int i=0; i<2; i++) fRec23[i] = 0;
166 for (int i=0; i<2; i++) fRec22[i] = 0;
167 for (int i=0; i<2; i++) fRec29[i] = 0;
168 for (int i=0; i<2; i++) fRec34[i] = 0;
188 for (int i=0; i<2; i++) fRec35[i] = 0;
189 for (int i=0; i<3; i++) fRec34[i] = 0;
169190 for (int i=0; i<3; i++) fRec33[i] = 0;
170191 for (int i=0; i<2; i++) fRec32[i] = 0;
171192 for (int i=0; i<2; i++) fRec31[i] = 0;
172193 for (int i=0; i<2; i++) fRec30[i] = 0;
173 for (int i=0; i<2; i++) fRec35[i] = 0;
194 for (int i=0; i<2; i++) fRec36[i] = 0;
195 for (int i=0; i<2; i++) fRec26[i] = 0;
196 for (int i=0; i<2; i++) iRec27[i] = 0;
197 for (int i=0; i<2; i++) fRec28[i] = 0;
198 for (int i=0; i<2; i++) fRec47[i] = 0;
199 for (int i=0; i<3; i++) fRec46[i] = 0;
200 for (int i=0; i<3; i++) fRec45[i] = 0;
201 for (int i=0; i<3; i++) fRec44[i] = 0;
202 for (int i=0; i<2; i++) fRec43[i] = 0;
203 for (int i=0; i<2; i++) fRec42[i] = 0;
204 for (int i=0; i<2; i++) fRec41[i] = 0;
205 for (int i=0; i<2; i++) fRec48[i] = 0;
206 for (int i=0; i<2; i++) fRec37[i] = 0;
207 for (int i=0; i<2; i++) iRec38[i] = 0;
208 for (int i=0; i<2; i++) fRec39[i] = 0;
209 for (int i=0; i<2; i++) fRec60[i] = 0;
210 for (int i=0; i<3; i++) fRec59[i] = 0;
211 for (int i=0; i<3; i++) fRec58[i] = 0;
212 for (int i=0; i<3; i++) fRec57[i] = 0;
213 for (int i=0; i<3; i++) fRec56[i] = 0;
214 for (int i=0; i<2; i++) fRec55[i] = 0;
215 for (int i=0; i<2; i++) fRec54[i] = 0;
216 for (int i=0; i<2; i++) fRec53[i] = 0;
217 for (int i=0; i<2; i++) fRec61[i] = 0;
218 for (int i=0; i<2; i++) fRec49[i] = 0;
219 for (int i=0; i<2; i++) iRec50[i] = 0;
220 for (int i=0; i<2; i++) fRec51[i] = 0;
174221 }
175222
176223 void Dsp::clear_state_f_static(PluginDef *p)
182229 {
183230 fSamplingFreq = samplingFreq;
184231 iConst0 = min(192000, max(1, fSamplingFreq));
185 fConst1 = (2.0 / double(iConst0));
186 fConst2 = (1.0 / double(iConst0));
232 fConst1 = (1.0 / double(iConst0));
233 fConst2 = (2.0 / double(iConst0));
187234 fConst3 = (3.141592653589793 / double(iConst0));
188235 clear_state_f();
189236 }
193240 static_cast<Dsp*>(p)->init(samplingFreq);
194241 }
195242
196 void always_inline Dsp::compute(int count, float *input0, float *output0)
243 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
197244 {
198245 double fSlow0 = fslider0;
199 double fSlow1 = exp((0 - (fConst1 / fSlow0)));
200 double fSlow2 = exp((0 - (fConst2 / fSlow0)));
246 double fSlow1 = exp((0 - (fConst2 / fSlow0)));
247 double fSlow2 = exp((0 - (fConst1 / fSlow0)));
201248 double fSlow3 = tan((fConst3 * fslider1));
202249 double fSlow4 = (1.0 / faustpower<2>(fSlow3));
203250 double fSlow5 = (2 * (1 - fSlow4));
204251 double fSlow6 = (1.0 / fSlow3);
205252 double fSlow7 = (1 + ((fSlow6 - 1.0000000000000004) / fSlow3));
206 double fSlow8 = (1 + ((1.0000000000000004 + fSlow6) / fSlow3));
207 double fSlow9 = (1.0 / fSlow8);
208 double fSlow10 = (1 + fSlow6);
209 double fSlow11 = (0 - ((1 - fSlow6) / fSlow10));
210 double fSlow12 = tan((fConst3 * fslider2));
211 double fSlow13 = (1.0 / faustpower<2>(fSlow12));
212 double fSlow14 = (2 * (1 - fSlow13));
213 double fSlow15 = (1.0 / fSlow12);
214 double fSlow16 = (1 + ((fSlow15 - 1.0000000000000004) / fSlow12));
215 double fSlow17 = (1 + ((1.0000000000000004 + fSlow15) / fSlow12));
216 double fSlow18 = (1.0 / fSlow17);
217 double fSlow19 = (1 + fSlow15);
218 double fSlow20 = (0 - ((1 - fSlow15) / fSlow19));
219 double fSlow21 = (1.0 / fSlow19);
220 double fSlow22 = (1.0 / (fSlow17 * fSlow3));
221 double fSlow23 = (0 - fSlow6);
222 double fSlow24 = (1.0 / fSlow10);
223 double fSlow25 = (2 * (0 - fSlow4));
224 double fSlow26 = fslider3;
225 double fSlow27 = max((double)0, (fSlow26 - 1));
226 int iSlow28 = int(fSlow27);
227 double fSlow29 = exp((0 - (fConst2 / fslider4)));
228 double fSlow30 = (1.0 - fSlow29);
229 double fSlow31 = (1.0 - fSlow2);
230 double fSlow32 = fslider5;
231 double fSlow33 = (((1.0 / double(fslider6)) - 1.0) * (1.0 - fSlow1));
232 double fSlow34 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow32 - fslider7) * fabs((fSlow27 - 1))))));
233 double fSlow35 = fabs((max((double)0, (fSlow26 - 2)) - 1));
234 double fSlow36 = fslider8;
235 double fSlow37 = exp((0 - (fConst1 / fSlow36)));
236 double fSlow38 = exp((0 - (fConst2 / fSlow36)));
237 double fSlow39 = (0 - fSlow15);
238 double fSlow40 = (2 * (0 - fSlow13));
239 double fSlow41 = fslider9;
240 double fSlow42 = max((double)0, (fSlow41 - 1));
241 int iSlow43 = int(fSlow42);
242 double fSlow44 = exp((0 - (fConst2 / fslider10)));
243 double fSlow45 = (1.0 - fSlow44);
244 double fSlow46 = (1.0 - fSlow38);
245 double fSlow47 = fslider11;
246 double fSlow48 = (((1.0 / double(fslider12)) - 1.0) * (1.0 - fSlow37));
247 double fSlow49 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow47 - fslider13) * fabs((fSlow42 - 1))))));
248 double fSlow50 = fabs((max((double)0, (fSlow41 - 2)) - 1));
249 double fSlow51 = fslider14;
250 double fSlow52 = exp((0 - (fConst1 / fSlow51)));
251 double fSlow53 = exp((0 - (fConst2 / fSlow51)));
252 double fSlow54 = tan((fConst3 * fslider15));
253 double fSlow55 = (1.0 / faustpower<2>(fSlow54));
254 double fSlow56 = (2 * (1 - fSlow55));
255 double fSlow57 = (1.0 / fSlow54);
256 double fSlow58 = (1 + ((fSlow57 - 1.0000000000000004) / fSlow54));
257 double fSlow59 = (1 + ((1.0000000000000004 + fSlow57) / fSlow54));
258 double fSlow60 = (1.0 / fSlow59);
259 double fSlow61 = (1 + fSlow57);
260 double fSlow62 = (0 - ((1 - fSlow57) / fSlow61));
261 double fSlow63 = (1.0 / (fSlow8 * fSlow54));
262 double fSlow64 = (0 - fSlow57);
263 double fSlow65 = (1.0 / fSlow61);
264 double fSlow66 = (2 * (0 - fSlow55));
265 double fSlow67 = fslider16;
266 double fSlow68 = max((double)0, (fSlow67 - 1));
267 int iSlow69 = int(fSlow68);
268 double fSlow70 = exp((0 - (fConst2 / fslider17)));
269 double fSlow71 = (1.0 - fSlow70);
270 double fSlow72 = (1.0 - fSlow53);
271 double fSlow73 = fslider18;
272 double fSlow74 = (((1.0 / double(fslider19)) - 1.0) * (1.0 - fSlow52));
273 double fSlow75 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow73 - fslider20) * fabs((fSlow68 - 1))))));
274 double fSlow76 = fabs((max((double)0, (fSlow67 - 2)) - 1));
275 double fSlow77 = fslider21;
276 double fSlow78 = exp((0 - (fConst1 / fSlow77)));
277 double fSlow79 = exp((0 - (fConst2 / fSlow77)));
278 double fSlow80 = tan((fConst3 * fslider22));
279 double fSlow81 = (1.0 / faustpower<2>(fSlow80));
280 double fSlow82 = (2 * (1 - fSlow81));
281 double fSlow83 = (1.0 / fSlow80);
282 double fSlow84 = (1 + ((fSlow83 - 1.0000000000000004) / fSlow80));
283 double fSlow85 = (1.0 / (1 + ((1.0000000000000004 + fSlow83) / fSlow80)));
284 double fSlow86 = (1 + fSlow83);
285 double fSlow87 = (0 - ((1 - fSlow83) / fSlow86));
286 double fSlow88 = (1.0 / (fSlow59 * fSlow80));
287 double fSlow89 = (0 - fSlow83);
288 double fSlow90 = (1.0 / fSlow86);
289 double fSlow91 = (2 * (0 - fSlow81));
290 double fSlow92 = fslider23;
291 double fSlow93 = max((double)0, (fSlow92 - 1));
292 int iSlow94 = int(fSlow93);
293 double fSlow95 = exp((0 - (fConst2 / fslider24)));
294 double fSlow96 = (1.0 - fSlow95);
295 double fSlow97 = (1.0 - fSlow79);
296 double fSlow98 = fslider25;
297 double fSlow99 = (((1.0 / double(fslider26)) - 1.0) * (1.0 - fSlow78));
298 double fSlow100 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow98 - fslider27) * fabs((fSlow93 - 1))))));
299 double fSlow101 = fabs((max((double)0, (fSlow92 - 2)) - 1));
300 double fSlow102 = fslider28;
301 double fSlow103 = exp((0 - (fConst1 / fSlow102)));
302 double fSlow104 = exp((0 - (fConst2 / fSlow102)));
303 double fSlow105 = fslider29;
304 double fSlow106 = max((double)0, (fSlow105 - 1));
305 int iSlow107 = int(fSlow106);
306 double fSlow108 = exp((0 - (fConst2 / fslider30)));
307 double fSlow109 = (1.0 - fSlow108);
308 double fSlow110 = (1.0 - fSlow104);
309 double fSlow111 = fslider31;
310 double fSlow112 = (((1.0 / double(fslider32)) - 1.0) * (1.0 - fSlow103));
311 double fSlow113 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow111 - fslider33) * fabs((fSlow106 - 1))))));
312 double fSlow114 = fabs((max((double)0, (fSlow105 - 2)) - 1));
253 double fSlow8 = (1.0 / (1 + ((fSlow6 + 1.0000000000000004) / fSlow3)));
254 double fSlow9 = (1 + fSlow6);
255 double fSlow10 = (0 - ((1 - fSlow6) / fSlow9));
256 double fSlow11 = tan((fConst3 * fslider2));
257 double fSlow12 = (1.0 / faustpower<2>(fSlow11));
258 double fSlow13 = (2 * (1 - fSlow12));
259 double fSlow14 = (1.0 / fSlow11);
260 double fSlow15 = (1 + ((fSlow14 - 1.0000000000000004) / fSlow11));
261 double fSlow16 = (1 + ((fSlow14 + 1.0000000000000004) / fSlow11));
262 double fSlow17 = (1.0 / fSlow16);
263 double fSlow18 = (1 + fSlow14);
264 double fSlow19 = (0 - ((1 - fSlow14) / fSlow18));
265 double fSlow20 = tan((fConst3 * fslider3));
266 double fSlow21 = (1.0 / faustpower<2>(fSlow20));
267 double fSlow22 = (2 * (1 - fSlow21));
268 double fSlow23 = (1.0 / fSlow20);
269 double fSlow24 = (1 + ((fSlow23 - 1.0000000000000004) / fSlow20));
270 double fSlow25 = (1 + ((fSlow23 + 1.0000000000000004) / fSlow20));
271 double fSlow26 = (1.0 / fSlow25);
272 double fSlow27 = (1 + fSlow23);
273 double fSlow28 = (0 - ((1 - fSlow23) / fSlow27));
274 double fSlow29 = tan((fConst3 * fslider4));
275 double fSlow30 = (1.0 / faustpower<2>(fSlow29));
276 double fSlow31 = (2 * (1 - fSlow30));
277 double fSlow32 = (1.0 / fSlow29);
278 double fSlow33 = (1 + ((fSlow32 - 1.0000000000000004) / fSlow29));
279 double fSlow34 = (1 + ((1.0000000000000004 + fSlow32) / fSlow29));
280 double fSlow35 = (1.0 / fSlow34);
281 double fSlow36 = (1 + fSlow32);
282 double fSlow37 = (0 - ((1 - fSlow32) / fSlow36));
283 double fSlow38 = (1.0 / fSlow36);
284 double fSlow39 = (1.0 / fSlow27);
285 double fSlow40 = (1.0 / fSlow18);
286 double fSlow41 = (1.0 / (fSlow3 * fSlow16));
287 double fSlow42 = (0 - fSlow6);
288 double fSlow43 = (1.0 / fSlow9);
289 double fSlow44 = (2 * (0 - fSlow4));
290 double fSlow45 = fslider5;
291 double fSlow46 = max((double)0, (fSlow45 - 1));
292 int iSlow47 = int(fSlow46);
293 double fSlow48 = exp((0 - (fConst1 / fslider6)));
294 double fSlow49 = (1.0 - fSlow48);
295 double fSlow50 = (1.0 - fSlow2);
296 double fSlow51 = fslider7;
297 double fSlow52 = (((1.0 / double(fslider8)) - 1.0) * (1.0 - fSlow1));
298 double fSlow53 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow51 - fslider9) * fabs((fSlow46 - 1))))));
299 double fSlow54 = fabs((max((double)0, (fSlow45 - 2)) - 1));
300 double fSlow55 = fslider10;
301 double fSlow56 = exp((0 - (fConst2 / fSlow55)));
302 double fSlow57 = exp((0 - (fConst1 / fSlow55)));
303 double fSlow58 = fslider11;
304 double fSlow59 = max((double)0, (fSlow58 - 1));
305 int iSlow60 = int(fSlow59);
306 double fSlow61 = exp((0 - (fConst1 / fslider12)));
307 double fSlow62 = (1.0 - fSlow61);
308 double fSlow63 = (1.0 - fSlow57);
309 double fSlow64 = fslider13;
310 double fSlow65 = (((1.0 / double(fslider14)) - 1.0) * (1.0 - fSlow56));
311 double fSlow66 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow64 - fslider15) * fabs((fSlow59 - 1))))));
312 double fSlow67 = fabs((max((double)0, (fSlow58 - 2)) - 1));
313 double fSlow68 = fslider16;
314 double fSlow69 = exp((0 - (fConst2 / fSlow68)));
315 double fSlow70 = exp((0 - (fConst1 / fSlow68)));
316 double fSlow71 = (1 + ((fSlow6 - 1.0) / fSlow3));
317 double fSlow72 = (1.0 / (1 + ((1.0 + fSlow6) / fSlow3)));
318 double fSlow73 = (1.0 / (fSlow11 * fSlow25));
319 double fSlow74 = (0 - fSlow14);
320 double fSlow75 = (2 * (0 - fSlow12));
321 double fSlow76 = fslider17;
322 double fSlow77 = max((double)0, (fSlow76 - 1));
323 int iSlow78 = int(fSlow77);
324 double fSlow79 = exp((0 - (fConst1 / fslider18)));
325 double fSlow80 = (1.0 - fSlow79);
326 double fSlow81 = (1.0 - fSlow70);
327 double fSlow82 = fslider19;
328 double fSlow83 = (((1.0 / double(fslider20)) - 1.0) * (1.0 - fSlow69));
329 double fSlow84 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow82 - fslider21) * fabs((fSlow77 - 1))))));
330 double fSlow85 = fabs((max((double)0, (fSlow76 - 2)) - 1));
331 double fSlow86 = fslider22;
332 double fSlow87 = exp((0 - (fConst2 / fSlow86)));
333 double fSlow88 = exp((0 - (fConst1 / fSlow86)));
334 double fSlow89 = (1 + ((fSlow14 - 1.0) / fSlow11));
335 double fSlow90 = (1.0 / (1 + ((1.0 + fSlow14) / fSlow11)));
336 double fSlow91 = (1.0 / (fSlow20 * fSlow34));
337 double fSlow92 = (0 - fSlow23);
338 double fSlow93 = (2 * (0 - fSlow21));
339 double fSlow94 = fslider23;
340 double fSlow95 = max((double)0, (fSlow94 - 1));
341 int iSlow96 = int(fSlow95);
342 double fSlow97 = exp((0 - (fConst1 / fslider24)));
343 double fSlow98 = (1.0 - fSlow97);
344 double fSlow99 = (1.0 - fSlow88);
345 double fSlow100 = fslider25;
346 double fSlow101 = (((1.0 / double(fslider26)) - 1.0) * (1.0 - fSlow87));
347 double fSlow102 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow100 - fslider27) * fabs((fSlow95 - 1))))));
348 double fSlow103 = fabs((max((double)0, (fSlow94 - 2)) - 1));
349 double fSlow104 = fslider28;
350 double fSlow105 = exp((0 - (fConst2 / fSlow104)));
351 double fSlow106 = exp((0 - (fConst1 / fSlow104)));
352 double fSlow107 = (1 + ((fSlow23 - 1.0) / fSlow20));
353 double fSlow108 = (1.0 / (1 + ((1.0 + fSlow23) / fSlow20)));
354 double fSlow109 = (0 - fSlow32);
355 double fSlow110 = (2 * (0 - fSlow30));
356 double fSlow111 = fslider29;
357 double fSlow112 = max((double)0, (fSlow111 - 1));
358 int iSlow113 = int(fSlow112);
359 double fSlow114 = exp((0 - (fConst1 / fslider30)));
360 double fSlow115 = (1.0 - fSlow114);
361 double fSlow116 = (1.0 - fSlow106);
362 double fSlow117 = fslider31;
363 double fSlow118 = (((1.0 / double(fslider32)) - 1.0) * (1.0 - fSlow105));
364 double fSlow119 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow117 - fslider33) * fabs((fSlow112 - 1))))));
365 double fSlow120 = fabs((max((double)0, (fSlow111 - 2)) - 1));
313366 for (int i=0; i<count; i++) {
314367 double fTemp0 = (double)input0[i];
315368 fVec0[0] = fTemp0;
316 double fTemp1 = (fVec0[0] + fVec0[1]);
317 fRec6[0] = ((fSlow21 * fTemp1) + (fSlow20 * fRec6[1]));
318 fRec5[0] = (fRec6[0] - (fSlow18 * ((fSlow16 * fRec5[2]) + (fSlow14 * fRec5[1]))));
319 double fTemp2 = (fRec5[2] + (fRec5[0] + (2 * fRec5[1])));
320 fVec1[0] = (fSlow18 * fTemp2);
321 fRec4[0] = ((fSlow24 * ((fSlow23 * fVec1[1]) + (fSlow22 * fTemp2))) + (fSlow11 * fRec4[1]));
322 fRec3[0] = (fRec4[0] - (fSlow9 * ((fSlow7 * fRec3[2]) + (fSlow5 * fRec3[1]))));
323 double fTemp3 = (fSlow9 * (((fSlow4 * fRec3[0]) + (fSlow25 * fRec3[1])) + (fSlow4 * fRec3[2])));
324 double fTemp4 = ((iSlow28)?0:fTemp3);
325 double fTemp5 = fabs(fTemp4);
326 fRec2[0] = ((fSlow30 * fTemp5) + (fSlow29 * max(fTemp5, fRec2[1])));
327 fRec1[0] = ((fSlow31 * fRec2[0]) + (fSlow2 * fRec1[1]));
328 fRec0[0] = ((fSlow33 * max((fSlow32 + (20 * log10(fRec1[0]))), 0.0)) + (fSlow1 * fRec0[1]));
329 fRec7[0] = (fSlow34 + (0.999 * fRec7[1]));
330 fRec12[0] = ((fSlow21 * ((fSlow39 * fVec0[1]) + (fSlow15 * fVec0[0]))) + (fSlow20 * fRec12[1]));
331 fRec11[0] = (fRec12[0] - (fSlow18 * ((fSlow16 * fRec11[2]) + (fSlow14 * fRec11[1]))));
332 double fTemp6 = (fSlow18 * (((fSlow13 * fRec11[0]) + (fSlow40 * fRec11[1])) + (fSlow13 * fRec11[2])));
333 double fTemp7 = ((iSlow43)?0:fTemp6);
334 double fTemp8 = fabs(fTemp7);
335 fRec10[0] = ((fSlow45 * fTemp8) + (fSlow44 * max(fTemp8, fRec10[1])));
336 fRec9[0] = ((fSlow46 * fRec10[0]) + (fSlow38 * fRec9[1]));
337 fRec8[0] = ((fSlow48 * max((fSlow47 + (20 * log10(fRec9[0]))), 0.0)) + (fSlow37 * fRec8[1]));
338 fRec13[0] = (fSlow49 + (0.999 * fRec13[1]));
339 fRec20[0] = ((fSlow24 * fTemp1) + (fSlow11 * fRec20[1]));
340 fRec19[0] = (fRec20[0] - (fSlow9 * ((fSlow7 * fRec19[2]) + (fSlow5 * fRec19[1]))));
341 double fTemp9 = (fRec19[2] + (fRec19[0] + (2 * fRec19[1])));
342 fVec2[0] = (fSlow9 * fTemp9);
343 fRec18[0] = ((fSlow65 * ((fSlow64 * fVec2[1]) + (fSlow63 * fTemp9))) + (fSlow62 * fRec18[1]));
344 fRec17[0] = (fRec18[0] - (fSlow60 * ((fSlow58 * fRec17[2]) + (fSlow56 * fRec17[1]))));
345 double fTemp10 = (fSlow60 * (((fSlow55 * fRec17[0]) + (fSlow66 * fRec17[1])) + (fSlow55 * fRec17[2])));
346 double fTemp11 = ((iSlow69)?0:fTemp10);
347 double fTemp12 = fabs(fTemp11);
348 fRec16[0] = ((fSlow71 * fTemp12) + (fSlow70 * max(fTemp12, fRec16[1])));
349 fRec15[0] = ((fSlow72 * fRec16[0]) + (fSlow53 * fRec15[1]));
350 fRec14[0] = ((fSlow74 * max((fSlow73 + (20 * log10(fRec15[0]))), 0.0)) + (fSlow52 * fRec14[1]));
351 fRec21[0] = (fSlow75 + (0.999 * fRec21[1]));
352 fRec28[0] = ((fSlow65 * fTemp1) + (fSlow62 * fRec28[1]));
353 fRec27[0] = (fRec28[0] - (fSlow60 * ((fSlow58 * fRec27[2]) + (fSlow56 * fRec27[1]))));
354 double fTemp13 = (fRec27[2] + (fRec27[0] + (2 * fRec27[1])));
355 fVec3[0] = (fSlow60 * fTemp13);
356 fRec26[0] = ((fSlow90 * ((fSlow89 * fVec3[1]) + (fSlow88 * fTemp13))) + (fSlow87 * fRec26[1]));
357 fRec25[0] = (fRec26[0] - (fSlow85 * ((fSlow84 * fRec25[2]) + (fSlow82 * fRec25[1]))));
358 double fTemp14 = (fSlow85 * (((fSlow81 * fRec25[0]) + (fSlow91 * fRec25[1])) + (fSlow81 * fRec25[2])));
359 double fTemp15 = ((iSlow94)?0:fTemp14);
360 double fTemp16 = fabs(fTemp15);
361 fRec24[0] = ((fSlow96 * fTemp16) + (fSlow95 * max(fTemp16, fRec24[1])));
362 fRec23[0] = ((fSlow97 * fRec24[0]) + (fSlow79 * fRec23[1]));
363 fRec22[0] = ((fSlow99 * max((fSlow98 + (20 * log10(fRec23[0]))), 0.0)) + (fSlow78 * fRec22[1]));
364 fRec29[0] = (fSlow100 + (0.999 * fRec29[1]));
365 fRec34[0] = ((fSlow90 * fTemp1) + (fSlow87 * fRec34[1]));
366 fRec33[0] = (fRec34[0] - (fSlow85 * ((fSlow84 * fRec33[2]) + (fSlow82 * fRec33[1]))));
367 double fTemp17 = (fSlow85 * (fRec33[2] + (fRec33[0] + (2 * fRec33[1]))));
368 double fTemp18 = ((iSlow107)?0:fTemp17);
369 double fTemp19 = fabs(fTemp18);
370 fRec32[0] = ((fSlow109 * fTemp19) + (fSlow108 * max(fTemp19, fRec32[1])));
371 fRec31[0] = ((fSlow110 * fRec32[0]) + (fSlow104 * fRec31[1]));
372 fRec30[0] = ((fSlow112 * max((fSlow111 + (20 * log10(fRec31[0]))), 0.0)) + (fSlow103 * fRec30[1]));
373 fRec35[0] = (fSlow113 + (0.999 * fRec35[1]));
374 output0[i] = (FAUSTFLOAT)((fSlow114 * (fRec35[0] * ((iSlow107)?fTemp17:(fTemp18 * pow(10,(0.05 * fRec30[0])))))) + ((fSlow101 * (fRec29[0] * ((iSlow94)?fTemp14:(fTemp15 * pow(10,(0.05 * fRec22[0])))))) + ((fSlow76 * (fRec21[0] * ((iSlow69)?fTemp10:(fTemp11 * pow(10,(0.05 * fRec14[0])))))) + ((fSlow50 * (fRec13[0] * ((iSlow43)?fTemp6:(fTemp7 * pow(10,(0.05 * fRec8[0])))))) + (fSlow35 * (fRec7[0] * ((iSlow28)?fTemp3:(fTemp4 * pow(10,(0.05 * fRec0[0]))))))))));
369 fRec14[0] = ((fSlow38 * (fVec0[0] + fVec0[1])) + (fSlow37 * fRec14[1]));
370 fRec13[0] = (fRec14[0] - (fSlow35 * ((fSlow33 * fRec13[2]) + (fSlow31 * fRec13[1]))));
371 double fTemp1 = (fRec13[2] + (fRec13[0] + (2 * fRec13[1])));
372 double fTemp2 = (fSlow35 * fTemp1);
373 fVec1[0] = fTemp2;
374 fRec12[0] = ((fSlow39 * (fVec1[0] + fVec1[1])) + (fSlow28 * fRec12[1]));
375 fRec11[0] = (fRec12[0] - (fSlow26 * ((fSlow24 * fRec11[2]) + (fSlow22 * fRec11[1]))));
376 double fTemp3 = (fRec11[2] + (fRec11[0] + (2 * fRec11[1])));
377 double fTemp4 = (fSlow26 * fTemp3);
378 fVec2[0] = fTemp4;
379 fRec10[0] = ((fSlow40 * (fVec2[0] + fVec2[1])) + (fSlow19 * fRec10[1]));
380 fRec9[0] = (fRec10[0] - (fSlow17 * ((fSlow15 * fRec9[2]) + (fSlow13 * fRec9[1]))));
381 double fTemp5 = (fRec9[2] + (fRec9[0] + (2 * fRec9[1])));
382 double fTemp6 = (fSlow17 * fTemp5);
383 fVec3[0] = fTemp6;
384 fRec8[0] = ((fSlow43 * ((fSlow42 * fVec3[1]) + (fSlow41 * fTemp5))) + (fSlow10 * fRec8[1]));
385 fRec7[0] = (fRec8[0] - (fSlow8 * ((fSlow7 * fRec7[2]) + (fSlow5 * fRec7[1]))));
386 double fTemp7 = (fSlow8 * (((fSlow4 * fRec7[0]) + (fSlow44 * fRec7[1])) + (fSlow4 * fRec7[2])));
387 double fTemp8 = ((iSlow47)?0:fTemp7);
388 double fTemp9 = fabs(fTemp8);
389 fRec6[0] = ((fSlow49 * fTemp9) + (fSlow48 * max(fTemp9, fRec6[1])));
390 fRec5[0] = ((fSlow50 * fRec6[0]) + (fSlow2 * fRec5[1]));
391 fRec4[0] = ((fSlow52 * max((fSlow51 + (20 * log10(fRec5[0]))), 0.0)) + (fSlow1 * fRec4[1]));
392 fRec15[0] = (fSlow53 + (0.999 * fRec15[1]));
393 double fTemp10 = (fSlow54 * (fRec15[0] * ((iSlow47)?fTemp7:(fTemp8 * pow(10,(0.05 * fRec4[0]))))));
394 double fRec3 = max(fConst1, fabs(fTemp10));
395 int iTemp11 = int((iRec1[1] < 4096));
396 fRec0[0] = ((iTemp11)?max(fRec0[1], fRec3):fRec3);
397 iRec1[0] = ((iTemp11)?(1 + iRec1[1]):1);
398 fRec2[0] = ((iTemp11)?fRec2[1]:fRec0[1]);
399 fbargraph0 = fRec2[0];
400 fRec24[0] = ((fSlow43 * (fVec3[0] + fVec3[1])) + (fSlow10 * fRec24[1]));
401 fRec23[0] = (fRec24[0] - (fSlow8 * ((fSlow7 * fRec23[2]) + (fSlow5 * fRec23[1]))));
402 double fTemp12 = (fSlow8 * (fRec23[2] + (fRec23[0] + (2 * fRec23[1]))));
403 double fTemp13 = ((iSlow60)?0:fTemp12);
404 double fTemp14 = fabs(fTemp13);
405 fRec22[0] = ((fSlow62 * fTemp14) + (fSlow61 * max(fTemp14, fRec22[1])));
406 fRec21[0] = ((fSlow63 * fRec22[0]) + (fSlow57 * fRec21[1]));
407 fRec20[0] = ((fSlow65 * max((fSlow64 + (20 * log10(fRec21[0]))), 0.0)) + (fSlow56 * fRec20[1]));
408 fRec25[0] = (fSlow66 + (0.999 * fRec25[1]));
409 double fTemp15 = (fSlow67 * (fRec25[0] * ((iSlow60)?fTemp12:(fTemp13 * pow(10,(0.05 * fRec20[0]))))));
410 double fRec19 = max(fConst1, fabs(fTemp15));
411 int iTemp16 = int((iRec17[1] < 4096));
412 fRec16[0] = ((iTemp16)?max(fRec16[1], fRec19):fRec19);
413 iRec17[0] = ((iTemp16)?(1 + iRec17[1]):1);
414 fRec18[0] = ((iTemp16)?fRec18[1]:fRec16[1]);
415 fbargraph1 = fRec18[0];
416 double fTemp17 = (fSlow5 * fRec33[1]);
417 fRec35[0] = ((fSlow40 * ((fSlow74 * fVec2[1]) + (fSlow73 * fTemp3))) + (fSlow19 * fRec35[1]));
418 fRec34[0] = (fRec35[0] - (fSlow17 * ((fSlow15 * fRec34[2]) + (fSlow13 * fRec34[1]))));
419 fRec33[0] = ((fSlow17 * (((fSlow12 * fRec34[0]) + (fSlow75 * fRec34[1])) + (fSlow12 * fRec34[2]))) - (fSlow72 * ((fSlow71 * fRec33[2]) + fTemp17)));
420 double fTemp18 = (fRec33[2] + (fSlow72 * (fTemp17 + (fSlow71 * fRec33[0]))));
421 double fTemp19 = ((iSlow78)?0:fTemp18);
422 double fTemp20 = fabs(fTemp19);
423 fRec32[0] = ((fSlow80 * fTemp20) + (fSlow79 * max(fTemp20, fRec32[1])));
424 fRec31[0] = ((fSlow81 * fRec32[0]) + (fSlow70 * fRec31[1]));
425 fRec30[0] = ((fSlow83 * max((fSlow82 + (20 * log10(fRec31[0]))), 0.0)) + (fSlow69 * fRec30[1]));
426 fRec36[0] = (fSlow84 + (0.999 * fRec36[1]));
427 double fTemp21 = (fSlow85 * (fRec36[0] * ((iSlow78)?fTemp18:(fTemp19 * pow(10,(0.05 * fRec30[0]))))));
428 double fRec29 = max(fConst1, fabs(fTemp21));
429 int iTemp22 = int((iRec27[1] < 4096));
430 fRec26[0] = ((iTemp22)?max(fRec26[1], fRec29):fRec29);
431 iRec27[0] = ((iTemp22)?(1 + iRec27[1]):1);
432 fRec28[0] = ((iTemp22)?fRec28[1]:fRec26[1]);
433 fbargraph2 = fRec28[0];
434 double fTemp23 = (fSlow5 * fRec44[1]);
435 double fTemp24 = (fSlow13 * fRec45[1]);
436 fRec47[0] = ((fSlow39 * ((fSlow92 * fVec1[1]) + (fSlow91 * fTemp1))) + (fSlow28 * fRec47[1]));
437 fRec46[0] = (fRec47[0] - (fSlow26 * ((fSlow24 * fRec46[2]) + (fSlow22 * fRec46[1]))));
438 fRec45[0] = ((fSlow26 * (((fSlow21 * fRec46[0]) + (fSlow93 * fRec46[1])) + (fSlow21 * fRec46[2]))) - (fSlow90 * ((fSlow89 * fRec45[2]) + fTemp24)));
439 fRec44[0] = ((fRec45[2] + (fSlow90 * (fTemp24 + (fSlow89 * fRec45[0])))) - (fSlow72 * ((fSlow71 * fRec44[2]) + fTemp23)));
440 double fTemp25 = (fRec44[2] + (fSlow72 * (fTemp23 + (fSlow71 * fRec44[0]))));
441 double fTemp26 = ((iSlow96)?0:fTemp25);
442 double fTemp27 = fabs(fTemp26);
443 fRec43[0] = ((fSlow98 * fTemp27) + (fSlow97 * max(fTemp27, fRec43[1])));
444 fRec42[0] = ((fSlow99 * fRec43[0]) + (fSlow88 * fRec42[1]));
445 fRec41[0] = ((fSlow101 * max((fSlow100 + (20 * log10(fRec42[0]))), 0.0)) + (fSlow87 * fRec41[1]));
446 fRec48[0] = (fSlow102 + (0.999 * fRec48[1]));
447 double fTemp28 = (fSlow103 * (fRec48[0] * ((iSlow96)?fTemp25:(fTemp26 * pow(10,(0.05 * fRec41[0]))))));
448 double fRec40 = max(fConst1, fabs(fTemp28));
449 int iTemp29 = int((iRec38[1] < 4096));
450 fRec37[0] = ((iTemp29)?max(fRec37[1], fRec40):fRec40);
451 iRec38[0] = ((iTemp29)?(1 + iRec38[1]):1);
452 fRec39[0] = ((iTemp29)?fRec39[1]:fRec37[1]);
453 fbargraph3 = fRec39[0];
454 double fTemp30 = (fSlow5 * fRec56[1]);
455 double fTemp31 = (fSlow13 * fRec57[1]);
456 double fTemp32 = (fSlow22 * fRec58[1]);
457 fRec60[0] = ((fSlow38 * ((fSlow109 * fVec0[1]) + (fSlow32 * fVec0[0]))) + (fSlow37 * fRec60[1]));
458 fRec59[0] = (fRec60[0] - (fSlow35 * ((fSlow33 * fRec59[2]) + (fSlow31 * fRec59[1]))));
459 fRec58[0] = ((fSlow35 * (((fSlow30 * fRec59[0]) + (fSlow110 * fRec59[1])) + (fSlow30 * fRec59[2]))) - (fSlow108 * ((fSlow107 * fRec58[2]) + fTemp32)));
460 fRec57[0] = ((fRec58[2] + (fSlow108 * (fTemp32 + (fSlow107 * fRec58[0])))) - (fSlow90 * ((fSlow89 * fRec57[2]) + fTemp31)));
461 fRec56[0] = ((fRec57[2] + (fSlow90 * (fTemp31 + (fSlow89 * fRec57[0])))) - (fSlow72 * ((fSlow71 * fRec56[2]) + fTemp30)));
462 double fTemp33 = (fRec56[2] + (fSlow72 * (fTemp30 + (fSlow71 * fRec56[0]))));
463 double fTemp34 = ((iSlow113)?0:fTemp33);
464 double fTemp35 = fabs(fTemp34);
465 fRec55[0] = ((fSlow115 * fTemp35) + (fSlow114 * max(fTemp35, fRec55[1])));
466 fRec54[0] = ((fSlow116 * fRec55[0]) + (fSlow106 * fRec54[1]));
467 fRec53[0] = ((fSlow118 * max((fSlow117 + (20 * log10(fRec54[0]))), 0.0)) + (fSlow105 * fRec53[1]));
468 fRec61[0] = (fSlow119 + (0.999 * fRec61[1]));
469 double fTemp36 = (fSlow120 * (fRec61[0] * ((iSlow113)?fTemp33:(fTemp34 * pow(10,(0.05 * fRec53[0]))))));
470 double fRec52 = max(fConst1, fabs(fTemp36));
471 int iTemp37 = int((iRec50[1] < 4096));
472 fRec49[0] = ((iTemp37)?max(fRec49[1], fRec52):fRec52);
473 iRec50[0] = ((iTemp37)?(1 + iRec50[1]):1);
474 fRec51[0] = ((iTemp37)?fRec51[1]:fRec49[1]);
475 fbargraph4 = fRec51[0];
476 output0[i] = (FAUSTFLOAT)(fTemp36 + (fTemp28 + (fTemp21 + (fTemp15 + fTemp10))));
375477 // post processing
376 fRec35[1] = fRec35[0];
478 fRec51[1] = fRec51[0];
479 iRec50[1] = iRec50[0];
480 fRec49[1] = fRec49[0];
481 fRec61[1] = fRec61[0];
482 fRec53[1] = fRec53[0];
483 fRec54[1] = fRec54[0];
484 fRec55[1] = fRec55[0];
485 fRec56[2] = fRec56[1]; fRec56[1] = fRec56[0];
486 fRec57[2] = fRec57[1]; fRec57[1] = fRec57[0];
487 fRec58[2] = fRec58[1]; fRec58[1] = fRec58[0];
488 fRec59[2] = fRec59[1]; fRec59[1] = fRec59[0];
489 fRec60[1] = fRec60[0];
490 fRec39[1] = fRec39[0];
491 iRec38[1] = iRec38[0];
492 fRec37[1] = fRec37[0];
493 fRec48[1] = fRec48[0];
494 fRec41[1] = fRec41[0];
495 fRec42[1] = fRec42[0];
496 fRec43[1] = fRec43[0];
497 fRec44[2] = fRec44[1]; fRec44[1] = fRec44[0];
498 fRec45[2] = fRec45[1]; fRec45[1] = fRec45[0];
499 fRec46[2] = fRec46[1]; fRec46[1] = fRec46[0];
500 fRec47[1] = fRec47[0];
501 fRec28[1] = fRec28[0];
502 iRec27[1] = iRec27[0];
503 fRec26[1] = fRec26[0];
504 fRec36[1] = fRec36[0];
377505 fRec30[1] = fRec30[0];
378506 fRec31[1] = fRec31[0];
379507 fRec32[1] = fRec32[0];
380508 fRec33[2] = fRec33[1]; fRec33[1] = fRec33[0];
381 fRec34[1] = fRec34[0];
382 fRec29[1] = fRec29[0];
509 fRec34[2] = fRec34[1]; fRec34[1] = fRec34[0];
510 fRec35[1] = fRec35[0];
511 fRec18[1] = fRec18[0];
512 iRec17[1] = iRec17[0];
513 fRec16[1] = fRec16[0];
514 fRec25[1] = fRec25[0];
515 fRec20[1] = fRec20[0];
516 fRec21[1] = fRec21[0];
383517 fRec22[1] = fRec22[0];
384 fRec23[1] = fRec23[0];
518 fRec23[2] = fRec23[1]; fRec23[1] = fRec23[0];
385519 fRec24[1] = fRec24[0];
386 fRec25[2] = fRec25[1]; fRec25[1] = fRec25[0];
387 fRec26[1] = fRec26[0];
520 fRec2[1] = fRec2[0];
521 iRec1[1] = iRec1[0];
522 fRec0[1] = fRec0[0];
523 fRec15[1] = fRec15[0];
524 fRec4[1] = fRec4[0];
525 fRec5[1] = fRec5[0];
526 fRec6[1] = fRec6[0];
527 fRec7[2] = fRec7[1]; fRec7[1] = fRec7[0];
528 fRec8[1] = fRec8[0];
388529 fVec3[1] = fVec3[0];
389 fRec27[2] = fRec27[1]; fRec27[1] = fRec27[0];
390 fRec28[1] = fRec28[0];
391 fRec21[1] = fRec21[0];
392 fRec14[1] = fRec14[0];
393 fRec15[1] = fRec15[0];
394 fRec16[1] = fRec16[0];
395 fRec17[2] = fRec17[1]; fRec17[1] = fRec17[0];
396 fRec18[1] = fRec18[0];
530 fRec9[2] = fRec9[1]; fRec9[1] = fRec9[0];
531 fRec10[1] = fRec10[0];
397532 fVec2[1] = fVec2[0];
398 fRec19[2] = fRec19[1]; fRec19[1] = fRec19[0];
399 fRec20[1] = fRec20[0];
400 fRec13[1] = fRec13[0];
401 fRec8[1] = fRec8[0];
402 fRec9[1] = fRec9[0];
403 fRec10[1] = fRec10[0];
404533 fRec11[2] = fRec11[1]; fRec11[1] = fRec11[0];
405534 fRec12[1] = fRec12[0];
406 fRec7[1] = fRec7[0];
407 fRec0[1] = fRec0[0];
408 fRec1[1] = fRec1[0];
409 fRec2[1] = fRec2[0];
410 fRec3[2] = fRec3[1]; fRec3[1] = fRec3[0];
411 fRec4[1] = fRec4[0];
412535 fVec1[1] = fVec1[0];
413 fRec5[2] = fRec5[1]; fRec5[1] = fRec5[0];
414 fRec6[1] = fRec6[0];
536 fRec13[2] = fRec13[1]; fRec13[1] = fRec13[0];
537 fRec14[1] = fRec14[0];
415538 fVec0[1] = fVec0[0];
416539 }
417540 }
418541
419 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
542 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
420543 {
421544 static_cast<Dsp*>(p)->compute(count, input0, output0);
422545 }
423546
424547 int Dsp::register_par(const ParamReg& reg)
425548 {
549 static const value_pair fslider11_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
550 reg.registerEnumVar("mbc.Mode1","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider11_values,&fslider11, 1.0, 1.0, 3.0, 1.0);
551 static const value_pair fslider5_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
552 reg.registerEnumVar("mbc.Mode2","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider5_values,&fslider5, 1.0, 1.0, 3.0, 1.0);
553 static const value_pair fslider17_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
554 reg.registerEnumVar("mbc.Mode3","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider17_values,&fslider17, 1.0, 1.0, 3.0, 1.0);
555 static const value_pair fslider23_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
556 reg.registerEnumVar("mbc.Mode4","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider23_values,&fslider23, 1.0, 1.0, 3.0, 1.0);
426557 static const value_pair fslider29_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
427 reg.registerEnumVar("mbc.Mode1","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider29_values,&fslider29, 1.0, 1.0, 3.0, 1.0);
428 static const value_pair fslider23_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
429 reg.registerEnumVar("mbc.Mode2","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider23_values,&fslider23, 1.0, 1.0, 3.0, 1.0);
430 static const value_pair fslider16_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
431 reg.registerEnumVar("mbc.Mode3","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider16_values,&fslider16, 1.0, 1.0, 3.0, 1.0);
432 static const value_pair fslider3_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
433 reg.registerEnumVar("mbc.Mode4","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider3_values,&fslider3, 1.0, 1.0, 3.0, 1.0);
434 static const value_pair fslider9_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
435 reg.registerEnumVar("mbc.Mode5","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider9_values,&fslider9, 1.0, 1.0, 3.0, 1.0);
436 reg.registerVar("mbc.Makeup1","","S",N_("Post amplification and threshold"),&fslider31, 13.0, -5e+01, 5e+01, 0.1);
437 reg.registerVar("mbc.Makeup2","","S",N_("Post amplification and threshold"),&fslider25, 1e+01, -5e+01, 5e+01, 0.1);
438 reg.registerVar("mbc.Makeup3","","S",N_("Post amplification and threshold"),&fslider18, 4.0, -5e+01, 5e+01, 0.1);
439 reg.registerVar("mbc.Makeup4","","S",N_("Post amplification and threshold"),&fslider5, 8.0, -5e+01, 5e+01, 0.1);
440 reg.registerVar("mbc.Makeup5","","S",N_("Post amplification and threshold"),&fslider11, 11.0, -5e+01, 5e+01, 0.1);
441 reg.registerVar("mbc.Makeup-Threshold1","","S",N_("Threshold correction, an anticlip measure"),&fslider33, 2.0, 0.0, 1e+01, 0.1);
442 reg.registerVar("mbc.Makeup-Threshold2","","S",N_("Threshold correction, an anticlip measure"),&fslider27, 2.0, 0.0, 1e+01, 0.1);
443 reg.registerVar("mbc.Makeup-Threshold3","","S",N_("Threshold correction, an anticlip measure"),&fslider20, 2.0, 0.0, 1e+01, 0.1);
444 reg.registerVar("mbc.Makeup-Threshold4","","S",N_("Threshold correction, an anticlip measure"),&fslider7, 2.0, 0.0, 1e+01, 0.1);
445 reg.registerVar("mbc.Makeup-Threshold5","","S",N_("Threshold correction, an anticlip measure"),&fslider13, 2.0, 0.0, 1e+01, 0.1);
446 reg.registerVar("mbc.Ratio1","","S",N_("Compression ratio"),&fslider32, 2.0, 1.0, 1e+02, 0.1);
447 reg.registerVar("mbc.Ratio2","","S",N_("Compression ratio"),&fslider26, 2.0, 1.0, 1e+02, 0.1);
448 reg.registerVar("mbc.Ratio3","","S",N_("Compression ratio"),&fslider19, 2.0, 1.0, 1e+02, 0.1);
449 reg.registerVar("mbc.Ratio4","","S",N_("Compression ratio"),&fslider6, 2.0, 1.0, 1e+02, 0.1);
450 reg.registerVar("mbc.Ratio5","","S",N_("Compression ratio"),&fslider12, 2.0, 1.0, 1e+02, 0.1);
451 reg.registerVar("mbc.Attack1","","S",N_("Time before the compressor starts to kick in"),&fslider28, 0.012, 0.0, 1.0, 0.001);
452 reg.registerVar("mbc.Attack2","","S",N_("Time before the compressor starts to kick in"),&fslider21, 0.012, 0.0, 1.0, 0.001);
453 reg.registerVar("mbc.Attack3","","S",N_("Time before the compressor starts to kick in"),&fslider14, 0.012, 0.0, 1.0, 0.001);
454 reg.registerVar("mbc.Attack4","","S",N_("Time before the compressor starts to kick in"),&fslider0, 0.012, 0.0, 1.0, 0.001);
455 reg.registerVar("mbc.Attack5","","S",N_("Time before the compressor starts to kick in"),&fslider8, 0.012, 0.0, 1.0, 0.001);
456 reg.registerVar("mbc.Release1","","S",N_("Time before the compressor releases the sound"),&fslider30, 1.25, 0.0, 1e+01, 0.01);
457 reg.registerVar("mbc.Release2","","S",N_("Time before the compressor releases the sound"),&fslider24, 1.25, 0.0, 1e+01, 0.01);
458 reg.registerVar("mbc.Release3","","S",N_("Time before the compressor releases the sound"),&fslider17, 1.25, 0.0, 1e+01, 0.01);
459 reg.registerVar("mbc.Release4","","S",N_("Time before the compressor releases the sound"),&fslider4, 1.25, 0.0, 1e+01, 0.01);
460 reg.registerVar("mbc.Release5","","S",N_("Time before the compressor releases the sound"),&fslider10, 1.25, 0.0, 1e+01, 0.01);
461 reg.registerVar("mbc.crossover_b1_b2",N_("Crossover B1-B2 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider22, 8e+01, 2e+01, 2e+04, 1.08);
462 reg.registerVar("mbc.crossover_b2_b3",N_("Crossover B2-B3 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider15, 2.1e+02, 2e+01, 2e+04, 1.08);
463 reg.registerVar("mbc.crossover_b3_b4",N_("Crossover B3-B4 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider1, 1.7e+03, 2e+01, 2e+04, 1.08);
464 reg.registerVar("mbc.crossover_b4_b5",N_("Crossover B4-B5 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider2, 5e+03, 2e+01, 2e+04, 1.08);
558 reg.registerEnumVar("mbc.Mode5","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider29_values,&fslider29, 1.0, 1.0, 3.0, 1.0);
559 reg.registerVar("mbc.Makeup1","","S",N_("Post amplification and threshold"),&fslider13, 13.0, -5e+01, 5e+01, 0.1);
560 reg.registerVar("mbc.Makeup2","","S",N_("Post amplification and threshold"),&fslider7, 1e+01, -5e+01, 5e+01, 0.1);
561 reg.registerVar("mbc.Makeup3","","S",N_("Post amplification and threshold"),&fslider19, 4.0, -5e+01, 5e+01, 0.1);
562 reg.registerVar("mbc.Makeup4","","S",N_("Post amplification and threshold"),&fslider25, 8.0, -5e+01, 5e+01, 0.1);
563 reg.registerVar("mbc.Makeup5","","S",N_("Post amplification and threshold"),&fslider31, 11.0, -5e+01, 5e+01, 0.1);
564 reg.registerVar("mbc.Makeup-Threshold1","","S",N_("Threshold correction, an anticlip measure"),&fslider15, 2.0, 0.0, 1e+01, 0.1);
565 reg.registerVar("mbc.Makeup-Threshold2","","S",N_("Threshold correction, an anticlip measure"),&fslider9, 2.0, 0.0, 1e+01, 0.1);
566 reg.registerVar("mbc.Makeup-Threshold3","","S",N_("Threshold correction, an anticlip measure"),&fslider21, 2.0, 0.0, 1e+01, 0.1);
567 reg.registerVar("mbc.Makeup-Threshold4","","S",N_("Threshold correction, an anticlip measure"),&fslider27, 2.0, 0.0, 1e+01, 0.1);
568 reg.registerVar("mbc.Makeup-Threshold5","","S",N_("Threshold correction, an anticlip measure"),&fslider33, 2.0, 0.0, 1e+01, 0.1);
569 reg.registerVar("mbc.Ratio1","","S",N_("Compression ratio"),&fslider14, 2.0, 1.0, 1e+02, 0.1);
570 reg.registerVar("mbc.Ratio2","","S",N_("Compression ratio"),&fslider8, 2.0, 1.0, 1e+02, 0.1);
571 reg.registerVar("mbc.Ratio3","","S",N_("Compression ratio"),&fslider20, 2.0, 1.0, 1e+02, 0.1);
572 reg.registerVar("mbc.Ratio4","","S",N_("Compression ratio"),&fslider26, 2.0, 1.0, 1e+02, 0.1);
573 reg.registerVar("mbc.Ratio5","","S",N_("Compression ratio"),&fslider32, 2.0, 1.0, 1e+02, 0.1);
574 reg.registerVar("mbc.Attack1","","S",N_("Time before the compressor starts to kick in"),&fslider10, 0.012, 0.001, 1.0, 0.001);
575 reg.registerVar("mbc.Attack2","","S",N_("Time before the compressor starts to kick in"),&fslider0, 0.012, 0.001, 1.0, 0.001);
576 reg.registerVar("mbc.Attack3","","S",N_("Time before the compressor starts to kick in"),&fslider16, 0.012, 0.001, 1.0, 0.001);
577 reg.registerVar("mbc.Attack4","","S",N_("Time before the compressor starts to kick in"),&fslider22, 0.012, 0.001, 1.0, 0.001);
578 reg.registerVar("mbc.Attack5","","S",N_("Time before the compressor starts to kick in"),&fslider28, 0.012, 0.001, 1.0, 0.001);
579 reg.registerVar("mbc.Release1","","S",N_("Time before the compressor releases the sound"),&fslider12, 1.25, 0.01, 1e+01, 0.01);
580 reg.registerVar("mbc.Release2","","S",N_("Time before the compressor releases the sound"),&fslider6, 1.25, 0.01, 1e+01, 0.01);
581 reg.registerVar("mbc.Release3","","S",N_("Time before the compressor releases the sound"),&fslider18, 1.25, 0.01, 1e+01, 0.01);
582 reg.registerVar("mbc.Release4","","S",N_("Time before the compressor releases the sound"),&fslider24, 1.25, 0.01, 1e+01, 0.01);
583 reg.registerVar("mbc.Release5","","S",N_("Time before the compressor releases the sound"),&fslider30, 1.25, 0.01, 1e+01, 0.01);
584 reg.registerVar("mbc.crossover_b1_b2",N_("Crossover B1-B2 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider1, 8e+01, 2e+01, 2e+04, 1.08);
585 reg.registerVar("mbc.crossover_b2_b3",N_("Crossover B2-B3 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider2, 2.1e+02, 2e+01, 2e+04, 1.08);
586 reg.registerVar("mbc.crossover_b3_b4",N_("Crossover B3-B4 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider3, 1.7e+03, 2e+01, 2e+04, 1.08);
587 reg.registerVar("mbc.crossover_b4_b5",N_("Crossover B4-B5 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider4, 5e+03, 2e+01, 2e+04, 1.08);
588 reg.registerNonMidiFloatVar("mbc.v1",&fbargraph1, false, true, -70.0, -70.0, 4.0, 0.00001);
589 reg.registerNonMidiFloatVar("mbc.v2",&fbargraph0, false, true, -70.0, -70.0, 4.0, 0.00001);
590 reg.registerNonMidiFloatVar("mbc.v3",&fbargraph2, false, true, -70.0, -70.0, 4.0, 0.00001);
591 reg.registerNonMidiFloatVar("mbc.v4",&fbargraph3, false, true, -70.0, -70.0, 4.0, 0.00001);
592 reg.registerNonMidiFloatVar("mbc.v5",&fbargraph4, false, true, -70.0, -70.0, 4.0, 0.00001);
465593 return 0;
466594 }
467595
484612 b.openTabBox("");
485613
486614 b.openHorizontalBox(N_("Band 1"));
615 b.openpaintampBox("");
487616 b.openVerticalBox("");
488617 b.openHorizontalBox("");
489618 b.set_next_flags(UI_NUM_RIGHT);
501630 b.closeBox();
502631 b.closeBox();
503632 b.closeBox();
633 b.closeBox();
504634
505635 b.openHorizontalBox(N_("Band 2"));
636 b.openpaintampBox("");
506637 b.openVerticalBox("");
507638 b.openHorizontalBox("");
508639 b.set_next_flags(UI_NUM_RIGHT);
522653 b.closeBox();
523654 b.closeBox();
524655 b.closeBox();
656 b.closeBox();
525657
526658 b.openHorizontalBox(N_("Band 3"));
659 b.openpaintampBox("");
527660 b.openVerticalBox("");
528661 b.openHorizontalBox("");
529662 b.set_next_flags(UI_NUM_RIGHT);
543676 b.closeBox();
544677 b.closeBox();
545678 b.closeBox();
679 b.closeBox();
546680
547681 b.openHorizontalBox(N_("Band 4"));
682 b.openpaintampBox("");
548683 b.openVerticalBox("");
549684 b.openHorizontalBox("");
550685 b.set_next_flags(UI_NUM_RIGHT);
565700 b.closeBox();
566701 b.closeBox();
567702 b.closeBox();
703 b.closeBox();
568704
569705 b.openHorizontalBox(N_("Band 5"));
706 b.openpaintampBox("");
570707 b.openVerticalBox("");
571708 b.openHorizontalBox("");
572709 b.set_next_flags(UI_NUM_RIGHT);
584721 b.closeBox();
585722 b.closeBox();
586723 b.closeBox();
587
588 b.closeBox();
724 b.closeBox();
725
726 b.closeBox();
727 b.closeBox();
728 b.openVerticalBox2("Analyze");
729 b.create_simple_meter(PARAM("v1"));
730 b.create_simple_meter(PARAM("v2"));
731 b.create_simple_meter(PARAM("v3"));
732 b.create_simple_meter(PARAM("v4"));
733 b.create_simple_meter(PARAM("v5"));
589734 b.closeBox();
590735 b.closeBox();
591736
0 // generated from file '../src/plugins/mbchor.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.58 (http://faust.grame.fr)
2
3 #include "gx_faust_support.h"
4 #include "gx_plugin.h"
5
6 namespace pluginlib {
7 namespace mbchor {
8
9 class Dsp: public PluginDef {
10 private:
11 int fSamplingFreq;
12 class SIG0 {
13 private:
14 int fSamplingFreq;
15 int iRec13[2];
16 public:
17 int getNumInputs() { return 0; }
18 int getNumOutputs() { return 1; }
19 void init(int samplingFreq) {
20 fSamplingFreq = samplingFreq;
21 for (int i=0; i<2; i++) iRec13[i] = 0;
22 }
23 void fill (int count, double output[]) {
24 for (int i=0; i<count; i++) {
25 iRec13[0] = (1 + iRec13[1]);
26 output[i] = sin((9.587379924285257e-05 * (iRec13[0] - 1)));
27 // post processing
28 iRec13[1] = iRec13[0];
29 }
30 }
31 };
32 int iConst0;
33 double fConst1;
34 FAUSTFLOAT fslider0;
35 double fConst2;
36 FAUSTFLOAT fslider1;
37 FAUSTFLOAT fslider2;
38 FAUSTFLOAT fslider3;
39 double fVec0[2];
40 double fRec11[2];
41 double fRec10[3];
42 double fVec1[2];
43 double fRec9[2];
44 double fRec8[3];
45 double fVec2[2];
46 double fRec7[2];
47 double fRec6[3];
48 double fVec3[2];
49 double fRec5[2];
50 double fRec4[3];
51 int IOTA;
52 double fVec4[65536];
53 FAUSTFLOAT fslider4;
54 double fConst3;
55 double fRec12[2];
56 static double ftbl0[65536];
57 FAUSTFLOAT fslider5;
58 FAUSTFLOAT fslider6;
59 double fRec14[2];
60 double fConst4;
61 FAUSTFLOAT fslider7;
62 double fRec0[2];
63 int iRec1[2];
64 double fRec2[2];
65 FAUSTFLOAT fbargraph0;
66 double fRec20[2];
67 double fRec19[3];
68 double fVec5[65536];
69 FAUSTFLOAT fslider8;
70 double fRec21[2];
71 FAUSTFLOAT fslider9;
72 FAUSTFLOAT fslider10;
73 double fRec22[2];
74 FAUSTFLOAT fslider11;
75 double fRec15[2];
76 int iRec16[2];
77 double fRec17[2];
78 FAUSTFLOAT fbargraph1;
79 double fRec29[2];
80 double fRec28[3];
81 double fRec27[3];
82 double fVec6[65536];
83 FAUSTFLOAT fslider12;
84 double fRec30[2];
85 FAUSTFLOAT fslider13;
86 FAUSTFLOAT fslider14;
87 double fRec31[2];
88 FAUSTFLOAT fslider15;
89 double fRec23[2];
90 int iRec24[2];
91 double fRec25[2];
92 FAUSTFLOAT fbargraph2;
93 double fRec39[2];
94 double fRec38[3];
95 double fRec37[3];
96 double fRec36[3];
97 double fVec7[65536];
98 FAUSTFLOAT fslider16;
99 double fRec40[2];
100 FAUSTFLOAT fslider17;
101 FAUSTFLOAT fslider18;
102 double fRec41[2];
103 FAUSTFLOAT fslider19;
104 double fRec32[2];
105 int iRec33[2];
106 double fRec34[2];
107 FAUSTFLOAT fbargraph3;
108 double fRec50[2];
109 double fRec49[3];
110 double fRec48[3];
111 double fRec47[3];
112 double fRec46[3];
113 double fVec8[65536];
114 FAUSTFLOAT fslider20;
115 double fRec51[2];
116 FAUSTFLOAT fslider21;
117 FAUSTFLOAT fslider22;
118 double fRec52[2];
119 FAUSTFLOAT fslider23;
120 double fRec42[2];
121 int iRec43[2];
122 double fRec44[2];
123 FAUSTFLOAT fbargraph4;
124 void clear_state_f();
125 int load_ui_f(const UiBuilder& b, int form);
126 void init(unsigned int samplingFreq);
127 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
128 int register_par(const ParamReg& reg);
129
130 static void clear_state_f_static(PluginDef*);
131 static int load_ui_f_static(const UiBuilder& b, int form);
132 static void init_static(unsigned int samplingFreq, PluginDef*);
133 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
134 static int register_params_static(const ParamReg& reg);
135 static void del_instance(PluginDef *p);
136 public:
137 Dsp();
138 ~Dsp();
139 };
140
141
142 double Dsp::ftbl0[65536];
143
144 Dsp::Dsp()
145 : PluginDef() {
146 version = PLUGINDEF_VERSION;
147 flags = 0;
148 id = "mbchor";
149 name = N_("MultiBand Chorus");
150 groups = 0;
151 description = N_("Multi Band Chorus"); // description (tooltip)
152 category = N_("Modulation"); // category
153 shortname = N_("MB Chorus"); // shortname
154 mono_audio = compute_static;
155 stereo_audio = 0;
156 set_samplerate = init_static;
157 activate_plugin = 0;
158 register_params = register_params_static;
159 load_ui = load_ui_f_static;
160 clear_state = clear_state_f_static;
161 delete_instance = del_instance;
162 }
163
164 Dsp::~Dsp() {
165 }
166
167 inline void Dsp::clear_state_f()
168 {
169 for (int i=0; i<2; i++) fVec0[i] = 0;
170 for (int i=0; i<2; i++) fRec11[i] = 0;
171 for (int i=0; i<3; i++) fRec10[i] = 0;
172 for (int i=0; i<2; i++) fVec1[i] = 0;
173 for (int i=0; i<2; i++) fRec9[i] = 0;
174 for (int i=0; i<3; i++) fRec8[i] = 0;
175 for (int i=0; i<2; i++) fVec2[i] = 0;
176 for (int i=0; i<2; i++) fRec7[i] = 0;
177 for (int i=0; i<3; i++) fRec6[i] = 0;
178 for (int i=0; i<2; i++) fVec3[i] = 0;
179 for (int i=0; i<2; i++) fRec5[i] = 0;
180 for (int i=0; i<3; i++) fRec4[i] = 0;
181 for (int i=0; i<65536; i++) fVec4[i] = 0;
182 for (int i=0; i<2; i++) fRec12[i] = 0;
183 for (int i=0; i<2; i++) fRec14[i] = 0;
184 for (int i=0; i<2; i++) fRec0[i] = 0;
185 for (int i=0; i<2; i++) iRec1[i] = 0;
186 for (int i=0; i<2; i++) fRec2[i] = 0;
187 for (int i=0; i<2; i++) fRec20[i] = 0;
188 for (int i=0; i<3; i++) fRec19[i] = 0;
189 for (int i=0; i<65536; i++) fVec5[i] = 0;
190 for (int i=0; i<2; i++) fRec21[i] = 0;
191 for (int i=0; i<2; i++) fRec22[i] = 0;
192 for (int i=0; i<2; i++) fRec15[i] = 0;
193 for (int i=0; i<2; i++) iRec16[i] = 0;
194 for (int i=0; i<2; i++) fRec17[i] = 0;
195 for (int i=0; i<2; i++) fRec29[i] = 0;
196 for (int i=0; i<3; i++) fRec28[i] = 0;
197 for (int i=0; i<3; i++) fRec27[i] = 0;
198 for (int i=0; i<65536; i++) fVec6[i] = 0;
199 for (int i=0; i<2; i++) fRec30[i] = 0;
200 for (int i=0; i<2; i++) fRec31[i] = 0;
201 for (int i=0; i<2; i++) fRec23[i] = 0;
202 for (int i=0; i<2; i++) iRec24[i] = 0;
203 for (int i=0; i<2; i++) fRec25[i] = 0;
204 for (int i=0; i<2; i++) fRec39[i] = 0;
205 for (int i=0; i<3; i++) fRec38[i] = 0;
206 for (int i=0; i<3; i++) fRec37[i] = 0;
207 for (int i=0; i<3; i++) fRec36[i] = 0;
208 for (int i=0; i<65536; i++) fVec7[i] = 0;
209 for (int i=0; i<2; i++) fRec40[i] = 0;
210 for (int i=0; i<2; i++) fRec41[i] = 0;
211 for (int i=0; i<2; i++) fRec32[i] = 0;
212 for (int i=0; i<2; i++) iRec33[i] = 0;
213 for (int i=0; i<2; i++) fRec34[i] = 0;
214 for (int i=0; i<2; i++) fRec50[i] = 0;
215 for (int i=0; i<3; i++) fRec49[i] = 0;
216 for (int i=0; i<3; i++) fRec48[i] = 0;
217 for (int i=0; i<3; i++) fRec47[i] = 0;
218 for (int i=0; i<3; i++) fRec46[i] = 0;
219 for (int i=0; i<65536; i++) fVec8[i] = 0;
220 for (int i=0; i<2; i++) fRec51[i] = 0;
221 for (int i=0; i<2; i++) fRec52[i] = 0;
222 for (int i=0; i<2; i++) fRec42[i] = 0;
223 for (int i=0; i<2; i++) iRec43[i] = 0;
224 for (int i=0; i<2; i++) fRec44[i] = 0;
225 }
226
227 void Dsp::clear_state_f_static(PluginDef *p)
228 {
229 static_cast<Dsp*>(p)->clear_state_f();
230 }
231
232 inline void Dsp::init(unsigned int samplingFreq)
233 {
234 SIG0 sig0;
235 sig0.init(samplingFreq);
236 sig0.fill(65536,ftbl0);
237 fSamplingFreq = samplingFreq;
238 iConst0 = min(192000, max(1, fSamplingFreq));
239 fConst1 = (1.0 / double(iConst0));
240 fConst2 = (3.141592653589793 / double(iConst0));
241 IOTA = 0;
242 fConst3 = (0.016666666666666666 / double(iConst0));
243 fConst4 = (0.5 * iConst0);
244 clear_state_f();
245 }
246
247 void Dsp::init_static(unsigned int samplingFreq, PluginDef *p)
248 {
249 static_cast<Dsp*>(p)->init(samplingFreq);
250 }
251
252 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
253 {
254 double fSlow0 = tan((fConst2 * fslider0));
255 double fSlow1 = (1.0 / faustpower<2>(fSlow0));
256 double fSlow2 = (2 * (1 - fSlow1));
257 double fSlow3 = (1.0 / fSlow0);
258 double fSlow4 = (1 + ((fSlow3 - 1.0000000000000004) / fSlow0));
259 double fSlow5 = (1.0 / (1 + ((fSlow3 + 1.0000000000000004) / fSlow0)));
260 double fSlow6 = (1 + fSlow3);
261 double fSlow7 = (0 - ((1 - fSlow3) / fSlow6));
262 double fSlow8 = tan((fConst2 * fslider1));
263 double fSlow9 = (1.0 / faustpower<2>(fSlow8));
264 double fSlow10 = (2 * (1 - fSlow9));
265 double fSlow11 = (1.0 / fSlow8);
266 double fSlow12 = (1 + ((fSlow11 - 1.0000000000000004) / fSlow8));
267 double fSlow13 = (1 + ((fSlow11 + 1.0000000000000004) / fSlow8));
268 double fSlow14 = (1.0 / fSlow13);
269 double fSlow15 = (1 + fSlow11);
270 double fSlow16 = (0 - ((1 - fSlow11) / fSlow15));
271 double fSlow17 = tan((fConst2 * fslider2));
272 double fSlow18 = (1.0 / faustpower<2>(fSlow17));
273 double fSlow19 = (2 * (1 - fSlow18));
274 double fSlow20 = (1.0 / fSlow17);
275 double fSlow21 = (1 + ((fSlow20 - 1.0000000000000004) / fSlow17));
276 double fSlow22 = (1 + ((fSlow20 + 1.0000000000000004) / fSlow17));
277 double fSlow23 = (1.0 / fSlow22);
278 double fSlow24 = (1 + fSlow20);
279 double fSlow25 = (0 - ((1 - fSlow20) / fSlow24));
280 double fSlow26 = tan((fConst2 * fslider3));
281 double fSlow27 = (1.0 / faustpower<2>(fSlow26));
282 double fSlow28 = (2 * (1 - fSlow27));
283 double fSlow29 = (1.0 / fSlow26);
284 double fSlow30 = (1 + ((fSlow29 - 1.0000000000000004) / fSlow26));
285 double fSlow31 = (1 + ((1.0000000000000004 + fSlow29) / fSlow26));
286 double fSlow32 = (1.0 / fSlow31);
287 double fSlow33 = (1 + fSlow29);
288 double fSlow34 = (0 - ((1 - fSlow29) / fSlow33));
289 double fSlow35 = (1.0 / fSlow33);
290 double fSlow36 = (1.0 / fSlow24);
291 double fSlow37 = (1.0 / fSlow15);
292 double fSlow38 = (1.0 / fSlow6);
293 double fSlow39 = (fConst3 * fslider4);
294 double fSlow40 = (0.1 * fslider5);
295 double fSlow41 = (0.0010000000000000009 * fslider6);
296 double fSlow42 = fslider7;
297 double fSlow43 = (1.0 / (fSlow0 * fSlow13));
298 double fSlow44 = (0 - fSlow3);
299 double fSlow45 = (2 * (0 - fSlow1));
300 double fSlow46 = (fConst3 * fslider8);
301 double fSlow47 = (0.1 * fslider9);
302 double fSlow48 = (0.0010000000000000009 * fslider10);
303 double fSlow49 = fslider11;
304 double fSlow50 = (1 + ((fSlow3 - 1.0) / fSlow0));
305 double fSlow51 = (1.0 / (1 + ((1.0 + fSlow3) / fSlow0)));
306 double fSlow52 = (1.0 / (fSlow8 * fSlow22));
307 double fSlow53 = (0 - fSlow11);
308 double fSlow54 = (2 * (0 - fSlow9));
309 double fSlow55 = (fConst3 * fslider12);
310 double fSlow56 = (0.1 * fslider13);
311 double fSlow57 = (0.0010000000000000009 * fslider14);
312 double fSlow58 = fslider15;
313 double fSlow59 = (1 + ((fSlow11 - 1.0) / fSlow8));
314 double fSlow60 = (1.0 / (1 + ((1.0 + fSlow11) / fSlow8)));
315 double fSlow61 = (1.0 / (fSlow17 * fSlow31));
316 double fSlow62 = (0 - fSlow20);
317 double fSlow63 = (2 * (0 - fSlow18));
318 double fSlow64 = (fConst3 * fslider16);
319 double fSlow65 = (0.1 * fslider17);
320 double fSlow66 = (0.0010000000000000009 * fslider18);
321 double fSlow67 = fslider19;
322 double fSlow68 = (1 + ((fSlow20 - 1.0) / fSlow17));
323 double fSlow69 = (1.0 / (1 + ((1.0 + fSlow20) / fSlow17)));
324 double fSlow70 = (0 - fSlow29);
325 double fSlow71 = (2 * (0 - fSlow27));
326 double fSlow72 = (fConst3 * fslider20);
327 double fSlow73 = (0.1 * fslider21);
328 double fSlow74 = (0.0010000000000000009 * fslider22);
329 double fSlow75 = fslider23;
330 for (int i=0; i<count; i++) {
331 double fTemp0 = (double)input0[i];
332 fVec0[0] = fTemp0;
333 fRec11[0] = ((fSlow35 * (fVec0[0] + fVec0[1])) + (fSlow34 * fRec11[1]));
334 fRec10[0] = (fRec11[0] - (fSlow32 * ((fSlow30 * fRec10[2]) + (fSlow28 * fRec10[1]))));
335 double fTemp1 = (fRec10[2] + (fRec10[0] + (2 * fRec10[1])));
336 double fTemp2 = (fSlow32 * fTemp1);
337 fVec1[0] = fTemp2;
338 fRec9[0] = ((fSlow36 * (fVec1[0] + fVec1[1])) + (fSlow25 * fRec9[1]));
339 fRec8[0] = (fRec9[0] - (fSlow23 * ((fSlow21 * fRec8[2]) + (fSlow19 * fRec8[1]))));
340 double fTemp3 = (fRec8[2] + (fRec8[0] + (2 * fRec8[1])));
341 double fTemp4 = (fSlow23 * fTemp3);
342 fVec2[0] = fTemp4;
343 fRec7[0] = ((fSlow37 * (fVec2[0] + fVec2[1])) + (fSlow16 * fRec7[1]));
344 fRec6[0] = (fRec7[0] - (fSlow14 * ((fSlow12 * fRec6[2]) + (fSlow10 * fRec6[1]))));
345 double fTemp5 = (fRec6[2] + (fRec6[0] + (2 * fRec6[1])));
346 double fTemp6 = (fSlow14 * fTemp5);
347 fVec3[0] = fTemp6;
348 fRec5[0] = ((fSlow38 * (fVec3[0] + fVec3[1])) + (fSlow7 * fRec5[1]));
349 fRec4[0] = (fRec5[0] - (fSlow5 * ((fSlow4 * fRec4[2]) + (fSlow2 * fRec4[1]))));
350 double fTemp7 = (fSlow5 * (fRec4[2] + (fRec4[0] + (2 * fRec4[1]))));
351 fVec4[IOTA&65535] = fTemp7;
352 double fTemp8 = (fSlow39 + fRec12[1]);
353 fRec12[0] = (fTemp8 - floor(fTemp8));
354 double fTemp9 = (65536 * (fRec12[0] - floor(fRec12[0])));
355 double fTemp10 = floor(fTemp9);
356 int iTemp11 = int(fTemp10);
357 fRec14[0] = (fSlow41 + (0.999 * fRec14[1]));
358 double fTemp12 = (fConst4 * (fRec14[0] * (1 + (fSlow40 * ((ftbl0[((1 + iTemp11) & 65535)] * (fTemp9 - fTemp10)) + (ftbl0[(iTemp11 & 65535)] * ((1 + fTemp10) - fTemp9)))))));
359 int iTemp13 = int(fTemp12);
360 int iTemp14 = (1 + iTemp13);
361 double fTemp15 = (fSlow42 * (fVec4[IOTA&65535] + (fSlow42 * (((fTemp12 - iTemp13) * fVec4[(IOTA-int((int(iTemp14) & 65535)))&65535]) + ((iTemp14 - fTemp12) * fVec4[(IOTA-int((iTemp13 & 65535)))&65535])))));
362 double fRec3 = max(fConst1, fabs(fTemp15));
363 int iTemp16 = int((iRec1[1] < 4096));
364 fRec0[0] = ((iTemp16)?max(fRec0[1], fRec3):fRec3);
365 iRec1[0] = ((iTemp16)?(1 + iRec1[1]):1);
366 fRec2[0] = ((iTemp16)?fRec2[1]:fRec0[1]);
367 fbargraph0 = fRec2[0];
368 fRec20[0] = ((fSlow38 * ((fSlow44 * fVec3[1]) + (fSlow43 * fTemp5))) + (fSlow7 * fRec20[1]));
369 fRec19[0] = (fRec20[0] - (fSlow5 * ((fSlow4 * fRec19[2]) + (fSlow2 * fRec19[1]))));
370 double fTemp17 = (fSlow5 * (((fSlow1 * fRec19[0]) + (fSlow45 * fRec19[1])) + (fSlow1 * fRec19[2])));
371 fVec5[IOTA&65535] = fTemp17;
372 double fTemp18 = (fSlow46 + fRec21[1]);
373 fRec21[0] = (fTemp18 - floor(fTemp18));
374 double fTemp19 = (65536 * (fRec21[0] - floor(fRec21[0])));
375 double fTemp20 = floor(fTemp19);
376 int iTemp21 = int(fTemp20);
377 fRec22[0] = (fSlow48 + (0.999 * fRec22[1]));
378 double fTemp22 = (fConst4 * (fRec22[0] * (1 + (fSlow47 * ((ftbl0[((1 + iTemp21) & 65535)] * (fTemp19 - fTemp20)) + (ftbl0[(iTemp21 & 65535)] * ((1 + fTemp20) - fTemp19)))))));
379 int iTemp23 = int(fTemp22);
380 int iTemp24 = (1 + iTemp23);
381 double fTemp25 = (fSlow49 * (fVec5[IOTA&65535] + (fSlow49 * (((fTemp22 - iTemp23) * fVec5[(IOTA-int((int(iTemp24) & 65535)))&65535]) + ((iTemp24 - fTemp22) * fVec5[(IOTA-int((iTemp23 & 65535)))&65535])))));
382 double fRec18 = max(fConst1, fabs(fTemp25));
383 int iTemp26 = int((iRec16[1] < 4096));
384 fRec15[0] = ((iTemp26)?max(fRec15[1], fRec18):fRec18);
385 iRec16[0] = ((iTemp26)?(1 + iRec16[1]):1);
386 fRec17[0] = ((iTemp26)?fRec17[1]:fRec15[1]);
387 fbargraph1 = fRec17[0];
388 double fTemp27 = (fSlow2 * fRec27[1]);
389 fRec29[0] = ((fSlow37 * ((fSlow53 * fVec2[1]) + (fSlow52 * fTemp3))) + (fSlow16 * fRec29[1]));
390 fRec28[0] = (fRec29[0] - (fSlow14 * ((fSlow12 * fRec28[2]) + (fSlow10 * fRec28[1]))));
391 fRec27[0] = ((fSlow14 * (((fSlow9 * fRec28[0]) + (fSlow54 * fRec28[1])) + (fSlow9 * fRec28[2]))) - (fSlow51 * ((fSlow50 * fRec27[2]) + fTemp27)));
392 double fTemp28 = (fRec27[2] + (fSlow51 * (fTemp27 + (fSlow50 * fRec27[0]))));
393 fVec6[IOTA&65535] = fTemp28;
394 double fTemp29 = (fSlow55 + fRec30[1]);
395 fRec30[0] = (fTemp29 - floor(fTemp29));
396 double fTemp30 = (65536 * (fRec30[0] - floor(fRec30[0])));
397 double fTemp31 = floor(fTemp30);
398 int iTemp32 = int(fTemp31);
399 fRec31[0] = (fSlow57 + (0.999 * fRec31[1]));
400 double fTemp33 = (fConst4 * (fRec31[0] * (1 + (fSlow56 * ((ftbl0[((1 + iTemp32) & 65535)] * (fTemp30 - fTemp31)) + (ftbl0[(iTemp32 & 65535)] * ((1 + fTemp31) - fTemp30)))))));
401 int iTemp34 = int(fTemp33);
402 int iTemp35 = (1 + iTemp34);
403 double fTemp36 = (fSlow58 * (fVec6[IOTA&65535] + (fSlow58 * (((fTemp33 - iTemp34) * fVec6[(IOTA-int((int(iTemp35) & 65535)))&65535]) + ((iTemp35 - fTemp33) * fVec6[(IOTA-int((iTemp34 & 65535)))&65535])))));
404 double fRec26 = max(fConst1, fabs(fTemp36));
405 int iTemp37 = int((iRec24[1] < 4096));
406 fRec23[0] = ((iTemp37)?max(fRec23[1], fRec26):fRec26);
407 iRec24[0] = ((iTemp37)?(1 + iRec24[1]):1);
408 fRec25[0] = ((iTemp37)?fRec25[1]:fRec23[1]);
409 fbargraph2 = fRec25[0];
410 double fTemp38 = (fSlow2 * fRec36[1]);
411 double fTemp39 = (fSlow10 * fRec37[1]);
412 fRec39[0] = ((fSlow36 * ((fSlow62 * fVec1[1]) + (fSlow61 * fTemp1))) + (fSlow25 * fRec39[1]));
413 fRec38[0] = (fRec39[0] - (fSlow23 * ((fSlow21 * fRec38[2]) + (fSlow19 * fRec38[1]))));
414 fRec37[0] = ((fSlow23 * (((fSlow18 * fRec38[0]) + (fSlow63 * fRec38[1])) + (fSlow18 * fRec38[2]))) - (fSlow60 * ((fSlow59 * fRec37[2]) + fTemp39)));
415 fRec36[0] = ((fRec37[2] + (fSlow60 * (fTemp39 + (fSlow59 * fRec37[0])))) - (fSlow51 * ((fSlow50 * fRec36[2]) + fTemp38)));
416 double fTemp40 = (fRec36[2] + (fSlow51 * (fTemp38 + (fSlow50 * fRec36[0]))));
417 fVec7[IOTA&65535] = fTemp40;
418 double fTemp41 = (fSlow64 + fRec40[1]);
419 fRec40[0] = (fTemp41 - floor(fTemp41));
420 double fTemp42 = (65536 * (fRec40[0] - floor(fRec40[0])));
421 double fTemp43 = floor(fTemp42);
422 int iTemp44 = int(fTemp43);
423 fRec41[0] = (fSlow66 + (0.999 * fRec41[1]));
424 double fTemp45 = (fConst4 * (fRec41[0] * (1 + (fSlow65 * ((ftbl0[((1 + iTemp44) & 65535)] * (fTemp42 - fTemp43)) + (ftbl0[(iTemp44 & 65535)] * ((1 + fTemp43) - fTemp42)))))));
425 int iTemp46 = int(fTemp45);
426 int iTemp47 = (1 + iTemp46);
427 double fTemp48 = (fSlow67 * (fVec7[IOTA&65535] + (fSlow67 * (((fTemp45 - iTemp46) * fVec7[(IOTA-int((int(iTemp47) & 65535)))&65535]) + ((iTemp47 - fTemp45) * fVec7[(IOTA-int((iTemp46 & 65535)))&65535])))));
428 double fRec35 = max(fConst1, fabs(fTemp48));
429 int iTemp49 = int((iRec33[1] < 4096));
430 fRec32[0] = ((iTemp49)?max(fRec32[1], fRec35):fRec35);
431 iRec33[0] = ((iTemp49)?(1 + iRec33[1]):1);
432 fRec34[0] = ((iTemp49)?fRec34[1]:fRec32[1]);
433 fbargraph3 = fRec34[0];
434 double fTemp50 = (fSlow2 * fRec46[1]);
435 double fTemp51 = (fSlow10 * fRec47[1]);
436 double fTemp52 = (fSlow19 * fRec48[1]);
437 fRec50[0] = ((fSlow35 * ((fSlow70 * fVec0[1]) + (fSlow29 * fVec0[0]))) + (fSlow34 * fRec50[1]));
438 fRec49[0] = (fRec50[0] - (fSlow32 * ((fSlow30 * fRec49[2]) + (fSlow28 * fRec49[1]))));
439 fRec48[0] = ((fSlow32 * (((fSlow27 * fRec49[0]) + (fSlow71 * fRec49[1])) + (fSlow27 * fRec49[2]))) - (fSlow69 * ((fSlow68 * fRec48[2]) + fTemp52)));
440 fRec47[0] = ((fRec48[2] + (fSlow69 * (fTemp52 + (fSlow68 * fRec48[0])))) - (fSlow60 * ((fSlow59 * fRec47[2]) + fTemp51)));
441 fRec46[0] = ((fRec47[2] + (fSlow60 * (fTemp51 + (fSlow59 * fRec47[0])))) - (fSlow51 * ((fSlow50 * fRec46[2]) + fTemp50)));
442 double fTemp53 = (fRec46[2] + (fSlow51 * (fTemp50 + (fSlow50 * fRec46[0]))));
443 fVec8[IOTA&65535] = fTemp53;
444 double fTemp54 = (fSlow72 + fRec51[1]);
445 fRec51[0] = (fTemp54 - floor(fTemp54));
446 double fTemp55 = (65536 * (fRec51[0] - floor(fRec51[0])));
447 double fTemp56 = floor(fTemp55);
448 int iTemp57 = int(fTemp56);
449 fRec52[0] = (fSlow74 + (0.999 * fRec52[1]));
450 double fTemp58 = (fConst4 * (fRec52[0] * (1 + (fSlow73 * ((ftbl0[((1 + iTemp57) & 65535)] * (fTemp55 - fTemp56)) + (ftbl0[(iTemp57 & 65535)] * ((1 + fTemp56) - fTemp55)))))));
451 int iTemp59 = int(fTemp58);
452 int iTemp60 = (1 + iTemp59);
453 double fTemp61 = (fSlow75 * (fVec8[IOTA&65535] + (fSlow75 * (((fTemp58 - iTemp59) * fVec8[(IOTA-int((int(iTemp60) & 65535)))&65535]) + ((iTemp60 - fTemp58) * fVec8[(IOTA-int((iTemp59 & 65535)))&65535])))));
454 double fRec45 = max(fConst1, fabs(fTemp61));
455 int iTemp62 = int((iRec43[1] < 4096));
456 fRec42[0] = ((iTemp62)?max(fRec42[1], fRec45):fRec45);
457 iRec43[0] = ((iTemp62)?(1 + iRec43[1]):1);
458 fRec44[0] = ((iTemp62)?fRec44[1]:fRec42[1]);
459 fbargraph4 = fRec44[0];
460 output0[i] = (FAUSTFLOAT)(fTemp61 + (fTemp48 + (fTemp36 + (fTemp25 + (fVec0[0] + fTemp15)))));
461 // post processing
462 fRec44[1] = fRec44[0];
463 iRec43[1] = iRec43[0];
464 fRec42[1] = fRec42[0];
465 fRec52[1] = fRec52[0];
466 fRec51[1] = fRec51[0];
467 fRec46[2] = fRec46[1]; fRec46[1] = fRec46[0];
468 fRec47[2] = fRec47[1]; fRec47[1] = fRec47[0];
469 fRec48[2] = fRec48[1]; fRec48[1] = fRec48[0];
470 fRec49[2] = fRec49[1]; fRec49[1] = fRec49[0];
471 fRec50[1] = fRec50[0];
472 fRec34[1] = fRec34[0];
473 iRec33[1] = iRec33[0];
474 fRec32[1] = fRec32[0];
475 fRec41[1] = fRec41[0];
476 fRec40[1] = fRec40[0];
477 fRec36[2] = fRec36[1]; fRec36[1] = fRec36[0];
478 fRec37[2] = fRec37[1]; fRec37[1] = fRec37[0];
479 fRec38[2] = fRec38[1]; fRec38[1] = fRec38[0];
480 fRec39[1] = fRec39[0];
481 fRec25[1] = fRec25[0];
482 iRec24[1] = iRec24[0];
483 fRec23[1] = fRec23[0];
484 fRec31[1] = fRec31[0];
485 fRec30[1] = fRec30[0];
486 fRec27[2] = fRec27[1]; fRec27[1] = fRec27[0];
487 fRec28[2] = fRec28[1]; fRec28[1] = fRec28[0];
488 fRec29[1] = fRec29[0];
489 fRec17[1] = fRec17[0];
490 iRec16[1] = iRec16[0];
491 fRec15[1] = fRec15[0];
492 fRec22[1] = fRec22[0];
493 fRec21[1] = fRec21[0];
494 fRec19[2] = fRec19[1]; fRec19[1] = fRec19[0];
495 fRec20[1] = fRec20[0];
496 fRec2[1] = fRec2[0];
497 iRec1[1] = iRec1[0];
498 fRec0[1] = fRec0[0];
499 fRec14[1] = fRec14[0];
500 fRec12[1] = fRec12[0];
501 IOTA = IOTA+1;
502 fRec4[2] = fRec4[1]; fRec4[1] = fRec4[0];
503 fRec5[1] = fRec5[0];
504 fVec3[1] = fVec3[0];
505 fRec6[2] = fRec6[1]; fRec6[1] = fRec6[0];
506 fRec7[1] = fRec7[0];
507 fVec2[1] = fVec2[0];
508 fRec8[2] = fRec8[1]; fRec8[1] = fRec8[0];
509 fRec9[1] = fRec9[0];
510 fVec1[1] = fVec1[0];
511 fRec10[2] = fRec10[1]; fRec10[1] = fRec10[0];
512 fRec11[1] = fRec11[0];
513 fVec0[1] = fVec0[0];
514 }
515 }
516
517 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
518 {
519 static_cast<Dsp*>(p)->compute(count, input0, output0);
520 }
521
522 int Dsp::register_par(const ParamReg& reg)
523 {
524 reg.registerVar("mbchor.crossover_b1_b2",N_("Crossover B1-B2 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider0, 8e+01, 2e+01, 2e+04, 1.08);
525 reg.registerVar("mbchor.crossover_b2_b3",N_("Crossover B2-B3 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider1, 2.1e+02, 2e+01, 2e+04, 1.08);
526 reg.registerVar("mbchor.crossover_b3_b4",N_("Crossover B3-B4 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider2, 1.7e+03, 2e+01, 2e+04, 1.08);
527 reg.registerVar("mbchor.crossover_b4_b5",N_("Crossover B4-B5 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider3, 5e+03, 2e+01, 2e+04, 1.08);
528 reg.registerVar("mbchor.delay1","","S","",&fslider6, 0.02, 0.0, 0.2, 0.01);
529 reg.registerVar("mbchor.delay2","","S","",&fslider10, 0.04, 0.0, 0.2, 0.01);
530 reg.registerVar("mbchor.delay3","","S","",&fslider14, 0.06, 0.0, 0.2, 0.01);
531 reg.registerVar("mbchor.delay4","","S","",&fslider18, 0.08, 0.0, 0.2, 0.01);
532 reg.registerVar("mbchor.delay5","","S","",&fslider22, 0.1, 0.0, 0.2, 0.01);
533 reg.registerVar("mbchor.depth1","","S","",&fslider5, 0.02, 0.01, 1.0, 0.01);
534 reg.registerVar("mbchor.depth2","","S","",&fslider9, 0.04, 0.01, 1.0, 0.01);
535 reg.registerVar("mbchor.depth3","","S","",&fslider13, 0.06, 0.01, 1.0, 0.01);
536 reg.registerVar("mbchor.depth4","","S","",&fslider17, 0.08, 0.01, 1.0, 0.01);
537 reg.registerVar("mbchor.depth5","","S","",&fslider21, 0.1, 0.01, 1.0, 0.01);
538 reg.registerVar("mbchor.freq1","","S",N_("Beats per Minute"),&fslider4, 3e+01, 24.0, 3.6e+02, 1.0);
539 reg.registerVar("mbchor.freq2","","S",N_("Beats per Minute"),&fslider8, 6e+01, 24.0, 3.6e+02, 1.0);
540 reg.registerVar("mbchor.freq3","","S",N_("Beats per Minute"),&fslider12, 9e+01, 24.0, 3.6e+02, 1.0);
541 reg.registerVar("mbchor.freq4","","S",N_("Beats per Minute"),&fslider16, 1.2e+02, 24.0, 3.6e+02, 1.0);
542 reg.registerVar("mbchor.freq5","","S",N_("Beats per Minute"),&fslider20, 1.5e+02, 24.0, 3.6e+02, 1.0);
543 reg.registerVar("mbchor.level1","","S","",&fslider7, 0.5, 0.0, 1.0, 0.01);
544 reg.registerVar("mbchor.level2","","S","",&fslider11, 0.5, 0.0, 1.0, 0.01);
545 reg.registerVar("mbchor.level3","","S","",&fslider15, 0.5, 0.0, 1.0, 0.01);
546 reg.registerVar("mbchor.level4","","S","",&fslider19, 0.5, 0.0, 1.0, 0.01);
547 reg.registerVar("mbchor.level5","","S","",&fslider23, 0.5, 0.0, 1.0, 0.01);
548 reg.registerNonMidiFloatVar("mbchor.v1",&fbargraph0, false, true, -70.0, -70.0, 4.0, 0.00001);
549 reg.registerNonMidiFloatVar("mbchor.v2",&fbargraph1, false, true, -70.0, -70.0, 4.0, 0.00001);
550 reg.registerNonMidiFloatVar("mbchor.v3",&fbargraph2, false, true, -70.0, -70.0, 4.0, 0.00001);
551 reg.registerNonMidiFloatVar("mbchor.v4",&fbargraph3, false, true, -70.0, -70.0, 4.0, 0.00001);
552 reg.registerNonMidiFloatVar("mbchor.v5",&fbargraph4, false, true, -70.0, -70.0, 4.0, 0.00001);
553 return 0;
554 }
555
556 int Dsp::register_params_static(const ParamReg& reg)
557 {
558 return static_cast<Dsp*>(reg.plugin)->register_par(reg);
559 }
560
561 inline int Dsp::load_ui_f(const UiBuilder& b, int form)
562 {
563 if (form & UI_FORM_STACK) {
564 #define PARAM(p) ("mbchor" "." p)
565
566 b.openHorizontalhideBox("");
567 b.closeBox();
568
569 b.openHorizontalBox("");
570 b.openVerticalBox("");
571
572 b.openTabBox("");
573
574 b.openHorizontalBox(N_("Band 1"));
575 b.openVerticalBox("");
576 b.openpaintampBox("");
577 b.openHorizontalBox("");
578 b.openVerticalBox("");
579 b.set_next_flags(UI_NUM_RIGHT);
580 b.create_small_rackknob(PARAM("level1"), N_("Level"));
581 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
582 b.create_small_rackknob(PARAM("freq1"), N_("BPM"));
583 b.closeBox();
584 b.openVerticalBox("");
585 b.set_next_flags(UI_NUM_RIGHT);
586 b.create_small_rackknob(PARAM("delay1"), N_("Delay"));
587 b.set_next_flags(UI_NUM_RIGHT);
588 b.create_small_rackknob(PARAM("depth1"), N_("Depth"));
589 b.closeBox();
590 b.openVerticalBox("");
591 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
592 b.create_small_rackknob(PARAM("crossover_b1_b2"), N_("Low Shelf (Hz)"));
593 b.closeBox();
594 b.closeBox();
595 b.closeBox();
596 b.closeBox();
597 b.closeBox();
598
599 b.openHorizontalBox(N_("Band 2"));
600 b.openVerticalBox("");
601 b.openpaintampBox("");
602 b.openHorizontalBox("");
603 b.openVerticalBox("");
604 b.set_next_flags(UI_NUM_RIGHT);
605 b.create_small_rackknob(PARAM("level2"), N_("Level"));
606 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
607 b.create_small_rackknob(PARAM("freq2"), N_("BPM"));
608 b.closeBox();
609 b.openVerticalBox("");
610 b.set_next_flags(UI_NUM_RIGHT);
611 b.create_small_rackknob(PARAM("delay2"), N_("Delay"));
612 b.set_next_flags(UI_NUM_RIGHT);
613 b.create_small_rackknob(PARAM("depth2"), N_("Depth"));
614 b.closeBox();
615 b.openVerticalBox("");
616 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
617 b.create_small_rackknob(PARAM("crossover_b1_b2"), N_("Low (Hz)"));
618 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
619 b.create_small_rackknob(PARAM("crossover_b2_b3"), N_("High (hz)"));
620 b.closeBox();
621 b.closeBox();
622 b.closeBox();
623 b.closeBox();
624 b.closeBox();
625
626 b.openHorizontalBox(N_("Band 3"));
627 b.openVerticalBox("");
628 b.openpaintampBox("");
629 b.openHorizontalBox("");
630 b.openVerticalBox("");
631 b.set_next_flags(UI_NUM_RIGHT);
632 b.create_small_rackknob(PARAM("level3"), N_("Level"));
633 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
634 b.create_small_rackknob(PARAM("freq3"), N_("BPM"));
635 b.closeBox();
636 b.openVerticalBox("");
637 b.set_next_flags(UI_NUM_RIGHT);
638 b.create_small_rackknob(PARAM("delay3"), N_("Delay"));
639 b.set_next_flags(UI_NUM_RIGHT);
640 b.create_small_rackknob(PARAM("depth3"), N_("Depth"));
641 b.closeBox();
642 b.openVerticalBox("");
643 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
644 b.create_small_rackknob(PARAM("crossover_b2_b3"), N_("Low (Hz)"));
645 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
646 b.create_small_rackknob(PARAM("crossover_b3_b4"), N_("High (hz)"));
647 b.closeBox();
648 b.closeBox();
649 b.closeBox();
650 b.closeBox();
651 b.closeBox();
652
653 b.openHorizontalBox(N_("Band 4"));
654 b.openVerticalBox("");
655 b.openpaintampBox("");
656 b.openHorizontalBox("");
657 b.openVerticalBox("");
658 b.set_next_flags(UI_NUM_RIGHT);
659 b.create_small_rackknob(PARAM("level4"), N_("Level"));
660 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
661 b.create_small_rackknob(PARAM("freq4"), N_("BPM"));
662 b.closeBox();
663 b.openVerticalBox("");
664 b.set_next_flags(UI_NUM_RIGHT);
665 b.create_small_rackknob(PARAM("delay4"), N_("Delay"));
666 b.set_next_flags(UI_NUM_RIGHT);
667 b.create_small_rackknob(PARAM("depth4"), N_("Depth"));
668 b.closeBox();
669 b.openVerticalBox("");
670 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
671 b.create_small_rackknob(PARAM("crossover_b3_b4"), N_("Low (Hz)"));
672 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
673 b.create_small_rackknob(PARAM("crossover_b4_b5"), N_("High (hz)"));
674 b.closeBox();
675 b.closeBox();
676 b.closeBox();
677 b.closeBox();
678 b.closeBox();
679
680 b.openHorizontalBox(N_("Band 5"));
681 b.openVerticalBox("");
682 b.openpaintampBox("");
683 b.openHorizontalBox("");
684 b.openVerticalBox("");
685 b.set_next_flags(UI_NUM_RIGHT);
686 b.create_small_rackknob(PARAM("level5"), N_("Level"));
687 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
688 b.create_small_rackknob(PARAM("freq5"), N_("BPM"));
689 b.closeBox();
690 b.openVerticalBox("");
691 b.set_next_flags(UI_NUM_RIGHT);
692 b.create_small_rackknob(PARAM("delay5"), N_("Delay"));
693 b.set_next_flags(UI_NUM_RIGHT);
694 b.create_small_rackknob(PARAM("depth5"), N_("Depth"));
695 b.closeBox();
696 b.openVerticalBox("");
697 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
698 b.create_small_rackknob(PARAM("crossover_b4_b5"), N_("High Shelf (Hz)"));
699 b.closeBox();
700 b.closeBox();
701 b.closeBox();
702 b.closeBox();
703 b.closeBox();
704
705 b.closeBox();
706 b.closeBox();
707 b.openVerticalBox2("Analyze");
708 b.create_simple_meter(PARAM("v1"));
709 b.create_simple_meter(PARAM("v2"));
710 b.create_simple_meter(PARAM("v3"));
711 b.create_simple_meter(PARAM("v4"));
712 b.create_simple_meter(PARAM("v5"));
713 b.closeBox();
714 b.closeBox();
715
716 #undef PARAM
717 return 0;
718 }
719 return -1;
720 }
721
722 int Dsp::load_ui_f_static(const UiBuilder& b, int form)
723 {
724 return static_cast<Dsp*>(b.plugin)->load_ui_f(b, form);
725 }
726 PluginDef *plugin() {
727 return new Dsp();
728 }
729
730 void Dsp::del_instance(PluginDef *p)
731 {
732 delete static_cast<Dsp*>(p);
733 }
734
735 } // end namespace mbchor
736 } // end namespace pluginlib
1616 FAUSTFLOAT fslider1;
1717 double fConst3;
1818 FAUSTFLOAT fslider2;
19 FAUSTFLOAT fslider3;
20 FAUSTFLOAT fslider4;
1921 double fVec0[2];
22 double fRec10[2];
23 double fRec9[3];
24 double fVec1[2];
25 double fRec8[2];
26 double fRec7[3];
27 double fVec2[2];
2028 double fRec6[2];
2129 double fRec5[3];
22 double fVec1[2];
30 double fVec3[2];
2331 double fRec4[2];
2432 double fRec3[3];
25 FAUSTFLOAT fslider3;
26 double fVec2[2];
27 double fRec10[2];
28 double fRec9[3];
29 double fVec3[2];
30 double fRec8[2];
31 double fRec7[3];
32 FAUSTFLOAT fslider4;
33 FAUSTFLOAT fslider5;
34 double fVec4[2];
35 double fRec18[2];
36 double fRec17[3];
37 double fVec5[2];
38 double fRec16[2];
39 double fRec15[3];
40 double fVec6[2];
41 double fRec14[2];
42 double fRec13[3];
43 double fVec7[2];
44 double fRec12[2];
45 double fRec11[3];
46 FAUSTFLOAT fslider6;
3347 double fRec2[2];
3448 double fRec1[2];
35 FAUSTFLOAT fslider5;
36 FAUSTFLOAT fslider6;
49 FAUSTFLOAT fslider7;
50 FAUSTFLOAT fslider8;
3751 double fRec0[2];
38 FAUSTFLOAT fslider7;
39 double fRec11[2];
40 FAUSTFLOAT fslider8;
41 double fRec16[2];
42 double fRec15[3];
4352 FAUSTFLOAT fslider9;
44 double fRec18[2];
45 double fRec17[3];
53 double fRec19[2];
4654 FAUSTFLOAT fslider10;
47 double fRec14[2];
48 double fRec13[2];
55 double fRec24[2];
56 double fRec23[3];
4957 FAUSTFLOAT fslider11;
50 FAUSTFLOAT fslider12;
51 double fRec12[2];
52 FAUSTFLOAT fslider13;
53 double fRec19[2];
54 FAUSTFLOAT fslider14;
55 FAUSTFLOAT fslider15;
5658 double fRec26[2];
5759 double fRec25[3];
58 double fVec4[2];
59 double fRec24[2];
60 double fRec23[3];
61 FAUSTFLOAT fslider16;
62 double fRec30[2];
63 double fRec29[3];
64 double fVec5[2];
65 double fRec28[2];
66 double fRec27[3];
67 FAUSTFLOAT fslider17;
60 FAUSTFLOAT fslider12;
6861 double fRec22[2];
6962 double fRec21[2];
70 FAUSTFLOAT fslider18;
71 FAUSTFLOAT fslider19;
63 FAUSTFLOAT fslider13;
64 FAUSTFLOAT fslider14;
7265 double fRec20[2];
73 FAUSTFLOAT fslider20;
74 double fRec31[2];
75 FAUSTFLOAT fslider21;
76 FAUSTFLOAT fslider22;
77 double fRec38[2];
78 double fRec37[3];
79 double fVec6[2];
66 FAUSTFLOAT fslider15;
67 double fRec27[2];
68 FAUSTFLOAT fslider16;
69 double fRec33[2];
70 double fRec32[3];
71 double fRec31[3];
72 FAUSTFLOAT fslider17;
8073 double fRec36[2];
8174 double fRec35[3];
75 double fRec34[3];
76 FAUSTFLOAT fslider18;
77 double fRec30[2];
78 double fRec29[2];
79 FAUSTFLOAT fslider19;
80 FAUSTFLOAT fslider20;
81 double fRec28[2];
82 FAUSTFLOAT fslider21;
83 double fRec37[2];
84 FAUSTFLOAT fslider22;
85 double fRec44[2];
86 double fRec43[3];
87 double fRec42[3];
88 double fRec41[3];
8289 FAUSTFLOAT fslider23;
83 double fRec42[2];
84 double fRec41[3];
85 double fVec7[2];
90 double fRec48[2];
91 double fRec47[3];
92 double fRec46[3];
93 double fRec45[3];
94 FAUSTFLOAT fslider24;
8695 double fRec40[2];
87 double fRec39[3];
88 FAUSTFLOAT fslider24;
89 double fRec34[2];
90 double fRec33[2];
96 double fRec39[2];
9197 FAUSTFLOAT fslider25;
9298 FAUSTFLOAT fslider26;
93 double fRec32[2];
99 double fRec38[2];
94100 FAUSTFLOAT fslider27;
95 double fRec43[2];
101 double fRec49[2];
96102 FAUSTFLOAT fslider28;
97 double fRec48[2];
98 double fRec47[3];
103 double fRec57[2];
104 double fRec56[3];
105 double fRec55[3];
106 double fRec54[3];
107 double fRec53[3];
99108 FAUSTFLOAT fslider29;
100 double fRec50[2];
101 double fRec49[3];
109 double fRec62[2];
110 double fRec61[3];
111 double fRec60[3];
112 double fRec59[3];
113 double fRec58[3];
102114 FAUSTFLOAT fslider30;
103 double fRec46[2];
104 double fRec45[2];
115 double fRec52[2];
116 double fRec51[2];
105117 FAUSTFLOAT fslider31;
106118 FAUSTFLOAT fslider32;
107 double fRec44[2];
119 double fRec50[2];
108120 FAUSTFLOAT fslider33;
109 double fRec51[2];
121 double fRec63[2];
110122 void clear_state_f();
111123 int load_ui_f(const UiBuilder& b, int form);
112124 void init(unsigned int samplingFreq);
113 void compute(int count, float *input0, float *input1, float *output0, float *output1);
125 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
114126 int register_par(const ParamReg& reg);
115127
116128 static void clear_state_f_static(PluginDef*);
117129 static int load_ui_f_static(const UiBuilder& b, int form);
118130 static void init_static(unsigned int samplingFreq, PluginDef*);
119 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
131 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
120132 static int register_params_static(const ParamReg& reg);
121133 static void del_instance(PluginDef *p);
122134 public:
152164 inline void Dsp::clear_state_f()
153165 {
154166 for (int i=0; i<2; i++) fVec0[i] = 0;
167 for (int i=0; i<2; i++) fRec10[i] = 0;
168 for (int i=0; i<3; i++) fRec9[i] = 0;
169 for (int i=0; i<2; i++) fVec1[i] = 0;
170 for (int i=0; i<2; i++) fRec8[i] = 0;
171 for (int i=0; i<3; i++) fRec7[i] = 0;
172 for (int i=0; i<2; i++) fVec2[i] = 0;
155173 for (int i=0; i<2; i++) fRec6[i] = 0;
156174 for (int i=0; i<3; i++) fRec5[i] = 0;
157 for (int i=0; i<2; i++) fVec1[i] = 0;
175 for (int i=0; i<2; i++) fVec3[i] = 0;
158176 for (int i=0; i<2; i++) fRec4[i] = 0;
159177 for (int i=0; i<3; i++) fRec3[i] = 0;
160 for (int i=0; i<2; i++) fVec2[i] = 0;
161 for (int i=0; i<2; i++) fRec10[i] = 0;
162 for (int i=0; i<3; i++) fRec9[i] = 0;
163 for (int i=0; i<2; i++) fVec3[i] = 0;
164 for (int i=0; i<2; i++) fRec8[i] = 0;
165 for (int i=0; i<3; i++) fRec7[i] = 0;
178 for (int i=0; i<2; i++) fVec4[i] = 0;
179 for (int i=0; i<2; i++) fRec18[i] = 0;
180 for (int i=0; i<3; i++) fRec17[i] = 0;
181 for (int i=0; i<2; i++) fVec5[i] = 0;
182 for (int i=0; i<2; i++) fRec16[i] = 0;
183 for (int i=0; i<3; i++) fRec15[i] = 0;
184 for (int i=0; i<2; i++) fVec6[i] = 0;
185 for (int i=0; i<2; i++) fRec14[i] = 0;
186 for (int i=0; i<3; i++) fRec13[i] = 0;
187 for (int i=0; i<2; i++) fVec7[i] = 0;
188 for (int i=0; i<2; i++) fRec12[i] = 0;
189 for (int i=0; i<3; i++) fRec11[i] = 0;
166190 for (int i=0; i<2; i++) fRec2[i] = 0;
167191 for (int i=0; i<2; i++) fRec1[i] = 0;
168192 for (int i=0; i<2; i++) fRec0[i] = 0;
169 for (int i=0; i<2; i++) fRec11[i] = 0;
170 for (int i=0; i<2; i++) fRec16[i] = 0;
171 for (int i=0; i<3; i++) fRec15[i] = 0;
172 for (int i=0; i<2; i++) fRec18[i] = 0;
173 for (int i=0; i<3; i++) fRec17[i] = 0;
174 for (int i=0; i<2; i++) fRec14[i] = 0;
175 for (int i=0; i<2; i++) fRec13[i] = 0;
176 for (int i=0; i<2; i++) fRec12[i] = 0;
177193 for (int i=0; i<2; i++) fRec19[i] = 0;
194 for (int i=0; i<2; i++) fRec24[i] = 0;
195 for (int i=0; i<3; i++) fRec23[i] = 0;
178196 for (int i=0; i<2; i++) fRec26[i] = 0;
179197 for (int i=0; i<3; i++) fRec25[i] = 0;
180 for (int i=0; i<2; i++) fVec4[i] = 0;
181 for (int i=0; i<2; i++) fRec24[i] = 0;
182 for (int i=0; i<3; i++) fRec23[i] = 0;
183 for (int i=0; i<2; i++) fRec30[i] = 0;
184 for (int i=0; i<3; i++) fRec29[i] = 0;
185 for (int i=0; i<2; i++) fVec5[i] = 0;
186 for (int i=0; i<2; i++) fRec28[i] = 0;
187 for (int i=0; i<3; i++) fRec27[i] = 0;
188198 for (int i=0; i<2; i++) fRec22[i] = 0;
189199 for (int i=0; i<2; i++) fRec21[i] = 0;
190200 for (int i=0; i<2; i++) fRec20[i] = 0;
191 for (int i=0; i<2; i++) fRec31[i] = 0;
192 for (int i=0; i<2; i++) fRec38[i] = 0;
193 for (int i=0; i<3; i++) fRec37[i] = 0;
194 for (int i=0; i<2; i++) fVec6[i] = 0;
201 for (int i=0; i<2; i++) fRec27[i] = 0;
202 for (int i=0; i<2; i++) fRec33[i] = 0;
203 for (int i=0; i<3; i++) fRec32[i] = 0;
204 for (int i=0; i<3; i++) fRec31[i] = 0;
195205 for (int i=0; i<2; i++) fRec36[i] = 0;
196206 for (int i=0; i<3; i++) fRec35[i] = 0;
197 for (int i=0; i<2; i++) fRec42[i] = 0;
207 for (int i=0; i<3; i++) fRec34[i] = 0;
208 for (int i=0; i<2; i++) fRec30[i] = 0;
209 for (int i=0; i<2; i++) fRec29[i] = 0;
210 for (int i=0; i<2; i++) fRec28[i] = 0;
211 for (int i=0; i<2; i++) fRec37[i] = 0;
212 for (int i=0; i<2; i++) fRec44[i] = 0;
213 for (int i=0; i<3; i++) fRec43[i] = 0;
214 for (int i=0; i<3; i++) fRec42[i] = 0;
198215 for (int i=0; i<3; i++) fRec41[i] = 0;
199 for (int i=0; i<2; i++) fVec7[i] = 0;
200 for (int i=0; i<2; i++) fRec40[i] = 0;
201 for (int i=0; i<3; i++) fRec39[i] = 0;
202 for (int i=0; i<2; i++) fRec34[i] = 0;
203 for (int i=0; i<2; i++) fRec33[i] = 0;
204 for (int i=0; i<2; i++) fRec32[i] = 0;
205 for (int i=0; i<2; i++) fRec43[i] = 0;
206216 for (int i=0; i<2; i++) fRec48[i] = 0;
207217 for (int i=0; i<3; i++) fRec47[i] = 0;
218 for (int i=0; i<3; i++) fRec46[i] = 0;
219 for (int i=0; i<3; i++) fRec45[i] = 0;
220 for (int i=0; i<2; i++) fRec40[i] = 0;
221 for (int i=0; i<2; i++) fRec39[i] = 0;
222 for (int i=0; i<2; i++) fRec38[i] = 0;
223 for (int i=0; i<2; i++) fRec49[i] = 0;
224 for (int i=0; i<2; i++) fRec57[i] = 0;
225 for (int i=0; i<3; i++) fRec56[i] = 0;
226 for (int i=0; i<3; i++) fRec55[i] = 0;
227 for (int i=0; i<3; i++) fRec54[i] = 0;
228 for (int i=0; i<3; i++) fRec53[i] = 0;
229 for (int i=0; i<2; i++) fRec62[i] = 0;
230 for (int i=0; i<3; i++) fRec61[i] = 0;
231 for (int i=0; i<3; i++) fRec60[i] = 0;
232 for (int i=0; i<3; i++) fRec59[i] = 0;
233 for (int i=0; i<3; i++) fRec58[i] = 0;
234 for (int i=0; i<2; i++) fRec52[i] = 0;
235 for (int i=0; i<2; i++) fRec51[i] = 0;
208236 for (int i=0; i<2; i++) fRec50[i] = 0;
209 for (int i=0; i<3; i++) fRec49[i] = 0;
210 for (int i=0; i<2; i++) fRec46[i] = 0;
211 for (int i=0; i<2; i++) fRec45[i] = 0;
212 for (int i=0; i<2; i++) fRec44[i] = 0;
213 for (int i=0; i<2; i++) fRec51[i] = 0;
237 for (int i=0; i<2; i++) fRec63[i] = 0;
214238 }
215239
216240 void Dsp::clear_state_f_static(PluginDef *p)
233257 static_cast<Dsp*>(p)->init(samplingFreq);
234258 }
235259
236 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
260 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
237261 {
238262 double fSlow0 = fslider0;
239263 double fSlow1 = exp((0 - (fConst1 / fSlow0)));
243267 double fSlow5 = (2 * (1 - fSlow4));
244268 double fSlow6 = (1.0 / fSlow3);
245269 double fSlow7 = (1 + ((fSlow6 - 1.0000000000000004) / fSlow3));
246 double fSlow8 = (1 + ((1.0000000000000004 + fSlow6) / fSlow3));
247 double fSlow9 = (1.0 / fSlow8);
248 double fSlow10 = (1 + fSlow6);
249 double fSlow11 = (0 - ((1 - fSlow6) / fSlow10));
250 double fSlow12 = tan((fConst3 * fslider2));
251 double fSlow13 = (1.0 / faustpower<2>(fSlow12));
252 double fSlow14 = (2 * (1 - fSlow13));
253 double fSlow15 = (1.0 / fSlow12);
254 double fSlow16 = (1 + ((fSlow15 - 1.0000000000000004) / fSlow12));
255 double fSlow17 = (1 + ((1.0000000000000004 + fSlow15) / fSlow12));
256 double fSlow18 = (1.0 / fSlow17);
257 double fSlow19 = (1 + fSlow15);
258 double fSlow20 = (0 - ((1 - fSlow15) / fSlow19));
259 double fSlow21 = (1.0 / fSlow19);
260 double fSlow22 = (1.0 / (fSlow17 * fSlow3));
261 double fSlow23 = (0 - fSlow6);
262 double fSlow24 = (1.0 / fSlow10);
263 double fSlow25 = (2 * (0 - fSlow4));
264 double fSlow26 = fslider3;
265 double fSlow27 = max((double)0, (fSlow26 - 1));
266 int iSlow28 = int(fSlow27);
267 double fSlow29 = exp((0 - (fConst2 / fslider4)));
268 double fSlow30 = (1.0 - fSlow29);
269 double fSlow31 = (1.0 - fSlow2);
270 double fSlow32 = fslider5;
271 double fSlow33 = (((1.0 / double(fslider6)) - 1.0) * (1.0 - fSlow1));
272 double fSlow34 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow32 - fslider7) * fabs((fSlow27 - 1))))));
273 double fSlow35 = fabs((max((double)0, (fSlow26 - 2)) - 1));
274 double fSlow36 = fslider8;
275 double fSlow37 = exp((0 - (fConst1 / fSlow36)));
276 double fSlow38 = exp((0 - (fConst2 / fSlow36)));
277 double fSlow39 = (0 - fSlow15);
278 double fSlow40 = (2 * (0 - fSlow13));
279 double fSlow41 = fslider9;
280 double fSlow42 = max((double)0, (fSlow41 - 1));
281 int iSlow43 = int(fSlow42);
282 double fSlow44 = exp((0 - (fConst2 / fslider10)));
283 double fSlow45 = (1.0 - fSlow44);
284 double fSlow46 = (1.0 - fSlow38);
285 double fSlow47 = fslider11;
286 double fSlow48 = (((1.0 / double(fslider12)) - 1.0) * (1.0 - fSlow37));
287 double fSlow49 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow47 - fslider13) * fabs((fSlow42 - 1))))));
288 double fSlow50 = fabs((max((double)0, (fSlow41 - 2)) - 1));
289 double fSlow51 = fslider14;
290 double fSlow52 = exp((0 - (fConst1 / fSlow51)));
291 double fSlow53 = exp((0 - (fConst2 / fSlow51)));
292 double fSlow54 = tan((fConst3 * fslider15));
293 double fSlow55 = (1.0 / faustpower<2>(fSlow54));
294 double fSlow56 = (2 * (1 - fSlow55));
295 double fSlow57 = (1.0 / fSlow54);
296 double fSlow58 = (1 + ((fSlow57 - 1.0000000000000004) / fSlow54));
297 double fSlow59 = (1 + ((1.0000000000000004 + fSlow57) / fSlow54));
298 double fSlow60 = (1.0 / fSlow59);
299 double fSlow61 = (1 + fSlow57);
300 double fSlow62 = (0 - ((1 - fSlow57) / fSlow61));
301 double fSlow63 = (1.0 / (fSlow8 * fSlow54));
302 double fSlow64 = (0 - fSlow57);
303 double fSlow65 = (1.0 / fSlow61);
304 double fSlow66 = (2 * (0 - fSlow55));
305 double fSlow67 = fslider16;
306 double fSlow68 = max((double)0, (fSlow67 - 1));
307 int iSlow69 = int(fSlow68);
308 double fSlow70 = exp((0 - (fConst2 / fslider17)));
309 double fSlow71 = (1.0 - fSlow70);
310 double fSlow72 = (1.0 - fSlow53);
311 double fSlow73 = fslider18;
312 double fSlow74 = (((1.0 / double(fslider19)) - 1.0) * (1.0 - fSlow52));
313 double fSlow75 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow73 - fslider20) * fabs((fSlow68 - 1))))));
314 double fSlow76 = fabs((max((double)0, (fSlow67 - 2)) - 1));
315 double fSlow77 = fslider21;
316 double fSlow78 = exp((0 - (fConst1 / fSlow77)));
317 double fSlow79 = exp((0 - (fConst2 / fSlow77)));
318 double fSlow80 = tan((fConst3 * fslider22));
319 double fSlow81 = (1.0 / faustpower<2>(fSlow80));
320 double fSlow82 = (2 * (1 - fSlow81));
321 double fSlow83 = (1.0 / fSlow80);
322 double fSlow84 = (1 + ((fSlow83 - 1.0000000000000004) / fSlow80));
323 double fSlow85 = (1.0 / (1 + ((1.0000000000000004 + fSlow83) / fSlow80)));
324 double fSlow86 = (1 + fSlow83);
325 double fSlow87 = (0 - ((1 - fSlow83) / fSlow86));
326 double fSlow88 = (1.0 / (fSlow59 * fSlow80));
327 double fSlow89 = (0 - fSlow83);
328 double fSlow90 = (1.0 / fSlow86);
329 double fSlow91 = (2 * (0 - fSlow81));
330 double fSlow92 = fslider23;
331 double fSlow93 = max((double)0, (fSlow92 - 1));
332 int iSlow94 = int(fSlow93);
333 double fSlow95 = exp((0 - (fConst2 / fslider24)));
334 double fSlow96 = (1.0 - fSlow95);
335 double fSlow97 = (1.0 - fSlow79);
336 double fSlow98 = fslider25;
337 double fSlow99 = (((1.0 / double(fslider26)) - 1.0) * (1.0 - fSlow78));
338 double fSlow100 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow98 - fslider27) * fabs((fSlow93 - 1))))));
339 double fSlow101 = fabs((max((double)0, (fSlow92 - 2)) - 1));
340 double fSlow102 = fslider28;
341 double fSlow103 = exp((0 - (fConst1 / fSlow102)));
342 double fSlow104 = exp((0 - (fConst2 / fSlow102)));
343 double fSlow105 = fslider29;
344 double fSlow106 = max((double)0, (fSlow105 - 1));
345 int iSlow107 = int(fSlow106);
346 double fSlow108 = exp((0 - (fConst2 / fslider30)));
347 double fSlow109 = (1.0 - fSlow108);
348 double fSlow110 = (1.0 - fSlow104);
349 double fSlow111 = fslider31;
350 double fSlow112 = (((1.0 / double(fslider32)) - 1.0) * (1.0 - fSlow103));
351 double fSlow113 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow111 - fslider33) * fabs((fSlow106 - 1))))));
352 double fSlow114 = fabs((max((double)0, (fSlow105 - 2)) - 1));
270 double fSlow8 = (1.0 / (1 + ((fSlow6 + 1.0000000000000004) / fSlow3)));
271 double fSlow9 = (1 + fSlow6);
272 double fSlow10 = (0 - ((1 - fSlow6) / fSlow9));
273 double fSlow11 = tan((fConst3 * fslider2));
274 double fSlow12 = (1.0 / faustpower<2>(fSlow11));
275 double fSlow13 = (2 * (1 - fSlow12));
276 double fSlow14 = (1.0 / fSlow11);
277 double fSlow15 = (1 + ((fSlow14 - 1.0000000000000004) / fSlow11));
278 double fSlow16 = (1 + ((fSlow14 + 1.0000000000000004) / fSlow11));
279 double fSlow17 = (1.0 / fSlow16);
280 double fSlow18 = (1 + fSlow14);
281 double fSlow19 = (0 - ((1 - fSlow14) / fSlow18));
282 double fSlow20 = tan((fConst3 * fslider3));
283 double fSlow21 = (1.0 / faustpower<2>(fSlow20));
284 double fSlow22 = (2 * (1 - fSlow21));
285 double fSlow23 = (1.0 / fSlow20);
286 double fSlow24 = (1 + ((fSlow23 - 1.0000000000000004) / fSlow20));
287 double fSlow25 = (1 + ((fSlow23 + 1.0000000000000004) / fSlow20));
288 double fSlow26 = (1.0 / fSlow25);
289 double fSlow27 = (1 + fSlow23);
290 double fSlow28 = (0 - ((1 - fSlow23) / fSlow27));
291 double fSlow29 = tan((fConst3 * fslider4));
292 double fSlow30 = (1.0 / faustpower<2>(fSlow29));
293 double fSlow31 = (2 * (1 - fSlow30));
294 double fSlow32 = (1.0 / fSlow29);
295 double fSlow33 = (1 + ((fSlow32 - 1.0000000000000004) / fSlow29));
296 double fSlow34 = (1 + ((1.0000000000000004 + fSlow32) / fSlow29));
297 double fSlow35 = (1.0 / fSlow34);
298 double fSlow36 = (1 + fSlow32);
299 double fSlow37 = (0 - ((1 - fSlow32) / fSlow36));
300 double fSlow38 = (1.0 / fSlow36);
301 double fSlow39 = (1.0 / fSlow27);
302 double fSlow40 = (1.0 / fSlow18);
303 double fSlow41 = (1.0 / (fSlow3 * fSlow16));
304 double fSlow42 = (0 - fSlow6);
305 double fSlow43 = (1.0 / fSlow9);
306 double fSlow44 = (2 * (0 - fSlow4));
307 double fSlow45 = fslider5;
308 double fSlow46 = max((double)0, (fSlow45 - 1));
309 int iSlow47 = int(fSlow46);
310 double fSlow48 = exp((0 - (fConst2 / fslider6)));
311 double fSlow49 = (1.0 - fSlow48);
312 double fSlow50 = (1.0 - fSlow2);
313 double fSlow51 = fslider7;
314 double fSlow52 = (((1.0 / double(fslider8)) - 1.0) * (1.0 - fSlow1));
315 double fSlow53 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow51 - fslider9) * fabs((fSlow46 - 1))))));
316 double fSlow54 = fabs((max((double)0, (fSlow45 - 2)) - 1));
317 double fSlow55 = fslider10;
318 double fSlow56 = exp((0 - (fConst1 / fSlow55)));
319 double fSlow57 = exp((0 - (fConst2 / fSlow55)));
320 double fSlow58 = fslider11;
321 double fSlow59 = max((double)0, (fSlow58 - 1));
322 int iSlow60 = int(fSlow59);
323 double fSlow61 = exp((0 - (fConst2 / fslider12)));
324 double fSlow62 = (1.0 - fSlow61);
325 double fSlow63 = (1.0 - fSlow57);
326 double fSlow64 = fslider13;
327 double fSlow65 = (((1.0 / double(fslider14)) - 1.0) * (1.0 - fSlow56));
328 double fSlow66 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow64 - fslider15) * fabs((fSlow59 - 1))))));
329 double fSlow67 = fabs((max((double)0, (fSlow58 - 2)) - 1));
330 double fSlow68 = fslider16;
331 double fSlow69 = exp((0 - (fConst1 / fSlow68)));
332 double fSlow70 = exp((0 - (fConst2 / fSlow68)));
333 double fSlow71 = (1 + ((fSlow6 - 1.0) / fSlow3));
334 double fSlow72 = (1.0 / (1 + ((1.0 + fSlow6) / fSlow3)));
335 double fSlow73 = (1.0 / (fSlow11 * fSlow25));
336 double fSlow74 = (0 - fSlow14);
337 double fSlow75 = (2 * (0 - fSlow12));
338 double fSlow76 = fslider17;
339 double fSlow77 = max((double)0, (fSlow76 - 1));
340 int iSlow78 = int(fSlow77);
341 double fSlow79 = exp((0 - (fConst2 / fslider18)));
342 double fSlow80 = (1.0 - fSlow79);
343 double fSlow81 = (1.0 - fSlow70);
344 double fSlow82 = fslider19;
345 double fSlow83 = (((1.0 / double(fslider20)) - 1.0) * (1.0 - fSlow69));
346 double fSlow84 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow82 - fslider21) * fabs((fSlow77 - 1))))));
347 double fSlow85 = fabs((max((double)0, (fSlow76 - 2)) - 1));
348 double fSlow86 = fslider22;
349 double fSlow87 = exp((0 - (fConst1 / fSlow86)));
350 double fSlow88 = exp((0 - (fConst2 / fSlow86)));
351 double fSlow89 = (1 + ((fSlow14 - 1.0) / fSlow11));
352 double fSlow90 = (1.0 / (1 + ((1.0 + fSlow14) / fSlow11)));
353 double fSlow91 = (1.0 / (fSlow20 * fSlow34));
354 double fSlow92 = (0 - fSlow23);
355 double fSlow93 = (2 * (0 - fSlow21));
356 double fSlow94 = fslider23;
357 double fSlow95 = max((double)0, (fSlow94 - 1));
358 int iSlow96 = int(fSlow95);
359 double fSlow97 = exp((0 - (fConst2 / fslider24)));
360 double fSlow98 = (1.0 - fSlow97);
361 double fSlow99 = (1.0 - fSlow88);
362 double fSlow100 = fslider25;
363 double fSlow101 = (((1.0 / double(fslider26)) - 1.0) * (1.0 - fSlow87));
364 double fSlow102 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow100 - fslider27) * fabs((fSlow95 - 1))))));
365 double fSlow103 = fabs((max((double)0, (fSlow94 - 2)) - 1));
366 double fSlow104 = fslider28;
367 double fSlow105 = exp((0 - (fConst1 / fSlow104)));
368 double fSlow106 = exp((0 - (fConst2 / fSlow104)));
369 double fSlow107 = (1 + ((fSlow23 - 1.0) / fSlow20));
370 double fSlow108 = (1.0 / (1 + ((1.0 + fSlow23) / fSlow20)));
371 double fSlow109 = (0 - fSlow32);
372 double fSlow110 = (2 * (0 - fSlow30));
373 double fSlow111 = fslider29;
374 double fSlow112 = max((double)0, (fSlow111 - 1));
375 int iSlow113 = int(fSlow112);
376 double fSlow114 = exp((0 - (fConst2 / fslider30)));
377 double fSlow115 = (1.0 - fSlow114);
378 double fSlow116 = (1.0 - fSlow106);
379 double fSlow117 = fslider31;
380 double fSlow118 = (((1.0 / double(fslider32)) - 1.0) * (1.0 - fSlow105));
381 double fSlow119 = (0.0010000000000000009 * pow(10,(0.05 * ((fSlow117 - fslider33) * fabs((fSlow112 - 1))))));
382 double fSlow120 = fabs((max((double)0, (fSlow111 - 2)) - 1));
353383 for (int i=0; i<count; i++) {
354384 double fTemp0 = (double)input0[i];
355385 fVec0[0] = fTemp0;
356 double fTemp1 = (fVec0[0] + fVec0[1]);
357 fRec6[0] = ((fSlow21 * fTemp1) + (fSlow20 * fRec6[1]));
358 fRec5[0] = (fRec6[0] - (fSlow18 * ((fSlow16 * fRec5[2]) + (fSlow14 * fRec5[1]))));
359 double fTemp2 = (fRec5[2] + (fRec5[0] + (2 * fRec5[1])));
360 fVec1[0] = (fSlow18 * fTemp2);
361 fRec4[0] = ((fSlow24 * ((fSlow23 * fVec1[1]) + (fSlow22 * fTemp2))) + (fSlow11 * fRec4[1]));
362 fRec3[0] = (fRec4[0] - (fSlow9 * ((fSlow7 * fRec3[2]) + (fSlow5 * fRec3[1]))));
363 double fTemp3 = (fSlow9 * (((fSlow4 * fRec3[0]) + (fSlow25 * fRec3[1])) + (fSlow4 * fRec3[2])));
364 double fTemp4 = ((iSlow28)?0:fTemp3);
365 double fTemp5 = (double)input1[i];
366 fVec2[0] = fTemp5;
367 double fTemp6 = (fVec2[0] + fVec2[1]);
368 fRec10[0] = ((fSlow21 * fTemp6) + (fSlow20 * fRec10[1]));
369 fRec9[0] = (fRec10[0] - (fSlow18 * ((fSlow16 * fRec9[2]) + (fSlow14 * fRec9[1]))));
370 double fTemp7 = (fRec9[2] + (fRec9[0] + (2 * fRec9[1])));
371 fVec3[0] = (fSlow18 * fTemp7);
372 fRec8[0] = ((fSlow24 * ((fSlow23 * fVec3[1]) + (fSlow22 * fTemp7))) + (fSlow11 * fRec8[1]));
373 fRec7[0] = (fRec8[0] - (fSlow9 * ((fSlow7 * fRec7[2]) + (fSlow5 * fRec7[1]))));
374 double fTemp8 = (fSlow9 * (((fSlow4 * fRec7[0]) + (fSlow25 * fRec7[1])) + (fSlow4 * fRec7[2])));
375 double fTemp9 = ((iSlow28)?0:fTemp8);
376 double fTemp10 = fabs((fabs(fTemp9) + fabs(fTemp4)));
377 fRec2[0] = ((fSlow30 * fTemp10) + (fSlow29 * max(fTemp10, fRec2[1])));
378 fRec1[0] = ((fSlow31 * fRec2[0]) + (fSlow2 * fRec1[1]));
379 fRec0[0] = ((fSlow33 * max((fSlow32 + (20 * log10(fRec1[0]))), 0.0)) + (fSlow1 * fRec0[1]));
380 double fTemp11 = pow(10,(0.05 * fRec0[0]));
381 fRec11[0] = (fSlow34 + (0.999 * fRec11[1]));
382 fRec16[0] = ((fSlow21 * ((fSlow39 * fVec0[1]) + (fSlow15 * fVec0[0]))) + (fSlow20 * fRec16[1]));
383 fRec15[0] = (fRec16[0] - (fSlow18 * ((fSlow16 * fRec15[2]) + (fSlow14 * fRec15[1]))));
384 double fTemp12 = (fSlow18 * (((fSlow13 * fRec15[0]) + (fSlow40 * fRec15[1])) + (fSlow13 * fRec15[2])));
385 double fTemp13 = ((iSlow43)?0:fTemp12);
386 fRec18[0] = ((fSlow21 * ((fSlow39 * fVec2[1]) + (fSlow15 * fVec2[0]))) + (fSlow20 * fRec18[1]));
387 fRec17[0] = (fRec18[0] - (fSlow18 * ((fSlow16 * fRec17[2]) + (fSlow14 * fRec17[1]))));
388 double fTemp14 = (fSlow18 * (((fSlow13 * fRec17[0]) + (fSlow40 * fRec17[1])) + (fSlow13 * fRec17[2])));
389 double fTemp15 = ((iSlow43)?0:fTemp14);
390 double fTemp16 = fabs((fabs(fTemp15) + fabs(fTemp13)));
391 fRec14[0] = ((fSlow45 * fTemp16) + (fSlow44 * max(fTemp16, fRec14[1])));
392 fRec13[0] = ((fSlow46 * fRec14[0]) + (fSlow38 * fRec13[1]));
393 fRec12[0] = ((fSlow48 * max((fSlow47 + (20 * log10(fRec13[0]))), 0.0)) + (fSlow37 * fRec12[1]));
394 double fTemp17 = pow(10,(0.05 * fRec12[0]));
395 fRec19[0] = (fSlow49 + (0.999 * fRec19[1]));
396 fRec26[0] = ((fSlow24 * fTemp1) + (fSlow11 * fRec26[1]));
397 fRec25[0] = (fRec26[0] - (fSlow9 * ((fSlow7 * fRec25[2]) + (fSlow5 * fRec25[1]))));
398 double fTemp18 = (fRec25[2] + (fRec25[0] + (2 * fRec25[1])));
399 fVec4[0] = (fSlow9 * fTemp18);
400 fRec24[0] = ((fSlow65 * ((fSlow64 * fVec4[1]) + (fSlow63 * fTemp18))) + (fSlow62 * fRec24[1]));
401 fRec23[0] = (fRec24[0] - (fSlow60 * ((fSlow58 * fRec23[2]) + (fSlow56 * fRec23[1]))));
402 double fTemp19 = (fSlow60 * (((fSlow55 * fRec23[0]) + (fSlow66 * fRec23[1])) + (fSlow55 * fRec23[2])));
403 double fTemp20 = ((iSlow69)?0:fTemp19);
404 fRec30[0] = ((fSlow24 * fTemp6) + (fSlow11 * fRec30[1]));
405 fRec29[0] = (fRec30[0] - (fSlow9 * ((fSlow7 * fRec29[2]) + (fSlow5 * fRec29[1]))));
406 double fTemp21 = (fRec29[2] + (fRec29[0] + (2 * fRec29[1])));
407 fVec5[0] = (fSlow9 * fTemp21);
408 fRec28[0] = ((fSlow65 * ((fSlow64 * fVec5[1]) + (fSlow63 * fTemp21))) + (fSlow62 * fRec28[1]));
409 fRec27[0] = (fRec28[0] - (fSlow60 * ((fSlow58 * fRec27[2]) + (fSlow56 * fRec27[1]))));
410 double fTemp22 = (fSlow60 * (((fSlow55 * fRec27[0]) + (fSlow66 * fRec27[1])) + (fSlow55 * fRec27[2])));
411 double fTemp23 = ((iSlow69)?0:fTemp22);
412 double fTemp24 = fabs((fabs(fTemp23) + fabs(fTemp20)));
413 fRec22[0] = ((fSlow71 * fTemp24) + (fSlow70 * max(fTemp24, fRec22[1])));
414 fRec21[0] = ((fSlow72 * fRec22[0]) + (fSlow53 * fRec21[1]));
415 fRec20[0] = ((fSlow74 * max((fSlow73 + (20 * log10(fRec21[0]))), 0.0)) + (fSlow52 * fRec20[1]));
386 fRec10[0] = ((fSlow38 * (fVec0[0] + fVec0[1])) + (fSlow37 * fRec10[1]));
387 fRec9[0] = (fRec10[0] - (fSlow35 * ((fSlow33 * fRec9[2]) + (fSlow31 * fRec9[1]))));
388 double fTemp1 = (fRec9[2] + (fRec9[0] + (2 * fRec9[1])));
389 double fTemp2 = (fSlow35 * fTemp1);
390 fVec1[0] = fTemp2;
391 fRec8[0] = ((fSlow39 * (fVec1[0] + fVec1[1])) + (fSlow28 * fRec8[1]));
392 fRec7[0] = (fRec8[0] - (fSlow26 * ((fSlow24 * fRec7[2]) + (fSlow22 * fRec7[1]))));
393 double fTemp3 = (fRec7[2] + (fRec7[0] + (2 * fRec7[1])));
394 double fTemp4 = (fSlow26 * fTemp3);
395 fVec2[0] = fTemp4;
396 fRec6[0] = ((fSlow40 * (fVec2[0] + fVec2[1])) + (fSlow19 * fRec6[1]));
397 fRec5[0] = (fRec6[0] - (fSlow17 * ((fSlow15 * fRec5[2]) + (fSlow13 * fRec5[1]))));
398 double fTemp5 = (fRec5[2] + (fRec5[0] + (2 * fRec5[1])));
399 double fTemp6 = (fSlow17 * fTemp5);
400 fVec3[0] = fTemp6;
401 fRec4[0] = ((fSlow43 * ((fSlow42 * fVec3[1]) + (fSlow41 * fTemp5))) + (fSlow10 * fRec4[1]));
402 fRec3[0] = (fRec4[0] - (fSlow8 * ((fSlow7 * fRec3[2]) + (fSlow5 * fRec3[1]))));
403 double fTemp7 = (fSlow8 * (((fSlow4 * fRec3[0]) + (fSlow44 * fRec3[1])) + (fSlow4 * fRec3[2])));
404 double fTemp8 = ((iSlow47)?0:fTemp7);
405 double fTemp9 = (double)input1[i];
406 fVec4[0] = fTemp9;
407 fRec18[0] = ((fSlow38 * (fVec4[0] + fVec4[1])) + (fSlow37 * fRec18[1]));
408 fRec17[0] = (fRec18[0] - (fSlow35 * ((fSlow33 * fRec17[2]) + (fSlow31 * fRec17[1]))));
409 double fTemp10 = (fRec17[2] + (fRec17[0] + (2 * fRec17[1])));
410 double fTemp11 = (fSlow35 * fTemp10);
411 fVec5[0] = fTemp11;
412 fRec16[0] = ((fSlow39 * (fVec5[0] + fVec5[1])) + (fSlow28 * fRec16[1]));
413 fRec15[0] = (fRec16[0] - (fSlow26 * ((fSlow24 * fRec15[2]) + (fSlow22 * fRec15[1]))));
414 double fTemp12 = (fRec15[2] + (fRec15[0] + (2 * fRec15[1])));
415 double fTemp13 = (fSlow26 * fTemp12);
416 fVec6[0] = fTemp13;
417 fRec14[0] = ((fSlow40 * (fVec6[0] + fVec6[1])) + (fSlow19 * fRec14[1]));
418 fRec13[0] = (fRec14[0] - (fSlow17 * ((fSlow15 * fRec13[2]) + (fSlow13 * fRec13[1]))));
419 double fTemp14 = (fRec13[2] + (fRec13[0] + (2 * fRec13[1])));
420 double fTemp15 = (fSlow17 * fTemp14);
421 fVec7[0] = fTemp15;
422 fRec12[0] = ((fSlow43 * ((fSlow42 * fVec7[1]) + (fSlow41 * fTemp14))) + (fSlow10 * fRec12[1]));
423 fRec11[0] = (fRec12[0] - (fSlow8 * ((fSlow7 * fRec11[2]) + (fSlow5 * fRec11[1]))));
424 double fTemp16 = (fSlow8 * (((fSlow4 * fRec11[0]) + (fSlow44 * fRec11[1])) + (fSlow4 * fRec11[2])));
425 double fTemp17 = ((iSlow47)?0:fTemp16);
426 double fTemp18 = fabs((fabs(fTemp17) + fabs(fTemp8)));
427 fRec2[0] = ((fSlow49 * fTemp18) + (fSlow48 * max(fTemp18, fRec2[1])));
428 fRec1[0] = ((fSlow50 * fRec2[0]) + (fSlow2 * fRec1[1]));
429 fRec0[0] = ((fSlow52 * max((fSlow51 + (20 * log10(fRec1[0]))), 0.0)) + (fSlow1 * fRec0[1]));
430 double fTemp19 = pow(10,(0.05 * fRec0[0]));
431 fRec19[0] = (fSlow53 + (0.999 * fRec19[1]));
432 fRec24[0] = ((fSlow43 * (fVec3[0] + fVec3[1])) + (fSlow10 * fRec24[1]));
433 fRec23[0] = (fRec24[0] - (fSlow8 * ((fSlow7 * fRec23[2]) + (fSlow5 * fRec23[1]))));
434 double fTemp20 = (fSlow8 * (fRec23[2] + (fRec23[0] + (2 * fRec23[1]))));
435 double fTemp21 = ((iSlow60)?0:fTemp20);
436 fRec26[0] = ((fSlow43 * (fVec7[0] + fVec7[1])) + (fSlow10 * fRec26[1]));
437 fRec25[0] = (fRec26[0] - (fSlow8 * ((fSlow7 * fRec25[2]) + (fSlow5 * fRec25[1]))));
438 double fTemp22 = (fSlow8 * (fRec25[2] + (fRec25[0] + (2 * fRec25[1]))));
439 double fTemp23 = ((iSlow60)?0:fTemp22);
440 double fTemp24 = fabs((fabs(fTemp23) + fabs(fTemp21)));
441 fRec22[0] = ((fSlow62 * fTemp24) + (fSlow61 * max(fTemp24, fRec22[1])));
442 fRec21[0] = ((fSlow63 * fRec22[0]) + (fSlow57 * fRec21[1]));
443 fRec20[0] = ((fSlow65 * max((fSlow64 + (20 * log10(fRec21[0]))), 0.0)) + (fSlow56 * fRec20[1]));
416444 double fTemp25 = pow(10,(0.05 * fRec20[0]));
417 fRec31[0] = (fSlow75 + (0.999 * fRec31[1]));
418 fRec38[0] = ((fSlow65 * fTemp1) + (fSlow62 * fRec38[1]));
419 fRec37[0] = (fRec38[0] - (fSlow60 * ((fSlow58 * fRec37[2]) + (fSlow56 * fRec37[1]))));
420 double fTemp26 = (fRec37[2] + (fRec37[0] + (2 * fRec37[1])));
421 fVec6[0] = (fSlow60 * fTemp26);
422 fRec36[0] = ((fSlow90 * ((fSlow89 * fVec6[1]) + (fSlow88 * fTemp26))) + (fSlow87 * fRec36[1]));
423 fRec35[0] = (fRec36[0] - (fSlow85 * ((fSlow84 * fRec35[2]) + (fSlow82 * fRec35[1]))));
424 double fTemp27 = (fSlow85 * (((fSlow81 * fRec35[0]) + (fSlow91 * fRec35[1])) + (fSlow81 * fRec35[2])));
425 double fTemp28 = ((iSlow94)?0:fTemp27);
426 fRec42[0] = ((fSlow65 * fTemp6) + (fSlow62 * fRec42[1]));
427 fRec41[0] = (fRec42[0] - (fSlow60 * ((fSlow58 * fRec41[2]) + (fSlow56 * fRec41[1]))));
428 double fTemp29 = (fRec41[2] + (fRec41[0] + (2 * fRec41[1])));
429 fVec7[0] = (fSlow60 * fTemp29);
430 fRec40[0] = ((fSlow90 * ((fSlow89 * fVec7[1]) + (fSlow88 * fTemp29))) + (fSlow87 * fRec40[1]));
431 fRec39[0] = (fRec40[0] - (fSlow85 * ((fSlow84 * fRec39[2]) + (fSlow82 * fRec39[1]))));
432 double fTemp30 = (fSlow85 * (((fSlow81 * fRec39[0]) + (fSlow91 * fRec39[1])) + (fSlow81 * fRec39[2])));
433 double fTemp31 = ((iSlow94)?0:fTemp30);
445 fRec27[0] = (fSlow66 + (0.999 * fRec27[1]));
446 double fTemp26 = (fSlow5 * fRec31[1]);
447 fRec33[0] = ((fSlow40 * ((fSlow74 * fVec2[1]) + (fSlow73 * fTemp3))) + (fSlow19 * fRec33[1]));
448 fRec32[0] = (fRec33[0] - (fSlow17 * ((fSlow15 * fRec32[2]) + (fSlow13 * fRec32[1]))));
449 fRec31[0] = ((fSlow17 * (((fSlow12 * fRec32[0]) + (fSlow75 * fRec32[1])) + (fSlow12 * fRec32[2]))) - (fSlow72 * ((fSlow71 * fRec31[2]) + fTemp26)));
450 double fTemp27 = (fRec31[2] + (fSlow72 * (fTemp26 + (fSlow71 * fRec31[0]))));
451 double fTemp28 = ((iSlow78)?0:fTemp27);
452 double fTemp29 = (fSlow5 * fRec34[1]);
453 fRec36[0] = ((fSlow40 * ((fSlow74 * fVec6[1]) + (fSlow73 * fTemp12))) + (fSlow19 * fRec36[1]));
454 fRec35[0] = (fRec36[0] - (fSlow17 * ((fSlow15 * fRec35[2]) + (fSlow13 * fRec35[1]))));
455 fRec34[0] = ((fSlow17 * (((fSlow12 * fRec35[0]) + (fSlow75 * fRec35[1])) + (fSlow12 * fRec35[2]))) - (fSlow72 * ((fSlow71 * fRec34[2]) + fTemp29)));
456 double fTemp30 = (fRec34[2] + (fSlow72 * (fTemp29 + (fSlow71 * fRec34[0]))));
457 double fTemp31 = ((iSlow78)?0:fTemp30);
434458 double fTemp32 = fabs((fabs(fTemp31) + fabs(fTemp28)));
435 fRec34[0] = ((fSlow96 * fTemp32) + (fSlow95 * max(fTemp32, fRec34[1])));
436 fRec33[0] = ((fSlow97 * fRec34[0]) + (fSlow79 * fRec33[1]));
437 fRec32[0] = ((fSlow99 * max((fSlow98 + (20 * log10(fRec33[0]))), 0.0)) + (fSlow78 * fRec32[1]));
438 double fTemp33 = pow(10,(0.05 * fRec32[0]));
439 fRec43[0] = (fSlow100 + (0.999 * fRec43[1]));
440 fRec48[0] = ((fSlow90 * fTemp1) + (fSlow87 * fRec48[1]));
441 fRec47[0] = (fRec48[0] - (fSlow85 * ((fSlow84 * fRec47[2]) + (fSlow82 * fRec47[1]))));
442 double fTemp34 = (fSlow85 * (fRec47[2] + (fRec47[0] + (2 * fRec47[1]))));
443 double fTemp35 = ((iSlow107)?0:fTemp34);
444 fRec50[0] = ((fSlow90 * fTemp6) + (fSlow87 * fRec50[1]));
445 fRec49[0] = (fRec50[0] - (fSlow85 * ((fSlow84 * fRec49[2]) + (fSlow82 * fRec49[1]))));
446 double fTemp36 = (fSlow85 * (fRec49[2] + (fRec49[0] + (2 * fRec49[1]))));
447 double fTemp37 = ((iSlow107)?0:fTemp36);
448 double fTemp38 = fabs((fabs(fTemp37) + fabs(fTemp35)));
449 fRec46[0] = ((fSlow109 * fTemp38) + (fSlow108 * max(fTemp38, fRec46[1])));
450 fRec45[0] = ((fSlow110 * fRec46[0]) + (fSlow104 * fRec45[1]));
451 fRec44[0] = ((fSlow112 * max((fSlow111 + (20 * log10(fRec45[0]))), 0.0)) + (fSlow103 * fRec44[1]));
452 double fTemp39 = pow(10,(0.05 * fRec44[0]));
453 fRec51[0] = (fSlow113 + (0.999 * fRec51[1]));
454 output0[i] = (FAUSTFLOAT)((fSlow114 * (fRec51[0] * ((iSlow107)?fTemp34:(fTemp35 * fTemp39)))) + ((fSlow101 * (fRec43[0] * ((iSlow94)?fTemp27:(fTemp28 * fTemp33)))) + ((fSlow76 * (fRec31[0] * ((iSlow69)?fTemp19:(fTemp20 * fTemp25)))) + ((fSlow50 * (fRec19[0] * ((iSlow43)?fTemp12:(fTemp13 * fTemp17)))) + (fSlow35 * (fRec11[0] * ((iSlow28)?fTemp3:(fTemp4 * fTemp11))))))));
455 output1[i] = (FAUSTFLOAT)((fSlow114 * (fRec51[0] * ((iSlow107)?fTemp36:(fTemp37 * fTemp39)))) + ((fSlow101 * (fRec43[0] * ((iSlow94)?fTemp30:(fTemp31 * fTemp33)))) + ((fSlow76 * (fRec31[0] * ((iSlow69)?fTemp22:(fTemp23 * fTemp25)))) + ((fSlow50 * (fRec19[0] * ((iSlow43)?fTemp14:(fTemp15 * fTemp17)))) + (fSlow35 * (fRec11[0] * ((iSlow28)?fTemp8:(fTemp9 * fTemp11))))))));
459 fRec30[0] = ((fSlow80 * fTemp32) + (fSlow79 * max(fTemp32, fRec30[1])));
460 fRec29[0] = ((fSlow81 * fRec30[0]) + (fSlow70 * fRec29[1]));
461 fRec28[0] = ((fSlow83 * max((fSlow82 + (20 * log10(fRec29[0]))), 0.0)) + (fSlow69 * fRec28[1]));
462 double fTemp33 = pow(10,(0.05 * fRec28[0]));
463 fRec37[0] = (fSlow84 + (0.999 * fRec37[1]));
464 double fTemp34 = (fSlow5 * fRec41[1]);
465 double fTemp35 = (fSlow13 * fRec42[1]);
466 fRec44[0] = ((fSlow39 * ((fSlow92 * fVec1[1]) + (fSlow91 * fTemp1))) + (fSlow28 * fRec44[1]));
467 fRec43[0] = (fRec44[0] - (fSlow26 * ((fSlow24 * fRec43[2]) + (fSlow22 * fRec43[1]))));
468 fRec42[0] = ((fSlow26 * (((fSlow21 * fRec43[0]) + (fSlow93 * fRec43[1])) + (fSlow21 * fRec43[2]))) - (fSlow90 * ((fSlow89 * fRec42[2]) + fTemp35)));
469 fRec41[0] = ((fRec42[2] + (fSlow90 * (fTemp35 + (fSlow89 * fRec42[0])))) - (fSlow72 * ((fSlow71 * fRec41[2]) + fTemp34)));
470 double fTemp36 = (fRec41[2] + (fSlow72 * (fTemp34 + (fSlow71 * fRec41[0]))));
471 double fTemp37 = ((iSlow96)?0:fTemp36);
472 double fTemp38 = (fSlow5 * fRec45[1]);
473 double fTemp39 = (fSlow13 * fRec46[1]);
474 fRec48[0] = ((fSlow39 * ((fSlow92 * fVec5[1]) + (fSlow91 * fTemp10))) + (fSlow28 * fRec48[1]));
475 fRec47[0] = (fRec48[0] - (fSlow26 * ((fSlow24 * fRec47[2]) + (fSlow22 * fRec47[1]))));
476 fRec46[0] = ((fSlow26 * (((fSlow21 * fRec47[0]) + (fSlow93 * fRec47[1])) + (fSlow21 * fRec47[2]))) - (fSlow90 * ((fSlow89 * fRec46[2]) + fTemp39)));
477 fRec45[0] = ((fRec46[2] + (fSlow90 * (fTemp39 + (fSlow89 * fRec46[0])))) - (fSlow72 * ((fSlow71 * fRec45[2]) + fTemp38)));
478 double fTemp40 = (fRec45[2] + (fSlow72 * (fTemp38 + (fSlow71 * fRec45[0]))));
479 double fTemp41 = ((iSlow96)?0:fTemp40);
480 double fTemp42 = fabs((fabs(fTemp41) + fabs(fTemp37)));
481 fRec40[0] = ((fSlow98 * fTemp42) + (fSlow97 * max(fTemp42, fRec40[1])));
482 fRec39[0] = ((fSlow99 * fRec40[0]) + (fSlow88 * fRec39[1]));
483 fRec38[0] = ((fSlow101 * max((fSlow100 + (20 * log10(fRec39[0]))), 0.0)) + (fSlow87 * fRec38[1]));
484 double fTemp43 = pow(10,(0.05 * fRec38[0]));
485 fRec49[0] = (fSlow102 + (0.999 * fRec49[1]));
486 double fTemp44 = (fSlow5 * fRec53[1]);
487 double fTemp45 = (fSlow13 * fRec54[1]);
488 double fTemp46 = (fSlow22 * fRec55[1]);
489 fRec57[0] = ((fSlow38 * ((fSlow109 * fVec0[1]) + (fSlow32 * fVec0[0]))) + (fSlow37 * fRec57[1]));
490 fRec56[0] = (fRec57[0] - (fSlow35 * ((fSlow33 * fRec56[2]) + (fSlow31 * fRec56[1]))));
491 fRec55[0] = ((fSlow35 * (((fSlow30 * fRec56[0]) + (fSlow110 * fRec56[1])) + (fSlow30 * fRec56[2]))) - (fSlow108 * ((fSlow107 * fRec55[2]) + fTemp46)));
492 fRec54[0] = ((fRec55[2] + (fSlow108 * (fTemp46 + (fSlow107 * fRec55[0])))) - (fSlow90 * ((fSlow89 * fRec54[2]) + fTemp45)));
493 fRec53[0] = ((fRec54[2] + (fSlow90 * (fTemp45 + (fSlow89 * fRec54[0])))) - (fSlow72 * ((fSlow71 * fRec53[2]) + fTemp44)));
494 double fTemp47 = (fRec53[2] + (fSlow72 * (fTemp44 + (fSlow71 * fRec53[0]))));
495 double fTemp48 = ((iSlow113)?0:fTemp47);
496 double fTemp49 = (fSlow5 * fRec58[1]);
497 double fTemp50 = (fSlow13 * fRec59[1]);
498 double fTemp51 = (fSlow22 * fRec60[1]);
499 fRec62[0] = ((fSlow38 * ((fSlow109 * fVec4[1]) + (fSlow32 * fVec4[0]))) + (fSlow37 * fRec62[1]));
500 fRec61[0] = (fRec62[0] - (fSlow35 * ((fSlow33 * fRec61[2]) + (fSlow31 * fRec61[1]))));
501 fRec60[0] = ((fSlow35 * (((fSlow30 * fRec61[0]) + (fSlow110 * fRec61[1])) + (fSlow30 * fRec61[2]))) - (fSlow108 * ((fSlow107 * fRec60[2]) + fTemp51)));
502 fRec59[0] = ((fRec60[2] + (fSlow108 * (fTemp51 + (fSlow107 * fRec60[0])))) - (fSlow90 * ((fSlow89 * fRec59[2]) + fTemp50)));
503 fRec58[0] = ((fRec59[2] + (fSlow90 * (fTemp50 + (fSlow89 * fRec59[0])))) - (fSlow72 * ((fSlow71 * fRec58[2]) + fTemp49)));
504 double fTemp52 = (fRec58[2] + (fSlow72 * (fTemp49 + (fSlow71 * fRec58[0]))));
505 double fTemp53 = ((iSlow113)?0:fTemp52);
506 double fTemp54 = fabs((fabs(fTemp53) + fabs(fTemp48)));
507 fRec52[0] = ((fSlow115 * fTemp54) + (fSlow114 * max(fTemp54, fRec52[1])));
508 fRec51[0] = ((fSlow116 * fRec52[0]) + (fSlow106 * fRec51[1]));
509 fRec50[0] = ((fSlow118 * max((fSlow117 + (20 * log10(fRec51[0]))), 0.0)) + (fSlow105 * fRec50[1]));
510 double fTemp55 = pow(10,(0.05 * fRec50[0]));
511 fRec63[0] = (fSlow119 + (0.999 * fRec63[1]));
512 output0[i] = (FAUSTFLOAT)((fSlow120 * (fRec63[0] * ((iSlow113)?fTemp47:(fTemp48 * fTemp55)))) + ((fSlow103 * (fRec49[0] * ((iSlow96)?fTemp36:(fTemp37 * fTemp43)))) + ((fSlow85 * (fRec37[0] * ((iSlow78)?fTemp27:(fTemp28 * fTemp33)))) + ((fSlow67 * (fRec27[0] * ((iSlow60)?fTemp20:(fTemp21 * fTemp25)))) + (fSlow54 * (fRec19[0] * ((iSlow47)?fTemp7:(fTemp8 * fTemp19))))))));
513 output1[i] = (FAUSTFLOAT)((fSlow120 * (fRec63[0] * ((iSlow113)?fTemp52:(fTemp53 * fTemp55)))) + ((fSlow103 * (fRec49[0] * ((iSlow96)?fTemp40:(fTemp41 * fTemp43)))) + ((fSlow85 * (fRec37[0] * ((iSlow78)?fTemp30:(fTemp31 * fTemp33)))) + ((fSlow67 * (fRec27[0] * ((iSlow60)?fTemp22:(fTemp23 * fTemp25)))) + (fSlow54 * (fRec19[0] * ((iSlow47)?fTemp16:(fTemp17 * fTemp19))))))));
456514 // post processing
515 fRec63[1] = fRec63[0];
516 fRec50[1] = fRec50[0];
457517 fRec51[1] = fRec51[0];
458 fRec44[1] = fRec44[0];
459 fRec45[1] = fRec45[0];
460 fRec46[1] = fRec46[0];
461 fRec49[2] = fRec49[1]; fRec49[1] = fRec49[0];
462 fRec50[1] = fRec50[0];
518 fRec52[1] = fRec52[0];
519 fRec58[2] = fRec58[1]; fRec58[1] = fRec58[0];
520 fRec59[2] = fRec59[1]; fRec59[1] = fRec59[0];
521 fRec60[2] = fRec60[1]; fRec60[1] = fRec60[0];
522 fRec61[2] = fRec61[1]; fRec61[1] = fRec61[0];
523 fRec62[1] = fRec62[0];
524 fRec53[2] = fRec53[1]; fRec53[1] = fRec53[0];
525 fRec54[2] = fRec54[1]; fRec54[1] = fRec54[0];
526 fRec55[2] = fRec55[1]; fRec55[1] = fRec55[0];
527 fRec56[2] = fRec56[1]; fRec56[1] = fRec56[0];
528 fRec57[1] = fRec57[0];
529 fRec49[1] = fRec49[0];
530 fRec38[1] = fRec38[0];
531 fRec39[1] = fRec39[0];
532 fRec40[1] = fRec40[0];
533 fRec45[2] = fRec45[1]; fRec45[1] = fRec45[0];
534 fRec46[2] = fRec46[1]; fRec46[1] = fRec46[0];
463535 fRec47[2] = fRec47[1]; fRec47[1] = fRec47[0];
464536 fRec48[1] = fRec48[0];
465 fRec43[1] = fRec43[0];
466 fRec32[1] = fRec32[0];
467 fRec33[1] = fRec33[0];
468 fRec34[1] = fRec34[0];
469 fRec39[2] = fRec39[1]; fRec39[1] = fRec39[0];
470 fRec40[1] = fRec40[0];
471 fVec7[1] = fVec7[0];
472537 fRec41[2] = fRec41[1]; fRec41[1] = fRec41[0];
473 fRec42[1] = fRec42[0];
538 fRec42[2] = fRec42[1]; fRec42[1] = fRec42[0];
539 fRec43[2] = fRec43[1]; fRec43[1] = fRec43[0];
540 fRec44[1] = fRec44[0];
541 fRec37[1] = fRec37[0];
542 fRec28[1] = fRec28[0];
543 fRec29[1] = fRec29[0];
544 fRec30[1] = fRec30[0];
545 fRec34[2] = fRec34[1]; fRec34[1] = fRec34[0];
474546 fRec35[2] = fRec35[1]; fRec35[1] = fRec35[0];
475547 fRec36[1] = fRec36[0];
476 fVec6[1] = fVec6[0];
477 fRec37[2] = fRec37[1]; fRec37[1] = fRec37[0];
478 fRec38[1] = fRec38[0];
479 fRec31[1] = fRec31[0];
548 fRec31[2] = fRec31[1]; fRec31[1] = fRec31[0];
549 fRec32[2] = fRec32[1]; fRec32[1] = fRec32[0];
550 fRec33[1] = fRec33[0];
551 fRec27[1] = fRec27[0];
480552 fRec20[1] = fRec20[0];
481553 fRec21[1] = fRec21[0];
482554 fRec22[1] = fRec22[0];
483 fRec27[2] = fRec27[1]; fRec27[1] = fRec27[0];
484 fRec28[1] = fRec28[0];
485 fVec5[1] = fVec5[0];
486 fRec29[2] = fRec29[1]; fRec29[1] = fRec29[0];
487 fRec30[1] = fRec30[0];
555 fRec25[2] = fRec25[1]; fRec25[1] = fRec25[0];
556 fRec26[1] = fRec26[0];
488557 fRec23[2] = fRec23[1]; fRec23[1] = fRec23[0];
489558 fRec24[1] = fRec24[0];
490 fVec4[1] = fVec4[0];
491 fRec25[2] = fRec25[1]; fRec25[1] = fRec25[0];
492 fRec26[1] = fRec26[0];
493559 fRec19[1] = fRec19[0];
494 fRec12[1] = fRec12[0];
495 fRec13[1] = fRec13[0];
496 fRec14[1] = fRec14[0];
497 fRec17[2] = fRec17[1]; fRec17[1] = fRec17[0];
498 fRec18[1] = fRec18[0];
499 fRec15[2] = fRec15[1]; fRec15[1] = fRec15[0];
500 fRec16[1] = fRec16[0];
501 fRec11[1] = fRec11[0];
502560 fRec0[1] = fRec0[0];
503561 fRec1[1] = fRec1[0];
504562 fRec2[1] = fRec2[0];
563 fRec11[2] = fRec11[1]; fRec11[1] = fRec11[0];
564 fRec12[1] = fRec12[0];
565 fVec7[1] = fVec7[0];
566 fRec13[2] = fRec13[1]; fRec13[1] = fRec13[0];
567 fRec14[1] = fRec14[0];
568 fVec6[1] = fVec6[0];
569 fRec15[2] = fRec15[1]; fRec15[1] = fRec15[0];
570 fRec16[1] = fRec16[0];
571 fVec5[1] = fVec5[0];
572 fRec17[2] = fRec17[1]; fRec17[1] = fRec17[0];
573 fRec18[1] = fRec18[0];
574 fVec4[1] = fVec4[0];
575 fRec3[2] = fRec3[1]; fRec3[1] = fRec3[0];
576 fRec4[1] = fRec4[0];
577 fVec3[1] = fVec3[0];
578 fRec5[2] = fRec5[1]; fRec5[1] = fRec5[0];
579 fRec6[1] = fRec6[0];
580 fVec2[1] = fVec2[0];
505581 fRec7[2] = fRec7[1]; fRec7[1] = fRec7[0];
506582 fRec8[1] = fRec8[0];
507 fVec3[1] = fVec3[0];
583 fVec1[1] = fVec1[0];
508584 fRec9[2] = fRec9[1]; fRec9[1] = fRec9[0];
509585 fRec10[1] = fRec10[0];
510 fVec2[1] = fVec2[0];
511 fRec3[2] = fRec3[1]; fRec3[1] = fRec3[0];
512 fRec4[1] = fRec4[0];
513 fVec1[1] = fVec1[0];
514 fRec5[2] = fRec5[1]; fRec5[1] = fRec5[0];
515 fRec6[1] = fRec6[0];
516586 fVec0[1] = fVec0[0];
517587 }
518588 }
519589
520 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *p)
590 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
521591 {
522592 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
523593 }
524594
525595 int Dsp::register_par(const ParamReg& reg)
526596 {
597 static const value_pair fslider11_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
598 reg.registerEnumVar("mbcs.Mode1","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider11_values,&fslider11, 1.0, 1.0, 3.0, 1.0);
599 static const value_pair fslider5_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
600 reg.registerEnumVar("mbcs.Mode2","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider5_values,&fslider5, 1.0, 1.0, 3.0, 1.0);
601 static const value_pair fslider17_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
602 reg.registerEnumVar("mbcs.Mode3","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider17_values,&fslider17, 1.0, 1.0, 3.0, 1.0);
603 static const value_pair fslider23_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
604 reg.registerEnumVar("mbcs.Mode4","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider23_values,&fslider23, 1.0, 1.0, 3.0, 1.0);
527605 static const value_pair fslider29_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
528 reg.registerEnumVar("mbcs.Mode1","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider29_values,&fslider29, 1.0, 1.0, 3.0, 1.0);
529 static const value_pair fslider23_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
530 reg.registerEnumVar("mbcs.Mode2","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider23_values,&fslider23, 1.0, 1.0, 3.0, 1.0);
531 static const value_pair fslider16_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
532 reg.registerEnumVar("mbcs.Mode3","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider16_values,&fslider16, 1.0, 1.0, 3.0, 1.0);
533 static const value_pair fslider3_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
534 reg.registerEnumVar("mbcs.Mode4","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider3_values,&fslider3, 1.0, 1.0, 3.0, 1.0);
535 static const value_pair fslider9_values[] = {{"Compress"},{"Bypass"},{"Mute"},{0}};
536 reg.registerEnumVar("mbcs.Mode5","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider9_values,&fslider9, 1.0, 1.0, 3.0, 1.0);
537 reg.registerVar("mbcs.Makeup1","","S",N_("Post amplification and threshold"),&fslider31, 13.0, -5e+01, 5e+01, 0.1);
538 reg.registerVar("mbcs.Makeup2","","S",N_("Post amplification and threshold"),&fslider25, 1e+01, -5e+01, 5e+01, 0.1);
539 reg.registerVar("mbcs.Makeup3","","S",N_("Post amplification and threshold"),&fslider18, 4.0, -5e+01, 5e+01, 0.1);
540 reg.registerVar("mbcs.Makeup4","","S",N_("Post amplification and threshold"),&fslider5, 8.0, -5e+01, 5e+01, 0.1);
541 reg.registerVar("mbcs.Makeup5","","S",N_("Post amplification and threshold"),&fslider11, 11.0, -5e+01, 5e+01, 0.1);
542 reg.registerVar("mbcs.Makeup-Threshold1","","S",N_("Threshold correction, an anticlip measure"),&fslider33, 2.0, 0.0, 1e+01, 0.1);
543 reg.registerVar("mbcs.Makeup-Threshold2","","S",N_("Threshold correction, an anticlip measure"),&fslider27, 2.0, 0.0, 1e+01, 0.1);
544 reg.registerVar("mbcs.Makeup-Threshold3","","S",N_("Threshold correction, an anticlip measure"),&fslider20, 2.0, 0.0, 1e+01, 0.1);
545 reg.registerVar("mbcs.Makeup-Threshold4","","S",N_("Threshold correction, an anticlip measure"),&fslider7, 2.0, 0.0, 1e+01, 0.1);
546 reg.registerVar("mbcs.Makeup-Threshold5","","S",N_("Threshold correction, an anticlip measure"),&fslider13, 2.0, 0.0, 1e+01, 0.1);
547 reg.registerVar("mbcs.Ratio1","","S",N_("Compression ratio"),&fslider32, 2.0, 1.0, 1e+02, 0.1);
548 reg.registerVar("mbcs.Ratio2","","S",N_("Compression ratio"),&fslider26, 2.0, 1.0, 1e+02, 0.1);
549 reg.registerVar("mbcs.Ratio3","","S",N_("Compression ratio"),&fslider19, 2.0, 1.0, 1e+02, 0.1);
550 reg.registerVar("mbcs.Ratio4","","S",N_("Compression ratio"),&fslider6, 2.0, 1.0, 1e+02, 0.1);
551 reg.registerVar("mbcs.Ratio5","","S",N_("Compression ratio"),&fslider12, 2.0, 1.0, 1e+02, 0.1);
552 reg.registerVar("mbcs.Attack1","","S",N_("Time before the compressor starts to kick in"),&fslider28, 0.012, 0.0, 1.0, 0.001);
553 reg.registerVar("mbcs.Attack2","","S",N_("Time before the compressor starts to kick in"),&fslider21, 0.012, 0.0, 1.0, 0.001);
554 reg.registerVar("mbcs.Attack3","","S",N_("Time before the compressor starts to kick in"),&fslider14, 0.012, 0.0, 1.0, 0.001);
555 reg.registerVar("mbcs.Attack4","","S",N_("Time before the compressor starts to kick in"),&fslider0, 0.012, 0.0, 1.0, 0.001);
556 reg.registerVar("mbcs.Attack5","","S",N_("Time before the compressor starts to kick in"),&fslider8, 0.012, 0.0, 1.0, 0.001);
557 reg.registerVar("mbcs.Release1","","S",N_("Time before the compressor releases the sound"),&fslider30, 1.25, 0.0, 1e+01, 0.01);
558 reg.registerVar("mbcs.Release2","","S",N_("Time before the compressor releases the sound"),&fslider24, 1.25, 0.0, 1e+01, 0.01);
559 reg.registerVar("mbcs.Release3","","S",N_("Time before the compressor releases the sound"),&fslider17, 1.25, 0.0, 1e+01, 0.01);
560 reg.registerVar("mbcs.Release4","","S",N_("Time before the compressor releases the sound"),&fslider4, 1.25, 0.0, 1e+01, 0.01);
561 reg.registerVar("mbcs.Release5","","S",N_("Time before the compressor releases the sound"),&fslider10, 1.25, 0.0, 1e+01, 0.01);
562 reg.registerVar("mbcs.crossover_b1_b2",N_("Crossover B1-B2 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider22, 8e+01, 2e+01, 2e+04, 1.08);
563 reg.registerVar("mbcs.crossover_b2_b3",N_("Crossover B2-B3 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider15, 2.1e+02, 2e+01, 2e+04, 1.08);
564 reg.registerVar("mbcs.crossover_b3_b4",N_("Crossover B3-B4 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider1, 1.7e+03, 2e+01, 2e+04, 1.08);
565 reg.registerVar("mbcs.crossover_b4_b5",N_("Crossover B4-B5 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider2, 5e+03, 2e+01, 2e+04, 1.08);
606 reg.registerEnumVar("mbcs.Mode5","","S",N_("Compress or Mute the selected band, or Bypass The Compressor"),fslider29_values,&fslider29, 1.0, 1.0, 3.0, 1.0);
607 reg.registerVar("mbcs.Makeup1","","S",N_("Post amplification and threshold"),&fslider13, 13.0, -5e+01, 5e+01, 0.1);
608 reg.registerVar("mbcs.Makeup2","","S",N_("Post amplification and threshold"),&fslider7, 1e+01, -5e+01, 5e+01, 0.1);
609 reg.registerVar("mbcs.Makeup3","","S",N_("Post amplification and threshold"),&fslider19, 4.0, -5e+01, 5e+01, 0.1);
610 reg.registerVar("mbcs.Makeup4","","S",N_("Post amplification and threshold"),&fslider25, 8.0, -5e+01, 5e+01, 0.1);
611 reg.registerVar("mbcs.Makeup5","","S",N_("Post amplification and threshold"),&fslider31, 11.0, -5e+01, 5e+01, 0.1);
612 reg.registerVar("mbcs.Makeup-Threshold1","","S",N_("Threshold correction, an anticlip measure"),&fslider15, 2.0, 0.0, 1e+01, 0.1);
613 reg.registerVar("mbcs.Makeup-Threshold2","","S",N_("Threshold correction, an anticlip measure"),&fslider9, 2.0, 0.0, 1e+01, 0.1);
614 reg.registerVar("mbcs.Makeup-Threshold3","","S",N_("Threshold correction, an anticlip measure"),&fslider21, 2.0, 0.0, 1e+01, 0.1);
615 reg.registerVar("mbcs.Makeup-Threshold4","","S",N_("Threshold correction, an anticlip measure"),&fslider27, 2.0, 0.0, 1e+01, 0.1);
616 reg.registerVar("mbcs.Makeup-Threshold5","","S",N_("Threshold correction, an anticlip measure"),&fslider33, 2.0, 0.0, 1e+01, 0.1);
617 reg.registerVar("mbcs.Ratio1","","S",N_("Compression ratio"),&fslider14, 2.0, 1.0, 1e+02, 0.1);
618 reg.registerVar("mbcs.Ratio2","","S",N_("Compression ratio"),&fslider8, 2.0, 1.0, 1e+02, 0.1);
619 reg.registerVar("mbcs.Ratio3","","S",N_("Compression ratio"),&fslider20, 2.0, 1.0, 1e+02, 0.1);
620 reg.registerVar("mbcs.Ratio4","","S",N_("Compression ratio"),&fslider26, 2.0, 1.0, 1e+02, 0.1);
621 reg.registerVar("mbcs.Ratio5","","S",N_("Compression ratio"),&fslider32, 2.0, 1.0, 1e+02, 0.1);
622 reg.registerVar("mbcs.Attack1","","S",N_("Time before the compressor starts to kick in"),&fslider10, 0.012, 0.001, 1.0, 0.001);
623 reg.registerVar("mbcs.Attack2","","S",N_("Time before the compressor starts to kick in"),&fslider0, 0.012, 0.001, 1.0, 0.001);
624 reg.registerVar("mbcs.Attack3","","S",N_("Time before the compressor starts to kick in"),&fslider16, 0.012, 0.001, 1.0, 0.001);
625 reg.registerVar("mbcs.Attack4","","S",N_("Time before the compressor starts to kick in"),&fslider22, 0.012, 0.001, 1.0, 0.001);
626 reg.registerVar("mbcs.Attack5","","S",N_("Time before the compressor starts to kick in"),&fslider28, 0.012, 0.001, 1.0, 0.001);
627 reg.registerVar("mbcs.Release1","","S",N_("Time before the compressor releases the sound"),&fslider12, 1.25, 0.01, 1e+01, 0.01);
628 reg.registerVar("mbcs.Release2","","S",N_("Time before the compressor releases the sound"),&fslider6, 1.25, 0.01, 1e+01, 0.01);
629 reg.registerVar("mbcs.Release3","","S",N_("Time before the compressor releases the sound"),&fslider18, 1.25, 0.01, 1e+01, 0.01);
630 reg.registerVar("mbcs.Release4","","S",N_("Time before the compressor releases the sound"),&fslider24, 1.25, 0.01, 1e+01, 0.01);
631 reg.registerVar("mbcs.Release5","","S",N_("Time before the compressor releases the sound"),&fslider30, 1.25, 0.01, 1e+01, 0.01);
632 reg.registerVar("mbcs.crossover_b1_b2",N_("Crossover B1-B2 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider1, 8e+01, 2e+01, 2e+04, 1.08);
633 reg.registerVar("mbcs.crossover_b2_b3",N_("Crossover B2-B3 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider2, 2.1e+02, 2e+01, 2e+04, 1.08);
634 reg.registerVar("mbcs.crossover_b3_b4",N_("Crossover B3-B4 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider3, 1.7e+03, 2e+01, 2e+04, 1.08);
635 reg.registerVar("mbcs.crossover_b4_b5",N_("Crossover B4-B5 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider4, 5e+03, 2e+01, 2e+04, 1.08);
566636 return 0;
567637 }
568638
585655 b.openTabBox("");
586656
587657 b.openHorizontalBox(N_("Band 1"));
658 b.openpaintampBox("");
588659 b.openVerticalBox("");
589660 b.openHorizontalBox("");
590661 b.set_next_flags(UI_NUM_RIGHT);
602673 b.closeBox();
603674 b.closeBox();
604675 b.closeBox();
676 b.closeBox();
605677
606678 b.openHorizontalBox(N_("Band 2"));
679 b.openpaintampBox("");
607680 b.openVerticalBox("");
608681 b.openHorizontalBox("");
609682 b.set_next_flags(UI_NUM_RIGHT);
623696 b.closeBox();
624697 b.closeBox();
625698 b.closeBox();
699 b.closeBox();
626700
627701 b.openHorizontalBox(N_("Band 3"));
702 b.openpaintampBox("");
628703 b.openVerticalBox("");
629704 b.openHorizontalBox("");
630705 b.set_next_flags(UI_NUM_RIGHT);
644719 b.closeBox();
645720 b.closeBox();
646721 b.closeBox();
722 b.closeBox();
647723
648724 b.openHorizontalBox(N_("Band 4"));
725 b.openpaintampBox("");
649726 b.openVerticalBox("");
650727 b.openHorizontalBox("");
651728 b.set_next_flags(UI_NUM_RIGHT);
665742 b.closeBox();
666743 b.closeBox();
667744 b.closeBox();
745 b.closeBox();
668746
669747 b.openHorizontalBox(N_("Band 5"));
748 b.openpaintampBox("");
670749 b.openVerticalBox("");
671750 b.openHorizontalBox("");
672751 b.set_next_flags(UI_NUM_RIGHT);
684763 b.closeBox();
685764 b.closeBox();
686765 b.closeBox();
766 b.closeBox();
687767
688768 b.closeBox();
689769 b.closeBox();
0 // generated from file '../src/plugins/mbd.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.58 (http://faust.grame.fr)
2
3 #include "gx_faust_support.h"
4 #include "gx_plugin.h"
5
6 namespace pluginlib {
7 namespace mbd {
8
9 class Dsp: public PluginDef {
10 private:
11 int fSamplingFreq;
12 int iVec0[2];
13 FAUSTFLOAT fslider0;
14 double fRec0[2];
15 int iConst0;
16 double fConst1;
17 FAUSTFLOAT fslider1;
18 double fConst2;
19 FAUSTFLOAT fslider2;
20 FAUSTFLOAT fslider3;
21 FAUSTFLOAT fslider4;
22 double fRec14[2];
23 double fVec1[2];
24 double fRec13[2];
25 double fRec12[3];
26 double fVec2[2];
27 double fRec11[2];
28 double fRec10[3];
29 double fVec3[2];
30 double fRec9[2];
31 double fRec8[3];
32 double fVec4[2];
33 double fRec7[2];
34 double fRec6[3];
35 FAUSTFLOAT fslider5;
36 FAUSTFLOAT fslider6;
37 double fRec15[2];
38 double fVec5[2];
39 double fRec5[2];
40 double fRec1[2];
41 int iRec2[2];
42 double fRec3[2];
43 FAUSTFLOAT fbargraph0;
44 double fRec22[2];
45 double fRec21[3];
46 FAUSTFLOAT fslider7;
47 FAUSTFLOAT fslider8;
48 double fRec23[2];
49 double fVec6[2];
50 double fRec20[2];
51 double fRec16[2];
52 int iRec17[2];
53 double fRec18[2];
54 FAUSTFLOAT fbargraph1;
55 double fRec31[2];
56 double fRec30[3];
57 double fRec29[3];
58 FAUSTFLOAT fslider9;
59 FAUSTFLOAT fslider10;
60 double fRec32[2];
61 double fVec7[2];
62 double fRec28[2];
63 double fRec24[2];
64 int iRec25[2];
65 double fRec26[2];
66 FAUSTFLOAT fbargraph2;
67 double fRec41[2];
68 double fRec40[3];
69 double fRec39[3];
70 double fRec38[3];
71 FAUSTFLOAT fslider11;
72 FAUSTFLOAT fslider12;
73 double fRec42[2];
74 double fVec8[2];
75 double fRec37[2];
76 double fRec33[2];
77 int iRec34[2];
78 double fRec35[2];
79 FAUSTFLOAT fbargraph3;
80 double fRec52[2];
81 double fRec51[3];
82 double fRec50[3];
83 double fRec49[3];
84 double fRec48[3];
85 FAUSTFLOAT fslider13;
86 FAUSTFLOAT fslider14;
87 double fRec53[2];
88 double fVec9[2];
89 double fRec47[2];
90 double fRec43[2];
91 int iRec44[2];
92 double fRec45[2];
93 FAUSTFLOAT fbargraph4;
94 void clear_state_f();
95 int load_ui_f(const UiBuilder& b, int form);
96 void init(unsigned int samplingFreq);
97 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
98 int register_par(const ParamReg& reg);
99
100 static void clear_state_f_static(PluginDef*);
101 static int load_ui_f_static(const UiBuilder& b, int form);
102 static void init_static(unsigned int samplingFreq, PluginDef*);
103 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
104 static int register_params_static(const ParamReg& reg);
105 static void del_instance(PluginDef *p);
106 public:
107 Dsp();
108 ~Dsp();
109 };
110
111
112
113 Dsp::Dsp()
114 : PluginDef() {
115 version = PLUGINDEF_VERSION;
116 flags = 0;
117 id = "mbd";
118 name = N_("MultiBand Distortion");
119 groups = 0;
120 description = N_("MultiBand Distortion"); // description (tooltip)
121 category = N_("Distortion"); // category
122 shortname = N_("MB Distortion"); // shortname
123 mono_audio = compute_static;
124 stereo_audio = 0;
125 set_samplerate = init_static;
126 activate_plugin = 0;
127 register_params = register_params_static;
128 load_ui = load_ui_f_static;
129 clear_state = clear_state_f_static;
130 delete_instance = del_instance;
131 }
132
133 Dsp::~Dsp() {
134 }
135
136 inline void Dsp::clear_state_f()
137 {
138 for (int i=0; i<2; i++) iVec0[i] = 0;
139 for (int i=0; i<2; i++) fRec0[i] = 0;
140 for (int i=0; i<2; i++) fRec14[i] = 0;
141 for (int i=0; i<2; i++) fVec1[i] = 0;
142 for (int i=0; i<2; i++) fRec13[i] = 0;
143 for (int i=0; i<3; i++) fRec12[i] = 0;
144 for (int i=0; i<2; i++) fVec2[i] = 0;
145 for (int i=0; i<2; i++) fRec11[i] = 0;
146 for (int i=0; i<3; i++) fRec10[i] = 0;
147 for (int i=0; i<2; i++) fVec3[i] = 0;
148 for (int i=0; i<2; i++) fRec9[i] = 0;
149 for (int i=0; i<3; i++) fRec8[i] = 0;
150 for (int i=0; i<2; i++) fVec4[i] = 0;
151 for (int i=0; i<2; i++) fRec7[i] = 0;
152 for (int i=0; i<3; i++) fRec6[i] = 0;
153 for (int i=0; i<2; i++) fRec15[i] = 0;
154 for (int i=0; i<2; i++) fVec5[i] = 0;
155 for (int i=0; i<2; i++) fRec5[i] = 0;
156 for (int i=0; i<2; i++) fRec1[i] = 0;
157 for (int i=0; i<2; i++) iRec2[i] = 0;
158 for (int i=0; i<2; i++) fRec3[i] = 0;
159 for (int i=0; i<2; i++) fRec22[i] = 0;
160 for (int i=0; i<3; i++) fRec21[i] = 0;
161 for (int i=0; i<2; i++) fRec23[i] = 0;
162 for (int i=0; i<2; i++) fVec6[i] = 0;
163 for (int i=0; i<2; i++) fRec20[i] = 0;
164 for (int i=0; i<2; i++) fRec16[i] = 0;
165 for (int i=0; i<2; i++) iRec17[i] = 0;
166 for (int i=0; i<2; i++) fRec18[i] = 0;
167 for (int i=0; i<2; i++) fRec31[i] = 0;
168 for (int i=0; i<3; i++) fRec30[i] = 0;
169 for (int i=0; i<3; i++) fRec29[i] = 0;
170 for (int i=0; i<2; i++) fRec32[i] = 0;
171 for (int i=0; i<2; i++) fVec7[i] = 0;
172 for (int i=0; i<2; i++) fRec28[i] = 0;
173 for (int i=0; i<2; i++) fRec24[i] = 0;
174 for (int i=0; i<2; i++) iRec25[i] = 0;
175 for (int i=0; i<2; i++) fRec26[i] = 0;
176 for (int i=0; i<2; i++) fRec41[i] = 0;
177 for (int i=0; i<3; i++) fRec40[i] = 0;
178 for (int i=0; i<3; i++) fRec39[i] = 0;
179 for (int i=0; i<3; i++) fRec38[i] = 0;
180 for (int i=0; i<2; i++) fRec42[i] = 0;
181 for (int i=0; i<2; i++) fVec8[i] = 0;
182 for (int i=0; i<2; i++) fRec37[i] = 0;
183 for (int i=0; i<2; i++) fRec33[i] = 0;
184 for (int i=0; i<2; i++) iRec34[i] = 0;
185 for (int i=0; i<2; i++) fRec35[i] = 0;
186 for (int i=0; i<2; i++) fRec52[i] = 0;
187 for (int i=0; i<3; i++) fRec51[i] = 0;
188 for (int i=0; i<3; i++) fRec50[i] = 0;
189 for (int i=0; i<3; i++) fRec49[i] = 0;
190 for (int i=0; i<3; i++) fRec48[i] = 0;
191 for (int i=0; i<2; i++) fRec53[i] = 0;
192 for (int i=0; i<2; i++) fVec9[i] = 0;
193 for (int i=0; i<2; i++) fRec47[i] = 0;
194 for (int i=0; i<2; i++) fRec43[i] = 0;
195 for (int i=0; i<2; i++) iRec44[i] = 0;
196 for (int i=0; i<2; i++) fRec45[i] = 0;
197 }
198
199 void Dsp::clear_state_f_static(PluginDef *p)
200 {
201 static_cast<Dsp*>(p)->clear_state_f();
202 }
203
204 inline void Dsp::init(unsigned int samplingFreq)
205 {
206 fSamplingFreq = samplingFreq;
207 iConst0 = min(192000, max(1, fSamplingFreq));
208 fConst1 = (1.0 / double(iConst0));
209 fConst2 = (3.141592653589793 / double(iConst0));
210 clear_state_f();
211 }
212
213 void Dsp::init_static(unsigned int samplingFreq, PluginDef *p)
214 {
215 static_cast<Dsp*>(p)->init(samplingFreq);
216 }
217
218 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
219 {
220 double fSlow0 = (0.0010000000000000009 * pow(10,(0.05 * fslider0)));
221 double fSlow1 = tan((fConst2 * fslider1));
222 double fSlow2 = (1.0 / faustpower<2>(fSlow1));
223 double fSlow3 = (2 * (1 - fSlow2));
224 double fSlow4 = (1.0 / fSlow1);
225 double fSlow5 = (1 + ((fSlow4 - 1.0000000000000004) / fSlow1));
226 double fSlow6 = (1 + ((fSlow4 + 1.0000000000000004) / fSlow1));
227 double fSlow7 = (1.0 / fSlow6);
228 double fSlow8 = (1 + fSlow4);
229 double fSlow9 = (0 - ((1 - fSlow4) / fSlow8));
230 double fSlow10 = tan((fConst2 * fslider2));
231 double fSlow11 = (1.0 / faustpower<2>(fSlow10));
232 double fSlow12 = (2 * (1 - fSlow11));
233 double fSlow13 = (1.0 / fSlow10);
234 double fSlow14 = (1 + ((fSlow13 - 1.0000000000000004) / fSlow10));
235 double fSlow15 = (1 + ((fSlow13 + 1.0000000000000004) / fSlow10));
236 double fSlow16 = (1.0 / fSlow15);
237 double fSlow17 = (1 + fSlow13);
238 double fSlow18 = (0 - ((1 - fSlow13) / fSlow17));
239 double fSlow19 = tan((fConst2 * fslider3));
240 double fSlow20 = (1.0 / faustpower<2>(fSlow19));
241 double fSlow21 = (2 * (1 - fSlow20));
242 double fSlow22 = (1.0 / fSlow19);
243 double fSlow23 = (1 + ((fSlow22 - 1.0000000000000004) / fSlow19));
244 double fSlow24 = (1 + ((fSlow22 + 1.0000000000000004) / fSlow19));
245 double fSlow25 = (1.0 / fSlow24);
246 double fSlow26 = (1 + fSlow22);
247 double fSlow27 = (0 - ((1 - fSlow22) / fSlow26));
248 double fSlow28 = tan((fConst2 * fslider4));
249 double fSlow29 = (1.0 / faustpower<2>(fSlow28));
250 double fSlow30 = (2 * (1 - fSlow29));
251 double fSlow31 = (1.0 / fSlow28);
252 double fSlow32 = (1 + ((fSlow31 - 1.0000000000000004) / fSlow28));
253 double fSlow33 = (1 + ((1.0000000000000004 + fSlow31) / fSlow28));
254 double fSlow34 = (1.0 / fSlow33);
255 double fSlow35 = (1 + fSlow31);
256 double fSlow36 = (0 - ((1 - fSlow31) / fSlow35));
257 double fSlow37 = (1.0 / fSlow35);
258 double fSlow38 = (1.0 / fSlow26);
259 double fSlow39 = (1.0 / fSlow17);
260 double fSlow40 = (1.0 / fSlow8);
261 double fSlow41 = (pow(1e+01,(2 * fslider5)) / fSlow6);
262 double fSlow42 = (0.0010000000000000009 * fslider6);
263 double fSlow43 = (1.0 / (fSlow1 * fSlow15));
264 double fSlow44 = (0 - fSlow4);
265 double fSlow45 = (2 * (0 - fSlow2));
266 double fSlow46 = (pow(1e+01,(2 * fslider7)) / fSlow6);
267 double fSlow47 = (0.0010000000000000009 * fslider8);
268 double fSlow48 = (1 + ((fSlow4 - 1.0) / fSlow1));
269 double fSlow49 = (1.0 / (1 + ((1.0 + fSlow4) / fSlow1)));
270 double fSlow50 = (1.0 / (fSlow10 * fSlow24));
271 double fSlow51 = (0 - fSlow13);
272 double fSlow52 = (2 * (0 - fSlow11));
273 double fSlow53 = pow(1e+01,(2 * fslider9));
274 double fSlow54 = (0.0010000000000000009 * fslider10);
275 double fSlow55 = (1 + ((fSlow13 - 1.0) / fSlow10));
276 double fSlow56 = (1.0 / (1 + ((1.0 + fSlow13) / fSlow10)));
277 double fSlow57 = (1.0 / (fSlow19 * fSlow33));
278 double fSlow58 = (0 - fSlow22);
279 double fSlow59 = (2 * (0 - fSlow20));
280 double fSlow60 = pow(1e+01,(2 * fslider11));
281 double fSlow61 = (0.0010000000000000009 * fslider12);
282 double fSlow62 = (1 + ((fSlow22 - 1.0) / fSlow19));
283 double fSlow63 = (1.0 / (1 + ((1.0 + fSlow22) / fSlow19)));
284 double fSlow64 = (0 - fSlow31);
285 double fSlow65 = (2 * (0 - fSlow29));
286 double fSlow66 = pow(1e+01,(2 * fslider13));
287 double fSlow67 = (0.0010000000000000009 * fslider14);
288 for (int i=0; i<count; i++) {
289 iVec0[0] = 1;
290 fRec0[0] = (fSlow0 + (0.999 * fRec0[1]));
291 fRec14[0] = ((1e-20 * (1 - iVec0[1])) - fRec14[1]);
292 double fTemp0 = ((double)input0[i] + fRec14[0]);
293 fVec1[0] = fTemp0;
294 fRec13[0] = ((fSlow37 * (fVec1[0] + fVec1[1])) + (fSlow36 * fRec13[1]));
295 fRec12[0] = (fRec13[0] - (fSlow34 * ((fSlow32 * fRec12[2]) + (fSlow30 * fRec12[1]))));
296 double fTemp1 = (fRec12[2] + (fRec12[0] + (2 * fRec12[1])));
297 double fTemp2 = (fSlow34 * fTemp1);
298 fVec2[0] = fTemp2;
299 fRec11[0] = ((fSlow38 * (fVec2[0] + fVec2[1])) + (fSlow27 * fRec11[1]));
300 fRec10[0] = (fRec11[0] - (fSlow25 * ((fSlow23 * fRec10[2]) + (fSlow21 * fRec10[1]))));
301 double fTemp3 = (fRec10[2] + (fRec10[0] + (2 * fRec10[1])));
302 double fTemp4 = (fSlow25 * fTemp3);
303 fVec3[0] = fTemp4;
304 fRec9[0] = ((fSlow39 * (fVec3[0] + fVec3[1])) + (fSlow18 * fRec9[1]));
305 fRec8[0] = (fRec9[0] - (fSlow16 * ((fSlow14 * fRec8[2]) + (fSlow12 * fRec8[1]))));
306 double fTemp5 = (fRec8[2] + (fRec8[0] + (2 * fRec8[1])));
307 double fTemp6 = (fSlow16 * fTemp5);
308 fVec4[0] = fTemp6;
309 fRec7[0] = ((fSlow40 * (fVec4[0] + fVec4[1])) + (fSlow9 * fRec7[1]));
310 fRec6[0] = (fRec7[0] - (fSlow7 * ((fSlow5 * fRec6[2]) + (fSlow3 * fRec6[1]))));
311 fRec15[0] = (fSlow42 + (0.999 * fRec15[1]));
312 double fTemp7 = max((double)-1, min((double)1, (fRec15[0] + (fSlow41 * (fRec6[2] + (fRec6[0] + (2 * fRec6[1])))))));
313 double fTemp8 = (fTemp7 * (1 - (0.3333333333333333 * faustpower<2>(fTemp7))));
314 fVec5[0] = fTemp8;
315 fRec5[0] = ((fVec5[0] + (0.995 * fRec5[1])) - fVec5[1]);
316 double fRec4 = max(fConst1, fabs(fRec5[0]));
317 int iTemp9 = int((iRec2[1] < 4096));
318 fRec1[0] = ((iTemp9)?max(fRec1[1], fRec4):fRec4);
319 iRec2[0] = ((iTemp9)?(1 + iRec2[1]):1);
320 fRec3[0] = ((iTemp9)?fRec3[1]:fRec1[1]);
321 fbargraph0 = fRec3[0];
322 fRec22[0] = ((fSlow40 * ((fSlow44 * fVec4[1]) + (fSlow43 * fTemp5))) + (fSlow9 * fRec22[1]));
323 fRec21[0] = (fRec22[0] - (fSlow7 * ((fSlow5 * fRec21[2]) + (fSlow3 * fRec21[1]))));
324 fRec23[0] = (fSlow47 + (0.999 * fRec23[1]));
325 double fTemp10 = max((double)-1, min((double)1, (fRec23[0] + (fSlow46 * (((fSlow2 * fRec21[0]) + (fSlow45 * fRec21[1])) + (fSlow2 * fRec21[2]))))));
326 double fTemp11 = (fTemp10 * (1 - (0.3333333333333333 * faustpower<2>(fTemp10))));
327 fVec6[0] = fTemp11;
328 fRec20[0] = ((fVec6[0] + (0.995 * fRec20[1])) - fVec6[1]);
329 double fRec19 = max(fConst1, fabs(fRec20[0]));
330 int iTemp12 = int((iRec17[1] < 4096));
331 fRec16[0] = ((iTemp12)?max(fRec16[1], fRec19):fRec19);
332 iRec17[0] = ((iTemp12)?(1 + iRec17[1]):1);
333 fRec18[0] = ((iTemp12)?fRec18[1]:fRec16[1]);
334 fbargraph1 = fRec18[0];
335 double fTemp13 = (fSlow3 * fRec29[1]);
336 fRec31[0] = ((fSlow39 * ((fSlow51 * fVec3[1]) + (fSlow50 * fTemp3))) + (fSlow18 * fRec31[1]));
337 fRec30[0] = (fRec31[0] - (fSlow16 * ((fSlow14 * fRec30[2]) + (fSlow12 * fRec30[1]))));
338 fRec29[0] = ((fSlow16 * (((fSlow11 * fRec30[0]) + (fSlow52 * fRec30[1])) + (fSlow11 * fRec30[2]))) - (fSlow49 * ((fSlow48 * fRec29[2]) + fTemp13)));
339 fRec32[0] = (fSlow54 + (0.999 * fRec32[1]));
340 double fTemp14 = max((double)-1, min((double)1, (fRec32[0] + (fSlow53 * (fRec29[2] + (fSlow49 * (fTemp13 + (fSlow48 * fRec29[0]))))))));
341 double fTemp15 = (fTemp14 * (1 - (0.3333333333333333 * faustpower<2>(fTemp14))));
342 fVec7[0] = fTemp15;
343 fRec28[0] = ((fVec7[0] + (0.995 * fRec28[1])) - fVec7[1]);
344 double fRec27 = max(fConst1, fabs(fRec28[0]));
345 int iTemp16 = int((iRec25[1] < 4096));
346 fRec24[0] = ((iTemp16)?max(fRec24[1], fRec27):fRec27);
347 iRec25[0] = ((iTemp16)?(1 + iRec25[1]):1);
348 fRec26[0] = ((iTemp16)?fRec26[1]:fRec24[1]);
349 fbargraph2 = fRec26[0];
350 double fTemp17 = (fSlow3 * fRec38[1]);
351 double fTemp18 = (fSlow12 * fRec39[1]);
352 fRec41[0] = ((fSlow38 * ((fSlow58 * fVec2[1]) + (fSlow57 * fTemp1))) + (fSlow27 * fRec41[1]));
353 fRec40[0] = (fRec41[0] - (fSlow25 * ((fSlow23 * fRec40[2]) + (fSlow21 * fRec40[1]))));
354 fRec39[0] = ((fSlow25 * (((fSlow20 * fRec40[0]) + (fSlow59 * fRec40[1])) + (fSlow20 * fRec40[2]))) - (fSlow56 * ((fSlow55 * fRec39[2]) + fTemp18)));
355 fRec38[0] = ((fRec39[2] + (fSlow56 * (fTemp18 + (fSlow55 * fRec39[0])))) - (fSlow49 * ((fSlow48 * fRec38[2]) + fTemp17)));
356 fRec42[0] = (fSlow61 + (0.999 * fRec42[1]));
357 double fTemp19 = max((double)-1, min((double)1, (fRec42[0] + (fSlow60 * (fRec38[2] + (fSlow49 * (fTemp17 + (fSlow48 * fRec38[0]))))))));
358 double fTemp20 = (fTemp19 * (1 - (0.3333333333333333 * faustpower<2>(fTemp19))));
359 fVec8[0] = fTemp20;
360 fRec37[0] = ((fVec8[0] + (0.995 * fRec37[1])) - fVec8[1]);
361 double fRec36 = max(fConst1, fabs(fRec37[0]));
362 int iTemp21 = int((iRec34[1] < 4096));
363 fRec33[0] = ((iTemp21)?max(fRec33[1], fRec36):fRec36);
364 iRec34[0] = ((iTemp21)?(1 + iRec34[1]):1);
365 fRec35[0] = ((iTemp21)?fRec35[1]:fRec33[1]);
366 fbargraph3 = fRec35[0];
367 double fTemp22 = (fSlow3 * fRec48[1]);
368 double fTemp23 = (fSlow12 * fRec49[1]);
369 double fTemp24 = (fSlow21 * fRec50[1]);
370 fRec52[0] = ((fSlow37 * ((fSlow64 * fVec1[1]) + (fSlow31 * fVec1[0]))) + (fSlow36 * fRec52[1]));
371 fRec51[0] = (fRec52[0] - (fSlow34 * ((fSlow32 * fRec51[2]) + (fSlow30 * fRec51[1]))));
372 fRec50[0] = ((fSlow34 * (((fSlow29 * fRec51[0]) + (fSlow65 * fRec51[1])) + (fSlow29 * fRec51[2]))) - (fSlow63 * ((fSlow62 * fRec50[2]) + fTemp24)));
373 fRec49[0] = ((fRec50[2] + (fSlow63 * (fTemp24 + (fSlow62 * fRec50[0])))) - (fSlow56 * ((fSlow55 * fRec49[2]) + fTemp23)));
374 fRec48[0] = ((fRec49[2] + (fSlow56 * (fTemp23 + (fSlow55 * fRec49[0])))) - (fSlow49 * ((fSlow48 * fRec48[2]) + fTemp22)));
375 fRec53[0] = (fSlow67 + (0.999 * fRec53[1]));
376 double fTemp25 = max((double)-1, min((double)1, (fRec53[0] + (fSlow66 * (fRec48[2] + (fSlow49 * (fTemp22 + (fSlow48 * fRec48[0]))))))));
377 double fTemp26 = (fTemp25 * (1 - (0.3333333333333333 * faustpower<2>(fTemp25))));
378 fVec9[0] = fTemp26;
379 fRec47[0] = ((fVec9[0] + (0.995 * fRec47[1])) - fVec9[1]);
380 double fRec46 = max(fConst1, fabs(fRec47[0]));
381 int iTemp27 = int((iRec44[1] < 4096));
382 fRec43[0] = ((iTemp27)?max(fRec43[1], fRec46):fRec46);
383 iRec44[0] = ((iTemp27)?(1 + iRec44[1]):1);
384 fRec45[0] = ((iTemp27)?fRec45[1]:fRec43[1]);
385 fbargraph4 = fRec45[0];
386 output0[i] = (FAUSTFLOAT)(((((fRec47[0] + fRec37[0]) + fRec28[0]) + fRec20[0]) + fRec5[0]) * fRec0[0]);
387 // post processing
388 fRec45[1] = fRec45[0];
389 iRec44[1] = iRec44[0];
390 fRec43[1] = fRec43[0];
391 fRec47[1] = fRec47[0];
392 fVec9[1] = fVec9[0];
393 fRec53[1] = fRec53[0];
394 fRec48[2] = fRec48[1]; fRec48[1] = fRec48[0];
395 fRec49[2] = fRec49[1]; fRec49[1] = fRec49[0];
396 fRec50[2] = fRec50[1]; fRec50[1] = fRec50[0];
397 fRec51[2] = fRec51[1]; fRec51[1] = fRec51[0];
398 fRec52[1] = fRec52[0];
399 fRec35[1] = fRec35[0];
400 iRec34[1] = iRec34[0];
401 fRec33[1] = fRec33[0];
402 fRec37[1] = fRec37[0];
403 fVec8[1] = fVec8[0];
404 fRec42[1] = fRec42[0];
405 fRec38[2] = fRec38[1]; fRec38[1] = fRec38[0];
406 fRec39[2] = fRec39[1]; fRec39[1] = fRec39[0];
407 fRec40[2] = fRec40[1]; fRec40[1] = fRec40[0];
408 fRec41[1] = fRec41[0];
409 fRec26[1] = fRec26[0];
410 iRec25[1] = iRec25[0];
411 fRec24[1] = fRec24[0];
412 fRec28[1] = fRec28[0];
413 fVec7[1] = fVec7[0];
414 fRec32[1] = fRec32[0];
415 fRec29[2] = fRec29[1]; fRec29[1] = fRec29[0];
416 fRec30[2] = fRec30[1]; fRec30[1] = fRec30[0];
417 fRec31[1] = fRec31[0];
418 fRec18[1] = fRec18[0];
419 iRec17[1] = iRec17[0];
420 fRec16[1] = fRec16[0];
421 fRec20[1] = fRec20[0];
422 fVec6[1] = fVec6[0];
423 fRec23[1] = fRec23[0];
424 fRec21[2] = fRec21[1]; fRec21[1] = fRec21[0];
425 fRec22[1] = fRec22[0];
426 fRec3[1] = fRec3[0];
427 iRec2[1] = iRec2[0];
428 fRec1[1] = fRec1[0];
429 fRec5[1] = fRec5[0];
430 fVec5[1] = fVec5[0];
431 fRec15[1] = fRec15[0];
432 fRec6[2] = fRec6[1]; fRec6[1] = fRec6[0];
433 fRec7[1] = fRec7[0];
434 fVec4[1] = fVec4[0];
435 fRec8[2] = fRec8[1]; fRec8[1] = fRec8[0];
436 fRec9[1] = fRec9[0];
437 fVec3[1] = fVec3[0];
438 fRec10[2] = fRec10[1]; fRec10[1] = fRec10[0];
439 fRec11[1] = fRec11[0];
440 fVec2[1] = fVec2[0];
441 fRec12[2] = fRec12[1]; fRec12[1] = fRec12[0];
442 fRec13[1] = fRec13[0];
443 fVec1[1] = fVec1[0];
444 fRec14[1] = fRec14[0];
445 fRec0[1] = fRec0[0];
446 iVec0[1] = iVec0[0];
447 }
448 }
449
450 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
451 {
452 static_cast<Dsp*>(p)->compute(count, input0, output0);
453 }
454
455 int Dsp::register_par(const ParamReg& reg)
456 {
457 reg.registerVar("mbd.Drive1","","S",N_("Amount of distortion"),&fslider5, 0.0, 0.0, 1.0, 0.01);
458 reg.registerVar("mbd.Drive2","","S",N_("Amount of distortion"),&fslider7, 0.0, 0.0, 1.0, 0.01);
459 reg.registerVar("mbd.Drive3","","S",N_("Amount of distortion"),&fslider9, 0.0, 0.0, 1.0, 0.01);
460 reg.registerVar("mbd.Drive4","","S",N_("Amount of distortion"),&fslider11, 0.0, 0.0, 1.0, 0.01);
461 reg.registerVar("mbd.Drive5","","S",N_("Amount of distortion"),&fslider13, 0.0, 0.0, 1.0, 0.01);
462 reg.registerVar("mbd.Gain","","S","",&fslider0, 0.0, -4e+01, 4.0, 0.1);
463 reg.registerVar("mbd.Offset1","","S",N_("Brings in even harmonics"),&fslider6, 0.0, 0.0, 0.5, 0.01);
464 reg.registerVar("mbd.Offset2","","S",N_("Brings in even harmonics"),&fslider8, 0.0, 0.0, 0.5, 0.01);
465 reg.registerVar("mbd.Offset3","","S",N_("Brings in even harmonics"),&fslider10, 0.0, 0.0, 0.5, 0.01);
466 reg.registerVar("mbd.Offset4","","S",N_("Brings in even harmonics"),&fslider12, 0.0, 0.0, 0.5, 0.01);
467 reg.registerVar("mbd.Offset5","","S",N_("Brings in even harmonics"),&fslider14, 0.0, 0.0, 0.5, 0.01);
468 reg.registerVar("mbd.crossover_b1_b2",N_("Crossover B1-B2 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider1, 8e+01, 2e+01, 2e+04, 1.08);
469 reg.registerVar("mbd.crossover_b2_b3",N_("Crossover B2-B3 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider2, 2.1e+02, 2e+01, 2e+04, 1.08);
470 reg.registerVar("mbd.crossover_b3_b4",N_("Crossover B3-B4 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider3, 1.7e+03, 2e+01, 2e+04, 1.08);
471 reg.registerVar("mbd.crossover_b4_b5",N_("Crossover B4-B5 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider4, 5e+03, 2e+01, 2e+04, 1.08);
472 reg.registerNonMidiFloatVar("mbd.v1",&fbargraph0, false, true, -70.0, -70.0, 4.0, 0.00001);
473 reg.registerNonMidiFloatVar("mbd.v2",&fbargraph1, false, true, -70.0, -70.0, 4.0, 0.00001);
474 reg.registerNonMidiFloatVar("mbd.v3",&fbargraph2, false, true, -70.0, -70.0, 4.0, 0.00001);
475 reg.registerNonMidiFloatVar("mbd.v4",&fbargraph3, false, true, -70.0, -70.0, 4.0, 0.00001);
476 reg.registerNonMidiFloatVar("mbd.v5",&fbargraph4, false, true, -70.0, -70.0, 4.0, 0.00001);
477 return 0;
478 }
479
480 int Dsp::register_params_static(const ParamReg& reg)
481 {
482 return static_cast<Dsp*>(reg.plugin)->register_par(reg);
483 }
484
485 inline int Dsp::load_ui_f(const UiBuilder& b, int form)
486 {
487 if (form & UI_FORM_STACK) {
488 #define PARAM(p) ("mbd" "." p)
489
490 b.openHorizontalhideBox("");
491 b.create_master_slider(PARAM("Gain"), N_("Gain"));
492 b.closeBox();
493
494 b.openHorizontalBox("");
495 b.openVerticalBox("");
496
497 b.openTabBox("");
498
499 b.openHorizontalBox(N_("Band 1"));
500 b.openVerticalBox("");
501 b.openpaintampBox("");
502 b.openHorizontalBox("");
503 b.set_next_flags(UI_NUM_RIGHT);
504 b.create_small_rackknob(PARAM("Drive1"), N_("Drive"));
505 b.set_next_flags(UI_NUM_RIGHT);
506 b.create_small_rackknob(PARAM("Offset1"), N_("Offset"));
507 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
508 b.create_small_rackknob(PARAM("crossover_b1_b2"), N_("Low Shelf (Hz)"));
509 b.closeBox();
510 b.closeBox();
511 b.closeBox();
512 b.closeBox();
513
514 b.openHorizontalBox(N_("Band 2"));
515 b.openVerticalBox("");
516 b.openpaintampBox("");
517 b.openHorizontalBox("");
518 b.set_next_flags(UI_NUM_RIGHT);
519 b.create_small_rackknob(PARAM("Drive2"), N_("Drive"));
520 b.set_next_flags(UI_NUM_RIGHT);
521 b.create_small_rackknob(PARAM("Offset2"), N_("Offset"));
522 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
523 b.create_small_rackknob(PARAM("crossover_b1_b2"), N_("Low (Hz)"));
524 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
525 b.create_small_rackknob(PARAM("crossover_b2_b3"), N_("High (hz)"));
526 b.closeBox();
527 b.closeBox();
528 b.closeBox();
529 b.closeBox();
530
531 b.openHorizontalBox(N_("Band 3"));
532 b.openVerticalBox("");
533 b.openpaintampBox("");
534 b.openHorizontalBox("");
535 b.set_next_flags(UI_NUM_RIGHT);
536 b.create_small_rackknob(PARAM("Drive3"), N_("Drive"));
537 b.set_next_flags(UI_NUM_RIGHT);
538 b.create_small_rackknob(PARAM("Offset3"), N_("Offset"));
539 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
540 b.create_small_rackknob(PARAM("crossover_b2_b3"), N_("Low (Hz)"));
541 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
542 b.create_small_rackknob(PARAM("crossover_b3_b4"), N_("High (hz)"));
543 b.closeBox();
544 b.closeBox();
545 b.closeBox();
546 b.closeBox();
547
548 b.openHorizontalBox(N_("Band 4"));
549 b.openVerticalBox("");
550 b.openpaintampBox("");
551 b.openHorizontalBox("");
552 b.set_next_flags(UI_NUM_RIGHT);
553 b.create_small_rackknob(PARAM("Drive4"), N_("Drive"));
554 b.set_next_flags(UI_NUM_RIGHT);
555 b.create_small_rackknob(PARAM("Offset4"), N_("Offset"));
556 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
557 b.create_small_rackknob(PARAM("crossover_b3_b4"), N_("Low (Hz)"));
558 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
559 b.create_small_rackknob(PARAM("crossover_b4_b5"), N_("High (hz)"));
560 b.closeBox();
561 b.closeBox();
562 b.closeBox();
563 b.closeBox();
564
565 b.openHorizontalBox(N_("Band 5"));
566 b.openVerticalBox("");
567 b.openpaintampBox("");
568 b.openHorizontalBox("");
569 b.set_next_flags(UI_NUM_RIGHT);
570 b.create_small_rackknob(PARAM("Drive5"), N_("Drive"));
571 b.set_next_flags(UI_NUM_RIGHT);
572 b.create_small_rackknob(PARAM("Offset5"), N_("Offset"));
573 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
574 b.create_small_rackknob(PARAM("crossover_b4_b5"), N_("High Shelf (Hz)"));
575 b.closeBox();
576 b.closeBox();
577 b.closeBox();
578 b.closeBox();
579
580 b.closeBox();
581 b.closeBox();
582 b.create_small_rackknob(PARAM("Gain"), N_("Gain"));
583 b.openVerticalBox2("Analyze");
584 b.create_simple_meter(PARAM("v1"));
585 b.create_simple_meter(PARAM("v2"));
586 b.create_simple_meter(PARAM("v3"));
587 b.create_simple_meter(PARAM("v4"));
588 b.create_simple_meter(PARAM("v5"));
589 b.closeBox();
590 b.closeBox();
591
592
593 #undef PARAM
594 return 0;
595 }
596 return -1;
597 }
598
599 int Dsp::load_ui_f_static(const UiBuilder& b, int form)
600 {
601 return static_cast<Dsp*>(b.plugin)->load_ui_f(b, form);
602 }
603 PluginDef *plugin() {
604 return new Dsp();
605 }
606
607 void Dsp::del_instance(PluginDef *p)
608 {
609 delete static_cast<Dsp*>(p);
610 }
611
612 } // end namespace mbd
613 } // end namespace pluginlib
0 // generated from file '../src/plugins/mbdel.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.58 (http://faust.grame.fr)
2
3 #include "gx_faust_support.h"
4 #include "gx_plugin.h"
5
6 namespace pluginlib {
7 namespace mbdel {
8
9 class Dsp: public PluginDef {
10 private:
11 int fSamplingFreq;
12 int iConst0;
13 double fConst1;
14 FAUSTFLOAT fslider0;
15 double fConst2;
16 FAUSTFLOAT fslider1;
17 FAUSTFLOAT fslider2;
18 FAUSTFLOAT fslider3;
19 double fVec0[2];
20 double fRec11[2];
21 double fRec10[3];
22 double fVec1[2];
23 double fRec9[2];
24 double fRec8[3];
25 double fVec2[2];
26 double fRec7[2];
27 double fRec6[3];
28 double fVec3[2];
29 double fRec5[2];
30 double fRec4[3];
31 FAUSTFLOAT fslider4;
32 double fRec12[2];
33 int IOTA;
34 double fVec4[262144];
35 double fConst3;
36 double fConst4;
37 FAUSTFLOAT fslider5;
38 int iConst5;
39 double fRec13[2];
40 double fRec14[2];
41 double fRec15[2];
42 double fRec16[2];
43 double fRec0[2];
44 int iRec1[2];
45 double fRec2[2];
46 FAUSTFLOAT fbargraph0;
47 double fRec22[2];
48 double fRec21[3];
49 FAUSTFLOAT fslider6;
50 double fRec23[2];
51 double fVec5[262144];
52 FAUSTFLOAT fslider7;
53 double fRec24[2];
54 double fRec25[2];
55 double fRec26[2];
56 double fRec27[2];
57 double fRec17[2];
58 int iRec18[2];
59 double fRec19[2];
60 FAUSTFLOAT fbargraph1;
61 double fRec34[2];
62 double fRec33[3];
63 double fRec32[3];
64 FAUSTFLOAT fslider8;
65 double fRec35[2];
66 double fVec6[262144];
67 FAUSTFLOAT fslider9;
68 double fRec36[2];
69 double fRec37[2];
70 double fRec38[2];
71 double fRec39[2];
72 double fRec28[2];
73 int iRec29[2];
74 double fRec30[2];
75 FAUSTFLOAT fbargraph2;
76 double fRec47[2];
77 double fRec46[3];
78 double fRec45[3];
79 double fRec44[3];
80 FAUSTFLOAT fslider10;
81 double fRec48[2];
82 double fVec7[262144];
83 FAUSTFLOAT fslider11;
84 double fRec49[2];
85 double fRec50[2];
86 double fRec51[2];
87 double fRec52[2];
88 double fRec40[2];
89 int iRec41[2];
90 double fRec42[2];
91 FAUSTFLOAT fbargraph3;
92 double fRec61[2];
93 double fRec60[3];
94 double fRec59[3];
95 double fRec58[3];
96 double fRec57[3];
97 FAUSTFLOAT fslider12;
98 double fRec62[2];
99 double fVec8[262144];
100 FAUSTFLOAT fslider13;
101 double fRec63[2];
102 double fRec64[2];
103 double fRec65[2];
104 double fRec66[2];
105 double fRec53[2];
106 int iRec54[2];
107 double fRec55[2];
108 FAUSTFLOAT fbargraph4;
109 void clear_state_f();
110 int load_ui_f(const UiBuilder& b, int form);
111 void init(unsigned int samplingFreq);
112 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
113 int register_par(const ParamReg& reg);
114
115 static void clear_state_f_static(PluginDef*);
116 static int load_ui_f_static(const UiBuilder& b, int form);
117 static void init_static(unsigned int samplingFreq, PluginDef*);
118 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
119 static int register_params_static(const ParamReg& reg);
120 static void del_instance(PluginDef *p);
121 public:
122 Dsp();
123 ~Dsp();
124 };
125
126
127
128 Dsp::Dsp()
129 : PluginDef() {
130 version = PLUGINDEF_VERSION;
131 flags = 0;
132 id = "mbdel";
133 name = N_("MultiBand Delay");
134 groups = 0;
135 description = N_("Multi Band Delay"); // description (tooltip)
136 category = N_("Echo / Delay"); // category
137 shortname = N_("MB Delay"); // shortname
138 mono_audio = compute_static;
139 stereo_audio = 0;
140 set_samplerate = init_static;
141 activate_plugin = 0;
142 register_params = register_params_static;
143 load_ui = load_ui_f_static;
144 clear_state = clear_state_f_static;
145 delete_instance = del_instance;
146 }
147
148 Dsp::~Dsp() {
149 }
150
151 inline void Dsp::clear_state_f()
152 {
153 for (int i=0; i<2; i++) fVec0[i] = 0;
154 for (int i=0; i<2; i++) fRec11[i] = 0;
155 for (int i=0; i<3; i++) fRec10[i] = 0;
156 for (int i=0; i<2; i++) fVec1[i] = 0;
157 for (int i=0; i<2; i++) fRec9[i] = 0;
158 for (int i=0; i<3; i++) fRec8[i] = 0;
159 for (int i=0; i<2; i++) fVec2[i] = 0;
160 for (int i=0; i<2; i++) fRec7[i] = 0;
161 for (int i=0; i<3; i++) fRec6[i] = 0;
162 for (int i=0; i<2; i++) fVec3[i] = 0;
163 for (int i=0; i<2; i++) fRec5[i] = 0;
164 for (int i=0; i<3; i++) fRec4[i] = 0;
165 for (int i=0; i<2; i++) fRec12[i] = 0;
166 for (int i=0; i<262144; i++) fVec4[i] = 0;
167 for (int i=0; i<2; i++) fRec13[i] = 0;
168 for (int i=0; i<2; i++) fRec14[i] = 0;
169 for (int i=0; i<2; i++) fRec15[i] = 0;
170 for (int i=0; i<2; i++) fRec16[i] = 0;
171 for (int i=0; i<2; i++) fRec0[i] = 0;
172 for (int i=0; i<2; i++) iRec1[i] = 0;
173 for (int i=0; i<2; i++) fRec2[i] = 0;
174 for (int i=0; i<2; i++) fRec22[i] = 0;
175 for (int i=0; i<3; i++) fRec21[i] = 0;
176 for (int i=0; i<2; i++) fRec23[i] = 0;
177 for (int i=0; i<262144; i++) fVec5[i] = 0;
178 for (int i=0; i<2; i++) fRec24[i] = 0;
179 for (int i=0; i<2; i++) fRec25[i] = 0;
180 for (int i=0; i<2; i++) fRec26[i] = 0;
181 for (int i=0; i<2; i++) fRec27[i] = 0;
182 for (int i=0; i<2; i++) fRec17[i] = 0;
183 for (int i=0; i<2; i++) iRec18[i] = 0;
184 for (int i=0; i<2; i++) fRec19[i] = 0;
185 for (int i=0; i<2; i++) fRec34[i] = 0;
186 for (int i=0; i<3; i++) fRec33[i] = 0;
187 for (int i=0; i<3; i++) fRec32[i] = 0;
188 for (int i=0; i<2; i++) fRec35[i] = 0;
189 for (int i=0; i<262144; i++) fVec6[i] = 0;
190 for (int i=0; i<2; i++) fRec36[i] = 0;
191 for (int i=0; i<2; i++) fRec37[i] = 0;
192 for (int i=0; i<2; i++) fRec38[i] = 0;
193 for (int i=0; i<2; i++) fRec39[i] = 0;
194 for (int i=0; i<2; i++) fRec28[i] = 0;
195 for (int i=0; i<2; i++) iRec29[i] = 0;
196 for (int i=0; i<2; i++) fRec30[i] = 0;
197 for (int i=0; i<2; i++) fRec47[i] = 0;
198 for (int i=0; i<3; i++) fRec46[i] = 0;
199 for (int i=0; i<3; i++) fRec45[i] = 0;
200 for (int i=0; i<3; i++) fRec44[i] = 0;
201 for (int i=0; i<2; i++) fRec48[i] = 0;
202 for (int i=0; i<262144; i++) fVec7[i] = 0;
203 for (int i=0; i<2; i++) fRec49[i] = 0;
204 for (int i=0; i<2; i++) fRec50[i] = 0;
205 for (int i=0; i<2; i++) fRec51[i] = 0;
206 for (int i=0; i<2; i++) fRec52[i] = 0;
207 for (int i=0; i<2; i++) fRec40[i] = 0;
208 for (int i=0; i<2; i++) iRec41[i] = 0;
209 for (int i=0; i<2; i++) fRec42[i] = 0;
210 for (int i=0; i<2; i++) fRec61[i] = 0;
211 for (int i=0; i<3; i++) fRec60[i] = 0;
212 for (int i=0; i<3; i++) fRec59[i] = 0;
213 for (int i=0; i<3; i++) fRec58[i] = 0;
214 for (int i=0; i<3; i++) fRec57[i] = 0;
215 for (int i=0; i<2; i++) fRec62[i] = 0;
216 for (int i=0; i<262144; i++) fVec8[i] = 0;
217 for (int i=0; i<2; i++) fRec63[i] = 0;
218 for (int i=0; i<2; i++) fRec64[i] = 0;
219 for (int i=0; i<2; i++) fRec65[i] = 0;
220 for (int i=0; i<2; i++) fRec66[i] = 0;
221 for (int i=0; i<2; i++) fRec53[i] = 0;
222 for (int i=0; i<2; i++) iRec54[i] = 0;
223 for (int i=0; i<2; i++) fRec55[i] = 0;
224 }
225
226 void Dsp::clear_state_f_static(PluginDef *p)
227 {
228 static_cast<Dsp*>(p)->clear_state_f();
229 }
230
231 inline void Dsp::init(unsigned int samplingFreq)
232 {
233 fSamplingFreq = samplingFreq;
234 iConst0 = min(192000, max(1, fSamplingFreq));
235 fConst1 = (1.0 / double(iConst0));
236 fConst2 = (3.141592653589793 / double(iConst0));
237 IOTA = 0;
238 fConst3 = (1e+01 / double(iConst0));
239 fConst4 = (0 - fConst3);
240 iConst5 = (60 * iConst0);
241 clear_state_f();
242 }
243
244 void Dsp::init_static(unsigned int samplingFreq, PluginDef *p)
245 {
246 static_cast<Dsp*>(p)->init(samplingFreq);
247 }
248
249 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
250 {
251 double fSlow0 = tan((fConst2 * fslider0));
252 double fSlow1 = (1.0 / faustpower<2>(fSlow0));
253 double fSlow2 = (2 * (1 - fSlow1));
254 double fSlow3 = (1.0 / fSlow0);
255 double fSlow4 = (1 + ((fSlow3 - 1.0000000000000004) / fSlow0));
256 double fSlow5 = (1.0 / (1 + ((fSlow3 + 1.0000000000000004) / fSlow0)));
257 double fSlow6 = (1 + fSlow3);
258 double fSlow7 = (0 - ((1 - fSlow3) / fSlow6));
259 double fSlow8 = tan((fConst2 * fslider1));
260 double fSlow9 = (1.0 / faustpower<2>(fSlow8));
261 double fSlow10 = (2 * (1 - fSlow9));
262 double fSlow11 = (1.0 / fSlow8);
263 double fSlow12 = (1 + ((fSlow11 - 1.0000000000000004) / fSlow8));
264 double fSlow13 = (1 + ((fSlow11 + 1.0000000000000004) / fSlow8));
265 double fSlow14 = (1.0 / fSlow13);
266 double fSlow15 = (1 + fSlow11);
267 double fSlow16 = (0 - ((1 - fSlow11) / fSlow15));
268 double fSlow17 = tan((fConst2 * fslider2));
269 double fSlow18 = (1.0 / faustpower<2>(fSlow17));
270 double fSlow19 = (2 * (1 - fSlow18));
271 double fSlow20 = (1.0 / fSlow17);
272 double fSlow21 = (1 + ((fSlow20 - 1.0000000000000004) / fSlow17));
273 double fSlow22 = (1 + ((fSlow20 + 1.0000000000000004) / fSlow17));
274 double fSlow23 = (1.0 / fSlow22);
275 double fSlow24 = (1 + fSlow20);
276 double fSlow25 = (0 - ((1 - fSlow20) / fSlow24));
277 double fSlow26 = tan((fConst2 * fslider3));
278 double fSlow27 = (1.0 / faustpower<2>(fSlow26));
279 double fSlow28 = (2 * (1 - fSlow27));
280 double fSlow29 = (1.0 / fSlow26);
281 double fSlow30 = (1 + ((fSlow29 - 1.0000000000000004) / fSlow26));
282 double fSlow31 = (1 + ((1.0000000000000004 + fSlow29) / fSlow26));
283 double fSlow32 = (1.0 / fSlow31);
284 double fSlow33 = (1 + fSlow29);
285 double fSlow34 = (0 - ((1 - fSlow29) / fSlow33));
286 double fSlow35 = (1.0 / fSlow33);
287 double fSlow36 = (1.0 / fSlow24);
288 double fSlow37 = (1.0 / fSlow15);
289 double fSlow38 = (1.0 / fSlow6);
290 double fSlow39 = (0.0010000000000000009 * pow(10,(0.05 * fslider4)));
291 double fSlow40 = (double(iConst5) / fslider5);
292 double fSlow41 = (1.0 / (fSlow0 * fSlow13));
293 double fSlow42 = (0 - fSlow3);
294 double fSlow43 = (2 * (0 - fSlow1));
295 double fSlow44 = (0.0010000000000000009 * pow(10,(0.05 * fslider6)));
296 double fSlow45 = (double(iConst5) / fslider7);
297 double fSlow46 = (1 + ((fSlow3 - 1.0) / fSlow0));
298 double fSlow47 = (1.0 / (1 + ((1.0 + fSlow3) / fSlow0)));
299 double fSlow48 = (1.0 / (fSlow8 * fSlow22));
300 double fSlow49 = (0 - fSlow11);
301 double fSlow50 = (2 * (0 - fSlow9));
302 double fSlow51 = (0.0010000000000000009 * pow(10,(0.05 * fslider8)));
303 double fSlow52 = (double(iConst5) / fslider9);
304 double fSlow53 = (1 + ((fSlow11 - 1.0) / fSlow8));
305 double fSlow54 = (1.0 / (1 + ((1.0 + fSlow11) / fSlow8)));
306 double fSlow55 = (1.0 / (fSlow17 * fSlow31));
307 double fSlow56 = (0 - fSlow20);
308 double fSlow57 = (2 * (0 - fSlow18));
309 double fSlow58 = (0.0010000000000000009 * pow(10,(0.05 * fslider10)));
310 double fSlow59 = (double(iConst5) / fslider11);
311 double fSlow60 = (1 + ((fSlow20 - 1.0) / fSlow17));
312 double fSlow61 = (1.0 / (1 + ((1.0 + fSlow20) / fSlow17)));
313 double fSlow62 = (0 - fSlow29);
314 double fSlow63 = (2 * (0 - fSlow27));
315 double fSlow64 = (0.0010000000000000009 * pow(10,(0.05 * fslider12)));
316 double fSlow65 = (double(iConst5) / fslider13);
317 for (int i=0; i<count; i++) {
318 double fTemp0 = (double)input0[i];
319 fVec0[0] = fTemp0;
320 fRec11[0] = ((fSlow35 * (fVec0[0] + fVec0[1])) + (fSlow34 * fRec11[1]));
321 fRec10[0] = (fRec11[0] - (fSlow32 * ((fSlow30 * fRec10[2]) + (fSlow28 * fRec10[1]))));
322 double fTemp1 = (fRec10[2] + (fRec10[0] + (2 * fRec10[1])));
323 double fTemp2 = (fSlow32 * fTemp1);
324 fVec1[0] = fTemp2;
325 fRec9[0] = ((fSlow36 * (fVec1[0] + fVec1[1])) + (fSlow25 * fRec9[1]));
326 fRec8[0] = (fRec9[0] - (fSlow23 * ((fSlow21 * fRec8[2]) + (fSlow19 * fRec8[1]))));
327 double fTemp3 = (fRec8[2] + (fRec8[0] + (2 * fRec8[1])));
328 double fTemp4 = (fSlow23 * fTemp3);
329 fVec2[0] = fTemp4;
330 fRec7[0] = ((fSlow37 * (fVec2[0] + fVec2[1])) + (fSlow16 * fRec7[1]));
331 fRec6[0] = (fRec7[0] - (fSlow14 * ((fSlow12 * fRec6[2]) + (fSlow10 * fRec6[1]))));
332 double fTemp5 = (fRec6[2] + (fRec6[0] + (2 * fRec6[1])));
333 double fTemp6 = (fSlow14 * fTemp5);
334 fVec3[0] = fTemp6;
335 fRec5[0] = ((fSlow38 * (fVec3[0] + fVec3[1])) + (fSlow7 * fRec5[1]));
336 fRec4[0] = (fRec5[0] - (fSlow5 * ((fSlow4 * fRec4[2]) + (fSlow2 * fRec4[1]))));
337 fRec12[0] = (fSlow39 + (0.999 * fRec12[1]));
338 double fTemp7 = (fSlow5 * (fRec12[0] * (fRec4[2] + (fRec4[0] + (2 * fRec4[1])))));
339 fVec4[IOTA&262143] = fTemp7;
340 double fTemp8 = ((int((fRec13[1] != 0.0)))?((int(((fRec14[1] > 0.0) & (fRec14[1] < 1.0))))?fRec13[1]:0):((int(((fRec14[1] == 0.0) & (fSlow40 != fRec15[1]))))?fConst3:((int(((fRec14[1] == 1.0) & (fSlow40 != fRec16[1]))))?fConst4:0)));
341 fRec13[0] = fTemp8;
342 fRec14[0] = max(0.0, min(1.0, (fRec14[1] + fTemp8)));
343 fRec15[0] = ((int(((fRec14[1] >= 1.0) & (fRec16[1] != fSlow40))))?fSlow40:fRec15[1]);
344 fRec16[0] = ((int(((fRec14[1] <= 0.0) & (fRec15[1] != fSlow40))))?fSlow40:fRec16[1]);
345 double fTemp9 = ((fRec14[0] * fVec4[(IOTA-int((int(fRec16[0]) & 262143)))&262143]) + ((1.0 - fRec14[0]) * fVec4[(IOTA-int((int(fRec15[0]) & 262143)))&262143]));
346 double fRec3 = max(fConst1, fabs(fTemp9));
347 int iTemp10 = int((iRec1[1] < 4096));
348 fRec0[0] = ((iTemp10)?max(fRec0[1], fRec3):fRec3);
349 iRec1[0] = ((iTemp10)?(1 + iRec1[1]):1);
350 fRec2[0] = ((iTemp10)?fRec2[1]:fRec0[1]);
351 fbargraph0 = fRec2[0];
352 fRec22[0] = ((fSlow38 * ((fSlow42 * fVec3[1]) + (fSlow41 * fTemp5))) + (fSlow7 * fRec22[1]));
353 fRec21[0] = (fRec22[0] - (fSlow5 * ((fSlow4 * fRec21[2]) + (fSlow2 * fRec21[1]))));
354 fRec23[0] = (fSlow44 + (0.999 * fRec23[1]));
355 double fTemp11 = (fSlow5 * (fRec23[0] * (((fSlow1 * fRec21[0]) + (fSlow43 * fRec21[1])) + (fSlow1 * fRec21[2]))));
356 fVec5[IOTA&262143] = fTemp11;
357 double fTemp12 = ((int((fRec24[1] != 0.0)))?((int(((fRec25[1] > 0.0) & (fRec25[1] < 1.0))))?fRec24[1]:0):((int(((fRec25[1] == 0.0) & (fSlow45 != fRec26[1]))))?fConst3:((int(((fRec25[1] == 1.0) & (fSlow45 != fRec27[1]))))?fConst4:0)));
358 fRec24[0] = fTemp12;
359 fRec25[0] = max(0.0, min(1.0, (fRec25[1] + fTemp12)));
360 fRec26[0] = ((int(((fRec25[1] >= 1.0) & (fRec27[1] != fSlow45))))?fSlow45:fRec26[1]);
361 fRec27[0] = ((int(((fRec25[1] <= 0.0) & (fRec26[1] != fSlow45))))?fSlow45:fRec27[1]);
362 double fTemp13 = ((fRec25[0] * fVec5[(IOTA-int((int(fRec27[0]) & 262143)))&262143]) + ((1.0 - fRec25[0]) * fVec5[(IOTA-int((int(fRec26[0]) & 262143)))&262143]));
363 double fRec20 = max(fConst1, fabs(fTemp13));
364 int iTemp14 = int((iRec18[1] < 4096));
365 fRec17[0] = ((iTemp14)?max(fRec17[1], fRec20):fRec20);
366 iRec18[0] = ((iTemp14)?(1 + iRec18[1]):1);
367 fRec19[0] = ((iTemp14)?fRec19[1]:fRec17[1]);
368 fbargraph1 = fRec19[0];
369 double fTemp15 = (fSlow2 * fRec32[1]);
370 fRec34[0] = ((fSlow37 * ((fSlow49 * fVec2[1]) + (fSlow48 * fTemp3))) + (fSlow16 * fRec34[1]));
371 fRec33[0] = (fRec34[0] - (fSlow14 * ((fSlow12 * fRec33[2]) + (fSlow10 * fRec33[1]))));
372 fRec32[0] = ((fSlow14 * (((fSlow9 * fRec33[0]) + (fSlow50 * fRec33[1])) + (fSlow9 * fRec33[2]))) - (fSlow47 * ((fSlow46 * fRec32[2]) + fTemp15)));
373 fRec35[0] = (fSlow51 + (0.999 * fRec35[1]));
374 double fTemp16 = (fRec35[0] * (fRec32[2] + (fSlow47 * (fTemp15 + (fSlow46 * fRec32[0])))));
375 fVec6[IOTA&262143] = fTemp16;
376 double fTemp17 = ((int((fRec36[1] != 0.0)))?((int(((fRec37[1] > 0.0) & (fRec37[1] < 1.0))))?fRec36[1]:0):((int(((fRec37[1] == 0.0) & (fSlow52 != fRec38[1]))))?fConst3:((int(((fRec37[1] == 1.0) & (fSlow52 != fRec39[1]))))?fConst4:0)));
377 fRec36[0] = fTemp17;
378 fRec37[0] = max(0.0, min(1.0, (fRec37[1] + fTemp17)));
379 fRec38[0] = ((int(((fRec37[1] >= 1.0) & (fRec39[1] != fSlow52))))?fSlow52:fRec38[1]);
380 fRec39[0] = ((int(((fRec37[1] <= 0.0) & (fRec38[1] != fSlow52))))?fSlow52:fRec39[1]);
381 double fTemp18 = ((fRec37[0] * fVec6[(IOTA-int((int(fRec39[0]) & 262143)))&262143]) + ((1.0 - fRec37[0]) * fVec6[(IOTA-int((int(fRec38[0]) & 262143)))&262143]));
382 double fRec31 = max(fConst1, fabs(fTemp18));
383 int iTemp19 = int((iRec29[1] < 4096));
384 fRec28[0] = ((iTemp19)?max(fRec28[1], fRec31):fRec31);
385 iRec29[0] = ((iTemp19)?(1 + iRec29[1]):1);
386 fRec30[0] = ((iTemp19)?fRec30[1]:fRec28[1]);
387 fbargraph2 = fRec30[0];
388 double fTemp20 = (fSlow2 * fRec44[1]);
389 double fTemp21 = (fSlow10 * fRec45[1]);
390 fRec47[0] = ((fSlow36 * ((fSlow56 * fVec1[1]) + (fSlow55 * fTemp1))) + (fSlow25 * fRec47[1]));
391 fRec46[0] = (fRec47[0] - (fSlow23 * ((fSlow21 * fRec46[2]) + (fSlow19 * fRec46[1]))));
392 fRec45[0] = ((fSlow23 * (((fSlow18 * fRec46[0]) + (fSlow57 * fRec46[1])) + (fSlow18 * fRec46[2]))) - (fSlow54 * ((fSlow53 * fRec45[2]) + fTemp21)));
393 fRec44[0] = ((fRec45[2] + (fSlow54 * (fTemp21 + (fSlow53 * fRec45[0])))) - (fSlow47 * ((fSlow46 * fRec44[2]) + fTemp20)));
394 fRec48[0] = (fSlow58 + (0.999 * fRec48[1]));
395 double fTemp22 = (fRec48[0] * (fRec44[2] + (fSlow47 * (fTemp20 + (fSlow46 * fRec44[0])))));
396 fVec7[IOTA&262143] = fTemp22;
397 double fTemp23 = ((int((fRec49[1] != 0.0)))?((int(((fRec50[1] > 0.0) & (fRec50[1] < 1.0))))?fRec49[1]:0):((int(((fRec50[1] == 0.0) & (fSlow59 != fRec51[1]))))?fConst3:((int(((fRec50[1] == 1.0) & (fSlow59 != fRec52[1]))))?fConst4:0)));
398 fRec49[0] = fTemp23;
399 fRec50[0] = max(0.0, min(1.0, (fRec50[1] + fTemp23)));
400 fRec51[0] = ((int(((fRec50[1] >= 1.0) & (fRec52[1] != fSlow59))))?fSlow59:fRec51[1]);
401 fRec52[0] = ((int(((fRec50[1] <= 0.0) & (fRec51[1] != fSlow59))))?fSlow59:fRec52[1]);
402 double fTemp24 = ((fRec50[0] * fVec7[(IOTA-int((int(fRec52[0]) & 262143)))&262143]) + ((1.0 - fRec50[0]) * fVec7[(IOTA-int((int(fRec51[0]) & 262143)))&262143]));
403 double fRec43 = max(fConst1, fabs(fTemp24));
404 int iTemp25 = int((iRec41[1] < 4096));
405 fRec40[0] = ((iTemp25)?max(fRec40[1], fRec43):fRec43);
406 iRec41[0] = ((iTemp25)?(1 + iRec41[1]):1);
407 fRec42[0] = ((iTemp25)?fRec42[1]:fRec40[1]);
408 fbargraph3 = fRec42[0];
409 double fTemp26 = (fSlow2 * fRec57[1]);
410 double fTemp27 = (fSlow10 * fRec58[1]);
411 double fTemp28 = (fSlow19 * fRec59[1]);
412 fRec61[0] = ((fSlow35 * ((fSlow62 * fVec0[1]) + (fSlow29 * fVec0[0]))) + (fSlow34 * fRec61[1]));
413 fRec60[0] = (fRec61[0] - (fSlow32 * ((fSlow30 * fRec60[2]) + (fSlow28 * fRec60[1]))));
414 fRec59[0] = ((fSlow32 * (((fSlow27 * fRec60[0]) + (fSlow63 * fRec60[1])) + (fSlow27 * fRec60[2]))) - (fSlow61 * ((fSlow60 * fRec59[2]) + fTemp28)));
415 fRec58[0] = ((fRec59[2] + (fSlow61 * (fTemp28 + (fSlow60 * fRec59[0])))) - (fSlow54 * ((fSlow53 * fRec58[2]) + fTemp27)));
416 fRec57[0] = ((fRec58[2] + (fSlow54 * (fTemp27 + (fSlow53 * fRec58[0])))) - (fSlow47 * ((fSlow46 * fRec57[2]) + fTemp26)));
417 fRec62[0] = (fSlow64 + (0.999 * fRec62[1]));
418 double fTemp29 = (fRec62[0] * (fRec57[2] + (fSlow47 * (fTemp26 + (fSlow46 * fRec57[0])))));
419 fVec8[IOTA&262143] = fTemp29;
420 double fTemp30 = ((int((fRec63[1] != 0.0)))?((int(((fRec64[1] > 0.0) & (fRec64[1] < 1.0))))?fRec63[1]:0):((int(((fRec64[1] == 0.0) & (fSlow65 != fRec65[1]))))?fConst3:((int(((fRec64[1] == 1.0) & (fSlow65 != fRec66[1]))))?fConst4:0)));
421 fRec63[0] = fTemp30;
422 fRec64[0] = max(0.0, min(1.0, (fRec64[1] + fTemp30)));
423 fRec65[0] = ((int(((fRec64[1] >= 1.0) & (fRec66[1] != fSlow65))))?fSlow65:fRec65[1]);
424 fRec66[0] = ((int(((fRec64[1] <= 0.0) & (fRec65[1] != fSlow65))))?fSlow65:fRec66[1]);
425 double fTemp31 = ((fRec64[0] * fVec8[(IOTA-int((int(fRec66[0]) & 262143)))&262143]) + ((1.0 - fRec64[0]) * fVec8[(IOTA-int((int(fRec65[0]) & 262143)))&262143]));
426 double fRec56 = max(fConst1, fabs(fTemp31));
427 int iTemp32 = int((iRec54[1] < 4096));
428 fRec53[0] = ((iTemp32)?max(fRec53[1], fRec56):fRec56);
429 iRec54[0] = ((iTemp32)?(1 + iRec54[1]):1);
430 fRec55[0] = ((iTemp32)?fRec55[1]:fRec53[1]);
431 fbargraph4 = fRec55[0];
432 output0[i] = (FAUSTFLOAT)(fTemp31 + (fTemp24 + (fTemp18 + (fTemp13 + (fVec0[0] + fTemp9)))));
433 // post processing
434 fRec55[1] = fRec55[0];
435 iRec54[1] = iRec54[0];
436 fRec53[1] = fRec53[0];
437 fRec66[1] = fRec66[0];
438 fRec65[1] = fRec65[0];
439 fRec64[1] = fRec64[0];
440 fRec63[1] = fRec63[0];
441 fRec62[1] = fRec62[0];
442 fRec57[2] = fRec57[1]; fRec57[1] = fRec57[0];
443 fRec58[2] = fRec58[1]; fRec58[1] = fRec58[0];
444 fRec59[2] = fRec59[1]; fRec59[1] = fRec59[0];
445 fRec60[2] = fRec60[1]; fRec60[1] = fRec60[0];
446 fRec61[1] = fRec61[0];
447 fRec42[1] = fRec42[0];
448 iRec41[1] = iRec41[0];
449 fRec40[1] = fRec40[0];
450 fRec52[1] = fRec52[0];
451 fRec51[1] = fRec51[0];
452 fRec50[1] = fRec50[0];
453 fRec49[1] = fRec49[0];
454 fRec48[1] = fRec48[0];
455 fRec44[2] = fRec44[1]; fRec44[1] = fRec44[0];
456 fRec45[2] = fRec45[1]; fRec45[1] = fRec45[0];
457 fRec46[2] = fRec46[1]; fRec46[1] = fRec46[0];
458 fRec47[1] = fRec47[0];
459 fRec30[1] = fRec30[0];
460 iRec29[1] = iRec29[0];
461 fRec28[1] = fRec28[0];
462 fRec39[1] = fRec39[0];
463 fRec38[1] = fRec38[0];
464 fRec37[1] = fRec37[0];
465 fRec36[1] = fRec36[0];
466 fRec35[1] = fRec35[0];
467 fRec32[2] = fRec32[1]; fRec32[1] = fRec32[0];
468 fRec33[2] = fRec33[1]; fRec33[1] = fRec33[0];
469 fRec34[1] = fRec34[0];
470 fRec19[1] = fRec19[0];
471 iRec18[1] = iRec18[0];
472 fRec17[1] = fRec17[0];
473 fRec27[1] = fRec27[0];
474 fRec26[1] = fRec26[0];
475 fRec25[1] = fRec25[0];
476 fRec24[1] = fRec24[0];
477 fRec23[1] = fRec23[0];
478 fRec21[2] = fRec21[1]; fRec21[1] = fRec21[0];
479 fRec22[1] = fRec22[0];
480 fRec2[1] = fRec2[0];
481 iRec1[1] = iRec1[0];
482 fRec0[1] = fRec0[0];
483 fRec16[1] = fRec16[0];
484 fRec15[1] = fRec15[0];
485 fRec14[1] = fRec14[0];
486 fRec13[1] = fRec13[0];
487 IOTA = IOTA+1;
488 fRec12[1] = fRec12[0];
489 fRec4[2] = fRec4[1]; fRec4[1] = fRec4[0];
490 fRec5[1] = fRec5[0];
491 fVec3[1] = fVec3[0];
492 fRec6[2] = fRec6[1]; fRec6[1] = fRec6[0];
493 fRec7[1] = fRec7[0];
494 fVec2[1] = fVec2[0];
495 fRec8[2] = fRec8[1]; fRec8[1] = fRec8[0];
496 fRec9[1] = fRec9[0];
497 fVec1[1] = fVec1[0];
498 fRec10[2] = fRec10[1]; fRec10[1] = fRec10[0];
499 fRec11[1] = fRec11[0];
500 fVec0[1] = fVec0[0];
501 }
502 }
503
504 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
505 {
506 static_cast<Dsp*>(p)->compute(count, input0, output0);
507 }
508
509 int Dsp::register_par(const ParamReg& reg)
510 {
511 reg.registerVar("mbdel.crossover_b1_b2",N_("Crossover B1-B2 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider0, 8e+01, 2e+01, 2e+04, 1.08);
512 reg.registerVar("mbdel.crossover_b2_b3",N_("Crossover B2-B3 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider1, 2.1e+02, 2e+01, 2e+04, 1.08);
513 reg.registerVar("mbdel.crossover_b3_b4",N_("Crossover B3-B4 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider2, 1.7e+03, 2e+01, 2e+04, 1.08);
514 reg.registerVar("mbdel.crossover_b4_b5",N_("Crossover B4-B5 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider3, 5e+03, 2e+01, 2e+04, 1.08);
515 reg.registerVar("mbdel.delay1","","S",N_("Delay in Beats per Minute"),&fslider5, 3e+01, 24.0, 3.6e+02, 1.0);
516 reg.registerVar("mbdel.delay2","","S",N_("Delay in Beats per Minute"),&fslider7, 6e+01, 24.0, 3.6e+02, 1.0);
517 reg.registerVar("mbdel.delay3","","S",N_("Delay in Beats per Minute"),&fslider9, 9e+01, 24.0, 3.6e+02, 1.0);
518 reg.registerVar("mbdel.delay4","","S",N_("Delay in Beats per Minute"),&fslider11, 1.2e+02, 24.0, 3.6e+02, 1.0);
519 reg.registerVar("mbdel.delay5","","S",N_("Delay in Beats per Minute"),&fslider13, 1.5e+02, 24.0, 3.6e+02, 1.0);
520 reg.registerVar("mbdel.gain1","","S","",&fslider4, -1e+01, -2e+01, 2e+01, 0.1);
521 reg.registerVar("mbdel.gain2","","S","",&fslider6, -5.0, -2e+01, 2e+01, 0.1);
522 reg.registerVar("mbdel.gain3","","S","",&fslider8, -2.0, -2e+01, 2e+01, 0.1);
523 reg.registerVar("mbdel.gain4","","S","",&fslider10, 0.0, -2e+01, 2e+01, 0.1);
524 reg.registerVar("mbdel.gain5","","S","",&fslider12, -1e+01, -2e+01, 2e+01, 0.1);
525 reg.registerNonMidiFloatVar("mbdel.v1",&fbargraph0, false, true, -70.0, -70.0, 4.0, 0.00001);
526 reg.registerNonMidiFloatVar("mbdel.v2",&fbargraph1, false, true, -70.0, -70.0, 4.0, 0.00001);
527 reg.registerNonMidiFloatVar("mbdel.v3",&fbargraph2, false, true, -70.0, -70.0, 4.0, 0.00001);
528 reg.registerNonMidiFloatVar("mbdel.v4",&fbargraph3, false, true, -70.0, -70.0, 4.0, 0.00001);
529 reg.registerNonMidiFloatVar("mbdel.v5",&fbargraph4, false, true, -70.0, -70.0, 4.0, 0.00001);
530 return 0;
531 }
532
533 int Dsp::register_params_static(const ParamReg& reg)
534 {
535 return static_cast<Dsp*>(reg.plugin)->register_par(reg);
536 }
537
538 inline int Dsp::load_ui_f(const UiBuilder& b, int form)
539 {
540 if (form & UI_FORM_STACK) {
541 #define PARAM(p) ("mbdel" "." p)
542
543 b.openHorizontalhideBox("");
544 b.closeBox();
545
546 b.openHorizontalBox("");
547 b.openVerticalBox("");
548
549 b.openTabBox("");
550
551 b.openHorizontalBox(N_("Band 1"));
552 b.openVerticalBox("");
553 b.openpaintampBox("");
554 b.openHorizontalBox("");
555 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
556 b.create_small_rackknob(PARAM("delay1"), N_("BPM"));
557 b.set_next_flags(UI_NUM_RIGHT);
558 b.create_small_rackknob(PARAM("gain1"), N_("Gain (db)"));
559 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
560 b.create_small_rackknob(PARAM("crossover_b1_b2"), N_("Low Shelf (Hz)"));
561 b.closeBox();
562 b.closeBox();
563 b.closeBox();
564 b.closeBox();
565
566 b.openHorizontalBox(N_("Band 2"));
567 b.openVerticalBox("");
568 b.openpaintampBox("");
569 b.openHorizontalBox("");
570 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
571 b.create_small_rackknob(PARAM("delay2"), N_("BPM"));
572 b.set_next_flags(UI_NUM_RIGHT);
573 b.create_small_rackknob(PARAM("gain2"), N_("Gain (db)"));
574 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
575 b.create_small_rackknob(PARAM("crossover_b1_b2"), N_("Low (Hz)"));
576 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
577 b.create_small_rackknob(PARAM("crossover_b2_b3"), N_("High (hz)"));
578 b.closeBox();
579 b.closeBox();
580 b.closeBox();
581 b.closeBox();
582
583 b.openHorizontalBox(N_("Band 3"));
584 b.openVerticalBox("");
585 b.openpaintampBox("");
586 b.openHorizontalBox("");
587 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
588 b.create_small_rackknob(PARAM("delay3"), N_("BPM"));
589 b.set_next_flags(UI_NUM_RIGHT);
590 b.create_small_rackknob(PARAM("gain3"), N_("Gain (db)"));
591 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
592 b.create_small_rackknob(PARAM("crossover_b2_b3"), N_("Low (Hz)"));
593 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
594 b.create_small_rackknob(PARAM("crossover_b3_b4"), N_("High (hz)"));
595 b.closeBox();
596 b.closeBox();
597 b.closeBox();
598 b.closeBox();
599
600 b.openHorizontalBox(N_("Band 4"));
601 b.openVerticalBox("");
602 b.openpaintampBox("");
603 b.openHorizontalBox("");
604 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
605 b.create_small_rackknob(PARAM("delay4"), N_("BPM"));
606 b.set_next_flags(UI_NUM_RIGHT);
607 b.create_small_rackknob(PARAM("gain4"), N_("Gain (db)"));
608 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
609 b.create_small_rackknob(PARAM("crossover_b3_b4"), N_("Low (Hz)"));
610 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
611 b.create_small_rackknob(PARAM("crossover_b4_b5"), N_("High (hz)"));
612 b.closeBox();
613 b.closeBox();
614 b.closeBox();
615 b.closeBox();
616
617 b.openHorizontalBox(N_("Band 5"));
618 b.openVerticalBox("");
619 b.openpaintampBox("");
620 b.openHorizontalBox("");
621 b.set_next_flags(UI_NUM_RIGHT);
622 b.create_small_rackknob(PARAM("delay5"), N_("BPM"));
623 b.set_next_flags(UI_NUM_RIGHT);
624 b.create_small_rackknob(PARAM("gain5"), N_("Gain (db)"));
625 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
626 b.create_small_rackknob(PARAM("crossover_b4_b5"), N_("High Shelf (Hz)"));
627 b.closeBox();
628 b.closeBox();
629 b.closeBox();
630 b.closeBox();
631
632 b.closeBox();
633 b.closeBox();
634 b.openVerticalBox2("Analyze");
635 b.create_simple_meter(PARAM("v1"));
636 b.create_simple_meter(PARAM("v2"));
637 b.create_simple_meter(PARAM("v3"));
638 b.create_simple_meter(PARAM("v4"));
639 b.create_simple_meter(PARAM("v5"));
640 b.closeBox();
641 b.closeBox();
642
643 #undef PARAM
644 return 0;
645 }
646 return -1;
647 }
648
649 int Dsp::load_ui_f_static(const UiBuilder& b, int form)
650 {
651 return static_cast<Dsp*>(b.plugin)->load_ui_f(b, form);
652 }
653 PluginDef *plugin() {
654 return new Dsp();
655 }
656
657 void Dsp::del_instance(PluginDef *p)
658 {
659 delete static_cast<Dsp*>(p);
660 }
661
662 } // end namespace mbdel
663 } // end namespace pluginlib
0 // generated from file '../src/plugins/mbe.dsp' by dsp2cc:
1 // Code generated with Faust 0.9.58 (http://faust.grame.fr)
2
3 #include "gx_faust_support.h"
4 #include "gx_plugin.h"
5
6 namespace pluginlib {
7 namespace mbe {
8
9 class Dsp: public PluginDef {
10 private:
11 int fSamplingFreq;
12 int iConst0;
13 double fConst1;
14 double fConst2;
15 double fConst3;
16 FAUSTFLOAT fslider0;
17 int iConst4;
18 double fRec5[2];
19 double fRec6[2];
20 double fRec7[2];
21 double fRec8[2];
22 FAUSTFLOAT fslider1;
23 double fRec9[2];
24 FAUSTFLOAT fslider2;
25 double fConst5;
26 FAUSTFLOAT fslider3;
27 FAUSTFLOAT fslider4;
28 FAUSTFLOAT fslider5;
29 double fVec0[2];
30 double fRec17[2];
31 double fRec16[3];
32 double fVec1[2];
33 double fRec15[2];
34 double fRec14[3];
35 double fVec2[2];
36 double fRec13[2];
37 double fRec12[3];
38 double fVec3[2];
39 double fRec11[2];
40 double fRec10[3];
41 int IOTA;
42 double fRec4[524288];
43 double fRec0[2];
44 int iRec1[2];
45 double fRec2[2];
46 FAUSTFLOAT fbargraph0;
47 FAUSTFLOAT fslider6;
48 double fRec23[2];
49 double fRec24[2];
50 double fRec25[2];
51 double fRec26[2];
52 FAUSTFLOAT fslider7;
53 double fRec27[2];
54 double fRec29[2];
55 double fRec28[3];
56 double fRec22[524288];
57 double fRec18[2];
58 int iRec19[2];
59 double fRec20[2];
60 FAUSTFLOAT fbargraph1;
61 FAUSTFLOAT fslider8;
62 double fRec35[2];
63 double fRec36[2];
64 double fRec37[2];
65 double fRec38[2];
66 FAUSTFLOAT fslider9;
67 double fRec39[2];
68 double fRec42[2];
69 double fRec41[3];
70 double fRec40[3];
71 double fRec34[524288];
72 double fRec30[2];
73 int iRec31[2];
74 double fRec32[2];
75 FAUSTFLOAT fbargraph2;
76 FAUSTFLOAT fslider10;
77 double fRec48[2];
78 double fRec49[2];
79 double fRec50[2];
80 double fRec51[2];
81 FAUSTFLOAT fslider11;
82 double fRec52[2];
83 double fRec56[2];
84 double fRec55[3];
85 double fRec54[3];
86 double fRec53[3];
87 double fRec47[524288];
88 double fRec43[2];
89 int iRec44[2];
90 double fRec45[2];
91 FAUSTFLOAT fbargraph3;
92 FAUSTFLOAT fslider12;
93 double fRec62[2];
94 double fRec63[2];
95 double fRec64[2];
96 double fRec65[2];
97 FAUSTFLOAT fslider13;
98 double fRec66[2];
99 double fRec71[2];
100 double fRec70[3];
101 double fRec69[3];
102 double fRec68[3];
103 double fRec67[3];
104 double fRec61[524288];
105 double fRec57[2];
106 int iRec58[2];
107 double fRec59[2];
108 FAUSTFLOAT fbargraph4;
109 void clear_state_f();
110 int load_ui_f(const UiBuilder& b, int form);
111 void init(unsigned int samplingFreq);
112 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
113 int register_par(const ParamReg& reg);
114
115 static void clear_state_f_static(PluginDef*);
116 static int load_ui_f_static(const UiBuilder& b, int form);
117 static void init_static(unsigned int samplingFreq, PluginDef*);
118 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
119 static int register_params_static(const ParamReg& reg);
120 static void del_instance(PluginDef *p);
121 public:
122 Dsp();
123 ~Dsp();
124 };
125
126
127
128 Dsp::Dsp()
129 : PluginDef() {
130 version = PLUGINDEF_VERSION;
131 flags = 0;
132 id = "mbe";
133 name = N_("MultiBand Echo");
134 groups = 0;
135 description = N_("Multi Band Echo"); // description (tooltip)
136 category = N_("Echo / Delay"); // category
137 shortname = N_("MB Echo"); // shortname
138 mono_audio = compute_static;
139 stereo_audio = 0;
140 set_samplerate = init_static;
141 activate_plugin = 0;
142 register_params = register_params_static;
143 load_ui = load_ui_f_static;
144 clear_state = clear_state_f_static;
145 delete_instance = del_instance;
146 }
147
148 Dsp::~Dsp() {
149 }
150
151 inline void Dsp::clear_state_f()
152 {
153 for (int i=0; i<2; i++) fRec5[i] = 0;
154 for (int i=0; i<2; i++) fRec6[i] = 0;
155 for (int i=0; i<2; i++) fRec7[i] = 0;
156 for (int i=0; i<2; i++) fRec8[i] = 0;
157 for (int i=0; i<2; i++) fRec9[i] = 0;
158 for (int i=0; i<2; i++) fVec0[i] = 0;
159 for (int i=0; i<2; i++) fRec17[i] = 0;
160 for (int i=0; i<3; i++) fRec16[i] = 0;
161 for (int i=0; i<2; i++) fVec1[i] = 0;
162 for (int i=0; i<2; i++) fRec15[i] = 0;
163 for (int i=0; i<3; i++) fRec14[i] = 0;
164 for (int i=0; i<2; i++) fVec2[i] = 0;
165 for (int i=0; i<2; i++) fRec13[i] = 0;
166 for (int i=0; i<3; i++) fRec12[i] = 0;
167 for (int i=0; i<2; i++) fVec3[i] = 0;
168 for (int i=0; i<2; i++) fRec11[i] = 0;
169 for (int i=0; i<3; i++) fRec10[i] = 0;
170 for (int i=0; i<524288; i++) fRec4[i] = 0;
171 for (int i=0; i<2; i++) fRec0[i] = 0;
172 for (int i=0; i<2; i++) iRec1[i] = 0;
173 for (int i=0; i<2; i++) fRec2[i] = 0;
174 for (int i=0; i<2; i++) fRec23[i] = 0;
175 for (int i=0; i<2; i++) fRec24[i] = 0;
176 for (int i=0; i<2; i++) fRec25[i] = 0;
177 for (int i=0; i<2; i++) fRec26[i] = 0;
178 for (int i=0; i<2; i++) fRec27[i] = 0;
179 for (int i=0; i<2; i++) fRec29[i] = 0;
180 for (int i=0; i<3; i++) fRec28[i] = 0;
181 for (int i=0; i<524288; i++) fRec22[i] = 0;
182 for (int i=0; i<2; i++) fRec18[i] = 0;
183 for (int i=0; i<2; i++) iRec19[i] = 0;
184 for (int i=0; i<2; i++) fRec20[i] = 0;
185 for (int i=0; i<2; i++) fRec35[i] = 0;
186 for (int i=0; i<2; i++) fRec36[i] = 0;
187 for (int i=0; i<2; i++) fRec37[i] = 0;
188 for (int i=0; i<2; i++) fRec38[i] = 0;
189 for (int i=0; i<2; i++) fRec39[i] = 0;
190 for (int i=0; i<2; i++) fRec42[i] = 0;
191 for (int i=0; i<3; i++) fRec41[i] = 0;
192 for (int i=0; i<3; i++) fRec40[i] = 0;
193 for (int i=0; i<524288; i++) fRec34[i] = 0;
194 for (int i=0; i<2; i++) fRec30[i] = 0;
195 for (int i=0; i<2; i++) iRec31[i] = 0;
196 for (int i=0; i<2; i++) fRec32[i] = 0;
197 for (int i=0; i<2; i++) fRec48[i] = 0;
198 for (int i=0; i<2; i++) fRec49[i] = 0;
199 for (int i=0; i<2; i++) fRec50[i] = 0;
200 for (int i=0; i<2; i++) fRec51[i] = 0;
201 for (int i=0; i<2; i++) fRec52[i] = 0;
202 for (int i=0; i<2; i++) fRec56[i] = 0;
203 for (int i=0; i<3; i++) fRec55[i] = 0;
204 for (int i=0; i<3; i++) fRec54[i] = 0;
205 for (int i=0; i<3; i++) fRec53[i] = 0;
206 for (int i=0; i<524288; i++) fRec47[i] = 0;
207 for (int i=0; i<2; i++) fRec43[i] = 0;
208 for (int i=0; i<2; i++) iRec44[i] = 0;
209 for (int i=0; i<2; i++) fRec45[i] = 0;
210 for (int i=0; i<2; i++) fRec62[i] = 0;
211 for (int i=0; i<2; i++) fRec63[i] = 0;
212 for (int i=0; i<2; i++) fRec64[i] = 0;
213 for (int i=0; i<2; i++) fRec65[i] = 0;
214 for (int i=0; i<2; i++) fRec66[i] = 0;
215 for (int i=0; i<2; i++) fRec71[i] = 0;
216 for (int i=0; i<3; i++) fRec70[i] = 0;
217 for (int i=0; i<3; i++) fRec69[i] = 0;
218 for (int i=0; i<3; i++) fRec68[i] = 0;
219 for (int i=0; i<3; i++) fRec67[i] = 0;
220 for (int i=0; i<524288; i++) fRec61[i] = 0;
221 for (int i=0; i<2; i++) fRec57[i] = 0;
222 for (int i=0; i<2; i++) iRec58[i] = 0;
223 for (int i=0; i<2; i++) fRec59[i] = 0;
224 }
225
226 void Dsp::clear_state_f_static(PluginDef *p)
227 {
228 static_cast<Dsp*>(p)->clear_state_f();
229 }
230
231 inline void Dsp::init(unsigned int samplingFreq)
232 {
233 fSamplingFreq = samplingFreq;
234 iConst0 = min(192000, max(1, fSamplingFreq));
235 fConst1 = (1.0 / double(iConst0));
236 fConst2 = (1e+01 / double(iConst0));
237 fConst3 = (0 - fConst2);
238 iConst4 = (60 * iConst0);
239 fConst5 = (3.141592653589793 / double(iConst0));
240 IOTA = 0;
241 clear_state_f();
242 }
243
244 void Dsp::init_static(unsigned int samplingFreq, PluginDef *p)
245 {
246 static_cast<Dsp*>(p)->init(samplingFreq);
247 }
248
249 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
250 {
251 double fSlow0 = (double(iConst4) / fslider0);
252 double fSlow1 = (1.000000000000001e-05 * fslider1);
253 double fSlow2 = tan((fConst5 * fslider2));
254 double fSlow3 = (1.0 / faustpower<2>(fSlow2));
255 double fSlow4 = (2 * (1 - fSlow3));
256 double fSlow5 = (1.0 / fSlow2);
257 double fSlow6 = (1 + ((fSlow5 - 1.0000000000000004) / fSlow2));
258 double fSlow7 = (1.0 / (1 + ((fSlow5 + 1.0000000000000004) / fSlow2)));
259 double fSlow8 = (1 + fSlow5);
260 double fSlow9 = (0 - ((1 - fSlow5) / fSlow8));
261 double fSlow10 = tan((fConst5 * fslider3));
262 double fSlow11 = (1.0 / faustpower<2>(fSlow10));
263 double fSlow12 = (2 * (1 - fSlow11));
264 double fSlow13 = (1.0 / fSlow10);
265 double fSlow14 = (1 + ((fSlow13 - 1.0000000000000004) / fSlow10));
266 double fSlow15 = (1 + ((fSlow13 + 1.0000000000000004) / fSlow10));
267 double fSlow16 = (1.0 / fSlow15);
268 double fSlow17 = (1 + fSlow13);
269 double fSlow18 = (0 - ((1 - fSlow13) / fSlow17));
270 double fSlow19 = tan((fConst5 * fslider4));
271 double fSlow20 = (1.0 / faustpower<2>(fSlow19));
272 double fSlow21 = (2 * (1 - fSlow20));
273 double fSlow22 = (1.0 / fSlow19);
274 double fSlow23 = (1 + ((fSlow22 - 1.0000000000000004) / fSlow19));
275 double fSlow24 = (1 + ((fSlow22 + 1.0000000000000004) / fSlow19));
276 double fSlow25 = (1.0 / fSlow24);
277 double fSlow26 = (1 + fSlow22);
278 double fSlow27 = (0 - ((1 - fSlow22) / fSlow26));
279 double fSlow28 = tan((fConst5 * fslider5));
280 double fSlow29 = (1.0 / faustpower<2>(fSlow28));
281 double fSlow30 = (2 * (1 - fSlow29));
282 double fSlow31 = (1.0 / fSlow28);
283 double fSlow32 = (1 + ((fSlow31 - 1.0000000000000004) / fSlow28));
284 double fSlow33 = (1 + ((1.0000000000000004 + fSlow31) / fSlow28));
285 double fSlow34 = (1.0 / fSlow33);
286 double fSlow35 = (1 + fSlow31);
287 double fSlow36 = (0 - ((1 - fSlow31) / fSlow35));
288 double fSlow37 = (1.0 / fSlow35);
289 double fSlow38 = (1.0 / fSlow26);
290 double fSlow39 = (1.0 / fSlow17);
291 double fSlow40 = (1.0 / fSlow8);
292 double fSlow41 = (double(iConst4) / fslider6);
293 double fSlow42 = (1.000000000000001e-05 * fslider7);
294 double fSlow43 = (1.0 / (fSlow2 * fSlow15));
295 double fSlow44 = (0 - fSlow5);
296 double fSlow45 = (2 * (0 - fSlow3));
297 double fSlow46 = (double(iConst4) / fslider8);
298 double fSlow47 = (1.000000000000001e-05 * fslider9);
299 double fSlow48 = (1 + ((fSlow5 - 1.0) / fSlow2));
300 double fSlow49 = (1.0 / (1 + ((1.0 + fSlow5) / fSlow2)));
301 double fSlow50 = (1.0 / (fSlow10 * fSlow24));
302 double fSlow51 = (0 - fSlow13);
303 double fSlow52 = (2 * (0 - fSlow11));
304 double fSlow53 = (double(iConst4) / fslider10);
305 double fSlow54 = (1.000000000000001e-05 * fslider11);
306 double fSlow55 = (1 + ((fSlow13 - 1.0) / fSlow10));
307 double fSlow56 = (1.0 / (1 + ((1.0 + fSlow13) / fSlow10)));
308 double fSlow57 = (1.0 / (fSlow19 * fSlow33));
309 double fSlow58 = (0 - fSlow22);
310 double fSlow59 = (2 * (0 - fSlow20));
311 double fSlow60 = (double(iConst4) / fslider12);
312 double fSlow61 = (1.000000000000001e-05 * fslider13);
313 double fSlow62 = (1 + ((fSlow22 - 1.0) / fSlow19));
314 double fSlow63 = (1.0 / (1 + ((1.0 + fSlow22) / fSlow19)));
315 double fSlow64 = (0 - fSlow31);
316 double fSlow65 = (2 * (0 - fSlow29));
317 for (int i=0; i<count; i++) {
318 double fTemp0 = ((int((fRec5[1] != 0.0)))?((int(((fRec6[1] > 0.0) & (fRec6[1] < 1.0))))?fRec5[1]:0):((int(((fRec6[1] == 0.0) & (fSlow0 != fRec7[1]))))?fConst2:((int(((fRec6[1] == 1.0) & (fSlow0 != fRec8[1]))))?fConst3:0)));
319 fRec5[0] = fTemp0;
320 fRec6[0] = max(0.0, min(1.0, (fRec6[1] + fTemp0)));
321 fRec7[0] = ((int(((fRec6[1] >= 1.0) & (fRec8[1] != fSlow0))))?fSlow0:fRec7[1]);
322 fRec8[0] = ((int(((fRec6[1] <= 0.0) & (fRec7[1] != fSlow0))))?fSlow0:fRec8[1]);
323 fRec9[0] = (fSlow1 + (0.999 * fRec9[1]));
324 double fTemp1 = (double)input0[i];
325 fVec0[0] = fTemp1;
326 fRec17[0] = ((fSlow37 * (fVec0[0] + fVec0[1])) + (fSlow36 * fRec17[1]));
327 fRec16[0] = (fRec17[0] - (fSlow34 * ((fSlow32 * fRec16[2]) + (fSlow30 * fRec16[1]))));
328 double fTemp2 = (fRec16[2] + (fRec16[0] + (2 * fRec16[1])));
329 double fTemp3 = (fSlow34 * fTemp2);
330 fVec1[0] = fTemp3;
331 fRec15[0] = ((fSlow38 * (fVec1[0] + fVec1[1])) + (fSlow27 * fRec15[1]));
332 fRec14[0] = (fRec15[0] - (fSlow25 * ((fSlow23 * fRec14[2]) + (fSlow21 * fRec14[1]))));
333 double fTemp4 = (fRec14[2] + (fRec14[0] + (2 * fRec14[1])));
334 double fTemp5 = (fSlow25 * fTemp4);
335 fVec2[0] = fTemp5;
336 fRec13[0] = ((fSlow39 * (fVec2[0] + fVec2[1])) + (fSlow18 * fRec13[1]));
337 fRec12[0] = (fRec13[0] - (fSlow16 * ((fSlow14 * fRec12[2]) + (fSlow12 * fRec12[1]))));
338 double fTemp6 = (fRec12[2] + (fRec12[0] + (2 * fRec12[1])));
339 double fTemp7 = (fSlow16 * fTemp6);
340 fVec3[0] = fTemp7;
341 fRec11[0] = ((fSlow40 * (fVec3[0] + fVec3[1])) + (fSlow9 * fRec11[1]));
342 fRec10[0] = (fRec11[0] - (fSlow7 * ((fSlow6 * fRec10[2]) + (fSlow4 * fRec10[1]))));
343 fRec4[IOTA&524287] = ((fSlow7 * (fRec10[2] + (fRec10[0] + (2 * fRec10[1])))) + (fRec9[0] * ((fRec6[0] * fRec4[(IOTA-int((1 + int((int(fRec8[0]) & 262143)))))&524287]) + ((1.0 - fRec6[0]) * fRec4[(IOTA-int((1 + int((int(fRec7[0]) & 262143)))))&524287]))));
344 double fTemp8 = fRec4[(IOTA-0)&524287];
345 double fRec3 = max(fConst1, fabs(fTemp8));
346 int iTemp9 = int((iRec1[1] < 4096));
347 fRec0[0] = ((iTemp9)?max(fRec0[1], fRec3):fRec3);
348 iRec1[0] = ((iTemp9)?(1 + iRec1[1]):1);
349 fRec2[0] = ((iTemp9)?fRec2[1]:fRec0[1]);
350 fbargraph0 = fRec2[0];
351 double fTemp10 = ((int((fRec23[1] != 0.0)))?((int(((fRec24[1] > 0.0) & (fRec24[1] < 1.0))))?fRec23[1]:0):((int(((fRec24[1] == 0.0) & (fSlow41 != fRec25[1]))))?fConst2:((int(((fRec24[1] == 1.0) & (fSlow41 != fRec26[1]))))?fConst3:0)));
352 fRec23[0] = fTemp10;
353 fRec24[0] = max(0.0, min(1.0, (fRec24[1] + fTemp10)));
354 fRec25[0] = ((int(((fRec24[1] >= 1.0) & (fRec26[1] != fSlow41))))?fSlow41:fRec25[1]);
355 fRec26[0] = ((int(((fRec24[1] <= 0.0) & (fRec25[1] != fSlow41))))?fSlow41:fRec26[1]);
356 fRec27[0] = (fSlow42 + (0.999 * fRec27[1]));
357 fRec29[0] = ((fSlow40 * ((fSlow44 * fVec3[1]) + (fSlow43 * fTemp6))) + (fSlow9 * fRec29[1]));
358 fRec28[0] = (fRec29[0] - (fSlow7 * ((fSlow6 * fRec28[2]) + (fSlow4 * fRec28[1]))));
359 fRec22[IOTA&524287] = ((fSlow7 * (((fSlow3 * fRec28[0]) + (fSlow45 * fRec28[1])) + (fSlow3 * fRec28[2]))) + (fRec27[0] * ((fRec24[0] * fRec22[(IOTA-int((1 + int((int(fRec26[0]) & 262143)))))&524287]) + ((1.0 - fRec24[0]) * fRec22[(IOTA-int((1 + int((int(fRec25[0]) & 262143)))))&524287]))));
360 double fTemp11 = fRec22[(IOTA-0)&524287];
361 double fRec21 = max(fConst1, fabs(fTemp11));
362 int iTemp12 = int((iRec19[1] < 4096));
363 fRec18[0] = ((iTemp12)?max(fRec18[1], fRec21):fRec21);
364 iRec19[0] = ((iTemp12)?(1 + iRec19[1]):1);
365 fRec20[0] = ((iTemp12)?fRec20[1]:fRec18[1]);
366 fbargraph1 = fRec20[0];
367 double fTemp13 = ((int((fRec35[1] != 0.0)))?((int(((fRec36[1] > 0.0) & (fRec36[1] < 1.0))))?fRec35[1]:0):((int(((fRec36[1] == 0.0) & (fSlow46 != fRec37[1]))))?fConst2:((int(((fRec36[1] == 1.0) & (fSlow46 != fRec38[1]))))?fConst3:0)));
368 fRec35[0] = fTemp13;
369 fRec36[0] = max(0.0, min(1.0, (fRec36[1] + fTemp13)));
370 fRec37[0] = ((int(((fRec36[1] >= 1.0) & (fRec38[1] != fSlow46))))?fSlow46:fRec37[1]);
371 fRec38[0] = ((int(((fRec36[1] <= 0.0) & (fRec37[1] != fSlow46))))?fSlow46:fRec38[1]);
372 fRec39[0] = (fSlow47 + (0.999 * fRec39[1]));
373 double fTemp14 = (fSlow4 * fRec40[1]);
374 fRec42[0] = ((fSlow39 * ((fSlow51 * fVec2[1]) + (fSlow50 * fTemp4))) + (fSlow18 * fRec42[1]));
375 fRec41[0] = (fRec42[0] - (fSlow16 * ((fSlow14 * fRec41[2]) + (fSlow12 * fRec41[1]))));
376 fRec40[0] = ((fSlow16 * (((fSlow11 * fRec41[0]) + (fSlow52 * fRec41[1])) + (fSlow11 * fRec41[2]))) - (fSlow49 * ((fSlow48 * fRec40[2]) + fTemp14)));
377 fRec34[IOTA&524287] = ((fRec40[2] + (fSlow49 * (fTemp14 + (fSlow48 * fRec40[0])))) + (fRec39[0] * ((fRec36[0] * fRec34[(IOTA-int((1 + int((int(fRec38[0]) & 262143)))))&524287]) + ((1.0 - fRec36[0]) * fRec34[(IOTA-int((1 + int((int(fRec37[0]) & 262143)))))&524287]))));
378 double fTemp15 = fRec34[(IOTA-0)&524287];
379 double fRec33 = max(fConst1, fabs(fTemp15));
380 int iTemp16 = int((iRec31[1] < 4096));
381 fRec30[0] = ((iTemp16)?max(fRec30[1], fRec33):fRec33);
382 iRec31[0] = ((iTemp16)?(1 + iRec31[1]):1);
383 fRec32[0] = ((iTemp16)?fRec32[1]:fRec30[1]);
384 fbargraph2 = fRec32[0];
385 double fTemp17 = ((int((fRec48[1] != 0.0)))?((int(((fRec49[1] > 0.0) & (fRec49[1] < 1.0))))?fRec48[1]:0):((int(((fRec49[1] == 0.0) & (fSlow53 != fRec50[1]))))?fConst2:((int(((fRec49[1] == 1.0) & (fSlow53 != fRec51[1]))))?fConst3:0)));
386 fRec48[0] = fTemp17;
387 fRec49[0] = max(0.0, min(1.0, (fRec49[1] + fTemp17)));
388 fRec50[0] = ((int(((fRec49[1] >= 1.0) & (fRec51[1] != fSlow53))))?fSlow53:fRec50[1]);
389 fRec51[0] = ((int(((fRec49[1] <= 0.0) & (fRec50[1] != fSlow53))))?fSlow53:fRec51[1]);
390 fRec52[0] = (fSlow54 + (0.999 * fRec52[1]));
391 double fTemp18 = (fSlow4 * fRec53[1]);
392 double fTemp19 = (fSlow12 * fRec54[1]);
393 fRec56[0] = ((fSlow38 * ((fSlow58 * fVec1[1]) + (fSlow57 * fTemp2))) + (fSlow27 * fRec56[1]));
394 fRec55[0] = (fRec56[0] - (fSlow25 * ((fSlow23 * fRec55[2]) + (fSlow21 * fRec55[1]))));
395 fRec54[0] = ((fSlow25 * (((fSlow20 * fRec55[0]) + (fSlow59 * fRec55[1])) + (fSlow20 * fRec55[2]))) - (fSlow56 * ((fSlow55 * fRec54[2]) + fTemp19)));
396 fRec53[0] = ((fRec54[2] + (fSlow56 * (fTemp19 + (fSlow55 * fRec54[0])))) - (fSlow49 * ((fSlow48 * fRec53[2]) + fTemp18)));
397 fRec47[IOTA&524287] = ((fRec53[2] + (fSlow49 * (fTemp18 + (fSlow48 * fRec53[0])))) + (fRec52[0] * ((fRec49[0] * fRec47[(IOTA-int((1 + int((int(fRec51[0]) & 262143)))))&524287]) + ((1.0 - fRec49[0]) * fRec47[(IOTA-int((1 + int((int(fRec50[0]) & 262143)))))&524287]))));
398 double fTemp20 = fRec47[(IOTA-0)&524287];
399 double fRec46 = max(fConst1, fabs(fTemp20));
400 int iTemp21 = int((iRec44[1] < 4096));
401 fRec43[0] = ((iTemp21)?max(fRec43[1], fRec46):fRec46);
402 iRec44[0] = ((iTemp21)?(1 + iRec44[1]):1);
403 fRec45[0] = ((iTemp21)?fRec45[1]:fRec43[1]);
404 fbargraph3 = fRec45[0];
405 double fTemp22 = ((int((fRec62[1] != 0.0)))?((int(((fRec63[1] > 0.0) & (fRec63[1] < 1.0))))?fRec62[1]:0):((int(((fRec63[1] == 0.0) & (fSlow60 != fRec64[1]))))?fConst2:((int(((fRec63[1] == 1.0) & (fSlow60 != fRec65[1]))))?fConst3:0)));
406 fRec62[0] = fTemp22;
407 fRec63[0] = max(0.0, min(1.0, (fRec63[1] + fTemp22)));
408 fRec64[0] = ((int(((fRec63[1] >= 1.0) & (fRec65[1] != fSlow60))))?fSlow60:fRec64[1]);
409 fRec65[0] = ((int(((fRec63[1] <= 0.0) & (fRec64[1] != fSlow60))))?fSlow60:fRec65[1]);
410 fRec66[0] = (fSlow61 + (0.999 * fRec66[1]));
411 double fTemp23 = (fSlow4 * fRec67[1]);
412 double fTemp24 = (fSlow12 * fRec68[1]);
413 double fTemp25 = (fSlow21 * fRec69[1]);
414 fRec71[0] = ((fSlow37 * ((fSlow64 * fVec0[1]) + (fSlow31 * fVec0[0]))) + (fSlow36 * fRec71[1]));
415 fRec70[0] = (fRec71[0] - (fSlow34 * ((fSlow32 * fRec70[2]) + (fSlow30 * fRec70[1]))));
416 fRec69[0] = ((fSlow34 * (((fSlow29 * fRec70[0]) + (fSlow65 * fRec70[1])) + (fSlow29 * fRec70[2]))) - (fSlow63 * ((fSlow62 * fRec69[2]) + fTemp25)));
417 fRec68[0] = ((fRec69[2] + (fSlow63 * (fTemp25 + (fSlow62 * fRec69[0])))) - (fSlow56 * ((fSlow55 * fRec68[2]) + fTemp24)));
418 fRec67[0] = ((fRec68[2] + (fSlow56 * (fTemp24 + (fSlow55 * fRec68[0])))) - (fSlow49 * ((fSlow48 * fRec67[2]) + fTemp23)));
419 fRec61[IOTA&524287] = ((fRec67[2] + (fSlow49 * (fTemp23 + (fSlow48 * fRec67[0])))) + (fRec66[0] * ((fRec63[0] * fRec61[(IOTA-int((1 + int((int(fRec65[0]) & 262143)))))&524287]) + ((1.0 - fRec63[0]) * fRec61[(IOTA-int((1 + int((int(fRec64[0]) & 262143)))))&524287]))));
420 double fTemp26 = fRec61[(IOTA-0)&524287];
421 double fRec60 = max(fConst1, fabs(fTemp26));
422 int iTemp27 = int((iRec58[1] < 4096));
423 fRec57[0] = ((iTemp27)?max(fRec57[1], fRec60):fRec60);
424 iRec58[0] = ((iTemp27)?(1 + iRec58[1]):1);
425 fRec59[0] = ((iTemp27)?fRec59[1]:fRec57[1]);
426 fbargraph4 = fRec59[0];
427 output0[i] = (FAUSTFLOAT)((((fTemp26 + fTemp20) + fTemp15) + fTemp11) + fTemp8);
428 // post processing
429 fRec59[1] = fRec59[0];
430 iRec58[1] = iRec58[0];
431 fRec57[1] = fRec57[0];
432 fRec67[2] = fRec67[1]; fRec67[1] = fRec67[0];
433 fRec68[2] = fRec68[1]; fRec68[1] = fRec68[0];
434 fRec69[2] = fRec69[1]; fRec69[1] = fRec69[0];
435 fRec70[2] = fRec70[1]; fRec70[1] = fRec70[0];
436 fRec71[1] = fRec71[0];
437 fRec66[1] = fRec66[0];
438 fRec65[1] = fRec65[0];
439 fRec64[1] = fRec64[0];
440 fRec63[1] = fRec63[0];
441 fRec62[1] = fRec62[0];
442 fRec45[1] = fRec45[0];
443 iRec44[1] = iRec44[0];
444 fRec43[1] = fRec43[0];
445 fRec53[2] = fRec53[1]; fRec53[1] = fRec53[0];
446 fRec54[2] = fRec54[1]; fRec54[1] = fRec54[0];
447 fRec55[2] = fRec55[1]; fRec55[1] = fRec55[0];
448 fRec56[1] = fRec56[0];
449 fRec52[1] = fRec52[0];
450 fRec51[1] = fRec51[0];
451 fRec50[1] = fRec50[0];
452 fRec49[1] = fRec49[0];
453 fRec48[1] = fRec48[0];
454 fRec32[1] = fRec32[0];
455 iRec31[1] = iRec31[0];
456 fRec30[1] = fRec30[0];
457 fRec40[2] = fRec40[1]; fRec40[1] = fRec40[0];
458 fRec41[2] = fRec41[1]; fRec41[1] = fRec41[0];
459 fRec42[1] = fRec42[0];
460 fRec39[1] = fRec39[0];
461 fRec38[1] = fRec38[0];
462 fRec37[1] = fRec37[0];
463 fRec36[1] = fRec36[0];
464 fRec35[1] = fRec35[0];
465 fRec20[1] = fRec20[0];
466 iRec19[1] = iRec19[0];
467 fRec18[1] = fRec18[0];
468 fRec28[2] = fRec28[1]; fRec28[1] = fRec28[0];
469 fRec29[1] = fRec29[0];
470 fRec27[1] = fRec27[0];
471 fRec26[1] = fRec26[0];
472 fRec25[1] = fRec25[0];
473 fRec24[1] = fRec24[0];
474 fRec23[1] = fRec23[0];
475 fRec2[1] = fRec2[0];
476 iRec1[1] = iRec1[0];
477 fRec0[1] = fRec0[0];
478 IOTA = IOTA+1;
479 fRec10[2] = fRec10[1]; fRec10[1] = fRec10[0];
480 fRec11[1] = fRec11[0];
481 fVec3[1] = fVec3[0];
482 fRec12[2] = fRec12[1]; fRec12[1] = fRec12[0];
483 fRec13[1] = fRec13[0];
484 fVec2[1] = fVec2[0];
485 fRec14[2] = fRec14[1]; fRec14[1] = fRec14[0];
486 fRec15[1] = fRec15[0];
487 fVec1[1] = fVec1[0];
488 fRec16[2] = fRec16[1]; fRec16[1] = fRec16[0];
489 fRec17[1] = fRec17[0];
490 fVec0[1] = fVec0[0];
491 fRec9[1] = fRec9[0];
492 fRec8[1] = fRec8[0];
493 fRec7[1] = fRec7[0];
494 fRec6[1] = fRec6[0];
495 fRec5[1] = fRec5[0];
496 }
497 }
498
499 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
500 {
501 static_cast<Dsp*>(p)->compute(count, input0, output0);
502 }
503
504 int Dsp::register_par(const ParamReg& reg)
505 {
506 reg.registerVar("mbe.crossover_b1_b2",N_("Crossover B1-B2 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider2, 8e+01, 2e+01, 2e+04, 1.08);
507 reg.registerVar("mbe.crossover_b2_b3",N_("Crossover B2-B3 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider3, 2.1e+02, 2e+01, 2e+04, 1.08);
508 reg.registerVar("mbe.crossover_b3_b4",N_("Crossover B3-B4 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider4, 1.7e+03, 2e+01, 2e+04, 1.08);
509 reg.registerVar("mbe.crossover_b4_b5",N_("Crossover B4-B5 (hz)"),"SL",N_("Crossover bandpass frequency"),&fslider5, 5e+03, 2e+01, 2e+04, 1.08);
510 reg.registerVar("mbe.percent1","","S","",&fslider1, 1e+01, 0.0, 1e+02, 0.1);
511 reg.registerVar("mbe.percent2","","S","",&fslider7, 3e+01, 0.0, 1e+02, 0.1);
512 reg.registerVar("mbe.percent3","","S","",&fslider9, 45.0, 0.0, 1e+02, 0.1);
513 reg.registerVar("mbe.percent4","","S","",&fslider11, 2e+01, 0.0, 1e+02, 0.1);
514 reg.registerVar("mbe.percent5","","S","",&fslider13, 0.0, 0.0, 1e+02, 0.1);
515 reg.registerVar("mbe.time1","","S",N_("Echo in Beats per Minute"),&fslider0, 3e+01, 24.0, 3.6e+02, 1.0);
516 reg.registerVar("mbe.time2","","S",N_("Echo in Beats per Minute"),&fslider6, 6e+01, 24.0, 3.6e+02, 1.0);
517 reg.registerVar("mbe.time3","","S",N_("Echo in Beats per Minute"),&fslider8, 1.2e+02, 24.0, 3.6e+02, 1.0);
518 reg.registerVar("mbe.time4","","S",N_("Echo in Beats per Minute"),&fslider10, 1.5e+02, 24.0, 3.6e+02, 1.0);
519 reg.registerVar("mbe.time5","","S",N_("Echo in Beats per Minute"),&fslider12, 2.4e+02, 24.0, 3.6e+02, 1.0);
520 reg.registerNonMidiFloatVar("mbe.v1",&fbargraph0, false, true, -70.0, -70.0, 4.0, 0.00001);
521 reg.registerNonMidiFloatVar("mbe.v2",&fbargraph1, false, true, -70.0, -70.0, 4.0, 0.00001);
522 reg.registerNonMidiFloatVar("mbe.v3",&fbargraph2, false, true, -70.0, -70.0, 4.0, 0.00001);
523 reg.registerNonMidiFloatVar("mbe.v4",&fbargraph3, false, true, -70.0, -70.0, 4.0, 0.00001);
524 reg.registerNonMidiFloatVar("mbe.v5",&fbargraph4, false, true, -70.0, -70.0, 4.0, 0.00001);
525 return 0;
526 }
527
528 int Dsp::register_params_static(const ParamReg& reg)
529 {
530 return static_cast<Dsp*>(reg.plugin)->register_par(reg);
531 }
532
533 inline int Dsp::load_ui_f(const UiBuilder& b, int form)
534 {
535 if (form & UI_FORM_STACK) {
536 #define PARAM(p) ("mbe" "." p)
537
538 b.openHorizontalhideBox("");
539 b.closeBox();
540
541 b.openHorizontalBox("");
542 b.openVerticalBox("");
543
544 b.openTabBox("");
545
546 b.openHorizontalBox(N_("Band 1"));
547 b.openVerticalBox("");
548 b.openpaintampBox("");
549 b.openHorizontalBox("");
550 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
551 b.create_small_rackknob(PARAM("time1"), N_("BPM"));
552 b.set_next_flags(UI_NUM_RIGHT);
553 b.create_small_rackknob(PARAM("percent1"), N_("Amount"));
554 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
555 b.create_small_rackknob(PARAM("crossover_b1_b2"), N_("Low Shelf (Hz)"));
556 b.closeBox();
557 b.closeBox();
558 b.closeBox();
559 b.closeBox();
560
561 b.openHorizontalBox(N_("Band 2"));
562 b.openVerticalBox("");
563 b.openpaintampBox("");
564 b.openHorizontalBox("");
565 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
566 b.create_small_rackknob(PARAM("time2"), N_("BPM"));
567 b.set_next_flags(UI_NUM_RIGHT);
568 b.create_small_rackknob(PARAM("percent2"), N_("Amount"));
569 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
570 b.create_small_rackknob(PARAM("crossover_b1_b2"), N_("Low (Hz)"));
571 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
572 b.create_small_rackknob(PARAM("crossover_b2_b3"), N_("High (hz)"));
573 b.closeBox();
574 b.closeBox();
575 b.closeBox();
576 b.closeBox();
577
578 b.openHorizontalBox(N_("Band 3"));
579 b.openVerticalBox("");
580 b.openpaintampBox("");
581 b.openHorizontalBox("");
582 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
583 b.create_small_rackknob(PARAM("time3"), N_("BPM"));
584 b.set_next_flags(UI_NUM_RIGHT);
585 b.create_small_rackknob(PARAM("percent3"), N_("Amount"));
586 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
587 b.create_small_rackknob(PARAM("crossover_b2_b3"), N_("Low (Hz)"));
588 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
589 b.create_small_rackknob(PARAM("crossover_b3_b4"), N_("High (hz)"));
590 b.closeBox();
591 b.closeBox();
592 b.closeBox();
593 b.closeBox();
594
595 b.openHorizontalBox(N_("Band 4"));
596 b.openVerticalBox("");
597 b.openpaintampBox("");
598 b.openHorizontalBox("");
599 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
600 b.create_small_rackknob(PARAM("time4"), N_("BPM"));
601 b.set_next_flags(UI_NUM_RIGHT);
602 b.create_small_rackknob(PARAM("percent4"), N_("Amount"));
603 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
604 b.create_small_rackknob(PARAM("crossover_b3_b4"), N_("Low (Hz)"));
605 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
606 b.create_small_rackknob(PARAM("crossover_b4_b5"), N_("High (hz)"));
607 b.closeBox();
608 b.closeBox();
609 b.closeBox();
610 b.closeBox();
611
612 b.openHorizontalBox(N_("Band 5"));
613 b.openVerticalBox("");
614 b.openpaintampBox("");
615 b.openHorizontalBox("");
616 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
617 b.create_small_rackknob(PARAM("time5"), N_("BPM"));
618 b.set_next_flags(UI_NUM_RIGHT);
619 b.create_small_rackknob(PARAM("percent5"), N_("Amount"));
620 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
621 b.create_small_rackknob(PARAM("crossover_b4_b5"), N_("High Shelf (Hz)"));
622 b.closeBox();
623 b.closeBox();
624 b.closeBox();
625 b.closeBox();
626
627 b.closeBox();
628 b.closeBox();
629 b.openVerticalBox2("Analyze");
630 b.create_simple_meter(PARAM("v1"));
631 b.create_simple_meter(PARAM("v2"));
632 b.create_simple_meter(PARAM("v3"));
633 b.create_simple_meter(PARAM("v4"));
634 b.create_simple_meter(PARAM("v5"));
635 b.closeBox();
636 b.closeBox();
637
638 #undef PARAM
639 return 0;
640 }
641 return -1;
642 }
643
644 int Dsp::load_ui_f_static(const UiBuilder& b, int form)
645 {
646 return static_cast<Dsp*>(b.plugin)->load_ui_f(b, form);
647 }
648 PluginDef *plugin() {
649 return new Dsp();
650 }
651
652 void Dsp::del_instance(PluginDef *p)
653 {
654 delete static_cast<Dsp*>(p);
655 }
656
657 } // end namespace mbe
658 } // end namespace pluginlib
2828 void clear_state_f();
2929 int load_ui_f(const UiBuilder& b, int form);
3030 void init(unsigned int samplingFreq);
31 void compute(int count, float *input0, float *output0);
31 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
3232 int register_par(const ParamReg& reg);
3333
3434 static void clear_state_f_static(PluginDef*);
3535 static int load_ui_f_static(const UiBuilder& b, int form);
3636 static void init_static(unsigned int samplingFreq, PluginDef*);
37 static void compute_static(int count, float *input0, float *output0, PluginDef*);
37 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
3838 static int register_params_static(const ParamReg& reg);
3939 static void del_instance(PluginDef *p);
4040 public:
9999 static_cast<Dsp*>(p)->init(samplingFreq);
100100 }
101101
102 void always_inline Dsp::compute(int count, float *input0, float *output0)
102 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
103103 {
104104 double fSlow0 = (0.0010000000000000009 * pow(10,(0.05 * fslider0)));
105105 double fSlow1 = (1.0 / tan((fConst1 * fslider1)));
127127 }
128128 }
129129
130 void __rt_func Dsp::compute_static(int count, float *input0, float *output0, PluginDef *p)
130 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
131131 {
132132 static_cast<Dsp*>(p)->compute(count, input0, output0);
133133 }
126126 int load_ui_f(const UiBuilder& b, int form);
127127 static const char *glade_def;
128128 void init(unsigned int samplingFreq);
129 void compute(int count, float *input0, float *input1, float *output0, float *output1);
129 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
130130 int register_par(const ParamReg& reg);
131131
132132 static void clear_state_f_static(PluginDef*);
133133 static int load_ui_f_static(const UiBuilder& b, int form);
134134 static void init_static(unsigned int samplingFreq, PluginDef*);
135 static void compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef*);
135 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
136136 static int register_params_static(const ParamReg& reg);
137137 static void del_instance(PluginDef *p);
138138 public:
296296 static_cast<Dsp*>(p)->init(samplingFreq);
297297 }
298298
299 void always_inline Dsp::compute(int count, float *input0, float *input1, float *output0, float *output1)
299 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
300300 {
301301 double fSlow0 = fslider0;
302302 double fSlow1 = exp((fConst2 / fSlow0));
534534 }
535535 }
536536
537 void __rt_func Dsp::compute_static(int count, float *input0, float *input1, float *output0, float *output1, PluginDef *p)
537 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
538538 {
539539 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
540540 }
0 // generated by scripts/build-jcm800-preamp.py
1 // DO NOT MODIFY!
2 #include <iostream>
3 #include <cmath>
4
5 #include <float.h>
6 #include <Eigen/Core>
7
8 #include "gx_compiler.h"
9 #include "gx_plugin.h"
10
11 using namespace Eigen;
12
13 #define N_(x) (x)
14
15 #define creal double
16
17 static inline int sign(creal v) {
18 return v < 0 ? -1 : 1;
19 }
20
21 static inline int Heaviside(creal v) {
22 return v < 0 ? 0 : 1; // Heaviside(0) == 1/2 in sympy but shouldn't matter
23 }
24
25 static Matrix<creal, 7, 1> g_x;
26 creal g_v_data[8];
27 static Map<Matrix<creal, 8, 1> >g_v(g_v_data);
28 static int g_info;
29 static int g_nfev;
30
31
32 static creal x0_data[] = {-101.11169547,-4.28127308,-514.34759921,-230.31382521,-1133.65846006,-4.20085902,-20.3466745};
33
34 #define real realtype // real conflicts with Eigen::real of new eigen library version
35 typedef double real;
36 #ifndef _INTPP_H
37 #define _INTPP_H 1
38
39 #ifndef NO_INTPP_INCLUDES
40 typedef double real;
41 typedef double treal;
42 //typedef float real;
43 //typedef float treal;
44 #endif
45
46 template<typename M>
47 struct splinecoeffs {
48 real *x0;
49 real *xe;
50 real *stepi; // 1/h
51 int *k;
52 int *n;
53 int *nmap;
54 M **map;
55 treal **t;
56 treal **c;
57 int (*eval)(splinecoeffs *p, real *x, real *res);
58 };
59
60 template<typename M>
61 struct splinedata {
62 splinecoeffs<M> *sc;
63 int m;
64 int n_input;
65 int n_output;
66 int n_state;
67 const char *func_id;
68 template<int K0> static int splev(splinecoeffs<M> *p, real *x, real *res);
69 template<int K0> static int splev_pp(splinecoeffs<M> *p, real *x, real *res);
70 template<int K0, int K1> static int splev(splinecoeffs<M> *p, real *x, real *res);
71 template<int K0, int K1> static int splevgr(splinecoeffs<M> *p, real xi[2], real res[1], real grad[2]);
72 template<int K0, int K1, int K2> static int splev(splinecoeffs<M> *p, real *x, real *res);
73 template<int K0, int K1, int K2, int K3> static int splev(splinecoeffs<M> *p, real *x, real *res);
74 union retval {
75 char c[4];
76 int i;
77 };
78 };
79
80 template<typename M>
81 class SplineCalc {
82 protected:
83 splinedata<M> *sd;
84 real *s0;
85 real *temp;
86 public:
87 SplineCalc(splinedata<M> *sd_, real *s0_);
88 ~SplineCalc();
89 void reset();
90 void calc(real *in, real *out);
91 };
92
93 //#define CHECK_BOUNDS
94
95 #ifdef CHECK_BOUNDS
96 template<typename M>
97 void report(splinedata<M> *sd, real *t, int i);
98 template<typename M>
99 static inline void check(splinedata<M> *sd, creal *t, int i) { if (i) report(sd, t, i); }
100 #else
101 #define check(sd, t, i) i
102 #endif
103
104 #endif /* !_INTPP_H */
105
106 #define NO_INTPP_INCLUDES
107 #include <cstdio>
108 #include <cstdlib>
109
110 #ifndef NO_INTPP_INCLUDES
111 #include "intpp.h"
112 #include "intpp_inst.cc"
113 #endif
114
115 #define always_inline inline __attribute__((always_inline))
116
117 /****************************************************************
118 ** fpbspl evaluates the k non-zero b-splines of order k
119 ** at t[0] <= x < t[1] using the stable recurrence relation
120 ** of de boor and cox.
121 **
122 ** t: knot array
123 ** K: order (> 0)
124 ** h[K]: output array
125 */
126 template<int K> static always_inline void fpbspl(treal *t, real x, real *h)
127 {
128 real hh[K-1];
129 h[0] = 1;
130 for (int j = 0; j < K-1; j++) {
131 for (int i = 0; i <= j; i++) {
132 hh[i] = h[i];
133 }
134 h[0] = 0;
135 for (int i = 0; i <= j; i++) {
136 int li = i+1;
137 int lj = i-j;
138 real f = hh[i]/(t[li]-t[lj]);
139 h[i] = h[i]+f*(t[li]-x);
140 h[i+1] = f*(x-t[lj]);
141 }
142 }
143 }
144
145 template<> always_inline void fpbspl<2>(treal *t, real x, real *h)
146 {
147 h[0] = (t[1]-x)/(t[1]-t[0]);
148 h[1] = 1-h[0];
149 }
150
151
152 /****************************************************************
153 ** search for knot interval
154 ** n: len(map)
155 ** k: order
156 ** returns index l: t[l] <= x < t[l+1]
157 */
158 static always_inline int find_index(int n, int k, real xi, real x0, real xe, real stepi, char* cl)
159 {
160 int l;
161 if (k % 2) {
162 l = static_cast<int>((xi - x0) * stepi + 0.5);
163 } else {
164 l = static_cast<int>((xi - x0) * stepi);
165 }
166 if (l < 0) {
167 *cl = -1;
168 return 0;
169 }
170 if (l > n-2) {
171 *cl = 1;
172 return n-2;
173 }
174 return l;
175 }
176
177 template<int K, typename M>
178 static always_inline int forward(int i, splinecoeffs<M> *p, real *xi, int ll,
179 typename splinedata<M>::retval *cl, real *h)
180 {
181 int l = p->map[i][find_index(p->nmap[i], K, xi[i], p->x0[i], p->xe[i], p->stepi[i], &cl->c[i])];
182 fpbspl<K>(p->t[i]+l, xi[i], h);
183 return ll*p->n[i] + l-K+1;
184 }
185
186 /****************************************************************
187 ** evaluate the spline function at x
188 **
189 ** t[n+k]: knot array
190 ** c[m][n]: coefficents
191 ** k: order (k > 0), order = degree + 1
192 ** x: function argument
193 ** res: output array (size m)
194 */
195 template<>
196 template<int K0>
197 always_inline int splinedata<unsigned short>::splev(splinecoeffs<unsigned short> *p, real xi[1], real *res)
198 {
199 real h[K0];
200 retval cl;
201 cl.i = 0;
202 int ll = 0;
203 ll = forward<K0>(0, p, xi, ll, &cl, h);
204 treal *c = p->c[0]+ll;
205 real sp = 0;
206 for (int j = 0; j < K0; j++) {
207 sp += c[j]*h[j];
208 }
209 *res = sp;
210 return cl.i;
211 }
212
213 template<>
214 template<int K0>
215 always_inline int splinedata<unsigned char>::splev(splinecoeffs<unsigned char> *p, real xi[1], real *res)
216 {
217 real h[K0];
218 retval cl;
219 cl.i = 0;
220 int ll = 0;
221 ll = forward<K0>(0, p, xi, ll, &cl, h);
222 treal *c = p->c[0]+ll;
223 real sp = 0;
224 for (int j = 0; j < K0; j++) {
225 sp += c[j]*h[j];
226 }
227 *res = sp;
228 return cl.i;
229 }
230
231 template<>
232 template<>
233 always_inline int splinedata<unsigned short>::splev_pp<4>(splinecoeffs<unsigned short> *p, real xi[1], real *res)
234 {
235 retval cl;
236 cl.i = 0;
237 int l = p->map[0][find_index(p->nmap[0], 4, xi[0], p->x0[0], p->xe[0], p->stepi[0], &cl.c[0])];
238 treal x = xi[0] - p->t[0][l];
239 treal *c = p->c[0] + (l-3)*4;
240 *res = ((c[0] * x + c[1]) * x + c[2]) * x + c[3];
241 return cl.i;
242 }
243
244 template<>
245 template<>
246 always_inline int splinedata<unsigned char>::splev_pp<4>(splinecoeffs<unsigned char> *p, real xi[1], real *res)
247 {
248 retval cl;
249 cl.i = 0;
250 int l = p->map[0][find_index(p->nmap[0], 4, xi[0], p->x0[0], p->xe[0], p->stepi[0], &cl.c[0])];
251 treal x = xi[0] - p->t[0][l];
252 treal *c = p->c[0] + (l-3)*4;
253 *res = ((c[0] * x + c[1]) * x + c[2]) * x + c[3];
254 return cl.i;
255 }
256
257 template<>
258 template<>
259 always_inline int splinedata<unsigned short>::splev_pp<2>(splinecoeffs<unsigned short> *p, real xi[1], real *res)
260 {
261 retval cl;
262 cl.i = 0;
263 int l = p->map[0][find_index(p->nmap[0], 2, xi[0], p->x0[0], p->xe[0], p->stepi[0], &cl.c[0])];
264 treal x = xi[0] - p->t[0][l];
265 treal *c = p->c[0] + (l-1)*2;
266 *res = c[0] * x + c[1];
267 return cl.i;
268 }
269
270 template<>
271 template<>
272 always_inline int splinedata<unsigned char>::splev_pp<2>(splinecoeffs<unsigned char> *p, real xi[1], real *res)
273 {
274 retval cl;
275 cl.i = 0;
276 int l = p->map[0][find_index(p->nmap[0], 2, xi[0], p->x0[0], p->xe[0], p->stepi[0], &cl.c[0])];
277 treal x = xi[0] - p->t[0][l];
278 treal *c = p->c[0] + (l-1)*2;
279 *res = c[0] * x + c[1];
280 return cl.i;
281 }
282
283 /****************************************************************
284 ** evaluate the X-dim spline function
285 **
286 ** t: array of pointers to knot arrays
287 ** c[m][n[0]]...[n[X-1]]: coefficents
288 ** k: orders (2 <= k[i] <= 5), order = degree + 1
289 ** x: function arguments
290 ** res[m]: output array
291 */
292 template<typename M>
293 template<int K0, int K1>
294 int splinedata<M>::splev(splinecoeffs<M> *p, real xi[2], real *res)
295 {
296 real h[2][6];
297 retval cl;
298 cl.i = 0;
299 int ll = 0;
300 ll = forward<K0>(0, p, xi, ll, &cl, h[0]);
301 ll = forward<K1>(1, p, xi, ll, &cl, h[1]);
302 treal *c = p->c[0]+ll;
303 int j[2];
304 real sp = 0;
305 for (j[0] = 0; j[0] < K0; j[0]++) {
306 for (j[1] = 0; j[1] < K1; j[1]++) {
307 sp += c[j[1]]*h[0][j[0]]*h[1][j[1]];
308 }
309 c += p->n[1];
310 }
311 *res = sp;
312 return cl.i;
313 }
314
315 template<int K, int S>
316 static inline void deriv(real *t, real *wrk) {
317 for (int i = 0; i < K-1; i++, wrk += S) {
318 real fac = t[i+1] - t[i+1-(K-1)];
319 if (fac > 0) {
320 wrk[0] = (K-1) * (wrk[S] - wrk[0]) / fac;
321 }
322 }
323 }
324
325 template<int K0, int K1, int S0, int S1>
326 static inline void deriv2d(real *t, real *c) {
327 for (int i = 0; i < K0; i++) {
328 deriv<K1, S1>(t, c);
329 c += S0;
330 }
331 }
332
333 template<int K0, int K1>
334 static inline void copy2d(real *c, real *wrk, int n) {
335 int j[2];
336 for (j[0] = 0; j[0] < K0; j[0]++) {
337 for (j[1] = 0; j[1] < K1; j[1]++) {
338 *wrk++ = *c++;
339 }
340 c += n - K1;
341 }
342 }
343
344 template<int K0, int K1, int S>
345 static inline real eval2d(real *c, real *h0, real *h1) {
346 int j[2];
347 real sp = 0;
348 for (j[0] = 0; j[0] < K0; j[0]++) {
349 for (j[1] = 0; j[1] < K1; j[1]++) {
350 sp += *c++ * h0[j[0]] * h1[j[1]];
351 }
352 c += S;
353 }
354 return sp;
355 }
356
357 template<typename M>
358 template<int K0, int K1>
359 int splinedata<M>::splevgr(splinecoeffs<M> *p, real xi[2], real res[1], real grad[2])
360 {
361 real h0[K0];
362 real h1[K1];
363 retval cl;
364 cl.i = 0;
365 int ll = 0;
366 // ll = forward<K0>(0, p, xi, ll, &cl, h0);
367 int l[2];
368 l[0] = p->map[0][find_index(p->nmap[0], K0, xi[0], p->x0[0], p->xe[0], p->stepi[0], &cl.c[0])];
369 fpbspl<K0>(p->t[0]+l[0], xi[0], h0);
370 ll = l[0]-(K0-1);
371 // ll = forward<K1>(1, p, xi, ll, &cl, h1);
372 l[1] = p->map[1][find_index(p->nmap[1], K1, xi[1], p->x0[1], p->xe[1], p->stepi[1], &cl.c[1])];
373 fpbspl<K1>(p->t[1]+l[1], xi[1], h1);
374 ll = ll*p->n[1] + l[1]-(K1-1);
375 //
376 treal wrk[K0*K1];
377 copy2d<K0, K1>(p->c[0]+ll, wrk, p->n[1]);
378 res[0] = eval2d<K0, K1, 0>(wrk, h0, h1);
379
380 deriv2d<K1, K0, 1, K1>(p->t[0]+l[0], wrk);
381 real hx[6];
382 fpbspl<K0-1>(p->t[0]+l[0], xi[0], hx);
383 grad[0] = eval2d<K0-1, K1, 0>(wrk, hx, h1);
384
385 copy2d<K0, K1>(p->c[0]+ll, wrk, p->n[1]);
386 deriv2d<K0, K1, K1, 1>(p->t[1]+l[1], wrk);
387 fpbspl<K1-1>(p->t[1]+l[1], xi[1], hx);
388 grad[1] = eval2d<K0, K1-1, 1>(wrk, h0, hx);
389 return cl.i;
390 }
391
392 template<typename M>
393 template<int K0, int K1, int K2>
394 int splinedata<M>::splev(splinecoeffs<M> *p, real xi[3], real *res)
395 {
396 real h[3][6];
397 retval cl;
398 cl.i = 0;
399 int ll = 0;
400 ll = forward<K0>(0, p, xi, ll, &cl, h[0]);
401 ll = forward<K1>(1, p, xi, ll, &cl, h[1]);
402 ll = forward<K2>(2, p, xi, ll, &cl, h[2]);
403 treal *cc = p->c[0];
404 int lc = ll;
405 int j[3];
406 real sp = 0;
407 for (j[0] = 0; j[0] < K0; j[0]++) {
408 for (j[1] = 0; j[1] < K1; j[1]++) {
409 for (j[2] = 0; j[2] < K2; j[2]++) {
410 sp += cc[lc]*h[0][j[0]]*h[1][j[1]]*h[2][j[2]];
411 lc += 1;
412 }
413 lc += p->n[2]-K2;
414 }
415 lc += (p->n[1]-K1)*p->n[2];
416 }
417 *res = sp;
418 return cl.i;
419 }
420
421 template<typename M>
422 template<int K0, int K1, int K2, int K3>
423 int splinedata<M>::splev(splinecoeffs<M> *p, real xi[4], real *res)
424 {
425 real h[4][6];
426 retval cl;
427 cl.i = 0;
428 int ll = 0;
429 ll = forward<K0>(0, p, xi, ll, &cl, h[0]);
430 ll = forward<K1>(1, p, xi, ll, &cl, h[1]);
431 ll = forward<K2>(2, p, xi, ll, &cl, h[2]);
432 ll = forward<K3>(3, p, xi, ll, &cl, h[3]);
433 treal *cc = p->c[0];
434 int lc = ll;
435 int j[4];
436 real sp = 0;
437 for (j[0] = 0; j[0] < K0; j[0]++) {
438 for (j[1] = 0; j[1] < K1; j[1]++) {
439 for (j[2] = 0; j[2] < K2; j[2]++) {
440 for (j[3] = 0; j[3] < K3; j[3]++) {
441 sp += cc[lc]*h[0][j[0]]*h[1][j[1]]*h[2][j[2]]*h[3][j[3]];
442 lc += 1;
443 }
444 lc += p->n[3]-K3;
445 }
446 lc += (p->n[2]-K2)*p->n[3];
447 }
448 lc += (p->n[1]-K1)*p->n[2]*p->n[3];
449 }
450 *res = sp;
451 return cl.i;
452 }
453
454 template<typename M>
455 SplineCalc<M>::SplineCalc(splinedata<M> *sd_, real *s0_)
456 : sd(sd_),
457 s0(s0_),
458 temp(new real[sd->n_input+sd->n_state]) {
459 }
460
461 template<typename M>
462 SplineCalc<M>::~SplineCalc() {
463 delete[] temp;
464 }
465
466 #ifdef CHECK_BOUNDS
467 void report(splinedata *sd, real *t, int i)
468 {
469 printf("%s:", sd->func_id);
470 splinedata::retval cl;
471 cl.i = i;
472 for (int n = 0; n < 4; n++) {
473 if (cl.c[n] < 0) {
474 printf(" %d:L[%g]", n, t[n]);
475 } else if (cl.c[n] > 0) {
476 printf(" %d:U[%g]", n, t[n]);
477 }
478 }
479 printf("\n");
480 }
481 #endif
482
483 template<typename M>
484 void SplineCalc<M>::calc(real *in, real *out)
485 {
486 for (int i = 0; i < sd->n_input; i++) {
487 temp[i] = in[i];
488 }
489 real t[sd->m];
490 for (int i = 0; i < sd->m; i++) {
491 splinecoeffs<M> *p = &sd->sc[i];
492 check(sd, temp, (*p->eval)(p, temp, &t[i]));
493 }
494 for (int i = 0; i < sd->n_output; i++) {
495 out[i] = t[i];
496 }
497 for (int i = 0; i < sd->n_state; i++) {
498 temp[i+sd->n_input] = t[i+sd->n_output];
499 }
500 }
501
502 template<typename M>
503 void SplineCalc<M>::reset()
504 {
505 for (int i = 0; i < sd->n_state; i++) {
506 temp[i+sd->n_input] = s0[i];
507 }
508 }
509
510 template int splinedata<unsigned char>::splev_pp<4>(splinecoeffs<unsigned char> *p, real xi[2], real *res);
511
512 #ifndef NO_INTPP_INCLUDES
513 #include "intpp.h"
514 #endif
515 namespace AmpData {
516 namespace nonlin_0 {
517 typedef unsigned char maptype;
518 real x0_0[1] = {-119.508269216};
519 real xe_0[1] = {148.877449521};
520 real hi_0[1] = {1.31899715702};
521 int k_0[1] = {4};
522 int nmap_0[1] = {355};
523 int n_0[1] = {39};
524 treal t0_0[43] = {
525 -215.79354119211405,-215.79354119211405,-215.79354119211405,-215.79354119211405,-118.75011746798432,-70.22840560591945,-58.09797764040323,-56.5816741447137,-55.82352239686894,-55.065370649024175,
526 -54.30721890117941,-53.54906715333465,-52.03276365764512,-49.000156666266065,-45.96754967488702,-39.902335692128915,-33.837121709370805,-21.706693743854586,-9.57626577833837,-3.5110517955802605,
527 -1.9947482998907333,-0.47844480420120616,2.554162187177848,8.619376169935958,14.684590152694065,20.749804135452173,26.815018118210283,29.847625109589334,32.880232100968385,35.91283909234744,
528 38.945446083726495,45.010660066484604,51.075874049242714,63.20630201475893,75.33672998027515,87.46715794579137,99.59758591130759,123.85844184234001,148.11929777337244,172.38015370440488,
529 172.38015370440488,172.38015370440488,172.38015370440488};
530 maptype a0_0[354] = {
531 3,4,4,4,4,4,4,4,4,4,
532 4,4,4,4,4,4,4,4,4,4,
533 4,4,4,4,4,4,4,4,4,4,
534 4,4,4,4,4,4,4,4,4,4,
535 4,4,4,4,4,4,4,4,4,4,
536 4,4,4,4,4,4,4,4,4,4,
537 4,4,4,4,4,5,5,5,5,5,
538 5,5,5,5,5,5,5,5,5,5,
539 5,6,6,7,8,9,10,11,11,12,
540 12,12,12,13,13,13,13,14,14,14,
541 14,14,14,14,14,15,15,15,15,15,
542 15,15,15,16,16,16,16,16,16,16,
543 16,16,16,16,16,16,16,16,16,17,
544 17,17,17,17,17,17,17,17,17,17,
545 17,17,17,17,17,18,18,18,18,18,
546 18,18,18,19,19,20,20,21,21,21,
547 21,22,22,22,22,22,22,22,22,23,
548 23,23,23,23,23,23,23,24,24,24,
549 24,24,24,24,24,25,25,25,25,25,
550 25,25,25,26,26,26,26,27,27,27,
551 27,28,28,28,28,29,29,29,29,30,
552 30,30,30,30,30,30,30,31,31,31,
553 31,31,31,31,31,32,32,32,32,32,
554 32,32,32,32,32,32,32,32,32,32,
555 32,33,33,33,33,33,33,33,33,33,
556 33,33,33,33,33,33,33,34,34,34,
557 34,34,34,34,34,34,34,34,34,34,
558 34,34,34,35,35,35,35,35,35,35,
559 35,35,35,35,35,35,35,35,35,36,
560 36,36,36,36,36,36,36,36,36,36,
561 36,36,36,36,36,36,36,36,36,36,
562 36,36,36,36,36,36,36,36,36,36,
563 36,37,37,37,37,37,37,37,37,37,
564 37,37,37,37,37,37,37,37,37,37,
565 37,37,37,37,37,37,37,37,37,37,
566 37,37,37,38};
567 treal c0_0[144] = {
568 -1.6873137730947968e-08,2.283373705907306e-06,-7.08366044887381e-05,0.00016094985081404104,1.0773629819818119e-07,-2.6289074572326475e-06,-0.00010436838272959129,-0.0006301219261502878,-4.3813060254044074e-06,1.3053741397540291e-05,
569 0.00040146240593189064,0.0004238755997537633,0.006950938857027557,-0.00014638761001061073,-0.001215934482642564,-0.0006058448954747285,0.03812445957054991,0.03147281105169455,0.04628443088943314,0.02144656244395482,
570 -0.014607563382236495,0.11818518802884288,0.15974790447129264,0.09124148997352426,-0.015591328547518634,0.08496093889885559,0.3137634956694214,0.27392108803937953,-0.009927806034353953,0.049499159930285946,
571 0.41570465461211475,0.5538420679993398,-0.003613308257829718,0.026918809438658223,0.4736410716559274,0.8931347516741054,-0.0007786511779558718,0.010482193611605111,0.5303523433233364,1.660612560301017,
572 -0.0001771877081884625,0.0033981645932615705,0.5724460146582606,3.3436478532585276,-5.90972253293622e-05,0.0017861425453452849,0.5881679807322562,5.105961793530823,-2.0878100771578455e-05,0.0007108305931157232,
573 0.6033126571262213,8.725847190649315,1.6272671169467374e-06,0.0003309401469160916,0.6096312195854904,12.406558431601251,-3.0490891639089684e-05,0.00039015848654441857,0.6183784546147153,19.85324757556291,
574 0.0002813674649289688,-0.0007194442073525958,0.6143840778983787,27.357428628715304,0.0022374857272430527,0.004400217440388554,0.6367087551787501,31.120112155359543,-0.002443033099687247,0.01457833972971075,
575 0.6654860077589153,32.103473174672544,-7.445119777083006e-05,0.003465200842287768,0.6928454914028523,33.1375530858228,-7.304069647906582e-05,0.0027878571736586763,0.7118085588595104,35.26847315413927,
576 -9.203191801796418e-06,0.0014588348128730133,0.7375656544766893,39.672003944499636,9.846820433221443e-06,0.001291376830066232,0.7542462765889886,44.19710994426894,5.541887360394889e-05,0.0014705460489980809,
577 0.770997929854389,48.821477677302184,7.87978917166114e-05,0.0024789280302722062,0.7949523352645198,53.56420687160392,3.6233408602374344e-05,0.0031958171422493816,0.8121616071490032,55.9999805241572,
578 -2.454176271533914e-05,0.0035254622069965445,0.8325446058945382,58.493349029632526,-6.88566870740012e-05,0.0033021856434226346,0.8532501785003934,61.04986778901328,-6.210649668334695e-05,0.002675739831551187,
579 0.871378877089742,63.66588906101117,-3.604600421055791e-05,0.001545672255239319,0.8969826447055279,69.03556317416984,-1.3518555506066317e-05,0.0008897920689580184,0.9117542569791581,74.52477263891492,
580 -4.171710256724323e-06,0.000397834477665508,0.9273737180494612,85.69154238626115,-2.214325453001808e-06,0.0002460205853789093,0.9351839555119544,96.99207639859175,-1.225126751269013e-06,0.0001654384391793668,
581 0.9401751295701202,108.36850678476425,-6.209590726258885e-07,0.00012085450376467978,0.9436479854915386,119.79539048410334,-2.850430075249797e-07,7.565950796454724e-05,0.9484155836185306,142.7513648625841,
582 -1.8920535850098484e-07,5.4913345945412075e-05,0.9515833928157438,165.80120074168525};
583 maptype *map_0[1] = {a0_0};
584 treal *t_0[1] = {t0_0};
585 treal *c_0[1] = {c0_0};
586 real x0_1[2] = {-119.508269216};
587 real xe_1[2] = {124.61659359};
588 real hi_1[2] = {1.31899715702};
589 int k_1[2] = {4};
590 int nmap_1[2] = {323};
591 int n_1[2] = {48};
592 treal t0_1[52] = {
593 -215.79354119211405,-215.79354119211405,-215.79354119211405,-215.79354119211405,-118.75011746798432,-70.22840560591945,-58.09797764040323,-56.5816741447137,-55.82352239686894,-55.065370649024175,
594 -54.30721890117941,-53.54906715333465,-52.03276365764512,-49.000156666266065,-45.96754967488702,-39.902335692128915,-33.837121709370805,-21.706693743854586,-9.57626577833837,-3.5110517955802605,
595 -2.752900047735497,-1.9947482998907333,-0.47844480420120616,2.554162187177848,5.586769178556903,8.619376169935958,11.651983161315012,14.684590152694065,17.71719714407312,20.749804135452173,
596 23.782411126831228,26.815018118210283,29.847625109589334,31.363928605278858,32.880232100968385,34.39653559665791,35.91283909234744,38.945446083726495,41.97805307510555,45.010660066484604,
597 48.04326705786366,51.075874049242714,57.14108803200082,63.20630201475893,75.33672998027515,87.46715794579137,99.59758591130759,123.85844184234001,172.38015370440488,172.38015370440488,
598 172.38015370440488,172.38015370440488};
599 maptype a0_1[322] = {
600 3,4,4,4,4,4,4,4,4,4,
601 4,4,4,4,4,4,4,4,4,4,
602 4,4,4,4,4,4,4,4,4,4,
603 4,4,4,4,4,4,4,4,4,4,
604 4,4,4,4,4,4,4,4,4,4,
605 4,4,4,4,4,4,4,4,4,4,
606 4,4,4,4,4,5,5,5,5,5,
607 5,5,5,5,5,5,5,5,5,5,
608 5,6,6,7,8,9,10,11,11,12,
609 12,12,12,13,13,13,13,14,14,14,
610 14,14,14,14,14,15,15,15,15,15,
611 15,15,15,16,16,16,16,16,16,16,
612 16,16,16,16,16,16,16,16,16,17,
613 17,17,17,17,17,17,17,17,17,17,
614 17,17,17,17,17,18,18,18,18,18,
615 18,18,18,19,20,21,21,22,22,22,
616 22,23,23,23,23,24,24,24,24,25,
617 25,25,25,26,26,26,26,27,27,27,
618 27,28,28,28,28,29,29,29,29,30,
619 30,30,30,31,31,31,31,32,32,33,
620 33,34,34,35,35,36,36,36,36,37,
621 37,37,37,38,38,38,38,39,39,39,
622 39,40,40,40,40,41,41,41,41,41,
623 41,41,41,42,42,42,42,42,42,42,
624 42,43,43,43,43,43,43,43,43,43,
625 43,43,43,43,43,43,43,44,44,44,
626 44,44,44,44,44,44,44,44,44,44,
627 44,44,44,45,45,45,45,45,45,45,
628 45,45,45,45,45,45,45,45,45,46,
629 46,46,46,46,46,46,46,46,46,46,
630 46,46,46,46,46,46,46,46,46,46,
631 46,46,46,46,46,46,46,46,46,46,
632 46,47};
633 treal c0_1[180] = {
634 1.0848462380964293e-07,-1.468078678975303e-05,0.0004554388467900852,-0.0010348154739325075,-6.926827699175401e-07,1.6902371157982944e-05,0.0006710289999751239,0.004051323541752485,2.816929130984947e-05,-8.392809016328463e-05,
635 -0.0025811736249478504,-0.0027252776403900265,-0.0446905647929792,0.0009411885870580284,0.00781776308031648,0.003895235708224949,-0.2451185155078063,-0.202352190272743,-0.2975824428460169,-0.1378891432531651,
636 0.09391838287499231,-0.7598632831568145,-1.0270877858299128,-0.5866306558994957,0.10024296672209858,-0.5462501247625271,-2.0173199489274425,-1.7611561080801312,0.0638315030566027,-0.31825198347401656,
637 -2.672743733302461,-3.5608880938752137,0.023229400313225696,-0.17307008664425141,-3.0452404195173335,-5.742346215974677,0.00500927083550711,-0.06740162395110483,-3.4098685149075125,-10.676790074493017,
638 0.0011289600690984286,-0.02182817467869464,-3.6804674260715875,-21.497745510124755,0.0003955061366950978,-0.01155709808308764,-3.781711837658065,-32.828417357041296,8.065543929835555e-05,-0.004360610031438406,
639 -3.8782561434877505,-56.102212462956054,7.077390934567486e-05,-0.0028930325367847536,-3.9222510378184667,-79.76708299563707,-8.396783874579635e-05,-0.00031747910931770134,-3.9611959180739635,-127.64503998619958,
640 0.0010273344018808912,-0.0033731765672955936,-4.005965150904645,-175.8926371084096,0.12607956503023027,0.015319832370473666,-3.933506127080011,-200.0845426084335,-0.10427536142116145,0.30208216015600353,
641 -3.6928672516766516,-203.00298830956112,-0.0022972441895976986,0.06491251760020961,-3.414629595286053,-205.6745482707608,-0.0029323318617046723,0.05446255941479127,-3.2336207487100004,-210.7109265064872,
642 -0.0006268694165330165,0.02778472910024383,-2.984197046537335,-220.09813400834423,-0.00047699613857886777,0.022081583374464628,-2.8329721186922416,-228.90998625697446,-0.0001790534620116404,0.017741957900319367,
643 -2.712202969000859,-237.31150291731925,-2.904731792126768e-05,0.016112961558137993,-2.6095343035585663,-245.3783748469969,0.0001587550867705028,0.015848694259911453,-2.512607162668699,-253.1446907929159,
644 0.0004013802026051694,0.0172930196180831,-2.4121013694560083,-260.6142573945086,0.000731603729069995,0.020944704843947833,-2.296141378918027,-267.7589795778188,0.001100295647572758,0.027600704595037797,
645 -2.1489222308540006,-274.5092472790924,0.0011320046972310152,0.03761099741527707,-1.9511607674177924,-280.74156108060157,0.000699100446660465,0.04790977349256718,-1.6918098796545378,-286.2811960086408,
646 0.0002823183542081732,0.05108991884589529,-1.5416963000895396,-288.7339029896136,-0.000268385091836766,0.05237415976804479,-1.3848133560089262,-290.95313351651595,-0.000667354611794246,0.05115330000921566,
647 -1.2278343068488093,-292.9334490799787,-0.0010856376846818574,0.048117563617031234,-1.0773095493122127,-294.679934641371,-0.0011223717443227808,0.03824062631901892,-0.8154190987493068,-297.53474649344264,
648 -0.0008682804034554786,0.02802948912274021,-0.614447883341131,-299.6872073270599,-0.0006109637917904033,0.02013002945675068,-0.46839899059551743,-301.3170236603891,-0.0004477728214474514,0.014571590257361577,
649 -0.36316261603832334,-302.56940354366094,-0.0002492843938587625,0.010497833290748378,-0.2871369069164824,-303.5492107932738,-0.000128473559440053,0.005961943716801739,-0.18730483725720898,-304.96019598427785,
650 -5.509644364222013e-05,0.0036242848294101957,-0.1291623098368094,-305.9055839607225,-1.903179046664134e-05,0.0016192545071359696,-0.06555593363048545,-307.03741931311396,-1.0521608343926757e-05,0.0009266632172047965,
651 -0.03467286206923881,-307.6283429185529,-4.137357935808846e-06,0.0005437683809126627,-0.016835897490056075,-307.9313642448178,-1.3662724279523318e-06,0.00024264084646534635,0.00224306347819632,-308.07884150099943,
652 };
653 maptype *map_1[2] = {a0_1};
654 treal *t_1[2] = {t0_1};
655 treal *c_1[1] = {c0_1};
656 splinecoeffs<maptype> sc[2] = {
657 {x0_0, xe_0, hi_0, k_0, n_0, nmap_0, map_0, t_0, c_0, splinedata<unsigned char>::splev_pp<4>},
658 {x0_1, xe_1, hi_1, k_1, n_1, nmap_1, map_1, t_1, c_1, splinedata<unsigned char>::splev_pp<4>},
659 };
660 splinedata<maptype> sd = {
661 sc,
662 2, /* number of calculated values */
663 2, /* number of input values */
664 2, /* number of output values */
665 0, /* number of state values */
666 "nonlin_0",
667 };
668 }; /* ! namespace nonlin_0 */
669 } // namespace AmpData
670
671 // nonlin_0: 2420 bytes
672 // data size sum: 2436 bytes
673 #ifndef NO_INTPP_INCLUDES
674 #include "intpp.h"
675 #endif
676 namespace AmpData {
677 namespace nonlin_1 {
678 typedef unsigned char maptype;
679 real x0_0[1] = {-84.3557465684};
680 real xe_0[1] = {477.417648954};
681 real hi_0[1] = {5.01625748471};
682 int k_0[1] = {4};
683 int nmap_0[1] = {2819};
684 int n_0[1] = {97};
685 treal t0_0[101] = {
686 -288.2926463625786,-288.2926463625786,-288.2926463625786,-288.2926463625786,-84.15639476023611,-58.639363309943306,-45.880847584796896,-39.5015897222237,-38.704182489402044,-38.305478872991216,
687 -37.906775256580396,-37.508071640169575,-37.30871983196416,-37.10936802375875,-36.910016215553334,-36.71066440734792,-36.51131259914251,-36.31196079093709,-36.11260898273168,-35.913257174526265,
688 -35.71390536632086,-35.514553558115445,-35.31520174991003,-35.115849941704624,-34.7171463252938,-34.31844270888297,-33.91973909247214,-33.521035476061314,-33.122331859650494,-32.72362824323967,
689 -32.324924626828846,-31.527517394007194,-30.730110161185543,-29.932702928363895,-29.135295695542244,-28.337888462720592,-27.540481229898944,-26.743073997077293,-25.148259531433993,-23.55344506579069,
690 -21.95863060014739,-20.36381613450409,-18.76900166886079,-17.17418720321749,-13.984558271930888,-10.794929340644288,-9.997522107822636,-9.598818491411812,-9.200114875000986,-8.80141125859016,
691 -8.402707642179337,-7.605300409357685,-6.8078931765360355,-6.010485943714385,-5.213078710892734,-4.415671478071085,-2.820857012427784,-1.226042546784483,0.36877191885881744,1.963586384502118,
692 3.5584008501454187,5.153215315788719,6.748029781432019,8.34284424707532,11.532473178361922,13.127287644005222,14.722102109648523,16.316916575291824,17.911731040935123,21.101359972221726,
693 24.290988903508328,27.480617834794927,30.67024676608153,33.85987569736813,37.04950462865473,40.23913355994134,43.428762491227936,49.80802035380114,56.18727821637434,62.56653607894754,
694 68.94579394152075,75.32505180409395,81.70430966666714,94.46282539181355,107.22134111695996,119.97985684210636,132.73837256725278,145.49688829239918,171.013919742692,196.5309511929848,
695 222.0479826432776,247.56501409357043,273.0820455438632,324.11610844444886,375.15017134503444,426.1842342456201,477.2182971462057,528.2523600467913,528.2523600467913,528.2523600467913,
696 528.2523600467913};
697 maptype a0_0[2818] = {
698 3,4,4,4,4,4,4,4,4,4,
699 4,4,4,4,4,4,4,4,4,4,
700 4,4,4,4,4,4,4,4,4,4,
701 4,4,4,4,4,4,4,4,4,4,
702 4,4,4,4,4,4,4,4,4,4,
703 4,4,4,4,4,4,4,4,4,4,
704 4,4,4,4,4,4,4,4,4,4,
705 4,4,4,4,4,4,4,4,4,4,
706 4,4,4,4,4,4,4,4,4,4,
707 4,4,4,4,4,4,4,4,4,4,
708 4,4,4,4,4,4,4,4,4,4,
709 4,4,4,4,4,4,4,4,4,4,
710 4,4,4,4,4,4,4,4,4,5,
711 5,5,5,5,5,5,5,5,5,5,
712 5,5,5,5,5,5,5,5,5,5,
713 5,5,5,5,5,5,5,5,5,5,
714 5,5,5,5,5,5,5,5,5,5,
715 5,5,5,5,5,5,5,5,5,5,
716 5,5,5,5,5,5,5,5,5,5,
717 5,5,5,6,6,6,6,6,6,6,
718 6,6,6,6,6,6,6,6,6,6,
719 6,6,6,6,6,6,6,6,6,6,
720 6,6,6,6,6,7,7,7,7,8,
721 8,9,9,10,10,11,12,13,14,15,
722 16,17,18,19,20,21,22,23,23,24,
723 24,25,25,26,26,27,27,28,28,29,
724 29,30,30,30,30,31,31,31,31,32,
725 32,32,32,33,33,33,33,34,34,34,
726 34,35,35,35,35,36,36,36,36,37,
727 37,37,37,37,37,37,37,38,38,38,
728 38,38,38,38,38,39,39,39,39,39,
729 39,39,39,40,40,40,40,40,40,40,
730 40,41,41,41,41,41,41,41,41,42,
731 42,42,42,42,42,42,42,43,43,43,
732 43,43,43,43,43,43,43,43,43,43,
733 43,43,43,44,44,44,44,44,44,44,
734 44,44,44,44,44,44,44,44,44,45,
735 45,45,45,46,46,47,47,48,48,49,
736 49,50,50,50,50,51,51,51,51,52,
737 52,52,52,53,53,53,53,54,54,54,
738 54,55,55,55,55,55,55,55,55,56,
739 56,56,56,56,56,56,56,57,57,57,
740 57,57,57,57,57,58,58,58,58,58,
741 58,58,58,59,59,59,59,59,59,59,
742 59,60,60,60,60,60,60,60,60,61,
743 61,61,61,61,61,61,61,62,62,62,
744 62,62,62,62,62,63,63,63,63,63,
745 63,63,63,63,63,63,63,63,63,63,
746 63,64,64,64,64,64,64,64,64,65,
747 65,65,65,65,65,65,65,66,66,66,
748 66,66,66,66,66,67,67,67,67,67,
749 67,67,67,68,68,68,68,68,68,68,
750 68,68,68,68,68,68,68,68,68,69,
751 69,69,69,69,69,69,69,69,69,69,
752 69,69,69,69,69,70,70,70,70,70,
753 70,70,70,70,70,70,70,70,70,70,
754 70,71,71,71,71,71,71,71,71,71,
755 71,71,71,71,71,71,71,72,72,72,
756 72,72,72,72,72,72,72,72,72,72,
757 72,72,72,73,73,73,73,73,73,73,
758 73,73,73,73,73,73,73,73,73,74,
759 74,74,74,74,74,74,74,74,74,74,
760 74,74,74,74,74,75,75,75,75,75,
761 75,75,75,75,75,75,75,75,75,75,
762 75,76,76,76,76,76,76,76,76,76,
763 76,76,76,76,76,76,76,76,76,76,
764 76,76,76,76,76,76,76,76,76,76,
765 76,76,76,77,77,77,77,77,77,77,
766 77,77,77,77,77,77,77,77,77,77,
767 77,77,77,77,77,77,77,77,77,77,
768 77,77,77,77,77,78,78,78,78,78,
769 78,78,78,78,78,78,78,78,78,78,
770 78,78,78,78,78,78,78,78,78,78,
771 78,78,78,78,78,78,78,79,79,79,
772 79,79,79,79,79,79,79,79,79,79,
773 79,79,79,79,79,79,79,79,79,79,
774 79,79,79,79,79,79,79,79,79,80,
775 80,80,80,80,80,80,80,80,80,80,
776 80,80,80,80,80,80,80,80,80,80,
777 80,80,80,80,80,80,80,80,80,80,
778 80,81,81,81,81,81,81,81,81,81,
779 81,81,81,81,81,81,81,81,81,81,
780 81,81,81,81,81,81,81,81,81,81,
781 81,81,81,82,82,82,82,82,82,82,
782 82,82,82,82,82,82,82,82,82,82,
783 82,82,82,82,82,82,82,82,82,82,
784 82,82,82,82,82,82,82,82,82,82,
785 82,82,82,82,82,82,82,82,82,82,
786 82,82,82,82,82,82,82,82,82,82,
787 82,82,82,82,82,82,82,83,83,83,
788 83,83,83,83,83,83,83,83,83,83,
789 83,83,83,83,83,83,83,83,83,83,
790 83,83,83,83,83,83,83,83,83,83,
791 83,83,83,83,83,83,83,83,83,83,
792 83,83,83,83,83,83,83,83,83,83,
793 83,83,83,83,83,83,83,83,83,83,
794 83,84,84,84,84,84,84,84,84,84,
795 84,84,84,84,84,84,84,84,84,84,
796 84,84,84,84,84,84,84,84,84,84,
797 84,84,84,84,84,84,84,84,84,84,
798 84,84,84,84,84,84,84,84,84,84,
799 84,84,84,84,84,84,84,84,84,84,
800 84,84,84,84,84,85,85,85,85,85,
801 85,85,85,85,85,85,85,85,85,85,
802 85,85,85,85,85,85,85,85,85,85,
803 85,85,85,85,85,85,85,85,85,85,
804 85,85,85,85,85,85,85,85,85,85,
805 85,85,85,85,85,85,85,85,85,85,
806 85,85,85,85,85,85,85,85,85,86,
807 86,86,86,86,86,86,86,86,86,86,
808 86,86,86,86,86,86,86,86,86,86,
809 86,86,86,86,86,86,86,86,86,86,
810 86,86,86,86,86,86,86,86,86,86,
811 86,86,86,86,86,86,86,86,86,86,
812 86,86,86,86,86,86,86,86,86,86,
813 86,86,86,87,87,87,87,87,87,87,
814 87,87,87,87,87,87,87,87,87,87,
815 87,87,87,87,87,87,87,87,87,87,
816 87,87,87,87,87,87,87,87,87,87,
817 87,87,87,87,87,87,87,87,87,87,
818 87,87,87,87,87,87,87,87,87,87,
819 87,87,87,87,87,87,87,87,87,87,
820 87,87,87,87,87,87,87,87,87,87,
821 87,87,87,87,87,87,87,87,87,87,
822 87,87,87,87,87,87,87,87,87,87,
823 87,87,87,87,87,87,87,87,87,87,
824 87,87,87,87,87,87,87,87,87,87,
825 87,87,87,87,87,87,87,87,87,87,
826 87,88,88,88,88,88,88,88,88,88,
827 88,88,88,88,88,88,88,88,88,88,
828 88,88,88,88,88,88,88,88,88,88,
829 88,88,88,88,88,88,88,88,88,88,
830 88,88,88,88,88,88,88,88,88,88,
831 88,88,88,88,88,88,88,88,88,88,
832 88,88,88,88,88,88,88,88,88,88,
833 88,88,88,88,88,88,88,88,88,88,
834 88,88,88,88,88,88,88,88,88,88,
835 88,88,88,88,88,88,88,88,88,88,
836 88,88,88,88,88,88,88,88,88,88,
837 88,88,88,88,88,88,88,88,88,88,
838 88,88,88,88,88,88,88,88,88,89,
839 89,89,89,89,89,89,89,89,89,89,
840 89,89,89,89,89,89,89,89,89,89,
841 89,89,89,89,89,89,89,89,89,89,
842 89,89,89,89,89,89,89,89,89,89,
843 89,89,89,89,89,89,89,89,89,89,
844 89,89,89,89,89,89,89,89,89,89,
845 89,89,89,89,89,89,89,89,89,89,
846 89,89,89,89,89,89,89,89,89,89,
847 89,89,89,89,89,89,89,89,89,89,
848 89,89,89,89,89,89,89,89,89,89,
849 89,89,89,89,89,89,89,89,89,89,
850 89,89,89,89,89,89,89,89,89,89,
851 89,89,89,89,89,89,89,90,90,90,
852 90,90,90,90,90,90,90,90,90,90,
853 90,90,90,90,90,90,90,90,90,90,
854 90,90,90,90,90,90,90,90,90,90,
855 90,90,90,90,90,90,90,90,90,90,
856 90,90,90,90,90,90,90,90,90,90,
857 90,90,90,90,90,90,90,90,90,90,
858 90,90,90,90,90,90,90,90,90,90,
859 90,90,90,90,90,90,90,90,90,90,
860 90,90,90,90,90,90,90,90,90,90,
861 90,90,90,90,90,90,90,90,90,90,
862 90,90,90,90,90,90,90,90,90,90,
863 90,90,90,90,90,90,90,90,90,90,
864 90,90,90,90,90,91,91,91,91,91,
865 91,91,91,91,91,91,91,91,91,91,
866 91,91,91,91,91,91,91,91,91,91,
867 91,91,91,91,91,91,91,91,91,91,
868 91,91,91,91,91,91,91,91,91,91,
869 91,91,91,91,91,91,91,91,91,91,
870 91,91,91,91,91,91,91,91,91,91,
871 91,91,91,91,91,91,91,91,91,91,
872 91,91,91,91,91,91,91,91,91,91,
873 91,91,91,91,91,91,91,91,91,91,
874 91,91,91,91,91,91,91,91,91,91,
875 91,91,91,91,91,91,91,91,91,91,
876 91,91,91,91,91,91,91,91,91,91,
877 91,91,91,92,92,92,92,92,92,92,
878 92,92,92,92,92,92,92,92,92,92,
879 92,92,92,92,92,92,92,92,92,92,
880 92,92,92,92,92,92,92,92,92,92,
881 92,92,92,92,92,92,92,92,92,92,
882 92,92,92,92,92,92,92,92,92,92,
883 92,92,92,92,92,92,92,92,92,92,
884 92,92,92,92,92,92,92,92,92,92,
885 92,92,92,92,92,92,92,92,92,92,
886 92,92,92,92,92,92,92,92,92,92,
887 92,92,92,92,92,92,92,92,92,92,
888 92,92,92,92,92,92,92,92,92,92,
889 92,92,92,92,92,92,92,92,92,92,
890 92,92,92,92,92,92,92,92,92,92,
891 92,92,92,92,92,92,92,92,92,92,
892 92,92,92,92,92,92,92,92,92,92,
893 92,92,92,92,92,92,92,92,92,92,
894 92,92,92,92,92,92,92,92,92,92,
895 92,92,92,92,92,92,92,92,92,92,
896 92,92,92,92,92,92,92,92,92,92,
897 92,92,92,92,92,92,92,92,92,92,
898 92,92,92,92,92,92,92,92,92,92,
899 92,92,92,92,92,92,92,92,92,92,
900 92,92,92,92,92,92,92,92,92,92,
901 92,92,92,92,92,92,92,92,92,92,
902 92,92,92,92,92,92,92,92,92,93,
903 93,93,93,93,93,93,93,93,93,93,
904 93,93,93,93,93,93,93,93,93,93,
905 93,93,93,93,93,93,93,93,93,93,
906 93,93,93,93,93,93,93,93,93,93,
907 93,93,93,93,93,93,93,93,93,93,
908 93,93,93,93,93,93,93,93,93,93,
909 93,93,93,93,93,93,93,93,93,93,
910 93,93,93,93,93,93,93,93,93,93,
911 93,93,93,93,93,93,93,93,93,93,
912 93,93,93,93,93,93,93,93,93,93,
913 93,93,93,93,93,93,93,93,93,93,
914 93,93,93,93,93,93,93,93,93,93,
915 93,93,93,93,93,93,93,93,93,93,
916 93,93,93,93,93,93,93,93,93,93,
917 93,93,93,93,93,93,93,93,93,93,
918 93,93,93,93,93,93,93,93,93,93,
919 93,93,93,93,93,93,93,93,93,93,
920 93,93,93,93,93,93,93,93,93,93,
921 93,93,93,93,93,93,93,93,93,93,
922 93,93,93,93,93,93,93,93,93,93,
923 93,93,93,93,93,93,93,93,93,93,
924 93,93,93,93,93,93,93,93,93,93,
925 93,93,93,93,93,93,93,93,93,93,
926 93,93,93,93,93,93,93,93,93,93,
927 93,93,93,93,93,93,93,93,93,93,
928 93,93,93,93,93,94,94,94,94,94,
929 94,94,94,94,94,94,94,94,94,94,
930 94,94,94,94,94,94,94,94,94,94,
931 94,94,94,94,94,94,94,94,94,94,
932 94,94,94,94,94,94,94,94,94,94,
933 94,94,94,94,94,94,94,94,94,94,
934 94,94,94,94,94,94,94,94,94,94,
935 94,94,94,94,94,94,94,94,94,94,
936 94,94,94,94,94,94,94,94,94,94,
937 94,94,94,94,94,94,94,94,94,94,
938 94,94,94,94,94,94,94,94,94,94,
939 94,94,94,94,94,94,94,94,94,94,
940 94,94,94,94,94,94,94,94,94,94,
941 94,94,94,94,94,94,94,94,94,94,
942 94,94,94,94,94,94,94,94,94,94,
943 94,94,94,94,94,94,94,94,94,94,
944 94,94,94,94,94,94,94,94,94,94,
945 94,94,94,94,94,94,94,94,94,94,
946 94,94,94,94,94,94,94,94,94,94,
947 94,94,94,94,94,94,94,94,94,94,
948 94,94,94,94,94,94,94,94,94,94,
949 94,94,94,94,94,94,94,94,94,94,
950 94,94,94,94,94,94,94,94,94,94,
951 94,94,94,94,94,94,94,94,94,94,
952 94,94,94,94,94,94,94,94,94,94,
953 94,94,94,94,94,94,94,94,94,94,
954 94,95,95,95,95,95,95,95,95,95,
955 95,95,95,95,95,95,95,95,95,95,
956 95,95,95,95,95,95,95,95,95,95,
957 95,95,95,95,95,95,95,95,95,95,
958 95,95,95,95,95,95,95,95,95,95,
959 95,95,95,95,95,95,95,95,95,95,
960 95,95,95,95,95,95,95,95,95,95,
961 95,95,95,95,95,95,95,95,95,95,
962 95,95,95,95,95,95,95,95,95,95,
963 95,95,95,95,95,95,95,95,95,95,
964 95,95,95,95,95,95,95,95,95,95,
965 95,95,95,95,95,95,95,95,95,95,
966 95,95,95,95,95,95,95,95,95,95,
967 95,95,95,95,95,95,95,95,95,95,
968 95,95,95,95,95,95,95,95,95,95,
969 95,95,95,95,95,95,95,95,95,95,
970 95,95,95,95,95,95,95,95,95,95,
971 95,95,95,95,95,95,95,95,95,95,
972 95,95,95,95,95,95,95,95,95,95,
973 95,95,95,95,95,95,95,95,95,95,
974 95,95,95,95,95,95,95,95,95,95,
975 95,95,95,95,95,95,95,95,95,95,
976 95,95,95,95,95,95,95,95,95,95,
977 95,95,95,95,95,95,95,95,95,95,
978 95,95,95,95,95,95,95,95,95,95,
979 95,95,95,95,95,95,95,96};
980 treal c0_0[376] = {
981 -1.4098306912781866e-10,3.785479628582994e-08,-2.324316285693539e-06,9.634462871282249e-06,1.960181358648102e-08,-4.848446952761055e-08,-4.494217937028353e-06,-8.667118842496641e-05,-3.8377800906645655e-07,1.4520558117794282e-06,
982 3.1320756145940964e-05,9.275726642802674e-05,8.058124288697283e-06,-1.3237257479139876e-05,-0.000119040924651099,-6.831191554306465e-05,0.003638822081560925,0.00014097730069965273,0.0006958457504287977,0.0007255229802391752,
983 0.004670889111060192,0.008845846441063149,0.007862004002203824,0.0032150580837461157,0.019412623179141764,0.014432747582364111,0.01714326362430375,0.00805188350667582,0.02478657002351342,0.03765239677899713,
984 0.03790979904245813,0.018411627490388327,0.03409415836165908,0.06729988209938163,0.0797546521818247,0.041082765292381376,0.025629482570435055,0.08769007845529703,0.11065218107208565,0.05992668359129099,
985 0.020535568540425205,0.10301792953665312,0.14867016730453342,0.08567334873170579,0.008508184988790085,0.11529933769983304,0.19219210929059144,0.11956775812526615,-0.002017129445343131,0.12038770388601742,
986 0.2391767472013153,0.16253113598277213,-0.010668228781033587,0.11918134867907682,0.28693527102022465,0.21497981738085598,-0.015769209180709426,0.11280115658553257,0.33318140291674647,0.2768327668595422,
987 -0.017917922338409296,0.10337029549310106,0.376275572771012,0.34761099786708965,-0.017927268404173198,0.09265438484076285,0.41535344724845596,0.42658831324184804,-0.016771949403814695,0.08193288472309611,
988 0.450157735125656,0.5129299369683228,-0.014908007435508353,0.0719023294007556,0.4808250632269129,0.605792926721149,-0.013485932663309642,0.06298651468373057,0.5077153982018933,0.7043856450680901,
989 -0.01056455946308883,0.054921179498429167,0.531220510238437,0.8079959419870516,-0.007597694694493399,0.04228479530726693,0.5699768839302077,1.0278564232767526,-0.0055921681762785445,0.0331971102540273,
990 0.6000717926510764,1.2613485126383768,-0.004140082247370856,0.026508257227647908,0.6238765385851577,1.505522040732009,-0.003131611937591421,0.02155625993485283,0.643040035398887,1.7582153492909371,
991 -0.002381741262315317,0.01781050492071384,0.6587357069131958,2.0178259377903167,-0.0019408210578741607,0.014961678356793871,0.6718020949036164,2.2831465315515485,-0.0013465173267465796,0.012640241233051724,
992 0.6828070800639686,2.5532518243701197,-0.0008707301246721087,0.00941907326664953,0.7003973369971179,3.1050817954162833,-0.0006129355368492403,0.007336093768901817,0.7137580283784015,3.669131400390254,
993 -0.0004409042020333111,0.005869816077890806,0.7242885164062246,4.242641149168397,-0.00032996881823149003,0.004815075478842343,0.7328087262154785,4.823702866857068,-0.00025047713097302743,0.004025716912052134,
994 0.7398584380118525,5.410944244369379,-0.0002046610334437265,0.003426520084369212,0.7458009056934999,6.0033454981714325,-0.00014426760687552426,0.0029369255193348676,0.7508751632435607,6.600127544913067,
995 -9.629140369029607e-05,0.002246685320228387,0.7591420607947615,7.8045187976839046,-7.098927230493294e-05,0.001785984549661238,0.7655734210384255,9.020533244497143,-5.255961182529003e-05,0.001446340394529043,
996 0.7707283796170799,10.24573538917235,-4.7213527913433756e-05,0.0011948719067863356,0.7749406232020526,11.47836963045112,-1.974761181272241e-05,0.0009689814549151415,0.778391567844825,12.71710371077832,
997 -5.4972617037243696e-05,0.0008745001239726269,0.7813315789339821,13.960878280377749,6.31178681843194e-05,0.0003484733747810334,0.7852324105878037,16.460149134814554,-0.0027661275165766067,0.000952441110106551,
998 0.7893818450659309,18.97034262648757,0.03337280476381055,-0.0056647491557689856,0.785624216547036,19.599004505008278,-0.01078621129881676,0.034252824691541936,0.7970223856493744,19.913450386887725,
999 -0.010582718433596582,0.02135132033491328,0.8191919593588541,20.23598745270275,-0.0009923009464007993,0.00869321600211588,0.8311708246498142,20.5653256229164,-0.001182329596975872,0.007506314074422235,
1000 0.8376296358754858,20.89803545814931,-0.00044052603991519946,0.0046779195577992295,0.8473454319002081,21.570140854252692,-0.00031459625000537306,0.003624083606375253,0.8539655092702291,22.248571360858524,
1001 -0.0001962409273418918,0.002871499630856695,0.8591451343249928,22.93167452589906,-0.0001517235006254813,0.0024020478263425374,0.8633502992099917,23.61848943530459,-9.808807298711842e-05,0.002039091575979201,
1002 0.8668916958913723,24.3083816408078,-6.16744044887281e-05,0.0015697947428584037,0.8726471999975167,25.695701475686946,-4.442835797282901e-05,0.0012747170455427246,0.8771836685453517,27.091154351545278,
1003 -3.348954139243773e-05,0.001062152081603185,0.8809105412336393,28.493161497868602,-2.6683222559134847e-05,0.0009019232664219256,0.8840428770102831,29.90061604105042,-2.2088178681282497e-05,0.0007742588984400619,
1004 0.8867160765738583,31.312686155853683,-1.667711339966583e-05,0.0006685792577981921,0.8890171357370091,32.72871346109606,-1.3575572323023186e-05,0.0005887885527133097,0.8910224041098471,34.14816368859959,
1005 3.870682341339684e-06,0.0005238369953528771,0.8927968354287474,35.57062158557842,1.652501762750896e-05,0.0005608751164921488,0.8962566645628054,38.42376718451725,1.025533165799457e-05,0.0006399381279642342,
1006 0.8981717388956004,39.85462385696781,4.217489203709734e-06,0.0006890041817986525,0.9002911553152158,41.288710377401316,-1.3606583009440145e-06,0.0007091825201709647,0.902521003693187,42.72627727870422,
1007 -6.5919455386986025e-06,0.0007026725275475353,0.90477265054668,44.16742907004963,-8.337302371781329e-06,0.0006395949469364391,0.909053985716819,47.060252983472736,-7.449588627944947e-06,0.0005598162443746847,
1008 0.9128796623531339,49.966034395389734,-6.315093844706993e-06,0.0004885319741330542,0.916223504160949,52.88323545568578,-5.222210236886068e-06,0.0004281035560404521,0.9191472313674356,55.810413718287215,
1009 -4.3340984409028905e-06,0.00037813281746995354,0.92171882622984,58.746338267744775,-3.584018510477514e-06,0.00033666032013550954,0.9239987511014315,61.689985681248636,-3.1164047298666206e-06,0.0003023652527416521,
1010 0.9260370055565125,64.64050761939896,-2.397927550774463e-06,0.0002725447286777092,0.9278707550661331,67.59719709834856,-1.7582332772723927e-06,0.0002266537341312325,0.9310552707849915,73.52679258666676,
1011 -1.3590446900958163e-06,0.00019300506375639925,0.9337323824710142,79.47500145791733,-1.0705780458318834e-06,0.00016699597418175295,0.9360289219228157,85.43902261536246,-8.554633498108393e-07,0.00014650749393263905,
1012 0.9380288413867284,91.41671043899811,-7.26565013231226e-07,0.00013013583003136704,0.9397936204862541,97.40637833182979,-5.433695525704639e-07,0.00011623099331138935,0.9413652579811407,103.40667142433091,
1013 -3.875120433256194e-07,9.543322636828125e-05,0.9440657792563745,115.43488643542663,-2.955848690540261e-07,8.060099087292065e-05,0.9463117145852102,127.49449432411251,-2.2764651014780293e-07,6.928731827309727e-05,
1014 0.9482240669344653,139.5805335437144,-1.889365693472967e-07,6.057402353461092e-05,0.9498809049060076,151.6892710006018,-1.3662970839616652e-07,5.334237296139283e-05,0.9513343090420538,163.81780929697055,
1015 -9.405186200125871e-08,4.288321926282487e-05,0.9537897005051623,188.12549895656414,-7.014801524368798e-08,3.5683446300890725e-05,0.9557944885812962,212.4897401795494,-5.297669610422804e-08,3.0313538967444306e-05,
1016 0.9574785357300128,236.90084688807764,-4.3382495941391207e-08,2.625811490557173e-05,0.9589220764010857,261.35171432750417,-3.079907645361472e-08,2.2937137365585694e-05,0.9601773932004939,285.8369354804065,
1017 -2.0795670460507038e-08,1.8221731350544535e-05,0.9622778974954699,334.89433445484354,-1.5313305483537226e-08,1.5037868687520437e-05,0.9639752700158608,384.0479791602135,-1.148795673562738e-08,1.2693368101732272e-05,
1018 0.9653905076984746,433.2806840883545,-9.203493258516892e-09,1.093453678179663e-05,0.9665963356825096,482.58001660466164};
1019 maptype *map_0[1] = {a0_0};
1020 treal *t_0[1] = {t0_0};
1021 treal *c_0[1] = {c0_0};
1022 real x0_1[2] = {-84.2062327123};
1023 real xe_1[2] = {426.234072198};
1024 real hi_1[2] = {20.0650299388};
1025 int k_1[2] = {4};
1026 int nmap_1[2] = {10243};
1027 int n_1[2] = {195};
1028 treal t0_1[199] = {
1029 -288.2926463625786,-288.2926463625786,-288.2926463625786,-288.2926463625786,-84.15639476023611,-58.639363309943306,-45.880847584796896,-42.6912186535103,-41.096404187866995,-39.5015897222237,
1030 -39.10288610581287,-38.704182489402044,-38.50483068119663,-38.305478872991216,-38.10612706478581,-38.0064511606831,-37.906775256580396,-37.80709935247769,-37.70742344837498,-37.60774754427228,
1031 -37.508071640169575,-37.408395736066865,-37.30871983196416,-37.258881879912806,-37.20904392786146,-37.1592059758101,-37.10936802375875,-37.05953007170739,-37.00969211965604,-36.95985416760469,
1032 -36.910016215553334,-36.86017826350198,-36.81034031145063,-36.760502359399275,-36.71066440734792,-36.660826455296565,-36.61098850324521,-36.56115055119386,-36.51131259914251,-36.46147464709115,
1033 -36.4116366950398,-36.36179874298845,-36.31196079093709,-36.26212283888574,-36.21228488683438,-36.162446934783034,-36.11260898273168,-36.062771030680324,-36.012933078628976,-35.96309512657762,
1034 -35.913257174526265,-35.81358127042356,-35.71390536632086,-35.61422946221815,-35.514553558115445,-35.41487765401274,-35.31520174991003,-35.21552584580733,-35.115849941704624,-35.016174037601914,
1035 -34.91649813349921,-34.81682222939651,-34.7171463252938,-34.617470421191086,-34.51779451708838,-34.41811861298568,-34.31844270888297,-34.21876680478026,-34.119090900677556,-33.91973909247214,
1036 -33.72038728426673,-33.521035476061314,-33.32168366785591,-33.122331859650494,-32.92298005144508,-32.72362824323967,-32.52427643503426,-32.324924626828846,-32.12557281862343,-31.92622101041802,
1037 -31.726869202212605,-31.527517394007194,-31.12881377759637,-30.730110161185543,-30.33140654477472,-29.932702928363895,-29.533999311953067,-29.135295695542244,-28.73659207913142,-28.337888462720592,
1038 -27.939184846309768,-27.540481229898944,-26.743073997077293,-25.94566676425564,-25.148259531433993,-24.35085229861234,-23.55344506579069,-22.756037832969042,-21.95863060014739,-21.16122336732574,
1039 -20.36381613450409,-18.76900166886079,-17.17418720321749,-15.57937273757419,-13.984558271930888,-10.794929340644288,-9.997522107822636,-9.598818491411812,-9.499142587309105,-9.399466683206398,
1040 -9.200114875000986,-9.000763066795574,-8.80141125859016,-8.602059450384749,-8.402707642179337,-8.004004025768511,-7.605300409357685,-7.20659679294686,-6.8078931765360355,-6.40918956012521,
1041 -6.010485943714385,-5.61178232730356,-5.213078710892734,-4.8143750944819095,-4.415671478071085,-3.618264245249434,-2.820857012427784,-2.0234497796061337,-1.226042546784483,-0.42863531396283283,
1042 0.36877191885881744,1.1661791516804678,1.963586384502118,2.760993617323768,3.5584008501454187,4.355808082967069,5.153215315788719,5.950622548610369,6.748029781432019,7.54543701425367,
1043 7.944140630664495,8.34284424707532,8.741547863486145,9.140251479896971,9.538955096307795,9.937658712718621,10.336362329129447,10.73506594554027,11.133769561951096,11.532473178361922,
1044 11.931176794772746,12.329880411183572,12.728584027594398,13.127287644005222,13.525991260416047,13.924694876826873,14.323398493237697,14.722102109648523,15.519509342470172,16.316916575291824,
1045 17.114323808113475,17.911731040935123,18.709138273756775,19.506545506578426,20.303952739400074,21.101359972221726,21.898767205043377,22.696174437865025,24.290988903508328,25.885803369151628,
1046 27.480617834794927,29.07543230043823,30.67024676608153,32.26506123172483,33.85987569736813,37.04950462865473,40.23913355994134,43.428762491227936,46.618391422514534,49.80802035380114,
1047 56.18727821637434,62.56653607894754,68.94579394152075,75.32505180409395,81.70430966666714,94.46282539181355,107.22134111695996,119.97985684210636,145.49688829239918,171.013919742692,
1048 196.5309511929848,222.0479826432776,273.0820455438632,324.11610844444886,426.1842342456201,528.2523600467913,528.2523600467913,528.2523600467913,528.2523600467913};
1049 maptype a0_1[10242] = {
1050 3,4,4,4,4,4,4,4,4,4,
1051 4,4,4,4,4,4,4,4,4,4,
1052 4,4,4,4,4,4,4,4,4,4,
1053 4,4,4,4,4,4,4,4,4,4,
1054 4,4,4,4,4,4,4,4,4,4,
1055 4,4,4,4,4,4,4,4,4,4,
1056 4,4,4,4,4,4,4,4,4,4,
1057 4,4,4,4,4,4,4,4,4,4,
1058 4,4,4,4,4,4,4,4,4,4,
1059 4,4,4,4,4,4,4,4,4,4,
1060 4,4,4,4,4,4,4,4,4,4,
1061 4,4,4,4,4,4,4,4,4,4,
1062 4,4,4,4,4,4,4,4,4,4,
1063 4,4,4,4,4,4,4,4,4,4,
1064 4,4,4,4,4,4,4,4,4,4,
1065 4,4,4,4,4,4,4,4,4,4,
1066 4,4,4,4,4,4,4,4,4,4,
1067 4,4,4,4,4,4,4,4,4,4,
1068 4,4,4,4,4,4,4,4,4,4,
1069 4,4,4,4,4,4,4,4,4,4,
1070 4,4,4,4,4,4,4,4,4,4,
1071 4,4,4,4,4,4,4,4,4,4,
1072 4,4,4,4,4,4,4,4,4,4,
1073 4,4,4,4,4,4,4,4,4,4,
1074 4,4,4,4,4,4,4,4,4,4,
1075 4,4,4,4,4,4,4,4,4,4,
1076 4,4,4,4,4,4,4,4,4,4,
1077 4,4,4,4,4,4,4,4,4,4,
1078 4,4,4,4,4,4,4,4,4,4,
1079 4,4,4,4,4,4,4,4,4,4,
1080 4,4,4,4,4,4,4,4,4,4,
1081 4,4,4,4,4,4,4,4,4,4,
1082 4,4,4,4,4,4,4,4,4,4,
1083 4,4,4,4,4,4,4,4,4,4,
1084 4,4,4,4,4,4,4,4,4,4,
1085 4,4,4,4,4,4,4,4,4,4,
1086 4,4,4,4,4,4,4,4,4,4,
1087 4,4,4,4,4,4,4,4,4,4,
1088 4,4,4,4,4,4,4,4,4,4,
1089 4,4,4,4,4,4,4,4,4,4,
1090 4,4,4,4,4,4,4,4,4,4,
1091 4,4,4,4,4,4,4,4,4,4,
1092 4,4,4,4,4,4,4,4,4,4,
1093 4,4,4,4,4,4,4,4,4,4,
1094 4,4,4,4,4,4,4,4,4,4,
1095 4,4,4,4,4,4,4,4,4,4,
1096 4,4,4,4,4,4,4,4,4,4,
1097 4,4,4,4,4,4,4,4,4,4,
1098 4,4,4,4,4,4,4,4,4,4,
1099 4,4,4,4,4,4,4,4,4,4,
1100 4,4,4,4,4,4,4,4,4,4,
1101 4,4,4,5,5,5,5,5,5,5,
1102 5,5,5,5,5,5,5,5,5,5,
1103 5,5,5,5,5,5,5,5,5,5,
1104 5,5,5,5,5,5,5,5,5,5,
1105 5,5,5,5,5,5,5,5,5,5,
1106 5,5,5,5,5,5,5,5,5,5,
1107 5,5,5,5,5,5,5,5,5,5,
1108 5,5,5,5,5,5,5,5,5,5,
1109 5,5,5,5,5,5,5,5,5,5,
1110 5,5,5,5,5,5,5,5,5,5,
1111 5,5,5,5,5,5,5,5,5,5,
1112 5,5,5,5,5,5,5,5,5,5,
1113 5,5,5,5,5,5,5,5,5,5,
1114 5,5,5,5,5,5,5,5,5,5,
1115 5,5,5,5,5,5,5,5,5,5,
1116 5,5,5,5,5,5,5,5,5,5,
1117 5,5,5,5,5,5,5,5,5,5,
1118 5,5,5,5,5,5,5,5,5,5,
1119 5,5,5,5,5,5,5,5,5,5,
1120 5,5,5,5,5,5,5,5,5,5,
1121 5,5,5,5,5,5,5,5,5,5,
1122 5,5,5,5,5,5,5,5,5,5,
1123 5,5,5,5,5,5,5,5,5,5,
1124 5,5,5,5,5,5,5,5,5,5,
1125 5,5,5,5,5,5,5,5,5,5,
1126 5,5,5,5,5,5,5,5,5,6,
1127 6,6,6,6,6,6,6,6,6,6,
1128 6,6,6,6,6,6,6,6,6,6,
1129 6,6,6,6,6,6,6,6,6,6,
1130 6,6,6,6,6,6,6,6,6,6,
1131 6,6,6,6,6,6,6,6,6,6,
1132 6,6,6,6,6,6,6,6,6,6,
1133 6,6,6,7,7,7,7,7,7,7,
1134 7,7,7,7,7,7,7,7,7,7,
1135 7,7,7,7,7,7,7,7,7,7,
1136 7,7,7,7,7,8,8,8,8,8,
1137 8,8,8,8,8,8,8,8,8,8,
1138 8,8,8,8,8,8,8,8,8,8,
1139 8,8,8,8,8,8,8,9,9,9,
1140 9,9,9,9,9,10,10,10,10,10,
1141 10,10,10,11,11,11,11,12,12,12,
1142 12,13,13,13,13,14,14,15,15,16,
1143 16,17,17,18,18,19,19,20,20,21,
1144 21,22,23,24,25,26,27,28,29,30,
1145 31,32,33,34,35,36,37,38,39,40,
1146 41,42,43,44,45,46,47,48,49,50,
1147 50,51,51,52,52,53,53,54,54,55,
1148 55,56,56,57,57,58,58,59,59,60,
1149 60,61,61,62,62,63,63,64,64,65,
1150 65,66,66,67,67,68,68,68,68,69,
1151 69,69,69,70,70,70,70,71,71,71,
1152 71,72,72,72,72,73,73,73,73,74,
1153 74,74,74,75,75,75,75,76,76,76,
1154 76,77,77,77,77,78,78,78,78,79,
1155 79,79,79,80,80,80,80,81,81,81,
1156 81,81,81,81,81,82,82,82,82,82,
1157 82,82,82,83,83,83,83,83,83,83,
1158 83,84,84,84,84,84,84,84,84,85,
1159 85,85,85,85,85,85,85,86,86,86,
1160 86,86,86,86,86,87,87,87,87,87,
1161 87,87,87,88,88,88,88,88,88,88,
1162 88,89,89,89,89,89,89,89,89,90,
1163 90,90,90,90,90,90,90,91,91,91,
1164 91,91,91,91,91,91,91,91,91,91,
1165 91,91,91,92,92,92,92,92,92,92,
1166 92,92,92,92,92,92,92,92,92,93,
1167 93,93,93,93,93,93,93,93,93,93,
1168 93,93,93,93,93,94,94,94,94,94,
1169 94,94,94,94,94,94,94,94,94,94,
1170 94,95,95,95,95,95,95,95,95,95,
1171 95,95,95,95,95,95,95,96,96,96,
1172 96,96,96,96,96,96,96,96,96,96,
1173 96,96,96,97,97,97,97,97,97,97,
1174 97,97,97,97,97,97,97,97,97,98,
1175 98,98,98,98,98,98,98,98,98,98,
1176 98,98,98,98,98,99,99,99,99,99,
1177 99,99,99,99,99,99,99,99,99,99,
1178 99,100,100,100,100,100,100,100,100,100,
1179 100,100,100,100,100,100,100,100,100,100,
1180 100,100,100,100,100,100,100,100,100,100,
1181 100,100,100,101,101,101,101,101,101,101,
1182 101,101,101,101,101,101,101,101,101,101,
1183 101,101,101,101,101,101,101,101,101,101,
1184 101,101,101,101,101,102,102,102,102,102,
1185 102,102,102,102,102,102,102,102,102,102,
1186 102,102,102,102,102,102,102,102,102,102,
1187 102,102,102,102,102,102,102,103,103,103,
1188 103,103,103,103,103,103,103,103,103,103,
1189 103,103,103,103,103,103,103,103,103,103,
1190 103,103,103,103,103,103,103,103,103,104,
1191 104,104,104,104,104,104,104,104,104,104,
1192 104,104,104,104,104,104,104,104,104,104,
1193 104,104,104,104,104,104,104,104,104,104,
1194 104,104,104,104,104,104,104,104,104,104,
1195 104,104,104,104,104,104,104,104,104,104,
1196 104,104,104,104,104,104,104,104,104,104,
1197 104,104,104,105,105,105,105,105,105,105,
1198 105,105,105,105,105,105,105,105,105,106,
1199 106,106,106,106,106,106,106,107,107,108,
1200 108,109,109,109,109,110,110,110,110,111,
1201 111,111,111,112,112,112,112,113,113,113,
1202 113,114,114,114,114,114,114,114,114,115,
1203 115,115,115,115,115,115,115,116,116,116,
1204 116,116,116,116,116,117,117,117,117,117,
1205 117,117,117,118,118,118,118,118,118,118,
1206 118,119,119,119,119,119,119,119,119,120,
1207 120,120,120,120,120,120,120,121,121,121,
1208 121,121,121,121,121,122,122,122,122,122,
1209 122,122,122,123,123,123,123,123,123,123,
1210 123,124,124,124,124,124,124,124,124,124,
1211 124,124,124,124,124,124,124,125,125,125,
1212 125,125,125,125,125,125,125,125,125,125,
1213 125,125,125,126,126,126,126,126,126,126,
1214 126,126,126,126,126,126,126,126,126,127,
1215 127,127,127,127,127,127,127,127,127,127,
1216 127,127,127,127,127,128,128,128,128,128,
1217 128,128,128,128,128,128,128,128,128,128,
1218 128,129,129,129,129,129,129,129,129,129,
1219 129,129,129,129,129,129,129,130,130,130,
1220 130,130,130,130,130,130,130,130,130,130,
1221 130,130,130,131,131,131,131,131,131,131,
1222 131,131,131,131,131,131,131,131,131,132,
1223 132,132,132,132,132,132,132,132,132,132,
1224 132,132,132,132,132,133,133,133,133,133,
1225 133,133,133,133,133,133,133,133,133,133,
1226 133,134,134,134,134,134,134,134,134,134,
1227 134,134,134,134,134,134,134,135,135,135,
1228 135,135,135,135,135,135,135,135,135,135,
1229 135,135,135,136,136,136,136,136,136,136,
1230 136,136,136,136,136,136,136,136,136,137,
1231 137,137,137,137,137,137,137,137,137,137,
1232 137,137,137,137,137,138,138,138,138,138,
1233 138,138,138,138,138,138,138,138,138,138,
1234 138,139,139,139,139,139,139,139,139,140,
1235 140,140,140,140,140,140,140,141,141,141,
1236 141,141,141,141,141,142,142,142,142,142,
1237 142,142,142,143,143,143,143,143,143,143,
1238 143,144,144,144,144,144,144,144,144,145,
1239 145,145,145,145,145,145,145,146,146,146,
1240 146,146,146,146,146,147,147,147,147,147,
1241 147,147,147,148,148,148,148,148,148,148,
1242 148,149,149,149,149,149,149,149,149,150,
1243 150,150,150,150,150,150,150,151,151,151,
1244 151,151,151,151,151,152,152,152,152,152,
1245 152,152,152,153,153,153,153,153,153,153,
1246 153,154,154,154,154,154,154,154,154,155,
1247 155,155,155,155,155,155,155,156,156,156,
1248 156,156,156,156,156,157,157,157,157,157,
1249 157,157,157,157,157,157,157,157,157,157,
1250 157,158,158,158,158,158,158,158,158,158,
1251 158,158,158,158,158,158,158,159,159,159,
1252 159,159,159,159,159,159,159,159,159,159,
1253 159,159,159,160,160,160,160,160,160,160,
1254 160,160,160,160,160,160,160,160,160,161,
1255 161,161,161,161,161,161,161,161,161,161,
1256 161,161,161,161,161,162,162,162,162,162,
1257 162,162,162,162,162,162,162,162,162,162,
1258 162,163,163,163,163,163,163,163,163,163,
1259 163,163,163,163,163,163,163,164,164,164,
1260 164,164,164,164,164,164,164,164,164,164,
1261 164,164,164,165,165,165,165,165,165,165,
1262 165,165,165,165,165,165,165,165,165,166,
1263 166,166,166,166,166,166,166,166,166,166,
1264 166,166,166,166,166,167,167,167,167,167,
1265 167,167,167,167,167,167,167,167,167,167,
1266 167,167,167,167,167,167,167,167,167,167,
1267 167,167,167,167,167,167,167,168,168,168,
1268 168,168,168,168,168,168,168,168,168,168,
1269 168,168,168,168,168,168,168,168,168,168,
1270 168,168,168,168,168,168,168,168,168,169,
1271 169,169,169,169,169,169,169,169,169,169,
1272 169,169,169,169,169,169,169,169,169,169,
1273 169,169,169,169,169,169,169,169,169,169,
1274 169,170,170,170,170,170,170,170,170,170,
1275 170,170,170,170,170,170,170,170,170,170,
1276 170,170,170,170,170,170,170,170,170,170,
1277 170,170,170,171,171,171,171,171,171,171,
1278 171,171,171,171,171,171,171,171,171,171,
1279 171,171,171,171,171,171,171,171,171,171,
1280 171,171,171,171,171,172,172,172,172,172,
1281 172,172,172,172,172,172,172,172,172,172,
1282 172,172,172,172,172,172,172,172,172,172,
1283 172,172,172,172,172,172,172,173,173,173,
1284 173,173,173,173,173,173,173,173,173,173,
1285 173,173,173,173,173,173,173,173,173,173,
1286 173,173,173,173,173,173,173,173,173,174,
1287 174,174,174,174,174,174,174,174,174,174,
1288 174,174,174,174,174,174,174,174,174,174,
1289 174,174,174,174,174,174,174,174,174,174,
1290 174,174,174,174,174,174,174,174,174,174,
1291 174,174,174,174,174,174,174,174,174,174,
1292 174,174,174,174,174,174,174,174,174,174,
1293 174,174,174,175,175,175,175,175,175,175,
1294 175,175,175,175,175,175,175,175,175,175,
1295 175,175,175,175,175,175,175,175,175,175,
1296 175,175,175,175,175,175,175,175,175,175,
1297 175,175,175,175,175,175,175,175,175,175,
1298 175,175,175,175,175,175,175,175,175,175,
1299 175,175,175,175,175,175,175,176,176,176,
1300 176,176,176,176,176,176,176,176,176,176,
1301 176,176,176,176,176,176,176,176,176,176,
1302 176,176,176,176,176,176,176,176,176,176,
1303 176,176,176,176,176,176,176,176,176,176,
1304 176,176,176,176,176,176,176,176,176,176,
1305 176,176,176,176,176,176,176,176,176,176,
1306 176,177,177,177,177,177,177,177,177,177,
1307 177,177,177,177,177,177,177,177,177,177,
1308 177,177,177,177,177,177,177,177,177,177,
1309 177,177,177,177,177,177,177,177,177,177,
1310 177,177,177,177,177,177,177,177,177,177,
1311 177,177,177,177,177,177,177,177,177,177,
1312 177,177,177,177,177,178,178,178,178,178,
1313 178,178,178,178,178,178,178,178,178,178,
1314 178,178,178,178,178,178,178,178,178,178,
1315 178,178,178,178,178,178,178,178,178,178,
1316 178,178,178,178,178,178,178,178,178,178,
1317 178,178,178,178,178,178,178,178,178,178,
1318 178,178,178,178,178,178,178,178,178,179,
1319 179,179,179,179,179,179,179,179,179,179,
1320 179,179,179,179,179,179,179,179,179,179,
1321 179,179,179,179,179,179,179,179,179,179,
1322 179,179,179,179,179,179,179,179,179,179,
1323 179,179,179,179,179,179,179,179,179,179,
1324 179,179,179,179,179,179,179,179,179,179,
1325 179,179,179,179,179,179,179,179,179,179,
1326 179,179,179,179,179,179,179,179,179,179,
1327 179,179,179,179,179,179,179,179,179,179,
1328 179,179,179,179,179,179,179,179,179,179,
1329 179,179,179,179,179,179,179,179,179,179,
1330 179,179,179,179,179,179,179,179,179,179,
1331 179,179,179,179,179,179,179,180,180,180,
1332 180,180,180,180,180,180,180,180,180,180,
1333 180,180,180,180,180,180,180,180,180,180,
1334 180,180,180,180,180,180,180,180,180,180,
1335 180,180,180,180,180,180,180,180,180,180,
1336 180,180,180,180,180,180,180,180,180,180,
1337 180,180,180,180,180,180,180,180,180,180,
1338 180,180,180,180,180,180,180,180,180,180,
1339 180,180,180,180,180,180,180,180,180,180,
1340 180,180,180,180,180,180,180,180,180,180,
1341 180,180,180,180,180,180,180,180,180,180,
1342 180,180,180,180,180,180,180,180,180,180,
1343 180,180,180,180,180,180,180,180,180,180,
1344 180,180,180,180,180,181,181,181,181,181,
1345 181,181,181,181,181,181,181,181,181,181,
1346 181,181,181,181,181,181,181,181,181,181,
1347 181,181,181,181,181,181,181,181,181,181,
1348 181,181,181,181,181,181,181,181,181,181,
1349 181,181,181,181,181,181,181,181,181,181,
1350 181,181,181,181,181,181,181,181,181,181,
1351 181,181,181,181,181,181,181,181,181,181,
1352 181,181,181,181,181,181,181,181,181,181,
1353 181,181,181,181,181,181,181,181,181,181,
1354 181,181,181,181,181,181,181,181,181,181,
1355 181,181,181,181,181,181,181,181,181,181,
1356 181,181,181,181,181,181,181,181,181,181,
1357 181,181,181,182,182,182,182,182,182,182,
1358 182,182,182,182,182,182,182,182,182,182,
1359 182,182,182,182,182,182,182,182,182,182,
1360 182,182,182,182,182,182,182,182,182,182,
1361 182,182,182,182,182,182,182,182,182,182,
1362 182,182,182,182,182,182,182,182,182,182,
1363 182,182,182,182,182,182,182,182,182,182,
1364 182,182,182,182,182,182,182,182,182,182,
1365 182,182,182,182,182,182,182,182,182,182,
1366 182,182,182,182,182,182,182,182,182,182,
1367 182,182,182,182,182,182,182,182,182,182,
1368 182,182,182,182,182,182,182,182,182,182,
1369 182,182,182,182,182,182,182,182,182,182,
1370 182,183,183,183,183,183,183,183,183,183,
1371 183,183,183,183,183,183,183,183,183,183,
1372 183,183,183,183,183,183,183,183,183,183,
1373 183,183,183,183,183,183,183,183,183,183,
1374 183,183,183,183,183,183,183,183,183,183,
1375 183,183,183,183,183,183,183,183,183,183,
1376 183,183,183,183,183,183,183,183,183,183,
1377 183,183,183,183,183,183,183,183,183,183,
1378 183,183,183,183,183,183,183,183,183,183,
1379 183,183,183,183,183,183,183,183,183,183,
1380 183,183,183,183,183,183,183,183,183,183,
1381 183,183,183,183,183,183,183,183,183,183,
1382 183,183,183,183,183,183,183,183,183,184,
1383 184,184,184,184,184,184,184,184,184,184,
1384 184,184,184,184,184,184,184,184,184,184,
1385 184,184,184,184,184,184,184,184,184,184,
1386 184,184,184,184,184,184,184,184,184,184,
1387 184,184,184,184,184,184,184,184,184,184,
1388 184,184,184,184,184,184,184,184,184,184,
1389 184,184,184,184,184,184,184,184,184,184,
1390 184,184,184,184,184,184,184,184,184,184,
1391 184,184,184,184,184,184,184,184,184,184,
1392 184,184,184,184,184,184,184,184,184,184,
1393 184,184,184,184,184,184,184,184,184,184,
1394 184,184,184,184,184,184,184,184,184,184,
1395 184,184,184,184,184,184,184,184,184,184,
1396 184,184,184,184,184,184,184,184,184,184,
1397 184,184,184,184,184,184,184,184,184,184,
1398 184,184,184,184,184,184,184,184,184,184,
1399 184,184,184,184,184,184,184,184,184,184,
1400 184,184,184,184,184,184,184,184,184,184,
1401 184,184,184,184,184,184,184,184,184,184,
1402 184,184,184,184,184,184,184,184,184,184,
1403 184,184,184,184,184,184,184,184,184,184,
1404 184,184,184,184,184,184,184,184,184,184,
1405 184,184,184,184,184,184,184,184,184,184,
1406 184,184,184,184,184,184,184,184,184,184,
1407 184,184,184,184,184,184,184,184,184,184,
1408 184,184,184,184,184,185,185,185,185,185,
1409 185,185,185,185,185,185,185,185,185,185,
1410 185,185,185,185,185,185,185,185,185,185,
1411 185,185,185,185,185,185,185,185,185,185,
1412 185,185,185,185,185,185,185,185,185,185,
1413 185,185,185,185,185,185,185,185,185,185,
1414 185,185,185,185,185,185,185,185,185,185,
1415 185,185,185,185,185,185,185,185,185,185,
1416 185,185,185,185,185,185,185,185,185,185,
1417 185,185,185,185,185,185,185,185,185,185,
1418 185,185,185,185,185,185,185,185,185,185,
1419 185,185,185,185,185,185,185,185,185,185,
1420 185,185,185,185,185,185,185,185,185,185,
1421 185,185,185,185,185,185,185,185,185,185,
1422 185,185,185,185,185,185,185,185,185,185,
1423 185,185,185,185,185,185,185,185,185,185,
1424 185,185,185,185,185,185,185,185,185,185,
1425 185,185,185,185,185,185,185,185,185,185,
1426 185,185,185,185,185,185,185,185,185,185,
1427 185,185,185,185,185,185,185,185,185,185,
1428 185,185,185,185,185,185,185,185,185,185,
1429 185,185,185,185,185,185,185,185,185,185,
1430 185,185,185,185,185,185,185,185,185,185,
1431 185,185,185,185,185,185,185,185,185,185,
1432 185,185,185,185,185,185,185,185,185,185,
1433 185,185,185,185,185,185,185,185,185,185,
1434 185,186,186,186,186,186,186,186,186,186,
1435 186,186,186,186,186,186,186,186,186,186,
1436 186,186,186,186,186,186,186,186,186,186,
1437 186,186,186,186,186,186,186,186,186,186,
1438 186,186,186,186,186,186,186,186,186,186,
1439 186,186,186,186,186,186,186,186,186,186,
1440 186,186,186,186,186,186,186,186,186,186,
1441 186,186,186,186,186,186,186,186,186,186,
1442 186,186,186,186,186,186,186,186,186,186,
1443 186,186,186,186,186,186,186,186,186,186,
1444 186,186,186,186,186,186,186,186,186,186,
1445 186,186,186,186,186,186,186,186,186,186,
1446 186,186,186,186,186,186,186,186,186,186,
1447 186,186,186,186,186,186,186,186,186,186,
1448 186,186,186,186,186,186,186,186,186,186,
1449 186,186,186,186,186,186,186,186,186,186,
1450 186,186,186,186,186,186,186,186,186,186,
1451 186,186,186,186,186,186,186,186,186,186,
1452 186,186,186,186,186,186,186,186,186,186,
1453 186,186,186,186,186,186,186,186,186,186,
1454 186,186,186,186,186,186,186,186,186,186,
1455 186,186,186,186,186,186,186,186,186,186,
1456 186,186,186,186,186,186,186,186,186,186,
1457 186,186,186,186,186,186,186,186,186,186,
1458 186,186,186,186,186,186,186,186,186,186,
1459 186,186,186,186,186,186,186,187,187,187,
1460 187,187,187,187,187,187,187,187,187,187,
1461 187,187,187,187,187,187,187,187,187,187,
1462 187,187,187,187,187,187,187,187,187,187,
1463 187,187,187,187,187,187,187,187,187,187,
1464 187,187,187,187,187,187,187,187,187,187,
1465 187,187,187,187,187,187,187,187,187,187,
1466 187,187,187,187,187,187,187,187,187,187,
1467 187,187,187,187,187,187,187,187,187,187,
1468 187,187,187,187,187,187,187,187,187,187,
1469 187,187,187,187,187,187,187,187,187,187,
1470 187,187,187,187,187,187,187,187,187,187,
1471 187,187,187,187,187,187,187,187,187,187,
1472 187,187,187,187,187,187,187,187,187,187,
1473 187,187,187,187,187,187,187,187,187,187,
1474 187,187,187,187,187,187,187,187,187,187,
1475 187,187,187,187,187,187,187,187,187,187,
1476 187,187,187,187,187,187,187,187,187,187,
1477 187,187,187,187,187,187,187,187,187,187,
1478 187,187,187,187,187,187,187,187,187,187,
1479 187,187,187,187,187,187,187,187,187,187,
1480 187,187,187,187,187,187,187,187,187,187,
1481 187,187,187,187,187,187,187,187,187,187,
1482 187,187,187,187,187,187,187,187,187,187,
1483 187,187,187,187,187,187,187,187,187,187,
1484 187,187,187,187,187,187,187,187,187,187,
1485 187,187,187,187,187,187,187,187,187,187,
1486 187,187,187,187,187,187,187,187,187,187,
1487 187,187,187,187,187,187,187,187,187,187,
1488 187,187,187,187,187,187,187,187,187,187,
1489 187,187,187,187,187,187,187,187,187,187,
1490 187,187,187,187,187,187,187,187,187,187,
1491 187,187,187,187,187,187,187,187,187,187,
1492 187,187,187,187,187,187,187,187,187,187,
1493 187,187,187,187,187,187,187,187,187,187,
1494 187,187,187,187,187,187,187,187,187,187,
1495 187,187,187,187,187,187,187,187,187,187,
1496 187,187,187,187,187,187,187,187,187,187,
1497 187,187,187,187,187,187,187,187,187,187,
1498 187,187,187,187,187,187,187,187,187,187,
1499 187,187,187,187,187,187,187,187,187,187,
1500 187,187,187,187,187,187,187,187,187,187,
1501 187,187,187,187,187,187,187,187,187,187,
1502 187,187,187,187,187,187,187,187,187,187,
1503 187,187,187,187,187,187,187,187,187,187,
1504 187,187,187,187,187,187,187,187,187,187,
1505 187,187,187,187,187,187,187,187,187,187,
1506 187,187,187,187,187,187,187,187,187,187,
1507 187,187,187,187,187,187,187,187,187,187,
1508 187,187,187,187,187,187,187,187,187,187,
1509 187,187,187,187,187,187,187,187,187,187,
1510 187,187,187,187,187,187,187,187,187,188,
1511 188,188,188,188,188,188,188,188,188,188,
1512 188,188,188,188,188,188,188,188,188,188,
1513 188,188,188,188,188,188,188,188,188,188,
1514 188,188,188,188,188,188,188,188,188,188,
1515 188,188,188,188,188,188,188,188,188,188,
1516 188,188,188,188,188,188,188,188,188,188,
1517 188,188,188,188,188,188,188,188,188,188,
1518 188,188,188,188,188,188,188,188,188,188,
1519 188,188,188,188,188,188,188,188,188,188,
1520 188,188,188,188,188,188,188,188,188,188,
1521 188,188,188,188,188,188,188,188,188,188,
1522 188,188,188,188,188,188,188,188,188,188,
1523 188,188,188,188,188,188,188,188,188,188,
1524 188,188,188,188,188,188,188,188,188,188,
1525 188,188,188,188,188,188,188,188,188,188,
1526 188,188,188,188,188,188,188,188,188,188,
1527 188,188,188,188,188,188,188,188,188,188,
1528 188,188,188,188,188,188,188,188,188,188,
1529 188,188,188,188,188,188,188,188,188,188,
1530 188,188,188,188,188,188,188,188,188,188,
1531 188,188,188,188,188,188,188,188,188,188,
1532 188,188,188,188,188,188,188,188,188,188,
1533 188,188,188,188,188,188,188,188,188,188,
1534 188,188,188,188,188,188,188,188,188,188,
1535 188,188,188,188,188,188,188,188,188,188,
1536 188,188,188,188,188,188,188,188,188,188,
1537 188,188,188,188,188,188,188,188,188,188,
1538 188,188,188,188,188,188,188,188,188,188,
1539 188,188,188,188,188,188,188,188,188,188,
1540 188,188,188,188,188,188,188,188,188,188,
1541 188,188,188,188,188,188,188,188,188,188,
1542 188,188,188,188,188,188,188,188,188,188,
1543 188,188,188,188,188,188,188,188,188,188,
1544 188,188,188,188,188,188,188,188,188,188,
1545 188,188,188,188,188,188,188,188,188,188,
1546 188,188,188,188,188,188,188,188,188,188,
1547 188,188,188,188,188,188,188,188,188,188,
1548 188,188,188,188,188,188,188,188,188,188,
1549 188,188,188,188,188,188,188,188,188,188,
1550 188,188,188,188,188,188,188,188,188,188,
1551 188,188,188,188,188,188,188,188,188,188,
1552 188,188,188,188,188,188,188,188,188,188,
1553 188,188,188,188,188,188,188,188,188,188,
1554 188,188,188,188,188,188,188,188,188,188,
1555 188,188,188,188,188,188,188,188,188,188,
1556 188,188,188,188,188,188,188,188,188,188,
1557 188,188,188,188,188,188,188,188,188,188,
1558 188,188,188,188,188,188,188,188,188,188,
1559 188,188,188,188,188,188,188,188,188,188,
1560 188,188,188,188,188,188,188,188,188,188,
1561 188,188,188,188,188,188,188,188,188,188,
1562 188,189,189,189,189,189,189,189,189,189,
1563 189,189,189,189,189,189,189,189,189,189,
1564 189,189,189,189,189,189,189,189,189,189,
1565 189,189,189,189,189,189,189,189,189,189,
1566 189,189,189,189,189,189,189,189,189,189,
1567 189,189,189,189,189,189,189,189,189,189,
1568 189,189,189,189,189,189,189,189,189,189,
1569 189,189,189,189,189,189,189,189,189,189,
1570 189,189,189,189,189,189,189,189,189,189,
1571 189,189,189,189,189,189,189,189,189,189,
1572 189,189,189,189,189,189,189,189,189,189,
1573 189,189,189,189,189,189,189,189,189,189,
1574 189,189,189,189,189,189,189,189,189,189,
1575 189,189,189,189,189,189,189,189,189,189,
1576 189,189,189,189,189,189,189,189,189,189,
1577 189,189,189,189,189,189,189,189,189,189,
1578 189,189,189,189,189,189,189,189,189,189,
1579 189,189,189,189,189,189,189,189,189,189,
1580 189,189,189,189,189,189,189,189,189,189,
1581 189,189,189,189,189,189,189,189,189,189,
1582 189,189,189,189,189,189,189,189,189,189,
1583 189,189,189,189,189,189,189,189,189,189,
1584 189,189,189,189,189,189,189,189,189,189,
1585 189,189,189,189,189,189,189,189,189,189,
1586 189,189,189,189,189,189,189,189,189,189,
1587 189,189,189,189,189,189,189,189,189,189,
1588 189,189,189,189,189,189,189,189,189,189,
1589 189,189,189,189,189,189,189,189,189,189,
1590 189,189,189,189,189,189,189,189,189,189,
1591 189,189,189,189,189,189,189,189,189,189,
1592 189,189,189,189,189,189,189,189,189,189,
1593 189,189,189,189,189,189,189,189,189,189,
1594 189,189,189,189,189,189,189,189,189,189,
1595 189,189,189,189,189,189,189,189,189,189,
1596 189,189,189,189,189,189,189,189,189,189,
1597 189,189,189,189,189,189,189,189,189,189,
1598 189,189,189,189,189,189,189,189,189,189,
1599 189,189,189,189,189,189,189,189,189,189,
1600 189,189,189,189,189,189,189,189,189,189,
1601 189,189,189,189,189,189,189,189,189,189,
1602 189,189,189,189,189,189,189,189,189,189,
1603 189,189,189,189,189,189,189,189,189,189,
1604 189,189,189,189,189,189,189,189,189,189,
1605 189,189,189,189,189,189,189,189,189,189,
1606 189,189,189,189,189,189,189,189,189,189,
1607 189,189,189,189,189,189,189,189,189,189,
1608 189,189,189,189,189,189,189,189,189,189,
1609 189,189,189,189,189,189,189,189,189,189,
1610 189,189,189,189,189,189,189,189,189,189,
1611 189,189,189,189,189,189,189,189,189,189,
1612 189,189,189,189,189,189,189,189,189,189,
1613 189,189,189,190,190,190,190,190,190,190,
1614 190,190,190,190,190,190,190,190,190,190,
1615 190,190,190,190,190,190,190,190,190,190,
1616 190,190,190,190,190,190,190,190,190,190,
1617 190,190,190,190,190,190,190,190,190,190,
1618 190,190,190,190,190,190,190,190,190,190,
1619 190,190,190,190,190,190,190,190,190,190,
1620 190,190,190,190,190,190,190,190,190,190,
1621 190,190,190,190,190,190,190,190,190,190,
1622 190,190,190,190,190,190,190,190,190,190,
1623 190,190,190,190,190,190,190,190,190,190,
1624 190,190,190,190,190,190,190,190,190,190,
1625 190,190,190,190,190,190,190,190,190,190,
1626 190,190,190,190,190,190,190,190,190,190,
1627 190,190,190,190,190,190,190,190,190,190,
1628 190,190,190,190,190,190,190,190,190,190,
1629 190,190,190,190,190,190,190,190,190,190,
1630 190,190,190,190,190,190,190,190,190,190,
1631 190,190,190,190,190,190,190,190,190,190,
1632 190,190,190,190,190,190,190,190,190,190,
1633 190,190,190,190,190,190,190,190,190,190,
1634 190,190,190,190,190,190,190,190,190,190,
1635 190,190,190,190,190,190,190,190,190,190,
1636 190,190,190,190,190,190,190,190,190,190,
1637 190,190,190,190,190,190,190,190,190,190,
1638 190,190,190,190,190,190,190,190,190,190,
1639 190,190,190,190,190,190,190,190,190,190,
1640 190,190,190,190,190,190,190,190,190,190,
1641 190,190,190,190,190,190,190,190,190,190,
1642 190,190,190,190,190,190,190,190,190,190,
1643 190,190,190,190,190,190,190,190,190,190,
1644 190,190,190,190,190,190,190,190,190,190,
1645 190,190,190,190,190,190,190,190,190,190,
1646 190,190,190,190,190,190,190,190,190,190,
1647 190,190,190,190,190,190,190,190,190,190,
1648 190,190,190,190,190,190,190,190,190,190,
1649 190,190,190,190,190,190,190,190,190,190,
1650 190,190,190,190,190,190,190,190,190,190,
1651 190,190,190,190,190,190,190,190,190,190,
1652 190,190,190,190,190,190,190,190,190,190,
1653 190,190,190,190,190,190,190,190,190,190,
1654 190,190,190,190,190,190,190,190,190,190,
1655 190,190,190,190,190,190,190,190,190,190,
1656 190,190,190,190,190,190,190,190,190,190,
1657 190,190,190,190,190,190,190,190,190,190,
1658 190,190,190,190,190,190,190,190,190,190,
1659 190,190,190,190,190,190,190,190,190,190,
1660 190,190,190,190,190,190,190,190,190,190,
1661 190,190,190,190,190,190,190,190,190,190,
1662 190,190,190,190,190,190,190,190,190,190,
1663 190,190,190,190,190,190,190,190,190,190,
1664 190,190,190,190,190,191,191,191,191,191,
1665 191,191,191,191,191,191,191,191,191,191,
1666 191,191,191,191,191,191,191,191,191,191,
1667 191,191,191,191,191,191,191,191,191,191,
1668 191,191,191,191,191,191,191,191,191,191,
1669 191,191,191,191,191,191,191,191,191,191,
1670 191,191,191,191,191,191,191,191,191,191,
1671 191,191,191,191,191,191,191,191,191,191,
1672 191,191,191,191,191,191,191,191,191,191,
1673 191,191,191,191,191,191,191,191,191,191,
1674 191,191,191,191,191,191,191,191,191,191,
1675 191,191,191,191,191,191,191,191,191,191,
1676 191,191,191,191,191,191,191,191,191,191,
1677 191,191,191,191,191,191,191,191,191,191,
1678 191,191,191,191,191,191,191,191,191,191,
1679 191,191,191,191,191,191,191,191,191,191,
1680 191,191,191,191,191,191,191,191,191,191,
1681 191,191,191,191,191,191,191,191,191,191,
1682 191,191,191,191,191,191,191,191,191,191,
1683 191,191,191,191,191,191,191,191,191,191,
1684 191,191,191,191,191,191,191,191,191,191,
1685 191,191,191,191,191,191,191,191,191,191,
1686 191,191,191,191,191,191,191,191,191,191,
1687 191,191,191,191,191,191,191,191,191,191,
1688 191,191,191,191,191,191,191,191,191,191,
1689 191,191,191,191,191,191,191,191,191,191,
1690 191,191,191,191,191,191,191,191,191,191,
1691 191,191,191,191,191,191,191,191,191,191,
1692 191,191,191,191,191,191,191,191,191,191,
1693 191,191,191,191,191,191,191,191,191,191,
1694 191,191,191,191,191,191,191,191,191,191,
1695 191,191,191,191,191,191,191,191,191,191,
1696 191,191,191,191,191,191,191,191,191,191,
1697 191,191,191,191,191,191,191,191,191,191,
1698 191,191,191,191,191,191,191,191,191,191,
1699 191,191,191,191,191,191,191,191,191,191,
1700 191,191,191,191,191,191,191,191,191,191,
1701 191,191,191,191,191,191,191,191,191,191,
1702 191,191,191,191,191,191,191,191,191,191,
1703 191,191,191,191,191,191,191,191,191,191,
1704 191,191,191,191,191,191,191,191,191,191,
1705 191,191,191,191,191,191,191,191,191,191,
1706 191,191,191,191,191,191,191,191,191,191,
1707 191,191,191,191,191,191,191,191,191,191,
1708 191,191,191,191,191,191,191,191,191,191,
1709 191,191,191,191,191,191,191,191,191,191,
1710 191,191,191,191,191,191,191,191,191,191,
1711 191,191,191,191,191,191,191,191,191,191,
1712 191,191,191,191,191,191,191,191,191,191,
1713 191,191,191,191,191,191,191,191,191,191,
1714 191,191,191,191,191,191,191,191,191,191,
1715 191,191,191,191,191,191,191,191,191,191,
1716 191,191,191,191,191,191,191,191,191,191,
1717 191,191,191,191,191,191,191,191,191,191,
1718 191,191,191,191,191,191,191,191,191,191,
1719 191,191,191,191,191,191,191,191,191,191,
1720 191,191,191,191,191,191,191,191,191,191,
1721 191,191,191,191,191,191,191,191,191,191,
1722 191,191,191,191,191,191,191,191,191,191,
1723 191,191,191,191,191,191,191,191,191,191,
1724 191,191,191,191,191,191,191,191,191,191,
1725 191,191,191,191,191,191,191,191,191,191,
1726 191,191,191,191,191,191,191,191,191,191,
1727 191,191,191,191,191,191,191,191,191,191,
1728 191,191,191,191,191,191,191,191,191,191,
1729 191,191,191,191,191,191,191,191,191,191,
1730 191,191,191,191,191,191,191,191,191,191,
1731 191,191,191,191,191,191,191,191,191,191,
1732 191,191,191,191,191,191,191,191,191,191,
1733 191,191,191,191,191,191,191,191,191,191,
1734 191,191,191,191,191,191,191,191,191,191,
1735 191,191,191,191,191,191,191,191,191,191,
1736 191,191,191,191,191,191,191,191,191,191,
1737 191,191,191,191,191,191,191,191,191,191,
1738 191,191,191,191,191,191,191,191,191,191,
1739 191,191,191,191,191,191,191,191,191,191,
1740 191,191,191,191,191,191,191,191,191,191,
1741 191,191,191,191,191,191,191,191,191,191,
1742 191,191,191,191,191,191,191,191,191,191,
1743 191,191,191,191,191,191,191,191,191,191,
1744 191,191,191,191,191,191,191,191,191,191,
1745 191,191,191,191,191,191,191,191,191,191,
1746 191,191,191,191,191,191,191,191,191,191,
1747 191,191,191,191,191,191,191,191,191,191,
1748 191,191,191,191,191,191,191,191,191,191,
1749 191,191,191,191,191,191,191,191,191,191,
1750 191,191,191,191,191,191,191,191,191,191,
1751 191,191,191,191,191,191,191,191,191,191,
1752 191,191,191,191,191,191,191,191,191,191,
1753 191,191,191,191,191,191,191,191,191,191,
1754 191,191,191,191,191,191,191,191,191,191,
1755 191,191,191,191,191,191,191,191,191,191,
1756 191,191,191,191,191,191,191,191,191,191,
1757 191,191,191,191,191,191,191,191,191,191,
1758 191,191,191,191,191,191,191,191,191,191,
1759 191,191,191,191,191,191,191,191,191,191,
1760 191,191,191,191,191,191,191,191,191,191,
1761 191,191,191,191,191,191,191,191,191,191,
1762 191,191,191,191,191,191,191,191,191,191,
1763 191,191,191,191,191,191,191,191,191,191,
1764 191,191,191,191,191,191,191,191,191,191,
1765 191,191,191,191,191,191,191,191,191,191,
1766 191,191,191,191,191,191,191,191,191,192,
1767 192,192,192,192,192,192,192,192,192,192,
1768 192,192,192,192,192,192,192,192,192,192,
1769 192,192,192,192,192,192,192,192,192,192,
1770 192,192,192,192,192,192,192,192,192,192,
1771 192,192,192,192,192,192,192,192,192,192,
1772 192,192,192,192,192,192,192,192,192,192,
1773 192,192,192,192,192,192,192,192,192,192,
1774 192,192,192,192,192,192,192,192,192,192,
1775 192,192,192,192,192,192,192,192,192,192,
1776 192,192,192,192,192,192,192,192,192,192,
1777 192,192,192,192,192,192,192,192,192,192,
1778 192,192,192,192,192,192,192,192,192,192,
1779 192,192,192,192,192,192,192,192,192,192,
1780 192,192,192,192,192,192,192,192,192,192,
1781 192,192,192,192,192,192,192,192,192,192,
1782 192,192,192,192,192,192,192,192,192,192,
1783 192,192,192,192,192,192,192,192,192,192,
1784 192,192,192,192,192,192,192,192,192,192,
1785 192,192,192,192,192,192,192,192,192,192,
1786 192,192,192,192,192,192,192,192,192,192,
1787 192,192,192,192,192,192,192,192,192,192,
1788 192,192,192,192,192,192,192,192,192,192,
1789 192,192,192,192,192,192,192,192,192,192,
1790 192,192,192,192,192,192,192,192,192,192,
1791 192,192,192,192,192,192,192,192,192,192,
1792 192,192,192,192,192,192,192,192,192,192,
1793 192,192,192,192,192,192,192,192,192,192,
1794 192,192,192,192,192,192,192,192,192,192,
1795 192,192,192,192,192,192,192,192,192,192,
1796 192,192,192,192,192,192,192,192,192,192,
1797 192,192,192,192,192,192,192,192,192,192,
1798 192,192,192,192,192,192,192,192,192,192,
1799 192,192,192,192,192,192,192,192,192,192,
1800 192,192,192,192,192,192,192,192,192,192,
1801 192,192,192,192,192,192,192,192,192,192,
1802 192,192,192,192,192,192,192,192,192,192,
1803 192,192,192,192,192,192,192,192,192,192,
1804 192,192,192,192,192,192,192,192,192,192,
1805 192,192,192,192,192,192,192,192,192,192,
1806 192,192,192,192,192,192,192,192,192,192,
1807 192,192,192,192,192,192,192,192,192,192,
1808 192,192,192,192,192,192,192,192,192,192,
1809 192,192,192,192,192,192,192,192,192,192,
1810 192,192,192,192,192,192,192,192,192,192,
1811 192,192,192,192,192,192,192,192,192,192,
1812 192,192,192,192,192,192,192,192,192,192,
1813 192,192,192,192,192,192,192,192,192,192,
1814 192,192,192,192,192,192,192,192,192,192,
1815 192,192,192,192,192,192,192,192,192,192,
1816 192,192,192,192,192,192,192,192,192,192,
1817 192,192,192,192,192,192,192,192,192,192,
1818 192,192,192,192,192,192,192,192,192,192,
1819 192,192,192,192,192,192,192,192,192,192,
1820 192,192,192,192,192,192,192,192,192,192,
1821 192,192,192,192,192,192,192,192,192,192,
1822 192,192,192,192,192,192,192,192,192,192,
1823 192,192,192,192,192,192,192,192,192,192,
1824 192,192,192,192,192,192,192,192,192,192,
1825 192,192,192,192,192,192,192,192,192,192,
1826 192,192,192,192,192,192,192,192,192,192,
1827 192,192,192,192,192,192,192,192,192,192,
1828 192,192,192,192,192,192,192,192,192,192,
1829 192,192,192,192,192,192,192,192,192,192,
1830 192,192,192,192,192,192,192,192,192,192,
1831 192,192,192,192,192,192,192,192,192,192,
1832 192,192,192,192,192,192,192,192,192,192,
1833 192,192,192,192,192,192,192,192,192,192,
1834 192,192,192,192,192,192,192,192,192,192,
1835 192,192,192,192,192,192,192,192,192,192,
1836 192,192,192,192,192,192,192,192,192,192,
1837 192,192,192,192,192,192,192,192,192,192,
1838 192,192,192,192,192,192,192,192,192,192,
1839 192,192,192,192,192,192,192,192,192,192,
1840 192,192,192,192,192,192,192,192,192,192,
1841 192,192,192,192,192,192,192,192,192,192,
1842 192,192,192,192,192,192,192,192,192,192,
1843 192,192,192,192,192,192,192,192,192,192,
1844 192,192,192,192,192,192,192,192,192,192,
1845 192,192,192,192,192,192,192,192,192,192,
1846 192,192,192,192,192,192,192,192,192,192,
1847 192,192,192,192,192,192,192,192,192,192,
1848 192,192,192,192,192,192,192,192,192,192,
1849 192,192,192,192,192,192,192,192,192,192,
1850 192,192,192,192,192,192,192,192,192,192,
1851 192,192,192,192,192,192,192,192,192,192,
1852 192,192,192,192,192,192,192,192,192,192,
1853 192,192,192,192,192,192,192,192,192,192,
1854 192,192,192,192,192,192,192,192,192,192,
1855 192,192,192,192,192,192,192,192,192,192,
1856 192,192,192,192,192,192,192,192,192,192,
1857 192,192,192,192,192,192,192,192,192,192,
1858 192,192,192,192,192,192,192,192,192,192,
1859 192,192,192,192,192,192,192,192,192,192,
1860 192,192,192,192,192,192,192,192,192,192,
1861 192,192,192,192,192,192,192,192,192,192,
1862 192,192,192,192,192,192,192,192,192,192,
1863 192,192,192,192,192,192,192,192,192,192,
1864 192,192,192,192,192,192,192,192,192,192,
1865 192,192,192,192,192,192,192,192,192,192,
1866 192,192,192,192,192,192,192,192,192,192,
1867 192,192,192,192,192,192,192,192,192,192,
1868 192,192,192,192,192,192,192,192,192,192,
1869 192,192,192,193,193,193,193,193,193,193,
1870 193,193,193,193,193,193,193,193,193,193,
1871 193,193,193,193,193,193,193,193,193,193,
1872 193,193,193,193,193,193,193,193,193,193,
1873 193,193,193,193,193,193,193,193,193,193,
1874 193,193,193,193,193,193,193,193,193,193,
1875 193,193,193,193,193,193,193,193,193,193,
1876 193,193,193,193,193,193,193,193,193,193,
1877 193,193,193,193,193,193,193,193,193,193,
1878 193,193,193,193,193,193,193,193,193,193,
1879 193,193,193,193,193,193,193,193,193,193,
1880 193,193,193,193,193,193,193,193,193,193,
1881 193,193,193,193,193,193,193,193,193,193,
1882 193,193,193,193,193,193,193,193,193,193,
1883 193,193,193,193,193,193,193,193,193,193,
1884 193,193,193,193,193,193,193,193,193,193,
1885 193,193,193,193,193,193,193,193,193,193,
1886 193,193,193,193,193,193,193,193,193,193,
1887 193,193,193,193,193,193,193,193,193,193,
1888 193,193,193,193,193,193,193,193,193,193,
1889 193,193,193,193,193,193,193,193,193,193,
1890 193,193,193,193,193,193,193,193,193,193,
1891 193,193,193,193,193,193,193,193,193,193,
1892 193,193,193,193,193,193,193,193,193,193,
1893 193,193,193,193,193,193,193,193,193,193,
1894 193,193,193,193,193,193,193,193,193,193,
1895 193,193,193,193,193,193,193,193,193,193,
1896 193,193,193,193,193,193,193,193,193,193,
1897 193,193,193,193,193,193,193,193,193,193,
1898 193,193,193,193,193,193,193,193,193,193,
1899 193,193,193,193,193,193,193,193,193,193,
1900 193,193,193,193,193,193,193,193,193,193,
1901 193,193,193,193,193,193,193,193,193,193,
1902 193,193,193,193,193,193,193,193,193,193,
1903 193,193,193,193,193,193,193,193,193,193,
1904 193,193,193,193,193,193,193,193,193,193,
1905 193,193,193,193,193,193,193,193,193,193,
1906 193,193,193,193,193,193,193,193,193,193,
1907 193,193,193,193,193,193,193,193,193,193,
1908 193,193,193,193,193,193,193,193,193,193,
1909 193,193,193,193,193,193,193,193,193,193,
1910 193,193,193,193,193,193,193,193,193,193,
1911 193,193,193,193,193,193,193,193,193,193,
1912 193,193,193,193,193,193,193,193,193,193,
1913 193,193,193,193,193,193,193,193,193,193,
1914 193,193,193,193,193,193,193,193,193,193,
1915 193,193,193,193,193,193,193,193,193,193,
1916 193,193,193,193,193,193,193,193,193,193,
1917 193,193,193,193,193,193,193,193,193,193,
1918 193,193,193,193,193,193,193,193,193,193,
1919 193,193,193,193,193,193,193,193,193,193,
1920 193,193,193,193,193,193,193,193,193,193,
1921 193,193,193,193,193,193,193,193,193,193,
1922 193,193,193,193,193,193,193,193,193,193,
1923 193,193,193,193,193,193,193,193,193,193,
1924 193,193,193,193,193,193,193,193,193,193,
1925 193,193,193,193,193,193,193,193,193,193,
1926 193,193,193,193,193,193,193,193,193,193,
1927 193,193,193,193,193,193,193,193,193,193,
1928 193,193,193,193,193,193,193,193,193,193,
1929 193,193,193,193,193,193,193,193,193,193,
1930 193,193,193,193,193,193,193,193,193,193,
1931 193,193,193,193,193,193,193,193,193,193,
1932 193,193,193,193,193,193,193,193,193,193,
1933 193,193,193,193,193,193,193,193,193,193,
1934 193,193,193,193,193,193,193,193,193,193,
1935 193,193,193,193,193,193,193,193,193,193,
1936 193,193,193,193,193,193,193,193,193,193,
1937 193,193,193,193,193,193,193,193,193,193,
1938 193,193,193,193,193,193,193,193,193,193,
1939 193,193,193,193,193,193,193,193,193,193,
1940 193,193,193,193,193,193,193,193,193,193,
1941 193,193,193,193,193,193,193,193,193,193,
1942 193,193,193,193,193,193,193,193,193,193,
1943 193,193,193,193,193,193,193,193,193,193,
1944 193,193,193,193,193,193,193,193,193,193,
1945 193,193,193,193,193,193,193,193,193,193,
1946 193,193,193,193,193,193,193,193,193,193,
1947 193,193,193,193,193,193,193,193,193,193,
1948 193,193,193,193,193,193,193,193,193,193,
1949 193,193,193,193,193,193,193,193,193,193,
1950 193,193,193,193,193,193,193,193,193,193,
1951 193,193,193,193,193,193,193,193,193,193,
1952 193,193,193,193,193,193,193,193,193,193,
1953 193,193,193,193,193,193,193,193,193,193,
1954 193,193,193,193,193,193,193,193,193,193,
1955 193,193,193,193,193,193,193,193,193,193,
1956 193,193,193,193,193,193,193,193,193,193,
1957 193,193,193,193,193,193,193,193,193,193,
1958 193,193,193,193,193,193,193,193,193,193,
1959 193,193,193,193,193,193,193,193,193,193,
1960 193,193,193,193,193,193,193,193,193,193,
1961 193,193,193,193,193,193,193,193,193,193,
1962 193,193,193,193,193,193,193,193,193,193,
1963 193,193,193,193,193,193,193,193,193,193,
1964 193,193,193,193,193,193,193,193,193,193,
1965 193,193,193,193,193,193,193,193,193,193,
1966 193,193,193,193,193,193,193,193,193,193,
1967 193,193,193,193,193,193,193,193,193,193,
1968 193,193,193,193,193,193,193,193,193,193,
1969 193,193,193,193,193,193,193,193,193,193,
1970 193,193,193,193,193,193,193,193,193,193,
1971 193,193,193,193,193,193,193,193,193,193,
1972 193,193,193,193,193,193,193,193,193,193,
1973 193,193,193,193,193,193,193,193,193,193,
1974 193,193,193,193,193,193,193,193,193,193,
1975 193,193,193,193,193,193,193,193,193,193,
1976 193,193,193,193,193,193,193,193,193,193,
1977 193,193,193,193,193,193,193,193,193,193,
1978 193,193,193,193,193,193,193,193,193,193,
1979 193,193,193,193,193,193,193,193,193,193,
1980 193,193,193,193,193,193,193,193,193,193,
1981 193,193,193,193,193,193,193,193,193,193,
1982 193,193,193,193,193,193,193,193,193,193,
1983 193,193,193,193,193,193,193,193,193,193,
1984 193,193,193,193,193,193,193,193,193,193,
1985 193,193,193,193,193,193,193,193,193,193,
1986 193,193,193,193,193,193,193,193,193,193,
1987 193,193,193,193,193,193,193,193,193,193,
1988 193,193,193,193,193,193,193,193,193,193,
1989 193,193,193,193,193,193,193,193,193,193,
1990 193,193,193,193,193,193,193,193,193,193,
1991 193,193,193,193,193,193,193,193,193,193,
1992 193,193,193,193,193,193,193,193,193,193,
1993 193,193,193,193,193,193,193,193,193,193,
1994 193,193,193,193,193,193,193,193,193,193,
1995 193,193,193,193,193,193,193,193,193,193,
1996 193,193,193,193,193,193,193,193,193,193,
1997 193,193,193,193,193,193,193,193,193,193,
1998 193,193,193,193,193,193,193,193,193,193,
1999 193,193,193,193,193,193,193,193,193,193,
2000 193,193,193,193,193,193,193,193,193,193,
2001 193,193,193,193,193,193,193,193,193,193,
2002 193,193,193,193,193,193,193,193,193,193,
2003 193,193,193,193,193,193,193,193,193,193,
2004 193,193,193,193,193,193,193,193,193,193,
2005 193,193,193,193,193,193,193,193,193,193,
2006 193,193,193,193,193,193,193,193,193,193,
2007 193,193,193,193,193,193,193,193,193,193,
2008 193,193,193,193,193,193,193,193,193,193,
2009 193,193,193,193,193,193,193,193,193,193,
2010 193,193,193,193,193,193,193,193,193,193,
2011 193,193,193,193,193,193,193,193,193,193,
2012 193,193,193,193,193,193,193,193,193,193,
2013 193,193,193,193,193,193,193,193,193,193,
2014 193,193,193,193,193,193,193,193,193,193,
2015 193,193,193,193,193,193,193,193,193,193,
2016 193,193,193,193,193,193,193,193,193,193,
2017 193,193,193,193,193,193,193,193,193,193,
2018 193,193,193,193,193,193,193,193,193,193,
2019 193,193,193,193,193,193,193,193,193,193,
2020 193,193,193,193,193,193,193,193,193,193,
2021 193,193,193,193,193,193,193,193,193,193,
2022 193,193,193,193,193,193,193,193,193,193,
2023 193,193,193,193,193,193,193,193,193,193,
2024 193,193,193,193,193,193,193,193,193,193,
2025 193,193,193,193,193,193,193,193,193,193,
2026 193,193,193,193,193,193,193,193,193,193,
2027 193,193,193,193,193,193,193,193,193,193,
2028 193,193,193,193,193,193,193,193,193,193,
2029 193,193,193,193,193,193,193,193,193,193,
2030 193,193,193,193,193,193,193,193,193,193,
2031 193,193,193,193,193,193,193,193,193,193,
2032 193,193,193,193,193,193,193,193,193,193,
2033 193,193,193,193,193,193,193,193,193,193,
2034 193,193,193,193,193,193,193,193,193,193,
2035 193,193,193,193,193,193,193,193,193,193,
2036 193,193,193,193,193,193,193,193,193,193,
2037 193,193,193,193,193,193,193,193,193,193,
2038 193,193,193,193,193,193,193,193,193,193,
2039 193,193,193,193,193,193,193,193,193,193,
2040 193,193,193,193,193,193,193,193,193,193,
2041 193,193,193,193,193,193,193,193,193,193,
2042 193,193,193,193,193,193,193,193,193,193,
2043 193,193,193,193,193,193,193,193,193,193,
2044 193,193,193,193,193,193,193,193,193,193,
2045 193,193,193,193,193,193,193,193,193,193,
2046 193,193,193,193,193,193,193,193,193,193,
2047 193,193,193,193,193,193,193,193,193,193,
2048 193,193,193,193,193,193,193,193,193,193,
2049 193,193,193,193,193,193,193,193,193,193,
2050 193,193,193,193,193,193,193,193,193,193,
2051 193,193,193,193,193,193,193,193,193,193,
2052 193,193,193,193,193,193,193,193,193,193,
2053 193,193,193,193,193,193,193,193,193,193,
2054 193,193,193,193,193,193,193,193,193,193,
2055 193,193,193,193,193,193,193,193,193,193,
2056 193,193,193,193,193,193,193,193,193,193,
2057 193,193,193,193,193,193,193,193,193,193,
2058 193,193,193,193,193,193,193,193,193,193,
2059 193,193,193,193,193,193,193,193,193,193,
2060 193,193,193,193,193,193,193,193,193,193,
2061 193,193,193,193,193,193,193,193,193,193,
2062 193,193,193,193,193,193,193,193,193,193,
2063 193,193,193,193,193,193,193,193,193,193,
2064 193,193,193,193,193,193,193,193,193,193,
2065 193,193,193,193,193,193,193,193,193,193,
2066 193,193,193,193,193,193,193,193,193,193,
2067 193,193,193,193,193,193,193,193,193,193,
2068 193,193,193,193,193,193,193,193,193,193,
2069 193,193,193,193,193,193,193,193,193,193,
2070 193,193,193,193,193,193,193,193,193,193,
2071 193,193,193,193,193,193,193,193,193,193,
2072 193,193,193,193,193,193,193,193,193,193,
2073 193,193,193,193,193,193,193,193,193,193,
2074 193,194};
2075 treal c0_1[768] = {
2076 4.758132187241876e-10,-1.277407818568957e-07,7.842343643041684e-06,-3.249730423203469e-05,-6.659405609327934e-08,1.636513989427078e-07,1.51730024076664e-05,0.0002928390839064367,1.3652402880314968e-06,-4.934196472261609e-06,
2077 -0.00010655714626325138,-0.00031986944119434904,-8.036914681457448e-05,4.732112257809819e-05,0.00043423711699868344,0.0003528011907137261,0.001031708537008783,-0.0007217221450096626,-0.0017168518954382972,-0.0003887246361204182,
2078 -0.011789414681082473,0.004214428952438226,0.0038533674452996126,-0.0007775134306049452,-0.10092424815904007,-0.052191358272135085,-0.07266093345089891,-0.03173443910946691,-0.18705435381703153,-0.17290794644579432,
2079 -0.16240884029350022,-0.07539774672947357,-0.3823221169606225,-0.3966456884425172,-0.38949193426340206,-0.17949243495638517,-0.5000679827535931,-0.6252955044415826,-0.593217758944445,-0.2759304445750457,
2080 -0.7443466542453533,-0.9243638742042699,-0.9021451581799735,-0.423001208804493,-0.9513162022909202,-1.3695244285706374,-1.3594359391593827,-0.6454778178096151,-1.0673903359450871,-1.6539943362233507,
2081 -1.6608079056117337,-0.7955295374202644,-1.216663740339414,-1.973173626520795,-2.022349151630617,-0.9785620193218263,-1.3536298863545688,-2.3369898014427184,-2.4519685881432873,-1.2009504160162128,
2082 -1.4738143026995427,-2.741762649671241,-2.958197830421928,-1.4699117749153536,-1.562815057862952,-3.1824739689744574,-3.54870147150378,-1.793472544837961,-1.6084985603056616,-3.6497989804878825,
2083 -4.229714454817882,-2.1803590302130664,-1.5923057425051776,-4.130784625227007,-5.00525116016424,-2.639814348749391,-1.5353024599628842,-4.606928168703397,-5.876190582689012,-3.1813346835435867,
2084 -1.4872167535380243,-4.836477159855271,-6.346830564655231,-3.485824828023705,-1.4124784494678153,-5.05883667161364,-6.83999274092102,-3.8143349116087966,-1.324190681413058,-5.270021771328088,
2085 -7.354761892745586,-4.167966237668229,-1.2201526402987273,-5.4680066263894345,-7.889923237157122,-4.547766221100498,-1.1028492821842337,-5.650436352737062,-8.444043665236556,-4.9547164302671085,
2086 -0.9740272918787632,-5.81532760167317,-9.01547385942861,-5.389721468813564,-0.8360551749729735,-5.960958178081245,-9.602379825462982,-5.853599031711619,-0.69144153101802,-6.085960011249016,
2087 -10.202773556549424,-6.347071426983463,-0.5428328314153126,-6.189340100856591,-10.814549374952538,-6.870758796956554,-0.3928779618852645,-6.270501130728513,-11.435522344819686,-7.425174202459737,
2088 -0.24413338870808318,-6.329241829807929,-12.063467730346302,-8.010720655868898,-0.09897088159728572,-6.365743154169634,-12.69615978327045,-8.627690109823265,0.04049532423209753,-6.380540672324211,
2089 -13.331408465448215,-9.27626433328757,0.17246210672753484,-6.374486060242061,-13.967092876159606,-9.956517540185265,0.29546987712551875,-6.348700585624777,-14.601190442156671,-10.668420581708274,
2090 0.40841482060540657,-6.304523744918373,-15.231801229637322,-11.41184647384948,0.5105430853054584,-6.243460070179188,-15.857167045355334,-12.186577007501413,0.6014300835524821,-6.167126804762385,
2091 -16.475685278957762,-12.992310179113149,0.6809486620060904,-6.077204673763392,-17.08591768408543,-13.828668183819053,0.7492295828039622,-5.97539341346391,-17.686594489650922,-14.69520572786125,
2092 0.8066190487374586,-5.8633732093941875,-18.276614372948107,-15.591418440346017,0.8536317621973758,-5.742772484970126,-18.855040905564877,-16.516751193136336,0.8909188387291441,-5.615142708468424,
2093 -19.421096138378747,-17.47060616941952,0.919189347906291,-5.4819379973697275,-19.97415191450633,-18.452350553961754,0.9393216829518062,-5.344506453428517,-20.51371973393187,-19.461323749469692,
2094 0.9517882073269205,-5.204064846441286,-21.03943892458501,-20.496844052518632,0.9586669931621209,-5.061759321321873,-21.551066577225633,-21.558214748292713,0.9568019924633494,-4.918425322406581,
2095 -22.048458540963445,-22.64472960545432,0.9390996294140703,-4.632315011468424,-23.000437218592587,-24.89034807690646,0.9074117420140406,-4.35149819765534,-23.895906922501812,-27.228030826813868,
2096 0.8668130679370982,-4.080156940319346,-24.7363397714617,-29.65221171452345,0.8206147406307873,-3.820955811615341,-25.523890328428188,-32.15750785854976,0.7715526841311134,-3.5755692630382034,
2097 -26.261145652462595,-34.73877432966058,0.7216089208322907,-3.3448536289772783,-26.950945060997334,-37.39113799281977,0.6722170809183882,-3.1290725641996744,-27.59623950739642,-40.11001526963585,
2098 0.624359607369657,-2.928061028318213,-28.199989774501496,-42.89111792041162,0.57867743706858,-2.7413602032688615,-28.76509446149904,-45.730450211511304,0.5355531113256744,-2.568319613097924,
2099 -29.29434159769127,-48.624300136579166,0.4951858346738723,-2.408174391398717,-29.79037813685116,-51.56922674710293,0.45762467013713537,-2.2601001040887962,-30.255692617788498,-54.562045135640396,
2100 0.42288693506746533,-2.1232576458819254,-30.692607764522457,-57.59981020252892,0.39070120887578375,-1.996802733123713,-31.103278507757565,-60.67980001382201,0.361604477451065,-1.8799722444375744,
2101 -31.489699558648727,-63.799499310830555,0.3329489110164922,-1.7718424847850052,-31.85369749339958,-66.95658354589249,0.31387788500953867,-1.67228153360826,-32.196993668774795,-70.14890368197416,
2102 0.2769571725739628,-1.5784233477097496,-32.52101061679124,-73.37447189440188,0.2370414298576837,-1.4127876082655146,-33.11731392958875,-79.91812832962906,0.2053914303716691,-1.2710236952803367,
2103 -33.65233656583274,-86.57439258604857,0.17827157083626777,-1.148188236176871,-34.134610838800846,-93.33193145856792,0.1555294279964258,-1.0415719561833863,-34.57114349268408,-100.18094581409619,
2104 0.13624319417159467,-0.9485567380826627,-34.967879246447495,-107.11292686455853,0.11986609364233064,-0.8670757567412967,-35.32982886732716,-114.12045416837498,0.10588933926891464,-0.795389189210945,
2105 -35.66124426038084,-121.19702838329417,0.09392616261924326,-0.732061495452141,-35.96574431631303,-128.3369326803239,0.08360125461384792,-0.6758884443843154,-36.246421682682126,-135.5351176770351,
2106 0.07481172149803667,-0.6258902605577801,-36.50593362139564,-142.78710563173624,0.06671196217014098,-0.5811487046909998,-36.74655902169238,-150.08891041047778,0.06144571340761554,-0.5412512538283535,
2107 -36.97031148295289,-157.43697038737002,0.05205463381114172,-0.5045033116055148,-37.178784546511196,-164.82809197337897,0.0425475829025917,-0.4422401993511847,-37.55625460814311,-179.72830677001144,
2108 0.035583294235618006,-0.39134857383277627,-37.88860946661102,-194.76972517071823,0.029938266180490333,-0.3487870095461223,-38.183704200338525,-209.93600608474796,0.025448839154870645,-0.3129775245604282,
2109 -38.447552113299224,-225.2135343358435,0.02180602146999261,-0.28253789194691503,-38.68498626348911,-240.59085180326693,0.01882159126876444,-0.25645547308806066,-38.89988486734999,-256.05822718268286,
2110 0.016389229604109032,-0.23394276357167235,-39.095408417787716,-271.6073263844652,0.014251730784279671,-0.21433942823163535,-39.27414014883227,-287.2309569721039,0.01288740242120183,-0.19729277842021803,
2111 -39.438259398255525,-302.92286778557286,0.010593037750441023,-0.1818780165657937,-39.58943616545382,-318.6775901946797,0.008378973144853608,-0.1565371218065303,-39.85929084448825,-350.35677050913574,
2112 0.006851161526608891,-0.13649276043855635,-40.09295499202336,-382.23614429322754,0.005664009912174691,-0.12010326317491435,-40.29756651716601,-414.28987284372425,0.0047596828494130715,-0.10655369576268947,
2113 -40.47830441559222,-446.4969406374878,0.004052674412552565,-0.09516747917251202,-40.639158339498834,-478.8399730620576,0.0034945094504017136,-0.0854725835059901,-40.78320203201602,-511.30439002885726,
2114 0.003053968967146449,-0.07711294217324828,-40.91284890614476,-543.8777869089324,0.002684662635651774,-0.06980717134360194,-41.030004067310074,-576.5494729676333,0.0023932127670595366,-0.06338486313353768,
2115 -41.13621235895637,-609.3101212165715,0.0015596372184436913,-0.051934672112731325,-41.32012562193839,-675.0662553138166,0.0028810043990807857,-0.04447267612134229,-41.4738774554964,-741.0899553833864,
2116 -0.0031306627025035646,-0.030688673647634238,-41.59374586336524,-807.3345221460247,0.008388011487938994,-0.045667152142642144,-41.715519238871714,-873.7595832397402,-0.19930101332082575,0.034596780211041595,
2117 -41.750829617464845,-1007.0090210893836,2.433625142411732,-0.44217542838109075,-42.07583577945931,-1040.380489140858,48.971722589839835,2.4687100074225015,-41.26784911401392,-1057.0723247039582,
2118 -43.20498994073569,17.11261218125022,-39.31606312133157,-1061.1127104170844,-0.7968980419427997,4.193122878976662,-37.192394716630716,-1064.9043421337747,-2.14365943913158,3.716533682126714,
2119 -35.61559037889096,-1072.1583871741286,-0.6441709722819802,2.4345065260242746,-34.389369391051865,-1079.127703293355,-0.5868080515311245,2.049256581670718,-33.49552310796814,-1085.8916396158936,
2120 -0.3875586308209203,1.6983128432440453,-32.74843836673607,-1092.4922418829885,-0.25912851530469183,1.4665313017247528,-32.11752096374823,-1098.9562798141626,-0.16048282422165924,1.1565848732233068,
2121 -31.0716750585307,-1111.5449485499355,-0.11489892294922227,0.9646296260563116,-30.22593916648484,-1123.7596531036963,-0.0846634234717707,0.8271977777516207,-29.511531100602596,-1135.6647846865267,
2122 -0.06545837616447249,0.7259309384038725,-28.8922930647199,-1147.3050096666695,-0.05191907988992061,0.6476354645004063,-28.344647172501556,-1158.7132228313324,-0.04212521232173599,0.5855344897619047,
2123 -27.852977852088003,-1169.914675687671,-0.034826883286433616,0.5351480662776548,-27.4061576641465,-1180.9293493299783,-0.028909545824213956,0.4934912533337983,-26.996035447435045,-1191.7734212375267,
2124 -0.02526236103962193,0.4589122319270726,-26.61630873357926,-1202.4602228522433,-0.019520877469643566,0.428695647810353,-26.262416261973208,-1213.0008917346343,-0.014146475223449013,0.3819973811543961,
2125 -25.615963777078623,-1233.6800405563704,-0.010428608822282597,0.34815587616806454,-25.033734288621403,-1253.870671945005,-0.007361956267790338,0.3232083318585971,-24.498383613283366,-1273.6166626304837,
2126 -0.004745205058638106,0.305596900331639,-23.996969773098773,-1292.9500690089515,-0.002320590723947715,0.29424531782669927,-23.51865124978753,-1311.893515947133,6.998293164097783e-05,0.28869395034361506,
2127 -23.053811261052765,-1330.4615368615189,0.002564141393466003,0.2888613650312088,-22.59326447521829,-1348.661208778152,0.0052742266236749874,0.2949953597105903,-22.12769289997762,-1366.4922662715633,
2128 0.008288885683037095,0.30761247908236716,-21.647169050769094,-1383.946799155879,0.011655771958827514,0.327441331269424,-21.14077254916363,-1401.0086076005714,0.015347815312938098,0.3553245218616905,
2129 -20.596330119553233,-1417.65229633277,0.019208550271511072,0.39203989867733363,-20.00037632506185,-1433.8422409694233,0.02288213382428557,0.4379910094328972,-19.338503675469234,-1449.5316644236761,
2130 0.02575399262336515,0.49273014647453195,-18.596339894008523,-1464.6622247985301,0.02699035030290703,0.5543394064502524,-17.76139905923897,-1479.164715930211,0.02674548419601983,0.5866228572721445,
2131 -17.306493278504565,-1486.1564189985259,0.02610752961738128,0.6186134210869795,-16.82596121569326,-1492.9616330814902,0.02458558314876305,0.6498409205089875,-16.320223882446932,-1499.5702123602714,
2132 0.022238045617284232,0.6792480032479301,-15.790311322013478,-1505.9722847297862,0.019039954330748825,0.7058471708764904,-15.238068867016892,-1512.1585531470448,0.015065685132781413,0.72862106682039,
2133 -14.666141193020682,-1518.120614869245,0.010444388317418436,0.7466412962588302,-14.077948753706217,-1523.8512786050258,0.005364981759812201,0.7591339424388913,-13.477590720535563,-1529.344856206654,
2134 5.626542738983064e-05,0.765551055327737,-12.869693298038676,-1534.5974049326608,-0.00523541868359845,0.7656183550158747,-12.259210516797047,-1539.6068991294126,-0.010272151508455337,0.7593562139281482,
2135 -11.651197641224528,-1544.3733163208788,-0.014847987524013714,0.747069582063925,-11.05058022850793,-1548.8986312654881,-0.018805983820875314,0.7293097430971838,-10.461942452372023,-1553.1867210301098,
2136 -0.02204823059374292,0.7068157018185445,-9.889354043864518,-1557.2431928266783,-0.024531787744151757,0.6804435739989891,-9.336248753696605,-1561.0751528025348,-0.026278125446918002,0.6511008365271409,
2137 -8.805357181808215,-1564.6909373402355,-0.02730153682087663,0.6196692855825904,-8.298696538496241,-1568.0998286265044,-0.027770088184381175,0.5870136211904199,-7.817587699704714,-1571.311773848647,
2138 -0.02682844206244422,0.5205814136674581,-6.934383407871695,-1577.1863978333915,-0.02467025269423413,0.4564018324296692,-6.155329901088271,-1582.3985123476052,-0.022015597233066158,0.3973851186279088,
2139 -5.474514011026212,-1587.0291187958235,-0.019242302436464593,0.3447189292223032,-4.882754875764231,-1591.153017984893,-0.016602655309313468,0.2986870758053675,-4.369698273714283,-1594.8371262269575,
2140 -0.01420543131965738,0.25896984352229346,-3.925018612809365,-1598.1400507581184,-0.012130710582860318,0.22498730248335558,-3.5391076842087386,-1601.1124235593193,-0.010244457455243031,0.19596795340923867,
2141 -3.2034349184656947,-1603.7976243131725,-0.009023080299305116,0.17146093999580522,-2.910444461316857,-1606.2326529675643,-0.006977522343578057,0.14987573151681596,-2.6542082752818588,-1608.4490126154064,
2142 -0.005051171062352146,0.11649217081315302,-2.229400891462962,-1612.3290864112505,-0.0037917873941223728,0.09232512877711892,-1.8963760413998256,-1615.608766235762,-0.002865646205514306,0.0741835366167481,
2143 -1.6308256131747267,-1618.413692025501,-0.0022096286505687637,0.060473014550837936,-1.416073397479023,-1620.8374993681507,-0.001707876074498925,0.04990117134395709,-1.2400470491804012,-1622.9510275607652,
2144 -0.0014083409577640446,0.041729934936546156,-1.0939124353813559,-1624.8086799025677,-0.0009903018095198516,0.03499180734054603,-0.9715554909684919,-1626.4528426366505,-0.0006461640125836153,0.02551572143349606,
2145 -0.7785589266301509,-1629.2278825654937,-0.00045485040217716123,0.019332651146817235,-0.6355092599268627,-1631.472574814074,-0.0003218345015424164,0.01498023914024238,-0.5260638723511945,-1633.3176884022605,
2146 -0.00024912556479836443,0.0119006412286247,-0.440323838628202,-1634.853675668811,-0.00016019485748280127,0.009516786901612763,-0.372010190230245,-1636.1451556128413,-9.450151686048652e-05,0.006451013989189905,
2147 -0.2701474708495888,-1638.1726066976096,-6.24634070532337e-05,0.004642465355817846,-0.19937930551465466,-1639.6579564272442,-4.1724745556267604e-05,0.003447054814115491,-0.1477741703661629,-1640.7571393392832,
2148 -3.099778109578605e-05,0.0026485360806544323,-0.10888882422367227,-1641.570383108307,-1.8922451071226797e-05,0.0020553075643215844,-0.07888179266714404,-1642.1652781348098,-1.0407470208263524e-05,0.0013310403956699026,
2149 -0.03567701896877518,-1642.876428999755,-7.0151441709385675e-06,0.0009326887787365337,-0.006795194699637968,-1643.1365629417298,-3.6965334785274006e-06,0.0006641802970792673,0.013578484515157922,-1643.0860059641059,
2150 -1.7553825060999973e-06,0.0003812066139933353,0.040253655202721984,-1642.3684795110685,-1.0198267500457514e-06,0.00024683016214699296,0.05627928937143526,-1641.1222799119394,-6.51456320227278e-07,0.00016876130838269098,
2151 0.06688394999541464,-1639.5424277680972,-3.360576856798921e-07,0.00011889161414749654,0.07422399866638607,-1637.7366879361261,-1.653971536144579e-07,6.744044693985803e-05,0.08373328079231387,-1633.6837531836497,
2152 -7.256835212030929e-08,4.2117780716443815e-05,0.08932448227380227,-1629.2568407564909,-2.479725332251944e-08,1.989703363624556e-05,0.09565421814668884,-1619.778043861927};
2153 maptype *map_1[2] = {a0_1};
2154 treal *t_1[2] = {t0_1};
2155 treal *c_1[1] = {c0_1};
2156 splinecoeffs<maptype> sc[2] = {
2157 {x0_0, xe_0, hi_0, k_0, n_0, nmap_0, map_0, t_0, c_0, splinedata<unsigned char>::splev_pp<4>},
2158 {x0_1, xe_1, hi_1, k_1, n_1, nmap_1, map_1, t_1, c_1, splinedata<unsigned char>::splev_pp<4>},
2159 };
2160 splinedata<maptype> sd = {
2161 sc,
2162 2, /* number of calculated values */
2163 2, /* number of input values */
2164 2, /* number of output values */
2165 0, /* number of state values */
2166 "nonlin_1",
2167 };
2168 }; /* ! namespace nonlin_1 */
2169 } // namespace AmpData
2170
2171 // nonlin_1: 18904 bytes
2172 // data size sum: 18920 bytes
2173 #ifndef NO_INTPP_INCLUDES
2174 #include "intpp.h"
2175 #endif
2176 namespace AmpData {
2177 namespace nonlin_2 {
2178 typedef unsigned char maptype;
2179 real x0_0[1] = {-4.75089365365};
2180 real xe_0[1] = {11.2145908347};
2181 real hi_0[1] = {28.1858029632};
2182 int k_0[1] = {4};
2183 int nmap_0[1] = {451};
2184 int n_0[1] = {61};
2185 treal t0_0[65] = {
2186 -22.880588261487706,-22.880588261487706,-22.880588261487706,-22.880588261487706,-4.7154147992349715,-4.431583963887272,-4.1477531285395735,-3.863922293191875,-3.7220068755180256,-3.580091457844176,
2187 -3.438176040170326,-3.2962606224964768,-3.1543452048226275,-3.012429787148778,-2.870514369474929,-2.728598951801079,-2.5866835341272294,-2.44476811645338,-2.302852698779531,-2.160937281105681,
2188 -2.0190218634318313,-1.877106445757982,-1.7351910280841325,-1.593275610410283,-1.4513601927364337,-1.3094447750625842,-1.0256139397148851,-0.7417831043671862,-0.4579522690194872,-0.17412143367178823,
2189 -0.13864257925332585,-0.10316372483486348,-0.032206015997938736,0.10970940167591076,0.2516248193497602,0.39354023702360974,0.6773710723713087,0.9612019077190077,1.2450327430667065,1.5288635784144056,
2190 1.8126944137621046,2.0965252491098036,2.3803560844575027,2.6641869198052017,2.9480177551529003,3.2318485905005994,3.5156794258482984,3.799510261195997,4.0833410965436965,4.367171931891395,
2191 4.651002767239094,4.934833602586793,5.218664437934493,5.502495273282191,6.070156943977589,6.637818614672987,7.2054802853683855,7.7731419560637836,8.90846529745458,10.043788638845376,
2192 11.179111980236172,13.449758663017763,13.449758663017763,13.449758663017763,13.449758663017763};
2193 maptype a0_0[450] = {
2194 3,4,4,4,4,4,4,4,4,5,
2195 5,5,5,5,5,5,5,6,6,6,
2196 6,6,6,6,6,7,7,7,7,8,
2197 8,8,8,9,9,9,9,10,10,10,
2198 10,11,11,11,11,12,12,12,12,13,
2199 13,13,13,14,14,14,14,15,15,15,
2200 15,16,16,16,16,17,17,17,17,18,
2201 18,18,18,19,19,19,19,20,20,20,
2202 20,21,21,21,21,22,22,22,22,23,
2203 23,23,23,24,24,24,24,25,25,25,
2204 25,25,25,25,25,26,26,26,26,26,
2205 26,26,26,27,27,27,27,27,27,27,
2206 27,28,28,28,28,28,28,28,28,29,
2207 30,31,31,32,32,32,32,33,33,33,
2208 33,34,34,34,34,35,35,35,35,35,
2209 35,35,35,36,36,36,36,36,36,36,
2210 36,37,37,37,37,37,37,37,37,38,
2211 38,38,38,38,38,38,38,39,39,39,
2212 39,39,39,39,39,40,40,40,40,40,
2213 40,40,40,41,41,41,41,41,41,41,
2214 41,42,42,42,42,42,42,42,42,43,
2215 43,43,43,43,43,43,43,44,44,44,
2216 44,44,44,44,44,45,45,45,45,45,
2217 45,45,45,46,46,46,46,46,46,46,
2218 46,47,47,47,47,47,47,47,47,48,
2219 48,48,48,48,48,48,48,49,49,49,
2220 49,49,49,49,49,50,50,50,50,50,
2221 50,50,50,51,51,51,51,51,51,51,
2222 51,52,52,52,52,52,52,52,52,53,
2223 53,53,53,53,53,53,53,53,53,53,
2224 53,53,53,53,53,54,54,54,54,54,
2225 54,54,54,54,54,54,54,54,54,54,
2226 54,55,55,55,55,55,55,55,55,55,
2227 55,55,55,55,55,55,55,56,56,56,
2228 56,56,56,56,56,56,56,56,56,56,
2229 56,56,56,57,57,57,57,57,57,57,
2230 57,57,57,57,57,57,57,57,57,57,
2231 57,57,57,57,57,57,57,57,57,57,
2232 57,57,57,57,57,58,58,58,58,58,
2233 58,58,58,58,58,58,58,58,58,58,
2234 58,58,58,58,58,58,58,58,58,58,
2235 58,58,58,58,58,58,58,59,59,59,
2236 59,59,59,59,59,59,59,59,59,59,
2237 59,59,59,59,59,59,59,59,59,59,
2238 59,59,59,59,59,59,59,59,59,60,
2239 };
2240 treal c0_0[232] = {
2241 -0.000195288986670558,0.003874285259094822,-0.017419511850232897,0.0036391123722735786,-3.911625052543035,-0.006768089695319922,-0.06998597140009832,-0.20494510361710774,2.588056268956672,-3.3374875083861553,
2242 -1.019188831419784,-0.3147953728737259,-5.798723652671069,-1.1337769901516943,-2.2882715691002904,-0.8137634627107487,0.9229005861632151,-6.071346725015958,-4.333307851959838,-1.687172615767033,
2243 -6.274847934791513,-5.678425258545579,-6.000781650579467,-2.421774835240409,-2.106813393550019,-8.349918255063072,-7.991619879585479,-3.4056762837898646,-3.3440645061788614,-9.246886163182607,
2244 -10.488877728325859,-4.713999232062049,-1.8868443463090936,-10.67060909655061,-13.315477387127812,-6.398322771457918,-1.1830725989690192,-11.473926007026598,-16.45812833554519,-8.508293152161304,
2245 -0.21480164803790938,-11.977614733090123,-19.786263534774147,-11.078421443503954,0.5105725124286403,-12.069065729885116,-23.19885823634687,-14.12824022816317,1.072007089991766,-11.851691395822824,
2246 -26.59358247491643,-17.66212739109876,1.433794036344243,-11.395288394046295,-29.89268732145125,-21.671795668253864,1.6406125018892979,-10.784855955468093,-33.040391770878855,-26.13943178747002,
2247 1.7298676376958875,-10.086371330128417,-36.00234070848012,-31.04089047444895,1.7406621878272723,-9.349886665156154,-38.76064537989763,-36.34837280486629,1.7023663565404792,-8.6088062609124,
2248 -41.30926078737706,-42.03243745141675,1.6376973693433978,-7.884030163345347,-43.649848557152076,-48.06337402537929,1.5564891502040463,-7.186786644764148,-45.788629819161,-54.41206394524746,
2249 1.4834493612964401,-6.524117221196081,-47.73441846798475,-61.05046953394228,1.3631880314284788,-5.8925442140769135,-49.4965341616863,-67.95187513913834,1.3470273913985873,-5.312172017532418,
2250 -51.08665614561209,-75.0909759854829,0.8760266374453151,-4.165188288321739,-53.77662323811381,-89.9880922351998,1.8727369637506195,-3.41925817144292,-55.9293230124387,-105.56707276661317,
2251 -2.5246570414261105,-1.8246366810193646,-57.41770206888857,-121.67417360920557,1327.3238267799318,-3.9743632321226343,-59.0636370584169,-138.17580786122895,-1031.7622219061657,137.3014232173221,
2252 -54.333345707160404,-140.21704384450825,-33.59275323989736,27.484198220887777,-48.48694063389831,-142.01797810730113,-25.732235422049598,20.333203810605884,-45.0939273432094,-145.33211922671052,
2253 -5.3166326970335565,9.377800997799904,-40.87747768631475,-151.39567954363125,-4.471287869217019,7.114264548346018,-38.53699931602895,-157.02315094821859,-1.8985980494629013,5.210630491846168,
2254 -36.78790668861372,-162.3616438361954,-0.8927973101793615,3.593988480740467,-34.28888433070625,-172.4268302225494,-0.49416800307010306,2.833778261707306,-32.464485926777144,-181.8899555617798,
2255 -0.23820800727001548,2.4129979103668315,-30.97528906297494,-190.88738805305897,-0.051887750840627,2.2101655772969537,-29.663092708322345,-199.49018596899734,0.12020831289412044,2.1659835463007284,
2256 -28.421006646965516,-207.73262197222857,0.29540132328420354,2.268340023894156,-27.16240888383511,-215.6221399083563,0.47110162543185874,2.5198720369458694,-25.80336665478496,-223.14217730044857,
2257 0.609185387110233,2.9210115405858192,-24.259076123944563,-230.2521957397629,0.6298654487691794,3.439728332501145,-22.453702012336876,-236.88842379221887,0.44879420002418713,3.9760540419435735,
2258 -20.348874306241484,-242.96997034942552,0.07485206532557996,4.358198940019776,-17.983356320371776,-248.41503579771214,-0.34178558759495653,4.421934912706355,-15.491283594487912,-253.1664590637666,
2259 -0.6264525040894139,4.130907046195713,-13.063723316695883,-257.21494726485275,-0.7208488086061818,3.597487433571645,-10.870166655606972,-260.604373214559,-0.680120091453524,2.9836900750533872,
2260 -9.002225545762442,-263.41633080728263,-0.5699216517440676,2.4045729139713647,-7.472870360514456,-265.7466253164484,-0.47995754073240837,1.9192888984795866,-6.245625050358484,-267.6869755804271,
2261 -0.32092204477696457,1.510608649327067,-5.272114364207498,-269.3160331705012,-0.18618767911248998,0.9640832170238418,-3.867326644898429,-271.8807363082429,-0.11467972561685451,0.6470083900601576,
2262 -2.9527716915777917,-273.79946149622714,-0.07692796338424553,0.45171053614449724,-2.3290710703038036,-275.2881225501753,-0.0411070967008294,0.3207033674908116,-1.8906013032978302,-276.4787597315005,
2263 -0.019208247652961807,0.18069382834703096,-1.3213533635552355,-278.2719855225347,-0.011203512302054344,0.11527111262416341,-0.9853374578372892,-279.5673509539689,-0.006389022384987176,0.07711228555791973,
2264 -0.7669200953850905,-280.5538428762878};
2265 maptype *map_0[1] = {a0_0};
2266 treal *t_0[1] = {t0_0};
2267 treal *c_0[1] = {c0_0};
2268 real x0_1[2] = {-4.78637250807};
2269 real xe_1[2] = {12.3853930305};
2270 real hi_1[2] = {14.0929014816};
2271 int k_1[2] = {4};
2272 int nmap_1[2] = {243};
2273 int n_1[2] = {25};
2274 treal t0_1[29] = {
2275 -22.880588261487706,-22.880588261487706,-22.880588261487706,-22.880588261487706,-4.7154147992349715,-2.44476811645338,-0.17412143367178823,-0.10316372483486348,-0.032206015997938736,0.10970940167591076,
2276 0.39354023702360974,0.6773710723713087,0.9612019077190077,1.5288635784144056,2.0965252491098036,2.6641869198052017,3.2318485905005994,4.367171931891395,5.502495273282191,6.637818614672987,
2277 7.7731419560637836,8.90846529745458,10.043788638845376,11.179111980236172,12.314435321626966,13.449758663017763,13.449758663017763,13.449758663017763,13.449758663017763};
2278 maptype a0_1[242] = {
2279 3,4,4,4,4,4,4,4,4,4,
2280 4,4,4,4,4,4,4,4,4,4,
2281 4,4,4,4,4,4,4,4,4,4,
2282 4,4,4,5,5,5,5,5,5,5,
2283 5,5,5,5,5,5,5,5,5,5,
2284 5,5,5,5,5,5,5,5,5,5,
2285 5,5,5,5,5,6,7,8,8,9,
2286 9,9,9,10,10,10,10,11,11,11,
2287 11,12,12,12,12,12,12,12,12,13,
2288 13,13,13,13,13,13,13,14,14,14,
2289 14,14,14,14,14,15,15,15,15,15,
2290 15,15,15,16,16,16,16,16,16,16,
2291 16,16,16,16,16,16,16,16,16,17,
2292 17,17,17,17,17,17,17,17,17,17,
2293 17,17,17,17,17,18,18,18,18,18,
2294 18,18,18,18,18,18,18,18,18,18,
2295 18,19,19,19,19,19,19,19,19,19,
2296 19,19,19,19,19,19,19,20,20,20,
2297 20,20,20,20,20,20,20,20,20,20,
2298 20,20,20,21,21,21,21,21,21,21,
2299 21,21,21,21,21,21,21,21,21,22,
2300 22,22,22,22,22,22,22,22,22,22,
2301 22,22,22,22,22,23,23,23,23,23,
2302 23,23,23,23,23,23,23,23,23,23,
2303 23,24};
2304 treal c0_1[88] = {
2305 -6.36713549620182e-07,1.5160737693134769e-05,-8.260878166471392e-05,3.0323347755798663e-05,-0.00024411341807896697,-1.953729853071704e-05,-0.00016210976844749798,-0.0002841152100597304,4.079265842363113e-05,-0.0016824232674811633,
2306 -0.004026660881887453,-0.0036107963114564135,-6.657477252583585,-0.0014045461238867815,-0.011036077690245387,-0.020950656511001066,6.877363335753862,-1.418602543555714,-0.11179652730609937,-0.024119352142066425,
2307 -0.543466789153841,0.04540329187677823,-0.20923559998181623,-0.03673774827884677,0.15884805273658337,-0.18597565724712148,-0.22918498592674946,-0.06707040710458527,-0.000158610240520944,-0.05071773074238208,
2308 -0.29636586796108727,-0.14347023785330212,0.020447788838923116,-0.05085278617356736,-0.3251947126240388,-0.23167745391366554,0.0063615717881664625,-0.03344164721207264,-0.349120072067046,-0.32760689162074325,
2309 0.0035234959952906452,-0.02260798580351479,-0.3809373003865383,-0.5354015249270402,0.0020889306817305545,-0.016607524933389094,-0.4031984427286225,-0.7582856924455624,0.0015310232367928712,-0.013050107291114964,
2310 -0.42003394378605413,-0.9921354853038521,0.0008540032791263473,-0.010442797665701014,-0.43336996546332845,-1.234497859565131,0.00044321938261310733,-0.007534088096451751,-0.45377954347461635,-1.7387234999051162,
2311 0.00032202398681367554,-0.006024496165139314,-0.4691729206630146,-2.26297253804347,0.000229710864700529,-0.004927692118987451,-0.4816071956612905,-2.8029295899308724,0.0001731016159887567,-0.00414530379959073,
2312 -0.49190797970399575,-3.355724918582023,0.00013330936859535112,-0.003555724884397225,-0.5006511373216473,-3.9192893424003685,0.00010574464725677569,-0.003101677171020111,-0.5082094412681857,-4.49207836542927,
2313 8.520738916512169e-05,-0.00274151407224685,-0.514843352674877,-5.072903596231896,7.168736855737352e-05,-0.002451300258912455,-0.5207388759925508,-5.66082627992181};
2314 maptype *map_1[2] = {a0_1};
2315 treal *t_1[2] = {t0_1};
2316 treal *c_1[1] = {c0_1};
2317 splinecoeffs<maptype> sc[2] = {
2318 {x0_0, xe_0, hi_0, k_0, n_0, nmap_0, map_0, t_0, c_0, splinedata<unsigned char>::splev_pp<4>},
2319 {x0_1, xe_1, hi_1, k_1, n_1, nmap_1, map_1, t_1, c_1, splinedata<unsigned char>::splev_pp<4>},
2320 };
2321 splinedata<maptype> sd = {
2322 sc,
2323 2, /* number of calculated values */
2324 2, /* number of input values */
2325 2, /* number of output values */
2326 0, /* number of state values */
2327 "nonlin_2",
2328 };
2329 }; /* ! namespace nonlin_2 */
2330 } // namespace AmpData
2331
2332 // nonlin_2: 2416 bytes
2333 // data size sum: 2432 bytes
2334
2335
2336 static const creal __attribute__((aligned(16))) mo_data[1*16] = { -0.0102546428492310,-0.0926671566150658,0.00748481645910352,-0.0140923636667521,0.000146229606693146,0.0922823518597244,0.0130923463909865,0,0,0,-6.05681847115581e-5,0.000595161081745525,0,0,-21.3106335449389,0 };
2337 static const Map<const Matrix<creal, 1, 16>, Aligned> Mo(mo_data);
2338 static const creal __attribute__((aligned(16))) moc_data[1*1] = { 0.991243408620221 };
2339 static const Map<const Matrix<creal, 1, 1>, Aligned> Moc(moc_data);
2340 static const creal __attribute__((aligned(16))) mp_data[8*8] = { -1.60878766662268,0.201098738795714,18.3957218365136,-3.91398582031719,-0.0123843269016959,-1.04506003104504,-24.3073622142207,1.77200291622517,-8.88487051956217,1.11060977505219,166.234892997965,-35.3691437462083,-0.000977781651230822,-5.92128424260976,-174.653665466717,3.68076212702878,1.04505825382188,-0.130632444077542,-13.4269526764931,2.85680017523035,-0.0102398010071506,0.397763818919637,17.2035996438699,-1.21549433886385,-1.84036955719718,0.230046482676040,25.2801788968119,-5.37876475830232,0.0273903892012099,-0.172407562001718,-32.6789072654108,2.68046580539187,0.0674042024831012,-0.00842551253086225,-0.262319945235929,0.0558128269821166,0.00219678736800143,-0.0979397222211214,0.718340583633752,0.0276587628679819,4.46885219353691,-0.558606977146733,-165.544595019239,35.2222717021849,0.00120351074120639,-9.02952049284388,173.869107367223,-13.5602699048151,1.81354621649064,-0.226693368766333,-23.4862546943112,4.99707877518569,-0.00778901763100761,-1.57796122950664,32.8564145535054,-2.48722216637614,0,0,0,0,1.00000000000000,0,0,0 };
2341 static const Map<const Matrix<creal, 8, 8>, Aligned> Mp(mp_data);
2342 static const creal __attribute__((aligned(16))) mx_data[7*16] = { 1.05970174364689,-0.108282638352014,-0.00216390308520815,0.0114004550526571,-0.00614983937551424,0.00735634823212811,-0.0373376868458086,0.713522975253478,0.136120723019377,-0.102112632757899,0.113894820137347,-0.0489364044915694,0.206120132777242,-0.416089362653296,-0.0433301281262144,0.0664125136110350,1.00099915170040,-0.00502767212096184,0.00451528271064754,-0.0174164531743976,0.0283669734091872,0.0839522390879246,-0.105966821882551,-0.00316747488536151,1.00956830159365,-0.00857286923940689,0.0523569880167113,-0.0541206842484787,-0.00113061827397934,-0.00185742158800730,0.000224251694312446,-0.000856211240495214,1.00005450259739,-0.00387940275141992,0.000605868723121882,-0.545624721365257,0.306950247693952,0.0301073642157915,-0.0692961838570507,0.0696324581496592,0.257432975682703,0.538969989890965,-0.0830857401055198,0.0447852476649801,0.0103831526772016,-0.0271123453953327,0.00934503192093945,-0.102249000232238,1.01250767475771,0,0,0,0,0,0,0,-0.00211533957944378,0.00141132471136906,0.000931758428019313,-0.00121834618938154,-0.000342312419688939,0.000825499399629477,-0.00246640352687999,-0.00221019875914748,0.00147461751870934,0.000973541761263861,-0.00127298054725860,-0.000357662778471990,0.000862519622708971,-0.00257700485411471,0.000307278441346321,-0.000309004853953255,-2.23695668047990e-5,2.14873885323795e-5,-3.73067441519218e-5,0.000244734225363349,-0.000321720947551207,7.14531190632612e-5,-7.18548354480381e-5,-5.20173748404662e-6,4.99656752844864e-6,-8.67512148539013e-6,5.69095647660407e-5,-7.48114618591209e-5,-0.000185944022067206,-0.0328978757987105,-0.00205975139324839,0.00928258649842950,-0.000657578027217151,-0.0327275668944848,0.00532525400921149,-0.00753019147704296,0.000217644735509446,0.00119267447325060,0.00834739377311968,-0.00139172521333547,0.000380292343123624,0.00128078974223338,-1360.53531039429,169.083565190700,76.3715942748210,-236.747433234904,188.837967496056,-44.3875870949356,1237.07312474557,8676.03975995143,-3217.70398451414,-3777.02751206018,5337.82542445813,1498.14652753079,-3011.78616932036,10648.3974067810 };
2343 static const Map<const Matrix<creal, 7, 16>, Aligned> Mx(mx_data);
2344 static const creal __attribute__((aligned(16))) mxc_data[7*1] = { 0.841296047660765,-6.14125311669919,-0.333988273569845,-0.217191975968813,0.0159661555945044,-6.13970274163824,-0.147713788505921 };
2345 static const Map<const Matrix<creal, 7, 1>, Aligned> Mxc(mxc_data);
2346
2347
2348 static Matrix<creal, 0, 1> last_pot;
2349
2350 struct nonlin_param {
2351 Matrix<creal, 8, 1> *p;
2352 Matrix<creal, 8, 1> *i;
2353 Map<Matrix<creal, 8, 1> >*v;
2354 int *info;
2355 int *nfev;
2356 creal *fnorm;
2357 Array<creal, 8, 1> *p_val;
2358 inline nonlin_param(Matrix<creal, 8, 1> *p_, Matrix<creal, 8, 1> *i_, Map<Matrix<creal, 8, 1> >*v_, int *info_, int *nfev_, creal *fnorm_, Array<creal, 8, 1> *p_val_): p(p_), i(i_), v(v_), info(info_), nfev(nfev_), fnorm(fnorm_), p_val(p_val_) {}
2359 };
2360
2361
2362
2363 namespace nonlin_0 {
2364 static inline int nonlin(nonlin_param& par) {
2365 real t[AmpData::nonlin_0::sd.m];
2366 real m[2+0];
2367 Map<Matrix<real, 2+0, 1> >mp(m);
2368 mp << last_pot.cast<real>(), (*par.p).head<2>().cast<real>();
2369 for (int j = 0; j < AmpData::nonlin_0::sd.m; j++) {
2370 splinecoeffs<AmpData::nonlin_0::maptype> *pc = &AmpData::nonlin_0::sd.sc[j];
2371 check(&AmpData::nonlin_0::sd, m, (*pc->eval)(pc, m, &t[j]));
2372 }
2373 (*par.i).head<2>() = Map<Matrix<real, 2, 1> >(t).cast<creal>();
2374 return 0;
2375 }
2376
2377
2378
2379
2380 } // end nonlin_0
2381
2382 namespace nonlin_1 {
2383 static inline int nonlin(nonlin_param& par) {
2384 real t[AmpData::nonlin_1::sd.m];
2385 real m[2+0];
2386 Map<Matrix<real, 2+0, 1> >mp(m);
2387 mp << last_pot.cast<real>(), (*par.p).segment<2>(2).cast<real>();
2388 for (int j = 0; j < AmpData::nonlin_1::sd.m; j++) {
2389 splinecoeffs<AmpData::nonlin_1::maptype> *pc = &AmpData::nonlin_1::sd.sc[j];
2390 check(&AmpData::nonlin_1::sd, m, (*pc->eval)(pc, m, &t[j]));
2391 }
2392 (*par.i).segment<2>(2) = Map<Matrix<real, 2, 1> >(t).cast<creal>();
2393 return 0;
2394 }
2395
2396
2397
2398
2399 } // end nonlin_1
2400
2401 namespace nonlin_2 {
2402 static inline int nonlin(nonlin_param& par) {
2403 real t[AmpData::nonlin_2::sd.m];
2404 real m[2+0];
2405 Map<Matrix<real, 2+0, 1> >mp(m);
2406 mp << last_pot.cast<real>(), (*par.p).segment<2>(4).cast<real>();
2407 for (int j = 0; j < AmpData::nonlin_2::sd.m; j++) {
2408 splinecoeffs<AmpData::nonlin_2::maptype> *pc = &AmpData::nonlin_2::sd.sc[j];
2409 check(&AmpData::nonlin_2::sd, m, (*pc->eval)(pc, m, &t[j]));
2410 }
2411 (*par.i).segment<2>(4) = Map<Matrix<real, 2, 1> >(t).cast<creal>();
2412 return 0;
2413 }
2414
2415
2416
2417
2418 } // end nonlin_2
2419
2420 namespace nonlin {
2421 static const creal __attribute__((aligned(16))) kl_data[2*8] = { -0.0219270321823620,0.999759573727441,0.999759573727441,0.0219270321823619,1.00000000000000,0,0,0,0,1.00000000000000,0,0,551772.224409347,-13096.8526917654,-13096.8526917654,777788.180707371 };
2422 static const Map<const Matrix<creal, 2, 8>, Aligned> Kl(kl_data);
2423 static const creal __attribute__((aligned(16))) ku_data[6*2] = { 13096.8531048342,98362.8920522104,-431770.787790270,-8133.82959730492,0,0,-695224.597054545,-13096.8526917654,0,0,-7.46011600940896,51016.6019816278 };
2424 static const Map<const Matrix<creal, 6, 2>, Aligned> Ku(ku_data);
2425 static const creal __attribute__((aligned(16))) mpc_data[8*1] = { 0,0,0,0,0,0,347.381890451386,146.019756212607 };
2426 static const Map<const Matrix<creal, 8, 1>, Aligned> Mpc(mpc_data);
2427 static const creal __attribute__((aligned(16))) sam0_data[3*1] = { 0.984867796815516,0.990325823322304,0.572071777232610 };
2428 static const Map<const Array<creal, 3, 1>, Aligned> Sam0(sam0_data);
2429 static const creal __attribute__((aligned(16))) sam1_data[3*1] = { 0.529599326055711,0.294766829526201,-0.300692171196462 };
2430 static const Map<const Array<creal, 3, 1>, Aligned> Sam1(sam1_data);
2431 static const creal __attribute__((aligned(16))) sam2_data[3*1] = { 1.01047167427495,1.00954543304385,1.54972907825715 };
2432 static const Map<const Array<creal, 3, 1>, Aligned> Sam2(sam2_data);
2433 static const creal __attribute__((aligned(16))) spm0_data[3*1] = { 1.14429961087212e-7,3.70660566459397e-8,2.10374116872319e-7 };
2434 static const Map<const Array<creal, 3, 1>, Aligned> Spm0(spm0_data);
2435 static const creal __attribute__((aligned(16))) spm1_data[3*1] = { 0.000487812975465725,0.000184802678889708,-4.75770783104045e-6 };
2436 static const Map<const Array<creal, 3, 1>, Aligned> Spm1(spm1_data);
2437 static const creal __attribute__((aligned(16))) spm2_data[3*1] = { 9.83498403815797e-6,6.65101858921353e-6,1.00009613179018e-5 };
2438 static const Map<const Array<creal, 3, 1>, Aligned> Spm2(spm2_data);
2439 static const creal __attribute__((aligned(16))) ssm0_data[3*1] = { 0.00264912280520554,0.00263637203310291,0.00300240315205226 };
2440 static const Map<const Array<creal, 3, 1>, Aligned> Ssm0(ssm0_data);
2441 static const creal __attribute__((aligned(16))) ssm1_data[3*1] = { -0.138762806132000,-0.0809751016083964,0.00281682007847420 };
2442 static const Map<const Array<creal, 3, 1>, Aligned> Ssm1(ssm1_data);
2443 static const creal __attribute__((aligned(16))) ssm2_data[3*1] = { -0.00275908822697312,-0.00262552318516037,-0.00534179693076565 };
2444 static const Map<const Array<creal, 3, 1>, Aligned> Ssm2(ssm2_data);
2445
2446
2447
2448 typedef int root_fcn(void*p, const creal *v, creal *fvec, int iflag);
2449 static int fcn(void *p, const creal *v, creal *fvec, int iflag) {
2450 nonlin_param& par = *static_cast<nonlin_param *>(p);
2451 const Map<const Matrix<creal, 2, 1> > Mv(v);
2452 Array<creal, 6, 1> pt;
2453 pt = (*par.p).head<6>() + Ku * Mv;
2454 Array<creal, 3, 1> PP1;
2455 PP1 << pt(1), pt(3), pt(5);
2456 Array<creal, 3, 1> PP0;
2457 PP0 << pt(0), pt(2), pt(4);
2458 pt.head<3>() = (Spm1 * PP1 + Ssm1) * PP1 + Sam1 + ((Spm2 * PP1 + Ssm2) * PP1 + Sam2) * PP0;
2459 Array<creal, 6, 1> res;
2460 splinedata<AmpData::nonlin_0::maptype>::splev_pp<4>(&AmpData::nonlin_0::sd.sc[0], &pt(0), &res(0));
2461 splinedata<AmpData::nonlin_0::maptype>::splev_pp<4>(&AmpData::nonlin_0::sd.sc[1], &pt(0), &res(3));
2462 splinedata<AmpData::nonlin_1::maptype>::splev_pp<4>(&AmpData::nonlin_1::sd.sc[0], &pt(1), &res(1));
2463 splinedata<AmpData::nonlin_1::maptype>::splev_pp<4>(&AmpData::nonlin_1::sd.sc[1], &pt(1), &res(4));
2464 splinedata<AmpData::nonlin_2::maptype>::splev_pp<4>(&AmpData::nonlin_2::sd.sc[0], &pt(2), &res(2));
2465 splinedata<AmpData::nonlin_2::maptype>::splev_pp<4>(&AmpData::nonlin_2::sd.sc[1], &pt(2), &res(5));
2466 pt.head<3>() = ((Spm0 * PP1 + Ssm0) * PP1 + Sam0) * res.head<3>();
2467 pt.tail<3>() = ((Spm0 * PP1 + Ssm0) * PP1 + Sam0) * res.tail<3>();
2468 (*par.i).head<6>() << pt(0), pt(3), pt(1), pt(4), pt(2), pt(5);
2469 (*par.i).segment<2>(6) = Mv;
2470 Map<Matrix<creal, 2, 1>, Aligned> Mfvec(fvec);
2471 Mfvec = (*par.p).segment<2>(6) + Kl * (*par.i).head<8>();
2472
2473 return 0;
2474 }
2475
2476
2477
2478 #if 0
2479 #define real_EPSILON FLT_EPSILON
2480 #define real_MIN FLT_MIN
2481 #define real_MAX FLT_MAX
2482 #else
2483 #define real_EPSILON DBL_EPSILON
2484 #define real_MIN DBL_MIN
2485 #define real_MAX DBL_MAX
2486 #endif
2487
2488 real inline dpmpar(int i)
2489 {
2490 switch(i) {
2491 case 1:
2492 return real_EPSILON;
2493 case 2:
2494 return real_MIN;
2495 default:
2496 return real_MAX;
2497 }
2498 }
2499
2500 template<int N>
2501 real inline enorm(const real *fvec) {
2502 real s = 0;
2503 for (int i = 0; i < N; i++) {
2504 s += fvec[i] * fvec[i];
2505 }
2506 return sqrt(s);
2507 }
2508
2509 real inline enorm(int n, const real *fvec) {
2510 real s = 0;
2511 for (int i = 0; i < n; i++) {
2512 s += fvec[i] * fvec[i];
2513 }
2514 return sqrt(s);
2515 }
2516
2517 template<int N>
2518 real enorm2(const real *fvec) {
2519 real s = 0;
2520 for (int i = 0; i < N; i++) {
2521 s += fvec[i] * fvec[i];
2522 }
2523 return s;
2524 }
2525
2526 template<int N>
2527 void qform(real *q, int ldq, real *wa)
2528 {
2529 /* System generated locals */
2530 int q_dim1, q_offset;
2531
2532 /* Local variables */
2533 int i, j, k, l;
2534 real sum, temp;
2535
2536 /* Parameter adjustments */
2537 --wa;
2538 q_dim1 = ldq;
2539 q_offset = 1 + q_dim1 * 1;
2540 q -= q_offset;
2541
2542 /* Function Body */
2543
2544 /* zero out upper triangle of q in the first min(m,n) columns. */
2545
2546 if (N >= 2) {
2547 for (j = 2; j <= N; ++j) {
2548 for (i = 1; i <= j-1; ++i) {
2549 q[i + j * q_dim1] = 0.;
2550 }
2551 }
2552 }
2553
2554 /* accumulate q from its factored form. */
2555
2556 for (l = 1; l <= N; ++l) {
2557 k = N - l + 1;
2558 for (i = k; i <= N; ++i) {
2559 wa[i] = q[i + k * q_dim1];
2560 q[i + k * q_dim1] = 0.;
2561 }
2562 q[k + k * q_dim1] = 1.;
2563 if (wa[k] != 0.) {
2564 for (j = k; j <= N; ++j) {
2565 sum = 0.;
2566 for (i = k; i <= N; ++i) {
2567 sum += q[i + j * q_dim1] * wa[i];
2568 }
2569 temp = sum / wa[k];
2570 for (i = k; i <= N; ++i) {
2571 q[i + j * q_dim1] -= temp * wa[i];
2572 }
2573 }
2574 }
2575 }
2576 } /* qform_ */
2577
2578 template<int N>
2579 void r1updt(real *s, int ls, const real *u, real *v, real *w, int *sing)
2580 {
2581 /* Initialized data */
2582
2583 #define p5 .5
2584 #define p25 .25
2585
2586 /* Local variables */
2587 int i, j, l, jj, nm1;
2588 real tan;
2589 int nmj;
2590 real cos, sin, tau, temp, giant, cotan;
2591
2592 /* Parameter adjustments */
2593 --w;
2594 --u;
2595 --v;
2596 --s;
2597 (void)ls;
2598
2599 /* Function Body */
2600
2601 /* giant is the largest magnitude. */
2602
2603 giant = dpmpar(3);
2604
2605 /* initialize the diagonal element pointer. */
2606
2607 jj = N * ((N << 1) - N + 1) / 2 - (N - N);
2608
2609 /* move the nontrivial part of the last column of s into w. */
2610
2611 l = jj;
2612 for (i = N; i <= N; ++i) {
2613 w[i] = s[l];
2614 ++l;
2615 }
2616
2617 /* rotate the vector v into a multiple of the n-th unit vector */
2618 /* in such a way that a spike is introduced into w. */
2619
2620 nm1 = N - 1;
2621 if (nm1 >= 1) {
2622 for (nmj = 1; nmj <= nm1; ++nmj) {
2623 j = N - nmj;
2624 jj -= N - j + 1;
2625 w[j] = 0.;
2626 if (v[j] != 0.) {
2627
2628 /* determine a givens rotation which eliminates the */
2629 /* j-th element of v. */
2630
2631 if (fabs(v[N]) < fabs(v[j])) {
2632 cotan = v[N] / v[j];
2633 sin = p5 / sqrt(p25 + p25 * (cotan * cotan));
2634 cos = sin * cotan;
2635 tau = 1.;
2636 if (fabs(cos) * giant > 1.) {
2637 tau = 1. / cos;
2638 }
2639 } else {
2640 tan = v[j] / v[N];
2641 cos = p5 / sqrt(p25 + p25 * (tan * tan));
2642 sin = cos * tan;
2643 tau = sin;
2644 }
2645
2646 /* apply the transformation to v and store the information */
2647 /* necessary to recover the givens rotation. */
2648
2649 v[N] = sin * v[j] + cos * v[N];
2650 v[j] = tau;
2651
2652 /* apply the transformation to s and extend the spike in w. */
2653
2654 l = jj;
2655 for (i = j; i <= N; ++i) {
2656 temp = cos * s[l] - sin * w[i];
2657 w[i] = sin * s[l] + cos * w[i];
2658 s[l] = temp;
2659 ++l;
2660 }
2661 }
2662 }
2663 }
2664
2665 /* add the spike from the rank 1 update to w. */
2666
2667 for (i = 1; i <= N; ++i) {
2668 w[i] += v[N] * u[i];
2669 }
2670
2671 /* eliminate the spike. */
2672
2673 *sing = false;
2674 if (nm1 >= 1) {
2675 for (j = 1; j <= nm1; ++j) {
2676 if (w[j] != 0.) {
2677
2678 /* determine a givens rotation which eliminates the */
2679 /* j-th element of the spike. */
2680
2681 if (fabs(s[jj]) < fabs(w[j])) {
2682 cotan = s[jj] / w[j];
2683 sin = p5 / sqrt(p25 + p25 * (cotan * cotan));
2684 cos = sin * cotan;
2685 tau = 1.;
2686 if (fabs(cos) * giant > 1.) {
2687 tau = 1. / cos;
2688 }
2689 } else {
2690 tan = w[j] / s[jj];
2691 cos = p5 / sqrt(p25 + p25 * (tan * tan));
2692 sin = cos * tan;
2693 tau = sin;
2694 }
2695
2696 /* apply the transformation to s and reduce the spike in w. */
2697
2698 l = jj;
2699 for (i = j; i <= N; ++i) {
2700 temp = cos * s[l] + sin * w[i];
2701 w[i] = -sin * s[l] + cos * w[i];
2702 s[l] = temp;
2703 ++l;
2704 }
2705
2706 /* store the information necessary to recover the */
2707 /* givens rotation. */
2708
2709 w[j] = tau;
2710 }
2711
2712 /* test for zero diagonal elements in the output s. */
2713
2714 if (s[jj] == 0.) {
2715 *sing = true;
2716 }
2717 jj += N - j + 1;
2718 }
2719 }
2720
2721 /* move w back into the last column of the output s. */
2722
2723 l = jj;
2724 for (i = N; i <= N; ++i) {
2725 s[l] = w[i];
2726 ++l;
2727 }
2728 if (s[jj] == 0.) {
2729 *sing = true;
2730 }
2731
2732 /* last card of subroutine r1updt. */
2733
2734 } /* __minpack_func__(r1updt) */
2735
2736 template<int M, int N>
2737 void r1mpyq(real *a, int lda, const real *v, const real *w)
2738 {
2739 /* System generated locals */
2740 int a_dim1, a_offset;
2741
2742 /* Local variables */
2743 int i, j, nm1, nmj;
2744 real cos, sin, temp;
2745
2746 /* Parameter adjustments */
2747 --w;
2748 --v;
2749 a_dim1 = lda;
2750 a_offset = 1 + a_dim1 * 1;
2751 a -= a_offset;
2752
2753 /* Function Body */
2754
2755 /* apply the first set of givens rotations to a. */
2756
2757 nm1 = N - 1;
2758 if (nm1 < 1) {
2759 return;
2760 }
2761 for (nmj = 1; nmj <= nm1; ++nmj) {
2762 j = N - nmj;
2763 if (fabs(v[j]) > 1.) {
2764 cos = 1. / v[j];
2765 sin = sqrt(1. - cos * cos);
2766 } else {
2767 sin = v[j];
2768 cos = sqrt(1. - sin * sin);
2769 }
2770 for (i = 1; i <= M; ++i) {
2771 temp = cos * a[i + j * a_dim1] - sin * a[i + N * a_dim1];
2772 a[i + N * a_dim1] = sin * a[i + j * a_dim1] + cos * a[
2773 i + N * a_dim1];
2774 a[i + j * a_dim1] = temp;
2775 }
2776 }
2777
2778 /* apply the second set of givens rotations to a. */
2779
2780 for (j = 1; j <= nm1; ++j) {
2781 if (fabs(w[j]) > 1.) {
2782 cos = 1. / w[j];
2783 sin = sqrt(1. - cos * cos);
2784 } else {
2785 sin = w[j];
2786 cos = sqrt(1. - sin * sin);
2787 }
2788 for (i = 1; i <= M; ++i) {
2789 temp = cos * a[i + j * a_dim1] + sin * a[i + N * a_dim1];
2790 a[i + N * a_dim1] = -sin * a[i + j * a_dim1] + cos * a[i + N * a_dim1];
2791 a[i + j * a_dim1] = temp;
2792 }
2793 }
2794
2795 /* last card of subroutine r1mpyq. */
2796
2797 } /* r1mpyq_ */
2798
2799 template<int N>
2800 int fdjac1(root_fcn *fcn_nn, void *p, real *x, const real *fvec, real *fjac, int ldfjac, int ml,
2801 int mu, real epsfcn, real *wa1, real *wa2)
2802 {
2803 /* System generated locals */
2804 int fjac_dim1, fjac_offset;
2805
2806 /* Local variables */
2807 real h;
2808 int i, j, k;
2809 real eps, temp;
2810 int msum;
2811 real epsmch;
2812 int iflag = 0;
2813
2814 /* Parameter adjustments */
2815 --wa2;
2816 --wa1;
2817 --fvec;
2818 --x;
2819 fjac_dim1 = ldfjac;
2820 fjac_offset = 1 + fjac_dim1 * 1;
2821 fjac -= fjac_offset;
2822
2823 /* Function Body */
2824
2825 /* epsmch is the machine precision. */
2826
2827 epsmch = dpmpar(1);
2828
2829 eps = sqrt((std::max(epsfcn,epsmch)));
2830 msum = ml + mu + 1;
2831 if (msum >= N) {
2832
2833 /* computation of dense approximate jacobian. */
2834
2835 for (j = 1; j <= N; ++j) {
2836 temp = x[j];
2837 h = eps * fabs(temp);
2838 if (h == 0.) {
2839 h = eps;
2840 }
2841 x[j] = temp + h;
2842 /* the last parameter of fcn_nn() is set to 2 to tell calls
2843 made to compute the function from calls made to compute
2844 the Jacobian (see fcn() in tlmfdrv.c) */
2845 iflag = fcn_nn(p, &x[1], &wa1[1], 2);
2846 if (iflag < 0) {
2847 return iflag;
2848 }
2849 x[j] = temp;
2850 for (i = 1; i <= N; ++i) {
2851 fjac[i + j * fjac_dim1] = (wa1[i] - fvec[i]) / h;
2852 }
2853 }
2854 return 0;
2855 }
2856
2857 /* computation of banded approximate jacobian. */
2858
2859 for (k = 1; k <= msum; ++k) {
2860 for (j = k; msum < 0 ? j >= N : j <= N; j += msum) {
2861 wa2[j] = x[j];
2862 h = eps * fabs(wa2[j]);
2863 if (h == 0.) {
2864 h = eps;
2865 }
2866 x[j] = wa2[j] + h;
2867 }
2868 iflag = fcn_nn(p, &x[1], &wa1[1], 1);
2869 if (iflag < 0) {
2870 return iflag;
2871 }
2872 for (j = k; msum < 0 ? j >= N : j <= N; j += msum) {
2873 x[j] = wa2[j];
2874 h = eps * fabs(wa2[j]);
2875 if (h == 0.) {
2876 h = eps;
2877 }
2878 for (i = 1; i <= N; ++i) {
2879 fjac[i + j * fjac_dim1] = 0.;
2880 if (i >= j - mu && i <= j + ml) {
2881 fjac[i + j * fjac_dim1] = (wa1[i] - fvec[i]) / h;
2882 }
2883 }
2884 }
2885 }
2886 return 0;
2887
2888 } /* fdjac1_ */
2889
2890 template<int N>
2891 void qrfac(real *a, int lda, int pivot, int *ipvt, int lipvt, real *rdiag,
2892 real *acnorm, real *wa)
2893 {
2894 #ifdef USE_LAPACK
2895 int i, j, k;
2896 double t;
2897 double* tau = wa;
2898 const int ltau = N;
2899 int lwork = -1;
2900 int info = 0;
2901 double* work;
2902
2903 if (pivot) {
2904 assert( lipvt >= N );
2905 /* set all columns free */
2906 memset(ipvt, 0, sizeof(int)*N);
2907 }
2908
2909 /* query optimal size of work */
2910 lwork = -1;
2911 if (pivot) {
2912 dgeqp3_(&m,&n,a,&lda,ipvt,tau,tau,&lwork,&info);
2913 lwork = (int)tau[0];
2914 assert( lwork >= 3*n+1 );
2915 } else {
2916 dgeqrf_(&m,&n,a,&lda,tau,tau,&lwork,&info);
2917 lwork = (int)tau[0];
2918 assert( lwork >= 1 && lwork >= n );
2919 }
2920
2921 assert( info == 0 );
2922
2923 /* alloc work area */
2924 work = (double *)malloc(sizeof(double)*lwork);
2925 assert(work != NULL);
2926
2927 /* set acnorm first (from the doc of qrfac, acnorm may point to the same area as rdiag) */
2928 if (acnorm != rdiag) {
2929 for (j = 0; j < n; ++j) {
2930 acnorm[j] = enorm<N>(&a[j * lda]);
2931 }
2932 }
2933
2934 /* QR decomposition */
2935 if (pivot) {
2936 dgeqp3_(&m,&n,a,&lda,ipvt,tau,work,&lwork,&info);
2937 } else {
2938 dgeqrf_(&m,&n,a,&lda,tau,work,&lwork,&info);
2939 }
2940 assert(info == 0);
2941
2942 /* set rdiag, before the diagonal is replaced */
2943 memset(rdiag, 0, sizeof(double)*n);
2944 for(i=0 ; i<n ; ++i) {
2945 rdiag[i] = a[i*lda+i];
2946 }
2947
2948 /* modify lower trinagular part to look like qrfac's output */
2949 for(i=0 ; i<ltau ; ++i) {
2950 k = i*lda+i;
2951 t = tau[i];
2952 a[k] = t;
2953 for(j=i+1 ; j<m ; j++) {
2954 k++;
2955 a[k] *= t;
2956 }
2957 }
2958
2959 free(work);
2960 #else /* !USE_LAPACK */
2961 /* Initialized data */
2962
2963 #define p05 .05
2964
2965 /* System generated locals */
2966 real d1;
2967
2968 /* Local variables */
2969 int i, j, k, jp1;
2970 real sum;
2971 real temp;
2972 real epsmch;
2973 real ajnorm;
2974
2975 /* ********** */
2976
2977 /* subroutine qrfac */
2978
2979 /* this subroutine uses householder transformations with column */
2980 /* pivoting (optional) to compute a qr factorization of the */
2981 /* m by n matrix a. that is, qrfac determines an orthogonal */
2982 /* matrix q, a permutation matrix p, and an upper trapezoidal */
2983 /* matrix r with diagonal elements of nonincreasing magnitude, */
2984 /* such that a*p = q*r. the householder transformation for */
2985 /* column k, k = 1,2,...,min(m,n), is of the form */
2986
2987 /* t */
2988 /* i - (1/u(k))*u*u */
2989
2990 /* where u has zeros in the first k-1 positions. the form of */
2991 /* this transformation and the method of pivoting first */
2992 /* appeared in the corresponding linpack subroutine. */
2993
2994 /* the subroutine statement is */
2995
2996 /* subroutine qrfac(m,n,a,lda,pivot,ipvt,lipvt,rdiag,acnorm,wa) */
2997
2998 /* where */
2999
3000 /* m is a positive integer input variable set to the number */
3001 /* of rows of a. */
3002
3003 /* n is a positive integer input variable set to the number */
3004 /* of columns of a. */
3005
3006 /* a is an m by n array. on input a contains the matrix for */
3007 /* which the qr factorization is to be computed. on output */
3008 /* the strict upper trapezoidal part of a contains the strict */
3009 /* upper trapezoidal part of r, and the lower trapezoidal */
3010 /* part of a contains a factored form of q (the non-trivial */
3011 /* elements of the u vectors described above). */
3012
3013 /* lda is a positive integer input variable not less than m */
3014 /* which specifies the leading dimension of the array a. */
3015
3016 /* pivot is a logical input variable. if pivot is set true, */
3017 /* then column pivoting is enforced. if pivot is set false, */
3018 /* then no column pivoting is done. */
3019
3020 /* ipvt is an integer output array of length lipvt. ipvt */
3021 /* defines the permutation matrix p such that a*p = q*r. */
3022 /* column j of p is column ipvt(j) of the identity matrix. */
3023 /* if pivot is false, ipvt is not referenced. */
3024
3025 /* lipvt is a positive integer input variable. if pivot is false, */
3026 /* then lipvt may be as small as 1. if pivot is true, then */
3027 /* lipvt must be at least n. */
3028
3029 /* rdiag is an output array of length n which contains the */
3030 /* diagonal elements of r. */
3031
3032 /* acnorm is an output array of length n which contains the */
3033 /* norms of the corresponding columns of the input matrix a. */
3034 /* if this information is not needed, then acnorm can coincide */
3035 /* with rdiag. */
3036
3037 /* wa is a work array of length n. if pivot is false, then wa */
3038 /* can coincide with rdiag. */
3039
3040 /* subprograms called */
3041
3042 /* minpack-supplied ... dpmpar,enorm */
3043
3044 /* fortran-supplied ... dmax1,dsqrt,min0 */
3045
3046 /* argonne national laboratory. minpack project. march 1980. */
3047 /* burton s. garbow, kenneth e. hillstrom, jorge j. more */
3048
3049 /* ********** */
3050 (void)lipvt;
3051
3052 /* epsmch is the machine precision. */
3053
3054 epsmch = dpmpar(1);
3055
3056 /* compute the initial column norms and initialize several arrays. */
3057
3058 for (j = 0; j < N; ++j) {
3059 acnorm[j] = enorm<N>(&a[j * lda + 0]);
3060 rdiag[j] = acnorm[j];
3061 wa[j] = rdiag[j];
3062 if (pivot) {
3063 ipvt[j] = j+1;
3064 }
3065 }
3066
3067 /* reduce a to r with householder transformations. */
3068
3069 for (j = 0; j < N; ++j) {
3070 if (pivot) {
3071
3072 /* bring the column of largest norm into the pivot position. */
3073
3074 int kmax = j;
3075 for (k = j; k < N; ++k) {
3076 if (rdiag[k] > rdiag[kmax]) {
3077 kmax = k;
3078 }
3079 }
3080 if (kmax != j) {
3081 for (i = 0; i < N; ++i) {
3082 temp = a[i + j * lda];
3083 a[i + j * lda] = a[i + kmax * lda];
3084 a[i + kmax * lda] = temp;
3085 }
3086 rdiag[kmax] = rdiag[j];
3087 wa[kmax] = wa[j];
3088 k = ipvt[j];
3089 ipvt[j] = ipvt[kmax];
3090 ipvt[kmax] = k;
3091 }
3092 }
3093
3094 /* compute the householder transformation to reduce the */
3095 /* j-th column of a to a multiple of the j-th unit vector. */
3096
3097 ajnorm = enorm(N - (j+1) + 1, &a[j + j * lda]);
3098 if (ajnorm != 0.) {
3099 if (a[j + j * lda] < 0.) {
3100 ajnorm = -ajnorm;
3101 }
3102 for (i = j; i < N; ++i) {
3103 a[i + j * lda] /= ajnorm;
3104 }
3105 a[j + j * lda] += 1.;
3106
3107 /* apply the transformation to the remaining columns */
3108 /* and update the norms. */
3109
3110 jp1 = j + 1;
3111 if (N > jp1) {
3112 for (k = jp1; k < N; ++k) {
3113 sum = 0.;
3114 for (i = j; i < N; ++i) {
3115 sum += a[i + j * lda] * a[i + k * lda];
3116 }
3117 temp = sum / a[j + j * lda];
3118 for (i = j; i < N; ++i) {
3119 a[i + k * lda] -= temp * a[i + j * lda];
3120 }
3121 if (pivot && rdiag[k] != 0.) {
3122 temp = a[j + k * lda] / rdiag[k];
3123 /* Computing MAX */
3124 d1 = 1. - temp * temp;
3125 rdiag[k] *= sqrt((std::max((real)0.,d1)));
3126 /* Computing 2nd power */
3127 d1 = rdiag[k] / wa[k];
3128 if (p05 * (d1 * d1) <= epsmch) {
3129 rdiag[k] = enorm(N - (j+1), &a[jp1 + k * lda]);
3130 wa[k] = rdiag[k];
3131 }
3132 }
3133 }
3134 }
3135 }
3136 rdiag[j] = -ajnorm;
3137 }
3138
3139 /* last card of subroutine qrfac. */
3140 #endif /* !USE_LAPACK */
3141 } /* qrfac_ */
3142
3143 template<int N>
3144 void dogleg(const real *r, int lr, const real *diag, const real *qtb, real delta, real *x,
3145 real *wa1, real *wa2)
3146 {
3147 /* System generated locals */
3148 real d1, d2, d3, d4;
3149
3150 /* Local variables */
3151 int i, j, k, l, jj, jp1;
3152 real sum, temp, alpha, bnorm;
3153 real gnorm, qnorm, epsmch;
3154 real sgnorm;
3155
3156 /* Parameter adjustments */
3157 --wa2;
3158 --wa1;
3159 --x;
3160 --qtb;
3161 --diag;
3162 --r;
3163 (void)lr;
3164
3165 /* Function Body */
3166
3167 /* epsmch is the machine precision. */
3168
3169 epsmch = dpmpar(1);
3170
3171 /* first, calculate the gauss-newton direction. */
3172
3173 jj = N * (N + 1) / 2 + 1;
3174 for (k = 1; k <= N; ++k) {
3175 j = N - k + 1;
3176 jp1 = j + 1;
3177 jj -= k;
3178 l = jj + 1;
3179 sum = 0.;
3180 if (N >= jp1) {
3181 for (i = jp1; i <= N; ++i) {
3182 sum += r[l] * x[i];
3183 ++l;
3184 }
3185 }
3186 temp = r[jj];
3187 if (temp == 0.) {
3188 l = j;
3189 for (i = 1; i <= j; ++i) {
3190 /* Computing MAX */
3191 d2 = fabs(r[l]);
3192 temp = std::max(temp,d2);
3193 l = l + N - i;
3194 }
3195 temp = epsmch * temp;
3196 if (temp == 0.) {
3197 temp = epsmch;
3198 }
3199 }
3200 x[j] = (qtb[j] - sum) / temp;
3201 }
3202
3203 /* test whether the gauss-newton direction is acceptable. */
3204
3205 for (j = 1; j <= N; ++j) {
3206 wa1[j] = 0.;
3207 wa2[j] = diag[j] * x[j];
3208 }
3209 qnorm = enorm<N>(&wa2[1]);
3210 if (qnorm <= delta) {
3211 return;
3212 }
3213
3214 /* the gauss-newton direction is not acceptable. */
3215 /* next, calculate the scaled gradient direction. */
3216
3217 l = 1;
3218 for (j = 1; j <= N; ++j) {
3219 temp = qtb[j];
3220 for (i = j; i <= N; ++i) {
3221 wa1[i] += r[l] * temp;
3222 ++l;
3223 }
3224 wa1[j] /= diag[j];
3225 }
3226
3227 /* calculate the norm of the scaled gradient and test for */
3228 /* the special case in which the scaled gradient is zero. */
3229
3230 gnorm = enorm<N>(&wa1[1]);
3231 sgnorm = 0.;
3232 alpha = delta / qnorm;
3233 if (gnorm != 0.) {
3234
3235 /* calculate the point along the scaled gradient */
3236 /* at which the quadratic is minimized. */
3237
3238 for (j = 1; j <= N; ++j) {
3239 wa1[j] = wa1[j] / gnorm / diag[j];
3240 }
3241 l = 1;
3242 for (j = 1; j <= N; ++j) {
3243 sum = 0.;
3244 for (i = j; i <= N; ++i) {
3245 sum += r[l] * wa1[i];
3246 ++l;
3247 }
3248 wa2[j] = sum;
3249 }
3250 temp = enorm<N>(&wa2[1]);
3251 sgnorm = gnorm / temp / temp;
3252
3253 /* test whether the scaled gradient direction is acceptable. */
3254
3255 alpha = 0.;
3256 if (sgnorm < delta) {
3257
3258 /* the scaled gradient direction is not acceptable. */
3259 /* finally, calculate the point along the dogleg */
3260 /* at which the quadratic is minimized. */
3261
3262 bnorm = enorm<N>(&qtb[1]);
3263 temp = bnorm / gnorm * (bnorm / qnorm) * (sgnorm / delta);
3264 /* Computing 2nd power */
3265 d1 = sgnorm / delta;
3266 /* Computing 2nd power */
3267 d2 = temp - delta / qnorm;
3268 /* Computing 2nd power */
3269 d3 = delta / qnorm;
3270 /* Computing 2nd power */
3271 d4 = sgnorm / delta;
3272 temp = temp - delta / qnorm * (d1 * d1)
3273 + sqrt(d2 * d2
3274 + (1. - d3 * d3) * (1. - d4 * d4));
3275 /* Computing 2nd power */
3276 d1 = sgnorm / delta;
3277 alpha = delta / qnorm * (1. - d1 * d1) / temp;
3278 }
3279 }
3280
3281 /* form appropriate convex combination of the gauss-newton */
3282 /* direction and the scaled gradient direction. */
3283
3284 temp = (1. - alpha) * std::min(sgnorm,delta);
3285 for (j = 1; j <= N; ++j) {
3286 x[j] = temp * wa1[j] + alpha * x[j];
3287 }
3288
3289 } /* dogleg_ */
3290
3291 template<int N>
3292 int hybrdX(root_fcn *fcn_nn, void *p, real *x, real *
3293 fvec, real xtol, int maxfev, int ml, int mu,
3294 real epsfcn, real *diag, int mode, real
3295 factor, int nprint, int *nfev, real *
3296 fjac, int ldfjac, real *r, int lr, real *qtf,
3297 real *wa1, real *wa2, real *wa3, real *wa4)
3298 {
3299 /* Initialized data */
3300
3301 #define p1 .1
3302 #define p5 .5
3303 #define p001 .001
3304 #define p0001 1e-4
3305
3306 /* System generated locals */
3307 int fjac_dim1, fjac_offset, i1;
3308 real d1, d2;
3309
3310 /* Local variables */
3311 int i, j, l, jm1, iwa[1];
3312 real sum;
3313 int sing;
3314 int iter;
3315 real temp;
3316 int msum, iflag;
3317 real delta = 0.;
3318 int jeval;
3319 int ncsuc;
3320 real ratio;
3321 real fnorm;
3322 real pnorm, xnorm = 0., fnorm1;
3323 int nslow1, nslow2;
3324 int ncfail;
3325 real actred, epsmch, prered;
3326 int info;
3327
3328 /* Parameter adjustments */
3329 --wa4;
3330 --wa3;
3331 --wa2;
3332 --wa1;
3333 --qtf;
3334 --diag;
3335 --fvec;
3336 --x;
3337 fjac_dim1 = ldfjac;
3338 fjac_offset = 1 + fjac_dim1 * 1;
3339 fjac -= fjac_offset;
3340 --r;
3341
3342 /* Function Body */
3343
3344 /* epsmch is the machine precision. */
3345
3346 epsmch = dpmpar(1);
3347
3348 info = 0;
3349 iflag = 0;
3350 *nfev = 0;
3351
3352 /* check the input parameters for errors. */
3353
3354 if (N <= 0 || xtol < 0. || maxfev <= 0 || ml < 0 || mu < 0 ||
3355 factor <= 0. || ldfjac < N || lr < N * (N + 1) / 2) {
3356 goto TERMINATE;
3357 }
3358 if (mode == 2) {
3359 for (j = 1; j <= N; ++j) {
3360 if (diag[j] <= 0.) {
3361 goto TERMINATE;
3362 }
3363 }
3364 }
3365
3366 /* evaluate the function at the starting point */
3367 /* and calculate its norm. */
3368
3369 iflag = fcn_nn(p, &x[1], &fvec[1], 1);
3370 *nfev = 1;
3371 if (iflag < 0) {
3372 goto TERMINATE;
3373 }
3374 fnorm = enorm2<N>(&fvec[1]);
3375
3376 /* determine the number of calls to fcn needed to compute */
3377 /* the jacobian matrix. */
3378
3379 /* Computing MIN */
3380 i1 = ml + mu + 1;
3381 msum = std::min(i1,N);
3382
3383 /* initialize iteration counter and monitors. */
3384
3385 iter = 1;
3386 ncsuc = 0;
3387 ncfail = 0;
3388 nslow1 = 0;
3389 nslow2 = 0;
3390
3391 /* beginning of the outer loop. */
3392
3393 for (;;) {
3394 jeval = true;
3395
3396 /* calculate the jacobian matrix. */
3397
3398 iflag = fdjac1<N>(fcn_nn, p, &x[1], &fvec[1], &fjac[fjac_offset], ldfjac,
3399 ml, mu, epsfcn, &wa1[1], &wa2[1]);
3400 *nfev += msum;
3401 if (iflag < 0) {
3402 goto TERMINATE;
3403 }
3404
3405 /* compute the qr factorization of the jacobian. */
3406
3407 qrfac<N>(&fjac[fjac_offset], ldfjac, false, iwa, 1, &wa1[1], &wa2[1], &wa3[1]);
3408
3409 /* on the first iteration and if mode is 1, scale according */
3410 /* to the norms of the columns of the initial jacobian. */
3411
3412 if (iter == 1) {
3413 if (mode != 2) {
3414 for (j = 1; j <= N; ++j) {
3415 diag[j] = wa2[j];
3416 if (wa2[j] == 0.) {
3417 diag[j] = 1.;
3418 }
3419 }
3420 }
3421
3422 /* on the first iteration, calculate the norm of the scaled x */
3423 /* and initialize the step bound delta. */
3424
3425 for (j = 1; j <= N; ++j) {
3426 wa3[j] = diag[j] * x[j];
3427 }
3428 xnorm = enorm<N>(&wa3[1]);
3429 delta = factor * xnorm;
3430 if (delta == 0.) {
3431 delta = factor;
3432 }
3433 }
3434
3435 /* form (q transpose)*fvec and store in qtf. */
3436
3437 for (i = 1; i <= N; ++i) {
3438 qtf[i] = fvec[i];
3439 }
3440 for (j = 1; j <= N; ++j) {
3441 if (fjac[j + j * fjac_dim1] != 0.) {
3442 sum = 0.;
3443 for (i = j; i <= N; ++i) {
3444 sum += fjac[i + j * fjac_dim1] * qtf[i];
3445 }
3446 temp = -sum / fjac[j + j * fjac_dim1];
3447 for (i = j; i <= N; ++i) {
3448 qtf[i] += fjac[i + j * fjac_dim1] * temp;
3449 }
3450 }
3451 }
3452
3453 /* copy the triangular factor of the qr factorization into r. */
3454
3455 sing = false;
3456 for (j = 1; j <= N; ++j) {
3457 l = j;
3458 jm1 = j - 1;
3459 if (jm1 >= 1) {
3460 for (i = 1; i <= jm1; ++i) {
3461 r[l] = fjac[i + j * fjac_dim1];
3462 l = l + N - i;
3463 }
3464 }
3465 r[l] = wa1[j];
3466 if (wa1[j] == 0.) {
3467 sing = true;
3468 }
3469 }
3470
3471 /* accumulate the orthogonal factor in fjac. */
3472
3473 qform<N>(&fjac[fjac_offset], ldfjac, &wa1[1]);
3474
3475 /* rescale if necessary. */
3476
3477 if (mode != 2) {
3478 for (j = 1; j <= N; ++j) {
3479 /* Computing MAX */
3480 d1 = diag[j], d2 = wa2[j];
3481 diag[j] = std::max(d1,d2);
3482 }
3483 }
3484
3485 /* beginning of the inner loop. */
3486
3487 for (;;) {
3488
3489 /* if requested, call fcn to enable printing of iterates. */
3490
3491 if (nprint > 0) {
3492 iflag = 0;
3493 if ((iter - 1) % nprint == 0) {
3494 iflag = fcn_nn(p, &x[1], &fvec[1], 0);
3495 }
3496 if (iflag < 0) {
3497 goto TERMINATE;
3498 }
3499 }
3500
3501 /* determine the direction p. */
3502
3503 dogleg<N>(&r[1], lr, &diag[1], &qtf[1], delta, &wa1[1], &wa2[1], &wa3[1]);
3504
3505 /* store the direction p and x + p. calculate the norm of p. */
3506
3507 for (j = 1; j <= N; ++j) {
3508 wa1[j] = -wa1[j];
3509 wa2[j] = x[j] + wa1[j];
3510 wa3[j] = diag[j] * wa1[j];
3511 }
3512 pnorm = enorm<N>(&wa3[1]);
3513
3514 /* on the first iteration, adjust the initial step bound. */
3515
3516 if (iter == 1) {
3517 delta = std::min(delta,pnorm);
3518 }
3519
3520 /* evaluate the function at x + p and calculate its norm. */
3521
3522 iflag = fcn_nn(p, &wa2[1], &wa4[1], 1);
3523 ++(*nfev);
3524 if (iflag < 0) {
3525 goto TERMINATE;
3526 }
3527 fnorm1 = enorm2<N>(&wa4[1]);
3528
3529 /* compute the scaled actual reduction. */
3530
3531 actred = -1.;
3532 if (fnorm1 < fnorm) {
3533 /* already 2nd power */
3534 actred = 1. - fnorm1 / fnorm;
3535 }
3536
3537 /* compute the scaled predicted reduction. */
3538
3539 l = 1;
3540 for (i = 1; i <= N; ++i) {
3541 sum = 0.;
3542 for (j = i; j <= N; ++j) {
3543 sum += r[l] * wa1[j];
3544 ++l;
3545 }
3546 wa3[i] = qtf[i] + sum;
3547 }
3548 temp = enorm2<N>(&wa3[1]);
3549 prered = 0.;
3550 if (temp < fnorm) {
3551 /* already 2nd power */
3552 prered = 1. - temp / fnorm;
3553 }
3554
3555 /* compute the ratio of the actual to the predicted */
3556 /* reduction. */
3557
3558 ratio = 0.;
3559 if (prered > 0.) {
3560 ratio = actred / prered;
3561 }
3562
3563 /* update the step bound. */
3564
3565 if (ratio < p1) {
3566 ncsuc = 0;
3567 ++ncfail;
3568 delta = p5 * delta;
3569 } else {
3570 ncfail = 0;
3571 ++ncsuc;
3572 if (ratio >= p5 || ncsuc > 1) {
3573 /* Computing MAX */
3574 d1 = pnorm / p5;
3575 delta = std::max(delta,d1);
3576 }
3577 if (fabs(ratio - 1.) <= p1) {
3578 delta = pnorm / p5;
3579 }
3580 }
3581
3582 /* test for successful iteration. */
3583
3584 if (ratio >= p0001) {
3585
3586 /* successful iteration. update x, fvec, and their norms. */
3587
3588 for (j = 1; j <= N; ++j) {
3589 x[j] = wa2[j];
3590 wa2[j] = diag[j] * x[j];
3591 fvec[j] = wa4[j];
3592 }
3593 xnorm = enorm<N>(&wa2[1]);
3594 fnorm = fnorm1;
3595 ++iter;
3596 }
3597
3598 /* determine the progress of the iteration. */
3599
3600 ++nslow1;
3601 if (actred >= p001) {
3602 nslow1 = 0;
3603 }
3604 if (jeval) {
3605 ++nslow2;
3606 }
3607 if (actred >= p1) {
3608 nslow2 = 0;
3609 }
3610
3611 /* test for convergence. */
3612
3613 if (delta <= xtol * xnorm || fnorm == 0.) {
3614 info = 1;
3615 }
3616 if (info != 0) {
3617 goto TERMINATE;
3618 }
3619
3620 /* tests for termination and stringent tolerances. */
3621
3622 if (*nfev >= maxfev) {
3623 info = 2;
3624 }
3625 /* Computing MAX */
3626 d1 = p1 * delta;
3627 if (p1 * std::max(d1,pnorm) <= epsmch * xnorm) {
3628 info = 3;
3629 }
3630 if (nslow2 == 5) {
3631 info = 4;
3632 }
3633 if (nslow1 == 10) {
3634 info = 5;
3635 }
3636 if (info != 0) {
3637 goto TERMINATE;
3638 }
3639
3640 /* criterion for recalculating jacobian approximation */
3641 /* by forward differences. */
3642
3643 if (ncfail == 2) {
3644 goto TERMINATE_INNER_LOOP;
3645 }
3646
3647 /* calculate the rank one modification to the jacobian */
3648 /* and update qtf if necessary. */
3649
3650 for (j = 1; j <= N; ++j) {
3651 sum = 0.;
3652 for (i = 1; i <= N; ++i) {
3653 sum += fjac[i + j * fjac_dim1] * wa4[i];
3654 }
3655 wa2[j] = (sum - wa3[j]) / pnorm;
3656 wa1[j] = diag[j] * (diag[j] * wa1[j] / pnorm);
3657 if (ratio >= p0001) {
3658 qtf[j] = sum;
3659 }
3660 }
3661
3662 /* compute the qr factorization of the updated jacobian. */
3663
3664 r1updt<N>(&r[1], lr, &wa1[1], &wa2[1], &wa3[1], &sing);
3665 r1mpyq<N, N>(&fjac[fjac_offset], ldfjac, &wa2[1], &wa3[1]);
3666 r1mpyq<1, N>(&qtf[1], 1, &wa2[1], &wa3[1]);
3667
3668 /* end of the inner loop. */
3669
3670 jeval = false;
3671 }
3672 TERMINATE_INNER_LOOP:
3673 ;
3674 /* end of the outer loop. */
3675
3676 }
3677 TERMINATE:
3678
3679 /* termination, either normal or user imposed. */
3680
3681 if (iflag < 0) {
3682 info = iflag;
3683 }
3684 if (nprint > 0) {
3685 fcn_nn(p, &x[1], &fvec[1], 0);
3686 }
3687 return info;
3688
3689 /* last card of subroutine hybrd. */
3690
3691 } /* hybrd_ */
3692
3693
3694 static int nonlin(struct nonlin_param &par) {
3695 int maxfev, mode, nprint, ldfjac;
3696 creal xtol, epsfcn, factor;
3697 creal __attribute__((aligned(16))) fvec[2];
3698 creal __attribute__((aligned(16))) fjac[2*2];
3699 creal __attribute__((aligned(16))) qtf[2];
3700 creal __attribute__((aligned(16))) wa1[2];
3701 creal __attribute__((aligned(16))) wa2[2];
3702 creal __attribute__((aligned(16))) wa3[2];
3703 creal __attribute__((aligned(16))) wa4[2];
3704 creal diag[2] = {};
3705 int ml, mu, lr;
3706 creal r[(2*(2+1))/2];
3707 lr = (2*(2+1))/2;
3708 ml = 2-1; /* unbanded jacobian */
3709 mu = 2-1; /* unbanded jacobian */
3710 ldfjac = 2;
3711
3712 /* parameter */
3713 xtol = 0.1;
3714 maxfev = 12;
3715 epsfcn = 0.;
3716 //mode = 2; /* explicit variable scaling with diag */
3717 mode = 1; /* automatic variable scaling */
3718 factor = 100000.0;
3719 nprint = 0;
3720 /**/
3721
3722
3723 (*par.p_val).head<8>() = (*par.p).head<8>();
3724
3725 Matrix<creal, 8, 1> p2;
3726 Matrix<creal, 8, 1> *p_old;
3727 p2.head<8>() = (*par.p).head<8>() + Mpc;
3728 p_old = par.p;
3729 par.p = &p2;
3730
3731
3732 *par.info = hybrdX<2>(fcn, &par, &(*par.v)(6), fvec, xtol, maxfev, ml, mu, epsfcn,
3733 diag, mode, factor, nprint, par.nfev, fjac, ldfjac, r, lr,
3734 qtf, wa1, wa2, wa3, wa4);
3735 *par.fnorm = enorm<2>(fvec);
3736
3737 int ret = 0;
3738 if (*par.info != 1) {
3739 if (!(*par.info == 5 && *par.fnorm < 1e-20)) {
3740 ret = -1;
3741 }
3742 }
3743 par.p = p_old;
3744
3745 return ret;
3746 }
3747
3748
3749 } // end namespace nonlin
3750
3751
3752
3753
3754
3755
3756 #include <zita-resampler/resampler.h>
3757
3758 class FixedRateResampler {
3759 private:
3760 Resampler r_up, r_down;
3761 int inputRate, outputRate;
3762 int last_in_count;
3763 public:
3764 int setup(int _inputRate, int _outputRate);
3765 int up(int count, float *input, float *output);
3766 void down(float *input, float *output);
3767 int max_out_count(int in_count) {
3768 return static_cast<int>(ceil((in_count*static_cast<double>(outputRate))/inputRate)); }
3769 };
3770
3771 int FixedRateResampler::setup(int _inputRate, int _outputRate)
3772 {
3773 const int qual = 16; // resulting in a total delay of 2*qual (0.7ms @44100)
3774 inputRate = _inputRate;
3775 outputRate = _outputRate;
3776 if (inputRate == outputRate) {
3777 return 0;
3778 }
3779 // upsampler
3780 int ret = r_up.setup(inputRate, outputRate, 1, qual);
3781 if (ret) {
3782 return ret;
3783 }
3784 // k == filtlen() == 2 * qual
3785 // pre-fill with k-1 zeros
3786 r_up.inp_count = r_up.filtlen() - 1;
3787 r_up.out_count = 1;
3788 r_up.inp_data = r_up.out_data = 0;
3789 r_up.process();
3790 // downsampler
3791 ret = r_down.setup(outputRate, inputRate, 1, qual);
3792 if (ret) {
3793 return ret;
3794 }
3795 // k == filtlen() == 2 * qual * fact
3796 // pre-fill with k-2 zeros
3797 r_down.inp_count = r_down.filtlen() - 2;
3798 r_down.out_count = 1;
3799 r_down.inp_data = r_down.out_data = 0;
3800 r_down.process();
3801 return 0;
3802 }
3803
3804 int FixedRateResampler::up(int count, float *input, float *output)
3805 {
3806 if (inputRate == outputRate) {
3807 memcpy(output, input, count*sizeof(float));
3808 r_down.out_count = count;
3809 return count;
3810 }
3811 r_up.inp_count = count;
3812 r_down.out_count = count+1; // +1 == trick to drain input
3813 r_up.inp_data = input;
3814 int m = max_out_count(count);
3815 r_up.out_count = m;
3816 r_up.out_data = output;
3817 r_up.process();
3818 assert(r_up.inp_count == 0);
3819 assert(r_up.out_count <= 1);
3820 r_down.inp_count = m - r_up.out_count;
3821 return r_down.inp_count;
3822 }
3823
3824 void FixedRateResampler::down(float *input, float *output)
3825 {
3826 if (inputRate == outputRate) {
3827 memcpy(output, input, r_down.out_count*sizeof(float));
3828 return;
3829 }
3830 r_down.inp_data = input;
3831 r_down.out_data = output;
3832 r_down.process();
3833 assert(r_down.inp_count == 0);
3834 assert(r_down.out_count == 1);
3835 }
3836
3837 FixedRateResampler smp;
3838
3839 class DKPlugin: public PluginDef {
3840 public:
3841 float pots[0+1];
3842 private:
3843 creal pots_last[0+1];
3844 Matrix<creal, 7, 1> x_last;
3845 Array<double, 6, 1> K0;
3846 Array<double, 6, 1> K1;
3847 Array<double, 6, 1> K2;
3848 Array<double, 6, 1> K3;
3849 Array<double, 6, 1> K4;
3850 Array<double, 6, 1> K5;
3851 Array<double, 6, 1> Y;
3852 Array<double, 6, 1> X;
3853 public:
3854 EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
3855 DKPlugin();
3856 static void init(unsigned int samplingFreq, PluginDef *plugin);
3857 static void process(int count, float *input, float *output, PluginDef *plugin);
3858 static int registerparam(const ParamReg& reg);
3859 static int uiloader(const UiBuilder& builder, int form);
3860 static void del_instance(PluginDef *plugin);
3861 };
3862
3863 DKPlugin::DKPlugin():
3864 PluginDef(), pots(), pots_last(), x_last(), K0(), K1(), K2(), K3(), K4(), K5(), Y(), X() {
3865 version = PLUGINDEF_VERSION;
3866 flags = 0;
3867 id = "JCM800Pre";
3868 name = N_("JCM 800 Preamp");
3869 groups = 0;
3870 description = N_("Simulation of JCM 800 preamp circuit");
3871 category = N_("Distortion");
3872 shortname = N_("JCM800Pre");
3873 mono_audio = process;
3874 set_samplerate = init;
3875 register_params = registerparam;
3876 load_ui = uiloader;
3877 delete_instance = del_instance;
3878 for (int i = 0; i < 7; i++) {
3879 x_last(i) = x0_data[i];
3880 }
3881 }
3882
3883 #define PARAM(p) ("JCM800Pre" "." p)
3884
3885 int DKPlugin::registerparam(const ParamReg& reg) {
3886 DKPlugin& self = *static_cast<DKPlugin*>(reg.plugin);
3887
3888 reg.registerVar(PARAM("P6v"), N_("Volume"), "S", N_(""), &self.pots[0], 0.5, 0, 1, 0.01);
3889 return 0;
3890 }
3891
3892 void DKPlugin::init(unsigned int samplingFreq, PluginDef *plugin) {
3893 smp.setup(samplingFreq, 96000);
3894 DKPlugin& self = *static_cast<DKPlugin*>(plugin);
3895 self.X.setZero();
3896 self.Y.setZero();
3897 unsigned int fs = samplingFreq;
3898 self.K5(0) = 1.75171807136529e-7*pow(fs,2);
3899 self.K4(0) = -7.00687228546118e-7*pow(fs,2);
3900 self.K3(0) = 1.05103084281918e-6*pow(fs,2) + 0.000200534456453583*fs;
3901 self.K2(0) = -7.00687228546118e-7*pow(fs,2) - 0.000401068912907166*fs;
3902 self.K1(0) = 1.75171807136529e-7*pow(fs,2) + 0.000200534456453583*fs + 0.0107626291380964;
3903 self.K0(0) = 0.0;
3904 self.K5(1) = -3.50343614273059e-7*pow(fs,2);
3905 self.K4(1) = 1.40137445709224e-6*pow(fs,2);
3906 self.K3(1) = -2.10206168563835e-6*pow(fs,2);
3907 self.K2(1) = 1.40137445709224e-6*pow(fs,2);
3908 self.K1(1) = -3.50343614273059e-7*pow(fs,2) + 0.0215252582761928;
3909 self.K0(1) = 0.0;
3910 self.K5(2) = 1.75171807136529e-7*pow(fs,2);
3911 self.K4(2) = -7.00687228546118e-7*pow(fs,2);
3912 self.K3(2) = 1.05103084281918e-6*pow(fs,2) - 0.000200534456453583*fs;
3913 self.K2(2) = -7.00687228546118e-7*pow(fs,2) + 0.000401068912907166*fs;
3914 self.K1(2) = 1.75171807136529e-7*pow(fs,2) - 0.000200534456453583*fs + 0.0107626291380964;
3915 self.K0(2) = 0.0;
3916 self.K5(3) = 1.70232916580416e-7*pow(fs,2);
3917 self.K4(3) = -6.75992775765549e-7*pow(fs,2);
3918 self.K3(3) = 1.00164193725804e-6*pow(fs,2) + 7.7521112860407e-5*fs;
3919 self.K2(3) = -6.51298322984981e-7*pow(fs,2) - 3.20288821276382e-5*fs;
3920 self.K1(3) = 1.50477354355961e-7*pow(fs,2) - 0.000168505574325945*fs - 0.00752160890512768;
3921 self.K0(3) = 4.93889055611368e-9*pow(fs,2) + 0.000123013343593176*fs + 0.0182842380432241;
3922 self.K5(4) = -3.40465833160831e-7*pow(fs,2);
3923 self.K4(4) = 1.3519855515311e-6*pow(fs,2);
3924 self.K3(4) = -2.00328387451608e-6*pow(fs,2);
3925 self.K2(4) = 1.30259664596996e-6*pow(fs,2);
3926 self.K1(4) = -3.00954708711922e-7*pow(fs,2) - 0.0150432178102554;
3927 self.K0(4) = -9.87778111222735e-9*pow(fs,2) + 0.0365684760864481;
3928 self.K5(5) = 1.70232916580416e-7*pow(fs,2);
3929 self.K4(5) = -6.75992775765549e-7*pow(fs,2);
3930 self.K3(5) = 1.00164193725804e-6*pow(fs,2) - 7.7521112860407e-5*fs;
3931 self.K2(5) = -6.51298322984981e-7*pow(fs,2) + 3.20288821276382e-5*fs;
3932 self.K1(5) = 1.50477354355961e-7*pow(fs,2) + 0.000168505574325945*fs - 0.00752160890512768;
3933 self.K0(5) = 4.93889055611368e-9*pow(fs,2) - 0.000123013343593176*fs + 0.0182842380432241;
3934 }
3935
3936 void DKPlugin::process(int n, float *u, float *o, PluginDef *plugin) {
3937 DKPlugin& self = *static_cast<DKPlugin*>(plugin);
3938 creal t[0+1];
3939 t[0] = (exp(5 * self.pots[0]) - 1) / (exp(5) - 1);
3940 for (int j = 0; j < n; j++) {
3941 self.pots_last[0] = 0.01 * t[0] + (1-0.01) * self.pots_last[0];
3942 double P6v = self.pots_last[0];
3943 Array<double, 6, 1> AB;
3944 AB = (((((self.K5 * P6v + self.K4) * P6v + self.K3) * P6v + self.K2) * P6v + self.K1) * P6v + self.K0);
3945 double out;
3946 out = ((u[j] * AB(0) + self.X(0) * AB(1) + self.X(1) * AB(2)) - (self.Y(0) * AB(4) + self.Y(1) * AB(5))) / AB(3);
3947 self.Y(1) = self.Y(0);
3948 self.Y(0) = out;
3949 self.X(1) = self.X(0);
3950 self.X(0) = u[j];
3951 o[j] = out;
3952 }
3953 u = o;
3954
3955 // start copied and modified code
3956 Matrix<creal, 8, 1> mi;
3957 creal fnorm;
3958 Matrix<creal, 8, 1> mp;
3959 Array<creal, 8, 1> p_val;
3960 nonlin_param par(&mp, &mi, &g_v, &g_info, &g_nfev, &fnorm, &p_val);
3961 float buf[smp.max_out_count(n)];
3962 n = smp.up(n, u, buf);
3963 #define GET_U (buf+j*1)
3964 for (int j = 0; j < n; j++) {
3965 #define DTP_U float
3966
3967 Matrix<creal, 8, 1> dp;
3968 dp << self.x_last, Map<Matrix<float,1,1> >(GET_U).cast<creal>();
3969 mp = Mp * dp;
3970 nonlin::nonlin(par);
3971 Matrix<creal, 16, 1> d;
3972 d << self.x_last, Map<Matrix<float,1,1> >(GET_U).cast<creal>(), mi;
3973 Matrix<creal, 7, 1>& xn = self.x_last;
3974 xn = Mx * d + Mxc;
3975 Map<Matrix<float, 1, 1> > xo(buf+1*j);
3976 xo = (Mo * d).cast<float>();
3977 {
3978 static double y;
3979 static double xm1;
3980 y = 0.999345929619 * (buf[j] - xm1) + 0.998691859237 * y;
3981 xm1 = buf[j];
3982 buf[j] = y;
3983 }
3984
3985 #undef GET_U
3986 #undef DTP_U
3987 }
3988 smp.down(buf, o);
3989 // end copied code
3990 }
3991
3992 int DKPlugin::uiloader(const UiBuilder& b, int form) {
3993 if (!(form & UI_FORM_STACK)) {
3994 return -1;
3995 }
3996
3997 b.openHorizontalhideBox("");
3998 b.create_master_slider(PARAM("P6v"), 0);
3999 b.closeBox();
4000 b.openHorizontalBox("");
4001
4002 b.create_small_rackknobr(PARAM("P6v"), 0);
4003 b.closeBox();
4004
4005 return 0;
4006 }
4007
4008 void DKPlugin::del_instance(PluginDef *p)
4009 {
4010 delete static_cast<DKPlugin*>(p);
4011 }
4012
4013
4014 namespace pluginlib { namespace jcm800pre {
4015 PluginDef *plugin() {
4016 return new DKPlugin;
4017 }
4018 }}
4019
4020 #ifdef LV2_COMPILE
4021 #include "lv2/lv2plug.in/ns/lv2core/lv2.h"
4022
4023 #define LV2_PLUGIN_URI "http://guitarix.sourceforge.net/plugins/JCM800Pre#JCM800Pre"
4024
4025 typedef enum {
4026 PORT_in0 = 0,
4027 PORT_out0 = 1,
4028 PORT_P6v = 2,
4029 } PortIndex;
4030
4031 class LV2_DKPlugin: public DKPlugin {
4032 public:
4033 // Port buffers
4034 float* ports[3];
4035 public:
4036 LV2_DKPlugin(): DKPlugin() {}
4037 };
4038
4039 static LV2_Handle
4040 instantiate(const LV2_Descriptor* descriptor,
4041 double rate,
4042 const char* bundle_path,
4043 const LV2_Feature* const* features)
4044 {
4045 LV2_DKPlugin *p = new LV2_DKPlugin;
4046 p->set_samplerate(rate, p);
4047 return static_cast<LV2_Handle>(p);
4048 }
4049
4050 static void
4051 connect_port(LV2_Handle instance,
4052 uint32_t port,
4053 void* data)
4054 {
4055 static_cast<LV2_DKPlugin*>(instance)->ports[port] = static_cast<float*>(data);
4056 }
4057
4058 static void
4059 activate(LV2_Handle instance)
4060 {
4061 }
4062
4063 static void
4064 run(LV2_Handle instance, uint32_t n_samples)
4065 {
4066 LV2_DKPlugin* p = static_cast<LV2_DKPlugin*>(instance);
4067
4068 p->pots[0] = *(p->ports[2]);
4069 p->process(n_samples, p->ports[0], p->ports[1], p);
4070 }
4071
4072 static void
4073 deactivate(LV2_Handle instance)
4074 {
4075 }
4076
4077 static void
4078 cleanup(LV2_Handle instance)
4079 {
4080 LV2_DKPlugin* p = static_cast<LV2_DKPlugin*>(instance);
4081 p->delete_instance(p);
4082 }
4083
4084 static const void*
4085 extension_data(const char* uri)
4086 {
4087 return NULL;
4088 }
4089
4090 static const LV2_Descriptor descriptor = {
4091 LV2_PLUGIN_URI,
4092 instantiate,
4093 connect_port,
4094 activate,
4095 run,
4096 deactivate,
4097 cleanup,
4098 extension_data
4099 };
4100
4101 LV2_SYMBOL_EXPORT
4102 extern "C" __attribute__ ((visibility ("default")))
4103 const LV2_Descriptor*
4104 lv2_descriptor(uint32_t index)
4105 {
4106 switch (index) {
4107 case 0:
4108 return &descriptor;
4109 default:
4110 return NULL;
4111 }
4112 }
4113 #endif
66 import("effect.lib");
77 import("filter.lib");
88 import("music.lib");
9 import("reduce.lib");
10
11 vmeter1(x) = attach(x, envelop(x) : vbargraph("v1[nomidi:no]", -70, +5));
12 vmeter2(x) = attach(x, envelop(x) : vbargraph("v2[nomidi:no]", -70, +5));
13 vmeter3(x) = attach(x, envelop(x) : vbargraph("v3[nomidi:no]", -70, +5));
14 vmeter4(x) = attach(x, envelop(x) : vbargraph("v4[nomidi:no]", -70, +5));
15 vmeter5(x) = attach(x, envelop(x) : vbargraph("v5[nomidi:no]", -70, +5));
16
17 envelop = abs : max ~ (1.0/SR) : reduce(max,4096) ; // : max(db2linear(-70)) : linear2db;
918
1019 //Mono
11 process = _<: ( gcomp1s , gcomp2s , gcomp3s, gcomp4s, gcomp5s) :>_ with {
12 gcomp1s = bandpass1:bypass1(bswitch1,compressor_mono(ratio1,-push1,attack1,release1)):*(Makeup1);
13 gcomp2s = bandpass2:bypass1(bswitch2,compressor_mono(ratio2,-push2,attack2,release2)):*(Makeup2);
14 gcomp3s = bandpass3:bypass1(bswitch3,compressor_mono(ratio3,-push3,attack3,release3)):*(Makeup3);
15 gcomp4s = bandpass4:bypass1(bswitch4,compressor_mono(ratio4,-push4,attack4,release4)):*(Makeup4);
16 gcomp5s = bandpass5:bypass1(bswitch5,compressor_mono(ratio5,-push5,attack5,release5)):*(Makeup5);
20 process = geq : ( gcomp5s , gcomp4s , gcomp3s, gcomp2s, gcomp1s) :>_ with {
21 gcomp1s = bypass1(bswitch1,compressor_mono(ratio1,-push1,attack1,release1)):*(Makeup1) : vmeter1;
22 gcomp2s = bypass1(bswitch2,compressor_mono(ratio2,-push2,attack2,release2)):*(Makeup2) : vmeter2;
23 gcomp3s = bypass1(bswitch3,compressor_mono(ratio3,-push3,attack3,release3)):*(Makeup3) : vmeter3;
24 gcomp4s = bypass1(bswitch4,compressor_mono(ratio4,-push4,attack4,release4)):*(Makeup4) : vmeter4;
25 gcomp5s = bypass1(bswitch5,compressor_mono(ratio5,-push5,attack5,release5)):*(Makeup5) : vmeter5;
1726 };
1827
1928
3948 bswitch5 = max(0,sel5-1);
4049
4150 hifr1 =hslider("crossover_b1_b2 [log][name:Crossover B1-B2 (hz)][tooltip: Crossover bandpass frequency]" ,80 , 20, 20000, 1.08);
42 lowfr2 =hifr1;
4351 hifr2 =hslider("crossover_b2_b3 [log][name:Crossover B2-B3 (hz)][tooltip: Crossover bandpass frequency]",210,20,20000,1.08);
44 lowfr3 =hifr2;
4552 hifr3 =hslider("crossover_b3_b4 [log][name:Crossover B3-B4 (hz)][tooltip: Crossover bandpass frequency]",1700,20,20000,1.08);
46 lowfr4 =hifr3;
4753 hifr4 =hslider("crossover_b4_b5 [log][name:Crossover B4-B5 (hz)][tooltip: Crossover bandpass frequency]",5000,20,20000,1.08);
48 lowfr5 =hifr4;
4954
50 bandpass1 = lowpass(3,hifr1) ;
51 bandpass2 = lowpass(3,hifr2) : highpass(3,lowfr2);
52 bandpass3 = lowpass(3,hifr3) : highpass(3,lowfr3);
53 bandpass4 = lowpass(3,hifr4) : highpass(3,lowfr4);
54 bandpass5 = highpass(3,lowfr5);
55 geq = filterbank(3, (hifr1,hifr2,hifr3,hifr4));
5556
5657 ratio1 = hslider("[9] Ratio1 [tooltip: Compression ratio]",2,1,100,0.1);
57 attack1 = hslider("[A] Attack1 [tooltip: Time before the compressor starts to kick in]", 0.012, 0, 1, 0.001);
58 release1 = hslider("[B] Release1 [tooltip: Time before the compressor releases the sound]", 1.25, 0, 10, 0.01);
58 attack1 = hslider("[A] Attack1 [tooltip: Time before the compressor starts to kick in]", 0.012, 0.001, 1, 0.001);
59 release1 = hslider("[B] Release1 [tooltip: Time before the compressor releases the sound]", 1.25, 0.01, 10, 0.01);
5960
6061 ratio2 = hslider("[9] Ratio2 [tooltip: Compression ratio]",2,1,100,0.1);
61 attack2 = hslider("[A] Attack2 [tooltip: Time before the compressor starts to kick in]", 0.012, 0, 1, 0.001);
62 release2 = hslider("[B] Release2 [tooltip: Time before the compressor releases the sound]", 1.25, 0, 10, 0.01);
62 attack2 = hslider("[A] Attack2 [tooltip: Time before the compressor starts to kick in]", 0.012, 0.001, 1, 0.001);
63 release2 = hslider("[B] Release2 [tooltip: Time before the compressor releases the sound]", 1.25, 0.01, 10, 0.01);
6364
6465 ratio3 = hslider("[9] Ratio3 [tooltip: Compression ratio]",2,1,100,0.1);
65 attack3 = hslider("[A] Attack3 [tooltip: Time before the compressor starts to kick in]", 0.012, 0, 1, 0.001);
66 release3 = hslider("[B] Release3 [tooltip: Time before the compressor releases the sound]", 1.25, 0, 10, 0.01);
66 attack3 = hslider("[A] Attack3 [tooltip: Time before the compressor starts to kick in]", 0.012, 0.001, 1, 0.001);
67 release3 = hslider("[B] Release3 [tooltip: Time before the compressor releases the sound]", 1.25, 0.01, 10, 0.01);
6768
6869 ratio4 = hslider("[9] Ratio4 [tooltip: Compression ratio]",2,1,100,0.1);
69 attack4 = hslider("[A] Attack4 [tooltip: Time before the compressor starts to kick in]", 0.012, 0, 1, 0.001);
70 release4 = hslider("[B] Release4 [tooltip: Time before the compressor releases the sound]", 1.25, 0, 10, 0.01);
70 attack4 = hslider("[A] Attack4 [tooltip: Time before the compressor starts to kick in]", 0.012, 0.001, 1, 0.001);
71 release4 = hslider("[B] Release4 [tooltip: Time before the compressor releases the sound]", 1.25, 0.01, 10, 0.01);
7172
7273 ratio5 = hslider("[9] Ratio5 [tooltip: Compression ratio]",2,1,100,0.1);
73 attack5 = hslider("[A] Attack5 [tooltip: Time before the compressor starts to kick in]", 0.012, 0, 1, 0.001);
74 release5 = hslider("[B] Release5 [tooltip: Time before the compressor releases the sound]", 1.25, 0, 10, 0.01);
74 attack5 = hslider("[A] Attack5 [tooltip: Time before the compressor starts to kick in]", 0.012, 0.001, 1, 0.001);
75 release5 = hslider("[B] Release5 [tooltip: Time before the compressor releases the sound]", 1.25, 0.01, 10, 0.01);
7576
7677 push1 = hslider("[5] Makeup1 [tooltip: Post amplification and threshold]" , 13, -50, +50, 0.1) ; // threshold-=push ; makeup+=push
7778 push2 = hslider("[5] Makeup2 [tooltip: Post amplification and threshold]" , 10, -50, +50, 0.1) ; // threshold-=push ; makeup+=push
77 b.openTabBox("");
88
99 b.openHorizontalBox(N_("Band 1"));
10 b.openpaintampBox("");
1011 b.openVerticalBox("");
1112 b.openHorizontalBox("");
1213 b.set_next_flags(UI_NUM_RIGHT);
2425 b.closeBox();
2526 b.closeBox();
2627 b.closeBox();
28 b.closeBox();
2729
2830 b.openHorizontalBox(N_("Band 2"));
31 b.openpaintampBox("");
2932 b.openVerticalBox("");
3033 b.openHorizontalBox("");
3134 b.set_next_flags(UI_NUM_RIGHT);
4548 b.closeBox();
4649 b.closeBox();
4750 b.closeBox();
51 b.closeBox();
4852
4953 b.openHorizontalBox(N_("Band 3"));
54 b.openpaintampBox("");
5055 b.openVerticalBox("");
5156 b.openHorizontalBox("");
5257 b.set_next_flags(UI_NUM_RIGHT);
6671 b.closeBox();
6772 b.closeBox();
6873 b.closeBox();
74 b.closeBox();
6975
7076 b.openHorizontalBox(N_("Band 4"));
77 b.openpaintampBox("");
7178 b.openVerticalBox("");
7279 b.openHorizontalBox("");
7380 b.set_next_flags(UI_NUM_RIGHT);
8895 b.closeBox();
8996 b.closeBox();
9097 b.closeBox();
98 b.closeBox();
9199
92100 b.openHorizontalBox(N_("Band 5"));
101 b.openpaintampBox("");
93102 b.openVerticalBox("");
94103 b.openHorizontalBox("");
95104 b.set_next_flags(UI_NUM_RIGHT);
107116 b.closeBox();
108117 b.closeBox();
109118 b.closeBox();
119 b.closeBox();
110120
111121 b.closeBox();
112122 b.closeBox();
123 b.openVerticalBox2("Analyze");
124 b.create_simple_meter(PARAM("v1"));
125 b.create_simple_meter(PARAM("v2"));
126 b.create_simple_meter(PARAM("v3"));
127 b.create_simple_meter(PARAM("v4"));
128 b.create_simple_meter(PARAM("v5"));
113129 b.closeBox();
130 b.closeBox();
0 declare id "mbchor";
1 declare name "MultiBand Chorus";
2 declare shortname "MB Chorus";
3 declare category "Modulation";
4 declare description "Multi Band Chorus";
5
6 import("effect.lib");
7 import("filter.lib");
8 import("music.lib");
9 import("math.lib");
10 import("reduce.lib");
11
12 hifr1 =hslider("crossover_b1_b2 [log][name:Crossover B1-B2 (hz)][tooltip: Crossover bandpass frequency]" ,80 , 20, 20000, 1.08);
13 hifr2 =hslider("crossover_b2_b3 [log][name:Crossover B2-B3 (hz)][tooltip: Crossover bandpass frequency]",210,20,20000,1.08);
14 hifr3 =hslider("crossover_b3_b4 [log][name:Crossover B3-B4 (hz)][tooltip: Crossover bandpass frequency]",1700,20,20000,1.08);
15 hifr4 =hslider("crossover_b4_b5 [log][name:Crossover B4-B5 (hz)][tooltip: Crossover bandpass frequency]",5000,20,20000,1.08);
16
17 geq = filterbank(3, (hifr1,hifr2,hifr3,hifr4));
18
19
20
21 l1 = hslider("level1", 0.5, 0, 1, 0.01);
22 f1 = hslider("freq1[tooltip:Beats per Minute]",30,24,360,1)/60;
23 d1 = hslider("delay1", 0.02, 0, 0.2, 0.01): smooth(0.999);
24 de1 = hslider("depth1", 0.02, 0.01, 1, 0.01)/10;
25 l2 = hslider("level2", 0.5, 0, 1, 0.01);
26 f2 = hslider("freq2[tooltip:Beats per Minute]",60,24,360,1)/60;
27 d2 = hslider("delay2", 0.04, 0, 0.2, 0.01): smooth(0.999);
28 de2 = hslider("depth2", 0.04, 0.01, 1, 0.01)/10;
29 l3 = hslider("level3", 0.5, 0, 1, 0.01);
30 f3 = hslider("freq3[tooltip:Beats per Minute]",90,24,360,1)/60;
31 d3 = hslider("delay3", 0.06, 0, 0.2, 0.01): smooth(0.999);
32 de3 = hslider("depth3", 0.06, 0.01, 1, 0.01)/10;
33 l4 = hslider("level4", 0.5, 0, 1, 0.01);
34 f4 = hslider("freq4[tooltip:Beats per Minute]",120,24,360,1)/60;
35 d4 = hslider("delay4", 0.08, 0, 0.2, 0.01): smooth(0.999);
36 de4 = hslider("depth4", 0.08, 0.01, 1, 0.01)/10;
37 l5 = hslider("level5", 0.5, 0, 1, 0.01);
38 f5 = hslider("freq5[tooltip:Beats per Minute]",150,24,360,1)/60;
39 d5 = hslider("delay5", 0.10, 0, 0.2, 0.01): smooth(0.999);
40 de5 = hslider("depth5", 0.10, 0.01, 1, 0.01)/10;
41
42 tblosc(n,f,freq,mod) = (1-d)*rdtable(n,wform,i&(n-1)) +
43 d*rdtable(n,wform,(i+1)&(n-1))
44 with {
45 wform = time*(2.0*PI)/n : f;
46 phase = freq/SR : (+ : decimal) ~ _;
47 modphase = decimal(phase+mod/(2*PI))*n;
48 i = int(floor(modphase));
49 d = decimal(modphase);
50 };
51
52 chor(dtime,freq,depth,lev) = chorus(dtime,freq,depth,lev,0) : *(lev)
53 with {
54 chorus(dtime,freq,depth,lev,phase,x)
55 = x+lev*fdelay(1<<16, t, x)
56 with {
57 t = SR*dtime/2*(1+depth*tblosc(1<<16, sin, freq, phase));
58 };
59 };
60
61 vmeter1(x) = attach(x, envelop(x) : vbargraph("v1[nomidi:no]", -0, +1));
62 vmeter2(x) = attach(x, envelop(x) : vbargraph("v2[nomidi:no]", -0, +1));
63 vmeter3(x) = attach(x, envelop(x) : vbargraph("v3[nomidi:no]", -0, +1));
64 vmeter4(x) = attach(x, envelop(x) : vbargraph("v4[nomidi:no]", -0, +1));
65 vmeter5(x) = attach(x, envelop(x) : vbargraph("v5[nomidi:no]", -0, +1));
66
67 envelop = abs : max ~ (1.0/SR) : reduce(max,4096) ; // : max(db2linear(-70)) : linear2db;
68
69 process = _<:(geq:( dist5s , dist4s , dist3s, dist2s, dist1s)),_ :>_ with {
70 dist1s = chor(d1,f1,de1,l1) : vmeter1;
71 dist2s = chor(d2,f2,de2,l2) : vmeter2;
72 dist3s = chor(d3,f3,de3,l3) : vmeter3;
73 dist4s = chor(d4,f4,de4,l4) : vmeter4;
74 dist5s = chor(d5,f5,de5,l5) : vmeter5;
75
76 };
0
1 b.openHorizontalhideBox("");
2 b.closeBox();
3
4 b.openHorizontalBox("");
5 b.openVerticalBox("");
6
7 b.openTabBox("");
8
9 b.openHorizontalBox(N_("Band 1"));
10 b.openVerticalBox("");
11 b.openpaintampBox("");
12 b.openHorizontalBox("");
13 b.openVerticalBox("");
14 b.set_next_flags(UI_NUM_RIGHT);
15 b.create_small_rackknob(PARAM("level1"), N_("Level"));
16 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
17 b.create_small_rackknob(PARAM("freq1"), N_("BPM"));
18 b.closeBox();
19 b.openVerticalBox("");
20 b.set_next_flags(UI_NUM_RIGHT);
21 b.create_small_rackknob(PARAM("delay1"), N_("Delay"));
22 b.set_next_flags(UI_NUM_RIGHT);
23 b.create_small_rackknob(PARAM("depth1"), N_("Depth"));
24 b.closeBox();
25 b.openVerticalBox("");
26 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
27 b.create_small_rackknob(PARAM("crossover_b1_b2"), N_("Low Shelf (Hz)"));
28 b.closeBox();
29 b.closeBox();
30 b.closeBox();
31 b.closeBox();
32 b.closeBox();
33
34 b.openHorizontalBox(N_("Band 2"));
35 b.openVerticalBox("");
36 b.openpaintampBox("");
37 b.openHorizontalBox("");
38 b.openVerticalBox("");
39 b.set_next_flags(UI_NUM_RIGHT);
40 b.create_small_rackknob(PARAM("level2"), N_("Level"));
41 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
42 b.create_small_rackknob(PARAM("freq2"), N_("BPM"));
43 b.closeBox();
44 b.openVerticalBox("");
45 b.set_next_flags(UI_NUM_RIGHT);
46 b.create_small_rackknob(PARAM("delay2"), N_("Delay"));
47 b.set_next_flags(UI_NUM_RIGHT);
48 b.create_small_rackknob(PARAM("depth2"), N_("Depth"));
49 b.closeBox();
50 b.openVerticalBox("");
51 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
52 b.create_small_rackknob(PARAM("crossover_b1_b2"), N_("Low (Hz)"));
53 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
54 b.create_small_rackknob(PARAM("crossover_b2_b3"), N_("High (hz)"));
55 b.closeBox();
56 b.closeBox();
57 b.closeBox();
58 b.closeBox();
59 b.closeBox();
60
61 b.openHorizontalBox(N_("Band 3"));
62 b.openVerticalBox("");
63 b.openpaintampBox("");
64 b.openHorizontalBox("");
65 b.openVerticalBox("");
66 b.set_next_flags(UI_NUM_RIGHT);
67 b.create_small_rackknob(PARAM("level3"), N_("Level"));
68 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
69 b.create_small_rackknob(PARAM("freq3"), N_("BPM"));
70 b.closeBox();
71 b.openVerticalBox("");
72 b.set_next_flags(UI_NUM_RIGHT);
73 b.create_small_rackknob(PARAM("delay3"), N_("Delay"));
74 b.set_next_flags(UI_NUM_RIGHT);
75 b.create_small_rackknob(PARAM("depth3"), N_("Depth"));
76 b.closeBox();
77 b.openVerticalBox("");
78 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
79 b.create_small_rackknob(PARAM("crossover_b2_b3"), N_("Low (Hz)"));
80 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
81 b.create_small_rackknob(PARAM("crossover_b3_b4"), N_("High (hz)"));
82 b.closeBox();
83 b.closeBox();
84 b.closeBox();
85 b.closeBox();
86 b.closeBox();
87
88 b.openHorizontalBox(N_("Band 4"));
89 b.openVerticalBox("");
90 b.openpaintampBox("");
91 b.openHorizontalBox("");
92 b.openVerticalBox("");
93 b.set_next_flags(UI_NUM_RIGHT);
94 b.create_small_rackknob(PARAM("level4"), N_("Level"));
95 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
96 b.create_small_rackknob(PARAM("freq4"), N_("BPM"));
97 b.closeBox();
98 b.openVerticalBox("");
99 b.set_next_flags(UI_NUM_RIGHT);
100 b.create_small_rackknob(PARAM("delay4"), N_("Delay"));
101 b.set_next_flags(UI_NUM_RIGHT);
102 b.create_small_rackknob(PARAM("depth4"), N_("Depth"));
103 b.closeBox();
104 b.openVerticalBox("");
105 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
106 b.create_small_rackknob(PARAM("crossover_b3_b4"), N_("Low (Hz)"));
107 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
108 b.create_small_rackknob(PARAM("crossover_b4_b5"), N_("High (hz)"));
109 b.closeBox();
110 b.closeBox();
111 b.closeBox();
112 b.closeBox();
113 b.closeBox();
114
115 b.openHorizontalBox(N_("Band 5"));
116 b.openVerticalBox("");
117 b.openpaintampBox("");
118 b.openHorizontalBox("");
119 b.openVerticalBox("");
120 b.set_next_flags(UI_NUM_RIGHT);
121 b.create_small_rackknob(PARAM("level5"), N_("Level"));
122 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
123 b.create_small_rackknob(PARAM("freq5"), N_("BPM"));
124 b.closeBox();
125 b.openVerticalBox("");
126 b.set_next_flags(UI_NUM_RIGHT);
127 b.create_small_rackknob(PARAM("delay5"), N_("Delay"));
128 b.set_next_flags(UI_NUM_RIGHT);
129 b.create_small_rackknob(PARAM("depth5"), N_("Depth"));
130 b.closeBox();
131 b.openVerticalBox("");
132 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
133 b.create_small_rackknob(PARAM("crossover_b4_b5"), N_("High Shelf (Hz)"));
134 b.closeBox();
135 b.closeBox();
136 b.closeBox();
137 b.closeBox();
138 b.closeBox();
139
140 b.closeBox();
141 b.closeBox();
142 b.openVerticalBox2("Analyze");
143 b.create_simple_meter(PARAM("v1"));
144 b.create_simple_meter(PARAM("v2"));
145 b.create_simple_meter(PARAM("v3"));
146 b.create_simple_meter(PARAM("v4"));
147 b.create_simple_meter(PARAM("v5"));
148 b.closeBox();
149 b.closeBox();
2929 bswitch5 = max(0,sel5-1);
3030
3131 //Stereo
32 process = (_,_)<: ( gcomp1s , gcomp2s , gcomp3s, gcomp4s, gcomp5s) :>(_,_) with {
33 gcomp1s = bandpass1s:bypass2(bswitch1,compressor_stereo(ratio1,-push1,attack1,release1)):*(Makeup1),*(Makeup1);
34 gcomp2s = bandpass2s:bypass2(bswitch2,compressor_stereo(ratio2,-push2,attack2,release2)):*(Makeup2),*(Makeup2);
35 gcomp3s = bandpass3s:bypass2(bswitch3,compressor_stereo(ratio3,-push3,attack3,release3)):*(Makeup3),*(Makeup3);
36 gcomp4s = bandpass4s:bypass2(bswitch4,compressor_stereo(ratio4,-push4,attack4,release4)):*(Makeup4),*(Makeup4);
37 gcomp5s = bandpass5s:bypass2(bswitch5,compressor_stereo(ratio5,-push5,attack5,release5)):*(Makeup5),*(Makeup5);
32 process = (_,_):geqs: ( gcomp5s , gcomp4s , gcomp3s, gcomp2s, gcomp1s) :>(_,_) with {
33 gcomp1s = bypass2(bswitch1,compressor_stereo(ratio1,-push1,attack1,release1)):*(Makeup1),*(Makeup1);
34 gcomp2s = bypass2(bswitch2,compressor_stereo(ratio2,-push2,attack2,release2)):*(Makeup2),*(Makeup2);
35 gcomp3s = bypass2(bswitch3,compressor_stereo(ratio3,-push3,attack3,release3)):*(Makeup3),*(Makeup3);
36 gcomp4s = bypass2(bswitch4,compressor_stereo(ratio4,-push4,attack4,release4)):*(Makeup4),*(Makeup4);
37 gcomp5s = bypass2(bswitch5,compressor_stereo(ratio5,-push5,attack5,release5)):*(Makeup5),*(Makeup5);
3838 };
3939
4040
4141 hifr1 =hslider("crossover_b1_b2 [log][name:Crossover B1-B2 (hz)][tooltip: Crossover bandpass frequency]" ,80 , 20, 20000, 1.08);
42 lowfr2 =hifr1;
4342 hifr2 =hslider("crossover_b2_b3 [log][name:Crossover B2-B3 (hz)][tooltip: Crossover bandpass frequency]",210,20,20000,1.08);
44 lowfr3 =hifr2;
4543 hifr3 =hslider("crossover_b3_b4 [log][name:Crossover B3-B4 (hz)][tooltip: Crossover bandpass frequency]",1700,20,20000,1.08);
46 lowfr4 =hifr3;
4744 hifr4 =hslider("crossover_b4_b5 [log][name:Crossover B4-B5 (hz)][tooltip: Crossover bandpass frequency]",5000,20,20000,1.08);
48 lowfr5 =hifr4;
4945
50 bandpass1 = lowpass(3,hifr1) ;
51 bandpass2 = lowpass(3,hifr2) : highpass(3,lowfr2);
52 bandpass3 = lowpass(3,hifr3) : highpass(3,lowfr3);
53 bandpass4 = lowpass(3,hifr4) : highpass(3,lowfr4);
54 bandpass5 = highpass(3,lowfr5);
55
56 bandpass1s = (bandpass1,bandpass1);
57 bandpass2s = (bandpass2,bandpass2);
58 bandpass3s = (bandpass3,bandpass3);
59 bandpass4s = (bandpass4,bandpass4);
60 bandpass5s = (bandpass5,bandpass5);
46 geq = filterbank(3, (hifr1,hifr2,hifr3,hifr4));
47 cross5 = _,!,!,!,!,_,!,!,!,!,!,_,!,!,!,!,_,!,!,!,!,!,_,!,!,!,!,_,!,!,!,!,!,_,!,!,!,!,_,!,!,!,!,!,_,!,!,!,!,_ ;
48 geqs = (geq,geq) <: cross5;
6149
6250 ratio1 = hslider("[9] Ratio1 [tooltip: Compression ratio]",2,1,100,0.1);
63 attack1 = hslider("[A] Attack1 [tooltip: Time before the compressor starts to kick in]", 0.012, 0, 1, 0.001);
64 release1 = hslider("[B] Release1 [tooltip: Time before the compressor releases the sound]", 1.25, 0, 10, 0.01);
51 attack1 = hslider("[A] Attack1 [tooltip: Time before the compressor starts to kick in]", 0.012, 0.001, 1, 0.001);
52 release1 = hslider("[B] Release1 [tooltip: Time before the compressor releases the sound]", 1.25, 0.01, 10, 0.01);
6553
6654 ratio2 = hslider("[9] Ratio2 [tooltip: Compression ratio]",2,1,100,0.1);
67 attack2 = hslider("[A] Attack2 [tooltip: Time before the compressor starts to kick in]", 0.012, 0, 1, 0.001);
68 release2 = hslider("[B] Release2 [tooltip: Time before the compressor releases the sound]", 1.25, 0, 10, 0.01);
55 attack2 = hslider("[A] Attack2 [tooltip: Time before the compressor starts to kick in]", 0.012, 0.001, 1, 0.001);
56 release2 = hslider("[B] Release2 [tooltip: Time before the compressor releases the sound]", 1.25, 0.01, 10, 0.01);
6957
7058 ratio3 = hslider("[9] Ratio3 [tooltip: Compression ratio]",2,1,100,0.1);
71 attack3 = hslider("[A] Attack3 [tooltip: Time before the compressor starts to kick in]", 0.012, 0, 1, 0.001);
72 release3 = hslider("[B] Release3 [tooltip: Time before the compressor releases the sound]", 1.25, 0, 10, 0.01);
59 attack3 = hslider("[A] Attack3 [tooltip: Time before the compressor starts to kick in]", 0.012, 0.001, 1, 0.001);
60 release3 = hslider("[B] Release3 [tooltip: Time before the compressor releases the sound]", 1.25, 0.01, 10, 0.01);
7361
7462 ratio4 = hslider("[9] Ratio4 [tooltip: Compression ratio]",2,1,100,0.1);
75 attack4 = hslider("[A] Attack4 [tooltip: Time before the compressor starts to kick in]", 0.012, 0, 1, 0.001);
76 release4 = hslider("[B] Release4 [tooltip: Time before the compressor releases the sound]", 1.25, 0, 10, 0.01);
63 attack4 = hslider("[A] Attack4 [tooltip: Time before the compressor starts to kick in]", 0.012, 0.001, 1, 0.001);
64 release4 = hslider("[B] Release4 [tooltip: Time before the compressor releases the sound]", 1.25, 0.01, 10, 0.01);
7765
7866 ratio5 = hslider("[9] Ratio5 [tooltip: Compression ratio]",2,1,100,0.1);
79 attack5 = hslider("[A] Attack5 [tooltip: Time before the compressor starts to kick in]", 0.012, 0, 1, 0.001);
80 release5 = hslider("[B] Release5 [tooltip: Time before the compressor releases the sound]", 1.25, 0, 10, 0.01);
67 attack5 = hslider("[A] Attack5 [tooltip: Time before the compressor starts to kick in]", 0.012, 0.001, 1, 0.001);
68 release5 = hslider("[B] Release5 [tooltip: Time before the compressor releases the sound]", 1.25, 0.01, 10, 0.01);
8169
8270 push1 = hslider("[5] Makeup1 [tooltip: Post amplification and threshold]" , 13, -50, +50, 0.1) ; // threshold-=push ; makeup+=push
8371 push2 = hslider("[5] Makeup2 [tooltip: Post amplification and threshold]" , 10, -50, +50, 0.1) ; // threshold-=push ; makeup+=push
77 b.openTabBox("");
88
99 b.openHorizontalBox(N_("Band 1"));
10 b.openpaintampBox("");
1011 b.openVerticalBox("");
1112 b.openHorizontalBox("");
1213 b.set_next_flags(UI_NUM_RIGHT);
2425 b.closeBox();
2526 b.closeBox();
2627 b.closeBox();
28 b.closeBox();
2729
2830 b.openHorizontalBox(N_("Band 2"));
31 b.openpaintampBox("");
2932 b.openVerticalBox("");
3033 b.openHorizontalBox("");
3134 b.set_next_flags(UI_NUM_RIGHT);
4548 b.closeBox();
4649 b.closeBox();
4750 b.closeBox();
51 b.closeBox();
4852
4953 b.openHorizontalBox(N_("Band 3"));
54 b.openpaintampBox("");
5055 b.openVerticalBox("");
5156 b.openHorizontalBox("");
5257 b.set_next_flags(UI_NUM_RIGHT);
6671 b.closeBox();
6772 b.closeBox();
6873 b.closeBox();
74 b.closeBox();
6975
7076 b.openHorizontalBox(N_("Band 4"));
77 b.openpaintampBox("");
7178 b.openVerticalBox("");
7279 b.openHorizontalBox("");
7380 b.set_next_flags(UI_NUM_RIGHT);
8794 b.closeBox();
8895 b.closeBox();
8996 b.closeBox();
97 b.closeBox();
9098
9199 b.openHorizontalBox(N_("Band 5"));
100 b.openpaintampBox("");
92101 b.openVerticalBox("");
93102 b.openHorizontalBox("");
94103 b.set_next_flags(UI_NUM_RIGHT);
106115 b.closeBox();
107116 b.closeBox();
108117 b.closeBox();
118 b.closeBox();
109119
110120 b.closeBox();
111121 b.closeBox();
0 declare id "mbd";
1 declare name "MultiBand Distortion";
2 declare shortname "MB Distortion";
3 declare category "Distortion";
4 declare description "MultiBand Distortion";
5
6 import("effect.lib");
7 import("filter.lib");
8 import("music.lib");
9 import("math.lib");
10 import("reduce.lib");
11
12 anti_denormal = pow(10,-20);
13 anti_denormal_ac = 1 - 1' : *(anti_denormal) : + ~ *(-1);
14
15 hifr1 =hslider("crossover_b1_b2 [log][name:Crossover B1-B2 (hz)][tooltip: Crossover bandpass frequency]" ,80 , 20, 20000, 1.08);
16 hifr2 =hslider("crossover_b2_b3 [log][name:Crossover B2-B3 (hz)][tooltip: Crossover bandpass frequency]",210,20,20000,1.08);
17 hifr3 =hslider("crossover_b3_b4 [log][name:Crossover B3-B4 (hz)][tooltip: Crossover bandpass frequency]",1700,20,20000,1.08);
18 hifr4 =hslider("crossover_b4_b5 [log][name:Crossover B4-B5 (hz)][tooltip: Crossover bandpass frequency]",5000,20,20000,1.08);
19
20 geq = filterbank(3, (hifr1,hifr2,hifr3,hifr4));
21
22 drive1 = hslider("Drive1 [tooltip: Amount of distortion]", 0, 0, 1, 0.01);
23 offset1 = hslider("Offset1 [tooltip: Brings in even harmonics]", 0, 0, 0.5, 0.01);
24 drive2 = hslider("Drive2 [tooltip: Amount of distortion]", 0, 0, 1, 0.01);
25 offset2 = hslider("Offset2 [tooltip: Brings in even harmonics]", 0, 0, 0.5, 0.01);
26 drive3 = hslider("Drive3 [tooltip: Amount of distortion]", 0, 0, 1, 0.01);
27 offset3 = hslider("Offset3 [tooltip: Brings in even harmonics]", 0, 0, 0.5, 0.01);
28 drive4 = hslider("Drive4 [tooltip: Amount of distortion]", 0, 0, 1, 0.01);
29 offset4 = hslider("Offset4 [tooltip: Brings in even harmonics]", 0, 0, 0.5, 0.01);
30 drive5 = hslider("Drive5 [tooltip: Amount of distortion]", 0, 0, 1, 0.01);
31 offset5 = hslider("Offset5 [tooltip: Brings in even harmonics]", 0, 0, 0.5, 0.01);
32
33 gain1 = vslider("Gain", 0, -40, 4, 0.1) : db2linear : smooth(0.999);
34
35 vmeter1(x) = attach(x, envelop(x) : vbargraph("v1[nomidi:no]", -70, +5));
36 vmeter2(x) = attach(x, envelop(x) : vbargraph("v2[nomidi:no]", -70, +5));
37 vmeter3(x) = attach(x, envelop(x) : vbargraph("v3[nomidi:no]", -70, +5));
38 vmeter4(x) = attach(x, envelop(x) : vbargraph("v4[nomidi:no]", -70, +5));
39 vmeter5(x) = attach(x, envelop(x) : vbargraph("v5[nomidi:no]", -70, +5));
40
41 envelop = abs : max ~ (1.0/SR) : reduce(max,4096); // : max(db2linear(-70)) : linear2db;
42
43 process = _: +(anti_denormal_ac): geq: ( dist5s , dist4s , dist3s, dist2s, dist1s) :> *(gain1) with {
44 dist1s = cubicnl_nodc(drive1,offset1: smooth(0.999)) : vmeter1;
45 dist2s = cubicnl_nodc(drive2,offset2: smooth(0.999)) : vmeter2;
46 dist3s = cubicnl_nodc(drive3,offset3: smooth(0.999)) : vmeter3;
47 dist4s = cubicnl_nodc(drive4,offset4: smooth(0.999)) : vmeter4;
48 dist5s = cubicnl_nodc(drive5,offset5: smooth(0.999)) : vmeter5;
49
50 };
0
1 b.openHorizontalhideBox("");
2 b.create_master_slider(PARAM("Gain"), N_("Gain"));
3 b.closeBox();
4
5 b.openHorizontalBox("");
6 b.openVerticalBox("");
7
8 b.openTabBox("");
9
10 b.openHorizontalBox(N_("Band 1"));
11 b.openVerticalBox("");
12 b.openpaintampBox("");
13 b.openHorizontalBox("");
14 b.set_next_flags(UI_NUM_RIGHT);
15 b.create_small_rackknob(PARAM("Drive1"), N_("Drive"));
16 b.set_next_flags(UI_NUM_RIGHT);
17 b.create_small_rackknob(PARAM("Offset1"), N_("Offset"));
18 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
19 b.create_small_rackknob(PARAM("crossover_b1_b2"), N_("Low Shelf (Hz)"));
20 b.closeBox();
21 b.closeBox();
22 b.closeBox();
23 b.closeBox();
24
25 b.openHorizontalBox(N_("Band 2"));
26 b.openVerticalBox("");
27 b.openpaintampBox("");
28 b.openHorizontalBox("");
29 b.set_next_flags(UI_NUM_RIGHT);
30 b.create_small_rackknob(PARAM("Drive2"), N_("Drive"));
31 b.set_next_flags(UI_NUM_RIGHT);
32 b.create_small_rackknob(PARAM("Offset2"), N_("Offset"));
33 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
34 b.create_small_rackknob(PARAM("crossover_b1_b2"), N_("Low (Hz)"));
35 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
36 b.create_small_rackknob(PARAM("crossover_b2_b3"), N_("High (hz)"));
37 b.closeBox();
38 b.closeBox();
39 b.closeBox();
40 b.closeBox();
41
42 b.openHorizontalBox(N_("Band 3"));
43 b.openVerticalBox("");
44 b.openpaintampBox("");
45 b.openHorizontalBox("");
46 b.set_next_flags(UI_NUM_RIGHT);
47 b.create_small_rackknob(PARAM("Drive3"), N_("Drive"));
48 b.set_next_flags(UI_NUM_RIGHT);
49 b.create_small_rackknob(PARAM("Offset3"), N_("Offset"));
50 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
51 b.create_small_rackknob(PARAM("crossover_b2_b3"), N_("Low (Hz)"));
52 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
53 b.create_small_rackknob(PARAM("crossover_b3_b4"), N_("High (hz)"));
54 b.closeBox();
55 b.closeBox();
56 b.closeBox();
57 b.closeBox();
58
59 b.openHorizontalBox(N_("Band 4"));
60 b.openVerticalBox("");
61 b.openpaintampBox("");
62 b.openHorizontalBox("");
63 b.set_next_flags(UI_NUM_RIGHT);
64 b.create_small_rackknob(PARAM("Drive4"), N_("Drive"));
65 b.set_next_flags(UI_NUM_RIGHT);
66 b.create_small_rackknob(PARAM("Offset4"), N_("Offset"));
67 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
68 b.create_small_rackknob(PARAM("crossover_b3_b4"), N_("Low (Hz)"));
69 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
70 b.create_small_rackknob(PARAM("crossover_b4_b5"), N_("High (hz)"));
71 b.closeBox();
72 b.closeBox();
73 b.closeBox();
74 b.closeBox();
75
76 b.openHorizontalBox(N_("Band 5"));
77 b.openVerticalBox("");
78 b.openpaintampBox("");
79 b.openHorizontalBox("");
80 b.set_next_flags(UI_NUM_RIGHT);
81 b.create_small_rackknob(PARAM("Drive5"), N_("Drive"));
82 b.set_next_flags(UI_NUM_RIGHT);
83 b.create_small_rackknob(PARAM("Offset5"), N_("Offset"));
84 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
85 b.create_small_rackknob(PARAM("crossover_b4_b5"), N_("High Shelf (Hz)"));
86 b.closeBox();
87 b.closeBox();
88 b.closeBox();
89 b.closeBox();
90
91 b.closeBox();
92 b.closeBox();
93 b.create_small_rackknob(PARAM("Gain"), N_("Gain"));
94 b.openVerticalBox2("Analyze");
95 b.create_simple_meter(PARAM("v1"));
96 b.create_simple_meter(PARAM("v2"));
97 b.create_simple_meter(PARAM("v3"));
98 b.create_simple_meter(PARAM("v4"));
99 b.create_simple_meter(PARAM("v5"));
100 b.closeBox();
101 b.closeBox();
102
0 declare id "mbdel";
1 declare name "MultiBand Delay";
2 declare shortname "MB Delay";
3 declare category "Echo / Delay";
4 declare description "Multi Band Delay";
5
6 import("effect.lib");
7 import("filter.lib");
8 import("music.lib");
9 import("math.lib");
10 import("reduce.lib");
11
12 hifr1 =hslider("crossover_b1_b2 [log][name:Crossover B1-B2 (hz)][tooltip: Crossover bandpass frequency]" ,80 , 20, 20000, 1.08);
13 hifr2 =hslider("crossover_b2_b3 [log][name:Crossover B2-B3 (hz)][tooltip: Crossover bandpass frequency]",210,20,20000,1.08);
14 hifr3 =hslider("crossover_b3_b4 [log][name:Crossover B3-B4 (hz)][tooltip: Crossover bandpass frequency]",1700,20,20000,1.08);
15 hifr4 =hslider("crossover_b4_b5 [log][name:Crossover B4-B5 (hz)][tooltip: Crossover bandpass frequency]",5000,20,20000,1.08);
16
17 geq = filterbank(3, (hifr1,hifr2,hifr3,hifr4));
18
19
20 interp = 100*SR/1000.0;
21 N = int( 2^18);
22 g1 = vslider("gain1", -10, -20, 20, 0.1) : db2linear : smooth(0.999);
23 d1 = tempo(hslider("delay1[tooltip:Delay in Beats per Minute]",30,24,360,1));
24 g2 = vslider("gain2", -5, -20, 20, 0.1) : db2linear : smooth(0.999);
25 d2 = tempo(hslider("delay2[tooltip:Delay in Beats per Minute]",60,24,360,1));
26 g3 = vslider("gain3", -2, -20, 20, 0.1) : db2linear : smooth(0.999);
27 d3 = tempo(hslider("delay3[tooltip:Delay in Beats per Minute]",90,24,360,1));
28 g4 = vslider("gain4", 0, -20, 20, 0.1) : db2linear : smooth(0.999);
29 d4 = tempo(hslider("delay4[tooltip:Delay in Beats per Minute]",120,24,360,1));
30 g5 = vslider("gain5", -10, -20, 20, 0.1) : db2linear : smooth(0.999);
31 d5 = tempo(hslider("delay5[tooltip:Delay in Beats per Minute]",150,24,360,1));
32
33 del(g,d) = *(g) : sdelay(N, interp,d) ;
34
35 vmeter1(x) = attach(x, envelop(x) : vbargraph("v1[nomidi:no]", -70, +5));
36 vmeter2(x) = attach(x, envelop(x) : vbargraph("v2[nomidi:no]", -70, +5));
37 vmeter3(x) = attach(x, envelop(x) : vbargraph("v3[nomidi:no]", -70, +5));
38 vmeter4(x) = attach(x, envelop(x) : vbargraph("v4[nomidi:no]", -70, +5));
39 vmeter5(x) = attach(x, envelop(x) : vbargraph("v5[nomidi:no]", -70, +5));
40
41 envelop = abs : max ~ (1.0/SR) : reduce(max,4096) ; // : max(db2linear(-70)) : linear2db;
42
43 process = _<:(geq: ( dist5s , dist4s , dist3s, dist2s, dist1s)),_:>_ with {
44 dist1s = del(g1,d1) : vmeter1;
45 dist2s = del(g2,d2) : vmeter2;
46 dist3s = del(g3,d3) : vmeter3;
47 dist4s = del(g4,d4) : vmeter4;
48 dist5s = del(g5,d5) : vmeter5;
49
50 };
0
1 b.openHorizontalhideBox("");
2 b.closeBox();
3
4 b.openHorizontalBox("");
5 b.openVerticalBox("");
6
7 b.openTabBox("");
8
9 b.openHorizontalBox(N_("Band 1"));
10 b.openVerticalBox("");
11 b.openpaintampBox("");
12 b.openHorizontalBox("");
13 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
14 b.create_small_rackknob(PARAM("delay1"), N_("BPM"));
15 b.set_next_flags(UI_NUM_RIGHT);
16 b.create_small_rackknob(PARAM("gain1"), N_("Gain (db)"));
17 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
18 b.create_small_rackknob(PARAM("crossover_b1_b2"), N_("Low Shelf (Hz)"));
19 b.closeBox();
20 b.closeBox();
21 b.closeBox();
22 b.closeBox();
23
24 b.openHorizontalBox(N_("Band 2"));
25 b.openVerticalBox("");
26 b.openpaintampBox("");
27 b.openHorizontalBox("");
28 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
29 b.create_small_rackknob(PARAM("delay2"), N_("BPM"));
30 b.set_next_flags(UI_NUM_RIGHT);
31 b.create_small_rackknob(PARAM("gain2"), N_("Gain (db)"));
32 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
33 b.create_small_rackknob(PARAM("crossover_b1_b2"), N_("Low (Hz)"));
34 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
35 b.create_small_rackknob(PARAM("crossover_b2_b3"), N_("High (hz)"));
36 b.closeBox();
37 b.closeBox();
38 b.closeBox();
39 b.closeBox();
40
41 b.openHorizontalBox(N_("Band 3"));
42 b.openVerticalBox("");
43 b.openpaintampBox("");
44 b.openHorizontalBox("");
45 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
46 b.create_small_rackknob(PARAM("delay3"), N_("BPM"));
47 b.set_next_flags(UI_NUM_RIGHT);
48 b.create_small_rackknob(PARAM("gain3"), N_("Gain (db)"));
49 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
50 b.create_small_rackknob(PARAM("crossover_b2_b3"), N_("Low (Hz)"));
51 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
52 b.create_small_rackknob(PARAM("crossover_b3_b4"), N_("High (hz)"));
53 b.closeBox();
54 b.closeBox();
55 b.closeBox();
56 b.closeBox();
57
58 b.openHorizontalBox(N_("Band 4"));
59 b.openVerticalBox("");
60 b.openpaintampBox("");
61 b.openHorizontalBox("");
62 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
63 b.create_small_rackknob(PARAM("delay4"), N_("BPM"));
64 b.set_next_flags(UI_NUM_RIGHT);
65 b.create_small_rackknob(PARAM("gain4"), N_("Gain (db)"));
66 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
67 b.create_small_rackknob(PARAM("crossover_b3_b4"), N_("Low (Hz)"));
68 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
69 b.create_small_rackknob(PARAM("crossover_b4_b5"), N_("High (hz)"));
70 b.closeBox();
71 b.closeBox();
72 b.closeBox();
73 b.closeBox();
74
75 b.openHorizontalBox(N_("Band 5"));
76 b.openVerticalBox("");
77 b.openpaintampBox("");
78 b.openHorizontalBox("");
79 b.set_next_flags(UI_NUM_RIGHT);
80 b.create_small_rackknob(PARAM("delay5"), N_("BPM"));
81 b.set_next_flags(UI_NUM_RIGHT);
82 b.create_small_rackknob(PARAM("gain5"), N_("Gain (db)"));
83 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
84 b.create_small_rackknob(PARAM("crossover_b4_b5"), N_("High Shelf (Hz)"));
85 b.closeBox();
86 b.closeBox();
87 b.closeBox();
88 b.closeBox();
89
90 b.closeBox();
91 b.closeBox();
92 b.openVerticalBox2("Analyze");
93 b.create_simple_meter(PARAM("v1"));
94 b.create_simple_meter(PARAM("v2"));
95 b.create_simple_meter(PARAM("v3"));
96 b.create_simple_meter(PARAM("v4"));
97 b.create_simple_meter(PARAM("v5"));
98 b.closeBox();
99 b.closeBox();
0 declare id "mbe";
1 declare name "MultiBand Echo";
2 declare shortname "MB Echo";
3 declare category "Echo / Delay";
4 declare description "Multi Band Echo";
5
6 import("effect.lib");
7 import("filter.lib");
8 import("music.lib");
9 import("math.lib");
10 import("reduce.lib");
11
12 hifr1 =hslider("crossover_b1_b2 [log][name:Crossover B1-B2 (hz)][tooltip: Crossover bandpass frequency]" ,80 , 20, 20000, 1.08);
13 hifr2 =hslider("crossover_b2_b3 [log][name:Crossover B2-B3 (hz)][tooltip: Crossover bandpass frequency]",210,20,20000,1.08);
14 hifr3 =hslider("crossover_b3_b4 [log][name:Crossover B3-B4 (hz)][tooltip: Crossover bandpass frequency]",1700,20,20000,1.08);
15 hifr4 =hslider("crossover_b4_b5 [log][name:Crossover B4-B5 (hz)][tooltip: Crossover bandpass frequency]",5000,20,20000,1.08);
16
17 geq = filterbank(3, (hifr1,hifr2,hifr3,hifr4));
18
19
20 t1 = tempo(hslider("time1[tooltip:Echo in Beats per Minute]",30,24,360,1));
21 r1 = hslider("percent1", 10, 0, 100, 0.1)/100.0 : smooth(0.999);
22 t2 = tempo(hslider("time2[tooltip:Echo in Beats per Minute]",60,24,360,1));
23 r2 = hslider("percent2", 30, 0, 100, 0.1)/100.0 : smooth(0.999);
24 t3 = tempo(hslider("time3[tooltip:Echo in Beats per Minute]",120,24,360,1));
25 r3 = hslider("percent3", 45, 0, 100, 0.1)/100.0 : smooth(0.999);
26 t4 = tempo(hslider("time4[tooltip:Echo in Beats per Minute]",150,24,360,1));
27 r4 = hslider("percent4", 20, 0, 100, 0.1)/100.0 : smooth(0.999);
28 t5 = tempo(hslider("time5[tooltip:Echo in Beats per Minute]",240,24,360,1));
29 r5 = hslider("percent5", 0, 0, 100, 0.1)/100.0 : smooth(0.999);
30
31 vmeter1(x) = attach(x, envelop(x) : vbargraph("v1[nomidi:no]", -70, +5));
32 vmeter2(x) = attach(x, envelop(x) : vbargraph("v2[nomidi:no]", -70, +5));
33 vmeter3(x) = attach(x, envelop(x) : vbargraph("v3[nomidi:no]", -70, +5));
34 vmeter4(x) = attach(x, envelop(x) : vbargraph("v4[nomidi:no]", -70, +5));
35 vmeter5(x) = attach(x, envelop(x) : vbargraph("v5[nomidi:no]", -70, +5));
36
37 envelop = abs : max ~ (1.0/SR) : reduce(max,4096) ; // : max(db2linear(-70)) : linear2db;
38
39 echo1(t,r) = +~(sdelay(int(2^18), 100*SR/1000.0, t) * (r));
40
41 process = geq: ( dist5s , dist4s , dist3s, dist2s, dist1s) :>_ with {
42 dist1s = echo1(t1,r1) : vmeter1 ;
43 dist2s = echo1(t2,r2) : vmeter2;
44 dist3s = echo1(t3,r3) : vmeter3;
45 dist4s = echo1(t4,r4) : vmeter4;
46 dist5s = echo1(t5,r5) : vmeter5;
47
48 };
0
1 b.openHorizontalhideBox("");
2 b.closeBox();
3
4 b.openHorizontalBox("");
5 b.openVerticalBox("");
6
7 b.openTabBox("");
8
9 b.openHorizontalBox(N_("Band 1"));
10 b.openVerticalBox("");
11 b.openpaintampBox("");
12 b.openHorizontalBox("");
13 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
14 b.create_small_rackknob(PARAM("time1"), N_("BPM"));
15 b.set_next_flags(UI_NUM_RIGHT);
16 b.create_small_rackknob(PARAM("percent1"), N_("Amount"));
17 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
18 b.create_small_rackknob(PARAM("crossover_b1_b2"), N_("Low Shelf (Hz)"));
19 b.closeBox();
20 b.closeBox();
21 b.closeBox();
22 b.closeBox();
23
24 b.openHorizontalBox(N_("Band 2"));
25 b.openVerticalBox("");
26 b.openpaintampBox("");
27 b.openHorizontalBox("");
28 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
29 b.create_small_rackknob(PARAM("time2"), N_("BPM"));
30 b.set_next_flags(UI_NUM_RIGHT);
31 b.create_small_rackknob(PARAM("percent2"), N_("Amount"));
32 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
33 b.create_small_rackknob(PARAM("crossover_b1_b2"), N_("Low (Hz)"));
34 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
35 b.create_small_rackknob(PARAM("crossover_b2_b3"), N_("High (hz)"));
36 b.closeBox();
37 b.closeBox();
38 b.closeBox();
39 b.closeBox();
40
41 b.openHorizontalBox(N_("Band 3"));
42 b.openVerticalBox("");
43 b.openpaintampBox("");
44 b.openHorizontalBox("");
45 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
46 b.create_small_rackknob(PARAM("time3"), N_("BPM"));
47 b.set_next_flags(UI_NUM_RIGHT);
48 b.create_small_rackknob(PARAM("percent3"), N_("Amount"));
49 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
50 b.create_small_rackknob(PARAM("crossover_b2_b3"), N_("Low (Hz)"));
51 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
52 b.create_small_rackknob(PARAM("crossover_b3_b4"), N_("High (hz)"));
53 b.closeBox();
54 b.closeBox();
55 b.closeBox();
56 b.closeBox();
57
58 b.openHorizontalBox(N_("Band 4"));
59 b.openVerticalBox("");
60 b.openpaintampBox("");
61 b.openHorizontalBox("");
62 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
63 b.create_small_rackknob(PARAM("time4"), N_("BPM"));
64 b.set_next_flags(UI_NUM_RIGHT);
65 b.create_small_rackknob(PARAM("percent4"), N_("Amount"));
66 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
67 b.create_small_rackknob(PARAM("crossover_b3_b4"), N_("Low (Hz)"));
68 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
69 b.create_small_rackknob(PARAM("crossover_b4_b5"), N_("High (hz)"));
70 b.closeBox();
71 b.closeBox();
72 b.closeBox();
73 b.closeBox();
74
75 b.openHorizontalBox(N_("Band 5"));
76 b.openVerticalBox("");
77 b.openpaintampBox("");
78 b.openHorizontalBox("");
79 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
80 b.create_small_rackknob(PARAM("time5"), N_("BPM"));
81 b.set_next_flags(UI_NUM_RIGHT);
82 b.create_small_rackknob(PARAM("percent5"), N_("Amount"));
83 b.set_next_flags(UI_NUM_SHOW_ALWAYS|UI_NUM_RIGHT);
84 b.create_small_rackknob(PARAM("crossover_b4_b5"), N_("High Shelf (Hz)"));
85 b.closeBox();
86 b.closeBox();
87 b.closeBox();
88 b.closeBox();
89
90 b.closeBox();
91 b.closeBox();
92 b.openVerticalBox2("Analyze");
93 b.create_simple_meter(PARAM("v1"));
94 b.create_simple_meter(PARAM("v2"));
95 b.create_simple_meter(PARAM("v3"));
96 b.create_simple_meter(PARAM("v4"));
97 b.create_simple_meter(PARAM("v5"));
98 b.closeBox();
99 b.closeBox();
0 #include "gx_plugin.h"
1 #include <cmath>
2 #include <stdlib.h>
3
4 namespace pluginlib {
5 namespace reversedelay {
6
7 #define N_(x) (x)
8
9 class ReverseDelay : public PluginDef {
10 private:
11 float sample_rate;
12 float *buffer;
13 unsigned int counter;
14 unsigned int buf_size;
15
16 unsigned int cur_buf_size;
17 float feedback_buf;
18
19 //Params
20 float time, feedback, window, drywet;
21 //Params buffs
22 float time_old, window_old;
23
24 class overlap_window
25 {
26 private:
27 float val;
28 float step;
29 float acc;
30 unsigned int active_samples;
31 unsigned int full_samples;
32 unsigned int counter;
33
34 public:
35 overlap_window() {
36 val = 0;
37 step = 0;
38 acc = 0;
39 active_samples = 0;
40 full_samples = 0;
41 counter = 0;
42 }
43 void set_coef(float t /* 0..1 */, unsigned int full_samples) {
44 set_full(0, full_samples, t*full_samples);
45 }
46 bool set_full(float min_val, unsigned int full_samples, unsigned int active_samples) {
47 if(active_samples >= full_samples) return false;
48
49 acc = min_val;
50 val = min_val;
51 this->full_samples = full_samples;
52 this->active_samples = active_samples;
53 counter = 0;
54 step = (1 - min_val)/(active_samples/2);
55
56 return true;
57 }
58 float get() {
59 if(counter >= 0 && counter < active_samples/2) {
60 acc += step;
61 counter++;
62 return acc;
63 }
64 else if(counter >= active_samples/2 && counter <= full_samples - active_samples/2) {
65 counter++;
66 return 1;
67 }
68 else if(counter > full_samples - active_samples/2 && counter < full_samples) {
69 acc -= step;
70 counter++;
71 return acc;
72 }
73 else if(counter >= full_samples) {
74 float ret_val = acc;
75 acc = val;
76 counter = 0;
77 return ret_val;
78 }
79 return 1;
80 }
81 };
82
83 overlap_window ow;
84
85 static float reverse_delay_line_impl(float in, float* buf, unsigned int* counter, unsigned int length)
86 {
87 float out = 0;
88
89 //Read data
90 if(*counter < length - 1)
91 {
92 unsigned int read_counter = length - 1 - (*counter);
93 out = buf[read_counter];
94 }
95
96 //Write data
97 *(buf + (*counter)) = in;
98 (*counter)++;
99 if ((*counter) > length-1)
100 (*counter) = 0;
101
102 return (out);
103 }
104
105 public:
106 ReverseDelay();
107 static void init(unsigned int samplingFreq, PluginDef *plugin);
108 static void process(int count, float *input, float *output, PluginDef *plugin);
109 static int registerparam(const ParamReg& reg);
110 static int uiloader(const UiBuilder& builder, int form);
111 static void del_instance(PluginDef *plugin);
112 };
113
114 ReverseDelay::ReverseDelay():
115 PluginDef(),
116 sample_rate(0) {
117 version = PLUGINDEF_VERSION;
118 id = "reversedelay";
119 name = N_("ReverseDelay");
120 category = N_("Echo / Delay");
121 mono_audio = process;
122 set_samplerate = init;
123 register_params = registerparam;
124 load_ui = uiloader;
125 delete_instance = del_instance;
126
127 buffer = NULL;
128 counter = 0;
129 buf_size = 0;
130 cur_buf_size = 0;
131 feedback_buf = 0;
132 time_old = 0;
133 window_old = 0;
134 }
135
136 int ReverseDelay::registerparam(const ParamReg& reg) {
137 ReverseDelay& self = *static_cast<ReverseDelay*>(reg.plugin);
138 reg.registerVar("reversedelay.time", N_("Time (ms)"), "S", N_("Delay time in milliseconds"), &self.time, 500, 200, 2000, 1);
139 reg.registerVar("reversedelay.feedback", N_("Feedback"), "S", N_("Feedback"), &self.feedback, 0, 0, 1, 0.05);
140 reg.registerVar("reversedelay.window", N_("Window (%)"), "S", N_("Crossfade between delayed chunks in percents"), &self.window, 50, 0, 100, 1);
141 reg.registerVar("reversedelay.drywet", N_("Dry/Wet"), "S", "Dey/Wet", &self.drywet, 0.5, 0, 1, 0.05);
142 return 0;
143 }
144
145 void ReverseDelay::init(unsigned int samplingFreq, PluginDef *plugin) {
146 ReverseDelay& self = *static_cast<ReverseDelay*>(plugin);
147 self.sample_rate = samplingFreq;
148
149 float* old_buf = self.buffer;
150
151 //Provide dual buf size, with 2 seconds length for every part
152 unsigned int new_buf_size = (unsigned int)(samplingFreq * 2 * 2);
153
154 float *new_buf = new float[new_buf_size];
155 for (size_t i = 0; i < new_buf_size; i++)
156 new_buf[i] = 0.0f;
157
158 // Assign new pointer and size
159 self.buffer = new_buf;
160 self.buf_size = new_buf_size;
161
162 // Delete old buffer
163 if (old_buf != NULL)
164 delete [] old_buf;
165 }
166
167 void ReverseDelay::process(int count, float *input, float *output, PluginDef *plugin) {
168 ReverseDelay& self = *static_cast<ReverseDelay*>(plugin);
169
170 //Update params
171 if(self.time_old != self.time) {
172 self.cur_buf_size = (self.time/1000.0)*self.sample_rate;
173 self.counter = 0;
174 self.ow.set_coef((self.window)/(100.0 + 1.0), self.cur_buf_size/2); //Avoid to pass 1
175
176 self.time_old = self.time;
177 self.window_old = self.window;
178 }
179 else if(self.window_old != self.window)
180 {
181 self.ow.set_coef((self.window)/(100.0 + 1.0), self.cur_buf_size/2);
182 self.window_old = self.window;
183 }
184
185 for (int i = 0; i < count; ++i) {
186 float in = input[i];
187 float out = 0;
188
189 // Can be added -> //Update tempo led
190 //if(counter < cur_buf_size/4)
191 // *params[param_tempo_led] = true;
192 //else
193 // *params[param_tempo_led] = false;
194
195 //Process
196 out = reverse_delay_line_impl(in + self.feedback_buf * self.feedback, self.buffer, &self.counter, self.cur_buf_size);
197 self.feedback_buf = out;
198
199 out*= self.ow.get();
200
201 out = out* self.drywet + in* (1 - self.drywet);
202 output[i] = out;
203 }
204 }
205
206 int ReverseDelay::uiloader(const UiBuilder& b, int form) {
207 if (!(form & UI_FORM_STACK)) {
208 return -1;
209 }
210 b.openHorizontalhideBox("");
211 {
212 b.create_master_slider("reversedelay.drywet",0);
213 }
214 b.closeBox();
215 b.openHorizontalBox("");
216 {
217 b.create_small_rackknob("reversedelay.time",0);
218 b.create_small_rackknob("reversedelay.feedback",0);
219 b.create_small_rackknob("reversedelay.window",0);
220 b.create_small_rackknobr("reversedelay.drywet",0);
221 }
222 b.closeBox();
223 return 0;
224 }
225
226 void ReverseDelay::del_instance(PluginDef *plugin)
227 {
228 ReverseDelay& self = *static_cast<ReverseDelay*>(plugin);
229 delete [] self.buffer;
230 delete static_cast<ReverseDelay*>(plugin);
231 }
232
233
234 #if true
235
236 PluginDef *plugin() {
237 return new ReverseDelay;
238 }
239
240 #else
241
242 extern "C" __attribute__ ((visibility ("default"))) int
243 get_gx_plugin(unsigned int idx, PluginDef **pplugin)
244 {
245 const int count = 1;
246 if (!pplugin) {
247 return count;
248 }
249 switch (idx) {
250 case 0: *pplugin = new ReverseDelay; return count;
251 default: *pplugin = 0; return -1;
252 }
253 }
254
255 #endif
256
257 } // end namespace reverse_delay
258 } // end namespace pluginlib
44
55 csources = [ # generate .so files from c sources that can be loaded by guitarix
66 # element = name or [name, [lib, ...]]
7
78 ]
89
910 sources = [ # generate .so files that can be loaded by guitarix
1213
1314 lib_csource_defs = [ # put in static library linked with guitarix
1415 ["vibe.cc", ("plugin_mono", "plugin_stereo")],
16 #"dubbe.cc",
1517 "abgate.cc",
18 "jcm800pre.cpp",
19 "reversedelay.cc",
1620 ]
1721
22 lib_float_sources = [ # put in static library linked with guitarix
23 #"dubber.dsp",
24 ]
1825 lib_sources = [ # put in static library linked with guitarix
1926 "zita_rev1.dsp",
2027 "ts9sim.dsp",
2128 "flanger_gx.dsp",
2229 "mbc.dsp",
2330 "mbcs.dsp",
31 "mbd.dsp",
32 "mbe.dsp",
33 "mbdel.dsp",
34 "mbchor.dsp",
35 "gcb_95.dsp",
2436 ]
2537
2638 def build(bld):
3850 proc = "../tools/dsp2cc",
3951 gen_dir_suffix = "/generated",
4052 proc_args = arg+["--template-type=staticlib","--in-namespace=pluginlib"],
53 )
54 bld(name = "dsp2cc staticlib",
55 source = lib_float_sources,
56 proc = "../tools/dsp2cc",
57 gen_dir_suffix = "/generated",
58 proc_args = float_arg+["--template-type=staticlib","--in-namespace=pluginlib","--init-type=plugin-instance"],
4159 )
4260 else:
4361 gdir = "generated/"
7694 bld(features = ['cxx', 'cstaticlib'],
7795 includes = [".","../headers"],
7896 source = [s.replace(".dsp",".cc") for s in lib_sources]+lib_csources,
97 uselib = ["EIGEN3"],
7998 target = "plugins", # (also defines name of task)
8099 )
81100 for s in sources:
107126 tsk.env['shlib_PATTERN'] = '%s.so'
108127
109128 def configure(conf):
110 pass
129 conf.check_cfg(package='eigen3', args='--cflags', uselib_store="EIGEN3", mandatory=1)
680680
681681 av_rdft_end (_plan_r2c);
682682 av_rdft_end (_plan_c2r);
683 free (_freq_data);
683 av_free (_freq_data);
684684 _plan_r2c = 0;
685685 _plan_c2r = 0;
686686 _freq_data = 0;
0 Warning: experimental/unfinished code, missing documentation...
1
2 This directory contains an analog electronic circuit simulator, like
3 e.g. Spice but with an emphasis on automatic code generation for
4 realtime execution (which means it can directly generate Guitarix
5 modules).
6
7 It uses the "DK method" and generates/compiles optimized C++ code
8 internally for signal calculations.
9
10 The simulated circuit is defined by a "netlist", which is easy to
11 write manually. Circuit schematics can also be drawn with gschem (part
12 of gEDA). The gschem files (.sch) in this directory use additional
13 symbols which are in the subdirectory gschem-symbols. Before opening
14 them with gschem please add a line
15
16 (component-library "<absolute path to directory gschem-symbols>")
17
18 to the file ~/.gEDA/gafrc (of course replace the <...> with the real
19 path). (Tip: gschem on Ubuntu 13.4 needs the environment setting
20 UBUNTU_MENUPROXY= to have working keyboard shortcuts.)
21
22 Dependencies:
23 - python-scipy
24 - python-matplotlib
25 - python-sympy
26 - for internally generated C++ module:
27 - libeigen3-dev
28 - libcminpack-dev
29 - to generate symbolic output (e.g. Faust code):
30 - maxima
31 - (at least on debian / ubuntu): package maxima-share (add-on packages)
32
33 Demo:
34
35 "python circ.py", then select e.g. 5 (PushPullTransformer). You can
36 disable C code generation by adding option -p (the calculation will be
37 about a factor of 100 slower).
38
39 Create a Guitarix module crybaby4 from the schematics in wahwah.sch:
40
41 python simu.py --linearize -S wahwah.sch --create-c-module=crybaby4 --c-samplerate=44100
42
43 The module is automatically copied to ~/.config/guitarix/plugins, so
44 you can just start / restart Guitarix to try out the module (you'll
45 find it in the category "External"). It uses the script
46 tools/build-cmodule, so maybe you need to tweak the compiler options
47 in that script.
48
49 Look at the spectrum of the WahWah processing (uses the wahwah circuit
50 netlist from circ.py):
51
52 python simu.py --linearize WahWah --plot-spectrum --plot-variable=hotpotz
53
54 TODO: the produced code gets real-time execution speed for simple
55 circuits, but for complex circuits the solver for nonlinear equations
56 needs to be replaced (by function appromixation tables etc.).
0 ;;
1 ;; Given a uref, returns the device associated nets(s) ordered by their pin#,
2 ;; what when not defined?
3 ;; problem is slotted components e.g. ../examples/singlenet_1.sch
4 ;;
5 (define ampsim:write-net-name-of-component
6 (lambda (uref number-of-pin port)
7 (if (> number-of-pin 0)
8 (begin
9 ;; first find pin1 and then start writing the connected net name
10 (ampsim:write-net-name-of-component uref (- number-of-pin 1) port)
11 ;; generate a pin-name e.g. pin1, pin2, pin3 ...
12 (let ((pin-name (number->string number-of-pin)))
13 (display (car (gnetlist:get-nets uref (gnetlist:get-attribute-by-pinseq uref pin-name "pinnumber"))) port)
14 (write-char #\space port))))))
15
16
17 ;;
18 ;; Given a uref, returns the device attribute value as string
19 ;;
20 (define ampsim:component-value
21 (lambda (package)
22 (let ((value (gnetlist:get-package-attribute package "value")))
23 (if (not (string=? value "unknown"))
24 value
25 "None"))))
26
27
28 ;;
29 ;; write the uref, the net name connected to pin# and the component value. No extra attributes.
30 ;;
31 (define ampsim:write-one-component
32 (lambda (package port)
33 (display (string-append package " ") port)
34 (display (string-append (get-device package) " ") port)
35 (display (string-append (ampsim:component-value package) " ") port)
36 (ampsim:write-net-name-of-component package (length (gnetlist:get-pins package)) port)))
37
38
39 ;;
40 ;; write the uref, to the pin# connected net and component value and optional extra attributes
41 ;; check if the component is a special spice component
42 ;;
43 (define ampsim:write-netlist
44 (lambda (port ls)
45 (if (not (null? ls))
46 (let ((package (car ls))) ;; search for specific device labels
47 (ampsim:write-one-component package port)
48 (newline port)
49 (ampsim:write-netlist port (cdr ls)) ))))
50
51
52 ;;
53 ;; ampsim netlist generation
54 ;;
55 (define ampsim
56 (lambda (output-filename)
57 (let ((port (open-output-file output-filename)))
58 (ampsim:write-netlist port packages)
59 (close-output-port port))))
0 from __future__ import division
1 import sympy, math, shutil, sys, os, numpy, pylab, warnings, tempfile, logging, argparse
2 from cStringIO import StringIO
3 import dk_simulator, models, circ, mk_netlist, dk_lib, simu, signals, generate_code
4 from signals import Signal
5 from dk_lib import CircuitException, error
6 import scipy.optimize as opt
7
8 try:
9 get_ipython
10 except NameError:
11 pass
12 else:
13 def _circuit_exception_handler(self, etype, value, tb, tb_offset=None):
14 print "error:", value
15 get_ipython().set_custom_exc((CircuitException,), _circuit_exception_handler)
16
17
18 def eng_str(x):
19 y = abs(x)
20 exponent = int(math.log10(y))
21 engr_exponent = exponent - exponent % 3
22 y /= 10**engr_exponent
23 if engr_exponent:
24 engr_exponent = 'e' + str(engr_exponent)
25 else:
26 engr_exponent = ''
27 return "%s%g%s" % ('-' if x < 0 else '', y, engr_exponent)
28
29 def check_keywords(fname, kw, *keywords):
30 for k in kw:
31 if k not in keywords:
32 raise CircuitException("%s: unknown keyword '%s'" % (fname, k))
33
34 class NonlinComponent(object):
35
36 def __init__(self):
37 self.max_jacobi_error = None
38 self.max_jacobi = None
39 self.ptp = None
40 self.nonlin_range = None
41 self.max_error = None
42 self.basegrid = None
43
44
45 class DC_Values(object):
46 def __init__(self, v, x, p, o):
47 self.v = v
48 self.x = x
49 self.p = p
50 self.o = o
51 def show(self):
52 with dk_lib.printoptions(linewidth=200):
53 print "v =", self.v
54 print "x =", self.x
55 print "p =", self.p.A1
56 print "o =", self.o
57
58 SIM_PY, SIM_C, SIM_TABLE = range(3)
59
60 class Circuit(object):
61
62 have_plot = False
63
64 def __init__(self, copy_from=None, FS=96000):
65 self.tempdir = None
66 self.tempdir_keep = False
67 self.backward_euler = False
68 self.solver = None
69 self.build_verbose = False
70 self.module_id = None
71 self.module_name = None
72 self.module_desc = None
73 self.c_datatype = "double"
74 self.table_datatype = "double" #"float"
75 self.pre_filter = None
76 self.post_filter = None
77 self.code_generator = None
78 self.plugindef = None
79 self.build_script = None
80 self.resample = True
81 self.FS = FS
82 self.use_sim = SIM_C
83 self.sig = Signal()
84 self._clear()
85 self._rmtree = shutil.rmtree
86 self.subcircuits = {}
87 if copy_from is not None:
88 self.backward_euler = copy_from.backward_euler
89 self.solver = copy_from.solver
90 self.FS = copy_from.FS
91 self.S = copy_from.S
92 self.V = copy_from.V
93
94 #
95 # internal routines
96 #
97
98 def _clear(self):
99 self.max_homotopy_iter = None
100 self.dc_method = "A"
101 self.sys_reduce_tol = 0
102 self.solver_params = None
103 self.grid_error_limit = None
104 self.transform_opts = dk_simulator.TransformOptions()
105 self._clear_all()
106
107 def _clear_calculated(self):
108 self.eq = None
109 self.sim_py = None
110 self.sim_c = None
111 self.sim_table = None
112 self.sim_filter = None
113 self.dc_values = None
114 self.components = None
115 self.ptp = None
116 self.minmax = None
117 self.E = None
118 self.basegrid = None
119 self.knot_positions = None
120 self.table_source = None
121 self.input_amplitude = None
122 self.sensitivity = None
123
124 def _clear_all(self):
125 self.S = None
126 self.V = None
127 self.loaded_filename = None
128 self.parser = None
129 self._clear_calculated()
130
131 def __del__(self):
132 self._remove_tempdir(True)
133
134 def _remove_tempdir(self, ignore_errors=False):
135 if self.tempdir is None:
136 return
137 if self.tempdir_keep:
138 return
139 self._rmtree(self.tempdir, ignore_errors=ignore_errors)
140
141 def _ensure_parser(self, symbolic=False, for_filter=False):
142 if self.parser is None or not self.parser.matches(symbolic, for_filter):
143 if self.S is None:
144 raise CircuitException("no netlist defined")
145 if self.V is None and not symbolic:
146 raise CircuitException("no netlist values defined")
147 self.parser = dk_simulator.Parser(self.S, self.V, self.FS, not self.backward_euler, for_filter, symbolic)
148
149 def _ensure_eq(self):
150 if self.eq is None:
151 self._ensure_parser()
152 self.eq = dk_simulator.EquationSystem(self.parser, opts=self.transform_opts)
153
154 def _ensure_sim_py(self):
155 if self.sim_py is None:
156 self._ensure_eq()
157 try:
158 self.sim_py = dk_simulator.SimulatePy(self.eq, self.solver, self.dc_method)
159 if self.sys_reduce_tol >= 0:
160 self.sim_py.balance_realization(self.sys_reduce_tol)
161 if (isinstance(self.eq.nonlin, dk_simulator.PartitionedNonlinEquations)
162 and self.transform_opts.decompose):
163 self.eq.F, self.eq.C = self.eq.nonlin.decompose_blocks(self.eq.F, self.eq.C)
164 except dk_simulator.ConvergenceError as e:
165 raise CircuitException(e)
166
167 def _ensure_dc_values(self):
168 if self.dc_values is None:
169 self._ensure_sim_py()
170 self.dc_values = DC_Values(self.sim_py.v00, self.sim_py.x0, self.sim_py.p0, self.sim_py.o0)
171
172 def _ensure_sim_c(self):
173 if self.sim_c is None:
174 self._ensure_dc_values()
175 if self.tempdir is None:
176 self.tempdir = tempfile.mkdtemp("_dk_compile")
177 modc = dk_simulator.BuildCModule(
178 self._get_module_id(), self.sim_py, c_tempdir=self.tempdir,
179 c_verbose=self.build_verbose, c_real=self.c_datatype, pre_filter=self.pre_filter, post_filter=self.post_filter)
180 if self.max_homotopy_iter is not None:
181 modc.max_homotopy_iter = self.max_homotopy_iter
182 if self.solver_params is not None:
183 modc.solver_params = self.solver_params
184 self.c_module, self.sim_c = modc.get_executor()
185
186 def _check_input_amplitude(self):
187 if self.input_amplitude is None:
188 raise CircuitException("please define input_amplitude")
189
190 def calc_range(self, signal):
191 self._ensure_sim_c()
192 s = self.make_signal_vector(signal)
193 self.ptp = self.sim_c(s.input_signal).ptp()
194 pot_arr = numpy.array([[0., 1.]] * len(self.sim_c.pot_list))
195 if pot_arr.size:
196 self.minmax = numpy.append(pot_arr, self.sim_c.minmax, axis=0)
197 else:
198 self.minmax = self.sim_c.minmax
199 logger = logging.getLogger("range")
200 for i, r in enumerate(self.sim_c.minmax):
201 logger.debug("nonlin range %d: %g .. %g" % (i, r[0], r[1]))
202 #print self.ptp
203 #print repr(self.minmax)
204
205 def _ensure_range(self):
206 if self.minmax is None:
207 self._check_input_amplitude()
208 self.calc_range(self.sig(self.input_amplitude*self.sig.sweep()))
209
210 def _get_op(self):
211 if self.sim_py:
212 return self.sim_py.op
213 if self.sim_c:
214 return self.sim_c.op
215 else:
216 self._ensure_parser()
217 return self.parser.op
218
219 def _estimate_sensitivity(self, i_ptp, ii):
220 self._check_input_amplitude()
221 s = self.input_amplitude * self.sig.sweep()
222 pert = i_ptp * 1e-7 * self.sig.sine(freq=1000)
223 p = self.sig(sympy.Tuple(s, pert))
224 self.sim_c.reset()
225 ch = len(self._get_op()) + 1
226 signal = self.sig.generate(p, self.FS, channels=ch)
227 out_t = self.sim_c(signal.input_signal, ii)
228 max_pert = max(abs(signal.signal[:,-1]))
229 self.sim_c.reset()
230 signal = self.make_signal_vector(self.sig(s))
231 out_c = self.sim_c(signal.input_signal)
232 df = out_t-out_c
233 err = 2 * max(abs(df)) / out_c.ptp()
234 return err / max_pert
235
236 def _calc_ptp(self, idx):
237 self._ensure_sim_c()
238 self._ensure_range()
239 def calc(sgn):
240 def ff(p):
241 return -sgn * self.sim_c.nonlin_c(p[numpy.newaxis,:])[0,idx]
242 return -sgn * ff(opt.brute(ff, self.minmax, finish=None))
243 return calc(1) - calc(-1)
244
245 def _ensure_sensitivity(self):
246 if self.sensitivity is None:
247 self._ensure_sim_c()
248 self.sensitivity = [
249 self._estimate_sensitivity(self._calc_ptp(i), i) if self.basegrid[i] is not None else 1
250 for i in range(self.sim_c.nno)]
251 logger = logging.getLogger("approx")
252 logger.info("nonlin function sensitivity: %s"
253 % ", ".join(["%g" % v for v in self.sensitivity]))
254
255 def _ensure_max_error(self):
256 if self.E is None:
257 if not self.sim_c.nno:
258 self.E = []
259 return
260 self._ensure_sensitivity()
261 lim = self.grid_error_limit
262 if lim is None:
263 lim = 1e-2
264 self.E = [lim / self.sensitivity[i] for i in range(self.sim_c.nno)]
265
266 #self._ensure_eq()
267 #jacobi_estimate_error = 10#1e-1
268 #maxerr = 1e-4
269 #J, vals = simu.estimate_max_jacobi(self.sim_c.nonlin, self.minmax, jacobi_estimate_error,# self.sim_c.nno)
270 #J = J[:,J.shape[1]-J.shape[0]:] ##FIXME
271 #J = numpy.matrix(J)
272 #dv = numpy.amax(numpy.append(abs(self.eq.F), abs(self.eq.F)*J*abs(self.eq.G)*abs(self.eq.C), axis=0), axis=0).A1
273 #self.E = maxerr * self.ptp / numpy.where(dv == 0, 1e-20, dv)
274 #print "E =", self.E
275
276 #grd_shape = vals.grd.shape
277 #numpoints = numpy.product(grd_shape[1:])
278 #grd = vals.grd.reshape(grd_shape[0], numpoints)
279 #fnc = vals.values.reshape(self.eq.nonlin.nno, numpoints)
280 #self.cov = numpy.cov(grd, fnc)[:len(grd),len(grd):]
281 #print self.cov
282
283 def _ensure_basegrid(self):
284 if self.basegrid is None:
285 self._ensure_sim_c()
286 self.basegrid = [[[None,('s',4)]] * (self.sim_c.npl + self.sim_c.nni)] * self.sim_c.nno
287
288 def _ensure_knot_positions(self):
289 #if self.knot_positions is None:
290 # xx
291 pass
292
293 def _check_basegrid(self, basegrid, ns, nni, npl, nno):
294 if nno != len(basegrid):
295 error("basegrid needs %d rows (found %d)"
296 % (nno, len(basegrid)), "approx")
297 for i, row in enumerate(basegrid):
298 if row is None:
299 continue
300 if nni+npl != len(row):
301 if npl:
302 t = "%d parameters + %d inputs" % (nni, npl)
303 else:
304 t = "%d" % nni
305 error("basegrid[%d] has %d elements for function %s, input dimension: %s "
306 % (i, len(row), ns, t), "approx")
307
308 def _ensure_table_source(self):
309 if self.table_source is None:
310 if self.sim_c.nno == 0:
311 self.table_source = {}
312 self.maptype = None
313 return
314 self._ensure_eq()
315 o = StringIO()
316 inst = StringIO()
317 h = StringIO()
318 npl = self.sim_c.npl
319 tables = {}
320 i0v = self.sim_c.nonlin_c(numpy.append(numpy.matrix([0.5]*npl),self.sim_c.p0.T,axis=1))[0]
321 if len(self.sim_c.comp_sz) > 1:
322 for i, ((v_slice, p_slice, i_slice), ns) in enumerate(zip(self.sim_c.comp_sz, self.sim_c.comp_namespace)):
323 nni = p_slice.stop - p_slice.start
324 nno = i_slice.stop - i_slice.start
325 self._check_basegrid(self.basegrid[i_slice], ns, nni, npl, nno)
326 slc = range(npl) + range(p_slice.start+npl, p_slice.stop+npl)
327 class Comp:
328 comp_id = ns
329 comp_name = ns
330 ranges = self.minmax[slc]
331 basegrid = numpy.array([(g, None, None, e, True) for g, e in zip(self.basegrid, self.E)])[i_slice]
332 NVALS = nno
333 N_IN = nni+npl
334 NDIM = nni+npl
335 i0 = i0v[i_slice]
336 @staticmethod
337 def __call__(v, with_state):
338 return self.sim_c.c_calc_comp[i](v)
339 ##FIXME: maptype
340 self.maptype, spl = simu.TableGenerator.write_files(Comp(), o, inst, h)
341 tables[ns] = spl
342 else:
343 ns = "nonlin"
344 self._check_basegrid(self.basegrid, ns, self.eq.nonlin.nni, npl, self.eq.nonlin.nno)
345 class Comp:
346 comp_id = ns
347 comp_name = self._get_module_id()
348 ranges = self.minmax
349 basegrid = [(g, None, None, e, False) for g, e in zip(self.basegrid, self.E)]
350 NVALS = self.eq.nonlin.nno
351 N_IN = self.eq.nonlin.nni+npl
352 NDIM = self.eq.nonlin.nni+npl
353 i0 = i0v
354 @staticmethod
355 def __call__(v, with_state):
356 return self.sim_c.nonlin(v)
357 self.maptype, spl = simu.TableGenerator.write_files(Comp(), o, inst, h)
358 tables[ns] = spl
359 intpp_inst = "\n".join(set(inst.getvalue().split("\n")))
360 self.table_source = dict(data_c=o.getvalue(), data_h=h.getvalue(), intpp_inst=intpp_inst, tables=tables)
361
362 def _build_sim_table(self, dev_interface=True):
363 self._ensure_sim_c()
364 self.sim_c.reset()
365 self._ensure_range()
366 self._ensure_max_error()
367 self._ensure_basegrid()
368 self._ensure_knot_positions()
369 self._ensure_table_source()
370 name = self._get_module_id()
371 self._ensure_sim_py()
372 if self.solver is None:
373 solver = {}
374 else:
375 solver = self.solver.copy()
376 solver["method"] = "table"
377 modc = dk_simulator.BuildCModule(
378 name, self.sim_py, solver=solver,
379 extra_sources=self.table_source, c_tempdir="gencode",
380 c_verbose=self.build_verbose, c_real=self.table_datatype,
381 pre_filter=self.pre_filter, post_filter=self.post_filter,
382 generator=self.code_generator)
383 modc.dev_interface = dev_interface
384 modc.resample = self.resample
385 modc.build_script = self.build_script
386 if self.solver_params is not None:
387 modc.solver_params = self.solver_params
388 if self.plugindef:
389 modc.plugindef = self.plugindef
390 return modc
391
392 def _ensure_sim_table(self):
393 if self.sim_table is None:
394 self.table_module, self.sim_table = self._build_sim_table().get_executor()
395
396 def _get_sim(self):
397 if self.use_sim == SIM_C:
398 self._ensure_sim_c()
399 return self.sim_c
400 elif self.use_sim == SIM_TABLE:
401 self._ensure_sim_table()
402 return self.sim_table
403 else:
404 assert self.use_sim == SIM_PY
405 self._ensure_sim_py()
406 return self.sim_py
407
408 def _ensure_filter(self, symbolic):
409 self._ensure_parser(symbolic=symbolic, for_filter=True)
410 if len(self.parser.get_nonlin_funcs()) > 0:
411 if symbolic:
412 raise CircuitException("ciruit is nonlinear: symbolic formula generation not supported")
413 p = dk_simulator.Parser(self.S, self.V, self.FS, not self.backward_euler)
414 sim = dk_simulator.SimulatePy(dk_simulator.EquationSystem(p), self.solver, self.dc_method)
415 J = sim.jacobi()
416 else:
417 J = None
418 self.sim_filter = dk_simulator.LinearFilter(self.parser, J)
419
420 def _check_netlist(self):
421 if self.S is None:
422 raise CircuitException("no netlist loaded")
423
424 def _get_module_id(self, module_id=None):
425 if module_id is not None:
426 return module_id
427 if self.module_id is not None:
428 return self.module_id
429 if self.loaded_filename is not None:
430 return os.path.splitext(os.path.basename(self.loaded_filename))[0]
431 return "sim_module"
432
433 def _nodes_from_names(self, elements):
434 d = {}
435 elset = set()
436 for e in self.parser.element_name["N"]:
437 e = e[0]
438 elset.add(e)
439 d[str(e)] = e
440 l = []
441 for e in elements:
442 if e in d:
443 l.append(d[e])
444 elif e in elset:
445 l.append(e)
446 else:
447 raise CircuitException("%s unknown. nonlinear circuit elements: %s"
448 % (e, ", ".join(d.keys())))
449 return l
450
451 def _nonlin_function_list(self, elements):
452 elements = self._nodes_from_names(elements)
453 el = {}
454 if elements:
455 for i, e in enumerate(self.parser.element_name["N"]):
456 if e[0] in elements:
457 e = e[0]
458 if e not in el:
459 el[e] = []
460 el[e].append(i)
461 else:
462 for i, e in enumerate(self.parser.element_name["N"]):
463 e = e[0]
464 if e not in el:
465 el[e] = []
466 el[e].append(i)
467 return el
468
469 #
470 # user interface
471 #
472
473 def show_status(self):
474 if self.loaded_filename:
475 print "circuit loaded from: %s" % self.loaded_filename
476 if self.S:
477 print "circuit element count: %d" % len(self.S)
478 if self.module_id:
479 print "module id: %s" % self.module_id
480 if self.tempdir:
481 print "temp dir: %s" % self.tempdir
482 if self.tempdir_keep:
483 print "keep temp dir: %s" % self.tempdir_keep
484 if self.parser:
485 print "Parser: %s" % self.parser.get_status()
486 if self.eq:
487 print "EquationSystem: %s" % self.eq.get_status()
488 if self.sim_c:
489 print "C Executor: %s, %d" % (self.sim_c.soname, self.sim_c.nx)
490
491 def make_signal_vector(self, signal):
492 return self.sig.generate(signal, self.FS, self._get_op())
493
494 def print_netlist(self, values=False):
495 self._check_netlist()
496 for row in self.S:
497 print "%s: %s" % (row[0], ", ".join([str(v) for v in row[1:]]))
498 if values:
499 print
500 for e, v in sorted((str(e), v) for e, v in self.V.items()):
501 if isinstance(v, float):
502 v = eng_str(v)
503 print "%s = %s" % (e, v)
504
505 def read_gschem(self, filename, defs=None):
506 self._clear_all()
507 v = dict(vars(models))
508 v["Tubes"] = circ.Tubes
509 v["math"] = math
510 if defs:
511 v.update(defs)
512 exec mk_netlist.read_netlist(filename) in v
513 self.S = v["S"]
514 self.V = v["V"]
515 self.loaded_filename = filename
516
517 def read_netlist(self, filename):
518 self._clear_all()
519 v = vars(models)
520 v["Tubes"] = circ.Tubes
521 v["math"] = math
522 with open(filename) as f:
523 exec f in v
524 self.S = v["S"]
525 self.V = v["V"]
526 self.loaded_filename = filename
527
528 def set_netlist(self, S, V=None):
529 self._clear_all()
530 self.S = S
531 self.V = V
532
533 def set_tempdir(self, path):
534 self._remove_tempdir()
535 self.tempdir = path
536
537 def keep_tempdir(self, keep=True):
538 self.tempdir_keep = keep
539 self._remove_tempdir()
540
541 def set_use(self, use):
542 self.use_sim = use
543
544 def set_samplerate(self, fs):
545 self._clear_calculated()
546 self.parser = None
547 self.FS = fs
548
549 def set_float(self, use_float=True):
550 self.c_datatype = "float" if use_float else "double"
551
552 def set_solver(self, solver):
553 self.solver = generate_code.solver_set_defaults(solver)
554
555 def load_module(self, filename, clear_all=True):
556 sim_c = dk_simulator.SimulateC(filename)
557 if not clear_all and self.FS != sim_c.fs:
558 raise CircuitException("Samplerate mismatch: %d / %d" % (self.FS, sim_c.FS))
559 if clear_all:
560 self._clear_all()
561 self.FS = sim_c.fs
562 self.sim_c = sim_c
563
564 def set_module_id(self, module_id):
565 self.module_id = module_id
566
567 def set_in_nets(self, *connections):
568 self._check_netlist()
569 self.S = list(self.S)
570 l = (models.IN,) + tuple(connections)
571 for i, row in enumerate(self.S):
572 if row[0] == models.IN:
573 self.S[i] = l
574 break
575 else:
576 self.S.append(l)
577 self._clear_calculated()
578 if self.parser is not None:
579 self.parser.update(self.S, self.V)
580
581 def set_out_nets(self, *connections):
582 self._check_netlist()
583 self.S = list(self.S)
584 l = (models.OUT,) + tuple(connections)
585 for i, row in enumerate(self.S):
586 if row[0] == models.OUT:
587 self.S[i] = l
588 break
589 else:
590 self.S.append(l)
591 self._clear_calculated()
592 if self.parser is not None:
593 self.parser.update(self.S, self.V)
594
595 def add_element(self, element, connections, value):
596 self._check_netlist()
597 self.S = list(self.S) + [(element,)+tuple(connections)]
598 self.V[element] = value
599 self._clear_calculated()
600 if self.parser is not None:
601 self.parser.update(self.S, self.V)
602 return
603
604 def remove_element(self, element):
605 self._check_netlist()
606 self.S = list(self.S)
607 for i, row in enumerate(self.S):
608 if str(row[0]) == element:
609 del self.S[i]
610 self._clear_calculated()
611 if self.parser is not None:
612 self.parser.update(self.S, self.V)
613 return
614 raise CircuitException("%s not found int netlist" % element)
615
616 def remove_connected(self, net, exclude=None):
617 self._check_netlist()
618 if exclude is None:
619 exclude = {}
620 self.S = list(self.S)
621 comp = {net}
622 found = False
623 last_size = 0
624 def excluded_row(row):
625 for c in row[1:]:
626 if c in exclude and str(row[0]) in exclude[c]:
627 return True
628 return False
629 while len(comp) > last_size:
630 last_size = len(comp)
631 dl =[]
632 for i, row in enumerate(self.S):
633 for c in row[1:]:
634 if c in comp and not excluded_row(row):
635 comp |= set([j for j in row[1:] if j != models.GND])
636 dl.append(i)
637 found = True
638 break
639 for i in reversed(dl):
640 del self.S[i]
641 if not found:
642 raise CircuitException("net %s not found" % net)
643 self._clear_calculated()
644 if self.parser is not None:
645 self.parser.update(self.S, self.V)
646
647 def split_circuit(self, parts):
648 for block, (cuts, inputs, outputs) in parts.items():
649 c = Circuit(copy_from=self)
650 for net, els in cuts.items():
651 c.remove_connected(net, exclude=cuts)
652 if inputs:
653 c.set_in_nets(*[p[0] for p in inputs])
654 c.inputs = [p[1] for p in inputs]
655 if outputs:
656 c.set_out_nets(*[p[0] for p in outputs])
657 c.outputs = [p[1] for p in outputs]
658 self.subcircuits[block] = c
659
660 def join_net(self, net, target_net):
661 self._check_netlist()
662 l = []
663 found = False
664 for i, row in enumerate(self.S):
665 for j, c in enumerate(row[1:]):
666 if c == net:
667 l.append((i, j, c))
668 elif c == target_net:
669 found = True
670 if not found:
671 raise CircuitException("target_net %s not found" % target_net)
672 if not l:
673 raise CircuitException("net %s not found" % net)
674 S = list(self.S)
675 for i, j, c in l:
676 S[i] = list(S[i])
677 S[i][j+1] = target_net
678 self.S = S
679 self._clear_calculated()
680 if self.parser is not None:
681 self.parser.update(self.S, self.V)
682
683 def print_func_names(self):
684 self._ensure_parser()
685 print ", ".join(["%s:%s" % e for e in self.parser.element_name["N"]])
686
687 def get_dc_values(self):
688 self._ensure_dc_values()
689 return self.dc_values
690
691 def linearize(self, *elements, **kw):
692 check_keywords("linearize", kw, "keep_dc")
693 keep_dc = kw.get('keep_dc', len(elements) != 0)
694 self._ensure_parser()
695 el = self._nonlin_function_list(elements)
696 S = [tuple([models.NODES]+[v[1] for v in sorted([(v, k) for k, v in self.parser.nodes.items()])])]
697 V = dict(self.V)
698 for e in self.S:
699 if e[0] in el:
700 if isinstance(e[0], models.CC_N):
701 e = (models.CC_L(e[0].d),) + e[1:]
702 elif isinstance(e[0], (models.Trans_F, models.Trans_GC)):
703 #FIXME calculate R (Trans_L parameter)
704 e = (models.Trans_L(e[0].d),) + e[1:]
705 elif isinstance(e[0], models.OPA):
706 p = V[e[0]]
707 if isinstance(p, dict):
708 p = p["A"]
709 V[e[0]] = p
710 S.append(e)
711 self.S = S
712 self.parser.update(S, V)
713 self.eq = None
714 self.sim_py = None
715 self.dc_values = None
716 self._ensure_dc_values()
717 el = self._nonlin_function_list(elements)
718 J = self.sim_py.jacobi()
719 Jc = self.sim_py.calc_i(self.dc_values.v)
720 S = []
721 Nr = self.parser.N["Nr"]
722 Nl = self.parser.N["Nl"]
723 nodes = list(sorted(self.parser.nodes.keys(), key=lambda v: self.parser.nodes[v]))
724 def idx(a, v):
725 a = numpy.nonzero(numpy.ravel(a == v))[0]
726 if len(a) == 0:
727 return models.GND
728 else:
729 return nodes[int(a)]
730 for e in self.S:
731 if e[0] in el:
732 for i in el[e[0]]:
733 jl = J[i].nonzero()[1].A1
734 for j in jl:
735 v = models.VCCS(str(e) + "l%d%d" % (i, j))
736 S.append((v, idx(Nl[j], 1), idx(Nl[j], -1), idx(Nr[i], 1), idx(Nr[i], -1)))
737 dG = -J[i,j]
738 if keep_dc:
739 i0 = Jc[i]/len(jl) + dG*self.dc_values.v[j]
740 else:
741 i0 = 0
742 V[v] = dict(dG = dG, i0 = i0)
743 elif not keep_dc and isinstance(e[0], models.V):
744 V[e[0]] = 0
745 S.append(e)
746 else:
747 S.append(e)
748 self.S = S
749 self.V = V
750 self.parser.update(S, V)
751 self.eq = None
752 self.sim_py = None
753 self.dc_values = None
754
755 def print_filter_coeffs(self, symbolic=False, filename=None):
756 self._ensure_filter(symbolic=symbolic)
757 if filename is not None:
758 f = open(filename, "w")
759 else:
760 f = sys.stdout
761 b, a, terms = self.sim_filter.get_s_coeffs()
762 self.sim_filter.print_coeffs('b', b, f)
763 self.sim_filter.print_coeffs('a', a, f)
764 B, A, c = self.sim_filter.transform_bilinear(terms)
765 print >>f, "\nc = %s;" % c
766 self.sim_filter.print_coeffs('B', B, f)
767 self.sim_filter.print_coeffs('A', A, f)
768 if filename is not None:
769 f.close()
770
771 def save_faust_code(self, symbolic=False, filename=None):
772 self._ensure_filter(symbolic=symbolic)
773 b, a = self.sim_filter.get_z_coeffs(samplerate=self.FS)
774 l = self.parser.get_pot_attr()
775 m_id = self._get_module_id()
776 dsp, ui = simu.generate_faust_module(m_id, b, a, l, self.sim_filter)
777 ##FIXME where to save ui code?
778 if filename is None:
779 sys.stdout.write(dsp)
780 else:
781 with open(filename,"w") as f:
782 f.write(dsp)
783
784 def create_faust_module(self, module_id=None, symbolic=False, FS=None, pre_filter=None):
785 self._ensure_filter(symbolic=symbolic)
786 b, a = self.sim_filter.get_z_coeffs(samplerate=FS)
787 l = self.parser.get_pot_attr()
788 m_id = self._get_module_id(module_id)
789 plugindef = self.plugindef
790 if not plugindef:
791 plugindef = PluginDef(m_id)
792 simu.build_faust_module(plugindef, b, a, l, self.sim_filter, self.c_datatype, pre_filter, build_script=self.build_script)
793
794 def stream(self, signal, ii=-1):
795 if not isinstance(signal, signals.GeneratedSignal):
796 signal = self.make_signal_vector(signal)
797 sim = self._get_sim()
798 self.last_signal = signal
799 self.last_output = sim(signal.input_signal, ii)
800 return self.last_output
801
802 def plot(self, sig=None, label=None, clip=-80, nharmonics=8, spectrum=None, freq_range=None):
803 if sig is not None:
804 self.stream(sig)
805 if self.last_output is None:
806 raise CircuitException("nothing to plot")
807 lines = self.last_signal.plot(self.last_output, sig, label, clip, nharmonics, spectrum, freq_range)
808 #if label is None:
809 # label = self._get_sim().out_labels
810 #elif not hasattr(label, "__iter__"):
811 # l = []
812 # for lbl in self._get_sim().out_labels:
813 # l.append("%s.%s" % (label, lbl))
814 # label = l
815 Circuit.have_plot = True
816 return lines
817
818 def build_guitarix_module(self, include_paths=()):
819 modc = self._build_sim_table(dev_interface=False)
820 cw = modc.compile_c_func()
821 cw.script_dict["includes"] += "".join([" -I%s" % os.path.abspath(p) for p in include_paths])
822 cw.wrap_code(load_module=False)
823
824 def deploy(self, path=None):
825 sim = self._get_sim()
826 if sim is self.sim_py:
827 self._ensure_sim_c()
828 sim = self.sim_c
829 if is_test():
830 return
831 if sim is self.sim_table:
832 mod = self.table_module
833 s = "table"
834 else:
835 mod = self.c_module
836 s = "C"
837 if self.plugindef.lv2_plugin_type:
838 def try_mkdir(path):
839 try:
840 os.mkdir(path)
841 except OSError as e:
842 if e.errno != 17: # EEXIST
843 raise
844 vid = self.plugindef.lv2_versioned_id
845 if path is None:
846 path = os.path.expanduser("~/.lv2")
847 try_mkdir(path)
848 path = os.path.join(path, "gx_%s.lv2" % vid)
849 try_mkdir(path)
850 base = os.path.dirname(mod)
851 ttlname = os.path.join(base, vid+".ttl")
852 shutil.copy(ttlname, path)
853 shutil.copy(os.path.join(base, "manifest.ttl"), path)
854 fname = os.path.join(path, vid+".so")
855 s = "LV2 bundle [%s]" % s
856 shutil.copy(mod, fname)
857 print "LV2 bundle [%s module] copied to '%s'" % (s, path)
858 else:
859 if path is None:
860 path = os.path.expanduser("~/.config/guitarix/plugins/.")
861 fname = os.path.join(path, self._get_module_id()+".so")
862 shutil.copy(mod, fname)
863 print "%s module copied to '%s'" % (s, fname)
864
865 @staticmethod
866 def _get_samples(data, count):
867 return data[numpy.array(numpy.linspace(0, len(data)-1, count).round(), dtype=int)]
868
869 def check_result(self, sig, result, max_error=1e-7, count=None):
870 if not is_test():
871 return True
872 test = get_test()
873 if count is None:
874 if result is None:
875 count = 10
876 else:
877 count = len(result)
878 y = self.stream(sig)
879 samples = self._get_samples(y, count)
880 if test.plot:
881 timeline = self.last_signal.timeline
882 pylab.plot(timeline, y)
883 if result is not None:
884 pylab.plot(self._get_samples(timeline, count), result, "rx")
885 pylab.show()
886 if test.printout:
887 print repr(samples)
888 return True
889 error = numpy.max(abs(result - samples)) / numpy.max(abs(result))
890 if (error > max_error).any():
891 print "%s: Difference = %g (> %g)" % (self._get_module_id(), error, max_error)
892 return False
893 else:
894 print "%s: OK" % self._get_module_id()
895 return True
896
897 def set_pot_variable(self, name, val):
898 self._get_sim().set_variable(name, val)
899
900 def set_pot_position(self, name, val):
901 self._ensure_parser()
902 expr = dict([(row[0], row[4]) for row in self.parser.get_pot_attr()])[name]
903 self.set_pot_variable(name, expr(val))
904
905 def calc_nonlin_range(self, signal):
906 pass
907
908 def set_nonlin_range(self, idx, low=None, high=None):
909 pass
910
911 def estimate_max_jacobi(self, max_error):
912 pass
913
914 def set_max_jacobi(self, jacobi):
915 pass
916
917 def generate_table(self):
918 pass
919
920
921 def _create_funcs():
922 gcircuit = Circuit()
923 g = globals()
924 g['get_global_circuit'] = lambda: gcircuit
925 for v in dir(Circuit):
926 if not v.startswith("_"):
927 g[v] = getattr(gcircuit, v)
928 _create_funcs()
929
930 def show_plots(loc=None):
931 if Circuit.have_plot:
932 pylab.grid(which="both")
933 pylab.legend(loc=loc)
934 pylab.show()
935 Circuit.have_plot = False
936
937 INFO = logging.INFO
938 DEBUG = logging.DEBUG
939
940 def set_log_level(lvl, logger=None):
941 logging.getLogger(logger).setLevel(lvl)
942
943 class TestSettings:
944 active = False
945 plot = False
946 printout = False
947
948 _display_traceback = True #False
949 _testing = TestSettings
950
951 def is_test():
952 return _testing.active
953
954 def get_test():
955 return _testing
956
957 def display_traceback(v):
958 global _display_traceback
959 _display_traceback = v
960
961 def _init():
962 global _testing
963 def _catch_circuit_error(tp, value, traceback):
964 if tp == CircuitException:
965 if _display_traceback:
966 logging.getLogger(value.logger).error(value)
967 else:
968 print "ERROR:%s:%s" % (value.logger or "root", value)
969 return
970 if _excepthook is not None:
971 _excepthook(tp, value, traceback)
972
973 logging.basicConfig()
974 _excepthook = sys.excepthook
975 sys.excepthook = _catch_circuit_error
976 parser = argparse.ArgumentParser()
977 parser.add_argument('--test', action='store_true', help='check results of tests')
978 parser.add_argument('--test-plot', action='store_true', help='plot the test-data with markers')
979 parser.add_argument('--test-print', action='store_true', help='print the result array')
980 args = parser.parse_args()
981 _testing.active = args.test or args.test_plot or args.test_print
982 _testing.plot = args.test_plot
983 _testing.printout = args.test_print
984
985 _init()
0 # -*- coding: utf-8 -*-
1 from __future__ import division
2
3 import math
4 import pylab as pl
5 import numpy as np
6 from models import *
7 import dk_simulator, dk_lib
8 from numpy.fft import fftfreq
9
10 class Test(object):
11 FS = 96000
12 max_error = 1e-7
13 result_count = 10
14 timespan = 0.01
15 solver = None ## use default
16
17 def get_samples(self, data):
18 return data[np.array(np.linspace(0, len(data)-1, self.result_count).round(), dtype=int)]
19
20 def compare_data(self, data):
21 error = np.max(abs(self.result - self.get_samples(data))) / np.max(abs(data))
22 if (error > self.max_error).any():
23 return False, "Difference = %g (> %g)" % (error, self.max_error)
24 else:
25 return True, "OK"
26
27 def check_signal(self, p):
28 try:
29 y = p(self.signal())
30 except ValueError as v:
31 return False, v
32 else:
33 return self.compare_data(y)
34
35 def check(self, name, args):
36 parser = dk_simulator.Parser(self.S, self.V, self.FS, not args.backward_euler)
37 p = dk_simulator.get_executor(
38 name, parser, self.solver, args.pure_python, c_tempdir=args.c_tempdir,
39 c_verbose=args.c_verbose, c_debug_load=args.c_debug_load, linearize=args.linearize)
40 if args.print_result:
41 self.print_data(p(self.signal()), "\nresult = np.")
42 return ""
43 res = self.check_signal(p) # side-effect: calculate time_per_sample
44 if hasattr(p, "time_per_sample"):
45 s = " [%.2g]" % p.time_per_sample
46 else:
47 s = ""
48 return "%s%s" % (res[1], s)
49
50 def print_data(self, data, prefix=""):
51 print prefix + repr(self.get_samples(data))
52
53 def op_signal(self, op=None, samples=None, timespan=None):
54 if timespan is None:
55 timespan = self.timespan
56 if op is None:
57 op = self.V["OP"]
58 if samples is None:
59 samples = timespan*self.FS
60 return np.array((op,),dtype=np.float64).repeat(samples, axis=0)
61
62 def constant_signal(self, *values):
63 a = np.zeros((self.timespan*self.FS, len(values)))
64 for i, v in enumerate(values):
65 a[:,i] = v
66 return a
67
68 def sine_signal(self, freq, channels=1, timespan=None):
69 if timespan is None:
70 timespan = self.timespan
71 a = np.zeros((timespan*self.FS, channels))
72 s = np.sin(np.linspace(0, 2*np.pi*freq*timespan, self.FS*timespan))
73 for i in range(channels):
74 a[:,i] = s
75 return a
76
77 def timeline(self):
78 return np.linspace(0, self.timespan, self.timespan*self.FS)
79
80 def finish_plot(self, args, loc=None, timeline=None):
81 if timeline is not None:
82 pl.plot(self.get_samples(timeline), self.result, "rx")
83 pl.grid()
84 pl.legend(args, loc=loc)
85 pl.show()
86
87 def impulse(self, p, magnitude=1e-3):
88 a = self.op_signal(samples=64*1024, op=self.V.get("OP",[0.]))
89 a[0,0] += magnitude
90 return (p(a)-p.o0) / magnitude
91
92 def make_sweep(self, pre=None, span=0.5, post=0.1, magnitude=1e-2, start=20, stop=10000):
93 smpl = lambda tm: int(round(tm*self.FS))
94 if pre is None:
95 pre = span/2
96 s, d = dk_lib.genlogsweep(
97 start, stop, self.FS, smpl(pre), smpl(span), smpl(post))
98 s *= magnitude
99 n = dk_lib.pow2roundup(len(s))
100 #d /= np.mean(abs(np.fft.fft(dk_lib.fft_convolve(d, s), n))[n*start/self.FS:n*stop/self.FS])
101 #return s, d
102 return s
103
104 def sweep(self, p, pre=None, span=0.5, post=0.1, magnitude=1e-2, start=20, stop=10000):
105 #s, d = self.make_sweep(pre, span, post, magnitude, start, stop)
106 s = self.make_sweep(pre, span, post, magnitude, start, stop)
107 a = self.op_signal(samples=len(s), op=self.V.get("OP",[0.]))
108 a[:,0] += s
109 y = p(a)-p.o0
110 #return dk_lib.fft_convolve(d, y[:,0])
111 return dk_lib.fft_convolve(s, y[:,0], invert=True)
112
113 #spectrum_signal = impulse
114 spectrum_signal = sweep
115
116 def plot_spectrum(self, p, plot_variable):
117 y = self.spectrum_signal(p)
118 n = dk_lib.pow2roundup(len(y))
119 cut = slice(n*20.0/self.FS, n*10000.0/self.FS)
120 w = fftfreq(n,1.0/self.FS)[cut]
121 def spec(y):
122 s = 20*np.log10(abs(np.fft.fft(y,n,axis=0)[cut]))
123 return np.where(s > -80, s, np.nan)
124 pl.semilogx(w, spec(y))
125 self.finish_plot(p.out_labels)
126
127
128 class Pot_test(Test):
129
130 S = ((P(), GND, 1, 2),
131 (IN, 1),
132 (OUT, 2),
133 )
134 V = {P(): 100,
135 }
136
137 timespan = 0.001
138 result_count = 1
139 result = np.array([[5.]])
140
141 def signal(self):
142 return self.constant_signal(10)
143
144 def plot(self, p):
145 x = self.timeline()
146 y = p(self.signal())
147 pl.plot(x, y)
148 self.finish_plot(p.out_labels)
149
150
151 class Choke_test(Test):
152
153 Trans_ = Trans_GC
154 S = ((R(), "Vin", 1),
155 (Trans_(nw=1), 1, GND),
156 (IN, "Vin"),
157 (OUT, 1),
158 )
159
160 V = {R(): 100,
161 Trans_L(): dict(windings=[100], R = 358.),
162 Trans_F(): dict(windings=[100], b = 255., c = 358.),
163 Trans_GC(): dict(windings=[100], C = 3e-3, a = 5, o = 0, n = 7),
164 "OP": [0],
165 }
166
167 timespan = 0.1
168
169 result = np.array([[ 9.99982639e+00],
170 [ 9.63192390e+00],
171 [ 8.83713207e+00],
172 [ 4.81529457e+00],
173 [ 9.32319453e-01],
174 [ 1.15845534e-01],
175 [ 1.34415129e-02],
176 [ 1.54332593e-03],
177 [ 1.77387615e-04],
178 [ 2.03450473e-05]])
179
180 def signal(self):
181 return self.constant_signal(10)
182
183 def plot(self, p):
184 x = self.timeline()
185 y = p(self.signal())
186 pl.plot(x, y)
187 self.finish_plot(p.out_labels, timeline=x)
188
189
190 class Transformer_GC_test(Test): # transformer
191 Trans_ = Trans_GC
192 #Trans_ = Trans_L
193 #Trans_ = Trans_F
194 S = ((R("p1"), "Vin1", 1),
195 (R("p2"), "Vin2", 2),
196 (R("s"), 3, GND),
197 (Trans_(nw=3), 1, GND, GND, 2, 3, GND),
198 (IN, "Vin1", "Vin2"),
199 (OUT, Trans_()('phi',1e2), Trans_()('v'), Trans_()("W1")),
200 #(OUT, 3),
201 )
202 V = {R("p1"): 100,
203 R("p2"): 100,
204 R("s"): 1e3,
205 Trans_GC(): dict(windings=[100, 100, 100], C=2e-3, a=1e-5, o=0, n=25),
206 Trans_F(): dict(windings=[100, 100, 100], b = 255., c = 358.),
207 Trans_L(): dict(windings=[100, 100, 100], R = 358.),
208 }
209
210 result = np.array([
211 [ 0. , 0. , 0. ],
212 [ 0.3992909 , -0.00938712, -1.61537868],
213 [ 0.38494716, 0.08242046, -0.64855777],
214 [ 0.04203609, 1.36258321, 0.06707826],
215 [-0.3932343 , -0.04269338, 1.10292514],
216 [-0.20936599, -1.01472959, -0.04550217],
217 [ 0.3975867 , 0.02137891, -1.45104038],
218 [ 0.31854514, 0.55214928, 0.01398803],
219 [-0.3746337 , 1.22787577, 0.39689002],
220 [-0.36713395, -0.19608725, 0.19608725]])
221
222 freq = 40.
223 timespan = 2 / freq
224
225 def signal(self):
226 a = 165*self.sine_signal(self.freq, 2)
227 a[:,1] = -a[:,1]
228 return a
229
230 def plot(self, p):
231 x = self.timeline()
232 y = p(self.signal())
233 pl.plot(x, y)
234 self.finish_plot(p.out_labels, timeline=x)
235
236 def spectrum_signal(self, p):
237 if 0:
238 s, d = self.make_sweep()
239 a = self.op_signal(samples=len(s), op=self.V.get("OP",[0.,0.]))
240 a[:,0] += s
241 a[:,1] -= s
242 y = p(a)-p.o0
243 return dk_lib.fft_convolve(d, y)
244 else:
245 magnitude = 1e-3
246 a = self.op_signal(samples=64*1024, op=self.V.get("OP",[0.,0.]))
247 a[0,0] += magnitude
248 a[0,1] -= magnitude
249 return (p(a)-p.o0) / magnitude
250
251
252 class PushPullTransformer_test(Test): # 2 push-pull pentodes with transformer
253 #Trans_ = Trans_F
254 #Trans_ = Trans_L
255 Trans_ = Trans_GC
256 S = ((NODES, 1, 2, "Vps", 4, 5, "Vo", "Vin1", "Vin2"),
257 (Pentode(1), "Vin1", 1, 2, GND),
258 (Pentode(2), "Vin2", 4, 5, GND),
259 (R("s1"), 1, "Vps"),
260 (R("s2"), 4, "Vps"),
261 (R("L"), "Vo", GND),
262 (Trans_(nw=3), 2, "Vps", "Vps", 5, "Vo", GND),
263 (IN, "Vin1", "Vin2", "Vps"),
264 (OUT, Trans_()('phi',100), Trans_()('v'), Trans_()("W1"), Trans_()("W2")),
265 )
266
267 EL34 = dict(mu = 8.7,
268 Ex = 1.35,
269 Kp = 48.0,
270 Kvb = 12.0,
271 Kg1 = 1460.0,
272 Kg2 = 4500.0,
273 Gco = -0.2,
274 Gcf = 1e-5,
275 )
276
277 V = {Pentode(1): EL34,
278 Pentode(2): EL34,
279 R("s1"): 470,
280 R("s2"): 470,
281 R("L"): 8,
282 R(1): 100,
283 R(2): 100,
284 Trans_L(nw=3): dict(windings=[1000, 1000, 64], R=358),
285 Trans_GC(nw=3): dict(windings=[100.0, 100.0, 6.4], C=24e-3, a=900, o=0, n=7),
286 #Trans_GC(nw=3): dict(windings=[1000, 1000, 64], C=2e-3, a=1e-5, n=25),
287 Trans_F(nw=3): dict(windings=[1000, 1000, 64], b = 255., c = 358.),
288 "Vps": 394,
289 "OP": [-37., -37., 394.],
290 }
291
292 result = np.array([[ 6.65876850e-14, -5.33887551e-16, 5.15526850e-02,
293 -5.15526850e-02],
294 [ -1.56810408e+00, 1.14280615e-01, 4.69924498e-01,
295 -4.28187935e-05],
296 [ -1.37921862e+00, -7.20797506e-01, 1.62033720e-01,
297 -6.89921104e-03],
298 [ 5.51916398e-01, -3.82772153e+00, 1.14212528e-04,
299 -1.98699316e-01],
300 [ 1.48378173e+00, 4.35317909e-01, 6.88827024e-04,
301 -2.95292058e-01],
302 [ 1.51544857e-01, 3.75136569e+00, 1.92135627e-01,
303 -6.97176803e-04],
304 [ -1.54529256e+00, -2.35928614e-01, 4.07366368e-01,
305 -1.12968725e-04],
306 [ -8.02005162e-01, -2.97468382e+00, 6.98876783e-03,
307 -1.51762917e-01],
308 [ 1.57166756e+00, 2.26646240e-02, 4.27900722e-05,
309 -4.70255081e-01],
310 [ 1.19318722e+00, 1.40055656e+00, 5.09913605e-02,
311 -5.18198164e-02]])
312
313 freq = 30.
314 timespan = 2 / freq
315
316 def signal(self):
317 a = 50*self.sine_signal(self.freq, 3)
318 a[:,0] = a[:,0] + self.V["OP"][0]
319 a[:,1] = -a[:,1] + self.V["OP"][1]
320 a[:,2] = self.V["OP"][2]
321 return a
322
323 def plot(self, p):
324 x = self.timeline()
325 y = p(self.signal())
326 pl.plot(x, y)
327 self.finish_plot(p.out_labels, timeline=x)
328
329 def spectrum_signal(self, p):
330 if 0:
331 s, d = self.make_sweep()
332 a = self.op_signal(samples=len(s), op=self.V["OP"])
333 a[:,0] += s
334 a[:,1] -= s
335 y = p(a)-p.o0
336 return dk_lib.fft_convolve(d, y)
337 else:
338 magnitude = 1e-3
339 a = self.op_signal(samples=64*1024, op=self.V["OP"])
340 a[0,0] += magnitude
341 a[0,1] -= magnitude
342 return (p(a)-p.o0) / magnitude
343
344
345 class Resonator_test(Test): # LC-resonator
346 S = ((R(), "V0", "V1"),
347 (L(),"V0","V1"),
348 #(Trans_GC(nw=1), "V0", "V1"),
349 (C(),"V1",GND),
350 #(OUT, "V1",Trans_GC()("phi",1e6)),
351 (OUT, "V1"),
352 (IN, "V0"),
353 )
354
355 V = {L(): 1e-3,
356 C(): 1e-5,
357 R(): 1e+2,
358 Trans_GC(nw=1): dict(windings=[100], C = 1e-3/100**2, a = 5e-1, o = 0, n = 4),
359 "OP": [0],
360 }
361
362 result = np.array([[ 0. ],
363 [ 1.745916 ],
364 [ 1.01468553],
365 [-3.07344884],
366 [ 3.12017221],
367 [-3.56599345],
368 [ 4.03218786],
369 [-4.01662343],
370 [ 3.60790549],
371 [-2.8083471 ]])
372
373 timespan = 0.01
374
375 def signal(self):
376 res_freq = 1592
377 return self.sine_signal(res_freq-200)
378
379 def plot(self, p):
380 x = self.timeline()
381 y = p(self.signal())
382 pl.plot(x, y)
383 self.finish_plot(p.out_labels, timeline=x)
384
385
386 class Tonestack_test(Test):
387 S = ((R(4), 1, 2),
388 (C(1), 1, 3),
389 (C(2), 2, 4),
390 (C(3), 2, 5),
391 (P(3), GND, 6, 5),
392 (P(2), None, 6, 4),
393 (P(1), 4, 3, 7),
394 (IN, 1),
395 (OUT, 7),
396 )
397 V = {C(1): 0.25e-9,
398 C(2): 20e-9,
399 C(3): 20e-9,
400 P(1): dict(value=250e3, var='t'),
401 P(2): dict(value=1e6, var='l'),
402 P(3): dict(value=25e3, var='m'),
403 R(4): 56e3,
404 "POT": dict(l=0.5, m=0.5, t=0.5),
405 }
406
407 timespan = 0.01
408
409 def signal(self):
410 return self.sine_signal(400)
411
412 def plot(self, p):
413 x = self.timeline()
414 y = p(self.signal())
415 pl.plot(x, y)
416 self.finish_plot(p.out_labels)
417
418
419 class Diode_test(Test):
420 S = ((D(), "V+", GND),
421 (IN, "V+"),
422 (OUT, IN("V+")),
423 )
424 V = {D(): dict(Is=10e-12, mUt=30e-3),
425 }
426
427 result = np.array([[ -7.84771994e-09],
428 [ -4.30320159e-08],
429 [ -3.31279654e-07],
430 [ -1.81468620e-06],
431 [ -1.39675067e-05],
432 [ -7.65094713e-05],
433 [ -5.88885037e-04],
434 [ -3.22571938e-03],
435 [ -2.48280067e-02],
436 [ -1.35999688e-01]])
437
438 def signal(self):
439 self.sig = np.linspace(0.2, 0.7)
440 a = self.op_signal([0], samples=len(self.sig))
441 a[:,0] = self.sig
442 return a
443
444 def plot(self, p):
445 y = p(self.signal())
446 pl.semilogy(self.sig, -y)
447 pl.plot(self.get_samples(self.sig), -self.result, "rx")
448 self.finish_plot(p.out_labels)
449
450
451 class Diode_clipper(Test): # diode clipper
452 D_ = D2 # 2 antisymmetric diodes
453 #D_ = D # one diode
454 S = (#C(), 0, 1),
455 (R(1), 1, 2),
456 (D_(), 2, GND),
457 #(R(2), 2, GND),
458 (IN, 1),
459 (OUT, 1, IN(1), 2),
460 )
461
462 V = {R(): 100,
463 R(1): 0.1,
464 R(2): 1.,
465 D_(): dict(Is=10e-12, mUt=30e-3),
466 C(): 3e-7,
467 "OP": [0],
468 }
469
470 result = np.array([[ -1.20000000e+00, 3.98658844e+00, -8.01341156e-01],
471 [ -9.34673367e-01, 1.60606646e+00, -7.74066721e-01],
472 [ -6.69346734e-01, 4.24890680e-02, -6.65097827e-01],
473 [ -4.04020101e-01, 7.05959501e-06, -4.04019395e-01],
474 [ -1.38693467e-01, 1.01800915e-09, -1.38693467e-01],
475 [ 1.38693467e-01, -1.01800915e-09, 1.38693467e-01],
476 [ 4.04020101e-01, -7.05959501e-06, 4.04019395e-01],
477 [ 6.69346734e-01, -4.24890680e-02, 6.65097827e-01],
478 [ 9.34673367e-01, -1.60606646e+00, 7.74066721e-01],
479 [ 1.20000000e+00, -3.98658844e+00, 8.01341156e-01]])
480
481 def signal(self):
482 self.sig = np.linspace(-1.2, 1.2, 200)
483 a = self.op_signal([0], samples=len(self.sig))
484 a[:,0] = self.sig
485 return a
486
487 def plot(self, p):
488 y = p(self.signal())
489 pl.plot(self.sig, -y)
490 pl.plot(self.get_samples(self.sig), -self.result, "rx")
491 self.finish_plot(p.out_labels)
492
493
494 # class LFO_test(Test): # LFO, fail, finds wrong roots (c.f. Mačák thesis)
495
496 # S = ((R(1), "V1", "V2"),
497 # (C(1), "V2", "V3"),
498 # (R(2), "V3", "V4"),
499 # (R(3), "V4", "V1"),
500 # (OPA(1), GND, "V2", "V3"),# "Vee", "Vcc"),
501 # (OPA(2), "V4", GND, "V1"),# "Vee", "Vcc"),
502 # #(IN, "Vee", "Vcc"),
503 # (OUT, "V3"),
504 # )
505
506 # V = {R(1): 25e3,
507 # R(2): 33e3,
508 # R(3): 47e3,
509 # C(1): 5e-6,
510 # OPA(1): 1e5,
511 # OPA(2): 1e5,
512 # "OP": [],
513 # }
514
515 class LinOpAmp_test(Test): # linear inverting OPAMP
516
517 S = ((R(2), "V-", "Vout"),
518 (R(1), GND, "V-"),
519 (OPA(), "V+", "V-", "Vout"),
520 (OUT, "V-", "Vout"),
521 (IN, "V+"),
522 )
523
524 V = {OPA(): 1e5,
525 R(1): 1e3,
526 R(2): 1e3,
527 }
528
529 timespan = 0.02
530
531 result = np.array([[ 0.00000000e+00, 0.00000000e+00],
532 [ 6.37209653e-01, 1.27441931e+00],
533 [ 9.82196290e-01, 1.96439258e+00],
534 [ 8.60534149e-01, 1.72106830e+00],
535 [ 3.38606060e-01, 6.77212121e-01],
536 [ -3.38606060e-01, -6.77212121e-01],
537 [ -8.60534149e-01, -1.72106830e+00],
538 [ -9.82196290e-01, -1.96439258e+00],
539 [ -6.37209653e-01, -1.27441931e+00],
540 [ -2.44934259e-15, -4.89868517e-15]])
541
542 def signal(self):
543 return self.sine_signal(500)
544
545 def plot(self, p):
546 x = self.timeline()
547 y = p(self.signal())
548 pl.plot(x, y)
549 self.finish_plot(p.out_labels, timeline=x)
550
551
552 class InvOpAmp_test(Test): # inverting OPAMP
553 S = ((R(2), "V-", "Vout"),
554 (R(1), "Vin", "V-"),
555 (OPA(), GND, "V-", "Vout"),
556 (OUT, "Vin", "V-", "Vout"),
557 (IN, "Vin"),
558 )
559
560 V = {OPA(): dict(Vcc = 10, Vee = -10, A = 1e5),
561 R(1): 1e3,
562 R(2): 1e3,
563 }
564
565 timespan = 0.01
566
567 result = np.array([[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
568 [ -4.26797924e+00, -4.55963690e-05, 4.26788804e+00],
569 [ 7.67994044e+00, 1.01536941e-04, -7.67973737e+00],
570 [ -1.04572021e+01, -2.28601029e-01, 1.00000000e+01],
571 [ 1.18022106e+01, 9.01105283e-01, -1.00000000e+01],
572 [ -1.18022106e+01, -9.01105283e-01, 1.00000000e+01],
573 [ 1.04572021e+01, 2.28601029e-01, -1.00000000e+01],
574 [ -7.67994044e+00, -1.01536941e-04, 7.67973737e+00],
575 [ 4.26797924e+00, 4.55963690e-05, -4.26788804e+00],
576 [ -1.46957616e-14, -1.46954677e-19, 1.46954677e-14]])
577
578 def signal(self):
579 return 12*self.sine_signal(500)
580
581 def plot(self, p):
582 x = self.timeline()
583 y = p(self.signal())
584 pl.plot(x, y)
585 self.finish_plot(p.out_labels, timeline=x)
586
587 class WahWah_test(Test): # wah-wah
588 S = ((R(1), "V1", "V2"),
589 (C(1), "V2", "V3"),
590 (T(1), "V4", "V3", "V5"),
591 (R(4), "V4", "V6"),
592 (R(7), "V6", "V7"),
593 (C(4), "V4", "V8"),
594 (P(), GND, "V8", "V9"),
595 #(R("va"), "V8", "V9"),
596 #(R("vb"), "V9", GND),
597 (T(2), "V11", "V10", "V12"),
598 (C(5), "V9", "V10"),
599 (R(5), "V4", "V10"),
600 (R(10), "V13", "V11"),
601 (R(9), "V12", GND),
602 (C(3), "V7", "V12"),
603 (R(2), "V13", "V4"),
604 (R(3), "V5", GND),
605 (C(2), "V6", GND),
606 (R(8), "V6", GND),
607 (R(6), "V7", "V3"),
608 #(L(1), "V6", 7),
609 (Trans_GC(1, nw=1), "V6", 7),
610 #(Trans_L(1, nw=1), "V6", 7),
611 (R('L'), 7, "V7"),
612 (V(), "V13"),
613 (IN, "V1"),
614 (OUT, "V8"),
615 #(OUT, "V1","V2","V3","V4","V5","V6","V7","V8","V9","V10","V11","V12","V13"),
616 #(OUT, Trans_GC(1, nw=1)("W1"), Trans_GC(1, nw=1)("phi",1e3)),
617 #(OUT, "V4", "V6","V7"),
618 )
619
620 V = {R(1): 68e3,
621 R(2): 22e3,
622 R(3): 390,
623 R(4): 470e3,
624 R(5): 470e3,
625 R(6): 1.5e3,
626 R(7): 33e3,
627 R(8): 82e3,
628 R(9): 10e3,
629 R(10): 1e3,
630 P(): dict(value=100e3, a=5, inv=1, var='hotpotz', name='Wah'),
631 R("va"): 50e3,
632 R("vb"): 50e3,
633 C(1): 10e-9,
634 C(2): 4.7e-6,
635 C(3): 10e-9,
636 C(4): 220e-9,
637 C(5): 220e-9,
638 L(1): 500e-3,
639 R('L'): 60.,
640 # a = (4e-3/(0.5/100**2))**7
641 Trans_GC(1, nw=1): dict(windings=[100], C = 0.5/100**2, a = (8287.159*0.5/100)**7*100, o = 1e-3, n = 7),
642 Trans_L(1, nw=1): dict(windings=[100], R = 100**2/0.5),
643 T(1): dict(Vt=26e-3, Is=20.3e-15, Bf=1430, Br=4),
644 T(2): dict(Vt=26e-3, Is=20.3e-15, Bf=1430, Br=4),
645 V(): 8.15,
646 "OP": [0],
647 "POT": dict(Pv=0.5),
648 }
649
650 timespan = 0.02
651
652 def signal(self):
653 a = self.op_signal()
654 a[:,0] += 0.2*self.sine_signal(555.*1.2)[:,0]
655 #a[:,0] += 10*self.sine_signal(555.*1.02)[:,0]
656 return a
657
658 max_error = 5e-7 # presumable due to different numeric implementation of nonlinear vector function
659 result = np.array([[ -1.52955659e-09], # linear inductivity
660 [ -5.05823249e-01],
661 [ 6.48561512e-01],
662 [ -4.12448688e-01],
663 [ 3.39214923e-01],
664 [ -4.18385401e-01],
665 [ 3.80384337e-01],
666 [ -3.10358628e-01],
667 [ 2.61649974e-01],
668 [ -2.30510286e-01]])
669
670 result = np.array([[ 3.38299440e-09], # nonlinear inductivity
671 [ -5.05702356e-01],
672 [ 6.50565393e-01],
673 [ -4.16306149e-01],
674 [ 3.38903677e-01],
675 [ -4.17551679e-01],
676 [ 3.81734262e-01],
677 [ -3.11947188e-01],
678 [ 2.61606410e-01],
679 [ -2.30657192e-01]])
680
681 def plot(self, p):
682 x = self.timeline()
683 y = p(self.signal())
684 pl.plot(x, y)
685 self.finish_plot(p.out_labels, timeline=x)
686
687 def plot_spectrum(self, p, plot_variable):
688 varlist = []
689 if plot_variable:
690 if plot_variable not in p.pot_list:
691 raise ArgumentError("variable %s not found" % plot_variable)
692 ##hack
693 for k, t in self.V.items():
694 if isinstance(k, P):
695 if not isinstance(t, dict):
696 t = dict(value=t)
697 var = t.get('var')
698 if var is None:
699 var = str(k)+'v'
700 if var == plot_variable:
701 break
702 loga = t.get('a', 0)
703 inv = t.get('inv', 0)
704 for i in range(5):
705 pot = i/4
706 lbl = "%s" % pot
707 if inv:
708 pot = 1 - pot
709 if loga:
710 pot = (math.exp(loga * pot) - 1) / (math.exp(loga) - 1)
711 varlist.append((plot_variable, pot, lbl))
712 else:
713 varlist.append((None, None, p.out_labels))
714 n = None
715 cut = None
716 def spec(y):
717 s = 20*np.log10(abs(np.fft.fft(y,n,axis=0)[cut]))
718 return np.where(s > -80, s, np.nan)
719 labels = []
720 for var, val, lbl in varlist:
721 if var is not None:
722 p.set_variable(var, val)
723 y = self.spectrum_signal(p, magnitude=1e-4)
724 if n is None:
725 n = dk_lib.pow2roundup(len(y))
726 cut = slice(n*20.0/self.FS, n*10000.0/self.FS)
727 w = fftfreq(n,1.0/self.FS)[cut]
728 pl.semilogx(w, spec(y))
729 if isinstance(lbl, basestring):
730 labels.append(lbl)
731 else:
732 labels.extend(lbl)
733 self.finish_plot(labels, loc='upper left')
734
735
736 class WahWah_ss(WahWah_test): # wah-wah small signal model
737
738 result = np.array([ # RL = 0
739 [-7.06631563e-02, 3.63685251e-01, -7.61920610e-01, 8.24081826e-01, -4.77626993e-01, 1.36243627e-01, -1.37999458e-02],
740 [ 1.00000000e+00, -5.95793948e+00, 1.47953386e+01, -1.96017943e+01, 1.46127463e+01, -5.81176668e+00, 9.63415573e-01]])
741 result = np.array([ # RL = 60
742 [-7.06620964e-02, 3.63509088e-01, -7.61193126e-01, 8.22912278e-01, -4.76737510e-01, 1.35937831e-01, -1.37664640e-02],
743 [ 1.00000000e+00, -5.95545306e+00, 1.47829908e+01, -1.95772669e+01, 1.45883870e+01, -5.79967105e+00, 9.61013231e-01]])
744
745 def plot(self, p):
746 x = self.timeline()
747 y = p(self.signal())
748 pl.plot(x, y)
749 self.finish_plot(p.out_labels)
750
751 def check(self, name, args):
752 p = dk_simulator.Parser(self.S, self.V, self.FS, not args.backward_euler, create_filter=True, symbolic=False)
753 p1 = dk_simulator.Parser(self.S, self.V, self.FS, not args.backward_euler)
754 sim = dk_simulator.SimulatePy(dk_simulator.EquationSystem(p1), self.solver)
755 J = sim.jacobi()
756 f = dk_simulator.LinearFilter(p, J)
757 b, a = f.get_z_coeffs(samplerate=48000, subst_var=f.convert_variable_dict({}))
758 res = np.array([[float(v) for v in b],[float(v) for v in a]])
759 if np.allclose(res, self.result):
760 return "Ok"
761 else:
762 return "Fail"
763
764
765 class Transistor_test(Test): # transitor test
766 S = ((R(1), "Vcc", "Vc"),
767 (R(2), "Ve", GND),
768 (R(3), "Vi", "Vb"),
769 (T(1), "Vc", "Vb", "Ve"),
770 (IN, "Vi", "Vcc"),
771 (OUT, "Vi", "Vb", "Vc"),
772 )
773
774 V = {R(1): 22e3,
775 R(2): 3900,
776 R(3): 1e6,
777 T(1): dict(Vt=26e-3, Is=20.3e-15, Bf=1430, Br=4),
778 "OP": [1, 10],
779 "v0": [1, 1],
780 }
781
782 result = np.array([[ 0.00000000e+00, 5.07500000e-09, 1.00000000e+01],
783 [ 2.55102041e-01, 2.55101787e-01, 9.99999186e+00],
784 [ 5.61224490e-01, 5.54726496e-01, 9.79571591e+00],
785 [ 8.16326531e-01, 7.78051696e-01, 8.79671559e+00],
786 [ 1.12244898e+00, 1.04063290e+00, 7.42786606e+00],
787 [ 1.37755102e+00, 1.25843293e+00, 6.25516528e+00],
788 [ 1.68367347e+00, 1.51928439e+00, 4.83193585e+00],
789 [ 1.93877551e+00, 1.73642085e+00, 3.63837400e+00],
790 [ 2.24489796e+00, 1.99680450e+00, 2.20043766e+00],
791 [ 2.50000000e+00, 2.09652273e+00, 1.65153038e+00]])
792
793 def signal(self):
794 self.sig = np.linspace(0,2.5)
795 a = self.op_signal([0,10], len(self.sig))
796 a[:,0] += self.sig
797 return a
798
799 def plot(self, p):
800 y = p(self.signal())
801 pl.plot(self.sig, y)
802 self.finish_plot(p.out_labels, timeline=self.sig)
803
804
805 class Triode1_test(Test): # triode test
806 S = ((Triode(), "Vg", "Va", GND),
807 (IN, "Vg", "Va"),
808 (OUT, IN("Vg")),
809 )
810
811 V = {Triode(): dict(mu = 100.0, Ex = 1.4, Kp = 600.0, Kvb = 300.0, Kg1 = 1060.0, Gco = -0.2, Gcf = 1e-5),
812 "OP": [0, 200],
813 }
814
815 result = np.array([[ 0.00000000e+00],
816 [ -1.19744249e-05],
817 [ -3.38687882e-05],
818 [ -6.22209369e-05],
819 [ -9.57953991e-05],
820 [ -1.35707894e-04],
821 [ -1.77991025e-04],
822 [ -2.23933047e-04],
823 [ -2.73262818e-04],
824 [ -3.25761876e-04]])
825
826 def signal(self):
827 self.sig = np.linspace(-0.2, 10, 200)
828 a = self.op_signal(samples=len(self.sig))
829 a[:,0] += self.sig
830 return a
831
832 def plot(self, p):
833 y = p(self.signal())
834 pl.plot(self.sig, -y)
835 pl.plot(self.get_samples(self.sig), -self.result, "rx")
836 self.finish_plot(p.out_labels)
837
838 Tubes = {
839 "12ax7": dict(mu = 100.0, Ex = 1.4, Kp = 600.0, Kvb = 300.0, Kg1 = 1060.0, Gco = -0.2, Gcf = 1e-5),
840 "EL34": dict(mu = 8.7, Ex = 1.35, Kp = 48.0, Kvb = 12.0, Kg1 = 1460.0, Kg2 = 4500.0, Gco = -0.2, Gcf = 1e-5),
841 }
842
843 class Triode2_test(Test): # triode test 2
844 S = ((Triode(), "Vg", "Va", "Vk"),
845 (R("g"), "Vi", "Vg"),
846 (R("a"), "Va", "Vcc"),
847 (R("k"), "Vk", GND),
848 (IN, "Vi", "Vcc"),
849 (OUT, "Vi", "Vg", "Vk", Out("Va",5e-2)),
850 )
851
852 V = {Triode(): dict(mu = 100.0, Ex = 1.4, Kp = 600.0, Kvb = 300.0, Kg1 = 1060.0, Gco = -0.2, Gcf = 1e-5),
853 R("a"): 100e3,
854 R("k"): 1e3,
855 R("g"): 1e5,
856 "OP": [0, 200],
857 }
858
859 result = np.array([[ -3.50000000e+00, -3.50000000e+00, 7.72550710e-04,
860 9.99613725e+00],
861 [ -2.00753769e+00, -2.00753769e+00, 1.07424037e-01,
862 9.46287981e+00],
863 [ -5.15075377e-01, -5.15075377e-01, 5.57235813e-01,
864 7.21382094e+00],
865 [ 9.77386935e-01, 9.70474217e-01, 1.13418598e+00,
866 4.32941573e+00],
867 [ 2.46984925e+00, 1.96653045e+00, 1.53378538e+00,
868 2.35623905e+00],
869 [ 4.03015075e+00, 2.75954335e+00, 1.78642745e+00,
870 1.13139312e+00],
871 [ 5.52261307e+00, 3.35356923e+00, 1.87793631e+00,
872 7.18770664e-01],
873 [ 7.01507538e+00, 3.86821124e+00, 1.92078300e+00,
874 5.53428225e-01],
875 [ 8.50753769e+00, 4.33885772e+00, 1.94866325e+00,
876 4.65117726e-01],
877 [ 1.00000000e+01, 4.77961288e+00, 1.97029218e+00,
878 4.09558453e-01]])
879
880 def signal(self):
881 self.sig = np.linspace(-3.5, 10, 200)
882 a = self.op_signal(samples=len(self.sig))
883 a[:,0] += self.sig
884 return a
885
886 def plot(self, p):
887 y = p(self.signal())
888 pl.plot(self.sig, y)
889 self.finish_plot(p.out_labels, loc="upper center", timeline=self.sig)
890
891
892 class Preamp_test(Test):
893 S = ((P(6), GND, 8, 9),
894 #(R(61), 8, 9),
895 #(R(62), 9, GND),
896 (V('cc3'), 18),
897 (CC(2), 11, 13),
898 (V('cc2'), 12),
899 (Triode(2), 9, 11, 10),
900 (V('cc1'), 5),
901 (CC(1), 4, 6),
902 (R(71), 6, GND),
903 (R(72), 13, GND),
904 (Triode(3), 15, 17, 16),
905 (Triode(1), 2, 4, 3),
906 (C('m3'), 15, 17),
907 (C(7), 14, 15),
908 (C(6), 13, 14),
909 (C('m2'), 9, 11),
910 (C(5), 8, 9),
911 (C(4), 7, 8),
912 (C(3), 6, 7),
913 (C(2), 4, 3),
914 (C(1), 3, GND),
915 (C('m1'), 2, 4),
916 (R(12), 18, 17),
917 (R(11), 16, GND),
918 (R(10), 15, GND),
919 (R(9), 15, 14),
920 (R(7), 10, GND),
921 (R(8), 12, 11),
922 (R(5), 7, 8),
923 (R(4), 5, 4),
924 (R(3), 3, GND),
925 (R(2), 2, 1),
926 (R(1), 1, GND),
927 (OUT, Out(17,2.62e-3)),
928 (IN, 1),
929 )
930
931 V = {C('m1'): 2.e-12,
932 C('m2'): 2.e-12,
933 C('m3'): 2.e-12,
934 C(1): 680.e-9,
935 C(2): 100.e-12,
936 C(3): 22.e-9,
937 C(4): 470.e-12,
938 C(5): 1.e-9,
939 C(6): 22.e-9,
940 C(7): 470.e-12,
941 R(71): 1.e12,
942 R(72): 1.e12,
943 R(1): 1.e6,
944 R(10): 470.e3,
945 R(11): 820.,
946 R(12): 100.e3,
947 R(2): 68.e3,
948 R(3): 2.7e3,
949 R(4): 100.e3,
950 R(5): 470.e3,
951 R(7): 10.e3,
952 R(8): 100.e3,
953 R(9): 470.e3,
954 P(6): 1.e6,
955 R(61): 0.5e6,
956 R(62): 0.5e6,
957 Triode(1): Tubes['12ax7'],
958 Triode(2): Tubes['12ax7'],
959 Triode(3): Tubes['12ax7'],
960 V('cc1'): 385.,
961 V('cc2'): 385.,
962 V('cc3'): 385.,
963 }
964
965 result = 2.62e-3 * np.array(
966 [[ 221.71522314],
967 [ 171.55513962],
968 [ 384.87040955],
969 [ 87.6985932 ],
970 [ 175.15609089],
971 [ 384.87745145],
972 [ 88.35549583],
973 [ 176.31730901],
974 [ 384.87680835],
975 [ 88.18246137]])
976
977 timespan = 0.2
978
979 def signal(self):
980 return 0.15*self.sine_signal(150.0)
981
982 def plot(self, p):
983 x = self.timeline()
984 y = p(self.signal())
985 pl.plot(x, y)
986 self.finish_plot(p.out_labels, timeline=x)
0 import sympy as sp
1 import numpy as np
2
3 class VariableAccess(object):
4
5 def __init__(self, name, param, pointer):
6 if isinstance(name, (MatrixDefinition,MatrixDeclaration)):
7 self.name = name.name
8 self.pointer = name.pointer
9 else:
10 assert isinstance(name, basestring)
11 self.name = name
12 if pointer is None:
13 self.pointer = param
14 else:
15 self.pointer = pointer
16 self.param = param
17
18 @staticmethod
19 def _len(s):
20 if isinstance(s, slice):
21 return s.stop - s.start
22 return s[1] - s[0]
23
24 @staticmethod
25 def _start(s):
26 if isinstance(s, slice):
27 return s.start
28 return s[0]
29
30 def address_of(self):
31 if self.param:
32 if self.pointer:
33 return "par.%s" % self.name
34 else:
35 return "&par.%s" % self.name
36 else:
37 if self.pointer:
38 return self.name
39 else:
40 return "&%s" % self.name
41
42 def __str__(self):
43 if self.param:
44 if self.pointer:
45 return "(*par.%s)" % self.name
46 else:
47 return "par.%s" % self.name
48 else:
49 if self.pointer:
50 return "*%s" % self.name
51 else:
52 return self.name
53
54
55 class VectorAccess(VariableAccess):
56
57 def __init__(self, name, block=None, param=False, pointer=None):
58 VariableAccess.__init__(self, name, param, pointer)
59 self.block = block
60
61 @staticmethod
62 def block_expr(block):
63 start = VariableAccess._start(block)
64 if start == 0:
65 return ".head<%d>()" % VariableAccess._len(block)
66 else:
67 return ".segment<%d>(%d)" % (VariableAccess._len(block), start)
68
69 def __str__(self):
70 s = VariableAccess.__str__(self)
71 if self.block:
72 s += self.block_expr(self.block)
73 return s
74
75
76 class MatrixAccess(VariableAccess):
77
78 def __init__(self, name, block=None, param=False, pointer=None):
79 VariableAccess.__init__(self, name, param, pointer)
80 self.block = block
81
82 def __str__(self):
83 s = VariableAccess.__str__(self)
84 if self.block:
85 r = self.block[0]
86 c = self.block[1]
87 s += ".block<%d,%d>(%d,%d)" % (self._len(r), self._len(c), self._start(r), self._start(c))
88 return s
89
90
91 class MatrixDeclaration(object):
92
93 def __init__(self, name, rows, cols=1, mapping=False, pointer=False, aligned=True, array=False):
94 self.name = name
95 self.rows = rows
96 self.cols = cols
97 self.mapping = mapping
98 self.pointer = pointer
99 self.aligned = aligned
100 self.array = array
101
102 def generate(self, postfix=""):
103 n = self.name
104 if postfix:
105 n += postfix
106 if self.pointer:
107 n = "*" + n
108 m = "Matrix"
109 if self.array:
110 m = "Array"
111 attr = " "
112 if self.mapping:
113 if self.aligned:
114 attr = ", Aligned"
115 return "Map<%s<creal, %d, %d>%s>%s" % (m, self.rows, self.cols, attr, n)
116 else:
117 return "%s<creal, %d, %d> %s" % (m, self.rows, self.cols, n)
118
119 def generate_lines(self, indent=""):
120 return "%s%s;\n" % (indent, self.generate())
121
122 def __str__(self):
123 return self.generate()
124
125
126 class MatrixDefinition(object):
127
128 templ_def = "%(prefix)s%(tp)s<creal, %(rows)d, %(cols)d> %(definition)s;\n"
129
130 templ_data = "%(indent)sstatic const creal __attribute__((aligned(16))) %(data_name)s[%(rows)d*%(cols)d] = { %(data)s };\n"
131
132 templ_init = "%(prefix)s%(const)sMap<%(const)s%(tp)s<creal, %(rows)d, %(cols)d>%(attr)s> %(definition)s;\n"
133
134 def __init__(self, name, value=None, rows=None, cols=None, pointer=False, aligned=True, const=None, array=False):
135 if isinstance(name, VariableAccess):
136 name = name.name
137 try:
138 s = value.shape
139 if len(s) == 1:
140 s = (s[0], 1)
141 if rows is not None or cols is not None:
142 if s != (rows, cols):
143 raise ValueError("inconsistent shape for matrix %s: %s != %s" % (name, s, (rows, cols)))
144 rows, cols = s
145 if not isinstance(value, sp.Matrix):
146 value = sp.Matrix(value)
147 self.value_is_matrix = True
148 except AttributeError:
149 self.value_is_matrix = False
150 if rows is None or cols is None:
151 raise ValueError("rows and cols must be set or matrix value supplied")
152 self.name = name
153 self.value = value
154 self.rows = rows
155 self.cols = cols
156 self.pointer = pointer
157 self.aligned = aligned
158 self.const = const
159 self.array = array
160
161 def generate(self, indent=""):
162 l = []
163 n = self.name
164 tp = "Matrix"
165 if self.array:
166 tp = "Array"
167 if self.pointer:
168 n = "*" + n
169 if self.value is not None:
170 const = ""
171 if self.value_is_matrix:
172 aligned = True
173 if self.const is None or self.const:
174 const = "const "
175 static = "static "
176 data_name = self.name.lower() + "_data"
177 l.append(self.templ_data % dict(
178 indent = indent,
179 data_name = data_name,
180 tp = tp,
181 rows = self.rows,
182 cols = self.cols,
183 data = ",".join([sp.ccode(c) for c in self.value.T]), # col-major order is eigen3 default
184 ))
185 else:
186 aligned = self.aligned
187 if self.const:
188 const = "const "
189 static = ""
190 data_name = self.value
191 attr = " "
192 if self.aligned:
193 attr = ", Aligned"
194 l.append(self.templ_init % dict(
195 prefix = "%s%s" % (indent, static),
196 tp = tp,
197 rows = self.rows,
198 cols = self.cols,
199 attr = attr,
200 const = const,
201 definition = "%s(%s)" % (n, data_name),
202 ))
203 else:
204 l.append(self.templ_def % dict(
205 prefix = indent,
206 tp = tp,
207 rows = self.rows,
208 cols = self.cols,
209 definition = n,
210 ))
211 return "".join(l)
212
213 generate_lines = generate
214
215 def __str__(self):
216 return self.generate()
217
218
219 class Namespace(object):
220
221 def __init__(self, indent=""):
222 self.indent = indent
223 self.ns = {}
224 self.generated = set()
225
226 def add(self, m):
227 if m.name in self.ns:
228 mm = self.ns[m.name]
229 if m.rows != mm.rows or m.cols != mm.cols:
230 raise ValueError("inkonsistent definition of %s" % m)
231 return
232 self.ns[m.name] = m
233
234 def generate_lines(self):
235 l = []
236 for n, m in sorted(self.ns.items()):
237 if m in self.generated:
238 continue
239 l.append(m.generate_lines(self.indent))
240 self.generated.add(m)
241 return l
242
243 def __str__(self):
244 return "".join(self.generate_lines())
245
246
247 def expr_list_to_ccode(ret, ex, idx='[%d]', off=0):
248 """
249 ret: name of variable
250 ex: vector expression (iterable)
251 idx: syntax for index access
252 """
253 ret += idx
254 l = []
255 for i, ee in enumerate(ex):
256 l += [v+"\n" for v in sp.ccode(ee, ret % (i+off)).split("\n")]
257 return l
258
259 def make_symbol_vector(s, n, idx="[%d]"):
260 return sp.symbols(['%s%s' % (s, idx % i) for i in range(n)])
261
262 def matrix_is_zero(m):
263 return np.allclose(m, np.zeros_like(m))
264
265 def matrix_is_identity(m):
266 if m.shape[0] != m.shape[1]:
267 return False
268 return np.allclose(m, np.identity(m.shape[0]))
269
270 def join_with_indent(lines, indent=" "):
271 return "".join([l+indent for l in lines])
272
273 def gen_linear_combination(ns, resname, varname, mult, mult_data, add=None, add_data=None, cast=None):
274 if not isinstance(resname, VectorAccess):
275 resname = VectorAccess(resname)
276 if not isinstance(varname, VectorAccess):
277 varname = VectorAccess(varname)
278 if not isinstance(mult, MatrixAccess):
279 mult = MatrixAccess(mult)
280 if not isinstance(add, (VectorAccess,type(None))):
281 add = VectorAccess(add)
282 if mult_data.shape[0] == 0:
283 if add is None or add_data.shape[0] == 0:
284 return ""
285 else:
286 ns.add(MatrixDefinition(add, add_data))
287 e = "%s" % add
288 else:
289 if not matrix_is_identity(mult_data):
290 ns.add(MatrixDefinition(mult, mult_data))
291 e = "%s * %s" % (mult, varname)
292 else:
293 e = "%s" % varname
294 if add is not None and not matrix_is_zero(add_data):
295 ns.add(MatrixDefinition(add, add_data))
296 e += " + %s" % add
297 if cast is not None:
298 e = "(%s).cast<%s>()" % (e, cast)
299 return "%s = %s;" % (resname, e)
0 from __future__ import division
1 import contextlib, math, logging
2 import numpy as np
3 import numpy.core.arrayprint as npap
4
5 class CircuitException(Exception):
6 def __init__(self, msg, logger=None):
7 Exception.__init__(self, msg)
8 self.logger = logger
9
10 # http://stackoverflow.com/questions/2891790/pretty-printing-of-numpy-array
11 @contextlib.contextmanager
12 def printoptions(strip_zeros=True, **kwargs):
13 """Context manager to apply Numpy printoptions locally.
14
15 Example usage:
16 >>> x = np.array([0.078, 0.480, 0.413, 0.830, 0.776])
17 >>> with printoptions(precision=3, suppress=True, strip_zeros=False):
18 print(x)
19
20 """
21 origcall = npap.FloatFormat.__call__
22 def __call__(self, x, strip_zeros=strip_zeros):
23 return origcall.__call__(self, x, strip_zeros)
24 npap.FloatFormat.__call__ = __call__
25 original = np.get_printoptions()
26 np.set_printoptions(**kwargs)
27 yield
28 np.set_printoptions(**original)
29 npap.FloatFormat.__call__ = origcall
30
31 def pow2roundup(x):
32 "return smallest 2**Y which is >= x (with x < 2**32)"
33 if x <= 0:
34 return 0
35 x -= 1
36 x |= x >> 1;
37 x |= x >> 2;
38 x |= x >> 4;
39 x |= x >> 8;
40 x |= x >> 16;
41 return x+1;
42
43 def genlogsweep(fmin, fmax, rate, k0, k1, k2, dtype=np.float64):
44 """generate logarithmic sweep signal
45
46 fmin: start frequency
47 fmax: end frequency
48 rate: sample rate
49 k0: fade in before start of signal (samples)
50 k1: length of signal (samples)
51 k2: fade out after end of signal (samples)
52 dtype: data type of signal
53
54 returns: (logsweep signal, inverse logsweep signal)
55 """
56 s1 = np.empty(k0 + k1 + k2, dtype=dtype)
57 s2 = np.empty_like(s1)
58 b = math.log(fmax / fmin) / k1
59 a = fmin / (b * rate)
60 q0 = a * math.exp(-b * k0)
61 def sweep(t, g=None):
62 q = a * np.exp(b * t)
63 p = q - q0
64 x = np.sin(2 * np.pi * (p - np.floor(p)))
65 if g is not None:
66 x *= g
67 return x, x * q
68 if k0:
69 t = np.arange(-k0,0)
70 s1[:k0], s2[:k0] = sweep(t, np.cos(0.5 * np.pi * t / k0))
71 t = np.arange(k1)
72 s1[k0:k0+k1], s2[k0:k0+k1] = sweep(t)
73 if k2:
74 t = np.arange(k1,k1+k2)
75 s1[k0+k1:], s2[k0+k1:] = sweep(t, np.sin(0.5 * np.pi * (k1 + k2 - t) / k2))
76 s2 = s2[::-1] * 4 * b * b
77 return s1, s2, fmin, fmax, k1 / math.log(fmax / fmin)
78
79 def expchirp(fmin, fmax, rate, k0, k1, k2, dtype=np.float64):
80 nyq = rate / 2
81 if fmax <= fmin:
82 fmax = nyq
83 if k1 <= 0:
84 k1 = 1
85 p = np.ceil(np.log2(nyq / fmin)) + 1
86 #p1 = np.floor(np.log2(nyq / fmax))
87 p1 = 0
88 ep = 2 ** p
89 fmin = nyq / ep
90 fmax = nyq / (2 ** p1)
91 lep = np.log(ep)
92 L1 = 2 * ep * lep
93 L = np.ceil(k1 / L1) * L1
94 N = np.ceil(L)
95 NN = np.ceil(L - p1 * N / p)
96 epN = 2 ** (p/N)
97 n = np.arange(NN)
98 pp = L / L1 * epN**n
99 s = np.sin(2 * np.pi * pp)
100 #if k0:
101 # nn = int(round(N/p))
102 # s[:nn] = s[:nn] * np.hanning(2*nn)[:nn]
103 si = 2/N * lep * s[::-1] / epN**n
104 if p1:
105 si *= 2 ** -p1
106 return s, si, fmin, fmax, N / lep
107
108 def fft_convolve(h, xd, invert=False):
109 n = len(h) + len(xd) - 1
110 n2 = pow2roundup(n)
111 H = np.fft.rfft(h[2:], n2, axis=0)
112 XD = np.fft.rfft(xd, n2, axis=0)
113 if len(XD.shape) == 2 and len(H.shape) == 1:
114 H = H.reshape(len(H), 1)
115 if invert:
116 XD /= H
117 else:
118 XD *= H
119 s = np.fft.irfft(XD, n2, axis=0)
120 return s[:n]
121
122 def calc_grid(func, grd, nvals):
123 grd_shape = grd.shape
124 numpoints = np.product(grd_shape[1:])
125 grd = grd.reshape(grd_shape[0], numpoints)
126 fnc = func(grd.T).T
127 return fnc.reshape((nvals,)+grd_shape[1:])
128
129 def mkgrid(axeslist):
130 if len(axeslist) > 1:
131 grd = np.array(np.meshgrid(*axeslist, indexing='ij'))
132 else:
133 grd = np.empty((1, len(axeslist[0])))
134 grd[0] = axeslist[0]
135 return grd
136
137 def error(text, logger=None):
138 raise CircuitException(text, logger)
0 from __future__ import division
1 import numpy as np
2 import numpy.matlib as ml
3 import numpy.linalg as la
4 import scipy.linalg as sla
5 import scipy.optimize as opt
6 import scipy.signal as sig
7 import sympy as sp
8 import ctypes as ct
9 import slicot
10 import collections, warnings, tempfile, os, operator, sys, shutil, time
11 import commands, subprocess, math, re, logging
12
13 import dk_templates, generate_code
14 from models import GND, Out, Node
15 from dk_lib import printoptions
16
17 try:
18 opt.root
19 except AttributeError:
20 class RootResult(object):
21 def __init__(self, x, infodict, ier, mesg):
22 self.x = x
23 self.success = (ier == 1)
24 self.status = ier
25 self.message = mesg
26 def opt_root(fun, x0, args=(), method='hybr', jac=None, tol=None, callback=None, options=None):
27 factor = 100
28 if options:
29 factor = options.get("factor", factor)
30 return RootResult(*opt.fsolve(fun, x0, args, jac, full_output=True))
31 opt.root = opt_root
32
33 ################################################################
34 # bugfixes
35 #
36 from sympy.printing.ccode import CCodePrinter
37
38 def _print_Piecewise(self, expr):
39 # This method is called only for inline if constructs
40 # Top level piecewise is handled in doprint()
41 ecpairs = ["(%s) ? (%s) : " % (self._print(c), self._print(e)) \
42 for e, c in expr.args[:-1]]
43 last_line = ""
44 if expr.args[-1].cond == True:
45 last_line = "(%s)" % self._print(expr.args[-1].expr)
46 else:
47 ecpairs.append("(%s) ? (%s)" % \
48 (self._print(expr.args[-1].cond),
49 self._print(expr.args[-1].expr)))
50 return "(" + "".join(ecpairs) + last_line + ")"
51
52 CCodePrinter._print_Piecewise = _print_Piecewise
53 #
54 # end bugfixes
55 ################################################################
56
57 def pkgconfig(*packages, **kw):
58 flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}
59 for token in commands.getoutput("pkg-config --libs --cflags %s" % ' '.join(packages)).split():
60 kw.setdefault(flag_map.get(token[:2]), []).append(token[2:])
61 return kw
62
63 def matrix_add(*args):
64 l = [m for m in args if m.size]
65 if l:
66 return reduce(ml.add, l)
67 else:
68 return args[0]
69
70
71 class TransformOptions(object):
72
73 def __init__(self, **kw):
74 self._set(**kw)
75
76 def _set(self, partition=False, chain=False, svd_prec=None, decompose=False):
77 self.partition = partition
78 self.chain = chain
79 self.svd_prec = svd_prec
80 self.decompose = decompose
81
82 def copy(self, **kw):
83 t = TransformOptions()
84 t.__dict__.update(self.__dict__)
85 t._set(kw)
86 return t
87
88 @property
89 def svd_prec(self):
90 if self._svd_prec is None:
91 self._svd_prec = math.sqrt(sys.float_info.epsilon)
92 return self._svd_prec
93
94 @svd_prec.setter
95 def svd_prec(self, v):
96 self._svd_prec = v
97
98
99 class ConvergenceError(Exception): pass
100
101 class CodeWrapError(Exception): pass
102
103 class CodeWrapper(object):
104
105 _module_counter = 0
106
107 def __init__(self, d, code, tempdir=None, verbose=False, flags=[]):
108 self.code = code
109 if tempdir is not None:
110 tempdir = os.path.abspath(tempdir)
111 self.filepath = tempdir
112 self.flags = flags
113 self.quiet = not verbose
114 packages = ["eigen3"]
115 if d["method"] in ("hybr", "lm"):
116 packages.append('cminpack')
117 dct = pkgconfig(*packages)
118 libs = dct.get("libraries",[])
119 libs.append("m")
120 if d["resample"]:
121 libs.append("zita-resampler")
122 self.script_dict = dict(
123 includes = " ".join("-I%s" % v for v in dct.get("include_dirs",[])),
124 libraries = " ".join("-l%s" % v for v in set(libs)),
125 #defines = "-DCHECK_BOUNDS",
126 defines = "",
127 debug = False,
128 sourcename = "%s_%d.cpp" % (d["id"], CodeWrapper._module_counter),
129 soname = "%s_%d.so" % (d["id"], CodeWrapper._module_counter),
130 soname_ = "%s_%d_.so" % (d["id"], CodeWrapper._module_counter),
131 optimize = False,#(d["method"] == "table"),
132 )
133 self.build_script = "./build_script_%d" % CodeWrapper._module_counter
134
135 def _process_files(self, routine):
136 command = self.command
137 command.extend(self.flags)
138 null = open(os.devnull, 'w')
139 try:
140 if self.quiet:
141 retcode = subprocess.call(command, stdout=null, stderr=subprocess.STDOUT)
142 else:
143 retcode = subprocess.call(command)
144 except OSError:
145 retcode = 1
146 if retcode:
147 raise CodeWrapError(
148 "Error while executing command: %s" % " ".join(command))
149
150 @property
151 def command(self):
152 command = [self.build_script]
153 return command
154
155 def _prepare_files(self):
156 with open(self.build_script, 'w') as f:
157 print >> f, dk_templates.build_script_template.render(self.script_dict)
158 os.fchmod(f.fileno(), 0o777)
159
160
161 def _generate_code(self):
162 for fname, content in self.code.items():
163 if fname == "c_source":
164 fname = self.script_dict['sourcename']
165 with open(fname, 'w') as f:
166 f.write(content)
167
168 def wrap_code(self, load_module=True):
169 workdir = self.filepath or tempfile.mkdtemp("_dk_compile")
170 if not os.access(workdir, os.F_OK):
171 os.mkdir(workdir)
172 oldwork = os.getcwd()
173 os.chdir(workdir)
174 try:
175 self._generate_code()
176 self._prepare_files()
177 self._process_files(None)
178 path = os.path.join(workdir, self.script_dict["soname"])
179 if load_module:
180 return path, SimulateC(path)
181 else:
182 return path
183 finally:
184 CodeWrapper._module_counter +=1
185 os.chdir(oldwork)
186 if not self.filepath:
187 shutil.rmtree(workdir)
188
189
190 class LinearFilter(object):
191
192 def __init__(self, p, jacobi):
193 self.in_mat = p.N["I"]
194 self.out_mat = p.N["O"]
195 if self.in_mat.shape[0] != 1 or self.out_mat.shape[0] != 1:
196 raise ValueError("linear filter generation only implemented for circuits with one input and one output channel")
197 pot_func = p.get_pot_funcs()
198 Rv = sp.diag(*[1/(f * v) for (a, f), v in zip(pot_func, p.Pv)])
199 Nv = p.N["P"]
200 S = p.S + Nv.T * Rv * Nv
201 if jacobi is not None:
202 S -= p.N["Nr"].T * jacobi * p.N["Nl"]
203 self.S = S
204 ss = set()
205 self.syms = []
206 for a, f in pot_func:
207 if a not in ss:
208 self.syms.append(a)
209 ss.add(a)
210 self.subst_var_default = p.get_variable_defaults()
211
212 def get_s_coeffs(self):
213 s = sp.symbols("s")
214 expr = self.solve(self.S, self.in_mat, self.out_mat)
215 r = [sp.poly(e, s) for e in sp.fraction(expr)]
216 tc = r[1].TC()
217 for v in tc.atoms(sp.Symbol):
218 tc = tc.subs(v, 1)
219 b_coeffs, b_terms = self.collect_s_coeffs(sp.poly(r[0], s), 'b', tc)
220 a_coeffs, a_terms = self.collect_s_coeffs(sp.poly(r[1], s), 'a', tc)
221 if a_coeffs[0] == -1:
222 a_coeffs *= -1
223 b_coeffs *= -1
224 return b_coeffs, a_coeffs, b_terms / a_terms
225
226 def collect_s_coeffs(self, expr, prefix, tc):
227 s = sp.symbols("s")
228 monoms = expr.monoms()
229 max_degree = monoms[0][0]
230 filter_coeffs = np.zeros(max_degree+1, dtype=object)
231 ll = 0
232 for e, i in zip(expr.coeffs(), monoms):
233 i = i[0]
234 if self.syms:
235 # factorize according to variable symbols
236 x = sp.poly(e, self.syms)
237 ss = 0
238 for co, o in zip(x.coeffs(), x.monoms()):
239 ss += reduce(operator.mul, [pow(y, p) for y, p in zip(self.syms, o)], 1) * (co/tc).simplify()
240 else:
241 ss = e/tc
242 filter_coeffs[i] = ss
243 sym = "%s%d" % (prefix, i)
244 ll += sp.symbols(sym) * pow(s, i)
245 return filter_coeffs, ll
246
247 def transform_bilinear(self, expr):
248 s = sp.symbols("s")
249 fs = sp.symbols("fs")
250 c = sp.symbols("c")
251 z = sp.symbols("z")
252 b = c*(z-1)/(z+1)
253 r = [sp.poly(e, z) for e in sp.fraction(expr.subs(s, b).ratsimp())]
254 return self.collect_z_symbolic(r[0]), self.collect_z_symbolic(r[1]), 2 * fs
255
256 def collect_z_symbolic(self, expr):
257 c = sp.symbols("c")
258 monoms = expr.monoms()
259 max_degree = monoms[0][0]
260 filter_coeffs = np.zeros(max_degree+1, dtype=object)
261 for e, i in zip(expr.coeffs(), monoms):
262 idx = max_degree - i[0]
263 filter_coeffs[idx] = e
264 return filter_coeffs
265
266 def convert_variable_dict(self, subst_var):
267 d = self.subst_var_default.copy()
268 df = set(subst_var.keys()) - set([str(v) for v in d.keys()])
269 if df:
270 raise ValueError("unknown variable(s): %s" % ", ".join(df))
271 d.update(dict([(sp.symbols(k), v) for k, v in subst_var.items()]))
272 return d
273
274 def get_z_coeffs(self, samplerate=None, subst_var=None, as_expr=True):
275 if samplerate is None:
276 c = 2 * sp.symbols("fs")
277 else:
278 c = 2 * samplerate
279 z = sp.symbols("z")
280 b = c*(z-1)/(z+1)
281 expr = self.S.subs(sp.symbols("s"), b)
282 expr = self.solve(expr, self.in_mat, self.out_mat)
283 if subst_var is not None:
284 expr = expr.subs(subst_var)
285 syms = None
286 else:
287 syms = self.syms
288 # divide coeffs by magnitude of trailing denominator coefficient == a1 coefficient of filter
289 lc = sp.poly(sp.fraction(expr)[1], z).LC()
290 lc = lc.subs(self.subst_var_default)
291 if samplerate is None:
292 lc = lc.subs(sp.symbols("fs"), 48000.)
293 r = [sp.poly((e/lc).expand(), z) for e in sp.fraction(expr)]
294 return (self.collect_z_coeffs(r[0], 'b', syms, as_expr),
295 self.collect_z_coeffs(r[1], 'a', syms, as_expr))
296
297 def collect_z_coeffs(self, expr, prefix, syms, as_expr=True):
298 monoms = expr.monoms()
299 if as_expr:
300 max_degree = monoms[0][0]
301 filter_coeffs = np.zeros(max_degree+1, dtype=object)
302 else:
303 l = []
304 for e, i in zip(expr.coeffs(), monoms):
305 i = i[0]
306 if syms:
307 # factorize according to variable symbols
308 x = sp.poly(e.expand(), syms)
309 if not as_expr:
310 l.append(zip(x.monoms(), x.coeffs()))
311 else:
312 ss = 0
313 for co, o in zip(x.coeffs(), x.monoms()):
314 ss += reduce(operator.mul, [pow(y, p) for y, p in zip(syms, o)], 1) * co.evalf()
315 else:
316 if not as_expr:
317 l.append(((0,), e))
318 else:
319 ss = e.evalf()
320 if as_expr:
321 idx = max_degree-i
322 filter_coeffs[idx] = sp.horner(ss, wrt=(syms or [])+[sp.symbols("fs")])
323 if as_expr:
324 return filter_coeffs
325 else:
326 return l, syms
327
328 def coeffs_as_faust_code(self, prefix, coeffs):
329 l = []
330 for i, c in enumerate(coeffs):
331 c = re.sub(r'([a-zA-Z0-9]+)\*\*(\d+)', r'pow(\1,\2)', str(c))
332 l.append('%s%d = %s;' % (prefix, i, c))
333 return l
334
335 def print_coeffs(self, prefix, coeffs, f=sys.stdout):
336 print >>f, "\n\n".join(self.coeffs_as_faust_code(prefix, coeffs))
337
338 def spectrum(self, b, a, start_freq=20, stop_freq=10000, fs=48000, nbins=8*1024):
339 b = [float(x) for x in b]
340 a = [float(x) for x in a]
341 w, h = sig.freqz(b, a, nbins)
342 cut = slice(int(round(2 * nbins * start_freq / fs)), int(round(2 * nbins * stop_freq / fs)) + 1)
343 w = (w[cut] * (fs/(2*np.pi)))
344 h = 20*np.log10(abs(h[cut]))
345 return w, h
346
347 def solve(self, S, in_mat, out_mat):
348 v = sp.Matrix(sp.symbols("v:%d" % self.S.shape[0]))
349 try:
350 p = subprocess.Popen(("maxima","-b","/dev/fd/0","--very-quiet"),
351 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
352 stderr=subprocess.PIPE)
353 except OSError as e:
354 raise RuntimeError(
355 "can't start maxima -- please check maxima installation [%s]" % e)
356 out, expr = p.communicate(
357 "stringout(\"/dev/fd/2\",facsum(linsolve([%s], [%s])[%d], s));\n" % (
358 ", ".join(["%s = %s" % e for e in zip(S * v, in_mat)]),
359 ", ".join([str(sym) for sym in v]),
360 np.array(out_mat).nonzero()[1]+1,
361 ))
362 def maxima_error(s):
363 print out
364 print "----"
365 print "Truncated output: " + expr[:100] + "..."
366 raise ValueError(s)
367 syms = set()
368 for i in S:
369 syms |= i.atoms(sp.Symbol)
370 e = expr.split("=",1)
371 if len(e) != 2:
372 maxima_error("unexpected output from maxima")
373 e = e[1].rstrip(";\n").replace("^","**")
374 try:
375 return eval(e, dict([(str(sym),sym) for sym in syms]))
376 except Exception as ex:
377 maxima_error("can't eval maxima output [%s]" % ex)
378
379 def get_state_transform_trace(A, B, C):
380 "return the trace of the gram matrices (sensitivity measure)"
381 Wc = ml.matrix(sla.solve_discrete_lyapunov(A.A, (B*B.T).A))
382 Wo = ml.matrix(sla.solve_discrete_lyapunov(A.T.A, (C.T*C).A))
383 #R = ml.matrix(sla.cholesky(Wo, lower=False))
384 #X = R * Wc * R.T
385 #U, s, V = sla.svd(X)
386 #U = ml.matrix(U)
387 #V = ml.matrix(V)
388 #lli = np.sqrt(np.sqrt(s))
389 #U = R.I * V.T * ml.diag(lli)
390 #Ui = ml.diag(1/lli) * V * R
391 #return U, Ui
392 return np.trace(Wc), np.trace(Wo)
393
394 def get_state_transform(A, B, C, tol=0):
395 "calculate balanced reduced state space model realization"
396 # balance matrices
397 A, B, C, maxred, scale = slicot.tb01id('A', A, B, C)
398 # transform to schur form
399 A, B, C, U, WR, WI = slicot.tb01wd(A, B, C)
400 # reduce and balance
401 T, Ti, A, B, C, hsv = slicot.ab09ax('D', 'B', A, B, C, tol=tol)
402 # return transformation matrix (+ inverse) and hankel singular values
403 return (np.matrix(np.diag(scale).dot(U).dot(T)),
404 np.matrix(Ti.dot(U.T).dot(np.diag(1/scale))),
405 hsv)
406
407
408 class NonlinEquations(object):
409
410 def __init__(self, eq, v_slice):
411 self.eq = eq
412 self.v_slice = v_slice
413 self.p_slice = v_slice
414 self.i_slice = v_slice
415 self.nn = self.v_slice.stop - self.v_slice.start
416 self.nni = self.nn
417 self.nno = self.nn
418 self.U = self.Mi = ml.matrix(np.identity(self.nn))
419 self.Hc = ml.zeros((self.nn, 1))
420 self.pins = eq.nlin_elements[v_slice]
421 self.name = "%s:%d" % (Parser.format_element(np.sort(self.pins, axis=0)[0]), self.nn)
422 self.subblocks = []
423
424 @staticmethod
425 def create(eq, K, CZ, v_slice, opts):
426 "return a Permution and an instance of NonlinEquations or derived"
427 Pn = np.arange(len(CZ))
428 # permute nonlinear part to make left upper submatrix of K blockdiagonal
429 p, blocklist = NonlinEquations.get_block_indices(K[v_slice][:,v_slice], CZ[v_slice])
430 if len(blocklist) > 1:
431 Pn[v_slice] = p
432 K = K[Pn][:,Pn]
433 CZ = CZ[Pn]
434 if opts.partition and len(blocklist) > 1:
435 nlin = PartitionedNonlinEquations(eq, v_slice)
436 Pn = Pn[nlin.create(eq, K, CZ, blocklist, opts)]
437 return Pn, nlin
438 # permute the system if there is more than one strongly connected component
439 p, blocklist = NonlinEquations.find_scc(K[v_slice][:,v_slice], eq.get_parser())
440 if opts.chain and len(blocklist) > 1:
441 Pn[v_slice] = p
442 K = K[Pn][:,Pn]
443 CZ = CZ[Pn]
444 nlin = ChainedNonlinEquations(eq, v_slice)
445 Pn = Pn[nlin.create(eq, K, CZ, blocklist, opts)]
446 return Pn, nlin
447 return np.arange(len(CZ)), NonlinEquations(eq, v_slice)
448
449 @staticmethod
450 def rebase_nonlinear_functions(f, Pn):
451 Pni = np.argsort(Pn) # inverse permutation
452 a = np.zeros(len(f), dtype=object)
453 for j, (expr, vl, base) in enumerate(f[Pn]):
454 a[j] = (expr, vl, Pni[base])
455 return a
456
457 @staticmethod
458 def get_unique_rows(a):
459 """returns unique rows of a 2-dim array
460 """
461 if not a.size:
462 return a
463 order = np.lexsort(a.T)
464 a = a[order]
465 diff = np.diff(a, axis=0)
466 ui = np.ones(len(a), dtype=bool)
467 ui[1:] = (diff != 0).any(axis=1)
468 return a[ui]
469
470 @staticmethod
471 def get_blockdiag_permutation(B):
472 """returns the permuted index list to transform B to block diagonal form
473
474 B: quadratic (sparse) matrix
475 returns: index permutation (p), block indexlist (bl)
476
477 To get the block diagonal matrix A:
478 A = B[p][:,p]
479
480 Permutation matrix:
481 Q = matrix(eye(len(p)))[p]
482 A = Q * B * Q.T
483
484 To permute a list of row or column labels with the matrix:
485 labels_for_A = [labels_for_B[i] for i in p]
486
487 To get the ith block matrix:
488 r = slice(bl[i], bl[i+1])
489 A[r,r]
490 """
491 B = ml.matrix(B, bool)
492 G = B.T * B
493 while True:
494 G1 = G * G
495 if (G1 == G).all():
496 break
497 G = G1
498 n = B.shape[0]
499 p = []
500 bl = [0]
501 for row in NonlinEquations.get_unique_rows(G.A):
502 i = np.nonzero(row)[0]
503 if len(i):
504 p.extend(i)
505 bl.append(len(p))
506 if len(p) != B.shape[0]:
507 p.extend(set(range(B.shape[0])) - set(p))
508 return p, bl
509
510 @staticmethod
511 def get_block_indices(K, CZ):
512 "returns a permutation and a list of component slices"
513 nz = len(CZ)
514 n = np.count_nonzero(CZ)
515 if n != nz:
516 pc = np.argsort(CZ == 0)
517 K = K[pc][:,pc][:n,:n]
518 p, bl = NonlinEquations.get_blockdiag_permutation(K)
519 if n != nz:
520 p = np.array(pc)[p+range(n, nz)]
521 return p, [slice(i,j) for i, j in zip(bl[:-1], bl[1:])]
522
523 @staticmethod
524 def decompose(a):
525 U, s, V = la.svd(a, full_matrices=False)
526 o = np.sqrt(np.sum(s*s) / np.count_nonzero(s))
527 sr = np.where(s, s, o)
528 V1 = ml.diag(sr) * V
529 V1i = (ml.diag(1/sr) * V).T
530 U1 = U * np.diag(np.where(s, 1, 0))
531 if (U1 <= 0).all():
532 U1 = -U1
533 V1 = -V1
534 V1i = -V1i
535 return U1, V1, V1i
536
537 @staticmethod
538 def find_scc(K, parser):
539 from scipy.sparse import csr_matrix
540 from scipy.sparse.csgraph import connected_components
541 n, label = connected_components(csr_matrix(K), connection="strong")
542 V = np.zeros(n)
543 L = [[] for i in range(n)]
544 for i, l in enumerate(L):
545 col = K[:,label==i]
546 for j in range(n):
547 if i != j and col[label==j].any():
548 l.append(j)
549 V[j] += 1
550 p = []
551 l = []
552 N = np.arange(len(K))
553 while True:
554 idx = np.argwhere(V == 0)
555 if not idx.size:
556 break
557 V[idx] -= 1
558 for i in idx:
559 pi = N[label==i]
560 j = len(p)
561 l.append(slice(j, j+len(pi)))
562 p.extend(pi)
563 V[L[i]] -= 1
564 return p, l
565
566 def make_input_trans(self, matrix_list, opts):
567 if self.eq.np or opts.svd_prec < 0:
568 return matrix_list
569 # find number of linear independent inputs to the nonlinear function
570 M = np.concatenate(matrix_list, axis=1)
571 if not M.size:
572 return matrix_list
573 U, SV, V = la.svd(M, full_matrices=False)
574 if SV[0] != 0:
575 SV = np.where(SV / SV[0] > opts.svd_prec, SV, 0)
576 nni = np.count_nonzero(SV)
577 if nni == self.nn:
578 return matrix_list
579 U = U[:,:nni]
580 UH = U.H
581 self.U = U
582 self.nni = nni
583 self.p_slice = slice(self.p_slice.start, self.p_slice.start+nni)
584 return [UH * m for m in matrix_list]
585
586 def make_output_trans(self, matrix_list, opts):
587 if self.nn == 0 or self.eq.np != 0 or opts.svd_prec < 0:
588 return matrix_list
589 # find number of linear independent outputs of the nonlinear function
590 M = np.concatenate(matrix_list, axis=0)
591 U, SV, V = la.svd(M, full_matrices=False)
592 if SV[0] != 0:
593 SV = np.where(SV / SV[0] > opts.svd_prec, SV, 0)
594 n = np.count_nonzero(SV)
595 if n < self.nn and n < self.eq.nx + self.eq.no:
596 self.nno = n
597 self.Mi = (np.diag(SV) * V)[:n]
598 s = np.cumsum([0]+[m.shape[0] for m in matrix_list])
599 matrix_list = [U[slice(*sl),:n] for sl in zip(s[:-1],s[1:])]
600 elif self.eq.nx + self.eq.no < self.nn:
601 self.nno = self.eq.nx + self.eq.no
602 self.Mi = M
603 M = np.eye(self.nno, self.nno)
604 s = np.cumsum([0]+[m.shape[0] for m in matrix_list])
605 matrix_list = [M[slice(*sl)] for sl in zip(s[:-1],s[1:])]
606 self.i_slice = slice(self.i_slice.start, self.i_slice.start+self.nno)
607 return matrix_list
608
609 def transform_p0(self, p0, K, v0):
610 return p0
611
612
613 class ChainedNonlinEquations(NonlinEquations):
614
615 def create(self, eq, K, CZ, blocklist, opts):
616 self.subblocks = []
617 Pn = np.arange(len(K))
618 for sl in blocklist:
619 p, nlin = NonlinEquations.create(eq, K, CZ, sl, opts.copy(partition=False))
620 self.subblocks.append(nlin)
621 Pn = Pn[p]
622 return Pn
623
624 def make_input_trans(self, matrix_list, opts):
625 if opts.svd_prec < 0:
626 return matrix_list
627 i = self.subblocks[0].p_slice.start
628 j = self.subblocks[-1].p_slice.stop
629 ll = [[] for m in matrix_list]
630 if i:
631 for l, m in zip(ll, matrix_list):
632 l.append(m[0:i])
633 for bl in self.subblocks:
634 r = bl.make_input_trans([m[bl.p_slice] for m in matrix_list], opts)
635 for l, m in zip(ll, r):
636 l.append(m)
637 for l, m in zip(ll, matrix_list):
638 if j < m.shape[0]:
639 l.append(m[j:])
640 return [np.concatenate(l, axis=0) for l in ll]
641
642 def make_output_trans(self, matrix_list, opts):
643 if opts.svd_prec < 0:
644 return matrix_list
645 F, C = matrix_list ##FIXME
646 i = self.subblocks[0].i_slice.start
647 j = self.subblocks[-1].i_slice.stop
648 l_F = []
649 l_C = []
650 if i:
651 l_F.append(F[:,0:i])
652 l_C.append(C[:,0:i])
653 for bl in self.subblocks:
654 Fs, Cs = bl.make_output_trans((F[:,bl.i_slice], C[:,bl.i_slice]), opts)
655 l_F.append(Fs)
656 l_C.append(Cs)
657 if j < F.shape[0]:
658 l_F.append(F[:,j:])
659 l_C.append(C[:,j:])
660 return np.concatenate(l_F, axis=1), np.concatenate(l_C, axis=1)
661
662
663 class PartitionedNonlinEquations(NonlinEquations):
664
665 def create(self, eq, K, CZ, blocklist, opts):
666 self.cc_slice = slice(blocklist[-1].stop, self.v_slice.stop)
667 self.subblocks = []
668 Pn = np.arange(len(K))
669 for sl in blocklist:
670 p, nlin = NonlinEquations.create(eq, K, CZ, sl, opts.copy(chain=False))
671 self.subblocks.append(nlin)
672 Pn = Pn[p]
673 return Pn
674
675 def transform_p0(self, p0, K, v0):
676 endv = self.cc_slice.start
677 endp = self.p_slice.stop - (self.cc_slice.stop - self.cc_slice.start)
678 p = p0.copy()
679 p[:endp] = (p0 + self.Hc)[:endp] + self.Ku * np.matrix(v0[endv:]).T
680 return p
681
682 def make_input_trans(self, matrix_list, opts):
683 if opts.svd_prec < 0:
684 Ku = [self.eq.K[bl.p_slice,self.cc_slice] for bl in self.subblocks]
685 self.Ku = np.concatenate(Ku, axis=0)
686 return matrix_list
687 l = []
688 j = 0
689 Ku = []
690 for bl in self.subblocks:
691 mlist = [m[bl.p_slice] for m in matrix_list]
692 mlist.append(self.eq.K[bl.p_slice,self.cc_slice])
693 bl.Hc = self.Hc[bl.p_slice]
694 mlist = bl.make_input_trans(mlist, opts)
695 bl.p_slice = slice(j, bl.p_slice.stop - (bl.p_slice.start - j))
696 j = bl.p_slice.stop
697 l.append(mlist[:-1])
698 Ku.append(mlist[-1])
699 self.Ku = np.concatenate(Ku, axis=0)
700 Hc = self.Hc[self.cc_slice]
701 l.append([m[self.cc_slice] for m in matrix_list])
702 n_old = self.p_slice.stop - self.p_slice.start
703 cc = self.cc_slice.stop - self.cc_slice.start
704 self.p_slice = slice(self.p_slice.start, j+cc)
705 self.nni = self.p_slice.stop - self.p_slice.start
706 self.Hc = ml.zeros((self.nni, 1))
707 self.Hc[j:] = Hc
708 self.U = ml.eye(n_old, self.nni, self.nni-n_old)
709 j = 0
710 for bl in self.subblocks:
711 self.U[j:j+bl.U.shape[0],bl.p_slice] = bl.U
712 j += bl.U.shape[0]
713 return [np.concatenate(m, axis=0) for m in zip(*l)]
714
715 def make_output_trans(self, matrix_list, opts):
716 if opts.svd_prec < 0:
717 Kl = [self.eq.K[self.cc_slice, bl.i_slice] for bl in self.subblocks]
718 Kl.append(self.eq.K[self.cc_slice, self.cc_slice])
719 self.Kl = np.concatenate(Kl, axis=1)
720 return matrix_list
721 l = []
722 j = 0
723 Kl = []
724 for bl in self.subblocks:
725 mlist = [m[:,bl.i_slice] for m in matrix_list]
726 mlist.append(self.eq.K[self.cc_slice, bl.i_slice])
727 mlist = bl.make_output_trans(mlist, opts)
728 bl.i_slice = slice(j, bl.i_slice.stop - (bl.i_slice.start - j))
729 j = bl.i_slice.stop
730 l.append(mlist[:-1])
731 Kl.append(mlist[-1])
732 Kl.append(self.eq.K[self.cc_slice, self.cc_slice])
733 self.Kl = np.concatenate(Kl, axis=1)
734 l.append([m[:,self.cc_slice] for m in matrix_list])
735 n_old = self.i_slice.stop - self.i_slice.start
736 cc = self.cc_slice.stop - self.cc_slice.start
737 self.i_slice = slice(self.i_slice.start, j+cc)
738 self.nno = self.i_slice.stop - self.i_slice.start
739 self.Mi = ml.eye(self.nno, n_old, n_old-self.nno)
740 j = 0
741 for bl in self.subblocks:
742 self.Mi[bl.i_slice, j:j+bl.Mi.shape[1]] = bl.Mi
743 j += bl.Mi.shape[1]
744 return [np.concatenate(m, axis=1) for m in zip(*l)]
745
746 def decompose_blocks(self, F, C):
747 Kni = ml.identity(self.nn)
748 end = self.subblocks[-1].v_slice.stop
749 #self.Kl = self.eq.K[end:, :].copy()
750 #return F, C
751 for bl in self.subblocks:
752 sl = bl.v_slice
753 U, V, Vi = self.decompose(self.eq.K[end:, sl])
754 m = ml.zeros_like(self.Kl[:,sl])
755 m[:,:U.shape[1]] = U
756 self.Kl[:,sl] = m
757 #self.Mi[sl,sl] = V
758 bl.Mi = V
759 m = ml.zeros_like(Kni[sl,sl])
760 m[:,:Vi.shape[1]] = Vi
761 Kni[sl,sl] = m
762 return F * Kni, C * Kni
763
764
765 class EquationSystem(object):
766
767 def __init__(self, parser, jacobi_par=None, opts=None):
768 self.parser = parser
769 self.jacobi_par = jacobi_par
770 if opts is None:
771 opts = TransformOptions()
772
773 self.nx, self.nn, self.ni, self.no, self.np = [len(parser.element_name[j]) for j in 'X', 'N', 'I', 'O', 'P']
774 self.nlin_elements = np.array(parser.element_name["N"])
775 self.Nxl, self.Nxr, self.Nnl, self.Nnr, self.No, self.Nv, self.I = [
776 parser.N[j] for j in "Xl", "Xr", "Nl", "Nr", "O", "P", "I"]
777 self.CV = parser.ConstVoltages
778 m = parser.mm
779 self.f = parser.get_nonlin_funcs()
780 self.CZ = parser.CZ
781 if self.jacobi_par is not None:
782 J, Jc, select, unselect = self.jacobi_par
783 self.S = parser.S - self.Nnr[unselect].T * J[unselect][:,unselect] * self.Nnl[unselect]
784 self.CV = self.CV + (Nnr[unselect].T * Jc[unselect]).T
785 self.Nnr = self.Nnr[select]
786 self.Nnl = self.Nnl[select]
787 self.nn = len(select)
788 self.CZ = self.CZ[select]
789 self.f = NonlinEquations.rebase_nonlinear_functions(self.f, select)
790 parser.f = self.f
791 parser.element_name["N"] = np.array(parser.element_name["N"])[select]
792 else:
793 self.S = parser.S
794 self.Si = self.S.I
795
796 if self.nn:
797 K = (self.Nnl * self.Si * self.Nnr.T != 0)
798 for j, (expr, vl, base) in enumerate(self.f):
799 for i in base:
800 K[j, i] = True
801 v_slice = slice(0, len(K))
802 Pn, self.nonlin = NonlinEquations.create(self, K, self.CZ, v_slice, opts)
803 self.apply_permutation(Pn)
804 else:
805 self.nonlin = None
806
807 Z = ml.diag(parser.Z)
808 self.Tx = m * Z * self.Nxl * self.Si
809 self.A = self.Tx * self.Nxr.T - (Z if parser.TR else ml.diag((parser.Z - 1) / 2.0))
810 self.B = self.Tx * self.I.T
811 self.Bc = self.Tx * self.CV.T
812 self.C = self.Tx * self.Nnr.T
813
814 self.To = self.No * self.Si
815 self.D = self.To * self.Nxr.T
816 self.E = self.To * self.I.T
817 self.Ec = self.To * self.CV.T
818 self.F = self.To * self.Nnr.T
819
820 self.Tn = self.Nnl * self.Si
821 self.G = self.Tn * self.Nxr.T
822 self.H = self.Tn * self.I.T
823 self.Hc = self.Tn * self.CV.T
824 self.K = self.Tn * self.Nnr.T
825
826 if self.nn:
827 self.nonlin.Hc = self.Hc
828 self.G, self.H = self.nonlin.make_input_trans((self.G, self.H), opts)
829 self.F, self.C = self.nonlin.make_output_trans((self.F, self.C), opts)
830
831 if self.np:
832 # Woodbury Identity: \left(A+UCV \right)^{-1} = A^{-1} - A^{-1}U \left(C^{-1}+VA^{-1}U \right)^{-1} VA^{-1},
833 self.Twl = self.Si * self.Nv.T
834 self.Q = self.Nv * self.Twl
835 self.Uxl = m * Z * self.Nxl * self.Twl
836 self.Uo = self.No * self.Twl
837 self.Unl = self.Nnl * self.Twl
838 self.Twr = self.Si.T * self.Nv.T
839 self.Uxr = self.Nxr * self.Twr
840 self.Uu = self.I * self.Twr
841 self.Ucv = self.CV * self.Twr
842 self.Unr = self.Nnr * self.Twr
843
844 self.mp_cols = self.nx + self.ni
845
846 def apply_permutation(self, Pn):
847 self.nlin_elements = self.nlin_elements[Pn]
848 self.CZ = self.CZ[Pn]
849 self.f = NonlinEquations.rebase_nonlinear_functions(self.f, Pn)
850 self.Nnl = self.Nnl[Pn]
851 self.Nnr = self.Nnr[Pn]
852
853 def transform_state(self, Ts, Tsi):
854 self.A = Tsi * self.A * Ts
855 self.B = Tsi * self.B
856 self.Bc = Tsi * self.Bc
857 self.C = Tsi * self.C
858 self.D = self.D * Ts
859 self.G = self.G * Ts
860 self.nx = self.A.shape[0]
861 self.mp_cols = self.nx + self.ni
862 if self.np:
863 self.Uxl = Tsi * self.Uxl
864 self.Uxr = Ts.T * self.Uxr
865
866 def get_parser(self):
867 return self.parser
868
869 def get_Mo(self):
870 return np.concatenate((self.D, self.E, self.F), axis=1)
871
872 def get_Mx(self):
873 return np.concatenate((self.A, self.B, self.C), axis=1)
874
875 def get_Mp(self):
876 return np.concatenate((self.G, self.H), axis=1)
877
878 def get_UR(self):
879 assert hasattr(self, "Q")
880 return np.concatenate((self.Uxr.T, self.Uu.T, self.Unr.T), axis=1)
881
882 def get_mx_cols(self):
883 return self.A.shape[1] + self.B.shape[1] + self.C.shape[1]
884
885 def get_mp_cols(self):
886 return self.G.shape[1] + self.H.shape[1]
887
888 def get_npl(self):
889 return len(self.parser.pot_list)
890
891 def get_status(self):
892 return "nx=%d, nni=%d, nn=%d, nno=%d, ni=%d, no=%d, np=%d" % (self.nx, self.nni, self.nn, self.nno, self.ni, self.no, self.np)
893
894
895 class Simulate(object):
896
897 def __init__(self, eq, solver):
898 self.eq = eq
899 self.parser = eq.get_parser()
900 if solver is None:
901 self.solver_dict = dict()
902 elif isinstance(solver, basestring):
903 self.solver_dict = dict(method = solver)
904 else:
905 self.solver_dict = dict(solver)
906 self.solver_method = self.solver_dict.get("method", 'hybr')
907 self.max_homotopy_iter = self.solver_dict.get("max_homotopy_iter", 1000)
908 try:
909 del self.solver_dict["max_homotopy_iter"]
910 except KeyError:
911 pass
912 try:
913 del self.solver_dict["method"]
914 except KeyError:
915 pass
916
917 def get_solver(self):
918 d = self.solver_dict.copy()
919 d["method"] = self.solver_method
920 d["max_homotopy_iter"] = self.max_homotopy_iter
921 return d
922
923 def get_eq(self):
924 return self.eq
925
926 def get_parser(self):
927 return self.parser
928
929
930 class SimulatePy(Simulate):
931
932 def __init__(self, eq, solver=None, dc_method="A"):
933 Simulate.__init__(self, eq, solver)
934 self.dc_method = dc_method
935 parser = eq.get_parser()
936 self.pot_func = parser.get_pot_funcs()
937 self.Pv = parser.Pv
938 self.pot = parser.pot
939 self.out_labels = parser.out_labels()
940 self.v0 = parser.V.get("v0", np.zeros(eq.nn))
941 self.x = np.zeros(eq.nx)
942 self.o0 = np.zeros(eq.no)
943 self.op = parser.op
944 self.compile_py_func()
945 self.calc_dc(parser.op, method=dc_method)
946
947 def set_variable(self, var, val):
948 self.pot[var] = val
949
950 def calc_Rv(self):
951 n = self.eq.np
952 Rv = ml.matrix(np.zeros((n, n)))
953 for i, ((a, f), p) in enumerate(zip(self.pot_func, self.Pv)):
954 k = str(a)
955 try:
956 v = self.pot[k]
957 except KeyError:
958 v = self.pot[k] = 0.5
959 Rv[i, i] = float(f.subs({a: v})) * p
960 return Rv
961
962 def calc_matrixes(self):
963 eq = self.eq
964 if eq.np:
965 Qi = (eq.Q + self.calc_Rv()).I
966 Tx = eq.Uxl * Qi
967 To = eq.Uo * Qi
968 Tn = eq.Unl * Qi
969 return (eq.A - Tx * eq.Uxr.T,
970 eq.B - Tx * eq.Uu.T,
971 eq.Bc - Tx * eq.Ucv.T,
972 eq.C - Tx * eq.Unr.T,
973 eq.D - To * eq.Uxr.T,
974 eq.E - To * eq.Uu.T,
975 eq.Ec - To * eq.Ucv.T,
976 eq.F - To * eq.Unr.T,
977 eq.G - Tn * eq.Uxr.T,
978 eq.H - Tn * eq.Uu.T,
979 eq.Hc - Tn * eq.Ucv.T,
980 eq.K - Tn * eq.Unr.T,
981 )
982 else:
983 return (eq.A, eq.B, eq.Bc, eq.C,
984 eq.D, eq.E, eq.Ec, eq.F,
985 eq.G, eq.H, eq.Hc, eq.K,
986 )
987
988 def calc_linear_sys_matrices(self, v0=None):
989 eq = self.eq
990 if eq.nn:
991 nonlin = eq.nonlin
992 J = self.jacobi(v0)
993 X = nonlin.Mi * (np.diag(eq.CZ) - J * eq.K).I * J * nonlin.U
994 # equivalent formula for X:
995 # X = nonlin.Mi * J * (np.diag(eq.CZ) - eq.K * J).I * nonlin.U
996 A = eq.A + eq.C * X * eq.G
997 B = eq.B + eq.C * X * eq.H
998 D = eq.D + eq.F * X * eq.G
999 return A, B, D
1000 else:
1001 return eq.A, eq.B, eq.D
1002
1003 def balance_realization(self, tol=None):
1004 if self.eq.np:
1005 return
1006 A, B, D = self.calc_linear_sys_matrices()
1007 T, Ti, hsv = get_state_transform(A, B, D, tol=tol)
1008 logger = logging.getLogger("balance")
1009 if T.shape[0] != T.shape[1]:
1010 logger.info("reduced system size %d -> %d" % T.shape)
1011 logger.debug("HSV = %s" % hsv)
1012 self.eq.transform_state(T, Ti)
1013 self.calc_dc(self.eq.parser.op, method=self.dc_method)
1014
1015 def solve(self, func, v0, args=(), method='hybr', options=None):
1016 if method == "lm" and options and "maxfev" in options:
1017 options["maxiter"] = options["maxfev"]
1018 del options["maxfev"]
1019 try:
1020 with warnings.catch_warnings():
1021 warnings.filterwarnings(action="error")
1022 res = opt.root(func, v0, args=args, method=method, options=options)
1023 except RuntimeWarning as e:
1024 raise ConvergenceError(e)
1025 else:
1026 if not res.success:
1027 raise ConvergenceError(res.message)
1028 return res
1029
1030 def solve_using_homotopy(self, func, v0, method='hybr', options=None):
1031 # use homotopy
1032 points = [0, 1]
1033 max_iter = 100
1034 for tries in range(max_iter):
1035 try:
1036 res = self.solve(func, v0, args=(points[1],), method=method, options=options)
1037 except ConvergenceError as e:
1038 msg = e
1039 points.insert(1, (points[0]+points[1])/2)
1040 continue
1041 if len(points) == 2:
1042 return res
1043 v0 = res.x
1044 points = points[1:]
1045 raise ConvergenceError("more than %d iterations (list msg: %s)" % (max_iter, msg))
1046
1047 def calc_dc(self, u, method="A"):
1048 u = ml.matrix(u, dtype=np.float64).T
1049 A, B, Bc, C, D, E, Ec, F, G, H, Hc, K = self.calc_matrixes()
1050 if A.size == 0:
1051 if len(self.eq.f):
1052 p = self.eq.nonlin.U * H * u
1053 def func(v, fact):
1054 return (p + Hc * fact + K * self.calc_i(v) - ml.matrix(self.eq.CZ * v).T).A1
1055 self.v0 = self.solve_using_homotopy(func, self.v0).x
1056 else:
1057 I = ml.eye(len(A))
1058 if method == "A":
1059 try:
1060 Ai = (I - A).I
1061 except la.LinAlgError:
1062 method = "N"
1063 if method == "N":
1064 if self.eq.nonlin is None:
1065 Bu = B * u + Bc
1066 def func(v, fact):
1067 vv = ml.matrix(v).T
1068 return ((A - I) * vv + Bu*fact).A1
1069 res = self.solve_using_homotopy(func, self.x)
1070 self.x = res.x
1071 else:
1072 G1 = ml.append(self.eq.nonlin.U * G, A, axis=0)
1073 H1 = ml.append(self.eq.nonlin.U * H, B, axis=0)
1074 K1 = ml.append(K, C * self.eq.nonlin.Mi, axis=0)
1075 Hc1 = ml.append(Hc, Bc, axis=0)
1076 CZ1 = np.append(self.eq.CZ, np.ones(len(self.x)))
1077 n = len(self.v0)
1078 def func(v, fact):
1079 return (G1 * ml.matrix(v[n:]).T + H1 * u + Hc1*fact + K1 * self.calc_i(v) - ml.matrix(CZ1 * v).T).A1
1080 res = self.solve_using_homotopy(func, np.append(self.v0, self.x))
1081 self.v0 = res.x[:n]
1082 self.x = res.x[n:]
1083 else:
1084 self.x = matrix_add(Ai * B * u, Ai * Bc)
1085 if K.size != 0:
1086 T = self.eq.nonlin.U * G * Ai
1087 p = matrix_add(T * B * u, self.eq.nonlin.U * H * u)
1088 Hc1 = matrix_add(T * Bc, Hc)
1089 KK = T * C * self.eq.nonlin.Mi + K
1090 def func(v, fact):
1091 return (p + Hc1 * fact + KK * self.calc_i(v) - ml.matrix(self.eq.CZ * v).T).A1
1092 self.v0 = self.solve_using_homotopy(func, self.v0).x
1093 self.x += Ai * C * self.eq.nonlin.Mi * self.calc_i(self.v0)
1094 self.x = self.x.A1
1095 self.v00 = self.v0.copy()
1096 self.x0 = self.x.copy()
1097 self.p0 = matrix_add(G * np.matrix(self.x0).T, H * np.matrix(self.op).T)
1098 if self.eq.nonlin:
1099 self.p0 = self.eq.nonlin.transform_p0(self.p0, K, self.v0)
1100 self.o0 = matrix_add(D * np.matrix(self.x0).T, E * np.matrix(self.op).T, Ec, F * self.eq.nonlin.Mi * self.calc_i(self.v0)).A1
1101 self.last_p = self.eq.nonlin.U * self.p0 + Hc
1102 else:
1103 self.o0 = matrix_add(D * np.matrix(self.x0).T, E * np.matrix(self.op).T, Ec).A1
1104
1105 def calc_i(self, v):
1106 i = ml.zeros(len(self.ff)).T
1107 for n, (f, base) in enumerate(self.ff):
1108 i[n] = f(*v[base])
1109 return i
1110
1111 def solve_one(self, p, K, s, sm=None, sd=None):
1112 if sm is None:
1113 sm = self.solver_method
1114 if sd is None:
1115 sd = self.solver_dict
1116 i = ml.zeros((p.shape[0],1))
1117 vv = self.v0.copy()
1118 def func(v):
1119 for n, (f, base) in enumerate(self.ff[s]):
1120 ##FIXME
1121 vv[s] = v
1122 i[n] = f(*vv[base])
1123 return (p + K * i - ml.matrix(v).T).A1
1124 self.v0[s] = self.solve(func, self.v0[s], method=sm, options=sd).x
1125 return i
1126
1127 def nonlin_py(self, p, K, Hc):
1128 p = self.eq.nonlin.U * p + Hc
1129 i = ml.zeros((self.eq.nn, 1))
1130 if isinstance(self.eq.nonlin, PartitionedNonlinEquations):
1131 rc = slice(self.eq.blocklist[-1].stop, None)
1132 #sm = ["hybr", "lm", "hybr"]
1133 #sd = [dict(), dict(diag=(1e3,1),factor=1e-1), dict()]
1134 #sm = ["lm", "lm", "lm"]
1135 #sd = [dict(diag=(1e3,1),factor=1e-1), dict(diag=(1e3,1),factor=1e-1), dict(diag=(1e3,1),factor=1e-1)]
1136 sm = [None,None,None]
1137 sd = [None,None,None]
1138 def func(icc, fact):
1139 #print "*", fact, icc
1140 p1 = self.last_p + (p - self.last_p) * fact
1141 for j, s in enumerate(self.eq.blocklist):
1142 k = K[s]
1143 try:
1144 i[s] = self.eq.Kn[j] * self.solve_one(p1[s]+k[:,rc].dot(icc).T, k[:,s], s, sm[j], sd[j])
1145 except ConvergenceError as e:
1146 print "conv error in %d: %s" % (j, e)
1147 raise
1148 #raise SystemExit
1149 i[rc] = icc.reshape(len(icc), 1)
1150 return (p1[rc] + self.eq.Kl * i).A1
1151 self.v0[rc] = self.solve_using_homotopy(func, self.v0[rc], method=self.solver_method, options=self.solver_dict).x
1152 elif isinstance(self.eq.nonlin, ChainedNonlinEquations):
1153 for j, s in enumerate(self.eq.nonlin.blocklist):
1154 pp = p[s]
1155 if s.start:
1156 pp += K[s][:,:s.start] * i[:s.start]
1157 i[s] = self.solve_one(pp, K[s][:,s], s)
1158 i = self.eq.nonlin.Mi * i
1159 else:
1160 def func(v, fact):
1161 i[:] = self.calc_i(v)
1162 p1 = self.last_p + (p - self.last_p) * fact
1163 return (p1 + K * i - ml.matrix(self.eq.CZ * v).T).A1
1164 self.v0 = self.solve_using_homotopy(func, self.v0, method=self.solver_method, options=self.solver_dict).x
1165 i = self.eq.nonlin.Mi * i
1166 self.last_p = p
1167 return i
1168
1169 def compile_py_func(self):
1170 self.ff = np.zeros(len(self.eq.f), dtype=object)
1171 if not self.eq.nn:
1172 # model is linearized
1173 return
1174 for j, (expr, vl, base) in enumerate(self.eq.f):
1175 self.ff[j] = (sp.lambdify(vl, expr), base)
1176
1177 def calc_di(self, v, j):
1178 i = np.zeros(len(self.eq.f))
1179 for n, (f, vl, base) in enumerate(self.eq.f):
1180 for k, var in zip(base, vl):
1181 if k == j:
1182 s = dict([(sym,val) for sym, val in zip(vl, v[base])])
1183 i[n] = f.diff(var).subs(s)
1184 break
1185 else:
1186 i[n] = 0.
1187 return i
1188
1189 def jacobi_numeric(self, v0=None):
1190 if v0 is None:
1191 v0 = self.v00
1192 J = np.zeros((len(self.eq.f), len(v0)))
1193 i0 = self.calc_i(v0).A1
1194 eps = 1e-4
1195 for j in range(len(v0)):
1196 v = v0.copy()
1197 v[j] += eps
1198 J[:, j] = (self.calc_i(v).A1 - i0) / eps
1199 return ml.matrix(J)
1200
1201 def jacobi_symbolic(self, v0=None):
1202 if v0 is None:
1203 v0 = self.v00
1204 J = np.zeros((len(self.eq.f), len(v0)))
1205 for j in range(len(v0)):
1206 J[:, j] = self.calc_di(v0, j)
1207 return ml.matrix(J)
1208
1209 jacobi = jacobi_symbolic
1210 #jacobi = jacobi_numeric
1211
1212 def eval_py(self, v_in, ii=-1):
1213 self.x = ml.matrix(self.x).T ##FIXME
1214 v_in = ml.matrix(v_in)
1215 assert v_in.shape[1] == self.eq.ni
1216 y = np.empty((v_in.shape[0], self.eq.no))
1217 t1 = time.time()
1218 A, B, Bc, C, D, E, Ec, F, G, H, Hc, K = self.calc_matrixes()
1219 self.minmax = np.array(((float("inf"), float("-inf")),) * G.shape[0])
1220 for n, u in enumerate(v_in):
1221 u = ml.matrix(u).T
1222 if len(self.v0) == 0:
1223 i = ml.matrix(()).T
1224 else:
1225 try:
1226 p = G * self.x + H * u
1227 self.minmax[:,0] = np.min((self.minmax[:,0], p), axis=0)
1228 self.minmax[:,1] = np.max((self.minmax[:,1], p), axis=0)
1229 i = self.nonlin_py(p, K, Hc)
1230 except ConvergenceError as e:
1231 print "##", n
1232 raise
1233 y[n,:] = matrix_add(D * self.x, E * u, Ec, F * i).A1
1234 self.x = matrix_add(A * self.x, B * u, Bc, C * i)
1235 self.time_per_sample = (time.time() - t1)/(n+1)
1236 self.x = self.x.A1 ##FIXME
1237 return y
1238
1239 def __call__(self, v_in, ii=-1):
1240 return self.eval_py(v_in, ii)
1241
1242
1243 class CheckedDict(dict):
1244 def __setitem__(self, n, v):
1245 assert n not in self
1246 return dict.__setitem__(self, n, v)
1247 def overwrite(self, n, v):
1248 return dict.__setitem__(self, n, v)
1249
1250 class PluginDef(object):
1251
1252 def __init__(self, id):
1253 self.id = id
1254 self.name = id
1255 self._description = None
1256 self.category = "External"
1257 self._shortname = None
1258 self.namespace = id
1259 self.lv2_plugin_type = None
1260 self.lv2_versioned_id = id
1261 self.lv2_minor_version = 0
1262 self.lv2_micro_version = 0
1263
1264 @staticmethod
1265 def _lfmt(s):
1266 if s is None:
1267 return 0
1268 if not s:
1269 return '""'
1270 return 'N_("%s")' % s
1271
1272 @property
1273 def description(self):
1274 return self._description or ""
1275 @description.setter
1276 def description(self, v):
1277 self._description = v
1278
1279 @property
1280 def shortname(self):
1281 return self._shortname or ""
1282 @shortname.setter
1283 def shortname(self, v):
1284 self._shortname = v
1285
1286 @property
1287 def s_id(self):
1288 return '"%s"' % self.id
1289
1290 @property
1291 def l_name(self):
1292 return self._lfmt(self.name)
1293
1294 @property
1295 def l_description(self):
1296 return self._lfmt(self._description)
1297
1298 @property
1299 def l_category(self):
1300 return self._lfmt(self.category)
1301
1302 @property
1303 def l_shortname(self):
1304 return self._lfmt(self._shortname)
1305
1306
1307 class BuildCModule(Simulate):
1308
1309 def __init__(self, name, sim, solver=None, c_tempdir=None, c_verbose=False,
1310 c_real="double", extra_sources=None, linearize=False, pre_filter=None,
1311 post_filter=None, generator=None):
1312 if solver is None:
1313 solver = sim.get_solver()
1314 Simulate.__init__(self, sim.get_eq(), solver)
1315 self.name = name
1316 self.c_tempdir = c_tempdir
1317 self.c_verbose = c_verbose
1318 self.c_real = c_real
1319 self.extra_sources = extra_sources
1320 self.pre_filter = pre_filter
1321 self.post_filter = post_filter
1322 if generator is None:
1323 generator = generate_code.CodeGenerator
1324 self.generator = generator
1325 parser = sim.get_parser()
1326 if linearize:
1327 l = [i for i, e in enumerate(parser.element_name["N"]) if "linearize" not in parser.V[e[0]]]
1328 li = [i for i, e in enumerate(parser.element_name["N"]) if "linearize" in parser.V[e[0]]]
1329 J = sim.jacobi()
1330 Jc = sim.calc_i(sim.v00)
1331 par = J, Jc, l, li
1332 self.eq = EquationSystem(parser, par)
1333 sim = SimulatePy(self.eq, solver)
1334 self.v0, self.x0, self.p0, self.o0 = sim.v0, sim.x0, sim.p0, sim.o0
1335 self.op = parser.op
1336 self.pot_func = parser.get_pot_funcs()
1337 self.pot = parser.pot
1338 self.Pv = parser.Pv
1339 self.pot_attr = parser.get_pot_attr()
1340 self.out_labels = parser.out_labels()
1341 self.fs = parser.fs
1342 self.max_homotopy_iter = 64000
1343 self.resample = False
1344 self.solver_params = None
1345 self.dev_interface = True
1346 self.build_script = None
1347 self.plugindef = PluginDef(name)
1348
1349 def get_executor(self):
1350 return self.compile_c_func().wrap_code()
1351
1352 def compile_c_func(self):
1353 eq = self.eq
1354 d = CheckedDict(name=self.name, comment=time.ctime())
1355 d["solver_maptype"] = "unsigned short" ##FIXME
1356 d["fs"] = self.fs
1357 d["resample"] = self.resample
1358 d["c_real"] = self.c_real
1359 for j in "nx", "nn", "ni", "no", "np", "mp_cols":
1360 d[j] = getattr(eq, j)
1361 for j in "nni", "nno":
1362 d[j] = getattr(eq.nonlin, j, 0)
1363 d["npl"] = self.eq.get_npl()
1364 d["v0_data"] = ",".join([str(j) for j in self.v0])
1365 d["x0_data"] = ",".join([str(j) for j in self.x0])
1366 d["p0_data"] = ",".join([str(j) for j in self.p0.A1])
1367 d["o0_data"] = ",".join([str(j) for j in self.o0])
1368 d["op_data"] = ",".join([str(j) for j in self.op])
1369 d["out_labels"] = ",".join(['"%s"' % j for j in self.out_labels])
1370 d["nlin_elements"] = [Parser.format_element(v) for v in self.eq.nlin_elements]
1371 d["method"] = method = "linear" if eq.nn == 0 else self.solver_method
1372 pot_list = self.eq.get_parser().pot_list
1373 d["pot_vars"] = ",".join(['"%s"' % v for v in pot_list])
1374 d["pot"] = ",".join([str(self.pot.get(v,0.5)) for v in pot_list])
1375 d["pre_filter"] = self.pre_filter or ""
1376 d["post_filter"] = self.post_filter or ""
1377 d["post_process"] = ""
1378 d['id'] = d["name"]
1379 d['plugindef'] = self.plugindef
1380 d['build_script'] = self.build_script
1381 d["dev_interface"] = self.dev_interface
1382 solver = self.solver_dict.copy()
1383 solver["method"] = method
1384 solver["max_homotopy_iter"] = self.max_homotopy_iter
1385 if method == "table":
1386 d["extra_sources"] = self.extra_sources
1387 else:
1388 d["extra_sources"] = ""
1389 cg = self.generator(
1390 self.eq, solver, self.solver_params, self.pot, pot_list,
1391 self.pot_func, self.pot_attr, self.Pv, self.extra_sources
1392 ).generate(d)
1393 return CodeWrapper(d, cg, self.c_tempdir, self.c_verbose)
1394
1395
1396 class SimulateC(object):
1397
1398 def __init__(self, soname):
1399 self.soname = soname
1400 self.load_from_shared_lib()
1401 self.v0, self.x, self.p0, self.o0, self.op = self.c_get_dc()
1402 self.v00 = self.v0
1403 self.x0 = self.x
1404 self.c_set_state(self.v0, self.x)
1405 self.c_calc_pot_update(np.array([self.pot[v] for v in self.pot_list], dtype=self.dtp))
1406 self.eval = self.eval_c
1407 self.nonlin = self.nonlin_c
1408
1409 def set_variable(self, var, val):
1410 assert var in self.pot
1411 self.pot[var] = val
1412 self.c_calc_pot_update(np.array([self.pot[v] for v in self.pot_list], dtype=self.dtp))
1413
1414 def nonlin_c(self, p):#, K, Hc): ##FIXME
1415 return self.c_calc_nonlin(p, self.v0) ##FIXME
1416
1417 def eval_c(self, v_in, ii=-1):
1418 v_in = np.array(v_in)
1419 if v_in.ndim == 1:
1420 v_in = v_in.reshape((len(v_in),1))
1421 assert v_in.shape[1] == self.ni
1422 y = np.empty((v_in.shape[0], self.no))
1423 x = self.x
1424 v = self.v0
1425 t1 = time.time()
1426 for n, u in enumerate(v_in):
1427 y[n,:], x, v = self.c_calc(u, x, v)
1428 self.time_per_sample = (time.time() - t1)/n
1429 self.x = x
1430 self.v0 = v
1431 return y
1432
1433 def reset(self):
1434 self.v0 = self.v00
1435 self.x = self.x0
1436 self.c_set_state(self.v00, self.x0)
1437
1438 def eval_c(self, v_in, ii=-1):
1439 self.c_set_state(self.v0, self.x)
1440 t1 = time.time()
1441 try:
1442 return self.c_calc_stream(v_in, ii)
1443 finally:
1444 self.time_per_sample = (time.time() - t1)/v_in.shape[0]
1445 self.v0, self.x, self.minmax, info, nfev, fnorm = self.c_get_info()
1446
1447 def load_from_shared_lib(self):
1448 INTERFACE_VERSION = 5
1449 try:
1450 lib = ct.cdll.LoadLibrary(self.soname)
1451 except OSError as e:
1452 raise SystemExit(e)
1453 try:
1454 version = lib.get_interface_version()
1455 except AttributeError:
1456 raise SystemExit("%s: bad shared lib, missing get_interface_version" % self.soname)
1457 if version != INTERFACE_VERSION:
1458 raise SystemExit("interface version %d expected (found: %d)" % (INTERFACE_VERSION, version))
1459 c_char_pp = ct.POINTER(ct.c_char_p)
1460 c_get_structure = lib.get_structure
1461 c_get_structure.restype = None
1462 c_get_structure.argtypes = [c_char_pp, ct.POINTER(ct.c_int), ct.POINTER(ct.c_int), ct.POINTER(ct.POINTER(ct.c_int)),
1463 ct.POINTER(ct.POINTER(ct.c_int)), ct.POINTER(c_char_pp), ct.POINTER(c_char_pp),
1464 c_char_pp, ct.POINTER(c_char_pp), ct.POINTER(ct.POINTER(ct.c_double)),
1465 ct.POINTER(c_char_pp), c_char_pp]
1466 nm = ct.c_char_p()
1467 sz = ct.c_int()
1468 fs = ct.c_int()
1469 t = ct.POINTER(ct.c_int)()
1470 tc = ct.POINTER(ct.c_int)()
1471 pins = c_char_pp()
1472 cnm = c_char_pp()
1473 p = ct.c_char_p()
1474 plist = c_char_pp()
1475 pvals = ct.POINTER(ct.c_double)()
1476 ol = c_char_pp()
1477 cmt = ct.c_char_p()
1478 c_get_structure(ct.byref(nm), ct.byref(sz), ct.byref(fs), ct.byref(t), ct.byref(tc), ct.byref(pins),
1479 ct.byref(cnm), ct.byref(p), ct.byref(plist), ct.byref(pvals), ct.byref(ol),
1480 ct.byref(cmt))
1481 nx, ni, no, npl, nn, nni, nno, nc, end = [t[i] for i in range(9)]
1482 if end != -1:
1483 raise SystemExit("%s: bad sequence length in get_structure")
1484 self.nx, self.ni, self.no, self.npl, self.nn, self.nni, self.nno = nx, ni, no, npl, nn, nni, nno
1485 self.comp_sz = comp_sz = np.array([[slice(tc[6*i+2*j],tc[6*i+2*j+1]) for j in range(3)] for i in range(nc)])
1486 self.pins = np.array([pins[i] for i in range(nn)])
1487 self.comp_names = [cnm[2*i] for i in range(nc)]
1488 self.comp_namespace = [cnm[2*i+1] for i in range(nc)]
1489 self.name = nm.value
1490 self.data_size = sz.value
1491 self.fs = fs.value
1492 self.method = p.value
1493 self.pot_list = [plist[i] for i in range(npl)]
1494 self.pot = dict([(plist[i], pvals[i]) for i in range(npl)])
1495 self.out_labels = [ol[i] for i in range(no)]
1496 self.comment = cmt.value
1497 if self.data_size == 8:
1498 c_real = ct.c_double
1499 self.dtp = np.float64
1500 elif self.data_size == 4:
1501 c_real = ct.c_float
1502 self.dtp = np.float32
1503 else:
1504 raise ValueError("unknown data size: %d" % self.data_size)
1505 def c_arr(n, w=False):
1506 flags = ['C']
1507 if w:
1508 flags.append('W')
1509 return np.ctypeslib.ndpointer(dtype=c_real, ndim=1, shape=(n,), flags=flags)
1510 def c_mat(w=False):
1511 flags = ['C']
1512 if w:
1513 flags.append('W')
1514 return np.ctypeslib.ndpointer(dtype=c_real, ndim=2, flags=flags)
1515 c_int_p = ct.POINTER(ct.c_int)
1516 c_real_p = ct.POINTER(c_real)
1517 c_calc = lib.calc
1518 c_calc.restype = ct.c_int
1519 c_calc.argtypes = [c_arr(ni), c_arr(nx), c_arr(nn,True), c_arr(nx,True), c_arr(no,True), c_int_p, c_int_p, c_real_p]
1520 c_set_state = lib.set_state
1521 c_set_state.restype = None
1522 c_set_state.argtypes = [c_arr(nn), c_arr(nx)]
1523 c_get_info = lib.get_info
1524 c_get_info.restype = None
1525 c_get_info.argtypes = [c_arr(nn,True), c_arr(nx, True), c_arr(nni,True), c_arr(nni,True), c_int_p, c_int_p, c_real_p]
1526 c_calc_stream = lib.calc_stream
1527 c_calc_stream.restype = ct.c_int
1528 c_calc_stream.argtypes = [c_mat(), c_mat(True), ct.c_int]
1529 info = ct.c_int()
1530 nfev = ct.c_int()
1531 fnorm = c_real()
1532 if nn:
1533 c_calc_nonlin = lib.calc_nonlin
1534 c_calc_nonlin.restype = ct.c_int
1535 c_calc_nonlin.argtypes = [ct.c_int, c_mat(), c_mat(True), c_arr(nn, True), c_int_p, c_int_p, c_real_p]
1536 def calc_nonlin(p, v):
1537 assert p.shape[1] == nni+npl, (p.shape[1], nni+npl)
1538 p = np.array(p, dtype=self.dtp, order='C', copy=False)
1539 i = np.zeros((p.shape[0], nno), dtype=self.dtp, order='C')
1540 r = c_calc_nonlin(len(p), p, i, v, ct.byref(info), ct.byref(nfev), ct.byref(fnorm))
1541 if r != 0:
1542 raise ValueError("convergence error: info=%d, nfev=%d, fnorm=%g" % (info.value, nfev.value, fnorm.value))
1543 return i
1544 self.c_calc_nonlin = calc_nonlin
1545 def define_func(f, i, npl):
1546 v_slice, p_slice, i_slice = comp_sz[i]
1547 nni = p_slice.stop - p_slice.start
1548 nno = i_slice.stop - i_slice.start
1549 dtp = self.dtp
1550 def func(p, v=None):
1551 assert p.shape[1] == nni+npl, (p.shape[1], nni+npl)
1552 if v is None:
1553 v = self.v0
1554 p = np.array(p, dtype=dtp, order='C', copy=False)
1555 i = np.zeros((p.shape[0], nno), dtype=dtp, order='C')
1556 r = f(len(p), p, i, v, ct.byref(info), ct.byref(nfev), ct.byref(fnorm))
1557 if r != 0:
1558 raise ValueError("convergence error: info=%d, nfev=%d, fnorm=%g" % (info.value, nfev.value, fnorm.value))
1559 return i
1560 func.name = self.comp_names[i]
1561 func.pins = self.pins[v_slice]
1562 func.v_slice = v_slice
1563 func.p_slice = p_slice
1564 func.i_slice = i_slice
1565 return func
1566 self.c_calc_comp = []
1567 for i in range(nc):
1568 t = getattr(lib, "calc_%s" % self.comp_namespace[i])
1569 t.restype = ct.c_int
1570 t.argtypes = [ct.c_int, c_mat(), c_mat(True), c_arr(nn, True), c_int_p, c_int_p, c_real_p]
1571 self.c_calc_comp.append(define_func(t, i, npl))
1572 c_calc_pot_update = lib.calc_inv_update
1573 c_calc_pot_update.restype = None
1574 c_calc_pot_update.argtypes = [c_arr(npl)]
1575 c_get_dc = lib.get_dc
1576 c_get_dc.restype = None
1577 c_get_dc.argtypes = [c_arr(nn, True), c_arr(nx, True), c_arr(nni, True), c_arr(no, True), c_arr(ni, True)]
1578 def calc(u, x, v):
1579 u = np.array(u, dtype=self.dtp)
1580 x = np.array(x, dtype=self.dtp)
1581 v = np.array(v, dtype=self.dtp)
1582 x_new = np.zeros(nx, dtype=self.dtp)
1583 o = np.zeros(no, dtype=self.dtp)
1584 if c_calc(u, x, v, x_new, o, ct.byref(info), ct.byref(nfev), ct.byref(fnorm)) < 0:
1585 if fnorm.value > 1e-7:
1586 raise RuntimeError("convergence: method=%s, info=%d, nfev=%d, fnorm=%g"
1587 % (self.method, info.value, nfev.value, fnorm.value))
1588 return o, x_new, v
1589 def calc_stream(u, ii=-1):
1590 assert u.shape[1] == ni + (ii >= 0)
1591 u = np.array(u, dtype=self.dtp, order="C", copy=False)
1592 o = np.zeros((u.shape[0], no), dtype=self.dtp)
1593 if c_calc_stream(u, o, u.shape[0], ii) != 0:
1594 v, x, minmax, g_info, g_nfev, g_fnorm = get_info()
1595 raise ValueError("convergence error: info=%d, nfev=%d, fnorm=%g" % (g_info, g_nfev, g_fnorm))
1596 return o
1597 def get_info():
1598 v = np.zeros(nn, dtype=self.dtp, order='C')
1599 x = np.zeros(nx, dtype=self.dtp, order='C')
1600 minv = np.zeros(nni, dtype=self.dtp, order='C')
1601 maxv = np.zeros(nni, dtype=self.dtp, order='C')
1602 c_get_info(v, x, minv, maxv, ct.byref(info), ct.byref(nfev), ct.byref(fnorm))
1603 return v, x, np.vstack((minv, maxv)).T, info.value, nfev.value, fnorm.value
1604 def set_state(v, x):
1605 v = np.array(v, dtype=self.dtp)
1606 x = np.array(x, dtype=self.dtp)
1607 c_set_state(v, x)
1608 def get_dc():
1609 v0 = np.zeros(nn, dtype=self.dtp, order='C')
1610 x0 = np.zeros(nx, dtype=self.dtp, order='C')
1611 p0 = np.zeros(nni, dtype=self.dtp, order='C')
1612 o0 = np.zeros(no, dtype=self.dtp, order='C')
1613 op = np.zeros(ni, dtype=self.dtp, order='C')
1614 c_get_dc(v0, x0, p0, o0, op)
1615 return v0, x0, ml.matrix(p0).T, o0, op
1616 self.c_calc = calc
1617 self.c_set_state = set_state
1618 self.c_get_info = get_info
1619 self.c_calc_stream = calc_stream
1620 self.c_calc_pot_update = c_calc_pot_update
1621 self.c_get_dc = get_dc
1622
1623 def __call__(self, v_in, ii=-1):
1624 return self.eval_c(v_in, ii)
1625
1626
1627 class Parser(object):
1628 # Nl = incidence matrix denoting the nodes which potentials are controlling the currents
1629 # Nr = incidence matrix denoting the nodes where the current flows in (> 0) or out (< 0)
1630 #
1631 def __init__(self, S, V, fs, TR=True, create_filter=False, symbolic=False):
1632 self.fs = fs
1633 self.TR = TR # True: TR (trapezoidal) integration, False: BE backward euler
1634 self.create_filter = create_filter
1635 self.symbolic = symbolic
1636 self.mm = 2.0 if TR else 1.0
1637 self.update(S, V)
1638
1639 def update(self, S, V):
1640 self.V = V
1641 self.nodes = {}
1642 self.element_name = collections.defaultdict(list)
1643 tc = self.collect(S, V)
1644 n = len(self.nodes) + tc["V"]
1645 self.S = ml.zeros((n,n))
1646 self.N = dict([(t, ml.zeros((tc[t[0]], n)))
1647 for t in "R","Xl","Xr","Nl","Nr","I","O","P"])
1648 self.Pv = np.zeros(tc["P"])
1649 self.pot_func = np.array((None,)*tc["P"])
1650 self.ConstVoltages = ml.zeros(n)
1651 self.Z = np.zeros(tc["X"])
1652 self.CZ = np.ones(tc["N"], dtype=int)
1653 self.f = np.array((None,)*tc["N"])
1654 if self.create_filter or self.symbolic:
1655 alpha = sp.symbols("s")
1656 self.S = sp.Matrix(self.S)
1657 for k in self.N.keys():
1658 self.N[k] = sp.Matrix(self.N[k])
1659 if self.symbolic:
1660 self.Pv = sp.Matrix(self.Pv)
1661 d = {}
1662 for k, v in V.items():
1663 if isinstance(k, Node):
1664 sym = sp.Symbol(str(k))
1665 if isinstance(v, dict):
1666 v = v.copy()
1667 v["value"] = sym
1668 else:
1669 v = sym
1670 d[k] = v
1671 V = d
1672 else:
1673 alpha = self.mm * self.fs
1674 def map_conn(c):
1675 if isinstance(c, Out):
1676 return c
1677 if c is None:
1678 return None
1679 return self.nodes.get(c, -1)
1680 for row in S:
1681 row[0].process(self, [map_conn(c) for c in row[1:]], V.get(row[0]), alpha)
1682 self.pot = V.get("POT", {})
1683 self.op = V.get("OP",[0.]*tc["I"])
1684 self.pot_list = []
1685 for a, f in self.pot_func:
1686 s = str(a)
1687 if s not in self.pot_list:
1688 self.pot_list.append(s)
1689
1690 def get_status(self):
1691 return ""
1692
1693 def matches(self, create_filter, symbolic):
1694 return self.create_filter == create_filter and self.symbolic == symbolic
1695
1696 def get_nonlin_funcs(self):
1697 return self.f
1698
1699 def set_function(self, idx, expr, vl, base):
1700 assert self.f[idx] is None
1701 self.f[idx] = (expr, vl, range(base, base+len(vl)))
1702
1703 def get_pot_funcs(self):
1704 return self.pot_func
1705
1706 def get_pot_attr(self):
1707 attrlist = []
1708 for e in set([e[0] for e in self.element_name["P"]]):
1709 t = self.V[e]
1710 if not isinstance(t, dict):
1711 t = dict(value=t)
1712 var = t.get('var')
1713 if var is None:
1714 var = str(e)+"v"
1715 name = t.get('name', var)
1716 loga = t.get('a', 0)
1717 inv = t.get('inv', 0)
1718 if loga:
1719 if inv:
1720 expr = lambda a: (math.exp(loga * (1 - a)) - 1) / (math.exp(loga) - 1)
1721 else:
1722 expr = lambda a: (math.exp(loga * a) - 1) / (math.exp(loga) - 1)
1723 else:
1724 if inv:
1725 expr = lambda a: 1-a
1726 else:
1727 expr = lambda a: a
1728 attrlist.append((var, name, loga, inv, expr))
1729 return attrlist
1730
1731 def get_variable_defaults(self):
1732 return dict([(a, self.pot.get(str(a), 0.5)) for a, f in self.pot_func])
1733
1734 def extra_variable_index(self, idx):
1735 return len(self.nodes) + idx
1736
1737 def extra_variable_by_name(self, tpl):
1738 try:
1739 return len(self.nodes) + self.element_name["V"].index(tpl)
1740 except ValueError:
1741 print "%s not in %s" % (tpl, self.element_name["V"])
1742 raise
1743
1744 def collect(self, S, V):
1745 tc = collections.Counter()
1746 l = self.element_name["S"]
1747 for row in S:
1748 e = row[0]
1749 conn = row[1:]
1750 e.add_count(tc, conn, V.get(e))
1751 for s in conn:
1752 if s not in self.nodes:
1753 if s != GND and s is not None and not isinstance(s, Out):
1754 self.nodes[s] = len(self.nodes)
1755 l.append((s,None))
1756 return tc
1757
1758 def new_row(self, N, sym, f=None):
1759 l = self.element_name[N]
1760 n = len(l)
1761 if N == "V":
1762 n += len(self.nodes)
1763 l.append((sym,f))
1764 return n
1765
1766 def current_row(self, N):
1767 n = len(self.element_name[N]) - 1
1768 if N == "V":
1769 n += len(self.nodes)
1770 return n
1771
1772 def add_currents(self, m, conn, value):
1773 if conn[0] != -1:
1774 m[conn[0], conn[0]] += value
1775 if conn[1] != -1:
1776 m[conn[0], conn[1]] += -value
1777 if conn[1] != -1:
1778 m[conn[1], conn[1]] += value
1779 if conn[0] != -1:
1780 m[conn[1], conn[0]] += -value
1781
1782 def add_S_currents(self, conn, value):
1783 self.add_currents(self.S, conn, value)
1784
1785 def add_S(self, idx, conn, value):
1786 for i in conn[0], conn[1]:
1787 if i != -1:
1788 self.S[idx,i] += value
1789 value = -value
1790 for i in conn[0], conn[1]:
1791 value = -value
1792 if i != -1:
1793 self.S[i,idx] += value
1794
1795 def add_conn(self, N, node, conn, val):
1796 if conn != -1:
1797 self.N[N][node, conn] += val
1798
1799 def add_2conn(self, N, node, conn, value=1):
1800 if len(conn) != 2:
1801 raise ValueError("2 connections expected")
1802 for i, v in zip(conn, (value, -value)):
1803 self.add_conn(N, node, i, v)
1804
1805 @staticmethod
1806 def format_element(el, pref=""):
1807 n, d = el
1808 return "%s%s%s" % (pref, n, d and ("[%s]" % d) or "")
1809
1810 def node_names(self):
1811 return [self.format_element(v) for v in self.element_name["S"]+self.element_name["V"]]
1812
1813 def out_labels(self):
1814 return [str(v) for v in self.element_name["O"][0][0].conn]
1815
1816 def generate_c_code(self, d):
1817 # UNUSED
1818 def mk_sym(s, n):
1819 return sp.symbols(['%s[%d]' % (s, i) for i in range(len(self.element_name[n]))])
1820 def ccode(d, ret, ex):
1821 r = ret + '[%d]'
1822 d[ret] = "\n".join([sp.ccode(ee, r % i) for i, ee in enumerate(ex)]).replace("\n","\n ")
1823 def ccodesum(d, ret, l):
1824 l2 = [m for m in l if m]
1825 if l2:
1826 ccode(d, ret, reduce(operator.add, l2))
1827 else:
1828 d[ret] = '/* no %s */' % ret
1829 x = sp.Matrix(mk_sym('x', 'X'))
1830 u = sp.Matrix(mk_sym('u', 'I'))
1831 i = sp.Matrix(mk_sym('i', 'N'))
1832 v = mk_sym('v', 'N')
1833 p = mk_sym('p', 'N')
1834 # nonlinear function for root-finding
1835 l = []
1836 for n, (expr, vl, base) in enumerate(self.eq.f):
1837 for j, e in enumerate(vl):
1838 expr = expr.subs(e, v[base+j])
1839 l.append(expr)
1840 ccode(d, 'fvec', sp.Matrix(p) + sp.Matrix(self.K) * sp.Matrix(l) - sp.Matrix(np.diag(self.eq.CZ)) * sp.Matrix(v))
1841 # "currents"
1842 ccode(d, 'i', l)
1843 # p value
1844 ccodesum(d, 'p', [sp.Matrix(self.G) * x, sp.Matrix(self.H) * u, sp.Matrix(self.Hc)])
1845 # x update
1846 ccodesum(d, 'x_new', [sp.Matrix(self.A) * x, sp.Matrix(self.B) * u, sp.Matrix(self.Bc), sp.Matrix(self.C) * i])
1847 # output
1848 ccodesum(d, 'o', [sp.Matrix(self.D) * x, sp.Matrix(self.E) * u, sp.Matrix(self.Ec), sp.Matrix(self.F) * i])
1849
1850
1851 def get_py_executor(parser, solver=None, linearize=False):
1852 sim = SimulatePy(EquationSystem(parser), solver)
1853 if linearize:
1854 J = sim.jacobi()
1855 sim = SimulatePy(EquationSystem(parser, J), solver)
1856 return sim
1857
1858 def get_executor(name, parser, solver=None, pure_python=True, c_tempdir=None, c_verbose=False,
1859 c_debug_load="", c_real="double", extra_sources=None, linearize=False):
1860 if pure_python:
1861 return get_py_executor(parser, solver, linearize)
1862 elif c_debug_load:
1863 sim = SimulateC(c_debug_load)
1864 print "%s/%s: %s[%d], %s, %s" % (sim.name, sim.comment, sim.method, sim.data_size, sim.out_labels, sim.pot_list)
1865 return sim
1866 else:
1867 sim = SimulatePy(EquationSystem(parser), solver)
1868 return BuildCModule(name, sim, solver, c_tempdir, c_verbose, c_real, extra_sources, linearize).get_executor()[1]
0 from __future__ import division
1 import os, quik
2
3
4 class MyLoader(object):
5
6 def load_text(self, fname):
7 if fname.startswith("%"):
8 # hack for directly including guitarix gx_plugin.h
9 guitarix_headers = "../../../src/headers"
10 with open(os.path.join(guitarix_headers, fname[1:])) as f:
11 return "".join([line for line in f if not (line.startswith("#include") or line.startswith("#pragma once"))])
12 else:
13 with open(fname) as f:
14 return f.read()
15
16 def load_template(self, name):
17 return globals()[name]
18
19
20 class Template(quik.Template):
21 def render(self, namespace, loader=MyLoader()):
22 return quik.Template.render(self, namespace, loader)
23
24 c_template_top = Template("""\
25 %if (@build_script)\
26 // generated by @build_script
27 %else\
28 // generated automatically
29 %end
30 // DO NOT MODIFY!
31 #include <iostream>
32 #include <cmath>
33 #include <list>
34 %% %if (@method == "hybr" || @method == "lm")
35 %if (@method == "lm")
36 #include <cminpack.h>
37 %else
38 #include <float.h>
39 %end
40 #include <Eigen/Core>
41 %if (@np > 0)
42 #include <Eigen/LU>
43 %end
44 %if (@dev_interface)%% just for convenience, to make stand alone sources
45 %include ("%gx_compiler.h")
46 %include ("%gx_plugin.h")
47 %else
48 #include "gx_compiler.h"
49 #include "gx_plugin.h"
50 %end
51
52 using namespace Eigen;
53
54 #define N_(x) (x)
55
56 #define creal @c_real
57
58 static inline int sign(creal v) {
59 return v < 0 ? -1 : 1;
60 }
61
62 static inline int Heaviside(creal v) {
63 return v < 0 ? 0 : 1; // Heaviside(0) == 1/2 in sympy but shouldn't matter
64 }
65
66 static Matrix<creal, @nx, 1> g_x;
67 creal g_v_data[@nn];
68 static Map<Matrix<creal, @nn, 1> >g_v(g_v_data);
69 static int g_info;
70 static int g_nfev;
71
72 %if (@dev_interface)
73 static creal g_fnorm;
74 static Array<creal, @nni, 1> g_min;
75 static Array<creal, @nni, 1> g_max;
76
77 #define INTERFACE_VERSION 5
78
79 extern "C" __attribute__ ((visibility ("default")))
80 int get_interface_version() {
81 return INTERFACE_VERSION;
82 }
83
84 extern "C" __attribute__ ((visibility ("default")))
85 void get_structure(const char **name, int *data_size, int *samplerate, const int **shapes, const int (**comp_sz)[6],
86 const char ***pins, const char ***comp_names, const char **method, const char ***pot_vars,
87 const double **pot, const char ***out_labels, const char **comment) {
88 static const char *n = "@name";
89 static int sz[] = { @nx, @ni, @no, @npl, @nn, @nni, @nno, @nc, -1 }; // nx, ni, no, npl, nn, nni, nno, nc, -1
90 static int nn_sz[][6] = { // component v_slice, p_slice, i_slice
91 %for @c in @components:\
92 {@c.v_slice.start, @c.v_slice.stop, @c.p_slice.start, @c.p_slice.stop, @c.i_slice.start, @c.i_slice.stop},
93 %end
94 };
95 static const char *nn_name[] = { // component names
96 %for @c in @components:\
97 "@c.name", "@c.namespace",
98 %end 0
99 };
100 static const char *nn_pins[] = { // component pins
101 %for @c in @nlin_elements:\
102 "@c",
103 %end 0
104 };
105 static const char *m = "@method";
106 static const char *pvars[] = {@pot_vars};
107 static double pvalues[] = {@pot};
108 static const char *ol[] = {@out_labels};
109 static const char *c = "@comment";
110 if (name) *name = n;
111 if (data_size) *data_size = sizeof(creal);
112 if (samplerate) *samplerate = @fs;
113 if (shapes) *shapes = sz;
114 if (comp_sz) *comp_sz = nn_sz;
115 if (pins) *pins = nn_pins;
116 if (comp_names) *comp_names = nn_name;
117 if (method) *method = m;
118 if (pot_vars) *pot_vars = pvars;
119 if (pot) *pot = pvalues;
120 if (out_labels) *out_labels = ol;
121 if (comment) *comment = c;
122 }
123 %end
124
125 static creal x0_data[] = {@x0_data};
126 %if (@dev_interface)
127 static creal v0_data[] = {@v0_data};
128 static creal p0_data[] = {@p0_data};
129 static creal o0_data[] = {@o0_data};
130 static creal op_data[] = {@op_data};
131
132 extern "C" __attribute__ ((visibility ("default")))
133 void get_dc(creal *v0, creal *x0, creal *p0, creal *o0, creal *op) {
134 if (v0) {
135 for (int i = 0; i < @nn; i++) {
136 v0[i] = v0_data[i];
137 }
138 }
139 if (x0) {
140 for (int i = 0; i < @nx; i++) {
141 x0[i] = x0_data[i];
142 }
143 }
144 if (p0) {
145 for (int i = 0; i < @nni; i++) {
146 p0[i] = p0_data[i];
147 }
148 }
149 if (o0) {
150 for (int i = 0; i < @no; i++) {
151 o0[i] = o0_data[i];
152 }
153 }
154 if (op) {
155 for (int i = 0; i < @ni; i++) {
156 op[i] = op_data[i];
157 }
158 }
159 }
160
161 extern "C" __attribute__ ((visibility ("default")))
162 void get_info(creal *v, creal *x, creal *minval, creal *maxval, int *info, int *nfev, creal *fnorm) {
163 Map<Matrix<creal, @nn, 1> > V(v);
164 V = g_v;
165 Map<Matrix<creal, @nx, 1> > X(x);
166 X = g_x;
167 Map<Matrix<creal, @nni, 1> > Mi(minval);
168 Mi = g_min;
169 Map<Matrix<creal, @nni, 1> > Ma(maxval);
170 Ma = g_max;
171 *info = g_info;
172 *nfev = g_nfev;
173 *fnorm = g_fnorm;
174 }
175
176 extern "C" __attribute__ ((visibility ("default")))
177 void set_state(creal *v, creal *x) {
178 Map<Matrix<creal, @nn, 1> > V(v);
179 g_v = V;
180 Map<Matrix<creal, @nx, 1> > X(x);
181 g_x = X;
182 }
183 %end
184
185 #define real realtype // real conflicts with Eigen::real of new eigen library version
186 typedef double real;
187 %if (@method == "table")
188 %include ("intpp.h")
189 #define NO_INTPP_INCLUDES
190 %include ("intpp.cc")
191 @extra_sources.intpp_inst
192 %%@extra_sources.data_h
193 @extra_sources.data_c
194 %end
195
196 @global_matrices
197
198 static Matrix<creal, @npl, 1> last_pot;
199
200 @struct_def
201
202 %if (@dev_interface || @npl)
203 void calc_inv_update(const creal *pot, nonlin_param& par) {
204 Map<const Matrix<creal, @npl, 1> >pm(pot);
205 last_pot = pm;
206 @update_pot
207 }
208 %end
209 %if (@dev_interface)
210 nonlin_param par@nonlin_mat_list;
211
212 extern "C" __attribute__ ((visibility ("default")))
213 void calc_inv_update(const creal *pot) {
214 calc_inv_update(pot, par);
215 }
216 %end
217
218 @nonlin_code
219
220 %if (@dev_interface)
221 extern "C" __attribute__ ((visibility ("default")))
222 int calc_stream(creal *u, creal *o, int n, int ii) {
223 Matrix<creal, @nn, 1> mi;
224 %if (@nn)
225 g_min = Matrix<creal, @nni, 1>::Constant(HUGE_VAL);
226 g_max = Matrix<creal, @nni, 1>::Constant(-HUGE_VAL);
227 g_fnorm = 0;
228 par.v = &g_v;
229 par.i = &mi;
230 Array<creal, @nni, 1> p_val;
231 par.p_val = &p_val;
232 creal fnorm;
233 par.fnorm = &fnorm;
234 Matrix<creal, @nn, 1> mp;
235 par.p = &mp;
236 %end
237 int nu = @ni;
238 if (ii >= 0) {
239 nu += 1;
240 }
241 for (int j = 0; j < n; j++) {
242 #define GET_U (u+j*nu)
243 #define DTP_U creal
244 @pre_filter
245 %if (@nn)
246 Matrix<creal, @mp_cols, 1> dp;
247 dp << g_x, Map<Matrix<creal,@ni,1> >(GET_U);
248 @gen_mp
249 int ret = nonlin::nonlin_solve(par);
250 if (fnorm > g_fnorm) {
251 g_fnorm = fnorm;
252 }
253 if (ret != 0) {
254 return ret;
255 }
256 g_min = g_min.min(p_val.array());
257 g_max = g_max.max(p_val.array());
258 if (ii >= 0) {
259 mi(ii) += GET_U[@ni];
260 }
261 %end
262 Matrix<creal, @m_cols, 1> d;
263 %if (@nn)
264 d << g_x, Map<Matrix<creal,@ni,1> >(GET_U), mi@iblock;
265 %else
266 d << g_x, Map<Matrix<creal,@ni,1> >(GET_U);
267 %end
268 %if (@nx)
269 Matrix<creal, @nx, 1>& xn = g_x;
270 @gen_xn
271 %end
272 Map<Matrix<creal, @no, 1> > xo(o+@no*j);
273 @gen_xo
274 #undef GET_U
275 #undef DTP_U
276 }
277 return 0;
278 }
279
280 extern "C" __attribute__ ((visibility ("default")))
281 int calc(creal *u, creal *x, creal *v, creal *x_new, creal *o, int *info, int *nfev, creal *fnorm) {
282 #define GET_U (u)
283 #define DTP_U creal
284 @pre_filter
285 int ret = 0;
286 Matrix<creal, @nn, 1> mi;
287 %if (@nn)
288 par.fnorm = fnorm;
289 par.i = &mi;
290 Matrix<creal, @mp_cols, 1> dp;
291 dp << Map<Matrix<creal,@nx,1> >(x), Map<Matrix<creal,@ni,1> >(u);
292 Matrix<creal, @nn, 1> mp;
293 par.p = &mp;
294 Map<Matrix<creal, @nn, 1> >Mv(v);
295 par.v = &Mv;
296 Array<creal, @nni, 1> p_val;
297 par.p_val = &p_val;
298 @gen_mp
299 ret = nonlin::nonlin(par);
300 %else
301 *info = 1;
302 *nfev = 0;
303 *fnorm = 0;
304 %end
305 Matrix<creal, @m_cols, 1> d;
306 d << Map<Matrix<creal,@nx,1> >(x), Map<Matrix<creal,@ni,1> >(u), mi@iblock;
307 Map<Matrix<creal, @nx, 1> > xn(x_new);
308 @gen_xn
309 Map<Matrix<creal, @no, 1> > xo(o);
310 @gen_xo
311 return ret;
312 #undef GET_U
313 #undef DTP_U
314 }
315 %end
316
317 %if (@resample)
318 #include <zita-resampler/resampler.h>
319
320 class FixedRateResampler {
321 private:
322 Resampler r_up, r_down;
323 int inputRate, outputRate;
324 int last_in_count;
325 public:
326 int setup(int _inputRate, int _outputRate);
327 int up(int count, float *input, float *output);
328 void down(float *input, float *output);
329 int max_out_count(int in_count) {
330 return static_cast<int>(ceil((in_count*static_cast<double>(outputRate))/inputRate)); }
331 };
332
333 int FixedRateResampler::setup(int _inputRate, int _outputRate)
334 {
335 const int qual = 16; // resulting in a total delay of 2*qual (0.7ms @44100)
336 inputRate = _inputRate;
337 outputRate = _outputRate;
338 if (inputRate == outputRate) {
339 return 0;
340 }
341 // upsampler
342 int ret = r_up.setup(inputRate, outputRate, 1, qual);
343 if (ret) {
344 return ret;
345 }
346 // k == filtlen() == 2 * qual
347 // pre-fill with k-1 zeros
348 r_up.inp_count = r_up.filtlen() - 1;
349 r_up.out_count = 1;
350 r_up.inp_data = r_up.out_data = 0;
351 r_up.process();
352 // downsampler
353 ret = r_down.setup(outputRate, inputRate, 1, qual);
354 if (ret) {
355 return ret;
356 }
357 // k == filtlen() == 2 * qual * fact
358 // pre-fill with k-2 zeros
359 r_down.inp_count = r_down.filtlen() - 2;
360 r_down.out_count = 1;
361 r_down.inp_data = r_down.out_data = 0;
362 r_down.process();
363 return 0;
364 }
365
366 int FixedRateResampler::up(int count, float *input, float *output)
367 {
368 if (inputRate == outputRate) {
369 memcpy(output, input, count*sizeof(float));
370 r_down.out_count = count;
371 return count;
372 }
373 r_up.inp_count = count;
374 r_down.out_count = count+1; // +1 == trick to drain input
375 r_up.inp_data = input;
376 int m = max_out_count(count);
377 r_up.out_count = m;
378 r_up.out_data = output;
379 r_up.process();
380 assert(r_up.inp_count == 0);
381 assert(r_up.out_count <= 1);
382 r_down.inp_count = m - r_up.out_count;
383 return r_down.inp_count;
384 }
385
386 void FixedRateResampler::down(float *input, float *output)
387 {
388 if (inputRate == outputRate) {
389 memcpy(output, input, r_down.out_count*sizeof(float));
390 return;
391 }
392 r_down.inp_data = input;
393 r_down.out_data = output;
394 r_down.process();
395 assert(r_down.inp_count == 0);
396 assert(r_down.out_count == 1);
397 }
398
399 FixedRateResampler smp;
400 %end
401
402 class DKPlugin: public PluginDef {
403 public:
404 float pots[@npl+@add_npl];
405 private:
406 creal pots_last[@npl+@add_npl];
407 Matrix<creal, @nx, 1> x_last;
408 @DKPlugin_fields
409 public:
410 EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
411 DKPlugin();
412 static void init(unsigned int samplingFreq, PluginDef *plugin);
413 static void process(int count, float *input, float *output, PluginDef *plugin);
414 static int registerparam(const ParamReg& reg);
415 static int uiloader(const UiBuilder& builder, int form);
416 static void del_instance(PluginDef *plugin);
417 };
418
419 DKPlugin::DKPlugin():
420 PluginDef(), pots(), pots_last(), x_last()@DKPlugin_init {
421 version = PLUGINDEF_VERSION;
422 flags = 0;
423 id = @plugindef.s_id;
424 name = @plugindef.l_name;
425 groups = 0;
426 description = @plugindef.l_description;
427 category = @plugindef.l_category;
428 shortname = @plugindef.l_shortname;
429 mono_audio = process;
430 set_samplerate = init;
431 register_params = registerparam;
432 load_ui = uiloader;
433 delete_instance = del_instance;
434 for (int i = 0; i < @nx; i++) {
435 x_last(i) = x0_data[i];
436 }
437 }
438
439 #define PARAM(p) ("@id" "." p)
440
441 int DKPlugin::registerparam(const ParamReg& reg) {
442 %if (@regs)
443 DKPlugin& self = *static_cast<DKPlugin*>(reg.plugin);
444 %end
445 %for @r in @regs:
446 reg.registerVar(PARAM("@r.id"), N_("@r.name"), "S", N_("@r.desc"), &self.pots[@r.varidx], 0.5, 0, 1, 0.01);
447 %end
448 return 0;
449 }
450
451 void DKPlugin::init(unsigned int samplingFreq, PluginDef *plugin) {
452 %if (@resample)
453 smp.setup(samplingFreq, @fs);
454 %end
455 %if (@filter_init)
456 DKPlugin& self = *static_cast<DKPlugin*>(plugin);
457 @filter_init
458 %end
459 }
460
461 void DKPlugin::process(int n, float *u, float *o, PluginDef *plugin) {
462 DKPlugin& self = *static_cast<DKPlugin*>(plugin);
463 %if (@npl || @add_npl)
464 creal t[@npl+@add_npl];
465 @calc_pots
466 %end
467 @process_add
468 // start copied and modified code
469 Matrix<creal, @nn, 1> mi;
470 %if (@nn)
471 %% g_min = Matrix<creal, @nni, 1>::Constant(HUGE_VAL);
472 %% g_max = Matrix<creal, @nni, 1>::Constant(-HUGE_VAL);
473 %% g_fnorm = 0;
474 creal fnorm;
475 Matrix<creal, @nn, 1> mp;
476 Array<creal, @nni, 1> p_val;
477 nonlin_param par@nonlin_mat_list_calc;
478 %end
479 %if (@resample)
480 float buf[smp.max_out_count(n)];
481 n = smp.up(n, u, buf);
482 #define GET_U (buf+j*@ni)
483 %else
484 #define GET_U (u+j*@ni)
485 %end
486 for (int j = 0; j < n; j++) {
487 #define DTP_U float
488 @pre_filter
489 %if (@npl)
490 for (int k = 0; k < @npl; k++) {
491 self.pots_last[k] = @timecst * t[k] + (1-@timecst) * self.pots_last[k];
492 }
493 calc_inv_update(self.pots_last, par);
494 %end
495 %if (@nn)
496 Matrix<creal, @mp_cols, 1> dp;
497 dp << self.x_last, Map<Matrix<float,@ni,1> >(GET_U).cast<creal>();
498 @gen_mp
499 nonlin::nonlin(par);
500 %% int ret = nonlin::nonlin_solve(par);
501 %% if (fnorm > g_fnorm) {
502 %% g_fnorm = fnorm;
503 %% }
504 %% if (ret != 0) {
505 %% return;
506 %% }
507 %end
508 Matrix<creal, @m_cols, 1> d;
509 d << self.x_last, Map<Matrix<float,@ni,1> >(GET_U).cast<creal>(), mi@iblock;
510 %if (@nx)
511 Matrix<creal, @nx, 1>& xn = self.x_last;
512 @gen_xn
513 %end
514 %if (@resample)
515 Map<Matrix<float, @no, 1> > xo(buf+@no*j);
516 %else
517 Map<Matrix<float, @no, 1> > xo(o+@no*j);
518 %end
519 @gen_xo_float
520 @post_filter
521 #undef GET_U
522 #undef DTP_U
523 }
524 %if (@resample)
525 smp.down(buf, o);
526 %end
527 @post_process
528 // end copied code
529 }
530
531 int DKPlugin::uiloader(const UiBuilder& b, int form) {
532 if (!(form & UI_FORM_STACK)) {
533 return -1;
534 }
535 %parse ("module_ui_template")
536 return 0;
537 }
538
539 void DKPlugin::del_instance(PluginDef *p)
540 {
541 delete static_cast<DKPlugin*>(p);
542 }
543
544 %if (@dev_interface)
545 extern "C" __attribute__ ((visibility ("default")))
546 int get_gx_plugin(unsigned int idx, PluginDef **pplugin)
547 {
548 const int count = 1;
549 if (!pplugin) {
550 return count;
551 }
552 switch (idx) {
553 case 0: *pplugin = new DKPlugin; return count;
554 default: *pplugin = 0; return -1;
555 }
556 }
557 %else
558 namespace pluginlib { namespace @plugindef.namespace {
559 PluginDef *plugin() {
560 return new DKPlugin;
561 }
562 }}
563 %end
564
565 %if (@{plugindef.lv2_plugin_type})
566 %parse ("lv2_interface")
567 %end
568 """)
569
570 lv2_manifest = Template("""
571 \@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
572 \@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
573
574 <http://guitarix.sourceforge.net/plugins/@id#@{plugindef.lv2_versioned_id}>
575 a lv2:Plugin ;
576 lv2:binary <@{plugindef.lv2_versioned_id}.so> ;
577 rdfs:seeAlso <@{plugindef.lv2_versioned_id}.ttl> .
578 """)
579
580 lv2_ttl = Template("""
581 \@prefix doap: <http://usefulinc.com/ns/doap#> .
582 \@prefix foaf: <http://xmlns.com/foaf/0.1/> .
583 \@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
584 \@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
585 \@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
586 \@prefix guiext: <http://lv2plug.in/ns/extensions/ui#>.
587
588 <http://guitarix.sourceforge.net#devel>
589 a foaf:Group ;
590 foaf:name "Guitarix team" ;
591 foaf:mbox <mailto:guitarix-developer\@lists.sourceforge.net> ;
592 rdfs:seeAlso <http://guitarix.sourceforge.net> .
593
594 <http://guitarix.sourceforge.net/plugins/@id>
595 a doap:Project ;
596 doap:maintainer <http://guitarix.sourceforge.net#devel> ;
597 doap:name "@{plugindef.name}" .
598
599 <http://guitarix.sourceforge.net/plugins/@id#@{plugindef.lv2_versioned_id}>
600 a lv2:Plugin ,
601 lv2:@{plugindef.lv2_plugin_type} ;
602 doap:maintainer <http://guitarix.sourceforge.net#devel> ;
603 doap:name "@{plugindef.name}";
604 doap:license <http://usefulinc.com/doap/licenses/gpl> ;
605 lv2:project <http://guitarix.sourceforge.net/plugins/@id> ;
606 lv2:optionalFeature lv2:hardRTCapable ;
607 lv2:minorVersion @{plugindef.lv2_minor_version};
608 lv2:microVersion @{plugindef.lv2_micro_version};
609
610 lv2:port\
611 %for @p in @lv2_ports:\
612 [
613 a @{p.type_list} ;
614 lv2:index @{p.index} ;
615 lv2:symbol "@{p.symbol}" ;
616 lv2:name "@{p.name}" ;
617 %if (@{p.control_index} >= 0)\
618 lv2:default @{p.default} ;
619 lv2:minimum @{p.minimum} ;
620 lv2:maximum @{p.maximum} ;
621 %end
622 ]%if(@velocityHasNext),%end\
623 %end.
624 """)
625
626 lv2_interface = Template("""
627 #include "lv2/lv2plug.in/ns/lv2core/lv2.h"
628
629 #define LV2_PLUGIN_URI "http://guitarix.sourceforge.net/plugins/@id#@{plugindef.lv2_versioned_id}"
630
631 typedef enum {
632 %for @p in @lv2_ports:\
633 PORT_@{p.symbol} = @{p.index},
634 %end
635 } PortIndex;
636
637 class LV2_DKPlugin: public DKPlugin {
638 public:
639 // Port buffers
640 float* ports[@{lv2_ports.port_count()}];
641 public:
642 LV2_DKPlugin(): DKPlugin() {}
643 };
644
645 static LV2_Handle
646 instantiate(const LV2_Descriptor* descriptor,
647 double rate,
648 const char* bundle_path,
649 const LV2_Feature* const* features)
650 {
651 LV2_DKPlugin *p = new LV2_DKPlugin;
652 p->set_samplerate(rate, p);
653 return static_cast<LV2_Handle>(p);
654 }
655
656 static void
657 connect_port(LV2_Handle instance,
658 uint32_t port,
659 void* data)
660 {
661 static_cast<LV2_DKPlugin*>(instance)->ports[port] = static_cast<float*>(data);
662 }
663
664 static void
665 activate(LV2_Handle instance)
666 {
667 }
668
669 static void
670 run(LV2_Handle instance, uint32_t n_samples)
671 {
672 LV2_DKPlugin* p = static_cast<LV2_DKPlugin*>(instance);
673
674 %for @p in @lv2_ports:\
675 %if (@{p.control_index} >= 0)\
676 p->pots[@{p.control_index}] = *(p->ports[@{p.index}]);
677 %end
678 %end
679 %if (@ni == 1 && @no == 1)
680 p->process(n_samples, p->ports[0], p->ports[1], p);
681 %else
682 p->process(n_samples, p->ports[0], p->ports[1], p->ports[2], p->ports[3], p);
683 %end
684 }
685
686 static void
687 deactivate(LV2_Handle instance)
688 {
689 }
690
691 static void
692 cleanup(LV2_Handle instance)
693 {
694 LV2_DKPlugin* p = static_cast<LV2_DKPlugin*>(instance);
695 p->delete_instance(p);
696 }
697
698 static const void*
699 extension_data(const char* uri)
700 {
701 return NULL;
702 }
703
704 static const LV2_Descriptor descriptor = {
705 LV2_PLUGIN_URI,
706 instantiate,
707 connect_port,
708 activate,
709 run,
710 deactivate,
711 cleanup,
712 extension_data
713 };
714
715 LV2_SYMBOL_EXPORT
716 extern "C" __attribute__ ((visibility ("default")))
717 const LV2_Descriptor*
718 lv2_descriptor(uint32_t index)
719 {
720 switch (index) {
721 case 0:
722 return &descriptor;
723 default:
724 return NULL;
725 }
726 }
727 """)
728
729 c_template_calc_nonlin = Template("""
730 %if (@dev_interface)
731 extern "C" __attribute__ ((visibility ("default")))
732 int calc_@{namespace}(int n, creal *p, creal *i, creal *v, int *info, int *nfev, creal *fnorm) {
733 int ret = 0;
734 Matrix<creal, @g_nn, 1> mp;
735 Matrix<creal, @g_nn, 1> mi;
736 Map<Matrix<creal, @g_nn, 1> >Mv(v);
737 Array<creal, @g_nni, 1> p_val;
738 nonlin_param par@nonlin_mat_list;
739 for (int k = 0; k < n; k++) {
740 calc_inv_update(p+k*(@nni+@npl), par);
741 mp@pblockV << Map<Matrix<creal, @nni, 1> >(p+k*(@nni+@npl)+@npl);
742 ret = @namespace::nonlin_solve(par);
743 Map<Matrix<creal, @nno, 1> >(i+k*@nno) << mi@iblockV;
744 }
745 return ret;
746 }
747 %end
748 """)
749
750 c_template_nonlin_func_hybr = Template("""
751 static int fcn(void *p, int n, const creal *v, creal *fvec, int iflag ) {
752 nonlin_param& par = *static_cast<nonlin_param *>(p);
753 @expression
754 return 0;
755 }
756 """)
757
758 c_template_nonlin_func_lm = Template("""
759 static int fcn(void *p, int m, int n, const creal *v, creal *fvec, int iflag ) {
760 nonlin_param& par = *static_cast<nonlin_param *>(p);
761 @expression
762 return 0;
763 }
764 """)
765
766 c_template_nonlin_func_hybrCC = Template("""
767 typedef int root_fcn(void*p, const creal *v, creal *fvec, int iflag);
768 static int fcn(void *p, const creal *v, creal *fvec, int iflag) {
769 nonlin_param& par = *static_cast<nonlin_param *>(p);
770 @expression
771 return 0;
772 }
773 """)
774
775 c_template_nonlin_solver_hybr = Template("""
776 static int nonlin(struct nonlin_param &par) {
777 int maxfev, mode, nprint, ldfjac;
778 creal xtol, epsfcn, factor;
779 creal __attribute__((aligned(16))) fvec[@nn];
780 creal __attribute__((aligned(16))) fjac[@nn*@nn];
781 creal __attribute__((aligned(16))) qtf[@nn];
782 creal __attribute__((aligned(16))) wa1[@nn];
783 creal __attribute__((aligned(16))) wa2[@nn];
784 creal __attribute__((aligned(16))) wa3[@nn];
785 creal __attribute__((aligned(16))) wa4[@nn];
786 creal diag[@nn] = {%for @j in @solver_diag:@j,%end};
787 int ml, mu, lr;
788 creal r[(@nn*(@nn+1))/2];
789 lr = (@nn*(@nn+1))/2;
790 ml = @nn-1; /* unbanded jacobian */
791 mu = @nn-1; /* unbanded jacobian */
792 ldfjac = @nn;
793
794 /* parameter */
795 xtol = @solver_xtol;
796 maxfev = @solver_maxfev;
797 epsfcn = 0.;
798 //mode = 2; /* explicit variable scaling with diag */
799 mode = 1; /* automatic variable scaling */
800 factor = @solver_factor;
801 nprint = 0;
802 /**/
803
804 @setup
805 @store_p
806 @p_transform
807 *par.info = __cminpack_func__(hybrd)(
808 fcn, &par, @nn, @var_v_ref, fvec, xtol, maxfev, ml, mu, epsfcn, diag,
809 mode, factor, nprint, par.nfev, fjac, ldfjac, r, lr, qtf, wa1, wa2, wa3, wa4);
810 *par.fnorm = __cminpack_func__(enorm)(@nn, fvec);
811 @i_transform
812 int ret = 0;
813 if (*par.info != 1) {
814 if (!(*par.info == 5 && *par.fnorm < 1e-20)) {
815 ret = -1;
816 }
817 }
818 @cleanup
819 return ret;
820 }
821 """)
822
823 c_template_nonlin_solver_lm = Template("""
824 static int nonlin(struct nonlin_param &par) {
825 int maxfev, mode, nprint, ldfjac;
826 creal xtol, epsfcn, factor;
827 creal __attribute__((aligned(16))) fvec[@nn];
828 creal __attribute__((aligned(16))) fjac[@nn*@nn];
829 creal __attribute__((aligned(16))) qtf[@nn];
830 creal __attribute__((aligned(16))) wa1[@nn];
831 creal __attribute__((aligned(16))) wa2[@nn];
832 creal __attribute__((aligned(16))) wa3[@nn];
833 creal __attribute__((aligned(16))) wa4[@nn];
834 creal diag[@nn] = {%for @j in @solver_diag:@j,%end};
835 int __attribute__((aligned(16))) ipvt[@nn];
836 creal ftol, gtol;
837 ftol = sqrt(__cminpack_func__(dpmpar)(1)); // parameter
838 gtol = 0.; // parameter
839 ldfjac = @nn;
840
841 /* parameter */
842 xtol = @solver_xtol;
843 maxfev = @solver_maxfev;
844 epsfcn = 0.;
845 //mode = 2; /* explicit variable scaling with diag */
846 mode = 1; /* automatic variable scaling */
847 factor = @solver_factor;
848 nprint = 0;
849 /**/
850
851 @setup
852 @store_p
853 @p_transform
854
855 *par.info = __cminpack_func__(lmdif)(
856 fcn, &par, @nn, @nn, @var_v_ref, fvec, ftol, xtol, gtol, maxfev, epsfcn, diag,
857 mode, factor, nprint, par.nfev, fjac, ldfjac, ipvt, qtf, wa1, wa2, wa3, wa4);
858 *par.fnorm = __cminpack_func__(enorm)(@nn, fvec);
859 @i_transform
860 @cleanup
861 return (*par.info < 1 || *par.info > 4) ? -1 : 0;
862 }
863 """)
864
865 c_template_nonlin_solver_hybrCC = Template("""
866 %include ("hybrd.cc")
867
868 static int nonlin(struct nonlin_param &par) {
869 int maxfev, mode, nprint, ldfjac;
870 creal xtol, epsfcn, factor;
871 creal __attribute__((aligned(16))) fvec[@nn];
872 creal __attribute__((aligned(16))) fjac[@nn*@nn];
873 creal __attribute__((aligned(16))) qtf[@nn];
874 creal __attribute__((aligned(16))) wa1[@nn];
875 creal __attribute__((aligned(16))) wa2[@nn];
876 creal __attribute__((aligned(16))) wa3[@nn];
877 creal __attribute__((aligned(16))) wa4[@nn];
878 creal diag[@nn] = {%for @j in @solver_diag:@j,%end};
879 int ml, mu, lr;
880 creal r[(@nn*(@nn+1))/2];
881 lr = (@nn*(@nn+1))/2;
882 ml = @nn-1; /* unbanded jacobian */
883 mu = @nn-1; /* unbanded jacobian */
884 ldfjac = @nn;
885
886 /* parameter */
887 xtol = @solver_xtol;
888 maxfev = @solver_maxfev;
889 epsfcn = 0.;
890 //mode = 2; /* explicit variable scaling with diag */
891 mode = 1; /* automatic variable scaling */
892 factor = @solver_factor;
893 nprint = 0;
894 /**/
895
896 @setup
897 @store_p
898 @p_transform
899
900 *par.info = hybrdX<@nn>(fcn, &par, @var_v_ref, fvec, xtol, maxfev, ml, mu, epsfcn,
901 diag, mode, factor, nprint, par.nfev, fjac, ldfjac, r, lr,
902 qtf, wa1, wa2, wa3, wa4);
903 *par.fnorm = enorm<@nn>(fvec);
904 @i_transform
905 int ret = 0;
906 if (*par.info != 1) {
907 if (!(*par.info == 5 && *par.fnorm < 1e-20)) {
908 ret = -1;
909 }
910 }
911 @cleanup
912 return ret;
913 }
914 """)
915
916 c_template_nonlin_chained = Template("""
917 namespace @namespace {
918 @global_data_def
919
920 static int nonlin(struct nonlin_param &par) {
921 @chained_code
922 }
923
924 %if (@dev_interface)
925 static inline int nonlin_solve(nonlin_param& par) {
926 return nonlin(par);
927 }
928 %end
929 } // end namespace @namespace
930 %if (@extern_nonlin)
931 %parse ("c_template_calc_nonlin")
932 %end
933 """)
934
935 c_template_nonlin_solver = Template("""
936 namespace @namespace {
937 @global_data_def
938
939 @fcn_def
940
941 @nonlin_def
942
943 %if (@dev_interface)
944 static Matrix<creal, @nni, 1> last_good;
945 static Matrix<creal, @nn, 1> last_v0;
946
947 int nonlin_homotopy(nonlin_param& par, creal f) {
948 Matrix<creal, @nni, 1> end = @par_p;
949 @par_p = last_good + (@par_p - last_good) * f;
950 @par_v = last_v0;
951 int ret = nonlin(par);
952 @par_p = end;
953 if (ret != 0) {
954 return ret;
955 }
956 last_v0 = @par_v;
957 return 0;
958 }
959
960 static inline int nonlin_solve(nonlin_param& par) {
961 @v0_guess
962 int ret = nonlin(par);
963 if (ret != 0) {
964 std::list<creal> points;
965 points.push_back(0);
966 points.push_back(0.5);
967 points.push_back(1);
968 for (int j = 0; j < @solver_max_homotopy_iter; j++) {
969 std::list<creal>::iterator it = points.begin();
970 ++it;
971 ret = nonlin_homotopy(par, *it);
972 if (ret != 0) {
973 points.insert(it, (*points.begin()+*it)/2);
974 continue;
975 }
976 if (points.size() == 2) {
977 break;
978 }
979 points.erase(points.begin());
980 }
981 if (ret != 0) {
982 return ret;
983 }
984 }
985 last_good = @par_p;
986 last_v0 = @par_v;
987 return 0;
988 }
989 %end
990 } // end namespace @namespace
991
992 %if (@extern_nonlin)
993 %parse ("c_template_calc_nonlin")
994 %end
995 """)
996
997 c_template_table = Template("""
998 namespace @namespace {
999 static inline int nonlin(nonlin_param& par) {
1000 @call
1001 return 0;
1002 }
1003
1004 %if (@dev_interface)
1005 static inline int nonlin_solve(nonlin_param& par) {
1006 return nonlin(par);
1007 }
1008 %end
1009
1010 %parse ("c_template_calc_nonlin")
1011 } // end @namespace
1012 """)
1013
1014 #
1015 #-mavx -ffast-math
1016 #
1017 # ffast-math seems to trigger a compiler error on gcc 4.7.3
1018 # according to documentation it expands into list of settings, including
1019 # funsafe-math-optimizations, which seems to be responsible for the bug.
1020 # But funsafe-math-optimizations in turn just expands into another list of
1021 # settings. When using the expanded list of settings the bug is gone (?!).
1022 #
1023 # maybe -mavx is the culprit (removed for now)??
1024 #
1025 build_script_template = Template("""\
1026 #! /bin/bash
1027 cd `dirname $0`
1028 fname="${1-@sourcename}"
1029 lname="${2-@soname}"
1030 lname_="${2-@soname_}"
1031 mo="-fwrapv -ffast-math -msse2"
1032 #mo="-fwrapv -fno-math-errno -ffinite-math-only -fno-rounding-math"
1033 #mo="$mo -fno-signaling-nans -fcx-limited-range -fno-signed-zeros"
1034 #mo="$mo -fno-trapping-math -fassociative-math -freciprocal-math"
1035 : ${CC:=c++}
1036 %if (@debug)
1037 dbg="-g -O2"
1038 %else
1039 dbg="-O2 -Wl,--strip-all -DNDEBUG"
1040 %end
1041 co="-shared -fPIC -Wall -fvisibility=hidden"
1042 lo="-Wl,-O1,-Bsymbolic-functions,-z,relro"
1043 libs="@libraries"
1044 inc="@includes"
1045 def="@defines"
1046 opt="-fno-stack-protector"
1047 set -e
1048 %if (@optimize)
1049 $CC $co $lo $mo $opt -fprofile-arcs $dbg $CFLAGS $def $inc "$fname" -o "$lname_" $libs
1050 python t.py
1051 $CC $co $lo $mo $opt -fprofile-use $dbg $CFLAGS $def $inc "$fname" -o "$lname" $libs
1052 %else
1053 $CC $co $lo $mo $opt $dbg $CFLAGS $def $inc "$fname" -o "$lname" $libs
1054 %end
1055 """)
1056
1057 faust_filter_template = Template("""\
1058 %if (@build_script)\
1059 // generated by @build_script
1060 %else\
1061 // generated automatically
1062 %end
1063 // DO NOT MODIFY!
1064 declare id "@plugindef.id";
1065 declare name "@plugindef.name";
1066 declare category "@plugindef.category";
1067 %if (@plugindef.shortname)\
1068 declare shortname "@plugindef.shortname";
1069 %end
1070 %if (@plugindef.description)\
1071 declare description "@plugindef.description";
1072 %end
1073
1074 import("filter.lib");
1075
1076 process = pre : iir((@b_list),(@a_list)) with {
1077 LogPot(a, x) = if(a, (exp(a * x) - 1) / (exp(a) - 1), x);
1078 Inverted(b, x) = if(b, 1 - x, x);
1079 s = 0.993;
1080 fs = float(SR);
1081 pre = @pre_filter;
1082
1083 %for @sl in @sliders:
1084 @sl.id = vslider("@sl.id[name:@sl.name]", 0.5, 0, 1, 0.01) : Inverted(@sl.inv) : LogPot(@sl.loga) : smooth(s);
1085 %end
1086
1087 @coeffs
1088 };
1089 """)
1090
1091 module_ui_template = Template("""
1092 b.openHorizontalhideBox("");
1093 %if (@have_master_slider)
1094 b.create_master_slider(PARAM("@master_slider_id"), 0);
1095 %end
1096 b.closeBox();
1097 b.openHorizontalBox("");
1098 %for @k in @knob_ids:
1099 b.create_small_rackknobr(PARAM("@k"), 0);
1100 %end
1101 b.closeBox();
1102 """)
0 from __future__ import division
1 import math, sys
2 from collections import OrderedDict
3 import sympy as sp
4 import numpy as np
5 import numpy.matlib as ml
6 import numpy.linalg as la
7 import dk_templates
8 from codelib import *
9 import dk_simulator
10
11 def solver_set_defaults(solver_dict=None):
12 if solver_dict is None:
13 solver_dict = {}
14 else:
15 solver_dict = solver_dict.copy()
16 solver_dict.setdefault("method", "hybr")
17 solver_dict.setdefault("factor", 1.e2)
18 solver_dict.setdefault("xtol", math.sqrt(sys.float_info.epsilon))
19 solver_dict.setdefault("maxfev", 2000)
20 solver_dict.setdefault("max_homotopy_iter", 100)
21 return solver_dict
22
23
24 class Structure(object):
25
26 def __init__(self, name):
27 self.name = name
28 self.members = []
29 self.nonlin_info = False
30 self.minmax_info = None
31
32 def add(self, m):
33 self.members.append(m)
34
35 def add_nonlin_info(self):
36 self.nonlin_info = True;
37
38 def add_minmax_info(self, rows):
39 self.minmax_info = rows
40
41 def get_initializer(self, kw):
42 s = dict((m.name, i) for i, m in enumerate(v for v in self.members if v.pointer))
43 n = len(s)
44 if self.nonlin_info:
45 s['info'] = n
46 s['nfev'] = n+1
47 s['fnorm'] = n+2
48 n += 3
49 if self.minmax_info:
50 s['p_val'] = n
51 n += 1
52 l = [None]*n
53 s2 = set()
54 for k, v in kw.items():
55 try:
56 i = s[k]
57 except KeyError:
58 raise ValueError("unknown struct member: %s" % k)
59 if isinstance(v, VariableAccess):
60 l[i] = str(v.address_of())
61 else:
62 l[i] = v
63 s2.add(k)
64 missing = set(s) - s2
65 if missing:
66 raise ValueError("no structure initialization for: %s" % ", ".join(missing))
67 if not l:
68 return ""
69 return "("+", ".join(l)+")"
70
71 def generate_lines(self):
72 arglist = [m.generate("_") for m in self.members if m.pointer]
73 initlist = []
74 for m in self.members:
75 if m.pointer:
76 initlist.append("%s(%s_)" % (m.name, m.name))
77 else:
78 initlist.append("%s()" % m.name)
79 l = []
80 l.append("struct %s {\n" % self.name)
81 l += [" %s;\n" % m for m in self.members]
82 if self.nonlin_info:
83 l.append(" int *info;\n")
84 l.append(" int *nfev;\n")
85 l.append(" creal *fnorm;\n")
86 initlist += ["info(info_)", "nfev(nfev_)", "fnorm(fnorm_)"]
87 arglist += ["int *info_", "int *nfev_", "creal *fnorm_"]
88 if self.minmax_info:
89 p_val = MatrixDeclaration('p_val', rows=self.minmax_info, cols=1, pointer=True, array=True)
90 l.append(" %s;\n" % p_val)
91 initlist.append("p_val(p_val_)")
92 arglist.append(p_val.generate("_"))
93 if initlist:
94 l.append(" inline %(name)s(%(args)s): %(init)s {}\n" % dict(
95 name = self.name,
96 args = ", ".join(arglist),
97 init = ", ".join(initlist),
98 ))
99 l.append("};")
100 return l
101
102 def __str__(self):
103 return "".join(self.generate_lines())
104
105
106 class NonlinFunction(object):
107
108 def __init__(self, global_ns, neq, on):
109 self.global_ns = global_ns
110 self.neq = neq
111 self.have_constant_matrices = (neq.eq.np == 0)
112 self.locals = Namespace()
113 self.input_slice = on.input_slice
114 self.output_slice = on.output_slice
115
116 def expr_list(self, v):
117 par_v = make_symbol_vector('(*par.v)', self.neq.nn)
118 l = []
119 f = self.neq.eq.f
120 off = 0
121 if self.neq.v_slice:
122 off = self.neq.v_slice.start
123 f = f[self.neq.v_slice]
124 for expr, vl, base in f:
125 for var, idx in zip(vl, base):
126 if idx >= off:
127 vv = v[idx-off]
128 else:
129 vv = par_v[idx]
130 expr = expr.subs(var, vv)
131 l.append(expr)
132 return l
133
134 def generate(self, template):
135 if self.neq.v_slice:
136 iblockV = self.input_slice
137 oblockV = self.output_slice
138 blockM = (self.neq.v_slice, self.neq.v_slice)
139 start = self.output_slice.start
140 else:
141 iblockV = oblockV = None
142 blockM = None
143 start = 0
144 v = make_symbol_vector('v', self.neq.nn)
145 i = VectorAccess('i', param=True)
146 l = []
147 l += expr_list_to_ccode(str(i), self.expr_list(v), '(%d)', start)
148 mv = MatrixDefinition('mv', rows=self.neq.nn, cols=1)
149 Mfvec = MatrixDefinition('Mfvec', value='fvec', rows=self.neq.nn, cols=1)
150 self.locals.add(mv)
151 self.locals.add(Mfvec)
152 l += self.locals.generate_lines()
153 CZ = self.neq.eq.CZ[self.neq.v_slice]
154 K = self.neq.eq.K
155 if self.have_constant_matrices:
156 K = K[blockM]
157 l.append("mv << %s;\n" % ", ".join(
158 ['v[%d]' % i if z else '0' for i, z in enumerate(CZ)]))
159 if not matrix_is_identity(K):
160 if self.have_constant_matrices:
161 self.global_ns.add(MatrixDefinition('K', K))
162 K = MatrixAccess('K')
163 else:
164 K = MatrixAccess('K', param=True, block=blockM, pointer=False)
165 l.append("Mfvec = %(p)s + %(K)s * %(i)s - %(mv)s;\n" % dict(
166 p = VectorAccess('p', param=True, block=iblockV),
167 K = K,
168 i = VectorAccess('i', param=True, block=oblockV),
169 mv = VectorAccess('mv'),
170 ))
171 else:
172 l.append("Mfvec = %(p)s + %(i)s - %(mv)s;" % dict(
173 p = VectorAccess('p', param=True, block=iblockV),
174 i = VectorAccess('i', param=True, block=oblockV),
175 mv = VectorAccess('mv'),
176 ))
177 return template.render(dict(expression=join_with_indent(l)))
178
179
180 class NonlinFunctionCC(object):
181
182 def __init__(self, global_ns, neq, extra_sources):
183 self.global_ns = global_ns
184 self.neq = neq
185 self.extra_sources = extra_sources
186
187 def generate(self, template):
188 neq = self.neq
189 have_constant_matrices = (neq.eq.np == 0)
190 end = neq.cc_slice.start
191 cc = neq.cc_slice.stop - neq.cc_slice.start
192 p0_slice = slice(neq.p_slice.start, neq.p_slice.stop-cc)
193 p1_slice = slice(neq.p_slice.stop-cc, neq.p_slice.stop)
194 i0_slice = slice(neq.i_slice.start, neq.i_slice.stop-cc)
195 i1_slice = slice(neq.i_slice.stop-cc, neq.i_slice.stop)
196 M0 = (slice(0, end), slice(end, neq.nn))
197 M1 = (slice(end, neq.nn), slice(0, neq.nn))
198 loc = Namespace()
199 l = []
200 loc.add(MatrixDefinition('Mv', value='v', rows=neq.nn-end, cols=1, aligned=False, const=True))
201 if self.extra_sources:
202 loc.add(MatrixDefinition('pt', rows=p0_slice.stop-p0_slice.start, cols=1, array=True))
203 pt = VectorAccess('pt')
204 else:
205 loc.add(MatrixDefinition('pt', rows=neq.nn, cols=1))
206 pt = VectorAccess('pt', block=p0_slice)
207 l += loc.generate_lines()
208 if have_constant_matrices:
209 #self.global_ns.add(MatrixDefinition('Ku', neq.eq.K[M0]))
210 self.global_ns.add(MatrixDefinition('Ku', neq.Ku))
211 Ku = MatrixAccess('Ku')
212 else:
213 Ku = MatrixAccess('K', param=True, block=M0, pointer=False)
214 l.append("%s = %s + %s * %s;\n" % (
215 pt,
216 VectorAccess('p', param=True, block=p0_slice),
217 Ku,
218 VectorAccess('Mv')))
219 if self.extra_sources:
220 shape_transform = self.extra_sources.get("shape_transform", ())
221 for mat in shape_transform:
222 self.global_ns.add(mat)
223 if shape_transform:
224 def nth(j):
225 idx = []
226 for bl in neq.subblocks:
227 ln = bl.v_slice.stop - bl.v_slice.start
228 idx.append(j)
229 j += ln
230 return idx
231 def spliced(n):
232 for a in range(n):
233 yield a
234 yield a+n
235 nn2 = end//2
236 loc.add(MatrixDeclaration('PP1', rows=nn2, cols=1, array=True))
237 l += loc.generate_lines()
238 l.append("PP1 << %s;\n" % ", ".join(["pt(%d)" % i for i in nth(1)]))
239 loc.add(MatrixDeclaration('PP0', rows=nn2, cols=1, array=True))
240 l += loc.generate_lines()
241 l.append("PP0 << %s;\n" % ", ".join(["pt(%d)" % i for i in nth(0)]))
242 l += loc.generate_lines()
243 l.append("pt.head<%d>() = (Spm1 * PP1 + Ssm1) * PP1 + Sam1 + ((Spm2 * PP1 + Ssm2) * PP1 + Sam2) * PP0;\n" % nn2)
244 loc.add(MatrixDeclaration('res', rows=end, cols=1, array=True))
245 l += loc.generate_lines()
246 inp = ["&pt(%d)" % (i//2) for i in range(end)]
247 outp = ["&res(%d)" % i for i in spliced(nn2)]
248 else:
249 inp = []
250 outp = []
251 for bl in neq.subblocks:
252 o = VectorAccess('i', param=True)
253 for j in range(bl.i_slice.start, bl.i_slice.stop):
254 inp.append("&pt(%d)" % bl.p_slice.start)
255 outp.append("&%s(%d)" % (o, j))
256 jj = 0
257 tables = self.extra_sources["tables"]
258 for bl in neq.subblocks:
259 for j, kn in enumerate(tables[bl.namespace].knot_data):
260 reorder = False
261 unused = False
262 ll = []
263 for i, v in enumerate(kn):
264 if not v.used():
265 unused = True
266 else:
267 ll.append(i)
268 if unused:
269 reorder = True
270 if reorder:
271 l.append("{ Array<creal, %d, 1> pt2; pt2 << %s;\n" % (len(ll), ", ".join(["pt(%d)" % (bl.p_slice.start+i) for i in ll])))
272 inpt = "&pt2(0)"
273 else:
274 inpt = inp[jj]
275 fu = "splev"
276 if kn[0].tp == 'pp':
277 fu = "splev_pp"
278 l.append("splinedata<AmpData::%s::maptype>::%s<%s>(&AmpData::%s::sd.sc[%d], %s, %s);\n"
279 % (bl.namespace, fu, ",".join([str(v.get_order()) for v in kn if v.used()]), bl.namespace, j, inpt, outp[jj]))
280 if reorder:
281 l.append("}\n")
282 jj += 1
283 if shape_transform:
284 l.append("pt.head<%d>() = ((Spm0 * PP1 + Ssm0) * PP1 + Sam0) * res.head<%d>();\n" % (nn2,nn2))
285 l.append("pt.tail<%d>() = ((Spm0 * PP1 + Ssm0) * PP1 + Sam0) * res.tail<%d>();\n" % (nn2,nn2))
286 l.append("%s << %s;\n" % (VectorAccess('i', param=True, block=i0_slice),
287 ", ".join(["pt(%d)" % v for v in spliced(nn2)])))
288 else:
289 loc.add(MatrixDefinition('pp', rows=neq.nn, cols=1, pointer=True))
290 l += loc.generate_lines()
291 l.append("%s = %s;\n" % (
292 MatrixAccess('pp', pointer=True).address_of(),
293 MatrixAccess('p', param=True).address_of()))
294 restore = "%s = %s;\n" % (
295 MatrixAccess('p', param=True).address_of(),
296 MatrixAccess('pp', pointer=True).address_of())
297 l.append("%s = %s;\n" % (
298 MatrixAccess('p', param=True).address_of(),
299 MatrixAccess('pt').address_of()))
300 l.append("int ret;\n")
301 for bl in neq.subblocks:
302 l.append("ret = %s::nonlin_solve(par);\n" % bl.namespace)
303 l.append("if (ret != 0) {\n")
304 l.append(" "+restore)
305 l.append(" return 1;\n")
306 l.append("};\n")
307 l.append(restore)
308 l.append("%s = %s;\n" % (VectorAccess('i', param=True, block=i1_slice), VectorAccess('Mv')))
309 if have_constant_matrices:
310 if M1:
311 self.global_ns.add(MatrixDefinition('Kl', neq.Kl))
312 Kl = MatrixAccess('Kl')
313 else:
314 Kl = MatrixAccess('K', block=M1)
315 else:
316 Kl = MatrixAccess('K', param=True, block=M1, pointer=False)
317 Mfvec = MatrixDefinition('Mfvec', value='fvec', rows=neq.nn-end, cols=1)
318 loc.add(Mfvec)
319 l += loc.generate_lines()
320 l.append("Mfvec = %(p)s + %(K)s * %(i)s;\n" % dict(
321 p = VectorAccess('p', param=True, block=p1_slice),
322 K = Kl,
323 i = VectorAccess('i', param=True, block=neq.i_slice),
324 ))
325 return template.render(dict(expression=join_with_indent(l)))
326
327
328 class NonlinSolver(object):
329
330 def __init__(self, base, glob, neq, solver_dict):
331 self.base = base
332 self.neq = neq
333 self.solver_dict = solver_dict
334 self.have_constant_matrices = (neq.eq.np == 0)
335 self.global_ns = glob
336 self.local_ns = Namespace()
337 self.mp_is_ident = matrix_is_identity(self.neq.U)
338 self.mpc_is_zero = matrix_is_zero(self.neq.Hc)
339 if self.mp_is_ident and self.mpc_is_zero:
340 self.input_slice = self.neq.p_slice
341 else:
342 self.input_slice = slice(0, self.neq.nn)
343 self.mi_is_ident = matrix_is_identity(self.neq.Mi)
344 if self.mi_is_ident:
345 self.output_slice = self.neq.i_slice
346 else:
347 self.output_slice = slice(0, self.neq.nn)
348 self.base["nn"] = self.neq.nn
349 self.base["nni"] = self.neq.nni
350 self.base["nno"] = self.neq.nno
351
352 def p_transform(self):
353 l = []
354 if self.mp_is_ident and self.mpc_is_zero:
355 return l
356 par = not self.have_constant_matrices
357 par_p = VectorAccess('p', param=True, block=self.neq.p_slice)
358 if not self.mp_is_ident:
359 if not par:
360 self.global_ns.add(MatrixDefinition('Mp', value=self.neq.U))
361 s = "%s * %s" % (MatrixAccess('Mp', param=par), par_p)
362 else:
363 s = "%s" % par_p
364 if not self.mpc_is_zero:
365 if not par:
366 self.global_ns.add(MatrixDefinition('Mpc', value=self.neq.Hc))
367 s += " + %s" % VectorAccess('Mpc', param=par, pointer=False)
368 g_nn = self.neq.eq.nonlin.nn
369 p_old_def = MatrixDefinition("p_old", rows=g_nn, cols=1, pointer=True)
370 self.local_ns.add(p_old_def)
371 p_old = VectorAccess(p_old_def)
372 p2_def = MatrixDefinition("p2", rows=g_nn, cols=1)
373 self.local_ns.add(p2_def)
374 p2 = VectorAccess(p2_def, block=self.input_slice)
375 l += self.local_ns.generate_lines()
376 l.append("%s = %s;\n" % (p2, s))
377 l.append("p_old = %s;\n" % par_p.address_of())
378 l.append("%s = &p2;\n" % par_p.address_of())
379 self.cleanup.append("%s = p_old;\n" % par_p.address_of())
380 return l
381
382 def i_transform(self):
383 l = []
384 if self.mi_is_ident or self.neq.nno == 0:
385 return l
386 g_nn = self.neq.eq.nonlin.nn
387 mi_def = MatrixDefinition("mi", rows=g_nn, cols=1)
388 mi = VectorAccess(mi_def, block=self.output_slice)
389 i_old_def = MatrixDefinition("i_old", rows=g_nn, cols=1, pointer=True)
390 i_old = VectorAccess(i_old_def)
391 par_i = VectorAccess('i', param=True, block=self.neq.i_slice)
392 self.global_ns.add(MatrixDefinition("Mi", self.neq.Mi))
393 self.local_ns.add(mi_def)
394 self.local_ns.add(i_old_def)
395 self.setup += self.local_ns.generate_lines()
396 self.setup.append("i_old = %s;\n" % VectorAccess('i', param=True).address_of())
397 self.setup.append("%s = &mi;\n" % VectorAccess('i', param=True).address_of())
398 l.append("%s = i_old;\n" % VectorAccess('i', param=True).address_of())
399 par = not self.have_constant_matrices
400 l.append("%(io)s = %(Mi)s * %(ii)s;" % dict(
401 io = par_i,
402 Mi = MatrixAccess('Mi', param=par, pointer=False),
403 ii = mi,
404 ))
405 return l
406
407 def make_var_v_ref(self):
408 start = 0
409 if self.neq.v_slice:
410 start = self.neq.v_slice.start
411 return "&%s(%s)" % (VectorAccess("v", param=True), start)
412
413 def generate(self, template):
414 d = self.base.copy()
415 self.setup = []
416 self.cleanup = []
417 d["i_transform"] = join_with_indent(self.i_transform())
418 d["p_transform"] = join_with_indent(self.p_transform())
419 d["setup"] = join_with_indent(self.setup)
420 d["cleanup"] = join_with_indent(self.cleanup)
421 d["var_v_ref"] = self.make_var_v_ref()
422 d["store_p"] = "%s = %s;\n" % (
423 VectorAccess('p_val', param=True, block=self.neq.p_slice),
424 VectorAccess('p', param=True, block=self.neq.p_slice),
425 )
426 return template.render(d)
427
428 class NonlinSolverCC(NonlinSolver):
429
430 def __init__(self, base, glob, neq, solver_dict):
431 NonlinSolver.__init__(self, base, glob, neq, solver_dict)
432 self.input_slice = self.neq.p_slice
433 self.mp_is_ident = True
434 self.mi_is_ident = True
435
436 def make_var_v_ref(self):
437 return "&%s(%s)" % (VectorAccess("v", param=True), self.neq.cc_slice.start)
438
439 def generate(self, template):
440 self.base = self.base.copy()
441 self.base["nn"] = self.base["nni"] = self.base["nno"] = self.neq.cc_slice.stop - self.neq.cc_slice.start
442 return NonlinSolver.generate(self, template)
443
444
445 class NonlinCode(object):
446
447 method_templates = {
448 'hybr': (dk_templates.c_template_nonlin_func_hybrCC,
449 dk_templates.c_template_nonlin_solver_hybrCC),
450 'lm': (dk_templates.c_template_nonlin_func_lm,
451 dk_templates.c_template_nonlin_solver_lm),
452 'hybrCC': (dk_templates.c_template_nonlin_func_hybrCC,
453 dk_templates.c_template_nonlin_solver_hybrCC),
454 }
455
456 def __init__(self, struct, neq, solver_dict, extra_sources):
457 self.struct = struct
458 self.neq = neq
459 self.solver_dict = solver_dict
460 self.extra_sources = extra_sources
461
462 def setup(self, d):
463 neq = self.neq
464 base = {}
465 base["v0_guess"] = d["v0_guess"]
466 base["dev_interface"] = d["dev_interface"]
467 g_nonlin = neq.eq.nonlin
468 base["extern_nonlin"] = not neq.subblocks or neq is g_nonlin
469 base["g_nn"] = g_nonlin.nn
470 base["g_nni"] = g_nonlin.nni
471 base["g_nno"] = g_nonlin.nno
472 base["npl"] = neq.eq.get_npl()
473 if neq.nn != g_nonlin.nn:
474 nn = base["nn"] = neq.nn
475 nni = base["nni"] = neq.nni
476 nno = base["nno"] = neq.nno
477 self.blockV = neq.v_slice
478 self.pblockV = neq.p_slice
479 base["pblockV"] = VectorAccess.block_expr(neq.p_slice)
480 base["iblockV"] = VectorAccess.block_expr(neq.i_slice)
481 else:
482 base["nn"] = nn = neq.nn
483 base["nni"] = nni = neq.nni
484 base["nno"] = nno = neq.nno
485 self.blockV = None
486 if nn != nni:
487 self.pblockV = slice(0, nni)
488 base["pblockV"] = VectorAccess.block_expr([0, nni])
489 else:
490 self.pblockV = None
491 base["pblockV"] = ""
492 if nn != nno:
493 base["iblockV"] = VectorAccess.block_expr([0, nno])
494 else:
495 base["iblockV"] = ""
496 if self.solver_dict:
497 for k, v in self.solver_dict.items():
498 base["solver_"+k] = v
499 ini = dict(
500 p = MatrixAccess('mp'),
501 i = MatrixAccess('mi'),
502 v = MatrixAccess('Mv'),
503 info = 'info',
504 fnorm = 'fnorm',
505 nfev = 'nfev',
506 p_val = MatrixAccess('p_val'),
507 )
508 base["nonlin_mat_list"] = self.struct.get_initializer(ini)
509 self.glob = Namespace()
510 base["namespace"] = neq.namespace
511 base["global_data_def"] = self.glob
512 return base
513
514 def generate(self, d):
515 base = self.setup(d)
516 d = base.copy()
517 neq = self.neq
518 func_t, solv_t = self.method_templates[self.solver_dict["method"]]
519 if isinstance(neq, dk_simulator.PartitionedNonlinEquations):
520 of = NonlinFunctionCC(self.glob, neq, self.extra_sources)
521 on = NonlinSolverCC(base, self.glob, neq, self.solver_dict)
522 else:
523 on = NonlinSolver(base, self.glob, neq, self.solver_dict)
524 of = NonlinFunction(self.glob, neq, on)
525 if func_t is not None:
526 d["fcn_def"] = of.generate(func_t)
527 d["nonlin_def"] = on.generate(solv_t)
528 d["par_p"] = VectorAccess("p", param=True, block=self.pblockV)
529 d["par_v"] = VectorAccess("v", param=True, block=self.blockV)
530 return dk_templates.c_template_nonlin_solver.render(d)
531
532
533 class NonlinChained(NonlinCode):
534
535 def __init__(self, s, neq):
536 NonlinCode.__init__(self, s, neq, None, None)
537
538 def generate(self, d):
539 d = self.setup(d)
540 self.glob.add(MatrixDefinition('K', self.neq.eq.K))
541 template = dk_templates.c_template_nonlin_chained
542 l = []
543 l.append("%s = %s;\n" % (
544 VectorAccess('p_val', param=True, block=self.neq.p_slice),
545 VectorAccess('p', param=True, block=self.neq.p_slice),
546 ))
547 g_nn = self.neq.eq.nonlin.nn
548 p_old_def = MatrixDefinition("p_old", rows=g_nn, cols=1, pointer=True)
549 local_ns = Namespace()
550 local_ns.add(p_old_def)
551 p_old = VectorAccess(p_old_def)
552 p2_def = MatrixDefinition("p2", rows=g_nn, cols=1)
553 local_ns.add(p2_def)
554 p2 = VectorAccess(p2_def, block=self.neq.p_slice)
555 l += local_ns.generate_lines()
556 l.append("int ret = 0;\n")
557 l.append("p2 = *par.p;\n")
558 l.append("p_old = par.p;\n")
559 l.append("par.p = &p2;\n")
560 for nlin in self.neq.subblocks:
561 st = nlin.p_slice.start
562 if st:
563 l.append("p2.segment<%(ln)d>(%(st)d) += K.block<%(ln)d,%(st)d>(%(st)d,0) * (*par.i).head<%(st)d>();\n"
564 % dict(ln=nlin.p_slice.stop-st, st=st))
565 l.append("ret = %s::nonlin_solve(par);\n" % nlin.namespace)
566 l.append("if (ret != 0) {\n")
567 l.append(" par.p = p_old;\n")
568 l.append(" return ret;\n")
569 l.append("}\n")
570 l.append("par.p = p_old;\n")
571 l.append("return 0;\n")
572 d["chained_code"] = join_with_indent(l)
573 return template.render(d)
574
575
576 class TableCode(object):
577
578 def __init__(self, struct, neq, extra_sources):
579 self.struct = struct
580 self.neq = neq
581 self.extra_sources = extra_sources
582
583 def add(self, d):
584 neq = self.neq
585 base = {}
586 base["dev_interface"] = d["dev_interface"]
587 g_nonlin = neq.eq.nonlin
588 base["g_nn"] = g_nonlin.nn
589 base["g_nni"] = g_nonlin.nni
590 base["g_nno"] = g_nonlin.nno
591 base["npl"] = neq.eq.get_npl()
592 nn = base["nn"] = neq.nn
593 nni = base["nni"] = neq.nni
594 nno = base["nno"] = neq.nno
595 if neq.v_slice:
596 self.blockV = neq.v_slice
597 self.pblockV = neq.p_slice
598 self.iblockV = neq.i_slice
599 base["blockV"] = VectorAccess.block_expr(neq.v_slice)
600 base["pblockV"] = VectorAccess.block_expr(neq.p_slice)
601 base["iblockV"] = VectorAccess.block_expr(neq.i_slice)
602 else:
603 self.blockV = None
604 base["blockV"] = ""
605 if nn != nni:
606 self.pblockV = slice(0, nni)
607 base["pblockV"] = VectorAccess.block_expr([0, nni])
608 else:
609 self.pblockV = None
610 base["pblockV"] = ""
611 if nn != nno:
612 base["iblockV"] = VectorAccess.block_expr([0, nno])
613 else:
614 base["iblockV"] = ""
615 ini = dict(
616 p = MatrixAccess('mp'),
617 i = MatrixAccess('mi'),
618 v = MatrixAccess('Mv'),
619 info = '&g_info',
620 fnorm = 'fnorm',
621 nfev = '&g_nfev',
622 p_val = MatrixAccess('p_val'),
623 )
624 base["nonlin_mat_list"] = self.struct.get_initializer(ini)
625 self.glob = Namespace()
626 d = base.copy()
627 d["namespace"] = neq.namespace
628 d["global_data_def"] = self.glob
629 d["par_p"] = VectorAccess("p", param=True, block=self.pblockV)
630 d["par_v"] = VectorAccess("v", param=True, block=self.iblockV)
631 return d
632
633 def generate(self, d):
634 d = self.add(d)
635 neq = self.neq
636 tables = self.extra_sources["tables"]
637 l = []
638 l.append("real t[AmpData::%(namespace)s::sd.m];\n" % d)
639 l.append("real m[%(nni)d+%(npl)d];\n" % d)
640 l.append("Map<Matrix<real, %(nni)d+%(npl)d, 1> >mp(m);\n" % d)
641 l.append("mp << last_pot.cast<real>(), (*par.p)%(pblockV)s.cast<real>();\n" % d)
642 for j, kn in enumerate(tables[neq.namespace].knot_data):
643 reorder = False
644 unused = False
645 fu = "splev"
646 ll = []
647 for i, v in enumerate(kn):
648 if not v.used():
649 unused = True
650 else:
651 ll.append(i)
652 if unused:
653 reorder = True
654 if kn[i].tp == 'pp':
655 fu = "splev_pp"
656 if reorder:
657 l.append("{ Array<creal, %d, 1> pt2; pt2 << %s;\n" % (len(ll), ", ".join(["mp(%d)" % i for i in ll])))
658 inpt = "&pt2(0)"
659 else:
660 inpt = "m"
661 l.append("splinedata<AmpData::%s::maptype>::%s<%s>(&AmpData::%s::sd.sc[%d], %s, &t[%d]);\n"
662 % (neq.namespace, fu, ",".join([str(v.get_order()) for v in kn if v.used()]), neq.namespace, j, inpt, j))
663 if reorder:
664 l.append("}\n")
665 l.append("(*par.i)%(iblockV)s = Map<Matrix<real, %(nno)d, 1> >(t).cast<creal>();\n" % d)
666 d["call"] = join_with_indent(l)
667 return dk_templates.c_template_table.render(d)
668
669
670 class UpdateMatrix(object):
671
672 def __init__(self, glob, eq, pot, pot_list, pot_func, Pv):
673 self.glob = glob
674 self.eq = eq
675 self.pot = pot
676 self.pot_func = pot_func
677 self.pot_list = pot_list
678 self.Pv = Pv
679
680 def trans_line(self, res, var, var_data, t, u, u_data):
681 if not isinstance(res, VariableAccess):
682 res = MatrixAccess(res)
683 if not isinstance(var, VariableAccess):
684 var = MatrixAccess(var)
685 self.glob.add(MatrixDefinition(var, var_data))
686 self.glob.add(MatrixDefinition(res, rows=var_data.shape[0], cols=var_data.shape[1]))
687 s = "%s = %s" % (res, var)
688 if t is None:
689 return s + ";\n"
690 if u_data is not None:
691 self.glob.add(MatrixDefinition(u, u_data))
692 return s + " - %s * %s;\n" % (t, u)
693
694 def generate(self, struct):
695 eq = self.eq
696 d = {}
697 pot = make_symbol_vector('pot', eq.np)
698 l = []
699 for (a, f), p in zip(self.pot_func, self.Pv):
700 s = str(a)
701 try:
702 i = self.pot_list.index(s)
703 except ValueError:
704 self.pot_list.append(s)
705 i = len(self.pot_list)-1
706 expr = f.subs(a, pot[i]) * p
707 l.append(expr)
708 d["pot_vars"] = ",".join(['"%s"' % v for v in self.pot_list])
709 d["pot"] = ",".join([str(self.pot.get(v,0.5)) for v in self.pot_list])
710 nx = eq.nx
711 no = eq.no
712 np = eq.np
713 nn = eq.nn
714 loc = Namespace()
715 loc.add(MatrixDeclaration("Rv", rows=np, cols=1))
716 lines = []
717 lines += loc.generate_lines()
718 lines += expr_list_to_ccode('Rv', l, '(%d)')
719 self.glob.add(MatrixDefinition("Q", eq.Q))
720 loc.add(MatrixDeclaration("Qi", rows=np, cols=np))
721 lines += loc.generate_lines()
722 lines.append("Qi = (%s + Matrix<creal, %d, %d>(Rv.asDiagonal())).inverse();\n" % (MatrixAccess('Q'), np, np))
723 if eq.nx:
724 if matrix_is_identity(eq.Uxl):
725 t = "Qi"
726 elif matrix_is_zero(eq.Uxl):
727 t = None
728 else:
729 loc.add(MatrixDeclaration("Tx", rows=nx, cols=np))
730 lines += loc.generate_lines()
731 self.glob.add(MatrixDefinition("Uxl", eq.Uxl))
732 lines.append("Tx = %s * Qi;\n" % MatrixAccess('Uxl'))
733 t = "Tx"
734 Mx_mat = eq.get_Mx()
735 m = MatrixDeclaration('Mx', rows=Mx_mat.shape[0], cols=Mx_mat.shape[1])
736 struct.add(m)
737 Mx = MatrixAccess(m, param=True)
738 lines.append(self.trans_line(Mx, 'Mx', Mx_mat, t, 'UR', eq.get_UR()))
739 m = MatrixDeclaration('Mxc', rows=eq.Bc.shape[0], cols=1)
740 struct.add(m)
741 Mxc = VectorAccess(m, param=True)
742 lines.append(self.trans_line(Mxc, 'Mxc', eq.Bc, t, 'Ucv', eq.Ucv.T))
743 if matrix_is_identity(eq.Uo):
744 t = "Qi"
745 elif matrix_is_zero(eq.Uo):
746 t = None
747 else:
748 loc.add(MatrixDeclaration("To", rows=no, cols=np))
749 lines += loc.generate_lines()
750 self.glob.add(MatrixDefinition('Uo', eq.Uo))
751 lines.append("To = %s * Qi;\n" % MatrixAccess('Uo'))
752 t = "To"
753 Mo_mat = eq.get_Mo()
754 m = MatrixDeclaration('Mo', rows=Mo_mat.shape[0], cols=Mo_mat.shape[1])
755 struct.add(m)
756 Mo = MatrixAccess(m, param=True)
757 lines.append(self.trans_line(Mo, 'Mo', Mo_mat, t, 'UR', eq.get_UR()))
758 m = MatrixDeclaration('Moc', rows=eq.Ec.shape[0], cols=1)
759 struct.add(m)
760 Moc = VectorAccess(m, param=True)
761 lines.append(self.trans_line(Moc, 'Moc', eq.Ec, t, 'Ucv', eq.Ucv.T))
762 if eq.nonlin and eq.nonlin.nni:
763 if matrix_is_identity(eq.Unl):
764 t = "Qi"
765 elif matrix_is_zero(eq.Unl):
766 t = None
767 else:
768 loc.add(MatrixDeclaration("Tp", rows=nn, cols=np))
769 lines += loc.generate_lines()
770 self.glob.add(MatrixDefinition("Unl", eq.Unl))
771 lines.append("Tp = %s * Qi;\n" % MatrixAccess('Unl'))
772 t = "Tp"
773 Mp_mat = eq.get_Mp()
774 struct.add(MatrixDeclaration('Mp', rows=Mp_mat.shape[0], cols=Mp_mat.shape[1]))
775 lines.append(self.trans_line(MatrixAccess('Mp', param=True, pointer=False), 'Mp', Mp_mat, t, 'UR.block<%d, %d>(0, 0)' % (eq.np, eq.mp_cols), None))
776 struct.add(MatrixDeclaration('Mpc', rows=eq.nonlin.Hc.shape[0], cols=1))
777 lines.append(self.trans_line(VectorAccess('Mpc', param=True, pointer=False), 'Mpc', eq.nonlin.Hc, t, 'Ucv', eq.Ucv.T))
778 struct.add(MatrixDeclaration('K', rows=eq.K.shape[0], cols=eq.K.shape[1]))
779 mp_cols = eq.get_mp_cols()
780 lines.append(self.trans_line(MatrixAccess('K', param=True, pointer=False), 'K', eq.K, t, 'UR.block<%d, %d>(0, %d)' % (eq.np, eq.get_mx_cols()-mp_cols, mp_cols), None))
781 d["update_pot"] = join_with_indent(lines)
782 return d
783
784
785 class LinearCode(object):
786
787 def __init__(self, glob, eq):
788 self.glob = glob
789 self.eq = eq
790
791 def generate(self):
792 eq = self.eq
793 param = bool(eq.np)
794 Mp = MatrixAccess('Mp', param=param, pointer=False)
795 Mo = MatrixAccess('Mo', param=param, pointer=False)
796 Moc = VectorAccess('Moc', param=param, pointer=False)
797 Mx = MatrixAccess('Mx', param=param, pointer=False)
798 Mxc = VectorAccess('Mxc', param=param, pointer=False)
799 d = {}
800 if eq.nonlin and eq.nn != eq.nonlin.nni:
801 pblock = slice(0, eq.nonlin.nni)
802 else:
803 pblock = None
804 d["m_cols"] = eq.get_mx_cols()
805 d["gen_mp"] = gen_linear_combination(
806 self.glob, VectorAccess('mp',block=pblock), 'dp', Mp, eq.get_Mp())
807 d["gen_xn"] = gen_linear_combination(
808 self.glob, 'xn', 'd', Mx, eq.get_Mx(), Mxc, eq.Bc)
809 d["gen_xo"] = gen_linear_combination(
810 self.glob, 'xo', 'd', Mo, eq.get_Mo(), Moc, eq.Ec)
811 d["gen_xo_float"] = gen_linear_combination(
812 self.glob, 'xo', 'd', Mo, eq.get_Mo(), cast="float")
813 return d
814
815
816 class NonlinEq(object):
817
818 def __init__(self, nn, nni, nno, np, npl, K, CZ, f, U, Hc, Mi, Kn):
819 self.nn = nn
820 self.nni = nni
821 self.nno = nno
822 self.np = np
823 self.npl = npl
824 self.K = K
825 self.CZ = CZ
826 self.f = f
827 self.U = U
828 self.Hc = Hc
829 self.Mi = Mi
830 self.Kn = Kn
831
832
833 class LV2_Port_List(object):
834
835 def __init__(self, pot_attr, pot, eq):
836 self.pot_attr = pot_attr
837 self.pot = pot
838 self.ni = eq.ni
839 self.no = eq.no
840
841 def port_count(self):
842 return self.ni + self.no + len(self.pot_attr)
843
844 def __len__(self):
845 return self.ni + self.no + len(self.pot_attr)
846
847 def __iter__(self):
848 idx = 0
849 max_idx = len(self) - 1
850 for i in range(self.ni):
851 yield dict(
852 type_list="lv2:AudioPort , lv2:InputPort",
853 index = idx,
854 symbol = "in%d" % i,
855 name = "In%d" % i,
856 control_index = -1,
857 separator = "," if idx == max_idx else "",
858 )
859 idx += 1
860 for i in range(self.no):
861 yield dict(
862 type_list="lv2:AudioPort , lv2:OutputPort",
863 index = idx,
864 symbol = "out%d" % i,
865 name = "Out%d" % i,
866 control_index = -1,
867 separator = "," if idx == max_idx else "",
868 )
869 idx += 1
870 for i, row in enumerate(self.pot_attr):
871 var = row[0]
872 name = row[1]
873 yield dict(
874 type_list="lv2:InputPort , lv2:ControlPort",
875 index = idx,
876 symbol = var,
877 name = name,
878 default = self.pot.get(var, 0.5),
879 minimum = 0.0,
880 maximum = 1.0,
881 control_index = i,
882 separator = "," if idx == max_idx else "",
883 )
884 idx += 1
885
886
887 class CodeGenerator(object):
888
889 def __init__(self, eq, solver_dict, solver_params, pot, pot_list, pot_func, pot_attr, Pv, extra_sources):
890 self.eq = eq
891 self.solver_dict = solver_set_defaults(solver_dict)
892 self.solver_params = solver_params
893 self.pot = pot
894 self.pot_list = pot_list
895 self.pot_func = pot_func
896 self.pot_attr = pot_attr
897 self.Pv = Pv
898 self.extra_sources = extra_sources
899 self.have_constant_matrices = (len(pot_func) == 0)
900
901 def pot_code(self):
902 d = {}
903 if self.pot_attr:
904 d['have_master_slider'] = True
905 d['master_slider_id'] = self.pot_attr[0][0]
906 else:
907 d['have_master_slider'] = False
908 d['knob_ids'] = [t[0] for t in self.pot_attr]
909 d['timecst'] = 0.01
910 d['regs'] = [dict(id=vv[0],name=vv[1],desc="",varidx=i) for i, vv in enumerate(self.pot_attr)]
911 ll = []
912 for i, (var, name, loga, inv, expr) in enumerate(self.pot_attr):
913 if loga and inv:
914 ss = "t[%d] = (exp(%s * (1-self.pots[%d])) - 1) / (exp(%s) - 1);" % (i, loga, i, loga)
915 elif loga:
916 ss = "t[%d] = (exp(%s * self.pots[%d]) - 1) / (exp(%s) - 1);" % (i, loga, i, loga)
917 elif inv:
918 ss = "t[%d] = 1-self.pots[%d];" % (i, i)
919 else:
920 ss = "t[%d] = self.pots[%d];" % (i, i)
921 ll.append(ss)
922 s = 0.993;
923 d['calc_pots'] = "\n ".join(ll)
924 return d
925
926 @staticmethod
927 def walk_eqs(nlin):
928 yield nlin
929 if nlin.__class__ is dk_simulator.NonlinEquations:
930 return
931 for bl in nlin.subblocks:
932 for neq in CodeGenerator.walk_eqs(bl):
933 yield neq
934
935 def gen_nonlin(self, nonlin, s, d, complist, code):
936 eq = self.eq
937 if isinstance(nonlin, dk_simulator.PartitionedNonlinEquations):
938 for i, nlin in enumerate(nonlin.subblocks):
939 #spar = solver_set_defaults({} if self.solver_params is None else self.solver_params[i])
940 self.gen_nonlin(nlin, s, d, complist, code)
941 if self.solver_dict["method"] == "table":
942 solver = self.solver_dict.copy()
943 solver["method"] = "hybrCC"
944 else:
945 solver = self.solver_dict
946 code.append(NonlinCode(s, nonlin, solver, self.extra_sources).generate(d))
947 elif isinstance(nonlin, dk_simulator.ChainedNonlinEquations):
948 for i, nlin in enumerate(nonlin.subblocks):
949 #spar = solver_set_defaults({} if self.solver_params is None else self.solver_params[i])
950 self.gen_nonlin(nlin, s, d, complist, code)
951 solver = self.solver_dict
952 code.append(NonlinChained(s, nonlin).generate(d))
953 else:
954 complist.append(dict(
955 name = nonlin.name,
956 namespace = nonlin.namespace,
957 pins = ",".join(dk_simulator.Parser.format_element(v) for v in nonlin.pins),
958 v_slice = nonlin.v_slice,
959 p_slice = nonlin.p_slice,
960 i_slice = nonlin.i_slice,
961 ))
962 generator = None
963 d.overwrite("v0_guess", "")
964 if self.solver_params:
965 try:
966 sp = self.solver_params[nonlin.name]
967 except KeyError:
968 pass
969 else:
970 generator = sp.get("generator")
971 d.overwrite("v0_guess", sp.get("v0_guess"))
972 if generator:
973 code.append(generator(s, nonlin, self.extra_sources, d))
974 elif self.solver_dict["method"] == "table":
975 code.append(TableCode(s, nonlin, self.extra_sources).generate(d))
976 else:
977 code.append(NonlinCode(s, nonlin, self.solver_dict, None).generate(d))
978
979 def add_dict(self, d):
980 eq = self.eq
981 s = Structure("nonlin_param")
982 par_ini = {}
983 glob = Namespace()
984 if self.have_constant_matrices:
985 d["update_pot"] = ""
986 else:
987 d.update(UpdateMatrix(glob, eq, self.pot, self.pot_list, self.pot_func, self.Pv).generate(s))
988 if eq.nonlin and eq.nonlin.nno:
989 for k, v in self.solver_dict.items():
990 d["solver_"+k] = v
991 s.add(MatrixDeclaration('p', rows=eq.nn, cols=1, pointer=True))
992 s.add(MatrixDeclaration('i', rows=eq.nn, cols=1, pointer=True))
993 s.add(MatrixDeclaration('v', rows=eq.nn, cols=1, mapping=True, pointer=True, aligned=False))
994 s.add_nonlin_info()
995 s.add_minmax_info(eq.nonlin.nni)
996 par_ini.update(dict(
997 v = '&g_v',
998 info = '&g_info',
999 fnorm = '0',
1000 nfev = '&g_nfev',
1001 p = '0',
1002 i = '0',
1003 p_val = '0',
1004 ))
1005 ini = dict(
1006 p = MatrixAccess('mp'),
1007 i = MatrixAccess('mi'),
1008 v = '&g_v',
1009 info = '&g_info',
1010 fnorm = '&fnorm',
1011 nfev = '&g_nfev',
1012 p_val = MatrixAccess('p_val'),
1013 )
1014 d["nonlin_mat_list_calc"] = s.get_initializer(ini)
1015 for i, neq in enumerate(self.walk_eqs(eq.nonlin)):
1016 if i == 0:
1017 neq.namespace = "nonlin"
1018 else:
1019 neq.namespace = "nonlin_%d" % (i-1)
1020 complist = []
1021 code = []
1022 self.gen_nonlin(eq.nonlin, s, d, complist, code)
1023 d["nc"] = len(complist)
1024 d["components"] = complist
1025 d["nonlin_code"] = "".join(code)
1026 if eq.nn != eq.nonlin.nno:
1027 d["iblock"] = VectorAccess.block_expr([0, eq.nonlin.nno])
1028 else:
1029 d["iblock"] = ""
1030 else:
1031 d["nonlin_code"] = ""
1032 d["nc"] = 0
1033 d["iblock"] = ""
1034 d["nonlin_mat_list"] = s.get_initializer(par_ini)
1035 d.update(self.pot_code())
1036 d["struct_def"] = s
1037 d.update(LinearCode(glob, eq).generate())
1038 d["global_matrices"] = glob
1039 d["add_npl"] = 0
1040 d["DKPlugin_fields"] = ""
1041 d["DKPlugin_init"] = ""
1042 d["process_add"] = ""
1043 return d
1044
1045 def generate(self, d):
1046 d = self.add_dict(d)
1047 d["lv2_ports"] = LV2_Port_List(self.pot_attr, self.pot, self.eq)
1048 out = dict(c_source = dk_templates.c_template_top.render(d))
1049 plugindef = d["plugindef"]
1050 if plugindef.lv2_plugin_type:
1051 out["manifest.ttl"] = dk_templates.lv2_manifest.render(d)
1052 out["%s.ttl" % plugindef.lv2_versioned_id] = dk_templates.lv2_ttl.render(d)
1053 return out
0 v 20110115 2
1 P 800 200 500 200 1 0 0
2 {
3 T 595 245 5 10 0 1 0 0 1
4 pinnumber=2
5 T 900 200 5 10 0 0 0 0 1
6 pinseq=2
7 }
8 P 0 200 300 200 1 0 0
9 {
10 T 205 245 5 10 0 1 0 6 1
11 pinnumber=1
12 T -200 200 5 10 0 0 0 0 1
13 pinseq=1
14 }
15 V 400 200 100 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1
16 L 400 400 400 0 3 30 0 1 -1 50
17 T 200 500 8 10 1 1 0 0 1
18 refdes=CC?
19 T 400 300 8 10 0 1 0 0 1
20 device=CONNECTION_CURRENT
0 v 20110115 2
1 P 200 0 200 200 1 0 0
2 {
3 T 250 50 5 6 0 1 0 0 1
4 pinnumber=1
5 T 250 50 5 6 0 0 0 0 1
6 pinseq=1
7 T 250 50 5 6 0 1 0 0 1
8 pinlabel=1
9 T 250 50 5 6 0 1 0 0 1
10 pintype=pwr
11 }
12 L 50 200 350 200 3 0 0 0 -1 -1
0 v 20121123 2
1 P 1600 1700 2000 1700 1 0 0
2 {
3 T 1695 1845 5 10 0 1 0 0 1
4 pinnumber=1
5 T 6100 1700 5 10 0 0 0 0 1
6 pinseq=1
7 }
8 P 2400 2900 2400 2300 1 0 0
9 {
10 T 2495 2850 5 10 0 1 180 6 1
11 pinnumber=4
12 T 2400 2400 5 10 0 0 0 0 1
13 pinseq=4
14 }
15 P 2600 1000 2600 1500 1 0 0
16 {
17 T 2805 1250 5 10 0 1 180 0 1
18 pinnumber=5
19 T 2600 1500 5 10 0 0 0 0 1
20 pinseq=5
21 }
22 L 2100 2300 2700 2300 3 0 0 0 -1 -1
23 L 2100 1700 2700 1700 3 0 0 2 170 90
24 L 2200 1400 2200 1500 3 0 0 0 -1 -1
25 L 2200 1500 2600 1500 3 0 0 0 -1 -1
26 T 2800 2600 8 10 1 1 0 0 1
27 refdes=U?
28 T 2400 2100 8 10 0 1 0 0 1
29 device=PENTODE
30 A 2400 2100 500 0 180 3 0 0 0 -1 -1
31 A 2400 1700 500 180 180 3 0 0 0 -1 -1
32 P 3200 1900 2800 1900 1 0 0
33 {
34 T 2895 1945 5 10 0 1 0 0 1
35 pinnumber=2
36 T -1300 1900 5 10 0 0 180 0 1
37 pinseq=2
38 }
39 L 2700 1900 2100 1900 3 0 0 2 170 90
40 P 3200 2100 2800 2100 1 0 0
41 {
42 T 2895 2145 5 10 0 1 0 0 1
43 pinnumber=3
44 T -1300 2100 5 10 0 0 180 0 1
45 pinseq=3
46 }
47 L 2700 2100 2100 2100 3 0 0 2 170 90
48 L 1900 2100 1900 1700 3 0 0 0 -1 -1
49 L 2900 1700 2900 2100 3 0 0 0 -1 -1
0 v 20110115 2
1 P 1600 2000 2000 2000 1 0 0
2 {
3 T 1695 2145 5 10 0 1 0 0 1
4 pinnumber=1
5 T 6100 2000 5 10 0 0 0 0 1
6 pinseq=1
7 }
8 P 2400 2800 2400 2200 1 0 0
9 {
10 T 2495 2750 5 10 0 1 180 6 1
11 pinnumber=2
12 T 2400 2300 5 10 0 0 0 0 1
13 pinseq=2
14 }
15 P 2600 1300 2600 1800 1 0 0
16 {
17 T 2805 1550 5 10 0 1 180 0 1
18 pinnumber=3
19 T 2600 1800 5 10 0 0 0 0 1
20 pinseq=3
21 }
22 V 2400 2000 500 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1
23 L 2100 2200 2700 2200 3 0 0 0 -1 -1
24 L 2100 2000 2700 2000 3 0 0 2 170 90
25 L 2200 1700 2200 1800 3 0 0 0 -1 -1
26 L 2200 1800 2600 1800 3 0 0 0 -1 -1
27 T 2800 2500 8 10 1 1 0 0 1
28 refdes=U?
29 T 2400 2100 8 10 0 1 0 0 1
30 device=TRIODE
0 #if 0
1 #define real_EPSILON FLT_EPSILON
2 #define real_MIN FLT_MIN
3 #define real_MAX FLT_MAX
4 #else
5 #define real_EPSILON DBL_EPSILON
6 #define real_MIN DBL_MIN
7 #define real_MAX DBL_MAX
8 #endif
9
10 real inline dpmpar(int i)
11 {
12 switch(i) {
13 case 1:
14 return real_EPSILON;
15 case 2:
16 return real_MIN;
17 default:
18 return real_MAX;
19 }
20 }
21
22 template<int N>
23 real inline enorm(const real *fvec) {
24 real s = 0;
25 for (int i = 0; i < N; i++) {
26 s += fvec[i] * fvec[i];
27 }
28 return sqrt(s);
29 }
30
31 real inline enorm(int n, const real *fvec) {
32 real s = 0;
33 for (int i = 0; i < n; i++) {
34 s += fvec[i] * fvec[i];
35 }
36 return sqrt(s);
37 }
38
39 template<int N>
40 real enorm2(const real *fvec) {
41 real s = 0;
42 for (int i = 0; i < N; i++) {
43 s += fvec[i] * fvec[i];
44 }
45 return s;
46 }
47
48 template<int N>
49 void qform(real *q, int ldq, real *wa)
50 {
51 /* System generated locals */
52 int q_dim1, q_offset;
53
54 /* Local variables */
55 int i, j, k, l;
56 real sum, temp;
57
58 /* Parameter adjustments */
59 --wa;
60 q_dim1 = ldq;
61 q_offset = 1 + q_dim1 * 1;
62 q -= q_offset;
63
64 /* Function Body */
65
66 /* zero out upper triangle of q in the first min(m,n) columns. */
67
68 if (N >= 2) {
69 for (j = 2; j <= N; ++j) {
70 for (i = 1; i <= j-1; ++i) {
71 q[i + j * q_dim1] = 0.;
72 }
73 }
74 }
75
76 /* accumulate q from its factored form. */
77
78 for (l = 1; l <= N; ++l) {
79 k = N - l + 1;
80 for (i = k; i <= N; ++i) {
81 wa[i] = q[i + k * q_dim1];
82 q[i + k * q_dim1] = 0.;
83 }
84 q[k + k * q_dim1] = 1.;
85 if (wa[k] != 0.) {
86 for (j = k; j <= N; ++j) {
87 sum = 0.;
88 for (i = k; i <= N; ++i) {
89 sum += q[i + j * q_dim1] * wa[i];
90 }
91 temp = sum / wa[k];
92 for (i = k; i <= N; ++i) {
93 q[i + j * q_dim1] -= temp * wa[i];
94 }
95 }
96 }
97 }
98 } /* qform_ */
99
100 template<int N>
101 void r1updt(real *s, int ls, const real *u, real *v, real *w, int *sing)
102 {
103 /* Initialized data */
104
105 #define p5 .5
106 #define p25 .25
107
108 /* Local variables */
109 int i, j, l, jj, nm1;
110 real tan;
111 int nmj;
112 real cos, sin, tau, temp, giant, cotan;
113
114 /* Parameter adjustments */
115 --w;
116 --u;
117 --v;
118 --s;
119 (void)ls;
120
121 /* Function Body */
122
123 /* giant is the largest magnitude. */
124
125 giant = dpmpar(3);
126
127 /* initialize the diagonal element pointer. */
128
129 jj = N * ((N << 1) - N + 1) / 2 - (N - N);
130
131 /* move the nontrivial part of the last column of s into w. */
132
133 l = jj;
134 for (i = N; i <= N; ++i) {
135 w[i] = s[l];
136 ++l;
137 }
138
139 /* rotate the vector v into a multiple of the n-th unit vector */
140 /* in such a way that a spike is introduced into w. */
141
142 nm1 = N - 1;
143 if (nm1 >= 1) {
144 for (nmj = 1; nmj <= nm1; ++nmj) {
145 j = N - nmj;
146 jj -= N - j + 1;
147 w[j] = 0.;
148 if (v[j] != 0.) {
149
150 /* determine a givens rotation which eliminates the */
151 /* j-th element of v. */
152
153 if (fabs(v[N]) < fabs(v[j])) {
154 cotan = v[N] / v[j];
155 sin = p5 / sqrt(p25 + p25 * (cotan * cotan));
156 cos = sin * cotan;
157 tau = 1.;
158 if (fabs(cos) * giant > 1.) {
159 tau = 1. / cos;
160 }
161 } else {
162 tan = v[j] / v[N];
163 cos = p5 / sqrt(p25 + p25 * (tan * tan));
164 sin = cos * tan;
165 tau = sin;
166 }
167
168 /* apply the transformation to v and store the information */
169 /* necessary to recover the givens rotation. */
170
171 v[N] = sin * v[j] + cos * v[N];
172 v[j] = tau;
173
174 /* apply the transformation to s and extend the spike in w. */
175
176 l = jj;
177 for (i = j; i <= N; ++i) {
178 temp = cos * s[l] - sin * w[i];
179 w[i] = sin * s[l] + cos * w[i];
180 s[l] = temp;
181 ++l;
182 }
183 }
184 }
185 }
186
187 /* add the spike from the rank 1 update to w. */
188
189 for (i = 1; i <= N; ++i) {
190 w[i] += v[N] * u[i];
191 }
192
193 /* eliminate the spike. */
194
195 *sing = false;
196 if (nm1 >= 1) {
197 for (j = 1; j <= nm1; ++j) {
198 if (w[j] != 0.) {
199
200 /* determine a givens rotation which eliminates the */
201 /* j-th element of the spike. */
202
203 if (fabs(s[jj]) < fabs(w[j])) {
204 cotan = s[jj] / w[j];
205 sin = p5 / sqrt(p25 + p25 * (cotan * cotan));
206 cos = sin * cotan;
207 tau = 1.;
208 if (fabs(cos) * giant > 1.) {
209 tau = 1. / cos;
210 }
211 } else {
212 tan = w[j] / s[jj];
213 cos = p5 / sqrt(p25 + p25 * (tan * tan));
214 sin = cos * tan;
215 tau = sin;
216 }
217
218 /* apply the transformation to s and reduce the spike in w. */
219
220 l = jj;
221 for (i = j; i <= N; ++i) {
222 temp = cos * s[l] + sin * w[i];
223 w[i] = -sin * s[l] + cos * w[i];
224 s[l] = temp;
225 ++l;
226 }
227
228 /* store the information necessary to recover the */
229 /* givens rotation. */
230
231 w[j] = tau;
232 }
233
234 /* test for zero diagonal elements in the output s. */
235
236 if (s[jj] == 0.) {
237 *sing = true;
238 }
239 jj += N - j + 1;
240 }
241 }
242
243 /* move w back into the last column of the output s. */
244
245 l = jj;
246 for (i = N; i <= N; ++i) {
247 s[l] = w[i];
248 ++l;
249 }
250 if (s[jj] == 0.) {
251 *sing = true;
252 }
253
254 /* last card of subroutine r1updt. */
255
256 } /* __minpack_func__(r1updt) */
257
258 template<int M, int N>
259 void r1mpyq(real *a, int lda, const real *v, const real *w)
260 {
261 /* System generated locals */
262 int a_dim1, a_offset;
263
264 /* Local variables */
265 int i, j, nm1, nmj;
266 real cos, sin, temp;
267
268 /* Parameter adjustments */
269 --w;
270 --v;
271 a_dim1 = lda;
272 a_offset = 1 + a_dim1 * 1;
273 a -= a_offset;
274
275 /* Function Body */
276
277 /* apply the first set of givens rotations to a. */
278
279 nm1 = N - 1;
280 if (nm1 < 1) {
281 return;
282 }
283 for (nmj = 1; nmj <= nm1; ++nmj) {
284 j = N - nmj;
285 if (fabs(v[j]) > 1.) {
286 cos = 1. / v[j];
287 sin = sqrt(1. - cos * cos);
288 } else {
289 sin = v[j];
290 cos = sqrt(1. - sin * sin);
291 }
292 for (i = 1; i <= M; ++i) {
293 temp = cos * a[i + j * a_dim1] - sin * a[i + N * a_dim1];
294 a[i + N * a_dim1] = sin * a[i + j * a_dim1] + cos * a[
295 i + N * a_dim1];
296 a[i + j * a_dim1] = temp;
297 }
298 }
299
300 /* apply the second set of givens rotations to a. */
301
302 for (j = 1; j <= nm1; ++j) {
303 if (fabs(w[j]) > 1.) {
304 cos = 1. / w[j];
305 sin = sqrt(1. - cos * cos);
306 } else {
307 sin = w[j];
308 cos = sqrt(1. - sin * sin);
309 }
310 for (i = 1; i <= M; ++i) {
311 temp = cos * a[i + j * a_dim1] + sin * a[i + N * a_dim1];
312 a[i + N * a_dim1] = -sin * a[i + j * a_dim1] + cos * a[i + N * a_dim1];
313 a[i + j * a_dim1] = temp;
314 }
315 }
316
317 /* last card of subroutine r1mpyq. */
318
319 } /* r1mpyq_ */
320
321 template<int N>
322 int fdjac1(root_fcn *fcn_nn, void *p, real *x, const real *fvec, real *fjac, int ldfjac, int ml,
323 int mu, real epsfcn, real *wa1, real *wa2)
324 {
325 /* System generated locals */
326 int fjac_dim1, fjac_offset;
327
328 /* Local variables */
329 real h;
330 int i, j, k;
331 real eps, temp;
332 int msum;
333 real epsmch;
334 int iflag = 0;
335
336 /* Parameter adjustments */
337 --wa2;
338 --wa1;
339 --fvec;
340 --x;
341 fjac_dim1 = ldfjac;
342 fjac_offset = 1 + fjac_dim1 * 1;
343 fjac -= fjac_offset;
344
345 /* Function Body */
346
347 /* epsmch is the machine precision. */
348
349 epsmch = dpmpar(1);
350
351 eps = sqrt((std::max(epsfcn,epsmch)));
352 msum = ml + mu + 1;
353 if (msum >= N) {
354
355 /* computation of dense approximate jacobian. */
356
357 for (j = 1; j <= N; ++j) {
358 temp = x[j];
359 h = eps * fabs(temp);
360 if (h == 0.) {
361 h = eps;
362 }
363 x[j] = temp + h;
364 /* the last parameter of fcn_nn() is set to 2 to tell calls
365 made to compute the function from calls made to compute
366 the Jacobian (see fcn() in tlmfdrv.c) */
367 iflag = fcn_nn(p, &x[1], &wa1[1], 2);
368 if (iflag < 0) {
369 return iflag;
370 }
371 x[j] = temp;
372 for (i = 1; i <= N; ++i) {
373 fjac[i + j * fjac_dim1] = (wa1[i] - fvec[i]) / h;
374 }
375 }
376 return 0;
377 }
378
379 /* computation of banded approximate jacobian. */
380
381 for (k = 1; k <= msum; ++k) {
382 for (j = k; msum < 0 ? j >= N : j <= N; j += msum) {
383 wa2[j] = x[j];
384 h = eps * fabs(wa2[j]);
385 if (h == 0.) {
386 h = eps;
387 }
388 x[j] = wa2[j] + h;
389 }
390 iflag = fcn_nn(p, &x[1], &wa1[1], 1);
391 if (iflag < 0) {
392 return iflag;
393 }
394 for (j = k; msum < 0 ? j >= N : j <= N; j += msum) {
395 x[j] = wa2[j];
396 h = eps * fabs(wa2[j]);
397 if (h == 0.) {
398 h = eps;
399 }
400 for (i = 1; i <= N; ++i) {
401 fjac[i + j * fjac_dim1] = 0.;
402 if (i >= j - mu && i <= j + ml) {
403 fjac[i + j * fjac_dim1] = (wa1[i] - fvec[i]) / h;
404 }
405 }
406 }
407 }
408 return 0;
409
410 } /* fdjac1_ */
411
412 template<int N>
413 void qrfac(real *a, int lda, int pivot, int *ipvt, int lipvt, real *rdiag,
414 real *acnorm, real *wa)
415 {
416 #ifdef USE_LAPACK
417 int i, j, k;
418 double t;
419 double* tau = wa;
420 const int ltau = N;
421 int lwork = -1;
422 int info = 0;
423 double* work;
424
425 if (pivot) {
426 assert( lipvt >= N );
427 /* set all columns free */
428 memset(ipvt, 0, sizeof(int)*N);
429 }
430
431 /* query optimal size of work */
432 lwork = -1;
433 if (pivot) {
434 dgeqp3_(&m,&n,a,&lda,ipvt,tau,tau,&lwork,&info);
435 lwork = (int)tau[0];
436 assert( lwork >= 3*n+1 );
437 } else {
438 dgeqrf_(&m,&n,a,&lda,tau,tau,&lwork,&info);
439 lwork = (int)tau[0];
440 assert( lwork >= 1 && lwork >= n );
441 }
442
443 assert( info == 0 );
444
445 /* alloc work area */
446 work = (double *)malloc(sizeof(double)*lwork);
447 assert(work != NULL);
448
449 /* set acnorm first (from the doc of qrfac, acnorm may point to the same area as rdiag) */
450 if (acnorm != rdiag) {
451 for (j = 0; j < n; ++j) {
452 acnorm[j] = enorm<N>(&a[j * lda]);
453 }
454 }
455
456 /* QR decomposition */
457 if (pivot) {
458 dgeqp3_(&m,&n,a,&lda,ipvt,tau,work,&lwork,&info);
459 } else {
460 dgeqrf_(&m,&n,a,&lda,tau,work,&lwork,&info);
461 }
462 assert(info == 0);
463
464 /* set rdiag, before the diagonal is replaced */
465 memset(rdiag, 0, sizeof(double)*n);
466 for(i=0 ; i<n ; ++i) {
467 rdiag[i] = a[i*lda+i];
468 }
469
470 /* modify lower trinagular part to look like qrfac's output */
471 for(i=0 ; i<ltau ; ++i) {
472 k = i*lda+i;
473 t = tau[i];
474 a[k] = t;
475 for(j=i+1 ; j<m ; j++) {
476 k++;
477 a[k] *= t;
478 }
479 }
480
481 free(work);
482 #else /* !USE_LAPACK */
483 /* Initialized data */
484
485 #define p05 .05
486
487 /* System generated locals */
488 real d1;
489
490 /* Local variables */
491 int i, j, k, jp1;
492 real sum;
493 real temp;
494 real epsmch;
495 real ajnorm;
496
497 /* ********** */
498
499 /* subroutine qrfac */
500
501 /* this subroutine uses householder transformations with column */
502 /* pivoting (optional) to compute a qr factorization of the */
503 /* m by n matrix a. that is, qrfac determines an orthogonal */
504 /* matrix q, a permutation matrix p, and an upper trapezoidal */
505 /* matrix r with diagonal elements of nonincreasing magnitude, */
506 /* such that a*p = q*r. the householder transformation for */
507 /* column k, k = 1,2,...,min(m,n), is of the form */
508
509 /* t */
510 /* i - (1/u(k))*u*u */
511
512 /* where u has zeros in the first k-1 positions. the form of */
513 /* this transformation and the method of pivoting first */
514 /* appeared in the corresponding linpack subroutine. */
515
516 /* the subroutine statement is */
517
518 /* subroutine qrfac(m,n,a,lda,pivot,ipvt,lipvt,rdiag,acnorm,wa) */
519
520 /* where */
521
522 /* m is a positive integer input variable set to the number */
523 /* of rows of a. */
524
525 /* n is a positive integer input variable set to the number */
526 /* of columns of a. */
527
528 /* a is an m by n array. on input a contains the matrix for */
529 /* which the qr factorization is to be computed. on output */
530 /* the strict upper trapezoidal part of a contains the strict */
531 /* upper trapezoidal part of r, and the lower trapezoidal */
532 /* part of a contains a factored form of q (the non-trivial */
533 /* elements of the u vectors described above). */
534
535 /* lda is a positive integer input variable not less than m */
536 /* which specifies the leading dimension of the array a. */
537
538 /* pivot is a logical input variable. if pivot is set true, */
539 /* then column pivoting is enforced. if pivot is set false, */
540 /* then no column pivoting is done. */
541
542 /* ipvt is an integer output array of length lipvt. ipvt */
543 /* defines the permutation matrix p such that a*p = q*r. */
544 /* column j of p is column ipvt(j) of the identity matrix. */
545 /* if pivot is false, ipvt is not referenced. */
546
547 /* lipvt is a positive integer input variable. if pivot is false, */
548 /* then lipvt may be as small as 1. if pivot is true, then */
549 /* lipvt must be at least n. */
550
551 /* rdiag is an output array of length n which contains the */
552 /* diagonal elements of r. */
553
554 /* acnorm is an output array of length n which contains the */
555 /* norms of the corresponding columns of the input matrix a. */
556 /* if this information is not needed, then acnorm can coincide */
557 /* with rdiag. */
558
559 /* wa is a work array of length n. if pivot is false, then wa */
560 /* can coincide with rdiag. */
561
562 /* subprograms called */
563
564 /* minpack-supplied ... dpmpar,enorm */
565
566 /* fortran-supplied ... dmax1,dsqrt,min0 */
567
568 /* argonne national laboratory. minpack project. march 1980. */
569 /* burton s. garbow, kenneth e. hillstrom, jorge j. more */
570
571 /* ********** */
572 (void)lipvt;
573
574 /* epsmch is the machine precision. */
575
576 epsmch = dpmpar(1);
577
578 /* compute the initial column norms and initialize several arrays. */
579
580 for (j = 0; j < N; ++j) {
581 acnorm[j] = enorm<N>(&a[j * lda + 0]);
582 rdiag[j] = acnorm[j];
583 wa[j] = rdiag[j];
584 if (pivot) {
585 ipvt[j] = j+1;
586 }
587 }
588
589 /* reduce a to r with householder transformations. */
590
591 for (j = 0; j < N; ++j) {
592 if (pivot) {
593
594 /* bring the column of largest norm into the pivot position. */
595
596 int kmax = j;
597 for (k = j; k < N; ++k) {
598 if (rdiag[k] > rdiag[kmax]) {
599 kmax = k;
600 }
601 }
602 if (kmax != j) {
603 for (i = 0; i < N; ++i) {
604 temp = a[i + j * lda];
605 a[i + j * lda] = a[i + kmax * lda];
606 a[i + kmax * lda] = temp;
607 }
608 rdiag[kmax] = rdiag[j];
609 wa[kmax] = wa[j];
610 k = ipvt[j];
611 ipvt[j] = ipvt[kmax];
612 ipvt[kmax] = k;
613 }
614 }
615
616 /* compute the householder transformation to reduce the */
617 /* j-th column of a to a multiple of the j-th unit vector. */
618
619 ajnorm = enorm(N - (j+1) + 1, &a[j + j * lda]);
620 if (ajnorm != 0.) {
621 if (a[j + j * lda] < 0.) {
622 ajnorm = -ajnorm;
623 }
624 for (i = j; i < N; ++i) {
625 a[i + j * lda] /= ajnorm;
626 }
627 a[j + j * lda] += 1.;
628
629 /* apply the transformation to the remaining columns */
630 /* and update the norms. */
631
632 jp1 = j + 1;
633 if (N > jp1) {
634 for (k = jp1; k < N; ++k) {
635 sum = 0.;
636 for (i = j; i < N; ++i) {
637 sum += a[i + j * lda] * a[i + k * lda];
638 }
639 temp = sum / a[j + j * lda];
640 for (i = j; i < N; ++i) {
641 a[i + k * lda] -= temp * a[i + j * lda];
642 }
643 if (pivot && rdiag[k] != 0.) {
644 temp = a[j + k * lda] / rdiag[k];
645 /* Computing MAX */
646 d1 = 1. - temp * temp;
647 rdiag[k] *= sqrt((std::max((real)0.,d1)));
648 /* Computing 2nd power */
649 d1 = rdiag[k] / wa[k];
650 if (p05 * (d1 * d1) <= epsmch) {
651 rdiag[k] = enorm(N - (j+1), &a[jp1 + k * lda]);
652 wa[k] = rdiag[k];
653 }
654 }
655 }
656 }
657 }
658 rdiag[j] = -ajnorm;
659 }
660
661 /* last card of subroutine qrfac. */
662 #endif /* !USE_LAPACK */
663 } /* qrfac_ */
664
665 template<int N>
666 void dogleg(const real *r, int lr, const real *diag, const real *qtb, real delta, real *x,
667 real *wa1, real *wa2)
668 {
669 /* System generated locals */
670 real d1, d2, d3, d4;
671
672 /* Local variables */
673 int i, j, k, l, jj, jp1;
674 real sum, temp, alpha, bnorm;
675 real gnorm, qnorm, epsmch;
676 real sgnorm;
677
678 /* Parameter adjustments */
679 --wa2;
680 --wa1;
681 --x;
682 --qtb;
683 --diag;
684 --r;
685 (void)lr;
686
687 /* Function Body */
688
689 /* epsmch is the machine precision. */
690
691 epsmch = dpmpar(1);
692
693 /* first, calculate the gauss-newton direction. */
694
695 jj = N * (N + 1) / 2 + 1;
696 for (k = 1; k <= N; ++k) {
697 j = N - k + 1;
698 jp1 = j + 1;
699 jj -= k;
700 l = jj + 1;
701 sum = 0.;
702 if (N >= jp1) {
703 for (i = jp1; i <= N; ++i) {
704 sum += r[l] * x[i];
705 ++l;
706 }
707 }
708 temp = r[jj];
709 if (temp == 0.) {
710 l = j;
711 for (i = 1; i <= j; ++i) {
712 /* Computing MAX */
713 d2 = fabs(r[l]);
714 temp = std::max(temp,d2);
715 l = l + N - i;
716 }
717 temp = epsmch * temp;
718 if (temp == 0.) {
719 temp = epsmch;
720 }
721 }
722 x[j] = (qtb[j] - sum) / temp;
723 }
724
725 /* test whether the gauss-newton direction is acceptable. */
726
727 for (j = 1; j <= N; ++j) {
728 wa1[j] = 0.;
729 wa2[j] = diag[j] * x[j];
730 }
731 qnorm = enorm<N>(&wa2[1]);
732 if (qnorm <= delta) {
733 return;
734 }
735
736 /* the gauss-newton direction is not acceptable. */
737 /* next, calculate the scaled gradient direction. */
738
739 l = 1;
740 for (j = 1; j <= N; ++j) {
741 temp = qtb[j];
742 for (i = j; i <= N; ++i) {
743 wa1[i] += r[l] * temp;
744 ++l;
745 }
746 wa1[j] /= diag[j];
747 }
748
749 /* calculate the norm of the scaled gradient and test for */
750 /* the special case in which the scaled gradient is zero. */
751
752 gnorm = enorm<N>(&wa1[1]);
753 sgnorm = 0.;
754 alpha = delta / qnorm;
755 if (gnorm != 0.) {
756
757 /* calculate the point along the scaled gradient */
758 /* at which the quadratic is minimized. */
759
760 for (j = 1; j <= N; ++j) {
761 wa1[j] = wa1[j] / gnorm / diag[j];
762 }
763 l = 1;
764 for (j = 1; j <= N; ++j) {
765 sum = 0.;
766 for (i = j; i <= N; ++i) {
767 sum += r[l] * wa1[i];
768 ++l;
769 }
770 wa2[j] = sum;
771 }
772 temp = enorm<N>(&wa2[1]);
773 sgnorm = gnorm / temp / temp;
774
775 /* test whether the scaled gradient direction is acceptable. */
776
777 alpha = 0.;
778 if (sgnorm < delta) {
779
780 /* the scaled gradient direction is not acceptable. */
781 /* finally, calculate the point along the dogleg */
782 /* at which the quadratic is minimized. */
783
784 bnorm = enorm<N>(&qtb[1]);
785 temp = bnorm / gnorm * (bnorm / qnorm) * (sgnorm / delta);
786 /* Computing 2nd power */
787 d1 = sgnorm / delta;
788 /* Computing 2nd power */
789 d2 = temp - delta / qnorm;
790 /* Computing 2nd power */
791 d3 = delta / qnorm;
792 /* Computing 2nd power */
793 d4 = sgnorm / delta;
794 temp = temp - delta / qnorm * (d1 * d1)
795 + sqrt(d2 * d2
796 + (1. - d3 * d3) * (1. - d4 * d4));
797 /* Computing 2nd power */
798 d1 = sgnorm / delta;
799 alpha = delta / qnorm * (1. - d1 * d1) / temp;
800 }
801 }
802
803 /* form appropriate convex combination of the gauss-newton */
804 /* direction and the scaled gradient direction. */
805
806 temp = (1. - alpha) * std::min(sgnorm,delta);
807 for (j = 1; j <= N; ++j) {
808 x[j] = temp * wa1[j] + alpha * x[j];
809 }
810
811 } /* dogleg_ */
812
813 template<int N>
814 int hybrdX(root_fcn *fcn_nn, void *p, real *x, real *
815 fvec, real xtol, int maxfev, int ml, int mu,
816 real epsfcn, real *diag, int mode, real
817 factor, int nprint, int *nfev, real *
818 fjac, int ldfjac, real *r, int lr, real *qtf,
819 real *wa1, real *wa2, real *wa3, real *wa4)
820 {
821 /* Initialized data */
822
823 #define p1 .1
824 #define p5 .5
825 #define p001 .001
826 #define p0001 1e-4
827
828 /* System generated locals */
829 int fjac_dim1, fjac_offset, i1;
830 real d1, d2;
831
832 /* Local variables */
833 int i, j, l, jm1, iwa[1];
834 real sum;
835 int sing;
836 int iter;
837 real temp;
838 int msum, iflag;
839 real delta = 0.;
840 int jeval;
841 int ncsuc;
842 real ratio;
843 real fnorm;
844 real pnorm, xnorm = 0., fnorm1;
845 int nslow1, nslow2;
846 int ncfail;
847 real actred, epsmch, prered;
848 int info;
849
850 /* Parameter adjustments */
851 --wa4;
852 --wa3;
853 --wa2;
854 --wa1;
855 --qtf;
856 --diag;
857 --fvec;
858 --x;
859 fjac_dim1 = ldfjac;
860 fjac_offset = 1 + fjac_dim1 * 1;
861 fjac -= fjac_offset;
862 --r;
863
864 /* Function Body */
865
866 /* epsmch is the machine precision. */
867
868 epsmch = dpmpar(1);
869
870 info = 0;
871 iflag = 0;
872 *nfev = 0;
873
874 /* check the input parameters for errors. */
875
876 if (N <= 0 || xtol < 0. || maxfev <= 0 || ml < 0 || mu < 0 ||
877 factor <= 0. || ldfjac < N || lr < N * (N + 1) / 2) {
878 goto TERMINATE;
879 }
880 if (mode == 2) {
881 for (j = 1; j <= N; ++j) {
882 if (diag[j] <= 0.) {
883 goto TERMINATE;
884 }
885 }
886 }
887
888 /* evaluate the function at the starting point */
889 /* and calculate its norm. */
890
891 iflag = fcn_nn(p, &x[1], &fvec[1], 1);
892 *nfev = 1;
893 if (iflag < 0) {
894 goto TERMINATE;
895 }
896 fnorm = enorm2<N>(&fvec[1]);
897
898 /* determine the number of calls to fcn needed to compute */
899 /* the jacobian matrix. */
900
901 /* Computing MIN */
902 i1 = ml + mu + 1;
903 msum = std::min(i1,N);
904
905 /* initialize iteration counter and monitors. */
906
907 iter = 1;
908 ncsuc = 0;
909 ncfail = 0;
910 nslow1 = 0;
911 nslow2 = 0;
912
913 /* beginning of the outer loop. */
914
915 for (;;) {
916 jeval = true;
917
918 /* calculate the jacobian matrix. */
919
920 iflag = fdjac1<N>(fcn_nn, p, &x[1], &fvec[1], &fjac[fjac_offset], ldfjac,
921 ml, mu, epsfcn, &wa1[1], &wa2[1]);
922 *nfev += msum;
923 if (iflag < 0) {
924 goto TERMINATE;
925 }
926
927 /* compute the qr factorization of the jacobian. */
928
929 qrfac<N>(&fjac[fjac_offset], ldfjac, false, iwa, 1, &wa1[1], &wa2[1], &wa3[1]);
930
931 /* on the first iteration and if mode is 1, scale according */
932 /* to the norms of the columns of the initial jacobian. */
933
934 if (iter == 1) {
935 if (mode != 2) {
936 for (j = 1; j <= N; ++j) {
937 diag[j] = wa2[j];
938 if (wa2[j] == 0.) {
939 diag[j] = 1.;
940 }
941 }
942 }
943
944 /* on the first iteration, calculate the norm of the scaled x */
945 /* and initialize the step bound delta. */
946
947 for (j = 1; j <= N; ++j) {
948 wa3[j] = diag[j] * x[j];
949 }
950 xnorm = enorm<N>(&wa3[1]);
951 delta = factor * xnorm;
952 if (delta == 0.) {
953 delta = factor;
954 }
955 }
956
957 /* form (q transpose)*fvec and store in qtf. */
958
959 for (i = 1; i <= N; ++i) {
960 qtf[i] = fvec[i];
961 }
962 for (j = 1; j <= N; ++j) {
963 if (fjac[j + j * fjac_dim1] != 0.) {
964 sum = 0.;
965 for (i = j; i <= N; ++i) {
966 sum += fjac[i + j * fjac_dim1] * qtf[i];
967 }
968 temp = -sum / fjac[j + j * fjac_dim1];
969 for (i = j; i <= N; ++i) {
970 qtf[i] += fjac[i + j * fjac_dim1] * temp;
971 }
972 }
973 }
974
975 /* copy the triangular factor of the qr factorization into r. */
976
977 sing = false;
978 for (j = 1; j <= N; ++j) {
979 l = j;
980 jm1 = j - 1;
981 if (jm1 >= 1) {
982 for (i = 1; i <= jm1; ++i) {
983 r[l] = fjac[i + j * fjac_dim1];
984 l = l + N - i;
985 }
986 }
987 r[l] = wa1[j];
988 if (wa1[j] == 0.) {
989 sing = true;
990 }
991 }
992
993 /* accumulate the orthogonal factor in fjac. */
994
995 qform<N>(&fjac[fjac_offset], ldfjac, &wa1[1]);
996
997 /* rescale if necessary. */
998
999 if (mode != 2) {
1000 for (j = 1; j <= N; ++j) {
1001 /* Computing MAX */
1002 d1 = diag[j], d2 = wa2[j];
1003 diag[j] = std::max(d1,d2);
1004 }
1005 }
1006
1007 /* beginning of the inner loop. */
1008
1009 for (;;) {
1010
1011 /* if requested, call fcn to enable printing of iterates. */
1012
1013 if (nprint > 0) {
1014 iflag = 0;
1015 if ((iter - 1) % nprint == 0) {
1016 iflag = fcn_nn(p, &x[1], &fvec[1], 0);
1017 }
1018 if (iflag < 0) {
1019 goto TERMINATE;
1020 }
1021 }
1022
1023 /* determine the direction p. */
1024
1025 dogleg<N>(&r[1], lr, &diag[1], &qtf[1], delta, &wa1[1], &wa2[1], &wa3[1]);
1026
1027 /* store the direction p and x + p. calculate the norm of p. */
1028
1029 for (j = 1; j <= N; ++j) {
1030 wa1[j] = -wa1[j];
1031 wa2[j] = x[j] + wa1[j];
1032 wa3[j] = diag[j] * wa1[j];
1033 }
1034 pnorm = enorm<N>(&wa3[1]);
1035
1036 /* on the first iteration, adjust the initial step bound. */
1037
1038 if (iter == 1) {
1039 delta = std::min(delta,pnorm);
1040 }
1041
1042 /* evaluate the function at x + p and calculate its norm. */
1043
1044 iflag = fcn_nn(p, &wa2[1], &wa4[1], 1);
1045 ++(*nfev);
1046 if (iflag < 0) {
1047 goto TERMINATE;
1048 }
1049 fnorm1 = enorm2<N>(&wa4[1]);
1050
1051 /* compute the scaled actual reduction. */
1052
1053 actred = -1.;
1054 if (fnorm1 < fnorm) {
1055 /* already 2nd power */
1056 actred = 1. - fnorm1 / fnorm;
1057 }
1058
1059 /* compute the scaled predicted reduction. */
1060
1061 l = 1;
1062 for (i = 1; i <= N; ++i) {
1063 sum = 0.;
1064 for (j = i; j <= N; ++j) {
1065 sum += r[l] * wa1[j];
1066 ++l;
1067 }
1068 wa3[i] = qtf[i] + sum;
1069 }
1070 temp = enorm2<N>(&wa3[1]);
1071 prered = 0.;
1072 if (temp < fnorm) {
1073 /* already 2nd power */
1074 prered = 1. - temp / fnorm;
1075 }
1076
1077 /* compute the ratio of the actual to the predicted */
1078 /* reduction. */
1079
1080 ratio = 0.;
1081 if (prered > 0.) {
1082 ratio = actred / prered;
1083 }
1084
1085 /* update the step bound. */
1086
1087 if (ratio < p1) {
1088 ncsuc = 0;
1089 ++ncfail;
1090 delta = p5 * delta;
1091 } else {
1092 ncfail = 0;
1093 ++ncsuc;
1094 if (ratio >= p5 || ncsuc > 1) {
1095 /* Computing MAX */
1096 d1 = pnorm / p5;
1097 delta = std::max(delta,d1);
1098 }
1099 if (fabs(ratio - 1.) <= p1) {
1100 delta = pnorm / p5;
1101 }
1102 }
1103
1104 /* test for successful iteration. */
1105
1106 if (ratio >= p0001) {
1107
1108 /* successful iteration. update x, fvec, and their norms. */
1109
1110 for (j = 1; j <= N; ++j) {
1111 x[j] = wa2[j];
1112 wa2[j] = diag[j] * x[j];
1113 fvec[j] = wa4[j];
1114 }
1115 xnorm = enorm<N>(&wa2[1]);
1116 fnorm = fnorm1;
1117 ++iter;
1118 }
1119
1120 /* determine the progress of the iteration. */
1121
1122 ++nslow1;
1123 if (actred >= p001) {
1124 nslow1 = 0;
1125 }
1126 if (jeval) {
1127 ++nslow2;
1128 }
1129 if (actred >= p1) {
1130 nslow2 = 0;
1131 }
1132
1133 /* test for convergence. */
1134
1135 if (delta <= xtol * xnorm || fnorm == 0.) {
1136 info = 1;
1137 }
1138 if (info != 0) {
1139 goto TERMINATE;
1140 }
1141
1142 /* tests for termination and stringent tolerances. */
1143
1144 if (*nfev >= maxfev) {
1145 info = 2;
1146 }
1147 /* Computing MAX */
1148 d1 = p1 * delta;
1149 if (p1 * std::max(d1,pnorm) <= epsmch * xnorm) {
1150 info = 3;
1151 }
1152 if (nslow2 == 5) {
1153 info = 4;
1154 }
1155 if (nslow1 == 10) {
1156 info = 5;
1157 }
1158 if (info != 0) {
1159 goto TERMINATE;
1160 }
1161
1162 /* criterion for recalculating jacobian approximation */
1163 /* by forward differences. */
1164
1165 if (ncfail == 2) {
1166 goto TERMINATE_INNER_LOOP;
1167 }
1168
1169 /* calculate the rank one modification to the jacobian */
1170 /* and update qtf if necessary. */
1171
1172 for (j = 1; j <= N; ++j) {
1173 sum = 0.;
1174 for (i = 1; i <= N; ++i) {
1175 sum += fjac[i + j * fjac_dim1] * wa4[i];
1176 }
1177 wa2[j] = (sum - wa3[j]) / pnorm;
1178 wa1[j] = diag[j] * (diag[j] * wa1[j] / pnorm);
1179 if (ratio >= p0001) {
1180 qtf[j] = sum;
1181 }
1182 }
1183
1184 /* compute the qr factorization of the updated jacobian. */
1185
1186 r1updt<N>(&r[1], lr, &wa1[1], &wa2[1], &wa3[1], &sing);
1187 r1mpyq<N, N>(&fjac[fjac_offset], ldfjac, &wa2[1], &wa3[1]);
1188 r1mpyq<1, N>(&qtf[1], 1, &wa2[1], &wa3[1]);
1189
1190 /* end of the inner loop. */
1191
1192 jeval = false;
1193 }
1194 TERMINATE_INNER_LOOP:
1195 ;
1196 /* end of the outer loop. */
1197
1198 }
1199 TERMINATE:
1200
1201 /* termination, either normal or user imposed. */
1202
1203 if (iflag < 0) {
1204 info = iflag;
1205 }
1206 if (nprint > 0) {
1207 fcn_nn(p, &x[1], &fvec[1], 0);
1208 }
1209 return info;
1210
1211 /* last card of subroutine hybrd. */
1212
1213 } /* hybrd_ */
0 #include <cstdio>
1 #include <cstdlib>
2
3 #ifndef NO_INTPP_INCLUDES
4 #include "intpp.h"
5 #include "intpp_inst.cc"
6 #endif
7
8 #define always_inline inline __attribute__((always_inline))
9
10 /****************************************************************
11 ** fpbspl evaluates the k non-zero b-splines of order k
12 ** at t[0] <= x < t[1] using the stable recurrence relation
13 ** of de boor and cox.
14 **
15 ** t: knot array
16 ** K: order (> 0)
17 ** h[K]: output array
18 */
19 template<int K> static always_inline void fpbspl(treal *t, real x, real *h)
20 {
21 real hh[K-1];
22 h[0] = 1;
23 for (int j = 0; j < K-1; j++) {
24 for (int i = 0; i <= j; i++) {
25 hh[i] = h[i];
26 }
27 h[0] = 0;
28 for (int i = 0; i <= j; i++) {
29 int li = i+1;
30 int lj = i-j;
31 real f = hh[i]/(t[li]-t[lj]);
32 h[i] = h[i]+f*(t[li]-x);
33 h[i+1] = f*(x-t[lj]);
34 }
35 }
36 }
37
38 template<> always_inline void fpbspl<2>(treal *t, real x, real *h)
39 {
40 h[0] = (t[1]-x)/(t[1]-t[0]);
41 h[1] = 1-h[0];
42 }
43
44
45 /****************************************************************
46 ** search for knot interval
47 ** n: len(map)
48 ** k: order
49 ** returns index l: t[l] <= x < t[l+1]
50 */
51 static always_inline int find_index(int n, int k, real xi, real x0, real xe, real stepi, char* cl)
52 {
53 int l;
54 if (k % 2) {
55 l = static_cast<int>((xi - x0) * stepi + 0.5);
56 } else {
57 l = static_cast<int>((xi - x0) * stepi);
58 }
59 if (l < 0) {
60 *cl = -1;
61 return 0;
62 }
63 if (l > n-2) {
64 *cl = 1;
65 return n-2;
66 }
67 return l;
68 }
69
70 template<int K, typename M>
71 static always_inline int forward(int i, splinecoeffs<M> *p, real *xi, int ll,
72 typename splinedata<M>::retval *cl, real *h)
73 {
74 int l = p->map[i][find_index(p->nmap[i], K, xi[i], p->x0[i], p->xe[i], p->stepi[i], &cl->c[i])];
75 fpbspl<K>(p->t[i]+l, xi[i], h);
76 return ll*p->n[i] + l-K+1;
77 }
78
79 /****************************************************************
80 ** evaluate the spline function at x
81 **
82 ** t[n+k]: knot array
83 ** c[m][n]: coefficents
84 ** k: order (k > 0), order = degree + 1
85 ** x: function argument
86 ** res: output array (size m)
87 */
88 template<>
89 template<int K0>
90 always_inline int splinedata<unsigned short>::splev(splinecoeffs<unsigned short> *p, real xi[1], real *res)
91 {
92 real h[K0];
93 retval cl;
94 cl.i = 0;
95 int ll = 0;
96 ll = forward<K0>(0, p, xi, ll, &cl, h);
97 treal *c = p->c[0]+ll;
98 real sp = 0;
99 for (int j = 0; j < K0; j++) {
100 sp += c[j]*h[j];
101 }
102 *res = sp;
103 return cl.i;
104 }
105
106 template<>
107 template<int K0>
108 always_inline int splinedata<unsigned char>::splev(splinecoeffs<unsigned char> *p, real xi[1], real *res)
109 {
110 real h[K0];
111 retval cl;
112 cl.i = 0;
113 int ll = 0;
114 ll = forward<K0>(0, p, xi, ll, &cl, h);
115 treal *c = p->c[0]+ll;
116 real sp = 0;
117 for (int j = 0; j < K0; j++) {
118 sp += c[j]*h[j];
119 }
120 *res = sp;
121 return cl.i;
122 }
123
124 template<>
125 template<>
126 always_inline int splinedata<unsigned short>::splev_pp<4>(splinecoeffs<unsigned short> *p, real xi[1], real *res)
127 {
128 retval cl;
129 cl.i = 0;
130 int l = p->map[0][find_index(p->nmap[0], 4, xi[0], p->x0[0], p->xe[0], p->stepi[0], &cl.c[0])];
131 treal x = xi[0] - p->t[0][l];
132 treal *c = p->c[0] + (l-3)*4;
133 *res = ((c[0] * x + c[1]) * x + c[2]) * x + c[3];
134 return cl.i;
135 }
136
137 template<>
138 template<>
139 always_inline int splinedata<unsigned char>::splev_pp<4>(splinecoeffs<unsigned char> *p, real xi[1], real *res)
140 {
141 retval cl;
142 cl.i = 0;
143 int l = p->map[0][find_index(p->nmap[0], 4, xi[0], p->x0[0], p->xe[0], p->stepi[0], &cl.c[0])];
144 treal x = xi[0] - p->t[0][l];
145 treal *c = p->c[0] + (l-3)*4;
146 *res = ((c[0] * x + c[1]) * x + c[2]) * x + c[3];
147 return cl.i;
148 }
149
150 template<>
151 template<>
152 always_inline int splinedata<unsigned short>::splev_pp<2>(splinecoeffs<unsigned short> *p, real xi[1], real *res)
153 {
154 retval cl;
155 cl.i = 0;
156 int l = p->map[0][find_index(p->nmap[0], 2, xi[0], p->x0[0], p->xe[0], p->stepi[0], &cl.c[0])];
157 treal x = xi[0] - p->t[0][l];
158 treal *c = p->c[0] + (l-1)*2;
159 *res = c[0] * x + c[1];
160 return cl.i;
161 }
162
163 template<>
164 template<>
165 always_inline int splinedata<unsigned char>::splev_pp<2>(splinecoeffs<unsigned char> *p, real xi[1], real *res)
166 {
167 retval cl;
168 cl.i = 0;
169 int l = p->map[0][find_index(p->nmap[0], 2, xi[0], p->x0[0], p->xe[0], p->stepi[0], &cl.c[0])];
170 treal x = xi[0] - p->t[0][l];
171 treal *c = p->c[0] + (l-1)*2;
172 *res = c[0] * x + c[1];
173 return cl.i;
174 }
175
176 /****************************************************************
177 ** evaluate the X-dim spline function
178 **
179 ** t: array of pointers to knot arrays
180 ** c[m][n[0]]...[n[X-1]]: coefficents
181 ** k: orders (2 <= k[i] <= 5), order = degree + 1
182 ** x: function arguments
183 ** res[m]: output array
184 */
185 template<typename M>
186 template<int K0, int K1>
187 int splinedata<M>::splev(splinecoeffs<M> *p, real xi[2], real *res)
188 {
189 real h[2][6];
190 retval cl;
191 cl.i = 0;
192 int ll = 0;
193 ll = forward<K0>(0, p, xi, ll, &cl, h[0]);
194 ll = forward<K1>(1, p, xi, ll, &cl, h[1]);
195 treal *c = p->c[0]+ll;
196 int j[2];
197 real sp = 0;
198 for (j[0] = 0; j[0] < K0; j[0]++) {
199 for (j[1] = 0; j[1] < K1; j[1]++) {
200 sp += c[j[1]]*h[0][j[0]]*h[1][j[1]];
201 }
202 c += p->n[1];
203 }
204 *res = sp;
205 return cl.i;
206 }
207
208 template<int K, int S>
209 static inline void deriv(real *t, real *wrk) {
210 for (int i = 0; i < K-1; i++, wrk += S) {
211 real fac = t[i+1] - t[i+1-(K-1)];
212 if (fac > 0) {
213 wrk[0] = (K-1) * (wrk[S] - wrk[0]) / fac;
214 }
215 }
216 }
217
218 template<int K0, int K1, int S0, int S1>
219 static inline void deriv2d(real *t, real *c) {
220 for (int i = 0; i < K0; i++) {
221 deriv<K1, S1>(t, c);
222 c += S0;
223 }
224 }
225
226 template<int K0, int K1>
227 static inline void copy2d(real *c, real *wrk, int n) {
228 int j[2];
229 for (j[0] = 0; j[0] < K0; j[0]++) {
230 for (j[1] = 0; j[1] < K1; j[1]++) {
231 *wrk++ = *c++;
232 }
233 c += n - K1;
234 }
235 }
236
237 template<int K0, int K1, int S>
238 static inline real eval2d(real *c, real *h0, real *h1) {
239 int j[2];
240 real sp = 0;
241 for (j[0] = 0; j[0] < K0; j[0]++) {
242 for (j[1] = 0; j[1] < K1; j[1]++) {
243 sp += *c++ * h0[j[0]] * h1[j[1]];
244 }
245 c += S;
246 }
247 return sp;
248 }
249
250 template<typename M>
251 template<int K0, int K1>
252 int splinedata<M>::splevgr(splinecoeffs<M> *p, real xi[2], real res[1], real grad[2])
253 {
254 real h0[K0];
255 real h1[K1];
256 retval cl;
257 cl.i = 0;
258 int ll = 0;
259 // ll = forward<K0>(0, p, xi, ll, &cl, h0);
260 int l[2];
261 l[0] = p->map[0][find_index(p->nmap[0], K0, xi[0], p->x0[0], p->xe[0], p->stepi[0], &cl.c[0])];
262 fpbspl<K0>(p->t[0]+l[0], xi[0], h0);
263 ll = l[0]-(K0-1);
264 // ll = forward<K1>(1, p, xi, ll, &cl, h1);
265 l[1] = p->map[1][find_index(p->nmap[1], K1, xi[1], p->x0[1], p->xe[1], p->stepi[1], &cl.c[1])];
266 fpbspl<K1>(p->t[1]+l[1], xi[1], h1);
267 ll = ll*p->n[1] + l[1]-(K1-1);
268 //
269 treal wrk[K0*K1];
270 copy2d<K0, K1>(p->c[0]+ll, wrk, p->n[1]);
271 res[0] = eval2d<K0, K1, 0>(wrk, h0, h1);
272
273 deriv2d<K1, K0, 1, K1>(p->t[0]+l[0], wrk);
274 real hx[6];
275 fpbspl<K0-1>(p->t[0]+l[0], xi[0], hx);
276 grad[0] = eval2d<K0-1, K1, 0>(wrk, hx, h1);
277
278 copy2d<K0, K1>(p->c[0]+ll, wrk, p->n[1]);
279 deriv2d<K0, K1, K1, 1>(p->t[1]+l[1], wrk);
280 fpbspl<K1-1>(p->t[1]+l[1], xi[1], hx);
281 grad[1] = eval2d<K0, K1-1, 1>(wrk, h0, hx);
282 return cl.i;
283 }
284
285 template<typename M>
286 template<int K0, int K1, int K2>
287 int splinedata<M>::splev(splinecoeffs<M> *p, real xi[3], real *res)
288 {
289 real h[3][6];
290 retval cl;
291 cl.i = 0;
292 int ll = 0;
293 ll = forward<K0>(0, p, xi, ll, &cl, h[0]);
294 ll = forward<K1>(1, p, xi, ll, &cl, h[1]);
295 ll = forward<K2>(2, p, xi, ll, &cl, h[2]);
296 treal *cc = p->c[0];
297 int lc = ll;
298 int j[3];
299 real sp = 0;
300 for (j[0] = 0; j[0] < K0; j[0]++) {
301 for (j[1] = 0; j[1] < K1; j[1]++) {
302 for (j[2] = 0; j[2] < K2; j[2]++) {
303 sp += cc[lc]*h[0][j[0]]*h[1][j[1]]*h[2][j[2]];
304 lc += 1;
305 }
306 lc += p->n[2]-K2;
307 }
308 lc += (p->n[1]-K1)*p->n[2];
309 }
310 *res = sp;
311 return cl.i;
312 }
313
314 template<typename M>
315 template<int K0, int K1, int K2, int K3>
316 int splinedata<M>::splev(splinecoeffs<M> *p, real xi[4], real *res)
317 {
318 real h[4][6];
319 retval cl;
320 cl.i = 0;
321 int ll = 0;
322 ll = forward<K0>(0, p, xi, ll, &cl, h[0]);
323 ll = forward<K1>(1, p, xi, ll, &cl, h[1]);
324 ll = forward<K2>(2, p, xi, ll, &cl, h[2]);
325 ll = forward<K3>(3, p, xi, ll, &cl, h[3]);
326 treal *cc = p->c[0];
327 int lc = ll;
328 int j[4];
329 real sp = 0;
330 for (j[0] = 0; j[0] < K0; j[0]++) {
331 for (j[1] = 0; j[1] < K1; j[1]++) {
332 for (j[2] = 0; j[2] < K2; j[2]++) {
333 for (j[3] = 0; j[3] < K3; j[3]++) {
334 sp += cc[lc]*h[0][j[0]]*h[1][j[1]]*h[2][j[2]]*h[3][j[3]];
335 lc += 1;
336 }
337 lc += p->n[3]-K3;
338 }
339 lc += (p->n[2]-K2)*p->n[3];
340 }
341 lc += (p->n[1]-K1)*p->n[2]*p->n[3];
342 }
343 *res = sp;
344 return cl.i;
345 }
346
347 template<typename M>
348 SplineCalc<M>::SplineCalc(splinedata<M> *sd_, real *s0_)
349 : sd(sd_),
350 s0(s0_),
351 temp(new real[sd->n_input+sd->n_state]) {
352 }
353
354 template<typename M>
355 SplineCalc<M>::~SplineCalc() {
356 delete[] temp;
357 }
358
359 #ifdef CHECK_BOUNDS
360 void report(splinedata *sd, real *t, int i)
361 {
362 printf("%s:", sd->func_id);
363 splinedata::retval cl;
364 cl.i = i;
365 for (int n = 0; n < 4; n++) {
366 if (cl.c[n] < 0) {
367 printf(" %d:L[%g]", n, t[n]);
368 } else if (cl.c[n] > 0) {
369 printf(" %d:U[%g]", n, t[n]);
370 }
371 }
372 printf("\n");
373 }
374 #endif
375
376 template<typename M>
377 void SplineCalc<M>::calc(real *in, real *out)
378 {
379 for (int i = 0; i < sd->n_input; i++) {
380 temp[i] = in[i];
381 }
382 real t[sd->m];
383 for (int i = 0; i < sd->m; i++) {
384 splinecoeffs<M> *p = &sd->sc[i];
385 check(sd, temp, (*p->eval)(p, temp, &t[i]));
386 }
387 for (int i = 0; i < sd->n_output; i++) {
388 out[i] = t[i];
389 }
390 for (int i = 0; i < sd->n_state; i++) {
391 temp[i+sd->n_input] = t[i+sd->n_output];
392 }
393 }
394
395 template<typename M>
396 void SplineCalc<M>::reset()
397 {
398 for (int i = 0; i < sd->n_state; i++) {
399 temp[i+sd->n_input] = s0[i];
400 }
401 }
0 #ifndef _INTPP_H
1 #define _INTPP_H 1
2
3 typedef double real;
4 typedef double treal;
5 //typedef float real;
6 //typedef float treal;
7
8 template<typename M>
9 struct splinecoeffs {
10 real *x0;
11 real *xe;
12 real *stepi; // 1/h
13 int *k;
14 int *n;
15 int *nmap;
16 M **map;
17 treal **t;
18 treal **c;
19 int (*eval)(splinecoeffs *p, real *x, real *res);
20 };
21
22 template<typename M>
23 struct splinedata {
24 splinecoeffs<M> *sc;
25 int m;
26 int n_input;
27 int n_output;
28 int n_state;
29 const char *func_id;
30 template<int K0> static int splev(splinecoeffs<M> *p, real *x, real *res);
31 template<int K0> static int splev_pp(splinecoeffs<M> *p, real *x, real *res);
32 template<int K0, int K1> static int splev(splinecoeffs<M> *p, real *x, real *res);
33 template<int K0, int K1> static int splevgr(splinecoeffs<M> *p, real xi[2], real res[1], real grad[2]);
34 template<int K0, int K1, int K2> static int splev(splinecoeffs<M> *p, real *x, real *res);
35 template<int K0, int K1, int K2, int K3> static int splev(splinecoeffs<M> *p, real *x, real *res);
36 union retval {
37 char c[4];
38 int i;
39 };
40 };
41
42 template<typename M>
43 class SplineCalc {
44 protected:
45 splinedata<M> *sd;
46 real *s0;
47 real *temp;
48 public:
49 SplineCalc(splinedata<M> *sd_, real *s0_);
50 ~SplineCalc();
51 void reset();
52 void calc(real *in, real *out);
53 };
54
55 //#define CHECK_BOUNDS
56
57 #ifdef CHECK_BOUNDS
58 template<typename M>
59 void report(splinedata<M> *sd, real *t, int i);
60 template<typename M>
61 static inline void check(splinedata<M> *sd, creal *t, int i) { if (i) report(sd, t, i); }
62 #else
63 #define check(sd, t, i) i
64 #endif
65
66 #endif /* !_INTPP_H */
0 v 20121123 2
1 C 40000 40000 0 0 0 title-B.sym
2 C 40400 44800 1 0 0 input-1.sym
3 {
4 T 40400 45100 5 10 0 0 0 0 1
5 device=INPUT
6 T 40501 44843 5 10 1 1 0 0 1
7 refdes=Vin
8 }
9 C 42300 44700 1 0 0 capacitor-1.sym
10 {
11 T 42500 45400 5 10 0 0 0 0 1
12 device=CAPACITOR
13 T 42500 45200 5 10 1 1 0 0 1
14 refdes=C1
15 T 42500 45600 5 10 0 0 0 0 1
16 symversion=0.1
17 T 42600 44500 5 10 1 1 0 0 1
18 value=22n
19 }
20 C 41600 44600 1 0 0 triode.sym
21 {
22 T 43400 46000 5 10 1 1 0 0 1
23 refdes=U1a
24 T 44000 46700 5 10 0 1 0 0 1
25 device=TRIODE
26 T 43400 45800 5 10 1 1 0 0 1
27 value=12ax7
28 }
29 C 47400 44600 1 0 1 triode.sym
30 {
31 T 45300 45900 5 10 1 1 0 6 1
32 refdes=U1b
33 T 45000 46700 5 10 0 1 0 6 1
34 device=TRIODE
35 T 44900 45700 5 10 1 1 0 0 1
36 value=12ax7
37 }
38 C 44400 45800 1 270 0 resistor-2.sym
39 {
40 T 44750 45400 5 10 0 0 270 0 1
41 device=RESISTOR
42 T 44700 45600 5 10 1 1 270 0 1
43 refdes=R3
44 T 44700 45300 5 10 1 1 270 0 1
45 value=470
46 }
47 N 44200 45900 44800 45900 4
48 N 44500 45800 44500 45900 4
49 {
50 T 44300 45700 5 10 1 1 0 0 1
51 netname=4
52 }
53 C 43400 44800 1 0 0 resistor-2.sym
54 {
55 T 43800 45150 5 10 0 0 0 0 1
56 device=RESISTOR
57 T 43600 45000 5 10 1 1 0 0 1
58 refdes=R2
59 T 43900 45100 5 10 1 1 0 0 1
60 value=1M
61 }
62 N 43200 46600 43200 44900 4
63 N 44300 44900 44700 44900 4
64 {
65 T 44300 44700 5 10 1 1 0 0 1
66 netname=3
67 }
68 N 43200 44900 43400 44900 4
69 {
70 T 43300 45000 5 10 1 1 0 0 1
71 netname=2
72 }
73 C 44700 44800 1 0 0 resistor-2.sym
74 {
75 T 45100 45150 5 10 0 0 0 0 1
76 device=RESISTOR
77 T 44900 45100 5 10 1 1 0 0 1
78 refdes=R4
79 T 45200 45100 5 10 1 1 0 0 1
80 value=1M
81 }
82 C 44400 44500 1 270 0 resistor-2.sym
83 {
84 T 44750 44100 5 10 0 0 270 0 1
85 device=RESISTOR
86 T 44700 44300 5 10 1 1 270 0 1
87 refdes=R5
88 T 44700 44000 5 10 1 1 270 0 1
89 value=10k
90 }
91 C 45600 44100 1 270 0 capacitor-1.sym
92 {
93 T 46300 43900 5 10 0 0 270 0 1
94 device=CAPACITOR
95 T 45900 43800 5 10 1 1 0 0 1
96 refdes=C2
97 T 46500 43900 5 10 0 0 270 0 1
98 symversion=0.1
99 T 45900 43300 5 10 1 1 0 0 1
100 value=100n
101 }
102 C 48400 43000 1 0 0 ccurrent.sym
103 {
104 T 48600 43500 5 10 1 1 0 0 1
105 refdes=CC3
106 T 48800 43300 5 10 0 1 0 0 1
107 device=CONNECTION_CURRENT
108 }
109 N 44500 44500 44500 44900 4
110 C 44100 48600 1 0 0 capacitor-1.sym
111 {
112 T 44300 49300 5 10 0 0 0 0 1
113 device=CAPACITOR
114 T 44200 48500 5 10 1 1 0 0 1
115 refdes=C6
116 T 44300 49500 5 10 0 0 0 0 1
117 symversion=0.1
118 T 44700 48500 5 10 1 1 0 0 1
119 value=1p
120 }
121 C 45200 48100 1 0 0 capacitor-1.sym
122 {
123 T 45400 48800 5 10 0 0 0 0 1
124 device=CAPACITOR
125 T 45300 48400 5 10 1 1 0 0 1
126 refdes=C4
127 T 45400 49000 5 10 0 0 0 0 1
128 symversion=0.1
129 T 45800 48400 5 10 1 1 0 0 1
130 value=22n
131 }
132 C 45100 47600 1 0 0 capacitor-1.sym
133 {
134 T 45300 48300 5 10 0 0 0 0 1
135 device=CAPACITOR
136 T 45200 47900 5 10 1 1 0 0 1
137 refdes=C5
138 T 45300 48500 5 10 0 0 0 0 1
139 symversion=0.1
140 T 45700 47900 5 10 1 1 0 0 1
141 value=22n
142 }
143 C 43900 49700 1 270 0 resistor-2.sym
144 {
145 T 44250 49300 5 10 0 0 270 0 1
146 device=RESISTOR
147 T 44200 49300 5 10 1 1 0 0 1
148 refdes=R9
149 T 44200 49100 5 10 1 1 0 0 1
150 value=82k
151 }
152 C 44900 49700 1 270 0 resistor-2.sym
153 {
154 T 45250 49300 5 10 0 0 270 0 1
155 device=RESISTOR
156 T 45200 49300 5 10 1 1 0 0 1
157 refdes=R10
158 T 45200 49000 5 10 1 1 0 0 1
159 value=100k
160 }
161 N 44000 48800 44100 48800 4
162 N 44000 47400 44000 48800 4
163 {
164 T 43800 47800 5 10 1 1 0 0 1
165 netname=5
166 }
167 N 45100 47800 45000 47800 4
168 {
169 T 44800 47800 5 10 1 1 0 0 1
170 netname=6
171 }
172 N 45000 48800 45000 47400 4
173 N 45200 48300 44000 48300 4
174 C 47000 48200 1 270 0 resistor-2.sym
175 {
176 T 47350 47800 5 10 0 0 270 0 1
177 device=RESISTOR
178 T 47300 47800 5 10 1 1 0 0 1
179 refdes=R11
180 T 47300 47600 5 10 1 1 0 0 1
181 value=220k
182 }
183 C 47000 47200 1 270 0 resistor-2.sym
184 {
185 T 47350 46800 5 10 0 0 270 0 1
186 device=RESISTOR
187 T 47300 46800 5 10 1 1 0 0 1
188 refdes=R12
189 T 47300 46600 5 10 1 1 0 0 1
190 value=220k
191 }
192 C 47100 46000 1 0 0 resistor-2.sym
193 {
194 T 47500 46350 5 10 0 0 0 0 1
195 device=RESISTOR
196 T 47200 45800 5 10 1 1 0 0 1
197 refdes=R14
198 T 47700 45800 5 10 1 1 0 0 1
199 value=5k6
200 }
201 C 47100 48200 1 0 0 resistor-2.sym
202 {
203 T 47500 48550 5 10 0 0 0 0 1
204 device=RESISTOR
205 T 47200 48500 5 10 1 1 0 0 1
206 refdes=R13
207 T 47700 48500 5 10 1 1 0 0 1
208 value=5k6
209 }
210 N 46800 48300 47100 48300 4
211 {
212 T 46800 48500 5 10 1 1 0 0 1
213 netname=14
214 }
215 N 47100 46100 46500 46100 4
216 N 46500 46100 46500 47000 4
217 {
218 T 46300 46600 5 10 1 1 0 0 1
219 netname=15
220 }
221 C 46900 46600 1 0 0 pentode.sym
222 {
223 T 49700 49200 5 10 1 1 0 0 1
224 refdes=U2
225 T 49300 48700 5 10 0 1 0 0 1
226 device=PENTODE
227 T 49800 48900 5 10 1 1 0 0 1
228 value=EL34
229 }
230 C 46900 47800 1 180 1 pentode.sym
231 {
232 T 49700 45200 5 10 1 1 180 6 1
233 refdes=U3
234 T 49300 45700 5 10 0 1 180 6 1
235 device=PENTODE
236 T 49800 45300 5 10 1 1 0 0 1
237 value=EL34
238 }
239 C 49200 47500 1 270 0 gnd-1.sym
240 N 49500 47600 49500 46800 4
241 N 49500 47400 50200 47400 4
242 N 50200 45700 50200 48700 4
243 N 50200 48700 50100 48700 4
244 N 50200 45700 50100 45700 4
245 C 50300 48400 1 0 0 resistor-2.sym
246 {
247 T 50700 48750 5 10 0 0 0 0 1
248 device=RESISTOR
249 T 50500 48700 5 10 1 1 0 0 1
250 refdes=R15
251 T 50600 48200 5 10 1 1 0 0 1
252 value=1k
253 }
254 C 50300 45800 1 0 0 resistor-2.sym
255 {
256 T 50700 46150 5 10 0 0 0 0 1
257 device=RESISTOR
258 T 50500 46100 5 10 1 1 0 0 1
259 refdes=R16
260 T 50600 45600 5 10 1 1 0 0 1
261 value=1k
262 }
263 N 50100 45900 50300 45900 4
264 {
265 T 49900 46000 5 10 1 1 0 0 1
266 netname=23
267 }
268 N 50100 48500 50300 48500 4
269 {
270 T 49900 48300 5 10 1 1 0 0 1
271 netname=22
272 }
273 N 51200 45900 51200 50300 4
274 {
275 T 51300 47200 5 10 1 1 0 0 1
276 netname=26
277 }
278 C 52700 46000 1 0 0 transformer-3.sym
279 {
280 T 53100 47400 5 10 1 1 0 0 1
281 refdes=Trans
282 T 52700 47600 5 10 0 0 0 0 1
283 device=TRANSFORMER
284 T 53700 45900 5 10 0 1 0 0 1
285 value=w1=1000,w2=1000,w3=64,R=358
286 }
287 N 49300 49500 52700 49500 4
288 {
289 T 50100 49600 5 10 1 1 0 0 1
290 netname=21
291 }
292 N 49300 44100 52700 44100 4
293 {
294 T 49400 44200 5 10 1 1 0 0 1
295 netname=24
296 }
297 N 52700 46700 51700 46700 4
298 {
299 T 52000 46500 5 10 1 1 0 0 1
300 netname=25
301 }
302 C 46400 43100 1 0 0 resistor-2.sym
303 {
304 T 46800 43450 5 10 0 0 0 0 1
305 device=RESISTOR
306 T 46600 43400 5 10 1 1 0 0 1
307 refdes=R7
308 T 46900 43400 5 10 1 1 0 0 1
309 value=100k
310 }
311 C 44400 42600 1 270 0 resistor-2.sym
312 {
313 T 44750 42200 5 10 0 0 270 0 1
314 device=RESISTOR
315 T 44700 42400 5 10 1 1 270 0 1
316 refdes=R6
317 T 44700 42100 5 10 1 1 270 0 1
318 value=4k7
319 }
320 C 43200 42300 1 270 0 capacitor-1.sym
321 {
322 T 43900 42100 5 10 0 0 270 0 1
323 device=CAPACITOR
324 T 43500 42000 5 10 1 1 0 0 1
325 refdes=C3
326 T 44100 42100 5 10 0 0 270 0 1
327 symversion=0.1
328 T 43500 41600 5 10 1 1 0 0 1
329 value=100n
330 }
331 C 43300 43200 1 270 0 resistor-variable-2.sym
332 {
333 T 43700 42650 5 10 1 1 270 0 1
334 refdes=P1
335 T 44200 42400 5 10 0 1 270 0 1
336 device=VARIABLE_RESISTOR
337 T 43600 42800 5 10 1 1 0 0 1
338 value=22k
339 }
340 N 43400 42300 43900 42300 4
341 {
342 T 43100 42200 5 10 1 1 0 0 1
343 netname=10
344 }
345 N 43900 42300 43900 42700 4
346 N 43400 43200 46400 43200 4
347 {
348 T 45600 43000 5 10 1 1 0 0 1
349 netname=9
350 }
351 N 44500 43600 44500 43200 4
352 N 44500 43200 44500 42600 4
353 C 43900 41100 1 0 0 gnd-1.sym
354 N 43400 41400 44500 41400 4
355 N 44500 41400 44500 41700 4
356 C 54100 44800 1 0 0 gnd-1.sym
357 N 54200 46100 54200 45100 4
358 N 47100 47300 48100 47300 4
359 {
360 T 48300 47200 5 10 1 1 0 0 1
361 netname=16
362 }
363 N 48100 47300 48100 50200 4
364 N 44000 49700 45000 49700 4
365 {
366 T 44700 49900 5 10 1 1 0 0 1
367 netname=7
368 }
369 N 44500 49700 44500 50100 4
370 N 49200 43200 54600 43200 4
371 {
372 T 50200 43000 5 10 1 1 0 0 1
373 netname=20
374 }
375 N 54600 43200 54600 47300 4
376 N 54200 47300 54900 47300 4
377 N 47300 43200 48400 43200 4
378 {
379 T 47600 43000 5 10 1 1 0 0 1
380 netname=19
381 }
382 N 45800 46600 45800 44100 4
383 {
384 T 46000 45400 5 10 1 1 0 0 1
385 netname=8
386 }
387 N 45600 44900 45800 44900 4
388 C 46000 48100 1 0 0 ccurrent.sym
389 {
390 T 46200 48600 5 10 1 1 0 0 1
391 refdes=CC1
392 T 46400 48400 5 10 0 1 0 0 1
393 device=CONNECTION_CURRENT
394 }
395 C 46300 47800 1 270 0 ccurrent.sym
396 {
397 T 46800 47600 5 10 1 1 270 0 1
398 refdes=CC2
399 T 46600 47400 5 10 0 1 270 0 1
400 device=CONNECTION_CURRENT
401 }
402 C 54300 47300 1 90 0 inductor-1.sym
403 {
404 T 53800 47500 5 10 0 0 90 0 1
405 device=INDUCTOR
406 T 54000 48000 5 10 1 1 180 0 1
407 refdes=L3
408 T 53600 47500 5 10 0 0 90 0 1
409 symversion=0.1
410 T 53700 47600 5 10 1 1 0 0 1
411 value=0m6
412 }
413 C 55100 49500 1 0 0 inductor-1.sym
414 {
415 T 55300 50000 5 10 0 0 0 0 1
416 device=INDUCTOR
417 T 55300 49800 5 10 1 1 0 0 1
418 refdes=L4
419 T 55300 50200 5 10 0 0 0 0 1
420 symversion=0.1
421 T 55700 49800 5 10 1 1 0 0 1
422 value=23m
423 }
424 C 55100 48800 1 0 0 capacitor-1.sym
425 {
426 T 55300 49500 5 10 0 0 0 0 1
427 device=CAPACITOR
428 T 55100 49100 5 10 1 1 0 0 1
429 refdes=C10
430 T 55300 49700 5 10 0 0 0 0 1
431 symversion=0.1
432 T 55600 49100 5 10 1 1 0 0 1
433 value=193
434 }
435 C 54700 47200 1 270 0 capacitor-1.sym
436 {
437 T 55400 47000 5 10 0 0 270 0 1
438 device=CAPACITOR
439 T 55100 46900 5 10 1 1 0 0 1
440 refdes=C9
441 T 55600 47000 5 10 0 0 270 0 1
442 symversion=0.1
443 T 55100 46500 5 10 1 1 0 0 1
444 value=1n
445 }
446 C 54200 48200 1 0 0 resistor-2.sym
447 {
448 T 54600 48550 5 10 0 0 0 0 1
449 device=RESISTOR
450 T 54400 48500 5 10 1 1 0 0 1
451 refdes=R19
452 T 54500 48000 5 10 1 1 0 0 1
453 value=6.8
454 }
455 C 55100 48200 1 0 0 resistor-2.sym
456 {
457 T 55500 48550 5 10 0 0 0 0 1
458 device=RESISTOR
459 T 55300 48500 5 10 1 1 0 0 1
460 refdes=R20
461 T 55400 48000 5 10 1 1 0 0 1
462 value=45
463 }
464 N 55100 48300 55100 49600 4
465 {
466 T 54800 48900 5 10 1 1 0 0 1
467 netname=32
468 }
469 N 54900 47300 54900 47200 4
470 N 54900 46300 54900 46100 4
471 N 54200 46100 56000 46100 4
472 N 56000 49600 56000 46100 4
473 C 41300 44800 1 0 0 resistor-2.sym
474 {
475 T 41700 45150 5 10 0 0 0 0 1
476 device=RESISTOR
477 T 41500 45100 5 10 1 1 0 0 1
478 refdes=R1
479 T 41800 45100 5 10 1 1 0 0 1
480 value=10
481 }
482 N 47100 46100 47100 46300 4
483 N 47100 48200 47100 48300 4
484 N 47100 47200 47100 47300 4
485 C 43000 47500 1 270 0 capacitor-1.sym
486 {
487 T 43700 47300 5 10 0 0 270 0 1
488 device=CAPACITOR
489 T 42800 47200 5 10 1 1 0 0 1
490 refdes=Cm1
491 T 43900 47300 5 10 0 0 270 0 1
492 symversion=0.1
493 T 43300 47200 5 10 1 1 0 0 1
494 value=1p6
495 }
496 C 45600 47500 1 270 0 capacitor-1.sym
497 {
498 T 46300 47300 5 10 0 0 270 0 1
499 device=CAPACITOR
500 T 45300 47200 5 10 1 1 0 0 1
501 refdes=Cm2
502 T 46500 47300 5 10 0 0 270 0 1
503 symversion=0.1
504 T 45900 47200 5 10 1 1 0 0 1
505 value=1p6
506 }
507 C 48400 44700 1 0 0 capacitor-1.sym
508 {
509 T 48600 45400 5 10 0 0 0 0 1
510 device=CAPACITOR
511 T 48400 44500 5 10 1 1 0 0 1
512 refdes=Cm4
513 T 48600 45600 5 10 0 0 0 0 1
514 symversion=0.1
515 T 48900 44500 5 10 1 1 0 0 1
516 value=1p6
517 }
518 C 48400 49300 1 0 0 capacitor-1.sym
519 {
520 T 48600 50000 5 10 0 0 0 0 1
521 device=CAPACITOR
522 T 48400 49800 5 10 1 1 0 0 1
523 refdes=Cm3
524 T 48600 50200 5 10 0 0 0 0 1
525 symversion=0.1
526 T 49000 49800 5 10 1 1 0 0 1
527 value=1p6
528 }
529 N 43200 47500 44000 47500 4
530 N 46500 47800 46000 47800 4
531 {
532 T 46100 47500 5 10 1 1 0 0 1
533 netname=13
534 }
535 N 45800 47500 45000 47500 4
536 N 48000 46100 48500 46100 4
537 {
538 T 48300 46300 5 10 1 1 0 0 1
539 netname=18
540 }
541 N 48000 48300 48500 48300 4
542 {
543 T 48400 48100 5 10 1 1 0 0 1
544 netname=17
545 }
546 N 48400 49500 48400 48300 4
547 N 48400 44900 48400 46100 4
548 C 51500 48600 1 270 0 capacitor-1.sym
549 {
550 T 52200 48400 5 10 0 0 270 0 1
551 device=CAPACITOR
552 T 51900 48300 5 10 1 1 0 0 1
553 refdes=C7
554 T 52400 48400 5 10 0 0 270 0 1
555 symversion=0.1
556 T 51900 47900 5 10 1 1 0 0 1
557 value=1n
558 }
559 C 51500 45800 1 270 0 capacitor-1.sym
560 {
561 T 52200 45600 5 10 0 0 270 0 1
562 device=CAPACITOR
563 T 51900 45500 5 10 1 1 0 0 1
564 refdes=C8
565 T 52400 45600 5 10 0 0 270 0 1
566 symversion=0.1
567 T 51900 45100 5 10 1 1 0 0 1
568 value=1n
569 }
570 N 51700 45800 51700 47700 4
571 N 51700 48600 51700 49500 4
572 C 52200 50300 1 0 0 generic-power-1.sym
573 {
574 T 52200 50600 5 10 1 1 0 0 1
575 refdes=Vcc3
576 T 52700 50600 5 10 1 1 0 0 1
577 value=468V
578 T 52200 50300 5 10 0 0 0 0 1
579 device=POWER
580 }
581 C 47900 50200 1 0 0 generic-power-1.sym
582 {
583 T 48000 50500 5 10 1 1 0 0 1
584 refdes=Vb
585 T 48300 50500 5 10 1 1 0 0 1
586 value=-57V
587 T 47900 50200 5 10 0 0 0 0 1
588 device=POWER
589 }
590 C 44300 50100 1 0 0 generic-power-1.sym
591 {
592 T 44300 50400 5 10 1 1 0 0 1
593 refdes=Vcc1
594 T 44800 50400 5 10 1 1 0 0 1
595 value=390V
596 T 44300 50100 5 10 0 0 0 0 1
597 device=POWER
598 }
599 C 51000 50300 1 0 0 generic-power-1.sym
600 {
601 T 51000 50600 5 10 1 1 0 0 1
602 refdes=Vcc2
603 T 51500 50600 5 10 1 1 0 0 1
604 value=467V
605 T 51000 50300 5 10 0 0 0 0 1
606 device=POWER
607 }
608 C 52600 48300 1 270 0 inductor-1.sym
609 {
610 T 53100 48100 5 10 0 0 270 0 1
611 device=INDUCTOR
612 T 52800 47900 5 10 1 1 0 0 1
613 refdes=L1
614 T 53300 48100 5 10 0 0 270 0 1
615 symversion=0.1
616 T 52800 47700 5 10 1 1 0 0 1
617 value=10m
618 }
619 C 52600 46000 1 270 0 inductor-1.sym
620 {
621 T 53100 45800 5 10 0 0 270 0 1
622 device=INDUCTOR
623 T 52900 45600 5 10 1 1 0 0 1
624 refdes=L2
625 T 53300 45800 5 10 0 0 270 0 1
626 symversion=0.1
627 T 52900 45400 5 10 1 1 0 0 1
628 value=10m
629 }
630 C 52600 45000 1 270 0 resistor-2.sym
631 {
632 T 52950 44600 5 10 0 0 270 0 1
633 device=RESISTOR
634 T 52900 44800 5 10 1 1 270 0 1
635 refdes=R18
636 T 52900 44400 5 10 1 1 270 0 1
637 value=10
638 }
639 C 52600 49300 1 270 0 resistor-2.sym
640 {
641 T 52950 48900 5 10 0 0 270 0 1
642 device=RESISTOR
643 T 52900 49100 5 10 1 1 270 0 1
644 refdes=R17
645 T 52900 48700 5 10 1 1 270 0 1
646 value=10
647 }
648 N 52700 49500 52700 49300 4
649 N 49300 44900 49300 44100 4
650 N 51700 44900 51700 44100 4
651 N 52400 46700 52400 50300 4
652 N 46100 48300 46000 48300 4
653 {
654 T 46000 48100 5 10 1 1 0 0 1
655 netname=12
656 }
657 C 54900 47200 1 0 0 output-1.sym
658 {
659 T 55000 47500 5 10 0 0 0 0 1
660 device=OUTPUT
661 T 55178 47241 5 10 1 1 0 0 1
662 refdes=Vout
663 }
664 N 41200 44900 41300 44900 4
665 {
666 T 41200 45000 5 10 1 1 0 0 1
667 netname=0
668 }
669 N 42200 44900 42300 44900 4
670 {
671 T 42200 45000 5 10 1 1 0 0 1
672 netname=1
673 }
674 N 52700 48400 52700 48300 4
675 {
676 T 52800 48300 5 10 1 1 0 0 1
677 netname=27
678 }
679 N 52700 47400 52700 47300 4
680 {
681 T 52800 47400 5 10 1 1 0 0 1
682 netname=28
683 }
684 N 52700 45000 52700 45100 4
685 {
686 T 52400 45000 5 10 1 1 0 0 1
687 netname=30
688 }
689 N 52700 46000 52700 46100 4
690 {
691 T 52400 46000 5 10 1 1 0 0 1
692 netname=29
693 }
694 N 54200 48300 54200 48200 4
695 {
696 T 53900 48300 5 10 1 1 0 0 1
697 netname=31
698 }
0 from __future__ import division
1 import sys, os, re
2
3 def mksym(sym, nm, dev=None):
4 if dev is None:
5 dev = nm
6 if sym.startswith(nm):
7 sym = sym[len(nm):]
8 try:
9 int(sym)
10 except ValueError:
11 sym = "'%s'" % sym
12 return "%s(%s)" % (dev, sym)
13
14 R_dict = {
15 "k" : "e3",
16 "M" : "e6",
17 "." : "",
18 "" : "",
19 }
20
21 C_dict = {
22 "n" : "e-9",
23 "p" : "e-12",
24 "u" : "e-6",
25 "." : "e-6",
26 "" : "e-6",
27 }
28
29 L_dict = {
30 "m" : "e-3",
31 "u" : "e-6",
32 "H" : "",
33 "." : "",
34 "" : "",
35 }
36
37 def resistor_value(val):
38 m = re.match("(?P<l>[0-9]*)(\\.(?P<t>[0-9]*))?(?P<m>[kM])?$", val)
39 if not m:
40 m = re.match("(?P<l>[0-9]*)(?P<m>[kM.]?)(?P<t>[0-9]*)$", val)
41 return m.group('l') + "." + (m.group('t') or '') + R_dict[m.group('m') or '']
42
43 def capacitor_value(val):
44 m = re.match("(?P<l>[0-9]*)(\\.(?P<t>[0-9]*))?(?P<m>[npu])?F?$", val)
45 if not m:
46 m = re.match("(?P<l>[0-9]*)(?P<m>[npu.]?)(?P<t>[0-9]*)$", val)
47 return m.group('l') + "." + (m.group('t') or '') + C_dict[m.group('m') or '']
48
49 mag_dict = {
50 "M": "e6",
51 "k": "e3",
52 "m": "e-3",
53 "u": "e-6",
54 "n": "e-9",
55 "p": "e-12",
56 "f": "e-15",
57 }
58
59 def convert_with_suffix(v):
60 try:
61 v = v[:-1] + mag_dict[v[-1]]
62 except KeyError:
63 pass
64 return v
65
66 def Voltage(v):
67 if v.endswith("V"):
68 v = v[:-1]
69 return convert_with_suffix(v)
70
71 def Current(v):
72 if v.endswith("A"):
73 v = v[:-1]
74 return convert_with_suffix(v)
75
76 def Number(v):
77 return convert_with_suffix(v)
78
79 def Text(v):
80 return "'%s'" % v
81
82 def Resistance(v):
83 return resistor_value(v)
84
85 def mk_dict(val, **kw):
86 l = []
87 for k, v in [v.split("=") for v in val.split(",")]:
88 if k not in kw:
89 print "warning: unknown parameter %s" % k
90 try:
91 v = float(v)
92 except ValueError:
93 pass
94 else:
95 v = kw[k](v)
96 l.append("%s=%s" % (k, v))
97 return "dict(%s)" % ", ".join(l)
98
99 def read_netlist(fname):
100 cmd = "echo '(ampsim \"/dev/fd/3\")' | gnetlist -l ampsim.scm -i %s 3>&1 >/dev/null"
101 rows = []
102 values = {}
103 with os.popen(cmd % fname) as f:
104 out = []
105 inp = []
106 for line in f:
107 line = line.split()
108 sym = line[0]
109 dev = line[1]
110 val = line[2]
111 conn = []
112 for v in line[3:]:
113 if v == "GND":
114 pass
115 elif v.startswith("unnamed_net"):
116 v = "'u"+v[11:]+"'"
117 elif v.startswith("unconnected_"):
118 v = None
119 else:
120 try:
121 int(v)
122 except ValueError:
123 v = "'%s'" % v
124 conn.append(v)
125 if dev == "INPUT":
126 inp += conn
127 continue
128 if dev == "OUTPUT":
129 out += conn
130 continue
131 if dev in ("OPAMP","AOP-Standard"):
132 conn = conn[:2] + conn[4:]
133 sym = mksym(sym, "O", "OPA")
134 val = "Opamps['%s']" % val
135 elif dev == "RESISTOR":
136 sym = mksym(sym, "R")
137 val = resistor_value(val)
138 elif dev in ("CAPACITOR", "POLARIZED_CAPACITOR"):
139 sym = mksym(sym, "C")
140 val = capacitor_value(val)
141 elif dev == "INDUCTOR":
142 sym = mksym(sym, "L")
143 m = re.match("([0-9]*)([muH.]?)([0-9]*)H?$", val)
144 val = m.group(1)+"."+m.group(3)+L_dict[m.group(2)]
145 elif dev == "TRANSFORMER":
146 ##FIXME
147 sym = mksym(sym, "Trans_L")
148 conn = [conn[0], conn[4], conn[4], conn[1], conn[2], conn[3]]
149 vl = {}
150 d = {}
151 for k, v in [v.split("=") for v in val.split(",")]:
152 if k == "R":
153 vl[k] = float(v)
154 elif k.startswith("w"):
155 d[int(k[1:])] = float(v)
156 else:
157 print "warning: unknown parameter %s" % k
158 vl["windings"] = [v[1] for v in sorted(d.items())]
159 val = repr(vl)
160 elif dev == "NPN_TRANSISTOR":
161 sym = mksym(sym, "T")
162 if "=" in val:
163 val = mk_dict(val,Vt=Voltage,Is=Current,Bf=Number,Br=Number)
164 else:
165 val = "Transistors['%s']" % val
166 elif dev == "DIODE":
167 sym = mksym(sym, "D")
168 val = "Diodes['%s']" % val
169 elif dev == "TRIODE":
170 sym = mksym(sym, "U", "Triode")
171 val = "Tubes['%s']" % val
172 elif dev == "PENTODE":
173 sym = mksym(sym, "U", "Pentode")
174 conn = [conn[0], conn[1], conn[3], conn[4]]
175 val = "Tubes['%s']" % val
176 elif dev == "VARIABLE_RESISTOR":
177 sym = mksym(sym, "P")
178 if "=" in val:
179 val = mk_dict(val,value=Resistance,a=Number,inv=Number,var=Text,name=Text)
180 else:
181 val = resistor_value(val)
182 elif dev == "CONNECTION_CURRENT":
183 sym = mksym(sym, "CC")
184 val = None
185 elif dev == "POWER":
186 sym = mksym(sym, "V")
187 if val.endswith("V"):
188 val = val[:-1]
189 if "." not in val:
190 val += "."
191 elif dev == "VOLTAGE_SOURCE":
192 sym = mksym(sym, "V")
193 if val == "DC":
194 val = conn[0][1:-1]
195 conn = conn[1:]
196 if val.endswith("V"):
197 val = val[:-1]
198 if "." not in val:
199 val += "."
200 elif dev == "vsin":
201 continue
202 else:
203 assert False, dev
204 if val is not None:
205 values[sym] = val
206 rows.append([sym]+conn)
207 rows.append(['OUT']+out)
208 rows.append(['IN']+inp)
209 fmt_row = lambda row: " ".join(["None," if v is None else v+"," for v in row])
210 return ("S = ((%s),\n )" % "),\n (".join([fmt_row(row) for row in rows]) +
211 "\n" +
212 "V = {%s}" % "".join(['%s: %s,\n ' % v for v in sorted(values.items())])
213 )
214 return rows, values
215
216 if __name__ == "__main__":
217 print read_netlist(sys.argv[1])
0 from __future__ import division
1 import numpy as np
2 import sympy as sp
3
4 class GNDclass(object):
5 def __repr__(self):
6 return "GND"
7 GND = GNDclass()
8
9 class NODESclass(object):
10 def add_count(self, tc, conn, param): pass
11 def process(self, p, conn, param, alpha): pass
12 def __repr__(self): return "NODES"
13 NODES = NODESclass()
14
15 class Node(object):
16 def __init__(self, nm, d):
17 self.nm = nm
18 self.d = d
19 def __repr__(self):
20 return "%s%s" % (self.nm, self.d or "")
21 def __hash__(self):
22 return hash((self.nm,self.d))
23 def __eq__(self, o):
24 if not isinstance(o, Node):
25 return False
26 return self.nm == o.nm and self.d == o.d
27 def __call__(self, s, fact=1.0):
28 return OutU(self, s, fact)
29 def check(self, param):
30 if param is None:
31 raise ValueError("%s: no value defined" % self)
32
33 class INclass(Node):
34 def __init__(self):
35 Node.__init__(self, "IN", None)
36 def add_count(self, tc, conn, param):
37 self.conn = conn
38 tc["V"] += len(conn)
39 tc["I"] = len(conn)
40 def process(self, p, conn, param, alpha):
41 for i, c in enumerate(conn):
42 idx = p.new_row("V", self, self.conn[i])
43 p.S[idx, c] += 1
44 p.S[c, idx] += 1
45 n = p.new_row("I", self, self.conn[i])
46 p.N["I"][n, idx] = 1
47 IN = INclass()
48
49
50 class Out(object):
51 def __init__(self, node, fact=1.0):
52 self.node = node
53 self.fact = fact
54
55 def get_index(self, p):
56 return p.nodes[self.node], self.fact
57
58 def __repr__(self):
59 if self.fact != 1.0:
60 return "%s*%g" % (self.node, self.fact)
61 else:
62 return repr(self.node)
63
64
65 class OutU(Out):
66 def __init__(self, node, f, fact):
67 self.node = node
68 self.f = f
69 self.fact = fact
70
71 def get_index(self, p):
72 return p.extra_variable_by_name((self.node,self.f)), self.fact
73
74 def __repr__(self):
75 return "%s%s" % (self.node, self.f and ("[%s]" % self.f) or "")
76
77 class OUTclass(Node):
78 def __init__(self):
79 Node.__init__(self, "OUT", None)
80 def add_count(self, tc, conn, param):
81 self.conn = conn
82 tc["O"] += len(conn)
83 def process(self, p, conn, param, alpha):
84 for c in conn:
85 v = 1
86 if isinstance(c, Out):
87 c, fact = c.get_index(p)
88 v = fact
89 p.N["O"][p.new_row("O", self), c] = v
90 OUT = OUTclass()
91
92 class R(Node):
93 def __init__(self, n=None):
94 Node.__init__(self, "R", n)
95 def add_count(self, tc, conn, param):
96 tc["R"] += 1
97 def process(self, p, conn, param, alpha):
98 idx = p.new_row("R", self)
99 #param = sp.symbols(str(self))
100 p.add_S_currents(conn, 1 / param)
101 p.add_2conn("R", idx, conn)
102
103 class P_parallel(Node):
104 # loga value pot value for var = 0.5
105 # log(16) 20%
106 # 5 ~7.6%
107 def __init__(self, n=None):
108 Node.__init__(self, "P", n)
109 def add_count(self, tc, conn, param):
110 if conn[0] is not None and conn[1] is not None and conn[0] != conn[2] and conn[2] != conn[1]:
111 tc["R"] += 2
112 tc["P"] += 2
113 else:
114 tc["R"] += 1
115 tc["P"] += 1
116 tc["v"] += 1
117 def process(self, p, conn, param, alpha):
118 self.check(param)
119 sym = str(self)+"v"
120 if isinstance(param, dict):
121 val = 2 * param["value"]
122 sym = param.get("var", sym)
123 else:
124 val = 2 * param
125 a = sp.symbols(sym)
126 v = 1 / val
127 # first resistor
128 if conn[0] != conn[2] and conn[0] is not None:
129 c = (conn[0], conn[2])
130 idx1 = p.new_row("R", self)
131 p.add_S_currents(c, v)
132 p.add_2conn("R", idx1, c)
133 idx_p1 = p.new_row("P", self, "+")
134 p.add_2conn("P", idx_p1, c)
135 p.Pv[idx_p1] = val
136 p.pot_func[idx_p1] = (a, a / (2 - a))
137 if conn[2] != conn[1] and conn[1] is not None:
138 # second resistor
139 c = (conn[2], conn[1])
140 idx2 = p.new_row("R", self)
141 p.add_S_currents(c, v)
142 p.add_2conn("R", idx2, c)
143 idx_p2 = p.new_row("P", self, "-")
144 p.add_2conn("P", idx_p2, c)
145 p.Pv[idx_p2] = val
146 p.pot_func[idx_p2] = (a, (1 - a) / (1 + a))
147
148
149 class P_single(Node):
150 def __init__(self, n=None):
151 Node.__init__(self, "P", n)
152 def add_count(self, tc, conn, param):
153 if len(conn) == 3:
154 tc["P"] += 2
155 else:
156 tc["P"] += 1
157 tc["v"] += 1
158 def process(self, p, conn, param, alpha):
159 sym = str(self)+"v"
160 if isinstance(param, dict):
161 val = param["value"]
162 sym = param.get("var", sym)
163 else:
164 val = param
165 a = sp.symbols(sym)
166 # first resistor
167 c = (conn[0], conn[2])
168 idx_p1 = p.new_row("P", self, "+")
169 p.add_2conn("P", idx_p1, c)
170 p.Pv[idx_p1] = val
171 p.pot_func[idx_p1] = (a, a)
172 if len(conn) == 3:
173 # second resistor
174 c = (conn[1], conn[2])
175 idx_p2 = p.new_row("P", self, "-")
176 p.add_2conn("P", idx_p2, c)
177 p.Pv[idx_p2] = val
178 p.pot_func[idx_p2] = (a, 1 - a)
179
180 class P_fixed(Node):
181 def __init__(self, n=None):
182 Node.__init__(self, "P", n)
183 def add_count(self, tc, conn, param):
184 if len(conn) == 3:
185 tc["R"] += 2
186 else:
187 tc["R"] += 1
188 def process(self, p, conn, param, alpha):
189 if isinstance(param, dict):
190 val = param["value"]
191 else:
192 val = param
193 # first resistor
194 c = (conn[0], conn[2])
195 idx_p1 = p.new_row("R", self, "+")
196 p.add_S_currents(conn, 2 / val)
197 p.add_2conn("R", idx_p1, c)
198 if len(conn) == 3:
199 # second resistor
200 c = (conn[1], conn[2])
201 idx_p2 = p.new_row("R", self, "-")
202 p.add_S_currents(conn, 2 / val)
203 p.add_2conn("R", idx_p2, c)
204
205 P = P_parallel
206 #P = P_single
207 #P = P_fixed
208
209 class C(Node):
210 def __init__(self, n=None):
211 Node.__init__(self, "C", n)
212 def add_count(self, tc, conn, param):
213 tc["X"] += 1
214 def process(self, p, conn, param, alpha):
215 idx = p.new_row("X", self)
216 #param = sp.symbols(str(self))
217 value = alpha * param
218 p.add_S_currents(conn, value)
219 p.add_2conn("Xl", idx, conn, value)
220 p.add_2conn("Xr", idx, conn)
221 p.Z[idx] = 1
222
223 class L(Node):
224 def __init__(self, n=None):
225 Node.__init__(self, "L", n)
226 def add_count(self, tc, conn, param):
227 tc["X"] += 1
228 def process(self, p, conn, param, alpha):
229 idx = p.new_row("X", self)
230 #param = sp.symbols(str(self))
231 value = 1 / (alpha * param)
232 p.add_S_currents(conn, value)
233 p.add_2conn("Xl", idx, conn, value)
234 p.add_2conn("Xr", idx, conn)
235 p.Z[idx] = -1
236
237 class D(Node):
238 def __init__(self, n=None):
239 Node.__init__(self, "D", n)
240 def add_count(self, tc, conn, param):
241 tc["N"] += 1
242 def process(self, p, conn, param, alpha):
243 Is, mUt = const = sp.symbols("Is,mUt")
244 v0, = v = sp.symbols("v:1", seq=True)
245 calc = -Is * (sp.exp(v0/mUt) - 1)
246 calc = calc.subs(dict([(k,param[str(k)]) for k in const]))
247 idx = p.new_row("N", self)
248 p.add_2conn("Nl", idx, conn)
249 p.add_2conn("Nr", idx, conn)
250 p.set_function(idx, calc, v, idx)
251
252 class D2(Node):
253 def __init__(self, n=None):
254 Node.__init__(self, "D", n)
255 def add_count(self, tc, conn, param):
256 tc["N"] += 1
257 def process(self, p, conn, param, alpha):
258 Is, mUt = const = sp.symbols("Is,mUt")
259 v0, = v = sp.symbols("v:1", seq=True)
260 calc = -2 * Is * sp.sinh(v0/mUt)
261 calc = calc.subs(dict([(k,param[str(k)]) for k in const]))
262 idx = p.new_row("N", self)
263 p.add_2conn("Nl", idx, (conn[0], conn[1]))
264 p.add_2conn("Nr", idx, (conn[0], conn[1]))
265 p.set_function(idx, calc, v, idx)
266
267 class VCCS(Node):
268 def __init__(self, n=None):
269 Node.__init__(self, "VCCS", n)
270 def add_count(self, tc, conn, param):
271 pass
272 def process(self, p, conn, param, alpha):
273 dG = param["dG"]
274 i0 = param["i0"]
275 if conn[2] != -1:
276 if conn[0] != -1:
277 p.S[conn[2], conn[0]] += dG
278 if conn[1] != -1:
279 p.S[conn[2], conn[1]] -= dG
280 p.ConstVoltages[0,conn[2]] += i0
281 if conn[3] != -1:
282 if conn[0] != -1:
283 p.S[conn[3], conn[0]] -= dG
284 if conn[1] != -1:
285 p.S[conn[3], conn[1]] += dG
286 p.ConstVoltages[0,conn[3]] -= i0
287
288 class T(Node):
289 def __init__(self, n=None):
290 Node.__init__(self, "T", n)
291 def add_count(self, tc, conn, param):
292 tc["N"] += 2
293 def process(self, p, conn, param, alpha):
294 # pins are C, B, E (index 0, 1, 2)
295 # Ib and Ie depend on Vbc (1 - 0) and Vbe (1 - 2), Ic = Ib + Ie
296 #
297 Is, Bf, Vt, Br = const = sp.symbols("Is,Bf,Vt,Br")
298 Vbc, Vbe = v = sp.symbols("Vbc,Vbe")
299 calc_ib = -(Is / Bf * (sp.exp(Vbe/Vt)-1) + Is/Br * (sp.exp(Vbc/Vt)-1))
300 calc_ib = calc_ib.subs(dict([(k,param[str(k)]) for k in const]))
301 calc_ie = -(-Is*(sp.exp(Vbe/Vt)-1) + Is*(Br-1)/Br * (sp.exp(Vbc/Vt)-1))
302 calc_ie = calc_ie.subs(dict([(k,param[str(k)]) for k in const]))
303 idx1 = p.new_row("N", self, "Ib")
304 p.add_2conn("Nl", idx1, (conn[1],conn[0]))
305 p.add_2conn("Nr", idx1, (conn[1],conn[0]))
306 p.set_function(idx1, calc_ib, v, idx1)
307 idx2 = p.new_row("N", self, "Ie")
308 p.add_2conn("Nl", idx2, (conn[1],conn[2]))
309 p.add_2conn("Nr", idx2, (conn[2],conn[0]))
310 p.set_function(idx2, calc_ie, v, idx1)
311
312 class Triode(Node):
313 def __init__(self, n=None):
314 Node.__init__(self, "Triode", n)
315 def add_count(self, tc, conn, param):
316 tc["N"] += 2
317 def process(self, p, conn, param, alpha):
318 mu, Ex, Kp, Kvb, Kg1, Gco, Gcf = const = sp.symbols("mu,Ex,Kp,Kvb,Kg1,Gco,Gcf")
319 Ugk, Uak = v = sp.symbols("Ugk,Uak", real=True) # "real" needed to get derivative of sign()
320 t = Kp*(1/mu+Ugk/sp.sqrt(Kvb+Uak*Uak))
321 E1 = Uak/Kp*sp.log(1+sp.exp(t))
322 E1_ = Uak/Kp*t
323 calc_Ia = sp.Piecewise(
324 (0, Uak < 0),
325 (0, t < -500),
326 (-pow(E1_,Ex) / Kg1 * (1+sp.sign(E1_)), t > 500),
327 (-pow(E1,Ex) / Kg1 * (1+sp.sign(E1)), True))
328 calc_Ia = calc_Ia.subs(dict([(k,param[str(k)]) for k in const]))
329 calc_Ig = sp.Piecewise((0, Ugk < Gco), (-Gcf*pow(Ugk-Gco, 1.5), True))
330 calc_Ig = calc_Ig.subs(dict([(k,param[str(k)]) for k in const]))
331 # def calc_Ia(v):
332 # Ugk = float(v[0])
333 # Uak = float(v[1])
334 # if Uak < 0:
335 # return 0
336 # t = Kp*(1/mu+Ugk/math.sqrt(Kvb+Uak*Uak))
337 # if t > 500:
338 # E1 = Uak/Kp*t
339 # elif t < -500:
340 # return 0
341 # else:
342 # E1 = Uak/Kp*math.log(1+math.exp(t))
343 # r = pow(E1,Ex) / Kg1 * 2*(E1 > 0.0)
344 # return -r
345 # def calc_Ig(v):
346 # Ugk = float(v[0])
347 # if Ugk < Gco:
348 # return 0
349 # r = Gcf*pow(Ugk-Gco, 1.5)
350 # return -r
351 idx1 = p.new_row("N", self, "Ig")
352 p.add_2conn("Nl", idx1, (conn[0],conn[2]))
353 p.add_2conn("Nr", idx1, (conn[0],conn[2]))
354 p.set_function(idx1, calc_Ig, v, idx1)
355 idx2 = p.new_row("N", self, "Ip")
356 p.add_2conn("Nl", idx2, (conn[1],conn[2]))
357 p.add_2conn("Nr", idx2, (conn[1],conn[2]))
358 p.set_function(idx2, calc_Ia, v, idx1)
359
360 class Pentode(Node):
361 def __init__(self, n=None):
362 Node.__init__(self, "Pentode", n)
363 def add_count(self, tc, conn, param):
364 tc["N"] += 3
365 def process(self, p, conn, param, alpha):
366 mu, Ex, Kp, Kg1, Kg2, Kvb, Gco, Gcf = const = sp.symbols("mu,Ex,Kp,Kg1,Kg2,Kvb,Gco,Gcf")
367 Ug1k, Ug2k, Uak = v = sp.symbols("Ug1k,Ug2k,Uak")
368 t = Kp * (1 / mu + Ug1k / Ug2k)
369 E1 = Ug2k / Kp * sp.log(1 + sp.exp(t))
370 E1_ = Ug2k / Kp * t
371 #sign = sp.sign
372 sign = lambda x: 2 * sp.Heaviside(x) - 1
373 calc_Ia = sp.Piecewise(
374 (0, Ug2k <= 0),
375 (0, t < -500),
376 (-pow(E1_,Ex)/Kg1 * (1+sign(E1_)) * sp.atan(Uak/Kvb), t > 500),
377 (-pow(E1,Ex)/Kg1 * (1+sign(E1)) * sp.atan(Uak/Kvb), True))
378 calc_Ia = calc_Ia.subs(dict([(k,param[str(k)]) for k in const]))
379 calc_Ig = sp.Piecewise((0, Ug1k < Gco), (-Gcf*pow(Ug1k-Gco, 1.5), True))
380 calc_Ig = calc_Ig.subs(dict([(k,param[str(k)]) for k in const]))
381 t = Ug2k / mu + Ug1k
382 calc_Is = sp.Piecewise((0, t <= 0), (-sp.exp(Ex*sp.log(t)) / Kg2, True))
383 calc_Is = calc_Is.subs(dict([(k,param[str(k)]) for k in const]))
384 # def calc_Ia(v):
385 # Ug1k = float(v[0])
386 # Ug2k = float(v[1])
387 # Uak = float(v[2])
388 # if Ug2k <= 0.0:
389 # return 0
390 # t = Kp * (1 / mu + Ug1k / Ug2k)
391 # if t > 500:
392 # E1 = Ug2k / Kp * t
393 # elif t < -500:
394 # return 0
395 # else:
396 # E1 = Ug2k / Kp * math.log(1 + math.exp(t))
397 # r = pow(E1,Ex)/Kg1 * 2*(E1 > 0.0) * math.atan(Uak/Kvb);
398 # #print Ug1k, Ug2k, Uak, r
399 # return -r
400 # def calc_Ig(v):
401 # Ugk = float(v[0])
402 # if Ugk < Gco:
403 # return 0
404 # r = Gcf*pow(Ugk-Gco, 1.5)
405 # return -r
406 # def calc_Is(v):
407 # Ug1k = float(v[0])
408 # Ug2k = float(v[1])
409 # t = Ug2k / mu + Ug1k
410 # if t <= 0:
411 # return 0
412 # r = math.exp(Ex*math.log(t)) / Kg2
413 # return -r
414
415 idx1 = p.new_row("N", self, "Ig")
416 p.add_2conn("Nl", idx1, (conn[0],conn[3]))
417 p.add_2conn("Nr", idx1, (conn[0],conn[3]))
418 p.set_function(idx1, calc_Ig, v[:1], idx1)
419 idx2 = p.new_row("N", self, "Is")
420 p.add_2conn("Nl", idx2, (conn[1],conn[3]))
421 p.add_2conn("Nr", idx2, (conn[1],conn[3]))
422 p.set_function(idx2, calc_Is, v, idx1)
423 idx3 = p.new_row("N", self, "Ip")
424 p.add_2conn("Nl", idx3, (conn[2],conn[3]))
425 p.add_2conn("Nr", idx3, (conn[2],conn[3]))
426 p.set_function(idx3, calc_Ia, v, idx1)
427
428 class Trans_L(Node):
429 def __init__(self, n=None, nw=3):
430 self.nw = nw
431 Node.__init__(self, "TL", n)
432 def add_count(self, tc, conn, param):
433 tc["X"] += 1
434 tc["V"] += self.nw + 2
435 def process(self, p, conn, param, alpha):
436 start = p.current_row("V") + 1
437 end = start + self.nw + 1
438 for i in range(self.nw):
439 s = "W%d" % (i+1)
440 idx = p.new_row("V", self, s)
441 p.add_S(idx, conn[2*i:], 1)
442 p.S[idx, end] += param["windings"][i]
443 idx = p.new_row("V", self, "phi")
444 p.S[idx, start:end-1] += np.array(param["windings"])
445 p.S[idx, end-1] += param["R"]
446 idx_v = p.new_row("V", self, "v")
447 p.S[idx_v, idx_v] += 1
448 p.S[idx_v, idx] += alpha
449 idx_xv = p.new_row("X", self, "v")
450 p.N["Xl"][idx_xv, idx] = alpha
451 p.N["Xr"][idx_xv, idx_v] = 1
452 p.Z[idx_xv] = 1
453
454 class Trans_F(Node):
455 def __init__(self, n=None, nw=3):
456 self.nw = nw
457 Node.__init__(self, "TF", n)
458 def add_count(self, tc, conn, param):
459 tc["X"] += 1
460 tc["V"] += self.nw + 2
461 tc["N"] += 1
462 def process(self, p, conn, param, alpha):
463 b, c = const = sp.symbols("b,c")
464 v0, = v = sp.symbols("v:1", seq=True)
465 calc_frohlich = -(c * v0) / (1 - b * abs(v0))
466 calc_frohlich = calc_frohlich.subs(dict([(k,param[str(k)]) for k in const]))
467 # def calc_frohlich(v):
468 # v = float(v[0])
469 # #b = 255.
470 # #c = 358.
471 # r = (c * v) / (1 - b * abs(v))
472 # return -r
473 start = p.current_row("V") + 1
474 end = start + self.nw + 1
475 for i in range(self.nw):
476 s = "W%d" % (i+1)
477 idx = p.new_row("V", self, s)
478 p.add_S(idx, conn[2*i:], 1)
479 p.S[idx, end] += param["windings"][i]
480 idx = p.new_row("V", self, "phi")
481 p.S[idx, start:end-1] += np.array(param["windings"])
482 idx_v = p.new_row("V", self, "v")
483 p.S[idx_v, idx_v] += 1
484 p.S[idx_v, idx] += alpha
485 idx_xv = p.new_row("X", self, "v")
486 p.N["Xl"][idx_xv, idx] = alpha
487 p.N["Xr"][idx_xv, idx_v] = 1
488 p.Z[idx_xv] = 1
489 idx = p.new_row("N", self, "phi")
490 p.N["Nl"][idx, end-1] = 1
491 p.N["Nr"][idx, end-1] = 1
492 p.set_function(idx, calc_frohlich, v, idx)
493
494 class Trans_GC(Node):
495 def __init__(self, n=None, nw=3):
496 self.nw = nw
497 Node.__init__(self, "TG", n)
498 def add_count(self, tc, conn, param):
499 tc["X"] += 1
500 tc["V"] += self.nw + 2
501 tc["N"] += 1
502 def process(self, p, conn, param, alpha):
503 windings = np.array(param["windings"], dtype=np.float64)
504 if self.nw == 1:
505 # avoid some convergence problems by scaling N to 1
506 wind = windings[0]
507 windings /= wind
508 param = dict(C = param["C"] * wind**2,
509 a = param["a"] * wind**(param["n"]-1),
510 o = param["o"] * wind**-1,
511 n = param["n"],
512 )
513 C, a, o, n = const = sp.symbols("C,a,o,n")
514 phi, = v = sp.symbols("phi", seq=True, real=True) # "real" needed to get derivative of sign()
515 t = phi / C
516 calc_gc_MMF = -(a * pow(abs(t), n) * sp.sign(t)) + o
517 calc_gc_MMF = calc_gc_MMF.subs(dict([(k,param[str(k)]) for k in const]))
518 # def calc_gc_MMF(v):
519 # v = float(v[0])
520 # #C = 2e-3
521 # #a = 1e-5
522 # #n = 25
523 # t = v / C
524 # if v >= 0:
525 # t2 = pow(t, n)
526 # else:
527 # t2 = -pow(-t, n)
528 # r = -(t + a * t2)
529 # return r
530 start = p.current_row("V") + 1
531 end = start + self.nw + 1
532 for i in range(self.nw):
533 s = "W%d" % (i+1)
534 idx = p.new_row("V", self, s)
535 p.add_S(idx, conn[2*i:], 1)
536 p.S[idx, end] += windings[i]
537 idx = p.new_row("V", self, "phi")
538 for i in range(self.nw):
539 p.S[idx, start+i] += windings[i]
540 p.S[idx, end-1] += 1 / param["C"]
541 idx_v = p.new_row("V", self, "v")
542 p.S[idx_v, idx_v] += 1
543 p.S[idx_v, idx] += alpha
544 idx_xv = p.new_row("X", self, "v")
545 p.N["Xl"][idx_xv, idx] = alpha
546 p.N["Xr"][idx_xv, idx_v] = 1
547 p.Z[idx_xv] = 1
548 idx = p.new_row("N", self, "phi")
549 p.N["Nl"][idx, end-1] = 1
550 p.N["Nr"][idx, end-1] = 1
551 p.set_function(idx, calc_gc_MMF, v, idx)
552
553 class V(Node):
554 def __init__(self, n=None):
555 Node.__init__(self, "V", n)
556 def add_count(self, tc, conn, param):
557 tc["V"] += 1
558 tc["C"] += 1
559 def process(self, p, conn, param, alpha):
560 idx = p.new_row("V", self)
561 p.S[idx, conn[0]] += 1
562 p.S[conn[0], idx] += 1
563 p.ConstVoltages[0,idx] += param
564
565 class OPA(Node):
566 def __init__(self, n=None):
567 Node.__init__(self, "OPA_L", n)
568 def add_count(self, tc, conn, param):
569 tc["V"] += 1
570 if isinstance(param, dict) and "Vcc" in param:
571 tc["N"] += 1
572 def process(self, p, conn, param, alpha):
573 idx_s = p.new_row("V", self)
574 p.S[idx_s, conn[2]] += 1
575 p.S[conn[2], idx_s] += 1
576 if isinstance(param, dict) and "Vcc" in param:
577 Vcc, Vee, A = const = sp.symbols("Vcc,Vee,A")
578 v0, = v = sp.symbols("v:1", seq=True)
579 a = 2*A/(Vcc-Vee)
580 calc = 0.5 * (sp.tanh(a*v0) * (Vcc-Vee) + Vcc + Vee)
581 calc = calc.subs(dict([(k,param[str(k)]) for k in const]))
582 idx = p.new_row("N", self)
583 p.add_conn("Nl", idx, conn[0], 1)
584 p.add_conn("Nl", idx, conn[1], -1)
585 p.add_conn("Nr", idx, idx_s, 1)
586 p.set_function(idx, calc, v, idx)
587 else:
588 if isinstance(param, dict):
589 param = param["A"]
590 p.S[idx_s, conn[0]] += param
591 p.S[idx_s, conn[1]] += -param
592
593 class CC_L(Node):
594 def __init__(self, n=None):
595 Node.__init__(self, "CC", n)
596 def add_count(self, tc, conn, param):
597 tc["V"] += 1
598 def process(self, p, conn, param, alpha):
599 idx = p.new_row("V", self)
600 p.S[conn[0], idx] += 1
601 p.S[conn[1], idx] -= 1
602 p.S[idx, conn[0]] += 1
603 p.S[idx, conn[1]] -= 1
604
605 class CC_N(Node):
606 def __init__(self, n=None):
607 Node.__init__(self, "CC", n)
608 def add_count(self, tc, conn, param):
609 tc["N"] += 1
610 def process(self, p, conn, param, alpha):
611 v0, = v = sp.symbols("v:1", seq=True)
612 calc = v0
613 idx = p.new_row("N", self)
614 p.add_2conn("Nl", idx, conn)
615 p.add_2conn("Nr", idx, conn)
616 p.set_function(idx, calc, v, idx)
617 p.CZ[idx] = 0
618
619 #CC = CC_L
620 CC = CC_N
0 v 20110115 2
1 C 40000 40000 0 0 0 title-B.sym
2 C 47800 47100 1 0 0 opamp-1.sym
3 {
4 T 48500 47900 5 10 0 0 0 0 1
5 device=OPAMP
6 T 48500 47800 5 10 1 1 0 0 1
7 refdes=O1
8 T 48500 48500 5 10 0 0 0 0 1
9 symversion=0.1
10 T 47800 47100 5 10 0 1 0 0 1
11 T 47800 47100 5 10 0 1 0 0 1
12 T 47800 47100 5 10 0 1 0 0 1
13 value=StdOP
14 }
15 C 46500 47200 1 0 0 resistor-2.sym
16 {
17 T 46900 47550 5 10 0 0 0 0 1
18 device=RESISTOR
19 T 46800 47000 5 10 1 1 0 0 1
20 refdes=R1
21 T 46500 47000 5 10 0 1 0 0 1
22 }
23 T 47900 46000 5 10 0 1 0 0 1
24 }
25 T 46800 47200 5 10 1 1 0 0 1
26 value=100
27 }
28 C 47900 46300 1 0 0 resistor-2.sym
29 {
30 T 48200 46100 5 10 1 1 0 0 1
31 refdes=R2
32 T 48200 46300 5 10 1 1 0 0 1
33 value=100
34 }
35 N 47400 47300 47800 47300 4
36 {
37 T 47500 47300 5 10 1 1 0 0 1
38 netname=V3
39 }
40 N 47800 46400 47800 47300 4
41 N 47800 46400 47900 46400 4
42 N 48800 46400 48800 47500 4
43 C 46200 47500 1 270 0 ground.sym
44 C 48500 47100 1 180 0 vdd-1.sym
45 C 48100 47900 1 0 0 vcc-1.sym
46 N 47800 47700 47500 47700 4
47 {
48 T 47600 47700 5 10 1 1 0 0 1
49 netname=V1
50 }
51 N 48800 47500 49300 47500 4
52 {
53 T 49000 47500 5 10 1 1 0 0 1
54 netname=V2
55 }
56 C 46700 47600 1 0 0 input-1.sym
57 {
58 T 46700 47900 5 10 0 0 0 0 1
59 device=INPUT
60 T 46400 47600 5 10 1 1 0 0 1
61 refdes=IN1
62 }
63 C 49300 47400 1 0 0 output-1.sym
64 {
65 T 49400 47700 5 10 0 0 0 0 1
66 device=OUTPUT
67 T 50100 47400 5 10 1 1 0 0 1
68 refdes=OUT1
69 }
70 T 46200 47300 8 10 0 1 0 0 1
71 netname=GND
72 T 44000 45000 8 10 0 1 0 0 1
73 netname=GND
74 T 48200 46300 8 10 1 1 0 0 1
75 value=100
0 v 20110115 2
1 C 40000 40000 0 0 0 title-B.sym
2 C 41700 44700 1 270 0 resistor-2.sym
3 {
4 T 42050 44300 5 10 0 0 270 0 1
5 device=RESISTOR
6 T 42000 44300 5 10 1 1 0 0 1
7 refdes=R1
8 T 42000 44000 5 10 1 1 0 0 1
9 value=1M
10 }
11 C 42700 45700 1 180 0 resistor-2.sym
12 {
13 T 42300 45350 5 10 0 0 180 0 1
14 device=RESISTOR
15 T 42216 45434 5 10 1 1 180 0 1
16 refdes=R2
17 T 42300 45300 5 10 1 1 0 0 1
18 value=68k
19 }
20 C 43700 44700 1 270 0 resistor-2.sym
21 {
22 T 44050 44300 5 10 0 0 270 0 1
23 device=RESISTOR
24 T 44000 44400 5 10 1 1 0 0 1
25 refdes=R3
26 T 44000 44200 5 10 1 1 0 0 1
27 value=2k7
28 }
29 C 43500 48200 1 270 0 resistor-2.sym
30 {
31 T 43850 47800 5 10 0 0 270 0 1
32 device=RESISTOR
33 T 43800 47800 5 10 1 1 0 0 1
34 refdes=R4
35 T 43800 47600 5 10 1 1 0 0 1
36 value=100k
37 }
38 C 47000 46800 1 0 0 resistor-2.sym
39 {
40 T 47400 47150 5 10 0 0 0 0 1
41 device=RESISTOR
42 T 47300 47100 5 10 1 1 0 0 1
43 refdes=R5
44 T 47300 46600 5 10 1 1 0 0 1
45 value=470k
46 }
47 C 50000 48200 1 270 0 resistor-2.sym
48 {
49 T 50350 47800 5 10 0 0 270 0 1
50 device=RESISTOR
51 T 50300 47800 5 10 1 1 0 0 1
52 refdes=R8
53 T 50300 47600 5 10 1 1 0 0 1
54 value=100k
55 }
56 C 50200 44700 1 270 0 resistor-2.sym
57 {
58 T 50550 44300 5 10 0 0 270 0 1
59 device=RESISTOR
60 T 49800 44300 5 10 1 1 0 0 1
61 refdes=R7
62 T 49800 44100 5 10 1 1 0 0 1
63 value=10k
64 }
65 C 53700 47000 1 180 0 resistor-2.sym
66 {
67 T 53300 46650 5 10 0 0 180 0 1
68 device=RESISTOR
69 T 53400 47200 5 10 1 1 180 0 1
70 refdes=R9
71 T 53100 46600 5 10 1 1 0 0 1
72 value=470k
73 }
74 C 53600 44700 1 270 0 resistor-2.sym
75 {
76 T 53950 44300 5 10 0 0 270 0 1
77 device=RESISTOR
78 T 53100 44300 5 10 1 1 0 0 1
79 refdes=R10
80 T 53100 44100 5 10 1 1 0 0 1
81 value=470k
82 }
83 C 55000 44700 1 270 0 resistor-2.sym
84 {
85 T 55350 44300 5 10 0 0 270 0 1
86 device=RESISTOR
87 T 54600 44300 5 10 1 1 0 0 1
88 refdes=R11
89 T 54600 44100 5 10 1 1 0 0 1
90 value=820
91 }
92 C 54800 48200 1 270 0 resistor-2.sym
93 {
94 T 55150 47800 5 10 0 0 270 0 1
95 device=RESISTOR
96 T 55100 47800 5 10 1 1 0 0 1
97 refdes=R12
98 T 55100 47600 5 10 1 1 0 0 1
99 value=100k
100 }
101 C 42700 46700 1 0 0 capacitor-1.sym
102 {
103 T 42900 47400 5 10 0 0 0 0 1
104 device=CAPACITOR
105 T 42900 47200 5 10 1 1 0 0 1
106 refdes=Cm1
107 T 42900 47600 5 10 0 0 0 0 1
108 symversion=0.1
109 T 43000 46500 5 10 1 1 0 0 1
110 value=2p
111 }
112 C 44600 44700 1 270 0 capacitor-1.sym
113 {
114 T 45300 44500 5 10 0 0 270 0 1
115 device=CAPACITOR
116 T 45100 44400 5 10 1 1 0 0 1
117 refdes=C1
118 T 45500 44500 5 10 0 0 270 0 1
119 symversion=0.1
120 T 45100 44200 5 10 1 1 0 0 1
121 value=680n
122 }
123 C 44600 46100 1 270 0 capacitor-1.sym
124 {
125 T 45300 45900 5 10 0 0 270 0 1
126 device=CAPACITOR
127 T 44900 45800 5 10 1 1 0 0 1
128 refdes=C2
129 T 45500 45900 5 10 0 0 270 0 1
130 symversion=0.1
131 T 44900 45400 5 10 1 1 0 0 1
132 value=100p
133 }
134 C 45900 46700 1 0 0 capacitor-1.sym
135 {
136 T 46100 47400 5 10 0 0 0 0 1
137 device=CAPACITOR
138 T 46200 47200 5 10 1 1 0 0 1
139 refdes=C3
140 T 46100 47600 5 10 0 0 0 0 1
141 symversion=0.1
142 T 46200 46500 5 10 1 1 0 0 1
143 value=22n
144 }
145 C 47000 47400 1 0 0 capacitor-1.sym
146 {
147 T 47200 48100 5 10 0 0 0 0 1
148 device=CAPACITOR
149 T 47300 47900 5 10 1 1 0 0 1
150 refdes=C4
151 T 47200 48300 5 10 0 0 0 0 1
152 symversion=0.1
153 T 47600 47700 5 10 1 1 0 0 1
154 value=470p
155 }
156 C 48100 46700 1 0 0 capacitor-1.sym
157 {
158 T 48300 47400 5 10 0 0 0 0 1
159 device=CAPACITOR
160 T 48400 47200 5 10 1 1 0 0 1
161 refdes=C5
162 T 48300 47600 5 10 0 0 0 0 1
163 symversion=0.1
164 T 48400 46500 5 10 1 1 0 0 1
165 value=1n
166 }
167 C 49200 46700 1 0 0 capacitor-1.sym
168 {
169 T 49400 47400 5 10 0 0 0 0 1
170 device=CAPACITOR
171 T 49400 47200 5 10 1 1 0 0 1
172 refdes=Cm2
173 T 49400 47600 5 10 0 0 0 0 1
174 symversion=0.1
175 T 49500 46500 5 10 1 1 0 0 1
176 value=2p
177 }
178 C 51900 46700 1 0 0 capacitor-1.sym
179 {
180 T 52100 47400 5 10 0 0 0 0 1
181 device=CAPACITOR
182 T 52200 47200 5 10 1 1 0 0 1
183 refdes=C6
184 T 52100 47600 5 10 0 0 0 0 1
185 symversion=0.1
186 T 52200 46500 5 10 1 1 0 0 1
187 value=22n
188 }
189 C 52800 47400 1 0 0 capacitor-1.sym
190 {
191 T 53000 48100 5 10 0 0 0 0 1
192 device=CAPACITOR
193 T 53100 47900 5 10 1 1 0 0 1
194 refdes=C7
195 T 53000 48300 5 10 0 0 0 0 1
196 symversion=0.1
197 T 53400 47700 5 10 1 1 0 0 1
198 value=470p
199 }
200 C 54000 46700 1 0 0 capacitor-1.sym
201 {
202 T 54200 47400 5 10 0 0 0 0 1
203 device=CAPACITOR
204 T 54200 47200 5 10 1 1 0 0 1
205 refdes=Cm3
206 T 54200 47600 5 10 0 0 0 0 1
207 symversion=0.1
208 T 54300 46500 5 10 1 1 0 0 1
209 value=2p
210 }
211 C 41700 43100 1 0 0 gnd-1.sym
212 C 47800 43100 1 0 0 gnd-1.sym
213 C 50200 43100 1 0 0 gnd-1.sym
214 C 55000 43100 1 0 0 gnd-1.sym
215 C 53600 43100 1 0 0 gnd-1.sym
216 C 41200 43600 1 0 0 triode.sym
217 {
218 T 44000 46400 5 10 1 1 0 0 1
219 refdes=U1
220 T 43900 46100 5 10 1 1 0 0 1
221 value=12ax7
222 T 43600 45700 5 10 0 1 0 0 1
223 device=TRIODE
224 }
225 C 52500 43600 1 0 0 triode.sym
226 {
227 T 55400 46100 5 10 1 1 0 0 1
228 refdes=U3
229 T 55400 45800 5 10 1 1 0 0 1
230 value=12ax7
231 }
232 C 41000 45500 1 0 0 input-1.sym
233 {
234 T 41000 45800 5 10 0 0 0 0 1
235 device=INPUT
236 T 41127 45534 5 10 1 1 0 0 1
237 refdes=Vin
238 }
239 N 42700 46900 42700 45600 4
240 {
241 T 42500 46100 5 10 1 1 0 0 1
242 netname=2
243 }
244 N 42700 45600 42800 45600 4
245 N 41800 44700 41800 45600 4
246 {
247 T 41800 45300 5 10 1 1 0 0 1
248 netname=1
249 }
250 C 43700 43100 1 0 0 gnd-1.sym
251 N 44800 44700 43800 44700 4
252 {
253 T 44900 44800 5 10 1 1 0 0 1
254 netname=3
255 }
256 C 45000 46700 1 0 0 ccurrent.sym
257 {
258 T 45200 47200 5 10 1 1 0 0 1
259 refdes=CC1
260 T 45400 47000 5 10 0 1 0 0 1
261 device=CONNECTION_CURRENT
262 }
263 N 44800 46100 44800 46900 4
264 N 45000 46900 43600 46900 4
265 {
266 T 44700 47000 5 10 1 1 0 0 1
267 netname=4
268 }
269 C 43400 48400 1 0 0 generic-power-1.sym
270 {
271 T 43600 48600 5 10 0 1 0 0 1
272 device=POWER
273 T 43932 48649 5 10 1 1 0 0 1
274 value=385V
275 T 43409 48652 5 10 1 1 0 0 1
276 refdes=Vcc1
277 }
278 N 47000 47600 47000 46900 4
279 C 47700 43600 1 0 0 triode.sym
280 {
281 T 50600 46100 5 10 1 1 0 0 1
282 refdes=U2
283 T 50600 45800 5 10 1 1 0 0 1
284 value=12ax7
285 }
286 N 49200 46900 49200 45600 4
287 C 49900 48400 1 0 0 generic-power-1.sym
288 {
289 T 48100 48500 5 10 0 1 0 0 1
290 device=POWER
291 T 50434 48652 5 10 1 1 0 0 1
292 value=385V
293 T 49895 48648 5 10 1 1 0 0 1
294 refdes=Vcc2
295 }
296 C 50900 46700 1 0 0 ccurrent.sym
297 {
298 T 51100 47200 5 10 1 1 0 0 1
299 refdes=CC2
300 T 51300 47000 5 10 0 1 0 0 1
301 device=CONNECTION_CURRENT
302 }
303 N 50100 46400 50100 47300 4
304 N 50100 46900 50900 46900 4
305 {
306 T 50400 47000 5 10 1 1 0 0 1
307 netname=11
308 }
309 N 52800 46900 52800 47600 4
310 {
311 T 52500 47000 5 10 1 1 0 0 1
312 netname=14
313 }
314 N 53700 44700 53700 47600 4
315 {
316 T 53800 47000 5 10 1 1 0 0 1
317 netname=15
318 }
319 N 53700 45600 54100 45600 4
320 C 55500 46800 1 0 0 output-1.sym
321 {
322 T 55600 47100 5 10 0 0 0 0 1
323 device=OUTPUT
324 T 55789 46837 5 10 1 1 0 0 1
325 refdes=Vout
326 }
327 N 47900 46100 47900 47600 4
328 {
329 T 48000 47000 5 10 1 1 0 0 1
330 netname=8
331 }
332 C 44700 43100 1 0 0 gnd-1.sym
333 C 54700 48400 1 0 0 generic-power-1.sym
334 {
335 T 54900 48700 5 10 0 1 0 0 1
336 device=POWER
337 T 55293 48649 5 10 1 1 0 0 1
338 value=385V
339 T 54697 48649 5 10 1 1 0 0 1
340 refdes=Vcc3
341 }
342 N 54000 46900 53700 46900 4
343 N 51900 46900 51700 46900 4
344 {
345 T 51700 47000 5 10 1 1 0 0 1
346 netname=13
347 }
348 N 49200 46900 49000 46900 4
349 {
350 T 49000 47000 5 10 1 1 0 0 1
351 netname=9
352 }
353 N 41800 43400 41800 43800 4
354 N 43800 43400 43800 43800 4
355 N 44800 43400 44800 43800 4
356 N 47900 43400 47900 45200 4
357 N 50300 43400 50300 43800 4
358 N 53700 43400 53700 43800 4
359 N 55100 43400 55100 43800 4
360 N 43800 44700 43800 44900 4
361 N 44800 44700 44800 45200 4
362 N 50300 44700 50300 44900 4
363 {
364 T 50000 44800 5 10 1 1 0 0 1
365 netname=10
366 }
367 N 55100 44700 55100 44900 4
368 {
369 T 54800 44800 5 10 1 1 0 0 1
370 netname=16
371 }
372 N 43600 48400 43600 48200 4
373 {
374 T 43400 48300 5 10 1 1 0 0 1
375 netname=5
376 }
377 N 50100 48400 50100 48200 4
378 {
379 T 49800 48300 5 10 1 1 0 0 1
380 netname=12
381 }
382 N 54900 48400 54900 48200 4
383 {
384 T 54600 48300 5 10 1 1 0 0 1
385 netname=18
386 }
387 N 54900 46400 54900 47300 4
388 N 55500 46900 54900 46900 4
389 {
390 T 55200 47000 5 10 1 1 0 0 1
391 netname=17
392 }
393 N 43600 46400 43600 47300 4
394 N 47000 46900 46800 46900 4
395 {
396 T 46800 47000 5 10 1 1 0 0 1
397 netname=7
398 }
399 N 45900 46900 45800 46900 4
400 {
401 T 45800 47000 5 10 1 1 0 0 1
402 netname=6
403 }
404 N 48100 46900 47900 46900 4
405 C 47800 46100 1 270 0 resistor-variable-2.sym
406 {
407 T 47510 45702 5 10 1 1 0 0 1
408 refdes=R6
409 T 48700 45300 5 10 0 1 270 0 1
410 device=VARIABLE_RESISTOR
411 T 47500 45500 5 10 1 1 0 0 1
412 value=1M
413 }
414 N 48400 45600 49300 45600 4
0 #!/usr/bin/env python
1 # -*- coding: utf-8 -*-
2 #
3 # copied from https://github.com/avelino/quik
4 #
5 # copied license statement:
6 # -------------------------------------------------------------------------
7 # The MIT License (MIT)
8 #
9 # Copyright (c) 2013 Thiago Avelino
10 #
11 # Permission is hereby granted, free of charge, to any person obtaining a copy of
12 # this software and associated documentation files (the "Software"), to deal in
13 # the Software without restriction, including without limitation the rights to
14 # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
15 # the Software, and to permit persons to whom the Software is furnished to do so,
16 # subject to the following conditions:
17 #
18 # The above copyright notice and this permission notice shall be included in all
19 # copies or substantial portions of the Software.
20 #
21 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
23 # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
24 # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
25 # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
26 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 # -------------------------------------------------------------------------
28 #
29 # Changed:
30 # - replaced '#' character by '%' to make it work better with C++
31 #
32
33 import re, operator, os
34 try:
35 from StringIO import StringIO
36 except ImportError:
37 from io import StringIO
38 xrange = range
39
40
41 VERSION = (0, 2, 3)
42 VERSION_TAG = 'dev'
43
44 __version__ = ".".join(map(str, VERSION))
45 if VERSION_TAG:
46 __version__ = "{0}-{1}".format(
47 __version__, VERSION_TAG)
48
49
50 class Template:
51 def __init__(self, content):
52 self.content = content
53 self.root_element = None
54
55 def render(self, namespace, loader=None):
56 output = StoppableStream()
57 self.merge_to(namespace, output, loader)
58 return output.getvalue()
59
60 def ensure_compiled(self):
61 if not self.root_element:
62 self.root_element = TemplateBody(self.content)
63
64 def merge_to(self, namespace, fileobj, loader=None):
65 if loader is None:
66 loader = NullLoader()
67 self.ensure_compiled()
68 self.root_element.evaluate(fileobj, namespace, loader)
69
70
71 class TemplateError(Exception):
72 pass
73
74
75 class TemplateSyntaxError(TemplateError):
76 def __init__(self, element, expected):
77 self.element = element
78 self.text_understood = element.full_text()[:element.end]
79 self.line = 1 + self.text_understood.count('\n')
80 self.column = len(self.text_understood) - self.text_understood.rfind('\n')
81 got = element.next_text()
82 if len(got) > 40:
83 got = got[:36] + ' ...'
84 Exception.__init__(self, "line %d, column %d: expected %s in %s, got: %s ..." % (self.line, self.column, expected, self.element_name(), got))
85
86 def get_position_strings(self):
87 error_line_start = 1 + self.text_understood.rfind('\n')
88 if '\n' in self.element.next_text():
89 error_line_end = self.element.next_text().find('\n') + self.element.end
90 else:
91 error_line_end = len(self.element.full_text())
92 error_line = self.element.full_text()[error_line_start:error_line_end]
93 caret_pos = self.column
94 return [error_line, ' ' * (caret_pos - 1) + '^']
95
96 def element_name(self):
97 return re.sub('([A-Z])', lambda m: ' ' + m.group(1).lower(), self.element.__class__.__name__).strip()
98
99
100 class NullLoader:
101 def load_text(self, name):
102 raise TemplateError("no loader available for '%s'" % name)
103
104 def load_template(self, name):
105 raise self.load_text(name)
106
107
108 class FileLoader:
109 def __init__(self, basedir, debugging=False):
110 self.basedir = basedir
111 self.known_templates = {}
112 self.debugging = debugging
113 if debugging:
114 print("creating caching file loader with basedir: {0}".format(basedir))
115
116 def filename_of(self, name):
117 return os.path.join(self.basedir, name)
118
119 def load_text(self, name):
120 if self.debugging:
121 print("Loading text from {0} {1}".format(self.basedir, name))
122 f = open(self.filename_of(name))
123 try:
124 return f.read()
125 finally:
126 f.close()
127
128 def load_template(self, name):
129 if self.debugging:
130 print("Loading template... {0}".format(name))
131
132 mtime = os.path.getmtime(self.filename_of(name))
133 if self.known_templates.get(name, None):
134 template, prev_mtime = self.known_templates[name]
135 if mtime <= prev_mtime:
136 if self.debugging:
137 print("loading parsed template from cache")
138 return template
139 if self.debugging:
140 print("loading text from disk")
141 template = Template(self.load_text(name))
142 template.ensure_compiled()
143 self.known_templates[name] = (template, mtime)
144 return template
145
146
147 class StoppableStream(StringIO):
148 def __init__(self, buf=''):
149 self.stop = False
150 StringIO.__init__(self, buf)
151
152 def write(self, s):
153 if not self.stop:
154 StringIO.write(self, s)
155
156
157 WHITESPACE_TO_END_OF_LINE = re.compile(r'[ \t\r]*\n(.*)', re.S)
158
159 class NoMatch(Exception): pass
160
161
162 class LocalNamespace(dict):
163 def __init__(self, parent):
164 dict.__init__(self)
165 self.parent = parent
166
167 def __getitem__(self, key):
168 try: return dict.__getitem__(self, key)
169 except KeyError:
170 parent_value = self.parent[key]
171 self[key] = parent_value
172 return parent_value
173
174 def top(self):
175 if hasattr(self.parent, "top"):
176 return self.parent.top()
177 return self.parent
178
179 def __repr__(self):
180 return dict.__repr__(self) + '->' + repr(self.parent)
181
182
183 class _Element:
184 def __init__(self, text, start=0):
185 self._full_text = text
186 self.start = self.end = start
187 self.parse()
188
189 def next_text(self):
190 return self._full_text[self.end:]
191
192 def my_text(self):
193 return self._full_text[self.start:self.end]
194
195 def full_text(self):
196 return self._full_text
197
198 def syntax_error(self, expected):
199 return TemplateSyntaxError(self, expected)
200
201 def identity_match(self, pattern):
202 m = pattern.match(self._full_text, self.end)
203 if not m: raise NoMatch()
204 self.end = m.start(pattern.groups)
205 return m.groups()[:-1]
206
207 def next_match(self, pattern):
208 m = pattern.match(self._full_text, self.end)
209 if not m: return False
210 self.end = m.start(pattern.groups)
211 return m.groups()[:-1]
212
213 def optional_match(self, pattern):
214 m = pattern.match(self._full_text, self.end)
215 if not m: return False
216 self.end = m.start(pattern.groups)
217 return True
218
219 def require_match(self, pattern, expected):
220 m = pattern.match(self._full_text, self.end)
221 if not m: raise self.syntax_error(expected)
222 self.end = m.start(pattern.groups)
223 return m.groups()[:-1]
224
225 def next_element(self, element_spec):
226 if callable(element_spec):
227 element = element_spec(self._full_text, self.end)
228 self.end = element.end
229 return element
230 else:
231 for element_class in element_spec:
232 try: element = element_class(self._full_text, self.end)
233 except NoMatch: pass
234 else:
235 self.end = element.end
236 return element
237 raise NoMatch()
238
239 def require_next_element(self, element_spec, expected):
240 if callable(element_spec):
241 try: element = element_spec(self._full_text, self.end)
242 except NoMatch: raise self.syntax_error(expected)
243 else:
244 self.end = element.end
245 return element
246 else:
247 for element_class in element_spec:
248 try: element = element_class(self._full_text, self.end)
249 except NoMatch: pass
250 else:
251 self.end = element.end
252 return element
253 expected = ', '.join([cls.__name__ for cls in element_spec])
254 raise self.syntax_error('one of: ' + expected)
255
256
257 class Text(_Element):
258 PLAIN = re.compile(r'((?:[^\\\@%]+|\\[\@%])+|\@[^!\{a-z0-9_]|\@@|%@|%[^\{\}a-zA-Z0-9%\*]+|\\.)(.*)$', re.S + re.I)
259 ESCAPED_CHAR = re.compile(r'\\([\\\@%])')
260
261 def parse(self):
262 text, = self.identity_match(self.PLAIN)
263 def unescape(match):
264 return match.group(1)
265 self.text = self.ESCAPED_CHAR.sub(unescape, text)
266
267 def evaluate(self, stream, namespace, loader):
268 stream.write(self.text)
269
270
271 class FallthroughHashText(_Element):
272 """ Plain tex, starting a hash, but which wouldn't be matched
273 by a directive or a macro earlier.
274 The canonical example is an HTML color spec.
275 Another good example, is in-document hypertext links
276 (or the dummy versions thereof often used a href targets
277 when javascript is used.
278 Note that it MUST NOT match block-ending directives. """
279 # because of earlier elements, this will always start with a hash
280 PLAIN = re.compile(r'(\%+\{?[\d\w]*\}?)(.*)$', re.S)
281
282 def parse(self):
283 self.text, = self.identity_match(self.PLAIN)
284 if self.text.startswith('%end') or self.text.startswith('%{end}') or self.text.startswith('%else') or self.text.startswith('%{else}') or self.text.startswith('%elseif') or self.text.startswith('%{elseif}'):
285 raise NoMatch
286
287 def evaluate(self, stream, namespace, loader):
288 stream.write(self.text)
289
290
291 class IntegerLiteral(_Element):
292 INTEGER = re.compile(r'(-?\d+)(.*)', re.S)
293
294 def parse(self):
295 self.value, = self.identity_match(self.INTEGER)
296 self.value = int(self.value)
297
298 def calculate(self, namespace, loader):
299 return self.value
300
301
302 class FloatingPointLiteral(_Element):
303 FLOAT = re.compile(r'(-?\d+\.\d+)(.*)', re.S)
304
305 def parse(self):
306 self.value, = self.identity_match(self.FLOAT)
307 self.value = float(self.value)
308
309 def calculate(self, namespace, loader):
310 return self.value
311
312
313 class BooleanLiteral(_Element):
314 BOOLEAN = re.compile(r'((?:true)|(?:false))(.*)', re.S | re.I)
315
316 def parse(self):
317 self.value, = self.identity_match(self.BOOLEAN)
318 self.value = self.value.lower() == 'true'
319
320 def calculate(self, namespace, loader):
321 return self.value
322
323
324 class StringLiteral(_Element):
325 STRING = re.compile(r"'((?:\\['nrbt\\\\\\@]|[^'\\])*)'(.*)", re.S)
326 ESCAPED_CHAR = re.compile(r"\\([nrbt'\\])")
327
328 def parse(self):
329 value, = self.identity_match(self.STRING)
330 def unescape(match):
331 return {'n': '\n', 'r': '\r', 'b': '\b', 't': '\t', '"': '"', '\\': '\\', "'": "'"}.get(match.group(1), '\\' + match.group(1))
332 self.value = self.ESCAPED_CHAR.sub(unescape, value)
333
334 def calculate(self, namespace, loader):
335 return self.value
336
337 class InterpolatedStringLiteral(StringLiteral):
338 STRING = re.compile(r'"((?:\\["nrbt\\\\\\@]|[^"\\])*)"(.*)', re.S)
339 ESCAPED_CHAR = re.compile(r'\\([nrbt"\\])')
340
341 def parse(self):
342 StringLiteral.parse(self)
343 self.block = Block(self.value, 0)
344
345 def calculate(self, namespace, loader):
346 output = StoppableStream()
347 self.block.evaluate(output, namespace, loader)
348 return output.getvalue()
349
350
351 class Range(_Element):
352 MIDDLE = re.compile(r'([ \t]*\.\.[ \t]*)(.*)$', re.S)
353
354 def parse(self):
355 self.value1 = self.next_element((FormalReference, IntegerLiteral))
356 self.identity_match(self.MIDDLE)
357 self.value2 = self.next_element((FormalReference, IntegerLiteral))
358
359 def calculate(self, namespace, loader):
360 value1 = self.value1.calculate(namespace, loader)
361 value2 = self.value2.calculate(namespace, loader)
362 if value2 < value1:
363 return xrange(value1, value2 - 1, -1)
364 return xrange(value1, value2 + 1)
365
366
367 class ValueList(_Element):
368 COMMA = re.compile(r'\s*,\s*(.*)$', re.S)
369
370 def parse(self):
371 self.values = []
372 try: value = self.next_element(Value)
373 except NoMatch:
374 pass
375 else:
376 self.values.append(value)
377 while self.optional_match(self.COMMA):
378 value = self.require_next_element(Value, 'value')
379 self.values.append(value)
380
381 def calculate(self, namespace, loader):
382 return [value.calculate(namespace, loader) for value in self.values]
383
384
385 class _EmptyValues:
386 def calculate(self, namespace, loader):
387 return []
388
389
390 class ArrayLiteral(_Element):
391 START = re.compile(r'\[[ \t]*(.*)$', re.S)
392 END = re.compile(r'[ \t]*\](.*)$', re.S)
393 values = _EmptyValues()
394
395 def parse(self):
396 self.identity_match(self.START)
397 try:
398 self.values = self.next_element((Range, ValueList))
399 except NoMatch:
400 pass
401 self.require_match(self.END, ']')
402 self.calculate = self.values.calculate
403
404 class DictionaryLiteral(_Element):
405 START = re.compile(r'{[ \t]*(.*)$', re.S)
406 END = re.compile(r'[ \t]*}(.*)$', re.S)
407 KEYVALSEP = re.compile(r'[ \t]*:[[ \t]*(.*)$', re.S)
408 PAIRSEP = re.compile(r'[ \t]*,[ \t]*(.*)$', re.S)
409
410 def parse(self):
411 self.identity_match(self.START)
412 self.local_data = {}
413 if self.optional_match(self.END):
414 # it's an empty dictionary
415 return
416 while(True):
417 key = self.next_element(Value)
418 self.require_match(self.KEYVALSEP, ':')
419 value = self.next_element(Value)
420 self.local_data[key] = value
421 if not self.optional_match(self.PAIRSEP): break
422 self.require_match(self.END, '}')
423
424 # Note that this delays calculation of values until it's used.
425 # TODO confirm that that's correct.
426 def calculate(self, namespace, loader):
427 tmp = {}
428 for (key,val) in self.local_data.items():
429 tmp[key.calculate(namespace, loader)] = val.calculate(namespace, loader)
430 return tmp
431
432
433 class Value(_Element):
434 def parse(self):
435 self.expression = self.next_element((FormalReference, FloatingPointLiteral, IntegerLiteral,
436 StringLiteral, InterpolatedStringLiteral, ArrayLiteral,
437 DictionaryLiteral, ParenthesizedExpression, UnaryOperatorValue,
438 BooleanLiteral))
439
440 def calculate(self, namespace, loader):
441 return self.expression.calculate(namespace, loader)
442
443
444 class NameOrCall(_Element):
445 NAME = re.compile(r'([a-zA-Z0-9_]+)(.*)$', re.S)
446 parameters = None
447
448 def parse(self):
449 self.name, = self.identity_match(self.NAME)
450 try: self.parameters = self.next_element(ParameterList)
451 except NoMatch: pass
452
453 def calculate(self, current_object, loader, top_namespace):
454 look_in_dict = True
455 if not isinstance(current_object, LocalNamespace):
456 try:
457 result = getattr(current_object, self.name)
458 look_in_dict = False
459 except AttributeError:
460 pass
461 if look_in_dict:
462 try: result = current_object[self.name]
463 except KeyError: result = None
464 except TypeError: result = None
465 except AttributeError: result = None
466 if result is None:
467 return None ## TODO: an explicit 'not found' exception?
468 if self.parameters is not None:
469 result = result(*self.parameters.calculate(top_namespace, loader))
470 return result
471
472
473 class SubExpression(_Element):
474 DOT = re.compile('\.(.*)', re.S)
475
476 def parse(self):
477 self.identity_match(self.DOT)
478 self.expression = self.next_element(VariableExpression)
479
480 def calculate(self, current_object, loader, global_namespace):
481 return self.expression.calculate(current_object, loader, global_namespace)
482
483
484 class VariableExpression(_Element):
485 subexpression = None
486
487 def parse(self):
488 self.part = self.next_element(NameOrCall)
489 try: self.subexpression = self.next_element(SubExpression)
490 except NoMatch: pass
491
492 def calculate(self, namespace, loader, global_namespace=None):
493 if global_namespace is None:
494 global_namespace = namespace
495 value = self.part.calculate(namespace, loader, global_namespace)
496 if self.subexpression:
497 value = self.subexpression.calculate(value, loader, global_namespace)
498 return value
499
500
501 class ParameterList(_Element):
502 START = re.compile(r'\(\s*(.*)$', re.S)
503 COMMA = re.compile(r'\s*,\s*(.*)$', re.S)
504 END = re.compile(r'\s*\)(.*)$', re.S)
505 values = _EmptyValues()
506
507 def parse(self):
508 self.identity_match(self.START)
509 try: self.values = self.next_element(ValueList)
510 except NoMatch: pass
511 self.require_match(self.END, ')')
512
513 def calculate(self, namespace, loader):
514 return self.values.calculate(namespace, loader)
515
516
517 class FormalReference(_Element):
518 START = re.compile(r'\@(!?)(\{?)(.*)$', re.S)
519 CLOSING_BRACE = re.compile(r'\}(.*)$', re.S)
520
521 def parse(self):
522 self.silent, braces = self.identity_match(self.START)
523 self.expression = self.require_next_element(VariableExpression, 'expression')
524 if braces: self.require_match(self.CLOSING_BRACE, '}')
525 self.calculate = self.expression.calculate
526
527 def evaluate(self, stream, namespace, loader):
528 value = self.expression.calculate(namespace, loader)
529 if value is None:
530 if self.silent: value = ''
531 else: value = self.my_text()
532
533 try:
534 basestring
535 def is_string(s):
536 return isinstance(s, basestring)
537 except NameError:
538 def is_string(s):
539 return type(s) == type('')
540
541 if is_string(value):
542 stream.write(value)
543 else:
544 stream.write(str(value))
545
546
547 class Null:
548 def evaluate(self, stream, namespace, loader): pass
549
550
551 class Comment(_Element, Null):
552 COMMENT = re.compile('%(?:%.*?(?:\n|$)|\*.*?\*%(?:[ \t]*\n)?)(.*)$', re.M + re.S)
553
554 def parse(self):
555 self.identity_match(self.COMMENT)
556
557
558 def boolean_value(variable_value):
559 if variable_value == False:
560 return False
561 return not (variable_value is None)
562
563
564 class BinaryOperator(_Element):
565
566 BINARY_OP = re.compile(r'\s*(>=|<=|<|==|!=|>|%|\|\||&&|or|and|\+|\-|\*|\/|\%)\s*(.*)$', re.S)
567 try:
568 operator.__gt__
569 except AttributeError:
570 operator.__gt__ = lambda a, b: a > b
571 operator.__lt__ = lambda a, b: a < b
572 operator.__ge__ = lambda a, b: a >= b
573 operator.__le__ = lambda a, b: a <= b
574 operator.__eq__ = lambda a, b: a == b
575 operator.__ne__ = lambda a, b: a != b
576 operator.mod = lambda a, b: a % b
577
578 OPERATORS = {
579 '>': operator.gt,
580 '>=': operator.ge,
581 '<': operator.lt,
582 '<=': operator.le,
583 '==': operator.eq,
584 '!=': operator.ne,
585 '%': operator.mod,
586 '||': lambda a,b : boolean_value(a) or boolean_value(b),
587 '&&': lambda a,b : boolean_value(a) and boolean_value(b),
588 'or': lambda a,b : boolean_value(a) or boolean_value(b),
589 'and': lambda a,b : boolean_value(a) and boolean_value(b),
590 '+' : operator.add,
591 '-' : operator.sub,
592 '/' : lambda a, b: a / b,
593 '*' : operator.mul}
594 PRECEDENCE = {
595 '>': 2,
596 '<': 2,
597 '==': 2,
598 '>=': 2,
599 '<=': 2,
600 '!=': 2,
601 '||': 1,
602 '&&': 1,
603 'or': 1,
604 'and': 1,
605 '+': 3,
606 '-': 3,
607 '*': 3,
608 '/': 3,
609 '%': 3}
610
611 def parse(self):
612 op_string, = self.identity_match(self.BINARY_OP)
613 self.apply_to = self.OPERATORS[op_string]
614 self.precedence = self.PRECEDENCE[op_string]
615
616 def greater_precedence_than(self, other):
617 return self.precedence > other.precedence
618
619
620 class UnaryOperatorValue(_Element):
621 UNARY_OP = re.compile(r'\s*(!)\s*(.*)$', re.S)
622 OPERATORS = {'!': operator.__not__}
623 def parse(self):
624 op_string, = self.identity_match(self.UNARY_OP)
625 self.value = self.next_element(Value)
626 self.op = self.OPERATORS[op_string]
627
628 def calculate(self, namespace, loader):
629 return self.op(self.value.calculate(namespace, loader))
630
631
632 class Expression(_Element):
633
634 def parse(self):
635 self.expression = [self.next_element(Value)]
636 while(True):
637 try:
638 binary_operator = self.next_element(BinaryOperator)
639 value = self.require_next_element(Value, 'value')
640 self.expression.append(binary_operator)
641 self.expression.append(value)
642 except NoMatch:
643 break
644
645 def calculate(self, namespace, loader):
646 if not self.expression or len(self.expression) == 0:
647 return False
648 #TODO: how does velocity deal with an empty condition expression?
649
650 opstack = []
651 valuestack = [self.expression[0]]
652 terms = self.expression[1:]
653
654 # use top of opstack on top 2 values of valuestack
655 def stack_calculate(ops, values, namespace, loader):
656 value2 = values.pop()
657 if isinstance(value2, Value):
658 value2 = value2.calculate(namespace, loader)
659 value1 = values.pop()
660 if isinstance(value1, Value):
661 value1 = value1.calculate(namespace, loader)
662 result = ops.pop().apply_to(value1, value2)
663 # TODO this doesn't short circuit -- does velocity?
664 # also note they're eval'd out of order
665 values.append(result)
666
667 while terms:
668 # next is a binary operator
669 if not opstack or terms[0].greater_precedence_than(opstack[-1]):
670 opstack.append(terms[0])
671 valuestack.append(terms[1])
672 terms = terms[2:]
673 else:
674 stack_calculate(opstack, valuestack, namespace, loader)
675
676 # now clean out the stacks
677 while opstack:
678 stack_calculate(opstack, valuestack, namespace, loader)
679
680 if len(valuestack) != 1:
681 print("evaluation of expression in Condition.calculate is messed up: final length of stack is not one")
682 #TODO handle this officially
683
684 result = valuestack[0]
685 if isinstance(result, Value):
686 result = result.calculate(namespace, loader)
687 return result
688
689
690 class ParenthesizedExpression(_Element):
691 START = re.compile(r'\(\s*(.*)$', re.S)
692 END = re.compile(r'\s*\)(.*)$', re.S)
693
694 def parse(self):
695 self.identity_match(self.START)
696 expression = self.next_element(Expression)
697 self.require_match(self.END, ')')
698 self.calculate = expression.calculate
699
700
701 class Condition(_Element):
702 def parse(self):
703 expression = self.next_element(ParenthesizedExpression)
704 self.optional_match(WHITESPACE_TO_END_OF_LINE)
705 self.calculate = expression.calculate
706 # TODO do I need to do anything else here?
707
708
709 class End(_Element):
710 END = re.compile(r'%(?:end|{end})(.*)', re.I + re.S)
711
712 def parse(self):
713 self.identity_match(self.END)
714 self.optional_match(WHITESPACE_TO_END_OF_LINE)
715
716
717 class ElseBlock(_Element):
718 START = re.compile(r'%(?:else|{else})(.*)$', re.S + re.I)
719
720 def parse(self):
721 self.identity_match(self.START)
722 self.block = self.require_next_element(Block, 'block')
723 self.evaluate = self.block.evaluate
724
725
726 class ElseifBlock(_Element):
727 START = re.compile(r'%elseif\b\s*(.*)$', re.S + re.I)
728
729 def parse(self):
730 self.identity_match(self.START)
731 self.condition = self.require_next_element(Condition, 'condition')
732 self.block = self.require_next_element(Block, 'block')
733 self.calculate = self.condition.calculate
734 self.evaluate = self.block.evaluate
735
736
737 class IfDirective(_Element):
738 START = re.compile(r'%if\b\s*(.*)$', re.S + re.I)
739 else_block = Null()
740
741 def parse(self):
742 self.identity_match(self.START)
743 self.condition = self.next_element(Condition)
744 self.block = self.require_next_element(Block, "block")
745 self.elseifs = []
746 while True:
747 try: self.elseifs.append(self.next_element(ElseifBlock))
748 except NoMatch: break
749 try: self.else_block = self.next_element(ElseBlock)
750 except NoMatch: pass
751 self.require_next_element(End, '%else, %elseif or %end')
752
753 def evaluate(self, stream, namespace, loader):
754 if self.condition.calculate(namespace, loader):
755 self.block.evaluate(stream, namespace, loader)
756 else:
757 for elseif in self.elseifs:
758 if elseif.calculate(namespace, loader):
759 elseif.evaluate(stream, namespace, loader)
760 return
761 self.else_block.evaluate(stream, namespace, loader)
762
763
764 class Assignment(_Element):
765 START = re.compile(r'\s*\@([a-z_][a-z0-9_]*(?:\.[a-z_][a-z0-9_]*)*)\s*=\s*(.*)$', re.S + re.I)
766 END = re.compile(r'\s*\:(?:[ \t]*\r?\n)?(.*)$', re.S + re.M)
767
768 def parse(self):
769 var_name, = self.identity_match(self.START)
770 self.terms = var_name.split('.')
771 self.value = self.require_next_element(Expression, "expression")
772 self.require_match(self.END, ')')
773
774 def evaluate(self, stream, namespace, loader):
775 thingy = namespace
776 for term in self.terms[0:-1]:
777 if thingy == None: return
778 look_in_dict = True
779 if not isinstance(thingy, LocalNamespace):
780 try:
781 thingy = getattr(thingy, term)
782 look_in_dict = False
783 except AttributeError:
784 pass
785 if look_in_dict:
786 try:
787 thingy = thingy[term]
788 except KeyError: thingy = None
789 except TypeError: thingy = None
790 except AttributeError: thingy = None
791 if thingy is not None:
792 thingy[self.terms[-1]] = self.value.calculate(namespace, loader)
793
794 class MacroDefinition(_Element):
795 START = re.compile(r'%macro\b(.*)', re.S + re.I)
796 OPEN_PAREN = re.compile(r'[ \t]\s*(.*)$', re.S)
797 NAME = re.compile(r'\s*([a-z][a-z_0-9]*)\b(.*)', re.S + re.I)
798 CLOSE_PAREN = re.compile(r'[ \t]*\:(.*)$', re.S)
799 ARG_NAME = re.compile(r'[, \t]+\@([a-z][a-z_0-9]*)(.*)$', re.S + re.I)
800 RESERVED_NAMES = ('if', 'else', 'elseif', 'set', 'macro',
801 'for', 'parse', 'include', 'stop', 'end')
802 def parse(self):
803 self.identity_match(self.START)
804 self.require_match(self.OPEN_PAREN, '(')
805 self.macro_name, = self.require_match(self.NAME, 'macro name')
806 if self.macro_name.lower() in self.RESERVED_NAMES:
807 raise self.syntax_error('non-reserved name')
808 self.arg_names = []
809 while True:
810 m = self.next_match(self.ARG_NAME)
811 if not m: break
812 self.arg_names.append(m[0])
813 self.require_match(self.CLOSE_PAREN, ') or arg name')
814 self.optional_match(WHITESPACE_TO_END_OF_LINE)
815 self.block = self.require_next_element(Block, 'block')
816 self.require_next_element(End, 'block')
817
818 def evaluate(self, stream, namespace, loader):
819 global_ns = namespace.top()
820 macro_key = '%' + self.macro_name.lower()
821 if global_ns.get(macro_key, None):
822 raise Exception("cannot redefine macro")
823 global_ns[macro_key] = self
824
825 def execute_macro(self, stream, namespace, arg_value_elements, loader):
826 if len(arg_value_elements) != len(self.arg_names):
827 raise Exception("expected %d arguments, got %d" % (len(self.arg_names), len(arg_value_elements)))
828 macro_namespace = LocalNamespace(namespace)
829 for arg_name, arg_value in zip(self.arg_names, arg_value_elements):
830 macro_namespace[arg_name] = arg_value.calculate(namespace, loader)
831 self.block.evaluate(stream, macro_namespace, loader)
832
833
834 class MacroCall(_Element):
835 START = re.compile(r'%([a-z][a-z_0-9]*)\b(.*)', re.S + re.I)
836 OPEN_PAREN = re.compile(r'[ \t]\s*(.*)$', re.S)
837 CLOSE_PAREN = re.compile(r'[ \t]*\:(.*)$', re.S)
838 SPACE_OR_COMMA = re.compile(r'[ \t]*(?:,|[ \t])[ \t]*(.*)$', re.S)
839
840 def parse(self):
841 macro_name, = self.identity_match(self.START)
842 self.macro_name = macro_name.lower()
843 self.args = []
844 if self.macro_name in MacroDefinition.RESERVED_NAMES or self.macro_name.startswith('end'):
845 raise NoMatch()
846 if not self.optional_match(self.OPEN_PAREN):
847 # It's not really a macro call,
848 # it's just a spare pound sign with text after it,
849 # the typical example being a color spec: "#ffffff"
850 # call it not-a-match and then let another thing catch it
851 raise NoMatch()
852 while True:
853 try: self.args.append(self.next_element(Value))
854 except NoMatch: break
855 if not self.optional_match(self.SPACE_OR_COMMA): break
856 self.require_match(self.CLOSE_PAREN, 'argument value or )')
857
858 def evaluate(self, stream, namespace, loader):
859 try: macro = namespace['%' + self.macro_name]
860 except KeyError: raise Exception('no such macro: ' + self.macro_name)
861 macro.execute_macro(stream, namespace, self.args, loader)
862
863
864 class IncludeDirective(_Element):
865 START = re.compile(r'%include\b(.*)', re.S + re.I)
866 OPEN_PAREN = re.compile(r'[ \t]*\(\s*(.*)$', re.S)
867 CLOSE_PAREN = re.compile(r'[ \t]*\)(.*)$', re.S)
868
869 def parse(self):
870 self.identity_match(self.START)
871 self.require_match(self.OPEN_PAREN, '(')
872 self.name = self.require_next_element((StringLiteral, InterpolatedStringLiteral, FormalReference), 'template name')
873 self.require_match(self.CLOSE_PAREN, ')')
874
875 def evaluate(self, stream, namespace, loader):
876 stream.write(loader.load_text(self.name.calculate(namespace, loader)))
877
878
879 class ParseDirective(_Element):
880 START = re.compile(r'%parse\b(.*)', re.S + re.I)
881 OPEN_PAREN = re.compile(r'[ \t]*\(\s*(.*)$', re.S)
882 CLOSE_PAREN = re.compile(r'[ \t]*\)(.*)$', re.S)
883
884 def parse(self):
885 self.identity_match(self.START)
886 self.require_match(self.OPEN_PAREN, '(')
887 self.name = self.require_next_element((StringLiteral, InterpolatedStringLiteral, FormalReference), 'template name')
888 self.require_match(self.CLOSE_PAREN, ')')
889
890 def evaluate(self, stream, namespace, loader):
891 template = loader.load_template(self.name.calculate(namespace, loader))
892 ## TODO: local namespace?
893 template.merge_to(namespace, stream, loader=loader)
894
895
896 class StopDirective(_Element):
897 STOP = re.compile(r'%stop\b(.*)', re.S + re.I)
898
899 def parse(self):
900 self.identity_match(self.STOP)
901
902 def evaluate(self, stream, namespace, loader):
903 if hasattr(stream, 'stop'):
904 stream.stop = True
905
906
907 # Represents a SINGLE user-defined directive
908 class UserDefinedDirective(_Element):
909 DIRECTIVES = []
910
911 def parse(self):
912 self.directive = self.next_element(self.DIRECTIVES)
913
914 def evaluate(self, stream, namespace, loader):
915 self.directive.evaluate(stream, namespace, loader)
916
917
918 class SetDirective(_Element):
919 START = re.compile(r'%set\b(.*)', re.S + re.I)
920
921 def parse(self):
922 self.identity_match(self.START)
923 self.assignment = self.require_next_element(Assignment, 'assignment')
924
925 def evaluate(self, stream, namespace, loader):
926 self.assignment.evaluate(stream, namespace, loader)
927
928
929 class ForDirective(_Element):
930 START = re.compile(r'%for\b(.*)$', re.S + re.I)
931 OPEN_PAREN = re.compile(r'[ \t]\s*(.*)$', re.S)
932 IN = re.compile(r'[ \t]+in[ \t]+(.*)$', re.S)
933 LOOP_VAR_NAME = re.compile(r'\@([a-z_][a-z0-9_]*)(.*)$', re.S + re.I)
934 CLOSE_PAREN = re.compile(r'[ \t]*\:(.*)$', re.S)
935
936 def parse(self):
937 ## Could be cleaner b/c syntax error if no '('
938 self.identity_match(self.START)
939 self.require_match(self.OPEN_PAREN, '(')
940 self.loop_var_name, = self.require_match(self.LOOP_VAR_NAME, 'loop var name')
941 self.require_match(self.IN, 'in')
942 self.value = self.next_element(Value)
943 self.require_match(self.CLOSE_PAREN, ')')
944 self.block = self.next_element(Block)
945 self.require_next_element(End, '%end')
946
947 def evaluate(self, stream, namespace, loader):
948 iterable = self.value.calculate(namespace, loader)
949 counter = 1
950 try:
951 if iterable is None:
952 return
953 if hasattr(iterable, 'keys'): iterable = iterable.keys()
954 try:
955 length = len(iterable)
956 except TypeError:
957 raise ValueError("value for @%s is not iterable in %%for: %s" % (self.loop_var_name, iterable))
958 for item in iterable:
959 namespace = LocalNamespace(namespace)
960 namespace['velocityCount'] = counter
961 namespace['velocityHasNext'] = counter < length
962 namespace[self.loop_var_name] = item
963 self.block.evaluate(stream, namespace, loader)
964 counter += 1
965 except TypeError:
966 raise
967
968
969 class TemplateBody(_Element):
970 def parse(self):
971 self.block = self.next_element(Block)
972 if self.next_text():
973 raise self.syntax_error('block element')
974
975 def evaluate(self, stream, namespace, loader):
976 namespace = LocalNamespace(namespace)
977 self.block.evaluate(stream, namespace, loader)
978
979
980 class Block(_Element):
981 def parse(self):
982 self.children = []
983 while True:
984 try: self.children.append(self.next_element((Text, FormalReference, Comment, IfDirective, SetDirective,
985 ForDirective, IncludeDirective, ParseDirective,
986 MacroDefinition, StopDirective, UserDefinedDirective,
987 MacroCall, FallthroughHashText)))
988 except NoMatch: break
989
990 def evaluate(self, stream, namespace, loader):
991 for child in self.children:
992 child.evaluate(stream, namespace, loader)
0 import sys; sys.path.append(".")
1 from models import *
2 from analog import *
3 from codelib import MatrixDefinition
4 import generate_code, re
5 from scipy.optimize import minimize, curve_fit
6 from scipy.signal import freqz
7
8 class Filter(object):
9
10 def __init__(self, fs):
11 self.fs = fs
12 self.calc_coeffs()
13
14 def freqz(self, R1, R5, C4, C5, P6v, w):
15 args = (R1, R5, C4, C5, P6v)
16 return freqz([v(*args) for v in self.b], [v(*args) for v in self.a], w)[1]
17
18 def calc_coeffs(self):
19 self.c = Circuit()
20 S = ((R(5), 7, 8),
21 (C(4), 7, 88),
22 (R(1), 88, 9),
23 (C(5), 8, 9),
24 (P(6), GND, 8, 9),
25 (IN, 7),
26 (OUT, 9),
27 )
28 R1, R5, C4, C5, P6v = sp.symbols("R1,R5,C4,C5,P6v")
29 V = {R(1): R1 * (1-P6v),
30 R(5): R5 * (1-P6v),
31 C(4): C4 * (1-P6v),
32 C(5): C5 * (1-P6v),
33 P(6): 1e6,
34 }
35 self.c.set_netlist(S, V)
36 self.c._ensure_filter(symbolic=False)
37 self.c.sim_filter.subst_var_default = dict(R1=1e4,R5=470e3,C4=470e-12,C5=1e-9,P6v=0.5)
38 b, a = self.c.sim_filter.get_z_coeffs(samplerate=self.fs)
39 args = (R1, R5, C4, C5, P6v)
40 self.b = [sp.lambdify(args, v) for v in b]
41 self.a = [sp.lambdify(args, v) for v in a]
42
43 def get_coeffs(self, R1, R5, C4, C5):
44 b, a = self.c.sim_filter.get_z_coeffs(as_expr=False)
45 l = []
46 for i, v in enumerate(b[0]+a[0]):
47 s = set()
48 for j, p in v:
49 p = p.subs(dict(R1=R1,R5=R5,C4=C4,C5=C5))
50 p = re.sub(r'([a-zA-Z0-9]+)\*\*(\d+)', r'pow(\1,\2)', str(p))
51 j = j[0]
52 l.append(' self.K%d(%d) = %s;' % (j, i, p))
53 s.add(j)
54 for j in sorted(set(range(max(s)+1))-s):
55 l.append(' self.K%d(%d) = 0.0;' % (j, i))
56 return l
57
58
59 class CompareFilter(object):
60
61 def __init__(self):
62 self.sig = Signal()
63 self.c = Circuit()
64 self.c.set_netlist(circ.Preamp_test.S, circ.Preamp_test.V)
65 self.c.linearize()
66 self.sr = self.sig(self.sig.sweep(), timespan=1)
67 self.fr = (50,20000)
68 self.f = numpy.logspace(numpy.log10(self.fr[0]), numpy.log10(self.fr[1]), 200)
69 self.flt = Filter(self.c.FS)
70 self.rg = np.logspace(0, -3, 6)
71 self.c.set_pot_variable('P6v', 1.0)
72 self.c.stream(self.sr)
73 self.base = self.c.last_signal.get_spectrum(
74 self.c.last_output, 2 * numpy.pi * self.f / self.c.FS)
75 self.base = 20 * numpy.log10(abs(self.base))
76
77 def get_coeffs(self, R1, R5, C4, C5):
78 return self.flt.get_coeffs(R1, R5, C4, C5)
79
80 def calc_highpass_f0(self, P6v, xdata, ydata):
81 omega = numpy.pi * xdata / 96000
82 p = [ 100e3, 470.e3, 470.e-12, 1.e-9]
83 def f(w, R1, R5, C4, C5):
84 return 20*numpy.log10(abs(self.flt.freqz(R1, R5, C4, C5, P6v, w)))
85 p, cov = curve_fit(f, omega, ydata, p)
86 return p
87
88 def calc_param(self, rg):
89 params = []
90 for i, p in enumerate(rg):
91 self.c.set_pot_variable('P6v', p)
92 self.c.sim_c(numpy.zeros((self.c.FS,1)))
93 self.c.stream(self.sr)
94 h = self.c.last_signal.get_spectrum(
95 self.c.last_output, 2 * numpy.pi * self.f / self.c.FS)
96 h = 20 * numpy.log10(abs(h)) - self.base
97 params.append(self.calc_highpass_f0(p, self.f, h))
98 return params
99
100 def plotcurves(self, param):
101 for i, p in enumerate(self.rg):
102 self.c.set_pot_variable('P6v', p)
103 self.c.sim_c(numpy.zeros((self.c.FS,1)))
104 lb = "%.1g" % p
105 self.c.stream(self.sr)
106 h = self.c.last_signal.get_spectrum(
107 self.c.last_output, 2 * numpy.pi * self.f / self.c.FS)
108 pylab.semilogx(self.f, 20*numpy.log10(abs(h))-self.base, label="c:"+lb)
109 h = self.flt.freqz(*param, P6v=p, w=numpy.pi*self.f/self.c.FS)
110 pylab.semilogx(self.f, 20*numpy.log10(abs(h)), label="f:"+lb)
111 pylab.xlim(*self.fr)
112 pylab.ylim(-60, 0)
113 pylab.grid(which="both")
114 pylab.legend(loc='lower right', ncol=2)
115 pylab.show()
116
117
118 def calc_shape_transform(fnum, resnum, minmax, c):
119 p0 = c.sim_py.p0.A1
120 argstart = fnum*2
121 if minmax[argstart+1,0] == minmax[argstart+1,1]:
122 return numpy.array([[0.,0.,0.],[0.,0.,0.],[1.,0.,1.]])
123 x = numpy.linspace(minmax[argstart,0], minmax[argstart,1], 200)
124 p1 = float(p0[argstart+1])
125 ap2 = numpy.linspace(minmax[argstart+1,0], minmax[argstart+1,1], 5)
126 m0 = [1,0,1]
127 r = numpy.zeros((len(ap2), 3))
128 a = numpy.zeros((len(x),2))
129 def f(x, p):
130 a[:,0] = x
131 a[:,1] = p
132 return c.sim_c.c_calc_comp[fnum](a)
133 for i, p2 in enumerate(ap2):
134 def func(m):
135 return numpy.sum(((m[0]*f(m[1]+m[2]*x,p1)) - f(x, p2)) ** 2)
136 meth = "Powell"
137 res = minimize(func, m0, method=meth)
138 r[i] = res.x
139 m0 = res.x
140 return numpy.polyfit(ap2, r, 2)
141
142 def shape_transform_matrices(c):
143 o = numpy.zeros((3, 3, 3))
144 o[0] = calc_shape_transform(0, 0, c.minmax, c)
145 o[1] = calc_shape_transform(1, 0, c.minmax, c)
146 o[2] = calc_shape_transform(2, 0, c.minmax, c)
147 l = []
148 for i in range(o.shape[2]):
149 for j in range(3):
150 sn = "S%sm%d" % (['p','s','a'][j], i)
151 l.append(MatrixDefinition(sn, array=True, value=o[:,j,i]))
152 return l
153
154 class CodeGenerator(generate_code.CodeGenerator):
155 def add_dict(self, d):
156 self.pot_attr = self.pot_attr + [("P6v", "Volume", 5, False, None)]
157 d = generate_code.CodeGenerator.add_dict(self, d)
158 fl = CompareFilter()
159 params = fl.calc_param(fl.rg[2:3])
160 l = ["self.X.setZero();",
161 "self.Y.setZero();",
162 "unsigned int fs = samplingFreq;"]
163 l.extend(fl.get_coeffs(*params[0]))
164 d.overwrite("filter_init", "\n ".join(l))
165 fields = ["Array<double, %d, 1> %s;" % r for r in
166 ((6,"K0"),(6,"K1"),(6,"K2"),(6,"K3"),(6,"K4"),(6,"K5"),(6,"Y"),(6,"X"))]
167 d.overwrite("DKPlugin_fields", "\n ".join(fields))
168 d.overwrite("add_npl", 1)
169 d.overwrite("DKPlugin_init", ", K0(), K1(), K2(), K3(), K4(), K5(), Y(), X()")
170 d.overwrite("process_add", """\
171 for (int j = 0; j < n; j++) {
172 self.pots_last[0] = 0.01 * t[0] + (1-0.01) * self.pots_last[0];
173 double P6v = self.pots_last[0];
174 Array<double, 6, 1> AB;
175 AB = (((((self.K5 * P6v + self.K4) * P6v + self.K3) * P6v + self.K2) * P6v + self.K1) * P6v + self.K0);
176 double out;
177 out = ((u[j] * AB(0) + self.X(0) * AB(1) + self.X(1) * AB(2)) - (self.Y(0) * AB(4) + self.Y(1) * AB(5))) / AB(3);
178 self.Y(1) = self.Y(0);
179 self.Y(0) = out;
180 self.X(1) = self.X(0);
181 self.X(0) = u[j];
182 o[j] = out;
183 }
184 u = o;
185 """)
186 return d
187
188 # hand-optimized, unused, maybe out of date:
189 cc_func_code = """
190 Array<creal, 2, 1> PP1;
191 PP1 << pt(1), pt(5);
192 Array<creal, 2, 1> PP0;
193 PP0 << pt(0), pt(4);
194 pt.head<2>() = (Spm1 * PP1 + Ssm1) * PP1 + Sam1 + ((Spm2 * PP1 + Ssm2) * PP1 + Sam2) * PP0;
195 Array<creal, 6, 1> res;
196 splinedata<unsigned short>::splev_pp<4>(&AmpData::nonlin_1::sd.sc[0], &pt(2), &res(2));
197 splinedata<unsigned short>::splev_pp<4>(&AmpData::nonlin_1::sd.sc[1], &pt(2), &res(3));
198
199 splinedata<unsigned short>::splev_pp<4>(&AmpData::nonlin_0::sd.sc[0], &pt(0), &res(0));
200 splinedata<unsigned short>::splev_pp<4>(&AmpData::nonlin_0::sd.sc[1], &pt(0), &res(4));
201
202 splinedata<unsigned short>::splev_pp<4>(&AmpData::nonlin_2::sd.sc[0], &pt(1), &res(1));
203 splinedata<unsigned short>::splev_pp<4>(&AmpData::nonlin_2::sd.sc[1], &pt(1), &res(5));
204
205 pt.head<2>() = ((Spm0 * PP1 + Ssm0) * PP1 + Sam0) * res.head<2>();
206 pt.tail<2>() = ((Spm0 * PP1 + Ssm0) * PP1 + Sam0) * res.tail<2>();
207
208 (*par.i).head<6>() << pt(0), pt(4), res(2), res(3), pt(1), pt(5), v[0], v[1];
209 """
210
211 def highpass_as_postfilter(f0, FS):
212 w0 = numpy.pi * f0 / FS
213 b0 = 1 / (1 + w0)
214 a1 = (1 - w0) * b0
215 return (
216 "{\n"
217 " static double y;\n"
218 " static double xm1;\n"
219 " y = %s * (buf[j] - xm1) + %s * y;\n"
220 " xm1 = buf[j];\n"
221 " buf[j] = y;\n"
222 " }\n"
223 % (b0, a1))
224
225 numpy.set_printoptions(linewidth=2000)
226 sig = Signal()
227 sr = sig(20*sig.sine(freq=150), timespan=1)
228 s = sig(0.15*sig.sine(freq=150), timespan=0.2)
229 c = Circuit(FS=96000)
230 mod_id = "JCM800Pre"
231 c.set_module_id(mod_id)
232 c.plugindef = dk_simulator.PluginDef(mod_id)
233 c.plugindef.name = "JCM 800 Preamp"
234 c.plugindef.shortname = "JCM800Pre"
235 c.plugindef.description = "Simulation of JCM 800 preamp circuit"
236 c.plugindef.category = "Distortion"
237 c.plugindef.namespace = "jcm800pre"
238 c.plugindef.lv2_plugin_type = "SimulatorPlugin"
239 c.build_script = sys.argv[0]
240 c.set_netlist(circ.Preamp_test.S, circ.Preamp_test.V)
241 c.backward_euler = True
242 c.transform_opts.partition = True
243 c.transform_opts.decompose = True
244 c.sys_reduce_tol = 1e-5
245 #c.add_element(R('cc1'), (6, GND), 1e12)
246 #c.add_element(R('cc2'), (13, GND), 1e12)
247 c.add_element(R(61), (8, 9), 0.2e6),
248 c.add_element(R(62), (9, GND), 0.8e6),
249 c.remove_element("P6")
250 c.remove_element("Cm1")
251 #c.remove_element("Cm2")
252 #c.remove_element("Cm3")
253 c.build_verbose = True
254 c.set_tempdir("gencode")
255 c.keep_tempdir()
256 c.set_solver(dict(method='hybr', factor=1e5))
257 if 1:
258 c.max_homotopy_iter = 10
259 c.solver_params = [
260 dict(method="hybr", factor=1e-1, max_homotopy_iter=10),
261 dict(method="hybr", factor=1e-2, max_homotopy_iter=10),
262 dict(method="hybr", factor=1e-1, max_homotopy_iter=10),
263 ]
264 c.basegrid = 6 * [ [[None, ('pp',4)], [None, None]], ] # with shape transform
265 c.stream(sig(0.0, samples=500))
266 c.calc_range(sr)
267 class CE(object):
268 def __init__(self, atol, rtol):
269 self.atol = atol
270 self.rtol = rtol
271 def __call__(self, f_intp, f_calc, f0):
272 return abs(f_intp - f_calc) > self.atol + self.rtol * abs(f_calc - f0)
273 c.E = [CE(2e-2, 5e-5), CE(1e-1, 5e-5), CE(1e-3, 5e-5),
274 CE(1e-2, 5e-5), CE(1e-1, 5e-5), CE(1e-3, 5e-5)]
275 c.max_homotopy_iter = 10
276 c.set_use(SIM_TABLE)
277 c._ensure_table_source()
278 x0 = np.array([ -101.11169547, -4.28127308, -514.34759921, -230.31382521,
279 -1133.65846006, -4.20085902, -20.3466745 ])
280 c.sim_py.x0 = x0
281 c.table_source["shape_transform"] = shape_transform_matrices(c)
282 c.set_solver(dict(factor=1e5, xtol=1e-1, maxfev=12))
283 c.post_filter = highpass_as_postfilter(20, c.FS)
284
285 c.code_generator = CodeGenerator
286 c.build_guitarix_module(include_paths=["../../../src/headers"])
287 #c.deploy()
0 import sys; sys.path.append(".")
1 from models import *
2 from analog import *
3 from scipy.optimize import curve_fit
4
5 def calc_highpass_f0(c1, c2):
6 sig = Signal()
7 s = c1.make_signal_vector(sig(0.01*sig.impulse(), timespan=1))
8 f0 = numpy.zeros(11)
9 fl = numpy.logspace(numpy.log10(s.start_freq), numpy.log10(s.stop_freq), 200)
10 w = 2 * numpy.pi * fl / s.fs
11 for i, hotpotz in enumerate(numpy.linspace(0, 1, 11)):
12 c1.set_pot_variable('hotpotz', hotpotz)
13 c1.stream(s)
14 h1 = s.get_spectrum(c1.last_output[:,0], w)
15
16 c2.set_pot_variable('hotpotz', hotpotz)
17 c2.stream(s)
18 h2 = s.get_spectrum(c2.last_output[:,0], w)
19
20 ydata = numpy.log(abs(h1/h2))
21 e = numpy.exp(-1j*w)
22 a1 = -1
23 def f(e, a1):
24 return numpy.log(abs((1-a1)/2 * (1 - e) / (1 + a1 * e)))
25 res = curve_fit(f, e, ydata, a1)
26
27 a1 = res[0][0]
28 f0[i] = s.fs*(1 + a1)/(numpy.pi*(1 - a1))
29 return numpy.mean(f0)
30
31 def highpass_as_prefilter(f0, FS):
32 w0 = numpy.pi * f0 / FS
33 b0 = 1 / (1 + w0)
34 a1 = (1 - w0) * b0
35 return (
36 "static DTP_U y; {\n"
37 " static double xm1;\n"
38 " y = %s * (GET_U[0] - xm1) + %s * y;\n"
39 " xm1 = GET_U[0];\n"
40 " }\n"
41 "#undef GET_U\n"
42 "#define GET_U (&y)\n"
43 % (b0, a1))
44
45 def build_module(FS, postfix, linear=False):
46 c1 = Circuit(FS=FS)
47 c1.build_script = sys.argv[0]
48 c1.set_tempdir("gencode")
49 c1.keep_tempdir()
50 mod_id = "GCB_95%s" % postfix
51 c1.set_module_id(mod_id)
52 c1.plugindef = dk_simulator.PluginDef(mod_id)
53 c1.plugindef.name = "GCB 95"
54 c1.plugindef.description = "Linear filter simulating the GCB 95 crybaby circuit"
55 c1.plugindef.category = "Guitar Effects"
56 c1.set_netlist(circ.WahWah_test.S, circ.WahWah_test.V)
57 c1.linearize(T(1), T(2), keep_dc=False)
58 c1.remove_element("C2")
59 c1.remove_element("R8")
60 c1.join_net("V6", GND)
61 c0 = Circuit(c1)
62 c1.remove_element("C1")
63 c1.join_net("V3", "V2")
64 f0 = calc_highpass_f0(c0, c1)
65 if linear:
66 c1.create_faust_module(pre_filter="dcblockerat(%s)" % f0)
67 else:
68 c1.sig.timespan = 0.2
69 #c1.grid_error_limit = 1e-1
70 c1.input_amplitude = 3
71 c1.pre_filter = highpass_as_prefilter(f0, c1.FS)
72 c1.set_use(SIM_TABLE)
73 c1.sim_c.set_variable("hotpotz", 1) # gives largest values for range calculation
74 c1.deploy(".")
75
76 if __name__ == "__main__":
77 set_log_level(INFO)
78 build_module(44100, "", linear=True)
79 build_module(44100, "_44")
80 build_module(48000, "_48")
0 from __future__ import division
1 import sympy, numpy, types, math
2 import dk_lib
3 import pylab, scipy.signal
4
5 class GeneratedSignal(object):
6
7 def __init__(self, func, op, fs, freq, start_freq, stop_freq):
8 self.op = op
9 self.fs = fs
10 self.freq = freq
11 self.start_freq = start_freq
12 self.stop_freq = stop_freq
13 self.generate_spectrum = False
14 self.generate_harmonics = False
15 self.make_spectrum = self._default_make_spectrum
16 m = [dict(sweep = self._sweep, chirp = self._chirp, impulse = self._impulse, time = self._time,
17 null=self._null, asin=numpy.arcsin, atan=numpy.arctan,
18 Min=numpy.minimum, Max=numpy.maximum, ramp=self._ramp), numpy]
19 self.signal = sympy.lambdify((), func, modules=m)()
20 if isinstance(self.signal, tuple):
21 self.signal = numpy.array(self.signal).T
22 else:
23 self.signal = self.signal[:,numpy.newaxis]
24 samples = len(self.signal)
25 if len(op) != self.signal.shape[1]:
26 raise ValueError(
27 "signal definition error: inconsistent channel count (%d vs. %d in OP definition)"
28 % (self.signal.shape[1], len(op)))
29 self.input_signal = self.signal + numpy.array(op, dtype=numpy.float64)
30 self.timeline = numpy.linspace(0, samples/fs, samples, endpoint=False)
31
32 def _sweep_make_spectrum(self, response, freqlist, shift=True):
33 return self._sweep_harmonics_responses(response, 1, freqlist, shift)[0]
34
35 @staticmethod
36 def _fft_convolve(h, xd):
37 n = len(h) + len(xd) - 1
38 np = dk_lib.pow2roundup(n)
39 if len(xd.shape) == 2 and len(h.shape) == 1:
40 h = h.reshape((len(h), 1))
41 s = numpy.fft.irfft(numpy.fft.rfft(h, np, axis=0) * numpy.fft.rfft(xd, np, axis=0), np, axis=0)
42 return s[:n]
43
44 def _sweep_harmonics_responses(self, response, N, freqlist, shift=True):
45 g = self.input_signal.ptp()/2
46 di = self._fft_convolve(self.sweep_inverse_signal, response/g) # deconvolved impulse response
47 imp_indices = numpy.zeros(N+1, dtype=int) # the indices of each impulse (1st linear, 2nd the first harm. dist. etc.)
48 imp_indices[0] = len(self.sweep_inverse_signal) - 1
49 for n in range(1, N+1):
50 imp_indices[n] = imp_indices[0] - int(round(math.log(n+1) * self.sweep_rate))
51 imps = []
52 for n in range(N):
53 dl = (imp_indices[n] - imp_indices[n+1]) // 2
54 lo = imp_indices[n] - dl # the low limit where to cut
55 hi = imp_indices[n] + dl # the high limit where to cut
56 di_w = di[lo:hi]
57 win = numpy.blackman(len(di_w))
58 if len(di.shape) == 2:
59 win = win.reshape((len(win), 1))
60 di_w *= win # smoothed version
61 w = freqlist
62 if shift:
63 w = w * (n + 1)
64 h = scipy.signal.freqz(di_w, worN=w)[1]
65 off = imp_indices[n] - lo
66 h *= numpy.exp(off * 1j * freqlist)
67 imps.append(h)
68 return imps
69
70 def _sweep(self, t, start, stop, pre, post, fs):
71 self.generate_spectrum = True
72 self.generate_harmonics = True
73 self.make_spectrum = self._sweep_make_spectrum
74 self.make_harmonics_responses = self._sweep_harmonics_responses
75 post = int(round(post * fs))
76 if pre < 0:
77 pre = int(round((len(t) - post) * 0.1))
78 if pre < 0:
79 pre = 0
80 else:
81 pre = int(round(pre * fs))
82 if post >= len(t) - pre:
83 post = int((len(t) - pre) * 0.1)
84 span = len(t) - (pre + post)
85 self.pre = pre
86 self.post = post
87 self.fs = fs
88 sig, self.sweep_inverse_signal, self.start, self.stop, self.sweep_rate = \
89 dk_lib.genlogsweep(start, stop, fs, pre, span, post)
90 return sig
91
92 def _chirp(self, t, start, stop, pre, post, fs):
93 self.generate_spectrum = True
94 self.generate_harmonics = True
95 self.make_spectrum = self._sweep_make_spectrum
96 self.make_harmonics_responses = self._sweep_harmonics_responses
97 post = int(round(post * fs))
98 if pre < 0:
99 pre = int(round((len(t) - post) * 0.1))
100 else:
101 pre = int(round(pre * fs))
102 span = len(t) - (pre + post)
103 self.pre = pre
104 self.post = post
105 self.fs = fs
106 sig, self.sweep_inverse_signal, self.start, self.stop, self.sweep_rate = \
107 dk_lib.expchirp(start, stop, fs, pre, span, post)
108 return sig
109
110 def _impulse_make_spectrum(self, response, freqlist):
111 g = self.input_signal.ptp()
112 return scipy.signal.freqz(response/g, worN=freqlist)[1]
113
114 def _impulse(self, t, offset):
115 self.generate_spectrum = True
116 self.make_spectrum = self._impulse_make_spectrum
117 a = numpy.zeros_like(t)
118 a[offset] = 1
119 return a
120
121 def _time(self, samples, fs):
122 return numpy.linspace(0, samples/fs, samples)
123
124 def _ramp(self, t, start, log):
125 if log:
126 if start < 0:
127 start = 0.001
128 return numpy.logspace(numpy.log10(start), 0, len(t))
129 else:
130 if start < 0:
131 start = 0
132 return numpy.linspace(start, 1, len(t))
133
134 def _null(self, s):
135 return 0*s
136
137 def _default_make_spectrum(self, response, freqlist):
138 n = dk_lib.pow2roundup(len(response))
139 return numpy.fft.rfft(response, n, axis=0)
140
141 def has_spectrum(self):
142 return self.generate_spectrum
143
144 def get_spectrum(self, response, freqlist, **kw):
145 return self.make_spectrum(response, freqlist, **kw)
146
147 def has_harmonics(self):
148 return self.generate_harmonics
149
150 def get_harmonics_responses(self, response, N, freqlist, shift=True):
151 return self.make_harmonics_responses(response, N, freqlist, shift)
152
153 def _plot_setup(self, lower_freq, upper_freq, plotfunc, freqlist):
154 if lower_freq is None:
155 lower_freq = self.start_freq
156 if upper_freq is None:
157 upper_freq = self.stop_freq
158 if plotfunc is None:
159 plotfunc = pylab.semilogx
160 if isinstance(freqlist, int):
161 freqlist = numpy.logspace(numpy.log10(lower_freq), numpy.log10(upper_freq), freqlist)
162 return lower_freq, upper_freq, plotfunc, freqlist
163
164 def plot_spectrum(self, response, lower_freq=None, upper_freq=None, plotfunc=None, freqlist=200):
165 lower_freq, upper_freq, plotfunc, freqlist = self._plot_setup(lower_freq, upper_freq, plotfunc, freqlist)
166 h = self.get_spectrum(response, 2 * numpy.pi * freqlist / self.fs)
167 return plotfunc(freqlist, 20 * numpy.log10(abs(h)))
168
169 def plot_harmonic_spectrum(self, response, nharmonics=6, lower_freq=None, upper_freq=None, plotfunc=None, freqlist=200):
170 lower_freq, upper_freq, plotfunc, freqlist = self._plot_setup(lower_freq, upper_freq, plotfunc, freqlist)
171 lines = []
172 for i, h in enumerate(self.get_harmonics_responses(response, nharmonics, 2*numpy.pi*freqlist/self.fs)):
173 if h.size:
174 lines.extend(plotfunc(freqlist, 20 * numpy.log10(abs(h))))
175 return lines
176
177 def plot(self, response, label=None, clip=-80, nharmonics=8, spectrum=None, freq_range=None):
178 if freq_range is not None:
179 lower_freq, upper_freq = freq_range
180 else:
181 lower_freq = upper_freq = None
182 if lower_freq is None:
183 lower_freq = self.start_freq
184 if upper_freq is None:
185 upper_freq = self.stop_freq
186 if self.has_harmonics() and nharmonics > 1 and (spectrum is None or spectrum):
187 lines = self.plot_harmonic_spectrum(response, nharmonics=nharmonics, lower_freq=lower_freq, upper_freq=upper_freq)
188 pylab.xlim(left=lower_freq, right=upper_freq)
189 for i, line in enumerate(lines):
190 if label:
191 line.set_label("%d, %s" % (i+1, label))
192 else:
193 line.set_label("%d" % (i+1))
194 return lines
195 elif (spectrum is None and self.has_spectrum()) or spectrum:
196 f = numpy.logspace(numpy.log10(lower_freq), numpy.log10(upper_freq), 200)
197 h = self.get_spectrum(response, 2*numpy.pi * f / self.fs)
198 s = 20*numpy.log10(abs(h))
199 lines = pylab.plot(f, numpy.where(s > clip, s, numpy.nan), label=label)
200 pylab.xscale('log')
201 return lines
202 else:
203 return pylab.plot(self.timeline, response, label=label)
204
205
206 class Signal(object):
207
208 _s_FS, _s_freq, _s_start_freq, _s_stop_freq, _s_sweep_pre, _s_sweep_post, _s_samples = sympy.symbols(
209 "FS, freq, start_freq, stop_freq, sweep_pre, sweep_post, samples")
210 _s_sweep, _s_chirp, _s_impulse, _s_time, _s_null, _s_ramp = sympy.symbols(
211 "sweep,chirp,impulse,time,null,ramp", cls=sympy.Function)
212 t = sympy.symbols("t")
213
214 def __init__(self, timespan=0.01):
215 self._freq = 440
216 self._start_freq = 20
217 self._stop_freq = 10000
218 self._timespan = timespan
219 self._sweep_pre = -1
220 self._sweep_post = 0.1
221 self.impulse_offset = 0
222
223 @property
224 def freq(self):
225 return self._freq
226 @freq.setter
227 def freq(self, v):
228 self._freq = v
229
230 @property
231 def start_freq(self):
232 return self._start_freq
233 @start_freq.setter
234 def start_freq(self, v):
235 self._start_freq = v
236
237 @property
238 def stop_freq(self):
239 return self._stop_freq
240 @stop_freq.setter
241 def stop_freq(self, v):
242 self._stop_freq = v
243
244 @property
245 def timespan(self):
246 return self._timespan
247 @timespan.setter
248 def timespan(self, v):
249 self._timespan = v
250
251 @property
252 def sweep_pre(self):
253 return self._sweep_pre
254 @sweep_pre.setter
255 def sweep_pre(self, v):
256 self._sweep_pre = v
257
258 @property
259 def sweep_post(self):
260 return self._sweep_post
261 @sweep_post.setter
262 def sweep_post(self, v):
263 self._sweep_post = v
264
265 def sine(self, freq=None):
266 if freq is None:
267 freq = self.freq
268 self.freq = freq
269 return sympy.sin(self.t * freq * 2 * sympy.pi)
270
271 def triangle(self, freq=None):
272 if freq is None:
273 freq = self.freq
274 return 2 / sympy.pi * sympy.asin(self.sine(freq))
275
276 def sawtooth(self, freq=None):
277 if freq is None:
278 freq = self.freq
279 return -2 / sympy.pi * sympy.atan(1/sympy.tan(sympy.pi * self.t))
280
281 def square(self, freq=None):
282 if freq is None:
283 freq = self.freq
284 return self.triangle(freq).diff()/(4*freq)
285
286 def sweep(self, start_freq=None, stop_freq=None, pre=None, post=None):
287 if start_freq is None:
288 start_freq = self._s_start_freq
289 if stop_freq is None:
290 stop_freq = self._s_stop_freq
291 if stop_freq is None:
292 stop_freq = self._s_stop_freq
293 if pre is None:
294 pre = self._s_sweep_pre
295 if post is None:
296 post = self._s_sweep_post
297 return self._s_sweep(self.t, start_freq, stop_freq, pre, post, self._s_FS)
298
299 def chirp(self, start_freq=None, stop_freq=None, pre=None, post=None):
300 if start_freq is None:
301 start_freq = self._s_start_freq
302 if stop_freq is None:
303 stop_freq = self._s_stop_freq
304 if stop_freq is None:
305 stop_freq = self._s_stop_freq
306 if pre is None:
307 pre = self._s_sweep_pre
308 if post is None:
309 post = self._s_sweep_post
310 return self._s_chirp(self.t, start_freq, stop_freq, pre, post, self._s_FS)
311
312 def ramp(self, start=-1, log=False):
313 return self._s_ramp(self.t, start, int(log))
314
315 def impulse(self):
316 return self._s_impulse(self.t, self.impulse_offset)
317
318 def generate(self, sig, fs, op=None, channels=None):
319 if op is None:
320 if channels is None:
321 op = [0]
322 else:
323 op = [0] * channels
324 d = {
325 self._s_FS: fs,
326 self._s_freq: self.freq,
327 self._s_start_freq: self.start_freq,
328 self._s_stop_freq: self.stop_freq,
329 self._s_sweep_pre: self.sweep_pre,
330 self._s_sweep_post: self.sweep_post,
331 }
332 return GeneratedSignal(self(sig).subs(d), op, fs, self.freq, self.start_freq, self.stop_freq)
333
334 def __call__(self, expr, samples=None, timespan=None, periods=None):
335 if isinstance(expr, types.FunctionType):
336 expr = expr()
337 if timespan is not None:
338 samples = self._s_FS * timespan
339 elif periods is not None:
340 samples = periods * self._s_FS / self._s_freq ##FIXME
341 elif samples is None:
342 samples = self._s_FS * self.timespan
343 if isinstance(expr, (int,float)) or not (self.t in expr.atoms() or expr.atoms(self._s_time)):
344 expr += self._s_null(self.t)
345 return expr.subs(self.t, self._s_time(samples, self._s_FS))
0 # -*- coding: utf-8 -*-
1 from __future__ import division
2
3 for pyname, package in (
4 ('scipy', 'python-scipy'),
5 ('sympy', 'python-sympy'),
6 ('pylab', 'python-matplotlib'),
7 ):
8 try:
9 __import__(pyname)
10 except ImportError:
11 raise SystemExit("Need module %s (Debian package: %s)" % (pyname, package))
12
13 import sys, itertools, fractions, os, argparse, math, logging
14 from cStringIO import StringIO
15 from scipy.interpolate import LSQUnivariateSpline
16 try:
17 from scipy.interpolate import PchipInterpolator
18 except ImportError:
19 print "pchip interpolation not available (scipy version too old)"
20 import pylab as pl
21 import numpy as np
22 from scipy.signal import correlate
23 from scipy.interpolate import splev
24 import dk_simulator, dk_lib, circ, models
25
26
27 class KnotData(object):
28
29 def __init__(self, knots, mapping, sl, order):
30 self.knots = knots
31 self.mapping = mapping
32 self.slice_data = sl
33 if order is None:
34 self.tp = None
35 self.order = None
36 self.bbox = None
37 else:
38 if isinstance(order, int):
39 self.tp = 's'
40 self.order = order
41 else:
42 self.tp = order[0]
43 self.order = order[1]
44 self.bbox = [self.knots[0], self.knots[-1]]
45
46 def cut_mapping(self):
47 m = self.mapping
48 i0, i1 = np.searchsorted(m, (m[0]+1, m[-1]))
49 i0 -= 1
50 i1 += 1
51 self.bbox[0] += i0 / self.inv_h()
52 self.bbox[1] -= (len(m) - i1) / self.inv_h()
53 self.mapping = m[i0:i1]
54
55 def used(self):
56 return self.order is not None
57
58 def inv_h(self):
59 sl = self.slice_data
60 return (sl.step.imag - 1) / (sl.stop - sl.start)
61
62 def count(self):
63 return len(self.mapping) + 1
64
65 def get_knots(self):
66 k = self.order
67 return self.knots[k:-k]
68
69 def get_knot_grid(self):
70 d = self.slice_data
71 k = self.order
72 if k is None:
73 return np.array(((d.start+d.stop)*0.5,))
74 else:
75 a = self.knots[k//2:-k//2].copy()
76 n = d.step.imag
77 if n == 1:
78 n = k
79 h = (d.stop - d.start) / (n - 1)
80 for i in range(k//2):
81 a[i] = d.start + i * h
82 a[-(i+1)] = d.stop - i * h
83 return a
84
85 def num_coeffs(self):
86 return len(self.knots) - self.order
87
88 def get_bbox(self):
89 return self.bbox
90
91 def get_order(self):
92 return self.order
93
94 class TensorSpline(object):
95
96 def __init__(self, func, ranges, basegrid):
97 self.func = func
98 self.ranges = ranges
99 self.basegrid = basegrid
100 self.knot_data = np.empty((len(basegrid), len(ranges)), dtype=object)
101 self.get_grid_estimate()
102 self.find_knots()
103 self.save_grid_estimate()
104
105 @staticmethod
106 def max_idx_to_maptype(max_idx):
107 if max_idx >= 2**16:
108 return "int"
109 elif max_idx >= 2**8:
110 return "unsigned short"
111 else:
112 return "unsigned char"
113
114 def grid_estimate_fname(self):
115 return "%s_grid.cache" % self.func.comp_id
116
117 def get_grid_estimate(self):
118 try:
119 self.grid_estimate = pickle.load(open(self.grid_estimate_fname()))
120 except (IOError, EOFError):
121 self.grid_estimate = np.empty((len(self.basegrid), len(self.ranges)), dtype=object)
122 for v, g in enumerate(self.basegrid):
123 self.grid_estimate[v][:] = [np.mgrid[slice(r[0], r[1], 0.5j * t[0])] for r, t in zip(self.ranges,g[0])]
124
125 def save_grid_estimate(self):
126 with open(self.grid_estimate_fname(),"w") as f:
127 pickle.dump(self.grid_estimate, f)
128
129 @staticmethod
130 def insert_points(a, n, kd):
131 o = []
132 for x, k in zip(a, kd):
133 if k.tp == 'h':
134 o.append(x)
135 continue
136 i = len(x)
137 b = np.zeros(i + n * (i - 1))
138 b[::n+1] = x
139 for j in range(n):
140 w = (j+1) / (n+1)
141 b[j+1::n+1] = x[:-1] * w + x[1:] * (1-w)
142 o.append(b)
143 return o
144
145 def calc_coeffs(self):
146 coeff = []
147 for v, (g, kdata) in enumerate(zip(self.basegrid, self.knot_data)):
148 coords = []
149 for kd in kdata:
150 if kd.used():
151 if kd.tp in ('s', 'pp'):
152 k = kd.get_order()
153 x = kd.knots.copy()
154 x[:k] = np.linspace(x[0], x[k], k, False)
155 x[-k:] = np.linspace(x[-(k+1)], x[-1], k, False)
156 else:
157 assert kd.tp == 'h'
158 k = kd.get_order() - 1
159 x = kd.knots[k:-k]
160 else:
161 x = kd.get_knot_grid()
162 coords.append(x)
163 add_num_points = 0
164 coords = self.insert_points(coords, add_num_points, self.knot_data[v])
165 fnc = self.calc_grid(self.make_grid(coords), g[1], g[2])[v]
166 for n in range(len(self.ranges)):
167 kd = self.knot_data[v,n]
168 if not kd.used():
169 continue
170 s = list(fnc.shape)
171 if kd.tp == 'h':
172 s[n] = 4 * (len(coords[n]) - 1)
173 else:
174 s[n] = kd.num_coeffs()
175 out = np.empty(s)
176 s[n] = 1
177 x = coords[n]
178 kn = kd.get_knots()
179 bb = kd.get_bbox()
180 k = kd.get_order() - 1
181 for i in np.ndindex(tuple(s)):
182 i = list(i)
183 i[n] = slice(None)
184 if kd.tp in ('s', 'pp'):
185 ss = LSQUnivariateSpline(x, fnc[i], kn, bbox=bb, k=k)
186 out[i] = ss.get_coeffs()
187 else:
188 ss = PchipInterpolator(x, fnc[i])
189 def mklist(kr):
190 c = kr.c[:,0]
191 return [c[3], c[2]-c[3]*(kr.xi[-1]-kr.xi[0]), c[1], c[0]]
192 out[i] = np.array([mklist(kr) for kr in ss.polynomials]).flat
193 fnc = out
194 coeff.append(fnc)
195 return coeff
196
197 @staticmethod
198 def get_interpolating_knots(x, k):
199 x_e = x[-1]
200 x_e += (x_e - x[-2]) * 0.1
201 start = k // 2
202 end = -(k - start)
203 knots = np.zeros((3,len(x)-k))
204 knots[0] = x[start:end]
205 knots[1] = np.arange(start, len(x)+end)
206 if k % 2:
207 knots[0,:-1] += knots[0,1:]
208 knots[0,-1] += x[end]
209 knots[0] *= 0.5
210 return knots, (x[0], x_e)
211
212 @staticmethod
213 def spline_diff(n, x, kn, bbox, k, fnc):
214 s = list(fnc.shape)
215 s[n] = 1
216 out = np.empty_like(fnc)
217 for idx in np.ndindex(tuple(s)):
218 idx = list(idx)
219 idx[n] = slice(None)
220 f = fnc[idx]
221 ss = LSQUnivariateSpline(x, f, kn, bbox=bbox, k=k-1)
222 out[idx] = abs(ss(x) - f)
223 return out
224
225 @staticmethod
226 def max_df(n, x, kn, bbox, k, fnc):
227 s = list(fnc.shape)
228 s[n] = 1
229 mx = 0
230 for idx in np.ndindex(tuple(s)):
231 idx = list(idx)
232 idx[n] = slice(None)
233 f = fnc[idx]
234 ss = LSQUnivariateSpline(x, f, kn, bbox=bbox, k=k-1)
235 mx = max(mx, np.amax(abs(ss(x) - f)))
236 return mx #/ np.ptp(fnc)
237
238 def make_grid(self, coords, sparse=False):
239 if len(coords) == 1:
240 r = coords[0]
241 res = np.empty((1, r.shape[0]))
242 res[0] = r
243 else:
244 r = np.meshgrid(*coords, indexing="ij", sparse=sparse)
245 res = np.empty((len(coords),)+r[0].shape)
246 res[:] = r
247 return res
248
249 def calc_grid(self, grd, pre, post):
250 if post:
251 pre_grd = grd.copy()
252 if pre:
253 grd = pre(grd)
254 grd_shape = grd.shape
255 numpoints = np.product(grd_shape[1:])
256 grd = grd.reshape(grd_shape[0], numpoints)
257 fnc = self.func(grd.T, True).T
258 fnc = fnc.reshape(fnc.shape[:1]+tuple(grd_shape[1:]))
259 if post:
260 fnc = post(pre_grd, fnc)
261 return fnc
262
263 @staticmethod
264 def max_diff(n, kn, pos, val):
265 ki = np.unique(np.digitize(pos, kn), True)[1]
266 idx = [slice(None)]*val.ndim
267 l = []
268 for i, j in itertools.izip_longest(ki, ki[1:]):
269 idx[n] = slice(i, j)
270 l.append(np.amax(val[idx]))
271 a = np.array(l)
272 return a[1:] + a[:-1]
273
274 @staticmethod
275 def mk_result(kn, bbox, k, r):
276 idx = np.zeros(len(kn[1])+2, dtype=np.int32)
277 idx[1:-1] = kn[1]
278 idx[-1] = r.step.imag
279 f = reduce(fractions.gcd, idx)
280 idx /= f
281 a = np.empty(idx[-1], dtype=np.int32)
282 for m, (i, j) in enumerate(itertools.izip_longest(idx[:-1], idx[1:])):
283 a[i:j] = m
284 a += k-1
285 return KnotData(np.pad(kn[0], k, 'constant', constant_values=bbox), a, slice(r.start, r.stop, r.step/f), k)
286
287 def get_support(self, i, fnc, dlim):
288 def apply_subcube(op, a, axis):
289 j = a.shape[axis]
290 return op(np.rollaxis(a, axis, 1).reshape(j, a.size/j), axis=1)
291 dfnc = np.diff(fnc, 1, axis=i)
292 supp1 = apply_subcube(np.amax, abs(dfnc), i) >= dlim
293 nz1 = np.flatnonzero(supp1)
294 d2fnc = np.diff(dfnc, 1, axis=i)
295 d2lim = 1e-7
296 supp2 = apply_subcube(np.amax, abs(d2fnc), i) >= d2lim
297 nz2 = np.flatnonzero(supp2)
298 istart, iend, llim, rlim = None, None, None, None
299 if len(nz1):
300 istart = nz1[0]
301 iend = nz1[-1]
302 if len(nz2):
303 istart = min(istart, nz2[0])
304 iend = max(iend, nz2[-1])
305 if istart < 2:
306 istart = None
307 if iend > d2fnc.shape[i]-1:
308 iend = None
309 if istart:
310 istart -= 1
311 if np.amax(apply_subcube(np.amax, abs(dfnc), i)[:istart]) < dlim:
312 llim = 0
313 else:
314 llim = (np.amin(apply_subcube(np.amin, dfnc, i)[:istart]), np.amax(apply_subcube(np.amax, dfnc, i)[:istart]))
315 if iend:
316 iend += 1
317 if np.amax(apply_subcube(np.amax, abs(dfnc), i)[iend:]) < dlim:
318 rlim = 0
319 else:
320 rlim = (np.amin(apply_subcube(np.amin, dfnc, i)[:iend]), np.amax(apply_subcube(np.amax, dfnc, i)[:iend]))
321 print apply_subcube(np.amax, abs(dfnc), i)[iend:]; print iend, dlim; raise SystemExit
322 print "##", dlim, (istart, iend), (llim, rlim)
323 return (istart, iend), (llim, rlim)
324
325 def find_knots(self):
326 for v, g in enumerate(self.basegrid):
327 order = [t[1] for t in g[0] if t is not None]
328 for n in range(len(self.ranges)):
329 coords = self.grid_estimate[v].copy()
330 coords[n] = np.mgrid[self.ranges[n][0]:self.ranges[n][1]:g[0][n][0]*2j]
331 #ranges = [slice(r[0], r[1], (2j * t[0] + 1 if i == n else 0.5j * t[0])) for i, (r, t) in enumerate(zip(self.ranges,g[0]))]
332 #fnc = self.calc_grid(np.mgrid[ranges], g[1], g[2])[v]
333 fnc = self.calc_grid(self.make_grid(coords), g[1], g[2])[v]
334 #self.get_support(n, fnc, np.amax(abs(fnc))*(ranges[n].stop-ranges[n].start)/ranges[n].step.imag * 1e-4)
335 ptp = fnc.ptp()
336 if np.amax(fnc.ptp(axis=n)) < 1e-6 * ptp and False: ##FIXME
337 print "%s[%d,%d]: const: %g" % (self.func.comp_id, v, n, np.amax(fnc.ptp(axis=n)) / ptp)
338 self.knot_data[v, n] = KnotData(None,None,slice(self.ranges[n][0], self.ranges[n][1], 1j),None)
339 continue
340 k = order[n]
341 #x = np.mgrid[ranges[n]]
342 x = coords[n]
343 rng = slice(self.ranges[n][0], self.ranges[n][1], g[0][n][0]*1j)
344 kn, bbox = self.get_interpolating_knots(np.mgrid[rng], k)
345 #e_max = 1.1 * self.max_df(n, x, kn, bbox, k, fnc)
346 try:
347 e_rel = g[3]
348 except IndexError:
349 e_rel = None
350 if e_rel is None:
351 #e_rel = 4e-5
352 e_rel = 4e-4
353 if e_rel < 0:
354 e_max = -e_rel
355 else:
356 e_max = ptp * e_rel
357 good = kn
358 am = None
359 kn0 = kn
360 try:
361 opt = g[4]
362 except IndexError:
363 opt = True
364 while opt:
365 df = self.spline_diff(n, x, kn[0], bbox, k, fnc)
366 mx = np.amax(df)
367 if mx > e_max:
368 if am is None:
369 raise ValueError("bad approximation for %s[%d,%d]: %g > %g" % (self.func.comp_id, v, n, mx, e_max))
370 kn = good
371 kn[2,am] = 1
372 else:
373 good = kn
374 if False:
375 xd = np.square(np.diff(ss(kn[:-1], k))).argsort()+1
376 else:
377 xd = self.max_diff(n, np.pad(kn[0],(1,0),'constant',constant_values=(x[0],)), x, df).argsort()
378 for am in xd:
379 if not kn[2,am]:
380 break
381 else:
382 break
383 kn = np.append(kn[:,:am],kn[:,am+1:], axis=1)
384 self.knot_data[v, n] = self.mk_result(kn, bbox, k, rng)
385 self.grid_estimate[v,n] = self.knot_data[v,n].get_knot_grid()
386 print "%s[%d,%d]: (%g), %d -> %d [%s]" % (self.func.comp_id, v, n, e_max, len(kn0[0]), len(kn[0]), fnc.shape)
387 #print "#", fnc.shape, x.shape, e_max
388 #print kn[:1]
389 #pylab.plot(x, fnc[:,0,:])
390 #pylab.plot(kn, np.zeros(len(kn)),"x")
391 #pylab.show(); raise SystemExit
392
393
394 #dtp = "float"
395 #tiny = np.finfo(np.float32).tiny
396 dtp = "treal"
397 tiny = np.finfo(np.float64).tiny
398
399 def print_float_array(o, name, a, prefix):
400 print >>o, "%s%s %s[%d] = {" % (prefix, dtp, name, a.size)
401 s = " "
402 i = 0
403 a = np.where(abs(a) < 100*tiny, 0, a)
404 for v in a.ravel('C'):
405 o.write(s+repr(float(v)))
406 #o.write(s + "%.8g" % v)
407 s = ","
408 i += 1
409 if i % 10 == 0:
410 print >>o, ","
411 s = " "
412 print >>o, "};"
413 return a.size * np.float32().nbytes
414
415 def print_int_array(o, name, a, prefix):
416 print >>o, "%sint %s[%d] = {" % (prefix, name, a.size)
417 s = " "
418 i = 0
419 for v in a.ravel('C'):
420 o.write(s + str(v))
421 s = ","
422 i += 1
423 if i % 10 == 0:
424 print >>o, ","
425 s = " "
426 print >>o, "};"
427 return a.size * np.int32().nbytes
428
429 def print_maptype_array(o, name, a, prefix):
430 print >>o, "%smaptype %s[%d] = {" % (prefix, name, a.size)
431 s = " "
432 i = 0
433 for v in a.ravel('C'):
434 o.write(s + str(v))
435 s = ","
436 i += 1
437 if i % 10 == 0:
438 print >>o, ","
439 s = " "
440 print >>o, "};"
441 align = 4
442 return ((a.size + align - 1) // align) * align
443
444 def print_intpp_data(o, tag, prefix, func, rgdata, basegrid, Spline=TensorSpline):
445 if prefix:
446 prefix += " "
447 sz = 0
448 int_sz = np.int32().nbytes
449 float_sz = np.float32().nbytes
450 #ranges = []
451 #orderlist = []
452 #for r, k in rgdata:
453 # ranges.append(r)
454 # orderlist.append(k)
455 spl = Spline(func, rgdata, basegrid)
456 coeffs = spl.calc_coeffs()
457 max_idx = 0
458 for iv, val in enumerate(spl.knot_data):
459 for v in val:
460 if not v.used():
461 continue
462 max_idx = max(max_idx, v.mapping[-1])
463 print >>o, "typedef %s maptype;" % Spline.max_idx_to_maptype(max_idx)
464 n = 0
465 for iv, val in enumerate(spl.knot_data):
466 for v in val:
467 if v.used():
468 n += 1
469 v.cut_mapping()
470 print >>o, "%sreal x0%s_%d[%d] = {%s};" % (prefix, tag, iv, n, ", ".join([str(float(v.get_bbox()[0])) for v in val if v.used()]))
471 print >>o, "%sreal xe%s_%d[%d] = {%s};" % (prefix, tag, iv, n, ", ".join([str(float(v.get_bbox()[1])) for v in val if v.used()]))
472 print >>o, "%sreal hi%s_%d[%d] = {%s};" % (prefix, tag, iv, n, ", ".join([str(v.inv_h()) for v in val if v.used()]))
473 print >>o, "%sint k%s_%d[%d] = {%s};" % (prefix, tag, iv, n, ", ".join([str(v.get_order()) for v in val if v.used()]))
474 print >>o, "%sint nmap%s_%d[%d] = {%s};" % (prefix, tag, iv, n, ", ".join([str(v.count()) for v in val if v.used()]))
475 print >>o, "%sint n%s_%d[%d] = {%s};" % (prefix, tag, iv, n, ", ".join([str(v.num_coeffs()) for v in val if v.used()]))
476 sz += (2*int_sz+2*float_sz) * n;
477 #grd = np.mgrid[ranges]
478 #grd_shape = grd.shape
479 #numpoints = np.product(grd_shape[1:])
480 #grd = grd.reshape(grd_shape[0], numpoints, order='F')
481 #grd = grd.T
482 #fnc = np.array(func(grd, True).T, order='C')
483 #fnc.shape = (nvals,)+tuple(reversed(grd_shape[1:]))
484 #fnc = fnc.T
485 #args = [np.arange(s.step.imag) for s in ranges]
486 ti = []
487 ai = []
488 ci = []
489 #idx = [slice(None)]*n+[0]
490 #fnca = []
491 #for i in range(nvals):
492 # idx[n] = i
493 # fnca.append(fnc[idx])
494 #tl, ca = b_ink(args, fnca, orderlist)
495 for j in range(len(val)):
496 if not val[j].used():
497 continue
498 t = "t%d_%d%s" % (j, iv, tag)
499 ti.append(t)
500 sz += print_float_array(o, t, val[j].knots, prefix)
501 a = "a%d_%d%s" % (j, iv, tag)
502 ai.append(a)
503 sz += print_maptype_array(o, a, val[j].mapping, prefix)
504 for i in range(1):
505 t = "c%d_%d%s" % (i, iv, tag)
506 ci.append(t)
507 sz += print_float_array(o, t, coeffs[iv], prefix)
508 print >>o, "%smaptype *map%s_%d[%d] = {%s};" % (prefix, tag, iv, n, ", ".join(ai))
509 print >>o, "%s%s *t%s_%d[%d] = {%s};" % (prefix, dtp, tag, iv, n, ", ".join(ti))
510 print >>o, "%s%s *c%s_%d[%d] = {%s};" % (prefix, dtp, tag, iv, 1, ", ".join(ci))
511 sz += (n + len(basegrid)) * float_sz
512 return sz, max_idx, spl
513
514 def print_header_file_start(h):
515 print >>h, """\
516 #ifndef _DATA_H
517 #define _DATA_H 1
518
519 #ifndef NO_INTPP_INCLUDES
520 #include "intpp.h"
521 #endif
522
523 namespace AmpData {
524 extern real b0;
525 extern real b1;
526 extern real a1;
527 extern int fs;
528
529 """
530
531 def print_header_file_end(h):
532 print >>h, """\
533 }
534
535 #endif /* !_DATA_H */
536 """
537
538 def print_header_file_entry(h, f):
539 print >>h, "namespace %s { extern splinedata sd; }" % f
540
541 def print_header(o):
542 print >>o, '#ifndef NO_INTPP_INCLUDES'
543 print >>o, '#include "intpp.h"'
544 print >>o, '#endif'
545 print >>o, "namespace AmpData {"
546 if 0:
547 b0, b1, a1 = circuit.PhaseSplitter().feedback_coeff(1.0)
548 print >>o, "real b0 = %g;" % b0
549 print >>o, "real b1 = %g;" % b1
550 print >>o, "real a1 = 1 - %g;" % (1 - a1)
551 #print >>o, "int fs = %d;" % circuit.FS
552 return 3 * np.float32().nbytes + np.int32().nbytes
553
554 def print_footer(o):
555 print >>o, "} // namespace AmpData"
556 return 0
557
558
559 class ArgumentError(ValueError):
560 pass
561
562 class ValueGrid(object):
563
564 def __init__(self, func, ranges, nvals):
565 self.ranges = ranges
566 self.grd = np.mgrid[ranges]
567 self.values = dk_lib.calc_grid(func, self.grd, nvals)
568 #print "%.2e" % np.max(self.values)
569
570 def max_jacobi_row(self, vals):
571 return np.array()
572
573 def max_jacobi(self):
574 n = self.values.shape[0]
575 m = len(self.ranges)
576 mj = np.zeros((n,m))
577 for i in range(n):
578 mj[i] = [np.max(abs(np.diff(self.values[i], axis=j))) for j in range(m)]
579 for i in range(m):
580 r = self.ranges[i]
581 if r.start != r.stop:
582 mj[:,i] /= (r.stop - r.start) / (r.step.imag-1)
583 else:
584 mj[:,i] = 0
585 return mj
586
587 def estimate_max_jacobi(func, ranges, error, nvals):
588 J = None
589 n = np.ones(len(ranges), dtype=int) * 2
590 while True:
591 v = ValueGrid(func, [slice(r[0],r[1],i*1j) for i, r in zip(n, ranges)], nvals)
592 J1 = v.max_jacobi()
593 if J is not None:
594 dv = np.max(abs(J1)+abs(J), axis=0)
595 m = 2 * np.max(abs(J1-J), axis=0) / np.where(dv == 0, 1., dv)
596 print "#%s: %s" % (n, m)
597 if np.max(m) < error:
598 #print "##", np.max(J1), np.max(v.values)
599 return J1, v
600 for i, e in enumerate(m):
601 if e >= error:
602 n[i] *= 2
603 else:
604 n *= 2
605 J = J1
606
607
608 class MyTensorSpline(TensorSpline):
609 def __init__(self, func, ranges, basegrid):
610 self.func = func
611 self.ranges = ranges
612 self.basegrid = basegrid
613 self.knot_data = np.empty((len([b for b in basegrid if b[0] is not None]), len(ranges)), dtype=object)
614 self.logger = logging.getLogger("approx")
615 #bg = []
616 self.coeffs = []
617 self.axes = []
618 kd_idx = 0
619 for i_fnc, (rng, pre, post, err, opt) in enumerate(basegrid):
620 if rng is None:
621 continue
622 grd, fnc, axes, axgrids = self.table_approximation(err, i_fnc, rng)
623 grd, fnc, axes = self.trim_table(grd, fnc, axes, err, self.func.i0[i_fnc])
624 self.logger.info("%d, %s, %s" % (i_fnc, fnc.shape, axgrids))
625 #print fnc.ptp(), grd.shape, fnc.shape, len(axes), axgrids
626 #grd.dump("grd.data")
627 #fnc.dump("fnc.data")
628 #import pickle
629 #pickle.dump(axes, file("axes.data","w"))
630 #raise SystemExit
631 self.coeffs.append(fnc)
632 self.axes.append(axes)
633 for i, (ax, ag, cg, r) in enumerate(zip(axes, axgrids, func.basegrid[i_fnc][0], rng)):
634 order_type = r[1]
635 w = ax[-1]-ax[0]
636 if w == 0:
637 order_type = None
638 if order_type is not None:
639 if np.amax(fnc.ptp(axis=i)) < 1e-6 * fnc.ptp():
640 self.logger.info(
641 "%s[%d,%d]: const: %g" %
642 (func.comp_id, i_fnc, i, np.amax(fnc.ptp(axis=i)) / fnc.ptp()))
643 order_type = None
644 if order_type is not None:
645 if isinstance(order_type, int):
646 tp = 's'
647 order = order_type
648 else:
649 tp = order_type[0]
650 order = order_type[1]
651 idx = np.array(np.rint((ax-ax[0])/w * ag), dtype=int)
652 if order > len(ax):
653 order = 2
654 self.knot_data[kd_idx, i] = self.mk_result(idx, ax, order, tp, slice(ax[0], ax[-1], (ag+1)*1j))
655 else:
656 self.knot_data[kd_idx, i] = KnotData(None,None,slice(ax[0], ax[-1], 1j),None)
657 kd_idx += 1
658
659 @staticmethod
660 def fromspline(xk, cvals, order):
661 xk2 = xk[order:-order]
662 N = len(xk2)-1
663 sivals = np.empty((order+1, N), dtype=float)
664 for m in xrange(order, -1, -1):
665 fact = np.product(np.arange(m)+1)
666 res = splev(xk2[:-1], (xk, cvals, order), m)
667 res /= fact
668 sivals[order-m, :] = res
669 return sivals
670
671 def calc_coeffs(self):
672 coeffs = TensorSpline.calc_coeffs(self)
673 cf = []
674 for c, k in zip(coeffs, self.knot_data):
675 k = [v for v in k if v.used()]
676 if len(k) == 1 and k[0].tp == 'pp' and k[0].get_order() == 4:
677 cs = np.squeeze(c)
678 assert len(cs.shape) == 1
679 cs = self.fromspline(k[0].knots, cs, 3).T
680 c = cs.reshape([len(cs)*4 if s > 1 else 1 for s in c.shape])
681 elif k[0].tp == 'h':
682 k[0].tp = 'pp'
683 else:
684 # no other orders implemented
685 k[0].tp = 's'
686 cf.append(c)
687 return cf
688
689 def mk_result(self, idx, kn, k, tp, r):
690 if k is None:
691 return KnotData(None,None,slice(r.start, r.stop, 1j),None)
692 f = reduce(fractions.gcd, idx)
693 idx /= f
694 a = np.empty(idx[-1], dtype=np.int32)
695 for m, (i, j) in enumerate(itertools.izip_longest(idx[:-1], idx[1:])):
696 a[i:j] = m
697 a += k-1
698 return KnotData(np.pad(kn, k-1, 'edge'), a, slice(r.start, r.stop, 1+(r.step-1)/f), (tp, k))
699
700 def trim_axis_edge(self, i, idx, grd, fnc, axes, prec, i0):
701 a = axes[i]
702 if len(a) <= 2:
703 return grd, fnc, axes
704 if idx < 0:
705 idx += len(a)
706 s1 = [slice(None)] * len(axes)
707 s2 = [slice(None)] * len(axes)
708 s1[i] = idx
709 fv = fnc[s1]
710 s1[i] = idx-1
711 s2[i] = idx+1
712 fi = (fnc[s1] + fnc[s2]) * 0.5
713 if callable(prec):
714 df = prec(fi, fv, i0).any()
715 else:
716 df = (abs(fi - fv) > prec).any()
717 if not df:
718 sl = range(idx) + range(idx+1, len(a))
719 axes[i] = axes[i][sl]
720 s1[i] = sl
721 fnc = fnc[s1]
722 grd = grd[[slice(None)]+s1]
723 return grd, fnc, axes
724
725 def trim_axis(self, i, idx, grd, fnc, axes, prec, i0):
726 a = axes[i]
727 if len(a) <= 2:
728 return grd, fnc, axes
729 s = [slice(None)] * len(axes)
730 s[i] = slice(idx, -1, 2)
731 fi = fnc[s]
732 s[i] = slice(idx+1, None, 2)
733 fi = (fi + fnc[s]) * 0.5
734 fsl = slice(idx+1, None, 2)
735 s[i] = fsl
736 fv = fnc[s]
737 if callable(prec):
738 df = prec(fi, fv, i0).any(axis=tuple([k for k in range(len(axes)) if k != i]))
739 else:
740 df = (abs(fi - fv) > prec).any(axis=tuple([k for k in range(len(axes)) if k != i]))
741 if not df.all():
742 sl = np.ones(len(a), dtype=bool)
743 sl[fsl] = df
744 axes[i] = axes[i][sl]
745 s[i] = sl
746 fnc = fnc[s]
747 grd = grd[[slice(None)]+s]
748 return grd, fnc, axes
749
750 def trim_table(self, grd, fnc, axes, prec, i0):
751 for i in range(len(axes)):
752 grd, fnc, axes = self.trim_axis_edge(i, 1, grd, fnc, axes, prec, i0)
753 grd, fnc, axes = self.trim_axis_edge(i, -2, grd, fnc, axes, prec, i0)
754 grd, fnc, axes = self.trim_axis(i, 0, grd, fnc, axes, prec, i0)
755 grd, fnc, axes = self.trim_axis(i, 1, grd, fnc, axes, prec, i0)
756 return grd, fnc, axes
757
758 def approx_one_axis(self, i, n, axes, s1, s2, fnc, ncalc_grid, prec, i0):
759 a = axes[i]
760 if len(a) == 1:
761 return 0, None, None, None, None
762 ax2 = (a[:-1]+a[1:]) * 0.5
763 axeslist = axes[:i] + [ax2] + axes[i+1:]
764 grd2 = dk_lib.mkgrid(axeslist)
765 fnc2 = ncalc_grid(grd2)
766 s1[i] = slice(None, -1)
767 s2[i] = slice(1, None)
768 fnc_intp = (fnc[s1] + fnc[s2]) * 0.5
769 if callable(prec):
770 df = prec(fnc_intp, fnc2, i0).any(axis=tuple([k for k in range(n) if k != i]))
771 else:
772 df = (abs(fnc_intp - fnc2) > prec).any(axis=tuple([k for k in range(n) if k != i]))
773 k = np.count_nonzero(df)
774 if k == 0:
775 s1[i] = slice(None)
776 s2[i] = slice(None)
777 return k, df, ax2, grd2, fnc2
778
779 def table_approximation(self, prec, i_fnc, rng):
780 #print rng, prec
781 def ncalc_grid(grd):
782 return self.calc_grid(grd, None, None)[i_fnc]
783 ranges = self.ranges
784 n = len(ranges)
785 axes = []
786 axgrids = np.ones(n)
787 start_size = 2
788 for i, (r, g) in enumerate(zip(ranges, rng)):
789 if g[1] is None:
790 axes.append(np.array(((r[0]+r[1])*0.5,), dtype=np.float64))
791 else:
792 axes.append(np.linspace(r[0], r[1], start_size+1))
793 axgrids[i] = start_size
794 grd = dk_lib.mkgrid(axes)
795 fnc = ncalc_grid(grd)
796 s1 = [slice(None)]*n
797 s2 = [slice(None)]*n
798 g1 = [slice(None)]*(n+1)
799 g2 = [slice(None)]*(n+1)
800 nn = 0
801 while True:
802 nn += 1
803 inserted = False
804 for i in range(len(axes)):
805 k, df, ax2, grd2, fnc2 = self.approx_one_axis(i, n, axes, s1, s2, fnc, ncalc_grid, prec, self.func.i0[i_fnc])
806 if k == 0:
807 continue
808 axgrids[i] *= 2
809 a = axes[i]
810 inserted = True
811 newshape = list(grd.shape)
812 newshape[i+1] += k
813 newgrd = np.empty(newshape)
814 newshape = list(fnc.shape)
815 newshape[i] += k
816 newfnc = np.empty(newshape)
817 newax = np.empty(len(a)+k)
818 j = 0
819 for k in range(len(a)):
820 g1[i+1] = j
821 g2[i+1] = k
822 newgrd[g1] = grd[g2]
823 s1[i] = j
824 s2[i] = k
825 newfnc[s1] = fnc[s2]
826 newax[j] = a[k]
827 j += 1
828 if k < len(df) and df[k]:
829 g1[i+1] = j
830 newgrd[g1] = grd2[g2]
831 s1[i] = j
832 newfnc[s1] = fnc2[s2]
833 newax[j] = ax2[k]
834 j += 1
835 s1[i] = slice(None)
836 s2[i] = slice(None)
837 g1[i+1] = slice(None)
838 g2[i+1] = slice(None)
839 axes[i] = newax
840 fnc = newfnc
841 grd = newgrd
842 self.logger.debug("%d, %s, %s" % (i_fnc, fnc.shape, axgrids))
843 if not inserted:
844 return grd, fnc, axes, axgrids
845
846
847 class TableGenerator(object):
848
849 def __init__(self, v, args, name, param):
850 parser = dk_simulator.Parser(v.S, v.V, v.FS, not args.backward_euler)
851 if args.c_debug_load:
852 raise NotImplemented("option c-debug-load with table generation")
853 else:
854 sim = dk_simulator.SimulatePy(dk_simulator.EquationSystem(parser), v.solver)
855 cmod = dk_simulator.BuildCModule(
856 name, sim, c_tempdir=args.c_tempdir, c_verbose=args.c_verbose,
857 linearize=args.linearize, c_real="double")
858 eq = cmod.eq
859 p = cmod.get_executor()
860 a = v.op_signal(timespan=1.02, op=parser.op)
861 smpl = lambda tm: int(round(tm*v.FS))
862 a[:,0] += param.input_signal.amplitude * dk_lib.genlogsweep(
863 param.input_signal.startfreq, param.input_signal.stopfreq, v.FS,
864 smpl(param.input_signal.pre), smpl(param.input_signal.timespan),
865 smpl(param.input_signal.post))[0]
866 ptp = p(a).ptp()
867 print "ptp =", ptp
868 print "nonlin function: OP value, range:"
869 print np.column_stack((p.p0, p.minmax))
870
871 nvals = p.nno
872 J, vals = estimate_max_jacobi(p.nonlin, p.minmax, param.jacobi_estimate_error, nvals)
873 J = np.matrix(J)
874 dv = np.amax(np.append(abs(eq.Fo), abs(eq.Fo)*J*abs(eq.G0)*abs(eq.Co), axis=0), axis=0).A
875 E = param.maxerr * ptp / np.where(dv == 0, 1e-20, dv)
876 print "function error limits for max out error %g: %s" % (param.maxerr, ", ".join(["%.2g" % vv for vv in E.T]))
877
878 grd_shape = vals.grd.shape
879 numpoints = np.product(grd_shape[1:])
880 grd = vals.grd.reshape(grd_shape[0], numpoints)
881 fnc = vals.values.reshape(nvals, numpoints)
882 with dk_lib.printoptions(precision=2, linewidth=200):
883 print "covariance matrix (rows: variables, columns: functions):"
884 print np.cov(grd, fnc)[:len(grd),len(grd):]
885
886 o = StringIO()
887 inst = StringIO()
888 h = StringIO()
889 class Comp:
890 comp_id = name
891 comp_name = name
892 ranges = p.minmax
893 basegrid = [
894 [((1024, 2),), None, None, -E.T[0], True],
895 ]
896 # basegrid = [[((64, 2),(8, 2),(16, 2),(32, 2)), None, None, -E.T[0], True],
897 # [((280, 2),(8, 2),(16, 2),(32, 2)), None, None, -E.T[1], True],
898 # [((64, 2),(8, 2),(16, 2),(32, 2)), None, None, -E.T[2], True],
899 # [((64, 2),(8, 2),(16, 2),(32, 2)), None, None, -E.T[3], True],
900 # ]
901 NVALS = nvals
902 N_IN = grd_shape[0]
903 NDIM = grd_shape[0]
904 @staticmethod
905 def __call__(v, with_state):
906 return p.nonlin(v)
907 if 1:
908 maptype = self.write_files(Comp(), o, inst, h)
909 c_debug_load = None
910 else:
911 c_debug_load = "gencode/dk_sim_0.so"
912 extra_sources = dict(data_c=o.getvalue(), data_h=h.getvalue(), intpp_inst=inst.getvalue())
913 sim = dk_simulator.SimulatePy(dk_simulator.EquationSystem(parser), v.solver)
914 cmodt = dk_simulator.BuildCModule(
915 name+"_table", sim, dict(method="table",name=name,maptype=maptype), extra_sources=extra_sources,
916 c_tempdir="gencode", c_verbose=args.c_verbose, linearize=args.linearize, c_real=("float" if args.c_float else "double"))
917 pt = cmodt.get_executor()
918 self.p = p
919 self.pt = pt
920 ##
921 rng = []
922 for r, b in zip(Comp.ranges, Comp.basegrid[0][0]):
923 off = 0.5 * (r[1]-r[0]) / (b[0]-1)
924 rng.append(slice(r[0]+off, r[1]-off, (b[0]-1)*1j))
925 v1 = ValueGrid(p.nonlin, rng, nvals)
926 v2 = ValueGrid(pt.nonlin, rng, nvals)
927 for i in range(len(Comp.basegrid)):
928 print np.max(abs(v1.values[i]-v2.values[i]))
929
930 @staticmethod
931 def max_idx_to_maptype(max_idx):
932 if max_idx >= 2**16:
933 return "int"
934 elif max_idx >= 2**8:
935 return "unsigned short"
936 else:
937 return "unsigned char"
938
939 @staticmethod
940 def print_intpp_data(p):
941 o = StringIO()
942 print >>o, "namespace %s {" % p.comp_id
943 r, max_idx, spl = print_intpp_data(o, "", "", p, p.ranges, p.basegrid, MyTensorSpline)
944 maptype = TableGenerator.max_idx_to_maptype(max_idx)
945 print >>o, "splinecoeffs<maptype> sc[%d] = {" % p.NVALS
946 f_set = set()
947 for j, kn in enumerate(spl.knot_data):
948 fu = "splev"
949 if kn[0].tp == 'pp':
950 fu = "splev_pp"
951 inst = "splinedata<%s>::%s<%s>" % (maptype, fu, ",".join([str(v.get_order()) for v in kn if v.used()]))
952 f_set.add((inst,maptype))
953 print >>o, "\t{x0_%d, xe_%d, hi_%d, k_%d, n_%d, nmap_%d, map_%d, t_%d, c_%d, %s}," % (j, j, j, j, j, j, j, j, j, inst)
954 print >>o, "};"
955 print >>o, "splinedata<maptype> sd = {"
956 print >>o, "\tsc,"
957 print >>o, "\t%d, /* number of calculated values */" % p.NVALS
958 print >>o, "\t%d, /* number of input values */" % p.N_IN
959 print >>o, "\t%d, /* number of output values */" % (p.NVALS-(p.NDIM-p.N_IN))
960 print >>o, "\t%d, /* number of state values */" % (p.NDIM-p.N_IN)
961 print >>o, '\t"%s",' % p.comp_id
962 print >>o, "};"
963 print >>o, "}; /* ! namespace %s */" % p.comp_id
964 o.seek(0)
965 return r, o.read(), f_set, p.comp_name, p.comp_id, max_idx, spl
966
967 @staticmethod
968 def write_files(comp, o, inst, h):
969 procs = [TableGenerator.print_intpp_data(comp)]
970 max_idx_all = 0
971 for p in procs:
972 s, f, i, comp_name, comp_id, max_idx, spl = p
973 max_idx_all = max(max_idx_all, max_idx)
974 #maptype = max_idx_to_maptype(max_idx_all)
975 #o.write("typedef %s maptype;\n" % maptype)
976 print_header_file_start(h)
977 sz = print_header(o)
978 l = []
979 templ = set()
980 for p in procs:
981 s, f, i, comp_name, comp_id, max_idx, spl = p
982 o.write(f)
983 templ |= i
984 l.append("%s: %d bytes" % (comp_name, s))
985 sz += s
986 print_header_file_entry(h, comp_id)
987 sz += print_footer(o)
988 l.append("data size sum: %d bytes" % sz)
989 print >>o, "".join(["\n// " + s for s in l])
990 print_header_file_end(h)
991 maptype = "unsigned char"
992 for v, maptype in sorted(templ):
993 print >>inst, "template int %s(splinecoeffs<%s> *p, real xi[2], real *res);" % (v, maptype)
994 return maptype, spl
995
996
997 class LoadedSchema(circ.Test):
998 def __init__(self, params):
999 v = vars(models)
1000 v["Tubes"] = circ.Tubes
1001 v["math"] = math
1002 if hasattr(params, "load_schema"):
1003 import mk_netlist
1004 exec mk_netlist.read_netlist(params.load_schema) in v
1005 else:
1006 with open(params.load_netlist) as f:
1007 exec f in v
1008 self.S = v["S"]
1009 self.V = v["V"]
1010 self.V["OP"] = getattr(params, "OP", [0.])
1011 if hasattr(params, "test_signal"):
1012 if hasattr(params.test_signal, "timespan"):
1013 self.timespan = params.test_signal.timespan
1014 def signal():
1015 a = self.op_signal()
1016 a[:,0] += params.test_signal.amplitude * self.sine_signal(params.test_signal.freq)[:,0]
1017 return a
1018 setattr(self, "signal", signal)
1019
1020
1021 def generate_faust_module(plugindef, b, a, potlist, flt, pre_filter=None, build_script=None):
1022 import dk_templates
1023 d = {}
1024 if not potlist:
1025 d['have_master_slider'] = False
1026 else:
1027 d['have_master_slider'] = True
1028 d['master_slider_id'] = potlist[0][0]
1029 d['knob_ids'] = [t[0] for t in potlist]
1030 ui = dk_templates.module_ui_template.render(d)
1031 d = {}
1032 d['plugindef'] = plugindef
1033 d['build_script'] = build_script
1034 d['sliders'] = [dict(id=t[0], name=t[1], loga=t[2], inv=t[3]) for t in potlist]
1035 d['pre_filter'] = '_' if pre_filter is None else pre_filter
1036 d['b_list'] = ",".join(["b%d/a0" % i for i in range(len(b))])
1037 d['a_list'] = ",".join(["a%d/a0" % i for i in range(1,len(a))])
1038 d['coeffs'] = "\n\n ".join(flt.coeffs_as_faust_code('b', b) + flt.coeffs_as_faust_code('a', a))
1039 dsp = dk_templates.faust_filter_template.render(d)
1040 return dsp, ui
1041
1042 def build_faust_module(plugindef, b, a, potlist, flt, datatype="float", pre_filter=None, build_script=None):
1043 dsp, ui = generate_faust_module(plugindef, b, a, potlist, flt, pre_filter, build_script)
1044 modname = plugindef.id
1045 dspname = "/tmp/%s.dsp" % modname
1046 uiname = "/tmp/%s_ui.cc" % modname
1047 with open(dspname,"w") as f:
1048 f.write(dsp)
1049 with open(uiname,"w") as f:
1050 f.write(ui)
1051 pgm = os.path.abspath("../../build-faust")
1052 opts = "-s" if datatype == "float" else ""
1053 os.system("%s %s -c %s" % (pgm, opts, dspname))
1054
1055 def get_circuit_instance(g, tests, args):
1056 if args.schema:
1057 class params(object):
1058 load_schema = args.schema
1059 t = os.path.splitext(os.path.basename(args.schema))[0]
1060 v = LoadedSchema(params)
1061 return v, t
1062 elif args.netlist:
1063 class params(object):
1064 load_netlist = args.netlist
1065 t = os.path.splitext(os.path.basename(args.netlist))[0]
1066 v = LoadedSchema(params)
1067 return v, t
1068 else:
1069 t = tests[0]
1070 return g[t](), t
1071
1072 def create_filter(g, tests, args):
1073 v, t = get_circuit_instance(g, tests, args)
1074 p = dk_simulator.Parser(v.S, v.V, v.FS, not args.backward_euler, create_filter=True, symbolic=args.filter_symbolic)
1075 if len(p.get_nonlin_funcs()) > 0:
1076 if args.filter_symbolic:
1077 raise ArgumentError("ciruit is nonlinear: symbolic formula generation not supported")
1078 p1 = dk_simulator.Parser(v.S, v.V, v.FS, not args.backward_euler)
1079 sim = dk_simulator.SimulatePy(dk_simulator.EquationSystem(p1), v.solver)
1080 J = sim.jacobi()
1081 else:
1082 J = None
1083 f = dk_simulator.LinearFilter(p, J)
1084 if args.filter_symbolic:
1085 if args.filter_s_coeffs:
1086 b, a, terms = f.get_s_coeffs()
1087 f.print_coeffs('b', b)
1088 f.print_coeffs('a', a)
1089 print "\nH = %s;" % terms
1090 else:
1091 b, a, terms = f.get_s_coeffs()
1092 f.print_coeffs('b', b)
1093 f.print_coeffs('a', a)
1094 B, A, c = f.transform_bilinear(terms)
1095 print "\nc = %s;" % c
1096 f.print_coeffs('B', B)
1097 f.print_coeffs('A', A)
1098 else:
1099 if args.filter_variable is None:
1100 if args.plot_spectrum:
1101 svar = f.convert_variable_dict({})
1102 else:
1103 svar = None
1104 else:
1105 try:
1106 svar = f.convert_variable_dict(dict([(s, float(vv)) for s, vv in [par.split("=") for par in args.filter_variable if par]]))
1107 except ValueError as e:
1108 raise ArgumentError(e)
1109 if args.filter_samplerate is None:
1110 if args.plot_spectrum:
1111 samplerate = 48000
1112 else:
1113 samplerate = None
1114 else:
1115 samplerate = args.filter_samplerate
1116 if args.plot_spectrum and args.plot_variable:
1117 pvar = [k for k in svar if args.plot_variable == str(k)]
1118 if not pvar:
1119 raise ArgumentError("variable %s not found" % args.plot_variable)
1120 pvar = pvar[0]
1121 del svar[pvar]
1122 b, a = f.get_z_coeffs(samplerate=samplerate, subst_var=svar)
1123 if args.plot_spectrum:
1124 if args.plot_variable:
1125 for e in p.element_name["P"]:
1126 t = v.V[e[0]]
1127 var = None
1128 if isinstance(t, dict):
1129 var = t.get("var")
1130 if var is None:
1131 var = "%sv" % e[0]
1132 if var == args.plot_variable:
1133 break
1134 else:
1135 raise ArgumentError("variable %s not found" % args.plot_variable)
1136 if not isinstance(t, dict):
1137 t = dict(value=t)
1138 loga = t.get('a', 0)
1139 inv = t.get('inv', 0)
1140 for i in range(5):
1141 pot = i/4
1142 lbl = "%s" % pot
1143 if inv:
1144 pot = 1 - pot
1145 if loga:
1146 pot = (math.exp(loga * pot) - 1) / (math.exp(loga) - 1)
1147 w, h = f.spectrum([j.subs(pvar, pot) for j in b], [j.subs(pvar, pot) for j in a], 20, 10000)
1148 pl.semilogx(w, np.where(h < -60, np.nan, h), label=lbl)
1149 pl.legend(loc='upper left')
1150 else:
1151 w, h = f.spectrum(b, a, 20, 10000)
1152 pl.semilogx(w, np.where(h < -60, np.nan, h))
1153 pl.grid()
1154 pl.show()
1155 elif args.create_module:
1156 l = []
1157 for e in set([e[0] for e in p.element_name["P"]]):
1158 t = v.V[e]
1159 if not isinstance(t, dict):
1160 t = dict(value=t)
1161 var = t.get('var')
1162 if var is None:
1163 var = str(e)+"v"
1164 name = t.get('name', var)
1165 loga = t.get('a', 0)
1166 inv = t.get('inv', 0)
1167 l.append((var, name, loga, inv))
1168 build_faust_module(dk_simulator.PluginDef(args.create_module), b, a, l, f)
1169 else:
1170 f.print_coeffs('b', b)
1171 f.print_coeffs('a', a)
1172
1173 def is_test(v):
1174 return isinstance(v, type) and issubclass(v, circ.Test) and v is not circ.Test
1175
1176 def plot_one(v, args, t):
1177 parser = dk_simulator.Parser(v.S, v.V, v.FS, not args.backward_euler)
1178 p = dk_simulator.get_executor(
1179 t, parser, v.solver, args.pure_python, c_tempdir=args.c_tempdir, c_verbose=args.c_verbose,
1180 c_debug_load=args.c_debug_load, linearize=args.linearize, c_real=("float" if args.c_float else "double"))
1181 if args.plot_spectrum:
1182 v.plot_spectrum(p, args.plot_variable)
1183 else:
1184 v.plot(p)
1185 if 0:
1186 for i, (p0, (s, e)) in enumerate(zip(p.p0, p.minmax)):
1187 print "%d: %g [%g .. %g]" % (i, p0, s, e)
1188
1189 def plot_output(g, tests, args):
1190 if args.schema or args.netlist:
1191 v, t = get_circuit_instance(g, tests, args)
1192 plot_one(v, args, t)
1193 return
1194 if not tests:
1195 testlist = [k for k, v in g.items() if is_test(v)]
1196 testlist.sort()
1197 for i, k in enumerate(testlist):
1198 if k.endswith("_test"):
1199 k = k[:-5]
1200 print "%2d: %s" % (i, k)
1201 print
1202 try:
1203 k = testlist[int(raw_input("Please select: "))]
1204 except (ValueError, KeyError):
1205 print "not found"
1206 raise SystemExit, 1
1207 except KeyboardInterrupt:
1208 print
1209 raise SystemExit, 1
1210 tests = [k]
1211 for t in tests:
1212 plot_one(g[t](), args, t)
1213
1214
1215 def main():
1216 parser = argparse.ArgumentParser()
1217 parser.add_argument('test', nargs="*",
1218 help='name of test')
1219 parser.add_argument('-c', '--check', action='store_true',
1220 help='check results of tests')
1221 parser.add_argument('-b', '--backward-euler', action='store_true',
1222 help='use Backward-Euler integration instead of trapezoidal')
1223 parser.add_argument('-p', '--pure-python', action='store_true',
1224 help='do not generate C code to speed up calculations')
1225 parser.add_argument('-f', '--func',
1226 help='function table generation')
1227 parser.add_argument('-s', '--show', action='store_true',
1228 help='plot nonlinear function')
1229 parser.add_argument('-S', '--schema',
1230 help='use gschem .sch file as input')
1231 parser.add_argument('-N', '--netlist',
1232 help='use netlist file as input (TBD: document file format)')
1233 parser.add_argument('--linearize', action='store_true',
1234 help='build a linear small signal model')
1235 parser.add_argument('-y', '--filter', action='store_true',
1236 help='calculate coefficients for linear filter (small signal model for nonlinear circuits)')
1237 parser.add_argument('--plot-spectrum', action='store_true',
1238 help='plot spectrum of curcuit')
1239 parser.add_argument('--plot-variable',
1240 help='display a set of curves by sweeping this the pot position for this variable from 0 to 1')
1241 parser.add_argument('--filter-s-coeffs', action='store_true',
1242 help='calculate s coefficients (Laplace tranform for analog circuit)')
1243 parser.add_argument('--filter-symbolic', action='store_true',
1244 help="use component symbols, don't replace by values (only valid for linear circuits)")
1245 parser.add_argument('--filter-samplerate', type=float,
1246 help='sample rate for calculation of filter z coefficients (with this option the symbol fs will be used)')
1247 parser.add_argument('--filter-variable', action='append',
1248 help='set a potentiometer variable in the form name=value (can be specified multiple times)')
1249 parser.add_argument('--create-module',
1250 help='create a loadable Guitarix module (use with --filter)')
1251 parser.add_argument('--print-result', action='store_true',
1252 help='print result (to be used as reference)')
1253 parser.add_argument('--c-verbose', action='store_true',
1254 help='show compiler messages when generating internal module')
1255 parser.add_argument('--c-tempdir',
1256 help='temp dir for module generation; not removed when finished')
1257 parser.add_argument('--c-float', action='store_true',
1258 help='use float instead of double in c module')
1259 parser.add_argument('--c-debug-load',
1260 help='load module (generated with --c-tempdir) instead of generating a new one')
1261 parser.add_argument('--c-samplerate', type=float,
1262 help='sample rate for calculation of c module)')
1263
1264 args = parser.parse_args()
1265 g = vars(circ)
1266 tests = []
1267 for t in args.test:
1268 if not (t in g and is_test(g[t])):
1269 tt = t + "_test"
1270 if not (tt in g and is_test(g[tt])):
1271 parser.error("%s is not a test" % t)
1272 t = tt
1273 tests.append(t)
1274 if args.check:
1275 if not tests:
1276 tests = [k for k, v in g.items() if is_test(v) and hasattr(v, 'result')]
1277 tests.sort()
1278 tn = [t[:-5] if t.endswith("_test") else t for t in tests]
1279 mlen = reduce(max, [len(t) for t in tn], 0)
1280 for t, nm in zip(tests, tn):
1281 sys.stdout.write("%-*s: " % (mlen, nm))
1282 sys.stdout.flush()
1283 v = g[t]()
1284 sys.stdout.write("%s\n" % v.check(t, args))
1285 elif args.func:
1286 t = os.path.splitext(os.path.basename(args.func))[0]
1287 class sweep(object):
1288 def __init__(self, startfreq=30, stopfreq=20000, timespan=1, pre = 0.01, post = 0.01):
1289 for i in "startfreq", "stopfreq", "timespan", "pre", "post":
1290 setattr(self, i, vars()[i])
1291 self.amplitude = 1
1292 def __rmul__(self, m):
1293 self.amplitude *= m
1294 return self
1295 __mul__ = __rmul__
1296 class sine_signal(object):
1297 def __init__(self, freq=200, timespan=0.1):
1298 self.freq = freq
1299 self.timespan=timespan
1300 self.amplitude = 1
1301 def __rmul__(self, m):
1302 self.amplitude *= m
1303 return self
1304 __mul__ = __rmul__
1305
1306 d = dict(sweep=sweep, sine_signal=sine_signal, circ=circ)
1307 try:
1308 with open(args.func) as f:
1309 exec f in d
1310 except IOError:
1311 raise SystemExit("error: can't open %s" % args.func)
1312 class params(object):
1313 jacobi_estimate_error = 0.1
1314 for k, v in d.items():
1315 if k != 'sweep' and not k.startswith("__"):
1316 setattr(params, k, v)
1317 if hasattr(params, "load_schema") or hasattr(params, "load_netlist"):
1318 v = LoadedSchema(params)
1319 else:
1320 v = params.schema()
1321 tg = TableGenerator(v, args, t, params)
1322 if hasattr(v, "signal"):
1323 x = v.timeline()
1324 s = v.signal()
1325 tg.p.x = tg.p.x0
1326 tg.p.v0 = tg.p.v00
1327 y1 = tg.p(s)
1328 pl.plot(x, y1, label="solver")
1329 y2 = tg.pt(s)
1330 pl.plot(x, y2, label="table")
1331 #
1332 #parser = dk_simulator.Parser(v.S, v.V, v.FS, not args.backward_euler)
1333 #p2 = dk_simulator.get_executor(t+"_table", parser, v.solver, args.pure_python,
1334 # c_debug_load="gencode/dk_sim_1.so")
1335 #y3 = p2(s)
1336 #pl.plot(x, y3, label="reloaded")
1337 #print np.max(abs(y3 - y1))
1338 #
1339 pl.grid()
1340 pl.legend()
1341 pl.show()
1342 elif args.show:
1343 t = tests[0]
1344 v = g[t]()
1345 parser = dk_simulator.Parser(v.S, v.V, v.FS, not args.backward_euler)
1346 p = dk_simulator.get_executor(
1347 t, parser, v.solver, args.pure_python, c_tempdir=args.c_tempdir,
1348 c_verbose=args.c_verbose, c_debug_load=args.c_debug_load)
1349 a = v.op_signal(timespan=1.02)
1350 smpl = lambda tm: int(round(tm*v.FS))
1351 a[:,0] += 2 * dk_lib.genlogsweep(30, 20000, v.FS, smpl(0.01), smpl(1), smpl(0.01))[0]
1352 ptp = p(a).ptp()
1353 rng = p.minmax
1354 ifunc = 3
1355 j = 0
1356 i = 1
1357 for k in range(4):
1358 if j == k:
1359 #if j <= k:
1360 #if k <= j:
1361 continue
1362 x = np.linspace(rng[j][0],rng[j][1],100)
1363 z = np.linspace(rng[k][0],rng[k][1],20)
1364 a = [[p0] for p0 in p.p0]
1365 a[j] = x
1366 a[k] = z
1367 y = dk_lib.calc_grid(p.nonlin, dk_lib.mkgrid(a))[ifunc]
1368 s = [slice(None)] * len(a)
1369 for n in range(len(s)):
1370 if n not in (j,k):
1371 s[n] = 0
1372 pl.subplot(3,1,i)
1373 i += 1
1374 t = y[s]
1375 if j > k:
1376 t = t.T
1377 else:
1378 t = t
1379 if 0:
1380 t = np.diff(t, 2, axis=0)
1381 x = x[:-2]
1382 if 0:
1383 t = np.diff(t, 1, axis=0)
1384 x = x[:-1]
1385 for ii, tt in enumerate(t.T):
1386 off = 0
1387 if j == 0 and k == 1:
1388 off = -0.55 * z[ii]
1389 if j == 0 and k == 2:
1390 off = 0.9 * z[ii]
1391 if j == 0 and k == 3:
1392 off = -0.9 * z[ii]
1393 off = 0
1394 pl.plot(x+off, tt)
1395 t = correlate(t[:,1:],t[:,:1],'same')
1396 m = t.argmax(axis=0)
1397 #pl.plot(np.diff(m))
1398 idx = (m, range(len(m)))
1399 #pl.plot(x[m], t[idx])
1400 pl.title("%d, %d" % (j, k))
1401 pl.grid()
1402 pl.show()
1403 elif args.filter:
1404 try:
1405 create_filter(g, tests, args)
1406 except ArgumentError as e:
1407 parser.error(e)
1408 else:
1409 plot_output(g, tests, args)
1410
1411
1412 if __name__ == "__main__":
1413 main()
0 import numpy as np
1 import ctypes as ct
2
3 __all__ = ["ab09ad","ab09ax","tb01id","tb01wd"]
4
5 def c_arr(w=False):
6 flags = ['F']
7 if w:
8 flags.append('W')
9 return np.ctypeslib.ndpointer(dtype=ct.c_double, ndim=1, flags=flags)
10 def c_mat(w=False):
11 flags = ['F']
12 if w:
13 flags.append('W')
14 return np.ctypeslib.ndpointer(dtype=ct.c_double, ndim=2, flags=flags)
15
16 slicot = ct.cdll.LoadLibrary("libslicot.so.0")
17
18 ################################################################
19 ## AB09AD
20 #
21 slicot.ab09ad_.restype = None
22 slicot.ab09ad_.argtypes = [
23 ct.c_char_p, #DICO,
24 ct.c_char_p, #JOB,
25 ct.c_char_p, #EQUIL,
26 ct.c_char_p, #ORDSEL,
27 ct.POINTER(ct.c_int), #N,
28 ct.POINTER(ct.c_int), #M,
29 ct.POINTER(ct.c_int), #P,
30 ct.POINTER(ct.c_int), #NR,
31 c_mat(True), #A,
32 ct.POINTER(ct.c_int), #LDA,
33 c_mat(True), #B,
34 ct.POINTER(ct.c_int), #LDB,
35 c_mat(True), #C,
36 ct.POINTER(ct.c_int), #LDC,
37 c_arr(True), #HSV,
38 ct.POINTER(ct.c_double), #TOL,
39 np.ctypeslib.ndpointer(dtype=ct.c_int, ndim=1, flags=["F","W"]), #IWORK,
40 c_arr(True), #DWORK,
41 ct.POINTER(ct.c_int), #LDWORK,
42 ct.POINTER(ct.c_int), #IWARN,
43 ct.POINTER(ct.c_int), #INFO
44 ]
45
46 def ab09ad(dico, job, equil, A, B, C, nr=None, tol=0):
47 ordsel = 'A' if nr is None else 'F'
48 Ar = np.array(A, dtype=np.float64, order='F', copy=True)
49 Br = np.array(B, dtype=np.float64, order='F', copy=True)
50 Cr = np.array(C, dtype=np.float64, order='F', copy=True)
51 _nr = ct.c_int(nr or 0)
52 hsv = np.zeros(Ar.shape[1], dtype=np.float64, order='F')
53 iwork = np.zeros(Ar.shape[1], dtype=np.int32, order='F')
54 dwork = np.zeros(Ar.size * 5, dtype=np.float64, order='F')
55 iwarn = ct.c_int()
56 info = ct.c_int()
57 n = ct.c_int(Ar.shape[0])
58 m = ct.c_int(Br.shape[1])
59 p = ct.c_int(Cr.shape[0])
60 lda = ct.c_int(Ar.shape[0])
61 ldb = ct.c_int(Br.shape[0])
62 ldc = ct.c_int(Cr.shape[0])
63 _tol = ct.c_double(tol)
64 ldwork = ct.c_int(dwork.shape[0])
65 slicot.ab09ad_(
66 dico, job, equil, ordsel, ct.byref(n), ct.byref(m), ct.byref(p),
67 ct.byref(_nr), Ar, ct.byref(lda), Br, ct.byref(ldb), Cr, ct.byref(ldc),
68 hsv, ct.byref(_tol), iwork, dwork, ct.byref(ldwork), ct.byref(iwarn), ct.byref(info))
69 if iwarn.value != 0:
70 print "ab09ad:", (
71 "The selected order NR is greater than the order of a minimal\n"
72 "realization of the given system. The order has been set according\n"
73 "to the minimal realization of the system.")
74 if info.value != 0:
75 if info.value < 0:
76 raise ValueError("%dth input argument is illegal" % -info.value())
77 if info.value == 1:
78 raise ValueError("the reduction of A to the real Schur form failed")
79 if info.value == 2:
80 raise ValueError("the state matrix A is not stable (if DICO = 'C') or not convergent (if DICO = 'D')")
81 if info.value == 3:
82 raise ValueError("the computation of Hankel singular values failed.")
83 raise ValueError("unknown error value %d" % info.value)
84 nr = _nr.value
85 if nr != Ar.shape[1]:
86 Ar = Ar[:nr,:nr]
87 Br = Br[:nr]
88 Cr = Cr[:,:nr]
89 return Ar, Br, Cr, hsv
90
91 ################################################################
92 ## AB09AX
93 ##
94 slicot.ab09ax_.restype = None
95 slicot.ab09ax_.argtypes = [
96 ct.c_char_p, #DICO,
97 ct.c_char_p, #JOB,
98 ct.c_char_p, #ORDSEL,
99 ct.POINTER(ct.c_int), #N,
100 ct.POINTER(ct.c_int), #M,
101 ct.POINTER(ct.c_int), #P,
102 ct.POINTER(ct.c_int), #NR,
103 c_mat(True), #A,
104 ct.POINTER(ct.c_int), #LDA,
105 c_mat(True), #B,
106 ct.POINTER(ct.c_int), #LDB,
107 c_mat(True), #C,
108 ct.POINTER(ct.c_int), #LDC,
109 c_arr(True), #HSV,
110 c_mat(True), #T,
111 ct.POINTER(ct.c_int), #LDT,
112 c_mat(True), #TI,
113 ct.POINTER(ct.c_int), #LDTI,
114 ct.POINTER(ct.c_double), #TOL,
115 np.ctypeslib.ndpointer(dtype=ct.c_int, ndim=1, flags=["F","W"]), #IWORK,
116 c_arr(True), #DWORK,
117 ct.POINTER(ct.c_int), #LDWORK,
118 ct.POINTER(ct.c_int), #IWARN,
119 ct.POINTER(ct.c_int), #INFO
120 ]
121
122 def ab09ax(dico, job, A, B, C, nr=None, tol=0):
123 ordsel = 'A' if nr is None else 'F'
124 Ar = np.array(A, dtype=np.float64, order='F', copy=True)
125 Br = np.array(B, dtype=np.float64, order='F', copy=True)
126 Cr = np.array(C, dtype=np.float64, order='F', copy=True)
127 _nr = ct.c_int(nr or 0)
128 hsv = np.zeros(Ar.shape[1], dtype=np.float64, order='F')
129 T = np.zeros_like(Ar)
130 ldt = ct.c_int(Ar.shape[0])
131 Ti = np.zeros_like(Ar)
132 ldti = ct.c_int(Ar.shape[0])
133 iwork = np.zeros(Ar.shape[1], dtype=np.int32, order='F')
134 n = Ar.shape[0]
135 m = Br.shape[1]
136 p = Cr.shape[0]
137 minsz = max(1,n*(max(n,m,p)+5) + n*(n+1)/2)
138 dwork = np.zeros(minsz * 2, dtype=np.float64, order='F')
139 iwarn = ct.c_int()
140 info = ct.c_int()
141 n = ct.c_int(Ar.shape[0])
142 m = ct.c_int(Br.shape[1])
143 p = ct.c_int(Cr.shape[0])
144 lda = ct.c_int(Ar.shape[0])
145 ldb = ct.c_int(Br.shape[0])
146 ldc = ct.c_int(Cr.shape[0])
147 _tol = ct.c_double(tol)
148 ldwork = ct.c_int(dwork.shape[0])
149 slicot.ab09ax_(
150 dico, job, ordsel, ct.byref(n), ct.byref(m), ct.byref(p),
151 ct.byref(_nr), Ar, ct.byref(lda), Br, ct.byref(ldb), Cr, ct.byref(ldc),
152 hsv, T, ct.byref(ldt), Ti, ct.byref(ldti), ct.byref(_tol),
153 iwork, dwork, ct.byref(ldwork), ct.byref(iwarn), ct.byref(info))
154 if iwarn.value != 0:
155 print "ab09ad:", (
156 "The selected order NR is greater than the order of a minimal\n"
157 "realization of the given system. The order has been set according\n"
158 "to the minimal realization of the system.")
159 if info.value != 0:
160 if info.value < 0:
161 raise ValueError("%dth input argument is illegal" % -info.value())
162 if info.value == 1:
163 raise ValueError("the state matrix A is not stable (if DICO = 'C') or not convergent (if DICO = 'D')")
164 if info.value == 2:
165 raise ValueError("the computation of Hankel singular values failed.")
166 raise ValueError("unknown error value %d" % info.value)
167 nr = _nr.value
168 if nr != Ar.shape[1]:
169 Ar = Ar[:nr,:nr]
170 Br = Br[:nr]
171 Cr = Cr[:,:nr]
172 T = T[:,:nr]
173 Ti = Ti[:nr,:]
174 return T, Ti, Ar, Br, Cr, hsv
175
176 ################################################################
177 ## TB01ID
178 ##
179 slicot.tb01id_.restype = None
180 slicot.tb01id_.argtypes = [
181 ct.c_char_p, #JOB,
182 ct.POINTER(ct.c_int), #N,
183 ct.POINTER(ct.c_int), #M,
184 ct.POINTER(ct.c_int), #P,
185 ct.POINTER(ct.c_double), #MAXRED,
186 c_mat(True), #A,
187 ct.POINTER(ct.c_int), #LDA,
188 c_mat(True), #B,
189 ct.POINTER(ct.c_int), #LDB,
190 c_mat(True), #C,
191 ct.POINTER(ct.c_int), #LDC,
192 c_arr(True), #SCALE,
193 ct.POINTER(ct.c_int), #INFO
194 ]
195
196 def tb01id(job, A, B, C, maxred=0):
197 Ar = np.array(A, dtype=np.float64, order='F', copy=True)
198 Br = np.array(B, dtype=np.float64, order='F', copy=True)
199 Cr = np.array(C, dtype=np.float64, order='F', copy=True)
200 n = ct.c_int(Ar.shape[0])
201 m = ct.c_int(Br.shape[1])
202 p = ct.c_int(Cr.shape[0])
203 lda = ct.c_int(Ar.shape[0])
204 ldb = ct.c_int(Br.shape[0])
205 ldc = ct.c_int(Cr.shape[0])
206 scale = np.zeros(Ar.shape[1], dtype=np.float64, order='F')
207 info = ct.c_int()
208 maxred_ = ct.c_double(maxred)
209 slicot.tb01id_(job, ct.byref(n), ct.byref(m), ct.byref(p), ct.byref(maxred_),
210 Ar, ct.byref(lda), Br, ct.byref(ldb), Cr, ct.byref(ldc),
211 scale, ct.byref(info))
212 if info.value != 0:
213 if info.value < 0:
214 raise ValueError("%dth input argument is illegal" % -info.value())
215 raise ValueError("unknown error value %d" % info.value)
216 return Ar, Br, Cr, maxred_.value, scale
217
218 ################################################################
219 ## TB01WD
220 ##
221 slicot.tb01wd_.restype = None
222 slicot.tb01wd_.argtypes = [
223 ct.POINTER(ct.c_int), #N,
224 ct.POINTER(ct.c_int), #M,
225 ct.POINTER(ct.c_int), #P,
226 c_mat(True), #A,
227 ct.POINTER(ct.c_int), #LDA,
228 c_mat(True), #B,
229 ct.POINTER(ct.c_int), #LDB,
230 c_mat(True), #C,
231 ct.POINTER(ct.c_int), #LDC,
232 c_mat(True), #U,
233 ct.POINTER(ct.c_int), #LDU,
234 c_arr(True), #WR,
235 c_arr(True), #WI,
236 c_arr(True), #DWORK,
237 ct.POINTER(ct.c_int), #LDWORK,
238 ct.POINTER(ct.c_int), #INFO
239 ]
240
241 def tb01wd(A, B, C):
242 Ar = np.array(A, dtype=np.float64, order='F', copy=True)
243 Br = np.array(B, dtype=np.float64, order='F', copy=True)
244 Cr = np.array(C, dtype=np.float64, order='F', copy=True)
245 n = ct.c_int(Ar.shape[0])
246 m = ct.c_int(Br.shape[1])
247 p = ct.c_int(Cr.shape[0])
248 lda = ct.c_int(Ar.shape[0])
249 ldb = ct.c_int(Br.shape[0])
250 ldc = ct.c_int(Cr.shape[0])
251 U = np.zeros_like(Ar)
252 ldu = ct.c_int(Ar.shape[0])
253 WR = np.zeros(Ar.shape[0], dtype=np.float64, order='F')
254 WI = np.zeros(Ar.shape[0], dtype=np.float64, order='F')
255 dwork = np.zeros(Ar.shape[0] * 5, dtype=np.float64, order='F')
256 ldwork = ct.c_int(dwork.shape[0])
257 info = ct.c_int()
258 slicot.tb01wd_(
259 ct.byref(n), ct.byref(m), ct.byref(p),
260 Ar, ct.byref(lda), Br, ct.byref(ldb), Cr, ct.byref(ldc), U, ct.byref(ldu),
261 WR, WI, dwork, ct.byref(ldwork), ct.byref(info))
262 if info.value != 0:
263 if info.value < 0:
264 raise ValueError("%dth input argument is illegal" % -info.value())
265 raise ValueError("not all eigenvalues computed (%d not computed)" % info.value)
266 return Ar, Br, Cr, U, WR, WI
0 v 20121123 2
1 C 40000 40000 0 0 0 title-B.sym
2 N 48800 46600 48800 45800 4
3 {
4 T 48900 46000 5 10 1 1 0 0 1
5 netname=6
6 }
7 C 48100 44600 1 0 0 ground.sym
8 C 45700 48400 1 0 0 input-1.sym
9 {
10 T 45700 48700 5 10 0 0 0 0 1
11 device=INPUT
12 T 45400 48400 5 10 1 1 0 0 1
13 refdes=IN1
14 }
15 C 49500 48400 1 0 0 output-1.sym
16 {
17 T 49600 48700 5 10 0 0 0 0 1
18 device=OUTPUT
19 T 50300 48400 5 10 1 1 0 0 1
20 refdes=OUT1
21 }
22 T 46200 47300 8 10 0 1 0 0 1
23 netname=GND
24 T 44000 45000 8 10 0 1 0 0 1
25 netname=GND
26 C 47100 48300 1 0 0 capacitor-1.sym
27 {
28 T 47300 49000 5 10 0 0 0 0 1
29 device=CAPACITOR
30 T 47200 48800 5 10 1 1 0 0 1
31 refdes=C1
32 T 47300 49200 5 10 0 0 0 0 1
33 symversion=0.1
34 T 47600 48800 5 10 1 1 0 0 1
35 value=250p
36 }
37 C 47100 46900 1 0 0 capacitor-1.sym
38 {
39 T 47300 47600 5 10 0 0 0 0 1
40 device=CAPACITOR
41 T 47200 47400 5 10 1 1 0 0 1
42 refdes=C2
43 T 47300 47800 5 10 0 0 0 0 1
44 symversion=0.1
45 T 47600 47400 5 10 1 1 0 0 1
46 value=20n
47 }
48 C 47100 45200 1 0 0 capacitor-1.sym
49 {
50 T 47300 45900 5 10 0 0 0 0 1
51 device=CAPACITOR
52 T 47300 45700 5 10 1 1 0 0 1
53 refdes=C3
54 T 47300 46100 5 10 0 0 0 0 1
55 symversion=0.1
56 T 47600 45700 5 10 1 1 0 0 1
57 value=20n
58 }
59 N 46900 45400 46900 47400 4
60 {
61 T 46700 47100 5 10 1 1 0 0 1
62 netname=2
63 }
64 C 48200 47400 1 270 1 resistor-variable-2.sym
65 {
66 T 48550 48200 5 10 1 1 180 6 1
67 refdes=P1
68 T 49100 48200 5 10 0 1 90 2 1
69 device=VARIABLE_RESISTOR
70 T 48600 47800 5 10 1 1 180 6 1
71 value=value=250k,var=t
72 }
73 C 48400 44900 1 90 0 resistor-variable-2.sym
74 {
75 T 48750 45600 5 10 1 1 180 0 1
76 refdes=P3
77 T 47500 45700 5 10 0 1 90 0 1
78 device=VARIABLE_RESISTOR
79 T 48500 45200 5 10 1 1 0 0 1
80 value=value=25k,var=m
81 }
82 C 48200 47100 1 270 0 resistor-variable-2.sym
83 {
84 T 48450 46900 5 10 1 1 0 0 1
85 refdes=P2
86 T 49100 46300 5 10 0 1 270 0 1
87 device=VARIABLE_RESISTOR
88 T 48500 46700 5 10 1 1 0 0 1
89 value=value=1M,var=l
90 }
91 N 47800 45400 48000 45400 4
92 {
93 T 47800 45200 5 10 1 1 0 0 1
94 netname=5
95 }
96 N 48300 48500 48000 48500 4
97 {
98 T 48200 48600 5 10 1 1 0 0 1
99 netname=3
100 }
101 N 48000 47100 48300 47100 4
102 {
103 T 48100 47200 5 10 1 1 0 0 1
104 netname=4
105 }
106 N 47100 47100 46900 47100 4
107 N 46500 48500 47100 48500 4
108 {
109 T 46600 48600 5 10 1 1 0 0 1
110 netname=1
111 }
112 N 47100 45400 46900 45400 4
113 N 48300 47100 48300 47400 4
114 N 48800 45800 48300 45800 4
115 N 46900 48500 46900 48300 4
116 N 48300 48300 48300 48500 4
117 N 49200 48500 49200 47900 4
118 {
119 T 49300 48100 5 10 1 1 0 0 1
120 netname=7
121 }
122 N 48800 47900 49200 47900 4
123 N 49200 48500 49500 48500 4
124 C 47000 47400 1 90 0 resistor-2.sym
125 {
126 T 46650 47800 5 10 0 0 90 0 1
127 device=RESISTOR
128 T 46700 48100 5 10 1 1 180 0 1
129 refdes=R4
130 T 46400 47700 5 10 1 1 0 0 1
131 value=56k
132 }
0 v 20110115 2
1 C 40000 40000 0 0 0 title-B.sym
2 C 48500 45100 1 270 0 resistor-2.sym
3 {
4 T 48850 44700 5 10 0 0 270 0 1
5 device=RESISTOR
6 T 48800 44800 5 10 1 1 0 0 1
7 refdes=Rk
8 T 48800 44600 5 10 1 1 0 0 1
9 value=2k7
10 }
11 C 48300 48600 1 270 0 resistor-2.sym
12 {
13 T 48650 48200 5 10 0 0 270 0 1
14 device=RESISTOR
15 T 48600 48200 5 10 1 1 0 0 1
16 refdes=Ra
17 T 48600 48000 5 10 1 1 0 0 1
18 value=100k
19 }
20 C 46000 44000 1 0 0 triode.sym
21 {
22 T 48800 46800 5 10 1 1 0 0 1
23 refdes=U1
24 T 48700 46500 5 10 1 1 0 0 1
25 value=12ax7
26 T 48400 46100 5 10 0 1 0 0 1
27 device=TRIODE
28 }
29 C 46300 45900 1 0 0 input-1.sym
30 {
31 T 46300 46200 5 10 0 0 0 0 1
32 device=INPUT
33 T 46427 45934 5 10 1 1 0 0 1
34 refdes=Vin
35 }
36 N 47100 46000 47600 46000 4
37 C 48500 43500 1 0 0 gnd-1.sym
38 N 49800 47300 48400 47300 4
39 C 48200 48800 1 0 0 generic-power-1.sym
40 {
41 T 48400 49000 5 10 0 1 0 0 1
42 device=POWER
43 T 48732 49049 5 10 1 1 0 0 1
44 value=385V
45 T 48209 49052 5 10 1 1 0 0 1
46 refdes=Vpp
47 }
48 C 49800 47200 1 0 0 output-1.sym
49 {
50 T 49900 47500 5 10 0 0 0 0 1
51 device=OUTPUT
52 T 50089 47237 5 10 1 1 0 0 1
53 refdes=Vout
54 }
55 N 48600 43800 48600 44200 4
56 N 48600 45100 48600 45300 4
57 N 48400 48800 48400 48600 4
58 N 48400 46800 48400 47700 4
0 load_schema = "triode.sch"
1 input_signal = 10 * sweep(startfreq=30, stopfreq=20000, timespan=1)
2 maxerr = 1e-5
3 spline_order = [[4]]
4 basegrid = [[256]]
5 #test_signal = 10 * sine_signal(freq=100)
0 v 20110115 2
1 C 40000 40000 0 0 0 title-B.sym
2 C 42700 46800 1 180 0 resistor-2.sym
3 {
4 T 42300 46450 5 10 0 0 180 0 1
5 device=RESISTOR
6 T 42216 46534 5 10 1 1 180 0 1
7 refdes=R1
8 T 42300 46400 5 10 1 1 0 0 1
9 value=68k
10 }
11 C 44400 46000 1 270 0 resistor-2.sym
12 {
13 T 44750 45600 5 10 0 0 270 0 1
14 device=RESISTOR
15 T 44700 45700 5 10 1 1 0 0 1
16 refdes=R3
17 T 44700 45500 5 10 1 1 0 0 1
18 value=390
19 }
20 C 44400 48400 1 270 0 resistor-2.sym
21 {
22 T 44750 48000 5 10 0 0 270 0 1
23 device=RESISTOR
24 T 44700 48000 5 10 1 1 0 0 1
25 refdes=R2
26 T 44700 47800 5 10 1 1 0 0 1
27 value=22k
28 }
29 C 46400 44700 1 90 0 resistor-2.sym
30 {
31 T 46050 45100 5 10 0 0 90 0 1
32 device=RESISTOR
33 T 46800 45300 5 10 1 1 180 0 1
34 refdes=R7
35 T 46800 45100 5 10 1 1 180 0 1
36 value=33k
37 }
38 C 48200 46000 1 270 0 resistor-2.sym
39 {
40 T 48550 45600 5 10 0 0 270 0 1
41 device=RESISTOR
42 T 48500 45600 5 10 1 1 0 0 1
43 refdes=R8
44 T 48500 45400 5 10 1 1 0 0 1
45 value=82k
46 }
47 C 43600 46000 1 270 0 resistor-2.sym
48 {
49 T 43950 45600 5 10 0 0 270 0 1
50 device=RESISTOR
51 T 43200 45600 5 10 1 1 0 0 1
52 refdes=R6
53 T 43200 45400 5 10 1 1 0 0 1
54 value=1k5
55 }
56 C 53700 43900 1 270 0 resistor-2.sym
57 {
58 T 54050 43500 5 10 0 0 270 0 1
59 device=RESISTOR
60 T 54000 43600 5 10 1 1 0 0 1
61 refdes=R9
62 T 54300 43400 5 10 1 1 180 0 1
63 value=10k
64 }
65 C 45500 47100 1 270 0 resistor-2.sym
66 {
67 T 45850 46700 5 10 0 0 270 0 1
68 device=RESISTOR
69 T 45800 46700 5 10 1 1 0 0 1
70 refdes=R4
71 T 45800 46400 5 10 1 1 0 0 1
72 value=470k
73 }
74 C 50800 45000 1 0 0 resistor-2.sym
75 {
76 T 51200 45350 5 10 0 0 0 0 1
77 device=RESISTOR
78 T 51200 45400 5 10 1 1 180 0 1
79 refdes=R5
80 T 51700 45400 5 10 1 1 180 0 1
81 value=470k
82 }
83 C 53700 46800 1 270 0 resistor-2.sym
84 {
85 T 54050 46400 5 10 0 0 270 0 1
86 device=RESISTOR
87 T 54000 46400 5 10 1 1 0 0 1
88 refdes=R10
89 T 54000 46200 5 10 1 1 0 0 1
90 value=1k
91 }
92 C 42800 46500 1 0 0 capacitor-1.sym
93 {
94 T 43000 47200 5 10 0 0 0 0 1
95 device=CAPACITOR
96 T 43100 47000 5 10 1 1 0 0 1
97 refdes=C1
98 T 43000 47400 5 10 0 0 0 0 1
99 symversion=0.1
100 T 43100 46300 5 10 1 1 0 0 1
101 value=10n
102 }
103 C 47100 46000 1 270 0 capacitor-1.sym
104 {
105 T 47800 45800 5 10 0 0 270 0 1
106 device=CAPACITOR
107 T 47600 45700 5 10 1 1 0 0 1
108 refdes=C2
109 T 48000 45800 5 10 0 0 270 0 1
110 symversion=0.1
111 T 47600 45500 5 10 1 1 0 0 1
112 value=4.7
113 }
114 C 49100 44000 1 0 0 capacitor-1.sym
115 {
116 T 49300 44700 5 10 0 0 0 0 1
117 device=CAPACITOR
118 T 49400 44500 5 10 1 1 180 0 1
119 refdes=C3
120 T 49300 44900 5 10 0 0 0 0 1
121 symversion=0.1
122 T 50100 44500 5 10 1 1 180 0 1
123 value=10n
124 }
125 C 49800 47000 1 0 0 capacitor-1.sym
126 {
127 T 50000 47700 5 10 0 0 0 0 1
128 device=CAPACITOR
129 T 49800 47400 5 10 1 1 0 0 1
130 refdes=C4
131 T 50000 47900 5 10 0 0 0 0 1
132 symversion=0.1
133 T 50400 47400 5 10 1 1 0 0 1
134 value=220n
135 }
136 C 51900 46400 1 0 0 capacitor-1.sym
137 {
138 T 52100 47100 5 10 0 0 0 0 1
139 device=CAPACITOR
140 T 52200 46900 5 10 1 1 0 0 1
141 refdes=C5
142 T 52100 47300 5 10 0 0 0 0 1
143 symversion=0.1
144 T 52500 46700 5 10 1 1 0 0 1
145 value=220n
146 }
147 C 47700 44700 1 0 0 gnd-1.sym
148 C 53700 42700 1 0 0 gnd-1.sym
149 C 51200 45800 1 0 0 gnd-1.sym
150 C 40900 46600 1 0 0 input-1.sym
151 {
152 T 40900 46900 5 10 0 0 0 0 1
153 device=INPUT
154 T 41027 46634 5 10 1 1 0 0 1
155 refdes=Vin
156 }
157 C 44400 44700 1 0 0 gnd-1.sym
158 N 44500 47200 49800 47200 4
159 {
160 T 44700 47300 5 10 1 1 0 0 1
161 netname=4
162 }
163 C 49000 48900 1 0 0 generic-power-1.sym
164 {
165 T 49200 49100 5 10 0 1 0 0 1
166 device=POWER
167 T 49532 49149 5 10 1 1 0 0 1
168 value=8.15V
169 T 49009 49152 5 10 1 1 0 0 1
170 refdes=Vcc
171 }
172 C 54900 47100 1 0 0 output-1.sym
173 {
174 T 55000 47400 5 10 0 0 0 0 1
175 device=OUTPUT
176 T 55189 47137 5 10 1 1 0 0 1
177 refdes=Vout
178 }
179 N 44500 45000 44500 45100 4
180 N 43700 44200 43700 45100 4
181 N 44500 46000 44500 46200 4
182 {
183 T 44600 46100 5 10 1 1 0 0 1
184 netname=5
185 }
186 N 49200 48900 49200 48600 4
187 {
188 T 49000 48800 5 10 1 1 0 0 1
189 netname=13
190 }
191 N 53800 48600 53800 46800 4
192 N 53800 45600 53800 45900 4
193 {
194 T 53900 45700 5 10 1 1 0 0 1
195 netname=11
196 }
197 N 50700 47200 54900 47200 4
198 {
199 T 51300 47300 5 10 1 1 0 0 1
200 netname=8
201 }
202 N 44500 47200 44500 47500 4
203 C 51200 46100 1 270 1 resistor-variable-2.sym
204 {
205 T 50810 46798 5 10 1 1 180 6 1
206 refdes=P1
207 T 52100 46900 5 10 0 1 90 2 1
208 device=VARIABLE_RESISTOR
209 T 50800 46600 5 10 0 1 180 6 1
210 value=value=100k,var=hotpotz,inv=1,name=HotpotZ,a=5
211 T 50800 46600 5 10 1 1 180 6 2
212 comment=100k
213 Log.
214 }
215 C 44000 46200 1 0 0 npn-2.sym
216 {
217 T 44600 46700 5 10 0 0 0 0 1
218 device=NPN_TRANSISTOR
219 T 44600 46700 5 10 1 1 0 0 1
220 refdes=T1
221 T 44200 46800 5 10 0 1 0 0 1
222 value=Vt=26mV,Is=20.3fA,Bf=1430,Br=4
223 T 44600 46500 5 10 1 1 0 0 1
224 model-name=MPSA18
225 }
226 N 43700 46700 43700 46000 4
227 N 44000 46700 43700 46700 4
228 {
229 T 43800 46800 5 10 1 1 0 0 1
230 netname=3
231 }
232 C 45700 45100 1 90 0 inductor-1.sym
233 {
234 T 45200 45300 5 10 0 0 90 0 1
235 device=INDUCTOR
236 T 45900 45800 5 10 1 1 180 0 1
237 refdes=L1
238 T 45000 45300 5 10 0 0 90 0 1
239 symversion=0.1
240 T 45700 45400 5 10 1 1 0 0 1
241 value=0.5H
242 }
243 N 45600 46200 45600 46000 4
244 N 45600 46000 48300 46000 4
245 {
246 T 46300 46100 5 10 1 1 0 0 1
247 netname=6
248 }
249 N 43700 44200 49100 44200 4
250 {
251 T 45600 43900 5 10 1 1 0 0 1
252 netname=7
253 }
254 N 46300 44200 46300 44700 4
255 N 47300 45100 48300 45100 4
256 N 47800 45100 47800 45000 4
257 N 49800 47200 49800 45100 4
258 N 49800 45100 50800 45100 4
259 N 51300 47200 51300 47000 4
260 C 53300 44600 1 0 0 npn-2.sym
261 {
262 T 53900 45100 5 10 0 0 0 0 1
263 device=NPN_TRANSISTOR
264 T 53900 45100 5 10 1 1 0 0 1
265 refdes=T2
266 T 53500 45300 5 10 0 1 0 0 1
267 value=Vt=26mV,Is=20.3fA,Bf=1430,Br=4
268 T 53900 44900 5 10 1 1 0 0 1
269 model-name=MPSA18
270 }
271 N 51700 45100 53300 45100 4
272 {
273 T 52700 44900 5 10 1 1 0 0 1
274 netname=10
275 }
276 N 52800 45100 52800 46600 4
277 N 50000 44200 53800 44200 4
278 N 53800 43900 53800 44600 4
279 {
280 T 53900 44200 5 10 1 1 0 0 1
281 netname=12
282 }
283 N 53800 48600 44500 48600 4
284 N 44500 48600 44500 48400 4
285 N 46300 46000 46300 45600 4
286 N 45600 47200 45600 47100 4
287 N 42700 46700 42800 46700 4
288 {
289 T 42700 46800 5 10 1 1 0 0 1
290 netname=2
291 }
292 N 41700 46700 41800 46700 4
293 {
294 T 41700 46800 5 10 1 1 0 0 1
295 netname=1
296 }
297 N 51900 46600 51800 46600 4
298 {
299 T 51800 46600 5 10 1 1 0 0 1
300 netname=9
301 }
302 C 45700 44200 1 90 0 resistor-2.sym
303 {
304 T 45350 44600 5 10 0 0 90 0 1
305 device=RESISTOR
306 T 46000 44800 5 10 1 1 180 0 1
307 refdes=RL
308 T 46000 44600 5 10 1 1 180 0 1
309 value=60
310 }
0 CXXFLAGS=-O2 -fPIC -fvisibility=hidden
1 #CXXFLAGS=-g
2 INTPP_OPT=-msse2 -mfpmath=sse -ffast-math
3 LDFLAGS=-fPIC
4
5 DSP2CC = ../dsp2cc
6 GXHEAD = ../../src/headers
7
8 .PHONY: clean all
9
10 all: pyamp.so gxplugins.so
11
12 clean:
13 rm -f gxplugins.so gxplugins_.so data.o intpp.o intpp_.o intpp.gcda intpp_.gcda
14 rm -f gx_poweramp.o gxpoweramp.cc gxpreamp.cc data.cc intpp_inst.cc data.h
15 rm -f pyamp.so pyamp.cpp
16 rm -f circuit/components.pyc circuit/__init__.pyc circuit/pycircuit.so
17 rm -rf circuit/build
18 make -C tensbs clean
19
20 install: gxplugins.so
21 cp gxplugins.so $(HOME)/.config/guitarix/plugins
22
23 gxplugins.so: gx_poweramp.o intpp.o data.o
24 $(LINK.cc) -shared -Wl,-soname,gxplugins.so -o gxplugins.so $^ -lzita-resampler
25
26 gx_poweramp.o: gx_poweramp.cpp gxpoweramp.cc gxpreamp.cc data.cc intpp.h
27 $(COMPILE.cc) $(CXXFLAGS) `pkg-config --cflags glibmm-2.4` -I$(GXHEAD) $< -o $@
28
29 gxpoweramp.cc: gxpoweramp.dsp gxpreamp.dsp $(DSP2CC)
30 $(DSP2CC) -i plugin gxpoweramp.dsp > $@
31
32 gxpreamp.cc: gxpreamp.dsp $(DSP2CC)
33 $(DSP2CC) -i plugin gxpreamp.dsp > $@
34
35 intpp.o: intpp.cc data.cc intpp.h Makefile intpp.gcda
36 $(COMPILE.cc) $(CXXFLAGS) $(INTPP_OPT) -fprofile-use $< -o $@
37 # $(COMPILE.cc) $(CXXFLAGS) $(INTPP_OPT) $< -o $@
38
39 intpp.gcda: gxplugins_.so exercise.py
40 python exercise.py
41 @mv intpp_.gcda intpp.gcda
42
43 intpp_.o: intpp.cc intpp.h intpp_inst.cc Makefile
44 $(COMPILE.cc) $(CXXFLAGS) $(INTPP_OPT) -fprofile-arcs $< -o $@
45
46 gxplugins_.so: gx_poweramp.o intpp_.o data.o
47 $(LINK.cc) -fprofile-arcs -shared -Wl,-soname,gxplugins_.so -o gxplugins_.so $^ -lzita-resampler
48
49 data.cc: gentables.py circuit/components.py circuit/pycircuit.so # tensbs/tensbs.so tensbs/splinetable.py
50 python $< data.cc intpp_inst.cc data.h
51
52 circuit/pycircuit.so: circuit/circuit.cc circuit/circuit.hpp circuit/pycircuit.pyx circuit/setup.py
53 cd circuit && rm -f pycircuit.so && python setup.py build_ext --inplace && rm pycircuit.cpp
54
55 tensbs/tensbs.so:
56 cd tensbs && make
57
58 pyamp.so: pyamp.pyx intpp.o data.o
59 @rm -f pyamp.so
60 python setup.py build_ext --inplace
0 import numpy as np
1 from components import *
2
3 class Func(object):
4
5 def __init__(self, circ):
6 self.circ = circ()
7 self.circ.init()
8 self.var_names = self.circ.var_names
0 #include <stdio.h>
1 #include <stdlib.h>
2 #include <cassert>
3 #include <math.h>
4 #include <sys/types.h>
5 #include <sys/stat.h>
6 #include <fcntl.h>
7 #include <sys/mman.h>
8 #include <unistd.h>
9 #include <kinsol/kinsol.h>
10 #include <kinsol/kinsol_dense.h>
11 #include <nvector/nvector_serial.h>
12 #include <sundials/sundials_types.h>
13 #include <sundials/sundials_math.h>
14 #include "circuit.hpp"
15
16 #define DOUBLE_UPDATE false
17
18 //#define FTOL RCONST(1.e-7) /* function tolerance */
19 //#define STOL RCONST(1.e-5) /* step tolerance */
20 #define FTOL RCONST(1.e-11) /* function tolerance */
21 #define STOL RCONST(1.e-9) /* step tolerance */
22
23 #define ZERO RCONST(0.0)
24 #define ONE RCONST(1.0)
25
26 static void print_vec(const char *t, N_Vector v) {
27 printf("%s =", t);
28 for (int i = 0; i < NV_LENGTH_S(v); i++) {
29 printf(" %g", Ith(v, i));
30 }
31 printf("\n");
32 }
33
34 /*
35 * Check function return value...
36 * opt == 0 means SUNDIALS function allocates memory so check if
37 * returned NULL pointer
38 * opt == 1 means SUNDIALS function returns a flag so check if
39 * flag >= 0
40 * opt == 2 means function allocates memory so check if returned
41 * NULL pointer
42 */
43
44 static int check_flag(void *flagvalue, const char *funcname, int opt)
45 {
46 int *errflag;
47
48 /* Check if SUNDIALS function returned NULL pointer - no memory allocated */
49 if (opt == 0 && flagvalue == NULL) {
50 fprintf(stderr,
51 "\nSUNDIALS_ERROR: %s() failed - returned NULL pointer\n\n",
52 funcname);
53 return(1);
54 }
55
56 /* Check if flag < 0 */
57 else if (opt == 1) {
58 errflag = (int *) flagvalue;
59 if (*errflag < 0) {
60 fprintf(stderr,
61 "\nSUNDIALS_ERROR: %s() failed with flag = %d\n\n",
62 funcname, *errflag);
63 return(1);
64 }
65 }
66
67 /* Check if function returned NULL pointer - no memory allocated */
68 else if (opt == 2 && flagvalue == NULL) {
69 fprintf(stderr,
70 "\nMEMORY_ERROR: %s() failed - returned NULL pointer\n\n",
71 funcname);
72 return(1);
73 }
74
75 return(0);
76 }
77
78 /*
79 * Print final statistics contained in iopt
80 */
81
82 static void PrintFinalStats(void *kmem)
83 {
84 long int nni, nfe, nje, nfeD;
85 int flag;
86
87 flag = KINGetNumNonlinSolvIters(kmem, &nni);
88 check_flag(&flag, "KINGetNumNonlinSolvIters", 1);
89 flag = KINGetNumFuncEvals(kmem, &nfe);
90 check_flag(&flag, "KINGetNumFuncEvals", 1);
91
92 flag = KINDlsGetNumJacEvals(kmem, &nje);
93 check_flag(&flag, "KINDlsGetNumJacEvals", 1);
94 flag = KINDlsGetNumFuncEvals(kmem, &nfeD);
95 check_flag(&flag, "KINDlsGetNumFuncEvals", 1);
96
97 printf("Final Statistics:\n");
98 printf(" nni = %5ld nfe = %5ld \n", nni, nfe);
99 printf(" nje = %5ld nfeD = %5ld \n", nje, nfeD);
100 }
101
102
103 /****************************************************************
104 * Spline
105 *
106 * http://www.thefullwiki.org/Spline_(mathematics)
107 */
108
109 Spline::Spline(double *y, int n, double xstart, double h):
110 count(n), x0(xstart), step(h), c(new double[n]), f(y)
111 {
112 double *z = new double[n-1];
113 double *mu = new double[n-1];
114 double l = 1;
115 mu[0] = 0.0;
116 z[0] = 0.0;
117 for (int i = 1; i < n-1; i++) {
118 l = 4 - mu[i-1];
119 mu[i] = 1 / l;
120 z[i] = (3 * (y[i+1]-2*y[i]+y[i-1]) - z[i-1]) / l;
121 }
122 c[n-1] = 0.0;
123 for (int i = n-2; i >= 0; i--) {
124 c[i] = z[i] - mu[i] * c[i+1];
125 }
126 delete[] z;
127 delete[] mu;
128 }
129
130 Spline::~Spline()
131 {
132 delete c;
133 }
134
135 double Spline::eval(double x)
136 {
137 x = (x - x0) / step;
138 int i = static_cast<int>(x);
139 if (i < 0) {
140 i = 0;
141 x = 0.0;
142 } else if (i >= count-1) {
143 i = count-2;
144 x = 1.0;
145 } else {
146 x = x - i;
147 }
148 double b = (f[i+1]-f[i]) - (c[i+1]+2*c[i])/3;
149 return ((((c[i+1]-c[i])/3 * x + c[i]) * x) + b) * x + f[i];
150 }
151
152 /****************************************************************
153 * Grid
154 */
155
156 Grid::Grid(int d, Dim *v, int n)
157 {
158 vals = n;
159 ndim = d;
160 dim = v;
161 weight = new double[ndim];
162 idx = new int[ndim];
163 idx2 = new int[ndim];
164 p2dim = 1;
165 for (int i = 0; i < ndim; i++) p2dim *= 2;
166 pts = new double[vals*p2dim];
167 grid = 0;
168 }
169
170 Grid::~Grid()
171 {
172 delete[] weight;
173 delete[] idx;
174 delete[] idx2;
175 delete[] pts;
176 }
177
178 int Grid::calc_strides()
179 {
180 int sz = vals;
181 for (Dim *p = dim+ndim; --p >= dim; ) {
182 p->stride = sz;
183 sz *= p->size;
184 }
185 return sz;
186 }
187
188 inline float *Grid::cell(int *ix)
189 {
190 float *p = grid;
191 for (int i = 0; i < ndim; i++) {
192 p += ix[i] * dim[i].stride;
193 }
194 return p;
195 }
196
197 /****************************************************************
198 * Cube
199 */
200
201 Cube::Cube(int d, Dim *v, int n, int *ix, int n_in_, ComponentBase& cb_, N_Vector u0, const char *fname)
202 : Grid(d, v, n),
203 cb(cb_),
204 mmap_size(0),
205 n_in(n_in_) {
206 grid = 0;
207 int sz = calc_strides();
208 if (fname) {
209 int fd = open(fname, O_RDONLY);
210 if (fd >= 0) {
211 struct stat attr;
212 if (fstat(fd, &attr) >= 0) {
213 if (attr.st_size == sz*(int)sizeof(float)) {
214 void *addr = mmap(0, attr.st_size, PROT_READ, MAP_SHARED, fd, 0);
215 if (addr != (void*)-1) {
216 grid = static_cast<float*>(addr);
217 mmap_size = attr.st_size;
218 }
219 }
220 }
221 }
222 }
223 if (!grid) {
224 grid = new float[sz];
225 N_Vector x = N_VNew_Serial(ndim);
226 for (int i = 0; i < ndim; i++) {
227 idx[i] = 0;
228 Ith(x,i) = dim[i].lower;
229 }
230 fill(ndim, ix, x, u0);
231 N_VDestroy_Serial(x);
232 if (fname) {
233 int fd = creat(fname, 0666);
234 if (fd < 0) {
235 fprintf(stderr, "open %s for writing failed\n", fname);
236 } else {
237 if (write(fd, grid, sz*sizeof(float)) != sz*(int)sizeof(float)) {
238 fprintf(stderr, "write to %s failed\n", fname);
239 } else {
240 printf("written mmap file %s\n", fname);
241 }
242 close(fd);
243 }
244 }
245 }
246 }
247
248 Cube::~Cube()
249 {
250 if (mmap_size) {
251 munmap(grid, mmap_size);
252 } else {
253 delete[] grid;
254 }
255 }
256
257 int Cube::fill(int n, int *ix, N_Vector x, N_Vector u0)
258 {
259 N_Vector u = N_VNew_Serial(vals);
260 N_VScale_Serial(ONE, u0, u);
261 for (int i = 0; i < dim[*ix].size; i++) {
262 idx[*ix] = i;
263 Ith(x,*ix) = dim[*ix].point(i);
264 if (n > 1) {
265 fill(n-1, ix+1, x, u);
266 } else {
267 //printf("-> "); N_VPrint_Serial(u); N_VPrint_Serial(x);
268 if (cb.findzero(NV_DATA_S(x), NV_DATA_S(x)+n_in, u)) {
269 print_vec("fill error at", x);
270 N_VDestroy_Serial(u);
271 return 1;
272 }
273 //printf("<- "); N_VPrint_Serial(u);
274 float *p = cell(idx);
275 for (int j = 0; j < vals; j++) {
276 p[j] = Ith(u,j);
277 }
278 }
279 if (i == 0) {
280 N_VScale_Serial(ONE,u,u0);
281 }
282 }
283 N_VDestroy_Serial(u);
284 return 0;
285 }
286
287 void Cube::startvalue(N_Vector x, N_Vector s, N_Vector u)
288 {
289 assert(NV_LENGTH_S(x)+NV_LENGTH_S(s) == ndim);
290 for (int i = 0; i < NV_LENGTH_S(x); i++) {
291 dim[i].index(Ith(x,i),idx[i],weight[i]);
292 }
293 for (int i = NV_LENGTH_S(x); i < ndim; i++) {
294 dim[i].index(Ith(s,i-NV_LENGTH_S(x)),idx[i],weight[i]);
295 }
296 for (int i = 0; i < p2dim; i++) {
297 for (int k = 0; k < ndim; k++) {
298 idx2[k] = idx[k];
299 if (i & (1 << k)) {
300 idx2[k] += 1;
301 }
302 }
303 float *p = cell(idx2);
304 for (int j = 0; j < vals; j++) {
305 pts[i*vals+j] = p[j];
306 }
307 }
308 int n = p2dim;
309 for (int i = 0; i < ndim; i++) {
310 double w = weight[i];
311 n /= 2;
312 for (int j = 0; j < n; j++) {
313 int b = j*vals;
314 for (int k = 0; k < vals; k++) {
315 pts[b+k] = pts[2*b+k] * (1-w) + pts[2*b+vals+k] * w;
316 }
317 }
318 }
319 for (int i = 0; i < vals; i++) {
320 Ith(u,i) = pts[i];
321 }
322 }
323
324 int Cube::calc(N_Vector x, N_Vector s, N_Vector u)
325 {
326 startvalue(x, s, u);
327 return cb.findzero(NV_DATA_S(x), NV_DATA_S(s), u);
328 }
329
330 /****************************************************************
331 ** class ComponentBase
332 */
333
334 ComponentBase::ComponentBase(int neq, int ndim, int nvals, int n_in, int n_out, int n_params_)
335 : NEQ(neq),
336 NDIM(ndim),
337 NVALS(nvals),
338 N_IN(n_in),
339 N_OUT(n_out),
340 n_params(n_params_),
341 params(new realtype[n_params_]),
342 param_names(new const char*[n_params_]),
343 in_names(new const char*[n_in]),
344 out_names(new const char*[n_out]),
345 state_names(new const char*[ndim-n_out]),
346 var_names(new const char*[neq]),
347 ix(new int[ndim]),
348 verbose(false),
349 ranges(new Dim[ndim]),
350 cube(0),
351 user_data(),
352 constraints(0),
353 Gco(params[0]),
354 Gcf(params[1]),
355 mu(params[2]),
356 Ex(params[3]),
357 Kg1(params[4]),
358 Kg2(params[5]),
359 Kp(params[6]),
360 Kvb(params[7]) {
361 const char *p[] = { "Gco", "Gcf", "mu", "Ex", "Kg1", "Kg2", "Kp", "Kvb", 0 };
362 set_names(param_names, p, param_off);
363 }
364
365 ComponentBase::~ComponentBase() {
366 delete[] params;
367 delete[] param_names;
368 delete[] in_names;
369 delete[] out_names;
370 delete[] state_names;
371 delete[] var_names;
372 delete[] ix;
373 delete[] ranges;
374 delete cube;
375 if (constraints) {
376 N_VDestroy_Serial(constraints);
377 }
378 }
379
380 int ComponentBase::set_range(int i, double lower, double upper, int size) {
381 if (i > NDIM) {
382 return 0;
383 }
384 ranges[i].lower = lower;
385 ranges[i].upper = upper;
386 ranges[i].size = size;
387 return 1;
388 }
389
390 void ComponentBase::init(N_Vector u0, const char* fname) {
391 N_Vector u = N_VNew_Serial(NEQ);
392 for (int i = 0; i < NEQ; i++) {
393 Ith(u,i) = Ith(u0,i);
394 }
395 delete cube;
396 cube = new Cube(NDIM, ranges, NEQ, ix, N_IN, *this, u, fname);
397 N_VDestroy_Serial(u);
398 }
399
400 //static
401 int ComponentBase::sfunc(N_Vector x, N_Vector u, void *data) {
402 ComponentBase *self = static_cast<ComponentBase*>(data);
403 return self->func(x, u, &self->user_data);
404 }
405
406 int ComponentBase::findzero(realtype *x, realtype *state, N_Vector u) {
407 int flag;
408
409 N_Vector s = N_VNew_Serial(NEQ);
410 if (check_flag((void *)s, "N_VNew_Serial", 0)) return 1;
411 N_VConst_Serial(ONE,s); /* no scaling */
412
413 realtype fnormtol = FTOL;
414 realtype scsteptol = STOL;
415
416 void *kmem = KINCreate();
417 if (check_flag((void *)kmem, "KINCreate", 0)) return 1;
418
419 user_data.inval = x;
420 user_data.state = state;
421 flag = KINSetUserData(kmem, this);
422 if (check_flag(&flag, "KINSetUserData", 1)) return flag;
423
424 if (constraints) {
425 flag = KINSetConstraints(kmem, constraints);
426 if (check_flag(&flag, "KINSetConstraints", 1)) {
427 return flag;
428 }
429 }
430
431 flag = KINSetFuncNormTol(kmem, fnormtol);
432 if (check_flag(&flag, "KINSetFuncNormTol", 1)) return flag;
433 flag = KINSetScaledStepTol(kmem, scsteptol);
434 if (check_flag(&flag, "KINSetScaledStepTol", 1)) return flag;
435
436 flag = KINInit(kmem, sfunc, u);
437 if (check_flag(&flag, "KINInit", 1)) return flag;
438
439 /* Call KINDense to specify the linear solver */
440
441 flag = KINDense(kmem, NEQ);
442 if (check_flag(&flag, "KINDense", 1)) return flag;
443
444 //flag = KINSetPrintLevel(kmem, 3);
445 //if (check_flag(&flag, "KINSetPrintLevel", 1)) return flag;
446
447 int glstr = KIN_NONE;
448 //int glstr = KIN_LINESEARCH;
449 int mset = 1;
450 flag = KINSetMaxSetupCalls(kmem, mset);
451 if (check_flag(&flag, "KINSetMaxSetupCalls", 1)) return flag;
452 flag = KINSol(kmem, u, glstr, s, s);
453 if (flag > 1) {
454 printf("res = %d\n", flag);
455 return flag;
456 }
457 if (check_flag(&flag, "KINSol", 1)) return flag;
458 if (verbose) {
459 PrintFinalStats(kmem);
460 }
461 N_VDestroy_Serial(s);
462 KINFree(&kmem);
463 user_data.inval = 0;
464 user_data.state = 0;
465 return 0;
466 }
467
468 void ComponentBase::startvalue(N_Vector x, N_Vector s, N_Vector u) {
469 cube->startvalue(x, s, u);
470 }
471
472 int ComponentBase::calc(N_Vector x, N_Vector s, N_Vector u) {
473 return cube->calc(x, s, u);
474 }
475
476 inline realtype ComponentBase::Ig(realtype Ugk) {
477 if (Ugk < Gco) {
478 return ZERO;
479 }
480 return Gcf*pow(Ugk-Gco,1.5);
481 }
482
483 inline realtype ComponentBase::Ia(realtype Ugk, realtype Uak) {
484 if (Uak < ZERO) {
485 return ZERO;
486 }
487 realtype E1;
488 realtype t = Kp*(1/mu+Ugk/sqrt(Kvb+Uak*Uak));
489 if (t > 500) {
490 E1 = Uak/Kp*t;
491 } else if (t < -500) {
492 return ZERO;
493 } else {
494 E1 = Uak/Kp*log(1+exp(t));
495 }
496 return pow(E1,Ex) / Kg1 * 2*(E1 > 0.0);
497 }
498
499 inline realtype ComponentBase::Iap(realtype Ug1k, realtype Ug2k, realtype Uak) {
500 realtype E1;
501 if (Ug2k <= 0.0) {
502 return ZERO;
503 }
504 realtype t = Kp*(1/mu+Ug1k/Ug2k);
505 if (t > 500) {
506 E1 = Ug2k/Kp*t;
507 } else if (t < -500) {
508 return ZERO;
509 } else {
510 E1 = Ug2k/Kp*log(1+exp(t));
511 }
512 return pow(E1,Ex)/Kg1 * 2*(E1 > 0.0) * atan(Uak/Kvb);
513 }
514
515 inline realtype ComponentBase::Is(realtype Ug1k, realtype Ug2k) {
516 realtype t = Ug2k/mu+Ug1k;
517 if (t < 0) {
518 return ZERO;
519 }
520 return exp(Ex*log(t))/Kg2;
521 }
522
523
524 /****************************************************************
525 ** Components
526 */
527
528 TriodeCircuit::TriodeCircuit()
529 : ComponentBase(3+2, 2, 2, 1, 1, param_off+8),
530 Ck(params[param_off+0]),
531 G1(params[param_off+1]),
532 G2(params[param_off+2]),
533 Gg(params[param_off+3]),
534 Gk(params[param_off+4]),
535 Ga(params[param_off+5]),
536 Gl(params[param_off+6]),
537 Un(params[param_off+7]) {
538 const char *p_names[] = {
539 "Ck", "G1", "G2", "Gg", "Gk", "Ga", "Gl", "Un", 0 };
540 set_names(param_names+param_off, p_names, n_params-param_off);
541 static const char *i_names[] = { "Uin", 0 };
542 set_names(in_names, i_names, N_IN);
543 static const char *o_names[] = { "Ua", 0 };
544 set_names(out_names, o_names, N_OUT);
545 static const char *s_names[] = { "Uc1m", 0 };
546 set_names(state_names, s_names, NDIM-N_IN);
547 static const char *v_names[] = { "Ug", "Uk", "Ua", "l", "L", 0 };
548 set_names(var_names, v_names, NEQ);
549 ix[0] = 1;
550 ix[1] = 0;
551 constraints = N_VNew_Serial(NEQ);
552 Ith(constraints,0) = ZERO; /* no constraint on f1 */
553 Ith(constraints,1) = ZERO; /* no constraint on f2 */
554 Ith(constraints,2) = ZERO; /* no constraint on f3 */
555 Ith(constraints,3) = ONE; /* l = Ua - Uk >= 0 */
556 Ith(constraints,4) = -ONE; /* L = Ua - Un <= 0 */
557 }
558
559 void TriodeCircuit::update(N_Vector y, N_Vector x, N_Vector state) {
560 realtype *fdata = NV_DATA_S(y);
561 realtype Uk = fdata[1];
562 realtype Uc1m = Uk;
563 if (DOUBLE_UPDATE) {
564 realtype Ug = fdata[0];
565 realtype Ua = fdata[2];
566 Uc1m = Uc1m - (Uk*Gk - Ia(Ug-Uk,Ua-Uk) - Ig(Ug-Uk)) / (Ck*fs);
567 }
568 Ith(state,0) = Uc1m;
569 }
570
571 int TriodeCircuit::func(N_Vector u, N_Vector f, UserData *data) {
572 realtype *udata = NV_DATA_S(u);
573 realtype *fdata = NV_DATA_S(f);
574
575 //printf("-> %g,%g,%g,%g,%g\n", Ith(u,0), Ith(u,1), Ith(u,2), Ith(u,3), Ith(u,4));
576 realtype Ug = udata[0];
577 realtype Uk = udata[1];
578 realtype Ua = udata[2];
579 realtype l = udata[3];
580 realtype L = udata[4];
581 realtype Uc = Uk;
582
583 realtype Uin = data->inval[0];
584 realtype Uc1m = data->state[0];
585
586 realtype ia = Ia(Ug-Uk,Ua-Uk);
587 realtype ig = Ig(Ug-Uk);
588 fdata[0] = G2*(Uin*G1+Ug*G2)/(G1+Gg+G2)-Ug*G2-ig;
589 fdata[1] = Uc1m-Uc-(Uk*Gk-ia-ig)/(Ck*fs);
590 fdata[2] = Un*Ga-Ua*Ga-Ua*Gl-ia;
591 fdata[3] = l - (Ua - Uk);
592 fdata[4] = L - (Ua - Un);
593 //printf("<- %g,%g,%g,%g,%g\n", Ith(f,0), Ith(f,1), Ith(f,2), Ith(f,3), Ith(f,4));
594
595 return(0);
596 }
597
598
599 CoupledTriodeCircuit::CoupledTriodeCircuit()
600 : ComponentBase(7, 3, 3, 1, 1, param_off+13),
601 Ck(params[param_off+0]),
602 Ca(params[param_off+1]),
603 Un(params[param_off+2]),
604 G1(params[param_off+3]),
605 G2(params[param_off+4]),
606 Gg(params[param_off+5]),
607 Gk(params[param_off+6]),
608 Ga(params[param_off+7]),
609 G3(params[param_off+8]),
610 Gg2(params[param_off+9]),
611 Gk2(params[param_off+10]),
612 Ga2(params[param_off+11]),
613 Gl(params[param_off+12]) {
614 const char *p_names[] = {
615 "Ck", "Ca", "Un", "G1", "G2", "Gg", "Gk", "Ga", "G3", "Gg2", "Gk2", "Ga2", "Gl", 0 };
616 set_names(param_names+param_off, p_names, n_params-param_off);
617 static const char *i_names[] = { "Uin", 0 };
618 set_names(in_names, i_names, N_IN);
619 static const char *o_names[] = { "U2", 0 };
620 set_names(out_names, o_names, N_OUT);
621 static const char *s_names[] = { "Uc1m", "Uc2m", 0 };
622 set_names(state_names, s_names, NDIM-N_IN);
623 static const char *v_names[] = { "Ug", "Uk", "Ua", "U2", "Ug2", "Uk2", "Ua2", 0 };
624 set_names(var_names, v_names, NEQ);
625 ix[0] = 2;
626 ix[1] = 1;
627 ix[2] = 0;
628 }
629
630 void CoupledTriodeCircuit::update(N_Vector y, N_Vector x, N_Vector state)
631 {
632 realtype *fdata = NV_DATA_S(y);
633 realtype Uk = fdata[1];
634 realtype Ua = fdata[2];
635 realtype U2 = fdata[3];
636
637 realtype Uc1m = Uk;
638 realtype Uc2m = Ua-U2;
639
640 if (DOUBLE_UPDATE) {
641 realtype Ug = fdata[0];
642 realtype Ug2 = fdata[4];
643 realtype ia1 = Ia(Ug-Uk,Ua-Uk);
644 realtype ig1 = Ig(Ug-Uk);
645 Uc1m = Uc1m - (Uk*Gk-ia1-ig1) / (Ck*fs);
646 Uc2m = Uc2m + ((U2-Ug2)*G3) / (Ca*fs);
647 }
648 Ith(state,0) = Uc1m;
649 Ith(state,1) = Uc2m;
650 }
651
652 int CoupledTriodeCircuit::func(N_Vector u, N_Vector f, UserData *data) {
653 realtype *udata = NV_DATA_S(u);
654 realtype *fdata = NV_DATA_S(f);
655
656 //printf("<- %g,%g,%g,%g,%g,%g,%g\n", Ith(u,0), Ith(u,1), Ith(u,2), Ith(u,3), Ith(u,4), Ith(u,5), Ith(u,6));
657 realtype Ug = udata[0];
658 realtype Uk = udata[1];
659 realtype Ua = udata[2];
660 realtype U2 = udata[3];
661 realtype Ug2 = udata[4];
662 realtype Uk2 = udata[5];
663 realtype Ua2 = udata[6];
664 realtype Uc1 = Uk;
665 realtype Uc2 = Ua-U2;
666
667 realtype Uin = data->inval[0];
668 realtype Uc1m = data->state[0];
669 realtype Uc2m = data->state[1];
670
671 realtype ia1 = Ia(Ug-Uk,Ua-Uk);
672 realtype ig1 = Ig(Ug-Uk);
673 realtype ia2 = Ia(Ug2-Uk2,Ua2-Uk2);
674 realtype ig2 = Ig(Ug2-Uk2);
675 fdata[0] = G2*(Uin*G1+Ug*G2)/(G1+Gg+G2)-Ug*G2-ig1;
676 fdata[1] = Uc1m-Uc1-(Uk*Gk-ia1-ig1)/(Ck*fs);
677 fdata[2] = (Un-Ua)*Ga-ia1-(U2-Ug2)*G3;
678 fdata[3] = Uc2m-Uc2+((U2-Ug2)*G3)/(Ca*fs);
679 fdata[4] = (U2-Ug2)*G3-Ug2*Gg2-ig2;
680 fdata[5] = Uk2*Gk2-ia2-ig2;
681 fdata[6] = (Un-Ua2)*Ga2-Ua2*Gl-ia2;
682 //printf("<- %g,%g,%g,%g,%g,%g,%g\n", Ith(f,0), Ith(f,1), Ith(f,2), Ith(f,3), Ith(f,4), Ith(f,5), Ith(f,6));
683
684 return(0);
685 }
686
687
688 PowerAmpGate::PowerAmpGate()
689 : ComponentBase(3, 2, 2, 1, 1, param_off+5),
690 C1(params[param_off+0]),
691 G1(params[param_off+1]),
692 Gb(params[param_off+2]),
693 Gg(params[param_off+3]),
694 Ub(params[param_off+4]) {
695 const char *p_names[] = { "C1", "G1", "Gb", "Gg", "Ub", 0 };
696 set_names(param_names+param_off, p_names, n_params-param_off);
697 static const char *i_names[] = { "Uin", 0 };
698 set_names(in_names, i_names, N_IN);
699 static const char *o_names[] = { "Ug", 0 };
700 set_names(out_names, o_names, N_OUT);
701 static const char *s_names[] = { "Uc1m", 0 };
702 set_names(state_names, s_names, NDIM-N_IN);
703 static const char *v_names[] = { "U0", "U1", "Ug", 0 };
704 set_names(var_names, v_names, NEQ);
705 ix[0] = 1;
706 ix[1] = 0;
707 }
708
709 void PowerAmpGate::update(N_Vector y, N_Vector x, N_Vector state) {
710 realtype *fdata = NV_DATA_S(y);
711 realtype U0 = fdata[0];
712 realtype U1 = fdata[1];
713 realtype Uc1m = U0-U1;
714
715 if (DOUBLE_UPDATE) {
716 realtype Ug = fdata[2];
717 Uc1m = Uc1m + ((U1-Ub)*Gb+(U1-Ug)*Gg)/(C1*fs);
718 }
719 Ith(state,0) = Uc1m;
720 }
721
722 int PowerAmpGate::func(N_Vector u, N_Vector f, UserData *data) {
723 realtype *udata = NV_DATA_S(u);
724 realtype *fdata = NV_DATA_S(f);
725
726 realtype U0 = udata[0];
727 realtype U1 = udata[1];
728 realtype Ug = udata[2];
729 realtype Uc1 = U0 - U1;
730
731 realtype Uin = data->inval[0];
732 realtype Uc1m = data->state[0];
733
734 fdata[0] = C1*(Uc1-Uc1m)*fs-(Uin-U0)*G1;
735 fdata[1] = (Uin-U0)*G1-(U1-Ub)*Gb-(U1-Ug)*Gg;
736 fdata[2] = (U1-Ug)*Gg-Ig(Ug);
737
738 return(0);
739 }
740
741
742 PowerAmpPlate::PowerAmpPlate()
743 : ComponentBase(5+2, 3, 2, 2, 2, param_off+5),
744 C2(params[param_off+0]),
745 Gd(params[param_off+1]),
746 Ga(params[param_off+2]),
747 Gs(params[param_off+3]),
748 Un(params[param_off+4]) {
749 const char *p_names[] = { "C2", "Gd", "Ga", "Gs", "Un", 0 };
750 set_names(param_names+param_off, p_names, n_params-param_off);
751 static const char *i_names[] = { "Ug1", "Ug2", 0 };
752 set_names(in_names, i_names, N_IN);
753 static const char *o_names[] = { "Ua1", "Ua2", 0 };
754 set_names(out_names, o_names, N_OUT);
755 static const char *s_names[] = { "Uc2m", 0 };
756 set_names(state_names, s_names, NDIM-N_IN);
757 static const char *v_names[] = { "Us1", "Us2", "Ud", "Ua1", "Ua2", "L1", "L2", 0 };
758 set_names(var_names, v_names, NEQ);
759 ix[0] = 2;
760 ix[1] = 1;
761 ix[2] = 0;
762 constraints = N_VNew_Serial(NEQ);
763 Ith(constraints,0) = ZERO; /* no constraint on f1 */
764 Ith(constraints,1) = ZERO; /* no constraint on f2 */
765 Ith(constraints,2) = ZERO; /* no constraint on f3 */
766 Ith(constraints,3) = ZERO; /* no constraint on f4 */
767 Ith(constraints,4) = ZERO; /* no constraint on f5 */
768 Ith(constraints,5) = ONE; /* L1 = Us1 - Ud/2 >= 0 */
769 Ith(constraints,6) = ONE; /* L2 = Us2 - Ud/2 >= 0 */
770 }
771
772 void PowerAmpPlate::update(N_Vector y, N_Vector x, N_Vector state) {
773 realtype *fdata = NV_DATA_S(y);
774 realtype Ud = fdata[2];
775 realtype Uc2m = Ud;
776 if (DOUBLE_UPDATE) {
777 realtype Us1 = fdata[0];
778 realtype Us2 = fdata[1];
779 realtype Ua1 = fdata[3];
780 realtype Ua2 = fdata[4];
781 realtype Ug1 = Ith(x,0);
782 realtype Ug2 = Ith(x,1);
783 realtype ia1 = Iap(Ug1,Us1,Ua1);
784 realtype is1 = Is(Ug1,Us1);
785 realtype ia2 = Iap(Ug2,Us2,Ua2);
786 realtype is2 = Is(Ug2,Us2);
787 Uc2m = Uc2m + ((Un-Uc2m)*Gd-(ia1+ia2+is1+is2))/(C2*fs);
788 }
789 Ith(state,0) = Uc2m;
790 }
791
792 int PowerAmpPlate::func(N_Vector u, N_Vector f, UserData *data) {
793 realtype *udata = NV_DATA_S(u);
794 realtype *fdata = NV_DATA_S(f);
795
796 realtype Us1 = udata[0];
797 realtype Us2 = udata[1];
798 realtype Ud = udata[2];
799 realtype Ua1 = udata[3];
800 realtype Ua2 = udata[4];
801 realtype L1 = udata[5];
802 realtype L2 = udata[6];
803 realtype Uc2 = Ud;
804
805 realtype Ug1 = data->inval[0];
806 realtype Ug2 = data->inval[1];
807 realtype Uc2m = data->state[0];
808
809 realtype ia1 = Iap(Ug1,Us1,Ua1);
810 realtype is1 = Is(Ug1,Us1);
811 realtype ia2 = Iap(Ug2,Us2,Ua2);
812 realtype is2 = Is(Ug2,Us2);
813 fdata[0] = -ia1+(Ud-Ua1)*Ga;
814 fdata[1] = -ia2+(Ud-Ua2)*Ga;
815 fdata[2] = -is1+(Ud-Us1)*Gs;
816 fdata[3] = -is2+(Ud-Us2)*Gs;
817 fdata[4] = -ia1-ia2-is1-is2+(Un-Ud)*Gd-C2*(Uc2-Uc2m)*fs;
818 fdata[5] = L1 - (Us1 - -Ud);
819 fdata[6] = L2 - (Us2 - -Ud);
820
821 return(0);
822 }
823
824
825 PhaseSplitter::PhaseSplitter()
826 : ComponentBase(9, 4, 5, 1, 2, param_off+16),
827 C1(params[param_off+0]),
828 C2(params[param_off+1]),
829 C3(params[param_off+2]),
830 Un(params[param_off+3]),
831 G1(params[param_off+4]),
832 Gg1(params[param_off+5]),
833 Gg2(params[param_off+6]),
834 Gk(params[param_off+7]),
835 G2(params[param_off+8]),
836 G3(params[param_off+9]),
837 G4(params[param_off+10]),
838 G5(params[param_off+11]),
839 Ga1(params[param_off+12]),
840 Ga2(params[param_off+13]),
841 Gl1(params[param_off+14]),
842 Gl2(params[param_off+15]) {
843 const char *p_names[] = {
844 "C1", "C2", "C3", "Un", "G1", "Gg1", "Gg2", "Gk", "G2", "G3", "G4", "G5", "Ga1", "Ga2", "Gl1", "Gl2", 0 };
845 set_names(param_names+param_off, p_names, n_params-param_off);
846 static const char *i_names[] = { "Uin", 0 };
847 set_names(in_names, i_names, N_IN);
848 static const char *o_names[] = { "Ua1", "Ua2", 0 };
849 set_names(out_names, o_names, N_OUT);
850 static const char *s_names[] = { "Uc1m", "Uc2m", "Uc3m", 0 };
851 set_names(state_names, s_names, NDIM-N_IN);
852 static const char *v_names[] = { "U1", "Ug1", "Uk", "Ua1", "U2", "U3", "U4", "Ug2", "Ua2", 0 };
853 set_names(var_names, v_names, NEQ);
854 ix[0] = 3;
855 ix[1] = 2;
856 ix[2] = 1;
857 ix[3] = 0;
858 }
859
860 void PhaseSplitter::update(N_Vector y, N_Vector x, N_Vector state) {
861 realtype *fdata = NV_DATA_S(y);
862 realtype U1 = fdata[0];
863 realtype Ug1 = fdata[1];
864 realtype U3 = fdata[5];
865 realtype U4 = fdata[6];
866 realtype Ug2 = fdata[7];
867 realtype Uc1m = U1-Ug1;
868 realtype Uc2m = Ug2-U3;
869 realtype Uc3m = U3-U4;
870 if (DOUBLE_UPDATE) {
871 realtype Uk = fdata[2];
872 realtype U2 = fdata[4];
873 realtype ig1 = Ig(Ug1-Uk);
874 realtype ig2 = Ig(Ug2-Uk);
875 Uc1m = Uc1m + ((Ug1-U2)*Gg1+ig1) / (C1*fs);
876 Uc2m = Uc2m - ((Ug2-U2)*Gg2+ig2) / (C2*fs);
877 Uc3m = Uc3m + (U4*G4) / (C3*fs);
878 }
879 Ith(state,0) = Uc1m;
880 Ith(state,1) = Uc2m;
881 Ith(state,2) = Uc3m;
882 }
883
884 int PhaseSplitter::func(N_Vector u, N_Vector f, UserData *data) {
885 realtype *udata = NV_DATA_S(u);
886 realtype *fdata = NV_DATA_S(f);
887
888 realtype U1 = udata[0];
889 realtype Ug1 = udata[1];
890 realtype Uk = udata[2];
891 realtype Ua1 = udata[3];
892 realtype U2 = udata[4];
893 realtype U3 = udata[5];
894 realtype U4 = udata[6];
895 realtype Ug2 = udata[7];
896 realtype Ua2 = udata[8];
897 realtype Uc1 = U1 - Ug1;
898 realtype Uc2 = Ug2 - U3;
899 realtype Uc3 = U3 - U4;
900
901 realtype Uin = data->inval[0];
902 realtype Uc1m = data->state[0];
903 realtype Uc2m = data->state[1];
904 realtype Uc3m = data->state[2];
905
906 realtype ia1 = Ia(Ug1-Uk,Ua1-Uk);
907 realtype ig1 = Ig(Ug1-Uk);
908 realtype ia2 = Ia(Ug2-Uk,Ua2-Uk);
909 realtype ig2 = Ig(Ug2-Uk);
910 fdata[0] = (Uin-U1)*G1-(Ug1-U2)*Gg1-ig1;
911 fdata[1] = C1*(Uc1-Uc1m)*fs-(Uin-U1)*G1;
912 fdata[2] = (Uk-U2)*Gk-ia1-ig1-ia2-ig2;
913 fdata[3] = (Un-Ua1)*Ga1-Ua1*Gl1-ia1;
914 fdata[4] = (Un-Ua2)*Ga2-Ua2*Gl2-ia2;
915 fdata[5] = -ig2+(U2-Ug2)*Gg2-C2*(Uc2-Uc2m)*fs;
916 fdata[6] = (Ug1-U2)*Gg1+(Uk-U2)*Gk-(U2-Ug2)*Gg2-(U2-U3)*G2;
917 fdata[7] = (U2-U3)*Gg2-U3*G3-U3*G5-U4*G4+C2*(Uc2-Uc2m)*fs;
918 fdata[8] = C3*(Uc3-Uc3m)*fs-U4*G4;
919
920 return(0);
921 }
922
923
924 PowerAmpPlateTrans::PowerAmpPlateTrans()
925 : ComponentBase(5+2, 3, 2, 2, 2, param_off+5),
926 C2(params[param_off+0]),
927 Gd(params[param_off+1]),
928 Ga(params[param_off+2]),
929 Gs(params[param_off+3]),
930 Un(params[param_off+4]) {
931 const char *p_names[] = { "C2", "Gd", "Ga", "Gs", "Un", 0 };
932 set_names(param_names+param_off, p_names, n_params-param_off);
933 static const char *i_names[] = { "Ug1", "Ug2", 0 };
934 set_names(in_names, i_names, N_IN);
935 static const char *o_names[] = { "Ua1", "Ua2", 0 };
936 set_names(out_names, o_names, N_OUT);
937 static const char *s_names[] = { "Uc2m", 0 };
938 set_names(state_names, s_names, NVALS-N_OUT);
939 static const char *v_names[] = { "Us1", "Us2", "Ud", "Ua1", "Ua2", "L1", "L2", 0 };
940 set_names(var_names, v_names, NEQ);
941 ix[0] = 2;
942 ix[1] = 1;
943 ix[2] = 0;
944 constraints = N_VNew_Serial(NEQ);
945 Ith(constraints,0) = ZERO; /* no constraint on f1 */
946 Ith(constraints,1) = ZERO; /* no constraint on f2 */
947 Ith(constraints,2) = ZERO; /* no constraint on f3 */
948 Ith(constraints,3) = ZERO; /* no constraint on f4 */
949 Ith(constraints,4) = ZERO; /* no constraint on f5 */
950 Ith(constraints,5) = ONE; /* L1 = Us1 - Ud/2 >= 0 */
951 Ith(constraints,6) = ONE; /* L2 = Us2 - Ud/2 >= 0 */
952 }
953
954 void PowerAmpPlateTrans::update(N_Vector y, N_Vector x, N_Vector state) {
955 realtype *fdata = NV_DATA_S(y);
956 realtype Ud = fdata[2];
957 realtype Uc2m = Ud;
958 if (DOUBLE_UPDATE) {
959 realtype Us1 = fdata[0];
960 realtype Us2 = fdata[1];
961 realtype Ua1 = fdata[3];
962 realtype Ua2 = fdata[4];
963 realtype Ug1 = Ith(x,0);
964 realtype Ug2 = Ith(x,1);
965 realtype ia1 = Iap(Ug1,Us1,Ua1);
966 realtype is1 = Is(Ug1,Us1);
967 realtype ia2 = Iap(Ug2,Us2,Ua2);
968 realtype is2 = Is(Ug2,Us2);
969 Uc2m = Uc2m + ((Un-Uc2m)*Gd-(ia1+ia2+is1+is2))/(C2*fs);
970 }
971 Ith(state,0) = Uc2m;
972 }
973
974 int PowerAmpPlateTrans::func(N_Vector u, N_Vector f, UserData *data) {
975 realtype *udata = NV_DATA_S(u);
976 realtype *fdata = NV_DATA_S(f);
977
978 realtype Us1 = udata[0];
979 realtype Us2 = udata[1];
980 realtype Ud = udata[2];
981 realtype Ua1 = udata[3];
982 realtype Ua2 = udata[4];
983 realtype L1 = udata[5];
984 realtype L2 = udata[6];
985 realtype Uc2 = Ud;
986
987 realtype Ug1 = data->inval[0];
988 realtype Ug2 = data->inval[1];
989 realtype Uc2m = data->state[0];
990
991 realtype ia1 = Iap(Ug1,Us1,Ua1);
992 realtype is1 = Is(Ug1,Us1);
993 realtype ia2 = Iap(Ug2,Us2,Ua2);
994 realtype is2 = Is(Ug2,Us2);
995 fdata[0] = -ia1+(Ud-Ua1)*Ga;
996 fdata[1] = -ia2+(Ud-Ua2)*Ga;
997 fdata[2] = -is1+(Ud-Us1)*Gs;
998 fdata[3] = -is2+(Ud-Us2)*Gs;
999 fdata[4] = -ia1-ia2-is1-is2+(Un-Ud)*Gd-C2*(Uc2-Uc2m)*fs;
1000 fdata[5] = L1 - (Us1 - -Ud);
1001 fdata[6] = L2 - (Us2 - -Ud);
1002
1003 return(0);
1004 }
1005
1006
1007 /*
1008 *--------------------------------------------------------------------
1009 * MAIN PROGRAM
1010 *--------------------------------------------------------------------
1011 */
1012
1013 #if 0
1014 int main()
1015 {
1016 N_Vector u = N_VNew_Serial(NEQ);
1017 for (int i = 0; i < 200; i++) {
1018 realtype Uin = RCONST(-40.0) + i * (RCONST(40.0)-RCONST(-40.0))/200;
1019 for (int j = 0; j < 12; j++) {
1020 realtype Uc1m = RCONST(-15.0) + j * (RCONST(15.0)-RCONST(-15.0))/12;
1021 Ith(u,0) = RCONST(0.0);
1022 Ith(u,1) = RCONST(0.0);
1023 Ith(u,2) = RCONST(340.0);
1024 printf("-> %g, %g\n", Uin, Uc1m);
1025 fflush(stdout);
1026 if (tc(Uin, Uc1m, u)) {
1027 return 1;
1028 }
1029 printf("<- %g, %g, %g\n", Ith(u,0), Ith(u,1), Ith(u,2));
1030 }
1031 }
1032 N_VDestroy_Serial(u);
1033 return 0;
1034 }
1035 #endif
0 #include <nvector/nvector_serial.h>
1
2 /* Accessor macro */
3 #define Ith(v,i) NV_Ith_S(v,i)
4
5 const int fs = 96000;
6 //const int fs = 8*44100;
7
8 struct Dim {
9 double lower, upper;
10 int size, stride;
11 inline double point(int i) { return lower + ((upper-lower) / (size-1)) * i; }
12 inline double point(double i) { return lower + ((upper-lower) / (size-1)) * i; }
13 inline void index(double v, int& i, double& w) {
14 w = (v-lower) / (upper-lower) * (size-1);
15 i = static_cast<int>(w);
16 if (i < 0) {
17 i = 0;
18 w = 0.0;
19 } else if (i > size-2) {
20 i = size-2;
21 w = 1.0;
22 } else {
23 w -= i;
24 }
25 }
26 };
27
28
29 class Grid {
30 protected:
31 float *grid; // ndim-dimensional cube
32 int vals; // size of cube cell
33 int ndim; // number of dimensions
34 Dim *dim; // dimension descriptor
35 double *weight; // coordinates inside grid cell
36 int *idx; // index of base point
37 int *idx2; // running index of neighbor nodes
38 int p2dim; // 2^ndim
39 double *pts; // size = p2dim*vals
40 inline float *cell(int *ix);
41 int calc_strides();
42 public:
43 Grid(int d, Dim *v, int n);
44 ~Grid();
45 };
46
47
48 class ComponentBase;
49
50 class Cube: public Grid {
51 private:
52 ComponentBase& cb;
53 int mmap_size;
54 int n_in; // length of input vector
55 int fill(int n, int *ix, N_Vector x, N_Vector u0);
56 public:
57 Cube(int d, Dim *v, int n, int *ix, int n_in_, ComponentBase& cb, N_Vector u0, const char* fname=0);
58 ~Cube();
59 void startvalue(N_Vector x, N_Vector s, N_Vector u);
60 int calc(N_Vector x, N_Vector s, N_Vector u);
61 };
62
63
64 class ComponentBase {
65 public:
66 int NEQ;
67 int NDIM;
68 int NVALS;
69 int N_IN;
70 int N_OUT;
71 int n_params;
72 realtype *params;
73 const char **param_names;
74 const char **in_names;
75 const char **out_names;
76 const char **state_names;
77 const char **var_names;
78 int *ix;
79 bool verbose;
80 struct UserData {
81 realtype *inval;
82 realtype *state;
83 };
84 private:
85 Dim *ranges;
86 Cube *cube;
87 UserData user_data;
88 static int sfunc(N_Vector x, N_Vector u, void *data);
89 protected:
90 N_Vector constraints;
91 realtype& Gco;
92 realtype& Gcf;
93 realtype& mu;
94 realtype& Ex;
95 realtype& Kg1;
96 realtype& Kg2;
97 realtype& Kp;
98 realtype& Kvb;
99 inline realtype Ig(realtype Ugk);
100 inline realtype Ia(realtype Ugk, realtype Uak);
101 inline realtype Iap(realtype Ug1k, realtype Ug2k, realtype Uak);
102 inline realtype Is(realtype Ug1k, realtype Ug2k);
103 static const int param_off = 8;
104 inline void set_names(const char **pn, const char **p, int n) {
105 while (*p) { *pn++ = *p++; n--; }
106 assert(n == 0);
107 }
108 public:
109 virtual int func(N_Vector x, N_Vector u, UserData *data) = 0;
110 virtual void update(N_Vector y, N_Vector x, N_Vector state) = 0;
111 int findzero(realtype *x, realtype *s, N_Vector u);
112 int set_range(int i, double lower, double upper, int size);
113 void init(N_Vector u0, const char* fname=0);
114 int calc(N_Vector x, N_Vector s, N_Vector u);
115 void startvalue(N_Vector x, N_Vector s, N_Vector u);
116 ComponentBase(int neq, int ndim, int nvals, int n_in, int n_out, int n_params_);
117 virtual ~ComponentBase();
118 };
119
120
121 class TriodeCircuit: public ComponentBase {
122 private:
123 realtype& Ck;
124
125 realtype& G1; // 1/R1
126 realtype& G2; // 1/R2
127 realtype& Gg; // 1/Rg
128 realtype& Gk; // 1/Rk
129 realtype& Ga; // 1/Ra
130 realtype& Gl; // 1/Rl
131
132 realtype& Un;
133
134 virtual int func(N_Vector u, N_Vector f, UserData *user_data);
135 virtual void update(N_Vector y, N_Vector x, N_Vector state);
136 public:
137 TriodeCircuit();
138 };
139
140
141 class CoupledTriodeCircuit: public ComponentBase {
142 private:
143 realtype& Ck;
144 realtype& Ca;
145 realtype& Un;
146 realtype& G1;
147 realtype& G2;
148 realtype& Gg;
149 realtype& Gk;
150 realtype& Ga;
151 realtype& G3;
152 realtype& Gg2;
153 realtype& Gk2;
154 realtype& Ga2;
155 realtype& Gl;
156
157 virtual int func(N_Vector u, N_Vector f, UserData *user_data);
158 virtual void update(N_Vector y, N_Vector x, N_Vector state);
159 public:
160 CoupledTriodeCircuit();
161 };
162
163
164 class PowerAmpGate: public ComponentBase {
165 private:
166 realtype& C1;
167 realtype& G1; // 1/R1
168 realtype& Gb; // 1/Rb
169 realtype& Gg; // 1/Rg
170 realtype& Ub;
171
172 virtual int func(N_Vector u, N_Vector f, UserData *user_data);
173 virtual void update(N_Vector y, N_Vector x, N_Vector state);
174 public:
175 PowerAmpGate();
176 };
177
178
179 class PowerAmpPlate: public ComponentBase {
180 private:
181 realtype& C2;
182 realtype& Gd; // 1/Rd
183 realtype& Ga; // 1/Ra
184 realtype& Gs; // 1/Rs
185 realtype& Un;
186
187 virtual int func(N_Vector u, N_Vector f, UserData *user_data);
188 virtual void update(N_Vector y, N_Vector x, N_Vector state);
189 public:
190 PowerAmpPlate();
191 };
192
193
194 class PhaseSplitter: public ComponentBase {
195 private:
196 realtype& C1;
197 realtype& C2;
198 realtype& C3;
199 realtype& Un;
200 realtype& G1;
201 realtype& Gg1;
202 realtype& Gg2;
203 realtype& Gk;
204 realtype& G2;
205 realtype& G3;
206 realtype& G4;
207 realtype& G5;
208 realtype& Ga1;
209 realtype& Ga2;
210 realtype& Gl1;
211 realtype& Gl2;
212
213 virtual int func(N_Vector u, N_Vector f, UserData *user_data);
214 virtual void update(N_Vector y, N_Vector x, N_Vector state);
215 public:
216 PhaseSplitter();
217 inline void feedback_coeff(realtype *b0, realtype *b1, realtype *a1, realtype pres) {
218 realtype R4v = pres/G4;
219 realtype B0 = 1/G5;
220 realtype B1 = R4v/G5*C3;
221 realtype A0 = 1/G3 + 1/G5;
222 realtype A1 = C3*R4v/G5 + C3/(G3*G5) + C3/G3*R4v;
223 realtype a = A0 + 2*A1*fs;
224 *a1 = -(A0 - 2*A1*fs) / a;
225 *b0 = (B0 + 2*B1*fs) / a;
226 *b1 = (B0 - 2*B1*fs) / a;
227 }
228 };
229
230
231 class PowerAmpPlateTrans: public ComponentBase {
232 private:
233 realtype& C2;
234 realtype& Gd; // 1/Rd
235 realtype& Ga; // 1/Ra
236 realtype& Gs; // 1/Rs
237 realtype& Un;
238
239 virtual int func(N_Vector u, N_Vector f, UserData *user_data);
240 virtual void update(N_Vector y, N_Vector x, N_Vector state);
241 public:
242 PowerAmpPlateTrans();
243 };
244
245
246 class Spline {
247 private:
248 int count;
249 double x0, step;
250 double *c;
251 double *f;
252 public:
253 Spline(double *y, int n, double xstart, double h);
254 ~Spline();
255 double eval(double x);
256 };
0 from circuit import pycircuit
1
2 FS = pycircuit.fs
3
4 class Triode(pycircuit.tcParams):
5
6 comp_id = "tc"
7 comp_name = "single triode"
8
9 u0 = (-37, -14, 341, 341-(-14), 341-350) #Un = 350
10
11 start_grid = (
12 (-40.0, 40.0, 2),
13 (-15.0, 15.0, 2),
14 )
15
16 ranges = ()
17
18 circuit = dict(
19 Gco = -0.2,
20 Gcf = 1e-5,
21 mu = 100.0,
22 Ex = 1.4,
23 Kg1 = 1060.0,
24 Kp = 600.0,
25 Kvb = 300.0,
26
27 Ck = 680e-9,
28
29 G1 = 1/68e3, # 1/R1
30 G2 = 1/1e0, # 1/R2
31 Gg = 1/1e6, # 1/Rg
32 Gk = 1/2.7e3, # 1/Rk
33 Ga = 1/100e3, # 1/Ra
34 Gl = 1/4e6, # 1/Rl
35
36 Un = 350,
37 )
38
39
40 class CoupledTriode(pycircuit.ctcParams):
41
42 comp_id = "ct"
43 comp_name = "coupled triodes"
44
45 u0 = (-18, 0, 313, 214, 45, 35, 37)
46
47 start_grid = (
48 (-80.0, 80.0, 220),
49 (0.0, 10.0, 2*30),
50 (30.0, 350.0, 2*18),
51 )
52
53 @property
54 def operating_point(self):
55 return [2.2423, 266.95][:]
56
57 ranges = (
58 (-40,40),
59 (0,10),
60 (100,350),
61 )
62
63 def pre(a):
64 a[0] += a[1]
65 return a
66
67 def post(a, o):
68 o[1] -= a[1]
69 o[2] -= a[2]
70 return o
71
72 basegrid = (
73 (((331, 4), (4, 4), (10, 4)), pre, post),
74 #L(((351, 2), (4, 2), (10, 2)), pre, post),
75 (((331, 2), (10, 2), (10, 2)), pre, post, 1e-3),
76 (((331, 2), (20, 2), (40, 2)), pre, post, 1e-3),
77 )
78
79 circuit = dict(
80 Gco = -0.2,
81 Gcf = 1e-5,
82 mu = 100.0,
83 Ex = 1.4,
84 Kg1 = 1060.0,
85 Kp = 600.0,
86 Kvb = 300.0,
87 Ck = 680e-9,
88 Ca = 22e-9,
89 Un = 350,
90 G1 = 1/68e3,
91 G2 = 1/1e0,
92 Gg = 1/1e6,
93 Gk = 1/2.7e3,
94 Ga = 1/100e3,
95 G3 = 1/470e3,
96 Gg2 = 1/1e6,
97 Gk2 = 1/10e3,
98 Ga2 = 1/100e3,
99 Gl = 1/4e6,
100 )
101
102
103 class PhaseSplitter(pycircuit.psParams):
104
105 comp_id = "ps"
106 comp_name = "phasesplitter"
107
108 u0 = (-4.99999142644, -4.99999053336, 3.7459813383, 391.962467113,
109 3.57356994824, 0.0264493076678, 0.0264491824349, 0.0264496771595,
110 354.458081186)
111
112 start_grid = (
113 (-40.0, 40.0, 60),
114 (-36.0, 0.0, 4),
115 (20.0, 35.0, 4),
116 (0.07, 0.25, 3),
117 )
118
119 @property
120 def operating_point(self):
121 return [-30.5966, 30.4599, 0.1367][:]
122
123 ranges = (
124 (slice(-40,40,81j), 3),
125 (slice(-36.0,-1.0,30j), 3),
126 (slice(23.0,35.0,8j), 3),
127 (slice(0.07,0.26,2j), 2),
128 )
129
130 circuit = dict(
131 Gco = -0.2,
132 Gcf = 1e-5,
133 mu = 100.0,
134 Ex = 1.4,
135 Kg1 = 1060.0,
136 Kp = 600.0,
137 Kvb = 300.0,
138 C1 = 100e-9, # corrected from 100e-6
139 C2 = 100e-9, # corrected from 100e-6
140 C3 = 100e-9, # corrected from 100e-6
141 Un = 400,
142 G1 = 1/1e0, # 1/R1
143 Gg1 = 1/1e6, # 1/Rg1
144 Gg2 = 1/1e6, # 1/Rg2
145 Gk = 1/470e0, # 1/Rk
146 G2 = 1/10e3, # 1/R2
147 G3 = 1/100e3, # 1/R3
148 G4 = 1/22e3, # 1/R4
149 G5 = 1/4.7e3, # 1/R5
150 Ga1 = 1/82e3, # 1/Ra1
151 Ga2 = 1/100e3, # 1/Ra2
152 Gl1 = 1/4e6, # 1/Rl1
153 Gl2 = 1/4e6, # 1/Rl2
154 )
155
156
157 class PPGate(pycircuit.pagParams):
158
159 comp_id = "ppg"
160 comp_name = "poweramp gate"
161
162 u0 = (-49.011342155, -93.9168241966, -93.9168241966)
163
164 start_grid = (
165 (-200,200,41),
166 (-70,170,8),
167 )
168
169 @property
170 def operating_point(self):
171 return [311.045][:]
172
173 ranges = (
174 (slice(45,425,60j), 3),
175 (slice(95,445,60j), 3),
176 )
177
178 circuit = dict(
179 Gco = -0.2,
180 Gcf = 1e-5,
181 C1 = 22e-9,
182 G1 = 1/30e3,
183 Gb = 1/220e3,
184 Gg = 1/5e3,
185 Ub = -48,
186 )
187
188
189 class PPPlate(pycircuit.papParams):
190
191 comp_id = "ppp"
192 comp_name = "poweramp plate"
193
194 u0 = (-93.9168241966, 400.010411242, 400.010411241, 399.983840905, 399.983840905)
195
196 start_grid = (
197 (-200,200,41),
198 (-200,200,41),
199 (350.0,450.0,2),
200 )
201
202 @property
203 def operating_point(self):
204 return [427.582][:]
205
206 ranges = (
207 (slice(-287,185,110j), 3),
208 (slice(-265,-51,40j), 3),
209 (slice(302,428,10j), 3),
210 )
211
212 circuit = dict(
213 Kp = 48.0,
214 mu = 8.7,
215 Ex = 1.35,
216 Kg1 = 1460.0,
217 Kg2 = 4500.0,
218 Kvb = 12.0,
219 Un = 450,
220 C2 = 100e-6,
221 Gd = 1/500e0,
222 Ga = 1/1.7e3,
223 Gs = 1/1e3,
224 )
225
226
227 ################################################################
228 # JCM800 Poweramp
229 #
230
231 class PhaseSplitter_JCM800(pycircuit.psParams):
232
233 comp_id = "ps_jcm800"
234 comp_name = "jcm800 phasesplitter"
235
236 u0 = (-4.99999142644, -4.99999053336, 3.7459813383, 391.962467113,
237 3.57356994824, 0.0264493076678, 0.0264491824349, 0.0264496771595,
238 354.458081186)
239
240 start_grid = (
241 (-70.0, 105.0, 60),
242 (-76.0, 45.0, 25),
243 (25.0, 35.0, 4),
244 (0.07, 0.25, 3),
245 )
246
247 @property
248 def operating_point(self):
249 return [-29.77995343, 29.64688073, 0.13308519][:]
250
251 ranges = (
252 (-105,60),
253 (-51.0,0.0),
254 (25.0,35.0),
255 (0.07,0.26),
256 )
257
258 def pre(a):
259 a[0] += a[1]
260 return a
261
262 def post(a, o):
263 o[2] -= a[1]
264 o[3] -= a[2]
265 o[4] -= a[3]
266 return o
267
268 basegrid = (
269 (((301,4), (2,2), (20,4), (2,2)), pre, post, 4e-5),
270 (((301,4), (2,2), (30,4), (2,2)), pre, post, 4e-5),
271 #L(((950,2), (2,2), (80,2), (2,2)), pre, post, 4e-5),
272 #L(((1100,2), (2,2), (100,2), (2,2)), pre, post, 4e-5),
273 (((600,2), (2,2), (30,2), (2,2)), pre, post, 1e-4),
274 (((700,2), (2,2), (50,2), (2,2)), pre, post, 1e-3),
275 (((700,2), (2,2), (50,2), (2,2)), pre, post, 1e-3),
276 )
277
278 circuit = dict(
279 # 12AX7 tube parameters
280 Gco = -0.2,
281 Gcf = 1e-5,
282 mu = 100.0,
283 Ex = 1.4,
284 Kg1 = 1060.0,
285 Kp = 600.0,
286 Kvb = 300.0,
287 # other parameters
288 C1 = 22e-9,
289 C2 = 100e-9,
290 C3 = 100e-9,
291 Un = 390,
292 G1 = 1/1e0, # ??
293 Gg1 = 1/1e6,
294 Gg2 = 1/1e6,
295 Gk = 1/470e0,
296 G2 = 1/10e3,
297 G3 = 1/100e3,
298 G4 = 1/22e3,
299 #G4 = 1/1.0,
300 G5 = 1/4.7e3,
301 Ga1 = 1/82e3,
302 Ga2 = 1/100e3,
303 Gl1 = 1/4e6,
304 Gl2 = 1/4e6,
305 )
306
307
308 class PPGate_JCM800(pycircuit.pagParams):
309
310 comp_id = "ppg_jcm800"
311 comp_name = "jcm800 poweramp gate"
312
313 u0 = (-49.011342155, -93.9168241966, -93.9168241966)
314
315 start_grid = (
316 (-200,200,41),
317 (-70,170,8),
318 )
319
320 @property
321 def operating_point(self):
322 return [311.045][:]
323
324 ranges = (
325 (-40, 500),
326 (95, 445),
327 )
328
329 def pre_c1(a):
330 a[0] += a[1] - 311.045
331 return a
332
333 def post_c1(a, o):
334 o[1] -= a[1] - 311.045
335 return o
336
337 basegrid = (
338 #S(((120, 4), (2, 2)), pre_c1, None),
339 (((120, 2), (2, 2)), pre_c1, None),
340 (((120, 2), (2, 2)), pre_c1, post_c1, 1e-3),
341 )
342
343 circuit = dict(
344 Gco = -0.2,
345 Gcf = 1e-5,
346 C1 = 22e-9,
347 G1 = 1/30e3, # ??
348 Gb = 1/150e3,
349 Gg = 1/5.6e3,
350 #Ub = -57,
351 Ub = -60,
352 )
353
354
355 class PPPlate_JCM800(pycircuit.papParams):
356
357 comp_id = "ppp_jcm800"
358 comp_name = "jcm800 poweramp plate"
359
360 u0 = (-93.9168241966, 400.010411242, 400.010411241, 399.983840905, 399.983840905,
361 (-93.9168241966+400.010411241/2), (400.010411242+400.010411241/2))
362
363 start_grid = (
364 #(-290,200,16*41),
365 #(-290,200,4*41),
366 #(300.0,440.0,2*2),
367 (-200,200,41),
368 (-200,200,41),
369 (335.0,430.0,20),
370 )
371
372 @property
373 def operating_point(self):
374 return [427.582][:]
375
376 ranges = (
377 (-56.59-240,-56.59+210),
378 #(-265,-51),
379 (-56.59-240,-56.59+210),
380 (340,468),
381 )
382
383 #def pre_in1(a):
384 # a[1] += a[0]
385 # return a
386
387 def post(a, o):
388 o[1] -= a[2]
389 return o
390
391 # basegrid = (
392 # (((110, 3), (110, 3), (10, 3)), None, None),
393 # (((110, 3), (110, 3), (10, 3)), None, None, 1e-6),
394 # #(((150, 4), (70, 4), (10, 4)), pre_in1, None),
395 # #(((4, 2), (4, 2), (4, 2)), None, None),
396 # )
397 basegrid = (
398 (((2*110, 4), (2*110, 4), (10, 4)), None, post, 1e-4),
399 #L(((270, 2), (270, 2), (20, 2)), None, post, 1e-4),
400 (((110, 2), (110, 2), (10, 2)), None, post, 1e-3),
401 #(((150, 4), (70, 4), (10, 4)), pre_in1, None),
402 #(((4, 2), (4, 2), (4, 2)), None, None),
403 )
404
405 circuit = dict(
406 # EL34 tube parameters
407 Kp = 60.0,
408 mu = 11.0,
409 Ex = 1.35,
410 Kg1 = 650.0,
411 Kg2 = 4200.0,
412 Kvb = 24.0,
413 #
414 Un = 468,
415 C2 = 100e-6,
416 Gd = 1/500e0, # ??
417 Ga = 1/1.7e3, # ??
418 Gs = 1/1.5e3,
419 )
0 import os
1 from libc.string cimport const_char, strcmp
2 from libc.stdlib cimport malloc, free
3 import numpy as np
4 cimport numpy as np
5 np.import_array()
6 cdef extern from "time.h":
7 cdef struct timespec:
8 int tv_sec
9 int tv_nsec
10 ctypedef int clockid_t
11 int CLOCK_MONOTONIC
12 int clock_gettime(clockid_t clk_id, timespec *tp)
13
14 cdef extern from "circuit.hpp":
15 ctypedef struct N_Vector:
16 pass
17 N_Vector N_VNew_Serial(long int vec_length)
18 void N_VDestroy_Serial(N_Vector v)
19 double *NV_DATA_S(N_Vector v)
20 int NV_LENGTH_S(N_Vector v)
21
22 int FS "fs"
23
24 cppclass UserData "ComponentBase::UserData":
25 double *inval
26 double *state
27
28 cppclass ComponentBase:
29 int NEQ
30 int NDIM
31 int NVALS
32 int N_IN
33 int N_OUT
34 int n_params
35 double *params
36 char **param_names
37 char **in_names
38 char **out_names
39 char **state_names
40 char **var_names
41 int *ix
42 int verbose
43 int func(N_Vector x, N_Vector u, UserData *user_data)
44 void update(N_Vector y, N_Vector x, N_Vector state)
45 int startvalue(N_Vector x, N_Vector s, N_Vector u)
46 int findzero(double *x, double *s, N_Vector u)
47 int set_range(int i, double lower, double upper, int size)
48 void init(N_Vector u0, char* fname)
49 int calc(N_Vector x, N_Vector s, N_Vector u)
50
51 cppclass TriodeCircuit(ComponentBase):
52 pass
53
54 cppclass CoupledTriodeCircuit(ComponentBase):
55 pass
56
57 cppclass PowerAmpGate(ComponentBase):
58 pass
59
60 cppclass PowerAmpPlate(ComponentBase):
61 pass
62
63 cppclass PhaseSplitter(ComponentBase):
64 void feedback_coeff(double *b0, double *b1, double *a1, double pres)
65
66 cdef cppclass CSpline "Spline":
67 CSpline(double *, int, double, double)
68 double eval(double)
69
70 fs = FS
71
72
73 class ConvergenceError(ValueError):
74
75 def __init__(self, err, x, s, tag=None):
76 self.error = err
77 self.x = x
78 self.s = s
79 self.tag = tag
80 t = "%s: " % tag if tag else ""
81 v1 = ", ".join((str(v) for v in x))
82 if s is not None:
83 v2 = "/[%s]" % ", ".join((str(v) for v in s))
84 else:
85 v2 = ""
86 ValueError.__init__(
87 self, "%sKINSol error %d at [%s]%s" % (t, err, v1, v2))
88
89 def __reduce__(self):
90 return (ConvergenceError, (self.error, self.x, self.s, self.tag))
91
92
93 cdef int find_idx(const_char *k, const_char **p, int n):
94 cdef int i
95 for i in range(n):
96 if strcmp(p[i], k) == 0:
97 return i
98 return -1
99
100 cdef to_list(const_char **p, int n):
101 cdef int i
102 cdef list l = []
103 cdef char *t
104 for i in range(n):
105 t = <char*>(p[i])
106 l.append(t)
107 return l
108
109 cdef inline double ts_diff(timespec ts1, timespec ts2):
110 cdef double df = ts1.tv_sec - ts2.tv_sec
111 return df * 1e9 + (ts1.tv_nsec - ts2.tv_nsec)
112
113 cdef class CalcBase:
114 cdef ComponentBase *pbase
115 cdef int *idx
116 cdef int *capt_idx
117 cdef int capt_len
118 cdef list capt_vars
119 cdef np.ndarray _captured
120 cdef N_Vector _state
121 cdef np.ndarray state_min
122 cdef np.ndarray state_max
123 cdef N_Vector inp
124 cdef N_Vector outp
125 cdef double time_per_sample
126
127 property NDIM:
128 def __get__(self):
129 return self.pbase.NDIM
130 property NEQ:
131 def __get__(self):
132 return self.pbase.NEQ
133 property NVALS:
134 def __get__(self):
135 return self.pbase.NVALS
136 property N_IN:
137 def __get__(self):
138 return self.pbase.N_IN
139 property N_OUT:
140 def __get__(self):
141 return self.pbase.N_OUT
142 property param_names:
143 def __get__(self):
144 return to_list(self.pbase.param_names, self.pbase.n_params)
145 property in_names:
146 def __get__(self):
147 return to_list(self.pbase.in_names, self.pbase.N_IN)
148 property out_names:
149 def __get__(self):
150 return to_list(self.pbase.out_names, self.pbase.N_OUT)
151 property state_names:
152 def __get__(self):
153 return to_list(self.pbase.state_names, self.pbase.NDIM-self.pbase.N_IN)
154 property var_names:
155 def __get__(self):
156 return to_list(self.pbase.var_names, self.pbase.NEQ)
157 property state:
158 def __get__(self):
159 cdef int i
160 return np.array([NV_DATA_S(self._state)[i] for i in range(self.pbase.NDIM-self.pbase.N_IN)])
161 def __set__(self, v):
162 for i in range(self.pbase.NDIM-self.pbase.N_IN):
163 NV_DATA_S(self._state)[i] = v[i]
164 property min_state:
165 def __get__(self):
166 return self.state_min
167 property max_state:
168 def __get__(self):
169 return self.state_max
170 property nanosec_per_sample:
171 "time in nanoseconds measured for last compute call"
172 def __get__(self):
173 return self.time_per_sample
174
175
176 def __dealloc__(self):
177 free(self.idx)
178 free(self.capt_idx)
179 N_VDestroy_Serial(self.inp)
180 N_VDestroy_Serial(self._state)
181 N_VDestroy_Serial(self.outp)
182 del self.pbase
183
184 property capture_signals:
185 def __get__(self):
186 return self.capt_vars
187 def __set__(self, v):
188 cdef int i, j
189 cdef char *t
190 if isinstance(v, basestring):
191 v = [v]
192 l = []
193 for n in v:
194 t = n
195 j = find_idx(t, self.pbase.var_names, self.pbase.NEQ)
196 if j < 0:
197 raise ValueError("not found: %s", n)
198 l.append(j)
199 i = len(l)
200 if i != self.capt_len:
201 free(self.capt_idx)
202 self.capt_idx = <int*>malloc(i * sizeof(int))
203 self.capt_len = i
204 for j in range(i):
205 self.capt_idx[j] = l[j]
206 self.capt_vars = v
207
208 property captured:
209 def __get__(self):
210 return self._captured
211
212 cdef int set_var(self, char *k, double v):
213 for i in range(self.pbase.n_params):
214 if strcmp(k, self.pbase.param_names[i]) == 0:
215 self.pbase.params[i] = v
216 return 1
217 return 0
218
219 def init(self):
220 cdef int i
221 for k, v in self.circuit.items():
222 if not self.set_var(k, v):
223 raise KeyError("unknown: %s" % k)
224 for i, l in enumerate(self.start_grid):
225 if not self.pbase.set_range(i, l[0], l[1], l[2]):
226 raise ValueError("can't set range nr %d" % i)
227 if len(self.u0) != self.pbase.NEQ:
228 raise ValueError("lenght %d expected for u0" % self.pbase.NEQ)
229 for i, v in enumerate(self.u0):
230 NV_DATA_S(self.outp)[i] = v
231 if "AMPSIM_CACHE" in os.environ:
232 fname = "%s.cache" % self.comp_id
233 else:
234 fname = None
235 if fname and os.path.exists(fname) and os.stat(fname).st_mtime < os.stat("circuit/components.py").st_mtime:
236 print "remove", fname
237 os.remove(fname)
238 cdef char *_fname = NULL
239 if fname:
240 _fname = fname
241 self.pbase.init(self.outp, _fname)
242
243 def pre_call(self, A, with_state):
244 return A
245
246 def post_call(self, O, with_state):
247 return O
248
249 cdef np.ndarray prepare_input(self, object a, int with_state, int* n_in, int* n_out, int* ndim):
250 cdef np.ndarray A = np.PyArray_FROMANY(a, np.NPY_DOUBLE, 0, 2, np.NPY_ALIGNED)
251 ndim[0] = np.PyArray_NDIM(A)
252 n_in[0] = self.pbase.NDIM if with_state else self.pbase.N_IN
253 n_out[0] = self.pbase.N_OUT
254 if with_state:
255 n_out[0] += self.pbase.NDIM-self.pbase.N_IN
256 if ndim[0] == 0:
257 if n_in[0] > 1:
258 raise ValueError("input array: bad shape")
259 A = np.PyArray_Reshape(A, (1, 1))
260 if n_out[0] > 1:
261 ndim[0] = 1
262 elif ndim[0] == 1:
263 if n_in[0] == 1:
264 A = np.PyArray_Reshape(A, ((np.PyArray_DIM(A, 0), 1)))
265 if n_out[0] > 1:
266 ndim[0] = 2
267 elif np.PyArray_DIM(A, 0) == n_in[0]:
268 A = np.PyArray_Reshape(A, (1, n_in[0]))
269 if n_out[0] == 1:
270 ndim[0] = 0
271 else:
272 raise ValueError("input array: bad shape")
273 elif np.PyArray_NDIM(A) == 2:
274 if np.PyArray_DIM(A, 1) != n_in[0]:
275 raise ValueError("input array: bad shape %d/%d" % (np.PyArray_DIM(A, 1), n_in[0]))
276 if n_out[0] == 1:
277 ndim[0] = 1
278 return A
279
280 def __call__(self, a, int with_state=False):
281 cdef int ndim = 0
282 cdef int n_in = 0
283 cdef int n_out = 0
284 cdef np.ndarray A = self.prepare_input(a, with_state, &n_in, &n_out, &ndim)
285 cdef np.npy_intp dim[2]
286 dim[0] = np.PyArray_DIM(A, 0)
287 dim[1] = n_out
288 cdef np.ndarray O = np.PyArray_SimpleNew(2, dim, np.NPY_DOUBLE)
289 cdef np.flatiter itc
290 if self.capt_len:
291 dim[0] = np.PyArray_DIM(A, 0)
292 dim[1] = self.capt_len
293 self._captured = np.PyArray_SimpleNew(2, dim, np.NPY_DOUBLE)
294 itc = np.PyArray_IterNew(self._captured)
295 A = self.pre_call(A, with_state)
296 cdef int i, j, n
297 cdef np.flatiter it = np.PyArray_IterNew(A)
298 cdef np.flatiter ito = np.PyArray_IterNew(O)
299 cdef np.npy_intp ix[2]
300 cdef timespec t0, t1
301 cdef double v
302 clock_gettime(CLOCK_MONOTONIC, &t0)
303 for i in range(np.PyArray_DIM(A, 0)):
304 ix[0] = i
305 for j in range(self.pbase.N_IN):
306 ix[1] = j
307 np.PyArray_ITER_GOTO(it, ix)
308 NV_DATA_S(self.inp)[j] = (<double*>np.PyArray_ITER_DATA(it))[0]
309 if with_state:
310 for j in range(n_in - self.pbase.N_IN):
311 ix[1] = self.pbase.N_IN + j
312 np.PyArray_ITER_GOTO(it, ix)
313 NV_DATA_S(self._state)[j] = (<double*>np.PyArray_ITER_DATA(it))[0]
314 n = self.pbase.calc(self.inp, self._state, self.outp)
315 if n:
316 raise ConvergenceError(n, A[i], None if with_state else self.state, getattr(self,"comp_id",None))
317 if self.capt_len:
318 for j in range(self.capt_len):
319 (<double*>np.PyArray_ITER_DATA(itc))[j] = NV_DATA_S(self.outp)[self.capt_idx[j]]
320 np.PyArray_ITER_NEXT(itc)
321 self.pbase.update(self.outp, self.inp, self._state)
322 for j in range(self.pbase.N_OUT):
323 (<double*>np.PyArray_ITER_DATA(ito))[0] = NV_DATA_S(self.outp)[self.idx[j]]
324 np.PyArray_ITER_NEXT(ito)
325 if with_state:
326 for j in range(n_out-self.pbase.N_OUT):
327 (<double*>np.PyArray_ITER_DATA(ito))[0] = NV_DATA_S(self._state)[j]
328 np.PyArray_ITER_NEXT(ito)
329 else:
330 for j in range(self.pbase.NDIM - self.pbase.N_IN):
331 v = NV_DATA_S(self._state)[j]
332 if v > (<double*>np.PyArray_DATA(self.state_max))[j]:
333 (<double*>np.PyArray_DATA(self.state_max))[j] = v
334 if v < (<double*>np.PyArray_DATA(self.state_min))[j]:
335 (<double*>np.PyArray_DATA(self.state_min))[j] = v
336 clock_gettime(CLOCK_MONOTONIC, &t1)
337 self.time_per_sample = ts_diff(t1,t0)/np.PyArray_DIM(A, 0)
338 O = self.post_call(O, with_state)
339 cdef np.PyArray_Dims dm
340 if ndim != np.PyArray_NDIM(O):
341 if ndim == 1:
342 if np.PyArray_NDIM(O) == 0:
343 dim[0] = 1
344 else:
345 dim[0] = np.PyArray_DIM(O, 0) * np.PyArray_DIM(O, 1)
346 else:
347 if np.PyArray_NDIM(O) == 0:
348 dim[0] = 1
349 dim[1] = 1
350 else:
351 dim[0] = np.PyArray_DIM(O, 0)
352 dim[1] = 1
353 dm.ptr = dim
354 dm.len = ndim
355 O = np.PyArray_Newshape(O, &dm, np.NPY_ANYORDER)
356 return O
357
358 def func(self, a, state):
359 cdef int i
360 cdef N_Vector x = N_VNew_Serial(self.pbase.N_IN)
361 cdef N_Vector s = N_VNew_Serial(self.pbase.NDIM-self.pbase.N_IN)
362 cdef N_Vector u = N_VNew_Serial(self.pbase.NEQ)
363 for i in range(self.pbase.N_IN):
364 NV_DATA_S(x)[i] = a[i]
365 for i in range(self.pbase.NDIM-self.pbase.N_IN):
366 NV_DATA_S(s)[i] = state[i]
367 i = self.pbase.calc(x, s, u)
368 if i:
369 raise ConvergenceError(i, a, state, getattr(self,"comp_id",None))
370 self.pbase.update(u, x, s)
371 for i in range(self.pbase.NDIM-self.pbase.N_IN):
372 state[i] = NV_DATA_S(s)[i]
373 ret = [NV_DATA_S(u)[self.idx[i]] for i in range(self.pbase.N_OUT)]
374 N_VDestroy_Serial(x)
375 N_VDestroy_Serial(s)
376 N_VDestroy_Serial(u)
377 return ret
378
379 def startvalue(self, x, s):
380 cdef int i
381 cdef N_Vector X = N_VNew_Serial(self.pbase.N_IN)
382 cdef N_Vector S = N_VNew_Serial(self.pbase.NDIM-self.pbase.N_IN)
383 cdef N_Vector U = N_VNew_Serial(self.pbase.NEQ)
384 for i in range(self.pbase.N_IN):
385 NV_DATA_S(X)[i] = x[i]
386 for i in range(self.pbase.NDIM-self.pbase.N_IN):
387 NV_DATA_S(S)[i] = s[i]
388 self.pbase.startvalue(X, S, U)
389 ret = [NV_DATA_S(U)[i] for i in range(self.pbase.NEQ)]
390 N_VDestroy_Serial(X)
391 N_VDestroy_Serial(S)
392 N_VDestroy_Serial(U)
393 return ret
394
395 def findzero(self, x, s, u, verbose=False):
396 cdef int i
397 cdef N_Vector X = N_VNew_Serial(self.pbase.N_IN)
398 cdef N_Vector S = N_VNew_Serial(self.pbase.NDIM-self.pbase.N_IN)
399 cdef N_Vector U = N_VNew_Serial(self.pbase.NEQ)
400 for i in range(self.pbase.N_IN):
401 NV_DATA_S(X)[i] = x[i]
402 for i in range(self.pbase.NDIM-self.pbase.N_IN):
403 NV_DATA_S(S)[i] = s[i]
404 for i in range(self.pbase.NEQ):
405 NV_DATA_S(U)[i] = u[i]
406 self.pbase.verbose = verbose
407 i = self.pbase.findzero(NV_DATA_S(X), NV_DATA_S(S), U)
408 self.pbase.verbose = False
409 if i != 0:
410 raise ValueError
411 ret = [NV_DATA_S(U)[i] for i in range(self.pbase.NEQ)]
412 N_VDestroy_Serial(X)
413 N_VDestroy_Serial(S)
414 N_VDestroy_Serial(U)
415 return ret
416
417 def equations(self, x, s, u):
418 cdef UserData D
419 cdef N_Vector X = N_VNew_Serial(self.pbase.N_IN)
420 cdef N_Vector S = N_VNew_Serial(self.pbase.NDIM-self.pbase.N_IN)
421 cdef N_Vector U = N_VNew_Serial(self.pbase.NEQ)
422 cdef N_Vector F = N_VNew_Serial(self.pbase.NEQ)
423 for i in range(self.pbase.N_IN):
424 NV_DATA_S(X)[i] = x[i]
425 for i in range(self.pbase.NDIM-self.pbase.N_IN):
426 NV_DATA_S(S)[i] = s[i]
427 for i in range(self.pbase.NEQ):
428 NV_DATA_S(U)[i] = u[i]
429 D.inval = NV_DATA_S(X)
430 D.state = NV_DATA_S(S)
431 self.pbase.func(U, F, &D)
432 ret = [NV_DATA_S(F)[i] for i in range(self.pbase.NEQ)]
433 N_VDestroy_Serial(X)
434 N_VDestroy_Serial(S)
435 N_VDestroy_Serial(U)
436 N_VDestroy_Serial(F)
437 return ret
438
439 def __init__(self):
440 cdef np.npy_intp i
441 cdef int j
442 self.inp = N_VNew_Serial(self.pbase.N_IN)
443 self._state = N_VNew_Serial(self.pbase.NDIM-self.pbase.N_IN)
444 i = self.pbase.NDIM-self.pbase.N_IN
445 self.state_min = np.PyArray_SimpleNew(1, &i, np.NPY_DOUBLE)
446 self.state_min[:] = 1e99
447 self.state_max = np.PyArray_SimpleNew(1, &i, np.NPY_DOUBLE)
448 self.state_max[:] = -1e99
449 self.outp = N_VNew_Serial(self.pbase.NEQ)
450 self.idx = <int*>malloc(2*sizeof(int))
451 for i in range(self.pbase.N_OUT):
452 j = find_idx(self.pbase.out_names[i], self.pbase.var_names, self.pbase.NEQ)
453 if j < 0:
454 raise ValueError("not found: %s", self.pbase.out_names[i])
455 self.idx[i] = j
456 self.state = self.operating_point
457
458
459 cdef class tcParams(CalcBase):
460 def __cinit__(self):
461 self.pbase = new TriodeCircuit()
462
463
464 cdef class ctcParams(CalcBase):
465 def __cinit__(self):
466 self.pbase = new CoupledTriodeCircuit()
467
468
469 cdef class pagParams(CalcBase):
470 def __cinit__(self):
471 self.pbase = new PowerAmpGate()
472
473 cdef class papParams(CalcBase):
474 def __cinit__(self):
475 self.pbase = new PowerAmpPlate()
476
477 def Xpre_call(self, A, with_state):
478 return np.append(A[:,0], A[:,1] + A[:,0], axis=1)
479
480 def post_call(self, O, with_state):
481 if with_state:
482 return np.append(O[:,:1] - O[:,1:2], O[:,2:], axis=1)
483 else:
484 return O[:,0] - O[:,1]
485
486 def func(self, a, state):
487 # expects [Ug1, Ug1+Ug2]
488 # returns Ua1 - Ua2
489 cdef int i
490 cdef N_Vector x = N_VNew_Serial(self.pbase.N_IN)
491 cdef N_Vector s = N_VNew_Serial(self.pbase.NDIM-self.pbase.N_IN)
492 cdef N_Vector u = N_VNew_Serial(self.pbase.NEQ)
493 for i in range(self.pbase.N_IN):
494 NV_DATA_S(x)[i] = a[i]
495 for i in range(self.pbase.NDIM-self.pbase.N_IN):
496 NV_DATA_S(s)[i] = state[i]
497 #NV_DATA_S(x)[1] -= NV_DATA_S(x)[0] #added
498 i = self.pbase.calc(x, s, u)
499 if i:
500 raise ConvergenceError(i, a, state)
501 self.pbase.update(u, x, s)
502 for i in range(self.pbase.NDIM-self.pbase.N_IN):
503 state[i] = NV_DATA_S(s)[i]
504 ret = [NV_DATA_S(u)[3] - NV_DATA_S(u)[4]] #changed
505 N_VDestroy_Serial(x)
506 N_VDestroy_Serial(s)
507 N_VDestroy_Serial(u)
508 return ret
509
510
511 cdef class psParams(CalcBase):
512 def __cinit__(self):
513 self.pbase = new PhaseSplitter()
514
515 def feedback_coeff(self, double pres):
516 cdef double b0, b1, a1
517 (<PhaseSplitter*>self.pbase).feedback_coeff(&b0, &b1, &a1, pres)
518 return b0, b1, a1
519
520
521 cdef class Spline:
522 cdef CSpline *spl
523 cdef np.ndarray y
524
525 def __cinit__(self, np.ndarray[np.float_t,ndim=1] y, double xstart, double h):
526 self.y = y
527 self.spl = new CSpline(<double*>np.PyArray_DATA(y), len(y), xstart, h)
528
529 def __dealloc__(self):
530 del self.spl
531
532 def __call__(self, np.ndarray[np.float_t,ndim=1] x):
533 cdef int i
534 cdef double v
535 out = np.empty_like(x)
536 for i in range(len(x)):
537 out[i] = self.spl.eval(x[i])
538 return out
539
540 # Local Variables:
541 # compile-command: "rm -f pycircuit.so; python setup.py build_ext --inplace"
542 # End:
0 from distutils.core import setup
1 from distutils.extension import Extension
2 from Cython.Distutils import build_ext
3
4 ext_modules = [Extension("pycircuit",
5 ["pycircuit.pyx"],
6 language="c++",
7 libraries=["sundials_kinsol","sundials_nvecserial","lapack","rt"],
8 extra_objects=["circuit.cc"],
9 extra_compile_args=['-UNDEBUG'],
10 extra_link_args=['-fPIC','-UNDEBUG'],
11 )]
12
13 setup(
14 cmdclass = {'build_ext': build_ext},
15 ext_modules = ext_modules
16 )
0 import sys; sys.path.append("..")
1 import numpy as np
2 import pluginloader
3
4 data = np.array((
5 -0.0290103 , -0.02684951, -0.02474904, -0.02275467, -0.02080619,
6 -0.01886916, -0.01686096, -0.01475108, -0.01247537, -0.00993085,
7 -0.00711274, -0.0040803 , -0.00090325, 0.00237584, 0.0056951 ,
8 0.00895047, 0.01215279, 0.01532888, 0.01846802, 0.0215832 ,
9 0.02470756, 0.02786744, 0.03104711, 0.03428566, 0.03763735,
10 0.04110992, 0.04472768, 0.04847527, 0.05222678, 0.05587375,
11 0.05941474, 0.06279755, 0.06599367, 0.06898189, 0.07170856,
12 0.0740819 , 0.0760802 , 0.07778156, 0.07922566, 0.08061182,
13 0.08192587, 0.08335137, 0.08490515, 0.08666515, 0.08860099,
14 0.09070063, 0.09294415, 0.09534264, 0.09780431, 0.1003077 ,
15 0.10280156, 0.10524273, 0.1076082 , 0.10989535, 0.1121639 ,
16 0.11444795, 0.11676121, 0.11915565, 0.12163615, 0.12423444,
17 0.12692463, 0.12973499, 0.13264489, 0.13569272, 0.13878357,
18 0.14183223, 0.14481664, 0.14764428, 0.15026379, 0.15261149,
19 0.15465033, 0.15633881, 0.1576283 , 0.15838623, 0.15861487,
20 0.15821159, 0.15721345, 0.15559149, 0.15342057, 0.15082347,
21 0.14790666, 0.14466608, 0.14119101, 0.13745093, 0.13352144,
22 0.12944591, 0.12520969, 0.12087071, 0.11645627, 0.11191988,
23 0.1072613 , 0.10253048, 0.09777272, 0.09305346, 0.0884372 ,
24 0.08401942, 0.07993639, 0.07621801, 0.07291341, 0.07001674,
25 ), dtype=np.float32)
26
27 dsp = [pluginloader.Plugin("gxplugins_.so", i) for i in range(2)]
28 dsp[0].init(96000)
29 dsp[1].init(96000)
30 dsp[1].compute(dsp[0].compute(data))
0 import sys, os, traceback
1 import circuit
2 from tensbs import splinetable
3 import multiprocessing as mp
4 import numpy as np
5 from cStringIO import StringIO
6
7 def print_intpp_data(i):
8 p = components_list[i]()
9 o = StringIO()
10 if hasattr(p, "init"):
11 p.init()
12 print >>o, "namespace %s {" % p.comp_id
13 r, order_tab = splinetable.print_intpp_data(o, "", "", p, p.ranges, p.basegrid)
14 print >>o, "splinecoeffs sc[%d] = {" % p.NVALS
15 f_set = set()
16 for j, row in enumerate(order_tab):
17 inst = "splinedata::splev<%s>" % ",".join([str(v) for v in row if v is not None])
18 f_set.add(inst)
19 print >>o, "\t{x0_%d, xe_%d, hi_%d, n_%d, nmap_%d, map_%d, t_%d, c_%d, %s}," % (j, j, j, j, j, j, j, j, inst)
20 print >>o, "};"
21 print >>o, "splinedata sd = {"
22 print >>o, "\tsc,"
23 print >>o, "\t%d, /* number of calculated values */" % p.NVALS
24 print >>o, "\t%d, /* number of input values */" % p.N_IN
25 print >>o, "\t%d, /* number of output values */" % (p.NVALS-(p.NDIM-p.N_IN))
26 print >>o, "\t%d, /* number of state values */" % (p.NDIM-p.N_IN)
27 print >>o, '\t"%s",' % p.comp_id
28 print >>o, "};"
29 print >>o, "}; /* ! namespace %s */" % p.comp_id
30 o.seek(0)
31 return r, o.read(), f_set, p.comp_name, p.comp_id;
32
33 def print_header_file_start(h):
34 print >>h, """\
35 #ifndef _DATA_H
36 #define _DATA_H 1
37
38 #include "intpp.h"
39
40 namespace AmpData {
41 extern real b0;
42 extern real b1;
43 extern real a1;
44 extern int fs;
45
46 """
47
48 def print_header_file_end(h):
49 print >>h, """\
50 }
51
52 #endif /* !_DATA_H */
53 """
54
55 def print_header_file_entry(h, f):
56 print >>h, "namespace %s { extern splinedata sd; }" % f
57
58 def print_header(o):
59 print >>o, '#include "intpp.h"'
60 print >>o, "namespace AmpData {"
61 if 0:
62 b0, b1, a1 = circuit.PhaseSplitter().feedback_coeff(1.0)
63 print >>o, "real b0 = %g;" % b0
64 print >>o, "real b1 = %g;" % b1
65 print >>o, "real a1 = 1 - %g;" % (1 - a1)
66 print >>o, "int fs = %d;" % circuit.FS
67 return 3 * np.float32().nbytes + np.int32().nbytes
68
69 def print_footer(o):
70 print >>o, "} // namespace AmpData"
71 return 0
72
73 components_list = [
74 circuit.PhaseSplitter_JCM800,
75 circuit.PPGate_JCM800,
76 circuit.PPPlate_JCM800,
77 circuit.CoupledTriode,
78 ]
79
80 def write_files(o, inst, h):
81 if True: # set to False for sequential computation in the current process
82 pool = mp.Pool(mp.cpu_count()+1)
83 procs = [pool.apply_async(print_intpp_data, [i]) for i in range(len(components_list))]
84 else:
85 procs = [print_intpp_data(i) for i in range(len(components_list))]
86 print_header_file_start(h)
87 sz = print_header(o)
88 l = []
89 templ = set()
90 for p in procs:
91 if hasattr(p, "get"):
92 p = p.get()
93 s, f, i, comp_name, comp_id = p
94 o.write(f)
95 templ |= i
96 l.append("%s: %d bytes" % (comp_name, s))
97 sz += s
98 print_header_file_entry(h, comp_id)
99 sz += print_footer(o)
100 l.append("data size sum: %d bytes" % sz)
101 print >>o, "".join(["\n// " + s for s in l])
102 print_header_file_end(h)
103 for v in sorted(templ):
104 print >>inst, "template int %s(splinecoeffs *p, real xi[2], real *res);" % v
105
106 def main():
107 if len(sys.argv) > 1:
108 o = open(sys.argv[1], "w")
109 inst = open(sys.argv[2], "w")
110 h = open(sys.argv[3], "w")
111 files = sys.argv[1:4]
112 else:
113 o = sys.stdout
114 inst = sys.stdout
115 h = sys.stdout
116 files = []
117 try:
118 write_files(o, inst, h)
119 except Exception:
120 traceback.print_exc()
121 for f in files:
122 try:
123 os.remove(f)
124 except:
125 pass
126 raise SystemExit(1)
127
128 if __name__ == "__main__":
129 main()
0 #include <zita-resampler/resampler.h>
1 #include <glibmm/i18n.h>
2 #include "intpp.h"
3 #include "data.h"
4 #include "gx_plugin.h"
5 #include <stdio.h>
6
7 /****************************************************************
8 ** Resampler
9 */
10 #include <cassert>
11 #include <cmath>
12
13 class FixedRateResampler {
14 private:
15 Resampler r_up, r_down;
16 int inputRate, outputRate;
17 int last_in_count;
18 public:
19 int setup(int _inputRate, int _outputRate);
20 int up(int count, float *input, float *output);
21 void down(float *input, float *output);
22 int max_out_count(int in_count) {
23 return static_cast<int>(ceil((in_count*static_cast<double>(outputRate))/inputRate)); }
24 };
25
26 int FixedRateResampler::setup(int _inputRate, int _outputRate)
27 {
28 const int qual = 16; // resulting in a total delay of 2*qual (0.7ms @44100)
29 inputRate = _inputRate;
30 outputRate = _outputRate;
31 if (inputRate == outputRate) {
32 return 0;
33 }
34 // upsampler
35 int ret = r_up.setup(inputRate, outputRate, 1, qual);
36 if (ret) {
37 return ret;
38 }
39 // k == filtlen() == 2 * qual
40 // pre-fill with k-1 zeros
41 r_up.inp_count = r_up.filtlen() - 1;
42 r_up.out_count = 1;
43 r_up.inp_data = r_up.out_data = 0;
44 r_up.process();
45 // downsampler
46 ret = r_down.setup(outputRate, inputRate, 1, qual);
47 if (ret) {
48 return ret;
49 }
50 // k == filtlen() == 2 * qual * fact
51 // pre-fill with k-2 zeros
52 r_down.inp_count = r_down.filtlen() - 2;
53 r_down.out_count = 1;
54 r_down.inp_data = r_down.out_data = 0;
55 r_down.process();
56 return 0;
57 }
58
59 int FixedRateResampler::up(int count, float *input, float *output)
60 {
61 if (inputRate == outputRate) {
62 memcpy(output, input, count*sizeof(float));
63 r_down.out_count = count;
64 return count;
65 }
66 r_up.inp_count = count;
67 r_down.out_count = count+1; // +1 == trick to drain input
68 r_up.inp_data = input;
69 int m = max_out_count(count);
70 r_up.out_count = m;
71 r_up.out_data = output;
72 r_up.process();
73 assert(r_up.inp_count == 0);
74 assert(r_up.out_count <= 1);
75 r_down.inp_count = m - r_up.out_count;
76 return r_down.inp_count;
77 }
78
79 void FixedRateResampler::down(float *input, float *output)
80 {
81 if (inputRate == outputRate) {
82 memcpy(output, input, r_down.out_count*sizeof(float));
83 return;
84 }
85 r_down.inp_data = input;
86 r_down.out_data = output;
87 r_down.process();
88 assert(r_down.inp_count == 0);
89 assert(r_down.out_count == 1);
90 }
91
92 namespace gx_engine {
93
94 /****************************************************************
95 ** Pre Amp
96 */
97
98 class preCalc: public SplineCalc {
99 public:
100 preCalc(splinedata *sd_, real *s0_): SplineCalc(sd_, s0_) {}
101 void calc(real *in, real *out);
102 };
103
104 void preCalc::calc(real *in, real *out)
105 {
106 temp[0] = in[0] - temp[1];
107 real t[sd->m];
108 for (int i = 0; i < sd->m; i++) {
109 splinecoeffs *p = &sd->sc[i];
110 check(sd, temp, (*p->eval)(p, temp, &t[i]));
111 }
112 for (int i = 0; i < sd->n_output; i++) {
113 out[i] = t[i];
114 }
115 for (int i = 0; i < sd->n_state; i++) {
116 temp[i+sd->n_input] += t[i+sd->n_output];
117 }
118 }
119
120 class PreAmp {
121 private:
122 preCalc pre;
123 real Uin;
124 static const real TransN;
125 static const real Fdamp;
126
127 public:
128 PreAmp();
129 ~PreAmp();
130 float operator()(float v);
131 };
132
133 static real ctc0[] = { 2.2423, 266.95 };
134
135 PreAmp::PreAmp()
136 : pre(&AmpData::ct::sd, ctc0)
137 {
138 pre.reset();
139 }
140
141 PreAmp::~PreAmp()
142 {
143 }
144
145 inline float PreAmp::operator()(float v)
146 {
147 real Uout;
148 pre.calc(&v, &Uout);
149 return Uout;
150 }
151
152 static PreAmp PreAmp1;
153 static PreAmp PreAmp2;
154 static PreAmp PreAmp3;
155 static PreAmp PreAmp4;
156 static PreAmp PreAmp5;
157 static PreAmp PreAmp6;
158
159 #include "gx_faust_support.h"
160 #include "gxpreamp.cc"
161
162 /****************************************************************/
163
164 FixedRateResampler pre_smp;
165
166 void Pre_init(unsigned int samplingFreq, PluginDef*)
167 {
168 pre_smp.setup(samplingFreq, AmpData::fs);
169 gxpreamp::init(AmpData::fs);
170 }
171
172 void run_preamp(int count, float* input, float* output, PluginDef *plugin) {
173 float buf[pre_smp.max_out_count(count)];
174 int n = pre_smp.up(count, input, buf);
175 gxpreamp::compute(n, buf, buf, plugin);
176 pre_smp.down(buf, output);
177 }
178
179 int preamp_register(const ParamReg& reg)
180 {
181 gxpreamp::register_params(reg);
182 return 0;
183 }
184
185 int preamp_load_ui(const UiBuilder& b, int form) {
186 if (!(form & UI_FORM_STACK)) {
187 return -1;
188 }
189 b.openHorizontalhideBox("");
190 {
191 b.create_master_slider("gxpreamp.gain1", 0);
192 }
193 b.closeBox();
194 b.openVerticalBox("");
195 {
196 b.openHorizontalBox("");
197 {
198 b.create_small_rackknob("gxpreamp.gain1", 0);
199 b.create_small_rackknob("gxpreamp.gain2", 0);
200 b.create_small_rackknob("gxpreamp.gain3", 0);
201 }
202 b.closeBox();
203 }
204 b.closeBox();
205 return 0;
206 }
207
208
209 /****************************************************************
210 ** Power Amp
211 */
212
213 class psCalc: public SplineCalc {
214 public:
215 psCalc(splinedata *sd_, real *s0_): SplineCalc(sd_, s0_) {}
216 void calc(real *in, real *out);
217 };
218
219 void psCalc::calc(real *in, real *out)
220 {
221 real temp1[3];
222 temp1[0] = in[0] - temp[1];
223 temp1[1] = temp[2];
224 temp1[2] = temp[3];
225 real t[sd->m];
226 for (int i = 0; i < sd->m; i++) {
227 splinecoeffs *p = &sd->sc[i];
228 check(sd, temp1, (*p->eval)(p, temp1, &t[i]));
229 }
230 for (int i = 0; i < sd->n_output; i++) {
231 out[i] = t[i];
232 }
233 for (int i = 0; i < sd->n_state; i++) {
234 temp[i+sd->n_input] += t[i+sd->n_output];
235 }
236 }
237
238 class gCalc: public SplineCalc {
239 public:
240 gCalc(splinedata *sd_, real *s0_): SplineCalc(sd_, s0_) {}
241 void calc(real *in, real *out);
242 };
243
244 void gCalc::calc(real *in, real *out)
245 {
246 for (int i = 0; i < sd->n_input; i++) {
247 temp[i] = in[i];
248 }
249 temp[0] -= temp[1] - 311.045;
250 real t[sd->m];
251 for (int i = 0; i < sd->m; i++) {
252 splinecoeffs *p = &sd->sc[i];
253 check(sd, temp, (*p->eval)(p, temp, &t[i]));
254 }
255 out[0] = t[0];
256 temp[1] += t[1] - 311.045;
257 }
258
259 class ptCalc: public SplineCalc {
260 public:
261 ptCalc(splinedata *sd_, real *s0_): SplineCalc(sd_, s0_) {}
262 void calc(real *in, real *out);
263 };
264
265 void ptCalc::calc(real *in, real *out)
266 {
267 for (int i = 0; i < sd->n_input; i++) {
268 temp[i] = in[i];
269 }
270 real t[sd->m];
271 for (int i = 0; i < sd->m; i++) {
272 splinecoeffs *p = &sd->sc[i];
273 check(sd, temp, (*p->eval)(p, temp, &t[i]));
274 }
275 for (int i = 0; i < sd->n_output; i++) {
276 out[i] = t[i];
277 }
278 for (int i = 0; i < sd->n_state; i++) {
279 temp[i+sd->n_input] += t[i+sd->n_output];
280 }
281 }
282
283 class Amp {
284 private:
285 psCalc ps;
286 gCalc g1;
287 gCalc g2;
288 ptCalc pt;
289 void reset();
290 static const real TransN;
291 static const real Fdamp;
292
293 public:
294 Amp();
295 ~Amp();
296 float operator()(float v);
297 };
298
299 static real ps0[] = { -29.77995343, 29.64688073, 0.13308519 };
300 static real g10[] = { 311.045 };
301 static real g20[] = { 302.032 };
302 static real pt0[] = { 427.582 };
303
304 Amp::Amp()
305 : ps(&AmpData::ps_jcm800::sd, ps0),
306 g1(&AmpData::ppg_jcm800::sd, g10),
307 g2(&AmpData::ppg_jcm800::sd, g20),
308 pt(&AmpData::ppp_jcm800::sd, pt0)
309 {
310 reset();
311 }
312
313 Amp::~Amp()
314 {
315 }
316
317
318 const real Amp::TransN = 450.0;
319 const real Amp::Fdamp = 15.0;
320
321 void Amp::reset()
322 {
323 ps.reset();
324 g1.reset();
325 g2.reset();
326 pt.reset();
327 }
328
329 inline float Amp::operator()(float v)
330 {
331 real s[2];
332 ps.calc(&v, s);
333 real up[2];
334 g1.calc(&s[0], &up[0]);
335 g2.calc(&s[1], &up[1]);
336 real Uout;
337 //up[1] += up[0]; // pt spline table expects signal + sum
338 pt.calc(up, &Uout);
339 return Uout;
340 }
341
342 static Amp PowAmp;
343
344 #include "gxpoweramp.cc"
345
346 /****************************************************************/
347
348 FixedRateResampler smp;
349
350 void PAinit(unsigned int samplingFreq, PluginDef*)
351 {
352 smp.setup(samplingFreq, AmpData::fs);
353 gxpoweramp::init(AmpData::fs);
354 }
355
356 void run_poweramp(int count, float* input, float* output, PluginDef *plugin) {
357 float buf[smp.max_out_count(count)];
358 int n = smp.up(count, input, buf);
359 gxpoweramp::compute(n, buf, buf, plugin);
360 smp.down(buf, output);
361 }
362
363 int poweramp_register(const ParamReg& reg)
364 {
365 gxpoweramp::register_params(reg);
366 return 0;
367 }
368
369 int poweramp_load_ui(const UiBuilder& b, int form) {
370 if (!(form & UI_FORM_STACK)) {
371 return -1;
372 }
373 b.openHorizontalhideBox("");
374 {
375 b.create_master_slider("gxpoweramp.Pregain", 0);
376 }
377 b.closeBox();
378 b.openVerticalBox("");
379 {
380 b.openHorizontalBox("");
381 {
382 b.create_small_rackknob("gxpoweramp.R4", "Presence");
383 b.create_small_rackknob("gxpoweramp.fbgain", "FeedBack");
384 b.create_small_rackknob("gxpoweramp.Pregain", "PreGain");
385 b.create_small_rackknob("gxpoweramp.postgain", "PostGain");
386 }
387 b.closeBox();
388 }
389 b.closeBox();
390 return 0;
391 }
392
393 extern "C" __attribute__ ((visibility ("default"))) int
394 get_gx_plugin(unsigned int idx, PluginDef **pplugin)
395 {
396 const int count = 2;
397 if (!pplugin) {
398 return count;
399 }
400 switch (idx) {
401 case 0: {
402 PluginDef *p = gxpreamp::plugin();
403 p->mono_audio = run_preamp;
404 p->set_samplerate = Pre_init;
405 p->register_params = preamp_register;
406 p->load_ui = preamp_load_ui;
407 *pplugin = p;
408 return count;
409 }
410 case 1: {
411 PluginDef *p = gxpoweramp::plugin();
412 p->mono_audio = run_poweramp;
413 p->set_samplerate = PAinit;
414 p->register_params = poweramp_register;
415 p->load_ui = poweramp_load_ui;
416 *pplugin = p;
417 return count;
418 }
419 default:
420 *pplugin = 0;
421 return -1;
422 }
423 }
424
425 } // namespace gx_engine
0 declare name "PowerAmp";
1 import("../../src/faust/guitarix.lib");
2
3 feedbackfilter = (_ <: *(b0), (mem : *(b1)) :> + ~ *(a1)) with {
4 k = *(1e3);
5 M = *(1e6);
6 nF = *(1e-9);
7 pF = *(1e-12);
8 R3 = 100:k;
9 R4m = 22:k;
10 R4 = vslider("R4", R4m, 0, R4m, 100);
11 R5 = 4.7:k;
12 C3 = 100:nF;
13 B0 = R5;
14 B1 = R4*R5*C3;
15 A0 = R3 + R5;
16 A1 = C3*R4*R5 + C3*R3*R5 + C3*R3*R4;
17 a = A0 + 2*A1*SR;
18 a1 = -1 * (A0 - 2*A1*SR) / a;
19 b0 = (B0 + 2*B1*SR) / a;
20 b1 = (B0 - 2*B1*SR) / a;
21 };
22
23 Xprocess = PowAmp with { PowAmp = ffunction(float PowAmp(float), <math.h>, ""); };
24
25 process = *(pregain) : (+ : PowAmp) ~ (feedbackfilter : *(-fbgain)) : *(postgain) with {
26 PowAmp = ffunction(float PowAmp(float), <math.h>, "");
27 pregain = vslider("Pregain",0,-20,40,0.1) : db2linear : smoothi(0.999);
28 postgain = vslider("postgain", 0, -20.0, 20.0, 0.1) : db2linear : /(450): smoothi(0.999);
29 fbgain = vslider("fbgain", -1, -40.0, 20.0, 0.1) : db2linear : /(15): smoothi(0.999);
30 };
0 declare name "PreAmp";
1 import("../../src/faust/guitarix.lib");
2
3 Xprocess = PreAmp with { PreAmp = ffunction(float PreAmp1(float), <math.h>, ""); };
4
5 process = *(gain1) : PreAmp1 : highpass(1,31.0) : *(2/92)
6 : *(gain2) : PreAmp2 : highpass(1,31.0) : *(2/92)
7 : *(gain3) : PreAmp3 : highpass(1,31.0) : *(2/92)
8 with {
9 PreAmp1 = ffunction(float PreAmp1(float), <math.h>, "");
10 PreAmp2 = ffunction(float PreAmp2(float), <math.h>, "");
11 PreAmp3 = ffunction(float PreAmp3(float), <math.h>, "");
12 gain1 = vslider("gain1",0,-20,40,0.1) : db2linear : smoothi(0.999);
13 gain2 = vslider("gain2",0,-20,40,0.1) : db2linear : smoothi(0.999);
14 gain3 = vslider("gain3",0,-20,40,0.1) : db2linear : smoothi(0.999);
15 };
16
17 /*
18 process = *(gain3) : PreAmp3 : highpass(1,31.0) : *(2/92)
19 : *(gain1) : mix(gain2, PreAmp1 : highpass(1,31.0), PreAmp2 : highpass(1,31.0)) : *(2/92)
20 with {
21 mix(w, Fx1, Fx2) = _ <: Fx1, Fx2 : balance(w) : +;
22 PreAmp1 = ffunction(float PreAmp1(float), <math.h>, "");
23 PreAmp2 = ffunction(float PreAmp2(float), <math.h>, "");
24 PreAmp3 = ffunction(float PreAmp3(float), <math.h>, "");
25 PreAmp4 = ffunction(float PreAmp4(float), <math.h>, "");
26 PreAmp5 = ffunction(float PreAmp5(float), <math.h>, "");
27 PreAmp6 = ffunction(float PreAmp6(float), <math.h>, "");
28 gain1 = vslider("gain1",0,-20,40,0.1) : db2linear : smoothi(0.999);
29 gain2 = vslider("gain2",0,-1,1,0.1);
30 gain3 = vslider("gain3",0,-20,40,0.1) : db2linear : smoothi(0.999);
31 };
32 */
0 #include <cstdio>
1 #include <cstdlib>
2 #include "intpp.h"
3
4 #include "intpp_inst.cc"
5
6 /****************************************************************
7 ** fpbspl evaluates the k non-zero b-splines of order k
8 ** at t[l] <= x < t[l+1] using the stable recurrence relation
9 ** of de boor and cox.
10 **
11 ** t: knot array
12 ** k: order (2 <= k <= 6)
13 ** h[k]: output array
14 */
15 template<int K> static void fpbspl(float *t, real x, int l, real *h)
16 {
17 real hh[K-1];
18 h[0] = 1;
19 for (int j = 0; j < K-1; j++) {
20 for (int i = 0; i <= j; i++) {
21 hh[i] = h[i];
22 }
23 h[0] = 0;
24 for (int i = 0; i <= j; i++) {
25 int li = l+i+1;
26 int lj = li-j-1;
27 real f = hh[i]/(t[li]-t[lj]);
28 h[i] = h[i]+f*(t[li]-x);
29 h[i+1] = f*(x-t[lj]);
30 }
31 }
32 }
33
34 /****************************************************************
35 ** search for knot interval
36 ** n: len(map)
37 ** k: order
38 ** returns index l: t[l] <= x < t[l+1]
39 */
40 static inline int find_index(int n, int k, real *x, real xi, real x0, real xe, real stepi, char* cl)
41 {
42 int l;
43 if (k % 2) {
44 l = static_cast<int>((xi - x0) * stepi + 0.5);
45 } else {
46 l = static_cast<int>((xi - x0) * stepi);
47 }
48 if (l < 0) {
49 *cl = -1;
50 *x = x0;
51 return 0;
52 }
53 if (l >= n) {
54 *cl = 1;
55 *x = xe;
56 return n-1;
57 }
58 *x = xi;
59 return l;
60 }
61
62 template<int K>
63 static inline int forward(int i, splinecoeffs *p, real *xi, real *x, int ll,
64 splinedata::retval *cl, real *h)
65 {
66 int l = p->map[i][find_index(p->nmap[i], K, &x[i], xi[i], p->x0[i], p->xe[i], p->stepi[i], &cl->c[i])];
67 fpbspl<K>(p->t[i],x[i],l,h);
68 return ll*p->n[i] + l-K+1;
69 }
70
71 /****************************************************************
72 ** evaluate the spline function at x
73 **
74 ** t[n+k]: knot array
75 ** c[m][n]: coefficents
76 ** k: order (2 <= k <= 5), order = degree + 1
77 ** x: function argument
78 ** res: output array (size m)
79 */
80 template<int K0>
81 int splinedata::splev(splinecoeffs *p, real xi[1], real *res)
82 {
83 real h[K0];
84 real x;
85 retval cl;
86 cl.i = 0;
87 int ll = 0;
88 ll = forward<K0>(0, p, xi, &x, ll, &cl, h);
89 real sp = 0;
90 for (int j = 0; j < K0; j++) {
91 sp += p->c[0][ll+j]*h[j];
92 }
93 *res = sp;
94 return cl.i;
95 }
96
97 /****************************************************************
98 ** evaluate the X-dim spline function
99 **
100 ** t: array of pointers to knot arrays
101 ** c[m][n[0]]...[n[X-1]]: coefficents
102 ** k: orders (2 <= k[i] <= 5), order = degree + 1
103 ** x: function arguments
104 ** res[m]: output array
105 */
106 template<int K0, int K1>
107 int splinedata::splev(splinecoeffs *p, real xi[2], real *res)
108 {
109 real h[2][6];
110 real x[2];
111 retval cl;
112 cl.i = 0;
113 int ll = 0;
114 ll = forward<K0>(0, p, xi, x, ll, &cl, h[0]);
115 ll = forward<K1>(1, p, xi, x, ll, &cl, h[1]);
116 float *cc = p->c[0];
117 int lc = ll;
118 int j[2];
119 real sp = 0;
120 for (j[0] = 0; j[0] < K0; j[0]++) {
121 for (j[1] = 0; j[1] < K1; j[1]++) {
122 sp += cc[lc]*h[0][j[0]]*h[1][j[1]];
123 lc += 1;
124 }
125 lc += p->n[1]-K1;
126 }
127 *res = sp;
128 return cl.i;
129 }
130
131 template<int K0, int K1, int K2>
132 int splinedata::splev(splinecoeffs *p, real xi[3], real *res)
133 {
134 real h[3][6];
135 real x[3];
136 retval cl;
137 cl.i = 0;
138 int ll = 0;
139 ll = forward<K0>(0, p, xi, x, ll, &cl, h[0]);
140 ll = forward<K1>(1, p, xi, x, ll, &cl, h[1]);
141 ll = forward<K2>(2, p, xi, x, ll, &cl, h[2]);
142 float *cc = p->c[0];
143 int lc = ll;
144 int j[3];
145 real sp = 0;
146 for (j[0] = 0; j[0] < K0; j[0]++) {
147 for (j[1] = 0; j[1] < K1; j[1]++) {
148 for (j[2] = 0; j[2] < K2; j[2]++) {
149 sp += cc[lc]*h[0][j[0]]*h[1][j[1]]*h[2][j[2]];
150 lc += 1;
151 }
152 lc += p->n[2]-K2;
153 }
154 lc += (p->n[1]-K1)*p->n[2];
155 }
156 *res = sp;
157 return cl.i;
158 }
159
160 template<int K0, int K1, int K2, int K3>
161 int splinedata::splev(splinecoeffs *p, real xi[4], real *res)
162 {
163 real h[4][6];
164 real x[4];
165 retval cl;
166 cl.i = 0;
167 int ll = 0;
168 ll = forward<K0>(0, p, xi, x, ll, &cl, h[0]);
169 ll = forward<K1>(1, p, xi, x, ll, &cl, h[1]);
170 ll = forward<K2>(2, p, xi, x, ll, &cl, h[2]);
171 ll = forward<K3>(3, p, xi, x, ll, &cl, h[3]);
172 float *cc = p->c[0];
173 int lc = ll;
174 int j[4];
175 real sp = 0;
176 for (j[0] = 0; j[0] < K0; j[0]++) {
177 for (j[1] = 0; j[1] < K1; j[1]++) {
178 for (j[2] = 0; j[2] < K2; j[2]++) {
179 for (j[3] = 0; j[3] < K3; j[3]++) {
180 sp += cc[lc]*h[0][j[0]]*h[1][j[1]]*h[2][j[2]]*h[3][j[3]];
181 lc += 1;
182 }
183 lc += p->n[3]-K3;
184 }
185 lc += (p->n[2]-K2)*p->n[3];
186 }
187 lc += (p->n[1]-K1)*p->n[2]*p->n[3];
188 }
189 *res = sp;
190 return cl.i;
191 }
192
193 SplineCalc::SplineCalc(splinedata *sd_, real *s0_)
194 : sd(sd_),
195 s0(s0_),
196 temp(new real[sd->n_input+sd->n_state]) {
197 }
198
199 SplineCalc::~SplineCalc() {
200 delete[] temp;
201 }
202
203 #ifdef CHECK_BOUNDS
204 void report(splinedata *sd, real *t, int i)
205 {
206 printf("%s:", sd->func_id);
207 splinedata::retval cl;
208 cl.i = i;
209 for (int n = 0; n < 4; n++) {
210 if (cl.c[n] < 0) {
211 printf(" %d:L[%g]", n, t[n]);
212 } else if (cl.c[n] > 0) {
213 printf(" %d:U[%g]", n, t[n]);
214 }
215 }
216 printf("\n");
217 }
218 #endif
219
220 void SplineCalc::calc(real *in, real *out)
221 {
222 for (int i = 0; i < sd->n_input; i++) {
223 temp[i] = in[i];
224 }
225 real t[sd->m];
226 for (int i = 0; i < sd->m; i++) {
227 splinecoeffs *p = &sd->sc[i];
228 check(sd, temp, (*p->eval)(p, temp, &t[i]));
229 }
230 for (int i = 0; i < sd->n_output; i++) {
231 out[i] = t[i];
232 }
233 for (int i = 0; i < sd->n_state; i++) {
234 temp[i+sd->n_input] = t[i+sd->n_output];
235 }
236 }
237
238 void SplineCalc::reset()
239 {
240 for (int i = 0; i < sd->n_state; i++) {
241 temp[i+sd->n_input] = s0[i];
242 }
243 }
0 #ifndef _INTPP_H
1 #define _INTPP_H 1
2
3 //typedef double real;
4 typedef float real;
5
6 struct splinecoeffs {
7 real *x0;
8 real *xe;
9 real *stepi; // 1/h
10 int *n;
11 int *nmap;
12 unsigned char **map;
13 real **t;
14 real **c;
15 int (*eval)(splinecoeffs *p, real *x, real *res);
16 };
17
18 struct splinedata {
19 splinecoeffs *sc;
20 int m;
21 int n_input;
22 int n_output;
23 int n_state;
24 const char *func_id;
25 template<int K0> static int splev(splinecoeffs *p, real *x, real *res);
26 template<int K0, int K1> static int splev(splinecoeffs *p, real *x, real *res);
27 template<int K0, int K1, int K2> static int splev(splinecoeffs *p, real *x, real *res);
28 template<int K0, int K1, int K2, int K3> static int splev(splinecoeffs *p, real *x, real *res);
29 union retval {
30 char c[4];
31 int i;
32 };
33 };
34
35 class SplineCalc {
36 protected:
37 splinedata *sd;
38 real *s0;
39 real *temp;
40 public:
41 SplineCalc(splinedata *sd_, real *s0_);
42 ~SplineCalc();
43 void reset();
44 void calc(real *in, real *out);
45 };
46
47 //#define CHECK_BOUNDS
48
49 #ifdef CHECK_BOUNDS
50 void report(splinedata *sd, real *t, int i);
51 static inline void check(splinedata *sd, real *t, int i) { if (i) report(sd, t, i); }
52 #else
53 #define check(sd, t, i) i
54 #endif
55
56 #endif /* !_INTPP_H */
0 import circuit as cp
1 from pylab import *
2
3 def mkplot(inp, *args, **kw):
4 if isinstance(inp, (cp.pycircuit.CalcBase, Func)):
5 inp = inp.captured[:,0]
6 x = linspace(0, timespan, len(inp))
7 plot(x, inp, "r", label="Uin")
8 legend(loc=2)
9 twinx()
10 for a in args:
11 lb = None
12 if isinstance(a, tuple):
13 lb = a[1]
14 a = a[0]
15 if isinstance(a, (cp.pycircuit.CalcBase, Func)):
16 if lb is None:
17 lb = a.capture_signals
18 elif isinstance(lb, basestring):
19 lb = [lb]
20 for v, n in zip(a.captured.T, lb):
21 plot(x, v, label=n)
22 else:
23 if lb is None:
24 lb = "Ua"
25 plot(x, a, label=lb)
26 legend(loc=1)
27 if kw["head"]:
28 title(kw["head"])
29
30
31 class Func(object):
32
33 def __init__(self, p, capt=None):
34 self.p = p()
35 self.p.init()
36 if capt:
37 self.p.capture_signals = capt
38
39 def __call__(self, s):
40 self.max_in = amax(s, axis=0)
41 self.min_in = amin(s, axis=0)
42 r = self.p(s)
43 self.max_out = amax(r, axis=0)
44 self.min_out = amin(r, axis=0)
45 return r
46
47 @property
48 def captured(self):
49 return self.p.captured
50
51 @property
52 def capture_signals(self):
53 return self.p.capture_signals
54
55 def show_stat(self, l, s, mn, mx):
56 if mn.shape == ():
57 l.append("%s: %g..%g" % (s, mn, mx))
58 else:
59 l += [(s+": %g..%g") % v for v in zip(mn, mx)]
60
61 def print_statist(self):
62 l = []
63 self.show_stat(l, "IN", self.min_in, self.max_in)
64 self.show_stat(l, "OUT", self.min_out, self.max_out)
65 l += ["%s: %g..%g" % v for v in zip(self.p.state_names, self.p.min_state, self.p.max_state)]
66 s = ", ".join(l)
67 print "%s: %.0fnsec, %s" % (self.p.comp_id, self.p.nanosec_per_sample, s)
68
69
70 def sine(freq):
71 return sin(linspace(0, 2*pi*freq*timespan, cp.FS*timespan), dtype=float32)
72
73 pr1 = Func(cp.CoupledTriode, "Ua")
74 pr2 = Func(cp.CoupledTriode, "Ua")
75 pr3 = Func(cp.CoupledTriode, "Ua")
76 sp = Func(cp.PhaseSplitter_JCM800, "Ua1")
77 g1 = Func(cp.PPGate_JCM800, "Ug")
78 g2 = Func(cp.PPGate_JCM800)
79 pl = Func(cp.PPPlate_JCM800)
80
81 freq = 150.0
82 timespan = 9/freq
83 s = 0.1*sine(freq)
84 y = sp(0.4*pr3(0.4*pr2(0.5*pr1(s))))
85 s1 = g1(y[:,0])
86 s2 = g2(y[:,1])
87 #s2 += s1
88 res = pl(vstack((s1,s2)).T)
89 for v in pr1, pr2, pr3, sp, g1, g2, pl:
90 v.print_statist()
91 subplot(221)
92 mkplot(s, (pr2,"Ua Stage2"), (pr3,"Ua Stage3"), head="Preamp")
93 subplot(222)
94 mkplot(pr3, sp, head="Phase Splitter")
95 subplot(223)
96 mkplot(sp, g1, head="Poweramp Gate")
97 subplot(224)
98 mkplot(g1, res, head="Poweramp Out")
99 show()
0 import numpy as np
1 cimport numpy as np
2 np.import_array()
3 from libc.string cimport const_char
4
5 cdef extern from "intpp.h":
6 ctypedef float real
7 struct splinecoeffs:
8 real *x0
9 real *xe
10 real *stepi
11 int *n
12 int *nmap
13 int **map
14 real **t
15 real **c
16 int (*eval)(splinecoeffs *p, real *x, real *res)
17 struct splinedata:
18 splinecoeffs *sc
19 int m
20 int n_input
21 int n_output
22 int n_state
23 const_char *func_id
24 union retval "splinedata::retval":
25 char c[4]
26 int i
27
28 cdef extern from "data.h":
29 splinedata ps_jcm800_sd "AmpData::ps_jcm800::sd"
30 splinedata ppg_jcm800_sd "AmpData::ppg_jcm800::sd"
31 splinedata ppp_jcm800_sd "AmpData::ppp_jcm800::sd"
32 splinedata ct_sd "AmpData::ct::sd"
33
34 cdef rangeerror(int rv, real *Uin, splinedata *p, int n, int k):
35 cdef retval cl
36 cl.i = rv
37 l = []
38 for i in range(k):
39 if not cl.c[i]:
40 continue
41 l.append("%g not in range [%g .. %g] (parameter %d)"
42 % (Uin[i], p.sc[n].x0[i], p.sc[n].xe[i], i+1))
43 raise LookupError("%s/%d: %s" % (<char*>(p.func_id), n, " / ".join(l)))
44
45 def phasesplitter(Uin):
46 assert len(Uin) == 4
47 cdef real Uout[5]
48 cdef real t[3]
49 cdef int i
50 t[0] = Uin[0] - Uin[1]
51 t[1] = Uin[2]
52 t[2] = Uin[3]
53 cdef splinecoeffs *p
54 cdef int rv
55 for i in range(5):
56 p = &ps_jcm800_sd.sc[i]
57 rv = p.eval(p, t, &Uout[i])
58 if rv != 0:
59 rangeerror(rv, t, &ps_jcm800_sd, i, 4)
60 for i in range(3):
61 Uout[i+2] += Uin[i+1]
62 return [v for v in Uout]
63
64 def pushpullgate(Uin):
65 assert len(Uin) == 2
66 cdef real Uout[2]
67 cdef real t[2]
68 cdef int i
69 t[0] = Uin[0] - (Uin[1] - 311.045)
70 cdef splinecoeffs *p
71 cdef int rv
72 for i in range(2):
73 p = &ppg_jcm800_sd.sc[i]
74 rv = p.eval(p, t, &Uout[i])
75 if rv != 0:
76 rangeerror(rv, t, &ppg_jcm800_sd, i, 1)
77 Uout[1] += Uin[1] - 311.045
78 return [v for v in Uout]
79
80 def pushpullplate(Uin):
81 assert len(Uin) == 3
82 cdef real Uout[2]
83 cdef real t[3]
84 cdef int i
85 for i in range(3):
86 t[i] = Uin[i]
87 cdef splinecoeffs *p
88 cdef int rv
89 for i in range(2):
90 p = &ppp_jcm800_sd.sc[i]
91 rv = p.eval(p, t, &Uout[i])
92 if rv != 0:
93 rangeerror(rv, t, &ppp_jcm800_sd, i, 3)
94 Uout[1] += t[2]
95 return [v for v in Uout]
96
97 def coupledtriode(Uin):
98 assert len(Uin) == 3
99 cdef real Uout[3]
100 cdef real t[3]
101 cdef int i
102 for i in range(3):
103 t[i] = Uin[i]
104 t[0] -= t[1]
105 cdef splinecoeffs *p
106 cdef int rv
107 p = &ct_sd.sc[0]
108 rv = p.eval(p, t, &Uout[0])
109 if rv != 0:
110 rangeerror(rv, t, &ct_sd, 0, 3)
111 p = &ct_sd.sc[1]
112 rv = p.eval(p, t, &Uout[1])
113 if rv != 0:
114 rangeerror(rv, t, &ct_sd, 1, 3)
115 p = &ct_sd.sc[2]
116 rv = p.eval(p, t, &Uout[2])
117 if rv != 0:
118 rangeerror(rv, t, &ct_sd, 2, 3)
119 Uout[1] += t[1]
120 Uout[2] += t[2]
121 return [v for v in Uout]
0 from distutils.core import setup
1 from distutils.extension import Extension
2 from Cython.Distutils import build_ext
3
4 ext_modules = [Extension("pyamp",
5 ["pyamp.pyx"],
6 language="c++",
7 extra_objects=["intpp.o","data.o"],
8 extra_compile_args=['-UNDEBUG'],
9 extra_link_args=['-fPIC','-UNDEBUG'],
10 )]
11
12 setup(
13 cmdclass = {'build_ext': build_ext},
14 ext_modules = ext_modules
15 )
0 FILES=b1ink.f b2ink.f b2val.f b3ink.f b3val.f b4ink.f b4val.f
1 DEPFILES=btpcf.f bintk.f bknot.f bnslv.f xerrwv.f xerprt.f i1mach.f \
2 xersav.f j4save.f fdump.f xgetua.f bvalu.f xerctl.f \
3 xerror.f bspvn.f intrv.f bnfac.f xerabt.f
4 ONLY=b1ink b2ink b2val b3ink b3val b4ink b4val
5 OPTS=-DF2PY_REPORT_ON_ARRAY_COPY=1 --f77flags="-Wno-unused-parameter"
6
7 .PHONY: all clean
8
9 all: tensbs.so
10
11 clean:
12 rm -f tensbs.so splinetable.pyc
13
14 tensbs.so: $(FILES) $(DEPFILES) tensbs.pyf
15 f2py --quiet -c $(OPTS) -m tensbs only: $(ONLY) : tensbs.pyf $(FILES) $(DEPFILES)
0 Fortran routines in the directory taken from cmlib (public domain)
0 SUBROUTINE B1INK(X,NX,FCN,KX,TX,BCOEF,WORK,IFLAG)
1 C***BEGIN PROLOGUE B2INK
2 C***DATE WRITTEN 25 MAY 1982
3 C***REVISION DATE 25 MAY 1982
4 C***CATEGORY NO. E1A
5 C***KEYWORDS INTERPOLATION, TWO-DIMENSIONS, GRIDDED DATA, SPLINES,
6 C PIECEWISE POLYNOMIALS
7 C***AUTHOR BOISVERT, RONALD, NBS
8 C SCIENTIFIC COMPUTING DIVISION
9 C NATIONAL BUREAU OF STANDARDS
10 C WASHINGTON, DC 20234
11 C***PURPOSE B2INK DETERMINES A PIECEWISE POLYNOMIAL FUNCTION THAT
12 C INTERPOLATES TWO-DIMENSIONAL GRIDDED DATA. USERS SPECIFY
13 C THE POLYNOMIAL ORDER (DEGREE+1) OF THE INTERPOLANT AND
14 C (OPTIONALLY) THE KNOT SEQUENCE.
15 C***DESCRIPTION
16 C
17 C B2INK determines the parameters of a function that interpolates the
18 C two-dimensional gridded data (X(i),Y(j),FCN(i,j)) for i=1,..,NX and
19 C j=1,..,NY. The interpolating function and its derivatives may
20 C subsequently be evaluated by the function B2VAL.
21 C
22 C The interpolating function is a piecewise polynomial function
23 C represented as a tensor product of one-dimensional B-splines. The
24 C form of this function is
25 C
26 C NX NY
27 C S(x,y) = SUM SUM a U (x) V (y)
28 C i=1 j=1 ij i j
29 C
30 C where the functions U(i) and V(j) are one-dimensional B-spline
31 C basis functions. The coefficients a(i,j) are chosen so that
32 C
33 C S(X(i),Y(j)) = FCN(i,j) for i=1,..,NX and j=1,..,NY
34 C
35 C Note that for each fixed value of y S(x,y) is a piecewise
36 C polynomial function of x alone, and for each fixed value of x S(x,
37 C y) is a piecewise polynomial function of y alone. In one dimension
38 C a piecewise polynomial may be created by partitioning a given
39 C interval into subintervals and defining a distinct polynomial piece
40 C on each one. The points where adjacent subintervals meet are called
41 C knots. Each of the functions U(i) and V(j) above is a piecewise
42 C polynomial.
43 C
44 C Users of B2INK choose the order (degree+1) of the polynomial pieces
45 C used to define the piecewise polynomial in each of the x and y
46 C directions (KX and KY). Users also may define their own knot
47 C sequence in x and y separately (TX and TY). If IFLAG=0, however,
48 C B2INK will choose sequences of knots that result in a piecewise
49 C polynomial interpolant with KX-2 continuous partial derivatives in
50 C x and KY-2 continuous partial derivatives in y. (KX knots are taken
51 C near each endpoint, not-a-knot end conditions are used, and the
52 C remaining knots are placed at data points if KX is even or at
53 C midpoints between data points if KX is odd. The y direction is
54 C treated similarly.)
55 C
56 C After a call to B2INK, all information necessary to define the
57 C interpolating function are contained in the parameters NX, NY, KX,
58 C KY, TX, TY, and BCOEF. These quantities should not be altered until
59 C after the last call of the evaluation routine B2VAL.
60 C
61 C
62 C I N P U T
63 C ---------
64 C
65 C X Real 1D array (size NX)
66 C Array of x abcissae. Must be strictly increasing.
67 C
68 C NX Integer scalar (.GE. 3)
69 C Number of x abcissae.
70 C
71 C Y Real 1D array (size NY)
72 C Array of y abcissae. Must be strictly increasing.
73 C
74 C NY Integer scalar (.GE. 3)
75 C Number of y abcissae.
76 C
77 C FCN Real 2D array (size LDF by NY)
78 C Array of function values to interpolate. FCN(I,J) should
79 C contain the function value at the point (X(I),Y(J))
80 C
81 C LDF Integer scalar (.GE. NX)
82 C The actual leading dimension of FCN used in the calling
83 C calling program.
84 C
85 C KX Integer scalar (.GE. 2, .LT. NX)
86 C The order of spline pieces in x.
87 C (Order = polynomial degree + 1)
88 C
89 C KY Integer scalar (.GE. 2, .LT. NY)
90 C The order of spline pieces in y.
91 C (Order = polynomial degree + 1)
92 C
93 C
94 C I N P U T O R O U T P U T
95 C -----------------------------
96 C
97 C TX Real 1D array (size NX+KX)
98 C The knots in the x direction for the spline interpolant.
99 C If IFLAG=0 these are chosen by B2INK.
100 C If IFLAG=1 these are specified by the user.
101 C (Must be non-decreasing.)
102 C
103 C TY Real 1D array (size NY+KY)
104 C The knots in the y direction for the spline interpolant.
105 C If IFLAG=0 these are chosen by B2INK.
106 C If IFLAG=1 these are specified by the user.
107 C (Must be non-decreasing.)
108 C
109 C
110 C O U T P U T
111 C -----------
112 C
113 C BCOEF Real 2D array (size NX by NY)
114 C Array of coefficients of the B-spline interpolant.
115 C This may be the same array as FCN.
116 C
117 C
118 C M I S C E L L A N E O U S
119 C -------------------------
120 C
121 C WORK Real 1D array (size NX*NY + max( 2*KX*(NX+1),
122 C 2*KY*(NY+1) ))
123 C Array of working storage.
124 C
125 C IFLAG Integer scalar.
126 C On input: 0 == knot sequence chosen by B2INK
127 C 1 == knot sequence chosen by user.
128 C On output: 1 == successful execution
129 C 2 == IFLAG out of range
130 C 3 == NX out of range
131 C 4 == KX out of range
132 C 5 == X not strictly increasing
133 C 6 == TX not non-decreasing
134 C 7 == NY out of range
135 C 8 == KY out of range
136 C 9 == Y not strictly increasing
137 C 10 == TY not non-decreasing
138 C
139 C***REFERENCES CARL DE BOOR, A PRACTICAL GUIDE TO SPLINES,
140 C SPRINGER-VERLAG, NEW YORK, 1978.
141 C CARL DE BOOR, EFFICIENT COMPUTER MANIPULATION OF TENSOR
142 C PRODUCTS, ACM TRANSACTIONS ON MATHEMATICAL SOFTWARE,
143 C VOL. 5 (1979), PP. 173-182.
144 C***ROUTINES CALLED BTPCF,BKNOT
145 C***END PROLOGUE B2INK
146 C
147 C ------------
148 C DECLARATIONS
149 C ------------
150 C
151 C PARAMETERS
152 C
153 INTEGER
154 * NX, KX, IFLAG
155 REAL
156 * X(NX), FCN(NX), TX(NX+KX),
157 * BCOEF(NX), WORK(NX+2*KX*(NX+1))
158 C
159 C LOCAL VARIABLES
160 C
161 INTEGER
162 * I, IW, NPK
163 C
164 C -----------------------
165 C CHECK VALIDITY OF INPUT
166 C -----------------------
167 C
168 C***FIRST EXECUTABLE STATEMENT
169 IF ((IFLAG .LT. 0) .OR. (IFLAG .GT. 1)) GO TO 920
170 IF (NX .LT. 3) GO TO 930
171 IF ((KX .LT. 2) .OR. (KX .GE. NX)) GO TO 940
172 DO 10 I=2,NX
173 IF (X(I) .LE. X(I-1)) GO TO 950
174 10 CONTINUE
175 IF (IFLAG .EQ. 0) GO TO 50
176 NPK = NX + KX
177 DO 30 I=2,NPK
178 IF (TX(I) .LT. TX(I-1)) GO TO 960
179 30 CONTINUE
180 50 CONTINUE
181 C
182 C ------------
183 C CHOOSE KNOTS
184 C ------------
185 C
186 IF (IFLAG .NE. 0) GO TO 100
187 CALL BKNOT(X,NX,KX,TX)
188 100 CONTINUE
189 C
190 C -------------------------------
191 C CONSTRUCT B-SPLINE COEFFICIENTS
192 C -------------------------------
193 C
194 IFLAG = 1
195 IW = (2*KX-1)*NX+1
196 CALL BINTK(X,FCN,TX,NX,KX,BCOEF,WORK,WORK(IW))
197 GO TO 9999
198 C
199 C -----
200 C EXITS
201 C -----
202 C
203 920 CONTINUE
204 CALL XERRWV('B2INK - IFLAG=I1 IS OUT OF RANGE.',
205 * 35,2,1,1,IFLAG,I2,0,R1,R2)
206 IFLAG = 2
207 GO TO 9999
208 C
209 930 CONTINUE
210 IFLAG = 3
211 CALL XERRWV('B2INK - NX=I1 IS OUT OF RANGE.',
212 * 32,IFLAG,1,1,NX,I2,0,R1,R2)
213 GO TO 9999
214 C
215 940 CONTINUE
216 IFLAG = 4
217 CALL XERRWV('B2INK - KX=I1 IS OUT OF RANGE.',
218 * 32,IFLAG,1,1,KX,I2,0,R1,R2)
219 GO TO 9999
220 C
221 950 CONTINUE
222 IFLAG = 5
223 CALL XERRWV('B2INK - X ARRAY MUST BE STRICTLY INCREASING.',
224 * 46,IFLAG,1,0,I1,I2,0,R1,R2)
225 GO TO 9999
226 C
227 960 CONTINUE
228 IFLAG = 6
229 CALL XERRWV('B2INK - TX ARRAY MUST BE NON-DECREASING.',
230 * 42,IFLAG,1,0,I1,I2,0,R1,R2)
231 GO TO 9999
232 C
233 9999 CONTINUE
234 RETURN
235 END
0
1 SUBROUTINE B2INK(X,NX,Y,NY,FCN,LDF,KX,KY,TX,TY,BCOEF,WORK,IFLAG)
2 C***BEGIN PROLOGUE B2INK
3 C***DATE WRITTEN 25 MAY 1982
4 C***REVISION DATE 25 MAY 1982
5 C***CATEGORY NO. E1A
6 C***KEYWORDS INTERPOLATION, TWO-DIMENSIONS, GRIDDED DATA, SPLINES,
7 C PIECEWISE POLYNOMIALS
8 C***AUTHOR BOISVERT, RONALD, NBS
9 C SCIENTIFIC COMPUTING DIVISION
10 C NATIONAL BUREAU OF STANDARDS
11 C WASHINGTON, DC 20234
12 C***PURPOSE B2INK DETERMINES A PIECEWISE POLYNOMIAL FUNCTION THAT
13 C INTERPOLATES TWO-DIMENSIONAL GRIDDED DATA. USERS SPECIFY
14 C THE POLYNOMIAL ORDER (DEGREE+1) OF THE INTERPOLANT AND
15 C (OPTIONALLY) THE KNOT SEQUENCE.
16 C***DESCRIPTION
17 C
18 C B2INK determines the parameters of a function that interpolates the
19 C two-dimensional gridded data (X(i),Y(j),FCN(i,j)) for i=1,..,NX and
20 C j=1,..,NY. The interpolating function and its derivatives may
21 C subsequently be evaluated by the function B2VAL.
22 C
23 C The interpolating function is a piecewise polynomial function
24 C represented as a tensor product of one-dimensional B-splines. The
25 C form of this function is
26 C
27 C NX NY
28 C S(x,y) = SUM SUM a U (x) V (y)
29 C i=1 j=1 ij i j
30 C
31 C where the functions U(i) and V(j) are one-dimensional B-spline
32 C basis functions. The coefficients a(i,j) are chosen so that
33 C
34 C S(X(i),Y(j)) = FCN(i,j) for i=1,..,NX and j=1,..,NY
35 C
36 C Note that for each fixed value of y S(x,y) is a piecewise
37 C polynomial function of x alone, and for each fixed value of x S(x,
38 C y) is a piecewise polynomial function of y alone. In one dimension
39 C a piecewise polynomial may be created by partitioning a given
40 C interval into subintervals and defining a distinct polynomial piece
41 C on each one. The points where adjacent subintervals meet are called
42 C knots. Each of the functions U(i) and V(j) above is a piecewise
43 C polynomial.
44 C
45 C Users of B2INK choose the order (degree+1) of the polynomial pieces
46 C used to define the piecewise polynomial in each of the x and y
47 C directions (KX and KY). Users also may define their own knot
48 C sequence in x and y separately (TX and TY). If IFLAG=0, however,
49 C B2INK will choose sequences of knots that result in a piecewise
50 C polynomial interpolant with KX-2 continuous partial derivatives in
51 C x and KY-2 continuous partial derivatives in y. (KX knots are taken
52 C near each endpoint, not-a-knot end conditions are used, and the
53 C remaining knots are placed at data points if KX is even or at
54 C midpoints between data points if KX is odd. The y direction is
55 C treated similarly.)
56 C
57 C After a call to B2INK, all information necessary to define the
58 C interpolating function are contained in the parameters NX, NY, KX,
59 C KY, TX, TY, and BCOEF. These quantities should not be altered until
60 C after the last call of the evaluation routine B2VAL.
61 C
62 C
63 C I N P U T
64 C ---------
65 C
66 C X Real 1D array (size NX)
67 C Array of x abcissae. Must be strictly increasing.
68 C
69 C NX Integer scalar (.GE. 3)
70 C Number of x abcissae.
71 C
72 C Y Real 1D array (size NY)
73 C Array of y abcissae. Must be strictly increasing.
74 C
75 C NY Integer scalar (.GE. 3)
76 C Number of y abcissae.
77 C
78 C FCN Real 2D array (size LDF by NY)
79 C Array of function values to interpolate. FCN(I,J) should
80 C contain the function value at the point (X(I),Y(J))
81 C
82 C LDF Integer scalar (.GE. NX)
83 C The actual leading dimension of FCN used in the calling
84 C calling program.
85 C
86 C KX Integer scalar (.GE. 2, .LT. NX)
87 C The order of spline pieces in x.
88 C (Order = polynomial degree + 1)
89 C
90 C KY Integer scalar (.GE. 2, .LT. NY)
91 C The order of spline pieces in y.
92 C (Order = polynomial degree + 1)
93 C
94 C
95 C I N P U T O R O U T P U T
96 C -----------------------------
97 C
98 C TX Real 1D array (size NX+KX)
99 C The knots in the x direction for the spline interpolant.
100 C If IFLAG=0 these are chosen by B2INK.
101 C If IFLAG=1 these are specified by the user.
102 C (Must be non-decreasing.)
103 C
104 C TY Real 1D array (size NY+KY)
105 C The knots in the y direction for the spline interpolant.
106 C If IFLAG=0 these are chosen by B2INK.
107 C If IFLAG=1 these are specified by the user.
108 C (Must be non-decreasing.)
109 C
110 C
111 C O U T P U T
112 C -----------
113 C
114 C BCOEF Real 2D array (size NX by NY)
115 C Array of coefficients of the B-spline interpolant.
116 C This may be the same array as FCN.
117 C
118 C
119 C M I S C E L L A N E O U S
120 C -------------------------
121 C
122 C WORK Real 1D array (size NX*NY + max( 2*KX*(NX+1),
123 C 2*KY*(NY+1) ))
124 C Array of working storage.
125 C
126 C IFLAG Integer scalar.
127 C On input: 0 == knot sequence chosen by B2INK
128 C 1 == knot sequence chosen by user.
129 C On output: 1 == successful execution
130 C 2 == IFLAG out of range
131 C 3 == NX out of range
132 C 4 == KX out of range
133 C 5 == X not strictly increasing
134 C 6 == TX not non-decreasing
135 C 7 == NY out of range
136 C 8 == KY out of range
137 C 9 == Y not strictly increasing
138 C 10 == TY not non-decreasing
139 C
140 C***REFERENCES CARL DE BOOR, A PRACTICAL GUIDE TO SPLINES,
141 C SPRINGER-VERLAG, NEW YORK, 1978.
142 C CARL DE BOOR, EFFICIENT COMPUTER MANIPULATION OF TENSOR
143 C PRODUCTS, ACM TRANSACTIONS ON MATHEMATICAL SOFTWARE,
144 C VOL. 5 (1979), PP. 173-182.
145 C***ROUTINES CALLED BTPCF,BKNOT
146 C***END PROLOGUE B2INK
147 C
148 C ------------
149 C DECLARATIONS
150 C ------------
151 C
152 C PARAMETERS
153 C
154 INTEGER
155 * NX, NY, LDF, KX, KY, IFLAG
156 REAL
157 * X(NX), Y(NY), FCN(LDF,NY), TX(NX+KX), TY(NY+KY),
158 * BCOEF(NX,NY), WORK(NX*NY+max(2*KX*(NX+1),2*KY*(NY+1)))
159 C
160 C LOCAL VARIABLES
161 C
162 INTEGER
163 * I, IW, NPK
164 C
165 C -----------------------
166 C CHECK VALIDITY OF INPUT
167 C -----------------------
168 C
169 C***FIRST EXECUTABLE STATEMENT
170 IF ((IFLAG .LT. 0) .OR. (IFLAG .GT. 1)) GO TO 920
171 IF (NX .LT. 3) GO TO 930
172 IF (NY .LT. 3) GO TO 970
173 IF ((KX .LT. 2) .OR. (KX .GE. NX)) GO TO 940
174 IF ((KY .LT. 2) .OR. (KY .GE. NY)) GO TO 980
175 DO 10 I=2,NX
176 IF (X(I) .LE. X(I-1)) GO TO 950
177 10 CONTINUE
178 DO 20 I=2,NY
179 IF (Y(I) .LE. Y(I-1)) GO TO 990
180 20 CONTINUE
181 IF (IFLAG .EQ. 0) GO TO 50
182 NPK = NX + KX
183 DO 30 I=2,NPK
184 IF (TX(I) .LT. TX(I-1)) GO TO 960
185 30 CONTINUE
186 NPK = NY + KY
187 DO 40 I=2,NPK
188 IF (TY(I) .LT. TY(I-1)) GO TO 1000
189 40 CONTINUE
190 50 CONTINUE
191 C
192 C ------------
193 C CHOOSE KNOTS
194 C ------------
195 C
196 IF (IFLAG .NE. 0) GO TO 100
197 CALL BKNOT(X,NX,KX,TX)
198 CALL BKNOT(Y,NY,KY,TY)
199 100 CONTINUE
200 C
201 C -------------------------------
202 C CONSTRUCT B-SPLINE COEFFICIENTS
203 C -------------------------------
204 C
205 IFLAG = 1
206 IW = NX*NY + 1
207 CALL BTPCF(X,NX,FCN,LDF,NY,TX,KX,WORK,WORK(IW))
208 CALL BTPCF(Y,NY,WORK,NY,NX,TY,KY,BCOEF,WORK(IW))
209 GO TO 9999
210 C
211 C -----
212 C EXITS
213 C -----
214 C
215 920 CONTINUE
216 CALL XERRWV('B2INK - IFLAG=I1 IS OUT OF RANGE.',
217 * 35,2,1,1,IFLAG,I2,0,R1,R2)
218 IFLAG = 2
219 GO TO 9999
220 C
221 930 CONTINUE
222 IFLAG = 3
223 CALL XERRWV('B2INK - NX=I1 IS OUT OF RANGE.',
224 * 32,IFLAG,1,1,NX,I2,0,R1,R2)
225 GO TO 9999
226 C
227 940 CONTINUE
228 IFLAG = 4
229 CALL XERRWV('B2INK - KX=I1 IS OUT OF RANGE.',
230 * 32,IFLAG,1,1,KX,I2,0,R1,R2)
231 GO TO 9999
232 C
233 950 CONTINUE
234 IFLAG = 5
235 CALL XERRWV('B2INK - X ARRAY MUST BE STRICTLY INCREASING.',
236 * 46,IFLAG,1,0,I1,I2,0,R1,R2)
237 GO TO 9999
238 C
239 960 CONTINUE
240 IFLAG = 6
241 CALL XERRWV('B2INK - TX ARRAY MUST BE NON-DECREASING.',
242 * 42,IFLAG,1,0,I1,I2,0,R1,R2)
243 GO TO 9999
244 C
245 970 CONTINUE
246 IFLAG = 7
247 CALL XERRWV('B2INK - NY=I1 IS OUT OF RANGE.',
248 * 32,IFLAG,1,1,NY,I2,0,R1,R2)
249 GO TO 9999
250 C
251 980 CONTINUE
252 IFLAG = 8
253 CALL XERRWV('B2INK - KY=I1 IS OUT OF RANGE.',
254 * 32,IFLAG,1,1,KY,I2,0,R1,R2)
255 GO TO 9999
256 C
257 990 CONTINUE
258 IFLAG = 9
259 CALL XERRWV('B2INK - Y ARRAY MUST BE STRICTLY INCREASING.',
260 * 46,IFLAG,1,0,I1,I2,0,R1,R2)
261 GO TO 9999
262 C
263 1000 CONTINUE
264 IFLAG = 10
265 CALL XERRWV('B2INK - TY ARRAY MUST BE NON-DECREASING.',
266 * 42,IFLAG,1,0,I1,I2,0,R1,R2)
267 GO TO 9999
268 C
269 9999 CONTINUE
270 RETURN
271 END
0 REAL FUNCTION B2VAL(XVAL,YVAL,IDX,IDY,TX,TY,NX,NY,
1 * KX,KY,BCOEF,WORK)
2 C***BEGIN PROLOGUE B2VAL
3 C***DATE WRITTEN 25 MAY 1982
4 C***REVISION DATE 25 MAY 1982
5 C***CATEGORY NO. E1A
6 C***KEYWORDS INTERPOLATION, TWO-DIMENSIONS, GRIDDED DATA, SPLINES,
7 C PIECEWISE POLYNOMIALS
8 C***AUTHOR BOISVERT, RONALD, NBS
9 C SCIENTIFIC COMPUTING DIVISION
10 C NATIONAL BUREAU OF STANDARDS
11 C WASHINGTON, DC 20234
12 C***PURPOSE B2VAL EVALUATES THE PIECEWISE POLYNOMIAL INTERPOLATING
13 C FUNCTION CONSTRUCTED BY THE ROUTINE B2INK OR ONE OF ITS
14 C PARTIAL DERIVATIVES.
15 C***DESCRIPTION
16 C
17 C B2VAL evaluates the tensor product piecewise polynomial interpolant
18 C constructed by the routine B2INK or one of its derivatives at the
19 C point (XVAL,YVAL). To evaluate the interpolant itself, set IDX=IDY=
20 C 0, to evaluate the first partial with respect to x, set IDX=1,IDY=
21 C 0, and so on.
22 C
23 C B2VAL returns 0.0E0 if (XVAL,YVAL) is out of range. That is, if
24 C XVAL.LT.TX(1) .OR. XVAL.GT.TX(NX+KX) .OR.
25 C YVAL.LT.TY(1) .OR. YVAL.GT.TY(NY+NY)
26 C If the knots TX and TY were chosen by B2INK, then this is
27 C equivalent to
28 C XVAL.LT.X(1) .OR. XVAL.GT.X(NX)+EPSX .OR.
29 C YVAL.LT.Y(1) .OR. YVAL.GT.Y(NY)+EPSY
30 C where EPSX = 0.1*(X(NX)-X(NX-1)) and EPSY = 0.1*(Y(NY)-Y(NY-1)).
31 C
32 C The input quantities TX, TY, NX, NY, KX, KY, and BCOEF should be
33 C unchanged since the last call of B2INK.
34 C
35 C
36 C I N P U T
37 C ---------
38 C
39 C XVAL Real scalar
40 C X coordinate of evaluation point.
41 C
42 C YVAL Real scalar
43 C Y coordinate of evaluation point.
44 C
45 C IDX Integer scalar
46 C X derivative of piecewise polynomial to evaluate.
47 C
48 C IDY Integer scalar
49 C Y derivative of piecewise polynomial to evaluate.
50 C
51 C TX Real 1D array (size NX+KX)
52 C Sequence of knots defining the piecewise polynomial in
53 C the x direction. (Same as in last call to B2INK.)
54 C
55 C TY Real 1D array (size NY+KY)
56 C Sequence of knots defining the piecewise polynomial in
57 C the y direction. (Same as in last call to B2INK.)
58 C
59 C NX Integer scalar
60 C The number of interpolation points in x.
61 C (Same as in last call to B2INK.)
62 C
63 C NY Integer scalar
64 C The number of interpolation points in y.
65 C (Same as in last call to B2INK.)
66 C
67 C KX Integer scalar
68 C Order of polynomial pieces in x.
69 C (Same as in last call to B2INK.)
70 C
71 C KY Integer scalar
72 C Order of polynomial pieces in y.
73 C (Same as in last call to B2INK.)
74 C
75 C BCOEF Real 2D array (size NX by NY)
76 C The B-spline coefficients computed by B2INK.
77 C
78 C WORK Real 1D array (size 3*max(KX,KY) + KY)
79 C A working storage array.
80 C
81 C***REFERENCES CARL DE BOOR, A PRACTICAL GUIDE TO SPLINES,
82 C SPRINGER-VERLAG, NEW YORK, 1978.
83 C***ROUTINES CALLED INTRV,BVALU
84 C***END PROLOGUE B2VAL
85 C
86 C ------------
87 C DECLARATIONS
88 C ------------
89 C
90 C PARAMETERS
91 C
92 INTEGER
93 * IDX, IDY, NX, NY, KX, KY
94 REAL
95 * XVAL, YVAL, TX(1), TY(1), BCOEF(NX,NY), WORK(1)
96 C
97 C LOCAL VARIABLES
98 C
99 INTEGER
100 * ILOY, INBVX, INBV, K, LEFTY, MFLAG, KCOL, IW
101 REAL
102 * BVALU
103 C
104 DATA ILOY /1/, INBVX /1/
105 C SAVE ILOY , INBVX
106 C
107 C
108 C***FIRST EXECUTABLE STATEMENT
109 B2VAL = 0.0E0
110 CALL INTRV(TY,NY+KY,YVAL,ILOY,LEFTY,MFLAG)
111 IF (MFLAG .NE. 0) GO TO 100
112 IW = KY + 1
113 KCOL = LEFTY - KY
114 DO 50 K=1,KY
115 KCOL = KCOL + 1
116 WORK(K) = BVALU(TX,BCOEF(1,KCOL),NX,KX,IDX,XVAL,INBVX,
117 * WORK(IW))
118 50 CONTINUE
119 INBV = 1
120 KCOL = LEFTY - KY + 1
121 B2VAL = BVALU(TY(KCOL),WORK,KY,KY,IDY,YVAL,INBV,WORK(IW))
122 100 CONTINUE
123 RETURN
124 END
0 SUBROUTINE B3INK(X,NX,Y,NY,Z,NZ,FCN,LDF1,LDF2,KX,KY,KZ,TX,TY,TZ,
1 * BCOEF,WORK,IFLAG)
2 C***BEGIN PROLOGUE B3INK
3 C***DATE WRITTEN 25 MAY 1982
4 C***REVISION DATE 25 MAY 1982
5 C***CATEGORY NO. E1A
6 C***KEYWORDS INTERPOLATION, THREE-DIMENSIONS, GRIDDED DATA, SPLINES,
7 C PIECEWISE POLYNOMIALS
8 C***AUTHOR BOISVERT, RONALD, NBS
9 C SCIENTIFIC COMPUTING DIVISION
10 C NATIONAL BUREAU OF STANDARDS
11 C WASHINGTON, DC 20234
12 C***PURPOSE B3INK DETERMINES A PIECEWISE POLYNOMIAL FUNCTION THAT
13 C INTERPOLATES THREE-DIMENSIONAL GRIDDED DATA. USERS SPECIFY
14 C THE POLYNOMIAL ORDER (DEGREE+1) OF THE INTERPOLANT AND
15 C (OPTIONALLY) THE KNOT SEQUENCE.
16 C***DESCRIPTION
17 C
18 C B3INK determines the parameters of a function that interpolates the
19 C three-dimensional gridded data (X(i),Y(j),Z(k),FCN(i,j,k)) for i=1,
20 C ..,NX, j=1,..,NY, and k=1,..,NZ. The interpolating function and its
21 C derivatives may subsequently be evaluated by the function B3VAL.
22 C
23 C The interpolating function is a piecewise polynomial function
24 C represented as a tensor product of one-dimensional B-splines. The
25 C form of this function is
26 C
27 C NX NY NZ
28 C S(x,y,z) = SUM SUM SUM a U (x) V (y) W (z)
29 C i=1 j=1 k=1 ij i j k
30 C
31 C where the functions U(i), V(j), and W(k) are one-dimensional B-
32 C spline basis functions. The coefficients a(i,j) are chosen so that
33 C
34 C S(X(i),Y(j),Z(k)) = FCN(i,j,k) for i=1,..,NX, j=1,..,NY, k=1,..,NZ
35 C
36 C Note that for fixed values of y and z S(x,y,z) is a piecewise
37 C polynomial function of x alone, for fixed values of x and z S(x,y,
38 C z) is a piecewise polynomial function of y alone, and for fixed
39 C values of x and y S(x,y,z) is a function of z alone. In one
40 C dimension a piecewise polynomial may be created by partitioning a
41 C given interval into subintervals and defining a distinct polynomial
42 C piece on each one. The points where adjacent subintervals meet are
43 C called knots. Each of the functions U(i), V(j), and W(k) above is a
44 C piecewise polynomial.
45 C
46 C Users of B3INK choose the order (degree+1) of the polynomial pieces
47 C used to define the piecewise polynomial in each of the x, y, and z
48 C directions (KX, KY, and KZ). Users also may define their own knot
49 C sequence in x, y, and z separately (TX, TY, and TZ). If IFLAG=0,
50 C however, B3INK will choose sequences of knots that result in a
51 C piecewise polynomial interpolant with KX-2 continuous partial
52 C derivatives in x, KY-2 continuous partial derivatives in y, and KZ-
53 C 2 continuous partial derivatives in z. (KX knots are taken near
54 C each endpoint in x, not-a-knot end conditions are used, and the
55 C remaining knots are placed at data points if KX is even or at
56 C midpoints between data points if KX is odd. The y and z directions
57 C are treated similarly.)
58 C
59 C After a call to B3INK, all information necessary to define the
60 C interpolating function are contained in the parameters NX, NY, NZ,
61 C KX, KY, KZ, TX, TY, TZ, and BCOEF. These quantities should not be
62 C altered until after the last call of the evaluation routine B3VAL.
63 C
64 C
65 C I N P U T
66 C ---------
67 C
68 C X Real 1D array (size NX)
69 C Array of x abcissae. Must be strictly increasing.
70 C
71 C NX Integer scalar (.GE. 3)
72 C Number of x abcissae.
73 C
74 C Y Real 1D array (size NY)
75 C Array of y abcissae. Must be strictly increasing.
76 C
77 C NY Integer scalar (.GE. 3)
78 C Number of y abcissae.
79 C
80 C Z Real 1D array (size NZ)
81 C Array of z abcissae. Must be strictly increasing.
82 C
83 C NZ Integer scalar (.GE. 3)
84 C Number of z abcissae.
85 C
86 C FCN Real 3D array (size LDF1 by LDF2 by NY)
87 C Array of function values to interpolate. FCN(I,J,K) should
88 C contain the function value at the point (X(I),Y(J),Z(K))
89 C
90 C LDF1 Integer scalar (.GE. NX)
91 C The actual first dimension of FCN used in the
92 C calling program.
93 C
94 C LDF2 Integer scalar (.GE. NY)
95 C The actual second dimension of FCN used in the calling
96 C program.
97 C
98 C KX Integer scalar (.GE. 2, .LT. NX)
99 C The order of spline pieces in x.
100 C (Order = polynomial degree + 1)
101 C
102 C KY Integer scalar (.GE. 2, .LT. NY)
103 C The order of spline pieces in y.
104 C (Order = polynomial degree + 1)
105 C
106 C KZ Integer scalar (.GE. 2, .LT. NZ)
107 C The order of spline pieces in z.
108 C (Order = polynomial degree + 1)
109 C
110 C
111 C I N P U T O R O U T P U T
112 C -----------------------------
113 C
114 C TX Real 1D array (size NX+KX)
115 C The knots in the x direction for the spline interpolant.
116 C If IFLAG=0 these are chosen by B3INK.
117 C If IFLAG=1 these are specified by the user.
118 C (Must be non-decreasing.)
119 C
120 C TY Real 1D array (size NY+KY)
121 C The knots in the y direction for the spline interpolant.
122 C If IFLAG=0 these are chosen by B3INK.
123 C If IFLAG=1 these are specified by the user.
124 C (Must be non-decreasing.)
125 C
126 C TZ Real 1D array (size NZ+KZ)
127 C The knots in the z direction for the spline interpolant.
128 C If IFLAG=0 these are chosen by B3INK.
129 C If IFLAG=1 these are specified by the user.
130 C (Must be non-decreasing.)
131 C
132 C
133 C O U T P U T
134 C -----------
135 C
136 C BCOEF Real 3D array (size NX by NY by NZ)
137 C Array of coefficients of the B-spline interpolant.
138 C This may be the same array as FCN.
139 C
140 C
141 C M I S C E L L A N E O U S
142 C -------------------------
143 C
144 C WORK Real 1D array (size NX*NY*NZ + max( 2*KX*(NX+1),
145 C 2*KY*(NY+1), 2*KZ*(NZ+1) )
146 C Array of working storage.
147 C
148 C IFLAG Integer scalar.
149 C On input: 0 == knot sequence chosen by B2INK
150 C 1 == knot sequence chosen by user.
151 C On output: 1 == successful execution
152 C 2 == IFLAG out of range
153 C 3 == NX out of range
154 C 4 == KX out of range
155 C 5 == X not strictly increasing
156 C 6 == TX not non-decreasing
157 C 7 == NY out of range
158 C 8 == KY out of range
159 C 9 == Y not strictly increasing
160 C 10 == TY not non-decreasing
161 C 11 == NZ out of range
162 C 12 == KZ out of range
163 C 13 == Z not strictly increasing
164 C 14 == TY not non-decreasing
165 C
166 C***REFERENCES CARL DE BOOR, A PRACTICAL GUIDE TO SPLINES,
167 C SPRINGER-VERLAG, NEW YORK, 1978.
168 C CARL DE BOOR, EFFICIENT COMPUTER MANIPULATION OF TENSOR
169 C PRODUCTS, ACM TRANSACTIONS ON MATHEMATICAL SOFTWARE,
170 C VOL. 5 (1979), PP. 173-182.
171 C***ROUTINES CALLED BTPCF,BKNOT
172 C***END PROLOGUE B3INK
173 C
174 C ------------
175 C DECLARATIONS
176 C ------------
177 C
178 C PARAMETERS
179 C
180 INTEGER
181 * NX, NY, NZ, LDF1, LDF2, KX, KY, KZ, IFLAG
182 REAL
183 * X(NX), Y(NY), Z(NZ), FCN(LDF1,LDF2,NY), TX(1), TY(1), TZ(1),
184 * BCOEF(NX,NY,NZ), WORK(1)
185 C
186 C LOCAL VARIABLES
187 C
188 INTEGER
189 * I, J, LOC, IW, NPK
190 C
191 C -----------------------
192 C CHECK VALIDITY OF INPUT
193 C -----------------------
194 C
195 C***FIRST EXECUTABLE STATEMENT
196 IF ((IFLAG .LT. 0) .OR. (IFLAG .GT. 1)) GO TO 920
197 IF (NX .LT. 3) GO TO 930
198 IF (NY .LT. 3) GO TO 970
199 IF (NZ .LT. 3) GO TO 1010
200 IF ((KX .LT. 2) .OR. (KX .GE. NX)) GO TO 940
201 IF ((KY .LT. 2) .OR. (KY .GE. NY)) GO TO 980
202 IF ((KZ .LT. 2) .OR. (KZ .GE. NZ)) GO TO 1020
203 DO 10 I=2,NX
204 IF (X(I) .LE. X(I-1)) GO TO 950
205 10 CONTINUE
206 DO 20 I=2,NY
207 IF (Y(I) .LE. Y(I-1)) GO TO 990
208 20 CONTINUE
209 DO 30 I=2,NZ
210 IF (Z(I) .LE. Z(I-1)) GO TO 1030
211 30 CONTINUE
212 IF (IFLAG .EQ. 0) GO TO 70
213 NPK = NX + KX
214 DO 40 I=2,NPK
215 IF (TX(I) .LT. TX(I-1)) GO TO 960
216 40 CONTINUE
217 NPK = NY + KY
218 DO 50 I=2,NPK
219 IF (TY(I) .LT. TY(I-1)) GO TO 1000
220 50 CONTINUE
221 NPK = NZ + KZ
222 DO 60 I=2,NPK
223 IF (TZ(I) .LT. TZ(I-1)) GO TO 1040
224 60 CONTINUE
225 70 CONTINUE
226 C
227 C ------------
228 C CHOOSE KNOTS
229 C ------------
230 C
231 IF (IFLAG .NE. 0) GO TO 100
232 CALL BKNOT(X,NX,KX,TX)
233 CALL BKNOT(Y,NY,KY,TY)
234 CALL BKNOT(Z,NZ,KZ,TZ)
235 100 CONTINUE
236 C
237 C -------------------------------
238 C CONSTRUCT B-SPLINE COEFFICIENTS
239 C -------------------------------
240 C
241 IFLAG = 1
242 IW = NX*NY*NZ + 1
243 C
244 C COPY FCN TO WORK IN PACKED FOR BTPCF
245 LOC = 0
246 DO 510 K=1,NZ
247 DO 510 J=1,NY
248 DO 510 I=1,NX
249 LOC = LOC + 1
250 WORK(LOC) = FCN(I,J,K)
251 510 CONTINUE
252 C
253 CALL BTPCF(X,NX,WORK,NX,NY*NZ,TX,KX,BCOEF,WORK(IW))
254 CALL BTPCF(Y,NY,BCOEF,NY,NX*NZ,TY,KY,WORK,WORK(IW))
255 CALL BTPCF(Z,NZ,WORK,NZ,NX*NY,TZ,KZ,BCOEF,WORK(IW))
256 GO TO 9999
257 C
258 C -----
259 C EXITS
260 C -----
261 C
262 920 CONTINUE
263 CALL XERRWV('B3INK - IFLAG=I1 IS OUT OF RANGE.',
264 * 35,2,1,1,IFLAG,I2,0,R1,R2)
265 IFLAG = 2
266 GO TO 9999
267 C
268 930 CONTINUE
269 IFLAG = 3
270 CALL XERRWV('B3INK - NX=I1 IS OUT OF RANGE.',
271 * 32,IFLAG,1,1,NX,I2,0,R1,R2)
272 GO TO 9999
273 C
274 940 CONTINUE
275 IFLAG = 4
276 CALL XERRWV('B3INK - KX=I1 IS OUT OF RANGE.',
277 * 32,IFLAG,1,1,KX,I2,0,R1,R2)
278 GO TO 9999
279 C
280 950 CONTINUE
281 IFLAG = 5
282 CALL XERRWV('B3INK - X ARRAY MUST BE STRICTLY INCREASING.',
283 * 46,IFLAG,1,0,I1,I2,0,R1,R2)
284 GO TO 9999
285 C
286 960 CONTINUE
287 IFLAG = 6
288 CALL XERRWV('B3INK - TX ARRAY MUST BE NON-DECREASING.',
289 * 42,IFLAG,1,0,I1,I2,0,R1,R2)
290 GO TO 9999
291 C
292 970 CONTINUE
293 IFLAG = 7
294 CALL XERRWV('B3INK - NY=I1 IS OUT OF RANGE.',
295 * 32,IFLAG,1,1,NY,I2,0,R1,R2)
296 GO TO 9999
297 C
298 980 CONTINUE
299 IFLAG = 8
300 CALL XERRWV('B3INK - KY=I1 IS OUT OF RANGE.',
301 * 32,IFLAG,1,1,KY,I2,0,R1,R2)
302 GO TO 9999
303 C
304 990 CONTINUE
305 IFLAG = 9
306 CALL XERRWV('B3INK - Y ARRAY MUST BE STRICTLY INCREASING.',
307 * 46,IFLAG,1,0,I1,I2,0,R1,R2)
308 GO TO 9999
309 C
310 1000 CONTINUE
311 IFLAG = 10
312 CALL XERRWV('B3INK - TY ARRAY MUST BE NON-DECREASING.',
313 * 42,IFLAG,1,0,I1,I2,0,R1,R2)
314 GO TO 9999
315 C
316 1010 CONTINUE
317 IFLAG = 11
318 CALL XERRWV('B3INK - NZ=I1 IS OUT OF RANGE.',
319 * 32,IFLAG,1,1,NZ,I2,0,R1,R2)
320 GO TO 9999
321 C
322 1020 CONTINUE
323 IFLAG = 12
324 CALL XERRWV('B3INK - KZ=I1 IS OUT OF RANGE.',
325 * 32,IFLAG,1,1,KZ,I2,0,R1,R2)
326 GO TO 9999
327 C
328 1030 CONTINUE
329 IFLAG = 13
330 CALL XERRWV('B3INK - Z ARRAY MUST BE STRICTLY INCREASING.',
331 * 46,IFLAG,1,0,I1,I2,0,R1,R2)
332 GO TO 9999
333 C
334 1040 CONTINUE
335 IFLAG = 14
336 CALL XERRWV('B3INK - TZ ARRAY MUST BE NON-DECREASING.',
337 * 42,IFLAG,1,0,I1,I2,0,R1,R2)
338 GO TO 9999
339 C
340 9999 CONTINUE
341 RETURN
342 END
0 REAL FUNCTION B3VAL(XVAL,YVAL,ZVAL,IDX,IDY,IDZ,TX,TY,TZ,
1 * NX,NY,NZ,KX,KY,KZ,BCOEF,WORK)
2 C***BEGIN PROLOGUE B3VAL
3 C***DATE WRITTEN 25 MAY 1982
4 C***REVISION DATE 25 MAY 1982
5 C***CATEGORY NO. E1A
6 C***KEYWORDS INTERPOLATION, THREE-DIMENSIONS, GRIDDED DATA, SPLINES,
7 C PIECEWISE POLYNOMIALS
8 C***AUTHOR BOISVERT, RONALD, NBS
9 C SCIENTIFIC COMPUTING DIVISION
10 C NATIONAL BUREAU OF STANDARDS
11 C WASHINGTON, DC 20234
12 C***PURPOSE B3VAL EVALUATES THE PIECEWISE POLYNOMIAL INTERPOLATING
13 C FUNCTION CONSTRUCTED BY THE ROUTINE B3INK OR ONE OF ITS
14 C PARTIAL DERIVATIVES.
15 C***DESCRIPTION
16 C
17 C B3VAL evaluates the tensor product piecewise polynomial interpolant
18 C constructed by the routine B3INK or one of its derivatives at the
19 C point (XVAL,YVAL,ZVAL). To evaluate the interpolant itself, set
20 C IDX=IDY=IDZ=0, to evaluate the first partial with respect to x, set
21 C IDX=1,IDY=IDZ=0, and so on.
22 C
23 C B3VAL returns 0.0E0 if (XVAL,YVAL,ZVAL) is out of range. That is,
24 C XVAL.LT.TX(1) .OR. XVAL.GT.TX(NX+KX) .OR.
25 C YVAL.LT.TY(1) .OR. YVAL.GT.TY(NY+NY) .OR.
26 C ZVAL.LT.TZ(1) .OR. ZVAL.GT.TZ(NZ+KZ)
27 C If the knots TX, TY, and TZ were chosen by B3INK, then this is
28 C equivalent to
29 C XVAL.LT.X(1) .OR. XVAL.GT.X(NX)+EPSX .OR.
30 C YVAL.LT.Y(1) .OR. YVAL.GT.Y(NY)+EPSY .OR.
31 C ZVAL.LT.Z(1) .OR. ZVAL.GT.Z(NZ)+EPSZ
32 C where EPSX = 0.1*(X(NX)-X(NX-1)), EPSY = 0.1*(Y(NY)-Y(NY-1)), and
33 C EPSZ = 0.1*(Z(NZ)-Z(NZ-1)).
34 C
35 C The input quantities TX, TY, TZ, NX, NY, NZ, KX, KY, KZ, and BCOEF
36 C should remain unchanged since the last call of B3INK.
37 C
38 C
39 C I N P U T
40 C ---------
41 C
42 C XVAL Real scalar
43 C X coordinate of evaluation point.
44 C
45 C YVAL Real scalar
46 C Y coordinate of evaluation point.
47 C
48 C ZVAL Real scalar
49 C Z coordinate of evaluation point.
50 C
51 C IDX Integer scalar
52 C X derivative of piecewise polynomial to evaluate.
53 C
54 C IDY Integer scalar
55 C Y derivative of piecewise polynomial to evaluate.
56 C
57 C IDZ Integer scalar
58 C Z derivative of piecewise polynomial to evaluate.
59 C
60 C TX Real 1D array (size NX+KX)
61 C Sequence of knots defining the piecewise polynomial in
62 C the x direction. (Same as in last call to B3INK.)
63 C
64 C TY Real 1D array (size NY+KY)
65 C Sequence of knots defining the piecewise polynomial in
66 C the y direction. (Same as in last call to B3INK.)
67 C
68 C TZ Real 1D array (size NZ+KZ)
69 C Sequence of knots defining the piecewise polynomial in
70 C the z direction. (Same as in last call to B3INK.)
71 C
72 C NX Integer scalar
73 C The number of interpolation points in x.
74 C (Same as in last call to B3INK.)
75 C
76 C NY Integer scalar
77 C The number of interpolation points in y.
78 C (Same as in last call to B3INK.)
79 C
80 C NZ Integer scalar
81 C The number of interpolation points in z.
82 C (Same as in last call to B3INK.)
83 C
84 C KX Integer scalar
85 C Order of polynomial pieces in x.
86 C (Same as in last call to B3INK.)
87 C
88 C KY Integer scalar
89 C Order of polynomial pieces in y.
90 C (Same as in last call to B3INK.)
91 C
92 C KZ Integer scalar
93 C Order of polynomial pieces in z.
94 C (Same as in last call to B3INK.)
95 C
96 C BCOEF Real 2D array (size NX by NY by NZ)
97 C The B-spline coefficients computed by B3INK.
98 C
99 C WORK Real 1D array (size KY*KZ+3*max(KX,KY,KZ)+KZ)
100 C A working storage array.
101 C
102 C***REFERENCES CARL DE BOOR, A PRACTICAL GUIDE TO SPLINES,
103 C SPRINGER-VERLAG, NEW YORK, 1978.
104 C***ROUTINES CALLED INTRV,BVALU
105 C***END PROLOGUE B3VAL
106 C
107 C ------------
108 C DECLARATIONS
109 C ------------
110 C
111 C PARAMETERS
112 C
113 INTEGER
114 * IDX, IDY, IDZ, NX, NY, NZ, KX, KY, KZ
115 REAL
116 * XVAL, YVAL, ZVAL, TX(1), TY(1), TZ(1), BCOEF(NX,NY,NZ),
117 * WORK(1)
118 C
119 C LOCAL VARIABLES
120 C
121 INTEGER
122 * ILOY, ILOZ, INBVX, INBV1, INBV2, LEFTY, LEFTZ, MFLAG,
123 * KCOLY, KCOLZ, IZ, IZM1, IW, I, J, K
124 REAL
125 * BVALU
126 C
127 DATA ILOY /1/, ILOZ /1/, INBVX /1/
128 C SAVE ILOY , ILOZ , INBVX
129 C
130 C
131 C***FIRST EXECUTABLE STATEMENT
132 B3VAL = 0.0E0
133 CALL INTRV(TY,NY+KY,YVAL,ILOY,LEFTY,MFLAG)
134 IF (MFLAG .NE. 0) GO TO 100
135 CALL INTRV(TZ,NZ+KZ,ZVAL,ILOZ,LEFTZ,MFLAG)
136 IF (MFLAG .NE. 0) GO TO 100
137 IZ = 1 + KY*KZ
138 IW = IZ + KZ
139 KCOLZ = LEFTZ - KZ
140 I = 0
141 DO 50 K=1,KZ
142 KCOLZ = KCOLZ + 1
143 KCOLY = LEFTY - KY
144 DO 50 J=1,KY
145 I = I + 1
146 KCOLY = KCOLY + 1
147 WORK(I) = BVALU(TX,BCOEF(1,KCOLY,KCOLZ),NX,KX,IDX,XVAL,
148 * INBVX,WORK(IW))
149 50 CONTINUE
150 INBV1 = 1
151 IZM1 = IZ - 1
152 KCOLY = LEFTY - KY + 1
153 DO 60 K=1,KZ
154 I = (K-1)*KY + 1
155 J = IZM1 + K
156 WORK(J) = BVALU(TY(KCOLY),WORK(I),KY,KY,IDY,YVAL,
157 * INBV1,WORK(IW))
158 60 CONTINUE
159 INBV2 = 1
160 KCOLZ = LEFTZ - KZ + 1
161 B3VAL = BVALU(TZ(KCOLZ),WORK(IZ),KZ,KZ,IDZ,ZVAL,INBV2,WORK(IW))
162 100 CONTINUE
163 RETURN
164 END
0 SUBROUTINE B4INK(X,NX,Y,NY,Z,NZ,V,NV,FCN,LDF1,LDF2,LDF3,KX,
1 * KY,KZ,KV,TX,TY,TZ,TV,BCOEF,WORK,IFLAG)
2 C***BEGIN PROLOGUE B3INK
3 C***DATE WRITTEN 25 MAY 1982
4 C***REVISION DATE 25 MAY 1982
5 C***CATEGORY NO. E1A
6 C***KEYWORDS INTERPOLATION, THREE-DIMENSIONS, GRIDDED DATA, SPLINES,
7 C PIECEWISE POLYNOMIALS
8 C***AUTHOR BOISVERT, RONALD, NBS
9 C SCIENTIFIC COMPUTING DIVISION
10 C NATIONAL BUREAU OF STANDARDS
11 C WASHINGTON, DC 20234
12 C***PURPOSE B3INK DETERMINES A PIECEWISE POLYNOMIAL FUNCTION THAT
13 C INTERPOLATES THREE-DIMENSIONAL GRIDDED DATA. USERS SPECIFY
14 C THE POLYNOMIAL ORDER (DEGREE+1) OF THE INTERPOLANT AND
15 C (OPTIONALLY) THE KNOT SEQUENCE.
16 C***DESCRIPTION
17 C
18 C B3INK determines the parameters of a function that interpolates the
19 C three-dimensional gridded data (X(i),Y(j),Z(k),FCN(i,j,k)) for i=1,
20 C ..,NX, j=1,..,NY, and k=1,..,NZ. The interpolating function and its
21 C derivatives may subsequently be evaluated by the function B3VAL.
22 C
23 C The interpolating function is a piecewise polynomial function
24 C represented as a tensor product of one-dimensional B-splines. The
25 C form of this function is
26 C
27 C NX NY NZ
28 C S(x,y,z) = SUM SUM SUM a U (x) V (y) W (z)
29 C i=1 j=1 k=1 ij i j k
30 C
31 C where the functions U(i), V(j), and W(k) are one-dimensional B-
32 C spline basis functions. The coefficients a(i,j) are chosen so that
33 C
34 C S(X(i),Y(j),Z(k)) = FCN(i,j,k) for i=1,..,NX, j=1,..,NY, k=1,..,NZ
35 C
36 C Note that for fixed values of y and z S(x,y,z) is a piecewise
37 C polynomial function of x alone, for fixed values of x and z S(x,y,
38 C z) is a piecewise polynomial function of y alone, and for fixed
39 C values of x and y S(x,y,z) is a function of z alone. In one
40 C dimension a piecewise polynomial may be created by partitioning a
41 C given interval into subintervals and defining a distinct polynomial
42 C piece on each one. The points where adjacent subintervals meet are
43 C called knots. Each of the functions U(i), V(j), and W(k) above is a
44 C piecewise polynomial.
45 C
46 C Users of B3INK choose the order (degree+1) of the polynomial pieces
47 C used to define the piecewise polynomial in each of the x, y, and z
48 C directions (KX, KY, and KZ). Users also may define their own knot
49 C sequence in x, y, and z separately (TX, TY, and TZ). If IFLAG=0,
50 C however, B3INK will choose sequences of knots that result in a
51 C piecewise polynomial interpolant with KX-2 continuous partial
52 C derivatives in x, KY-2 continuous partial derivatives in y, and KZ-
53 C 2 continuous partial derivatives in z. (KX knots are taken near
54 C each endpoint in x, not-a-knot end conditions are used, and the
55 C remaining knots are placed at data points if KX is even or at
56 C midpoints between data points if KX is odd. The y and z directions
57 C are treated similarly.)
58 C
59 C After a call to B3INK, all information necessary to define the
60 C interpolating function are contained in the parameters NX, NY, NZ,
61 C KX, KY, KZ, TX, TY, TZ, and BCOEF. These quantities should not be
62 C altered until after the last call of the evaluation routine B3VAL.
63 C
64 C
65 C I N P U T
66 C ---------
67 C
68 C X Real 1D array (size NX)
69 C Array of x abcissae. Must be strictly increasing.
70 C
71 C NX Integer scalar (.GE. 3)
72 C Number of x abcissae.
73 C
74 C Y Real 1D array (size NY)
75 C Array of y abcissae. Must be strictly increasing.
76 C
77 C NY Integer scalar (.GE. 3)
78 C Number of y abcissae.
79 C
80 C Z Real 1D array (size NZ)
81 C Array of z abcissae. Must be strictly increasing.
82 C
83 C NZ Integer scalar (.GE. 3)
84 C Number of z abcissae.
85 C
86 C FCN Real 3D array (size LDF1 by LDF2 by NY)
87 C Array of function values to interpolate. FCN(I,J,K) should
88 C contain the function value at the point (X(I),Y(J),Z(K))
89 C
90 C LDF1 Integer scalar (.GE. NX)
91 C The actual first dimension of FCN used in the
92 C calling program.
93 C
94 C LDF2 Integer scalar (.GE. NY)
95 C The actual second dimension of FCN used in the calling
96 C program.
97 C
98 C KX Integer scalar (.GE. 2, .LT. NX)
99 C The order of spline pieces in x.
100 C (Order = polynomial degree + 1)
101 C
102 C KY Integer scalar (.GE. 2, .LT. NY)
103 C The order of spline pieces in y.
104 C (Order = polynomial degree + 1)
105 C
106 C KZ Integer scalar (.GE. 2, .LT. NZ)
107 C The order of spline pieces in z.
108 C (Order = polynomial degree + 1)
109 C
110 C
111 C I N P U T O R O U T P U T
112 C -----------------------------
113 C
114 C TX Real 1D array (size NX+KX)
115 C The knots in the x direction for the spline interpolant.
116 C If IFLAG=0 these are chosen by B3INK.
117 C If IFLAG=1 these are specified by the user.
118 C (Must be non-decreasing.)
119 C
120 C TY Real 1D array (size NY+KY)
121 C The knots in the y direction for the spline interpolant.
122 C If IFLAG=0 these are chosen by B3INK.
123 C If IFLAG=1 these are specified by the user.
124 C (Must be non-decreasing.)
125 C
126 C TZ Real 1D array (size NZ+KZ)
127 C The knots in the z direction for the spline interpolant.
128 C If IFLAG=0 these are chosen by B3INK.
129 C If IFLAG=1 these are specified by the user.
130 C (Must be non-decreasing.)
131 C
132 C
133 C O U T P U T
134 C -----------
135 C
136 C BCOEF Real 3D array (size NX by NY by NZ)
137 C Array of coefficients of the B-spline interpolant.
138 C This may be the same array as FCN.
139 C
140 C
141 C M I S C E L L A N E O U S
142 C -------------------------
143 C
144 C WORK Real 1D array (size NX*NY*NZ + max( 2*KX*(NX+1),
145 C 2*KY*(NY+1), 2*KZ*(NZ+1) )
146 C Array of working storage.
147 C
148 C IFLAG Integer scalar.
149 C On input: 0 == knot sequence chosen by B2INK
150 C 1 == knot sequence chosen by user.
151 C On output: 1 == successful execution
152 C 2 == IFLAG out of range
153 C 3 == NX out of range
154 C 4 == KX out of range
155 C 5 == X not strictly increasing
156 C 6 == TX not non-decreasing
157 C 7 == NY out of range
158 C 8 == KY out of range
159 C 9 == Y not strictly increasing
160 C 10 == TY not non-decreasing
161 C 11 == NZ out of range
162 C 12 == KZ out of range
163 C 13 == Z not strictly increasing
164 C 14 == TY not non-decreasing
165 C
166 C***REFERENCES CARL DE BOOR, A PRACTICAL GUIDE TO SPLINES,
167 C SPRINGER-VERLAG, NEW YORK, 1978.
168 C CARL DE BOOR, EFFICIENT COMPUTER MANIPULATION OF TENSOR
169 C PRODUCTS, ACM TRANSACTIONS ON MATHEMATICAL SOFTWARE,
170 C VOL. 5 (1979), PP. 173-182.
171 C***ROUTINES CALLED BTPCF,BKNOT
172 C***END PROLOGUE B3INK
173 C
174 C ------------
175 C DECLARATIONS
176 C ------------
177 C
178 C PARAMETERS
179 C
180 INTEGER
181 * NX, NY, NZ, NV, LDF1, LDF2, LDF3, KX, KY, KZ, KV, IFLAG
182 REAL
183 * X(NX), Y(NY), Z(NZ), V(NV), FCN(LDF1,LDF2,LDF3,NY), TX(1),
184 * TY(1), TZ(1), TV(1), BCOEF(NX,NY,NZ,NV), WORK(1)
185 C
186 C LOCAL VARIABLES
187 C
188 INTEGER
189 * I, J, K, L, LOC, IW, NPK
190 C
191 C -----------------------
192 C CHECK VALIDITY OF INPUT
193 C -----------------------
194 C
195 C***FIRST EXECUTABLE STATEMENT
196 IF ((IFLAG .LT. 0) .OR. (IFLAG .GT. 1)) GO TO 920
197 IF (NX .LT. 3) GO TO 930
198 IF (NY .LT. 3) GO TO 970
199 IF (NZ .LT. 3) GO TO 1010
200 IF ((KX .LT. 2) .OR. (KX .GE. NX)) GO TO 940
201 IF ((KY .LT. 2) .OR. (KY .GE. NY)) GO TO 980
202 IF ((KZ .LT. 2) .OR. (KZ .GE. NZ)) GO TO 1020
203 DO 10 I=2,NX
204 IF (X(I) .LE. X(I-1)) GO TO 950
205 10 CONTINUE
206 DO 20 I=2,NY
207 IF (Y(I) .LE. Y(I-1)) GO TO 990
208 20 CONTINUE
209 DO 30 I=2,NZ
210 IF (Z(I) .LE. Z(I-1)) GO TO 1030
211 30 CONTINUE
212 IF (IFLAG .EQ. 0) GO TO 70
213 NPK = NX + KX
214 DO 40 I=2,NPK
215 IF (TX(I) .LT. TX(I-1)) GO TO 960
216 40 CONTINUE
217 NPK = NY + KY
218 DO 50 I=2,NPK
219 IF (TY(I) .LT. TY(I-1)) GO TO 1000
220 50 CONTINUE
221 NPK = NZ + KZ
222 DO 60 I=2,NPK
223 IF (TZ(I) .LT. TZ(I-1)) GO TO 1040
224 60 CONTINUE
225 70 CONTINUE
226 C
227 C ------------
228 C CHOOSE KNOTS
229 C ------------
230 C
231 IF (IFLAG .NE. 0) GO TO 100
232 CALL BKNOT(X,NX,KX,TX)
233 CALL BKNOT(Y,NY,KY,TY)
234 CALL BKNOT(Z,NZ,KZ,TZ)
235 CALL BKNOT(V,NV,KV,TV)
236 100 CONTINUE
237 C
238 C -------------------------------
239 C CONSTRUCT B-SPLINE COEFFICIENTS
240 C -------------------------------
241 C
242 IFLAG = 1
243 IW = NX*NY*NZ*NV + 1
244 C
245 C COPY FCN TO WORK IN PACKED FOR BTPCF
246 LOC = 0
247 DO 510 L=1,NV
248 DO 510 K=1,NZ
249 DO 510 J=1,NY
250 DO 510 I=1,NX
251 LOC = LOC + 1
252 BCOEF(I,J,K,L) = FCN(I,J,K,L)
253 510 CONTINUE
254 C
255 CALL BTPCF(X,NX,BCOEF,NX,NY*NZ*NV,TX,KX,WORK,WORK(IW))
256 CALL BTPCF(Y,NY,WORK,NY,NX*NZ*NV,TY,KY,BCOEF,WORK(IW))
257 CALL BTPCF(Z,NZ,BCOEF,NZ,NX*NY*NV,TZ,KZ,WORK,WORK(IW))
258 CALL BTPCF(V,NV,WORK,NV,NX*NY*NZ,TV,KV,BCOEF,WORK(IW))
259 GO TO 9999
260 C
261 C -----
262 C EXITS
263 C -----
264 C
265 920 CONTINUE
266 CALL XERRWV('B3INK - IFLAG=I1 IS OUT OF RANGE.',
267 * 35,2,1,1,IFLAG,I2,0,R1,R2)
268 IFLAG = 2
269 GO TO 9999
270 C
271 930 CONTINUE
272 IFLAG = 3
273 CALL XERRWV('B3INK - NX=I1 IS OUT OF RANGE.',
274 * 32,IFLAG,1,1,NX,I2,0,R1,R2)
275 GO TO 9999
276 C
277 940 CONTINUE
278 IFLAG = 4
279 CALL XERRWV('B3INK - KX=I1 IS OUT OF RANGE.',
280 * 32,IFLAG,1,1,KX,I2,0,R1,R2)
281 GO TO 9999
282 C
283 950 CONTINUE
284 IFLAG = 5
285 CALL XERRWV('B3INK - X ARRAY MUST BE STRICTLY INCREASING.',
286 * 46,IFLAG,1,0,I1,I2,0,R1,R2)
287 GO TO 9999
288 C
289 960 CONTINUE
290 IFLAG = 6
291 CALL XERRWV('B3INK - TX ARRAY MUST BE NON-DECREASING.',
292 * 42,IFLAG,1,0,I1,I2,0,R1,R2)
293 GO TO 9999
294 C
295 970 CONTINUE
296 IFLAG = 7
297 CALL XERRWV('B3INK - NY=I1 IS OUT OF RANGE.',
298 * 32,IFLAG,1,1,NY,I2,0,R1,R2)
299 GO TO 9999
300 C
301 980 CONTINUE
302 IFLAG = 8
303 CALL XERRWV('B3INK - KY=I1 IS OUT OF RANGE.',
304 * 32,IFLAG,1,1,KY,I2,0,R1,R2)
305 GO TO 9999
306 C
307 990 CONTINUE
308 IFLAG = 9
309 CALL XERRWV('B3INK - Y ARRAY MUST BE STRICTLY INCREASING.',
310 * 46,IFLAG,1,0,I1,I2,0,R1,R2)
311 GO TO 9999
312 C
313 1000 CONTINUE
314 IFLAG = 10
315 CALL XERRWV('B3INK - TY ARRAY MUST BE NON-DECREASING.',
316 * 42,IFLAG,1,0,I1,I2,0,R1,R2)
317 GO TO 9999
318 C
319 1010 CONTINUE
320 IFLAG = 11
321 CALL XERRWV('B3INK - NZ=I1 IS OUT OF RANGE.',
322 * 32,IFLAG,1,1,NZ,I2,0,R1,R2)
323 GO TO 9999
324 C
325 1020 CONTINUE
326 IFLAG = 12
327 CALL XERRWV('B3INK - KZ=I1 IS OUT OF RANGE.',
328 * 32,IFLAG,1,1,KZ,I2,0,R1,R2)
329 GO TO 9999
330 C
331 1030 CONTINUE
332 IFLAG = 13
333 CALL XERRWV('B3INK - Z ARRAY MUST BE STRICTLY INCREASING.',
334 * 46,IFLAG,1,0,I1,I2,0,R1,R2)
335 GO TO 9999
336 C
337 1040 CONTINUE
338 IFLAG = 14
339 CALL XERRWV('B3INK - TZ ARRAY MUST BE NON-DECREASING.',
340 * 42,IFLAG,1,0,I1,I2,0,R1,R2)
341 GO TO 9999
342 C
343 9999 CONTINUE
344 RETURN
345 END
0 REAL FUNCTION B4VAL(XVAL,YVAL,ZVAL,VVAL,IDX,IDY,IDZ,IDV,
1 * TX,TY,TZ,TV,NX,NY,NZ,NV,KX,KY,KZ,KV,BCOEF,WORK)
2 C***BEGIN PROLOGUE B4VAL
3 C***DATE WRITTEN 25 MAY 1982
4 C***REVISION DATE 25 MAY 1982
5 C***CATEGORY NO. E1A
6 C***KEYWORDS INTERPOLATION, THREE-DIMENSIONS, GRIDDED DATA, SPLINES,
7 C PIECEWISE POLYNOMIALS
8 C***AUTHOR BOISVERT, RONALD, NBS
9 C SCIENTIFIC COMPUTING DIVISION
10 C NATIONAL BUREAU OF STANDARDS
11 C WASHINGTON, DC 20234
12 C***PURPOSE B4VAL EVALUATES THE PIECEWISE POLYNOMIAL INTERPOLATING
13 C FUNCTION CONSTRUCTED BY THE ROUTINE B4INK OR ONE OF ITS
14 C PARTIAL DERIVATIVES.
15 C***DESCRIPTION
16 C
17 C B4VAL evaluates the tensor product piecewise polynomial interpolant
18 C constructed by the routine B4INK or one of its derivatives at the
19 C point (XVAL,YVAL,ZVAL). To evaluate the interpolant itself, set
20 C IDX=IDY=IDZ=0, to evaluate the first partial with respect to x, set
21 C IDX=1,IDY=IDZ=0, and so on.
22 C
23 C B4VAL returns 0.0E0 if (XVAL,YVAL,ZVAL) is out of range. That is,
24 C XVAL.LT.TX(1) .OR. XVAL.GT.TX(NX+KX) .OR.
25 C YVAL.LT.TY(1) .OR. YVAL.GT.TY(NY+NY) .OR.
26 C ZVAL.LT.TZ(1) .OR. ZVAL.GT.TZ(NZ+KZ)
27 C If the knots TX, TY, and TZ were chosen by B4INK, then this is
28 C equivalent to
29 C XVAL.LT.X(1) .OR. XVAL.GT.X(NX)+EPSX .OR.
30 C YVAL.LT.Y(1) .OR. YVAL.GT.Y(NY)+EPSY .OR.
31 C ZVAL.LT.Z(1) .OR. ZVAL.GT.Z(NZ)+EPSZ
32 C where EPSX = 0.1*(X(NX)-X(NX-1)), EPSY = 0.1*(Y(NY)-Y(NY-1)), and
33 C EPSZ = 0.1*(Z(NZ)-Z(NZ-1)).
34 C
35 C The input quantities TX, TY, TZ, NX, NY, NZ, KX, KY, KZ, and BCOEF
36 C should remain unchanged since the last call of B4INK.
37 C
38 C
39 C I N P U T
40 C ---------
41 C
42 C XVAL Real scalar
43 C X coordinate of evaluation point.
44 C
45 C YVAL Real scalar
46 C Y coordinate of evaluation point.
47 C
48 C ZVAL Real scalar
49 C Z coordinate of evaluation point.
50 C
51 C IDX Integer scalar
52 C X derivative of piecewise polynomial to evaluate.
53 C
54 C IDY Integer scalar
55 C Y derivative of piecewise polynomial to evaluate.
56 C
57 C IDZ Integer scalar
58 C Z derivative of piecewise polynomial to evaluate.
59 C
60 C TX Real 1D array (size NX+KX)
61 C Sequence of knots defining the piecewise polynomial in
62 C the x direction. (Same as in last call to B4INK.)
63 C
64 C TY Real 1D array (size NY+KY)
65 C Sequence of knots defining the piecewise polynomial in
66 C the y direction. (Same as in last call to B4INK.)
67 C
68 C TZ Real 1D array (size NZ+KZ)
69 C Sequence of knots defining the piecewise polynomial in
70 C the z direction. (Same as in last call to B4INK.)
71 C
72 C NX Integer scalar
73 C The number of interpolation points in x.
74 C (Same as in last call to B4INK.)
75 C
76 C NY Integer scalar
77 C The number of interpolation points in y.
78 C (Same as in last call to B4INK.)
79 C
80 C NZ Integer scalar
81 C The number of interpolation points in z.
82 C (Same as in last call to B4INK.)
83 C
84 C KX Integer scalar
85 C Order of polynomial pieces in x.
86 C (Same as in last call to B4INK.)
87 C
88 C KY Integer scalar
89 C Order of polynomial pieces in y.
90 C (Same as in last call to B4INK.)
91 C
92 C KZ Integer scalar
93 C Order of polynomial pieces in z.
94 C (Same as in last call to B4INK.)
95 C
96 C BCOEF Real 2D array (size NX by NY by NZ)
97 C The B-spline coefficients computed by B4INK.
98 C
99 C WORK Real 1D array (size KY*KZ+3*max(KX,KY,KZ)+KZ)
100 C A working storage array.
101 C
102 C***REFERENCES CARL DE BOOR, A PRACTICAL GUIDE TO SPLINES,
103 C SPRINGER-VERLAG, NEW YORK, 1978.
104 C***ROUTINES CALLED INTRV,BVALU
105 C***END PROLOGUE B4VAL
106 C
107 C ------------
108 C DECLARATIONS
109 C ------------
110 C
111 C PARAMETERS
112 C
113 INTEGER
114 * IDX, IDY, IDZ, IDV, NX, NY, NZ, NV, KX, KY, KZ, KV
115 REAL
116 * XVAL, YVAL, ZVAL, VVAL, TX(1), TY(1), TZ(1), TV(1),
117 * BCOEF(NX,NY,NZ,NV), WORK(1)
118 C
119 C LOCAL VARIABLES
120 C
121 INTEGER
122 * ILOY, ILOZ, ILOV, INBVX, INBV1,
123 * LEFTY, LEFTZ, LEFTV, MFLAG, KCOLY, KCOLZ, KCOLV,
124 * IV, IZ, IZM1, IW, I, J, K, L
125 REAL
126 * BVALU
127 C
128 DATA ILOY /1/, ILOZ /1/, ILOV /1/, INBVX /1/
129 C SAVE ILOY , ILOZ , ILOV , INBVX
130 C
131 C
132 C***FIRST EXECUTABLE STATEMENT
133 B4VAL = 0.0E0
134 CALL INTRV(TY,NY+KY,YVAL,ILOY,LEFTY,MFLAG)
135 IF (MFLAG .NE. 0) GO TO 100
136 CALL INTRV(TZ,NZ+KZ,ZVAL,ILOZ,LEFTZ,MFLAG)
137 IF (MFLAG .NE. 0) GO TO 100
138 CALL INTRV(TV,NV+KV,VVAL,ILOV,LEFTV,MFLAG)
139 IF (MFLAG .NE. 0) GO TO 100
140 IV = 1 + KY*KZ*KV
141 IW = IV + KZ*KV
142 KCOLV = LEFTV - KV
143 I = 1
144 DO 40 L=1,KV
145 KCOLV = KCOLV + 1
146 KCOLZ = LEFTZ - KZ
147 DO 40 K=1,KZ
148 KCOLZ = KCOLZ + 1
149 KCOLY = LEFTY - KY
150 DO 40 J=1,KY
151 KCOLY = KCOLY + 1
152 WORK(I) = BVALU(TX,BCOEF(1,KCOLY,KCOLZ,KCOLV),NX,KX,
153 * IDX,XVAL,INBVX,WORK(IW))
154 WRITE (*,'(A, I10, E20.10)') 'I=', I, WORK(I)
155 I = I + 1
156 40 CONTINUE
157 INBV1 = 1
158 KCOLY = LEFTY - KY + 1
159 I = 1
160 J = IV
161 DO 50 L=1,KV
162 DO 50 K=1,KZ
163 WORK(J) = BVALU(TY(KCOLY),WORK(I),KY,KY,IDY,YVAL,
164 * INBV1,WORK(IW))
165 WRITE (*,'(A, I10, E20.10)') 'J=', J, WORK(J)
166 J = J + 1
167 I = I + KY
168 50 CONTINUE
169 INBV1 = 1
170 KCOLZ = LEFTZ - KZ + 1
171 J = IV
172 K = 1
173 DO 60 L=1,KV
174 WORK(K) = BVALU(TZ(KCOLZ),WORK(J),KZ,KZ,IDZ,ZVAL,
175 * INBV1,WORK(IW))
176 WRITE (*,'(A, I10, E20.10)') 'K=', K, WORK(K)
177 K = K + 1
178 J = J + KZ
179 60 CONTINUE
180 INBV1 = 1
181 KCOLV = LEFTV - KV + 1
182 B4VAL = BVALU(TV(KCOLV),WORK(1),KV,KV,IDV,VVAL,INBV1,WORK(IW))
183 WRITE (*,'(A, I10, E20.10)') 'R=', 0, B4VAL
184 100 CONTINUE
185 RETURN
186 END
0
1 SUBROUTINE BFQAD(F,T,BCOEF,N,K,ID,X1,X2,TOL,QUAD,IERR,WORK)
2 C***BEGIN PROLOGUE BFQAD
3 C***DATE WRITTEN 800901 (YYMMDD)
4 C***REVISION DATE 820801 (YYMMDD)
5 C***CATEGORY NO. H2A2A1,E3,K6
6 C***KEYWORDS B-SPLINE,DATA FITTING,INTERPOLATION,QUADRATURE,SPLINE
7 C***AUTHOR AMOS, D. E., (SNLA)
8 C***PURPOSE Computes the integral on (X1,X2) of a product of a function
9 C F and the ID-th derivative of a K-th order B-spline
10 C (B-representation).
11 C***DESCRIPTION
12 C
13 C Written by D. E. Amos, June, 1979.
14 C
15 C Reference SAND 79-1825
16 C
17 C Abstract
18 C BFQAD computes the integral on (X1,X2) of a product of a
19 C function F and the ID-th derivative of a K-th order B-spline,
20 C using the B-representation (T,BCOEF,N,K). (X1,X2) must be
21 C a subinterval of T(K) .LE. X .le. T(N+1). An integration
22 C routine BSGQ8 (a modification
23 C of GAUS8), integrates the product on sub-
24 C intervals of (X1,X2) formed by included (distinct) knots.
25 C
26 C BFQAD calls INTRV,BVALU,BSGQ8,R1MACH,XERROR
27 C
28 C Description of Arguments
29 C Input
30 C F - external function of one argument for the
31 C integrand BF(X)=F(X)*BVALU(T,BCOEF,N,K,ID,X,INBV,
32 C WORK)
33 C T - knot array of length N+K
34 C BCOEF - coefficient array of length N
35 C N - length of coefficient array
36 C K - order of B-spline, K .GE. 1
37 C ID - order of the spline derivative, 0 .LE. ID .LE. K-1
38 C ID=0 gives the spline function
39 C X1,X2 - end points of quadrature interval in
40 C T(K) .LE. X .LE. T(N+1)
41 C TOL - desired accuracy for the quadrature, suggest
42 C 10.*STOL .LT. TOL .LE. 0.1 where STOL is the single
43 C precision unit roundoff for the machine = R1MACH(4)
44 C
45 C Output
46 C QUAD - integral of BF(X) on (X1,X2)
47 C IERR - a status code
48 C IERR=1 normal return
49 C 2 some quadrature on (X1,X2) does not meet
50 C the requested tolerance.
51 C WORK - work vector of length 3*K
52 C
53 C Error Conditions
54 C X1 or X2 not in T(K) .LE. X .LE. T(N+1) is a fatal error.
55 C TOL not greater than the single precision unit roundoff or
56 C less than 0.1 is a fatal error.
57 C Some quadrature fails to meet the requested tolerance.
58 C***REFERENCES D.E. AMOS, *QUADRATURE SUBROUTINES FOR SPLINES AND
59 C B-SPLINES*, SAND79-1825, SANDIA LABORATORIES,
60 C DECEMBER 1979.
61 C***ROUTINES CALLED BSGQ8,INTRV,R1MACH,XERROR
62 C***END PROLOGUE BFQAD
63 C
64 C
65 INTEGER ID, IERR, IFLG, ILO, IL1, IL2, K, LEFT, MFLAG, N, NPK, NP1
66 REAL A,AA,ANS,B,BB,BCOEF,Q,QUAD,T,TA,TB,TOL,WORK,WTOL, X1,
67 1 X2
68 REAL R1MACH, F
69 DIMENSION T(1), BCOEF(1), WORK(1)
70 EXTERNAL F
71 C***FIRST EXECUTABLE STATEMENT BFQAD
72 IERR = 1
73 QUAD = 0.0E0
74 IF(K.LT.1) GO TO 100
75 IF(N.LT.K) GO TO 105
76 IF(ID.LT.0 .OR. ID.GE.K) GO TO 110
77 WTOL = R1MACH(4)
78 IF (TOL.LT.WTOL .OR. TOL.GT.0.1E0) GO TO 30
79 AA = AMIN1(X1,X2)
80 BB = AMAX1(X1,X2)
81 IF (AA.LT.T(K)) GO TO 20
82 NP1 = N + 1
83 IF (BB.GT.T(NP1)) GO TO 20
84 IF (AA.EQ.BB) RETURN
85 NPK = N + K
86 C
87 ILO = 1
88 CALL INTRV(T, NPK, AA, ILO, IL1, MFLAG)
89 CALL INTRV(T, NPK, BB, ILO, IL2, MFLAG)
90 IF (IL2.GE.NP1) IL2 = N
91 INBV = 1
92 Q = 0.0E0
93 DO 10 LEFT=IL1,IL2
94 TA = T(LEFT)
95 TB = T(LEFT+1)
96 IF (TA.EQ.TB) GO TO 10
97 A = AMAX1(AA,TA)
98 B = AMIN1(BB,TB)
99 CALL BSGQ8(F,T,BCOEF,N,K,ID,A,B,INBV,TOL,ANS,IFLG,WORK)
100 IF (IFLG.GT.1) IERR = 2
101 Q = Q + ANS
102 10 CONTINUE
103 IF (X1.GT.X2) Q = -Q
104 QUAD = Q
105 RETURN
106 C
107 C
108 20 CONTINUE
109 CALL XERROR( ' BFQAD, X1 OR X2 OR BOTH DO NOT SATISFY T(K).LE.X.L
110 1E.T(N+1)', 60, 2, 1)
111 RETURN
112 30 CONTINUE
113 CALL XERROR( ' BFQAD, TOL IS LESS THAN THE SINGLE PRECISION TOLER
114 1ANCE OR GREATER THAN 0.1', 76, 2, 1)
115 RETURN
116 100 CONTINUE
117 CALL XERROR( ' BFQAD, K DOES NOT SATISFY K.GE.1', 34, 2, 1)
118 RETURN
119 105 CONTINUE
120 CALL XERROR( ' BFQAD, N DOES NOT SATISFY N.GE.K', 34, 2, 1)
121 RETURN
122 110 CONTINUE
123 CALL XERROR( ' BFQAD, ID DOES NOT SATISFY 0.LE.ID.LT.K',
124 1 41, 2, 1)
125 RETURN
126 END
0 SUBROUTINE BINT4(X,Y,NDATA,IBCL,IBCR,FBCL,FBCR,KNTOPT,T,BCOEF,N,
1 1 K,W)
2 C***BEGIN PROLOGUE BINT4
3 C***DATE WRITTEN 800901 (YYMMDD)
4 C***REVISION DATE 820801 (YYMMDD)
5 C***CATEGORY NO. E1A
6 C***KEYWORDS B-SPLINE,DATA FITTING,INTERPOLATION,SPLINE
7 C***AUTHOR AMOS, D. E., (SNLA)
8 C***PURPOSE Computes the B representation of a cubic spline
9 C which interpolates data (X(I),Y(I)),I=1,NDATA.
10 C***DESCRIPTION
11 C
12 C Written by D. E. Amos, August, 1979.
13 C
14 C References
15 C SAND-78-1968
16 C
17 C A Practical Guide to Splines by C. de Boor, Applied
18 C Mathematics Series 27, Springer, 1979.
19 C
20 C SIAM J. Numerical Analysis, 14, No. 3, June 1977, pp. 441-472.
21 C
22 C Abstract
23 C BINT4 computes the B representation (T,BCOEF,N,K) of a
24 C cubic spline (K=4) which interpolates data (X(I)),Y(I))),
25 C I=1,NDATA. Parameters IBCL, IBCR, FBCL, FBCR allow the
26 C specification of the spline first or second derivative at
27 C both X(1) and X(NDATA). When this data is not specified
28 C by the problem, it is common practice to use a natural
29 C spline by setting second derivatives at X(1) and X(NDATA)
30 C to zero (IBCL=IBCR=2,FBCL=FBCR=0.0). The spline is defined on
31 C T(4) .LE. X .LE. T(N+1) with (ordered) interior knots at X(I))
32 C values where N=NDATA+2. The knots T(1), T(2), T(3) lie to
33 C the left of T(4)=X(1) and the knots T(N+2), T(N+3), T(N+4)
34 C lie to the right of T(N+1)=X(NDATA) in increasing order. If
35 C no extrapolation outside (X(1),X(NDATA)) is anticipated, the
36 C knots T(1)=T(2)=T(3)=T(4)=X(1) and T(N+2)=T(N+3)=T(N+4)=
37 C T(N+1)=X(NDATA) can be specified by KNTOPT=1. KNTOPT=2
38 C selects a knot placement for T(1), T(2), T(3) to make the
39 C first 7 knots symmetric about T(4)=X(1) and similarly for
40 C T(N+2), T(N+3), T(N+4) about T(N+1)=X(NDATA). KNTOPT=3
41 C allows the user to make his own selection, in increasing
42 C order, for T(1), T(2), T(3) to the left of X(1) and T(N+2),
43 C T(N+3), T(N+4) to the right of X(NDATA) in the work array
44 C W(1) through W(6). In any case, the interpolation on
45 C T(4) .LE. X .LE. T(N+1) by using function BVALU is unique
46 C for given boundary conditions.
47 C
48 C BINT4 calls BSPVD, BNFAC, BNSLV, R1MACH, XERROR
49 C
50 C Description of Arguments
51 C Input
52 C X - X vector of abscissae of length NDATA, distinct
53 C and in increasing order
54 C Y - Y vector of ordinates of length NDATA
55 C NDATA - number of data points, NDATA .GE. 2
56 C IBCL - selection parameter for left boundary condition
57 C IBCL = 1 constrain the first derivative at
58 C X(1) to FBCL
59 C = 2 constrain the second derivative at
60 C X(1) to FBCL
61 C IBCR - selection parameter for right boundary condition
62 C IBCR = 1 constrain first derivative at
63 C X(NDATA) to FBCR
64 C IBCR = 2 constrain second derivative at
65 C X(NDATA) to FBCR
66 C FBCL - left boundary values governed by IBCL
67 C FBCR - right boundary values governed by IBCR
68 C KNTOPT - knot selection parameter
69 C KNTOPT = 1 sets knot multiplicity at T(4) and
70 C T(N+1) to 4
71 C = 2 sets a symmetric placement of knots
72 C about T(4) and T(N+1)
73 C = 3 sets TNP)=WNP) and T(N+1+I)=w(3+I),I=1,3
74 C where WNP),I=1,6 is supplied by the user
75 C W - work array of dimension at least 5*(NDATA+2)
76 C if KNTOPT=3, then W(1),W(2),W(3) are knot values to
77 C the left of X(1) and W(4),W(5),W(6) are knot
78 C values to the right of X(NDATA) in increasing
79 C order to be supplied by the user
80 C
81 C Output
82 C T - knot array of length N+4
83 C BCOEF - B-spline coefficient array of length N
84 C N - number of coefficients, N=NDATA+2
85 C K - order of spline, K=4
86 C
87 C Error Conditions
88 C Improper input is a fatal error
89 C Singular system of equations is a fatal error
90 C***REFERENCES D.E. AMOS, *COMPUTATION WITH SPLINES AND B-SPLINES*,
91 C SAND78-1968,SANDIA LABORATORIES,MARCH,1979.
92 C C. DE BOOR, *PACKAGE FOR CALCULATING WITH B-SPLINES*,
93 C SIAM JOURNAL ON NUMERICAL ANALYSIS, VOLUME 14, NO. 3,
94 C JUNE 1977, PP. 441-472.
95 C C. DE BOOR, *A PRACTICAL GUIDE TO SPLINES*, APPLIED
96 C MATHEMATICS SERIES 27, SPRINGER, 1979.
97 C***ROUTINES CALLED BNFAC,BNSLV,BSPVD,R1MACH,XERROR
98 C***END PROLOGUE BINT4
99 C
100 C
101 INTEGER I, IBCL, IBCR, IFLAG, ILB, ILEFT, IT, IUB, IW, IWP, J,
102 1 JW, K, KNTOPT, N, NDATA, NDM, NP, NWROW
103 REAL BCOEF,FBCL,FBCR,T, TOL,TXN,TX1,VNIKX,W,WDTOL,WORK,X, XL,
104 1 Y
105 REAL R1MACH
106 DIMENSION X(1), Y(1), T(1), BCOEF(1), W(5,1), VNIKX(4,4), WORK(15)
107 C***FIRST EXECUTABLE STATEMENT BINT4
108 WDTOL = R1MACH(4)
109 TOL = SQRT(WDTOL)
110 IF (NDATA.LT.2) GO TO 200
111 NDM = NDATA - 1
112 DO 10 I=1,NDM
113 IF (X(I).GE.X(I+1)) GO TO 210
114 10 CONTINUE
115 IF (IBCL.LT.1 .OR. IBCL.GT.2) GO TO 220
116 IF (IBCR.LT.1 .OR. IBCR.GT.2) GO TO 230
117 IF (KNTOPT.LT.1 .OR. KNTOPT.GT.3) GO TO 240
118 K = 4
119 N = NDATA + 2
120 NP = N + 1
121 DO 20 I=1,NDATA
122 T(I+3) = X(I)
123 20 CONTINUE
124 GO TO (30, 50, 90), KNTOPT
125 C SET UP KNOT ARRAY WITH MULTIPLICITY 4 AT X(1) AND X(NDATA)
126 30 CONTINUE
127 DO 40 I=1,3
128 T(4-I) = X(1)
129 T(NP+I) = X(NDATA)
130 40 CONTINUE
131 GO TO 110
132 C SET UP KNOT ARRAY WITH SYMMETRIC PLACEMENT ABOUT END POINTS
133 50 CONTINUE
134 IF (NDATA.GT.3) GO TO 70
135 XL = (X(NDATA)-X(1))/3.0E0
136 DO 60 I=1,3
137 T(4-I) = T(5-I) - XL
138 T(NP+I) = T(NP+I-1) + XL
139 60 CONTINUE
140 GO TO 110
141 70 CONTINUE
142 TX1 = X(1) + X(1)
143 TXN = X(NDATA) + X(NDATA)
144 DO 80 I=1,3
145 T(4-I) = TX1 - X(I+1)
146 T(NP+I) = TXN - X(NDATA-I)
147 80 CONTINUE
148 GO TO 110
149 C SET UP KNOT ARRAY LESS THAN X(1) AND GREATER THAN X(NDATA) TO BE
150 C SUPPLIED BY USER IN WORK LOCATIONS W(1) THROUGH W(6) WHEN KNTOPT=3
151 90 CONTINUE
152 DO 100 I=1,3
153 T(4-I) = W(4-I,1)
154 JW = MAX0(1,I-1)
155 IW = MOD(I+2,5)+1
156 T(NP+I) = W(IW,JW)
157 IF (T(4-I).GT.T(5-I)) GO TO 250
158 IF (T(NP+I).LT.T(NP+I-1)) GO TO 250
159 100 CONTINUE
160 110 CONTINUE
161 C
162 DO 130 I=1,5
163 DO 120 J=1,N
164 W(I,J) = 0.0E0
165 120 CONTINUE
166 130 CONTINUE
167 C SET UP LEFT INTERPOLATION POINT AND LEFT BOUNDARY CONDITION FOR
168 C RIGHT LIMITS
169 IT = IBCL + 1
170 CALL BSPVD(T, K, IT, X(1), K, 4, VNIKX, WORK)
171 IW = 0
172 IF (ABS(VNIKX(3,1)).LT.TOL) IW = 1
173 DO 140 J=1,3
174 W(J+1,4-J) = VNIKX(4-J,IT)
175 W(J,4-J) = VNIKX(4-J,1)
176 140 CONTINUE
177 BCOEF(1) = Y(1)
178 BCOEF(2) = FBCL
179 C SET UP INTERPOLATION EQUATIONS FOR POINTS I=2 TO I=NDATA-1
180 ILEFT = 4
181 IF (NDM.LT.2) GO TO 170
182 DO 160 I=2,NDM
183 ILEFT = ILEFT + 1
184 CALL BSPVD(T, K, 1, X(I), ILEFT, 4, VNIKX, WORK)
185 DO 150 J=1,3
186 W(J+1,3+I-J) = VNIKX(4-J,1)
187 150 CONTINUE
188 BCOEF(I+1) = Y(I)
189 160 CONTINUE
190 C SET UP RIGHT INTERPOLATION POINT AND RIGHT BOUNDARY CONDITION FOR
191 C LEFT LIMITS(ILEFT IS ASSOCIATED WITH T(N)=X(NDATA-1))
192 170 CONTINUE
193 IT = IBCR + 1
194 CALL BSPVD(T, K, IT, X(NDATA), ILEFT, 4, VNIKX, WORK)
195 JW = 0
196 IF (ABS(VNIKX(2,1)).LT.TOL) JW = 1
197 DO 180 J=1,3
198 W(J+1,3+NDATA-J) = VNIKX(5-J,IT)
199 W(J+2,3+NDATA-J) = VNIKX(5-J,1)
200 180 CONTINUE
201 BCOEF(N-1) = FBCR
202 BCOEF(N) = Y(NDATA)
203 C SOLVE SYSTEM OF EQUATIONS
204 ILB = 2 - JW
205 IUB = 2 - IW
206 NWROW = 5
207 IWP = IW + 1
208 CALL BNFAC(W(IWP,1), NWROW, N, ILB, IUB, IFLAG)
209 IF (IFLAG.EQ.2) GO TO 190
210 CALL BNSLV(W(IWP,1), NWROW, N, ILB, IUB, BCOEF)
211 RETURN
212 C
213 C
214 190 CONTINUE
215 CALL XERROR( ' BINT4, THE SYSTEM OF EQUATIONS IS SINGULAR',
216 1 44, 2, 1)
217 RETURN
218 200 CONTINUE
219 CALL XERROR( ' BINT4, NDATA IS LESS THAN 2', 29, 2, 1)
220 RETURN
221 210 CONTINUE
222 CALL XERROR( ' BINT4, X VALUES ARE NOT DISTINCT OR NOT ORDERED',
223 149, 2, 1)
224 RETURN
225 220 CONTINUE
226 CALL XERROR( ' BINT4, IBCL IS NOT 1 OR 2', 27, 2, 1)
227 RETURN
228 230 CONTINUE
229 CALL XERROR( ' BINT4, IBCR IS NOT 1 OR 2', 27, 2, 1)
230 RETURN
231 240 CONTINUE
232 CALL XERROR( ' BINT4, KNTOPT IS NOT 1, 2, OR 3', 33, 2, 1)
233 RETURN
234 250 CONTINUE
235 CALL XERROR( ' BINT4, KNOT INPUT THROUGH W ARRAY IS NOT ORDERED P
236 1ROPERLY', 59, 2, 1)
237 RETURN
238 END
0 SUBROUTINE BINTK(X,Y,T,N,K,BCOEF,Q,WORK)
1 C***BEGIN PROLOGUE BINTK
2 C***DATE WRITTEN 800901 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. E1A
5 C***KEYWORDS B-SPLINE,DATA FITTING,INTERPOLATION,SPLINE
6 C***AUTHOR AMOS, D. E., (SNLA)
7 C***PURPOSE Produces the B-spline coefficients, BCOEF, of the
8 C B-spline of order K with knots T(I), I=1,...,N+K, which
9 C takes on the value Y(I) at X(I), I=1,...,N.
10 C***DESCRIPTION
11 C
12 C Written by Carl de Boor and modified by D. E. Amos
13 C
14 C References
15 C
16 C A Practical Guide to Splines by C. de Boor, Applied
17 C Mathematics Series 27, Springer, 1979.
18 C
19 C Abstract
20 C
21 C BINTK is the SPLINT routine of the reference.
22 C
23 C BINTK produces the B-spline coefficients, BCOEF, of the
24 C B-spline of order K with knots T(I), I=1,...,N+K, which
25 C takes on the value Y(I) at X(I), I=1,...,N. The spline or
26 C any of its derivatives can be evaluated by calls to BVALU.
27 C The I-th equation of the linear system A*BCOEF = B for the
28 C coefficients of the interpolant enforces interpolation at
29 C X(I)), I=1,...,N. Hence, B(I) = Y(I), all I, and A is
30 C a band matrix with 2K-1 bands if A is invertible. The matrix
31 C A is generated row by row and stored, diagonal by diagonal,
32 C in the rows of Q, with the main diagonal going into row K.
33 C The banded system is then solved by a call to BNFAC (which
34 C constructs the triangular factorization for A and stores it
35 C again in Q), followed by a call to BNSLV (which then
36 C obtains the solution BCOEF by substitution). BNFAC does no
37 C pivoting, since the total positivity of the matrix A makes
38 C this unnecessary. The linear system to be solved is
39 C (theoretically) invertible if and only if
40 C T(I) .LT. X(I)) .LT. T(I+K), all I.
41 C Equality is permitted on the left for I=1 and on the right
42 C for I=N when K knots are used at X(1) or X(N). Otherwise,
43 C violation of this condition is certain to lead to an error.
44 C
45 C BINTK calls BSPVN, BNFAC, BNSLV, XERROR
46 C
47 C Description of Arguments
48 C Input
49 C X - vector of length N containing data point abscissa
50 C in strictly increasing order.
51 C Y - corresponding vector of length N containing data
52 C point ordinates.
53 C T - knot vector of length N+K
54 C since T(1),..,T(K) .LE. X(1) and T(N+1),..,T(N+K)
55 C .GE. X(N), this leaves only N-K knots (not nec-
56 C essarily X(I)) values) interior to (X(1),X(N))
57 C N - number of data points, N .GE. K
58 C K - order of the spline, K .GE. 1
59 C
60 C Output
61 C BCOEF - a vector of length N containing the B-spline
62 C coefficients
63 C Q - a work vector of length (2*K-1)*N, containing
64 C the triangular factorization of the coefficient
65 C matrix of the linear system being solved. The
66 C coefficients for the interpolant of an
67 C additional data set (X(I)),YY(I)), I=1,...,N
68 C with the same abscissa can be obtained by loading
69 C YY into BCOEF and then executing
70 C call BNSLV(Q,2K-1,N,K-1,K-1,BCOEF)
71 C WORK - work vector of length 2*K
72 C
73 C Error Conditions
74 C Improper input is a fatal error
75 C Singular system of equations is a fatal error
76 C***REFERENCES D.E. AMOS, *COMPUTATION WITH SPLINES AND B-SPLINES*,
77 C SAND78-1968,SANDIA LABORATORIES,MARCH,1979.
78 C C. DE BOOR, *PACKAGE FOR CALCULATING WITH B-SPLINES*,
79 C SIAM JOURNAL ON NUMERICAL ANALYSIS, VOLUME 14, NO. 3,
80 C JUNE 1977, PP. 441-472.
81 C C. DE BOOR, *A PRACTICAL GUIDE TO SPLINES*, APPLIED
82 C MATHEMATICS SERIES 27, SPRINGER, 1979.
83 C***ROUTINES CALLED BNFAC,BNSLV,BSPVN,XERROR
84 C***END PROLOGUE BINTK
85 C
86 C
87 INTEGER IFLAG, IWORK, K, N, I, ILP1MX, J, JJ, KM1, KPKM2, LEFT,
88 1 LENQ, NP1
89 REAL BCOEF(N), Y(N), Q(1), T(1), X(N), XI, WORK(1)
90 C DIMENSION Q(2*K-1,N), T(N+K)
91 C***FIRST EXECUTABLE STATEMENT BINTK
92 IF(K.LT.1) GO TO 100
93 IF(N.LT.K) GO TO 105
94 JJ = N - 1
95 IF(JJ.EQ.0) GO TO 6
96 DO 5 I=1,JJ
97 IF(X(I).GE.X(I+1)) GO TO 110
98 5 CONTINUE
99 6 CONTINUE
100 NP1 = N + 1
101 KM1 = K - 1
102 KPKM2 = 2*KM1
103 LEFT = K
104 C ZERO OUT ALL ENTRIES OF Q
105 LENQ = N*(K+KM1)
106 DO 10 I=1,LENQ
107 Q(I) = 0.0E0
108 10 CONTINUE
109 C
110 C *** LOOP OVER I TO CONSTRUCT THE N INTERPOLATION EQUATIONS
111 DO 50 I=1,N
112 XI = X(I)
113 ILP1MX = MIN0(I+K,NP1)
114 C *** FIND LEFT IN THE CLOSED INTERVAL (I,I+K-1) SUCH THAT
115 C T(LEFT) .LE. X(I) .LT. T(LEFT+1)
116 C MATRIX IS SINGULAR IF THIS IS NOT POSSIBLE
117 LEFT = MAX0(LEFT,I)
118 IF (XI.LT.T(LEFT)) GO TO 80
119 20 IF (XI.LT.T(LEFT+1)) GO TO 30
120 LEFT = LEFT + 1
121 IF (LEFT.LT.ILP1MX) GO TO 20
122 LEFT = LEFT - 1
123 IF (XI.GT.T(LEFT+1)) GO TO 80
124 C *** THE I-TH EQUATION ENFORCES INTERPOLATION AT XI, HENCE
125 C A(I,J) = B(J,K,T)(XI), ALL J. ONLY THE K ENTRIES WITH J =
126 C LEFT-K+1,...,LEFT ACTUALLY MIGHT BE NONZERO. THESE K NUMBERS
127 C ARE RETURNED, IN BCOEF (USED FOR TEMP.STORAGE HERE), BY THE
128 C FOLLOWING
129 30 CALL BSPVN(T, K, K, 1, XI, LEFT, BCOEF, WORK, IWORK)
130 C WE THEREFORE WANT BCOEF(J) = B(LEFT-K+J)(XI) TO GO INTO
131 C A(I,LEFT-K+J), I.E., INTO Q(I-(LEFT+J)+2*K,(LEFT+J)-K) SINCE
132 C A(I+J,J) IS TO GO INTO Q(I+K,J), ALL I,J, IF WE CONSIDER Q
133 C AS A TWO-DIM. ARRAY , WITH 2*K-1 ROWS (SEE COMMENTS IN
134 C BNFAC). IN THE PRESENT PROGRAM, WE TREAT Q AS AN EQUIVALENT
135 C ONE-DIMENSIONAL ARRAY (BECAUSE OF FORTRAN RESTRICTIONS ON
136 C DIMENSION STATEMENTS) . WE THEREFORE WANT BCOEF(J) TO GO INTO
137 C ENTRY
138 C I -(LEFT+J) + 2*K + ((LEFT+J) - K-1)*(2*K-1)
139 C = I-LEFT+1 + (LEFT -K)*(2*K-1) + (2*K-2)*J
140 C OF Q .
141 JJ = I - LEFT + 1 + (LEFT-K)*(K+KM1)
142 DO 40 J=1,K
143 JJ = JJ + KPKM2
144 Q(JJ) = BCOEF(J)
145 40 CONTINUE
146 50 CONTINUE
147 C
148 C ***OBTAIN FACTORIZATION OF A , STORED AGAIN IN Q.
149 CALL BNFAC(Q, K+KM1, N, KM1, KM1, IFLAG)
150 GO TO (60, 90), IFLAG
151 C *** SOLVE A*BCOEF = Y BY BACKSUBSTITUTION
152 60 DO 70 I=1,N
153 BCOEF(I) = Y(I)
154 70 CONTINUE
155 CALL BNSLV(Q, K+KM1, N, KM1, KM1, BCOEF)
156 RETURN
157 C
158 C
159 80 CONTINUE
160 CALL XERROR( 'BINTK, SOME ABSCISSA WAS NOT IN THE SUPPORT OF THE
161 1 CORRESPONDING BASIS FUNCTION AND THE SYSTEM IS SINGULAR.',108,2,1
162 2)
163 RETURN
164 90 CONTINUE
165 CALL XERROR( 'BINTK, THE SYSTEM OF SOLVER DETECTS A SINGULAR SYST
166 1EM ALTHOUGH THE THEORETICAL CONDITIONS FOR A SOLUTION WERE SATISFI
167 2ED.',121,8,1)
168 RETURN
169 100 CONTINUE
170 CALL XERROR( ' BINTK, K DOES NOT SATISFY K.GE.1', 34, 2, 1)
171 RETURN
172 105 CONTINUE
173 CALL XERROR( ' BINTK, N DOES NOT SATISFY N.GE.K', 34, 2, 1)
174 RETURN
175 110 CONTINUE
176 CALL XERROR( ' BINTK, X(I) DOES NOT SATISFY X(I).LT.X(I+1) FOR SO
177 1ME I', 56, 2, 1)
178 RETURN
179 END
0 SUBROUTINE BKNOT(X,N,K,T)
1 C***BEGIN PROLOGUE BKNOT
2 C***REFER TO B2INK,B3INK
3 C***ROUTINES CALLED (NONE)
4 C***END PROLOGUE BKNOT
5 C
6 C --------------------------------------------------------------------
7 C BKNOT CHOOSES A KNOT SEQUENCE FOR INTERPOLATION OF ORDER K AT THE
8 C DATA POINTS X(I), I=1,..,N. THE N+K KNOTS ARE PLACED IN THE ARRAY
9 C T. K KNOTS ARE PLACED AT EACH ENDPOINT AND NOT-A-KNOT END
10 C CONDITIONS ARE USED. THE REMAINING KNOTS ARE PLACED AT DATA POINTS
11 C IF N IS EVEN AND BETWEEN DATA POINTS IF N IS ODD. THE RIGHTMOST
12 C KNOT IS SHIFTED SLIGHTLY TO THE RIGHT TO INSURE PROPER INTERPOLATION
13 C AT X(N) (SEE PAGE 350 OF THE REFERENCE).
14 C --------------------------------------------------------------------
15 C
16 C ------------
17 C DECLARATIONS
18 C ------------
19 C
20 C PARAMETERS
21 C
22 INTEGER
23 * N, K
24 REAL
25 * X(N), T(1)
26 C
27 C LOCAL VARIABLES
28 C
29 INTEGER
30 * I, J, IPJ, NPJ, IP1
31 REAL
32 * RNOT
33 C
34 C
35 C ----------------------------
36 C PUT K KNOTS AT EACH ENDPOINT
37 C ----------------------------
38 C
39 C (SHIFT RIGHT ENPOINTS SLIGHTLY -- SEE PG 350 OF REFERENCE)
40 RNOT = X(N) + 0.10E0*( X(N)-X(N-1) )
41 DO 110 J=1,K
42 T(J) = X(1)
43 NPJ = N + J
44 T(NPJ) = RNOT
45 110 CONTINUE
46 C
47 C --------------------------
48 C DISTRIBUTE REMAINING KNOTS
49 C --------------------------
50 C
51 IF (MOD(K,2) .EQ. 1) GO TO 150
52 C
53 C CASE OF EVEN K -- KNOTS AT DATA POINTS
54 C
55 I = (K/2) - K
56 JSTRT = K+1
57 DO 120 J=JSTRT,N
58 IPJ = I + J
59 T(J) = X(IPJ)
60 120 CONTINUE
61 GO TO 200
62 C
63 C CASE OF ODD K -- KNOTS BETWEEN DATA POINTS
64 C
65 150 CONTINUE
66 I = (K-1)/2 - K
67 IP1 = I + 1
68 JSTRT = K + 1
69 DO 160 J=JSTRT,N
70 IPJ = I + J
71 T(J) = 0.50E0*( X(IPJ) + X(IPJ+1) )
72 160 CONTINUE
73 200 CONTINUE
74 C
75 RETURN
76 END
0 SUBROUTINE BNFAC(W,NROWW,NROW,NBANDL,NBANDU,IFLAG)
1 C***BEGIN PROLOGUE BNFAC
2 C***REFER TO BINT4,BINTK
3 C
4 C BNFAC is the BANFAC routine from
5 C * A Practical Guide to Splines * by C. de Boor
6 C
7 C Returns in W the lu-factorization (without pivoting) of the banded
8 C matrix A of order NROW with (NBANDL + 1 + NBANDU) bands or diag-
9 C onals in the work array W .
10 C
11 C ***** I N P U T ******
12 C W.....Work array of size (NROWW,NROW) containing the interesting
13 C part of a banded matrix A , with the diagonals or bands of A
14 C stored in the rows of W , while columns of A correspond to
15 C columns of W . This is the storage mode used in LINPACK and
16 C results in efficient innermost loops.
17 C Explicitly, A has NBANDL bands below the diagonal
18 C + 1 (main) diagonal
19 C + NBANDU bands above the diagonal
20 C and thus, with MIDDLE = NBANDU + 1,
21 C A(I+J,J) is in W(I+MIDDLE,J) for I=-NBANDU,...,NBANDL
22 C J=1,...,NROW .
23 C For example, the interesting entries of A (1,2)-banded matrix
24 C of order 9 would appear in the first 1+1+2 = 4 rows of W
25 C as follows.
26 C 13 24 35 46 57 68 79
27 C 12 23 34 45 56 67 78 89
28 C 11 22 33 44 55 66 77 88 99
29 C 21 32 43 54 65 76 87 98
30 C
31 C All other entries of W not identified in this way with an en-
32 C try of A are never referenced .
33 C NROWW.....Row dimension of the work array W .
34 C must be .GE. NBANDL + 1 + NBANDU .
35 C NBANDL.....Number of bands of A below the main diagonal
36 C NBANDU.....Number of bands of A above the main diagonal .
37 C
38 C ***** O U T P U T ******
39 C IFLAG.....Integer indicating success( = 1) or failure ( = 2) .
40 C If IFLAG = 1, then
41 C W.....contains the LU-factorization of A into a unit lower triangu-
42 C lar matrix L and an upper triangular matrix U (both banded)
43 C and stored in customary fashion over the corresponding entries
44 C of A . This makes it possible to solve any particular linear
45 C system A*X = B for X by A
46 C CALL BNSLV ( W, NROWW, NROW, NBANDL, NBANDU, B )
47 C with the solution X contained in B on return .
48 C If IFLAG = 2, then
49 C one of NROW-1, NBANDL,NBANDU failed to be nonnegative, or else
50 C one of the potential pivots was found to be zero indicating
51 C that A does not have an LU-factorization. This implies that
52 C A is singular in case it is totally positive .
53 C
54 C ***** M E T H O D ******
55 C Gauss elimination W I T H O U T pivoting is used. The routine is
56 C intended for use with matrices A which do not require row inter-
57 C changes during factorization, especially for the T O T A L L Y
58 C P O S I T I V E matrices which occur in spline calculations.
59 C The routine should not be used for an arbitrary banded matrix.
60 C***ROUTINES CALLED (NONE)
61 C***END PROLOGUE BNFAC
62 C
63 INTEGER IFLAG, NBANDL, NBANDU, NROW, NROWW, I, IPK, J, JMAX, K,
64 1 KMAX, MIDDLE, MIDMK, NROWM1
65 REAL W(NROWW,NROW), FACTOR, PIVOT
66 C
67 C***FIRST EXECUTABLE STATEMENT BNFAC
68 IFLAG = 1
69 MIDDLE = NBANDU + 1
70 C W(MIDDLE,.) CONTAINS THE MAIN DIAGONAL OF A .
71 NROWM1 = NROW - 1
72 IF (NROWM1) 120, 110, 10
73 10 IF (NBANDL.GT.0) GO TO 30
74 C A IS UPPER TRIANGULAR. CHECK THAT DIAGONAL IS NONZERO .
75 DO 20 I=1,NROWM1
76 IF (W(MIDDLE,I).EQ.0.0E0) GO TO 120
77 20 CONTINUE
78 GO TO 110
79 30 IF (NBANDU.GT.0) GO TO 60
80 C A IS LOWER TRIANGULAR. CHECK THAT DIAGONAL IS NONZERO AND
81 C DIVIDE EACH COLUMN BY ITS DIAGONAL .
82 DO 50 I=1,NROWM1
83 PIVOT = W(MIDDLE,I)
84 IF (PIVOT.EQ.0.0E0) GO TO 120
85 JMAX = MIN0(NBANDL,NROW-I)
86 DO 40 J=1,JMAX
87 W(MIDDLE+J,I) = W(MIDDLE+J,I)/PIVOT
88 40 CONTINUE
89 50 CONTINUE
90 RETURN
91 C
92 C A IS NOT JUST A TRIANGULAR MATRIX. CONSTRUCT LU FACTORIZATION
93 60 DO 100 I=1,NROWM1
94 C W(MIDDLE,I) IS PIVOT FOR I-TH STEP .
95 PIVOT = W(MIDDLE,I)
96 IF (PIVOT.EQ.0.0E0) GO TO 120
97 C JMAX IS THE NUMBER OF (NONZERO) ENTRIES IN COLUMN I
98 C BELOW THE DIAGONAL .
99 JMAX = MIN0(NBANDL,NROW-I)
100 C DIVIDE EACH ENTRY IN COLUMN I BELOW DIAGONAL BY PIVOT .
101 DO 70 J=1,JMAX
102 W(MIDDLE+J,I) = W(MIDDLE+J,I)/PIVOT
103 70 CONTINUE
104 C KMAX IS THE NUMBER OF (NONZERO) ENTRIES IN ROW I TO
105 C THE RIGHT OF THE DIAGONAL .
106 KMAX = MIN0(NBANDU,NROW-I)
107 C SUBTRACT A(I,I+K)*(I-TH COLUMN) FROM (I+K)-TH COLUMN
108 C (BELOW ROW I ) .
109 DO 90 K=1,KMAX
110 IPK = I + K
111 MIDMK = MIDDLE - K
112 FACTOR = W(MIDMK,IPK)
113 DO 80 J=1,JMAX
114 W(MIDMK+J,IPK) = W(MIDMK+J,IPK) - W(MIDDLE+J,I)*FACTOR
115 80 CONTINUE
116 90 CONTINUE
117 100 CONTINUE
118 C CHECK THE LAST DIAGONAL ENTRY .
119 110 IF (W(MIDDLE,NROW).NE.0.0E0) RETURN
120 120 IFLAG = 2
121 RETURN
122 END
0 SUBROUTINE BNSLV(W,NROWW,NROW,NBANDL,NBANDU,B)
1 C***BEGIN PROLOGUE BNSLV
2 C***REFER TO BINT4,BINTK
3 C
4 C BNSLV is the BANSLV routine from
5 C * A Practical Guide to Splines * by C. de Boor
6 C
7 C Companion routine to BNFAC . It returns the solution X of the
8 C linear system A*X = B in place of B , given the LU-factorization
9 C for A in the work array W from BNFAC.
10 C
11 C ***** I N P U T ******
12 C W, NROWW,NROW,NBANDL,NBANDU.....describe the LU-factorization of a
13 C banded matrix A of order NROW as constructed in BNFAC .
14 C For details, see BNFAC .
15 C B.....Right side of the system to be solved .
16 C
17 C ***** O U T P U T ******
18 C B.....Contains the solution X , of order NROW .
19 C
20 C ***** M E T H O D ******
21 C (With A = L*U, as stored in W,) the unit lower triangular system
22 C L(U*X) = B is solved for Y = U*X, and Y stored in B . Then the
23 C upper triangular system U*X = Y is solved for X . The calcul-
24 C ations are so arranged that the innermost loops stay within columns.
25 C***ROUTINES CALLED (NONE)
26 C***END PROLOGUE BNSLV
27 C
28 INTEGER NBANDL, NBANDU, NROW, NROWW, I, J, JMAX, MIDDLE, NROWM1
29 REAL W(NROWW,NROW), B(NROW)
30 C***FIRST EXECUTABLE STATEMENT BNSLV
31 MIDDLE = NBANDU + 1
32 IF (NROW.EQ.1) GO TO 80
33 NROWM1 = NROW - 1
34 IF (NBANDL.EQ.0) GO TO 30
35 C FORWARD PASS
36 C FOR I=1,2,...,NROW-1, SUBTRACT RIGHT SIDE(I)*(I-TH COLUMN
37 C OF L ) FROM RIGHT SIDE (BELOW I-TH ROW) .
38 DO 20 I=1,NROWM1
39 JMAX = MIN0(NBANDL,NROW-I)
40 DO 10 J=1,JMAX
41 B(I+J) = B(I+J) - B(I)*W(MIDDLE+J,I)
42 10 CONTINUE
43 20 CONTINUE
44 C BACKWARD PASS
45 C FOR I=NROW,NROW-1,...,1, DIVIDE RIGHT SIDE(I) BY I-TH DIAG-
46 C ONAL ENTRY OF U, THEN SUBTRACT RIGHT SIDE(I)*(I-TH COLUMN
47 C OF U) FROM RIGHT SIDE (ABOVE I-TH ROW).
48 30 IF (NBANDU.GT.0) GO TO 50
49 C A IS LOWER TRIANGULAR .
50 DO 40 I=1,NROW
51 B(I) = B(I)/W(1,I)
52 40 CONTINUE
53 RETURN
54 50 I = NROW
55 60 B(I) = B(I)/W(MIDDLE,I)
56 JMAX = MIN0(NBANDU,I-1)
57 DO 70 J=1,JMAX
58 B(I-J) = B(I-J) - B(I)*W(MIDDLE-J,I)
59 70 CONTINUE
60 I = I - 1
61 IF (I.GT.1) GO TO 60
62 80 B(1) = B(1)/W(MIDDLE,1)
63 RETURN
64 END
0 SUBROUTINE BSGQ8(FUN,XT,BC,N,KK,ID,A,B,INBV,ERR,ANS,IERR,WORK)
1 C***BEGIN PROLOGUE BSGQ8
2 C***REFER TO BFQAD
3 C
4 C Written by R.E. Jones and modified by D.E. Amos
5 C
6 C Abstract
7 C BSGQ8, a modification of GAUS8, integrates the
8 C product of FUN(X) by the ID-th derivative of a spline
9 C BVALU(XT,BC,N,KK,ID,X,INBV,WORK) between limits A and B.
10 C
11 C BSGQ8 calls BVALU, INTRV, I1MACH, R1MACH, XERROR
12 C
13 C Description of Arguments
14 C
15 C INPUT--
16 C FUN - Name of external function of one argument which
17 C multiplies BVALU.
18 C XT - Knot array for BVALU
19 C BC - B-coefficient array for BVALU
20 C N - Number of B-coefficients for BVALU
21 C KK - Order of the spline, KK.GE.1
22 C ID - Order of the spline derivative, 0.LE.ID.LE.KK-1
23 C A - Lower limit of integral
24 C B - Upper limit of integral (may be less than A)
25 C INBV- Initialization parameter for BVALU
26 C ERR - Is a requested pseudorelative error tolerance. Normally
27 C pick a value of ABS(ERR).LT.1E-3. ANS will normally
28 C have no more error than ABS(ERR) times the integral of
29 C the absolute value of FUN(X)*BVALU(XT,BC,N,KK,X,ID,
30 C INBV,WORK).
31 C
32 C
33 C OUTPUT--
34 C ERR - Will be an estimate of the absolute error in ans if the
35 C input value of ERR was negative. (ERR is unchanged if
36 C the input value of ERR was nonnegative.) The estimated
37 C error is solely for information to the user and should
38 C not be used as a correction to the computed integral.
39 C ANS - Computed value of integral
40 C IERR- A status code
41 C --Normal Codes
42 C 1 ANS most likely meets requested error tolerance,
43 C or A=B.
44 C -1 A and B are too nearly equal to allow normal
45 C integration. ANS is set to zero.
46 C --Abnormal Code
47 C 2 ANS probably does not meet requested error tolerance.
48 C WORK- Work vector of length 3*K for BVALU
49 C***ROUTINES CALLED BVALU,I1MACH,R1MACH,XERROR
50 C***END PROLOGUE BSGQ8
51 C
52 INTEGER ICALL,ID,IERR,INBV,K, KK, KML, KMX, L, LMN, LMX, LR, MXL,
53 1 N, NBITS, NIB, NLMN, NLMX
54 INTEGER I1MACH
55 REAL A, AA, AE, ANIB, ANS, AREA, B, BC, C, CE, EE, EF, EPS, ERR,
56 1 EST,GL,GLR,GR,HH,SQ2,TOL,VL,VR,WORK,W1, W2, W3, W4, XT, X1,
57 2 X2, X3, X4, X, H
58 REAL R1MACH, BVALU, G8, FUN
59 DIMENSION XT(1), BC(1)
60 DIMENSION AA(30), HH(30), LR(30), VL(30), GR(30)
61 DATA X1, X2, X3, X4/
62 1 1.83434642495649805E-01, 5.25532409916328986E-01,
63 2 7.96666477413626740E-01, 9.60289856497536232E-01/
64 DATA W1, W2, W3, W4/
65 1 3.62683783378361983E-01, 3.13706645877887287E-01,
66 2 2.22381034453374471E-01, 1.01228536290376259E-01/
67 DATA ICALL / 0 /
68 DATA SQ2/1.41421356E0/
69 DATA NLMN/1/,KMX/5000/,KML/6/
70 G8(X,H)=H*((W1*(FUN(X-X1*H)*BVALU(XT,BC,N,KK,ID,X-X1*H,INBV,WORK)+
71 1 FUN(X+X1*H)*BVALU(XT,BC,N,KK,ID,X+X1*H,INBV,WORK))
72 2 +W2*(FUN(X-X2*H)*BVALU(XT,BC,N,KK,ID,X-X2*H,INBV,WORK)+
73 3 FUN(X+X2*H)*BVALU(XT,BC,N,KK,ID,X+X2*H,INBV,WORK)))
74 4 +(W3*(FUN(X-X3*H)*BVALU(XT,BC,N,KK,ID,X-X3*H,INBV,WORK)+
75 5 FUN(X+X3*H)*BVALU(XT,BC,N,KK,ID,X+X3*H,INBV,WORK))
76 6 +W4*(FUN(X-X4*H)*BVALU(XT,BC,N,KK,ID,X-X4*H,INBV,WORK)+
77 7 FUN(X+X4*H)*BVALU(XT,BC,N,KK,ID,X+X4*H,INBV,WORK))))
78 C
79 C INITIALIZE
80 C
81 C***FIRST EXECUTABLE STATEMENT BSGQ8
82 IF (ICALL.NE.0) CALL XERROR( 'BSGQ8- BSGQ8 CALLED RECURSIVELY. RE
83 1CURSIVE CALLS ARE ILLEGAL IN FORTRAN.', 73, 7, 2)
84 ICALL = 1
85 K = I1MACH(11)
86 ANIB = R1MACH(5)*FLOAT(K)/0.30102000E0
87 NBITS = INT(ANIB)
88 NLMX = (NBITS*5)/8
89 ANS = 0.0E0
90 IERR = 1
91 CE = 0.0E0
92 IF (A.EQ.B) GO TO 140
93 LMX = NLMX
94 LMN = NLMN
95 IF (B.EQ.0.0E0) GO TO 10
96 IF (SIGN(1.0E0,B)*A.LE.0.0E0) GO TO 10
97 C = ABS(1.0E0-A/B)
98 IF (C.GT.0.1E0) GO TO 10
99 IF (C.LE.0.0E0) GO TO 140
100 ANIB = 0.5E0 - ALOG(C)/0.69314718E0
101 NIB = INT(ANIB)
102 LMX = MIN0(NLMX,NBITS-NIB-7)
103 IF (LMX.LT.1) GO TO 130
104 LMN = MIN0(LMN,LMX)
105 10 TOL = AMAX1(ABS(ERR),2.0E0**(5-NBITS))/2.0E0
106 IF (ERR.EQ.0.0E0) TOL = SQRT(R1MACH(4))
107 EPS = TOL
108 HH(1) = (B-A)/4.0E0
109 AA(1) = A
110 LR(1) = 1
111 L = 1
112 EST = G8(AA(L)+2.0E0*HH(L),2.0E0*HH(L))
113 K = 8
114 AREA = ABS(EST)
115 EF = 0.5E0
116 MXL = 0
117 C
118 C COMPUTE REFINED ESTIMATES, ESTIMATE THE ERROR, ETC.
119 C
120 20 GL = G8(AA(L)+HH(L),HH(L))
121 GR(L) = G8(AA(L)+3.0E0*HH(L),HH(L))
122 K = K + 16
123 AREA = AREA + (ABS(GL)+ABS(GR(L))-ABS(EST))
124 GLR = GL + GR(L)
125 EE = ABS(EST-GLR)*EF
126 AE = AMAX1(EPS*AREA,TOL*ABS(GLR))
127 IF (EE-AE) 40, 40, 50
128 30 MXL = 1
129 40 CE = CE + (EST-GLR)
130 IF (LR(L)) 60, 60, 80
131 C
132 C CONSIDER THE LEFT HALF OF THIS LEVEL
133 C
134 50 IF (K.GT.KMX) LMX = KML
135 IF (L.GE.LMX) GO TO 30
136 L = L + 1
137 EPS = EPS*0.5E0
138 EF = EF/SQ2
139 HH(L) = HH(L-1)*0.5E0
140 LR(L) = -1
141 AA(L) = AA(L-1)
142 EST = GL
143 GO TO 20
144 C
145 C PROCEED TO RIGHT HALF AT THIS LEVEL
146 C
147 60 VL(L) = GLR
148 70 EST = GR(L-1)
149 LR(L) = 1
150 AA(L) = AA(L) + 4.0E0*HH(L)
151 GO TO 20
152 C
153 C RETURN ONE LEVEL
154 C
155 80 VR = GLR
156 90 IF (L.LE.1) GO TO 120
157 L = L - 1
158 EPS = EPS*2.0E0
159 EF = EF*SQ2
160 IF (LR(L)) 100, 100, 110
161 100 VL(L) = VL(L+1) + VR
162 GO TO 70
163 110 VR = VL(L+1) + VR
164 GO TO 90
165 C
166 C EXIT
167 C
168 120 ANS = VR
169 IF ((MXL.EQ.0) .OR. (ABS(CE).LE.2.0E0*TOL*AREA)) GO TO 140
170 IERR = 2
171 CALL XERROR( 'BSGQ8- ANS IS PROBABLY INSUFFICIENTLY ACCURATE.',
172 1 47, 3, 1)
173 GO TO 140
174 130 IERR = -1
175 CALL XERROR( 'BSGQ8- THE FOLLOWING TEMPORARY DIAGNOSTIC WILL APPEA
176 1R ONLY ONCE. A AND B ARE TOO NEARLY EQUAL TO ALLOW NORMAL INTEGRA
177 2TION. ANS IS SET TO ZERO, AND IERR=-1.', 157, 1, -1)
178 140 ICALL = 0
179 IF (ERR.LT.0.0E0) ERR = CE
180 RETURN
181 END
0 SUBROUTINE BSPDR(T,A,N,K,NDERIV,AD)
1 C***BEGIN PROLOGUE BSPDR
2 C***DATE WRITTEN 800901 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. E3
5 C***KEYWORDS B-SPLINE,DATA FITTING,INTERPOLATION,SPLINE
6 C***AUTHOR AMOS, D. E., (SNLA)
7 C***PURPOSE Uses the B-representation to construct a divided difference
8 C table preparatory to a (right) derivative calculation in
9 C BSPEV.
10 C***DESCRIPTION
11 C
12 C Written by Carl de Boor and modified by D. E. Amos
13 C
14 C Reference
15 C SIAM J. Numerical Analysis, 14, No. 3, June, 1977, pp.441-472.
16 C
17 C Abstract
18 C BSPDR is the BSPLDR routine of the reference.
19 C
20 C BSPDR uses the B-representation (T,A,N,K) to construct a
21 C divided difference table ADIF preparatory to a (right)
22 C derivative calculation in BSPEV. The lower triangular matrix
23 C ADIF is stored in vector AD by columns. The arrays are
24 C related by
25 C
26 C ADIF(I,J) = AD(I-J+1 + (2*N-J+2)*(J-1)/2)
27 C
28 C I = J,N , J = 1,NDERIV .
29 C
30 C Description of Arguments
31 C Input
32 C T - knot vector of length N+K
33 C A - B-spline coefficient vector of length N
34 C N - number of B-spline coefficients
35 C N = sum of knot multiplicities-K
36 C K - order of the spline, K .GE. 1
37 C NDERIV - number of derivatives, 1 .LE. NDERIV .LE. K.
38 C NDERIV=1 gives the zero-th derivative = function
39 C value
40 C
41 C Output
42 C AD - table of differences in a vector of length
43 C (2*N-NDERIV+1)*NDERIV/2 for input to BSPEV
44 C
45 C Error Conditions
46 C Improper input is a fatal error
47 C***REFERENCES C. DE BOOR, *PACKAGE FOR CALCULATING WITH B-SPLINES*,
48 C SIAM JOURNAL ON NUMERICAL ANALYSIS, VOLUME 14, NO. 3,
49 C JUNE 1977, PP. 441-472.
50 C***ROUTINES CALLED XERROR
51 C***END PROLOGUE BSPDR
52 C
53 C
54 INTEGER I, ID, II, IPKMID, JJ, JM, K, KMID, N, NDERIV
55 REAL A, AD, DIFF, FKMID, T
56 C DIMENSION T(N+K), AD((2*N-NDERIV+1)*NDERIV/2)
57 DIMENSION T(1), A(N), AD(1)
58 C***FIRST EXECUTABLE STATEMENT BSPDR
59 IF(K.LT.1) GO TO 100
60 IF(N.LT.K) GO TO 105
61 IF(NDERIV.LT.1 .OR. NDERIV.GT.K) GO TO 110
62 DO 10 I=1,N
63 AD(I) = A(I)
64 10 CONTINUE
65 IF (NDERIV.EQ.1) RETURN
66 KMID = K
67 JJ = N
68 JM = 0
69 DO 30 ID=2,NDERIV
70 KMID = KMID - 1
71 FKMID = FLOAT(KMID)
72 II = 1
73 DO 20 I=ID,N
74 IPKMID = I + KMID
75 DIFF = T(IPKMID) - T(I)
76 IF (DIFF.NE.0.0E0) AD(II+JJ) = (AD(II+JM+1)-AD(II+JM))/
77 1 DIFF*FKMID
78 II = II + 1
79 20 CONTINUE
80 JM = JJ
81 JJ = JJ + N - ID + 1
82 30 CONTINUE
83 RETURN
84 C
85 C
86 100 CONTINUE
87 CALL XERROR( ' BSPDR, K DOES NOT SATISFY K.GE.1', 34, 2, 1)
88 RETURN
89 105 CONTINUE
90 CALL XERROR( ' BSPDR, N DOES NOT SATISFY N.GE.K', 34, 2, 1)
91 RETURN
92 110 CONTINUE
93 CALL XERROR( ' BSPDR, NDERIV DOES NOT SATISFY 1.LE.NDERIV.LE.K',
94 1 49, 2, 1)
95 RETURN
96 END
0 SUBROUTINE BSPEV(T,AD,N,K,NDERIV,X,INEV,SVALUE,WORK)
1 C***BEGIN PROLOGUE BSPEV
2 C***DATE WRITTEN 800901 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. E3,K6
5 C***KEYWORDS B-SPLINE,DATA FITTING,INTERPOLATION,SPLINE
6 C***AUTHOR AMOS, D. E., (SNLA)
7 C***PURPOSE Calculates the value of the spline and its derivatives at X
8 C from the B-representation .
9 C***DESCRIPTION
10 C
11 C Written by Carl de Boor and modified by D. E. Amos
12 C
13 C Reference
14 C SIAM J. Numerical Analysis, 14, No. 3, June, 1977, pp.441-472.
15 C
16 C Abstract
17 C BSPEV is the BSPLEV routine of the reference.
18 C
19 C BSPEV calculates the value of the spline and its derivatives
20 C at X from the B-representation (T,A,N,K) and returns them
21 C in SVALUE(I),I=1,NDERIV, T(K) .LE. X .LE. T(N+1). AD(I) can
22 C be the B-spline coefficients A(I), I=1,N if NDERIV=1. Other-
23 C wise AD must be computed before hand by a call to BSPDR (T,A,
24 C N,K,NDERIV,AD). If X=T(I),I=K,N, right limiting values are
25 C obtained.
26 C
27 C To compute left derivatives or left limiting values at a
28 C knot T(I), replace N by I-1 and set X=T(I), I=K+1,N+1.
29 C
30 C BSPEV calls INTRV, BSPVN
31 C
32 C Description of Arguments
33 C Input
34 C T - knot vector of length N+K
35 C AD - vector of length (2*N-NDERIV+1)*NDERIV/2 containing
36 C the difference table from BSPDR.
37 C N - number of B-spline coefficients
38 C N = sum of knot multiplicities-K
39 C K - order of the B-spline, K .GE. 1
40 C NDERIV - number of derivatives, 1 .LE. NDERIV .LE. K.
41 C NDERIV=1 gives the zero-th derivative = function
42 C value
43 C X - argument, T(K) .LE. X .LE. T(N+1)
44 C INEV - an initialization parameter which must be set
45 C to 1 the first time BSPEV is called.
46 C
47 C Output
48 C INEV - INEV contains information for efficient process-
49 C ing after the initial call and INEV must not
50 C be changed by the user. Distinct splines require
51 C distinct INEV parameters.
52 C SVALUE - vector of length NDERIV containing the spline
53 C value in SVALUE(1) and the NDERIV-1 derivatives
54 C in the remaining components.
55 C WORK - work vector of length 3*K
56 C
57 C Error Conditions
58 C Improper input is a fatal error.
59 C***REFERENCES C. DE BOOR, *PACKAGE FOR CALCULATING WITH B-SPLINES*,
60 C SIAM JOURNAL ON NUMERICAL ANALYSIS, VOLUME 14, NO. 3,
61 C JUNE 1977, PP. 441-472.
62 C***ROUTINES CALLED BSPVN,INTRV,XERROR
63 C***END PROLOGUE BSPEV
64 C
65 C
66 INTEGER I,ID,INEV,IWORK,JJ,K,KP1,KP1MN,L,LEFT,LL,MFLAG,
67 1 N, NDERIV
68 REAL AD, SVALUE, SUM, T, WORK, X
69 C DIMENSION T(N+K)
70 DIMENSION T(1), AD(1), SVALUE(NDERIV), WORK(1)
71 C***FIRST EXECUTABLE STATEMENT BSPEV
72 IF(K.LT.1) GO TO 100
73 IF(N.LT.K) GO TO 105
74 IF(NDERIV.LT.1 .OR. NDERIV.GT.K) GO TO 115
75 ID = NDERIV
76 CALL INTRV(T, N+1, X, INEV, I, MFLAG)
77 IF (X.LT.T(K)) GO TO 110
78 IF (MFLAG.EQ.0) GO TO 30
79 IF (X.GT.T(I)) GO TO 110
80 20 IF (I.EQ.K) GO TO 120
81 I = I - 1
82 IF (X.EQ.T(I)) GO TO 20
83 C
84 C *I* HAS BEEN FOUND IN (K,N) SO THAT T(I) .LE. X .LT. T(I+1)
85 C (OR .LE. T(I+1), IF T(I) .LT. T(I+1) = T(N+1) ).
86 30 KP1MN = K + 1 - ID
87 KP1 = K + 1
88 CALL BSPVN(T, KP1MN, K, 1, X, I, WORK(1),WORK(KP1),IWORK)
89 JJ = (N+N-ID+2)*(ID-1)/2
90 C ADIF(LEFTPL,ID) = AD(LEFTPL-ID+1 + (2*N-ID+2)*(ID-1)/2)
91 C LEFTPL = LEFT + L
92 40 LEFT = I - KP1MN
93 SUM = 0.0E0
94 LL = LEFT + JJ + 2 - ID
95 DO 50 L=1,KP1MN
96 SUM = SUM + WORK(L)*AD(LL)
97 LL = LL + 1
98 50 CONTINUE
99 SVALUE(ID) = SUM
100 ID = ID - 1
101 IF (ID.EQ.0) GO TO 60
102 JJ = JJ-(N-ID+1)
103 KP1MN = KP1MN + 1
104 CALL BSPVN(T, KP1MN, K, 2, X, I, WORK(1), WORK(KP1),IWORK)
105 GO TO 40
106 C
107 60 RETURN
108 C
109 C
110 100 CONTINUE
111 CALL XERROR( ' BSPEV, K DOES NOT SATISFY K.GE.1',34,2,1)
112 RETURN
113 105 CONTINUE
114 CALL XERROR( ' BSPEV, N DOES NOT SATISFY N.GE.K',34,2,1)
115 RETURN
116 110 CONTINUE
117 CALL XERROR( ' BSPEV, X IS NOT IN T(K).LE.X.LE.T(N+1)',40,2,1)
118 RETURN
119 115 CONTINUE
120 CALL XERROR( ' BSPEV, NDERIV DOES NOT SATISFY 1.LE.NDERIV.LE.K',
121 1 49, 2, 1)
122 RETURN
123 120 CONTINUE
124 CALL XERROR( ' BSPEV, A LEFT LIMITING VALUE CANNOT BE OBTAINED AT
125 1 T(K)',57,2,1)
126 RETURN
127 END
0 SUBROUTINE BSPPP(T,A,N,K,LDC,C,XI,LXI,WORK)
1 C***BEGIN PROLOGUE BSPPP
2 C***DATE WRITTEN 800901 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. E3,K6
5 C***KEYWORDS B-SPLINE,DATA FITTING,INTERPOLATION,SPLINE
6 C***AUTHOR AMOS, D. E., (SNLA)
7 C***PURPOSE Converts the B-representation to the piecewise
8 C polynomial (PP) form for use with PPVAL.
9 C***DESCRIPTION
10 C
11 C Written by Carl de Boor and modified by D. E. Amos
12 C
13 C Reference
14 C SIAM J. Numerical Analysis, 14, No. 3, June, 1977, pp.441-472.
15 C
16 C Abstract
17 C BSPPP is the BSPLPP routine of the reference.
18 C
19 C BSPPP converts the B-representation (T,A,N,K) to the
20 C piecewise polynomial (PP) form (C,XI,LXI,K) for use with
21 C PPVAL. Here XI(*), the break point array of length LXI, is
22 C the knot array T(*) with multiplicities removed. The columns
23 C of the matrix C(I,J) contain the right Taylor derivatives
24 C for the polynomial expansion about XI(J) for the intervals
25 C XI(J) .LE. X .LE. XI(J+1), I=1,K, J=1,LXI. Function PPVAL
26 C makes this evaluation at a specified point X in
27 C XI(1) .LE. X .LE. XI(LXI(1) .LE. X .LE. XI+1)
28 C
29 C BSPPP calls BSPDR, BSPEV, INTRV, BSPVN
30 C
31 C Description of Arguments
32 C Input
33 C T - knot vector of length N+K
34 C A - B-spline coefficient vector of length N
35 C N - number of B-spline coefficients
36 C N = sum of knot multiplicities-K
37 C K - order of the B-spline, K .GE. 1
38 C LDC - leading dimension of C, LDC .GE. K
39 C
40 C Output
41 C C - matrix of dimension at least (K,LXI) containing
42 C right derivatives at break points
43 C XI - XI break point vector of length LXI+1
44 C LXI - number of break points, LXI .LE. N-K+1
45 C WORK - work vector of length K*(N+3)
46 C
47 C Error Conditions
48 C Improper input is a fatal error
49 C***REFERENCES C. DE BOOR, *PACKAGE FOR CALCULATING WITH B-SPLINES*,
50 C SIAM JOURNAL ON NUMERICAL ANALYSIS, VOLUME 14, NO. 3,
51 C JUNE 1977, PP. 441-472.
52 C***ROUTINES CALLED BSPDR,BSPEV,XERROR
53 C***END PROLOGUE BSPPP
54 C
55 C
56 INTEGER ILEFT, INEV, K, LDC, LXI, N, NK
57 REAL A, C, T, WORK, XI
58 C DIMENSION T(N+K),XI(LXI+1),C(LDC,*)
59 C HERE, * = THE FINAL VALUE OF THE OUTPUT PARAMETER LXI.
60 DIMENSION T(1), A(N), WORK(1), XI(1), C(LDC,1)
61 C***FIRST EXECUTABLE STATEMENT BSPPP
62 IF(K.LT.1) GO TO 100
63 IF(N.LT.K) GO TO 105
64 IF(LDC.LT.K) GO TO 110
65 CALL BSPDR(T, A, N, K, K, WORK)
66 LXI = 0
67 XI(1) = T(K)
68 INEV = 1
69 NK = N*K + 1
70 DO 10 ILEFT=K,N
71 IF (T(ILEFT+1).EQ.T(ILEFT)) GO TO 10
72 LXI = LXI + 1
73 XI(LXI+1) = T(ILEFT+1)
74 CALL BSPEV(T,WORK(1),N,K, K,XI(LXI),INEV,C(1,LXI),WORK(NK))
75 10 CONTINUE
76 RETURN
77 100 CONTINUE
78 CALL XERROR( ' BSPPP, K DOES NOT SATISFY K.GE.1', 34, 2, 1)
79 RETURN
80 105 CONTINUE
81 CALL XERROR( ' BSPPP, N DOES NOT SATISFY N.GE.K', 34, 2, 1)
82 RETURN
83 110 CONTINUE
84 CALL XERROR( ' BSPPP, LDC DOES NOT SATISFY LDC.GE.K', 38, 2, 1)
85 RETURN
86 END
0 SUBROUTINE BSPVD(T,K,NDERIV,X,ILEFT,LDVNIK,VNIKX,WORK)
1 C***BEGIN PROLOGUE BSPVD
2 C***DATE WRITTEN 800901 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. E3,K6
5 C***KEYWORDS B-SPLINE,DATA FITTING,INTERPOLATION,SPLINE
6 C***AUTHOR AMOS, D. E., (SNLA)
7 C***PURPOSE Calculates the value and all derivatives of order less than
8 C NDERIV of all basis functions which do not vanish at X.
9 C***DESCRIPTION
10 C
11 C Written by Carl de Boor and modified by D. E. Amos
12 C
13 C Reference
14 C SIAM J. Numerical Analysis, 14, No. 3, June, 1977, pp.441-472.
15 C
16 C Abstract
17 C BSPVD is the BSPLVD routine of the reference.
18 C
19 C BSPVD calculates the value and all derivatives of order
20 C less than NDERIV of all basis functions which do not
21 C (possibly) vanish at X. ILEFT is input such that
22 C T(ILEFT) .LE. X .LT. T(ILEFT+1). A call to INTRV(T,N+1,X,
23 C ILO,ILEFT,MFLAG) will produce the proper ILEFT. The output of
24 C BSPVD is a matrix VNIKX(I,J) of dimension at least (K,NDERIV)
25 C whose columns contain the K nonzero basis functions and
26 C their NDERIV-1 right derivatives at X, I=1,K, J=1,NDERIV.
27 C These basis functions have indices ILEFT-K+I, I=1,K,
28 C K .LE. ILEFT .LE. N. The nonzero part of the I-th basis
29 C function lies in (T(I),T(I+K)), I=1,N.
30 C
31 C If X=T(ILEFT+1) then VNIKX contains left limiting values
32 C (left derivatives) at T(ILEFT+1). In particular, ILEFT = N
33 C produces left limiting values at the right end point
34 C X=T(N+1). To obtain left limiting values at T(I), I=K+1,N+1,
35 C set X= next lower distinct knot, call INTRV to get ILEFT,
36 C set X=T(I), and then call BSPVD.
37 C
38 C BSPVD calls BSPVN
39 C
40 C Description of Arguments
41 C Input
42 C T - knot vector of length N+K, where
43 C N = number of B-spline basis functions
44 C N = sum of knot multiplicities-K
45 C K - order of the B-spline, K .GE. 1
46 C NDERIV - number of derivatives = NDERIV-1,
47 C 1 .LE. NDERIV .LE. K
48 C X - argument of basis functions,
49 C T(K) .LE. X .LE. T(N+1)
50 C ILEFT - largest integer such that
51 C T(ILEFT) .LE. X .LT. T(ILEFT+1)
52 C LDVNIK - leading dimension of matrix VNIKX
53 C
54 C Output
55 C VNIKX - matrix of dimension at least (K,NDERIV) contain-
56 C ing the nonzero basis functions at X and their
57 C derivatives columnwise.
58 C WORK - a work vector of length (K+1)*(K+2)/2
59 C
60 C Error Conditions
61 C Improper input is a fatal error
62 C***REFERENCES C. DE BOOR, *PACKAGE FOR CALCULATING WITH B-SPLINES*,
63 C SIAM JOURNAL ON NUMERICAL ANALYSIS, VOLUME 14, NO. 3,
64 C JUNE 1977, PP. 441-472.
65 C***ROUTINES CALLED BSPVN,XERROR
66 C***END PROLOGUE BSPVD
67 C
68 C
69 INTEGER I,IDERIV,ILEFT,IPKMD,J,JJ,JLOW,JM,JP1MID,K,KMD, KP1, L,
70 1 LDUMMY, M, MHIGH, NDERIV
71 REAL FACTOR, FKMD, T, V, VNIKX, WORK, X
72 C DIMENSION T(ILEFT+K), WORK((K+1)*(K+2)/2)
73 C A(I,J) = WORK(I+J*(J+1)/2), I=1,J+1 J=1,K-1
74 C A(I,K) = W0RK(I+K*(K-1)/2) I=1.K
75 C WORK(1) AND WORK((K+1)*(K+2)/2) ARE NOT USED.
76 DIMENSION T(1), VNIKX(LDVNIK,NDERIV), WORK(1)
77 C***FIRST EXECUTABLE STATEMENT BSPVD
78 IF(K.LT.1) GO TO 200
79 IF(NDERIV.LT.1 .OR. NDERIV.GT.K) GO TO 205
80 IF(LDVNIK.LT.K) GO TO 210
81 IDERIV = NDERIV
82 KP1 = K + 1
83 JJ = KP1 - IDERIV
84 CALL BSPVN(T, JJ, K, 1, X, ILEFT, VNIKX, WORK, IWORK)
85 IF (IDERIV.EQ.1) GO TO 100
86 MHIGH = IDERIV
87 DO 20 M=2,MHIGH
88 JP1MID = 1
89 DO 10 J=IDERIV,K
90 VNIKX(J,IDERIV) = VNIKX(JP1MID,1)
91 JP1MID = JP1MID + 1
92 10 CONTINUE
93 IDERIV = IDERIV - 1
94 JJ = KP1 - IDERIV
95 CALL BSPVN(T, JJ, K, 2, X, ILEFT, VNIKX, WORK, IWORK)
96 20 CONTINUE
97 C
98 JM = KP1*(KP1+1)/2
99 DO 30 L = 1,JM
100 WORK(L) = 0.0E0
101 30 CONTINUE
102 C A(I,I) = WORK(I*(I+3)/2) = 1.0 I = 1,K
103 L = 2
104 J = 0
105 DO 40 I = 1,K
106 J = J + L
107 WORK(J) = 1.0E0
108 L = L + 1
109 40 CONTINUE
110 KMD = K
111 DO 90 M=2,MHIGH
112 KMD = KMD - 1
113 FKMD = FLOAT(KMD)
114 I = ILEFT
115 J = K
116 JJ = J*(J+1)/2
117 JM = JJ - J
118 DO 60 LDUMMY=1,KMD
119 IPKMD = I + KMD
120 FACTOR = FKMD/(T(IPKMD)-T(I))
121 DO 50 L=1,J
122 WORK(L+JJ) = (WORK(L+JJ)-WORK(L+JM))*FACTOR
123 50 CONTINUE
124 I = I - 1
125 J = J - 1
126 JJ = JM
127 JM = JM - J
128 60 CONTINUE
129 C
130 DO 80 I=1,K
131 V = 0.0E0
132 JLOW = MAX0(I,M)
133 JJ = JLOW*(JLOW+1)/2
134 DO 70 J=JLOW,K
135 V = WORK(I+JJ)*VNIKX(J,M) + V
136 JJ = JJ + J + 1
137 70 CONTINUE
138 VNIKX(I,M) = V
139 80 CONTINUE
140 90 CONTINUE
141 100 RETURN
142 C
143 C
144 200 CONTINUE
145 CALL XERROR( ' BSPVD, K DOES NOT SATISFY K.GE.1', 34, 2, 1)
146 RETURN
147 205 CONTINUE
148 CALL XERROR( ' BSPVD, NDERIV DOES NOT SATISFY 1.LE.NDERIV.LE.K',
149 1 49, 2, 1)
150 RETURN
151 210 CONTINUE
152 CALL XERROR( ' BSPVD, LDVNIK DOES NOT SATISFY LDVNIK.GE.K',44,
153 1 2, 1)
154 RETURN
155 END
0 SUBROUTINE BSPVN(T,JHIGH,K,INDEX,X,ILEFT,VNIKX,WORK,IWORK)
1 C***BEGIN PROLOGUE BSPVN
2 C***DATE WRITTEN 800901 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. E3,K6
5 C***KEYWORDS B-SPLINE,DATA FITTING,INTERPOLATION,SPLINE
6 C***AUTHOR AMOS, D. E., (SNLA)
7 C***PURPOSE Calculates the value of all (possibly) nonzero basis
8 C functions at X.
9 C***DESCRIPTION
10 C
11 C Written by Carl de Boor and modified by D. E. Amos
12 C
13 C Reference
14 C SIAM J. Numerical Analysis, 14, No. 3, June, 1977, pp.441-472.
15 C
16 C Abstract
17 C BSPVN is the BSPLVN routine of the reference.
18 C
19 C BSPVN calculates the value of all (possibly) nonzero basis
20 C functions at X of order MAX(JHIGH,(J+1)*(INDEX-1)), where
21 C T(K) .LE. X .LE. T(N+1) and J=IWORK is set inside the routine
22 C on the first call when INDEX=1. ILEFT is such that T(ILEFT)
23 C .LE. X .LT. T(ILEFT+1). A call to INTRV(T,N+1,X,ILO,ILEFT,
24 C MFLAG) produces the proper ILEFT. BSPVN calculates using the
25 C basic algorithm needed in BSPVD. If only basis functions are
26 C desired, setting JHIGH=K and INDEX=1 can be faster than
27 C calling BSPVD, but extra coding is required for derivatives
28 C (INDEX=2) and BSPVD is set up for this purpose.
29 C
30 C Left limiting values are set up as described in BSPVD.
31 C
32 C Description of Arguments
33 C Input
34 C T - knot vector of length N+K, where
35 C N = number of B-spline basis functions
36 C N = sum of knot multiplicities-K
37 C JHIGH - order of B-spline, 1 .LE. JHIGH .LE. K
38 C K - highest possible order
39 C INDEX - INDEX = 1 gives basis functions of order JHIGH
40 C = 2 denotes previous entry with WORK, IWORK
41 C values saved for subsequent calls to
42 C BSPVN.
43 C X - argument of basis functions,
44 C T(K) .LE. X .LE. T(N+1)
45 C ILEFT - largest integer such that
46 C T(ILEFT) .LE. X .LT. T(ILEFT+1)
47 C
48 C Output
49 C VNIKX - vector of length K for spline values.
50 C WORK - a work vector of length 2*K
51 C IWORK - a work parameter. Both WORK and IWORK contain
52 C information necessary to continue for INDEX = 2.
53 C When INDEX = 1 exclusively, these are scratch
54 C variables and can be used for other purposes.
55 C
56 C Error Conditions
57 C Improper input is a fatal error.
58 C***REFERENCES C. DE BOOR, *PACKAGE FOR CALCULATING WITH B-SPLINES*,
59 C SIAM JOURNAL ON NUMERICAL ANALYSIS, VOLUME 14, NO. 3,
60 C JUNE 1977, PP. 441-472.
61 C***ROUTINES CALLED XERROR
62 C***END PROLOGUE BSPVN
63 C
64 C
65 INTEGER ILEFT, IMJP1, INDEX, IPJ, IWORK, JHIGH, JP1, JP1ML, K, L
66 REAL T, VM, VMPREV, VNIKX, WORK, X
67 C DIMENSION T(ILEFT+JHIGH)
68 DIMENSION T(1), VNIKX(K), WORK(1)
69 C CONTENT OF J, DELTAM, DELTAP IS EXPECTED UNCHANGED BETWEEN CALLS.
70 C WORK(I) = DELTAP(I), WORK(K+I) = DELTAM(I), I = 1,K
71 C***FIRST EXECUTABLE STATEMENT BSPVN
72 IF(K.LT.1) GO TO 90
73 IF(JHIGH.GT.K .OR. JHIGH.LT.1) GO TO 100
74 IF(INDEX.LT.1 .OR. INDEX.GT.2) GO TO 105
75 IF(X.LT.T(ILEFT) .OR. X.GT.T(ILEFT+1)) GO TO 110
76 GO TO (10, 20), INDEX
77 10 IWORK = 1
78 VNIKX(1) = 1.0E0
79 IF (IWORK.GE.JHIGH) GO TO 40
80 C
81 20 IPJ = ILEFT + IWORK
82 WORK(IWORK) = T(IPJ) - X
83 IMJP1 = ILEFT - IWORK + 1
84 WORK(K+IWORK) = X - T(IMJP1)
85 VMPREV = 0.0E0
86 JP1 = IWORK + 1
87 DO 30 L=1,IWORK
88 JP1ML = JP1 - L
89 VM = VNIKX(L)/(WORK(L)+WORK(K+JP1ML))
90 VNIKX(L) = VM*WORK(L) + VMPREV
91 VMPREV = VM*WORK(K+JP1ML)
92 30 CONTINUE
93 VNIKX(JP1) = VMPREV
94 IWORK = JP1
95 IF (IWORK.LT.JHIGH) GO TO 20
96 C
97 40 RETURN
98 C
99 C
100 90 CONTINUE
101 CALL XERROR( ' BSPVN, K DOES NOT SATISFY K.GE.1', 34, 2, 1)
102 RETURN
103 100 CONTINUE
104 CALL XERROR( ' BSPVN, JHIGH DOES NOT SATISFY 1.LE.JHIGH.LE.K',
105 1 47, 2, 1)
106 RETURN
107 105 CONTINUE
108 CALL XERROR( ' BSPVN, INDEX IS NOT 1 OR 2',28,2,1)
109 RETURN
110 110 CONTINUE
111 CALL XERROR( ' BSPVN, X DOES NOT SATISFY T(ILEFT).LE.X.LE.T(ILEFT
112 1+1)', 55, 2, 1)
113 RETURN
114 END
0 SUBROUTINE BSQAD(T,BCOEF,N,K,X1,X2,BQUAD,WORK)
1 C***BEGIN PROLOGUE BSQAD
2 C***DATE WRITTEN 800901 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. H2A2A1,E3,K6
5 C***KEYWORDS B-SPLINE,DATA FITTING,INTERPOLATION,QUADRATURE,SPLINE
6 C***AUTHOR AMOS, D. E., (SNLA)
7 C***PURPOSE Computes the integral on (X1,X2) of a K-th order
8 C B-spline using the B-representation.
9 C***DESCRIPTION
10 C
11 C Written by D. E. Amos, June, 1979.
12 C
13 C Reference SAND 79-1825
14 C
15 C Abstract
16 C BSQAD computes the integral on (X1,X2) of a K-th order
17 C B-spline using the B-representation (T,BCOEF,N,K). Orders
18 C K as high as 20 are permitted by applying a 2, 6, or 10
19 C point Gauss formula on subintervals of (X1,X2) which are
20 C formed by included (distinct) knots.
21 C
22 C If orders K greater than 20 are needed, use BFQAD with
23 C F(X) = 1.
24 C
25 C BSQAD calls INTRV, BVALU, XERROR
26 C
27 C Description of Arguments
28 C Input
29 C T - knot array of length N+K
30 C BCOEF - B-spline coefficient array of length N
31 C N - length of coefficient array
32 C K - order of B-spline, 1 .LE. K .LE. 20
33 C X1,X2 - end points of quadrature interval in
34 C T(K) .LE. X .LE. T(N+1)
35 C
36 C Output
37 C BQUAD - integral of the B-spline over (X1,X2)
38 C WORK - work vector of length 3*K
39 C
40 C Error Conditions
41 C Improper input is a fatal error
42 C***REFERENCES D.E. AMOS, *QUADRATURE SUBROUTINES FOR SPLINES AND
43 C B-SPLINES*, SAND79-1825, SANDIA LABORATORIES,
44 C DECEMBER 1979.
45 C***ROUTINES CALLED BVALU,INTRV,XERROR
46 C***END PROLOGUE BSQAD
47 C
48 C
49 INTEGER I,IL1,IL2,ILO,INBV, JF,K,LEFT,M,MF,MFLAG,N, NPK, NP1
50 REAL A, AA, B, BB, BCOEF, BMA, BPA, BQUAD, C1, GPTS, GWTS, GX, Q,
51 1 SUM, T, TA, TB, WORK, X1, X2, Y1, Y2
52 REAL BVALU
53 DIMENSION T(1), BCOEF(1), GPTS(9), GWTS(9), SUM(5), WORK(1)
54 C
55 DATA GPTS(1), GPTS(2), GPTS(3), GPTS(4), GPTS(5), GPTS(6),
56 1 GPTS(7), GPTS(8), GPTS(9)/
57 2 5.77350269189625764E-01, 2.38619186083196909E-01,
58 3 6.61209386466264514E-01, 9.32469514203152028E-01,
59 4 1.48874338981631211E-01, 4.33395394129247191E-01,
60 5 6.79409568299024406E-01, 8.65063366688984511E-01,
61 6 9.73906528517171720E-01/
62 DATA GWTS(1), GWTS(2), GWTS(3), GWTS(4), GWTS(5), GWTS(6),
63 1 GWTS(7), GWTS(8), GWTS(9)/
64 2 1.00000000000000000E+00, 4.67913934572691047E-01,
65 3 3.60761573048138608E-01, 1.71324492379170345E-01,
66 4 2.95524224714752870E-01, 2.69266719309996355E-01,
67 5 2.19086362515982044E-01, 1.49451349150580593E-01,
68 6 6.66713443086881376E-02/
69 C
70 C***FIRST EXECUTABLE STATEMENT BSQAD
71 BQUAD = 0.0E0
72 IF(K.LT.1 .OR. K.GT.20) GO TO 65
73 IF(N.LT.K) GO TO 70
74 AA = AMIN1(X1,X2)
75 BB = AMAX1(X1,X2)
76 IF (AA.LT.T(K)) GO TO 60
77 NP1 = N + 1
78 IF (BB.GT.T(NP1)) GO TO 60
79 IF (AA.EQ.BB) RETURN
80 NPK = N + K
81 C SELECTION OF 2, 6, OR 10 POINT GAUSS FORMULA
82 JF = 0
83 MF = 1
84 IF (K.LE.4) GO TO 10
85 JF = 1
86 MF = 3
87 IF (K.LE.12) GO TO 10
88 JF = 4
89 MF = 5
90 10 CONTINUE
91 C
92 DO 20 I=1,MF
93 SUM(I) = 0.0E0
94 20 CONTINUE
95 ILO = 1
96 INBV = 1
97 CALL INTRV(T, NPK, AA, ILO, IL1, MFLAG)
98 CALL INTRV(T, NPK, BB, ILO, IL2, MFLAG)
99 IF (IL2.GE.NP1) IL2 = N
100 DO 40 LEFT=IL1,IL2
101 TA = T(LEFT)
102 TB = T(LEFT+1)
103 IF (TA.EQ.TB) GO TO 40
104 A = AMAX1(AA,TA)
105 B = AMIN1(BB,TB)
106 BMA = 0.5E0*(B-A)
107 BPA = 0.5E0*(B+A)
108 DO 30 M=1,MF
109 C1 = BMA*GPTS(JF+M)
110 GX = -C1 + BPA
111 Y2 = BVALU(T,BCOEF,N,K,0,GX,INBV,WORK)
112 GX = C1 + BPA
113 Y1 = BVALU(T,BCOEF,N,K,0,GX,INBV,WORK)
114 SUM(M) = SUM(M) + (Y1+Y2)*BMA
115 30 CONTINUE
116 40 CONTINUE
117 Q = 0.0E0
118 DO 50 M=1,MF
119 Q = Q + GWTS(JF+M)*SUM(M)
120 50 CONTINUE
121 IF (X1.GT.X2) Q = -Q
122 BQUAD = Q
123 RETURN
124 C
125 C
126 60 CONTINUE
127 CALL XERROR( ' BSQAD, X1 OR X2 OR BOTH DO NOT SATISFY T(K).LE.X.L
128 1E.T(N+1)', 60, 2, 1)
129 RETURN
130 65 CONTINUE
131 CALL XERROR( ' BSQAD, K DOES NOT SATISFY 1.LE.K.LE.20',
132 1 40, 2, 1)
133 RETURN
134 70 CONTINUE
135 CALL XERROR( ' BSQAD, N DOES NOT SATISFY N.GE.K', 34, 2, 1)
136 RETURN
137 END
0 SUBROUTINE BTPCF(X,N,FCN,LDF,NF,T,K,BCOEF,WORK)
1 C***BEGIN PROLOGUE BTPCF
2 C***REFER TO B2INK,B3INK
3 C***ROUTINES CALLED BINTK,BNSLV
4 C***END PROLOGUE BTPCF
5 C
6 C -----------------------------------------------------------------
7 C BTPCF COMPUTES B-SPLINE INTERPOLATION COEFFICIENTS FOR NF SETS
8 C OF DATA STORED IN THE COLUMNS OF THE ARRAY FCN. THE B-SPLINE
9 C COEFFICIENTS ARE STORED IN THE ROWS OF BCOEF HOWEVER.
10 C EACH INTERPOLATION IS BASED ON THE N ABCISSA STORED IN THE
11 C ARRAY X, AND THE N+K KNOTS STORED IN THE ARRAY T. THE ORDER
12 C OF EACH INTERPOLATION IS K. THE WORK ARRAY MUST BE OF LENGTH
13 C AT LEAST 2*K*(N+1).
14 C -----------------------------------------------------------------
15 C
16 C ------------
17 C DECLARATIONS
18 C ------------
19 C
20 C PARAMETERS
21 C
22 INTEGER
23 * N, LDF, K
24 REAL
25 * X(N), FCN(LDF,NF), T(1), BCOEF(NF,N), WORK(1)
26 C
27 C LOCAL VARIABLES
28 C
29 INTEGER
30 * I, J, K1, K2, IQ, IW
31 C
32 C ---------------------------------------------
33 C CHECK FOR NULL INPUT AND PARTITION WORK ARRAY
34 C ---------------------------------------------
35 C
36 C***FIRST EXECUTABLE STATEMENT
37 IF (NF .LE. 0) GO TO 500
38 K1 = K - 1
39 K2 = K1 + K
40 IQ = 1 + N
41 IW = IQ + K2*N+1
42 C
43 C -----------------------------
44 C COMPUTE B-SPLINE COEFFICIENTS
45 C -----------------------------
46 C
47 C
48 C FIRST DATA SET
49 C
50 CALL BINTK(X,FCN,T,N,K,WORK,WORK(IQ),WORK(IW))
51 DO 20 I=1,N
52 BCOEF(1,I) = WORK(I)
53 20 CONTINUE
54 C
55 C ALL REMAINING DATA SETS BY BACK-SUBSTITUTION
56 C
57 IF (NF .EQ. 1) GO TO 500
58 DO 100 J=2,NF
59 DO 50 I=1,N
60 WORK(I) = FCN(I,J)
61 50 CONTINUE
62 CALL BNSLV(WORK(IQ),K2,N,K1,K1,WORK)
63 DO 60 I=1,N
64 BCOEF(J,I) = WORK(I)
65 60 CONTINUE
66 100 CONTINUE
67 C
68 C ----
69 C EXIT
70 C ----
71 C
72 500 CONTINUE
73 RETURN
74 END
0 FUNCTION BVALU(T,A,N,K,IDERIV,X,INBV,WORK)
1 C***BEGIN PROLOGUE BVALU
2 C***DATE WRITTEN 800901 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. E3,K6
5 C***KEYWORDS B-SPLINE,DATA FITTING,INTERPOLATION,SPLINE
6 C***AUTHOR AMOS, D. E., (SNLA)
7 C***PURPOSE Evaluates the B-representation of a B-spline at X for the
8 C function value or any of its derivatives.
9 C***DESCRIPTION
10 C
11 C Written by Carl de Boor and modified by D. E. Amos
12 C
13 C Reference
14 C SIAM J. Numerical Analysis, 14, No. 3, June, 1977, pp.441-472.
15 C
16 C Abstract
17 C BVALU is the BVALUE function of the reference.
18 C
19 C BVALU evaluates the B-representation (T,A,N,K) of a B-spline
20 C at X for the function value on IDERIV = 0 or any of its
21 C derivatives on IDERIV = 1,2,...,K-1. Right limiting values
22 C (right derivatives) are returned except at the right end
23 C point X=T(N+1) where left limiting values are computed. The
24 C spline is defined on T(K) .LE. X .LE. T(N+1). BVALU returns
25 C a fatal error message when X is outside of this interval.
26 C
27 C To compute left derivatives or left limiting values at a
28 C knot T(I), replace N by I-1 and set X=T(I), I=K+1,N+1.
29 C
30 C BVALU calls INTRV
31 C
32 C Description of Arguments
33 C Input
34 C T - knot vector of length N+K
35 C A - B-spline coefficient vector of length N
36 C N - number of B-spline coefficients
37 C N = sum of knot multiplicities-K
38 C K - order of the B-spline, K .GE. 1
39 C IDERIV - order of the derivative, 0 .LE. IDERIV .LE. K-1
40 C IDERIV=0 returns the B-spline value
41 C X - argument, T(K) .LE. X .LE. T(N+1)
42 C INBV - an initialization parameter which must be set
43 C to 1 the first time BVALU is called.
44 C
45 C Output
46 C INBV - INBV contains information for efficient process-
47 C ing after the initial call and INBV must not
48 C be changed by the user. Distinct splines require
49 C distinct INBV parameters.
50 C WORK - work vector of length 3*K.
51 C BVALU - value of the IDERIV-th derivative at X
52 C
53 C Error Conditions
54 C An improper input is a fatal error
55 C***REFERENCES C. DE BOOR, *PACKAGE FOR CALCULATING WITH B-SPLINES*,
56 C SIAM JOURNAL ON NUMERICAL ANALYSIS, VOLUME 14, NO. 3,
57 C JUNE 1977, PP. 441-472.
58 C***ROUTINES CALLED INTRV,XERROR
59 C***END PROLOGUE BVALU
60 C
61 C
62 INTEGER I,IDERIV,IDERP1,IHI,IHMKMJ,ILO,IMK,IMKPJ, INBV, IPJ,
63 1 IP1, IP1MJ, J, JJ, J1, J2, K, KMIDER, KMJ, KM1, KPK, MFLAG, N
64 REAL A, FKMJ, T, WORK, X
65 C DIMENSION T(N+K), WORK(3*K)
66 DIMENSION T(1), A(N), WORK(1)
67 C***FIRST EXECUTABLE STATEMENT BVALU
68 BVALU = 0.0E0
69 IF(K.LT.1) GO TO 102
70 IF(N.LT.K) GO TO 101
71 IF(IDERIV.LT.0 .OR. IDERIV.GE.K) GO TO 110
72 KMIDER = K - IDERIV
73 C
74 C *** FIND *I* IN (K,N) SUCH THAT T(I) .LE. X .LT. T(I+1)
75 C (OR, .LE. T(I+1) IF T(I) .LT. T(I+1) = T(N+1)).
76 KM1 = K - 1
77 CALL INTRV(T, N+1, X, INBV, I, MFLAG)
78 IF (X.LT.T(K)) GO TO 120
79 IF (MFLAG.EQ.0) GO TO 20
80 IF (X.GT.T(I)) GO TO 130
81 10 IF (I.EQ.K) GO TO 140
82 I = I - 1
83 IF (X.EQ.T(I)) GO TO 10
84 C
85 C *** DIFFERENCE THE COEFFICIENTS *IDERIV* TIMES
86 C WORK(I) = AJ(I), WORK(K+I) = DP(I), WORK(K+K+I) = DM(I), I=1.K
87 C
88 20 IMK = I - K
89 DO 30 J=1,K
90 IMKPJ = IMK + J
91 WORK(J) = A(IMKPJ)
92 30 CONTINUE
93 IF (IDERIV.EQ.0) GO TO 60
94 DO 50 J=1,IDERIV
95 KMJ = K - J
96 FKMJ = FLOAT(KMJ)
97 DO 40 JJ=1,KMJ
98 IHI = I + JJ
99 IHMKMJ = IHI - KMJ
100 WORK(JJ) = (WORK(JJ+1)-WORK(JJ))/(T(IHI)-T(IHMKMJ))*FKMJ
101 40 CONTINUE
102 50 CONTINUE
103 C
104 C *** COMPUTE VALUE AT *X* IN (T(I),(T(I+1)) OF IDERIV-TH DERIVATIVE,
105 C GIVEN ITS RELEVANT B-SPLINE COEFF. IN AJ(1),...,AJ(K-IDERIV).
106 60 IF (IDERIV.EQ.KM1) GO TO 100
107 IP1 = I + 1
108 KPK = K + K
109 J1 = K + 1
110 J2 = KPK + 1
111 DO 70 J=1,KMIDER
112 IPJ = I + J
113 WORK(J1) = T(IPJ) - X
114 IP1MJ = IP1 - J
115 WORK(J2) = X - T(IP1MJ)
116 J1 = J1 + 1
117 J2 = J2 + 1
118 70 CONTINUE
119 IDERP1 = IDERIV + 1
120 DO 90 J=IDERP1,KM1
121 KMJ = K - J
122 ILO = KMJ
123 DO 80 JJ=1,KMJ
124 WORK(JJ) = (WORK(JJ+1)*WORK(KPK+ILO)+WORK(JJ)
125 1 *WORK(K+JJ))/(WORK(KPK+ILO)+WORK(K+JJ))
126 ILO = ILO - 1
127 80 CONTINUE
128 90 CONTINUE
129 100 BVALU = WORK(1)
130 RETURN
131 C
132 C
133 101 CONTINUE
134 CALL XERROR( ' BVALU, N DOES NOT SATISFY N.GE.K',34,2,1)
135 RETURN
136 102 CONTINUE
137 CALL XERROR( ' BVALU, K DOES NOT SATISFY K.GE.1',34,2,1)
138 RETURN
139 110 CONTINUE
140 CALL XERROR( ' BVALU, IDERIV DOES NOT SATISFY 0.LE.IDERIV.LT.K',
141 1 49, 2, 1)
142 RETURN
143 120 CONTINUE
144 CALL XERROR( ' BVALU, X IS N0T GREATER THAN OR EQUAL TO T(K)',
145 1 47, 2, 1)
146 RETURN
147 130 CONTINUE
148 CALL XERROR( ' BVALU, X IS NOT LESS THAN OR EQUAL TO T(N+1)',
149 1 46, 2, 1)
150 RETURN
151 140 CONTINUE
152 CALL XERROR( ' BVALU, A LEFT LIMITING VALUE CANN0T BE OBTAINED AT
153 1 T(K)', 57, 2, 1)
154 RETURN
155 END
0 SUBROUTINE FDUMP
1 C***BEGIN PROLOGUE FDUMP
2 C***DATE WRITTEN 790801 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. Z
5 C***KEYWORDS ERROR,XERROR PACKAGE
6 C***AUTHOR JONES, R. E., (SNLA)
7 C***PURPOSE Symbolic dump (should be locally written).
8 C***DESCRIPTION
9 C ***Note*** Machine Dependent Routine
10 C FDUMP is intended to be replaced by a locally written
11 C version which produces a symbolic dump. Failing this,
12 C it should be replaced by a version which prints the
13 C subprogram nesting list. Note that this dump must be
14 C printed on each of up to five files, as indicated by the
15 C XGETUA routine. See XSETUA and XGETUA for details.
16 C
17 C Written by Ron Jones, with SLATEC Common Math Library Subcommittee
18 C Latest revision --- 23 May 1979
19 C***ROUTINES CALLED (NONE)
20 C***END PROLOGUE FDUMP
21 C***FIRST EXECUTABLE STATEMENT FDUMP
22 RETURN
23 END
0 INTEGER FUNCTION I1MACH(I)
1 C***BEGIN PROLOGUE I1MACH
2 C***DATE WRITTEN 750101 (YYMMDD)
3 C***REVISION DATE 840405 (YYMMDD)
4 C***CATEGORY NO. R1
5 C***KEYWORDS MACHINE CONSTANTS
6 C***AUTHOR FOX, P. A., (BELL LABS)
7 C HALL, A. D., (BELL LABS)
8 C SCHRYER, N. L., (BELL LABS)
9 C***PURPOSE Returns integer machine dependent constants
10 C***DESCRIPTION
11 C
12 C * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
13 C These machine constant routines must be activated for
14 C a particular environment.
15 C * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
16 C
17 C I1MACH can be used to obtain machine-dependent parameters
18 C for the local machine environment. It is a function
19 C subroutine with one (input) argument, and can be called
20 C as follows, for example
21 C
22 C K = I1MACH(I)
23 C
24 C where I=1,...,16. The (output) value of K above is
25 C determined by the (input) value of I. The results for
26 C various values of I are discussed below.
27 C
28 C I/O unit numbers.
29 C I1MACH( 1) = the standard input unit.
30 C I1MACH( 2) = the standard output unit.
31 C I1MACH( 3) = the standard punch unit.
32 C I1MACH( 4) = the standard error message unit.
33 C
34 C Words.
35 C I1MACH( 5) = the number of bits per integer storage unit.
36 C I1MACH( 6) = the number of characters per integer storage unit.
37 C
38 C Integers.
39 C assume integers are represented in the S-digit, base-A form
40 C
41 C sign ( X(S-1)*A**(S-1) + ... + X(1)*A + X(0) )
42 C
43 C where 0 .LE. X(I) .LT. A for I=0,...,S-1.
44 C I1MACH( 7) = A, the base.
45 C I1MACH( 8) = S, the number of base-A digits.
46 C I1MACH( 9) = A**S - 1, the largest magnitude.
47 C
48 C Floating-Point Numbers.
49 C Assume floating-point numbers are represented in the T-digit,
50 C base-B form
51 C sign (B**E)*( (X(1)/B) + ... + (X(T)/B**T) )
52 C
53 C where 0 .LE. X(I) .LT. B for I=1,...,T,
54 C 0 .LT. X(1), and EMIN .LE. E .LE. EMAX.
55 C I1MACH(10) = B, the base.
56 C
57 C Single-Precision
58 C I1MACH(11) = T, the number of base-B digits.
59 C I1MACH(12) = EMIN, the smallest exponent E.
60 C I1MACH(13) = EMAX, the largest exponent E.
61 C
62 C Double-Precision
63 C I1MACH(14) = T, the number of base-B digits.
64 C I1MACH(15) = EMIN, the smallest exponent E.
65 C I1MACH(16) = EMAX, the largest exponent E.
66 C
67 C To alter this function for a particular environment,
68 C the desired set of DATA statements should be activated by
69 C removing the C from column 1. Also, the values of
70 C I1MACH(1) - I1MACH(4) should be checked for consistency
71 C with the local operating system.
72 C***REFERENCES FOX P.A., HALL A.D., SCHRYER N.L.,*FRAMEWORK FOR A
73 C PORTABLE LIBRARY*, ACM TRANSACTIONS ON MATHEMATICAL
74 C SOFTWARE, VOL. 4, NO. 2, JUNE 1978, PP. 177-188.
75 C***ROUTINES CALLED (NONE)
76 C***END PROLOGUE I1MACH
77 C
78 INTEGER IMACH(16),OUTPUT
79 EQUIVALENCE (IMACH(4),OUTPUT)
80 C
81 C MACHINE CONSTANTS FOR THE BURROUGHS 1700 SYSTEM.
82 C
83 C DATA IMACH( 1) / 7 /
84 C DATA IMACH( 2) / 2 /
85 C DATA IMACH( 3) / 2 /
86 C DATA IMACH( 4) / 2 /
87 C DATA IMACH( 5) / 36 /
88 C DATA IMACH( 6) / 4 /
89 C DATA IMACH( 7) / 2 /
90 C DATA IMACH( 8) / 33 /
91 C DATA IMACH( 9) / Z1FFFFFFFF /
92 C DATA IMACH(10) / 2 /
93 C DATA IMACH(11) / 24 /
94 C DATA IMACH(12) / -256 /
95 C DATA IMACH(13) / 255 /
96 C DATA IMACH(14) / 60 /
97 C DATA IMACH(15) / -256 /
98 C DATA IMACH(16) / 255 /
99 C
100 C MACHINE CONSTANTS FOR THE BURROUGHS 5700 SYSTEM.
101 C
102 C DATA IMACH( 1) / 5 /
103 C DATA IMACH( 2) / 6 /
104 C DATA IMACH( 3) / 7 /
105 C DATA IMACH( 4) / 6 /
106 C DATA IMACH( 5) / 48 /
107 C DATA IMACH( 6) / 6 /
108 C DATA IMACH( 7) / 2 /
109 C DATA IMACH( 8) / 39 /
110 C DATA IMACH( 9) / O0007777777777777 /
111 C DATA IMACH(10) / 8 /
112 C DATA IMACH(11) / 13 /
113 C DATA IMACH(12) / -50 /
114 C DATA IMACH(13) / 76 /
115 C DATA IMACH(14) / 26 /
116 C DATA IMACH(15) / -50 /
117 C DATA IMACH(16) / 76 /
118 C
119 C MACHINE CONSTANTS FOR THE BURROUGHS 6700/7700 SYSTEMS.
120 C
121 C DATA IMACH( 1) / 5 /
122 C DATA IMACH( 2) / 6 /
123 C DATA IMACH( 3) / 7 /
124 C DATA IMACH( 4) / 6 /
125 C DATA IMACH( 5) / 48 /
126 C DATA IMACH( 6) / 6 /
127 C DATA IMACH( 7) / 2 /
128 C DATA IMACH( 8) / 39 /
129 C DATA IMACH( 9) / O0007777777777777 /
130 C DATA IMACH(10) / 8 /
131 C DATA IMACH(11) / 13 /
132 C DATA IMACH(12) / -50 /
133 C DATA IMACH(13) / 76 /
134 C DATA IMACH(14) / 26 /
135 C DATA IMACH(15) / -32754 /
136 C DATA IMACH(16) / 32780 /
137 C
138 C MACHINE CONSTANTS FOR THE CONVEX C-120 (NATIVE MODE)
139 C
140 C DATA IMACH( 1) / 5 /
141 C DATA IMACH( 2) / 6 /
142 C DATA IMACH( 3) / 0 /
143 C DATA IMACH( 4) / 6 /
144 C DATA IMACH( 5) / 32 /
145 C DATA IMACH( 6) / 4 /
146 C DATA IMACH( 7) / 2 /
147 C DATA IMACH( 8) / 31 /
148 C DATA IMACH( 9) / 2147483647 /
149 C DATA IMACH(10) / 2 /
150 C DATA IMACH(11) / 24 /
151 C DATA IMACH(12) / -127 /
152 C DATA IMACH(13) / 127 /
153 C DATA IMACH(14) / 53 /
154 C DATA IMACH(15) / -1023 /
155 C DATA IMACH(16) / 1023 /
156 C
157 C MACHINE CONSTANTS FOR THE CONVEX (NATIVE MODE)
158 C WITH -R8 OPTION
159 C
160 C DATA IMACH( 1) / 5 /
161 C DATA IMACH( 2) / 6 /
162 C DATA IMACH( 3) / 0 /
163 C DATA IMACH( 4) / 6 /
164 C DATA IMACH( 5) / 32 /
165 C DATA IMACH( 6) / 4 /
166 C DATA IMACH( 7) / 2 /
167 C DATA IMACH( 8) / 31 /
168 C DATA IMACH( 9) / 2147483647 /
169 C DATA IMACH(10) / 2 /
170 C DATA IMACH(11) / 53 /
171 C DATA IMACH(12) / -1023 /
172 C DATA IMACH(13) / 1023 /
173 C DATA IMACH(14) / 53 /
174 C DATA IMACH(15) / -1023 /
175 C DATA IMACH(16) / 1023 /
176 C
177 C MACHINE CONSTANTS FOR THE CONVEX C-120 (IEEE MODE)
178 C
179 C DATA IMACH( 1) / 5 /
180 C DATA IMACH( 2) / 6 /
181 C DATA IMACH( 3) / 0 /
182 C DATA IMACH( 4) / 6 /
183 C DATA IMACH( 5) / 32 /
184 C DATA IMACH( 6) / 4 /
185 C DATA IMACH( 7) / 2 /
186 C DATA IMACH( 8) / 31 /
187 C DATA IMACH( 9) / 2147483647 /
188 C DATA IMACH(10) / 2 /
189 C DATA IMACH(11) / 24 /
190 C DATA IMACH(12) / -125 /
191 C DATA IMACH(13) / 128 /
192 C DATA IMACH(14) / 53 /
193 C DATA IMACH(15) / -1021 /
194 C DATA IMACH(16) / 1024 /
195 C
196 C MACHINE CONSTANTS FOR THE CONVEX (IEEE MODE)
197 C WITH -R8 OPTION
198 C
199 C DATA IMACH( 1) / 5 /
200 C DATA IMACH( 2) / 6 /
201 C DATA IMACH( 3) / 0 /
202 C DATA IMACH( 4) / 6 /
203 C DATA IMACH( 5) / 32 /
204 C DATA IMACH( 6) / 4 /
205 C DATA IMACH( 7) / 2 /
206 C DATA IMACH( 8) / 31 /
207 C DATA IMACH( 9) / 2147483647 /
208 C DATA IMACH(10) / 2 /
209 C DATA IMACH(11) / 53 /
210 C DATA IMACH(12) / -1021 /
211 C DATA IMACH(13) / 1024 /
212 C DATA IMACH(14) / 53 /
213 C DATA IMACH(15) / -1021 /
214 C DATA IMACH(16) / 1024 /
215 C
216 C MACHINE CONSTANTS FOR THE CDC CYBER 170 SERIES (FTN5).
217 C
218 C DATA IMACH( 1) / 5 /
219 C DATA IMACH( 2) / 6 /
220 C DATA IMACH( 3) / 7 /
221 C DATA IMACH( 4) / 6 /
222 C DATA IMACH( 5) / 60 /
223 C DATA IMACH( 6) / 10 /
224 C DATA IMACH( 7) / 2 /
225 C DATA IMACH( 8) / 48 /
226 C DATA IMACH( 9) / O"00007777777777777777" /
227 C DATA IMACH(10) / 2 /
228 C DATA IMACH(11) / 48 /
229 C DATA IMACH(12) / -974 /
230 C DATA IMACH(13) / 1070 /
231 C DATA IMACH(14) / 96 /
232 C DATA IMACH(15) / -927 /
233 C DATA IMACH(16) / 1070 /
234 C
235 C MACHINE CONSTANTS FOR THE CDC 170/180 SERIES USING NOS/VE
236 C
237 C DATA IMACH( 1) / 5 /
238 C DATA IMACH( 2) / 6 /
239 C DATA IMACH( 3) / 7 /
240 C DATA IMACH( 4) / 6 /
241 C DATA IMACH( 5) / 64 /
242 C DATA IMACH( 6) / 8 /
243 C DATA IMACH( 7) / 2 /
244 C DATA IMACH( 8) / 63 /
245 C DATA IMACH( 9) / 9223372036854775807 /
246 C DATA IMACH(10) / 2 /
247 C DATA IMACH(11) / 47 /
248 C DATA IMACH(12) / -4095 /
249 C DATA IMACH(13) / 4094 /
250 C DATA IMACH(14) / 94 /
251 C DATA IMACH(15) / -4095 /
252 C DATA IMACH(16) / 4094 /
253 C
254 C MACHINE CONSTANTS FOR THE CDC CYBER 205
255 C
256 C DATA IMACH( 1) / 5 /
257 C DATA IMACH( 2) / 6 /
258 C DATA IMACH( 3) / 7 /
259 C DATA IMACH( 4) / 6 /
260 C DATA IMACH( 5) / 64 /
261 C DATA IMACH( 6) / 8 /
262 C DATA IMACH( 7) / 2 /
263 C DATA IMACH( 8) / 47 /
264 C DATA IMACH( 9) / X'00007FFFFFFFFFFF' /
265 C DATA IMACH(10) / 2 /
266 C DATA IMACH(11) / 47 /
267 C DATA IMACH(12) / -28625 /
268 C DATA IMACH(13) / 28718 /
269 C DATA IMACH(14) / 94 /
270 C DATA IMACH(15) / -28625 /
271 C DATA IMACH(16) / 28718 /
272 C
273 C
274 C MACHINE CONSTANTS FOR THE CDC 6000/7000 SERIES.
275 C
276 C DATA IMACH( 1) / 5 /
277 C DATA IMACH( 2) / 6 /
278 C DATA IMACH( 3) / 7 /
279 C DATA IMACH( 4) /6LOUTPUT/
280 C DATA IMACH( 5) / 60 /
281 C DATA IMACH( 6) / 10 /
282 C DATA IMACH( 7) / 2 /
283 C DATA IMACH( 8) / 48 /
284 C DATA IMACH( 9) / 00007777777777777777B /
285 C DATA IMACH(10) / 2 /
286 C DATA IMACH(11) / 47 /
287 C DATA IMACH(12) / -929 /
288 C DATA IMACH(13) / 1070 /
289 C DATA IMACH(14) / 94 /
290 C DATA IMACH(15) / -929 /
291 C DATA IMACH(16) / 1069 /
292 C
293 C MACHINE CONSTANTS FOR THE CRAY 1
294 C
295 C DATA IMACH( 1) / 100 /
296 C DATA IMACH( 2) / 101 /
297 C DATA IMACH( 3) / 102 /
298 C DATA IMACH( 4) / 101 /
299 C DATA IMACH( 5) / 64 /
300 C DATA IMACH( 6) / 8 /
301 C DATA IMACH( 7) / 2 /
302 C DATA IMACH( 8) / 63 /
303 C DATA IMACH( 9) / 777777777777777777777B /
304 C DATA IMACH(10) / 2 /
305 C DATA IMACH(11) / 47 /
306 C DATA IMACH(12) / -8189 /
307 C DATA IMACH(13) / 8190 /
308 C DATA IMACH(14) / 94 /
309 C DATA IMACH(15) / -8099 /
310 C DATA IMACH(16) / 8190 /
311 C
312 C MACHINE CONSTANTS FOR THE DATA GENERAL ECLIPSE S/200
313 C
314 C DATA IMACH( 1) / 11 /
315 C DATA IMACH( 2) / 12 /
316 C DATA IMACH( 3) / 8 /
317 C DATA IMACH( 4) / 10 /
318 C DATA IMACH( 5) / 16 /
319 C DATA IMACH( 6) / 2 /
320 C DATA IMACH( 7) / 2 /
321 C DATA IMACH( 8) / 15 /
322 C DATA IMACH( 9) /32767 /
323 C DATA IMACH(10) / 16 /
324 C DATA IMACH(11) / 6 /
325 C DATA IMACH(12) / -64 /
326 C DATA IMACH(13) / 63 /
327 C DATA IMACH(14) / 14 /
328 C DATA IMACH(15) / -64 /
329 C DATA IMACH(16) / 63 /
330 C
331 C MACHINE CONSTANTS FOR THE HARRIS 220
332 C
333 C DATA IMACH( 1) / 5 /
334 C DATA IMACH( 2) / 6 /
335 C DATA IMACH( 3) / 0 /
336 C DATA IMACH( 4) / 6 /
337 C DATA IMACH( 5) / 24 /
338 C DATA IMACH( 6) / 3 /
339 C DATA IMACH( 7) / 2 /
340 C DATA IMACH( 8) / 23 /
341 C DATA IMACH( 9) / 8388607 /
342 C DATA IMACH(10) / 2 /
343 C DATA IMACH(11) / 23 /
344 C DATA IMACH(12) / -127 /
345 C DATA IMACH(13) / 127 /
346 C DATA IMACH(14) / 38 /
347 C DATA IMACH(15) / -127 /
348 C DATA IMACH(16) / 127 /
349 C
350 C MACHINE CONSTANTS FOR THE HONEYWELL 600/6000 SERIES.
351 C
352 C DATA IMACH( 1) / 5 /
353 C DATA IMACH( 2) / 6 /
354 C DATA IMACH( 3) / 43 /
355 C DATA IMACH( 4) / 6 /
356 C DATA IMACH( 5) / 36 /
357 C DATA IMACH( 6) / 6 /
358 C DATA IMACH( 7) / 2 /
359 C DATA IMACH( 8) / 35 /
360 C DATA IMACH( 9) / O377777777777 /
361 C DATA IMACH(10) / 2 /
362 C DATA IMACH(11) / 27 /
363 C DATA IMACH(12) / -127 /
364 C DATA IMACH(13) / 127 /
365 C DATA IMACH(14) / 63 /
366 C DATA IMACH(15) / -127 /
367 C DATA IMACH(16) / 127 /
368 C
369 C MACHINE CONSTANTS FOR THE HP 2100
370 C 3 WORD DOUBLE PRECISION OPTION WITH FTN4
371 C
372 C DATA IMACH(1) / 5/
373 C DATA IMACH(2) / 6 /
374 C DATA IMACH(3) / 4 /
375 C DATA IMACH(4) / 1 /
376 C DATA IMACH(5) / 16 /
377 C DATA IMACH(6) / 2 /
378 C DATA IMACH(7) / 2 /
379 C DATA IMACH(8) / 15 /
380 C DATA IMACH(9) / 32767 /
381 C DATA IMACH(10)/ 2 /
382 C DATA IMACH(11)/ 23 /
383 C DATA IMACH(12)/ -128 /
384 C DATA IMACH(13)/ 127 /
385 C DATA IMACH(14)/ 39 /
386 C DATA IMACH(15)/ -128 /
387 C DATA IMACH(16)/ 127 /
388 C
389 C MACHINE CONSTANTS FOR THE HP 2100
390 C 4 WORD DOUBLE PRECISION OPTION WITH FTN4
391 C
392 C DATA IMACH(1) / 5 /
393 C DATA IMACH(2) / 6 /
394 C DATA IMACH(3) / 4 /
395 C DATA IMACH(4) / 1 /
396 C DATA IMACH(5) / 16 /
397 C DATA IMACH(6) / 2 /
398 C DATA IMACH(7) / 2 /
399 C DATA IMACH(8) / 15 /
400 C DATA IMACH(9) / 32767 /
401 C DATA IMACH(10)/ 2 /
402 C DATA IMACH(11)/ 23 /
403 C DATA IMACH(12)/ -128 /
404 C DATA IMACH(13)/ 127 /
405 C DATA IMACH(14)/ 55 /
406 C DATA IMACH(15)/ -128 /
407 C DATA IMACH(16)/ 127 /
408 C
409 C MACHINE CONSTANTS FOR THE IBM 360/370 SERIES,
410 C THE XEROX SIGMA 5/7/9, THE SEL SYSTEMS 85/86, AND
411 C THE PERKIN ELMER (INTERDATA) 7/32.
412 C
413 C DATA IMACH( 1) / 5 /
414 C DATA IMACH( 2) / 6 /
415 C DATA IMACH( 3) / 7 /
416 C DATA IMACH( 4) / 6 /
417 C DATA IMACH( 5) / 32 /
418 C DATA IMACH( 6) / 4 /
419 C DATA IMACH( 7) / 16 /
420 C DATA IMACH( 8) / 31 /
421 C DATA IMACH( 9) / Z7FFFFFFF /
422 C DATA IMACH(10) / 16 /
423 C DATA IMACH(11) / 6 /
424 C DATA IMACH(12) / -64 /
425 C DATA IMACH(13) / 63 /
426 C DATA IMACH(14) / 14 /
427 C DATA IMACH(15) / -64 /
428 C DATA IMACH(16) / 63 /
429 C
430 C MACHINE CONSTANTS FOR THE PDP-10 (KA PROCESSOR).
431 C
432 C DATA IMACH( 1) / 5 /
433 C DATA IMACH( 2) / 6 /
434 C DATA IMACH( 3) / 5 /
435 C DATA IMACH( 4) / 6 /
436 C DATA IMACH( 5) / 36 /
437 C DATA IMACH( 6) / 5 /
438 C DATA IMACH( 7) / 2 /
439 C DATA IMACH( 8) / 35 /
440 C DATA IMACH( 9) / "377777777777 /
441 C DATA IMACH(10) / 2 /
442 C DATA IMACH(11) / 27 /
443 C DATA IMACH(12) / -128 /
444 C DATA IMACH(13) / 127 /
445 C DATA IMACH(14) / 54 /
446 C DATA IMACH(15) / -101 /
447 C DATA IMACH(16) / 127 /
448 C
449 C MACHINE CONSTANTS FOR THE PDP-10 (KI PROCESSOR).
450 C
451 C DATA IMACH( 1) / 5 /
452 C DATA IMACH( 2) / 6 /
453 C DATA IMACH( 3) / 5 /
454 C DATA IMACH( 4) / 6 /
455 C DATA IMACH( 5) / 36 /
456 C DATA IMACH( 6) / 5 /
457 C DATA IMACH( 7) / 2 /
458 C DATA IMACH( 8) / 35 /
459 C DATA IMACH( 9) / "377777777777 /
460 C DATA IMACH(10) / 2 /
461 C DATA IMACH(11) / 27 /
462 C DATA IMACH(12) / -128 /
463 C DATA IMACH(13) / 127 /
464 C DATA IMACH(14) / 62 /
465 C DATA IMACH(15) / -128 /
466 C DATA IMACH(16) / 127 /
467 C
468 C MACHINE CONSTANTS FOR PDP-11 FORTRAN SUPPORTING
469 C 32-BIT INTEGER ARITHMETIC.
470 C
471 C DATA IMACH( 1) / 5 /
472 C DATA IMACH( 2) / 6 /
473 C DATA IMACH( 3) / 5 /
474 C DATA IMACH( 4) / 6 /
475 C DATA IMACH( 5) / 32 /
476 C DATA IMACH( 6) / 4 /
477 C DATA IMACH( 7) / 2 /
478 C DATA IMACH( 8) / 31 /
479 C DATA IMACH( 9) / 2147483647 /
480 C DATA IMACH(10) / 2 /
481 C DATA IMACH(11) / 24 /
482 C DATA IMACH(12) / -127 /
483 C DATA IMACH(13) / 127 /
484 C DATA IMACH(14) / 56 /
485 C DATA IMACH(15) / -127 /
486 C DATA IMACH(16) / 127 /
487 C
488 C MACHINE CONSTANTS FOR PDP-11 FORTRAN SUPPORTING
489 C 16-BIT INTEGER ARITHMETIC.
490 C
491 C DATA IMACH( 1) / 5 /
492 C DATA IMACH( 2) / 6 /
493 C DATA IMACH( 3) / 5 /
494 C DATA IMACH( 4) / 6 /
495 C DATA IMACH( 5) / 16 /
496 C DATA IMACH( 6) / 2 /
497 C DATA IMACH( 7) / 2 /
498 C DATA IMACH( 8) / 15 /
499 C DATA IMACH( 9) / 32767 /
500 C DATA IMACH(10) / 2 /
501 C DATA IMACH(11) / 24 /
502 C DATA IMACH(12) / -127 /
503 C DATA IMACH(13) / 127 /
504 C DATA IMACH(14) / 56 /
505 C DATA IMACH(15) / -127 /
506 C DATA IMACH(16) / 127 /
507 C
508 C MACHINE CONSTANTS FOR THE SUN 3 (68881 OR FPA)
509 C
510 DATA IMACH( 1) / 5 /
511 DATA IMACH( 2) / 6 /
512 DATA IMACH( 3) / 6 /
513 DATA IMACH( 4) / 0 /
514 DATA IMACH( 5) / 32 /
515 DATA IMACH( 6) / 4 /
516 DATA IMACH( 7) / 2 /
517 DATA IMACH( 8) / 31 /
518 DATA IMACH( 9) / 2147483647 /
519 DATA IMACH(10) / 2 /
520 DATA IMACH(11) / 24 /
521 DATA IMACH(12) / -125 /
522 DATA IMACH(13) / 128 /
523 DATA IMACH(14) / 53 /
524 DATA IMACH(15) / -1021 /
525 DATA IMACH(16) / 1024 /
526 C
527 C MACHINE CONSTANTS FOR THE UNIVAC 1100 SERIES. FTN COMPILER
528 C
529 C DATA IMACH( 1) / 5 /
530 C DATA IMACH( 2) / 6 /
531 C DATA IMACH( 3) / 1 /
532 C DATA IMACH( 4) / 6 /
533 C DATA IMACH( 5) / 36 /
534 C DATA IMACH( 6) / 4 /
535 C DATA IMACH( 7) / 2 /
536 C DATA IMACH( 8) / 35 /
537 C DATA IMACH( 9) / O377777777777 /
538 C DATA IMACH(10) / 2 /
539 C DATA IMACH(11) / 27 /
540 C DATA IMACH(12) / -128 /
541 C DATA IMACH(13) / 127 /
542 C DATA IMACH(14) / 60 /
543 C DATA IMACH(15) /-1024 /
544 C DATA IMACH(16) / 1023 /
545 C
546 C MACHINE CONSTANTS FOR THE VAX 11/780
547 C
548 c$$$ DATA IMACH(1) / 5 /
549 c$$$ DATA IMACH(2) / 6 /
550 c$$$ DATA IMACH(3) / 5 /
551 c$$$ DATA IMACH(4) / 6 /
552 c$$$ DATA IMACH(5) / 32 /
553 c$$$ DATA IMACH(6) / 4 /
554 c$$$ DATA IMACH(7) / 2 /
555 c$$$ DATA IMACH(8) / 31 /
556 c$$$ DATA IMACH(9) /2147483647 /
557 c$$$ DATA IMACH(10)/ 2 /
558 c$$$ DATA IMACH(11)/ 24 /
559 c$$$ DATA IMACH(12)/ -127 /
560 c$$$ DATA IMACH(13)/ 127 /
561 c$$$ DATA IMACH(14)/ 56 /
562 c$$$ DATA IMACH(15)/ -127 /
563 c$$$ DATA IMACH(16)/ 127 /
564 C
565 C MACHINE CONSTANTS FOR THE Z80 MICROPROCESSOR
566 C
567 C DATA IMACH( 1) / 1/
568 C DATA IMACH( 2) / 1/
569 C DATA IMACH( 3) / 0/
570 C DATA IMACH( 4) / 1/
571 C DATA IMACH( 5) / 16/
572 C DATA IMACH( 6) / 2/
573 C DATA IMACH( 7) / 2/
574 C DATA IMACH( 8) / 15/
575 C DATA IMACH( 9) / 32767/
576 C DATA IMACH(10) / 2/
577 C DATA IMACH(11) / 24/
578 C DATA IMACH(12) / -127/
579 C DATA IMACH(13) / 127/
580 C DATA IMACH(14) / 56/
581 C DATA IMACH(15) / -127/
582 C DATA IMACH(16) / 127/
583 C
584 C
585 C***FIRST EXECUTABLE STATEMENT I1MACH
586 C IF (I .LT. 1 .OR. I .GT. 16) GO TO 10
587 C
588 I1MACH=IMACH(I)
589 RETURN
590 C
591 C 10 CONTINUE
592 C WRITE(OUTPUT,9000)
593 C9000 FORMAT('1ERROR 1 IN I1MACH - I OUT OF BOUNDS ')
594 C
595 C CALL FDUMP
596 C
597 C
598 C STOP
599 END
0 SUBROUTINE INTRV(XT,LXT,X,ILO,ILEFT,MFLAG)
1 C***BEGIN PROLOGUE INTRV
2 C***DATE WRITTEN 800901 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. E3,K6
5 C***KEYWORDS B-SPLINE,DATA FITTING,INTERPOLATION,SPLINE
6 C***AUTHOR AMOS, D. E., (SNLA)
7 C***PURPOSE Computes the largest integer ILEFT in 1.LE.ILEFT.LE.LXT
8 C such that XT(ILEFT).LE.X where XT(*) is a subdivision
9 C of the X interval.
10 C***DESCRIPTION
11 C
12 C Written by Carl de Boor and modified by D. E. Amos
13 C
14 C Reference
15 C SIAM J. Numerical Analysis, 14, No. 3, June 1977, pp. 441-472.
16 C
17 C Abstract
18 C INTRV is the INTERV routine of the reference.
19 C
20 C INTRV computes the largest integer ILEFT in 1 .LE. ILEFT .LE.
21 C LXT such that XT(ILEFT) .LE. X where XT(*) is a subdivision of
22 C the X interval. Precisely,
23 C
24 C X .LT. XT(1) 1 -1
25 C if XT(I) .LE. X .LT. XT(I+1) then ILEFT=I , MFLAG=0
26 C XT(LXT) .LE. X LXT 1,
27 C
28 C That is, when multiplicities are present in the break point
29 C to the left of X, the largest index is taken for ILEFT.
30 C
31 C Description of Arguments
32 C Input
33 C XT - XT is a knot or break point vector of length LXT
34 C LXT - length of the XT vector
35 C X - argument
36 C ILO - an initialization parameter which must be set
37 C to 1 the first time the spline array XT is
38 C processed by INTRV.
39 C
40 C Output
41 C ILO - ILO contains information for efficient process-
42 C ing after the initial call, and ILO must not be
43 C changed by the user. Distinct splines require
44 C distinct ILO parameters.
45 C ILEFT - largest integer satisfying XT(ILEFT) .LE. X
46 C MFLAG - signals when X lies out of bounds
47 C
48 C Error Conditions
49 C None
50 C***REFERENCES C. DE BOOR, *PACKAGE FOR CALCULATING WITH B-SPLINES*,
51 C SIAM JOURNAL ON NUMERICAL ANALYSIS, VOLUME 14, NO. 3,
52 C JUNE 1977, PP. 441-472.
53 C***ROUTINES CALLED (NONE)
54 C***END PROLOGUE INTRV
55 C
56 C
57 INTEGER IHI, ILEFT, ILO, ISTEP, LXT, MFLAG, MIDDLE
58 REAL X, XT
59 DIMENSION XT(LXT)
60 C***FIRST EXECUTABLE STATEMENT INTRV
61 IHI = ILO + 1
62 IF (IHI.LT.LXT) GO TO 10
63 IF (X.GE.XT(LXT)) GO TO 110
64 IF (LXT.LE.1) GO TO 90
65 ILO = LXT - 1
66 IHI = LXT
67 C
68 10 IF (X.GE.XT(IHI)) GO TO 40
69 IF (X.GE.XT(ILO)) GO TO 100
70 C
71 C *** NOW X .LT. XT(IHI) . FIND LOWER BOUND
72 ISTEP = 1
73 20 IHI = ILO
74 ILO = IHI - ISTEP
75 IF (ILO.LE.1) GO TO 30
76 IF (X.GE.XT(ILO)) GO TO 70
77 ISTEP = ISTEP*2
78 GO TO 20
79 30 ILO = 1
80 IF (X.LT.XT(1)) GO TO 90
81 GO TO 70
82 C *** NOW X .GE. XT(ILO) . FIND UPPER BOUND
83 40 ISTEP = 1
84 50 ILO = IHI
85 IHI = ILO + ISTEP
86 IF (IHI.GE.LXT) GO TO 60
87 IF (X.LT.XT(IHI)) GO TO 70
88 ISTEP = ISTEP*2
89 GO TO 50
90 60 IF (X.GE.XT(LXT)) GO TO 110
91 IHI = LXT
92 C
93 C *** NOW XT(ILO) .LE. X .LT. XT(IHI) . NARROW THE INTERVAL
94 70 MIDDLE = (ILO+IHI)/2
95 IF (MIDDLE.EQ.ILO) GO TO 100
96 C NOTE. IT IS ASSUMED THAT MIDDLE = ILO IN CASE IHI = ILO+1
97 IF (X.LT.XT(MIDDLE)) GO TO 80
98 ILO = MIDDLE
99 GO TO 70
100 80 IHI = MIDDLE
101 GO TO 70
102 C *** SET OUTPUT AND RETURN
103 90 MFLAG = -1
104 ILEFT = 1
105 RETURN
106 100 MFLAG = 0
107 ILEFT = ILO
108 RETURN
109 110 MFLAG = 1
110 ILEFT = LXT
111 RETURN
112 END
0 FUNCTION J4SAVE(IWHICH,IVALUE,ISET)
1 C***BEGIN PROLOGUE J4SAVE
2 C***REFER TO XERROR
3 C Abstract
4 C J4SAVE saves and recalls several global variables needed
5 C by the library error handling routines.
6 C
7 C Description of Parameters
8 C --Input--
9 C IWHICH - Index of item desired.
10 C = 1 Refers to current error number.
11 C = 2 Refers to current error control flag.
12 C = 3 Refers to current unit number to which error
13 C messages are to be sent. (0 means use standard.)
14 C = 4 Refers to the maximum number of times any
15 C message is to be printed (as set by XERMAX).
16 C = 5 Refers to the total number of units to which
17 C each error message is to be written.
18 C = 6 Refers to the 2nd unit for error messages
19 C = 7 Refers to the 3rd unit for error messages
20 C = 8 Refers to the 4th unit for error messages
21 C = 9 Refers to the 5th unit for error messages
22 C IVALUE - The value to be set for the IWHICH-th parameter,
23 C if ISET is .TRUE. .
24 C ISET - If ISET=.TRUE., the IWHICH-th parameter will BE
25 C given the value, IVALUE. If ISET=.FALSE., the
26 C IWHICH-th parameter will be unchanged, and IVALUE
27 C is a dummy parameter.
28 C --Output--
29 C The (old) value of the IWHICH-th parameter will be returned
30 C in the function value, J4SAVE.
31 C
32 C Written by Ron Jones, with SLATEC Common Math Library Subcommittee
33 C Adapted from Bell Laboratories PORT Library Error Handler
34 C Latest revision --- 23 MAY 1979
35 C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR-
36 C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES,
37 C 1982.
38 C***ROUTINES CALLED (NONE)
39 C***END PROLOGUE J4SAVE
40 LOGICAL ISET
41 INTEGER IPARAM(9)
42 SAVE IPARAM
43 DATA IPARAM(1),IPARAM(2),IPARAM(3),IPARAM(4)/0,2,0,10/
44 DATA IPARAM(5)/1/
45 DATA IPARAM(6),IPARAM(7),IPARAM(8),IPARAM(9)/0,0,0,0/
46 C***FIRST EXECUTABLE STATEMENT J4SAVE
47 J4SAVE = IPARAM(IWHICH)
48 IF (ISET) IPARAM(IWHICH) = IVALUE
49 RETURN
50 END
0 FUNCTION NUMXER(NERR)
1 C***BEGIN PROLOGUE NUMXER
2 C***REFER TO XERROR
3 C Abstract
4 C NUMXER returns the most recent error number,
5 C in both NUMXER and the parameter NERR.
6 C
7 C Written by Ron Jones, with SLATEC Common Math Library Subcommittee
8 C Latest revision --- 7 JUNE 1978
9 C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR-
10 C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES,
11 C 1982.
12 C***ROUTINES CALLED J4SAVE
13 C***END PROLOGUE NUMXER
14 C***FIRST EXECUTABLE STATEMENT NUMXER
15 NERR = J4SAVE(1,0,.FALSE.)
16 NUMXER = NERR
17 RETURN
18 END
0 SUBROUTINE PFQAD(F,LDC,C,XI,LXI,K,ID,X1,X2,TOL,QUAD,IERR)
1 C***BEGIN PROLOGUE PFQAD
2 C***DATE WRITTEN 800901 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. H2A2A1,E3,K6
5 C***KEYWORDS B-SPLINE,DATA FITTING,INTERPOLATION,QUADRATURE,SPLINE
6 C***AUTHOR AMOS, D. E., (SNLA)
7 C***PURPOSE Computes the integral on (X1,X2) of a product of a function
8 C F and the ID-th derivative of a B-spline,
9 C (PP-representation).
10 C***DESCRIPTION
11 C
12 C Written by D. E. Amos, June, 1979.
13 C
14 C Reference SAND-79-1825
15 C
16 C Abstract
17 C PFQAD computes the integral on (X1,X2) of a product of a
18 C function F and the ID-th derivative of a B-spline, using the
19 C PP-representation (C,XI,LXI,K). (X1,X2) is normally a sub-
20 C interval of XI(1) .LE. X .LE. XI(LXI+1). An integration rou-
21 C tine, PPGQ8(a modification of GAUS8), integrates the product
22 C on sub-intervals of (X1,X2) formed by the included break
23 C points. Integration outside of (XI(1),XI(LXI+1)) is permitted
24 C provided F is defined.
25 C
26 C PFQAD calls INTRV, PPVAL, PPGQ8, R1MACH, XERROR
27 C
28 C Description of Arguments
29 C Input
30 C F - external function of one argument for the
31 C integrand PF(X)=F(X)*PPVAL(LDC,C,XI,LXI,K,ID,X,
32 C INPPV)
33 C LDC - leading dimension of matrix C, LDC .GE. K
34 C C(I,J) - right Taylor derivatives at XI(J), I=1,K , J=1,LXI
35 C XI(*) - break point array of length LXI+1
36 C LXI - number of polynomial pieces
37 C K - order of B-spline, K .GE. 1
38 C ID - order of the spline derivative, 0 .LE. ID .LE. K-1
39 C ID=0 gives the spline function
40 C X1,X2 - end points of quadrature interval, normally in
41 C XI(1) .LE. X .LE. XI(LXI+1)
42 C TOL - desired accuracy for the quadrature, suggest
43 C 10.*STOL .LT. TOL .LE. 0.1 where STOL is the single
44 C precision unit roundoff for the machine = R1MACH(4)
45 C
46 C Output
47 C QUAD - integral of PF(X) on (X1,X2)
48 C IERR - a status code
49 C IERR=1 normal return
50 C 2 some quadrature does not meet the
51 C requested tolerance
52 C
53 C Error Conditions
54 C TOL not greater than the single precision unit roundoff or
55 C less than 0.1 is a fatal error.
56 C Some quadrature does not meet the requested tolerance.
57 C***REFERENCES D.E. AMOS, *QUADRATURE SUBROUTINES FOR SPLINES AND
58 C B-SPLINES*, SAND79-1825, SANDIA LABORATORIES,
59 C DECEMBER 1979.
60 C***ROUTINES CALLED INTRV,PPGQ8,R1MACH,XERROR
61 C***END PROLOGUE PFQAD
62 C
63 C
64 INTEGER ID,IERR,IFLG,ILO,IL1,IL2,INPPV,K,LDC,LEFT,LXI,MF1,MF2
65 REAL A, AA, ANS, B, BB, C, Q, QUAD, TA, TB, TOL, WTOL, XI, X1, X2
66 REAL R1MACH, F
67 DIMENSION XI(1), C(LDC,1)
68 EXTERNAL F
69 C
70 C***FIRST EXECUTABLE STATEMENT PFQAD
71 IERR = 1
72 QUAD = 0.0E0
73 IF(K.LT.1) GO TO 100
74 IF(LDC.LT.K) GO TO 105
75 IF(ID.LT.0 .OR. ID.GE.K) GO TO 110
76 IF(LXI.LT.1) GO TO 115
77 WTOL = R1MACH(4)
78 IF (TOL.LT.WTOL .OR. TOL.GT.0.1E0) GO TO 20
79 AA = AMIN1(X1,X2)
80 BB = AMAX1(X1,X2)
81 IF (AA.EQ.BB) RETURN
82 ILO = 1
83 CALL INTRV(XI, LXI, AA, ILO, IL1, MF1)
84 CALL INTRV(XI, LXI, BB, ILO, IL2, MF2)
85 Q = 0.0E0
86 INPPV = 1
87 DO 10 LEFT=IL1,IL2
88 TA = XI(LEFT)
89 A = AMAX1(AA,TA)
90 IF (LEFT.EQ.1) A = AA
91 TB = BB
92 IF (LEFT.LT.LXI) TB = XI(LEFT+1)
93 B = AMIN1(BB,TB)
94 CALL PPGQ8(F,LDC,C,XI,LXI,K,ID,A,B,INPPV,TOL,ANS,IFLG)
95 IF (IFLG.GT.1) IERR = 2
96 Q = Q + ANS
97 10 CONTINUE
98 IF (X1.GT.X2) Q = -Q
99 QUAD = Q
100 RETURN
101 C
102 20 CONTINUE
103 CALL XERROR( ' PFQAD, TOL IS LESS THAN THE SINGLE PRECISION TOLER
104 1ANCE OR GREATER THAN 0.1', 76, 2, 1)
105 RETURN
106 100 CONTINUE
107 CALL XERROR( ' PFQAD, K DOES NOT SATISFY K.GE.1', 34, 2, 1)
108 RETURN
109 105 CONTINUE
110 CALL XERROR( ' PFQAD, LDC DOES NOT SATISFY LDC.GE.K', 38, 2, 1)
111 RETURN
112 110 CONTINUE
113 CALL XERROR( ' PFQAD, ID DOES NOT SATISFY 0.LE.ID.LT.K', 41,
114 1 2, 1)
115 RETURN
116 115 CONTINUE
117 CALL XERROR( ' PFQAD, LXI DOES NOT SATISFY LXI.GE.1', 38, 2, 1)
118 RETURN
119 END
0 SUBROUTINE PPGQ8(FUN,LDC,C,XI,LXI,KK,ID,A,B,INPPV,ERR,ANS,IERR)
1 C***BEGIN PROLOGUE PPGQ8
2 C***REFER TO PFQAD
3 C
4 C Written by R.E. Jones and modified by D.E. Amos
5 C
6 C Abstract
7 C PPGQ8, a modification of GAUS8, integrates the
8 C product of FUN(X) by the ID-th derivative of a spline
9 C PPVAL(LDC,C,XI,LXI,KK,ID,X,INPPV) between limits A and B.
10 C
11 C PPGQ8 calls PPVAL, INTRV, I1MACH, R1MACH, XERROR
12 C
13 C Description of arguments
14 C
15 C INPUT--
16 C FUN - Name of external function of one argument which
17 C multiplies PPVAL.
18 C LDC - Leading dimension of matrix C, LDC.GE.KK
19 C C - Matrix of Tayor derivatives of dimension at least
20 C (K,LXI)
21 C XI - Breakpoint vector of length LXI+1
22 C LXI - Number of polynomial pieces
23 C KK - Order of the spline, KK.GE.1
24 C ID - Order of the spline derivative, 0.LE.ID.LE.KK-1
25 C A - Lower limit of integral
26 C B - Upper limit of integral (may be less than A)
27 C INPPV- Initialization parameter for PPVAL
28 C ERR - Is a requested pseudorelative error tolerance. Normally
29 C pick a value of ABS(ERR).LT.1E-3. ANS will normally
30 C have no more error than ABS(ERR) times the integral of
31 C the absolute value of FUN(X)*PPVAL(LDC,C,XI,LXI,KK,ID,X,
32 C INPPV).
33 C
34 C OUTPUT--
35 C ERR - Will be an estimate of the absolute error in ANS if the
36 C input value of ERR was negative. (ERR is unchanged if
37 C the input value of ERR was nonnegative.) The estimated
38 C error is solely for information to the user and should
39 C not be used as a correction to the computed integral.
40 C ANS - Computed value of integral
41 C IERR- A status code
42 C --Normal codes
43 C 1 ANS most likely meets requested error tolerance,
44 C or A=B.
45 C -1 A and B ARE too nearly equal to allow normal
46 C integration. ANS is set to zero.
47 C --Abnormal code
48 C 2 ANS probably does not meet requested error tolerance.
49 C***ROUTINES CALLED I1MACH,PPVAL,R1MACH,XERROR
50 C***END PROLOGUE PPGQ8
51 C
52 INTEGER ICALL,ID,IERR,INPPV,K,KK,KML,KMX,L,LDC,LMN,LMX,LR,LXI,MXL,
53 1 NBITS, NIB, NLMN, NLMX
54 INTEGER I1MACH
55 REAL A,AA,AE,ANIB, ANS,AREA,B, BE,C,CC,EE, EF, EPS, ERR,
56 1 EST,GL,GLR,GR,HH,SQ2,TOL,VL,VR,W1, W2, W3, W4, XI, X1,
57 2 X2, X3, X4, X, H
58 REAL R1MACH, PPVAL, G8, FUN
59 DIMENSION XI(1), C(LDC,1)
60 DIMENSION AA(30), HH(30), LR(30), VL(30), GR(30)
61 DATA X1, X2, X3, X4/
62 1 1.83434642495649805E-01, 5.25532409916328986E-01,
63 2 7.96666477413626740E-01, 9.60289856497536232E-01/
64 DATA W1, W2, W3, W4/
65 1 3.62683783378361983E-01, 3.13706645877887287E-01,
66 2 2.22381034453374471E-01, 1.01228536290376259E-01/
67 DATA ICALL / 0 /
68 DATA SQ2/1.41421356E0/
69 DATA NLMN/1/,KMX/5000/,KML/6/
70 G8(X,H)=H*((W1*(FUN(X-X1*H)*PPVAL(LDC,C,XI,LXI,KK,ID,X-X1*H,INPPV)
71 1 +FUN(X+X1*H)*PPVAL(LDC,C,XI,LXI,KK,ID,X+X1*H,INPPV))
72 2 +W2*(FUN(X-X2*H)*PPVAL(LDC,C,XI,LXI,KK,ID,X-X2*H,INPPV)
73 3 +FUN(X+X2*H)*PPVAL(LDC,C,XI,LXI,KK,ID,X+X2*H,INPPV)))
74 4 +(W3*(FUN(X-X3*H)*PPVAL(LDC,C,XI,LXI,KK,ID,X-X3*H,INPPV)
75 5 +FUN(X+X3*H)*PPVAL(LDC,C,XI,LXI,KK,ID,X+X3*H,INPPV))
76 6 +W4*(FUN(X-X4*H)*PPVAL(LDC,C,XI,LXI,KK,ID,X-X4*H,INPPV)
77 7 +FUN(X+X4*H)*PPVAL(LDC,C,XI,LXI,KK,ID,X+X4*H,INPPV))))
78 C
79 C INITIALIZE
80 C
81 C***FIRST EXECUTABLE STATEMENT PPGQ8
82 IF (ICALL.NE.0) CALL XERROR( 'PPGQ8- PPGQ8 CALLED RECURSIVELY. RE
83 1CURSIVE CALLS ARE ILLEGAL IN FORTRAN.', 73, 7, 2)
84 ICALL = 1
85 K = I1MACH(11)
86 ANIB = R1MACH(5)*FLOAT(K)/0.30102000E0
87 NBITS = INT(ANIB)
88 NLMX = (NBITS*5)/8
89 ANS = 0.0E0
90 IERR = 1
91 BE = 0.0E0
92 IF (A.EQ.B) GO TO 140
93 LMX = NLMX
94 LMN = NLMN
95 IF (B.EQ.0.0E0) GO TO 10
96 IF (SIGN(1.0E0,B)*A.LE.0.0E0) GO TO 10
97 CC = ABS(1.0E0-A/B)
98 IF (CC.GT.0.1E0) GO TO 10
99 IF (CC.LE.0.0E0) GO TO 140
100 ANIB = 0.5E0 - ALOG(CC)/0.69314718E0
101 NIB = INT(ANIB)
102 LMX = MIN0(NLMX,NBITS-NIB-7)
103 IF (LMX.LT.1) GO TO 130
104 LMN = MIN0(LMN,LMX)
105 10 TOL = AMAX1(ABS(ERR),2.0E0**(5-NBITS))/2.0E0
106 IF (ERR.EQ.0.0E0) TOL = SQRT(R1MACH(4))
107 EPS = TOL
108 HH(1) = (B-A)/4.0E0
109 AA(1) = A
110 LR(1) = 1
111 L = 1
112 EST = G8(AA(L)+2.0E0*HH(L),2.0E0*HH(L))
113 K = 8
114 AREA = ABS(EST)
115 EF = 0.5E0
116 MXL = 0
117 C
118 C COMPUTE REFINED ESTIMATES, ESTIMATE THE ERROR, ETC.
119 C
120 20 GL = G8(AA(L)+HH(L),HH(L))
121 GR(L) = G8(AA(L)+3.0E0*HH(L),HH(L))
122 K = K + 16
123 AREA = AREA + (ABS(GL)+ABS(GR(L))-ABS(EST))
124 GLR = GL + GR(L)
125 EE = ABS(EST-GLR)*EF
126 AE = AMAX1(EPS*AREA,TOL*ABS(GLR))
127 IF (EE-AE) 40, 40, 50
128 30 MXL = 1
129 40 BE = BE + (EST-GLR)
130 IF (LR(L)) 60, 60, 80
131 C
132 C CONSIDER THE LEFT HALF OF THIS LEVEL
133 C
134 50 IF (K.GT.KMX) LMX = KML
135 IF (L.GE.LMX) GO TO 30
136 L = L + 1
137 EPS = EPS*0.5E0
138 EF = EF/SQ2
139 HH(L) = HH(L-1)*0.5E0
140 LR(L) = -1
141 AA(L) = AA(L-1)
142 EST = GL
143 GO TO 20
144 C
145 C PROCEED TO RIGHT HALF AT THIS LEVEL
146 C
147 60 VL(L) = GLR
148 70 EST = GR(L-1)
149 LR(L) = 1
150 AA(L) = AA(L) + 4.0E0*HH(L)
151 GO TO 20
152 C
153 C RETURN ONE LEVEL
154 C
155 80 VR = GLR
156 90 IF (L.LE.1) GO TO 120
157 L = L - 1
158 EPS = EPS*2.0E0
159 EF = EF*SQ2
160 IF (LR(L)) 100, 100, 110
161 100 VL(L) = VL(L+1) + VR
162 GO TO 70
163 110 VR = VL(L+1) + VR
164 GO TO 90
165 C
166 C EXIT
167 C
168 120 ANS = VR
169 IF ((MXL.EQ.0) .OR. (ABS(BE).LE.2.0E0*TOL*AREA)) GO TO 140
170 IERR = 2
171 CALL XERROR( 'PPGQ8- ANS IS PROBABLY INSUFFICIENTLY ACCURATE.',
172 1 47, 3, 1)
173 GO TO 140
174 130 IERR = -1
175 CALL XERROR( 'PPGQ8- THE FOLLOWING TEMPORARY DIAGNOSTIC WILL APPEA
176 1R ONLY ONCE. A AND B ARE TOO NEARLY EQUAL TO ALLOW NORMAL INTEGRA
177 2TION. ANS IS SET TO ZERO, AND IERR=-1.', 157, 1, -1)
178 140 ICALL = 0
179 IF (ERR.LT.0.0E0) ERR = BE
180 RETURN
181 END
0 SUBROUTINE PPQAD(LDC,C,XI,LXI,K,X1,X2,PQUAD)
1 C***BEGIN PROLOGUE PPQAD
2 C***DATE WRITTEN 800901 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. H2A2A1,E3,K6
5 C***KEYWORDS B-SPLINE,DATA FITTING,INTERPOLATION,QUADRATURE,SPLINE
6 C***AUTHOR AMOS, D. E., (SNLA)
7 C***PURPOSE Computes the integral on (X1,X2) of a K-th order B-spline
8 C using the piecewise polynomial representation.
9 C***DESCRIPTION
10 C
11 C Written by D. E. Amos, June, 1979.
12 C
13 C Reference SAND-79-1825
14 C
15 C Abstract
16 C PPQAD computes the integral on (X1,X2) of a K-th order
17 C B-spline using the piecewise polynomial representation
18 C (C,XI,LXI,K). Here the Taylor expansion about the left
19 C end point XI(J) of the J-th interval is integrated and
20 C evaluated on subintervals of (X1,X2) which are formed by
21 C included break points. Integration outside (XI(1),XI(LXI+1))
22 C is permitted.
23 C
24 C PPQAD calls INTRV
25 C
26 C Description of Arguments
27 C Input
28 C LDC - leading dimension of matrix C, LDC .GE. K
29 C C(I,J) - right Taylor derivatives at XI(J), I=1,K , J=1,LXI
30 C XI(*) - break point array of length LXI+1
31 C LXI - number of polynomial pieces
32 C K - order of B-spline, K .GE. 1
33 C X1,X2 - end points of quadrature interval, normally in
34 C XI(1) .LE. X .LE. XI(LXI+1)
35 C
36 C Output
37 C PQUAD - integral of the PP representation over (X1,X2)
38 C
39 C Error Conditions
40 C Improper input is a fatal error
41 C***REFERENCES D.E. AMOS, *QUADRATURE SUBROUTINES FOR SPLINES AND
42 C B-SPLINES*, SAND79-1825, SANDIA LABORATORIES,
43 C DECEMBER 1979.
44 C***ROUTINES CALLED INTRV,XERROR
45 C***END PROLOGUE PPQAD
46 C
47 C
48 INTEGER I, II, IL, ILO, IL1, IL2, IM, K, LDC, LEFT, LXI, MF1, MF2
49 REAL A, AA, BB, C, DX, FLK, PQUAD, Q, S, SS, TA, TB, X, XI, X1, X2
50 DIMENSION XI(1), C(LDC,1), SS(2)
51 C
52 C***FIRST EXECUTABLE STATEMENT PPQAD
53 PQUAD = 0.0E0
54 IF(K.LT.1) GO TO 100
55 IF(LXI.LT.1) GO TO 105
56 IF(LDC.LT.K) GO TO 110
57 AA = AMIN1(X1,X2)
58 BB = AMAX1(X1,X2)
59 IF (AA.EQ.BB) RETURN
60 ILO = 1
61 CALL INTRV(XI, LXI, AA, ILO, IL1, MF1)
62 CALL INTRV(XI, LXI, BB, ILO, IL2, MF2)
63 Q = 0.0E0
64 DO 40 LEFT=IL1,IL2
65 TA = XI(LEFT)
66 A = AMAX1(AA,TA)
67 IF (LEFT.EQ.1) A = AA
68 TB = BB
69 IF (LEFT.LT.LXI) TB = XI(LEFT+1)
70 X = AMIN1(BB,TB)
71 DO 30 II=1,2
72 SS(II) = 0.0E0
73 DX = X - XI(LEFT)
74 IF (DX.EQ.0.0E0) GO TO 20
75 S = C(K,LEFT)
76 FLK = FLOAT(K)
77 IM = K - 1
78 IL = IM
79 DO 10 I=1,IL
80 S = S*DX/FLK + C(IM,LEFT)
81 IM = IM - 1
82 FLK = FLK - 1.0E0
83 10 CONTINUE
84 SS(II) = S*DX
85 20 CONTINUE
86 X = A
87 30 CONTINUE
88 Q = Q + (SS(1)-SS(2))
89 40 CONTINUE
90 IF (X1.GT.X2) Q = -Q
91 PQUAD = Q
92 RETURN
93 C
94 C
95 100 CONTINUE
96 CALL XERROR( ' PPQAD, K DOES NOT SATISFY K.GE.1', 34, 2, 1)
97 RETURN
98 105 CONTINUE
99 CALL XERROR( ' PPQAD, LXI DOES NOT SATISFY LXI.GE.1', 38, 2, 1)
100 RETURN
101 110 CONTINUE
102 CALL XERROR( ' PPQAD, LDC DOES NOT SATISFY LDC.GE.K', 38, 2, 1)
103 RETURN
104 END
0 FUNCTION PPVAL(LDC,C,XI,LXI,K,IDERIV,X,INPPV)
1 C***BEGIN PROLOGUE PPVAL
2 C***DATE WRITTEN 800901 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. E3,K6
5 C***KEYWORDS B-SPLINE,DATA FITTING,INTERPOLATION,SPLINE
6 C***AUTHOR AMOS, D. E., (SNLA)
7 C***PURPOSE Calculates (at X) the value of the IDERIV-th derivative
8 C of the B-spline from the PP-representation.
9 C***DESCRIPTION
10 C
11 C Written by Carl de Boor and modified by D. E. Amos
12 C
13 C Reference
14 C SIAM J. Numerical Analysis, 14, No. 3, June, 1977, pp.441-472.
15 C
16 C Abstract
17 C PPVAL is the PPVALU function of the reference.
18 C
19 C PPVAL calculates (at X) the value of the IDERIV-th
20 C derivative of the B-spline from the PP-representation
21 C (C,XI,LXI,K). The Taylor expansion about XI(J) for X in
22 C the interval XI(J) .LE. X .LT. XI(J+1) is evaluated, J=1,LXI.
23 C Right limiting values at X=XI(J) are obtained. PPVAL will
24 C extrapolate beyond XI(1) and XI(LXI+1).
25 C
26 C To obtain left limiting values (left derivatives) at XI(J),
27 C replace LXI by J-1 and set X=XI(J),J=2,LXI+1.
28 C
29 C PPVAL calls INTRV
30 C
31 C Description of Arguments
32 C Input
33 C LDC - leading dimension of C matrix, LDC .GE. K
34 C C - matrix of dimension at least (K,LXI) containing
35 C right derivatives at break points XI(*).
36 C XI - break point vector of length LXI+1
37 C LXI - number of polynomial pieces
38 C K - order of B-spline, K .GE. 1
39 C IDERIV - order of the derivative, 0 .LE. IDERIV .LE. K-1
40 C IDERIV=0 gives the B-spline value
41 C X - argument, XI(1) .LE. X .LE. XI(LXI+1)
42 C INPPV - an initialization parameter which must be set
43 C to 1 the first time PPVAL is called.
44 C
45 C Output
46 C INPPV - INPPV contains information for efficient process-
47 C ing after the initial call and INPPV must not
48 C be changed by the user. Distinct splines require
49 C distinct INPPV parameters.
50 C PPVAL - value of the IDERIV-th derivative at X
51 C
52 C Error Conditions
53 C Improper input is a fatal error
54 C***REFERENCES C. DE BOOR, *PACKAGE FOR CALCULATING WITH B-SPLINES*,
55 C SIAM JOURNAL ON NUMERICAL ANALYSIS, VOLUME 14, NO. 3,
56 C JUNE 1977, PP. 441-472.
57 C***ROUTINES CALLED INTRV,XERROR
58 C***END PROLOGUE PPVAL
59 C
60 C
61 INTEGER I, IDERIV, INPPV, J, K, LDC, LXI, NDUMMY
62 REAL C, DX, FLTK, X, XI
63 DIMENSION XI(1), C(LDC,LXI)
64 C***FIRST EXECUTABLE STATEMENT PPVAL
65 PPVAL = 0.0E0
66 IF(K.LT.1) GO TO 90
67 IF(LDC.LT.K) GO TO 80
68 IF(LXI.LT.1) GO TO 85
69 IF(IDERIV.LT.0 .OR. IDERIV.GE.K) GO TO 95
70 I = K - IDERIV
71 FLTK = FLOAT(I)
72 CALL INTRV(XI, LXI, X, INPPV, I, NDUMMY)
73 DX = X - XI(I)
74 J = K
75 10 PPVAL = (PPVAL/FLTK)*DX + C(J,I)
76 J = J - 1
77 FLTK = FLTK - 1.0E0
78 IF (FLTK.GT.0.0E0) GO TO 10
79 RETURN
80 C
81 C
82 80 CONTINUE
83 CALL XERROR( ' PPVAL, LDC DOES NOT SATISFY LDC.GE.K', 38, 2, 1)
84 RETURN
85 85 CONTINUE
86 CALL XERROR( ' PPVAL, LXI DOES NOT SATISFY LXI.GE.1', 38, 2, 1)
87 RETURN
88 90 CONTINUE
89 CALL XERROR( ' PPVAL, K DOES NOT SATISFY K.GE.1', 34, 2, 1)
90 RETURN
91 95 CONTINUE
92 CALL XERROR( ' PPVAL, IDERIV DOES NOT SATISFY 0.LE.IDERIV.LT.K',
93 1 49, 2, 1)
94 RETURN
95 END
0 import sys
1 import itertools, fractions
2 import numpy as np
3 import pylab
4 from scipy.interpolate import LSQUnivariateSpline, InterpolatedUnivariateSpline, UnivariateSpline
5
6 try:
7 np.pad
8 except AttributeError:
9 # copied from newer numpy distribution
10 def _create_vector(vector, pad_tuple, before_val, after_val):
11 vector[:pad_tuple[0]] = before_val
12 if pad_tuple[1] > 0:
13 vector[-pad_tuple[1]:] = after_val
14 return vector
15
16 def _normalize_shape(narray, shape):
17 normshp = None
18 shapelen = len(np.shape(narray))
19 if (isinstance(shape, int)):
20 normshp = ((shape, shape), ) * shapelen
21 elif (isinstance(shape, (tuple, list))
22 and isinstance(shape[0], (tuple, list))
23 and len(shape) == shapelen):
24 normshp = shape
25 for i in normshp:
26 if len(i) != 2:
27 fmt = "Unable to create correctly shaped tuple from %s"
28 raise ValueError(fmt % (normshp,))
29 elif (isinstance(shape, (tuple, list))
30 and isinstance(shape[0], (int, float, long))
31 and len(shape) == 1):
32 normshp = ((shape[0], shape[0]), ) * shapelen
33 elif (isinstance(shape, (tuple, list))
34 and isinstance(shape[0], (int, float, long))
35 and len(shape) == 2):
36 normshp = (shape, ) * shapelen
37 if normshp == None:
38 fmt = "Unable to create correctly shaped tuple from %s"
39 raise ValueError(fmt % (shape,))
40 return normshp
41
42 def _validate_lengths(narray, number_elements):
43 shapelen = len(np.shape(narray))
44 normshp = _normalize_shape(narray, number_elements)
45 for i in normshp:
46 if i[0] < 0 or i[1] < 0:
47 fmt ="%s cannot contain negative values."
48 raise ValueError(fmt % (number_elements,))
49 return normshp
50
51 def _constant(vector, pad_tuple, iaxis, kwargs):
52 nconstant = kwargs['constant_values'][iaxis]
53 return _create_vector(vector, pad_tuple, nconstant[0], nconstant[1])
54
55 def pad(array, pad_width, mode=None, **kwargs):
56 narray = np.array(array)
57 pad_width = _validate_lengths(narray, pad_width)
58
59 modefunc = {
60 'constant': _constant,
61 }
62
63 allowedkwargs = {
64 'constant': ['constant_values'],
65 }
66
67 kwdefaults = {
68 'stat_length': None,
69 'constant_values': 0,
70 'end_values': 0,
71 'reflect_type': 'even',
72 }
73
74 if isinstance(mode, str):
75 function = modefunc[mode]
76
77 # Make sure have allowed kwargs appropriate for mode
78 for key in kwargs:
79 if key not in allowedkwargs[mode]:
80 raise ValueError('%s keyword not in allowed keywords %s' %
81 (key, allowedkwargs[mode]))
82
83 # Set kwarg defaults
84 for kw in allowedkwargs[mode]:
85 kwargs.setdefault(kw, kwdefaults[kw])
86
87 # Need to only normalize particular keywords.
88 for i in kwargs:
89 if i == 'stat_length' and kwargs[i]:
90 kwargs[i] = _validate_lengths(narray, kwargs[i])
91 if i in ['end_values', 'constant_values']:
92 kwargs[i] = _normalize_shape(narray, kwargs[i])
93 elif mode == None:
94 raise ValueError('Keyword "mode" must be a function or one of %s.' %
95 (modefunc.keys(),))
96 else:
97 # User supplied function, I hope
98 function = mode
99
100 # Create a new padded array
101 rank = range(len(narray.shape))
102 total_dim_increase = [np.sum(pad_width[i]) for i in rank]
103 offset_slices = [slice(pad_width[i][0],
104 pad_width[i][0] + narray.shape[i])
105 for i in rank]
106 new_shape = np.array(narray.shape) + total_dim_increase
107 newmat = np.zeros(new_shape).astype(narray.dtype)
108
109 # Insert the original array into the padded array
110 newmat[offset_slices] = narray
111
112 # This is the core of pad ...
113 for iaxis in rank:
114 np.apply_along_axis(function,
115 iaxis,
116 newmat,
117 pad_width[iaxis],
118 iaxis,
119 kwargs)
120 return newmat
121
122 np.pad = pad
123
124 ################################################################
125
126 class KnotData(object):
127
128 def __init__(self, knots, mapping, sl, order):
129 self.knots = knots
130 self.mapping = mapping
131 self.slice_data = sl
132 self.order = order
133
134 def used(self):
135 return self.order is not None
136
137 def inv_h(self):
138 sl = self.slice_data
139 return (sl.step.imag - 1) / (sl.stop - sl.start)
140
141 def count(self):
142 return int(self.slice_data.step.imag)
143
144 def get_knots(self):
145 k = self.order
146 return self.knots[k:-k]
147
148 def num_coeffs(self):
149 return len(self.knots) - self.order
150
151 def get_bbox(self):
152 return self.knots[0], self.knots[-1]
153
154 def get_order(self):
155 return self.order
156
157
158 class TensorSpline(object):
159
160 def __init__(self, func, ranges, basegrid):
161 self.func = func
162 self.ranges = ranges
163 self.basegrid = basegrid
164 self.knot_data = np.empty((len(basegrid), len(ranges)), dtype=object)
165 self.find_knots()
166
167 def calc_coeffs(self):
168 coeff = []
169 for v, (g, kdata) in enumerate(zip(self.basegrid, self.knot_data)):
170 ranges = [(slice(r[0], r[1], t[0]*1j) if kd.used() else slice((r[1]-r[0])/2.0,r[1],1j)) for r, t, kd in zip(self.ranges,g[0],kdata)]
171 fnc = self.calc_grid(ranges, g[1], g[2])[v]
172 for n in range(len(ranges)):
173 kd = self.knot_data[v,n]
174 if not kd.used():
175 continue
176 s = list(fnc.shape)
177 s[n] = kd.num_coeffs()
178 out = np.empty(s)
179 s[n] = 1
180 x = np.mgrid[ranges[n]]
181 for i in np.ndindex(tuple(s)):
182 i = list(i)
183 i[n] = slice(None)
184 ss = LSQUnivariateSpline(x, fnc[i], kd.get_knots(), bbox=kd.get_bbox(), k=kd.get_order()-1)
185 out[i] = ss.get_coeffs()
186 fnc = out
187 coeff.append(fnc)
188 return coeff
189
190 @staticmethod
191 def get_interpolating_knots(x, k):
192 x_e = x[-1]
193 x_e += (x_e - x[-2]) * 0.1
194 start = k // 2
195 end = -(k - start)
196 knots = np.zeros((3,len(x)-k))
197 knots[0] = x[start:end]
198 knots[1] = np.arange(start, len(x)+end)
199 if k % 2:
200 knots[0,:-1] += knots[0,1:]
201 knots[0,-1] += x[end]
202 knots[0] *= 0.5
203 return knots, (x[0], x_e)
204
205 @staticmethod
206 def spline_diff(n, x, kn, bbox, k, fnc):
207 s = list(fnc.shape)
208 s[n] = 1
209 out = np.empty_like(fnc)
210 for idx in np.ndindex(tuple(s)):
211 idx = list(idx)
212 idx[n] = slice(None)
213 f = fnc[idx]
214 ss = LSQUnivariateSpline(x, f, kn, bbox=bbox, k=k-1)
215 out[idx] = abs(ss(x) - f)
216 return out
217
218 @staticmethod
219 def max_df(n, x, kn, bbox, k, fnc):
220 s = list(fnc.shape)
221 s[n] = 1
222 mx = 0
223 for idx in np.ndindex(tuple(s)):
224 idx = list(idx)
225 idx[n] = slice(None)
226 f = fnc[idx]
227 ss = LSQUnivariateSpline(x, f, kn, bbox=bbox, k=k-1)
228 mx = max(mx, np.amax(abs(ss(x) - f)))
229 return mx #/ np.ptp(fnc)
230
231 def calc_grid(self, ranges, pre, post):
232 grd = np.mgrid[ranges]
233 pre_grd = grd.copy()
234 if pre:
235 grd = pre(grd)
236 grd_shape = grd.shape
237 numpoints = np.product(grd_shape[1:])
238 grd = grd.reshape(grd_shape[0], numpoints)
239 fnc = self.func(grd.T, True).T
240 fnc.shape = (len(self.basegrid),)+tuple(grd_shape[1:])
241 if post:
242 fnc = post(pre_grd, fnc)
243 return fnc
244
245 @staticmethod
246 def max_diff(n, kn, pos, val):
247 ki = np.unique(np.digitize(pos, kn), True)[1]
248 idx = [slice(None)]*val.ndim
249 l = []
250 for i, j in itertools.izip_longest(ki, ki[1:]):
251 idx[n] = slice(i, j)
252 l.append(np.amax(val[idx]))
253 a = np.array(l)
254 return a[1:] + a[:-1]
255
256 @staticmethod
257 def mk_result(kn, bbox, k, r):
258 idx = np.zeros(len(kn[1])+2, dtype=np.int32)
259 idx[1:-1] = kn[1]
260 idx[-1] = r.step.imag
261 f = reduce(fractions.gcd, idx)
262 idx /= f
263 a = np.empty(idx[-1], dtype=np.int32)
264 for m, (i, j) in enumerate(itertools.izip_longest(idx[:-1], idx[1:])):
265 a[i:j] = m
266 a += k-1
267 return KnotData(np.pad(kn[0], k, 'constant', constant_values=bbox), a, slice(r.start, r.stop, r.step/f), k)
268
269 def get_support(self, i, fnc, dlim):
270 def apply_subcube(op, a, axis):
271 j = a.shape[axis]
272 return op(np.rollaxis(a, axis, 1).reshape(j, a.size/j), axis=1)
273 dfnc = np.diff(fnc, 1, axis=i)
274 supp1 = apply_subcube(np.amax, abs(dfnc), i) >= dlim
275 nz1 = np.flatnonzero(supp1)
276 d2fnc = np.diff(dfnc, 1, axis=i)
277 d2lim = 1e-7
278 supp2 = apply_subcube(np.amax, abs(d2fnc), i) >= d2lim
279 nz2 = np.flatnonzero(supp2)
280 istart, iend, llim, rlim = None, None, None, None
281 if len(nz1):
282 istart = nz1[0]
283 iend = nz1[-1]
284 if len(nz2):
285 istart = min(istart, nz2[0])
286 iend = max(iend, nz2[-1])
287 if istart < 2:
288 istart = None
289 if iend > d2fnc.shape[i]-1:
290 iend = None
291 if istart:
292 istart -= 1
293 if np.amax(apply_subcube(np.amax, abs(dfnc), i)[:istart]) < dlim:
294 llim = 0
295 else:
296 llim = (np.amin(apply_subcube(np.amin, dfnc, i)[:istart]), np.amax(apply_subcube(np.amax, dfnc, i)[:istart]))
297 if iend:
298 iend += 1
299 if np.amax(apply_subcube(np.amax, abs(dfnc), i)[iend:]) < dlim:
300 rlim = 0
301 else:
302 rlim = (np.amin(apply_subcube(np.amin, dfnc, i)[:iend]), np.amax(apply_subcube(np.amax, dfnc, i)[:iend]))
303 print apply_subcube(np.amax, abs(dfnc), i)[iend:]; print iend, dlim; raise SystemExit
304 print "##", dlim, (istart, iend), (llim, rlim)
305 return (istart, iend), (llim, rlim)
306
307 def find_knots(self):
308 for v, g in enumerate(self.basegrid):
309 order = [t[1] for t in g[0] if t is not None]
310 for n in range(len(self.ranges)):
311 ranges = [slice(r[0], r[1], (2j * t[0] + 1 if i == n else 0.5j * t[0])) for i, (r, t) in enumerate(zip(self.ranges,g[0]))]
312 fnc = self.calc_grid(ranges, g[1], g[2])[v]
313 #self.get_support(n, fnc, np.amax(abs(fnc))*(ranges[n].stop-ranges[n].start)/ranges[n].step.imag * 1e-4)
314 ptp = fnc.ptp()
315 if np.amax(fnc.ptp(axis=n)) < 1e-6 * ptp:
316 print "%s[%d,%d]: const: %g" % (self.func.comp_id, v, n, np.amax(fnc.ptp(axis=n)) / ptp)
317 self.knot_data[v, n] = KnotData(None,None,None,None)
318 continue
319 k = order[n]
320 x = np.mgrid[ranges[n]]
321 rng = slice(self.ranges[n][0], self.ranges[n][1], g[0][n][0]*1j)
322 kn, bbox = self.get_interpolating_knots(np.mgrid[rng], k)
323 #e_max = 1.1 * self.max_df(n, x, kn, bbox, k, fnc)
324 try:
325 e_rel = g[3]
326 except IndexError:
327 e_rel = None
328 if e_rel is None:
329 #e_rel = 4e-5
330 e_rel = 4e-4
331 e_max = ptp * e_rel
332 good = kn
333 am = None
334 kn0 = kn
335 try:
336 opt = g[4]
337 except IndexError:
338 opt = True
339 while opt:
340 df = self.spline_diff(n, x, kn[0], bbox, k, fnc)
341 mx = np.amax(df)
342 if mx > e_max:
343 if am is None:
344 raise ValueError("bad approximation for %s[%d,%d]: %g > %g" % (self.func.comp_id, v, n, mx, e_max))
345 kn = good
346 kn[2,am] = 1
347 else:
348 good = kn
349 if False:
350 xd = np.square(np.diff(ss(kn[:-1], k))).argsort()+1
351 else:
352 xd = self.max_diff(n, np.pad(kn[0],(1,0),'constant',constant_values=(x[0],)), x, df).argsort()
353 for am in xd:
354 if not kn[2,am]:
355 break
356 else:
357 break
358 kn = np.append(kn[:,:am],kn[:,am+1:], axis=1)
359 self.knot_data[v, n] = self.mk_result(kn, bbox, k, rng)
360 print "%s[%d,%d]: (%g), %d -> %d" % (self.func.comp_id, v, n, e_max, len(kn0[0]), len(kn[0]))
361 #print "#", fnc.shape, x.shape, e_max
362 #print kn[:1]
363 #pylab.plot(x, fnc[:,0,:])
364 #pylab.plot(kn, np.zeros(len(kn)),"x")
365 #pylab.show(); raise SystemExit
366
367
368 def b_ink(x, fnca, k):
369 "return t, bcoef"
370 ca = []
371 for fnc in fnca:
372 t = [None]*len(x)
373 for n in range(len(x)):
374 cf = np.empty_like(fnc)
375 s = list(fnc.shape)
376 s[n] = 1
377 xx = x[n]
378 xxe = xx[-1]
379 xxe += (xxe-xx[-2]) * 0.1
380 kk = k[n]
381 start = kk // 2
382 end = -(kk - start)
383 knots = xx[start:end].copy()
384 if kk % 2:
385 knots[:-1] += knots[1:]
386 knots[-1] += xx[end]
387 knots *= 0.5
388 for idx in np.ndindex(tuple(s)):
389 idx = list(idx)
390 idx[n] = slice(None)
391 #ss = InterpolatedUnivariateSpline(x[n], fnc[idx], bbox=(xx[0],xxe), k=k[n]-1)
392 ss = LSQUnivariateSpline(xx, fnc[idx], knots, bbox=(xx[0],xxe), k=kk-1)
393 cf[idx] = ss.get_coeffs()
394 t[n] = np.pad(knots, kk, 'constant', constant_values=(xx[0],xxe))
395 fnc = cf
396 ca.append(fnc)
397 return t, ca
398
399 def print_float_array(o, name, a, prefix):
400 print >>o, "%sfloat %s[%d] = {" % (prefix, name, a.size)
401 s = " "
402 i = 0
403 a = np.where(abs(a) < 100*np.finfo(np.float32).tiny, 0, a)
404 for v in a.ravel('C'):
405 #o.write(s+repr(float(v)))
406 o.write(s + "%.8g" % v)
407 s = ","
408 i += 1
409 if i % 10 == 0:
410 print >>o, ","
411 s = " "
412 print >>o, "};"
413 return a.size * np.float32().nbytes
414
415 def print_int_array(o, name, a, prefix):
416 print >>o, "%sint %s[%d] = {" % (prefix, name, a.size)
417 s = " "
418 i = 0
419 for v in a.ravel('C'):
420 o.write(s + str(v))
421 s = ","
422 i += 1
423 if i % 10 == 0:
424 print >>o, ","
425 s = " "
426 print >>o, "};"
427 return a.size * np.int32().nbytes
428
429 def print_char_array(o, name, a, prefix):
430 print >>o, "%sunsigned char %s[%d] = {" % (prefix, name, a.size)
431 s = " "
432 i = 0
433 for v in a.ravel('C'):
434 if v > 255:
435 raise ValueError("value > 255 for unsigned char in %s" % name)
436 o.write(s + str(v))
437 s = ","
438 i += 1
439 if i % 10 == 0:
440 print >>o, ","
441 s = " "
442 print >>o, "};"
443 align = 4
444 return ((a.size + align - 1) // align) * align
445
446 def print_intpp_data(o, tag, prefix, func, rgdata, basegrid):
447 if prefix:
448 prefix += " "
449 sz = 0
450 int_sz = np.int32().nbytes
451 float_sz = np.float32().nbytes
452 #ranges = []
453 #orderlist = []
454 #for r, k in rgdata:
455 # ranges.append(r)
456 # orderlist.append(k)
457 spl = TensorSpline(func, rgdata, basegrid)
458 coeffs = spl.calc_coeffs()
459 for iv, val in enumerate(spl.knot_data):
460 n = len([v for v in val if v.used()])
461 print >>o, "%sreal x0%s_%d[%d] = {%s};" % (prefix, tag, iv, n, ", ".join([str(float(r[0])) for r, v in zip(rgdata, val) if v.used()]))
462 print >>o, "%sreal xe%s_%d[%d] = {%s};" % (prefix, tag, iv, n, ", ".join([str(float(r[1])) for r, v in zip(rgdata, val) if v.used()]))
463 print >>o, "%sreal hi%s_%d[%d] = {%s};" % (prefix, tag, iv, n, ", ".join([str(v.inv_h()) for v in val if v.used()]))
464 print >>o, "%sint nmap%s_%d[%d] = {%s};" % (prefix, tag, iv, n, ", ".join([str(v.count()) for v in val if v.used()]))
465 print >>o, "%sint n%s_%d[%d] = {%s};" % (prefix, tag, iv, n, ", ".join([str(v.num_coeffs()) for v in val if v.used()]))
466 sz += (2*int_sz+2*float_sz) * n;
467 #grd = np.mgrid[ranges]
468 #grd_shape = grd.shape
469 #numpoints = np.product(grd_shape[1:])
470 #grd = grd.reshape(grd_shape[0], numpoints, order='F')
471 #grd = grd.T
472 #fnc = np.array(func(grd, True).T, order='C')
473 #fnc.shape = (nvals,)+tuple(reversed(grd_shape[1:]))
474 #fnc = fnc.T
475 #args = [np.arange(s.step.imag) for s in ranges]
476 ti = []
477 ai = []
478 ci = []
479 #idx = [slice(None)]*n+[0]
480 #fnca = []
481 #for i in range(nvals):
482 # idx[n] = i
483 # fnca.append(fnc[idx])
484 #tl, ca = b_ink(args, fnca, orderlist)
485 for j in range(len(val)):
486 if not val[j].used():
487 continue
488 t = "t%d_%d%s" % (j, iv, tag)
489 ti.append(t)
490 sz += print_float_array(o, t, val[j].knots, prefix)
491 a = "a%d_%d%s" % (j, iv, tag)
492 ai.append(a)
493 sz += print_char_array(o, a, val[j].mapping, prefix)
494 for i in range(1):
495 t = "c%d_%d%s" % (i, iv, tag)
496 ci.append(t)
497 sz += print_float_array(o, t, coeffs[iv], prefix)
498 print >>o, "%sunsigned char *map%s_%d[%d] = {%s};" % (prefix, tag, iv, n, ", ".join(ai))
499 print >>o, "%sfloat *t%s_%d[%d] = {%s};" % (prefix, tag, iv, n, ", ".join(ti))
500 print >>o, "%sfloat *c%s_%d[%d] = {%s};" % (prefix, tag, iv, 1, ", ".join(ci))
501 sz += (n + len(basegrid)) * float_sz
502 return sz, [[v.order for v in val] for val in spl.knot_data]
503
504 ################################################################
505
506 class PlotManager(object):
507 def __init__(self, r, c):
508 self.r = r
509 self.c = c
510 self.i = 1
511
512 def __call__(self):
513 pylab.subplot(self.r,self.c,self.i)
514 self.i += 1
515
516 def check_error_grid2(name, ranges, func1, func2, labels, pm):
517 points = np.array(np.mgrid[ranges].T, dtype=np.float32, order="C")
518 points = points.view(",".join(['float32']*len(ranges))).reshape(points.shape[:-1])
519 def f1(x):
520 return tuple(func1(x))
521 def f2(x):
522 return tuple(func2(x))
523 print name
524 for i, (l, a1, a2) in enumerate(zip(labels, np.vectorize(f1)(points),np.vectorize(f2)(points))):
525 a = abs(a2 - a1)
526 print "%s: %g" % (l, max(a.flat))
527 if False:
528 m = argsort(a, axis=None)
529 for i in range(10):
530 n = m[-(1+i)]
531 idx = unravel_index(n, a.shape)
532 print idx, ",".join(["%g" % v for v in points[idx]]), a.flat[n]
533 if pm:
534 pm()
535 pylab.title("%s/%s" % (name,l))
536 pylab.hist(a.flat)
537
538 def check_error_func2(name, func, funcrange, func0, val, pm):
539 l = []
540 for i, (x0, h, n) in enumerate(funcrange):
541 stop = x0 + (n-1)*h - 1e-6
542 l.append(slice(x0+h/2,stop-h/2,(n-1)*1j))
543 check_error_grid2(name, l, func, func0, val, pm)
0 ! -*- f90 -*-
1 ! Note: the context of this file is case sensitive.
2
3 python module tensbs ! in
4 interface ! in :tensbs
5 subroutine b1ink(x,nx,fcn,kx,tx,bcoef,work,iflag) ! in :tensbs:b1ink.f
6 real dimension(nx) :: x
7 integer optional,check(len(x)>=nx),depend(x) :: nx=len(x)
8 real dimension(nx) :: fcn
9 integer optional:: kx=4
10 real dimension(nx+kx),optional,intent(out),depend(nx,kx) :: tx
11 real dimension(nx),intent(out),depend(nx) :: bcoef
12 real dimension(nx+2*kx*(nx+1)),intent(hide),depend(nx,kx) :: work
13 integer, optional, intent(in,out) :: iflag=0
14 end subroutine b1ink
15 subroutine b2ink(x,nx,y,ny,fcn,ldf,kx,ky,tx,ty,bcoef,work,iflag) ! in :tensbs:b2ink.f
16 real dimension(nx) :: x
17 integer optional,check(len(x)>=nx),depend(x) :: nx=len(x)
18 real dimension(ny) :: y
19 integer optional,check(len(y)>=ny),depend(y) :: ny=len(y)
20 real dimension(ldf,ny),depend(ny) :: fcn
21 integer optional,check(shape(fcn,0)==ldf),depend(fcn) :: ldf=shape(fcn,0)
22 integer optional:: kx=4
23 integer optional:: ky=4
24 real dimension(nx+kx),optional,intent(out),depend(nx,kx) :: tx
25 real dimension(ny+ky),optional,intent(out),depend(ny,ky) :: ty
26 real dimension(nx,ny),intent(out),depend(nx,ny) :: bcoef
27 real dimension(nx*ny+max(2*kx*(nx+1),2*ky*(ny+1))),intent(hide),depend(nx,ny,kx,ky) :: work
28 integer, optional, intent(in,out) :: iflag=0
29 end subroutine b2ink
30 function b2val(xval,yval,idx,idy,tx,ty,nx,ny,kx,ky,bcoef,work) ! in :tensbs:b2val.f
31 real :: xval
32 real :: yval
33 integer optional :: idx=0
34 integer optional :: idy=0
35 real dimension(nx+kx),depend(nx,kx) :: tx
36 real dimension(ny+ky),depend(ny,ky) :: ty
37 integer optional,check(shape(bcoef,0)==nx),depend(bcoef) :: nx=shape(bcoef,0)
38 integer optional,check(shape(bcoef,1)==ny),depend(bcoef) :: ny=shape(bcoef,1)
39 integer :: kx
40 integer :: ky
41 real dimension(nx,ny) :: bcoef
42 real dimension(3*max(kx,ky)+ky), intent(hide) :: work
43 real :: b2val
44 end function b2val
45 subroutine b3ink(x,nx,y,ny,z,nz,fcn,ldf1,ldf2,kx,ky,kz,tx,ty,tz,bcoef,work,iflag) ! in :tensbs:b3ink.f
46 real dimension(nx) :: x
47 integer optional,check(len(x)>=nx),depend(x) :: nx=len(x)
48 real dimension(ny) :: y
49 integer optional,check(len(y)>=ny),depend(y) :: ny=len(y)
50 real dimension(nz) :: z
51 integer optional,check(len(z)>=nz),depend(z) :: nz=len(z)
52 real dimension(ldf1,ldf2,nz),depend(nz) :: fcn
53 integer optional,check(shape(fcn,0)==ldf1),depend(fcn) :: ldf1=shape(fcn,0)
54 integer optional,check(shape(fcn,1)==ldf2),depend(fcn) :: ldf2=shape(fcn,1)
55 integer optional :: kx=4
56 integer optional :: ky=4
57 integer optional :: kz=4
58 real dimension(nx+kx),optional,intent(out),depend(nx,kx) :: tx
59 real dimension(ny+ky),optional,intent(out),depend(ny,ky) :: ty
60 real dimension(nz+kz),optional,intent(out),depend(nz,kz) :: tz
61 real dimension(nx,ny,nz),intent(out),depend(nx,ny,nz) :: bcoef
62 real dimension(nx*ny*nz + max(2*kx*(nx+1),max(2*ky*(ny+1),2*kz*(nz+1)))),intent(hide) :: work
63 integer, optional, intent(in,out) :: iflag
64 end subroutine b3ink
65 function b3val(xval,yval,zval,idx,idy,idz,tx,ty,tz,nx,ny,nz,kx,ky,kz,bcoef,work) ! in :tensbs:b3val.f
66 real :: xval
67 real :: yval
68 real :: zval
69 integer optional :: idx=0
70 integer optional :: idy=0
71 integer optional :: idz=0
72 real dimension(nx+kx),depend(nx,kx) :: tx
73 real dimension(ny+ky),depend(ny,ky) :: ty
74 real dimension(nz+kz),depend(nz,kz) :: tz
75 integer optional,check(shape(bcoef,0)==nx),depend(bcoef) :: nx=shape(bcoef,0)
76 integer optional,check(shape(bcoef,1)==ny),depend(bcoef) :: ny=shape(bcoef,1)
77 integer optional,check(shape(bcoef,2)==nz),depend(bcoef) :: nz=shape(bcoef,2)
78 integer :: kx
79 integer :: ky
80 integer :: kz
81 real dimension(nx,ny,nz) :: bcoef
82 real dimension(ky*kz+3*max(kx,max(ky,kz))+kz), intent(hide) :: work
83 real :: b3val
84 end function b3val
85 subroutine b4ink(x,nx,y,ny,z,nz,v,nv,fcn,ldf1,ldf2,ldf3,kx,ky,kz,kv,tx,ty,tz,tv,bcoef,work,iflag) ! in b4ink.f
86 real dimension(nx) :: x
87 integer optional,check(len(x)>=nx),depend(x) :: nx=len(x)
88 real dimension(ny) :: y
89 integer optional,check(len(y)>=ny),depend(y) :: ny=len(y)
90 real dimension(nz) :: z
91 integer optional,check(len(z)>=nz),depend(z) :: nz=len(z)
92 real dimension(nv) :: v
93 integer optional,check(len(v)>=nv),depend(v) :: nv=len(v)
94 real dimension(ldf1,ldf2,ldf3,nv),depend(nv) :: fcn
95 integer optional,check(shape(fcn,0)==ldf1),depend(fcn) :: ldf1=shape(fcn,0)
96 integer optional,check(shape(fcn,1)==ldf2),depend(fcn) :: ldf2=shape(fcn,1)
97 integer optional,check(shape(fcn,2)==ldf3),depend(fcn) :: ldf3=shape(fcn,2)
98 integer optional :: kx=4
99 integer optional :: ky=4
100 integer optional :: kz=4
101 integer optional :: kv=4
102 real dimension(nx+kx),optional,intent(out),depend(nx,kx) :: tx
103 real dimension(ny+ky),optional,intent(out),depend(ny,ky) :: ty
104 real dimension(nz+kz),optional,intent(out),depend(nz,kz) :: tz
105 real dimension(nv+kv),optional,intent(out),depend(nv,kv) :: tv
106 real dimension(nx,ny,nz,nv),intent(out),depend(nx,ny,nz,nv) :: bcoef
107 real dimension(nx*ny*nz*nv+max(2*kx*(nx+1),max(2*ky*(ny+1),max(2*kz*(nz+1),2*kv*(nv+1))))),intent(hide) :: work
108 integer, optional, intent(in,out) :: iflag
109 end subroutine b4ink
110 function b4val(xval,yval,zval,vval,idx,idy,idz,idv,tx,ty,tz,tv,nx,ny,nz,nv,kx,ky,kz,kv,bcoef,work) ! in b4val.f
111 real :: xval
112 real :: yval
113 real :: zval
114 real :: vval
115 integer optional :: idx=0
116 integer optional :: idy=0
117 integer optional :: idz=0
118 integer optional :: idv=0
119 real dimension(nx+kx),depend(nx,kx) :: tx
120 real dimension(ny+ky),depend(ny,ky) :: ty
121 real dimension(nz+kz),depend(nz,kz) :: tz
122 real dimension(nv+kv),depend(nv,kv) :: tv
123 integer optional,check(shape(bcoef,0)==nx),depend(bcoef) :: nx=shape(bcoef,0)
124 integer optional,check(shape(bcoef,1)==ny),depend(bcoef) :: ny=shape(bcoef,1)
125 integer optional,check(shape(bcoef,2)==nz),depend(bcoef) :: nz=shape(bcoef,2)
126 integer optional,check(shape(bcoef,3)==nv),depend(bcoef) :: nv=shape(bcoef,3)
127 integer :: kx
128 integer :: ky
129 integer :: kz
130 integer :: kv
131 real dimension(nx,ny,nz,nv) :: bcoef
132 real dimension(ky*kz*kv+kz*kv+3*max(kx,max(ky,max(kz,kv)))), intent(hide) :: work
133 real :: b4val
134 end function b4val
135 end interface
136 end python module tensbs
137
138 ! This file was auto-generated with f2py (version:1).
139 ! See http://cens.ioc.ee/projects/f2py2e/
0 SUBROUTINE XERABT(MESSG,NMESSG)
1 C***BEGIN PROLOGUE XERABT
2 C***DATE WRITTEN 790801 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. R3C
5 C***KEYWORDS ERROR,XERROR PACKAGE
6 C***AUTHOR JONES, R. E., (SNLA)
7 C***PURPOSE Aborts program execution and prints error message.
8 C***DESCRIPTION
9 C Abstract
10 C ***Note*** machine dependent routine
11 C XERABT aborts the execution of the program.
12 C The error message causing the abort is given in the calling
13 C sequence, in case one needs it for printing on a dayfile,
14 C for example.
15 C
16 C Description of Parameters
17 C MESSG and NMESSG are as in XERROR, except that NMESSG may
18 C be zero, in which case no message is being supplied.
19 C
20 C Written by Ron Jones, with SLATEC Common Math Library Subcommittee
21 C Latest revision --- 19 MAR 1980
22 C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR-
23 C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES,
24 C 1982.
25 C***ROUTINES CALLED (NONE)
26 C***END PROLOGUE XERABT
27 CHARACTER*(*) MESSG
28 C***FIRST EXECUTABLE STATEMENT XERABT
29 STOP
30 END
0 SUBROUTINE XERCLR
1 C***BEGIN PROLOGUE XERCLR
2 C***DATE WRITTEN 790801 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. R3C
5 C***KEYWORDS ERROR,XERROR PACKAGE
6 C***AUTHOR JONES, R. E., (SNLA)
7 C***PURPOSE Resets current error number to zero.
8 C***DESCRIPTION
9 C Abstract
10 C This routine simply resets the current error number to zero.
11 C This may be necessary to do in order to determine that
12 C a certain error has occurred again since the last time
13 C NUMXER was referenced.
14 C
15 C Written by Ron Jones, with SLATEC Common Math Library Subcommittee
16 C Latest revision --- 7 June 1978
17 C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR-
18 C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES,
19 C 1982.
20 C***ROUTINES CALLED J4SAVE
21 C***END PROLOGUE XERCLR
22 C***FIRST EXECUTABLE STATEMENT XERCLR
23 JUNK = J4SAVE(1,0,.TRUE.)
24 RETURN
25 END
0 SUBROUTINE XERCTL(MESSG1,NMESSG,NERR,LEVEL,KONTRL)
1 C***BEGIN PROLOGUE XERCTL
2 C***DATE WRITTEN 790801 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. R3C
5 C***KEYWORDS ERROR,XERROR PACKAGE
6 C***AUTHOR JONES, R. E., (SNLA)
7 C***PURPOSE Allows user control over handling of individual errors.
8 C***DESCRIPTION
9 C Abstract
10 C Allows user control over handling of individual errors.
11 C Just after each message is recorded, but before it is
12 C processed any further (i.e., before it is printed or
13 C a decision to abort is made), a call is made to XERCTL.
14 C If the user has provided his own version of XERCTL, he
15 C can then override the value of KONTROL used in processing
16 C this message by redefining its value.
17 C KONTRL may be set to any value from -2 to 2.
18 C The meanings for KONTRL are the same as in XSETF, except
19 C that the value of KONTRL changes only for this message.
20 C If KONTRL is set to a value outside the range from -2 to 2,
21 C it will be moved back into that range.
22 C
23 C Description of Parameters
24 C
25 C --Input--
26 C MESSG1 - the first word (only) of the error message.
27 C NMESSG - same as in the call to XERROR or XERRWV.
28 C NERR - same as in the call to XERROR or XERRWV.
29 C LEVEL - same as in the call to XERROR or XERRWV.
30 C KONTRL - the current value of the control flag as set
31 C by a call to XSETF.
32 C
33 C --Output--
34 C KONTRL - the new value of KONTRL. If KONTRL is not
35 C defined, it will remain at its original value.
36 C This changed value of control affects only
37 C the current occurrence of the current message.
38 C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR-
39 C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES,
40 C 1982.
41 C***ROUTINES CALLED (NONE)
42 C***END PROLOGUE XERCTL
43 CHARACTER*20 MESSG1
44 C***FIRST EXECUTABLE STATEMENT XERCTL
45 RETURN
46 END
0 SUBROUTINE XERDMP
1 C***BEGIN PROLOGUE XERDMP
2 C***DATE WRITTEN 790801 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. R3C
5 C***KEYWORDS ERROR,XERROR PACKAGE
6 C***AUTHOR JONES, R. E., (SNLA)
7 C***PURPOSE Prints the error tables and then clears them.
8 C***DESCRIPTION
9 C Abstract
10 C XERDMP prints the error tables, then clears them.
11 C
12 C Written by Ron Jones, with SLATEC Common Math Library Subcommittee
13 C Latest revision --- 7 June 1978
14 C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR-
15 C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES,
16 C 1982.
17 C***ROUTINES CALLED XERSAV
18 C***END PROLOGUE XERDMP
19 C***FIRST EXECUTABLE STATEMENT XERDMP
20 CALL XERSAV(' ',0,0,0,KOUNT)
21 RETURN
22 END
0 SUBROUTINE XERMAX(MAX)
1 C***BEGIN PROLOGUE XERMAX
2 C***DATE WRITTEN 790801 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. R3C
5 C***KEYWORDS ERROR,XERROR PACKAGE
6 C***AUTHOR JONES, R. E., (SNLA)
7 C***PURPOSE Sets maximum number of times any error message is to be
8 C printed.
9 C***DESCRIPTION
10 C Abstract
11 C XERMAX sets the maximum number of times any message
12 C is to be printed. That is, non-fatal messages are
13 C not to be printed after they have occured MAX times.
14 C Such non-fatal messages may be printed less than
15 C MAX times even if they occur MAX times, if error
16 C suppression mode (KONTRL=0) is ever in effect.
17 C
18 C Description of Parameter
19 C --Input--
20 C MAX - the maximum number of times any one message
21 C is to be printed.
22 C
23 C Written by Ron Jones, with SLATEC Common Math Library Subcommittee
24 C Latest revision --- 7 June 1978
25 C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR-
26 C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES,
27 C 1982.
28 C***ROUTINES CALLED J4SAVE
29 C***END PROLOGUE XERMAX
30 C***FIRST EXECUTABLE STATEMENT XERMAX
31 JUNK = J4SAVE(4,MAX,.TRUE.)
32 RETURN
33 END
0 SUBROUTINE XERPRT(MESSG,NMESSG)
1 C***BEGIN PROLOGUE XERPRT
2 C***DATE WRITTEN 790801 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. Z
5 C***KEYWORDS ERROR,XERROR PACKAGE
6 C***AUTHOR JONES, R. E., (SNLA)
7 C***PURPOSE Prints error messages.
8 C***DESCRIPTION
9 C Abstract
10 C Print the Hollerith message in MESSG, of length NMESSG,
11 C on each file indicated by XGETUA.
12 C Latest revision --- 19 MAR 1980
13 C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR-
14 C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES,
15 C 1982.
16 C***ROUTINES CALLED I1MACH,S88FMT,XGETUA
17 C***END PROLOGUE XERPRT
18 INTEGER LUN(5)
19 CHARACTER*(*) MESSG
20 C OBTAIN UNIT NUMBERS AND WRITE LINE TO EACH UNIT
21 C***FIRST EXECUTABLE STATEMENT XERPRT
22 CALL XGETUA(LUN,NUNIT)
23 LENMES = LEN(MESSG)
24 DO 20 KUNIT=1,NUNIT
25 IUNIT = LUN(KUNIT)
26 IF (IUNIT.EQ.0) IUNIT = I1MACH(4)
27 DO 10 ICHAR=1,LENMES,72
28 LAST = MIN0(ICHAR+71 , LENMES)
29 WRITE (IUNIT,'(1X,A)') MESSG(ICHAR:LAST)
30 10 CONTINUE
31 20 CONTINUE
32 RETURN
33 END
0 SUBROUTINE XERROR(MESSG,NMESSG,NERR,LEVEL)
1 C***BEGIN PROLOGUE XERROR
2 C***DATE WRITTEN 790801 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. R3C
5 C***KEYWORDS ERROR,XERROR PACKAGE
6 C***AUTHOR JONES, R. E., (SNLA)
7 C***PURPOSE Processes an error (diagnostic) message.
8 C***DESCRIPTION
9 C Abstract
10 C XERROR processes a diagnostic message, in a manner
11 C determined by the value of LEVEL and the current value
12 C of the library error control flag, KONTRL.
13 C (See subroutine XSETF for details.)
14 C
15 C Description of Parameters
16 C --Input--
17 C MESSG - the Hollerith message to be processed, containing
18 C no more than 72 characters.
19 C NMESSG- the actual number of characters in MESSG.
20 C NERR - the error number associated with this message.
21 C NERR must not be zero.
22 C LEVEL - error category.
23 C =2 means this is an unconditionally fatal error.
24 C =1 means this is a recoverable error. (I.e., it is
25 C non-fatal if XSETF has been appropriately called.)
26 C =0 means this is a warning message only.
27 C =-1 means this is a warning message which is to be
28 C printed at most once, regardless of how many
29 C times this call is executed.
30 C
31 C Examples
32 C CALL XERROR('SMOOTH -- NUM WAS ZERO.',23,1,2)
33 C CALL XERROR('INTEG -- LESS THAN FULL ACCURACY ACHIEVED.',
34 C 43,2,1)
35 C CALL XERROR('ROOTER -- ACTUAL ZERO OF F FOUND BEFORE INTERVAL F
36 C 1ULLY COLLAPSED.',65,3,0)
37 C CALL XERROR('EXP -- UNDERFLOWS BEING SET TO ZERO.',39,1,-1)
38 C
39 C Latest revision --- 19 MAR 1980
40 C Written by Ron Jones, with SLATEC Common Math Library Subcommittee
41 C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR-
42 C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES,
43 C 1982.
44 C***ROUTINES CALLED XERRWV
45 C***END PROLOGUE XERROR
46 CHARACTER*(*) MESSG
47 C***FIRST EXECUTABLE STATEMENT XERROR
48 CALL XERRWV(MESSG,NMESSG,NERR,LEVEL,0,0,0,0,0.,0.)
49 RETURN
50 END
0 SUBROUTINE XERRWV(MESSG,NMESSG,NERR,LEVEL,NI,I1,I2,NR,R1,R2)
1 C***BEGIN PROLOGUE XERRWV
2 C***DATE WRITTEN 800319 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. R3C
5 C***KEYWORDS ERROR,XERROR PACKAGE
6 C***AUTHOR JONES, R. E., (SNLA)
7 C***PURPOSE Processes error message allowing 2 integer and two real
8 C values to be included in the message.
9 C***DESCRIPTION
10 C Abstract
11 C XERRWV processes a diagnostic message, in a manner
12 C determined by the value of LEVEL and the current value
13 C of the library error control flag, KONTRL.
14 C (See subroutine XSETF for details.)
15 C In addition, up to two integer values and two real
16 C values may be printed along with the message.
17 C
18 C Description of Parameters
19 C --Input--
20 C MESSG - the Hollerith message to be processed.
21 C NMESSG- the actual number of characters in MESSG.
22 C NERR - the error number associated with this message.
23 C NERR must not be zero.
24 C LEVEL - error category.
25 C =2 means this is an unconditionally fatal error.
26 C =1 means this is a recoverable error. (I.e., it is
27 C non-fatal if XSETF has been appropriately called.)
28 C =0 means this is a warning message only.
29 C =-1 means this is a warning message which is to be
30 C printed at most once, regardless of how many
31 C times this call is executed.
32 C NI - number of integer values to be printed. (0 to 2)
33 C I1 - first integer value.
34 C I2 - second integer value.
35 C NR - number of real values to be printed. (0 to 2)
36 C R1 - first real value.
37 C R2 - second real value.
38 C
39 C Examples
40 C CALL XERRWV('SMOOTH -- NUM (=I1) WAS ZERO.',29,1,2,
41 C 1 1,NUM,0,0,0.,0.)
42 C CALL XERRWV('QUADXY -- REQUESTED ERROR (R1) LESS THAN MINIMUM (
43 C 1R2).,54,77,1,0,0,0,2,ERRREQ,ERRMIN)
44 C
45 C Latest revision --- 19 MAR 1980
46 C Written by Ron Jones, with SLATEC Common Math Library Subcommittee
47 C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR-
48 C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES,
49 C 1982.
50 C***ROUTINES CALLED FDUMP,I1MACH,J4SAVE,XERABT,XERCTL,XERPRT,XERSAV,
51 C XGETUA
52 C***END PROLOGUE XERRWV
53 CHARACTER*(*) MESSG
54 CHARACTER*20 LFIRST
55 CHARACTER*37 FORM
56 DIMENSION LUN(5)
57 C GET FLAGS
58 C***FIRST EXECUTABLE STATEMENT XERRWV
59 LKNTRL = J4SAVE(2,0,.FALSE.)
60 MAXMES = J4SAVE(4,0,.FALSE.)
61 C CHECK FOR VALID INPUT
62 IF ((NMESSG.GT.0).AND.(NERR.NE.0).AND.
63 1 (LEVEL.GE.(-1)).AND.(LEVEL.LE.2)) GO TO 10
64 IF (LKNTRL.GT.0) CALL XERPRT('FATAL ERROR IN...',17)
65 CALL XERPRT('XERROR -- INVALID INPUT',23)
66 IF (LKNTRL.GT.0) CALL FDUMP
67 IF (LKNTRL.GT.0) CALL XERPRT('JOB ABORT DUE TO FATAL ERROR.',
68 1 29)
69 IF (LKNTRL.GT.0) CALL XERSAV(' ',0,0,0,KDUMMY)
70 CALL XERABT('XERROR -- INVALID INPUT',23)
71 RETURN
72 10 CONTINUE
73 C RECORD MESSAGE
74 JUNK = J4SAVE(1,NERR,.TRUE.)
75 CALL XERSAV(MESSG,NMESSG,NERR,LEVEL,KOUNT)
76 C LET USER OVERRIDE
77 LFIRST = MESSG
78 LMESSG = NMESSG
79 LERR = NERR
80 LLEVEL = LEVEL
81 CALL XERCTL(LFIRST,LMESSG,LERR,LLEVEL,LKNTRL)
82 C RESET TO ORIGINAL VALUES
83 LMESSG = NMESSG
84 LERR = NERR
85 LLEVEL = LEVEL
86 LKNTRL = MAX0(-2,MIN0(2,LKNTRL))
87 MKNTRL = IABS(LKNTRL)
88 C DECIDE WHETHER TO PRINT MESSAGE
89 IF ((LLEVEL.LT.2).AND.(LKNTRL.EQ.0)) GO TO 100
90 IF (((LLEVEL.EQ.(-1)).AND.(KOUNT.GT.MIN0(1,MAXMES)))
91 1.OR.((LLEVEL.EQ.0) .AND.(KOUNT.GT.MAXMES))
92 2.OR.((LLEVEL.EQ.1) .AND.(KOUNT.GT.MAXMES).AND.(MKNTRL.EQ.1))
93 3.OR.((LLEVEL.EQ.2) .AND.(KOUNT.GT.MAX0(1,MAXMES)))) GO TO 100
94 IF (LKNTRL.LE.0) GO TO 20
95 CALL XERPRT(' ',1)
96 C INTRODUCTION
97 IF (LLEVEL.EQ.(-1)) CALL XERPRT
98 1('WARNING MESSAGE...THIS MESSAGE WILL ONLY BE PRINTED ONCE.',57)
99 IF (LLEVEL.EQ.0) CALL XERPRT('WARNING IN...',13)
100 IF (LLEVEL.EQ.1) CALL XERPRT
101 1 ('RECOVERABLE ERROR IN...',23)
102 IF (LLEVEL.EQ.2) CALL XERPRT('FATAL ERROR IN...',17)
103 20 CONTINUE
104 C MESSAGE
105 CALL XERPRT(MESSG,LMESSG)
106 CALL XGETUA(LUN,NUNIT)
107 ISIZEI = LOG10(FLOAT(I1MACH(9))) + 1.0
108 ISIZEF = LOG10(FLOAT(I1MACH(10))**I1MACH(11)) + 1.0
109 DO 50 KUNIT=1,NUNIT
110 IUNIT = LUN(KUNIT)
111 IF (IUNIT.EQ.0) IUNIT = I1MACH(4)
112 DO 22 I=1,MIN(NI,2)
113 WRITE (FORM,21) I,ISIZEI
114 21 FORMAT ('(11X,21HIN ABOVE MESSAGE, I',I1,'=,I',I2,') ')
115 IF (I.EQ.1) WRITE (IUNIT,FORM) I1
116 IF (I.EQ.2) WRITE (IUNIT,FORM) I2
117 22 CONTINUE
118 DO 24 I=1,MIN(NR,2)
119 WRITE (FORM,23) I,ISIZEF+10,ISIZEF
120 23 FORMAT ('(11X,21HIN ABOVE MESSAGE, R',I1,'=,E',
121 1 I2,'.',I2,')')
122 IF (I.EQ.1) WRITE (IUNIT,FORM) R1
123 IF (I.EQ.2) WRITE (IUNIT,FORM) R2
124 24 CONTINUE
125 IF (LKNTRL.LE.0) GO TO 40
126 C ERROR NUMBER
127 WRITE (IUNIT,30) LERR
128 30 FORMAT (15H ERROR NUMBER =,I10)
129 40 CONTINUE
130 50 CONTINUE
131 C TRACE-BACK
132 IF (LKNTRL.GT.0) CALL FDUMP
133 100 CONTINUE
134 IFATAL = 0
135 IF ((LLEVEL.EQ.2).OR.((LLEVEL.EQ.1).AND.(MKNTRL.EQ.2)))
136 1IFATAL = 1
137 C QUIT HERE IF MESSAGE IS NOT FATAL
138 IF (IFATAL.LE.0) RETURN
139 IF ((LKNTRL.LE.0).OR.(KOUNT.GT.MAX0(1,MAXMES))) GO TO 120
140 C PRINT REASON FOR ABORT
141 IF (LLEVEL.EQ.1) CALL XERPRT
142 1 ('JOB ABORT DUE TO UNRECOVERED ERROR.',35)
143 IF (LLEVEL.EQ.2) CALL XERPRT
144 1 ('JOB ABORT DUE TO FATAL ERROR.',29)
145 C PRINT ERROR SUMMARY
146 CALL XERSAV(' ',-1,0,0,KDUMMY)
147 120 CONTINUE
148 C ABORT
149 IF ((LLEVEL.EQ.2).AND.(KOUNT.GT.MAX0(1,MAXMES))) LMESSG = 0
150 CALL XERABT(MESSG,LMESSG)
151 RETURN
152 END
0 SUBROUTINE XERSAV(MESSG,NMESSG,NERR,LEVEL,ICOUNT)
1 C***BEGIN PROLOGUE XERSAV
2 C***DATE WRITTEN 800319 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. Z
5 C***KEYWORDS ERROR,XERROR PACKAGE
6 C***AUTHOR JONES, R. E., (SNLA)
7 C***PURPOSE Records that an error occurred.
8 C***DESCRIPTION
9 C Abstract
10 C Record that this error occurred.
11 C
12 C Description of Parameters
13 C --Input--
14 C MESSG, NMESSG, NERR, LEVEL are as in XERROR,
15 C except that when NMESSG=0 the tables will be
16 C dumped and cleared, and when NMESSG is less than zero the
17 C tables will be dumped and not cleared.
18 C --Output--
19 C ICOUNT will be the number of times this message has
20 C been seen, or zero if the table has overflowed and
21 C does not contain this message specifically.
22 C When NMESSG=0, ICOUNT will not be altered.
23 C
24 C Written by Ron Jones, with SLATEC Common Math Library Subcommittee
25 C Latest revision --- 19 Mar 1980
26 C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR-
27 C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES,
28 C 1982.
29 C***ROUTINES CALLED I1MACH,S88FMT,XGETUA
30 C***END PROLOGUE XERSAV
31 INTEGER LUN(5)
32 CHARACTER*(*) MESSG
33 CHARACTER*20 MESTAB(10),MES
34 DIMENSION NERTAB(10),LEVTAB(10),KOUNT(10)
35 SAVE MESTAB,NERTAB,LEVTAB,KOUNT,KOUNTX
36 C NEXT TWO DATA STATEMENTS ARE NECESSARY TO PROVIDE A BLANK
37 C ERROR TABLE INITIALLY
38 DATA KOUNT(1),KOUNT(2),KOUNT(3),KOUNT(4),KOUNT(5),
39 1 KOUNT(6),KOUNT(7),KOUNT(8),KOUNT(9),KOUNT(10)
40 2 /0,0,0,0,0,0,0,0,0,0/
41 DATA KOUNTX/0/
42 C***FIRST EXECUTABLE STATEMENT XERSAV
43 IF (NMESSG.GT.0) GO TO 80
44 C DUMP THE TABLE
45 IF (KOUNT(1).EQ.0) RETURN
46 C PRINT TO EACH UNIT
47 CALL XGETUA(LUN,NUNIT)
48 DO 60 KUNIT=1,NUNIT
49 IUNIT = LUN(KUNIT)
50 IF (IUNIT.EQ.0) IUNIT = I1MACH(4)
51 C PRINT TABLE HEADER
52 WRITE (IUNIT,10)
53 10 FORMAT (32H0 ERROR MESSAGE SUMMARY/
54 1 51H MESSAGE START NERR LEVEL COUNT)
55 C PRINT BODY OF TABLE
56 DO 20 I=1,10
57 IF (KOUNT(I).EQ.0) GO TO 30
58 WRITE (IUNIT,15) MESTAB(I),NERTAB(I),LEVTAB(I),KOUNT(I)
59 15 FORMAT (1X,A20,3I10)
60 20 CONTINUE
61 30 CONTINUE
62 C PRINT NUMBER OF OTHER ERRORS
63 IF (KOUNTX.NE.0) WRITE (IUNIT,40) KOUNTX
64 40 FORMAT (41H0OTHER ERRORS NOT INDIVIDUALLY TABULATED=,I10)
65 WRITE (IUNIT,50)
66 50 FORMAT (1X)
67 60 CONTINUE
68 IF (NMESSG.LT.0) RETURN
69 C CLEAR THE ERROR TABLES
70 DO 70 I=1,10
71 70 KOUNT(I) = 0
72 KOUNTX = 0
73 RETURN
74 80 CONTINUE
75 C PROCESS A MESSAGE...
76 C SEARCH FOR THIS MESSG, OR ELSE AN EMPTY SLOT FOR THIS MESSG,
77 C OR ELSE DETERMINE THAT THE ERROR TABLE IS FULL.
78 MES = MESSG
79 DO 90 I=1,10
80 II = I
81 IF (KOUNT(I).EQ.0) GO TO 110
82 IF (MES.NE.MESTAB(I)) GO TO 90
83 IF (NERR.NE.NERTAB(I)) GO TO 90
84 IF (LEVEL.NE.LEVTAB(I)) GO TO 90
85 GO TO 100
86 90 CONTINUE
87 C THREE POSSIBLE CASES...
88 C TABLE IS FULL
89 KOUNTX = KOUNTX+1
90 ICOUNT = 1
91 RETURN
92 C MESSAGE FOUND IN TABLE
93 100 KOUNT(II) = KOUNT(II) + 1
94 ICOUNT = KOUNT(II)
95 RETURN
96 C EMPTY SLOT FOUND FOR NEW MESSAGE
97 110 MESTAB(II) = MES
98 NERTAB(II) = NERR
99 LEVTAB(II) = LEVEL
100 KOUNT(II) = 1
101 ICOUNT = 1
102 RETURN
103 END
0 SUBROUTINE XGETF(KONTRL)
1 C***BEGIN PROLOGUE XGETF
2 C***DATE WRITTEN 790801 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. R3C
5 C***KEYWORDS ERROR,XERROR PACKAGE
6 C***AUTHOR JONES, R. E., (SNLA)
7 C***PURPOSE Returns current value of error control flag.
8 C***DESCRIPTION
9 C Abstract
10 C XGETF returns the current value of the error control flag
11 C in KONTRL. See subroutine XSETF for flag value meanings.
12 C (KONTRL is an output parameter only.)
13 C
14 C Written by Ron Jones, with SLATEC Common Math Library Subcommittee
15 C Latest revision --- 7 June 1978
16 C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR-
17 C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES,
18 C 1982.
19 C***ROUTINES CALLED J4SAVE
20 C***END PROLOGUE XGETF
21 C***FIRST EXECUTABLE STATEMENT XGETF
22 KONTRL = J4SAVE(2,0,.FALSE.)
23 RETURN
24 END
0 SUBROUTINE XGETUA(IUNITA,N)
1 C***BEGIN PROLOGUE XGETUA
2 C***DATE WRITTEN 790801 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. R3C
5 C***KEYWORDS ERROR,XERROR PACKAGE
6 C***AUTHOR JONES, R. E., (SNLA)
7 C***PURPOSE Returns unit number(s) to which error messages are being
8 C sent.
9 C***DESCRIPTION
10 C Abstract
11 C XGETUA may be called to determine the unit number or numbers
12 C to which error messages are being sent.
13 C These unit numbers may have been set by a call to XSETUN,
14 C or a call to XSETUA, or may be a default value.
15 C
16 C Description of Parameters
17 C --Output--
18 C IUNIT - an array of one to five unit numbers, depending
19 C on the value of N. A value of zero refers to the
20 C default unit, as defined by the I1MACH machine
21 C constant routine. Only IUNIT(1),...,IUNIT(N) are
22 C defined by XGETUA. The values of IUNIT(N+1),...,
23 C IUNIT(5) are not defined (for N .LT. 5) or altered
24 C in any way by XGETUA.
25 C N - the number of units to which copies of the
26 C error messages are being sent. N will be in the
27 C range from 1 to 5.
28 C
29 C Latest revision --- 19 MAR 1980
30 C Written by Ron Jones, with SLATEC Common Math Library Subcommittee
31 C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR-
32 C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES,
33 C 1982.
34 C***ROUTINES CALLED J4SAVE
35 C***END PROLOGUE XGETUA
36 DIMENSION IUNITA(5)
37 C***FIRST EXECUTABLE STATEMENT XGETUA
38 N = J4SAVE(5,0,.FALSE.)
39 DO 30 I=1,N
40 INDEX = I+4
41 IF (I.EQ.1) INDEX = 3
42 IUNITA(I) = J4SAVE(INDEX,0,.FALSE.)
43 30 CONTINUE
44 RETURN
45 END
0 SUBROUTINE XGETUN(IUNIT)
1 C***BEGIN PROLOGUE XGETUN
2 C***DATE WRITTEN 790801 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. R3C
5 C***KEYWORDS ERROR,XERROR PACKAGE
6 C***AUTHOR JONES, R. E., (SNLA)
7 C***PURPOSE Returns the (first) output file to which messages are being
8 C sent.
9 C***DESCRIPTION
10 C Abstract
11 C XGETUN gets the (first) output file to which error messages
12 C are being sent. To find out if more than one file is being
13 C used, one must use the XGETUA routine.
14 C
15 C Description of Parameter
16 C --Output--
17 C IUNIT - the logical unit number of the (first) unit to
18 C which error messages are being sent.
19 C A value of zero means that the default file, as
20 C defined by the I1MACH routine, is being used.
21 C
22 C Written by Ron Jones, with SLATEC Common Math Library Subcommittee
23 C Latest revision --- 23 May 1979
24 C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR-
25 C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES,
26 C 1982.
27 C***ROUTINES CALLED J4SAVE
28 C***END PROLOGUE XGETUN
29 C***FIRST EXECUTABLE STATEMENT XGETUN
30 IUNIT = J4SAVE(3,0,.FALSE.)
31 RETURN
32 END
0 SUBROUTINE XSETF(KONTRL)
1 C***BEGIN PROLOGUE XSETF
2 C***DATE WRITTEN 790801 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. R3A
5 C***KEYWORDS ERROR,XERROR PACKAGE
6 C***AUTHOR JONES, R. E., (SNLA)
7 C***PURPOSE Sets the error control flag.
8 C***DESCRIPTION
9 C Abstract
10 C XSETF sets the error control flag value to KONTRL.
11 C (KONTRL is an input parameter only.)
12 C The following table shows how each message is treated,
13 C depending on the values of KONTRL and LEVEL. (See XERROR
14 C for description of LEVEL.)
15 C
16 C If KONTRL is zero or negative, no information other than the
17 C message itself (including numeric values, if any) will be
18 C printed. If KONTRL is positive, introductory messages,
19 C trace-backs, etc., will be printed in addition to the message.
20 C
21 C IABS(KONTRL)
22 C LEVEL 0 1 2
23 C value
24 C 2 fatal fatal fatal
25 C
26 C 1 not printed printed fatal
27 C
28 C 0 not printed printed printed
29 C
30 C -1 not printed printed printed
31 C only only
32 C once once
33 C
34 C Written by Ron Jones, with SLATEC Common Math Library Subcommittee
35 C Latest revision --- 19 MAR 1980
36 C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR-
37 C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES,
38 C 1982.
39 C***ROUTINES CALLED J4SAVE,XERRWV
40 C***END PROLOGUE XSETF
41 C***FIRST EXECUTABLE STATEMENT XSETF
42 IF ((KONTRL.GE.(-2)).AND.(KONTRL.LE.2)) GO TO 10
43 CALL XERRWV('XSETF -- INVALID VALUE OF KONTRL (I1).',33,1,2,
44 1 1,KONTRL,0,0,0.,0.)
45 RETURN
46 10 JUNK = J4SAVE(2,KONTRL,.TRUE.)
47 RETURN
48 END
0 SUBROUTINE XSETUA(IUNITA,N)
1 C***BEGIN PROLOGUE XSETUA
2 C***DATE WRITTEN 790801 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. R3B
5 C***KEYWORDS ERROR,XERROR PACKAGE
6 C***AUTHOR JONES, R. E., (SNLA)
7 C***PURPOSE Sets up to 5 unit numbers to which messages are to be sent.
8 C***DESCRIPTION
9 C Abstract
10 C XSETUA may be called to declare a list of up to five
11 C logical units, each of which is to receive a copy of
12 C each error message processed by this package.
13 C The purpose of XSETUA is to allow simultaneous printing
14 C of each error message on, say, a main output file,
15 C an interactive terminal, and other files such as graphics
16 C communication files.
17 C
18 C Description of Parameters
19 C --Input--
20 C IUNIT - an array of up to five unit numbers.
21 C Normally these numbers should all be different
22 C (but duplicates are not prohibited.)
23 C N - the number of unit numbers provided in IUNIT
24 C must have 1 .LE. N .LE. 5.
25 C
26 C Written by Ron Jones, with SLATEC Common Math Library Subcommittee
27 C Latest revision --- 19 MAR 1980
28 C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR-
29 C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES,
30 C 1982.
31 C***ROUTINES CALLED J4SAVE,XERRWV
32 C***END PROLOGUE XSETUA
33 DIMENSION IUNITA(5)
34 C***FIRST EXECUTABLE STATEMENT XSETUA
35 IF ((N.GE.1).AND.(N.LE.5)) GO TO 10
36 CALL XERRWV('XSETUA -- INVALID VALUE OF N (I1).',34,1,2,
37 1 1,N,0,0,0.,0.)
38 RETURN
39 10 CONTINUE
40 DO 20 I=1,N
41 INDEX = I+4
42 IF (I.EQ.1) INDEX = 3
43 JUNK = J4SAVE(INDEX,IUNITA(I),.TRUE.)
44 20 CONTINUE
45 JUNK = J4SAVE(5,N,.TRUE.)
46 RETURN
47 END
0 SUBROUTINE XSETUN(IUNIT)
1 C***BEGIN PROLOGUE XSETUN
2 C***DATE WRITTEN 790801 (YYMMDD)
3 C***REVISION DATE 820801 (YYMMDD)
4 C***CATEGORY NO. R3B
5 C***KEYWORDS ERROR,XERROR PACKAGE
6 C***AUTHOR JONES, R. E., (SNLA)
7 C***PURPOSE Sets output file to which error messages are to be sent.
8 C***DESCRIPTION
9 C Abstract
10 C XSETUN sets the output file to which error messages are to
11 C be sent. Only one file will be used. See XSETUA for
12 C how to declare more than one file.
13 C
14 C Description of Parameter
15 C --Input--
16 C IUNIT - an input parameter giving the logical unit number
17 C to which error messages are to be sent.
18 C
19 C Written by Ron Jones, with SLATEC Common Math Library Subcommittee
20 C Latest revision --- 7 June 1978
21 C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR-
22 C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES,
23 C 1982.
24 C***ROUTINES CALLED J4SAVE
25 C***END PROLOGUE XSETUN
26 C***FIRST EXECUTABLE STATEMENT XSETUN
27 JUNK = J4SAVE(3,IUNIT,.TRUE.)
28 JUNK = J4SAVE(5,1,.TRUE.)
29 RETURN
30 END
1111 exit 1
1212 }
1313 set -e
14 bname="$(basename "${1%.*}" .dsp)"
14 bname="${1%.*}"
1515 opt="-shared -fPIC -fvisibility=hidden"
1616 opt="$opt -I$instdir/src/gx_head -I$instdir/src/headers"
1717 opt="$opt -Wall -g"
3636 $prec "${faustopt[@]}" -o "$bname.cc" "$1"
3737 opt="$(python-config --cflags --ldflags | sed s/-Wstrict-prototypes//)"
3838 opt="$opt -shared -fPIC -fvisibility=hidden"
39 opt="$opt -I$instdir/src/gx_head -I$instdir/src/headers"
39 opt="$opt -I$instdir/src/gx_head/engine -I$instdir/src/headers"
4040 opt="$opt -Wall -Wno-unused-function"
4141 #opt="$opt -Wno-unused-but-set-variable"
42 opt="$opt -O3 -march=i686 -mmmx -msse4.2 -mfpmath=sse -ftree-loop-linear -ffinite-math-only -fno-math-errno -fno-signed-zeros -fstrength-reduce"
42 opt="$opt -D_= "
43 opt="$opt -O3 -mmmx -msse4.2 -mfpmath=sse -ftree-loop-linear -ffinite-math-only -fno-math-errno -fno-signed-zeros -fstrength-reduce"
4344 g++ $opt "$bname.cc" -o "$bname.so"
4445 rm -f "$bname.cc"
4546 if [ $copy = 1 ]; then
4343 d["ename"] = ename = d["variable"] + "_values"
4444 fp.write('\tstatic const value_pair %s[] = {%s};\n' % (ename, enumvals))
4545 fp.write('\t%(prefix)sregisterEnumVar("%(id)s",%(N_name)s,"%(type)s",%(N_tooltip)s,%(ename)s,&%(variable)s%(tail)s);\n' % d)
46 elif "nomidi" in d:
47 assert "enum" not in d
48 fp.write('\t%(prefix)sregisterNonMidiFloatVar("%(id)s",&%(variable)s, false, true%(tail)s);\n' % d)
4649 else:
4750 fp.write('\t%(prefix)sregisterVar("%(id)s",%(N_name)s,"%(type)s",%(N_tooltip)s,&%(variable)s%(tail)s);\n' % d)
4851
240243 vr = "([a-zA-Z_][0-9a-zA-Z_]*)"
241244 sarg = (r"%s,\s*&%s,\s*%s,\s*%s,\s*%s,\s*%s"
242245 % (nm, vr, num_re, num_re, num_re, num_re))
246 sargb = (r"%s,\s*&%s,\s*%s,\s*%s"
247 % (nm, vr, num_re, num_re))
243248 openbox = re.compile(pre+r"open(Horizontal|Vertical)Box\(%s\);" % nm).match
244249 closebox = re.compile(pre+r"closeBox\(\);").match
245250 vslider = re.compile(pre+r"addVerticalSlider\(%s\);" % sarg).match
246251 hslider = re.compile(pre+r"addHorizontalSlider\(%s\);" % sarg).match
247252 numentry = re.compile(pre+r"addNumEntry\(%s\);" % sarg).match
253 vbargrahp = re.compile(pre+r"addVerticalBargraph\(%s\);" % sargb).match
254 hbargrahp = re.compile(pre+r"addHorizontalBargraph\(%s\);" % sargb).match
248255 checkbutton = re.compile(pre+r"addCheckButton\(%s,\s*&%s\);" % (nm, vr)).match
249256 declare = re.compile(pre+r"declare\((?:&%s|0),\s*%s,\s*%s\);" % (vr, nm, nm)).match
250257 stack = []
303310 self.ui.add(vn, "type", "B")
304311 self.ui.add(vn, "id", make_name(m.group(1)))
305312 self.ui.add(vn, "value", ("0.0","0.0","1.0","1.0"))
313 continue
314 m = vbargrahp(line) or hbargrahp(line)
315 if m:
316 vn = m.group(2)
317 self.ui.add(vn, "type", "S")
318 self.ui.add(vn, "id", make_name(m.group(1)))
319 self.ui.add(vn, "value", ("-70.0","-70.0","4.0","0.00001"))
306320 continue
307321 m = declare(line)
308322 if m:
13661380 self.has_activate = len(self.parser.memlist) > 0
13671381 if self.options.vectorize:
13681382 self.countname = "fullcount"
1369 self.inputdecl = ", float *inputX%d"
1370 self.outputdecl = ", float *outputX%d"
1383 self.inputdecl = ", FAUSTFLOAT *inputX%d"
1384 self.outputdecl = ", FAUSTFLOAT *outputX%d"
13711385 self.inputcall = ", inputX%d"
13721386 self.outputcall = ", outputX%d"
13731387 else:
13741388 self.countname = "count"
1375 self.inputdecl = ", float *input%d"
1376 self.outputdecl = ", float *output%d"
1389 self.inputdecl = ", FAUSTFLOAT *input%d"
1390 self.outputdecl = ", FAUSTFLOAT *output%d"
13771391 self.inputcall = ", input%d"
13781392 self.outputcall = ", output%d"
13791393 s = StringIO()
15111525 indent = 1
15121526 plugin_standalone = self.options.template_type in ("staticlib", "sharedlib")
15131527 has_plugindef = self.options.init_type in ("plugin", "plugin-instance", "plugin-lv2")
1514 has_lv2 = self.options.init_type in ("plugin-lv2")
1528 has_lv2 = (self.options.init_type == "plugin-lv2")
15151529 in_namespace = self.options.in_namespace
15161530 compute_args = ("".join([self.inputdecl % i for i in range(self.parser.getNumInputs())])
15171531 + "".join([self.outputdecl % i for i in range(self.parser.getNumOutputs())]))
15411555 end_extra_namespace = "} // end namespace %s\n" % in_namespace if in_namespace else "",
15421556 has_standalone_header = plugin_standalone,
15431557 includes = self.parser_sect("includes"),
1544 namespace = self.parser.modname,
1558 namespace = self.parser.modname.replace("-","_"),
15451559 var_decl = self.parser_sect("var-decl", indent=indent) % dd,
15461560 static_decl = static_decl,
15471561 has_activate = self.has_activate,
9191
9292 ctypedef float *floatp
9393
94 cdef void *open_ladspa(char *path, LADSPA_Descriptor_Function *ladspa_descriptor):
95 cdef void* handle
96 handle = dlopen(path, RTLD_LOCAL|RTLD_NOW)
97 if not handle:
98 raise RuntimeError("Cannot open plugin: %s [%s]" % (path, dlerror()))
99 ladspa_descriptor[0] = <LADSPA_Descriptor_Function>dlsym(handle, "ladspa_descriptor")
100 cdef char *dlsym_error = dlerror()
101 if dlsym_error:
102 raise RuntimeError("Cannot load symbol 'ladspa_descriptor': %s" % dlsym_error)
103 return handle
104
105 def plugin_list(char *path):
106 """lists the LADSPA plugins contained in a share library.
107
108 argument: path name of the share library
109 returns: list of (UniqueID, Name)
110 """
111 cdef LADSPA_Descriptor_Function ladspa_descriptor
112 cdef void *handle = open_ladspa(path, &ladspa_descriptor)
113 cdef cp_LADSPA_Descriptor desc
114 cdef idx = 0
115 l = []
116 while True:
117 desc = ladspa_descriptor(idx)
118 if not desc:
119 break
120 l.append((desc.UniqueID, desc.Name))
121 idx += 1
122 dlclose(handle)
123 return l
124
125
94126 cdef class Ladspa:
95127 cdef cp_LADSPA_Descriptor desc
96128 cdef void* handle
97129 cdef LADSPA_Handle instance
98130 cdef LADSPA_Data *ctrl_ports
99131 cdef dict ctrl
132 cdef list params
100133 cdef int num_ctrl
101 cdef int num_inputs
102 cdef int num_outputs
134 cdef int _num_inputs
135 cdef int _num_outputs
103136 cdef double time_per_sample
104
105 def __cinit__(self, char *path):
106 self.handle = dlopen(path, RTLD_LOCAL|RTLD_NOW)
107 if not self.handle:
108 raise RuntimeError("Cannot open plugin: %s [%s]" % (path, dlerror()))
109 cdef LADSPA_Descriptor_Function ladspa_descriptor = <LADSPA_Descriptor_Function>dlsym(self.handle, "ladspa_descriptor")
110 cdef char *dlsym_error = dlerror()
111 if dlsym_error:
112 raise RuntimeError("Cannot load symbol 'ladspa_descriptor': %s" % dlsym_error)
113 self.desc = ladspa_descriptor(0)
114 self.instance = self.desc[0].instantiate(self.desc, 48000)
137 cdef int _samplerate
138
139 @staticmethod
140 def open_unique_id(char *path, unsigned long UniqueID):
141 """open a LADSPA plugin by path name and unique id.
142
143 arguments:
144 path: path name of share library
145 UniqueID: id of plugin
146
147 returns: Ladspa instance
148 """
149 cdef int i
150 for i, (uid, name) in enumerate(plugin_list(path)):
151 if uid == UniqueID:
152 return Ladspa(path, i)
153 raise ValueError("UniqueID %d not found" % UniqueID)
154
155 def __cinit__(self, char *path, unsigned int idx = 0):
156 cdef LADSPA_Descriptor_Function ladspa_descriptor
157 self.handle = open_ladspa(path, &ladspa_descriptor)
158 self.desc = ladspa_descriptor(idx)
115159 cdef int i
116160 d = {}
161 self.params = []
117162 for i in range(self.desc[0].PortCount):
118163 if self.desc[0].PortDescriptors[i] & LADSPA_PORT_CONTROL:
119164 d[self.desc[0].PortNames[i]] = (i, self.num_ctrl)
165 self.params.append(self.desc[0].PortNames[i])
120166 self.num_ctrl += 1
121167 elif self.desc[0].PortDescriptors[i] & LADSPA_PORT_INPUT:
122 self.num_inputs += 1
168 self._num_inputs += 1
123169 else:
124 self.num_outputs += 1
170 self._num_outputs += 1
125171 self.ctrl_ports = <LADSPA_Data*>libc.stdlib.calloc(self.num_ctrl, sizeof(LADSPA_Data))
172 self.ctrl = d
173 self.instance = NULL
174 self.time_per_sample = 0
175 self._samplerate = 0
176
177 def init(self, int samplingRate):
178 """argument: sample rate
179 must be called before calling compute"""
180 self.instance = self.desc[0].instantiate(self.desc, samplingRate)
126181 cdef int n = 0
182 cdef int i
127183 for i in range(self.desc[0].PortCount):
128184 if self.desc[0].PortDescriptors[i] & LADSPA_PORT_CONTROL:
129185 self.desc[0].connect_port(self.instance, i, &self.ctrl_ports[n])
130186 n += 1
131 self.ctrl = d
132187 self.activate()
188 self._samplerate = samplingRate
189
190 property num_inputs:
191 "number of input channels"
192 def __get__(self):
193 return self._num_inputs
194
195 property num_outputs:
196 "number of output channels"
197 def __get__(self):
198 return self._num_outputs
199
200 property samplerate:
201 "initialized samplerate"
202 def __get__(self):
203 return self._samplerate
204
205 property nanosec_per_sample:
206 "time in nanoseconds measured for last compute call"
207 def __get__(self):
208 return self.time_per_sample
209
210 property UniqueID:
211 "LADSPA UniqueID"
212 def __get__(self):
213 return self.desc.UniqueID
214
215 property Name:
216 "LADSPA Name"
217 def __get__(self):
218 return self.desc.Name
133219
134220 def keys(self):
135 return self.ctrl.keys()
221 "List of LADSPA parameters names (in correct order)"
222 return self.params
223
224 def get_var_attr(self, key):
225 """argument: parameter name
226 returns: name, stdval, lower, upper"""
227 low, up = self.get_range(key)
228 return (key, None, low, up)
136229
137230 def get_range(self, key):
231 "return (lower,upper) range for parameter name"
138232 cdef int i, n
139233 i, n = self.get_ctrl_idx(key)
140234 low = up = None
170264 self.ctrl_ports[n] = value
171265
172266 def activate(self):
267 "activate LADSPA plugin (called automatically by init())"
173268 if self.desc[0].activate:
174269 self.desc[0].activate(self.instance)
175270
185280 i -= 1
186281 raise ValueError("audio port not found")
187282
188 def compute(self, np.ndarray inp = None):
283 def compute(self, np.ndarray inp_data = None):
189284 """execute dsp algorithm
190285
191286 argument: 2-dim float32 numpy array with at least num_inputs rows
196291
197292 when num_inputs == 1 you can use a 1-dim array
198293
199 specify type when creating an array, e.g. zeros(200, dtype=float32)
294 some other input format will be converted automatically
200295 """
201 cdef int ni = self.num_inputs
296 if not self.instance:
297 raise ValueError("ladspa plugin not initialized")
298 cdef int ni = self._num_inputs
202299 cdef int count
203 if ni == 0 and inp is None:
300 cdef np.ndarray inp
301 cdef int transposed = False
302 if ni == 0 and inp_data is None:
204303 count = self.defsize
304 inp = None
205305 else:
206 if not isinstance(inp, np.ndarray):
207 raise ValueError("need ndarray")
208 if inp.dtype != np.float32:
209 raise ValueError("need float32")
306 if inp_data.ndim == 2 and inp_data.shape[0] > ni and inp_data.shape[1] == ni:
307 inp_data = inp_data.T
308 transposed = True
309 inp = np.array(inp_data, dtype=np.float32, order='C', copy=False)
210310 count = inp.shape[inp.ndim-1]
211311 if ni == 1:
212312 if not (inp.ndim == 1 or (inp.ndim == 2 and inp.shape[1] >= 1)):
218318 n = inp.strides[0]
219319 for i in range(ni):
220320 self.connect(LADSPA_PORT_INPUT, i, <floatp>(inp.data+i*n))
221 cdef int no = self.num_outputs
321 cdef int no = self._num_outputs
222322 cdef np.ndarray o
223323 if no == 1:
224 o = np.empty(count,dtype=np.float32)
324 if inp_data.ndim == 2:
325 o = np.empty((1,count),dtype=np.float32)
326 else:
327 o = np.empty(count,dtype=np.float32)
225328 else:
226329 o = np.empty((no,count),dtype=np.float32)
227330 for i in range(no):
231334 self.desc[0].run(self.instance, count)
232335 clock_gettime(CLOCK_MONOTONIC, &t1)
233336 self.time_per_sample = ts_diff(t1,t0)/count
337 if transposed:
338 o = o.T
234339 return o
235340
236341 def __dealloc__(self):
238343 self.desc[0].cleanup(self.instance)
239344 if self.ctrl_ports:
240345 libc.stdlib.free(self.ctrl_ports)
346 if self.handle:
347 dlclose(self.handle)
3838 static void registerBoolVar_(const char* id, const char* name, const char* tp,
3939 const char* tooltip, bool* var, bool val);
4040 static void registerNonMidiVar_(const char * id, bool*var, bool preset, bool nosave);
41 static void registerNonMidiFloatVar_(const char * id, float *var, bool preset, bool nosave,
42 float val, float low, float up, float step);
4143 static void registerEnumVar_(const char *id, const char* name, const char* tp,
4244 const char* tooltip, const value_pair* values, float *var, float val,
4345 float low, float up, float step);
5759 registerVar = registerVar_;
5860 registerBoolVar = registerBoolVar_;
5961 registerNonMidiVar = registerNonMidiVar_;
62 registerNonMidiFloatVar = registerNonMidiFloatVar_;
6063 registerEnumVar = registerEnumVar_;
6164 registerIEnumVar = registerIEnumVar_;
6265 }
8083 assert(false);
8184 }
8285
86 void ParamRegImpl::registerNonMidiFloatVar_(const char * id, float *var, bool preset, bool nosave,
87 float val, float low, float up, float step) {
88 assert(false);
89 }
90
8391 void ParamRegImpl::registerEnumVar_(const char *id, const char* name, const char* tp,
8492 const char* tooltip, const value_pair* values, float *var, float val,
8593 float low, float up, float step) {
92100 for (const value_pair* p = values; p->value_id; ++p, ++up);
93101 vars->insert(std::pair<std::string,Var*>(id, new Var(id,name,var,std,0,up,values)));
94102 }
103
104 bool compare_plugin_version(PluginDef *p) {
105 return p->version == PLUGINDEF_VERSION;
106 }
00 from cython.operator cimport dereference as deref, preincrement as inc
1 import numpy as np
12 cimport numpy as np
23
34 cdef extern from "dlfcn.h":
1819 int CLOCK_MONOTONIC
1920 int clock_gettime(clockid_t clk_id, timespec *tp)
2021
22 DEF UseDouble = False
23
24 IF UseDouble:
25 ctypedef double realt
26 np_realt = np.float64
27 ELSE:
28 ctypedef float realt
29 np_realt = np.float32
30
31 ctypedef realt *realtp
32
2133 cdef extern from "gx_plugin.h":
2234 cdef struct value_pair:
2335 char *value_id
2638 cppclass Var:
2739 char *id
2840 char *name
29 float *var
41 realt *var
3042 int *ivar
31 float val
32 float low
33 float up
43 realt val
44 realt low
45 realt up
3446 value_pair *values
3547 cppclass string:
3648 char *c_str()
5163 PluginDef *plugin
5264 ParamRegImpl(VarMap *v, PluginDef *p)
5365 ctypedef int (*registerfunc)(ParamRegImpl& reg)
54 ctypedef void (*process_mono_audio) (int count, float *input, float *output, PluginDef *plugin)
66 ctypedef void (*process_mono_audio) (int count, realt *input, realt *output, PluginDef *plugin)
5567 ctypedef void (*inifunc)(unsigned int samplingFreq, PluginDef *plugin)
5668 ctypedef int (*activatefunc)(int start, PluginDef *plugin)
57 ctypedef void (*process_stereo_audio)(int count, float *input1, float *input2,
58 float *output1, float *output2, PluginDef *plugin)
69 ctypedef void (*clearstatefunc)(PluginDef *plugin)
70 ctypedef void (*deletefunc)(PluginDef *plugin)
71 ctypedef void (*process_stereo_audio)(int count, realt *input1, realt *input2,
72 realt *output1, realt *output2, PluginDef *plugin)
5973 cppclass PluginDef:
6074 int version
6175 int flags
6276 char* id
6377 char* name
6478 char** groups
79 char* decription
80 char* category
81 char* shortname
6582 registerfunc register_params
6683 process_mono_audio mono_audio
6784 process_stereo_audio stereo_audio
6885 inifunc set_samplerate
6986 activatefunc activate_plugin
87 clearstatefunc clear_state
88 deletefunc delete_instance
7089 ctypedef int (*plugin_inifunc)(unsigned int idx, PluginDef **p)
7190
7291 cdef extern from "pluginloader.h":
73 pass
92 int compare_plugin_version(PluginDef *p)
7493
7594 cdef inline double ts_diff(timespec ts1, timespec ts2):
7695 cdef double df = ts1.tv_sec - ts2.tv_sec
7796 return df * 1e9 + (ts1.tv_nsec - ts2.tv_nsec)
78
79 ctypedef float *floatp
8097
8198 cdef class Plugin:
8299 cdef void *handle
84101 cdef VarMap *varmap
85102 cdef dict d
86103 cdef double time_per_sample
104 cdef int _samplerate
87105
88106 def __cinit__(self, path, unsigned int idx = 0):
89107 cdef int n
109127 raise RuntimeError("idx too big (%d > %d)" % (idx, n-1))
110128 if get_gx_plugin(idx, &self.p) < 0:
111129 raise RuntimeError("plugin loader error")
130 if not compare_plugin_version(self.p):
131 raise ValueError("bad plugin version 0x%x" % self.p[0].version)
112132 cdef ParamRegImpl *pr
113133 cdef variter i
114134 d = {}
125145 inc(i)
126146 self.d = d
127147 self.time_per_sample = 0
148 self._samplerate = 0
128149
129150 property nanosec_per_sample:
130151 "time in nanoseconds measured for last compute call"
132153 return self.time_per_sample
133154
134155 def keys(self):
156 "List of parameters names"
135157 return self.d.keys()
136158
137159 def get_var_attr(self, key):
150172 return l
151173
152174 def get_range(self, key):
175 "return (lower,upper) range for parameter name"
153176 f = self.d[key]
154177 return (f[2], f[3])
155178
198221 else:
199222 return 0
200223
224 property samplerate:
225 "initialized samplerate"
226 def __get__(self):
227 return self._samplerate
228
201229 def init(self, int samplingRate):
202230 """argument: sample rate
203231 must be called before calling compute"""
205233 self.p[0].activate_plugin(True, self.p)
206234 if self.p[0].set_samplerate:
207235 self.p[0].set_samplerate(samplingRate, self.p)
208
209 def compute(self, np.ndarray inp = None):
236 self._samplerate = samplingRate
237
238 def clear_state(self):
239 if self.p[0].clear_state:
240 self.p[0].clear_state(self.p)
241
242 def compute(self, np.ndarray inp_data not None):
210243 """execute dsp algorithm
211244
212 argument: float32 numpy array
245 argument: numpy array
213246 returns: float32 numpy array
214247
215248 specify type when creating an array, e.g. zeros(200, dtype=float32)
216249 """
217 if not isinstance(inp, np.ndarray):
218 raise ValueError("need ndarray")
219 if inp.dtype != np.float32:
220 raise ValueError("need float32")
221 cdef int count = np.PyArray_SHAPE(inp)[np.PyArray_NDIM(inp)-1]
250 if not self._samplerate:
251 raise ValueError("Plugin not initialized")
252 cdef int transposed = False
253 if self.p[0].mono_audio:
254 if np.PyArray_NDIM(inp_data) == 2:
255 if np.PyArray_DIMS(inp_data)[0] != 1:
256 if np.PyArray_DIMS(inp_data)[1] == 1:
257 transposed = True
258 inp_data = inp_data.T
259 else:
260 raise ValueError("plugin has only channel")
261 elif not np.PyArray_NDIM(inp_data) == 1:
262 raise ValueError("plugin has only channel")
263 elif self.p[0].stereo_audio:
264 if np.PyArray_NDIM(inp_data) != 2:
265 raise ValueError("plugin has 2 channels")
266 if np.PyArray_DIMS(inp_data)[0] != 2 and np.PyArray_DIMS(inp_data)[1] == 2:
267 transposed = True
268 inp_data = inp_data.T
269 else:
270 raise ValueError("no process function available")
271 cdef np.ndarray inp = np.array(inp_data, dtype=np_realt, order='C', copy=False)
272 cdef int count = np.PyArray_DIMS(inp)[np.PyArray_NDIM(inp)-1]
222273 cdef timespec t0, t1
223274 cdef np.ndarray o
224275 if self.p[0].mono_audio:
225 if not np.PyArray_NDIM(inp) == 1:
226 raise ValueError("need vector")
227 o = np.empty(count,dtype=np.float32)
276 o = np.empty(count,dtype=np_realt)
228277 clock_gettime(CLOCK_MONOTONIC, &t0)
229 self.p[0].mono_audio(count, <floatp>np.PyArray_DATA(inp), <floatp>np.PyArray_DATA(o), self.p)
278 self.p[0].mono_audio(count, <realtp>np.PyArray_DATA(inp), <realtp>np.PyArray_DATA(o), self.p)
230279 clock_gettime(CLOCK_MONOTONIC, &t1)
231 elif self.p[0].stereo_audio:
232 if not (np.PyArray_NDIM(inp) == 2 and np.PyArray_SHAPE(inp)[1] >= 2):
233 raise ValueError("need 2-dim array with at least %d rows" % 2)
234 o = np.empty((2,count),dtype=np.float32)
280 if np.PyArray_NDIM(inp_data) == 2:
281 o = o.reshape(1, count)
282 else:
283 o = np.empty((2,count),dtype=np_realt)
235284 clock_gettime(CLOCK_MONOTONIC, &t0)
236285 self.p[0].stereo_audio(
237 count, <floatp>np.PyArray_DATA(inp), <floatp>(<char*>np.PyArray_DATA(inp)+np.PyArray_STRIDES(inp)[0]),
238 <floatp>np.PyArray_DATA(o), <floatp>(<char*>np.PyArray_DATA(o)+np.PyArray_STRIDES(o)[0]), self.p)
286 count, <realtp>np.PyArray_DATA(inp), <realtp>(<char*>np.PyArray_DATA(inp)+np.PyArray_STRIDES(inp)[0]),
287 <realtp>np.PyArray_DATA(o), <realtp>(<char*>np.PyArray_DATA(o)+np.PyArray_STRIDES(o)[0]), self.p)
239288 clock_gettime(CLOCK_MONOTONIC, &t1)
240 else:
241 raise ValueError("no process function available")
242289 self.time_per_sample = ts_diff(t1,t0)/count
290 if transposed:
291 o = o.T
243292 return o
244293
245294 def __dealloc__(self):
246295 del self.varmap
247296 if self.handle:
297 if self.p and self.p[0].delete_instance:
298 self.p[0].delete_instance(self.p)
248299 dlclose(self.handle)
2323 use_2to3 = True
2424
2525 # used by waf dist and waf build
26 VERSION='0.28.2'
26 VERSION='0.29.0'
2727 APPNAME='guitarix'
2828
29 good_faust_versions = ['0.9.43','0.9.46','0.9.55','0.9.58']
29 good_faust_versions = ['0.9.46','0.9.55','0.9.58','0.9.65']
3030
3131 g_maxlen = 40 # maximum width of message for 2-column display
3232
786786 display_msg("Additional faust options", conf.env['FAUST_OPTIONS'], 'CYAN')
787787 display_feature("Use prebuild gperf files", not conf.env["HAVE_GPERF"])
788788 display_feature("Avahi service discovery", conf.env["HAVE_AVAHI"])
789 display_feature("Bluetooth rfcomm", conf.env["HAVE_BLUEZ"])
789790 display_feature("Use internal zita-resampler", not conf.env['ZITA_RESAMPLER'])
790791 if conf.env['CONVOLVER_FFMPEG']:
791792 display_feature("Use zita-convolver-ffmpeg", True)