private int GetValue(Note n) { if (_track.IsPercussion) { return(PercussionMapper.MapValue(n)); } else { return(n.RealValue); } }
private int GetNoteLineWithAccidental(Note n, AccidentalType accidentalToSet) { var value = n.Beat.Voice.Bar.Track.IsPercussion ? PercussionMapper.MapValue(n) : n.RealValue; var ks = n.Beat.Voice.Bar.MasterBar.KeySignature; var clef = n.Beat.Voice.Bar.Clef; var index = value % 12; var octave = (value / 12); // Initial Position var steps = OctaveSteps[(int)clef]; // Move to Octave steps -= (octave * StepsPerOctave); // get the step list for the current keySignature var stepList = ModelUtils.KeySignatureIsSharp(ks) || ModelUtils.KeySignatureIsNatural(ks) ? SharpNoteSteps : FlatNoteSteps; //Add offset for note itself int offset = 0; switch (n.AccidentalMode) { // TODO: provide line according to accidentalMode case NoteAccidentalMode.Default: case NoteAccidentalMode.SwapAccidentals: case NoteAccidentalMode.ForceNatural: case NoteAccidentalMode.ForceFlat: case NoteAccidentalMode.ForceSharp: default: // normal behavior: simply use the position where // the keysignature defines the position offset = stepList[index]; break; } steps -= stepList[index]; // TODO: It seems note heads are always one step above the calculated line // maybe the SVG paths are wrong, need to recheck where step=0 is really placed var line = steps + NoteStepCorrection; _appliedScoreLines[GetNoteId(n)] = line; return(line); }