//______________________________________________________________________________ void xml2guidovisitor::visitStart ( S_part& elt ) { partsummary ps; xml_tree_browser browser(&ps); browser.browse(*elt); smartlist<int>::ptr voices = ps.getVoices (); int targetStaff = 0xffff; // initialized to a value we'll unlikely encounter bool notesOnly = false; rational currentTimeSign (0,1); // browse the parts voice by voice: allows to describe voices that spans over several staves for (unsigned int i = 0; i < voices->size(); i++) { int targetVoice = (*voices)[i]; int mainstaff = ps.getMainStaff(targetVoice); if (targetStaff == mainstaff) { notesOnly = true; } else { notesOnly = false; targetStaff = mainstaff; fCurrentStaffIndex++; } Sguidoelement seq = guidoseq::create(); push (seq); Sguidoelement tag = guidotag::create("staff"); tag->add (guidoparam::create(fCurrentStaffIndex, false)); add (tag); flushHeader (fHeader); flushPartHeader (fPartHeaders[elt->getAttributeValue("id")]); xmlpart2guido pv(fGenerateComments, fGenerateStem, fGenerateBars); pv.generatePositions (fGeneratePositions); xml_tree_browser browser(&pv); pv.initialize(seq, targetStaff, fCurrentStaffIndex, targetVoice, notesOnly, currentTimeSign); browser.browse(*elt); pop(); currentTimeSign = pv.getTimeSign(); } }
//________________________________________________________________________ void midicontextvisitor::visitStart(S_part& elt) { fCurrentDate = fLastPosition = fPendingDuration = 0; fEndMeasureDate = fEndPartDate = 0; fTranspose = 0; fDivisions = 1; fCurrentPartID = elt->getAttributeValue("id"); int instrCount = fScoreInstruments.count(fCurrentPartID); if (fMidiWriter) { fMidiWriter->startPart(instrCount); multimap<string, scoreInstrument>::iterator start = fScoreInstruments.lower_bound(fCurrentPartID); multimap<string, scoreInstrument>::iterator end = fScoreInstruments.upper_bound(fCurrentPartID); while (start != end) { playScoreInstrument(start->second); start++; } } }