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


C# System.getNumDrivers方法代码示例

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


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

示例1: fmodSetup

        //This function is called by the loadSystem function. It sets up FMOD for the rest of
        //the program, like an "init" of sorts. Most of this code is boilerplate that is used in
        //every FMOD application.
        private FMOD.System fmodSetup()
        {
            FMOD.System t_system = new FMOD.System();
            FMOD.RESULT result = new FMOD.RESULT();
            uint version = 0;
            int numDrivers = 0;
            FMOD.SPEAKERMODE speakerMode = FMOD.SPEAKERMODE.STEREO;
            FMOD.CAPS caps = FMOD.CAPS.NONE;
            StringBuilder name = null;

            // Create FMOD interface object
            result = FMOD.Factory.System_Create(ref t_system);
            FMODErrorCheck(result);

            // Check version
            result = t_system.getVersion(ref version);
            FMODErrorCheck(result);

            if (version < FMOD.VERSION.number)
            {
                Console.WriteLine("Error! You are using an old version of FMOD " + version + ". This program requires " + FMOD.VERSION.number);
                return null;
            }

            //Check Sound Cards, if none, disable sound
            result = t_system.getNumDrivers(ref numDrivers);
            FMODErrorCheck(result);

            if (numDrivers == 0)
            {
                result = t_system.setOutput(FMOD.OUTPUTTYPE.NOSOUND);
                FMODErrorCheck(result);
            }
            // At least one sound card
            else
            {

                // Get the capabilities of the default (0) sound card
                result = t_system.getDriverCaps(0, ref caps, ref zero, ref speakerMode);
                FMODErrorCheck(result);

                // Set the speaker mode to match that in Control Panel
                result = t_system.setSpeakerMode(speakerMode);
                FMODErrorCheck(result);

                // Increase buffer size if user has Acceleration slider set to off
                if (FMOD.CAPS.HARDWARE_EMULATED.Equals(true))
                {
                    result = t_system.setDSPBufferSize(1024, 10);
                    FMODErrorCheck(result);
                }
                // Get name of driver
                FMOD.GUID temp = new FMOD.GUID();

                result = t_system.getDriverInfo(0, name, 256, ref temp);
                FMODErrorCheck(result);
            }
            System.IntPtr temp2 = new System.IntPtr();
            // Initialise FMOD
            result = t_system.init(100, FMOD.INITFLAGS.NORMAL, temp2);

            // If the selected speaker mode isn't supported by this sound card, switch it back to stereo
            if (result == FMOD.RESULT.ERR_OUTPUT_CREATEBUFFER)
            {
                result = t_system.setSpeakerMode(FMOD.SPEAKERMODE.STEREO);
                FMODErrorCheck(result);

                result = t_system.init(100, FMOD.INITFLAGS.NORMAL, temp2);
            }

            FMODErrorCheck(result);

            return t_system;
        }
开发者ID:SkuliSheepman,项目名称:BeatDetectorForGames,代码行数:77,代码来源:BeatDetector.cs


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