public void PlaySoundEffect(Guid id, byte[] data, Volume volume) { data.ThrowIfNull("data"); var adjustedParameters = new SoundParameters(volume * _volumeConfiguration.SoundEffects, _soundEffectsMuted); _soundEffectManager.Play(id, data, adjustedParameters); }
public void Play(SoundParameters parameters) { RESULT result = _soundSystem.System.playSound(CHANNELINDEX.FREE, _sound, true, ref _channel); _channel.setVolume(parameters.Volume); _channel.setMute(parameters.Muted); _channel.setPaused(false); if (result != RESULT.OK) { throw new Exception(GetExceptionMessage("Failed to play sound.", result)); } }
public void Play(Guid id, byte[] data, SoundParameters parameters) { SoundManager manager; if (!_soundManagersById.TryGetValue(id, out manager)) { manager = new SoundManager(data); _soundManagersById.Add(id, manager); } Sound sound = manager.Next(); sound.Play(parameters); }
public void Play(Guid id, byte[] data, SoundParameters parameters) { foreach (Sound existingSound in _soundsById.Values) { existingSound.Stop(); } Sound sound; if (!_soundsById.TryGetValue(id, out sound)) { sound = new Sound(SoundSystem.Instance, data); _soundsById.Add(id, sound); } sound.Play(parameters); }