コード例 #1
0
        public SoundSystem()
        {
            var ret = FMOD.Result.OK;

            system = null;

            try
            {
                FMOD.Factory.CreateSystem(ref system);
            }
            catch (DllNotFoundException)
            {
                return;
            }
            if (ret != FMOD.Result.OK)
            {
                return;
            }
            ret = system.Initialize(8, FMOD.InitFlags.Normal, IntPtr.Zero);
            if (ret != FMOD.Result.OK)
            {
                system = null;
                return;
            }
            sounds       = new Dictionary <string, Sound>();
            music        = null;
            musicChannel = null;
        }
コード例 #2
0
ファイル: SoundSystem.cs プロジェクト: dragontamer8740/Noxico
        public SoundSystem()
        {
            var ret = FMOD.Result.OK;

            system = null;
            Program.WriteLine("SoundSystem: _ctor");
            if (!IniFile.GetValue("audio", "enabled", true))
            {
                return;
            }
            musicVolume = IniFile.GetValue("audio", "musicvolume", 100) / 100f;
            soundVolume = IniFile.GetValue("audio", "soundvolume", 100) / 100f;

            Program.Write("SoundSystem: trying to create FMOD system...");
            try
            {
                FMOD.Factory.CreateSystem(ref system);
            }
            catch (DllNotFoundException)
            {
                Program.WriteLine(" Library not found. Disabling sound.");
                return;
            }
            Program.WriteLine(" " + ret.ToString());
            if (ret != FMOD.Result.OK)
            {
                return;
            }
            Program.Write("SoundSystem: system.init...");
            ret = system.Initialize(8, FMOD.InitFlags.Normal, IntPtr.Zero);
            Program.WriteLine(" " + ret.ToString());
            if (ret != FMOD.Result.OK)
            {
                system = null;
                return;
            }
            music        = null;
            musicChannel = null;

            sounds = new Dictionary <string, Sound>();

            Program.WriteLine("SoundSystem: loading libraries...");
            musicLibrary = Mix.GetTokenTree("music.tml");
            soundLibrary = Mix.GetTokenTree("sound.tml");

            Program.WriteLine("SoundSystem: _ctor DONE");
            Program.WriteLine("Null report:");
            if (system == null)
            {
                Program.WriteLine(" * system");
            }
            if (music == null)
            {
                Program.WriteLine(" * music");
            }
            if (musicChannel == null)
            {
                Program.WriteLine(" * musicChannel");
            }
        }