Skip to content

Commit

Permalink
Set loop_mode to one_shot for release regions
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfd committed Aug 18, 2020
1 parent be7ff64 commit ed38c93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/sfizz/Region.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,11 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode)
break;
case hash("release"):
trigger = SfzTrigger::release;
loopMode = SfzLoopMode::one_shot;
break;
case hash("release_key"):
trigger = SfzTrigger::release_key;
loopMode = SfzLoopMode::one_shot;
break;
default:
DBG("Unknown trigger mode: " << opcode.value);
Expand Down
5 changes: 5 additions & 0 deletions tests/RegionT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,15 @@ TEST_CASE("[Region] Parsing opcodes")
REQUIRE(region.trigger == SfzTrigger::attack);
region.parseOpcode({ "trigger", "release" });
REQUIRE(region.trigger == SfzTrigger::release);
REQUIRE(region.loopMode == SfzLoopMode::one_shot);
region.parseOpcode({ "trigger", "first" });
REQUIRE(region.trigger == SfzTrigger::first);
region.parseOpcode({ "trigger", "legato" });
REQUIRE(region.trigger == SfzTrigger::legato);
region.parseOpcode({ "loop_mode", "no_loop" });
region.parseOpcode({ "trigger", "release_key" });
REQUIRE(region.trigger == SfzTrigger::release_key);
REQUIRE(region.loopMode == SfzLoopMode::one_shot);
}

SECTION("on_locc, on_hicc")
Expand Down

0 comments on commit ed38c93

Please sign in to comment.