Skip to content

Commit

Permalink
Add support for SFZ opcode aliases
Browse files Browse the repository at this point in the history
Opcode aliases are listed here: https://www.linuxsampler.org/sfz/

Not sure which implementations use them, but at the very least ChickenSys Translator outputs loopstart and loopend in its generated SFZ
  • Loading branch information
Jamie Bullock committed Sep 26, 2017
1 parent 68273e3 commit 016f8c6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions module/SFZero/SFZero/SFZReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void SFZReader::read(const char* text, unsigned int length)
buildingRegion->trigger = (SFZRegion::Trigger) triggerValue(value);
else if (opcode == "group")
buildingRegion->group = (unsigned long) value.getLargeIntValue();
else if (opcode == "off_by")
else if (opcode == "off_by" || opcode == "offby")
buildingRegion->off_by = (unsigned long) value.getLargeIntValue();
else if (opcode == "offset")
buildingRegion->offset = (unsigned long) value.getLargeIntValue();
Expand All @@ -213,7 +213,7 @@ void SFZReader::read(const char* text, unsigned int length)
else
buildingRegion->end = end;
}
else if (opcode == "loop_mode") {
else if (opcode == "loop_mode" || opcode == "loopmode") {
bool modeIsSupported =
value == "no_loop" ||
value == "one_shot" ||
Expand All @@ -226,9 +226,9 @@ void SFZReader::read(const char* text, unsigned int length)
sound->addUnsupportedOpcode(fauxOpcode);
}
}
else if (opcode == "loop_start")
else if (opcode == "loop_start" || opcode == "loopstart")
buildingRegion->loop_start = (unsigned long) value.getLargeIntValue();
else if (opcode == "loop_end")
else if (opcode == "loop_end" || opcode == "loopend")
buildingRegion->loop_end = (unsigned long) value.getLargeIntValue();
else if (opcode == "transpose")
buildingRegion->transpose = value.getIntValue();
Expand All @@ -238,9 +238,9 @@ void SFZReader::read(const char* text, unsigned int length)
buildingRegion->pitch_keycenter = keyValue(value);
else if (opcode == "pitch_keytrack")
buildingRegion->pitch_keytrack = value.getIntValue();
else if (opcode == "bend_up")
else if (opcode == "bend_up" || opcode == "bendup")
buildingRegion->bend_up = value.getIntValue();
else if (opcode == "bend_down")
else if (opcode == "bend_down" || opcode == "benddown")
buildingRegion->bend_down = value.getIntValue();
else if (opcode == "volume")
buildingRegion->volume = value.getFloatValue();
Expand Down

0 comments on commit 016f8c6

Please sign in to comment.