Exemple #1
0
        public DDMusic(DDSound sound_binding)
        {
            this.Sound = sound_binding;
            this.Sound.PostLoadeds.Add(handle => DDSoundUtils.SetVolume(handle, 0.0));             // ロードしたらミュートしておく。

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

            DDMusicUtils.Add(this);
        }
Exemple #4
0
        public void UpdateVolume_Handles(int[] handles)
        {
            double mixedVolume = DDSoundUtils.MixVolume(DDGround.SEVolume, this.Volume);

            foreach (int handle in handles)
            {
                DDSoundUtils.SetVolume(handle, mixedVolume);
            }
        }
Exemple #5
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);
            }
        }
Exemple #6
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();
                    }
                }
            }
        }