Esempio n. 1
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public static bool EachFrame()         // ret: ? 処理した。
        {
            if (1 <= PlayInfos.Count)
            {
                PlayInfo info = PlayInfos.Dequeue();

                if (info != null)
                {
                    switch (info.AlterCommand)
                    {
                    case PlayInfo.AlterCommand_e.NORMAL:
                        info.SE.HandleIndex %= DDSE.HANDLE_COUNT;
                        DDSoundUtils.Play(info.SE.Sound.GetHandle(info.SE.HandleIndex++));
                        break;

                    case PlayInfo.AlterCommand_e.STOP:
                        for (int index = 0; index < DDSE.HANDLE_COUNT; index++)
                        {
                            DDSoundUtils.Stop(info.SE.Sound.GetHandle(index));
                        }
                        break;

                    case PlayInfo.AlterCommand_e.LOOP:
                        DDSoundUtils.Play(info.SE.Sound.GetHandle(0), false);
                        break;

                    default:
                        throw new DDError();
                    }
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 2
0
        public DDSound(Func <byte[]> getFileData, int handleCount)
        {
            this.Func_GetFileData = getFileData;
            this.HandleCount      = handleCount;

            DDSoundUtils.Add(this);
        }
Esempio n. 3
0
        public static void EachFrame()
        {
            if (1 <= PlayInfos.Count)
            {
                PlayInfo info = PlayInfos.Dequeue();

                if (info != null)
                {
                    switch (info.Command)
                    {
                    case PlayInfo.Command_e.PLAY:
                        DDSoundUtils.Play(info.Music.Sound.GetHandle(0), info.Once, info.Resume);
                        break;

                    case PlayInfo.Command_e.VOLUME_RATE:
                        DDSoundUtils.SetVolume(info.Music.Sound.GetHandle(0), DDSoundUtils.MixVolume(DDGround.MusicVolume, info.Music.Volume) * info.VolumeRate);
                        break;

                    case PlayInfo.Command_e.STOP:
                        DDSoundUtils.Stop(info.Music.Sound.GetHandle(0));
                        break;

                    default:
                        throw new DDError();
                    }
                }
            }
        }
Esempio n. 4
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public DDMusic(DDSound sound_binding)
        {
            this.Sound            = sound_binding;
            this.Sound.PostLoaded = () => DDSoundUtils.SetVolume(this.Sound.GetHandle(0), 0.0);             // ロードしたらミュートしておく。

            DDMusicUtils.Add(this);
        }
Esempio n. 5
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public void UpdateVolume_NoCheck()
        {
            double mixedVolume = DDSoundUtils.MixVolume(DDGround.SEVolume, this.Volume);

            for (int index = 0; index < HANDLE_COUNT; index++)
            {
                DDSoundUtils.SetVolume(this.Sound.GetHandle(index), mixedVolume);
            }
        }