private void CreateEmptyInputStaves(List<List<VoiceDef>> barDefsInOneSystem) { int nPrintedOutputStaves = _pageFormat.VisibleOutputVoiceIndicesPerStaff.Count; int nPrintedInputStaves = _pageFormat.VisibleInputVoiceIndicesPerStaff.Count; int nStaffNames = _pageFormat.ShortStaffNames.Count; for(int i = 0; i < Systems.Count; i++) { SvgSystem system = Systems[i]; List<VoiceDef> barDef = barDefsInOneSystem[i]; for(int staffIndex = 0; staffIndex < nPrintedInputStaves; staffIndex++) { int staffNameIndex = nPrintedOutputStaves + staffIndex; string staffname = StaffName(i, staffNameIndex); float gap = _pageFormat.Gap * _pageFormat.InputStavesSizeFactor; float stafflineStemStrokeWidth = _pageFormat.StafflineStemStrokeWidth * _pageFormat.InputStavesSizeFactor; InputStaff inputStaff = new InputStaff(system, staffname, _pageFormat.StafflinesPerStaff[staffIndex], gap, stafflineStemStrokeWidth); List<byte> inputVoiceIndices = _pageFormat.VisibleInputVoiceIndicesPerStaff[staffIndex]; for(int ivIndex = 0; ivIndex < inputVoiceIndices.Count; ++ivIndex) { InputVoiceDef inputVoiceDef = barDef[inputVoiceIndices[ivIndex] + _algorithm.MidiChannelIndexPerOutputVoice.Count] as InputVoiceDef; Debug.Assert(inputVoiceDef != null); InputVoice inputVoice = new InputVoice(inputStaff); inputVoice.VoiceDef = inputVoiceDef; inputStaff.Voices.Add(inputVoice); } SetStemDirections(inputStaff); system.Staves.Add(inputStaff); } } }
/// <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); } } } } }