Package info.textgrid.lab.noteeditor.mei2013

Examples of info.textgrid.lab.noteeditor.mei2013.Layer


      Marshaller marshaller = jc.createMarshaller();
      marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
          Boolean.TRUE);
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      // create the new inputstream
      marshaller.marshal(new Mei(), os);
      ByteArrayInputStream bais = new ByteArrayInputStream(
          os.toByteArray());
      return bais;
    } catch (JAXBException e) {
      LogService.error(MusicMessages.MeiResourceReader_4 + e.toString(),
View Full Code Here


  public static Mei parseMEIInstance(InputStream currentIFileInputStream,
      String preValidationResult) {
    if (preValidationResult.equals(StringConstants.STRING_NEWFILE)) {
      return MusicContainerFactory.createDefaultModel();
    } else {
      Mei root = null;
      Unmarshaller unmarshaller;
      try {
        unmarshaller = getJaxbContextInstance().createUnmarshaller();
        unmarshaller.setSchema(null);
        root = (Mei) unmarshaller.unmarshal(new InputSource(
View Full Code Here

   * creates a default mei tree
   *
   * @return
   */
  public static Mei createDefaultMeiTree(int stavesCount, int measureCount) {
    Mei mei = new Mei();
    MeiHead meiHead = new MeiHead();
    FileDesc fileDesc = new FileDesc();
    TitleStmt titleStmt = new TitleStmt();
    Title title = new Title();
    title.getContent().add("New MEI-2013 document");
    titleStmt.getTitles().add(title);
    fileDesc.setTitleStmt(titleStmt);
    PubStmt pubStmt = new PubStmt();
    fileDesc.setPubStmt(pubStmt);
    SourceDesc sourceDesc = new SourceDesc();
    Source source = new Source();
    sourceDesc.getSources().add(source);
    fileDesc.setSourceDesc(sourceDesc);   
    meiHead.setFileDesc(fileDesc)
    mei.setMeiHead(meiHead);
    Music music = new Music();
    Body body = new Body();
    Mdiv mdiv = new Mdiv();
    Score score = new Score();
    ScoreDef scoreDef = createScoreDef(stavesCount);
    score.getGapsAndSbsAndCorrs().add(scoreDef);
    Section section = new Section();
    Measure measureFirst = new Measure();
    Staff staffFirst = new Staff();
    Layer layerFirst = new Layer();
    staffFirst.getSbsAndSymbolsAndOrigs().add(layerFirst);
    measureFirst.getAnnotsAndSlursAndTupletSpen().add(staffFirst);
    for (int stavesIter = 1; stavesIter < stavesCount; stavesIter++) {
      Staff staff = new Staff();
      Layer layer = new Layer();
      staff.getSbsAndSymbolsAndOrigs().add(layer);
      measureFirst.getAnnotsAndSlursAndTupletSpen().add(staff);
    }
    section.getUnclearsAndSbsAndApps().add(measureFirst);

    for (int measureIter = 1; measureIter < measureCount; measureIter++) {
      Measure measure = new Measure();
      for (int stavesIter = 0; stavesIter < stavesCount; stavesIter++) {
        Staff staff = new Staff();
        Layer layer = new Layer();
        staff.getSbsAndSymbolsAndOrigs().add(layer);
        measure.getAnnotsAndSlursAndTupletSpen().add(staff);
      }
      section.getUnclearsAndSbsAndApps().add(measure);
    }
    score.getGapsAndSbsAndCorrs().add(section);
    mdiv.setScore(score);
    body.getMdivs().add(mdiv);
    music.setBody(body);
    mei.setMusic(music);
    mei.setId(DEFAULT_MEI_TREE);
    return mei;
  }
View Full Code Here

   * @param meiData
   * @return
   */
  public static Mei createMeiFromFormsDiagram(MusicDiagram rootDiagram,
      boolean saveAllVariants) {
    Mei mei = rootDiagram.getMeiTree();
    handleSourceList(rootDiagram, mei);
    Score score = new Score();
    for (BasicElement child : rootDiagram.getChildren()) {
      score.getGapsAndSbsAndCorrs().add(
          handleScoreChild(child, saveAllVariants));
    }
    mei.getMusic().getBody().getMdivs().get(0).setScore(score);
    return mei;
  }
View Full Code Here

   *
   * @return
   */
  public static Mei createDefaultMeiTree(int stavesCount, int measureCount) {
    Mei mei = new Mei();
    MeiHead meiHead = new MeiHead();
    FileDesc fileDesc = new FileDesc();
    TitleStmt titleStmt = new TitleStmt();
    Title title = new Title();
    title.getContent().add("New MEI-2013 document");
    titleStmt.getTitles().add(title);
    fileDesc.setTitleStmt(titleStmt);
    PubStmt pubStmt = new PubStmt();
    fileDesc.setPubStmt(pubStmt);
    SourceDesc sourceDesc = new SourceDesc();
    Source source = new Source();
    sourceDesc.getSources().add(source);
    fileDesc.setSourceDesc(sourceDesc);   
    meiHead.setFileDesc(fileDesc)
    mei.setMeiHead(meiHead);
    Music music = new Music();
    Body body = new Body();
    Mdiv mdiv = new Mdiv();
    Score score = new Score();
View Full Code Here

   * @param meiData
   *            the mei tree
   */
  private static void handleSourceList(MusicDiagram rootDiagram, Mei meiData) {
    if (!meiData.isSetMeiHead())
      meiData.setMeiHead(new MeiHead());
    if (!meiData.getMeiHead().isSetFileDesc())
      meiData.getMeiHead().setFileDesc(new FileDesc());
    if (!meiData.getMeiHead().getFileDesc().isSetSourceDesc())
      meiData.getMeiHead().getFileDesc().setSourceDesc(new SourceDesc());
    if (!rootDiagram.getSourceList().isEmpty()) {
View Full Code Here

    Source source = new Source();
    sourceDesc.getSources().add(source);
    fileDesc.setSourceDesc(sourceDesc);   
    meiHead.setFileDesc(fileDesc)
    mei.setMeiHead(meiHead);
    Music music = new Music();
    Body body = new Body();
    Mdiv mdiv = new Mdiv();
    Score score = new Score();
    ScoreDef scoreDef = createScoreDef(stavesCount);
    score.getGapsAndSbsAndCorrs().add(scoreDef);
    Section section = new Section();
    Measure measureFirst = new Measure();
    Staff staffFirst = new Staff();
    Layer layerFirst = new Layer();
    staffFirst.getSbsAndSymbolsAndOrigs().add(layerFirst);
    measureFirst.getAnnotsAndSlursAndTupletSpen().add(staffFirst);
    for (int stavesIter = 1; stavesIter < stavesCount; stavesIter++) {
      Staff staff = new Staff();
      Layer layer = new Layer();
      staff.getSbsAndSymbolsAndOrigs().add(layer);
      measureFirst.getAnnotsAndSlursAndTupletSpen().add(staff);
    }
    section.getUnclearsAndSbsAndApps().add(measureFirst);

    for (int measureIter = 1; measureIter < measureCount; measureIter++) {
      Measure measure = new Measure();
      for (int stavesIter = 0; stavesIter < stavesCount; stavesIter++) {
        Staff staff = new Staff();
        Layer layer = new Layer();
        staff.getSbsAndSymbolsAndOrigs().add(layer);
        measure.getAnnotsAndSlursAndTupletSpen().add(staff);
      }
      section.getUnclearsAndSbsAndApps().add(measure);
    }
    score.getGapsAndSbsAndCorrs().add(section);
    mdiv.setScore(score);
    body.getMdivs().add(mdiv);
    music.setBody(body);
    mei.setMusic(music);
    mei.setId(DEFAULT_MEI_TREE);
    return mei;
  }
View Full Code Here

  /**
   * Create a note with default values
   */
  private void createDefaultNote() {
    Note note = new Note();
    note.setPname(GraphicalConstants.DEFAULT_NOTE_PITCHNAME);
    note.setDur(GraphicalConstants.DEFAULT_NOTE_DURATION);
    note.setOct(GraphicalConstants.DEFAULT_NOTE_OCTAVE);
    setMeiNode(note);
  }
View Full Code Here

        } catch (Exception e) {
          LogService.error(e.getMessage(), e);
        }
      }
      if(meiNode instanceof Note) {
        Note newNote = new Note();
        Note meiNote = (Note) meiNode;
        if(meiNote.isSetDur())
          newNote.setDur(meiNote.getDur());
        if(meiNote.isSetDots())
          newNote.setDots(meiNote.getDots());
        if(meiNote.isSetOct())
        newNote.setOct(((Note) meiNode).getOct());
        if(meiNote.isSetN())
          newNote.setN(meiNote.getN());
        if(meiNote.isSetPname())
          newNote.setPname(meiNote.getPname());
        this.child.setMeiNode(newNote);
        return;
      }
      this.child.setMeiNode(meiNode);
    }
View Full Code Here

            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof NoteForm) {
      NoteForm contentForm = (NoteForm) childForm;
      Note contentNode = (Note) contentForm.getMeiNode();
      if (contentNode.getArtics().isEmpty())
        contentNode.unsetArtics();
      return contentNode;
    } else if (childForm instanceof RestForm) {
      RestForm contentForm = (RestForm) childForm;
      Rest contentNode = (Rest) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof MRestForm) {
      MRestForm contentForm = (MRestForm) childForm;
      MRest contentNode = (MRest) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof SpaceForm) {
      SpaceForm contentForm = (SpaceForm) childForm;
      Space contentNode = (Space) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof DynamForm) {
      DynamForm contentForm = (DynamForm) childForm;
      Dynam contentNode = (Dynam) contentForm.getMeiNode();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getContent().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof TieForm) {
      TieForm contentForm = (TieForm) childForm;
View Full Code Here

TOP

Related Classes of info.textgrid.lab.noteeditor.mei2013.Layer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.