コード例 #1
0
        private void AdjustEffect(BasicSoundEffect effect)
        {
            Rect visibleRectange = m_getVisibleRectangleDelegate();

            if (effect.Position.HasValue)
            {
                effect.SoundVolumeMultiplier = m_volumeEsimationFunction(visibleRectange, effect.Position.Value);
            }
        }
コード例 #2
0
        public BasicSoundEffect CreateBasicSoundEffect(string relativeSoundName, bool createGCRootToPreventGCWhilePlay = true)
        {
            string path = string.Format("Sounds/{0}", relativeSoundName);

            var effect = new BasicSoundEffect(m_game.Content.Load <SoundEffect>(path).CreateInstance());

            RegisterWeak(effect);

            if (createGCRootToPreventGCWhilePlay)
            {
                RegisterHard(effect);
            }

            return(effect);
        }
コード例 #3
0
 /// <summary>
 /// Create GC root to prevent GC
 /// </summary>
 private void RegisterHard(BasicSoundEffect effect)
 {
     m_soundHardLinks.Add(effect);
 }
コード例 #4
0
        /// <summary>
        /// Only registered sounds will be controlled by Manager
        /// </summary>
        private void RegisterWeak(BasicSoundEffect effect)
        {
            m_registeredSounds.Add(new WeakReference(effect));

            AdjustEffect(effect);
        }