Exemple #1
0
boolByte setTimeSignatureFromMidiBytes(const byte *bytes) {
  if (bytes != NULL) {
    return (boolByte)(
        setTimeSignatureBeatsPerMeasure(bytes[0]) &&
        setTimeSignatureNoteValue((unsigned const short)powl(2, bytes[1])));
  }

  return false;
}
Exemple #2
0
boolByte setTimeSignatureFromString(const CharString signature) {
  char *slash = NULL;
  unsigned short numerator = 0;
  unsigned short denominator = 0;

  if (!charStringIsEmpty(signature)) {
    slash = strchr(signature->data, '/');

    if (slash != NULL) {
      *slash = '\0';
      numerator = (unsigned short)strtod(signature->data, NULL);
      denominator = (unsigned short)strtod(slash + 1, NULL);

      if (numerator > 0 && denominator > 0) {
        return (boolByte)(setTimeSignatureBeatsPerMeasure(numerator) &&
                          setTimeSignatureNoteValue(denominator));
      }
    }
  }

  return false;
}
Exemple #3
0
void setTimeSignatureFromMidiBytes(const byte* bytes) {
  if(bytes != NULL) {
    setTimeSignatureBeatsPerMeasure(bytes[0]);
    setTimeSignatureNoteValue((short)powl(2, bytes[1]));
  }
}