Rename the "canBeStolen" function

This commit is contained in:
Paul Ferrand 2020-05-05 23:45:06 +02:00
parent 87e4b4ed90
commit ac993741d1
4 changed files with 14 additions and 14 deletions

View file

@ -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();
}

View file

@ -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)
*

View file

@ -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")

View file

@ -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")