src/emu/sound/sn76496.c
| r6398 | r6399 | |
| 5 | 5 | |
| 6 | 6 | Routines to emulate the: |
| 7 | 7 | Texas Instruments SN76489, SN76489A, SN76494/SN76496 |
| 8 | | ( Also known as, or at least compatible with, the TMS9919.) |
| 8 | ( Also known as, or at least compatible with, the TMS9919 and SN94624.) |
| 9 | 9 | and the Sega 'PSG' used on the Master System, Game Gear, and Megadrive/Genesis |
| 10 | 10 | This chip is known as the Programmable Sound Generator, or PSG, and is a 4 |
| 11 | 11 | channel sound generator, with three squarewave channels and a noise/arbitrary |
| r6398 | r6399 | |
| 48 | 48 | 14/11/2009 : Lord Nightmare |
| 49 | 49 | Removed STEP mess, vastly simplifying the code. Made output bipolar rather |
| 50 | 50 | than always above the 0 line, but disabled that code due to pending issues. |
| 51 | |
| 52 | 16/11/2009 : Lord Nightmare |
| 53 | Fix screeching in regulus: When summing together four equal channels, the |
| 54 | size of the max amplitude per channel should be 1/4 of the max range, not |
| 55 | 1/3. |
| 51 | 56 | |
| 52 | 57 | TODO: * Implement a function for setting stereo regs for the game gear. |
| 53 | 58 | Requires making the core support both mono and stereo, and have |
| r6398 | r6399 | |
| 270 | 275 | gain &= 0xff; |
| 271 | 276 | |
| 272 | 277 | /* increase max output basing on gain (0.2 dB per step) */ |
| 273 | | out = MAX_OUTPUT / 3; |
| 278 | out = MAX_OUTPUT / 4; // four channels, each gets 1/4 of the total range |
| 274 | 279 | while (gain-- > 0) |
| 275 | 280 | out *= 1.023292992; /* = (10 ^ (0.2/20)) */ |
| 276 | 281 | |