mirror of
https://github.com/usatiuk/cardboy.git
synced 2025-10-28 15:17:48 +01:00
format
This commit is contained in:
@@ -435,12 +435,12 @@ public:
|
||||
|
||||
GameboyApp* owner = nullptr;
|
||||
std::array<uint8_t, kRegisterCount> regs{};
|
||||
bool enabled = true;
|
||||
mutable uint8_t squareAlternate = 0;
|
||||
mutable uint8_t lastChannel = 0xFF;
|
||||
mutable double filteredFreqHz = 0.0;
|
||||
mutable std::array<uint16_t, 2> lastSquareRaw{};
|
||||
mutable std::array<uint8_t, 2> squareStable{};
|
||||
bool enabled = true;
|
||||
mutable uint8_t squareAlternate = 0;
|
||||
mutable uint8_t lastChannel = 0xFF;
|
||||
mutable double filteredFreqHz = 0.0;
|
||||
mutable std::array<uint16_t, 2> lastSquareRaw{};
|
||||
mutable std::array<uint8_t, 2> squareStable{};
|
||||
|
||||
static constexpr bool inRange(uint16_t addr) {
|
||||
return addr >= kBaseAddr && addr <= (kBaseAddr + static_cast<uint16_t>(kRegisterCount) - 1);
|
||||
@@ -510,7 +510,7 @@ public:
|
||||
// Track how stable each square channel's raw frequency is so we can bias selection.
|
||||
auto updateSquareHistory = [&](int idx, uint16_t raw) {
|
||||
if (raw == 0 || raw >= 2048U) {
|
||||
squareStable[static_cast<std::size_t>(idx)] = 0;
|
||||
squareStable[static_cast<std::size_t>(idx)] = 0;
|
||||
lastSquareRaw[static_cast<std::size_t>(idx)] = 0;
|
||||
return;
|
||||
}
|
||||
@@ -520,7 +520,7 @@ public:
|
||||
squareStable[static_cast<std::size_t>(idx)] = static_cast<uint8_t>(current + 1);
|
||||
} else {
|
||||
lastSquareRaw[static_cast<std::size_t>(idx)] = raw;
|
||||
squareStable[static_cast<std::size_t>(idx)] = 0;
|
||||
squareStable[static_cast<std::size_t>(idx)] = 0;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -548,7 +548,7 @@ public:
|
||||
updateSquareHistory(0, raw);
|
||||
pushCandidate(freq, loud, 3, Channel::Square1);
|
||||
} else {
|
||||
squareStable[0] = 0;
|
||||
squareStable[0] = 0;
|
||||
lastSquareRaw[0] = 0;
|
||||
}
|
||||
}
|
||||
@@ -568,7 +568,7 @@ public:
|
||||
updateSquareHistory(1, raw);
|
||||
pushCandidate(freq, loud, 3, Channel::Square2);
|
||||
} else {
|
||||
squareStable[1] = 0;
|
||||
squareStable[1] = 0;
|
||||
lastSquareRaw[1] = 0;
|
||||
}
|
||||
}
|
||||
@@ -625,7 +625,7 @@ public:
|
||||
|
||||
for (int idx = 0; idx < 2; ++idx) {
|
||||
if (!squareActive[idx]) {
|
||||
squareStable[static_cast<std::size_t>(idx)] = 0;
|
||||
squareStable[static_cast<std::size_t>(idx)] = 0;
|
||||
lastSquareRaw[static_cast<std::size_t>(idx)] = 0;
|
||||
}
|
||||
}
|
||||
@@ -691,9 +691,8 @@ public:
|
||||
bestSquare = squareCandidates[1];
|
||||
}
|
||||
if (!bestSquare) {
|
||||
const Candidate* preferred =
|
||||
(squareAlternate & 1U) ? squareCandidates[1] : squareCandidates[0];
|
||||
bestSquare = preferred;
|
||||
const Candidate* preferred = (squareAlternate & 1U) ? squareCandidates[1] : squareCandidates[0];
|
||||
bestSquare = preferred;
|
||||
squareAlternate ^= 1U;
|
||||
}
|
||||
}
|
||||
@@ -705,7 +704,7 @@ public:
|
||||
if (!best)
|
||||
best = bestOther;
|
||||
else if (bestOther) {
|
||||
int bestScore = static_cast<int>(best->loud);
|
||||
int bestScore = static_cast<int>(best->loud);
|
||||
int otherScore = static_cast<int>(bestOther->loud);
|
||||
if (waveBass) {
|
||||
if (best->channel == Channel::Wave)
|
||||
|
||||
Reference in New Issue
Block a user