Beispiel #1
0
        // private void MilkThread()
        // {
        //  Thread.Sleep(2000);
        //  int frameCount = 0;
        //  // Session pull loop.
        //  while (running)
        //  {
        //      if (milkFramesToSave.TryPop(out Frame frame))
        //      {
        //          if (milkData == null)
        //          {
        //              milkData = new Milk(frame);
        //          }
        //          else
        //          {
        //              milkData.AddFrame(frame);
        //          }
        //
        //          frameCount++;
        //      }
        //
        //      // only save every once in a while
        //      if (frameCount > 200)
        //      {
        //          frameCount = 0;
        //          string filePath = Path.Combine(SparkSettings.instance.saveFolder, fileName + ".milk");
        //          File.WriteAllBytes(filePath, milkData.GetBytes());
        //      }
        //
        //      Thread.Sleep(fullDeltaTimes[SparkSettings.instance.targetDeltaTimeIndexFull]);
        //  }
        // }


        private void AddButterFrame(Frame f)
        {
            if (!SparkSettings.instance.enableFullLogging)
            {
                return;
            }
            if (!SparkSettings.instance.saveButterFiles)
            {
                return;
            }

            if (frameIndex % FrameInterval != 0)
            {
                return;
            }

            butter.AddFrame(f);

            // write the whole file every chunk
            // at 300 frames/chunk this is every 10 seconds
            if (butter.NumChunks() - lastButterNumChunks > 1)
            {
                WriteOutButterFile();
                lastButterNumChunks = butter.NumChunks();
            }
        }