当前位置: 首页>>代码示例>>C#>>正文


C# FMOD.getNumParameters方法代码示例

本文整理汇总了C#中FMOD.getNumParameters方法的典型用法代码示例。如果您正苦于以下问题:C# FMOD.getNumParameters方法的具体用法?C# FMOD.getNumParameters怎么用?C# FMOD.getNumParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FMOD的用法示例。


在下文中一共展示了FMOD.getNumParameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Initialize

    public void Initialize(FMOD.Event e, FmodEventGroup eventGroup, int indexInGroup, FmodEventAsset asset)
    {
        #if UNITY_EDITOR
        FMOD.EVENT_INFO info = new FMOD.EVENT_INFO();
        FMOD.GUID guid = new FMOD.GUID();
        FMOD.EventParameter param = null;
        FMOD.RESULT result = FMOD.RESULT.OK;
        FmodEventParameter toAdd = null;
        IntPtr name = new IntPtr(0);
        int numParameters = 0;
        int index = 0;

        Initialize(eventGroup, indexInGroup, asset);
        int size = System.Runtime.InteropServices.Marshal.SizeOf(typeof(FMOD.GUID));
        info.guid = System.Runtime.InteropServices.Marshal.AllocHGlobal(size);
        result = e.getInfo(ref index, ref name, ref info);
        ERRCHECK(result);
        m_name = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(name);
        this.name = m_name;
        guid = (FMOD.GUID)System.Runtime.InteropServices.Marshal.PtrToStructure(info.guid, typeof(FMOD.GUID));
        m_guidString = "{" + String.Format("{0:x8}-{1:x4}-{2:x4}-{3:x2}{4:x2}-{5:x2}{6:x2}{7:x2}{8:x2}{9:x2}{10:x2}",
            guid.Data1, guid.Data2, guid.Data3,
            guid.Data4[0], guid.Data4[1],
            guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]
        ) + "}";

        int mode = 0;
        IntPtr modePtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(sizeof(int));
        e.getPropertyByIndex((int)FMOD.EVENTPROPERTY.MODE, modePtr, false);
        mode = System.Runtime.InteropServices.Marshal.ReadInt32(modePtr);
        System.Runtime.InteropServices.Marshal.FreeHGlobal(modePtr);
        m_sourceType = (SourceType)mode;

        if (m_sourceType == SourceType.SOURCE_3D) {
            IntPtr range;
            float[] tmp = new float[1];
            int[] tmpInt = new int[1];

            range = System.Runtime.InteropServices.Marshal.AllocHGlobal(sizeof(int));
            result = e.getPropertyByIndex((int)FMOD.EVENTPROPERTY._3D_ROLLOFF, range, false);
            ERRCHECK(result);
            System.Runtime.InteropServices.Marshal.Copy(range, tmpInt, 0, 1);
            if (tmpInt[0] == (int)FMOD.MODE._3D_CUSTOMROLLOFF) {
                m_rolloffType = RolloffType.CUSTOM;
            } else if (tmpInt[0] == (int)FMOD.MODE._3D_INVERSEROLLOFF) {
                m_rolloffType = RolloffType.INVERSE;
            } else if (tmpInt[0] == (int)FMOD.MODE._3D_LINEARROLLOFF) {
                m_rolloffType = RolloffType.LINEAR;
            } else if (tmpInt[0] == (int)FMOD.MODE._3D_LINEARSQUAREROLLOFF) {
                m_rolloffType = RolloffType.LINEARSQUARE;
            } else if (tmpInt[0] == (int)FMOD.MODE._3D_LOGROLLOFF) {
                m_rolloffType = RolloffType.LOGARITHMIC;
            }
            System.Runtime.InteropServices.Marshal.FreeHGlobal(range);

            range = System.Runtime.InteropServices.Marshal.AllocHGlobal(sizeof(float));
            result = e.getPropertyByIndex((int)FMOD.EVENTPROPERTY._3D_MINDISTANCE, range, false);
            ERRCHECK(result);
            System.Runtime.InteropServices.Marshal.Copy(range, tmp, 0, 1);
            m_minRange = tmp[0];
            System.Runtime.InteropServices.Marshal.FreeHGlobal(range);
            range = System.Runtime.InteropServices.Marshal.AllocHGlobal(sizeof(float));
            result = e.getPropertyByIndex((int)FMOD.EVENTPROPERTY._3D_MAXDISTANCE, range, false);
            ERRCHECK(result);
            System.Runtime.InteropServices.Marshal.Copy(range, tmp, 0, 1);
            m_maxRange = tmp[0];
            System.Runtime.InteropServices.Marshal.FreeHGlobal(range);
        }

        e.getNumParameters(ref numParameters);
        for (int k = 0; k < numParameters; k++) {
            e.getParameterByIndex(k, ref param);
            toAdd = FmodEventParameter.CreateInstance("FmodEventParameter") as FmodEventParameter;
            toAdd.Initialize(param, this);
            m_parameters.Add(toAdd);
        }
        m_wasLoaded = true;
        #endif
    }
开发者ID:Bourinours,项目名称:Projet_Son,代码行数:79,代码来源:FmodEvent.cs


注:本文中的FMOD.getNumParameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。