示例#1
0
 private void _play_Click(object sender, EventArgs e)
 {
     byte[] data = _audioFileService.ConvertToWav(GetSelectedData());
     using (var stream = new MemoryStream(data))
     {
         _player.Stream = stream;
         _player.Load();
         _player.Play();
     }
 }
        private void _audioPlay_Click(object sender, EventArgs e)
        {
            var lvi = _audioPatterns.SelectedItems.Cast <ListViewItem>().FirstOrDefault();

            if (lvi != null)
            {
                var    setting  = (AudioPatternSetting)lvi.Tag;
                string fileName = _audioFileService.ConvertToWav(setting.FileName);
                var    player   = new SoundPlayer(fileName);
                player.PlayLooping();
                Thread.Sleep(5000);
                player.Stop();
            }
        }