示例#1
0
        public int GetHandle(int handleIndex)
        {
            if (this.Handles == null)
            {
                this.Handles = new int[this.HandleCount];

                {
                    byte[] fileData = this.Func_GetFileData();
                    int    handle   = -1;

#if false // SetLoop*SamplePosSoundMem が正常に動作しない。@ 2021.4.30
                    using (WorkingDir wd = new WorkingDir())
                    {
                        string file = wd.MakePath();
                        File.WriteAllBytes(file, fileData);
                        handle = DX.LoadSoundMem(file);
                    }
#else
                    DDSystem.PinOn(fileData, p => handle = DX.LoadSoundMemByMemImage(p, fileData.Length));                     // DxLibDotNet3_22c で正常に動作しない。@ 2021.4.18
#endif

                    if (handle == -1)                     // ? 失敗
                    {
                        throw new DDError("Sound File SHA-512: " + SCommon.Hex.ToString(SCommon.GetSHA512(fileData)));
                    }

                    this.Handles[0] = handle;
                }

                for (int index = 1; index < this.HandleCount; index++)
                {
                    int handle = DX.DuplicateSoundMem(this.Handles[0]);

                    if (handle == -1)                     // ? 失敗
                    {
                        throw new DDError();
                    }

                    this.Handles[index] = handle;
                }

                this.PostLoaded();

                foreach (Action routine in this.PostLoaded2)
                {
                    routine();
                }
            }
            return(this.Handles[handleIndex]);
        }
示例#2
0
        public static int FileData2SoftImage(byte[] fileData)
        {
            int siHandle = -1;

            DDSystem.PinOn(fileData, p => siHandle = DX.LoadSoftImageToMem(p, fileData.Length));

            if (siHandle == -1)
            {
                throw new DDError();
            }

            int w;
            int h;

            GetSoftImageSize(siHandle, out w, out h);

            // RGB -> RGBA
            {
                int h2 = DX.MakeARGB8ColorSoftImage(w, h);

                if (h2 == -1)                 // ? 失敗
                {
                    throw new DDError();
                }

                if (DX.BltSoftImage(0, 0, w, h, siHandle, 0, 0, h2) != 0)                 // ? 失敗
                {
                    throw new DDError();
                }

                if (DX.DeleteSoftImage(siHandle) != 0)                 // ? 失敗
                {
                    throw new DDError();
                }

                siHandle = h2;
            }

            return(siHandle);
        }
示例#3
0
        public int GetHandle(int handleIndex)
        {
            if (this.Handles == null)
            {
                this.Handles = new int[1];

                {
                    byte[] fileData = this.Func_GetFileData();
                    int    handle   = -1;

#if false // SetLoop*SamplePosSoundMem が正常に動作しない。@ 2021.4.30
                    using (WorkingDir wd = new WorkingDir())
                    {
                        string file = wd.MakePath();
                        File.WriteAllBytes(file, fileData);
                        handle = DX.LoadSoundMem(file);
                    }
#else
                    DDSystem.PinOn(fileData, p => handle = DX.LoadSoundMemByMemImage(p, fileData.Length));                     // DxLibDotNet3_22c で正常に動作しない。@ 2021.4.18
#endif

                    if (handle == -1)                     // ? 失敗
                    {
                        throw new DDError();
                    }

                    this.Handles[0] = handle;
                }

                foreach (Action <int> routine in this.PostLoadeds)
                {
                    routine(this.Handles[0]);
                }
            }
            return(this.Handles[handleIndex]);
        }
示例#4
0
        public int GetHandle(int handleIndex)
        {
            if (this.Handles == null)
            {
                this.Handles = new int[this.HandleCount];

                {
                    byte[] fileData = this.Func_GetFileData();
                    int    handle   = -1;

                    DDSystem.PinOn(fileData, p => handle = DX.LoadSoundMemByMemImage(p, fileData.Length));

                    if (handle == -1)                     // ? 失敗
                    {
                        throw new DDError();
                    }

                    this.Handles[0] = handle;
                }

                for (int index = 1; index < this.HandleCount; index++)
                {
                    int handle = DX.DuplicateSoundMem(this.Handles[0]);

                    if (handle == -1)                     // ? 失敗
                    {
                        throw new DDError();
                    }

                    this.Handles[index] = handle;
                }

                this.PostLoaded();
            }
            return(this.Handles[handleIndex]);
        }
示例#5
0
 public static void INIT()
 {
     DDSystem.Pin(StatusMap);
 }