コード例 #1
0
        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);
        }
コード例 #2
0
        public DDMusic(DDSound sound_binding)
        {
            this.Sound = sound_binding;
            this.Sound.PostLoadeds.Add(handle => DDSoundUtils.SetVolume(handle, 0.0));             // ロードしたらミュートしておく。

            DDMusicUtils.Add(this);
        }
コード例 #3
0
        public DDSound(Func <byte[]> getFileData, int handleCount)
        {
            this.Func_GetFileData = getFileData;
            this.HandleCount      = handleCount;

            DDSoundUtils.Add(this);
        }
コード例 #4
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();
                    }
                }
            }
        }
コード例 #5
0
        public DDMusic(DDSound sound_binding)
        {
            this.Sound            = sound_binding;
            this.Sound.PostLoaded = () => DDSoundUtils.SetVolume(this.Sound.GetHandle(0), 0.0);             // ロードしたらミュートしておく。

            DDMusicUtils.Add(this);
        }
コード例 #6
0
        public void UpdateVolume_Handles(int[] handles)
        {
            double mixedVolume = DDSoundUtils.MixVolume(DDGround.SEVolume, this.Volume);

            foreach (int handle in handles)
            {
                DDSoundUtils.SetVolume(handle, mixedVolume);
            }
        }
コード例 #7
0
        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);
            }
        }
コード例 #8
0
        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++;
                        info.SE.HandleIndex %= info.SE.Sound.HandleCount;

                        if (DDSoundUtils.IsPlaying(info.SE.Sound.GetHandle(info.SE.HandleIndex)))
                        {
                            for (info.SE.HandleIndex = 0; info.SE.HandleIndex < info.SE.Sound.HandleCount; info.SE.HandleIndex++)
                            {
                                if (!DDSoundUtils.IsPlaying(info.SE.Sound.GetHandle(info.SE.HandleIndex)))
                                {
                                    goto foundNotPlaying;
                                }
                            }

                            //info.SE.HandleIndex = info.SE.Sound.HandleCount;
                            info.SE.Sound.Extend();

                            //ProcMain.WriteLog("音を拡張しました。" + info.SE.Sound.HandleCount);
                        }
foundNotPlaying:
                        DDSoundUtils.Play(info.SE.Sound.GetHandle(info.SE.HandleIndex));
                        break;

                    case PlayInfo.AlterCommand_e.STOP:
                        for (int index = 0; index < info.SE.Sound.HandleCount; 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);
        }
コード例 #9
0
        public bool IsPlaying()
        {
            if (this.Handles != null)
            {
                for (int index = 0; index < this.HandleCount; index++)
                {
                    if (DDSoundUtils.IsPlaying(this.Handles[index]))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
コード例 #10
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));

#if true // 再生していたローカルBGMのみ解放する。
                        if (info.Music.Locally)
                        {
                            info.Music.Sound.Unload();
                        }
#else // 全てのローカルBGMを解放する。
                        DDMusicUtils.UnloadLocally();
#endif
                        break;

                    default:
                        throw new DDError();
                    }
                }
            }
        }
コード例 #11
0
        public DDSound(Func <byte[]> getFileData)
        {
            this.Func_GetFileData = getFileData;

            DDSoundUtils.Add(this);
        }