Package info.textgrid.lab.noteeditor.mei2013

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


    cpd.setDescription(MusicMessages.MEI_documentation_generic_dur);
    descriptors.add(cpd);
  }

  private void createDefaultRest() {
    Rest rest = new Rest();
    rest.setDur(GraphicalConstants.DEFAULT_REST_DURATION);
    setMeiNode(rest);
  }
View Full Code Here


      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

    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);
View Full Code Here

   */
  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

  public void addStaffgroup(StaffGrp parent, StaffGrp child) {
    this.rootStaffTree.addStaffGroup(parent, child);
  }

  private void createDefaultScoreDef() {
    this.scoreDef = new ScoreDef();
  }
View Full Code Here

    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();
View Full Code Here

    musicDiagram.bootUp();
    return musicDiagram;
  }

  public static ScoreDef createScoreDef(int stavesCount) {
    ScoreDef scoreDef = new ScoreDef();
    StaffGrp staffGrp = new StaffGrp();
    for (int i = 0; i < stavesCount; i++) {
      StaffDef staffDef = new StaffDef();
      staffDef.setN(String.valueOf(i));
      if (i % 2 == 0)
        staffDef.setClefShape(GraphicalConstants.DEFAULT_SYSTEM_CLEF);
      else
        staffDef.setClefShape(GraphicalConstants.ALTERNATE_SYSTEM_CLEF);
      staffDef.setMeterCount(StringConstants.STRING_EMPTY + GraphicalConstants.DEFAULT_METER_COUNT);
      staffDef.setMeterUnit(new BigDecimal(
          GraphicalConstants.DEFAULT_METER_UNIT));
      staffDef.setKeySigValue("0");
      staffGrp.getInstrDevesAndGrpSymsAndStaffDeves().add(staffDef);
    }
    scoreDef.setStaffGrp(staffGrp);
    return scoreDef;
  }
View Full Code Here

        new Point(this.figurePassingObject.getRootXAxisProgress(),
            GraphicalConstants.DEFAULT_STARTPOINT.y
                + GraphicalConstants.SHAPE_SINGLESYSTEM_HEIGHT
                * indexOfStaffDef));
    StaffDef staffDef = (StaffDef) staffDefForm.getMeiNode();
    ScoreDef scoreDef = (ScoreDef) scoreDefForm.getMeiNode();
    int extentForLabel = 0; // extent for label if present
    if (staffDef.isSetLabel()) {
      extentForLabel = staffDef.getLabel().length()
          * this.figurePassingObject.getLabelSylExtentBase();
    }
    int extentForBrackets = 0;
    BasicElement parent = staffDefForm.getParent();
    while (parent.getFormType() == BasicElement.FormType.StaffGroup) {
      parent = parent.getParent();
      extentForBrackets += GraphicalConstants.SHAPE_STAFFDEF_BRACKET_OFFSET;
    }
    int extentForClefs = 0; // extent for clef keys if present
    if (staffDef.isSetClefShape()) {
      extentForClefs = GraphicalConstants.SHAPE_STAFFDEF_CLEF_OFFSET;
      if (staffDef.getClefShape() == DataCLEFSHAPE.GG) {
        extentForClefs = GraphicalConstants.SHAPE_STAFFDEF_CLEF_OFFSET * 2;
      }
    } else {
      if (scoreDef.isSetClefShape()) {
        extentForClefs = GraphicalConstants.SHAPE_STAFFDEF_CLEF_OFFSET;
        if (scoreDef.getClefShape() == DataCLEFSHAPE.GG) {
          extentForClefs = GraphicalConstants.SHAPE_STAFFDEF_CLEF_OFFSET * 2;
        }
      }
    }
    int extentForKeySig = 0; // extent for key signatures if present
    String keySignatureMEIString;
    if (staffDef.isSetKeySigValue()) {
      keySignatureMEIString = staffDef.getKeySigValue();
    } else {
      if (scoreDef.isSetKeySigValue()) {
        keySignatureMEIString = scoreDef.getKeySigValue();
      } else { // default: empty
        keySignatureMEIString = GraphicalConstants.PROPCOMBO_STRING_ARRAY_KEYSIGVALUES[0];
      }
    }
    if (keySignatureMEIString.length() == 2) {
      // one of the numbered sharps or flats, not '0'
      int countKeysigs = Integer.parseInt(keySignatureMEIString
          .substring(0, 1));
      extentForKeySig = countKeysigs * 5;
    }
    int extentForMeterSign = 0; // extent for meter sign if present
    if (staffDef.isSetMeterSym() || staffDef.isSetMeterCount()
        || staffDef.isSetMeterUnit() || scoreDef.isSetMeterSym()
        || scoreDef.isSetMeterCount() || scoreDef.isSetMeterUnit()) {
      extentForMeterSign = GraphicalConstants.SHAPE_STAFFDEF_METER_OFFSET;
    }
    FigureStaffDefPassingObject figureStaffDefPassingObject = new FigureStaffDefPassingObject(
        extentForLabel, extentForBrackets, extentForClefs,
        extentForKeySig, extentForMeterSign);
View Full Code Here

   *            the inheritance-providing scoredefForm
   */
  private void processStaffDef(Graphics graphics, StaffDefForm staffDefForm,
      ScoreDefForm scoreDefForm) {
    StaffDef staffDef = (StaffDef) staffDefForm.getMeiNode();
    ScoreDef scoreDef = (ScoreDef) scoreDefForm.getMeiNode();
    if (FigureRenderLibrary.isFormInVisibleArea(staffDefForm.getId(),
        this.figurePassingObject)) {
      FigureStaffDefPassingObject scoreDefPassingObject = this.figurePassingObject
          .getStaffDefMap().get(scoreDefForm.getId());
      Point startLocation = this.figurePassingObject.getLocationMap()
View Full Code Here

    }
    StaffDef staffDef = ((StaffDef) staffDefForm.getMeiNode());
//    ScoreDef scoredef = (ScoreDef) ((ScoreDefForm) MeiNodeNavigator
//        .findAncestorForm(ScoreDefForm.class, staffDefForm))
//        .getMeiNode();
    ScoreDef scoredef = (ScoreDef) MusicPlugin.getDefault().getActiveDiagram().getScoreDefForm().getMeiNode();
    String meterCount = StringConstants.STRING_EMPTY;
    if (staffDef.isSetMeterSym()) {
      if (staffDef.getMeterSym() == DataMETERSIGN.CUT) { // 2/2
        meterCount = "2";
      } else { // common = 4/4
        meterCount = "4";
      }
    } else { // directly placed
      if (staffDef.isSetMeterCount()) {
        meterCount = staffDef.getMeterCount();
      } else {
        if (scoredef.isSetMeterSym()) {
          if (scoredef.getMeterSym() == DataMETERSIGN.CUT) { // 2/2
            meterCount = "2";
          } else { // common = 4/4
            meterCount = "4";
          }
        } else { // directly placed
          if (scoredef.isSetMeterCount()) {
            meterCount = scoredef.getMeterCount();
          } else {
            meterCount = StringConstants.STRING_EMPTY + GraphicalConstants.DEFAULT_METER_COUNT;
          }
        }
      }
    }
    int meterUnit = -1;
    if (staffDef.isSetMeterSym()) {
      if (staffDef.getMeterSym() == DataMETERSIGN.CUT) { // 2/2
        meterUnit = 2;
      } else { // common = 4/4
        meterUnit = 4;
      }
    } else { // directly placed
      if (staffDef.isSetMeterUnit()) {
        meterUnit = staffDef.getMeterUnit().intValue();
      } else {
        if (scoredef.isSetMeterSym()) {
          if (scoredef.getMeterSym() == DataMETERSIGN.CUT) { // 2/2
            meterUnit = 2;
          } else { // common = 4/4
            meterUnit = 4;
          }
        } else { // directly placed
          if (scoredef.isSetMeterUnit()) {
            meterUnit = scoredef.getMeterUnit().intValue();
          } else {
            meterUnit = GraphicalConstants.DEFAULT_METER_UNIT;
          }
        }
      }
View Full Code Here

TOP

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

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.