diff --git a/src/burn/drv/midway/narc_sound.cpp b/src/burn/drv/midway/narc_sound.cpp index c8ce86799..efcdb6162 100644 --- a/src/burn/drv/midway/narc_sound.cpp +++ b/src/burn/drv/midway/narc_sound.cpp @@ -17,6 +17,9 @@ static INT32 sound_int_state; static INT32 sound_in_reset; static UINT8 audio_sync; +static INT32 if_clk; +static INT32 if_seq; + static void bankswitch(INT32 cpu, INT32 data) { INT32 bank = 0x10000 + 0x8000 * (data & 1) + 0x10000 * ((data >> 3) & 1) + 0x20000 * ((data >> 1) & 3); @@ -134,17 +137,14 @@ static INT32 hc_idlefilter_check(UINT8 in) { const UINT8 crap[8] = { 0x01, 0x00, 0x55, 0x2a, 0x15, 0x0a, 0x05, 0x02 }; - static INT32 clk = 0; - static INT32 seq = 0; - - if (in == crap[clk]) { - clk = (clk + 1) & 7; - seq++; + if (in == crap[if_clk]) { + if_clk = (if_clk + 1) & 7; + if_seq++; } else { - seq = 0; + if_seq = 0; } - return (seq > 2); + return (if_seq > 2); } static void narc_sound1_write(UINT16 address, UINT8 data) @@ -213,6 +213,9 @@ void narc_sound_reset() sound_int_state = 0; sound_in_reset = 0; + + if_clk = 0; + if_seq = 0; } void narc_sound_init(UINT8 *rom0, UINT8 *rom1) @@ -246,6 +249,7 @@ void narc_sound_init(UINT8 *rom0, UINT8 *rom1) BurnTimerAttachM6809(2000000); hc55516_init(M6809TotalCycles, 2000000); + hc55516_volume(0.60); DACInit(0, 0, 1, M6809TotalCycles, 2000000); DACInit(1, 0, 1, M6809TotalCycles, 2000000); @@ -305,6 +309,9 @@ INT32 narc_sound_scan(INT32 nAction, INT32 *pnMin) SCAN_VAR(bankdata); SCAN_VAR(sound_int_state); SCAN_VAR(sound_in_reset); + + SCAN_VAR(if_clk); + SCAN_VAR(if_seq); } if (nAction & ACB_WRITE) diff --git a/src/burn/snd/hc55516.cpp b/src/burn/snd/hc55516.cpp index d8800de4f..cc3fec0bd 100644 --- a/src/burn/snd/hc55516.cpp +++ b/src/burn/snd/hc55516.cpp @@ -44,6 +44,8 @@ static double m_leak; static INT32 m_clock = 0; // always 0 for sw-driven clock +static double volume = 1.0; + static INT16 *m_mixer_buffer; // re-sampler static INT32 (*pCPUTotalCycles)() = NULL; @@ -135,6 +137,11 @@ void hc55516_reset() samples_from = (SAMPLE_RATE * 100 + (nBurnFPS >> 1)) / nBurnFPS; } +void hc55516_volume(double vol) +{ + volume = vol; +} + void hc55516_scan(INT32 nAction, INT32 *) { SCAN_VAR(m_last_clock_state); @@ -166,6 +173,8 @@ static void start_common(UINT8 _shiftreg_mask, INT32 _active_clock_hi) m_active_clock_hi = _active_clock_hi; m_mixer_buffer = (INT16*)BurnMalloc(2 * sizeof(INT16) * SAMPLE_RATE); + + volume = 1.0; } static inline INT32 is_external_oscillator() @@ -359,10 +368,11 @@ void hc55516_update(INT16 *inputs, INT32 sample_len) { INT32 k = (samples_from * j) / nBurnSoundLen; - INT32 rlmono = m_mixer_buffer[k]; + INT32 rlmono = m_mixer_buffer[k] * volume; + rlmono = BURN_SND_CLIP(rlmono); - inputs[0] = BURN_SND_CLIP(inputs[0] + BURN_SND_CLIP(rlmono)); - inputs[1] = BURN_SND_CLIP(inputs[1] + BURN_SND_CLIP(rlmono)); + inputs[0] = BURN_SND_CLIP(inputs[0] + rlmono); + inputs[1] = BURN_SND_CLIP(inputs[1] + rlmono); inputs += 2; } diff --git a/src/burn/snd/hc55516.h b/src/burn/snd/hc55516.h index 497a97521..2492d10b2 100644 --- a/src/burn/snd/hc55516.h +++ b/src/burn/snd/hc55516.h @@ -13,6 +13,8 @@ void hc55516_exit(); void hc55516_reset(); void hc55516_scan(INT32 nAction, INT32 *); +void hc55516_volume(double vol); + void hc55516_clock_w(INT32 state); void hc55516_digit_w(INT32 digit); INT32 hc55516_clock_state_r();