Corrected a bug with default_path
The default path was not properly reset when loading a new file
This commit is contained in:
parent
194816ef58
commit
92254e8c98
3 changed files with 12 additions and 0 deletions
|
|
@ -136,6 +136,7 @@ void sfz::Synth::clear()
|
|||
numCurves = 0;
|
||||
fileTicket = -1;
|
||||
defaultSwitch = absl::nullopt;
|
||||
defaultPath = "";
|
||||
midiState.reset();
|
||||
ccNames.clear();
|
||||
globalOpcodes.clear();
|
||||
|
|
|
|||
|
|
@ -370,4 +370,14 @@ TEST_CASE("[Files] Default path")
|
|||
REQUIRE(synth.getRegionView(1)->sample == R"(DefaultPath/SubPath2/sample2.wav)");
|
||||
REQUIRE(synth.getRegionView(2)->sample == R"(DefaultPath/SubPath1/sample1.wav)");
|
||||
REQUIRE(synth.getRegionView(3)->sample == R"(DefaultPath/SubPath2/sample2.wav)");
|
||||
}
|
||||
|
||||
TEST_CASE("[Files] Default path reset when calling loadSfzFile again")
|
||||
{
|
||||
sfz::Synth synth;
|
||||
synth.loadSfzFile(fs::current_path() / "tests/TestFiles/default_path.sfz");
|
||||
REQUIRE(synth.getNumRegions() == 4);
|
||||
synth.loadSfzFile(fs::current_path() / "tests/TestFiles/default_path_reset.sfz");
|
||||
REQUIRE(synth.getNumRegions() == 1);
|
||||
REQUIRE(synth.getRegionView(0)->sample == R"(DefaultPath/SubPath2/sample2.wav)");
|
||||
}
|
||||
1
tests/TestFiles/default_path_reset.sfz
Normal file
1
tests/TestFiles/default_path_reset.sfz
Normal file
|
|
@ -0,0 +1 @@
|
|||
<region> sample=DefaultPath/SubPath2/sample2.wav
|
||||
Loading…
Add table
Reference in a new issue