mirror of
https://github.com/libretro/FBNeo.git
synced 2024-11-27 11:00:27 +00:00
narc sound, tweaks for barbudreadmon
This commit is contained in:
parent
e77f3b1339
commit
40d3c283f8
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user