Added support to itemga20.cpp for volume and left/right selection for each route. Updated necessary drivers to support.

This commit is contained in:
Barry Harris 2012-05-23 08:49:07 +00:00
parent 8255b1c542
commit 4a88f48677
3 changed files with 35 additions and 2 deletions

View File

@ -1752,6 +1752,7 @@ static INT32 DrvInit(INT32 (*pRomLoadCallback)(), const UINT8 *sound_decrypt_tab
BurnYM2151SetAllRoutes(0.40, BURN_SND_ROUTE_BOTH);
iremga20_init(0, DrvSndROM, 0x100000, 3579545);
itemga20_set_route(0, 1.00, BURN_SND_ROUTE_BOTH);
MSM6295Init(0, 1000000 / 132, 0); // ppan
MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH);

View File

@ -54,6 +54,8 @@ struct _ga20_state
UINT16 regs[0x40];
struct IremGA20_channel_def channel[4];
INT32 frequency;
double gain;
INT32 output_dir;
};
static struct _ga20_state chips[MAX_GA20];
@ -130,8 +132,21 @@ void iremga20_update(INT32 device, INT16 *buffer, INT32 length)
}
sampleout >>= 2;
buffer[0] += sampleout;
buffer[1] += sampleout;
INT32 nLeftSample = 0, nRightSample = 0;
if ((chip->output_dir & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) {
nLeftSample += (INT32)(sampleout * chip->gain);
}
if ((chip->output_dir & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) {
nRightSample += (INT32)(sampleout * chip->gain);
}
nLeftSample = BURN_SND_CLIP(nLeftSample);
nRightSample = BURN_SND_CLIP(nRightSample);
buffer[0] += nLeftSample;
buffer[1] += nRightSample;
}
/* update the regs now */
@ -247,6 +262,9 @@ void iremga20_init(INT32 device, UINT8 *rom, INT32 rom_size, INT32 frequency)
chip->rom = rom;
chip->rom_size = rom_size;
chip->frequency = (frequency / 4) / 60;
chip->gain = 1.00;
chip->output_dir = BURN_SND_ROUTE_BOTH;
iremga20_reset(device);
@ -255,6 +273,19 @@ void iremga20_init(INT32 device, UINT8 *rom, INT32 rom_size, INT32 frequency)
nNumChips = device;
}
void itemga20_set_route(INT32 device, double nVolume, INT32 nRouteDir)
{
#if defined FBA_DEBUG
if (!DebugSnd_IremGA20Initted) bprintf(PRINT_ERROR, _T("itemga20_set_route called without init\n"));
if (device > nNumChips) bprintf(PRINT_ERROR, _T("itemga20_set_route called with invalid chip %x\n"), device);
#endif
chip = &chips[device];
chip->gain = nVolume;
chip->output_dir = nRouteDir;
}
void iremga20_exit()
{
#if defined FBA_DEBUG

View File

@ -3,6 +3,7 @@ UINT8 iremga20_read(INT32 device, INT32 offset);
void iremga20_reset(INT32 device);
void iremga20_init(INT32 device, UINT8 *rom, INT32 rom_size, INT32 frequency);
void itemga20_set_route(INT32 device, double nVolume, INT32 nRouteDir);
void iremga20_update(INT32 device, INT16 *buffer, INT32 length);
void iremga20_exit();