void fireFilePlayedEvent(string soundName) { try { Task t = new Task(() => { if (FilePlayed != null) { try { FilePlayed.Invoke(this, new AudioRendererSoundEventArgs(soundName)); } catch (Exception) { } } }); t.Start(); } catch (Exception) { } }
public async Task PlayAsync() { if (string.IsNullOrWhiteSpace(Filepath)) { return; } await Task.Run(() => { var codec = codecFactory.GetCodec(Filepath); soundOut.Stop(); soundOut.Initialize(codec); soundOut.Play(); }); LastFilePlayed = this; FilePlayed?.Invoke(this); }