Added support to Renegade custom sample for volume and left/right selection for each route.
This commit is contained in:
parent
92c2320e5d
commit
e3c877e0d3
|
@ -552,6 +552,8 @@ static struct renegade_adpcm_state
|
||||||
UINT8 nibble;
|
UINT8 nibble;
|
||||||
UINT8 playing;
|
UINT8 playing;
|
||||||
UINT8 *base;
|
UINT8 *base;
|
||||||
|
double gain;
|
||||||
|
INT32 output_dir;
|
||||||
} renegade_adpcm;
|
} renegade_adpcm;
|
||||||
|
|
||||||
static INT32 diff_lookup[49*16];
|
static INT32 diff_lookup[49*16];
|
||||||
|
@ -602,11 +604,19 @@ static void RenegadeADPCMInit(INT32 clock)
|
||||||
struct renegade_adpcm_state *state = &renegade_adpcm;
|
struct renegade_adpcm_state *state = &renegade_adpcm;
|
||||||
state->playing = 0;
|
state->playing = 0;
|
||||||
state->base = DrvADPCMRom;
|
state->base = DrvADPCMRom;
|
||||||
|
state->gain = 1.00;
|
||||||
|
state->output_dir = BURN_SND_ROUTE_BOTH;
|
||||||
reset_adpcm(&state->adpcm);
|
reset_adpcm(&state->adpcm);
|
||||||
|
|
||||||
nUpdateStep = (INT32)(((float)clock / nBurnSoundRate) * 32768);
|
nUpdateStep = (INT32)(((float)clock / nBurnSoundRate) * 32768);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RenegadeADMPCMSetRoute(double nVolume, INT32 nRouteDir)
|
||||||
|
{
|
||||||
|
renegade_adpcm.gain = nVolume;
|
||||||
|
renegade_adpcm.output_dir = nRouteDir;
|
||||||
|
}
|
||||||
|
|
||||||
static INT32 DrvDoReset()
|
static INT32 DrvDoReset()
|
||||||
{
|
{
|
||||||
M6502Open(0);
|
M6502Open(0);
|
||||||
|
@ -1297,11 +1307,22 @@ static void RenderADPCMSample(INT16 *pSoundBuf, INT32 nLength)
|
||||||
}
|
}
|
||||||
|
|
||||||
INT16 Sample = clock_adpcm(&renegade_adpcm.adpcm, val) << 2;
|
INT16 Sample = clock_adpcm(&renegade_adpcm.adpcm, val) << 2;
|
||||||
INT32 Left = pSoundBuf[0] + Sample;
|
|
||||||
INT32 Right = pSoundBuf[1] + Sample;
|
INT32 nLeftSample = 0, nRightSample = 0;
|
||||||
|
|
||||||
pSoundBuf[0] = BURN_SND_CLIP(Left);
|
if ((renegade_adpcm.output_dir & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) {
|
||||||
pSoundBuf[1] = BURN_SND_CLIP(Right);
|
nLeftSample += (INT32)(Sample * renegade_adpcm.gain);
|
||||||
|
}
|
||||||
|
if ((renegade_adpcm.output_dir & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) {
|
||||||
|
nRightSample += (INT32)(Sample * renegade_adpcm.gain);
|
||||||
|
}
|
||||||
|
|
||||||
|
nLeftSample = BURN_SND_CLIP(nLeftSample + pSoundBuf[0]);
|
||||||
|
nRightSample = BURN_SND_CLIP(nRightSample + pSoundBuf[1]);
|
||||||
|
|
||||||
|
pSoundBuf[0] = nLeftSample;
|
||||||
|
pSoundBuf[1] = nRightSample;
|
||||||
|
|
||||||
pSoundBuf += 2;
|
pSoundBuf += 2;
|
||||||
nLength--;
|
nLength--;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue