Hey, Im looking for Enum.Parse() and it dosent show up, am I missing a using or something? I have Enum but nothing else with it
I want to enum each of the musical notes sothat I can hear every single one
Hey, Im looking for Enum.Parse() and it dosent show up, am I missing a using or something? I have Enum but nothing else with it
I want to enum each of the musical notes sothat I can hear every single one
You can implement it. I don’t think it is there in NETMF
As always, excuse my variables. I misspelt notes, making nuts. and then a singular nut. this assumes the file is filled with something like “a,b,c,g,h,e,d,a,b,c,g,h,f,e,a”
StreamReader sr = new StreamReader("\\USB\\Hello.txt");
string her = sr.ReadToEnd();
sr.Close();
string[] nuts = her.Split(',');
var melody = new Tunes.Melody();
foreach (string nut in nuts)
{
switch (nut)
{
case "a":
melody.Add(Tunes.Tone.C4, 200);
break;
case "b" :
melody.Add(Tunes.Tone.D4, 200);
break;
case "c":
melody.Add(Tunes.Tone.E4, 200);
break;
case "d":
melody.Add(Tunes.Tone.F4, 200);
break;
case "e":
melody.Add(Tunes.Tone.A4, 200);
break;
case "f":
melody.Add(Tunes.Tone.B4, 200);
break;
case "g":
melody.Add(Tunes.Tone.C5, 200);
break;
case "h":
melody.Add(Tunes.Tone.Rest, 200);
break;
}
I think the string->Enum / Enum->string conversion is not part of NETMF.
@ Reinhard Ostermeier - This isn’t a piece of code that does Enum-ming but just replaces the enum. Im working on something that can read through a “sheet music” and play it back easily.
@ MRTFEREN - I would use constants for those switch cases, since you’re going to be doing that alot. Technically I would use ints not string.
@ Mr. John Smith - that’s actually very smart, as I don’t know my keyboard abcdefgh’s very well