Exemplo n.º 1
0
 public async Task StopAsync()
 {
     await Task.Run(async() =>
     {
         CorePlayer.Stop();
         while (IsPlaying)
         {
             await Task.Delay(1);
         }
     });
 }
Exemplo n.º 2
0
        public async Task SaveAsync(string path, int loopCount = 2, MidiFile mf = null)
        {
            CorePlayer.Stop();
            if (mf != null)
            {
                CorePlayer.Load(mf);
            }
            CorePlayer.Play(loopCount);

            using (var wfw = new WaveFileWriter(path, new WaveFormat()))
            {
                while (CorePlayer.IsPlaying)
                {
                    byte[] b = ToByte(CorePlayer.GetBuffer(_buffer));
                    await wfw.WriteAsync(b, 0, b.Length);
                }
            }
        }