VOGONS


First post, by keenmaster486

User metadata
Rank l33t
Rank
l33t

I'm writing some OPL2 code. I was trying to stay away from using the old "increment a timer counter and check vs. the old value" method of timing writes to the OPL2, but when I set my playing code as the interrupt handler, it plays 20-30% slower than it should and there's quite a bit of jitter. Changed it to increment a counter and check it in the main loop instead and now it plays perfectly.

Did I do something wrong? Not sure what best practices are concerning interrupt handlers and if they really should do as little as possible.

World's foremost 486 enjoyer.

Reply 1 of 2, by bakemono

User metadata
Rank Oldbie
Rank
Oldbie

interrupt handler should work fine if it is setup to fire at a reasonable rate. The default ~18Hz is not good for music unless it was composed specifically so that the tempo matches up.

GBAJAM 2024 submission on itch: https://90soft90.itch.io/wreckage

Reply 2 of 2, by keenmaster486

User metadata
Rank l33t
Rank
l33t

Well, I figured it out. This has to do with the fact that when playing IMF files, you want to dump the reg/val pairs into the OPL2 chip as quickly as possible when you aren't processing a delay. You can't govern the entire file by the tickrate - only the delays. Otherwise you will get weird tempo issues like I was having.

World's foremost 486 enjoyer.