示例#1
0
            static void SmoothVUMeterData(ref float value, ref SmoothingData data, out float renderValue, out float renderPeak)
            {
                if (value <= data.lastValue)
                {
                    value = Mathf.Lerp(data.lastValue, value, Time.smoothDeltaTime * 7.0f);
                }
                else
                {
                    value              = Mathf.Lerp(value, data.lastValue, Time.smoothDeltaTime * 2.0f);
                    data.peakValue     = value;
                    data.peakValueTime = Time.realtimeSinceStartup;
                }

                if (value > 1.0f / VU_SPLIT)
                {
                    value = 1.0f / VU_SPLIT;
                }
                if (data.peakValue > 1.0f / VU_SPLIT)
                {
                    data.peakValue = 1.0f / VU_SPLIT;
                }

                renderValue = value * VU_SPLIT;
                renderPeak  = data.peakValue * VU_SPLIT;

                data.lastValue = value;
            }
示例#2
0
        private static void SmoothVUMeterData(ref float value, ref SmoothingData data, out float renderValue, out float renderPeak)
        {
            if (value <= data.lastValue)
            {
                value = Mathf.Lerp(data.lastValue, value, Time.smoothDeltaTime * 7f);
            }
            else
            {
                value              = Mathf.Lerp(value, data.lastValue, Time.smoothDeltaTime * 2f);
                data.peakValue     = value;
                data.peakValueTime = Time.realtimeSinceStartup;
            }

            if (value > 1.11111116f)
            {
                value = 1.11111116f;
            }

            if (data.peakValue > 1.11111116f)
            {
                data.peakValue = 1.11111116f;
            }

            renderValue    = value * 0.9f;
            renderPeak     = data.peakValue * 0.9f;
            data.lastValue = value;
        }
示例#3
0
            // Auto smoothing version
            public static void VerticalMeter(Rect position, float value, ref SmoothingData data, Texture2D foregroundTexture, Color peakColor)
            {
                if (Event.current.type != EventType.Repaint)
                {
                    return;
                }

                float renderValue, renderPeak;

                SmoothVUMeterData(ref value, ref data, out renderValue, out renderPeak);
                VerticalMeter(position, renderValue, renderPeak, foregroundTexture, peakColor);
            }
示例#4
0
        private static void HorizontalMeter(Rect position, float value, ref SmoothingData data, Texture2D foregroundTexture, Color peakColor)
        {
            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            float value2;
            float peak;

            SmoothVUMeterData(ref value, ref data, out value2, out peak);
            HorizontalMeter(position, value2, peak, foregroundTexture, peakColor);
        }
示例#5
0
 static public float LowPass( SmoothingData smoothingData ) {
     return smoothingData.value + ( smoothingData.target - smoothingData.value ) * smoothingData.strength;
 }
示例#6
0
 static public float Exponential( SmoothingData smoothingData ) {
     return smoothingData.value + ( smoothingData.target - smoothingData.value ) * 0.01f;
 }
示例#7
0
        private static void VUMeterHorizontal(float value, ref SmoothingData data, params GUILayoutOption[] options)
        {
            Rect position = EditorGUILayout.GetControlRect(false, 16f, EditorStyles.numberField, options);

            HorizontalMeter(position, value, ref data, HorizontalVUTexture, Color.grey);
        }
示例#8
0
 static public float LowPass(SmoothingData smoothingData)
 {
     return(smoothingData.value + (smoothingData.target - smoothingData.value) * smoothingData.strength);
 }
示例#9
0
 static public float Exponential(SmoothingData smoothingData)
 {
     return(smoothingData.value + (smoothingData.target - smoothingData.value) * 0.01f);
 }
示例#10
0
 public void GoTo( SmoothingData data, Func<SmoothingData, float> smoothingFunc ) {
     interpolating = true;
     smoothingData = data;
     smoothing = smoothingFunc;
 }
示例#11
0
 public void GoTo(SmoothingData data, Func <SmoothingData, float> smoothingFunc)
 {
     interpolating = true;
     smoothingData = data;
     smoothing     = smoothingFunc;
 }