summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Michaël Banaan Ananas <happppp@users.noreply.github.com>2012-04-17 15:58:57 +0000
committer Michaël Banaan Ananas <happppp@users.noreply.github.com>2012-04-17 15:58:57 +0000
commitdc38487ba1a5294640cf9f8523a0f8f876351d67 (patch)
treec0bfeba4cb149c36cd9700c3528c0ee99db86cd3
parent257bd20979fe1bad0c30d2ef4b5b9c21f9d1bc5a (diff)
exponential volume table sounds much better (music doesn't drown sfx anymore)
-rw-r--r--src/emu/sound/i5000.c17
-rw-r--r--src/emu/sound/i5000.h2
2 files changed, 16 insertions, 3 deletions
diff --git a/src/emu/sound/i5000.c b/src/emu/sound/i5000.c
index b8cd9aca730..9ac9d3ea8df 100644
--- a/src/emu/sound/i5000.c
+++ b/src/emu/sound/i5000.c
@@ -7,8 +7,10 @@
16-channel ADPCM player.
TODO:
- - improve volume balance (is it really linear?)
- verify that ADPCM is the same as standard OKI ADPCM
+ - verify volume balance
+ - sample command 0x0007
+ - any more sound formats than 3-bit and 4-bit ADPCM?
***************************************************************************/
@@ -28,6 +30,15 @@ i5000snd_device::i5000snd_device(const machine_config &mconfig, const char *tag,
void i5000snd_device::device_start()
{
+ // fill volume table
+ double div = 1.025;
+ double vol = 255.0;
+ for (int i = 0; i < 0x100; i++)
+ {
+ m_lut_volume[i] = vol + 0.5;
+ vol /= div;
+ }
+
// create the stream
m_stream = machine().sound().stream_alloc(*this, 0, 2, clock() / 0x400, this);
@@ -142,8 +153,8 @@ void i5000snd_device::write_reg16(UINT8 reg, UINT16 data)
// 3: left/right volume
case 3:
- m_channels[ch].vol_r = ~data & 0xff;
- m_channels[ch].vol_l = ~data >> 8 & 0xff;
+ m_channels[ch].vol_r = m_lut_volume[data & 0xff];
+ m_channels[ch].vol_l = m_lut_volume[data >> 8 & 0xff];
break;
default:
diff --git a/src/emu/sound/i5000.h b/src/emu/sound/i5000.h
index 6c9595f8162..a1db6b673b2 100644
--- a/src/emu/sound/i5000.h
+++ b/src/emu/sound/i5000.h
@@ -74,6 +74,8 @@ private:
UINT16 *m_rom_base;
UINT32 m_rom_mask;
+ int m_lut_volume[0x100];
+
bool read_sample(int ch);
void write_reg16(UINT8 reg, UINT16 data);
};