private void buttonPlay_Click(object sender, EventArgs e) { var partition = textBoxPartition.Text; if (string.IsNullOrEmpty(partition)) { return; } var tune = serializer.Parse(partition); if (tune == null) { return; } using (var stream = soundGenerator.TuneToWaveStream(tune)) using (var player = new SoundPlayer(stream)) { player.Play(); } string output = serializer.ToString(tune); textBoxPartition.Text = output; }
public void ToString_Success() { var tune = new Tune(new List <TuneElement> { new Note(Pitches.A, Scales.Four, Durations.Whole), new Note(Pitches.Asharp, Scales.Five, Durations.Half), new Pause(Durations.Quarter) } ); tune.Name = "TestName"; Assert.AreEqual(converter.ToString(tune), "TestName:d=1,o=4,b=63:A,2A#5,4P,"); }
public void Parse_Success() { var partition = "(6)888# (5)# 69999# 58888# 4# 4 (2)# (2)999 29# (6)8888# (5)# 69999# 488 4# 2 299# 288 4 5# 7 2* 49 (5)#** (4) 599 088888 88888"; var tune = converter.Parse(partition); tune.Tempo = 100; tune.Name = "TocattaFugue"; Assert.IsNotNull(tune); Assert.IsTrue(tune.TuneElementList != null && tune.TuneElementList.Count > 0); var rttlConverter = new RttlConverter(); var rttl = rttlConverter.ToString(tune); }
public string Export(Tune t) { return(converter.ToString(t)); }