Added per-channel volume control to ES5505/ES5506 sound chip, and hooked it up to the Taito F3 driver [Angelo Salese]

This commit is contained in:
Angelo Salese 2011-11-06 21:17:40 +00:00
parent c22e712313
commit d5290fc21b
3 changed files with 27 additions and 10 deletions

View File

@ -2150,7 +2150,12 @@ void es5505_voice_bank_w(device_t *device, int voice, int bank)
chip->voice[voice].exbank=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);
}
/************************************************************************** /**************************************************************************

View File

@ -24,6 +24,7 @@ struct _es5505_interface
READ16_DEVICE_HANDLER( es5505_r ); READ16_DEVICE_HANDLER( es5505_r );
WRITE16_DEVICE_HANDLER( es5505_w ); WRITE16_DEVICE_HANDLER( es5505_w );
void es5505_voice_bank_w(device_t *device, int voice, int bank); 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); DECLARE_LEGACY_SOUND_DEVICE(ES5505, es5505);

View File

@ -59,22 +59,33 @@ static WRITE16_HANDLER( f3_es5505_bank_w )
es5505_voice_bank_w(space->machine().device("ensoniq"),offset,data<<20); 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 UINT8 latch,ch[8];
// static int latch;
// if (offset==0) latch=(data>>8)&0x7; if(offset == 0)
// if (offset==1) channel[latch]=data>>8; latch = data & 0x7;
else
{
ch[latch] = data;
if((latch & 6) == 6)
{
double ch_vol;
// if (channel[7]!=last_l) mixer_set_volume(0, (int)((float)channel[7]*1.58)); /* Left master volume */ ch_vol = (double)(ch[latch] & 0x3f);
// if (channel[6]!=last_r) mixer_set_volume(1, (int)((float)channel[6]*1.58)); /* Right master volume */ ch_vol/= 63.0;
// last_l=channel[7]; ch_vol*= 100.0;
// last_r=channel[6]; /* Left/Right panning trusted with Arabian Magic Sound Test menu. */
es5505_set_channel_volume(space->machine().device("ensoniq"),(latch & 1) ^ 1,ch_vol);
}
}
//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 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 */ /* Channel 4 - Right Aux? Always set to volume, but never used for panning */
/* Channels 0, 1, 2, 3 - Unused */ /* Channels 0, 1, 2, 3 - Unused */
} }
static TIMER_DEVICE_CALLBACK( taito_en_timer_callback ) 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(0x260000, 0x2601ff) AM_READWRITE(es5510_dsp_r, es5510_dsp_w)
AM_RANGE(0x280000, 0x28001f) AM_READWRITE(f3_68681_r, f3_68681_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(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(0xc00000, 0xc1ffff) AM_ROMBANK("bank1")
AM_RANGE(0xc20000, 0xc3ffff) AM_ROMBANK("bank2") AM_RANGE(0xc20000, 0xc3ffff) AM_ROMBANK("bank2")
AM_RANGE(0xc40000, 0xc7ffff) AM_ROMBANK("bank3") AM_RANGE(0xc40000, 0xc7ffff) AM_ROMBANK("bank3")