Fix some issues introduced with last commit.

The sound system does not allow to stream values > 2^20. Currently limiting the value, but this is not really optimal.
This commit is contained in:
Couriersud 2014-07-09 21:21:38 +00:00
parent 1c4ae49942
commit 821233a8b8
2 changed files with 16 additions and 6 deletions

View File

@ -545,11 +545,19 @@ INLINE void build_mosfet_resistor_table(const ay8910_device::mosfet_param &par,
const double Vd = 5.0;
const double Vg = par.m_Vg - par.m_Vth;
const double kn = par.m_Kn[j] / 1.0e6;
const double p2 = 1.0 / (2.0 * kn * rd);
const double Vs = Vg + p2 - sqrt(p2 * p2 - Vg * Vg);
const double p2 = 1.0 / (2.0 * kn * rd) + Vg;
const double Vs = p2 - sqrt(p2 * p2 - Vg * Vg);
const double res = rd * ( Vd / Vs - 1.0);
tab[j] = res;
/* FXIME: That's the biggest value we can stream on to netlist. Have to find a different
* approach.
*/
if (res > (1 << 21))
tab[j] = (1 << 21);
else
tab[j] = res;
//printf("%d %f %10d\n", j, rd / (res + rd) * 5.0, tab[j]);
}
}
@ -834,7 +842,7 @@ void ay8910_device::build_mixer_table()
for (chan=0; chan < AY8910_NUM_CHANNELS; chan++)
{
build_mosfet_resistor_table(ay8910_mosfet_param, m_res_load[chan], m_vol_table[chan]);
build_mosfet_resistor_table(ay8910_mosfet_param, m_res_load[chan], m_vol_table[chan]);
build_mosfet_resistor_table(ay8910_mosfet_param, m_res_load[chan], m_env_table[chan]);
}
}
else

View File

@ -84,7 +84,9 @@ static NETLIST_START(nl_1942)
SOLVER(Solver, 48000)
ANALOG_INPUT(V5, 5)
PARAM(Solver.ACCURACY, 1e-10)
PARAM(Solver.ACCURACY, 1e-7)
//PARAM(Solver.DYNAMIC_TS, 1)
//PARAM(Solver.LTE, 5e-8)
/* AY 8910 internal resistors */
@ -580,7 +582,7 @@ static MACHINE_CONFIG_START( 1942, _1942_state )
MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "R1.1")
//MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "VR.2")
MCFG_NETLIST_ANALOG_MULT_OFFSET(100000.0, 0.0)
MCFG_NETLIST_ANALOG_MULT_OFFSET(70000.0, 0.0)
MACHINE_CONFIG_END