aboutsummaryrefslogtreecommitdiff
path: root/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio')
-rw-r--r--Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioGraph.cs261
-rw-r--r--Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioGraph.cs.meta12
-rw-r--r--Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioManager.cs242
-rw-r--r--Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioManager.cs.meta12
-rw-r--r--Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioMonitor.cs216
-rw-r--r--Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioMonitor.cs.meta12
-rw-r--r--Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioText.cs103
-rw-r--r--Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioText.cs.meta12
8 files changed, 0 insertions, 870 deletions
diff --git a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioGraph.cs b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioGraph.cs
deleted file mode 100644
index 0c4888b..0000000
--- a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioGraph.cs
+++ /dev/null
@@ -1,261 +0,0 @@
-/* ---------------------------------------
- * Author: Martin Pane (martintayx@gmail.com) (@tayx94)
- * Collaborators: Lars Aalbertsen (@Rockylars)
- * Project: Graphy - Ultimate Stats Monitor
- * Date: 15-Dec-17
- * Studio: Tayx
- *
- * This project is released under the MIT license.
- * Attribution is not required, but it is always welcomed!
- * -------------------------------------*/
-
-using Tayx.Graphy.Graph;
-using UnityEngine;
-using UnityEngine.UI;
-
-namespace Tayx.Graphy.Audio
-{
- public class G_AudioGraph : G_Graph
- {
- /* ----- TODO: ----------------------------
- * Add summaries to the variables.
- * Add summaries to the functions.
- * Check if we should add a "RequireComponent" for "AudioMonitor".
- * --------------------------------------*/
-
- #region Variables -> Serialized Private
-
- [SerializeField] private Image m_imageGraph = null;
- [SerializeField] private Image m_imageGraphHighestValues = null;
-
- [SerializeField] private Shader ShaderFull = null;
- [SerializeField] private Shader ShaderLight = null;
-
- #endregion
-
- #region Variables -> Private
-
- private GraphyManager m_graphyManager = null;
-
- private G_AudioMonitor m_audioMonitor = null;
-
- private int m_resolution = 40;
-
- private G_GraphShader m_shaderGraph = null;
- private G_GraphShader m_shaderGraphHighestValues = null;
-
- private float[] m_graphArray;
- private float[] m_graphArrayHighestValue;
-
- #endregion
-
- #region Methods -> Unity Callbacks
-
- private void OnEnable()
- {
- Init();
- }
-
- private void Update()
- {
- if (m_audioMonitor.SpectrumDataAvailable)
- {
- UpdateGraph();
- }
- }
-
- #endregion
-
- #region Methods -> Public
-
- public void UpdateParameters()
- {
- switch (m_graphyManager.GraphyMode)
- {
- case GraphyManager.Mode.FULL:
- m_shaderGraph.ArrayMaxSize = G_GraphShader.ArrayMaxSizeFull;
- m_shaderGraph.Image.material = new Material(ShaderFull);
-
- m_shaderGraphHighestValues.ArrayMaxSize = G_GraphShader.ArrayMaxSizeFull;
- m_shaderGraphHighestValues.Image.material = new Material(ShaderFull);
- break;
-
- case GraphyManager.Mode.LIGHT:
- m_shaderGraph.ArrayMaxSize = G_GraphShader.ArrayMaxSizeLight;
- m_shaderGraph.Image.material = new Material(ShaderLight);
-
- m_shaderGraphHighestValues.ArrayMaxSize = G_GraphShader.ArrayMaxSizeLight;
- m_shaderGraphHighestValues.Image.material = new Material(ShaderLight);
- break;
- }
-
- m_shaderGraph.InitializeShader();
- m_shaderGraphHighestValues.InitializeShader();
-
- m_resolution = m_graphyManager.AudioGraphResolution;
-
- CreatePoints();
- }
-
- #endregion
-
- #region Methods -> Protected Override
-
- protected override void UpdateGraph()
- {
- int incrementPerIteration = Mathf.FloorToInt(m_audioMonitor.Spectrum.Length / (float)m_resolution);
-
- // Current values -------------------------
-
- for (int i = 0; i <= m_resolution - 1; i++)
- {
- float currentValue = 0;
-
- for (int j = 0; j < incrementPerIteration; j++)
- {
- currentValue += m_audioMonitor.Spectrum[i * incrementPerIteration + j];
- }
-
- // Uses 3 values for each bar to accomplish that look
-
- if ((i + 1) % 3 == 0 && i > 1)
- {
- float value =
- (
- m_audioMonitor.dBNormalized(m_audioMonitor.lin2dB(currentValue / incrementPerIteration))
- + m_graphArray[i - 1]
- + m_graphArray[i - 2]
- ) / 3;
-
- m_graphArray[i] = value;
- m_graphArray[i - 1] = value;
- m_graphArray[i - 2] = -1; // Always set the third one to -1 to leave gaps in the graph and improve readability
- }
- else
- {
- m_graphArray[i] = m_audioMonitor.dBNormalized(m_audioMonitor.lin2dB(currentValue / incrementPerIteration));
- }
- }
-
- for (int i = 0; i <= m_resolution - 1; i++)
- {
- m_shaderGraph.Array[i] = m_graphArray[i];
- }
-
- m_shaderGraph.UpdatePoints();
-
-
- // Highest values -------------------------
-
- for (int i = 0; i <= m_resolution - 1; i++)
- {
- float currentValue = 0;
-
- for (int j = 0; j < incrementPerIteration; j++)
- {
- currentValue += m_audioMonitor.SpectrumHighestValues[i * incrementPerIteration + j];
- }
-
- // Uses 3 values for each bar to accomplish that look
-
- if ((i + 1) % 3 == 0 && i > 1)
- {
- float value =
- (
- m_audioMonitor.dBNormalized(m_audioMonitor.lin2dB(currentValue / incrementPerIteration))
- + m_graphArrayHighestValue[i - 1]
- + m_graphArrayHighestValue[i - 2]
- ) / 3;
-
- m_graphArrayHighestValue[i] = value;
- m_graphArrayHighestValue[i - 1] = value;
- m_graphArrayHighestValue[i - 2] = -1; // Always set the third one to -1 to leave gaps in the graph and improve readability
- }
- else
- {
- m_graphArrayHighestValue[i] = m_audioMonitor.dBNormalized(m_audioMonitor.lin2dB(currentValue / incrementPerIteration));
- }
- }
-
- for (int i = 0; i <= m_resolution - 1; i++)
- {
- m_shaderGraphHighestValues.Array[i] = m_graphArrayHighestValue[i];
- }
-
- m_shaderGraphHighestValues.UpdatePoints();
-
- }
-
- protected override void CreatePoints()
- {
- // Init Arrays
- m_shaderGraph.Array = new float[m_resolution];
- m_shaderGraphHighestValues.Array = new float[m_resolution];
-
- m_graphArray = new float[m_resolution];
- m_graphArrayHighestValue = new float[m_resolution];
-
- for (int i = 0; i < m_resolution; i++)
- {
- m_shaderGraph.Array[i] = 0;
- m_shaderGraphHighestValues.Array[i] = 0;
- }
-
- // Color
- m_shaderGraph.GoodColor = m_graphyManager.AudioGraphColor;
- m_shaderGraph.CautionColor = m_graphyManager.AudioGraphColor;
- m_shaderGraph.CriticalColor = m_graphyManager.AudioGraphColor;
- m_shaderGraph.UpdateColors();
-
- m_shaderGraphHighestValues.GoodColor = m_graphyManager.AudioGraphColor;
- m_shaderGraphHighestValues.CautionColor = m_graphyManager.AudioGraphColor;
- m_shaderGraphHighestValues.CriticalColor = m_graphyManager.AudioGraphColor;
- m_shaderGraphHighestValues.UpdateColors();
-
- // Threshold
- m_shaderGraph.GoodThreshold = 0;
- m_shaderGraph.CautionThreshold = 0;
- m_shaderGraph.UpdateThresholds();
-
- m_shaderGraphHighestValues.GoodThreshold = 0;
- m_shaderGraphHighestValues.CautionThreshold = 0;
- m_shaderGraphHighestValues.UpdateThresholds();
-
- // Update Array
- m_shaderGraph.UpdateArray();
- m_shaderGraphHighestValues.UpdateArray();
-
- // Average
- m_shaderGraph.Average = 0;
- m_shaderGraph.UpdateAverage();
-
- m_shaderGraphHighestValues.Average = 0;
- m_shaderGraphHighestValues.UpdateAverage();
- }
-
- #endregion
-
- #region Methods -> Private
-
- private void Init()
- {
- m_graphyManager = transform.root.GetComponentInChildren<GraphyManager>();
-
- m_audioMonitor = GetComponent<G_AudioMonitor>();
-
- m_shaderGraph = new G_GraphShader
- {
- Image = m_imageGraph
- };
-
- m_shaderGraphHighestValues = new G_GraphShader
- {
- Image = m_imageGraphHighestValues
- };
-
- UpdateParameters();
- }
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioGraph.cs.meta b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioGraph.cs.meta
deleted file mode 100644
index 157e8cf..0000000
--- a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioGraph.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: f2d6ca19dafe21b4b983441274e7f12a
-timeCreated: 1513169449
-licenseType: Store
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioManager.cs b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioManager.cs
deleted file mode 100644
index 1466546..0000000
--- a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioManager.cs
+++ /dev/null
@@ -1,242 +0,0 @@
-/* ---------------------------------------
- * Author: Martin Pane (martintayx@gmail.com) (@tayx94)
- * Collaborators: Lars Aalbertsen (@Rockylars)
- * Project: Graphy - Ultimate Stats Monitor
- * Date: 03-Jan-18
- * Studio: Tayx
- *
- * This project is released under the MIT license.
- * Attribution is not required, but it is always welcomed!
- * -------------------------------------*/
-
-using UnityEngine;
-using UnityEngine.UI;
-using System.Collections.Generic;
-using Tayx.Graphy.UI;
-using Tayx.Graphy.Utils;
-
-namespace Tayx.Graphy.Audio
-{
- public class G_AudioManager : MonoBehaviour, IMovable, IModifiableState
- {
- /* ----- TODO: ----------------------------
- * Add summaries to the variables.
- * Add summaries to the functions.
- * Check if we should add a "RequireComponent" for "RectTransform".
- * Check if we should add a "RequireComponent" for "AudioGraph".
- * Check if we should add a "RequireComponent" for "AudioMonitor".
- * Check if we should add a "RequireComponent" for "AudioText".
- * --------------------------------------*/
-
- #region Variables -> Serialized Private
-
- [SerializeField] private GameObject m_audioGraphGameObject = null;
- [SerializeField] private Text m_audioDbText = null;
-
- [SerializeField] private List<Image> m_backgroundImages = new List<Image>();
-
- #endregion
-
- #region Variables -> Private
-
- private GraphyManager m_graphyManager = null;
-
- private G_AudioGraph m_audioGraph = null;
- private G_AudioMonitor m_audioMonitor = null;
- private G_AudioText m_audioText = null;
-
- private RectTransform m_rectTransform = null;
-
- private List<GameObject> m_childrenGameObjects = new List<GameObject>();
-
- private GraphyManager.ModuleState m_previousModuleState = GraphyManager.ModuleState.FULL;
- private GraphyManager.ModuleState m_currentModuleState = GraphyManager.ModuleState.FULL;
-
- #endregion
-
- #region Methods -> Unity Callbacks
-
- private void Awake()
- {
- Init();
- }
-
- private void Start()
- {
- UpdateParameters();
- }
-
- #endregion
-
- #region Methods -> Public
-
- public void SetPosition(GraphyManager.ModulePosition newModulePosition)
- {
- float xSideOffset = Mathf.Abs(m_rectTransform.anchoredPosition.x);
- float ySideOffset = Mathf.Abs(m_rectTransform.anchoredPosition.y);
-
- m_audioDbText.alignment = TextAnchor.UpperRight;
-
- switch (newModulePosition)
- {
- case GraphyManager.ModulePosition.TOP_LEFT:
-
- m_rectTransform.anchorMax = Vector2.up;
- m_rectTransform.anchorMin = Vector2.up;
- m_rectTransform.anchoredPosition = new Vector2(xSideOffset, -ySideOffset);
-
- break;
-
- case GraphyManager.ModulePosition.TOP_RIGHT:
-
- m_rectTransform.anchorMax = Vector2.one;
- m_rectTransform.anchorMin = Vector2.one;
- m_rectTransform.anchoredPosition = new Vector2(-xSideOffset, -ySideOffset);
-
- break;
-
- case GraphyManager.ModulePosition.BOTTOM_LEFT:
-
- m_rectTransform.anchorMax = Vector2.zero;
- m_rectTransform.anchorMin = Vector2.zero;
- m_rectTransform.anchoredPosition = new Vector2(xSideOffset, ySideOffset);
-
- break;
-
- case GraphyManager.ModulePosition.BOTTOM_RIGHT:
-
- m_rectTransform.anchorMax = Vector2.right;
- m_rectTransform.anchorMin = Vector2.right;
- m_rectTransform.anchoredPosition = new Vector2(-xSideOffset, ySideOffset);
-
- break;
-
- case GraphyManager.ModulePosition.FREE:
- break;
- }
- }
-
- public void SetState(GraphyManager.ModuleState state, bool silentUpdate = false)
- {
- if (!silentUpdate)
- {
- m_previousModuleState = m_currentModuleState;
- }
-
- m_currentModuleState = state;
-
- switch (state)
- {
- case GraphyManager.ModuleState.FULL:
- gameObject.SetActive(true);
- m_childrenGameObjects.SetAllActive(true);
- SetGraphActive(true);
-
- if (m_graphyManager.Background)
- {
- m_backgroundImages.SetOneActive(0);
- }
- else
- {
- m_backgroundImages.SetAllActive(false);
- }
-
- break;
-
- case GraphyManager.ModuleState.TEXT:
- case GraphyManager.ModuleState.BASIC:
- gameObject.SetActive(true);
- m_childrenGameObjects.SetAllActive(true);
- SetGraphActive(false);
-
- if (m_graphyManager.Background)
- {
- m_backgroundImages.SetOneActive(1);
- }
- else
- {
- m_backgroundImages.SetAllActive(false);
- }
-
- break;
-
- case GraphyManager.ModuleState.BACKGROUND:
- gameObject.SetActive(true);
- SetGraphActive(false);
- m_childrenGameObjects.SetAllActive(false);
-
- m_backgroundImages.SetAllActive(false);
-
- break;
-
- case GraphyManager.ModuleState.OFF:
- gameObject.SetActive(false);
- break;
- }
- }
-
- public void RestorePreviousState()
- {
- SetState(m_previousModuleState);
- }
-
- public void UpdateParameters()
- {
- foreach (var image in m_backgroundImages)
- {
- image.color = m_graphyManager.BackgroundColor;
- }
-
- m_audioGraph .UpdateParameters();
- m_audioMonitor .UpdateParameters();
- m_audioText .UpdateParameters();
-
- SetState(m_graphyManager.AudioModuleState);
- }
-
- public void RefreshParameters()
- {
- foreach (var image in m_backgroundImages)
- {
- image.color = m_graphyManager.BackgroundColor;
- }
-
- m_audioGraph .UpdateParameters();
- m_audioMonitor .UpdateParameters();
- m_audioText .UpdateParameters();
-
- SetState(m_currentModuleState, true);
- }
-
- #endregion
-
- #region Methods -> Private
-
- private void Init()
- {
- m_graphyManager = transform.root.GetComponentInChildren<GraphyManager>();
-
- m_rectTransform = GetComponent<RectTransform>();
-
- m_audioGraph = GetComponent<G_AudioGraph>();
- m_audioMonitor = GetComponent<G_AudioMonitor>();
- m_audioText = GetComponent<G_AudioText>();
-
- foreach (Transform child in transform)
- {
- if (child.parent == transform)
- {
- m_childrenGameObjects.Add(child.gameObject);
- }
- }
- }
-
- private void SetGraphActive(bool active)
- {
- m_audioGraph.enabled = active;
- m_audioGraphGameObject.SetActive(active);
- }
-
- #endregion
- }
-}
diff --git a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioManager.cs.meta b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioManager.cs.meta
deleted file mode 100644
index fa8bc90..0000000
--- a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioManager.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 8c0448d8db852b54480670d291c04f1a
-timeCreated: 1514998347
-licenseType: Store
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioMonitor.cs b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioMonitor.cs
deleted file mode 100644
index a1f2774..0000000
--- a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioMonitor.cs
+++ /dev/null
@@ -1,216 +0,0 @@
-/* ---------------------------------------
- * Author: Martin Pane (martintayx@gmail.com) (@tayx94)
- * Collaborators: Lars Aalbertsen (@Rockylars)
- * Project: Graphy - Ultimate Stats Monitor
- * Date: 15-Dec-17
- * Studio: Tayx
- *
- * This project is released under the MIT license.
- * Attribution is not required, but it is always welcomed!
- * -------------------------------------*/
-
-using UnityEngine;
-using UnityEngine.SceneManagement;
-
-namespace Tayx.Graphy.Audio
-{
- public class G_AudioMonitor : MonoBehaviour
- {
- /* ----- TODO: ----------------------------
- * Add summaries to the variables.
- * Add summaries to the functions.
- * Make the "FindAudioListener" not constantly use "Camera.main".
- * --------------------------------------*/
-
- #region Variables -> Private
-
- private const float m_refValue = 1f;
-
- private GraphyManager m_graphyManager = null;
-
- private AudioListener m_audioListener = null;
-
- private GraphyManager.LookForAudioListener m_findAudioListenerInCameraIfNull = GraphyManager.LookForAudioListener.ON_SCENE_LOAD;
-
- private FFTWindow m_FFTWindow = FFTWindow.Blackman;
-
- private int m_spectrumSize = 512;
-
- private float[] m_spectrum;
- private float[] m_spectrumHighestValues;
-
- private float m_maxDB;
-
- #endregion
-
- #region Properties -> Public
-
- /// <summary>
- /// Current audio spectrum from the specified AudioListener.
- /// </summary>
- public float[] Spectrum { get { return m_spectrum; } }
-
- /// <summary>
- /// Highest audio spectrum from the specified AudioListener in the last few seconds.
- /// </summary>
- public float[] SpectrumHighestValues { get { return m_spectrumHighestValues; } }
-
- /// <summary>
- /// Maximum DB registered in the current spectrum.
- /// </summary>
- public float MaxDB { get { return m_maxDB; } }
-
- /// <summary>
- /// Returns true if there is a reference to the audio listener.
- /// </summary>
- public bool SpectrumDataAvailable { get { return m_audioListener != null;} }
-
- #endregion
-
- #region Methods -> Unity Callbacks
-
- private void Awake()
- {
- Init();
- }
-
- private void Update()
- {
- if (m_audioListener != null)
- {
- // Use this data to calculate the dB value
-
- AudioListener.GetOutputData(m_spectrum, 0);
-
- float sum = 0;
-
- for (int i = 0; i < m_spectrum.Length; i++)
- {
- sum += m_spectrum[i] * m_spectrum[i]; // sum squared samples
- }
-
- float rmsValue = Mathf.Sqrt(sum / m_spectrum.Length); // rms = square root of average
-
- m_maxDB = 20 * Mathf.Log10(rmsValue / m_refValue); // calculate dB
-
- if (m_maxDB < -80) m_maxDB = -80; // clamp it to -80dB min
-
- // Use this data to draw the spectrum in the graphs
-
- AudioListener.GetSpectrumData(m_spectrum, 0, m_FFTWindow);
-
- for (int i = 0; i < m_spectrum.Length; i++)
- {
- // Update the highest value if its lower than the current one
- if (m_spectrum[i] > m_spectrumHighestValues[i])
- {
- m_spectrumHighestValues[i] = m_spectrum[i];
- }
-
- // Slowly lower the value
- else
- {
- m_spectrumHighestValues[i] = Mathf.Clamp
- (
- value: m_spectrumHighestValues[i] - m_spectrumHighestValues[i] * Time.deltaTime * 2,
- min: 0,
- max: 1
- );
- }
- }
- }
- else if( m_audioListener == null
- && m_findAudioListenerInCameraIfNull == GraphyManager.LookForAudioListener.ALWAYS)
- {
- m_audioListener = FindAudioListener();
- }
- }
-
- private void OnDestroy()
- {
- UnityEngine.SceneManagement.SceneManager.sceneLoaded -= OnSceneLoaded;
- }
-
- #endregion
-
- #region Methods -> Public
-
- public void UpdateParameters()
- {
- m_findAudioListenerInCameraIfNull = m_graphyManager.FindAudioListenerInCameraIfNull;
-
- m_audioListener = m_graphyManager.AudioListener;
- m_FFTWindow = m_graphyManager.FftWindow;
- m_spectrumSize = m_graphyManager.SpectrumSize;
-
- if (m_audioListener == null
- && m_findAudioListenerInCameraIfNull != GraphyManager.LookForAudioListener.NEVER)
- {
- m_audioListener = FindAudioListener();
- }
-
- m_spectrum = new float[m_spectrumSize];
- m_spectrumHighestValues = new float[m_spectrumSize];
- }
-
- /// <summary>
- /// Converts spectrum values to decibels using logarithms.
- /// </summary>
- /// <param name="linear"></param>
- /// <returns></returns>
- public float lin2dB(float linear)
- {
- return Mathf.Clamp(Mathf.Log10(linear) * 20.0f, -160.0f, 0.0f);
- }
-
- /// <summary>
- /// Normalizes a value in decibels between 0-1.
- /// </summary>
- /// <param name="db"></param>
- /// <returns></returns>
- public float dBNormalized(float db)
- {
- return (db + 160f) / 160f;
- }
-
- #endregion
-
- #region Methods -> Private
-
- /// <summary>
- /// Tries to find an audio listener in the main camera.
- /// </summary>
- private AudioListener FindAudioListener()
- {
- Camera mainCamera = Camera.main;
-
- if (mainCamera != null)
- {
- return mainCamera.GetComponent<AudioListener>();
- }
- else
- {
- return null;
- }
- }
-
- private void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
- {
- if (m_findAudioListenerInCameraIfNull == GraphyManager.LookForAudioListener.ON_SCENE_LOAD)
- {
- m_audioListener = FindAudioListener();
- }
- }
-
- private void Init()
- {
- m_graphyManager = transform.root.GetComponentInChildren<GraphyManager>();
-
- UpdateParameters();
-
- UnityEngine.SceneManagement.SceneManager.sceneLoaded += OnSceneLoaded;
- }
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioMonitor.cs.meta b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioMonitor.cs.meta
deleted file mode 100644
index feade85..0000000
--- a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioMonitor.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 2216f4eff6a7a8a43b38b180fdd2fd9e
-timeCreated: 1513377074
-licenseType: Store
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioText.cs b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioText.cs
deleted file mode 100644
index 8fd8ac7..0000000
--- a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioText.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-/* ---------------------------------------
- * Author: Martin Pane (martintayx@gmail.com) (@tayx94)
- * Collaborators: Lars Aalbertsen (@Rockylars)
- * Project: Graphy - Ultimate Stats Monitor
- * Date: 15-Dec-17
- * Studio: Tayx
- *
- * This project is released under the MIT license.
- * Attribution is not required, but it is always welcomed!
- * -------------------------------------*/
-
-using UnityEngine;
-using UnityEngine.UI;
-using Tayx.Graphy.Utils.NumString;
-
-namespace Tayx.Graphy.Audio
-{
- public class G_AudioText : MonoBehaviour
- {
- /* ----- TODO: ----------------------------
- * Add summaries to the variables.
- * Add summaries to the functions.
- * Check if we should add a "RequireComponent" for "AudioMonitor".
- * Improve the FloatString Init to come from the core instead.
- * --------------------------------------*/
-
- #region Variables -> Serialized Private
-
- [SerializeField] private Text m_DBText = null;
-
- #endregion
-
- #region Variables -> Private
-
- private GraphyManager m_graphyManager = null;
-
- private G_AudioMonitor m_audioMonitor = null;
-
- private int m_updateRate = 4;
-
- private float m_deltaTimeOffset = 0;
-
- #endregion
-
- #region Methods -> Unity Callbacks
-
- private void Awake()
- {
- Init();
- }
-
- private void Update()
- {
- if (m_audioMonitor.SpectrumDataAvailable)
- {
- if (m_deltaTimeOffset > 1f / m_updateRate)
- {
- m_deltaTimeOffset = 0f;
-
- m_DBText.text = Mathf.Clamp(m_audioMonitor.MaxDB, -80f, 0f).ToStringNonAlloc();
- }
- else
- {
- m_deltaTimeOffset += Time.deltaTime;
- }
- }
- }
-
- #endregion
-
- #region Methods -> Public
-
- public void UpdateParameters()
- {
- m_updateRate = m_graphyManager.AudioTextUpdateRate;
- }
-
- #endregion
-
- #region Methods -> Private
-
- private void Init()
- {
- //TODO: Replace this with one activated from the core and figure out the min value.
- if (!G_FloatString.Inited || G_FloatString.MinValue > -1000f || G_FloatString.MaxValue < 16384f)
- {
- G_FloatString.Init
- (
- minNegativeValue: -1001f,
- maxPositiveValue: 16386f
- );
- }
-
- m_graphyManager = transform.root.GetComponentInChildren<GraphyManager>();
-
- m_audioMonitor = GetComponent<G_AudioMonitor>();
-
- UpdateParameters();
- }
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioText.cs.meta b/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioText.cs.meta
deleted file mode 100644
index f6bfa71..0000000
--- a/Assets/Packages/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Audio/G_AudioText.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 766a588f9a6cb55499c66ea772072e11
-timeCreated: 1513377063
-licenseType: Store
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant: