Change the midiState observer to a resource observer for tests

This commit is contained in:
Paul Fd 2020-04-06 00:29:42 +02:00
parent 4ea11a31bf
commit 13edb6dfba
3 changed files with 7 additions and 5 deletions

View file

@ -339,7 +339,7 @@ public:
*/
void disableFreeWheeling() noexcept;
const MidiState& getMidiState() const noexcept { return resources.midiState; }
const Resources& getResources() const noexcept { return resources; }
/**
* @brief Check if the SFZ should be reloaded.

View file

@ -394,9 +394,10 @@ TEST_CASE("[Files] Default path is ignored for generators")
TEST_CASE("[Files] Set CC applies properly")
{
sfz::Synth synth;
const auto& midiState = synth.getResources().midiState;
synth.loadSfzFile(fs::current_path() / "tests/TestFiles/set_cc.sfz");
REQUIRE(synth.getMidiState().getCCValue(142) == 63_norm);
REQUIRE(synth.getMidiState().getCCValue(61) == 122_norm);
REQUIRE(midiState.getCCValue(142) == 63_norm);
REQUIRE(midiState.getCCValue(61) == 122_norm);
}
TEST_CASE("[Files] Note and octave offsets")

View file

@ -140,10 +140,11 @@ TEST_CASE("[Synth] All notes offs/all sounds off")
TEST_CASE("[Synth] Reset all controllers")
{
sfz::Synth synth;
const auto& midiState = synth.getResources().midiState;
synth.cc(0, 12, 64);
REQUIRE(synth.getMidiState().getCCValue(12) == 64_norm);
REQUIRE(midiState.getCCValue(12) == 64_norm);
synth.cc(0, 121, 64);
REQUIRE(synth.getMidiState().getCCValue(12) == 0_norm);
REQUIRE(midiState.getCCValue(12) == 0_norm);
}
TEST_CASE("[Synth] Releasing before the EG started smoothing (initial delay) kills the voice")