private void Start() { spectrum1 = GameObject.Find("MusicPlayer(Reaktor)/Spectrum 1").GetComponent <Reaktion.Reaktor>(); spectrum2 = GameObject.Find("MusicPlayer(Reaktor)/Spectrum 2").GetComponent <Reaktion.Reaktor>(); spectrum3 = GameObject.Find("MusicPlayer(Reaktor)/Spectrum 3").GetComponent <Reaktion.Reaktor>(); spectrum4 = GameObject.Find("MusicPlayer(Reaktor)/Spectrum 4").GetComponent <Reaktion.Reaktor>(); }
// Draw the input level bar. void DrawInputLevelBars(Reaktor reaktor) { if (barTextures == null) { // Make textures for drawing level bars. barTextures = new Texture2D[] { NewBarTexture(new Color(55.0f / 255, 53.0f / 255, 45.0f / 255)), NewBarTexture(new Color(250.0f / 255, 249.0f / 255, 248.0f / 255)), NewBarTexture(new Color(110.0f / 255, 192.0f / 255, 91.0f / 255, 0.8f)), NewBarTexture(new Color(226.0f / 255, 0, 7.0f / 255, 0.8f)), NewBarTexture(new Color(249.0f / 255, 185.0f / 255, 22.0f / 255)) }; } // Get a rectangle as a text field and fill it. var rect = GUILayoutUtility.GetRect(18, 16, "TextField"); GUI.DrawTexture(rect, barTextures[0]); // Draw the raw input bar. var temp = rect; temp.width *= Mathf.Clamp01((reaktor.RawInput - reaktor.lowerBound) / (3 - reaktor.lowerBound)); GUI.DrawTexture(temp, barTextures[1]); // Draw the dynamic range. temp.x += rect.width * (reaktor.Peak - reaktor.lowerBound - reaktor.dynamicRange - reaktor.headroom) / (3 - reaktor.lowerBound); temp.width = rect.width * reaktor.dynamicRange / (3 - reaktor.lowerBound); GUI.DrawTexture(temp, barTextures[2]); // Draw the headroom. temp.x += temp.width; temp.width = rect.width * reaktor.headroom / (3 - reaktor.lowerBound); GUI.DrawTexture(temp, barTextures[3]); // Display the peak level value. EditorGUI.LabelField(rect, "Peak: " + reaktor.Peak.ToString("0.0") + " dB"); // Draw the gain level. DrawLevelBar("Gain", reaktor.Gain, barTextures[0], barTextures[1]); // Draw the offset level. DrawLevelBar("Offset", reaktor.Offset, barTextures[0], barTextures[1]); // Draw the output level. DrawLevelBar("Out", reaktor.Output, barTextures[0], barTextures[4]); }
static int CompareReaktor(Reaktor a, Reaktor b) { return(a.name.CompareTo(b.name)); }
// Draw the input level bar. void DrawInputLevelBars(Reaktor reaktor) { if (barTextures == null) { // Make textures for drawing level bars. barTextures = new Texture2D[] { NewBarTexture(new Color(55.0f / 255, 53.0f / 255, 45.0f / 255)), NewBarTexture(new Color(250.0f / 255, 249.0f / 255, 248.0f / 255)), NewBarTexture(new Color(110.0f / 255, 192.0f / 255, 91.0f / 255, 0.8f)), NewBarTexture(new Color(226.0f / 255, 0, 7.0f / 255, 0.8f)), NewBarTexture(new Color(249.0f / 255, 185.0f / 255, 22.0f / 255)) }; } // Get a rectangle as a text field and fill it. var rect = GUILayoutUtility.GetRect(18, 16, "TextField"); GUI.DrawTexture(rect, barTextures[0]); // Draw the raw input bar. var temp = rect; temp.width *= Mathf.Clamp01((reaktor.RawInput - reaktor.lowerBound) / (3 - reaktor.lowerBound)); GUI.DrawTexture(temp, barTextures[1]); // Draw the dynamic range. temp.x += rect.width * (reaktor.Peak - reaktor.lowerBound - reaktor.dynamicRange - reaktor.headroom) / (3 - reaktor.lowerBound); temp.width = rect.width * reaktor.dynamicRange / (3 - reaktor.lowerBound); GUI.DrawTexture(temp, barTextures[2]); // Draw the headroom. temp.x += temp.width; temp.width = rect.width * reaktor.headroom / (3 - reaktor.lowerBound); GUI.DrawTexture(temp, barTextures[3]); // Display the peak level value. EditorGUI.LabelField(rect, "Peak: " + reaktor.Peak.ToString ("0.0") + " dB"); // Draw the gain level. DrawLevelBar("Gain", reaktor.Gain, barTextures[0], barTextures[1]); // Draw the offset level. DrawLevelBar("Offset", reaktor.Offset, barTextures[0], barTextures[1]); // Draw the output level. DrawLevelBar("Out", reaktor.Output, barTextures[0], barTextures[4]); }
static int CompareReaktor (Reaktor a, Reaktor b) { return a.name.CompareTo(b.name); }