public static int StepDifference(Clef a, Note b) { int step1int = 0, step2int = 0; string step1 = a.Step; string step2 = b.Step; if (step1 == "C") { step1int = 0; } else if (step1 == "D") { step1int = 1; } else if (step1 == "E") { step1int = 2; } else if (step1 == "F") { step1int = 3; } else if (step1 == "G") { step1int = 4; } else if (step1 == "A") { step1int = 5; } else if (step1 == "B") { step1int = 6; } step1int += a.Octave * 7; if (step2 == "C") { step2int = 0; } else if (step2 == "D") { step2int = 1; } else if (step2 == "E") { step2int = 2; } else if (step2 == "F") { step2int = 3; } else if (step2 == "G") { step2int = 4; } else if (step2 == "A") { step2int = 5; } else if (step2 == "B") { step2int = 6; } step2int += b.Octave * 7; return(step1int - step2int); }
public static Clef SuggestClefForANote(Note n, Clef currentClef) { if (currentClef.TypeOfClef == ClefType.GClef) { if ((currentClef.Line == 1) && (n.MidiPitch < 59)) { return(new Clef(ClefType.FClef, 4)); } else if ((currentClef.Line == 2) && (n.MidiPitch < 55)) { return(new Clef(ClefType.FClef, 4)); } else if ((currentClef.Line == 3) && (n.MidiPitch < 52)) { return(new Clef(ClefType.FClef, 4)); } else if ((currentClef.Line == 4) && (n.MidiPitch < 48)) { return(new Clef(ClefType.FClef, 4)); } else if ((currentClef.Line == 5) && (n.MidiPitch < 45)) { return(new Clef(ClefType.FClef, 4)); } else { return(currentClef); } } else if (currentClef.TypeOfClef == ClefType.FClef) { if ((currentClef.Line == 1) && (n.MidiPitch > 74)) { return(new Clef(ClefType.GClef, 2)); } else if ((currentClef.Line == 2) && (n.MidiPitch > 71)) { return(new Clef(ClefType.GClef, 2)); } else if ((currentClef.Line == 3) && (n.MidiPitch > 67)) { return(new Clef(ClefType.GClef, 2)); } else if ((currentClef.Line == 4) && (n.MidiPitch > 64)) { return(new Clef(ClefType.GClef, 2)); } else if ((currentClef.Line == 5) && (n.MidiPitch > 60)) { return(new Clef(ClefType.GClef, 2)); } else { return(currentClef); } } else { return(new Clef(ClefType.GClef, 2)); } }