/* ------------------------------------------------------------
copyright: "Copyright (c) 2024 Punk Labs LLC"
license: "GPLv3 (or later)"
name: "OneTrick B-BOI DSP"
Code generated with Faust 2.74.6 (https://faust.grame.fr)
Compilation options: -a arch.rs -lang rust -ct 0 -cn DSP_Sampler -dtl 65536 -es 1 -mcd 16 -mdd 1024 -mdy 33 -single -ftz 0
------------------------------------------------------------ */
use faust_types::*;
use onetrick::faust::FaustDspExtended;



fn DSP_Sampler_faustpower2_f(value: F32) -> F32 {
	return value * value;
}
mod ffi {
	use std::os::raw::{c_float};
	// Conditionally compile the link attribute only on non-Windows platforms
	#[cfg_attr(not(target_os="windows"), link(name="m"))]
	extern {
		pub fn remainderf(from: c_float, to: c_float) -> c_float;
		pub fn rintf(val: c_float) -> c_float;
	}
}
fn remainder_f32(from: f32, to: f32) -> f32 {
	unsafe { ffi::remainderf(from, to) }
}
fn rint_f32(val: f32) -> f32 {
	unsafe { ffi::rintf(val) }
}

#[cfg_attr(feature = "default-boxed", derive(default_boxed::DefaultBoxed))]
#[repr(C)]
pub struct DSP_Sampler {
	fButton0: F32,
	fVec0: [F32;2],
	fSampleRate: i32,
	fConst0: F32,
	fConst1: F32,
	fConst2: F32,
	fHslider0: F32,
	fRec0: [F32;2],
	fConst3: F32,
	fHslider1: F32,
	fRec1: [F32;2],
	fEntry0: F32,
	fVec1: [F32;2],
	iVec2: [i32;2],
	iVec3: [i32;2],
	iRec3: [i32;2],
	fConst4: F32,
	fConst5: F32,
	fEntry1: F32,
	fVec4: [F32;2],
	iRec6: [i32;2],
	fEntry2: F32,
	fEntry3: F32,
	fHslider2: F32,
	fRec7: [F32;2],
	fEntry4: F32,
	fRec5: [F32;2],
	fConst6: F32,
	fVec5: [F32;3],
	fRec4: [F32;2],
	fRec8: [F32;2],
	fEntry5: F32,
	fRec9: [F32;2],
	fRec2: [F32;3],
	fHslider3: F32,
	fConst7: F32,
	fHslider4: F32,
	fConst8: F32,
	fHslider5: F32,
	fRec11: [F32;3],
	fRec10_widx: i32,
	fRec10: [F32;96002],
	fHslider6: F32,
	fRec12: [F32;2],
}

impl FaustDsp for DSP_Sampler {
	type T = F32;
		
	fn new() -> DSP_Sampler { 
		DSP_Sampler {
			fButton0: 0.0,
			fVec0: [0.0;2],
			fSampleRate: 0,
			fConst0: 0.0,
			fConst1: 0.0,
			fConst2: 0.0,
			fHslider0: 0.0,
			fRec0: [0.0;2],
			fConst3: 0.0,
			fHslider1: 0.0,
			fRec1: [0.0;2],
			fEntry0: 0.0,
			fVec1: [0.0;2],
			iVec2: [0;2],
			iVec3: [0;2],
			iRec3: [0;2],
			fConst4: 0.0,
			fConst5: 0.0,
			fEntry1: 0.0,
			fVec4: [0.0;2],
			iRec6: [0;2],
			fEntry2: 0.0,
			fEntry3: 0.0,
			fHslider2: 0.0,
			fRec7: [0.0;2],
			fEntry4: 0.0,
			fRec5: [0.0;2],
			fConst6: 0.0,
			fVec5: [0.0;3],
			fRec4: [0.0;2],
			fRec8: [0.0;2],
			fEntry5: 0.0,
			fRec9: [0.0;2],
			fRec2: [0.0;3],
			fHslider3: 0.0,
			fConst7: 0.0,
			fHslider4: 0.0,
			fConst8: 0.0,
			fHslider5: 0.0,
			fRec11: [0.0;3],
			fRec10_widx: 0,
			fRec10: [0.0;96002],
			fHslider6: 0.0,
			fRec12: [0.0;2],
		}
	}
	fn metadata(&self, m: &mut dyn Meta) { 
		m.declare("basics.lib/name", r"Faust Basic Element Library");
		m.declare("basics.lib/sAndH:author", r"Romain Michon");
		m.declare("basics.lib/tabulateNd", r"Copyright (C) 2023 Bart Brouns <bart@magnetophon.nl>");
		m.declare("basics.lib/version", r"1.18.0");
		m.declare("compile_options", r"-a arch.rs -lang rust -ct 0 -cn DSP_Sampler -dtl 65536 -es 1 -mcd 16 -mdd 1024 -mdy 33 -single -ftz 0");
		m.declare("copyright", r"Copyright (c) 2024 Punk Labs LLC");
		m.declare("delays.lib/name", r"Faust Delay Library");
		m.declare("delays.lib/version", r"1.1.0");
		m.declare("envelopes.lib/ar:author", r"Yann Orlarey, Stéphane Letz");
		m.declare("envelopes.lib/author", r"GRAME");
		m.declare("envelopes.lib/copyright", r"GRAME");
		m.declare("envelopes.lib/license", r"LGPL with exception");
		m.declare("envelopes.lib/name", r"Faust Envelope Library");
		m.declare("envelopes.lib/version", r"1.3.0");
		m.declare("filename", r"sampler.dsp");
		m.declare("filters.lib/fir:author", r"Julius O. Smith III");
		m.declare("filters.lib/fir:copyright", r"Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m.declare("filters.lib/fir:license", r"MIT-style STK-4.3 license");
		m.declare("filters.lib/iir:author", r"Julius O. Smith III");
		m.declare("filters.lib/iir:copyright", r"Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m.declare("filters.lib/iir:license", r"MIT-style STK-4.3 license");
		m.declare("filters.lib/lowpass0_highpass1", r"MIT-style STK-4.3 license");
		m.declare("filters.lib/lowpass0_highpass1:author", r"Julius O. Smith III");
		m.declare("filters.lib/lowpass:author", r"Julius O. Smith III");
		m.declare("filters.lib/lowpass:copyright", r"Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m.declare("filters.lib/lowpass:license", r"MIT-style STK-4.3 license");
		m.declare("filters.lib/name", r"Faust Filters Library");
		m.declare("filters.lib/resonlp:author", r"Julius O. Smith III");
		m.declare("filters.lib/resonlp:copyright", r"Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m.declare("filters.lib/resonlp:license", r"MIT-style STK-4.3 license");
		m.declare("filters.lib/tf2:author", r"Julius O. Smith III");
		m.declare("filters.lib/tf2:copyright", r"Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m.declare("filters.lib/tf2:license", r"MIT-style STK-4.3 license");
		m.declare("filters.lib/tf2s:author", r"Julius O. Smith III");
		m.declare("filters.lib/tf2s:copyright", r"Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
		m.declare("filters.lib/tf2s:license", r"MIT-style STK-4.3 license");
		m.declare("filters.lib/version", r"1.3.0");
		m.declare("interpolators.lib/interpolate_linear:author", r"Stéphane Letz");
		m.declare("interpolators.lib/interpolate_linear:licence", r"MIT");
		m.declare("interpolators.lib/name", r"Faust Interpolator Library");
		m.declare("interpolators.lib/version", r"1.3.1");
		m.declare("license", r"GPLv3 (or later)");
		m.declare("maths.lib/author", r"GRAME");
		m.declare("maths.lib/copyright", r"GRAME");
		m.declare("maths.lib/license", r"LGPL with exception");
		m.declare("maths.lib/name", r"Faust Math Library");
		m.declare("maths.lib/version", r"2.8.0");
		m.declare("name", r"OneTrick B-BOI DSP");
		m.declare("onetrick.lib/copyright", r"Copyright (c) 2023 Punk Labs LLC");
		m.declare("onetrick.lib/license", r"GPLv3 (or later)");
		m.declare("onetrick.lib/name", r"OneTrick DSP Library");
		m.declare("params.lib/copyright", r"Copyright (c) 2023 Punk Labs LLC");
		m.declare("params.lib/license", r"GPLv3 (or later)");
		m.declare("params.lib/name", r"OneTrick B-BOI DSP");
		m.declare("platform.lib/name", r"Generic Platform Library");
		m.declare("platform.lib/version", r"1.3.0");
		m.declare("shared.lib/copyright", r"Copyright (c) 2024 Punk Labs LLC");
		m.declare("shared.lib/license", r"GPLv3 (or later)");
		m.declare("shared.lib/name", r"OneTrick B-BOI DSP");
		m.declare("signals.lib/name", r"Faust Signal Routing Library");
		m.declare("signals.lib/version", r"1.5.0");
	}

	fn get_sample_rate(&self) -> i32 {
		return self.fSampleRate;
	}
	fn get_num_inputs(&self) -> i32 {
		return 0;
	}
	fn get_num_outputs(&self) -> i32 {
		return 2;
	}
	
	fn class_init(sample_rate: i32) {
	}
	fn instance_reset_params(&mut self) {
		self.fButton0 = 0.0;
		self.fHslider0 = 2e+01;
		self.fHslider1 = 0.0;
		self.fEntry0 = 0.0;
		self.fEntry1 = 0.0;
		self.fEntry2 = 0.0;
		self.fEntry3 = 0.0;
		self.fHslider2 = 0.0;
		self.fEntry4 = 36.0;
		self.fEntry5 = 0.0;
		self.fHslider3 = 2.5;
		self.fHslider4 = 2e+02;
		self.fHslider5 = 0.0;
		self.fHslider6 = 0.0;
	}
	fn instance_clear(&mut self) {
		for l0 in 0..2 {
			self.fVec0[l0 as usize] = 0.0;
		}
		for l1 in 0..2 {
			self.fRec0[l1 as usize] = 0.0;
		}
		for l2 in 0..2 {
			self.fRec1[l2 as usize] = 0.0;
		}
		for l3 in 0..2 {
			self.fVec1[l3 as usize] = 0.0;
		}
		for l4 in 0..2 {
			self.iVec2[l4 as usize] = 0;
		}
		for l5 in 0..2 {
			self.iVec3[l5 as usize] = 0;
		}
		for l6 in 0..2 {
			self.iRec3[l6 as usize] = 0;
		}
		for l7 in 0..2 {
			self.fVec4[l7 as usize] = 0.0;
		}
		for l8 in 0..2 {
			self.iRec6[l8 as usize] = 0;
		}
		for l9 in 0..2 {
			self.fRec7[l9 as usize] = 0.0;
		}
		for l10 in 0..2 {
			self.fRec5[l10 as usize] = 0.0;
		}
		for l11 in 0..3 {
			self.fVec5[l11 as usize] = 0.0;
		}
		for l12 in 0..2 {
			self.fRec4[l12 as usize] = 0.0;
		}
		for l13 in 0..2 {
			self.fRec8[l13 as usize] = 0.0;
		}
		for l14 in 0..2 {
			self.fRec9[l14 as usize] = 0.0;
		}
		for l15 in 0..3 {
			self.fRec2[l15 as usize] = 0.0;
		}
		for l16 in 0..3 {
			self.fRec11[l16 as usize] = 0.0;
		}
		for l17 in 0..96002 {
			self.fRec10[l17 as usize] = 0.0;
		}
		for l18 in 0..2 {
			self.fRec12[l18 as usize] = 0.0;
		}
	}
	fn instance_constants(&mut self, sample_rate: i32) {
		self.fSampleRate = sample_rate;
		self.fConst0 = F32::min(1.92e+05, F32::max(1.0, (self.fSampleRate) as F32));
		self.fConst1 = F32::exp(-(1e+02 / self.fConst0));
		self.fConst2 = 0.5 * self.fConst0;
		self.fConst3 = 3.1415927 / self.fConst0;
		self.fConst4 = 0.0002 * self.fConst0;
		self.fConst5 = 1.0 / F32::max(1.0, self.fConst4);
		self.fConst6 = 1.0 / self.fConst0;
		self.fConst7 = 3141.5928 / self.fConst0;
		self.fConst8 = 0.001 * self.fConst0;
		self.fRec10_widx = 0;
	}
	fn instance_init(&mut self, sample_rate: i32) {
		self.instance_constants(sample_rate);
		self.instance_reset_params();
		self.instance_clear();
	}
	fn init(&mut self, sample_rate: i32) {
		DSP_Sampler::class_init(sample_rate);
		self.instance_init(sample_rate);
	}
	
	fn build_user_interface(&self, ui_interface: &mut dyn UI<Self::T>) {
		Self::build_user_interface_static(ui_interface);
	}
	
	fn build_user_interface_static(ui_interface: &mut dyn UI<Self::T>) {
		ui_interface.open_vertical_box("OneTrick B-BOI DSP");
		ui_interface.add_num_entry("PitchWheel", ParamIndex(0), 0.0, -1.0, 1.0, 0.001);
		ui_interface.add_num_entry("SampleIndex", ParamIndex(1), 0.0, 0.0, 1e+02, 1.0);
		ui_interface.add_num_entry("Transpose", ParamIndex(2), 0.0, -48.0, 48.0, 0.001);
		ui_interface.add_num_entry("Trigger", ParamIndex(3), 0.0, 0.0, 1.0, 0.01);
		ui_interface.add_button("WakeUp", ParamIndex(4));
		ui_interface.declare(Some(ParamIndex(5)), "1010", "");
		ui_interface.declare(Some(ParamIndex(5)), "export", "Lowpass");
		ui_interface.declare(Some(ParamIndex(5)), "group", "Voice");
		ui_interface.declare(Some(ParamIndex(5)), "unit", "kHz");
		ui_interface.add_horizontal_slider("Voice_Lowpass", ParamIndex(5), 2e+01, 1.0, 2e+01, 0.01);
		ui_interface.declare(Some(ParamIndex(6)), "1020", "");
		ui_interface.declare(Some(ParamIndex(6)), "export", "Transpose");
		ui_interface.declare(Some(ParamIndex(6)), "group", "Voice");
		ui_interface.declare(Some(ParamIndex(6)), "unit", "st");
		ui_interface.add_horizontal_slider("Voice_Transpose", ParamIndex(6), 0.0, -24.0, 24.0, 0.01);
		ui_interface.declare(Some(ParamIndex(7)), "1030", "");
		ui_interface.declare(Some(ParamIndex(7)), "export", "Delay Amount");
		ui_interface.declare(Some(ParamIndex(7)), "group", "Voice");
		ui_interface.declare(Some(ParamIndex(7)), "unit", "%");
		ui_interface.add_horizontal_slider("Voice_DelayAmount", ParamIndex(7), 0.0, 0.0, 9e+01, 0.01);
		ui_interface.declare(Some(ParamIndex(8)), "1040", "");
		ui_interface.declare(Some(ParamIndex(8)), "export", "Delay MS");
		ui_interface.declare(Some(ParamIndex(8)), "group", "Voice");
		ui_interface.declare(Some(ParamIndex(8)), "unit", "ms");
		ui_interface.add_horizontal_slider("Voice_DelayMS", ParamIndex(8), 2e+02, 5e+01, 5e+02, 0.01);
		ui_interface.declare(Some(ParamIndex(9)), "1050", "");
		ui_interface.declare(Some(ParamIndex(9)), "export", "Delay Lowpass");
		ui_interface.declare(Some(ParamIndex(9)), "group", "Voice");
		ui_interface.declare(Some(ParamIndex(9)), "unit", "kHz");
		ui_interface.add_horizontal_slider("Voice_DelayCutoff", ParamIndex(9), 2.5, 1.0, 5.0, 0.01);
		ui_interface.declare(Some(ParamIndex(10)), "110", "");
		ui_interface.declare(Some(ParamIndex(10)), "export", "Gain");
		ui_interface.declare(Some(ParamIndex(10)), "group", "Mix");
		ui_interface.declare(Some(ParamIndex(10)), "unit", "dB");
		ui_interface.add_horizontal_slider("Mix_Gain", ParamIndex(10), 0.0, -1e+02, 6.0, 0.1);
		ui_interface.declare(Some(ParamIndex(11)), "120", "");
		ui_interface.declare(Some(ParamIndex(11)), "export", "Pan");
		ui_interface.declare(Some(ParamIndex(11)), "group", "Mix");
		ui_interface.declare(Some(ParamIndex(11)), "unit", "%");
		ui_interface.add_horizontal_slider("Mix_Pan", ParamIndex(11), 0.0, -1e+02, 1e+02, 0.01);
		ui_interface.add_num_entry("gain", ParamIndex(12), 0.0, 0.0, 1.0, 0.01);
		ui_interface.add_num_entry("key", ParamIndex(13), 36.0, 0.0, 128.0, 1.0);
		ui_interface.close_box();
	}
	
	fn get_param(&self, param: ParamIndex) -> Option<Self::T> {
		match param.0 {
			4 => Some(self.fButton0),
			3 => Some(self.fEntry0),
			1 => Some(self.fEntry1),
			0 => Some(self.fEntry2),
			2 => Some(self.fEntry3),
			13 => Some(self.fEntry4),
			12 => Some(self.fEntry5),
			5 => Some(self.fHslider0),
			10 => Some(self.fHslider1),
			6 => Some(self.fHslider2),
			9 => Some(self.fHslider3),
			8 => Some(self.fHslider4),
			7 => Some(self.fHslider5),
			11 => Some(self.fHslider6),
			_ => None,
		}
	}
	
	fn set_param(&mut self, param: ParamIndex, value: Self::T) {
		match param.0 {
			4 => { self.fButton0 = value }
			3 => { self.fEntry0 = value }
			1 => { self.fEntry1 = value }
			0 => { self.fEntry2 = value }
			2 => { self.fEntry3 = value }
			13 => { self.fEntry4 = value }
			12 => { self.fEntry5 = value }
			5 => { self.fHslider0 = value }
			10 => { self.fHslider1 = value }
			6 => { self.fHslider2 = value }
			9 => { self.fHslider3 = value }
			8 => { self.fHslider4 = value }
			7 => { self.fHslider5 = value }
			11 => { self.fHslider6 = value }
			_ => {}
		}
	}
	
	fn compute(&mut self, count: i32, inputs: &[&[Self::T]], outputs: &mut[&mut[Self::T]]) {
		let (outputs0, outputs1) = if let [outputs0, outputs1, ..] = outputs {
			let outputs0 = outputs0[..count as usize].iter_mut();
			let outputs1 = outputs1[..count as usize].iter_mut();
			(outputs0, outputs1)
		} else {
			panic!("wrong number of outputs");
		};
		let mut fSlow0: F32 = self.fButton0;
		let mut fSlow1: F32 = F32::min(self.fConst2, 1e+03 * self.fHslider0);
		let mut fSlow2: F32 = F32::max(-1e+02, self.fHslider1);
		let mut fSlow3: F32 = self.fEntry0;
		let mut fSlow4: F32 = self.fEntry1;
		let mut iSlow5: i32 = (fSlow4) as i32;
		let mut fSlow6: F32 = self.fHslider2 + self.fEntry3 + 12.0 * self.fEntry2;
		let mut fSlow7: F32 = self.fEntry4;
		let mut fSlow8: F32 = self.fEntry5;
		let mut fSlow9: F32 = F32::tan(self.fConst7 * self.fHslider3);
		let mut fSlow10: F32 = 2.0 * (1.0 - 1.0 / DSP_Sampler_faustpower2_f(fSlow9));
		let mut fSlow11: F32 = 1.0 / fSlow9;
		let mut fSlow12: F32 = (fSlow11 + -1.4142135) / fSlow9 + 1.0;
		let mut fSlow13: F32 = 1.0 / ((fSlow11 + 1.4142135) / fSlow9 + 1.0);
		let mut iSlow14: i32 = i32::wrapping_add((F32::min(9.6e+04, F32::max(0.0, self.fConst8 * self.fHslider4))) as i32, 1);
		let mut fSlow15: F32 = 0.01 * self.fHslider5;
		let mut fSlow16: F32 = 0.01 * self.fHslider6;
		let zipped_iterators = outputs0.zip(outputs1);
		for (output0, output1) in zipped_iterators {
			self.fVec0[0] = fSlow0;
			let mut fTemp0: F32 = ((fSlow0 <= self.fVec0[1]) as i32) as u32 as F32;
			let mut fTemp1: F32 = 1.0 - self.fConst1 * fTemp0;
			self.fRec0[0] = fSlow1 * fTemp1 + self.fConst1 * fTemp0 * self.fRec0[1];
			let mut fTemp2: F32 = F32::tan(self.fConst3 * self.fRec0[0]);
			let mut fTemp3: F32 = 1.0 / fTemp2;
			let mut fTemp4: F32 = (fTemp3 + 0.8333333) / fTemp2 + 1.0;
			self.fRec1[0] = fSlow2 * fTemp1 + self.fConst1 * fTemp0 * self.fRec1[1];
			self.fVec1[0] = fSlow3;
			let mut iTemp5: i32 = (fSlow3 > self.fVec1[1]) as i32;
			self.iVec2[0] = iTemp5;
			let mut iTemp6: i32 = (iTemp5 > self.iVec2[1]) as i32;
			self.iVec3[0] = iTemp6;
			self.iRec3[0] = ((iTemp6 > self.iVec3[1]) as i32) + ((iTemp6 <= self.iVec3[1]) as i32) * (i32::wrapping_add(self.iRec3[1], (self.iRec3[1] > 0) as i32));
			let mut fTemp7: F32 = (self.iRec3[0]) as F32;
			let mut fTemp8: F32 = F32::max(0.0, F32::min(fTemp7, self.fConst5 * (1.0 - fTemp7) + 1.0));
			let mut fTemp9: F32 = 1.0 - fTemp8;
			self.fVec4[0] = fSlow4;
			self.iRec6[0] = if ((fSlow4 != self.fVec4[1]) as i32) + ((iTemp5 != self.iVec2[1]) as i32) != 0 {(iTemp5 < self.iVec2[1]) as i32} else {self.iRec6[1]};
			self.fRec7[0] = fSlow6 * fTemp1 + self.fConst1 * fTemp0 * self.fRec7[1];
			self.fRec5[0] = if (self.iRec6[0] > 0) as i32 != 0 {self.fRec5[1] + F32::powf(2.0, 0.083333336 * (fSlow7 + self.fRec7[0]))} else {0.0};
			let mut fTemp10: F32 = self__read_sample_nearest(iSlow5, 0, self.fConst6 * self.fRec5[0], 0);
			self.fVec5[0] = fTemp10;
			self.fRec4[0] = if iTemp6 != 0 {self.fVec5[1] - self.fVec5[2]} else {self.fRec4[1]};
			self.fRec8[0] = if iTemp6 != 0 {self.fVec5[1]} else {self.fRec8[1]};
			let mut fTemp11: F32 = fTemp8 * (self.fRec8[0] + self.fConst4 * self.fRec4[0] * fTemp9);
			self.fRec9[0] = if iTemp5 != 0 {fSlow3} else {self.fRec9[1]};
			self.fRec2[0] = 0.5011872 * F32::max(fSlow8, self.fRec9[0]) * (fTemp11 + fTemp9 * (fTemp10 - fTemp11)) - (self.fRec2[2] * ((fTemp3 + -0.8333333) / fTemp2 + 1.0) + 2.0 * self.fRec2[1] * (1.0 - 1.0 / DSP_Sampler_faustpower2_f(fTemp2))) / fTemp4;
			let mut fTemp12: F32 = (self.fRec2[2] + self.fRec2[0] + 2.0 * self.fRec2[1]) * F32::powf(1e+01, 0.05 * self.fRec1[0]) / fTemp4;
			let mut fRec10_ridx_tmp0: i32 = i32::wrapping_sub(self.fRec10_widx, iSlow14);
			self.fRec11[0] = fSlow15 * self.fRec10[(if (fRec10_ridx_tmp0 < 0) as i32 != 0 {i32::wrapping_add(fRec10_ridx_tmp0, 96002)} else {fRec10_ridx_tmp0}) as usize] - fSlow13 * (fSlow12 * self.fRec11[2] + fSlow10 * self.fRec11[1]);
			let mut fRec10_widx_tmp: i32 = self.fRec10_widx;
			self.fRec10[fRec10_widx_tmp as usize] = fTemp12 + fSlow13 * (self.fRec11[2] + self.fRec11[0] + 2.0 * self.fRec11[1]);
			let mut fRec10_ridx_tmp1: i32 = self.fRec10_widx;
			let mut fTemp13: F32 = self.fRec10[(if (fRec10_ridx_tmp1 < 0) as i32 != 0 {i32::wrapping_add(fRec10_ridx_tmp1, 96002)} else {fRec10_ridx_tmp1}) as usize] + fTemp12;
			self.fRec12[0] = fSlow16 * fTemp1 + self.fConst1 * fTemp0 * self.fRec12[1];
			*output0 = F32::min(1.0, 1.0 - self.fRec12[0]) * fTemp13;
			*output1 = F32::min(1.0, self.fRec12[0] + 1.0) * fTemp13;
			self.fVec0[1] = self.fVec0[0];
			self.fRec0[1] = self.fRec0[0];
			self.fRec1[1] = self.fRec1[0];
			self.fVec1[1] = self.fVec1[0];
			self.iVec2[1] = self.iVec2[0];
			self.iVec3[1] = self.iVec3[0];
			self.iRec3[1] = self.iRec3[0];
			self.fVec4[1] = self.fVec4[0];
			self.iRec6[1] = self.iRec6[0];
			self.fRec7[1] = self.fRec7[0];
			self.fRec5[1] = self.fRec5[0];
			self.fVec5[2] = self.fVec5[1];
			self.fVec5[1] = self.fVec5[0];
			self.fRec4[1] = self.fRec4[0];
			self.fRec8[1] = self.fRec8[0];
			self.fRec9[1] = self.fRec9[0];
			self.fRec2[2] = self.fRec2[1];
			self.fRec2[1] = self.fRec2[0];
			self.fRec11[2] = self.fRec11[1];
			self.fRec11[1] = self.fRec11[0];
			fRec10_widx_tmp = i32::wrapping_add(fRec10_widx_tmp, 1);
			fRec10_widx_tmp = if (fRec10_widx_tmp == 96002) as i32 != 0 {0} else {fRec10_widx_tmp};
			self.fRec10_widx = fRec10_widx_tmp;
			self.fRec12[1] = self.fRec12[0];
		}
	}

}

