写入简谱flash钢琴谱自动播放简谱琴声程序 c#

这个音乐程序,有个缺点,就是节拍不好控制,你不懂要输入多少个空格(表示延时多少)?读简谱时钟的时钟周期是多少? /* 甩葱歌简谱 测试用 QTTUVTTTVUSSSUTT TTQTTUVTTTOQQQPOUVTT XXWVUSSSUWWWWVUott TTXXWVUSSSUWWWWVUVTT */ using System;

using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; namespace gangqinzidongbofang {     public partial class Form1 : Form     {         public Form1()         {             InitializeComponent();         }         public static uint SND_ASYNC = 0x0001; //         public static uint SND_FILENAME = 0x00020000;         [DllImport("winmm.dll")]         public static extern uint mciSendString(string lpstrCommand,        string lpstrReturnString,uint uReturnLength,uint hWndCallback);         string path = @"D:\Download\Silverlightkey\codefans.net\键盘钢琴\AphroditePiano\Sound\";         string keyname = "";         string stryinjie = "";         int i;                  private void button1_Click(object sender,EventArgs e)         {              stryinjie = richTextBox1.Text;              i = 0;              timer1.Interval = 200;              timer1.Enabled = true;         }         private void timer1_Tick(object sender,EventArgs e)         {             if (char.IsLetter(stryinjie[i]))             {                 //D:\Download\Silverlightkey\codefans.net\键盘钢琴\AphroditePiano\Sound\目录,保存了A.mp3  B.mp3  C.mp3到Z.mp3,分别存放了不同的音阶MP3文件                 string keyname = char.toupper(stryinjie[i]) + ".mp3";                 string alldir = path + keyname;                 mciSendString(@"close temp_alias",null,0);                 mciSendString(@"open " + alldir + " alias temp_alias",0);                 //("play temp_alias repeat",0);                 mciSendString("play temp_alias ",0);             }             else             {                 if (stryinjie[i].Equals(' '))//等于空格                 {                     System.Threading.Thread.Sleep(2000);                     //if(Delay(1));                                          }             }             i++;             if (i == stryinjie.Length)             {                 timer1.Enabled = false;             }         }         /// <summary>         /// 延时函数         /// </summary>         /// <param name="delayTime">需要延时多少秒</param>         /// <returns></returns>         public static bool Delay(int delayTime)         {             DateTime Now = DateTime.Now;             int s;             do             {                 TimeSpan spand = DateTime.Now - Now;                 s = spand.Seconds;                 Application.DoEvents();             }             while (s < delayTime);             return true;         }     } }

相关文章

  译序:JWMediaPlayer是开源的网页使用的Flash播放器。本...
    Flash编程原理都是只能将1写为0,而不能将0写成1.所...
 上传setenvgatewayip192.168.1.1;setenvserverip192.168.1...
Error:FlashDownloadFailed-"Cortex-M3"出现一般有...
jPlayer是一个用于控制和播放mp3文件的jQuery插件。它在后台...
#ifndef__FONTUPD_H__#define__FONTUPD_H__#include"sy...