Esempio n. 1
0
 public ParameterDescription(PARAMETER_DESCRIPTION description)
     : this()
 {
     Name    = description.name;
     Minimum = description.minimum;
     Maximum = description.maximum;
     Type    = (ParameterType)description.type;
 }
Esempio n. 2
0
 private float getParamValueOrDefault(PARAMETER_DESCRIPTION param)
 {
     if (playingPath == selectedPath)
     {
         playing.getParameterValue(param.name, out _, out float result);
         return(result);
     }
     return(param.defaultvalue);
 }
        /// <summary>
        /// Get all important information of ParameterInstance
        /// Return a parameterInfo with:
        /// -ParameterName
        /// -ParameterRange(start,end)
        /// </summary>
        /// <param name="instance">current ParameterInstance</param>
        /// <returns></returns>
        private ParameterData GetParameterName(ParameterInstance instance)
        {
            ///Create the parameter description
            ///useflue to get all information
            PARAMETER_DESCRIPTION desc = new PARAMETER_DESCRIPTION();

            instance.getDescription(out desc);
            ParameterData parameterInfo = new ParameterData(instance, desc.name, desc.minimum, desc.maximum, desc.defaultvalue);

            return(parameterInfo);
        }
Esempio n. 4
0
    void OnGUI()
    {
        boundactive = false;
        GUI.depth   = -5000;
        if (editing == this)
        {
            if (Vector3.Dot(Camera.main.transform.forward, (transform.position - Camera.main.transform.position).normalized) > 0.1f)
            {
                GUI.skin = gskin;
                Vector3 screenPoint = Camera.main.WorldToScreenPoint(transform.position);
                screenPoint.x -= 30f;
                screenPoint.y -= 25f;

                int height = 120;
                if (audioSrc.audioInst != null)
                {
                    int slidercnt = 0;
                    audioSrc.audioInst.getParameterCount(out slidercnt);
                    height = 304 + 25 * slidercnt;
                }

                GUI.BeginGroup(new Rect(screenPoint.x, Screen.height - screenPoint.y, 300, height));
                GUI.Box(new Rect(0, 0, 300, height), "");
                GUILayout.BeginHorizontal();
                GUILayout.Space(5);
                GUILayout.BeginVertical();
                GUILayout.Space(8);
                {
                    GUILayout.Label("Load Event");
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Space(13);
                        inputPath = GUILayout.TextField(inputPath, GUILayout.Width(200));
                        if (GUILayout.Button("Load", GUILayout.Width(50)))
                        {
                            audioSrc.path = inputPath;
                        }
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.Space(15);
                    GUILayout.Label("Audio Settings");
                    if (audioSrc.audioInst != null)
                    {
                        EventDescription desc = null;
                        audioSrc.audioInst.getDescription(out desc);
                        if (desc != null && desc.isValid())
                        {
                            bool is3D = false;
                            desc.is3D(out is3D);
                            bool isOneshot = false;
                            desc.isOneshot(out isOneshot);
                            float mindist = 0, maxdist = 0;
                            if (is3D)
                            {
                                desc.getMinimumDistance(out mindist);
                                desc.getMaximumDistance(out maxdist);
                                boundactive = true;
                                bound.transform.localScale = Vector3.one * audioSrc.maxDistance * 2f;
                            }
                            string is3Dstr = is3D ? "3D Sound" : "2D Sound";
                            string diststr = is3D ? ("Distance Area ( " + mindist.ToString("0.##") + "m ~ " + maxdist.ToString("0.##") + "m )") : ("");

                            if (listener != null)
                            {
                                LabelField("Distance", listenDist.ToString("#,##0.00") + " m");
                            }
                            else
                            {
                                LabelField("Distance", "-");
                            }

                            LabelField(is3Dstr, diststr);

                            audioSrc.minDistance = FloatField("Min Dist", audioSrc.minDistance);
                            audioSrc.maxDistance = FloatField("Max Dist", audioSrc.maxDistance);

                            LabelField("Is Oneshot", isOneshot.ToString());

                            audioSrc.volume = Slider("Volume", audioSrc.volume, 0f, 1f);
                            audioSrc.pitch  = Slider("Pitch", audioSrc.pitch, 0f, 4f);

                            int pcnt = 0;
                            audioSrc.audioInst.getParameterCount(out pcnt);

                            for (int i = 0; i < pcnt; ++i)
                            {
                                ParameterInstance pinst = null;
                                audioSrc.audioInst.getParameterByIndex(i, out pinst);
                                PARAMETER_DESCRIPTION pdesc = new PARAMETER_DESCRIPTION();
                                pinst.getDescription(out pdesc);
                                float val = 0f, _val = 0f;
                                pinst.getValue(out val);
                                _val = Slider(pdesc.name, val, pdesc.minimum, pdesc.maximum);
                                if (_val != val)
                                {
                                    pinst.setValue(_val);
                                }
                            }

                            GUILayout.Space(8);
                            GUILayout.BeginHorizontal();
                            {
                                GUILayout.Space(17);
                                if (GUILayout.Button("Play", GUILayout.Width(80)))
                                {
                                    audioSrc.Play();
                                }
                                GUILayout.Space(4);
                                if (GUILayout.Button("Stop", GUILayout.Width(80)))
                                {
                                    audioSrc.Stop();
                                }
                                GUILayout.Space(4);
                                if (GUILayout.Button("Unload", GUILayout.Width(80)))
                                {
                                    audioSrc.path = "";
                                }
                            }
                            GUILayout.EndHorizontal();
                        }
                    }
                    else
                    {
                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.Space(13);
                            GUILayout.Label("No Event Loaded");
                        }
                        GUILayout.EndHorizontal();
                    }
                }
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
                GUI.EndGroup();
            }
            else
            {
                if (audioSrc.is3D)
                {
                    boundactive = true;
                    bound.transform.localScale = Vector3.one * audioSrc.maxDistance * 2f;
                }
            }
        }
    }
 private static extern RESULT FMOD_Studio_EventDescription_GetParameter(IntPtr eventdescription, string name, out PARAMETER_DESCRIPTION parameter);
 private static extern RESULT FMOD_Studio_EventDescription_GetParameterByIndex(IntPtr eventdescription, int index, out PARAMETER_DESCRIPTION parameter);
 public RESULT getParameter(string name, out PARAMETER_DESCRIPTION parameter)
 {
     parameter = new FMOD.Studio.PARAMETER_DESCRIPTION();
     return FMOD_Studio_EventDescription_GetParameter(rawPtr, name, out parameter);
 }
 public RESULT getParameterByIndex(int index, out PARAMETER_DESCRIPTION parameter)
 {
     parameter = new FMOD.Studio.PARAMETER_DESCRIPTION();
     return FMOD_Studio_EventDescription_GetParameterByIndex(rawPtr, index, out parameter);
 }
Esempio n. 9
0
            public RESULT getParameter(string name, out PARAMETER_DESCRIPTION parameter)
            {
                parameter = new PARAMETER_DESCRIPTION();

                PARAMETER_DESCRIPTION_INTERNAL paramInternal;
                RESULT result = FMOD_Studio_EventDescription_GetParameter(rawPtr, Encoding.UTF8.GetBytes(name + Char.MinValue), out paramInternal);
                if (result != RESULT.OK)
                {
                return result;
                }
                paramInternal.assign(out parameter);
                return result;
            }
Esempio n. 10
0
            public RESULT getParameterByIndex(int index, out PARAMETER_DESCRIPTION parameter)
            {
                parameter = new PARAMETER_DESCRIPTION();

                PARAMETER_DESCRIPTION_INTERNAL paramInternal;
                RESULT result = FMOD_Studio_EventDescription_GetParameterByIndex(rawPtr, index, out paramInternal);
                if (result != RESULT.OK)
                {
                return result;
                }
                paramInternal.assign(out parameter);
                return result;
            }
Esempio n. 11
0
            public PARAMETER_TYPE type; /* Type of the parameter */

            // Helper functions
            public void assign(out PARAMETER_DESCRIPTION publicDesc)
            {
                publicDesc.name = MarshallingHelper.stringFromNativeUtf8(name);
                publicDesc.minimum = minimum;
                publicDesc.maximum = maximum;
                publicDesc.type = type;
            }
Esempio n. 12
0
            public RESULT getDescription(out PARAMETER_DESCRIPTION description)
            {
                description = new PARAMETER_DESCRIPTION();

                PARAMETER_DESCRIPTION_INTERNAL paramInternal;
                RESULT result = FMOD_Studio_ParameterInstance_GetDescription(rawPtr, out paramInternal);
                if (result != RESULT.OK)
                {
                return result;
                }
                paramInternal.assign(out description);
                return result;
            }