summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Angelo Salese <angelosa@users.noreply.github.com>2011-11-06 21:17:40 +0000
committer Angelo Salese <angelosa@users.noreply.github.com>2011-11-06 21:17:40 +0000
commitd5290fc21b80d5c41709e85a4b9f54052c232f06 (patch)
tree6be2d7735327aea646d4530f54470208d2554a13
parentc22e712313839fab2b3c71b3ce114bef995df930 (diff)
Added per-channel volume control to ES5505/ES5506 sound chip, and hooked it up to the Taito F3 driver [Angelo Salese]
-rw-r--r--src/emu/sound/es5506.c5
-rw-r--r--src/emu/sound/es5506.h1
-rw-r--r--src/mame/audio/taito_en.c31
3 files changed, 27 insertions, 10 deletions
diff --git a/src/emu/sound/es5506.c b/src/emu/sound/es5506.c
index a4cf6d7d50b..6ce1f3378b8 100644
--- a/src/emu/sound/es5506.c
+++ b/src/emu/sound/es5506.c
@@ -2150,7 +2150,12 @@ void es5505_voice_bank_w(device_t *device, int voice, int bank)
chip->voice[voice].exbank=bank;
}
+void es5505_set_channel_volume(device_t *device, int channel, int volume)
+{
+ es5506_state *chip = get_safe_token(device);
+ chip->stream->set_output_gain(channel,volume / 100.0);
+}
/**************************************************************************
diff --git a/src/emu/sound/es5506.h b/src/emu/sound/es5506.h
index 502ed1e8a7a..03e268431ea 100644
--- a/src/emu/sound/es5506.h
+++ b/src/emu/sound/es5506.h
@@ -24,6 +24,7 @@ struct _es5505_interface
READ16_DEVICE_HANDLER( es5505_r );
WRITE16_DEVICE_HANDLER( es5505_w );
void es5505_voice_bank_w(device_t *device, int voice, int bank);
+void es5505_set_channel_volume(device_t *device, int channel, int volume);
DECLARE_LEGACY_SOUND_DEVICE(ES5505, es5505);
diff --git a/src/mame/audio/taito_en.c b/src/mame/audio/taito_en.c
index f940d03d54c..1a4163e9d0c 100644
--- a/src/mame/audio/taito_en.c
+++ b/src/mame/audio/taito_en.c
@@ -59,22 +59,33 @@ static WRITE16_HANDLER( f3_es5505_bank_w )
es5505_voice_bank_w(space->machine().device("ensoniq"),offset,data<<20);
}
-static WRITE16_HANDLER( f3_volume_w )
+static WRITE8_HANDLER( f3_volume_w )
{
-// static UINT16 channel[8],last_l,last_r;
-// static int latch;
+ static UINT8 latch,ch[8];
-// if (offset==0) latch=(data>>8)&0x7;
-// if (offset==1) channel[latch]=data>>8;
+ if(offset == 0)
+ latch = data & 0x7;
+ else
+ {
+ ch[latch] = data;
+ if((latch & 6) == 6)
+ {
+ double ch_vol;
+
+ ch_vol = (double)(ch[latch] & 0x3f);
+ ch_vol/= 63.0;
+ ch_vol*= 100.0;
+ /* Left/Right panning trusted with Arabian Magic Sound Test menu. */
+ es5505_set_channel_volume(space->machine().device("ensoniq"),(latch & 1) ^ 1,ch_vol);
+ }
+ }
-// if (channel[7]!=last_l) mixer_set_volume(0, (int)((float)channel[7]*1.58)); /* Left master volume */
-// if (channel[6]!=last_r) mixer_set_volume(1, (int)((float)channel[6]*1.58)); /* Right master volume */
-// last_l=channel[7];
-// last_r=channel[6];
+ //popmessage("%02x %02x %02x %02x %02x %02x %02x %02x",ch[0],ch[1],ch[2],ch[3],ch[4],ch[5],ch[6],ch[7]);
/* Channel 5 - Left Aux? Always set to volume, but never used for panning */
/* Channel 4 - Right Aux? Always set to volume, but never used for panning */
/* Channels 0, 1, 2, 3 - Unused */
+
}
static TIMER_DEVICE_CALLBACK( taito_en_timer_callback )
@@ -245,7 +256,7 @@ static ADDRESS_MAP_START( f3_sound_map, AS_PROGRAM, 16 )
AM_RANGE(0x260000, 0x2601ff) AM_READWRITE(es5510_dsp_r, es5510_dsp_w)
AM_RANGE(0x280000, 0x28001f) AM_READWRITE(f3_68681_r, f3_68681_w)
AM_RANGE(0x300000, 0x30003f) AM_WRITE(f3_es5505_bank_w)
- AM_RANGE(0x340000, 0x340003) AM_WRITE(f3_volume_w) /* 8 channel volume control */
+ AM_RANGE(0x340000, 0x340003) AM_WRITE8(f3_volume_w,0xff00) /* 8 channel volume control */
AM_RANGE(0xc00000, 0xc1ffff) AM_ROMBANK("bank1")
AM_RANGE(0xc20000, 0xc3ffff) AM_ROMBANK("bank2")
AM_RANGE(0xc40000, 0xc7ffff) AM_ROMBANK("bank3")