public void TestSetProgram() { var controller = new UnsafeReverbController(48000); var dict = JsonConvert.DeserializeObject <Dictionary <string, double> >(program2); //dict["DiffusionEnabled"] = 0.0; foreach (var kvp in dict) { Parameter param; var ok = Enum.TryParse(kvp.Key, out param); if (ok) { controller.SetParameter(param, kvp.Value); } } controller.ClearBuffers(); var inputLArr = new double[64]; var inputRArr = new double[64]; var outputLArr = new double[64]; var outputRArr = new double[64]; var input = new IntPtr[2]; var output = new IntPtr[2]; unsafe { fixed(double *inL = inputLArr) fixed(double *inR = inputLArr) fixed(double *outL = outputLArr) fixed(double *outR = outputRArr) fixed(IntPtr * ins = input) fixed(IntPtr * outs = output) { inL[0] = 1.0; inR[0] = 1.0; ins[0] = (IntPtr)inL; ins[1] = (IntPtr)inR; outs[0] = (IntPtr)outL; outs[1] = (IntPtr)outR; for (int i = 0; i < 1; i++) { controller.Process((IntPtr)ins, (IntPtr)outs, 64); inL[0] = 0.0; inR[0] = 0.0; } } } Console.WriteLine("Disposing"); controller.Dispose(); }
public void TestSetProgram() { var controller = new UnsafeReverbController(48000); var dict = JsonConvert.DeserializeObject<Dictionary<string, double>>(program2); //dict["DiffusionEnabled"] = 0.0; foreach (var kvp in dict) { Parameter param; var ok = Enum.TryParse(kvp.Key, out param); if (ok) { controller.SetParameter(param, kvp.Value); } } controller.ClearBuffers(); var inputLArr = new double[64]; var inputRArr = new double[64]; var outputLArr = new double[64]; var outputRArr = new double[64]; var input = new IntPtr[2]; var output = new IntPtr[2]; unsafe { fixed (double* inL = inputLArr) fixed (double* inR = inputLArr) fixed (double* outL = outputLArr) fixed (double* outR = outputRArr) fixed (IntPtr* ins = input) fixed (IntPtr* outs = output) { inL[0] = 1.0; inR[0] = 1.0; ins[0] = (IntPtr)inL; ins[1] = (IntPtr)inR; outs[0] = (IntPtr)outL; outs[1] = (IntPtr)outR; for (int i = 0; i < 1; i++) { controller.Process((IntPtr)ins, (IntPtr)outs, 64); inL[0] = 0.0; inR[0] = 0.0; } } } Console.WriteLine("Disposing"); controller.Dispose(); }
public void TestCreate() { var rev = new UnsafeReverbController(48000); rev.Dispose(); }