front practice basically working, need cleanup

This commit is contained in:
GitBluub
2024-01-15 23:14:09 +01:00
committed by Clément Le Bihan
parent 23a1ff8d19
commit c08a1a2c74
2 changed files with 7 additions and 6 deletions

View File

@@ -223,8 +223,9 @@ const PlayView = ({ songId }: PlayViewProps) => {
};
inputs.forEach((input) => {
input.onmidimessage = (message) => {
const { command, note } = parseMidiMessage(message);
const keyIsPressed = command == 9;
const { command, note, velocity } = parseMidiMessage(message);
let keyIsPressed = command == 9;
if (velocity == 0) keyIsPressed = false;
webSocket.current?.send(
JSON.stringify({

View File

@@ -207,9 +207,9 @@ class Scorometer:
#self.keys_down.append((message.note, message.time))
self.keys_down_practice.add(message.note)
if self.to_play == self.keys_down_practice:
self.send({"type": "step", "timestamp": self.practice_partition[0][0].start + 1})
if len(self.practice_partition) == 0:
self.endGamePractice()
self.send({"type": "step", "timestamp": self.practice_partition[0][0].start + 1})
self.to_play = set([x.key for x in self.practice_partition.pop(0)])
'''
@@ -368,9 +368,9 @@ class Scorometer:
send(
{
"type": "end",
#"overallScore": self.info["score"],
#"precision": round(((self.info["perfect"] + self.info["great"] + self.info["good"]) / (len(self.partition.notes) + self.info["wrong"]) * 100), 2),
#"score": self.info,
"overallScore": self.info["score"],
"precision": round(((self.info["perfect"] + self.info["great"] + self.info["good"]) / (len(self.partition.notes) + self.info["wrong"]) * 100), 2),
"score": self.info,
}
)
exit()