Ejemplo n.º 1
0
        /// <summary>
        /// ミュート設定のセット
        /// </summary>
        public static void SetMute(AudioChannel ch, bool isMute)
        {
            if (ch == AudioChannel.None)
            {
                return;
            }
#if ENABLE_LOCALSAVE_SHIBUYA24_AUDIO
            AudioLocalSave.SetMute(ch, isMute);
#endif
            var list = PlayingChannelMap[ch];
            for (int i = 0; i < list.Count; i++)
            {
                list[i].SetMute(isMute);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// ボリュームのセット
        /// </summary>
        /// <param name="ch">チャンネル</param>
        /// <param name="volume">0~1f</param>
        public static void SetVolume(AudioChannel ch, float volume)
        {
            if (ch == AudioChannel.None)
            {
                return;
            }
#if ENABLE_LOCALSAVE_SHIBUYA24_AUDIO
            AudioLocalSave.SetVolume(ch, volume);
#endif
            // Clamp
            volume = Mathf.Clamp01(volume);
            var list = PlayingChannelMap[ch];
            for (int i = 0; i < list.Count; i++)
            {
                list[i].SetGlobalVolume(volume);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 初期化
        /// </summary>
        public static void InitializeIfNeed(AudioSetting setting = null, IAudioResourceLoader loader = null)
        {
            if (_isInitialized)
            {
#if ENABLE_DEBUG_SHIBUYA24_AUDIO
                Debug.Log("Already Initialized");
#endif
                return;
            }

            if (setting == null)
            {
                setting = new AudioSetting();
            }

            InitializeChannel(setting);
            if (loader == null)
            {
                loader = new ResourcesLoader();
            }

            Loader = loader;

#if ENABLE_LOCALSAVE_SHIBUYA24_AUDIO
#if ENABLE_DEBUG_SHIBUYA24_AUDIO
            Debug.Log("Enable AudioLocalSave");
#endif
            // Apply Initialize LocalSetting
            SetVolume(AudioChannel.BGM, AudioLocalSave.GetVolume(AudioChannel.BGM));
            SetVolume(AudioChannel.SE, AudioLocalSave.GetVolume(AudioChannel.SE));
            SetMute(AudioChannel.BGM, AudioLocalSave.GetMute(AudioChannel.BGM));
            SetMute(AudioChannel.SE, AudioLocalSave.GetMute(AudioChannel.SE));
#else
#if ENABLE_DEBUG_SHIBUYA24_AUDIO
            Debug.Log("Disable AudioLocalSave");
#endif
#endif
            _isInitialized = true;
        }