Code: Select all
const unsigned int YM2612::phaseModIncrementTable[1 << pmsBitCount][1 << (phaseModIndexBitCount - 2)] = {
{0, 0, 0, 0, 0, 0, 0, 0}, //0
{0, 0, 0, 0, 1, 1, 1, 1}, //1
{0, 0, 0, 1, 1, 1, 2, 2}, //2
{0, 0, 1, 1, 2, 2, 3, 3}, //3
{0, 0, 1, 2, 2, 2, 3, 4}, //4
{0, 0, 2, 3, 4, 4, 5, 6}, //5
{0, 0, 4, 6, 8, 8,10,12}, //6
{0, 0, 8,12,16,16,20,24}}; //7
Looking back on my notes, I've realised there's some testing I still haven't completed for frequency modulation. I've talked about the upper six bits being relevant for frequency modulation, and the lower bits not having an effect. That's not entirely true however. According to my notes, I measured sign-extension taking effect in the negative portion of the frequency modulation wave, even when the only fnum bits set were below the upper six bits, all the way down to fnum bit 0, which suggests that the frequency modulation value may be calculated at full precision, then the lower bits discarded when it is combined with fnum, eg:
Code: Select all
// ---------------------------------------------
// | Fnum (11-bit) |
// |-------------------------------------------|
// |10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
// ---------------------------------------------
// ---------------------------------------------------------------------------------
// | Frequency Modulation Value (20-bit) |
// |-------------------------------------------------------------------------------|
// |19 |18 |17 |16 |15 |14 |13 |12 |11 |10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
// ---------------------------------------------------------------------------------
//10 | 4 | 3 | 2 | 1 | 0 |
// 9 | 4 | 3 | 2 | 1 | 0 |
// 8 | 4 | 3 | 2 | 1 | 0 |
// 7 | 4 | 3 | 2 | 1 | 0 |
// 6 | 4 | 3 | 2 | 1 | 0 |
// 5 | 4 | 3 | 2 | 1 | 0 |
// 4 | 4 | 3 | 2 | 1 | 0 |
// 3 | 4 | 3 | 2 | 1 | 0 |
// 2 | 4 | 3 | 2 | 1 | 0 |
// 1 | 4 | 3 | 2 | 1 | 0 |
// 0 | 4 | 3 | 2 | 1 | 0 |