/// <summary>Stops sound playback.</summary> public void StopSound() { if(_lastSound != null) { _lastSound.Stop(); _lastSound = null; } }
/// <summary>Plays a sound.</summary> /// <param name="soundIndex">The index of the sound to play.</param> public void PlaySound(int soundIndex) { if(_disabled) return; StopSound(); float volume; if(soundIndex == 0 && _sys.SimulateIntroSound) volume = _speakerVolume; // Always use speaker volume when simulated else volume = (SpeakerMode ? _speakerVolume : _sampledSoundVolume); List<SoundSystem.Sound> sounds = (SpeakerMode ? _speakerSounds : _sampledSounds); SoundSystem.Sound sound = sounds[soundIndex]; sound.Play(volume); _lastSound = sound; }