public Task Play(SoundboxContext context, SoundPlayback sound) { if (Finished) { return(Task.FromResult(false)); } this.Sound = sound; this.WavPlayer = new System.Media.SoundPlayer(context.GetAbsoluteFileName(sound.Sound)); new System.Threading.Thread(() => { WavPlayer.PlaySync(); lock (this) { if (Finished) { return; } Finished = true; PlaybackFinished?.Invoke(this, new ISoundPlaybackService.PlaybackEventArgs( sound: sound, fromStop: false )); } }).Start(); return(Task.FromResult(true)); }
public SoundPlaybackEventArgs(SoundPlayback soundPlayback) : base(soundPlayback.Sound) { SoundPlayback = soundPlayback; }
public PlaybackEventArgs(SoundPlayback sound, bool fromStop) : base(sound) { this.FromStop = fromStop; }