mirror of
https://github.com/holub/mame
synced 2025-07-04 09:28:51 +03:00
fmtowns: fix cdda gain (nw)
This commit is contained in:
parent
1a5ac25f61
commit
9d20182474
@ -2061,12 +2061,13 @@ READ8_MEMBER(towns_state::towns_volume_r)
|
|||||||
|
|
||||||
void towns_state::cdda_db_to_gain(float db)
|
void towns_state::cdda_db_to_gain(float db)
|
||||||
{
|
{
|
||||||
float gain = powf(10, db / 20);
|
float gain = powf(10, db / 20.0f);
|
||||||
int port = m_towns_volume_select & 3;
|
int port = m_towns_volume_select & 3;
|
||||||
if(port > 1)
|
if(port > 1)
|
||||||
return;
|
return;
|
||||||
if(db == -1)
|
if(db > 0)
|
||||||
gain = 0;
|
gain = 0;
|
||||||
|
logerror("port %d gain %f db %f\n", port, gain, db);
|
||||||
m_cdda->set_output_gain(port, gain);
|
m_cdda->set_output_gain(port, gain);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2075,15 +2076,15 @@ WRITE8_MEMBER(towns_state::towns_volume_w)
|
|||||||
switch(offset)
|
switch(offset)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
|
m_towns_volume[m_towns_volume_select & 3] = data;
|
||||||
if(!(m_towns_volume_select & 4) || (m_towns_volume_select & 0x18))
|
if(!(m_towns_volume_select & 4) || (m_towns_volume_select & 0x18))
|
||||||
return;
|
return;
|
||||||
m_towns_volume[m_towns_volume_select & 3] = data;
|
cdda_db_to_gain((~data & 0x3f) * -0.5f);
|
||||||
cdda_db_to_gain(~(data & 0x3f) * -0.5f);
|
|
||||||
break;
|
break;
|
||||||
case 3: // select channel
|
case 3: // select channel
|
||||||
m_towns_volume_select = data;
|
m_towns_volume_select = data;
|
||||||
if(!(data & 4))
|
if(!(data & 4))
|
||||||
cdda_db_to_gain(-1);
|
cdda_db_to_gain(1);
|
||||||
else if(data & 8)
|
else if(data & 8)
|
||||||
cdda_db_to_gain(0);
|
cdda_db_to_gain(0);
|
||||||
else if(data & 0x10)
|
else if(data & 0x10)
|
||||||
|
Loading…
Reference in New Issue
Block a user