Pac-mania music issue
Posted: Fri May 15, 2015 8:58 am
Having now looked into this to see if it's a wider issue that needs resolving, it's a problem with the way the game music handler was coded:
This poses several questions:
- The original Pac-mania (F10507) uses Event 4 (VSync) to schedule the music and effects. That's fine for the effects as they're based on game play, but it's not correct for music - and goes against Acorn guidelines in the PRM
- The Learning Curve version (F10447) corrects the issue above by switching the code to be called via CallEvery at 1/50th second. This in itself isn't particularly good practice as CallEvery isn't guaranteed (for a guaranteed call at 1/50th sec it should be using TickerV), but does meet PRM guidelines
- As the music scheduler isn't hanging off the OS_Sound Scheduler and is also separate from the Voice Generators it introduces a potential timing issue...if the music scheduler isn't scheduling the samples on time you get an audio silence when the Voice Generator is called. This also makes it very dependent on the order IRQ's are generated (although I don't believe this to be an issue as ADFFS generates them in the same order as IOC) and means the Voice Generators can stall
This poses several questions:
- Why wasn't this an issue in some of the earlier ADFFS releases
- How can the problem be resolved on IOC / IOMD
- How can the problem be resolved on the Pi, where there's the potential the Voice Generators are called more than once to ensure the audio buffer is full