コード例 #1
0
        public BASSDriver(String pluginFolder)
        {
            SupportedExtensions = ".MP3|.WAV|.OGG|.MID|.IT|.S3M|.XM";

            //C:\Users\BC_Programming\AppData\Roaming\BASeBlock\Lib\x86
            //or, the application data folder \Lib\x86...
            if (!Directory.Exists(TetrisGame.AppDataFolder))
            {
            }

            String[] x86DLL = (from s in TetrisGame.GetSearchFolders() select Path.Combine(s, "Lib\\x86")).ToArray();
            String[] x64DLL = (from s in TetrisGame.GetSearchFolders() select Path.Combine(s, "Lib\\x64")).ToArray();

            string pathuse = LoadProperDLL(x86DLL, x64DLL); //load the x64 or x86 version as needed


            //Interestingly, switching to ManagedBass seems to have <removed> the ability to load DLLs from a particular folder.
            //Though- turns out the program was set to always build x86 anyway.

            var result = ManagedBass.Bass.Init(-1, 44100, ManagedBass.DeviceInitFlags.Default, IntPtr.Zero);

            loadedbassplugs = BassLoadPluginsDir(pathuse);
            //ManagedBass.Bass.SetConfig(BASSConfig.BASS_CONFIG_BUFFER, 10 + info.minbuf + 1);
            // default buffer size = update period + 'minbuf' + 1ms extra margin

            //buflen = BASS_GetConfig(BASS_CONFIG_BUFFER);


            /*
             * if (PluginFolder.Length > 0)
             * {
             *    Dictionary<int,String> loadedbassplugs = ManagedBass.Bass.PluginLoadDirectory(PluginFolder);
             *    if (loadedbassplugs != null) //added Feb 16 2010
             *    {
             *        foreach (KeyValuePair<int, String> kvp in loadedbassplugs)
             *        {
             *            Debug.Print(kvp.Key.ToString() + ":" + kvp.Value);
             *            String pluginfile = kvp.Value;
             *            if (Path.GetFileNameWithoutExtension(pluginfile).Equals("bassflac", StringComparison.OrdinalIgnoreCase))
             *            {
             *                //add flac
             *                SupportedExtensions += "|.FLAC";
             *
             *            }
             *
             *        }
             *    }
             * }*/
        }