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

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