Пример #1
0
        public void UpdateSound(string name,ref FMOD.Sound s,Boolean Loop)
        {
            FMOD.RESULT result;
            string strNameSpace =
            System.Reflection.Assembly.GetExecutingAssembly().GetName().Name.ToString();

            Stream str = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(strNameSpace + ".Sounds." + name);

            //Block = new Bitmap(str);
            byte[] Arr = new byte[str.Length];
            str.Read(Arr, 0, (int)str.Length);
            FMOD.CREATESOUNDEXINFO inf = new FMOD.CREATESOUNDEXINFO();
            inf.cbsize = Marshal.SizeOf(inf);
            inf.length = (uint)str.Length;

            result = soundsystem.createSound(Arr, FMOD.MODE.SOFTWARE | FMOD.MODE.OPENMEMORY | FMOD.MODE._3D, ref inf, ref s);
            ERRCHECK(result);

            if (!Loop)
                s.setMode(FMOD.MODE.LOOP_OFF);
            else
                s.setMode(FMOD.MODE.LOOP_NORMAL);

            ERRCHECK(result);
        }