//***************************************** Create Object Factory *******************************************// //The Object Factory, Used to create the elements of the score as required //***************************************** ScorePartwise *******************************************// // Create the top level Partwise Score Element public static ScorePartwise CreateScorePartwise(ScoreProperties i) { ObjectFactory factory = new ObjectFactory(); //Create a scorepart ScorePartwise.Part part; Marshalling.getContext(); ///////////////////// Following are the main components required for the Score in Phase 1 //***************************************** ScorePartwise *******************************************// ScorePartwise scorePartwise = factory.createScorePartwise(); // Set the version of MusicXML scorePartwise.setVersion("3.0"); //***************************************** Set Work and Movement Titles *******************************************// // Create the work element and set its title Work work = factory.createWork(); work.setWorkTitle(i.WorkTitle); //Setting some properties of the root element. scorePartwise.setMovementTitle(i.MovementTitle); //Set the work title of the scorepartwise scorePartwise.setWork(work); //***************************************** Create and set Identification Element *******************************************// //Create identification and set its properties Identification identification = factory.createIdentification(); com.audiveris.proxymusic.Encoding encoding = factory.createEncoding(); //set the software used for encoding encoding.getEncodingDateOrEncoderOrSoftware().add(factory.createEncodingSoftware(i.EncodingSoftware)); // set the encoding identification.setEncoding(encoding); scorePartwise.setIdentification(identification); //***************************************** Set the Credit words *******************************************// Credit credit = factory.createCredit(); FormattedText creditwordtext = new FormattedText(); creditwordtext.setValue(i.CreditWords); credit.getCreditTypeOrLinkOrBookmark().add(creditwordtext); scorePartwise.getCredit().add(credit); //***************************************** Create a PartList *******************************************// PartList partlist = factory.createPartList(); // create a scorepart ScorePart scorepart = factory.createScorePart(); ////////////////////////Some Properties of the scorepart PartName partname = factory.createPartName(); partname.setValue(i.PartDisplayName); scorepart.setPartName(partname); //set part abbreviation partname.setValue(i.PartAbbreviation); scorepart.setPartAbbreviation(partname); //set the scorepart id scorepart.setId(i.ScorePartID); // set the scorepart instrument ScoreInstrument scoreinstrument = factory.createScoreInstrument(); scoreinstrument.setId(i.InstrumentID); scoreinstrument.setInstrumentName(i.InstrumentName); scorepart.getScoreInstrument().add(scoreinstrument); //set the midi device parameters MidiInstrument midiinstrument = factory.createMidiInstrument(); //set midi instrument Id midiinstrument.setId(scoreinstrument); //set midi channel java.lang.Integer midichannel = i.MidiChannel; //channel number midiinstrument.setMidiChannel(midichannel); //set midi program java.lang.Integer midiprogram = i.MidiProgram; //program number midiinstrument.setMidiProgram(midiprogram); scorepart.getMidiDeviceAndMidiInstrument().add(midiinstrument); // add the scorepart to the partlist partlist.getPartGroupOrScorePart().add(scorepart); //Ambiguity scorePartwise.setPartList(partlist); //***************************************** Create a Part *******************************************// if (i.Part == null) { part = factory.createScorePartwisePart(); } else { part = i.Part; } //set part id part.setId(scorepart); // Add the part to the score scorePartwise.getPart().add(part); return(scorePartwise); }