Пример #1
0
    public FmodReverb getMatchingReverb(FmodReverb oldReverb)
    {
        List <FmodReverb> reverbs = getReverbs();

        foreach (FmodReverb r in reverbs)
        {
            if (r.getName() == oldReverb.getName())
            {
                return(r);
            }
        }
        return(null);
    }
Пример #2
0
    private void _updateReverbStack()
    {
        if (m_reverbStack.Count == 0)
        {
            return;
        }
        m_reverbStack.Sort((x, y) => (int)(y.Priority).CompareTo((int)x.Priority));
        FmodReverbZone newCurrentZone = m_reverbStack[0];


        if (m_currentZone != newCurrentZone)           // we should transition
        {
            float fadeInTime = newCurrentZone.fadeTime;

            // if we are transitionning from a zone back to the global zone, we use the previous fade time
            // to fade out
            if (newCurrentZone == m_globalReverbZone && m_currentZone != m_globalReverbZone)
            {
                m_globalReverb.Initialize(m_globalReverb.getName(), FmodReverb.GLOBAL_REVERB.Properties);
                fadeInTime = m_currentZone.fadeTime;
            }
            FMOD.REVERB_PROPERTIES targetProps = newCurrentZone.GetReverb().getProperties();
            if (fadeInTime <= 0)
            {
                FmodEventSystemHandle handle = new FmodEventSystemHandle();

                m_isInTransition  = false;
                m_startProperties = m_curProperties;
                m_endProperties   = targetProps;
                handle.getEventSystem().setReverbImmediate(targetProps);
                handle.Dispose();
            }
            else
            {
                m_isInTransition        = true;
                m_startProperties       = m_curProperties;
                m_endProperties         = targetProps;
                m_curTransitionDuration = fadeInTime;
                m_curTransitionTime     = 0;
            }
            m_currentZone = newCurrentZone;
        }
    }
Пример #3
0
    private void _SetupDragAndDrop(FmodEventAsset asset)
    {
        Event e = Event.current;

        if (e.type == EventType.MouseUp || e.type == EventType.MouseDown)
        {
            _clearDragAndDrop();
        }
        if (e.type == EventType.MouseDrag)
        {
            FmodEvent  fmodEvent = _getHoveredEvent();
            FmodReverb reverb    = _getHoveredReverb();

            if (fmodEvent != null)
            {
                DragAndDrop.PrepareStartDrag();
                DragAndDrop.paths            = new string[0];
                DragAndDrop.objectReferences = new Object[1] {
                    fmodEvent
                };
                DragAndDrop.SetGenericData(ONGOING_DRAG_KEY, true);
                DragAndDrop.SetGenericData(SOURCE_ASSET_KEY, asset);
                DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
                DragAndDrop.StartDrag("Creating sound from event '" + fmodEvent.getName() + "'");
                m_ongoingDrag = true;
                e.Use();
            }
            else if (reverb != null)
            {
                DragAndDrop.PrepareStartDrag();
                DragAndDrop.paths            = new string[0];
                DragAndDrop.objectReferences = new Object[1] {
                    reverb
                };
                DragAndDrop.SetGenericData(ONGOING_DRAG_KEY, true);
                DragAndDrop.SetGenericData(SOURCE_ASSET_KEY, asset);
                DragAndDrop.visualMode = DragAndDropVisualMode.Move;
                DragAndDrop.StartDrag("Creating reverb zone from reverb '" + reverb.getName() + "'");
                m_ongoingDrag = true;
                e.Use();
            }
        }
    }
Пример #4
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        if (serializedObject != null && serializedObject.targetObject != null)
        {
            FmodReverbZone     zone         = serializedObject.targetObject as FmodReverbZone;
            FmodReverb         reverb       = zone.GetReverb();
            SerializedProperty fadeTimeProp = serializedObject.FindProperty("fadeTime");
            SerializedProperty priorityProp = serializedObject.FindProperty("m_priority");
            bool isGlobal = zone.IsGlobal();

            if (reverb != null)
            {
                EditorGUILayout.LabelField("Name", reverb.getName() + (isGlobal ? " (global reverb)" : ""));
                if (isGlobal)
                {
                    GUI.enabled = false;
                }
                EditorGUILayout.Slider(fadeTimeProp, 0, 100, "Fade Time");
                EditorGUILayout.Slider(priorityProp, 0, 10000, "Priority");
                if (isGlobal)
                {
                    GUI.enabled = true;
                }
                EditorGUILayout.Separator();
                EditorGUILayout.PrefixLabel("Parameters");
                EditorGUI.indentLevel += 1;
                GUI.enabled            = false;
                EditorGUILayout.IntSlider("Master level", (int)((float)reverb.Room / 100), -100, 0);
                EditorGUILayout.IntSlider("Decay Time", (int)(reverb.DecayTime * 1000), 100, 20000);
                EditorGUILayout.Slider("HF Decay Ratio", reverb.DecayHFRatio, 0.1f, 2);
                EditorGUILayout.IntSlider("Pre Delay", (int)(reverb.ReflectionsDelay * 1000), 0, 300);
                EditorGUILayout.IntSlider("Late Delay", (int)(reverb.ReverbDelay * 1000), 0, 100);
                EditorGUILayout.Slider("Early Reflections", ((float)reverb.Reflections / 100), -100, 10);
                EditorGUILayout.Slider("Late Reflections", ((float)reverb.Reverb / 100), -100, 20);
                EditorGUILayout.IntSlider("Diffusion", (int)reverb.Diffusion, 0, 100);
                EditorGUILayout.IntSlider("Density", (int)reverb.Density, 0, 100);
                EditorGUILayout.Slider("HF Gain", ((float)reverb.RoomHF / 100), -100, 0);
                EditorGUILayout.Slider("LF Gain", ((float)reverb.RoomLF / 100), -100, 0);
                EditorGUILayout.IntSlider("HF Crossover", (int)reverb.HFReference, 20, 20000);
                EditorGUILayout.IntSlider("LF Crossover", (int)reverb.LFReference, 20, 1000);
                GUI.enabled            = true;
                EditorGUI.indentLevel -= 1;

                serializedObject.ApplyModifiedProperties();
            }
            else
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("Name");
                EditorGUILayout.HelpBox("No Reverb is set", MessageType.Error);
                EditorGUILayout.EndHorizontal();
                GUI.enabled = false;
                EditorGUILayout.FloatField("Fade Time", 3);
                GUI.enabled = true;
                EditorGUILayout.Separator();
                EditorGUILayout.PrefixLabel("Parameters");
                GUI.enabled            = false;
                EditorGUI.indentLevel += 1;
                EditorGUILayout.IntSlider("Master level", 0, -100, 0);
                EditorGUILayout.IntSlider("Decay Time", 100, 100, 20000);
                EditorGUILayout.Slider("HF Decay Ratio", 0.1f, 0.1f, 2);
                EditorGUILayout.IntSlider("Pre Delay", 0, 0, 300);
                EditorGUILayout.IntSlider("Late Delay", 0, 0, 100);
                EditorGUILayout.Slider("Early Reflections", -100, -100, 10);
                EditorGUILayout.Slider("Late Reflections", -100, -100, 20);
                EditorGUILayout.IntSlider("Diffusion", 0, 0, 100);
                EditorGUILayout.IntSlider("Density", 0, 0, 100);
                EditorGUILayout.Slider("HF Gain", -100, -100, 0);
                EditorGUILayout.Slider("LF Gain", -100, -100, 0);
                EditorGUILayout.IntSlider("HF Crossover", 20, 20, 20000);
                EditorGUILayout.IntSlider("LF Crossover", 20, 20, 1000);
                EditorGUI.indentLevel -= 1;
                GUI.enabled            = true;
            }
        }
    }
Пример #5
0
    public FmodReverb getMatchingReverb(FmodReverb oldReverb)
    {
        List<FmodReverb> reverbs = getReverbs();

        foreach (FmodReverb r in reverbs) {
            if (r.getName() == oldReverb.getName()) {
                return (r);
            }
        }
        return (null);
    }