/// <summary> /// Plays a cue with static 3D positional information. /// </summary> /// <remarks> /// Commonly used for short lived effects. To dynamically change the 3D /// positional information on a cue over time use <see cref="GetCue"/> and <see cref="Cue.Apply3D"/>.</remarks> /// <param name="name">The name of the cue to play.</param> /// <param name="listener">The listener state.</param> /// <param name="emitter">The cue emitter state.</param> public void PlayCue(string name, AudioListener listener, AudioEmitter emitter) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } XactSound[] sounds; if (!_sounds.TryGetValue(name, out sounds)) { throw new InvalidOperationException(); } float [] probs; if (!_probabilities.TryGetValue(name, out probs)) { throw new ArgumentException(); } IsInUse = true; var cue = new Cue(_audioengine, name, sounds, probs); cue.Prepare(); cue.Apply3D(listener, emitter); cue.Play(); }
/// <summary> /// Plays a cue. /// </summary> /// <param name="name">Name of the cue to play.</param> public void PlayCue(string name) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } XactSound[] sounds; if (!_sounds.TryGetValue(name, out sounds)) { throw new ArgumentException(); } float [] probs; if (!_probabilities.TryGetValue(name, out probs)) { throw new ArgumentException(); } IsInUse = true; var cue = new Cue(_audioengine, name, sounds, probs); cue.Prepare(); cue.Play(); }