Example #1
0
 public void TransferFftData(NextFftEventArgs e)
 {
     currentState = e;
     if (displayWindow != null)
     {
         displayWindow.currentState = currentState;
         //Task update = new Task(new Action(() =>
         //{
         //    //displayWindow.Update();
         //    //displayWindow.Render();
         //}));
         //update.Start();
         latencyMax -= 0.1;
         if (e.BufferMilliseconds > latencyMax)
         {
             latencyMax = e.BufferMilliseconds;
         }
         if (currentState.BufferLength == 0)
         {
             displayWindow.Title = (int)latencyMax + "ms*";
         }
         else
         {
             displayWindow.Title = (int)latencyMax + "ms";
         }
     }
 }
Example #2
0
 static void NextFft(object sender, NextFftEventArgs e)
 {
     visualizer.TransferFftData(e);
     if (!visualizer.Enabled)
     {
         bg_worker.Dispose();
     }
 }
Example #3
0
 public void TransferFftData(NextFftEventArgs e)
 {
     try
     {
         currentState = e;
         if (keyboardIO != null)
         {
             keyboardIO.currentState = currentState;
             latencyMax -= 0.1;
             keyboardIO.Update();
         }
     }
     catch (Exception _e)
     {
         Console.WriteLine(_e.ToString());
         Console.ReadLine();
     }
 }
        public void NextFft(object sender, NextFftEventArgs e)
        {
            currentState = e;
            foreach (IVisualizer vis in visualizers)
            {
                vis.TransferFftData(e);
            }
            amplitudeMax *= amplitudeDecay;
            if (amplitudeMax < e.Volume)
            {
                amplitudeMax = e.Volume;
            }
            double h = (Math.Sqrt(amplitudeMax) * -150 + 240) % 360;

            if (h < 0)
            {
                h += 360;
            }
            latencyAvg = (latencyAvg * 20 + e.BufferMilliseconds) / 21;
            this.Dispatcher.Invoke(() =>
            {
                ((SolidColorBrush)MainWpfWindow.Resources["BackgroundColor"]).Color = ColorFromHsb((int)(h), 1, .5f);
                if (e.BufferLength == 0)
                {
                    LatencyLabel.Content = (int)latencyAvg + "ms*";
                }
                else
                {
                    LatencyLabel.Content = (int)latencyAvg + "ms";
                }
            });
            int    index = 0;
            double max   = 0;;

            for (int i = 1; i < e.ResultLength; i++)
            {
                if (e.FftData[i] > max)
                {
                    max   = e.FftData[i];
                    index = i;
                }
            }
            var process = new Process();
        }
Example #5
0
        public void TransferFftData(NextFftEventArgs e)
        {
            currentState = e;
            if (displayWindow != null)
            {
                displayWindow.currentState = currentState;
                displayWindow.Update();

                //latencyMax -= 0.1;
                //if (e.BufferMilliseconds > latencyMax) latencyMax = e.BufferMilliseconds;
                latencyMax = e.BufferMilliseconds;

                if (currentState.BufferLength == 0)
                {
                    displayWindow.Title = (int)latencyMax + "ms*";
                }
                else
                {
                    displayWindow.Title = (int)latencyMax + "ms";
                }
            }
        }