i2s: Allow recording to multiple files This simply abuses the PCMEncoder class to change the output filename using an indexing scheme each time it is restarted using the CSR. Change-Id: Ic2d393b5c2c6a732d36de5869540b51d251f9a7c
diff --git a/shodan_infrastructure/MatchaI2S.cs b/shodan_infrastructure/MatchaI2S.cs index be3a3da..bee1cbf 100644 --- a/shodan_infrastructure/MatchaI2S.cs +++ b/shodan_infrastructure/MatchaI2S.cs
@@ -16,6 +16,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Diagnostics; using System.IO; using System.Linq; using System.Text; @@ -210,7 +211,8 @@ this.Log(LogLevel.Info, "Starting playback."); encoder = new PCMEncoder(SampleSizeBits, SampleFrequencyHz, NumChannels, false); - encoder.Output = OutputFile; + encoder.Output = OutputFile + String.Format(".{0}.{1:d4}", + Process.GetCurrentProcess().Id, outputFileIdx++); encoder.SetBufferingBySamplesCount(1); txThread = machine.ObtainManagedThread(TransmitFrame, SampleFrequencyHz); @@ -420,6 +422,7 @@ private int mappedRxTriggerLevel; private int mappedTxTriggerLevel; + private int outputFileIdx; private IManagedThread rxThread; private IManagedThread txThread;