Package nu.xom

Examples of nu.xom.Element.appendChild()


    Element elBeatUnit = new Element("beat-unit");
    //  assume quarter note beat unit
    elBeatUnit.appendChild("quarter");
    Element elPerMinute = new Element("per-minute");
    Integer iBPM = new Float(PPMtoBPM(tempo.getTempo())).intValue();
    elPerMinute.appendChild(iBPM.toString());
    //  assemble all the pieces
    elMetronome.appendChild(elBeatUnit);
    elMetronome.appendChild(elPerMinute);
    elDirectionType.appendChild(elMetronome);
    elDirection.appendChild(elDirectionType);
View Full Code Here


   
    private void doKeySig(KeySignature keySig)
    {  Element elKey = new Element("key");
      //  build the key element
      Element elFifths = new Element("fifths");
      elFifths.appendChild(Byte.toString(keySig.getKeySig()));
      elKey.appendChild(elFifths);
      Element elMode = new Element("mode");
      elMode.appendChild((keySig.getScale() == 1 ? "minor" : "major"));
      elKey.appendChild(elMode);
      //  add the key to the attributes element of the current measure
View Full Code Here

      //  build the key element
      Element elFifths = new Element("fifths");
      elFifths.appendChild(Byte.toString(keySig.getKeySig()));
      elKey.appendChild(elFifths);
      Element elMode = new Element("mode");
      elMode.appendChild((keySig.getScale() == 1 ? "minor" : "major"));
      elKey.appendChild(elMode);
      //  add the key to the attributes element of the current measure
    if (elCurMeasure == null)
      doFirstMeasure(true);
      Element elAttributes = elCurMeasure.getFirstChildElement("attributes");
View Full Code Here

      doFirstMeasure(true);
      Element elAttributes = elCurMeasure.getFirstChildElement("attributes");
      boolean bNewAttributes = (elAttributes == null);
      if (bNewAttributes == true)
        elAttributes = new Element("attributes");
      elAttributes.appendChild(elKey);
      if (bNewAttributes == true)
        elCurMeasure.appendChild(elAttributes);
    //  doKeySig

    public void measureEvent(Measure measure)
View Full Code Here

    private void doNote(Note note, boolean bChord)
    {
      Element elNote = new Element("note");
     
      if (bChord)
        elNote.appendChild(new Element("chord"));
     
      //  rest
      if (note.isRest())
      {  Element elRest = new Element("rest");
        elNote.appendChild(elRest);
View Full Code Here

        int iAlter = 0;
        if (sPitch.length() > 1)
        {  iAlter = sPitch.contains("#") ? 1 : -1;
          sPitch = sPitch.substring(0,1);
        }
        elStep.appendChild(sPitch);
        elPitch.appendChild(elStep);
        //  alter - -1 = flat, 1 = sharp
        if (iAlter != 0)
        {  Element elAlter = new Element("alter");
          elAlter.appendChild(Integer.toString(iAlter));
View Full Code Here

        elStep.appendChild(sPitch);
        elPitch.appendChild(elStep);
        //  alter - -1 = flat, 1 = sharp
        if (iAlter != 0)
        {  Element elAlter = new Element("alter");
          elAlter.appendChild(Integer.toString(iAlter));
          elPitch.appendChild(elAlter);
        }
        //  octave
        Element elOctave = new Element("octave");
        elOctave.appendChild(Integer.toString(note.getValue() / 12));
View Full Code Here

          elAlter.appendChild(Integer.toString(iAlter));
          elPitch.appendChild(elAlter);
        }
        //  octave
        Element elOctave = new Element("octave");
        elOctave.appendChild(Integer.toString(note.getValue() / 12));
        elPitch.appendChild(elOctave);
       
        elNote.appendChild(elPitch);
      }
      //  duration
View Full Code Here

      //  duration
      Element elDuration = new Element("duration");
      double dDuration = note.getDecimalDuration();
      int iXMLDuration = (int)
        ((dDuration * WHOLE * MUSICXMLDIVISIONS) / QUARTER);
      elDuration.appendChild(Integer.toString(iXMLDuration));
      elNote.appendChild(elDuration);
      //  tie start/stop
      boolean bDoNotation = false;
      if (note.isStartOfTie())
      {  Element elTie = new Element("tie");
View Full Code Here

        }
        else if (dDuration == 0.0078125)
          sDuration = "128th";
        else sDuration = "/" + Double.toString(dDuration);
      Element elType = new Element("type");
      elType.appendChild(sDuration);
      elNote.appendChild(elType);
      //  dotted
      if (bDotted)
      {  Element elDot = new Element("dot");
        elNote.appendChild(elDot);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.