public nes_mmc5() { cpu = null; SetClock(DEFAULT_CLOCK); SetRate(DEFAULT_RATE); option[(int)OPT.NONLINEAR_MIXER] = 1; //true; option[(int)OPT.PHASE_REFRESH] = 1; //true; frame_sequence_count = 0; // square nonlinear mix, same as 2A03 square_table[0] = 0; for (int i = 1; i < 32; i++) { square_table[i] = (Int32)((8192.0 * 95.88) / (8128.0 / i + 100)); } // 2A03 style nonlinear pcm mix with double the bits //pcm_table[0] = 0; //INT32 wd = 22638; //for(int d=1;d<256; ++d) // pcm_table[d] = (INT32)((8192.0*159.79)/(100.0+1.0/((double)d/wd))); // linear pcm mix (actual hardware seems closer to this) pcm_table[0] = 0; double pcm_scale = 32.0; for (int d = 1; d < 256; ++d) { pcm_table[d] = (Int32)((double)(d) * pcm_scale); } // stereo mix for (int c = 0; c < 2; ++c) { for (int t = 0; t < 3; ++t) { sm[c][t] = 128; } } }
// pcm read mode requires CPU read access public void SetCPU(km6502 cpu_) { cpu = cpu_; }