From ac993741d11fb06abc3ee8b3945d2278ca07279a Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Tue, 5 May 2020 23:45:06 +0200 Subject: [PATCH] Rename the "canBeStolen" function --- src/sfizz/Voice.cpp | 2 +- src/sfizz/Voice.h | 4 ++-- tests/FilesT.cpp | 4 ++-- tests/SynthT.cpp | 18 +++++++++--------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/sfizz/Voice.cpp b/src/sfizz/Voice.cpp index 7eea837a..131c3670 100644 --- a/src/sfizz/Voice.cpp +++ b/src/sfizz/Voice.cpp @@ -638,7 +638,7 @@ float sfz::Voice::getMeanSquaredAverage() const noexcept return powerHistory.getAverage(); } -bool sfz::Voice::canBeStolen() const noexcept +bool sfz::Voice::releasedOrFree() const noexcept { return state == State::idle || egEnvelope.isReleased(); } diff --git a/src/sfizz/Voice.h b/src/sfizz/Voice.h index bc1e537c..462cdfd7 100644 --- a/src/sfizz/Voice.h +++ b/src/sfizz/Voice.h @@ -144,12 +144,12 @@ public: */ bool isFree() const noexcept; /** - * @brief Can the voice be "stolen" and reused (i.e. is it releasing) + * @brief Can the voice be reused (i.e. is it releasing or free) * * @return true * @return false */ - bool canBeStolen() const noexcept; + bool releasedOrFree() const noexcept; /** * @brief Get the number that triggered the voice (note number or cc number) * diff --git a/tests/FilesT.cpp b/tests/FilesT.cpp index 2f22dea5..1288638b 100644 --- a/tests/FilesT.cpp +++ b/tests/FilesT.cpp @@ -455,7 +455,7 @@ TEST_CASE("[Files] Off by with different delays") REQUIRE( group1Voice->getRegion()->offBy == 2ul ); synth.noteOn(100, 64, 63); synth.renderBlock(buffer); - REQUIRE( group1Voice->canBeStolen() ); + REQUIRE( group1Voice->releasedOrFree() ); } TEST_CASE("[Files] Off by with the same delays") @@ -470,7 +470,7 @@ TEST_CASE("[Files] Off by with the same delays") REQUIRE( group1Voice->getRegion()->group == 1ul ); REQUIRE( group1Voice->getRegion()->offBy == 2ul ); synth.noteOn(0, 64, 63); - REQUIRE( !group1Voice->canBeStolen() ); + REQUIRE( !group1Voice->releasedOrFree() ); } TEST_CASE("[Files] Off by with the same notes at the same time") diff --git a/tests/SynthT.cpp b/tests/SynthT.cpp index 6d7022ba..40a6b136 100644 --- a/tests/SynthT.cpp +++ b/tests/SynthT.cpp @@ -195,7 +195,7 @@ TEST_CASE("[Synth] Trigger=release and an envelope properly kills the voice at t synth.renderBlock(buffer); // Decay (0.02) synth.renderBlock(buffer); synth.renderBlock(buffer); // Release (0.1) - REQUIRE( synth.getVoiceView(0)->canBeStolen() ); + REQUIRE( synth.getVoiceView(0)->releasedOrFree() ); // Release is 0.1s for (int i = 0; i < 10; ++i) synth.renderBlock(buffer); @@ -218,7 +218,7 @@ TEST_CASE("[Synth] Trigger=release_key and an envelope properly kills the voice synth.renderBlock(buffer); // Decay (0.02) synth.renderBlock(buffer); synth.renderBlock(buffer); // Release (0.1) - REQUIRE( synth.getVoiceView(0)->canBeStolen() ); + REQUIRE( synth.getVoiceView(0)->releasedOrFree() ); // Release is 0.1s for (int i = 0; i < 10; ++i) synth.renderBlock(buffer); @@ -241,7 +241,7 @@ TEST_CASE("[Synth] loopmode=one_shot and an envelope properly kills the voice at synth.renderBlock(buffer); // Decay (0.02) synth.renderBlock(buffer); synth.renderBlock(buffer); // Release (0.1) - REQUIRE( synth.getVoiceView(0)->canBeStolen() ); + REQUIRE( synth.getVoiceView(0)->releasedOrFree() ); // Release is 0.1s for (int i = 0; i < 10; ++i) synth.renderBlock(buffer); @@ -376,11 +376,11 @@ TEST_CASE("[Synth] Self-masking") synth.noteOn(0, 64, 64); REQUIRE(synth.getNumActiveVoices() == 3); // One of these is releasing REQUIRE(synth.getVoiceView(0)->getTriggerValue() == 63_norm); - REQUIRE(!synth.getVoiceView(0)->canBeStolen()); + REQUIRE(!synth.getVoiceView(0)->releasedOrFree()); REQUIRE(synth.getVoiceView(1)->getTriggerValue() == 62_norm); - REQUIRE(synth.getVoiceView(1)->canBeStolen()); // The lowest velocity voice is the masking candidate + REQUIRE(synth.getVoiceView(1)->releasedOrFree()); // The lowest velocity voice is the masking candidate REQUIRE(synth.getVoiceView(2)->getTriggerValue() == 64_norm); - REQUIRE(!synth.getVoiceView(2)->canBeStolen()); + REQUIRE(!synth.getVoiceView(2)->releasedOrFree()); } TEST_CASE("[Synth] Not self-masking") @@ -392,11 +392,11 @@ TEST_CASE("[Synth] Not self-masking") synth.noteOn(0, 66, 64); REQUIRE(synth.getNumActiveVoices() == 3); // One of these is releasing REQUIRE(synth.getVoiceView(0)->getTriggerValue() == 63_norm); - REQUIRE(synth.getVoiceView(0)->canBeStolen()); // The first encountered voice is the masking candidate + REQUIRE(synth.getVoiceView(0)->releasedOrFree()); // The first encountered voice is the masking candidate REQUIRE(synth.getVoiceView(1)->getTriggerValue() == 62_norm); - REQUIRE(!synth.getVoiceView(1)->canBeStolen()); + REQUIRE(!synth.getVoiceView(1)->releasedOrFree()); REQUIRE(synth.getVoiceView(2)->getTriggerValue() == 64_norm); - REQUIRE(!synth.getVoiceView(2)->canBeStolen()); + REQUIRE(!synth.getVoiceView(2)->releasedOrFree()); } TEST_CASE("[Synth] Polyphony in master")