コード例 #1
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            uint version = 0;

            FMOD.RESULT result;

            /*
             *  Create a System object and initialize.
             */
            result = FMOD.Factory.System_Create(ref system);
            ERRCHECK(result);

            result = system.getVersion(ref version);
            ERRCHECK(result);
            if (version < FMOD.VERSION.number)
            {
                MessageBox.Show("Error!  You are using an old version of FMOD " + version.ToString("X") + ".  This program requires " + FMOD.VERSION.number.ToString("X") + ".");
                Application.Exit();
            }

            /*
             *   Set the source directory for all of the FMOD plugins.
             */
            result = system.setPluginPath("../../../../../api/plugins");
            ERRCHECK(result);

            /*
             *  Load up an extra plugin that is not normally used by FMOD.
             */
            uint handle = 0;

            result = system.loadPlugin("output_mp3.dll", ref handle, 0);
            if (result == FMOD.RESULT.ERR_FILE_NOTFOUND)
            {
                /*
                 *  If it isn't in the same directory, try for the plugin directory.
                 */
                result = system.loadPlugin("../../../../../examples/plugin_dev/output_mp3/output_mp3.dll", ref handle, 0);
                ERRCHECK(result);
            }

            /*
             *  Display plugins
             */
            {
                int           num  = 0;
                StringBuilder name = new StringBuilder(256);

                result = system.getNumPlugins(FMOD.PLUGINTYPE.CODEC, ref num);
                ERRCHECK(result);
                for (int count = 0; count < num; count++)
                {
                    FMOD.PLUGINTYPE plugin_type = FMOD.PLUGINTYPE.CODEC;

                    result = system.getPluginHandle(FMOD.PLUGINTYPE.CODEC, count, ref handle);
                    ERRCHECK(result);

                    result = system.getPluginInfo(handle, ref plugin_type, name, name.Capacity, ref version);
                    ERRCHECK(result);

                    codecList.Items.Add(name);
                }

                result = system.getNumPlugins(FMOD.PLUGINTYPE.DSP, ref num);
                ERRCHECK(result);
                for (int count = 0; count < num; count++)
                {
                    FMOD.PLUGINTYPE plugin_type = FMOD.PLUGINTYPE.DSP;

                    result = system.getPluginHandle(FMOD.PLUGINTYPE.DSP, count, ref handle);
                    ERRCHECK(result);

                    result = system.getPluginInfo(handle, ref plugin_type, name, name.Capacity, ref version);
                    ERRCHECK(result);

                    dspList.Items.Add(name);
                }

                result = system.getNumPlugins(FMOD.PLUGINTYPE.OUTPUT, ref num);
                ERRCHECK(result);
                for (int count = 0; count < num; count++)
                {
                    FMOD.PLUGINTYPE plugin_type = FMOD.PLUGINTYPE.OUTPUT;

                    result = system.getPluginHandle(FMOD.PLUGINTYPE.OUTPUT, count, ref handle);
                    ERRCHECK(result);

                    result = system.getPluginInfo(handle, ref plugin_type, name, name.Capacity, ref version);
                    ERRCHECK(result);

                    outputList.Items.Add(name);
                }
            }
        }