예제 #1
0
파일: S.cs 프로젝트: optimus-code/Q2Sharp
        public static void Init( )
        {
            Com.Printf("\\n------- sound initialization -------\\n");
            cvar_t cv = Cvar.Get("s_initsound", "1", 0);

            if (cv.value == 0F)
            {
                Com.Printf("not initializing.\\n");
                UseDriver("dummy");
                return;
            }

            var defaultDriver = "dummy";

            if (drivers.Count > 1)
            {
                defaultDriver = (( ISound )drivers.Last()).GetName();
            }

            s_impl = Cvar.Get("s_impl", defaultDriver, Defines.CVAR_ARCHIVE);
            UseDriver(s_impl.string_renamed);
            if (impl.Init())
            {
                Cvar.Set("s_impl", impl.GetName());
            }
            else
            {
                UseDriver("dummy");
            }

            Com.Printf("\\n------- use sound driver \\\"" + impl.GetName() + "\\\" -------\\n");
            StopAllSounds();
        }
예제 #2
0
파일: S.cs 프로젝트: optimus-code/Q2Sharp
        public static void UseDriver(String driverName)
        {
            ISound driver = null;
            var    count  = drivers.Count;

            for (var i = 0; i < count; i++)
            {
                driver = ( ISound )drivers[i];
                if (driver.GetName().Equals(driverName))
                {
                    impl = driver;
                    return;
                }
            }

            impl = ( ISound )drivers.Last();
        }