Skip to content

Commit

Permalink
Play sounds from at least half a second ago
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanisaacg committed Aug 17, 2024
1 parent f96c8b3 commit 1151a6f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ function RealApp({ coords }: { coords: { lat: number; long: number } }) {
const time = (noteDistance / NOTE_SPEED) * 2;
const skew = Date.now() - msg.timestamp;
const timeout = time - skew;
if (timeout > 0) {
setTimeout(() => player.synthesizeBell(msg.note), timeout);
if (timeout > -500) {
setTimeout(() => player.synthesizeBell(msg.note), Math.max(timeout, 0));
}
});
return cleanup;
Expand Down

0 comments on commit 1151a6f

Please sign in to comment.