__inline static void UPDATE(N106_WM *chp) { if (chp->update & 3) { Uint32 freq; freq = ((int)chp->freql); freq += ((int)chp->freqm) << 8; freq += ((int)chp->freqh) << 16; chp->spd = freq & 0x3ffff; } if (chp->update & 2) { Uint32 tlen; tlen = (0x100 - (chp->freqh & 0xfc)) << PHASE_SHIFT; if (chp->tlen != tlen) { chp->tlen = tlen; chp->phase = 0; } } if (chp->update & 4) { chp->logvol = LinearToLog((chp->vreg & 0x0f) << 2); } chp->update = 0; }
static void N106SoundWriteData(uint32 address, uint8 value) { n106_sound.data[n106_sound.address] = value; n106_sound.tone[n106_sound.address * 2] = LinearToLog(((int)(value & 0xf) << 2) - 0x20); n106_sound.tone[n106_sound.address * 2 + 1] = LinearToLog(((int)(value >> 4) << 2) - 0x20); if (n106_sound.address >= 0x40) { N106_WM *chp = &n106_sound.ch[(n106_sound.address - 0x40) >> 3]; switch (n106_sound.address & 7) { case 0: chp->update |= 1; chp->freql = value; break; case 2: chp->update |= 1; chp->freqm = value; break; case 4: chp->update |= 2; chp->freqh = value; break; case 6: chp->tadr = value & 0xff; break; case 7: chp->update |= 4; chp->vreg = value; chp->nazo = (value >> 4) & 0x07; if (chp == &n106_sound.ch[7]) n106_sound.chinuse = 1 + chp->nazo; break; } }