Quantcast
Channel: Shadiku Izayoi » Development
Viewing all articles
Browse latest Browse all 12

Keysim

$
0
0

Here’s a program that I thought wouldn’t take long to write but in the end had loads of problems which took a while to overcome.

The main aim of this program is to simulate the sound created by mechanical keyboards, because it sounds awesome. I thought this would be a quick gimmicky project that I’d finish in 5 minutes but oh man, was I wrong.

It’s based off MRinterface’s keyboard simulators. The program downloads sounds from there as you require them instead of packaging all of them. I liked the whole idea of a mechanical keyboard simulator but of course this was limited to just the browser so I decided that I’d write a system wide version. But of course, the whole development process wasn’t easy.

So here’s a list of some of the problems I faced while creating this program.

  • AutoPlay’s Audio system only has seven channels, this means that you could only ever have seven sounds playing at one time. I don’t know if people type that fast for this to be an issue but writing a system that would switch between channels as others were in use seemed complicated at the time.
  • Compiling the BASS module for Lua, this didn’t work at all. At first it gave me some error about the specified module could not be found and then it gave me an error about procedures not being found, in the end I went for another pre-compiled module instead of compiling it myself.
  • Making sure that BASS freed the streams that were completed, this didn’t seem like something that would be an issue but there were all sorts of errors that I blame on being too tired at the time of writing the code, in the end I now free streams a second after they have been completed.
  • Detecting duplicate key presses, AutoPlay does not have a system-wide “On Key” event so I had to use a quick-firing timer and look at System.IsKeyDown’s result, obviously at first (and for a while until I managed to fix it) it would fire loads of times instead of just once per key press. If the key was down it would spam audio.
  • Detecting multiple keys being down at once, initially when I realised the code I had written which had been working so far didn’t detect more than one key down I didn’t think I’d fix it, but then I remembered that when I’m playing games like Counter-Strike: Source, I’m going to have more than one key down and I’d like to hear the sound for it. I then rewrote the code so that it would detect if multiple keys were down, this was added in Version 1.1 which is the first public release.

Anyway, here it is for your enjoyment. You’ll either love it or hate it.

http://repository.shadiku.com/projects/Keysim-1.2-en_GB.zip (updated to 1.2)

Known issues are as follows:

  • Sounds generally not firing for some reason and not firing on Alt, F10 and other keys that do not have VK_ codes.
  • RAM usage will slowly increase as you use it despite the streams that have been used being freed.
  • Sometimes when multiple keys are down, the sound will not fire on some presses. (this is down to your keyboard iirc)

Viewing all articles
Browse latest Browse all 12

Trending Articles