private void genericFilter1_ProcessData(object Sender, Mitov.SignalLab.ProcessBlockNotifyArgs Args) { try { // wavePlayer1.Enabled = false; //wavePlayer1.Stop(); if (!wavePlayer1.FileName.Contains('-')) { index = -1; basefilename = wavePlayer1.FileName; size = (int)Args.InBuffer.GetSize(); if (size > 2048) size = 2048; for (int i = 0; i < size; i++) { basesignal[i] = Args.InBuffer[i]; } convolve(basesignal, Args.InBuffer); wavePlayer1.FileName = wavePlayer1.FileName.Substring(0, wavePlayer1.FileName.Length - 4) + index + ".wav"; // wavePlayer1.Enabled = true; wavePlayer1.Start(); } else { convolve(basesignal, Args.InBuffer); index--; if (index < -9) { output(Result); Application.Exit(); } wavePlayer1.FileName = wavePlayer1.FileName.Substring(0, wavePlayer1.FileName.Length - 6) + index + ".wav"; //wavePlayer1.Start(); wavePlayer1.Enabled = true; wavePlayer1.Start(); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private void convolve(double[] basesignal, Mitov.SignalLab.BlockBuffer blockBuffer) { int samples=0; for (int offset = 0; offset < size; offset++) { Result[row, offset] = 0.0d; samples = 0; for (int i = 0; i < Math.Min(size, blockBuffer.GetSize()); i++) { int offsetPos = i + offset - (size / 2); if (offsetPos >= 0 && offsetPos < blockBuffer.GetSize()) { Result[row, offset] += basesignal[i] * blockBuffer[offsetPos]; } samples++; } Result[row, offset] = Result[row, offset] / samples; } row++; }
private void genericFilter1_ProcessData(object Sender, Mitov.VideoLab.ProcessVideoNotifyArgs Args) { aux = new Bitmap(Args.InBuffer.ToBitmap(), new Size(150, 150)); pictureBox1.Image = aux; genericFilter1.Enabled = false; }