tsoding / pinpog

Ping-Pong-like game in Assembly that works without OS
MIT License
571 stars 36 forks source link

Add a beep sound when you score a point (bounce or pin the ball). #71

Closed edorfaus closed 5 years ago

edorfaus commented 5 years ago

This takes 24 bytes, unless the sound is disabled using the included %define, which makes it take no space at all.

The frequency of the sound can be changed using the same %define; this sets it as close to the note C3 as I could get with the define, as that sounds fairly OK to my ears.

The beep lasts for almost one frame. If the ball is pinned, though, the beep gets re-triggered in the same frame that it stopped, which makes the sound almost (but not quite) continuous as long as the ball is pinned. In my experience this was not really a problem, and works fairly well as an audible indication of the ball being pinned.

I originally tried to use the print-a-BEL method suggested on the stream, but couldn't get it to work even when using an int10 service that explicitly said that BEL is treated as a control character.

Instead, this drives the PC speaker by controlling the PIT (Programmable Interval Timer) channel that it is connected to. This is a little bit more complicated, but in return allows control over both the frequency and duration of the sound.

Fixes #40 (I know it was set to wontfix, but I don't think this version is too annoying, and it lets you disable the sound if you disagree, so... Up to you.)

rexim commented 5 years ago

@edorfaus this is so cool! Unfortunately I find the sound extremely annoying, especially in the pinned state. Thank you so much for your time and effort, but this is not what I'd like to see in this game. I'm really sorry!