Fix routed QAM publication and redundant input state writes

This commit is contained in:
Delete228 committed 2026-10-27 14:23:37 +03:00
1 parent 92b4361100
commit ed121f247c
6 files changed
+85 -6

No files matched your search

@@ -29,11 +29,12 @@ class InputRouter(private val output: InputOutput) {
fun removeSnapshot(snapshot: () -> Unit) { snapshots.remove(snapshot) }
@Synchronized
fun setEnabled(on: Boolean) {
if (enabled == on) return
fun setEnabled(on: Boolean): Boolean {
if (enabled == on) return false
if (!on) releaseAll()
enabled = on
for (pad in pads) pad.refreshIdentity()
return true
}
@Synchronized
@@ -154,8 +154,7 @@ public final class PadBridge {
}
public synchronized void setInputEnabled(boolean enabled) {
if (inputRouter == null) return;
inputRouter.setEnabled(enabled);
if (inputRouter == null || !inputRouter.setEnabled(enabled)) return;
if (!enabled) clearBackQamWrites();
if (open) publish();
for (int slot = 1; slot < SLOTS; slot++) if (playerWriters[slot] != null) publish(slot);
@@ -988,7 +987,7 @@ public final class PadBridge {
boolean routedQam = output.isDown(PadState.QAM);
boolean routedQamStarted = routedQam && !routedQamPressed;
routedQamPressed = routedQam;
if (routedQamStarted && !nativeQam()) {
if (routedQamStarted && !nativeQam() && !qamChordActive) {
startChord(PadState.A);
return;
}