Ejemplo n.º 1
0
        private void AdjustEffect(BasicSoundEffect effect)
        {
            Rect visibleRectange = m_getVisibleRectangleDelegate();

            if (effect.Position.HasValue)
            {
                effect.SoundVolumeMultiplier = m_volumeEsimationFunction(visibleRectange, effect.Position.Value);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Create GC root to prevent GC
 /// </summary>
 private void RegisterHard(BasicSoundEffect effect)
 {
     m_soundHardLinks.Add(effect);
 }
Ejemplo n.º 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);
        }