小星星弹奏器

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WMPLib;//需要额外添加的引用,win媒体播放器,后缀.dll

namespace xxx
{
    class Program
    {
        static void Main(string[] args)
        {
            while(1==1)
            {
                //Console.ReadKey();
                //Console.Beep(800, 500);

                ConsoleKeyInfo ck = Console.ReadKey(true);//读取输入,传入true是为了不显示在控制台上
                char c = ck.KeyChar;//用.KeyChar这个方法,将ConsoleKeyInfo类型的值转为char类型
                Console.WriteLine(c);
                WindowsMediaPlayer wm = new WindowsMediaPlayer();

                wm.URL = @"D:\vs_code_\trash\xxx_trash\"+c+".mp3";//调用方法,地址是存放音阶的地址(do lai mi fa suo 那些)
            }
        }
    }
}

环境:vs2019 windows11

posted @ 2023-04-26 11:45  天天掉头发  阅读(13)  评论(0编辑  收藏  举报
返回顶端