Exemple #1
0
    public override void Update()
    {
        for (int i = 0; i < 64; i++)
        {
            float weight = m_beatDetect.GetBeat(1) * 0.125f + m_beatDetect.GetBeat(2) * 0.25f + m_beatDetect.GetBeat(4) * 0.5f;
            var   color  = Color.white * 0.5f;

            var pct = (float)i / 64f;
            if (pct > weight)
            {
                color.a = 0.0f;
            }

            m_beatTexture.SetPixel(m_textureOffset, i, color);
        }
        m_beatTexture.Apply();

        for (int i = 0; i < 64; i++)
        {
            var color = Color.white;
            color.a = 0.5f;
            var pct = (float)i / 64f;
            if (pct > m_bassLevel.normalizedLevel && pct > m_level.normalizedLevel)
            {
                color = Color.clear;
            }

            if (pct > m_bassLevel.normalizedLevel)
            {
                color.r = 0;
            }
            if (pct > m_level.normalizedLevel)
            {
                color.g = 0;
            }
            m_levelTexture.SetPixel(m_textureOffset, i, color);
        }
        m_levelTexture.Apply();
        m_textureOffset++;
    }
Exemple #2
0
 public static float SampleOscillator(OscillatorType type, int beats)
 {
     return(m_beat.GetBeat(beats));
 }