Пример #1
0
void
INKReport()
{
  INKReportSingleData("Total Requests", "count", INK_SUM, (double) my_plugin.requests);
  INKReportSingleData("Successful Documents", "count", INK_SUM, (double) my_plugin.successful_requests);
  INKReportSingleData("Unfinished Documents", "count", INK_SUM, (double) my_plugin.unfinished_requests);
  INKReportSingleData("Total Bytes Received", "count", INK_SUM, (double) my_plugin.total_bytes_received);
  INKReportSingleData("Average Bytes Per Request", "bytes/req", INK_AVE,
                      (double) safediv(my_plugin.total_bytes_received, my_plugin.successful_requests));
}
Пример #2
0
	// the signal processing routine;
	inline int perform(t_sample ** __ins, t_sample ** __outs, int __n) { 
		vectorsize = __n;
		const t_sample * __in1 = __ins[0];
		t_sample * __out1 = __outs[0];
		if (__exception) { 
			return __exception;
			
		} else if (( (__in1 == 0) || (__out1 == 0) )) { 
			__exception = GENLIB_ERR_NULL_BUFFER;
			return __exception;
			
		};
		double expr_226 = safediv(((m_tone_4 * 2) * 3.1415926535898), 48000);
		double sin_217 = sin(expr_226);
		double clamp_218 = ((sin_217 <= 1e-05) ? 1e-05 : ((sin_217 >= 0.99999) ? 0.99999 : sin_217));
		// the main sample loop;
		while ((__n--)) { 
			const double in1 = (*(__in1++));
			double mix_229 = (m_y_2 + (clamp_218 * (in1 - m_y_2)));
			double mix_215 = mix_229;
			m_cycle_7.freq(m_rate_6);
			double cycle_221 = m_cycle_7(__sinedata);
			double cycleindex_222 = m_cycle_7.phase();
			double add_220 = (cycle_221 + 1);
			double mul_219 = (add_220 * 0.5);
			double mul_223 = (m_depth_5 * mul_219);
			double mstosamps_214 = (mul_223 * (samplerate * 0.001));
			double mix_230 = (mstosamps_214 + (0.999 * (m_smth_1 - mstosamps_214)));
			double mix_213 = mix_230;
			double tap_225 = m_delay_3.read_linear(mix_213);
			double out1 = tap_225;
			double y0_next_227 = mix_215;
			double smth_next_228 = mix_213;
			m_delay_3.write(mix_215);
			m_y_2 = y0_next_227;
			m_smth_1 = smth_next_228;
			m_delay_3.step();
			// assign results to output buffer;
			(*(__out1++)) = out1;
			
		};
		return __exception;
		
	};
Пример #3
0
	// the signal processing routine;
	inline int perform(t_sample ** __ins, t_sample ** __outs, int __n) { 
		vectorsize = __n;
		const t_sample * __in1 = __ins[0];
		const t_sample * __in2 = __ins[1];
		t_sample * __out1 = __outs[0];
		t_sample * __out2 = __outs[1];
		if (__exception) { 
			return __exception;
			
		} else if (( (__in1 == 0) || (__in2 == 0) || (__out1 == 0) || (__out2 == 0) )) { 
			__exception = GENLIB_ERR_NULL_BUFFER;
			return __exception;
			
		};
		t_sample rsub_999 = (1 - m_bandwidth_22);
		t_sample expr_1051 = safepow(0.001, safediv(1, (m_revtime_19 * 44100)));
		t_sample expr_1052 = safediv((m_roomsize_20 * 44100), 340);
		t_sample mul_988 = (expr_1052 * 0.63245);
		t_sample expr_1043 = (-safepow(expr_1051, mul_988));
		t_sample mul_990 = (expr_1052 * 0.81649);
		t_sample expr_1045 = (-safepow(expr_1051, mul_990));
		t_sample mul_989 = (expr_1052 * 0.7071);
		t_sample expr_1044 = (-safepow(expr_1051, mul_989));
		t_sample mul_991 = (expr_1052 * 1);
		t_sample expr_1050 = (-safepow(expr_1051, mul_991));
		t_sample mul_985 = (expr_1052 * 0.000527);
		int int_984 = int(mul_985);
		t_sample mul_925 = (m_spread_21 * -0.380445);
		t_sample add_924 = (mul_925 + 931);
		t_sample rsub_921 = (1341 - add_924);
		t_sample mul_934 = (int_984 * rsub_921);
		t_sample mul_953 = (m_spread_21 * 0.376623);
		t_sample add_952 = (mul_953 + 931);
		t_sample rsub_949 = (1341 - add_952);
		t_sample mul_960 = (int_984 * rsub_949);
		t_sample add_914 = (expr_1052 + 5);
		t_sample expr_1046 = safepow(expr_1051, add_914);
		t_sample mul_920 = (expr_1052 * 0.41);
		t_sample add_917 = (mul_920 + 5);
		t_sample expr_1049 = safepow(expr_1051, add_917);
		t_sample mul_919 = (expr_1052 * 0.3);
		t_sample add_916 = (mul_919 + 5);
		t_sample expr_1048 = safepow(expr_1051, add_916);
		t_sample mul_918 = (expr_1052 * 0.155);
		t_sample add_915 = (mul_918 + 5);
		t_sample expr_1047 = safepow(expr_1051, add_915);
		t_sample mul_927 = (m_spread_21 * -0.568366);
		t_sample add_923 = (mul_927 + 369);
		t_sample rsub_922 = (add_924 - add_923);
		t_sample mul_941 = (int_984 * rsub_922);
		t_sample mul_983 = (expr_1052 * 0.110732);
		t_sample mul_969 = (m_spread_21 * 0.125541);
		t_sample add_951 = (mul_969 + 369);
		t_sample rsub_950 = (add_952 - add_951);
		t_sample mul_967 = (int_984 * rsub_950);
		t_sample add_926 = (mul_927 + 159);
		t_sample mul_948 = (int_984 * add_926);
		t_sample add_968 = (mul_969 + 159);
		t_sample mul_976 = (int_984 * add_968);
		// the main sample loop;
		while ((__n--)) { 
			const t_sample in1 = (*(__in1++));
			const t_sample in2 = (*(__in2++));
			t_sample mul_846 = (in2 * m_dry_24);
			t_sample mul_858 = (in1 * m_dry_24);
			t_sample mul_848 = ((in1 + in2) * 0.707);
			t_sample mix_1070 = (mul_848 + (rsub_999 * (m_history_5 - mul_848)));
			t_sample mix_998 = mix_1070;
			t_sample tap_888 = m_delay_17.read_linear(mul_988);
			t_sample mul_884 = (tap_888 * expr_1043);
			t_sample mix_1071 = (mul_884 + (m_damping_18 * (m_history_4 - mul_884)));
			t_sample mix_886 = mix_1071;
			t_sample tap_900 = m_delay_16.read_linear(mul_990);
			t_sample mul_896 = (tap_900 * expr_1045);
			t_sample mix_1072 = (mul_896 + (m_damping_18 * (m_history_3 - mul_896)));
			t_sample mix_898 = mix_1072;
			t_sample tap_894 = m_delay_15.read_linear(mul_989);
			t_sample mul_890 = (tap_894 * expr_1044);
			t_sample mix_1073 = (mul_890 + (m_damping_18 * (m_history_2 - mul_890)));
			t_sample mix_892 = mix_1073;
			t_sample tap_996 = m_delay_14.read_linear(mul_991);
			t_sample mul_987 = (tap_996 * expr_1050);
			t_sample mix_1074 = (mul_987 + (m_damping_18 * (m_history_1 - mul_987)));
			t_sample mix_994 = mix_1074;
			t_sample tap_933 = m_delay_13.read_linear(mul_934);
			t_sample mul_931 = (tap_933 * 0.625);
			t_sample tap_959 = m_delay_12.read_linear(mul_960);
			t_sample mul_957 = (tap_959 * 0.625);
			t_sample add_878 = (mix_994 + mix_898);
			t_sample add_876 = (mix_892 + mix_886);
			t_sample add_871 = (add_878 + add_876);
			t_sample mul_854 = (add_871 * 0.5);
			t_sample sub_875 = (add_878 - add_876);
			t_sample mul_857 = (sub_875 * 0.5);
			t_sample sub_877 = (mix_994 - mix_898);
			t_sample sub_874 = (mix_892 - mix_886);
			t_sample sub_873 = (sub_877 - sub_874);
			t_sample mul_856 = (sub_873 * 0.5);
			t_sample add_872 = (sub_877 + sub_874);
			t_sample rsub_870 = (0 - add_872);
			t_sample mul_855 = (rsub_870 * 0.5);
			t_sample tap_902 = m_delay_11.read_linear(add_917);
			t_sample tap_903 = m_delay_11.read_linear(add_916);
			t_sample tap_904 = m_delay_11.read_linear(add_915);
			t_sample tap_905 = m_delay_11.read_linear(add_914);
			t_sample mul_906 = (tap_905 * expr_1046);
			t_sample add_879 = (mul_854 + mul_906);
			t_sample mul_910 = (tap_903 * expr_1048);
			t_sample add_881 = (mul_856 + mul_910);
			t_sample mul_912 = (tap_902 * expr_1049);
			t_sample add_882 = (mul_857 + mul_912);
			t_sample mul_908 = (tap_904 * expr_1047);
			t_sample add_880 = (mul_855 + mul_908);
			t_sample tap_940 = m_delay_10.read_linear(mul_941);
			t_sample mul_938 = (tap_940 * 0.625);
			t_sample tap_982 = m_delay_9.read_linear(mul_983);
			t_sample tap_966 = m_delay_8.read_linear(mul_967);
			t_sample mul_964 = (tap_966 * 0.625);
			t_sample tap_947 = m_delay_7.read_linear(mul_948);
			t_sample mul_945 = (tap_947 * 0.75);
			t_sample mul_980 = (tap_982 * 0.75);
			t_sample sub_979 = (mix_998 - mul_980);
			t_sample mul_978 = (sub_979 * 0.75);
			t_sample add_977 = (mul_978 + tap_982);
			t_sample tap_975 = m_delay_6.read_linear(mul_976);
			t_sample mul_973 = (tap_975 * 0.75);
			t_sample mul_869 = (mul_857 * m_tail_23);
			t_sample mul_867 = (mul_855 * m_tail_23);
			t_sample add_853 = (mul_869 + mul_867);
			t_sample mul_868 = (mul_856 * m_tail_23);
			t_sample mul_866 = (mul_854 * m_tail_23);
			t_sample add_852 = (mul_868 + mul_866);
			t_sample sub_861 = (add_853 - add_852);
			t_sample mul_865 = (mul_912 * m_early_25);
			t_sample mul_863 = (mul_908 * m_early_25);
			t_sample add_851 = (mul_865 + mul_863);
			t_sample mul_864 = (mul_910 * m_early_25);
			t_sample mul_862 = (mul_906 * m_early_25);
			t_sample add_850 = (mul_864 + mul_862);
			t_sample sub_860 = (add_851 - add_850);
			t_sample add_847 = (sub_861 + sub_860);
			t_sample add_849 = (add_847 + in2);
			t_sample sub_944 = (add_849 - mul_945);
			t_sample mul_943 = (sub_944 * 0.75);
			t_sample add_942 = (mul_943 + tap_947);
			t_sample sub_937 = (add_942 - mul_938);
			t_sample mul_936 = (sub_937 * 0.625);
			t_sample add_935 = (mul_936 + tap_940);
			t_sample sub_930 = (add_935 - mul_931);
			t_sample mul_929 = (sub_930 * 0.625);
			t_sample add_928 = (mul_929 + tap_933);
			t_sample out2 = (mul_846 + add_928);
			t_sample add_859 = (add_847 + in1);
			t_sample sub_972 = (add_859 - mul_973);
			t_sample mul_971 = (sub_972 * 0.75);
			t_sample add_970 = (mul_971 + tap_975);
			t_sample sub_963 = (add_970 - mul_964);
			t_sample mul_962 = (sub_963 * 0.625);
			t_sample add_961 = (mul_962 + tap_966);
			t_sample sub_956 = (add_961 - mul_957);
			t_sample mul_955 = (sub_956 * 0.625);
			t_sample add_954 = (mul_955 + tap_959);
			t_sample out1 = (mul_858 + add_954);
			t_sample history_997_next_1065 = mix_998;
			t_sample history_885_next_1066 = mix_886;
			t_sample history_897_next_1067 = mix_898;
			t_sample history_891_next_1068 = mix_892;
			t_sample history_993_next_1069 = mix_994;
			m_delay_17.write(add_879);
			m_delay_16.write(add_881);
			m_delay_15.write(add_880);
			m_delay_14.write(add_882);
			m_delay_13.write(sub_930);
			m_delay_12.write(sub_956);
			m_delay_11.write(add_977);
			m_delay_10.write(sub_937);
			m_delay_9.write(sub_979);
			m_delay_8.write(sub_963);
			m_delay_7.write(sub_944);
			m_delay_6.write(sub_972);
			m_history_5 = history_997_next_1065;
			m_history_4 = history_885_next_1066;
			m_history_3 = history_897_next_1067;
			m_history_2 = history_891_next_1068;
			m_history_1 = history_993_next_1069;
			m_delay_6.step();
			m_delay_7.step();
			m_delay_8.step();
			m_delay_9.step();
			m_delay_10.step();
			m_delay_11.step();
			m_delay_12.step();
			m_delay_13.step();
			m_delay_14.step();
			m_delay_15.step();
			m_delay_16.step();
			m_delay_17.step();
			// assign results to output buffer;
			(*(__out1++)) = out1;
			(*(__out2++)) = out2;
			
		};
		return __exception;
		
	};
Пример #4
0
	// the signal processing routine;
	inline int perform(t_sample ** __ins, t_sample ** __outs, int __n) { 
		vectorsize = __n;
		const t_sample * __in1 = __ins[0];
		t_sample * __out1 = __outs[0];
		if (__exception) { 
			return __exception;
			
		} else if (( (__in1 == 0) || (__out1 == 0) )) { 
			__exception = GENLIB_ERR_NULL_BUFFER;
			return __exception;
			
		};
		double expr_5155 = safediv(((m_cutoff_16 * 2) * 3.1415926535898), 44100);
		double sin_5012 = sin(expr_5155);
		double clamp_5013 = ((sin_5012 <= 1e-05) ? 1e-05 : ((sin_5012 >= 0.99999) ? 0.99999 : sin_5012));
		double mstosamps_5148 = (m_delay_14 * (samplerate * 0.001));
		double mstosamps_5077 = (m_delay_18 * (samplerate * 0.001));
		double rsub_5064 = (1 - m_ratio_12);
		double mul_5063 = (rsub_5064 * 1000);
		double div_5062 = safediv(mul_5063, m_delay_18);
		samples_to_seconds = (1 / samplerate);
		double rsub_5135 = (1 - m_ratio_15);
		double mul_5134 = (rsub_5135 * 1000);
		double div_5133 = safediv(mul_5134, m_delay_14);
		// the main sample loop;
		while ((__n--)) { 
			const double in1 = (*(__in1++));
			double noise_5014 = noise();
			double abs_5031 = fabs(noise_5014);
			double mul_5035 = (abs_5031 * m_blur_17);
			double noise_5086 = noise();
			double abs_5104 = fabs(noise_5086);
			double mul_5112 = (abs_5104 * m_blur_17);
			double noise_5015 = noise();
			double abs_5032 = fabs(noise_5015);
			double mul_5038 = (abs_5032 * m_blur_17);
			double noise_5084 = noise();
			double abs_5102 = fabs(noise_5084);
			double mul_5106 = (abs_5102 * m_blur_17);
			double noise_5017 = noise();
			double abs_5034 = fabs(noise_5017);
			double mul_5044 = (abs_5034 * m_blur_17);
			double noise_5087 = noise();
			double abs_5105 = fabs(noise_5087);
			double mul_5115 = (abs_5105 * m_blur_17);
			double noise_5016 = noise();
			double abs_5033 = fabs(noise_5016);
			double mul_5041 = (abs_5033 * m_blur_17);
			double noise_5085 = noise();
			double abs_5103 = fabs(noise_5085);
			double mul_5109 = (abs_5103 * m_blur_17);
			double phasor_5083 = m_phasor_19(div_5062, samples_to_seconds);
			double add_5055 = ((phasor_5083 + m_history_9) + 0.75);
			double mod_5054 = safemod(add_5055, 1);
			double delta_5037 = m_delta_20(mod_5054);
			double sah_5018 = m_sah_21(mul_5035, delta_5037, 0);
			double sah_5036 = m_sah_22(mstosamps_5077, delta_5037, 0);
			double mul_5027 = (sah_5036 * mod_5054);
			double sub_5053 = (mod_5054 - 0.5);
			double mul_5052 = (sub_5053 * 3.1415926535898);
			double cos_5051 = cos(mul_5052);
			double mul_5046 = (cos_5051 * cos_5051);
			double add_5061 = ((phasor_5083 + m_history_8) + 0.5);
			double mod_5060 = safemod(add_5061, 1);
			double delta_5040 = m_delta_23(mod_5060);
			double sah_5020 = m_sah_24(mul_5038, delta_5040, 0);
			double sah_5039 = m_sah_25(mstosamps_5077, delta_5040, 0);
			double mul_5028 = (sah_5039 * mod_5060);
			double sub_5059 = (mod_5060 - 0.5);
			double mul_5058 = (sub_5059 * 3.1415926535898);
			double cos_5057 = cos(mul_5058);
			double mul_5047 = (cos_5057 * cos_5057);
			double add_5082 = ((phasor_5083 + m_history_7) + 0);
			double mod_5081 = safemod(add_5082, 1);
			double delta_5025 = m_delta_26(mod_5081);
			double sah_5024 = m_sah_27(mul_5044, delta_5025, 0);
			double sah_5045 = m_sah_28(mstosamps_5077, delta_5025, 0);
			double mul_5030 = (sah_5045 * mod_5081);
			double sub_5080 = (mod_5081 - 0.5);
			double mul_5079 = (sub_5080 * 3.1415926535898);
			double cos_5078 = cos(mul_5079);
			double mul_5049 = (cos_5078 * cos_5078);
			double add_5076 = ((phasor_5083 + m_history_6) + 0.25);
			double mod_5075 = safemod(add_5076, 1);
			double delta_5043 = m_delta_29(mod_5075);
			double sah_5022 = m_sah_30(mul_5041, delta_5043, 0);
			double sah_5042 = m_sah_31(mstosamps_5077, delta_5043, 0);
			double mul_5029 = (sah_5042 * mod_5075);
			double tap_5068 = m_delay_11.read_linear(mul_5030);
			double tap_5069 = m_delay_11.read_linear(mul_5029);
			double tap_5070 = m_delay_11.read_linear(mul_5028);
			double tap_5071 = m_delay_11.read_linear(mul_5027);
			double mul_5050 = (tap_5071 * mul_5046);
			double mul_5056 = (tap_5070 * mul_5047);
			double mul_5066 = (tap_5068 * mul_5049);
			double sub_5074 = (mod_5075 - 0.5);
			double mul_5073 = (sub_5074 * 3.1415926535898);
			double cos_5072 = cos(mul_5073);
			double mul_5048 = (cos_5072 * cos_5072);
			double mul_5065 = (tap_5069 * mul_5048);
			double phasor_5154 = m_phasor_32(div_5133, samples_to_seconds);
			double add_5147 = ((m_history_5 + phasor_5154) + 0.25);
			double mod_5146 = safemod(add_5147, 1);
			double delta_5114 = m_delta_33(mod_5146);
			double sah_5092 = m_sah_34(mul_5112, delta_5114, 0);
			double sah_5113 = m_sah_35(mstosamps_5148, delta_5114, 0);
			double mul_5100 = (sah_5113 * mod_5146);
			double sub_5145 = (mod_5146 - 0.5);
			double mul_5144 = (sub_5145 * 3.1415926535898);
			double cos_5143 = cos(mul_5144);
			double mul_5119 = (cos_5143 * cos_5143);
			double add_5126 = ((m_history_4 + phasor_5154) + 0.75);
			double mod_5125 = safemod(add_5126, 1);
			double delta_5108 = m_delta_36(mod_5125);
			double sah_5088 = m_sah_37(mul_5106, delta_5108, 0);
			double sah_5107 = m_sah_38(mstosamps_5148, delta_5108, 0);
			double mul_5098 = (sah_5107 * mod_5125);
			double sub_5124 = (mod_5125 - 0.5);
			double mul_5123 = (sub_5124 * 3.1415926535898);
			double cos_5122 = cos(mul_5123);
			double mul_5117 = (cos_5122 * cos_5122);
			double add_5153 = ((m_history_3 + phasor_5154) + 0);
			double mod_5152 = safemod(add_5153, 1);
			double delta_5095 = m_delta_39(mod_5152);
			double sah_5094 = m_sah_40(mul_5115, delta_5095, 0);
			double sah_5116 = m_sah_41(mstosamps_5148, delta_5095, 0);
			double mul_5101 = (sah_5116 * mod_5152);
			double sub_5151 = (mod_5152 - 0.5);
			double mul_5150 = (sub_5151 * 3.1415926535898);
			double cos_5149 = cos(mul_5150);
			double mul_5120 = (cos_5149 * cos_5149);
			double add_5132 = ((m_history_2 + phasor_5154) + 0.5);
			double mod_5131 = safemod(add_5132, 1);
			double delta_5111 = m_delta_42(mod_5131);
			double sah_5090 = m_sah_43(mul_5109, delta_5111, 0);
			double sah_5110 = m_sah_44(mstosamps_5148, delta_5111, 0);
			double mul_5099 = (sah_5110 * mod_5131);
			double tap_5139 = m_delay_10.read_linear(mul_5101);
			double tap_5140 = m_delay_10.read_linear(mul_5100);
			double tap_5141 = m_delay_10.read_linear(mul_5099);
			double tap_5142 = m_delay_10.read_linear(mul_5098);
			double mul_5137 = (tap_5139 * mul_5120);
			double mul_5136 = (tap_5140 * mul_5119);
			double mul_5121 = (tap_5142 * mul_5117);
			double sub_5130 = (mod_5131 - 0.5);
			double mul_5129 = (sub_5130 * 3.1415926535898);
			double cos_5128 = cos(mul_5129);
			double mul_5118 = (cos_5128 * cos_5128);
			double mul_5127 = (tap_5141 * mul_5118);
			double add_5174 = (((((((mul_5066 + mul_5065) + mul_5056) + mul_5050) + mul_5121) + mul_5127) + mul_5136) + mul_5137);
			double mix_5173 = (m_y_1 + (clamp_5013 * (add_5174 - m_y_1)));
			double mix_5010 = mix_5173;
			double mix_5175 = (in1 + (m_mix_13 * (mix_5010 - in1)));
			double out1 = mix_5175;
			double history_5019_next_5156 = sah_5018;
			double history_5021_next_5157 = sah_5020;
			double history_5026_next_5158 = sah_5024;
			double history_5023_next_5159 = sah_5022;
			double history_5093_next_5160 = sah_5092;
			double history_5089_next_5161 = sah_5088;
			double history_5096_next_5162 = sah_5094;
			double history_5091_next_5163 = sah_5090;
			double y0_next_5164 = mix_5010;
			m_delay_11.write(in1);
			m_delay_10.write(in1);
			m_history_9 = history_5019_next_5156;
			m_history_8 = history_5021_next_5157;
			m_history_7 = history_5026_next_5158;
			m_history_6 = history_5023_next_5159;
			m_history_5 = history_5093_next_5160;
			m_history_4 = history_5089_next_5161;
			m_history_3 = history_5096_next_5162;
			m_history_2 = history_5091_next_5163;
			m_y_1 = y0_next_5164;
			m_delay_10.step();
			m_delay_11.step();
			// assign results to output buffer;
			(*(__out1++)) = out1;
			
		};
		return __exception;
		
	};
Пример #5
0
	// the signal processing routine;
	inline int perform(t_sample ** __ins, t_sample ** __outs, int __n) { 
		vectorsize = __n;
		const t_sample * __in1 = __ins[0];
		t_sample * __out1 = __outs[0];
		if (__exception) { 
			return __exception;
			
		} else if (( (__in1 == 0) || (__out1 == 0) )) { 
			__exception = GENLIB_ERR_NULL_BUFFER;
			return __exception;
			
		};
		double mul_2327 = (m_resonance_13 * 0.125);
		double exp_2328 = exp(mul_2327);
		double mul_2326 = (exp_2328 * 0.882497);
		double mul_2322 = (mul_2326 * mul_2326);
		double expr_2437 = safediv(((m_cutoff_14 * 2) * 3.1415926535898), 44100);
		double cos_2325 = cos(expr_2437);
		double mul_2324 = (cos_2325 * mul_2326);
		double mul_2323 = (mul_2324 * -2);
		double add_2321 = ((mul_2323 + mul_2322) + 1);
		double mstosamps_2393 = (m_window_15 * (samplerate * 0.001));
		double mstosamps_2309 = (m_window_19 * (samplerate * 0.001));
		double rsub_2296 = (1 - m_ratio_20);
		double mul_2295 = (rsub_2296 * 1000);
		double div_2294 = safediv(mul_2295, m_window_19);
		samples_to_seconds = (1 / samplerate);
		double rsub_2380 = (1 - m_ratio_18);
		double mul_2379 = (rsub_2380 * 1000);
		double div_2378 = safediv(mul_2379, m_window_15);
		// the main sample loop;
		while ((__n--)) { 
			const double in1 = (*(__in1++));
			double noise_2247 = noise();
			double abs_2264 = fabs(noise_2247);
			double mul_2270 = (abs_2264 * m_blur_17);
			double noise_2246 = noise();
			double abs_2263 = fabs(noise_2246);
			double mul_2267 = (abs_2263 * m_blur_17);
			double noise_2330 = noise();
			double abs_2348 = fabs(noise_2330);
			double mul_2354 = (abs_2348 * m_blur_17);
			double noise_2332 = noise();
			double abs_2350 = fabs(noise_2332);
			double mul_2360 = (abs_2350 * m_blur_17);
			double noise_2249 = noise();
			double abs_2266 = fabs(noise_2249);
			double mul_2276 = (abs_2266 * m_blur_17);
			double noise_2248 = noise();
			double abs_2265 = fabs(noise_2248);
			double mul_2273 = (abs_2265 * m_blur_17);
			double noise_2331 = noise();
			double abs_2349 = fabs(noise_2331);
			double mul_2357 = (abs_2349 * m_blur_17);
			double noise_2329 = noise();
			double abs_2347 = fabs(noise_2329);
			double mul_2351 = (abs_2347 * m_blur_17);
			double mul_2318 = (mul_2322 * m_y_10);
			double mul_2319 = (mul_2323 * m_y_1);
			double phasor_2315 = m_phasor_21(div_2294, samples_to_seconds);
			double add_2293 = ((phasor_2315 + m_history_9) + 0.5);
			double mod_2292 = safemod(add_2293, 1);
			double delta_2272 = m_delta_22(mod_2292);
			double sah_2252 = m_sah_23(mul_2270, delta_2272, 0);
			double sah_2271 = m_sah_24(mstosamps_2309, delta_2272, 0);
			double mul_2260 = (sah_2271 * mod_2292);
			double sub_2291 = (mod_2292 - 0.5);
			double mul_2290 = (sub_2291 * 3.1415926535898);
			double cos_2289 = cos(mul_2290);
			double mul_2279 = (cos_2289 * cos_2289);
			double add_2287 = ((phasor_2315 + m_history_8) + 0.75);
			double mod_2286 = safemod(add_2287, 1);
			double delta_2269 = m_delta_25(mod_2286);
			double sah_2250 = m_sah_26(mul_2267, delta_2269, 0);
			double sah_2268 = m_sah_27(mstosamps_2309, delta_2269, 0);
			double mul_2259 = (sah_2268 * mod_2286);
			double sub_2285 = (mod_2286 - 0.5);
			double mul_2284 = (sub_2285 * 3.1415926535898);
			double cos_2283 = cos(mul_2284);
			double mul_2278 = (cos_2283 * cos_2283);
			double add_2314 = ((phasor_2315 + m_history_7) + 0);
			double mod_2313 = safemod(add_2314, 1);
			double delta_2257 = m_delta_28(mod_2313);
			double sah_2256 = m_sah_29(mul_2276, delta_2257, 0);
			double sah_2277 = m_sah_30(mstosamps_2309, delta_2257, 0);
			double mul_2262 = (sah_2277 * mod_2313);
			double sub_2312 = (mod_2313 - 0.5);
			double mul_2311 = (sub_2312 * 3.1415926535898);
			double cos_2310 = cos(mul_2311);
			double mul_2281 = (cos_2310 * cos_2310);
			double add_2308 = ((phasor_2315 + m_history_6) + 0.25);
			double mod_2307 = safemod(add_2308, 1);
			double delta_2275 = m_delta_31(mod_2307);
			double sah_2254 = m_sah_32(mul_2273, delta_2275, 0);
			double sah_2274 = m_sah_33(mstosamps_2309, delta_2275, 0);
			double mul_2261 = (sah_2274 * mod_2307);
			double tap_2300 = m_delay_12.read_linear(mul_2262);
			double tap_2301 = m_delay_12.read_linear(mul_2261);
			double tap_2302 = m_delay_12.read_linear(mul_2260);
			double tap_2303 = m_delay_12.read_linear(mul_2259);
			double mul_2282 = (tap_2303 * mul_2278);
			double mul_2288 = (tap_2302 * mul_2279);
			double mul_2298 = (tap_2300 * mul_2281);
			double sub_2306 = (mod_2307 - 0.5);
			double mul_2305 = (sub_2306 * 3.1415926535898);
			double cos_2304 = cos(mul_2305);
			double mul_2280 = (cos_2304 * cos_2304);
			double mul_2297 = (tap_2301 * mul_2280);
			double phasor_2399 = m_phasor_34(div_2378, samples_to_seconds);
			double add_2377 = ((m_history_5 + phasor_2399) + 0.5);
			double mod_2376 = safemod(add_2377, 1);
			double delta_2356 = m_delta_35(mod_2376);
			double sah_2335 = m_sah_36(mul_2354, delta_2356, 0);
			double sah_2355 = m_sah_37(mstosamps_2393, delta_2356, 0);
			double mul_2344 = (sah_2355 * mod_2376);
			double sub_2375 = (mod_2376 - 0.5);
			double mul_2374 = (sub_2375 * 3.1415926535898);
			double cos_2373 = cos(mul_2374);
			double mul_2363 = (cos_2373 * cos_2373);
			double add_2398 = ((m_history_4 + phasor_2399) + 0);
			double mod_2397 = safemod(add_2398, 1);
			double delta_2340 = m_delta_38(mod_2397);
			double sah_2339 = m_sah_39(mul_2360, delta_2340, 0);
			double sah_2361 = m_sah_40(mstosamps_2393, delta_2340, 0);
			double mul_2346 = (sah_2361 * mod_2397);
			double sub_2396 = (mod_2397 - 0.5);
			double mul_2395 = (sub_2396 * 3.1415926535898);
			double cos_2394 = cos(mul_2395);
			double mul_2365 = (cos_2394 * cos_2394);
			double add_2392 = ((m_history_3 + phasor_2399) + 0.25);
			double mod_2391 = safemod(add_2392, 1);
			double delta_2359 = m_delta_41(mod_2391);
			double sah_2337 = m_sah_42(mul_2357, delta_2359, 0);
			double sah_2358 = m_sah_43(mstosamps_2393, delta_2359, 0);
			double mul_2345 = (sah_2358 * mod_2391);
			double sub_2390 = (mod_2391 - 0.5);
			double mul_2389 = (sub_2390 * 3.1415926535898);
			double cos_2388 = cos(mul_2389);
			double mul_2364 = (cos_2388 * cos_2388);
			double add_2371 = ((m_history_2 + phasor_2399) + 0.75);
			double mod_2370 = safemod(add_2371, 1);
			double delta_2353 = m_delta_44(mod_2370);
			double sah_2333 = m_sah_45(mul_2351, delta_2353, 0);
			double sah_2352 = m_sah_46(mstosamps_2393, delta_2353, 0);
			double mul_2343 = (sah_2352 * mod_2370);
			double tap_2384 = m_delay_11.read_linear(mul_2346);
			double tap_2385 = m_delay_11.read_linear(mul_2345);
			double tap_2386 = m_delay_11.read_linear(mul_2344);
			double tap_2387 = m_delay_11.read_linear(mul_2343);
			double mul_2382 = (tap_2384 * mul_2365);
			double mul_2381 = (tap_2385 * mul_2364);
			double mul_2372 = (tap_2386 * mul_2363);
			double sub_2369 = (mod_2370 - 0.5);
			double mul_2368 = (sub_2369 * 3.1415926535898);
			double cos_2367 = cos(mul_2368);
			double mul_2362 = (cos_2367 * cos_2367);
			double mul_2366 = (tap_2387 * mul_2362);
			double mul_2320 = ((((((((mul_2298 + mul_2297) + mul_2288) + mul_2282) + mul_2366) + mul_2372) + mul_2381) + mul_2382) * add_2321);
			double sub_2317 = (mul_2320 - (mul_2319 + mul_2318));
			double mix_2450 = (in1 + (m_mix_16 * (sub_2317 - in1)));
			double out1 = mix_2450;
			double y2_next_2440 = m_y_1;
			double history_2253_next_2441 = sah_2252;
			double history_2251_next_2442 = sah_2250;
			double history_2258_next_2443 = sah_2256;
			double history_2255_next_2444 = sah_2254;
			double history_2336_next_2445 = sah_2335;
			double history_2341_next_2446 = sah_2339;
			double history_2338_next_2447 = sah_2337;
			double history_2334_next_2448 = sah_2333;
			double y1_next_2449 = sub_2317;
			m_delay_12.write(in1);
			m_delay_11.write(in1);
			m_y_10 = y2_next_2440;
			m_history_9 = history_2253_next_2441;
			m_history_8 = history_2251_next_2442;
			m_history_7 = history_2258_next_2443;
			m_history_6 = history_2255_next_2444;
			m_history_5 = history_2336_next_2445;
			m_history_4 = history_2341_next_2446;
			m_history_3 = history_2338_next_2447;
			m_history_2 = history_2334_next_2448;
			m_y_1 = y1_next_2449;
			m_delay_11.step();
			m_delay_12.step();
			// assign results to output buffer;
			(*(__out1++)) = out1;
			
		};
		return __exception;
		
	};
int main(int argc, char* argv[]) {
  FILE* F;
  TreeModel *model;
  int i, j, k, alph_size, nstates, do_eqfreqs = 0, exch_mode = 0, 
    list_mode = 0, latex_mode = 0, suppress_diag = 0, ti_tv = 0, 
    scientific_mode = 0,
    induced_aa = 0, do_stop_codons = 0, do_zeroes = 0, symmetric = 0, 
    context_ti_tv = 0, all_branches = 0;
  int startcol, endcol, ncols, branch_no = 0, matrix_idx = 0;
/*   int aa_inv[256]; */
  double t = -1, total_ti = 0, total_tv = 0, rho_s = 0, cpg_ti = 0, 
    cpg_tv = 0, non_cpg_ti = 0, non_cpg_tv = 0, cpg_eqfreq = 0;
  char *rate_format_string = "%8.6f";
  MarkovMatrix *M;
  char c;
  char tuple[5], tuple2[5]; /* , aa_alph[50]; */
  char *subst_mat_fname = NULL, *subst_score_fname = NULL, 
    *subst_mat_fname_paml = NULL, *order1_mod_fname = NULL;
  Matrix *subst_mat = NULL;
  List *matrix_list = lst_new_ptr(20), *traversal = NULL;

  while ((c = (char)getopt(argc, argv, "t:fedlLiM:N:A:B:aszSECh")) != -1) {
   switch(c) {
    case 't':
      if (optarg[0] == 'A') all_branches = 1;
      else t = get_arg_dbl_bounds(optarg, 0, INFTY);
      break;
    case 'f':
      do_eqfreqs = 1;
      break;
    case 'e':
      exch_mode = 1;
      break;
    case 'd':
      suppress_diag = 1;
      break;
    case 'l':
      list_mode = 1;
      break;
    case 'L':
      latex_mode = 1;
      break;
    case 'i':
      ti_tv = 1;
      break;
    case 'M':
      subst_mat_fname = optarg;
      induced_aa = 1;
      break;
    case 'N':
      subst_mat_fname_paml = optarg;
      induced_aa = 1;
      break;
    case 'A':
      subst_score_fname = optarg;
      break;
    case 'B':
      order1_mod_fname = optarg;
      break;
    case 'a':
      induced_aa = 1;
      do_zeroes = 1;
      break;
    case 's':
      do_stop_codons = 1;
      break;
    case 'z':
      do_zeroes = 1;
      break;
    case 'S':
      symmetric = 1;
      break;
    case 'E':
      scientific_mode = 1;
      rate_format_string = "%13.6e";
      break;
    case 'C':
      context_ti_tv = 1;
      break;
    case 'h':
      print_usage();
      exit(0);
    case '?':
      die("Unrecognized option.  Try \"display_rate_matrix -h\" for help.\n");
    }
  }

  set_seed(-1);

  if ((t >= 0 && exch_mode) || (latex_mode && list_mode) || 
      ((ti_tv || subst_mat_fname != NULL || subst_score_fname != NULL || 
        subst_mat_fname_paml != NULL || scientific_mode) && !list_mode) || 
      (subst_mat_fname != NULL && subst_score_fname != NULL) || 
      (subst_score_fname != NULL && subst_mat_fname_paml != NULL) || 
      (subst_mat_fname != NULL && subst_mat_fname_paml != NULL) || 
      optind != argc - 1) {
    die("ERROR: missing required arguments or illegal combination of arguments.\nTry \"display_rate_matrix -h\" for help.\n");
  }

  F = phast_fopen(argv[optind], "r");
  model = tm_new_from_file(F, 1);

  if (context_ti_tv) {
    /* this option requires completely different handling from the others */
    if (model->order != 2) { 
      die("ERROR: -C requires a model of order 3.\n");
    }
    do_context_dependent_ti_tv(model);
    exit(0);
  }

  if (induced_aa) {
    TreeModel *aa_model = tm_induced_aa(model);
    char *codon_to_aa = get_codon_mapping(model->rate_matrix->states);

    /* before freeing model, grab the expected rate of synonymous
       subst, rho_s */
    for (i = 0; i < model->rate_matrix->size; i++)
      for (j = 0; j < model->rate_matrix->size; j++)
        if (i != j && codon_to_aa[i] == codon_to_aa[j])
          rho_s += mm_get(model->rate_matrix, i, j) * 
            vec_get(model->backgd_freqs, i);

    sfree(codon_to_aa);

    tm_free(model);
    model = aa_model;
  }

  if (all_branches) {
    traversal = tr_inorder(model->tree);
    for (matrix_idx = 0; matrix_idx < lst_size(traversal); matrix_idx++) {
      TreeNode *n = lst_get_ptr(traversal, matrix_idx);
      if (n->parent == NULL) { lst_push_ptr(matrix_list, NULL); continue; }
      M = mm_new(model->rate_matrix->size, model->rate_matrix->states, DISCRETE);
      mm_exp(M, model->rate_matrix, n->dparent);
      lst_push_ptr(matrix_list, M);      
    }
  }
  else if (t >= 0) {
    M = mm_new(model->rate_matrix->size, model->rate_matrix->states, DISCRETE);
    mm_exp(M, model->rate_matrix, t);
    lst_push_ptr(matrix_list, M);
  }
  else 
    lst_push_ptr(matrix_list, model->rate_matrix);

  alph_size = (int)strlen(model->rate_matrix->states);
  nstates = model->rate_matrix->size;

  if (subst_mat_fname != NULL) {
    if ((F = fopen(subst_mat_fname, "r")) == NULL) {
      die("ERROR: Can't open %s.\n", subst_mat_fname);
    }    
    subst_mat = read_subst_mat(F, AA_ALPHABET); 
  }
  else if (subst_mat_fname_paml != NULL) {
    if ((F = fopen(subst_mat_fname_paml, "r")) == NULL) {
      die("ERROR: Can't open %s.\n", subst_mat_fname_paml);
    }    
    subst_mat = read_paml_matrix(F, AA_ALPHABET); 
  }
  else if (subst_score_fname != NULL) {
    if ((F = fopen(subst_score_fname, "r")) == NULL) {
      die("ERROR: Can't open %s.\n", subst_score_fname);
    }    
    subst_mat = read_subst_scores(model, F);
  }
  else if (order1_mod_fname != NULL) {
    if ((F = fopen(order1_mod_fname, "r")) == NULL) {
      die("ERROR: Can't open %s.\n", order1_mod_fname);
    }    
    subst_mat = unproject_rates(model, tm_new_from_file(F, 1));
  }

  /* loop through matrices to print */
  for (matrix_idx = 0; matrix_idx < lst_size(matrix_list); matrix_idx++) {
    M = lst_get_ptr(matrix_list, matrix_idx);

    if (all_branches) {
      if (M == NULL) continue;  /* root */
      printf("BRANCH %d (t = %.6f)\n", ++branch_no,
             ((TreeNode*)lst_get_ptr(traversal, matrix_idx))->dparent);
    }

  /* print no more than 16 columns at a time (except with -a) */
  ncols = (induced_aa ? nstates : 16);
  for (startcol = 0; startcol < nstates; startcol += ncols) {
    endcol = min(nstates, startcol+ncols);

    /* table header */
    if (! list_mode) {
      if (latex_mode) {
        printf("\\begin{tabular}{|c|");
        for (i = startcol; i < endcol; i++) printf("r");
        printf("|}\n\\hline\n");
      }
      printf("%-5s ", "");
      if (latex_mode) printf("& ");
      for (i = startcol; i < endcol; i++) {
        get_state_tuple(model, tuple, i);
        if (latex_mode) {
          printf("{\\bf %s}", tuple);
          if (i < endcol-1) printf("& ");
        }
        else printf("%8s ", tuple);
    }
      if (latex_mode) printf("\\\\\n\\hline\n");
      else printf("\n");
    }

    /* table or list contents */
    for (i = 0; i < nstates; i++) {
      if (induced_aa && AA_ALPHABET[i] == '$' && !do_stop_codons) continue;
      get_state_tuple(model, tuple, i);

      /* get total eq freq of tuples containing CpG dinucs */
      for (k = 0; k < model->order; k++) {
        if (tuple[k] == 'C' && tuple[k+1] == 'G') {
          cpg_eqfreq += vec_get(model->backgd_freqs, i);
/*           printf("***CPG***"); */
          break;
        }
      }

      if (latex_mode) printf("{\\bf %s}& ", tuple);
      else if (!list_mode) printf("%-5s ", tuple);
      for (j = startcol; j < endcol; j++) {
        if (induced_aa && AA_ALPHABET[j] == '$' && !do_stop_codons) continue;
        if (latex_mode) printf("$");
        if (list_mode) {
          if (symmetric && j <= i) continue;
          else if ((t < 0 && ! all_branches) 
		   && (i == j || (!do_zeroes && mm_get(M, i, j) == 0))) 
            continue;
          get_state_tuple(model, tuple2, j);
          printf("%-5s %-5s ", tuple, tuple2);
        }
        if (i == j && suppress_diag && !list_mode) printf("%-7s", "-");
        else { 
	  /* get rate or probability */
	  double val = exch_mode == 0 ? mm_get(M, i, j) : 
	    safediv(mm_get(M, i, j), vec_get(model->backgd_freqs,j));
	  /* print value in format %8.6f or %13.6e */
	  printf(rate_format_string, val); 
	  printf(" ");
	}
        if (latex_mode) {
          printf("$");
          if (j < endcol-1) printf("& ");
        }
        else if (list_mode) {
          int ti, is_cpg;
          if (ti_tv) {
            ti = -1;
            is_cpg = 0;
            for (k = 0; k <= model->order; k++) {
              int dig_i = (i % int_pow(alph_size, k+1)) / int_pow(alph_size, k);
              int dig_j = (j % int_pow(alph_size, k+1)) / int_pow(alph_size, k);
              char next_char = '\0', prev_char = '\0';
              if (dig_i != dig_j) {
                ti = is_transition(M->states[dig_i], M->states[dig_j]);
                if (k != model->order)
                  prev_char = M->states[(i % int_pow(alph_size, k+2)) / 
                                        int_pow(alph_size, k+1)];
                if (k != 0)
                  next_char = M->states[(i % int_pow(alph_size, k)) / 
                                        int_pow(alph_size, k-1)];
                if ((M->states[dig_i] == 'C' && next_char == 'G') || 
                    (M->states[dig_i] == 'G' && prev_char == 'C')) 
                  is_cpg = 1;
              }
            }
	    if (ti == -1)
	      die("ERROR ti=-1\n");
            printf("%5s ", ti ? "ti" : "tv");
/*             printf("%5s ", is_cpg ? "CPG" : "-"); */
            if (ti) {
              total_ti += mm_get(M, i, j) * 
                vec_get(model->backgd_freqs, i);
              if (is_cpg) 
                cpg_ti += mm_get(M, i, j) * 
                  vec_get(model->backgd_freqs, i);
              else non_cpg_ti += mm_get(M, i, j) * 
                     vec_get(model->backgd_freqs, i);
            }
            else {
              total_tv += mm_get(M, i, j) * 
                vec_get(model->backgd_freqs, i);
              if (is_cpg)
                cpg_tv += mm_get(M, i, j) * 
                  vec_get(model->backgd_freqs, i);
              else non_cpg_tv += mm_get(M, i, j) * 
                     vec_get(model->backgd_freqs, i);
            }
          }
          if (subst_mat != NULL) {
            if (mat_get(subst_mat, i, j) == NEGINFTY) 
              printf("%8s", "-"); 
            else printf("%8.4f", mat_get(subst_mat, i, j)); 
          }
          printf("\n");
        }
      }
      if (latex_mode) printf("\\\\\n");
      else if (!list_mode) printf("\n");
    }
    
    /* equilibrium freqs (table case only) */
    if (do_eqfreqs && ! list_mode) {
      if (latex_mode) 
        printf("\\hline\n$\\boldsymbol{\\mathbf{\\pi}}$&");
      else 
        printf("%-5s ", "pi");
      for (i = startcol; i < endcol; i++) {
        if (latex_mode) 
          printf("$%8.4f$ ", vec_get(model->backgd_freqs, i));      
        else 
          printf("%8.4f ", vec_get(model->backgd_freqs, i));      
        if (latex_mode && i < endcol-1) printf("& ");
      }
      if (latex_mode) printf("\\\\\n");
      else printf("\n");
    }

    if (latex_mode) printf("\\hline\n\\end{tabular}\n\n");
  }

  /* equilibrium freqs (list case only) */
  if (do_eqfreqs &&  list_mode) {
    for (i = 0; i < nstates; i++) {
      get_state_tuple(model, tuple, i);
      printf("%-5s %-5s ", "-", tuple); //!!
      printf(rate_format_string, vec_get(model->backgd_freqs, i)); 
      printf("\n");
    }
  }
  
  if (ti_tv && list_mode) {
    printf("\n#Total ti/tv = %.4f\n", total_ti/total_tv);
    printf("#CpG ti ratio = %.4f, CpG tv ratio = %.4f\n", 
           cpg_ti/non_cpg_ti /* * (1 - cpg_eqfreq) */ / cpg_eqfreq, 
           cpg_tv/non_cpg_tv /* * (1 - cpg_eqfreq) */ / cpg_eqfreq);
  }
  else if (induced_aa) 
    printf("\n#Total rho_s/rho_v = %.4f\n", rho_s/(3-rho_s));

  if (all_branches == 1) printf("\n\n");
  }

  tm_free(model);
  lst_free(matrix_list);

  return 0;
}