Added support to x1010.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 12:19:48 +00:00
parent 142cb722e6
commit 9151c056c5
4 changed files with 100 additions and 6 deletions

View File

@ -6740,6 +6740,8 @@ static INT32 DrvInit(void (*p68kInit)(), INT32 cpu_speed, INT32 irq_type, INT32
buffer_sprites = spr_buffer;
x1010_sound_init(16000000, 0x0000);
x1010_set_route(BURN_SND_X1010_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
x1010_set_route(BURN_SND_X1010_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
BurnYM3812Init(4000000, NULL, DrvYM3812SynchroniseStream, 0);
BurnTimerAttachSekYM3812(16000000);
@ -9305,7 +9307,11 @@ static INT32 downtownInit()
DrvSetVideoOffsets(0, 0, -1, 0);
DrvSetColorOffsets(0, 0, 0);
return DrvInit(downtown68kInit, 8000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1));
INT32 nRet = DrvInit(downtown68kInit, 8000000, SET_IRQLINES(1, 2), NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1));
x1010_set_all_routes(0.50, BURN_SND_ROUTE_LEFT);
return nRet;
}
struct BurnDriver BurnDrvDowntown = {
@ -9772,7 +9778,11 @@ static INT32 calibr50Init()
DrvSetColorOffsets(0, 0, 0);
DrvSetVideoOffsets(-1, 2, -3, -2);
return DrvInit(calibr5068kInit, 8000000, SET_IRQLINES(0x80, 0x80) /*custom*/, NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1));
INT32 nRet = DrvInit(calibr5068kInit, 8000000, SET_IRQLINES(0x80, 0x80) /*custom*/, NO_SPRITE_BUFFER, SET_GFX_DECODE(0, 1, -1));
x1010_set_all_routes(0.50, BURN_SND_ROUTE_LEFT);
return nRet;
}
struct BurnDriver BurnDrvCalibr50 = {

View File

@ -1642,6 +1642,8 @@ static INT32 grdiansInit()
gfx_code_mask = 0x0800000 * 4 / 64;
x1010_sound_init(50000000 / 3, 0x0000);
x1010_set_route(BURN_SND_X1010_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
x1010_set_route(BURN_SND_X1010_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
DrvDoReset();
@ -1803,6 +1805,8 @@ static INT32 mj4simaiInit()
gfx_code_mask = 0x0800000 * 4 / 64;
x1010_sound_init(50000000 / 3, 0x0000);
x1010_set_route(BURN_SND_X1010_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
x1010_set_route(BURN_SND_X1010_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
// bMahjong = 1;
@ -1953,6 +1957,8 @@ static INT32 myangelInit()
gfx_code_mask = 0x0400000 * 4 / 64;
x1010_sound_init(50000000 / 3, 0x0000);
x1010_set_route(BURN_SND_X1010_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
x1010_set_route(BURN_SND_X1010_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
DrvDoReset();
@ -2101,6 +2107,8 @@ static INT32 myangel2Init()
gfx_code_mask = 0x0600000 * 4 / 64;
x1010_sound_init(50000000 / 3, 0x0000);
x1010_set_route(BURN_SND_X1010_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
x1010_set_route(BURN_SND_X1010_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
DrvDoReset();
@ -2257,6 +2265,8 @@ static INT32 pzlbowlInit()
gfx_code_mask = 0x0400000 * 4 / 64;
x1010_sound_init(50000000 / 3, 0x0000);
x1010_set_route(BURN_SND_X1010_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
x1010_set_route(BURN_SND_X1010_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
DrvDoReset();
@ -2406,6 +2416,8 @@ static INT32 penbrosInit()
gfx_code_mask = 0x0400000 * 4 / 64;
x1010_sound_init(50000000 / 3, 0x0000);
x1010_set_route(BURN_SND_X1010_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
x1010_set_route(BURN_SND_X1010_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
DrvDoReset();
@ -2571,6 +2583,8 @@ static INT32 gundamexInit()
gfx_code_mask = 0x0800000 * 4 / 64;
x1010_sound_init(50000000 / 3, 0x0000);
x1010_set_route(BURN_SND_X1010_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
x1010_set_route(BURN_SND_X1010_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
EEPROMInit(&eeprom_interface_93C46);
@ -2703,6 +2717,8 @@ static INT32 samshootInit()
gfx_code_mask = 0x0800000 * 4 / 64;
x1010_sound_init(50000000 / 3, 0x0000);
x1010_set_route(BURN_SND_X1010_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
x1010_set_route(BURN_SND_X1010_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
BurnGunInit(2, true);

View File

@ -95,8 +95,29 @@ void x1010_sound_update()
break;
}
data = *(start + delta);
*bufL += (data * volL / 256); bufL += 2;
*bufR += (data * volR / 256); bufR += 2;
INT32 nLeftSample = 0, nRightSample = 0;
if ((x1_010_chip->output_dir[BURN_SND_X1010_ROUTE_1] & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) {
nLeftSample += (INT32)((data * volL / 256) * x1_010_chip->gain[BURN_SND_X1010_ROUTE_1]);
}
if ((x1_010_chip->output_dir[BURN_SND_X1010_ROUTE_1] & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) {
nRightSample += (INT32)((data * volL / 256) * x1_010_chip->gain[BURN_SND_X1010_ROUTE_1]);
}
if ((x1_010_chip->output_dir[BURN_SND_X1010_ROUTE_2] & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) {
nLeftSample += (INT32)((data * volR / 256) * x1_010_chip->gain[BURN_SND_X1010_ROUTE_2]);
}
if ((x1_010_chip->output_dir[BURN_SND_X1010_ROUTE_2] & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) {
nRightSample += (INT32)((data * volR / 256) * x1_010_chip->gain[BURN_SND_X1010_ROUTE_2]);
}
nLeftSample = BURN_SND_CLIP(nLeftSample);
nRightSample = BURN_SND_CLIP(nRightSample);
*bufL += nLeftSample; bufL += 2;;
*bufR += nRightSample; bufR += 2;
smp_offs += smp_step;
}
x1_010_chip->smp_offset[ch] = smp_offs;
@ -131,8 +152,29 @@ void x1010_sound_update()
volL = ((vol >> 4) & 0xf) * VOL_BASE;
volR = ((vol >> 0) & 0xf) * VOL_BASE;
data = *(start + ((smp_offs >> FREQ_BASE_BITS) & 0x7f));
*bufL += (data * volL / 256); bufL += 2;
*bufR += (data * volR / 256); bufR += 2;
INT32 nLeftSample = 0, nRightSample = 0;
if ((x1_010_chip->output_dir[BURN_SND_X1010_ROUTE_1] & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) {
nLeftSample += (INT32)((data * volL / 256) * x1_010_chip->gain[BURN_SND_X1010_ROUTE_1]);
}
if ((x1_010_chip->output_dir[BURN_SND_X1010_ROUTE_1] & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) {
nRightSample += (INT32)((data * volL / 256) * x1_010_chip->gain[BURN_SND_X1010_ROUTE_1]);
}
if ((x1_010_chip->output_dir[BURN_SND_X1010_ROUTE_2] & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) {
nLeftSample += (INT32)((data * volR / 256) * x1_010_chip->gain[BURN_SND_X1010_ROUTE_2]);
}
if ((x1_010_chip->output_dir[BURN_SND_X1010_ROUTE_2] & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) {
nRightSample += (INT32)((data * volR / 256) * x1_010_chip->gain[BURN_SND_X1010_ROUTE_2]);
}
nLeftSample = BURN_SND_CLIP(nLeftSample);
nRightSample = BURN_SND_CLIP(nRightSample);
*bufL += nLeftSample; bufL += 2;;
*bufR += nRightSample; bufR += 2;
smp_offs += smp_step;
env_offs += env_step;
}
@ -152,6 +194,22 @@ void x1010_sound_init(UINT32 base_clock, INT32 address)
x1_010_chip->base_clock = base_clock;
x1_010_chip->rate = x1_010_chip->base_clock / 1024;
x1_010_chip->address = address;
x1_010_chip->gain[BURN_SND_X1010_ROUTE_1] = 1.00;
x1_010_chip->gain[BURN_SND_X1010_ROUTE_2] = 1.00;
x1_010_chip->output_dir[BURN_SND_X1010_ROUTE_1] = BURN_SND_ROUTE_BOTH;
x1_010_chip->output_dir[BURN_SND_X1010_ROUTE_2] = BURN_SND_ROUTE_BOTH;
}
void x1010_set_route(INT32 nIndex, double nVolume, INT32 nRouteDir)
{
#if defined FBA_DEBUG
if (!DebugSnd_X1010Initted) bprintf(PRINT_ERROR, _T("x1010_set_route called without init\n"));
if (nIndex < 0 || nIndex > 1) bprintf(PRINT_ERROR, _T("x1010_set_route called with invalid index %i\n"), nIndex);
#endif
x1_010_chip->gain[nIndex] = nVolume;
x1_010_chip->output_dir[nIndex] = nRouteDir;
}
void x1010_scan(INT32 nAction,INT32 *pnMin)

View File

@ -17,6 +17,8 @@ struct x1_010_info
UINT32 env_offset[SETA_NUM_CHANNELS];
UINT32 base_clock;
UINT32 sound_banks[SETA_NUM_BANKS];
double gain[2];
INT32 output_dir[2];
};
typedef struct {
@ -38,5 +40,13 @@ UINT8 x1010_sound_read(UINT32 offset);
UINT16 x1010_sound_read_word(UINT32 offset);
void x1010_sound_update();
void x1010_sound_init(UINT32 base_clock, INT32 address);
void x1010_set_route(INT32 nIndex, double nVolume, INT32 nRouteDir);
void x1010_scan(INT32 nAction,INT32 *pnMin);
void x1010_exit();
#define BURN_SND_X1010_ROUTE_1 0
#define BURN_SND_X1010_ROUTE_2 1
#define x1010_set_all_routes(v, d) \
x1010_set_route(BURN_SND_X1010_ROUTE_1, v, d); \
x1010_set_route(BURN_SND_X1010_ROUTE_2, v, d);