Added option AY8910_RESISTOR_OUTPUT to AY8910. This will output internal resistor values instead of computed voltages. To be used with netlist output stages.

This commit is contained in:
Couriersud 2014-02-04 23:34:57 +00:00
parent 5d7b9522d1
commit 35c7cf0381
2 changed files with 37 additions and 11 deletions

View File

@ -423,6 +423,23 @@ INLINE void build_single_table(double rl, const ay_ym_param *par, int normalize,
}
INLINE void build_resisor_table(const ay_ym_param *par, INT32 *tab, int zero_is_off)
{
int j;
for (j=0; j < par->res_count; j++)
{
if (zero_is_off && j == 0)
{
tab[j] = 1e6;
}
else
tab[j] = par->res[j];
}
}
INLINE UINT16 mix_3D(ay8910_context *psg)
{
int indx = 0, chan;
@ -690,11 +707,22 @@ static void build_mixer_table(ay8910_context *psg)
normalize = 1;
}
for (chan=0; chan < NUM_CHANNELS; chan++)
{
build_single_table(psg->intf->res_load[chan], psg->par, normalize, psg->vol_table[chan], psg->zero_is_off);
build_single_table(psg->intf->res_load[chan], psg->par_env, normalize, psg->env_table[chan], 0);
}
if ((psg->intf->flags & AY8910_RESISTOR_OUTPUT) != 0)
{
for (chan=0; chan < NUM_CHANNELS; chan++)
{
build_resisor_table(psg->par, psg->vol_table[chan], psg->zero_is_off);
build_resisor_table(psg->par_env, psg->env_table[chan], 0);
}
}
else
{
for (chan=0; chan < NUM_CHANNELS; chan++)
{
build_single_table(psg->intf->res_load[chan], psg->par, normalize, psg->vol_table[chan], psg->zero_is_off);
build_single_table(psg->intf->res_load[chan], psg->par_env, normalize, psg->env_table[chan], 0);
}
}
/*
* The previous implementation added all three channels up instead of averaging them.
* The factor of 3 will force the same levels if normalizing is used.

View File

@ -56,13 +56,11 @@ YMZ294: 0 I/O port
/*
* The following define causes the driver to output
* raw volume levels, i.e. 0 .. 15 and 0..31.
* This is intended to be used in a subsequent
* mixing modul (i.e. mpatrol ties 6 channels from
* AY-3-8910 together). Do not use it now.
* resistor values. Intended to be used for
* netlist interfacing.
*/
/* TODO: implement mixing module */
#define AY8910_RAW_OUTPUT (0x08)
#define AY8910_RESISTOR_OUTPUT (0x08)
/*
* This define specifies the initial state of YM2149