@@ -146,9 +146,9 @@ internal void OnGUI()
146146 EditorGUILayout . LabelField ( "Flags" , m_DeviceFlagsString ) ;
147147 if ( m_Device is Keyboard )
148148 EditorGUILayout . LabelField ( "Keyboard Layout" , ( ( Keyboard ) m_Device ) . keyboardLayout ) ;
149- const string sampleFrequencyTooltip = "Displays the current average event or sample frequency of this device in Hertz (Hz). " +
150- "The target frequency is device and backend dependent and may not be supported by all devices nor backends. " +
151- "The Polling Frequency indicates system polling target frequency." ;
149+ const string sampleFrequencyTooltip = "Displays the current average event or sample frequency of this device in Hertz (Hz). " +
150+ "The target frequency is device and backend dependent and may not be supported by all devices nor backends. " +
151+ "The Polling Frequency indicates system polling target frequency." ;
152152 if ( ! string . IsNullOrEmpty ( m_DeviceFrequencyString ) )
153153 EditorGUILayout . LabelField ( new GUIContent ( "Sample Frequency" , sampleFrequencyTooltip ) , new GUIContent ( m_DeviceFrequencyString ) , EditorStyles . label ) ;
154154 const string inputSystemLatencyTooltip = "Displays the average input system latency (Excluding OS, driver, firmware or transport latency) for data reported for this device." ;
@@ -298,7 +298,7 @@ private void InitializeWith(InputDevice device)
298298 m_DeviceId = device . deviceId ;
299299 m_DeviceIdString = device . deviceId . ToString ( ) ;
300300 m_DeviceUsagesString = string . Join ( ", " , device . usages . Select ( x => x . ToString ( ) ) . ToArray ( ) ) ;
301-
301+
302302 UpdateDeviceFlags ( ) ;
303303
304304 // Query the sampling frequency of the device.
@@ -311,7 +311,7 @@ private void InitializeWith(InputDevice device)
311311 var realtimeSinceStartup = Time . realtimeSinceStartupAsDouble ;
312312 m_FrequencyCalculator = new FrequencyCalculator ( targetFrequency , realtimeSinceStartup ) ;
313313 m_LatencyCalculator = new LatencyCalculator ( realtimeSinceStartup ) ;
314-
314+
315315 // Set up event trace. The default trace size of 512kb fits a ton of events and will
316316 // likely bog down the UI if we try to display that many events. Instead, come up
317317 // with a more reasonable sized based on the state size of the device.
@@ -380,7 +380,7 @@ private string CreateDeviceFrequencyString(ref StringBuilder sb)
380380 // Display achievable frequency for device
381381 const string frequencyFormat = "Average: 0.000 Hz" ;
382382 sb . Append ( m_FrequencyCalculator . frequency . ToString ( frequencyFormat , CultureInfo . InvariantCulture ) ) ;
383-
383+
384384 // Display target frequency reported for device
385385 sb . Append ( " (Target @ " ) ;
386386 sb . Append ( float . IsNaN ( m_FrequencyCalculator . targetFrequency )
@@ -409,7 +409,7 @@ private static void FormatLatency(StringBuilder sb, float value)
409409 ? ( millis ) . ToString ( latencyFormat , CultureInfo . InvariantCulture )
410410 : ">1000.0 ms" ) ;
411411 }
412-
412+
413413 private string CreateDeviceLatencyString ( ref StringBuilder sb )
414414 {
415415 if ( sb == null )
@@ -424,7 +424,7 @@ private string CreateDeviceLatencyString(ref StringBuilder sb)
424424 FormatLatency ( sb , m_LatencyCalculator . minLatencySeconds ) ;
425425 sb . Append ( ", Max: " ) ;
426426 FormatLatency ( sb , m_LatencyCalculator . maxLatencySeconds ) ;
427-
427+
428428 return sb . ToString ( ) ;
429429 }
430430
@@ -586,19 +586,19 @@ public LatencyCalculator(double realtimeSinceStartup)
586586 }
587587
588588 public void ProcessSample ( InputEventPtr eventPtr ) => ProcessSample ( eventPtr , Time . realtimeSinceStartupAsDouble ) ;
589-
589+
590590 public void ProcessSample ( InputEventPtr eventPtr , double realtimeSinceStartup )
591591 {
592592 if ( ! eventPtr . valid )
593593 return ;
594-
594+
595595 var ageInSeconds = realtimeSinceStartup - eventPtr . time ;
596596 m_AccumulatedLatencySeconds += ageInSeconds ;
597597 if ( ++ m_SampleCount == 1 )
598598 {
599599 m_AccumulatedMinLatencySeconds = ageInSeconds ;
600600 m_AccumulatedMaxLatencySeconds = ageInSeconds ;
601- }
601+ }
602602 else if ( ageInSeconds < m_AccumulatedMaxLatencySeconds )
603603 m_AccumulatedMinLatencySeconds = ageInSeconds ;
604604 else if ( ageInSeconds > m_AccumulatedMaxLatencySeconds )
@@ -629,16 +629,16 @@ public bool Update(double realtimeSinceStartup)
629629 minLatencySeconds = ( float ) m_AccumulatedMinLatencySeconds ;
630630 maxLatencySeconds = ( float ) m_AccumulatedMaxLatencySeconds ;
631631 }
632-
632+
633633 m_LastUpdateTime = realtimeSinceStartup ;
634634 m_SampleCount = 0 ;
635-
635+
636636 m_AccumulatedLatencySeconds = 0.0 ;
637-
637+
638638 return true ;
639639 }
640640 }
641-
641+
642642 private struct FrequencyCalculator
643643 {
644644 private double m_LastUpdateTime ;
@@ -651,7 +651,7 @@ public FrequencyCalculator(float targetFrequency, double realtimeSinceStartup)
651651 this . frequency = 0.0f ;
652652 this . m_LastUpdateTime = realtimeSinceStartup ;
653653 }
654-
654+
655655 public float targetFrequency { get ; private set ; }
656656 public float frequency { get ; private set ; }
657657
@@ -663,9 +663,9 @@ public void ProcessSample(InputEventPtr eventPtr)
663663 if ( eventPtr != null )
664664 ++ m_SampleCount ;
665665 }
666-
666+
667667 public bool Update ( ) => Update ( Time . realtimeSinceStartupAsDouble ) ;
668-
668+
669669 public bool Update ( double realtimeSinceStartup )
670670 {
671671 var timeSinceLastUpdate = realtimeSinceStartup - m_LastUpdateTime ;
@@ -675,19 +675,19 @@ public bool Update(double realtimeSinceStartup)
675675 m_LastUpdateTime = realtimeSinceStartup ;
676676 frequency = ( float ) ( m_SampleCount / timeSinceLastUpdate ) ;
677677 m_SampleCount = 0 ;
678-
678+
679679 return true ;
680680 }
681681 }
682-
682+
683683 private void OnDeviceStateChange ( InputDevice device , InputEventPtr eventPtr )
684684 {
685685 if ( device == m_Device )
686686 {
687687 m_LatencyCalculator . ProcessSample ( eventPtr ) ;
688688 m_FrequencyCalculator . ProcessSample ( eventPtr ) ;
689689
690- NeedControlValueRefresh ( ) ;
690+ NeedControlValueRefresh ( ) ;
691691 }
692692 }
693693
0 commit comments