public void doFirstMeasure(boolean bAddDefaults)
{
if (elCurPart == null)
newVoice(new Voice((byte)0));
if (elCurMeasure == null)
{ elCurMeasure = new Element("measure");
elCurMeasure.addAttribute(new Attribute("number", Integer.toString(1)));
// assemble attributes element
Element elAttributes = new Element("attributes");
if (bAddDefaults)
{ // divisions - 4 per beat
Element elDivisions = new Element("divisions");
elDivisions.appendChild(Integer.toString(MUSICXMLDIVISIONS));
elAttributes.appendChild(elDivisions);
// beats - 1 beat per measure
Element elTime = new Element("time");
Element elBeats = new Element("beats");
elBeats.appendChild(Integer.toString(4));
elTime.appendChild(elBeats);
Element elBeatType = new Element("beat-type");
elBeatType.appendChild(Integer.toString(4));
elTime.appendChild(elBeatType);
elAttributes.appendChild(elTime);
}
if (bAddDefaults)
{ // Clef - assumed to be treble clef
Element elClef = new Element("clef");
Element elSign = new Element("sign");
elSign.appendChild("G");
Element elLine = new Element("line");
elLine.appendChild("2");
elClef.appendChild(elSign);
elClef.appendChild(elLine);
elAttributes.appendChild(elClef);
}
// add the attributes to the measure