public WaitHandle PlayAndWait() { if (_sounds.Count > 0) { if (_playingSound != null) { _playingSound.Stop(); _playingSound.Release(); _playingSound = null; } _timeAtPlayStart = GameManager.TickCount; if (_speaker != null) { Actor actor = SceneManager.GetActor(_speaker); if (actor != null) { _playingSound = Sound.SoundManager.PlaySound3DToChannel(_sounds[0], actor.Position.X, actor.Position.Y, actor.Position.Z, Sound.SoundTrackChannel.Dialog, new WaitHandle()); } } // if we weren't able to play in 3D then try 2D if (_playingSound == null) { _playingSound = Sound.SoundManager.PlaySound2DToChannel(_sounds[0], Sound.SoundTrackChannel.Dialog, new WaitHandle()); } return(_playingSound.Wait); } return(null); }
private static void sheep_PlaySound(IntPtr context) { bool isInWaitSection = SheepMachine.IsInWaitSection(context); string sound = SheepMachine.PopStringOffStack(context); Sound.AudioEngine.SoundEffect s = SceneManager.SceneContentManager.Load <Sound.AudioEngine.SoundEffect>(sound); Sound.PlayingSound ps = Sound.SoundManager.PlaySound2DToChannel(s, Sound.SoundTrackChannel.SFX); }
public void Stop() { if (_playingSound != null) { _playingSound.Stop(); _playingSound.Release(); _playingSound = null; } }