Exemplo n.º 1
0
  private void writeTimeSignature(TGTimeSignature timeSignature) {
    // escribo el numerador
    writeByte(timeSignature.getNumerator());

    // escribo el denominador
    writeDuration(timeSignature.getDenominator());
  }
Exemplo n.º 2
0
 private TGMeasureHeader readMeasureHeader(int number, TGSong song, TGTimeSignature timeSignature)
     throws IOException {
   int flags = readUnsignedByte();
   TGMeasureHeader header = getFactory().newHeader();
   header.setNumber(number);
   header.setStart(0);
   header.getTempo().setValue(120);
   header.setTripletFeel(this.tripletFeel);
   header.setRepeatOpen(((flags & 0x04) != 0));
   if ((flags & 0x01) != 0) {
     timeSignature.setNumerator(readByte());
   }
   if ((flags & 0x02) != 0) {
     timeSignature.getDenominator().setValue(readByte());
   }
   timeSignature.copy(header.getTimeSignature());
   if ((flags & 0x08) != 0) {
     header.setRepeatClose(readByte());
   }
   if ((flags & 0x10) != 0) {
     header.setRepeatAlternative(parseRepeatAlternative(song, number, readUnsignedByte()));
   }
   if ((flags & 0x20) != 0) {
     header.setMarker(readMarker(number));
   }
   if ((flags & 0x40) != 0) {
     readByte();
     readByte();
   }
   return header;
 }
Exemplo n.º 3
0
  private void readTimeSignature(TGTimeSignature timeSignature) {
    // leo el numerador
    timeSignature.setNumerator(readByte());

    // leo el denominador
    readDuration(timeSignature.getDenominator());
  }
Exemplo n.º 4
0
 private TGMeasureHeader readMeasureHeader(int index, TGTimeSignature timeSignature)
     throws IOException {
   int flags = readUnsignedByte();
   TGMeasureHeader header = new TGMeasureHeaderImpl();
   header.setNumber((index + 1));
   header.setStart(0);
   header.getTempo().setValue(120);
   header.setRepeatOpen(((flags & 0x04) != 0));
   if ((flags & 0x01) != 0) {
     timeSignature.setNumerator(readByte());
   }
   if ((flags & 0x02) != 0) {
     timeSignature.getDenominator().setValue(readByte());
   }
   header.setTimeSignature(timeSignature.clone());
   if ((flags & 0x08) != 0) {
     header.setRepeatClose(((readByte() & 0xff) - 1));
   }
   if ((flags & 0x20) != 0) {
     header.setMarker(readMarker(header.getNumber()));
   }
   if ((flags & 0x10) != 0) {
     header.setRepeatAlternative(readUnsignedByte());
   }
   if ((flags & 0x40) != 0) {
     readByte();
     readByte();
   }
   if ((flags & 0x01) != 0 || (flags & 0x02) != 0) {
     skip(4);
   }
   if ((flags & 0x10) == 0) {
     skip(1);
   }
   int tripletFeel = readByte();
   if (tripletFeel == 1) {
     header.setTripletFeel(TGMeasureHeader.TRIPLET_FEEL_EIGHTH);
   } else if (tripletFeel == 2) {
     header.setTripletFeel(TGMeasureHeader.TRIPLET_FEEL_SIXTEENTH);
   } else {
     header.setTripletFeel(TGMeasureHeader.TRIPLET_FEEL_NONE);
   }
   return header;
 }
Exemplo n.º 5
0
 private void addTimeSignature(TGTimeSignature ts, int indent) {
   this.writer.println(
       indent(indent) + "\\time " + ts.getNumerator() + "/" + ts.getDenominator().getValue());
 }
Exemplo n.º 6
0
 public boolean isEqual(TGTimeSignature ts) {
   return (getNumerator() == ts.getNumerator() && getDenominator().isEqual(ts.getDenominator()));
 }
Exemplo n.º 7
0
 public void copy(TGTimeSignature timeSignature) {
   timeSignature.setNumerator(getNumerator());
   getDenominator().copy(timeSignature.getDenominator());
 }