Advertisement
Eism

Untitled

Sep 21st, 2020 (edited)
1,135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. for (const instruments::InstrumentTemplate& instrumentTemplate: instrumentTemplates) {
  2.         Part* part = new Part(score);
  3.  
  4.         part->setPartName(instrumentTemplate.trackName);
  5.         auto instrument = instrumentFromTemplate(instrumentTemplate);
  6.         part->setInstrument(instrument);
  7.  
  8.        
  9.         score()->undo(new Ms::InsertPart(part, staffIndex));
  10.         addStaves(part, instrument, staffIndex);
  11.     }
  12.  
  13.  
  14.  
  15. void NotationParts::addStaves(Part* part, const Instrument& instrument, int& globalStaffIndex)
  16. {
  17.     for (int i = 0; i < instrument.staves; i++) {
  18.         Staff* staff = new Staff(score());
  19.         staff->setPart(part);
  20.         initStaff(staff, instrument, Ms::StaffType::preset(StaffType(0)), i);
  21.  
  22.         if (globalStaffIndex > 0) {
  23.             staff->setBarLineSpan(score()->staff(globalStaffIndex - 1)->barLineSpan());
  24.         }
  25.  
  26.         score()->undoInsertStaff(staff, i);
  27.         globalStaffIndex++;
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement