Ejemplo n.º 1
0
  /**
   * Returns the index with which to start parsing the next part of the string, once this method is
   * done with its part
   */
  private int parseDuration(
      String s, int index, NoteContext noteContext, StaccatoParserContext parserContext) {
    if (index < s.length()) {
      switch (s.charAt(index)) {
        case '/':
          index = parseNumericDuration(s, index, noteContext);
          break;
        case 'W':
        case 'H':
        case 'Q':
        case 'I':
        case 'S':
        case 'T':
        case 'X':
        case 'O':
        case '-':
          index = parseLetterDuration(s, index, noteContext, parserContext);
          break;
        default:
          noteContext.decimalDuration =
              DefaultNoteSettingsManager.getInstance().getDefaultDuration();
          noteContext.isDurationExplicitlySet = false;
          break; // Could get here if the next character is a velocity char ("a" or "d")
      }
      index = parseTuplet(s, index, noteContext);
    } else {
      noteContext.decimalDuration = DefaultNoteSettingsManager.getInstance().getDefaultDuration();
      noteContext.isDurationExplicitlySet = false;
    }

    logger.info("Decimal duration is " + noteContext.decimalDuration);

    return index;
  }
Ejemplo n.º 2
0
  private void setDefaultOctave(NoteContext context) {
    logger.info("No octave string found, setting default octave");

    if (context.isChord) {
      context.octaveNumber =
          DefaultNoteSettingsManager.getInstance().getDefaultBassOctave() + context.octaveBias;
    } else {
      context.octaveNumber =
          DefaultNoteSettingsManager.getInstance().getDefaultOctave() + context.octaveBias;
    }
  }