Microsoft.Xna.Framework.Audio.SoundEffectInstance.Stop C# (CSharp) Méthode

Stop() public méthode

Immediately stops playing a SoundEffectInstance.
public Stop ( ) : void
Résultat void
        public void Stop()
        {
            PlatformStop(true);
        }

Same methods

SoundEffectInstance::Stop ( bool immediate ) : void

Usage Example

Exemple #1
0
        public void Play()
        {
            var category     = _soundBank.AudioEngine.Categories[_categoryID];
            var curInstances = category.GetPlayingInstanceCount();

            if (curInstances >= category.maxInstances)
            {
                var prevSound = category.GetOldestInstance();

                if (prevSound != null)
                {
                    prevSound.SetFade(0.0f, category.fadeOut);
                    prevSound.Stop(AudioStopOptions.Immediate);
                    SetFade(category.fadeIn, 0.0f);
                }
            }

            if (_complexSound)
            {
                foreach (XactClip clip in _soundClips)
                {
                    clip.Play();
                }
            }
            else
            {
                if (_wave != null && _wave.State != SoundState.Stopped && _wave.IsLooped)
                {
                    _wave.Stop();
                }
                else
                {
                    _wave = _soundBank.GetSoundEffectInstance(_waveBankIndex, _trackIndex);
                }

                if (_wave == null)
                {
                    // We couldn't create a sound effect instance, most likely
                    // because we've reached the sound pool limits.
                    return;
                }

                _wave.Play();
            }
        }
All Usage Examples Of Microsoft.Xna.Framework.Audio.SoundEffectInstance::Stop