Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | import { createPlayerInputSignalBus } from '@be-music/player-engine/signals';
import { createInputTokenToChannelsMap, createLaneBindings } from './manual-input.ts';
import { createNodeInputRuntime } from './node/node-input-runtime.ts';
let sequence = 0;
main();
function main(): void {
const laneBindings = createLaneBindings(['11', '12', '13', '14', '15', '16', '18', '19'], {
platform: process.platform,
});
const inputSignals = createPlayerInputSignalBus();
const inputTokenToChannels = createInputTokenToChannelsMap(laneBindings);
const runtime = createNodeInputRuntime({
mode: 'manual',
inputSignals,
inputTokenToChannels,
});
process.stdout.write(
'Gameplay input diagnostics started. Press keys to inspect runtime commands. Press Ctrl+C to exit.\n',
);
emitRecord({
kind: 'bindings',
bindings: laneBindings.map((binding) => ({
channel: binding.channel,
keyLabel: binding.keyLabel,
inputTokens: binding.inputTokens,
isScratch: binding.isScratch,
})),
});
runtime.start();
const interval = setInterval(() => {
for (const command of inputSignals.drainCommands()) {
emitRecord(command);
if (command.kind === 'interrupt' && command.reason === 'ctrl-c') {
clearInterval(interval);
runtime.stop();
process.exit(0);
}
}
}, 16);
const stopOnExit = (): void => {
clearInterval(interval);
runtime.stop();
};
process.once('exit', stopOnExit);
}
function emitRecord(payload: Record<string, unknown>): void {
process.stdout.write(
`${JSON.stringify({
sequence: sequence++,
at: new Date().toISOString(),
...payload,
})}\n`,
);
}
|