Ejemplo n.º 1
0
 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)
     { }
 }
Ejemplo n.º 2
0
        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);
        }