public MidiPlayer(Beeper beeper, string fileName) { midiFile = new MidiFile(fileName); this.beeper = beeper; frequency = new MidiFrequency(); }
public PlayForm() { InitializeComponent(); keyMapping.Add(Keys.A, Note.C); keyMapping.Add(Keys.S, Note.D); keyMapping.Add(Keys.D, Note.E); keyMapping.Add(Keys.F, Note.F); keyMapping.Add(Keys.G, Note.G); keyMapping.Add(Keys.H, Note.A); keyMapping.Add(Keys.J, Note.B); comboBox1.Items.AddRange(SerialPort.GetPortNames()); beeper = new Beeper(); // a = () => beeper.Play((uint)random.Next(100, 1000)); }
static void Main() { //Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new PlayForm()); Beeper beeper = new Beeper(); beeper.SerialPort = new SerialPort("COM6", 9600); beeper.SerialPort.Open(); Console.WriteLine("opened!"); beeper.Handshake(); Console.WriteLine("handsheked: speakers " + beeper.SpeakerCount); MidiPlayer player = new MidiPlayer(beeper, "imperial.mid"); player.Play(); while (true) { Thread.Yield(); } // RunTests(); }