public void TestInvert() { var samples = new double[] { -1, 2, 3, -4 }; var output = WaveMath.Invert(samples); Assert.IsTrue(output.SequenceEqual(new double[] { -4, 3, 2, -1 })); samples = new double[] { }; output = WaveMath.Invert(samples); Assert.IsTrue(output.SequenceEqual(new double[] { })); output = WaveMath.Invert(null); Assert.IsNull(output); }
/// <summary> /// Executes the block /// </summary> public override void Execute() { var inputNode = InputNodes[0].ConnectingNode as BlockOutputNode; if (inputNode == null || inputNode.Object == null) { return; } OutputNodes[0].Object.Clear(); foreach (var signal in inputNode.Object) { var output = signal.Copy(); var samples = WaveMath.Invert(signal.Samples); output.Samples = samples; OutputNodes[0].Object.Add(output); } if (Cascade && OutputNodes[0].ConnectingNode != null) { OutputNodes[0].ConnectingNode.Root.Execute(); } }