예제 #1
0
 public static void Deserialize(ReverbZone zone, ReverbZoneState reverbState)
 {
     zone.level     = reverbState.level;
     zone.delay     = reverbState.delay;
     zone.diffusion = reverbState.diffusion;
     zone.lowPass   = reverbState.lowPass;
     zone.highPass  = reverbState.highPass;
 }
예제 #2
0
        public static ReverbZoneState Serialize(ReverbZone zone)
        {
            ReverbZoneState reverbZoneState = new ReverbZoneState();

            reverbZoneState.id        = zone.name;
            reverbZoneState.level     = zone.level;
            reverbZoneState.delay     = zone.delay;
            reverbZoneState.diffusion = zone.diffusion;
            reverbZoneState.lowPass   = zone.lowPass;
            reverbZoneState.highPass  = zone.highPass;
            return(reverbZoneState);
        }
예제 #3
0
 private void ShowReverbs()
 {
     soundScrollPos = GUILayout.BeginScrollView(soundScrollPos, GUILayout.Width(Screen.width));
     for (int i = 0; i < activeReverb.zones.Length; i++)
     {
         ReverbZone reverbZone = activeReverb.zones[i];
         Rect       rect       = GUILayoutUtility.GetRect(Screen.width, 0f);
         rect.height = 24f;
         if (ReverbManager.instance.zones.Contains(reverbZone))
         {
             AudioUI.DrawRect(rect, new Color(0.5f, 0.25f, 0.25f, 1f));
         }
         else if (i % 2 == 0)
         {
             AudioUI.DrawRect(rect, new Color(0.2f, 0.2f, 0.2f, 0.5f));
         }
         else
         {
             AudioUI.DrawRect(rect, new Color(0f, 0f, 0f, 0.5f));
         }
         GUILayout.BeginHorizontal(GUILayout.Height(rect.height));
         string name = reverbZone.name;
         GUILayout.Label(name, GUILayout.Width(200f));
         GUILayout.Label("level", AudioUI.style, GUILayout.ExpandWidth(expand: false));
         Rect rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false));
         reverbZone.level = AudioUI.DrawHorizontalSlider(rect2, -48f, 12f, 0f, reverbZone.level, AudioSliderType.Level);
         GUILayout.Label("delay", AudioUI.style, GUILayout.ExpandWidth(expand: false));
         rect2            = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false));
         reverbZone.delay = AudioUI.DrawHorizontalSlider(rect2, 0.1f, 3f, 0.5f, reverbZone.delay, AudioSliderType.Linear);
         GUILayout.Label("diffusion", AudioUI.style, GUILayout.ExpandWidth(expand: false));
         rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false));
         reverbZone.diffusion = AudioUI.DrawHorizontalSlider(rect2, 0.01f, 1f, 0.5f, reverbZone.diffusion, AudioSliderType.Linear);
         GUILayout.Label("HP", AudioUI.style, GUILayout.ExpandWidth(expand: false));
         rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false));
         reverbZone.highPass = AudioUI.DrawHorizontalSlider(rect2, 10f, 22000f, 10f, reverbZone.highPass, AudioSliderType.Log10);
         GUILayout.Label("LP", AudioUI.style, GUILayout.ExpandWidth(expand: false));
         rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false));
         reverbZone.lowPass = AudioUI.DrawHorizontalSlider(rect2, 10f, 22000f, 22000f, reverbZone.lowPass, AudioSliderType.Log10);
         if (GUILayout.Button("C", GUILayout.Width(32f)))
         {
             clipboard = Reverb.Serialize(reverbZone);
         }
         if (GUILayout.Button("V", GUILayout.Width(32f)) && clipboard != null)
         {
             Reverb.Deserialize(reverbZone, clipboard);
         }
         GUILayout.EndHorizontal();
     }
     GUILayout.EndScrollView();
 }
예제 #4
0
 private void LoadJson(ReverbState state)
 {
     for (int i = 0; i < state.zones.Length; i++)
     {
         ReverbZoneState reverbZoneState = state.zones[i];
         ReverbZone      reverbZone      = null;
         for (int j = 0; j < zones.Length; j++)
         {
             if (zones[j].name == reverbZoneState.id)
             {
                 reverbZone = zones[j];
                 break;
             }
         }
         if (!(reverbZone == null))
         {
             Deserialize(reverbZone, reverbZoneState);
         }
     }
 }