public Notator(PageFormat pageFormat) { _pageFormat = pageFormat; bool error = false; switch (pageFormat.ChordSymbolType) { case "standard": SymbolSet = new StandardSymbolSet(); break; //case "2b2": // SymbolSet = new Study2b2SymbolSet(); // break; case "none": SymbolSet = null; break; default: error = true; break; } if (error) { throw new ApplicationException("Cannot construct Notator!"); } }
public Notator() { bool error = false; switch (M.PageFormat.ChordSymbolType) { case "standard": SymbolSet = new StandardSymbolSet(false); // _coloredVelocities = false; break; case "coloredVelocities": SymbolSet = new StandardSymbolSet(true); // _coloredVelocities = true; break; case "none": SymbolSet = null; break; default: error = true; break; } if (error) { throw new ApplicationException("Cannot construct Notator!"); } }
/// <summary> /// There is still one system per bar. /// </summary> /// <param name="systems"></param> public void ConvertVoiceDefsToNoteObjects(List <SvgSystem> systems) { byte[] currentChannelVelocities = new byte[systems[0].Staves.Count]; List <ClefChangeDef> voice0ClefChangeDefs = new List <ClefChangeDef>(); List <ClefChangeDef> voice1ClefChangeDefs = new List <ClefChangeDef>(); for (int systemIndex = 0; systemIndex < systems.Count; ++systemIndex) { SvgSystem system = systems[systemIndex]; int visibleStaffIndex = -1; for (int staffIndex = 0; staffIndex < system.Staves.Count; ++staffIndex) { Staff staff = system.Staves[staffIndex]; if (!(staff is InvisibleOutputStaff)) { visibleStaffIndex++; } voice0ClefChangeDefs.Clear(); voice1ClefChangeDefs.Clear(); for (int voiceIndex = 0; voiceIndex < staff.Voices.Count; ++voiceIndex) { Voice voice = staff.Voices[voiceIndex]; float musicFontHeight = (voice is OutputVoice) ? _pageFormat.MusicFontHeight : _pageFormat.MusicFontHeight * _pageFormat.InputStavesSizeFactor; if (!(staff is InvisibleOutputStaff)) { Debug.Assert(_pageFormat.ClefsList[visibleStaffIndex] != null); voice.NoteObjects.Add(new ClefSymbol(voice, _pageFormat.ClefsList[visibleStaffIndex], musicFontHeight)); } bool firstLmdd = true; if (staff is InputStaff) { InputVoice inputVoice = staff.Voices[voiceIndex] as InputVoice; if (systemIndex == 0) { InputVoiceDef inputVoiceDef = inputVoice.VoiceDef as InputVoiceDef; inputVoice.SetMidiChannel(inputVoiceDef.MidiChannel, systemIndex); } } foreach (IUniqueDef iud in voice.VoiceDef.UniqueDefs) { NoteObject noteObject = SymbolSet.GetNoteObject(voice, iud, firstLmdd, ref currentChannelVelocities[staffIndex], musicFontHeight); ClefChangeSymbol clefChangeSymbol = noteObject as ClefChangeSymbol; if (clefChangeSymbol != null) { if (voiceIndex == 0) { voice0ClefChangeDefs.Add(iud as ClefChangeDef); } else { voice1ClefChangeDefs.Add(iud as ClefChangeDef); } } voice.NoteObjects.Add(noteObject); firstLmdd = false; } } if (voice0ClefChangeDefs.Count > 0 || voice1ClefChangeDefs.Count > 0) { // the main clef on this staff in the next system SetNextSystemClefType(staffIndex, voice0ClefChangeDefs, voice1ClefChangeDefs); } if (staff.Voices.Count == 2) { InsertInvisibleClefChangeSymbols(staff.Voices, voice0ClefChangeDefs, voice1ClefChangeDefs); CheckClefTypes(staff.Voices); StandardSymbolSet standardSymbolSet = SymbolSet as StandardSymbolSet; if (standardSymbolSet != null) { standardSymbolSet.ForceNaturalsInSynchronousChords(staff); } } } } }