On buffered soundchips.
Recently I buffered the AY8910, SN76496/89[a], and now the Namco WSG chips.
What's this mean? Simply put, less cpu usage and better sound. For the developer, it makes working with the sound chips a lot nicer as well, due to dealing with less code in the drivers. Take a look at the pacman driver's sound update routines in the attachment below.
The first block of code (- prefixed) was called every time the cpus ran, the second block was called at the end of a frame, to make sure the sound buffer was completely filled. In some games, this would have to be called up to 262 times per frame (and there are usually 60 frames in a second!) Each call is basically a call to emulate the soundchip.
The buffered approach does things a bit smarter, it only updates the sound buffers when the game writes to the soundchip. On average, it updates 1-5x per frame, but if a certain game were to use the chips as a rudimentary dac, it could be called hundreds of times per frame.
Out of the FM chips, they're all buffered except for the YM2151 and YM2413. Going to have to tackle those next..
For those that don't know -
The code removed has a - in front of it, the code added/replaced has a +.
(the green block at the bottom of the image replaces all that code above it!)
best regards,
- dink