fix(review): dead silenceFlags store removed; channelModeFor extracted + tested; auto-default + drop comments corrected; v9 constant minted

This commit is contained in:
2026-07-28 06:37:39 -04:00
parent 3e6629a867
commit e435ab1b8f
5 changed files with 68 additions and 19 deletions
+32
View File
@@ -146,6 +146,34 @@ static void testSelectChannelCountThreaded() {
CHECK(selUn && selUn->channelCount == 0); // unstamped -> unknown, never a guess
}
// --- channelModeFor (GA auto-default rule) -------------------------------------------
static void testChannelModeForExplicitIsNeverFought() {
// An explicit user choice is ALWAYS returned unchanged, regardless of channelCount.
CHECK(channelModeFor(2, ChannelMode::Mono, true) == ChannelMode::Mono);
CHECK(channelModeFor(1, ChannelMode::Stereo, true) == ChannelMode::Stereo);
CHECK(channelModeFor(0, ChannelMode::Stereo, true) == ChannelMode::Stereo);
}
static void testChannelModeForUnknownCountIsNoOp() {
// An unknown channel count (0 — an older bank entry) leaves the current mode unchanged.
CHECK(channelModeFor(0, ChannelMode::Mono, false) == ChannelMode::Mono);
CHECK(channelModeFor(0, ChannelMode::Stereo, false) == ChannelMode::Stereo);
}
static void testChannelModeForStereoCapture() {
// A capture with channelCount >= 2 selects Stereo (regardless of current mode).
CHECK(channelModeFor(2, ChannelMode::Mono, false) == ChannelMode::Stereo);
CHECK(channelModeFor(2, ChannelMode::Stereo, false) == ChannelMode::Stereo);
CHECK(channelModeFor(6, ChannelMode::Mono, false) == ChannelMode::Stereo);
}
static void testChannelModeForMonoCapture() {
// A capture with channelCount == 1 selects Mono (ingest-imported mono files only).
CHECK(channelModeFor(1, ChannelMode::Stereo, false) == ChannelMode::Mono);
CHECK(channelModeFor(1, ChannelMode::Mono, false) == ChannelMode::Mono);
}
static void testSelectEmptyBlob() {
CHECK(!selectSample("", "a").has_value());
}
@@ -2100,6 +2128,10 @@ int main() {
testSelectLoopThreaded();
testSelectNoLoopIsAbsent();
testSelectChannelCountThreaded();
testChannelModeForExplicitIsNeverFought();
testChannelModeForUnknownCountIsNoOp();
testChannelModeForStereoCapture();
testChannelModeForMonoCapture();
testSelectEmptyBlob();
testSelectMalformedBlob();
testSelectZeroSamples();