public NoteBuilder SetPitch(StepMusicXML step, int octave) { if (octave < 0 || octave > 9) { throw new Exception("NoteBuilder::SetPitch() -Octave Pitch have to be in between 0 and 9"); } var pitch = new PitchMusicXML { Step = step, Octave = octave.ToString() }; AppendItem(NoteChoiceTypeMusicXML.pitch, pitch); return(this); }
private void GetPitch() { var clef = ViewModel.ViewModelLocator.Instance.Main.CurrentScoreProperties.GetClef(measureId, partId, int.Parse(itemStaff), fractionPosition); pitchObject = new List <object>(); altered = new Dictionary <int, bool>(); pitchedPosition = new Dictionary <int, int>(); pitchedValue = new Dictionary <int, double>(); foreach (var note in noteItem) { pitchObject.Add(note.Items[note.GetIndexOfType(noteAdditionalType)]); int pitchIndex = pitchObject.Count - 1; if (pitchObject[pitchIndex] is PitchMusicXML) { PitchMusicXML pitch = (PitchMusicXML)pitchObject[pitchIndex]; altered.Add(pitchIndex, pitch.AlterSpecified); pitchedPosition.Add(pitchIndex, pitch.GetPitchIndexStaffLine(clef)); pitchedValue.Add(pitchIndex, staffLine[pitchedPosition[pitchIndex]]); } else { UnpitchedMusicXML pitch = (UnpitchedMusicXML)pitchObject[pitchIndex]; pitchedPosition.Add(pitchIndex, new PitchMusicXML() { Step = pitch.DisplayStep, Octave = pitch.DisplayOctave }.GetPitchIndexStaffLine(clef)); pitchedValue.Add(pitchIndex, staffLine[pitchedPosition[pitchIndex]]); } } if (altered.Any(x => x.Value))//bug fix - all chorded notes should have been altered if any (octave shift) { for (int i = 0; i < altered.Count; i++) { altered[i] = true; } } }