private void ShowSounds(SoundManager activeSounds) { if (activeSounds == null) { return; } for (int i = 0; i < activeSounds.groups.Count; i++) { SoundManager.SoundGroup soundGroup = activeSounds.groups[i]; string text = soundGroup.name; if (string.IsNullOrEmpty(text)) { text = "none"; } bool flag = expandedGroups.Contains(text); if (flag != GUILayout.Toggle(flag, $"{text} ({soundGroup.sounds.Count})")) { if (!flag) { expandedGroups.Add(text); } else { expandedGroups.Remove(text); } } if (!flag) { continue; } for (int j = 0; j < soundGroup.sounds.Count; j++) { Rect rect = GUILayoutUtility.GetRect(Screen.width, 0f); rect.height = 24f; if (j % 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)); SoundManager.SoundMaster soundMaster = soundGroup.sounds[j]; string name = soundMaster.master.name; bool flag2 = SoundManager.hasSolo && !soundMaster.isMuted; if (flag2 != GUILayout.Toggle(flag2, name, GUILayout.Width(200f))) { SoundManager.SoloSound(soundMaster, !flag2); } if (GUILayout.Button(soundMaster.master.sampleLabel, GUILayout.Width(200f))) { SamplePicker.pickSampleSound = soundMaster; if (soundMaster.master.soundSample != null) { SamplePicker.pickCategoryName = soundMaster.master.soundSample.category; } } GUILayout.Label("lvl", AudioUI.style, GUILayout.ExpandWidth(expand: false)); Rect rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); float num = AudioUI.DrawHorizontalSlider(rect2, 0f, 1f, 1f, soundMaster.master.baseVolume, AudioSliderType.Volume); if (num != soundMaster.master.baseVolume) { soundMaster.SetBaseVolume(num); } GUILayout.Label("tune", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(75f, rect.height, GUILayout.ExpandWidth(expand: false)); float num2 = AudioUI.DrawHorizontalSlider(rect2, -2400f, 2400f, 0f, soundMaster.master.basePitch, AudioSliderType.Pitch); if (num2 != soundMaster.master.basePitch) { soundMaster.SetBasePitch(num2); } GUILayout.Label("dist", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); float num3 = AudioUI.DrawHorizontalSlider(rect2, 10f, 300f, 30f, soundMaster.master.maxDistance, AudioSliderType.Log2); if (num3 != soundMaster.master.maxDistance) { soundMaster.SetMaxDistance(num3); soundMaster.ApplyAttenuation(); } GUILayout.Label("lp", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(75f, rect.height, GUILayout.ExpandWidth(expand: false)); float num4 = AudioUI.DrawHorizontalSlider(rect2, 1f, 30f, 2f, soundMaster.master.lpStart, AudioSliderType.Log2); if (num4 != soundMaster.master.lpStart) { soundMaster.SetLpStart(num4); soundMaster.ApplyAttenuation(); } rect2 = GUILayoutUtility.GetRect(50f, rect.height, GUILayout.ExpandWidth(expand: false)); float num5 = AudioUI.DrawHorizontalSlider(rect2, 0.1f, 1f, 0.5f, soundMaster.master.lpPower, AudioSliderType.Linear); if (num5 != soundMaster.master.lpPower) { soundMaster.SetLpPower(num5); soundMaster.ApplyAttenuation(); } GUILayout.Label("att", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(75f, rect.height, GUILayout.ExpandWidth(expand: false)); float num6 = AudioUI.DrawHorizontalSlider(rect2, 1f, 30f, 1f, soundMaster.master.falloffStart, AudioSliderType.Log2); if (num6 != soundMaster.master.falloffStart) { soundMaster.SetFalloffStart(num6); soundMaster.ApplyAttenuation(); } rect2 = GUILayoutUtility.GetRect(50f, rect.height, GUILayout.ExpandWidth(expand: false)); float num7 = AudioUI.DrawHorizontalSlider(rect2, 0f, 1f, 0.5f, soundMaster.master.falloffPower, AudioSliderType.Linear); if (num7 != soundMaster.master.falloffPower) { soundMaster.SetFalloffPower(num7); soundMaster.ApplyAttenuation(); } GUILayout.Label("spread", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(50f, rect.height, GUILayout.ExpandWidth(expand: false)); float num8 = AudioUI.DrawHorizontalSlider(rect2, 0f, 1f, 0.5f, soundMaster.master.spreadNear, AudioSliderType.Linear); if (num8 != soundMaster.master.spreadNear) { soundMaster.SetSpreadNear(num8); soundMaster.ApplyAttenuation(); } rect2 = GUILayoutUtility.GetRect(50f, rect.height, GUILayout.ExpandWidth(expand: false)); float num9 = AudioUI.DrawHorizontalSlider(rect2, 0f, 1f, 0f, soundMaster.master.spreadFar, AudioSliderType.Linear); if (num9 != soundMaster.master.spreadFar) { soundMaster.SetSpreadFar(num9); soundMaster.ApplyAttenuation(); } GUILayout.Label("3d", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(50f, rect.height, GUILayout.ExpandWidth(expand: false)); float num10 = AudioUI.DrawHorizontalSlider(rect2, 0f, 1f, 0.5f, soundMaster.master.spatialNear, AudioSliderType.Linear); if (num10 != soundMaster.master.spatialNear) { soundMaster.SetSpatialNear(num10); soundMaster.ApplyAttenuation(); } if (GUILayout.Button("C", GUILayout.Width(32f))) { clipboard = SoundManager.Serialize(soundMaster); } if (GUILayout.Button("V", GUILayout.Width(32f)) && clipboard != null) { SoundManager.Deserialize(soundMaster, clipboard, pasteSample: false); } if (GUILayout.Button("S", GUILayout.Width(32f)) && clipboard != null) { SoundManager.Deserialize(soundMaster, clipboard, pasteSample: true); } bool flag3 = SoundManager.main.state.GetSoundState(soundMaster.master.fullName) != null; if (!flag3 && !soundMaster.master.useMaster && GUILayout.Button("Create Master", GUILayout.ExpandWidth(expand: false))) { soundMaster.SetUseMaster(useMaster: true); } else if ((flag3 || soundMaster.master.useMaster) && soundMaster.master.useMaster != GUILayout.Toggle(soundMaster.master.useMaster, "Master", GUILayout.ExpandWidth(expand: false))) { soundMaster.SetUseMaster(!soundMaster.master.useMaster); if (soundMaster.master.useMaster) { SoundManager.SoundState soundState = SoundManager.main.state.GetSoundState(soundMaster.master.fullName); if (soundState != null) { SoundManager.Deserialize(soundMaster, soundState, pasteSample: true); } SoundManager.GrainState grainState = SoundManager.main.state.GetGrainState(soundMaster.master.fullName); if (grainState != null) { SoundManager.Deserialize(soundMaster, grainState); } } } GUILayout.EndHorizontal(); } } }
private void ShowGrains() { soundScrollPos = GUILayout.BeginScrollView(soundScrollPos, GUILayout.Width(Screen.width)); int num = 0; for (int i = 0; i < activeSounds.sounds.Count; i++) { SoundManager.SoundMaster soundMaster = activeSounds.sounds[i]; Grain grain = soundMaster.master as Grain; if (grain == null) { continue; } Rect rect = GUILayoutUtility.GetRect(Screen.width, 0f); rect.height = 24f; if (num % 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)); } num++; GUILayout.BeginHorizontal(GUILayout.Height(rect.height)); string name = soundMaster.master.name; GUILayout.Label(name, GUILayout.Width(200f)); if (GUILayout.Button(soundMaster.master.sampleLabel, GUILayout.Width(200f))) { SamplePicker.pickSampleSound = soundMaster; if (soundMaster.master.soundSample != null) { SamplePicker.pickCategoryName = soundMaster.master.soundSample.category; } } GUILayout.Label("freq", AudioUI.style, GUILayout.ExpandWidth(expand: false)); Rect rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); float num2 = AudioUI.DrawHorizontalSlider(rect2, 0.5f, 50f, 30f, grain.frequencyAtMaxIntensity, AudioSliderType.Linear); if (num2 != grain.frequencyAtMaxIntensity) { soundMaster.SetGrainFrequency(num2); } GUILayout.Label("lvl", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(100f, rect.height, GUILayout.ExpandWidth(expand: false)); float num3 = AudioUI.DrawHorizontalSlider(rect2, 0f, 1f, 0f, soundMaster.master.baseVolume, AudioSliderType.Volume); if (num3 != soundMaster.master.baseVolume) { soundMaster.SetBaseVolume(num3); } GUILayout.Label("slow", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(75f, rect.height, GUILayout.ExpandWidth(expand: false)); num3 = AudioUI.DrawHorizontalSlider(rect2, 0f, 1f, 1f, grain.slowVolume, AudioSliderType.Volume); if (num3 != grain.slowVolume) { soundMaster.SetGrainSlowVolume(num3); } GUILayout.Label("tune", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(75f, rect.height, GUILayout.ExpandWidth(expand: false)); float num4 = AudioUI.DrawHorizontalSlider(rect2, -2400f, 2400f, 1f, soundMaster.master.basePitch, AudioSliderType.Pitch); if (num4 != soundMaster.master.basePitch) { soundMaster.SetBasePitch(num4); } GUILayout.Label("slow", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(75f, rect.height, GUILayout.ExpandWidth(expand: false)); num4 = AudioUI.DrawHorizontalSlider(rect2, -2400f, 2400f, 1f, grain.slowPitch, AudioSliderType.Pitch); if (num4 != grain.slowPitch) { soundMaster.SetGrainSlowTune(num4); } GUILayout.Label("jitter", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(75f, rect.height, GUILayout.ExpandWidth(expand: false)); float num5 = AudioUI.DrawHorizontalSlider(rect2, 0f, 10f, 0f, grain.fastJitter, AudioSliderType.Linear); if (num5 != grain.fastJitter) { soundMaster.SetGrainFastJitter(num5); } GUILayout.Label("slow", AudioUI.style, GUILayout.ExpandWidth(expand: false)); rect2 = GUILayoutUtility.GetRect(75f, rect.height, GUILayout.ExpandWidth(expand: false)); num5 = AudioUI.DrawHorizontalSlider(rect2, 0f, 10f, 5f, grain.slowJitter, AudioSliderType.Linear); if (num5 != grain.slowJitter) { soundMaster.SetGrainSlowJitter(num5); } if (GUILayout.Button("C", GUILayout.Width(32f))) { clipFrequency = grain.frequencyAtMaxIntensity; clipVol = grain.baseVolume; clipSlowVol = grain.slowVolume; clipTune = grain.basePitch; clipSlowTune = grain.slowPitch; clipFastJitter = grain.fastJitter; clipSlowJitter = grain.slowJitter; } if (GUILayout.Button("V", GUILayout.Width(32f))) { soundMaster.SetGrainFrequency(clipFrequency); soundMaster.SetBaseVolume(clipVol); soundMaster.SetGrainSlowVolume(clipSlowVol); soundMaster.SetBasePitch(clipTune); soundMaster.SetGrainSlowTune(clipSlowTune); soundMaster.SetGrainFastJitter(clipFastJitter); soundMaster.SetGrainSlowJitter(clipSlowJitter); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); }