burn.cpp: make default BurnGetTime, BurnSynchronizeStream for FM handlers, hook up to pre90s/d_gng.cpp

This commit is contained in:
dinkc64 2018-01-29 12:42:44 +00:00
parent bd9487f946
commit 9fb845ba9d
4 changed files with 23 additions and 13 deletions

View File

@ -2,6 +2,7 @@
#include "version.h"
#include "burnint.h"
#include "timer.h"
#include "burn_sound.h"
#include "driverlist.h"
@ -881,6 +882,19 @@ void BurnRandomInit()
nBurnRandSeed = time(NULL);
}
// ----------------------------------------------------------------------------
// Handy FM default callbacks
INT32 BurnSynchroniseStream(INT32 nSoundRate)
{
return (INT64)(BurnTimerCPUTotalCycles() * nSoundRate / BurnTimerCPUClockspeed);
}
double BurnGetTime()
{
return (double)BurnTimerCPUTotalCycles() / BurnTimerCPUClockspeed;
}
// ----------------------------------------------------------------------------
// Wrappers for MAME-specific function calls

View File

@ -289,6 +289,10 @@ UINT16 BurnRandom(); // State-able Random Number
void BurnRandomScan(INT32 nAction); // Must be called in driver's DrvScan() if BurnRandom() is used
void BurnRandomInit(); // Called automatically in BurnDrvInit() / Internal use only
// Handy FM default callbacks
INT32 BurnSynchroniseStream(INT32 nSoundRate);
double BurnGetTime();
// ---------------------------------------------------------------------------
// Retrieve driver information

View File

@ -1,7 +1,8 @@
#include "burnint.h"
#include "burn_sound.h"
#include "timer.h"
INT16 Precalc[4096 *4];
INT16 Precalc[4096 * 4];
// Routine used to precalculate the table used for interpolation
INT32 cmc_4p_Precalc()
@ -21,3 +22,4 @@ INT32 cmc_4p_Precalc()
return 0;
}

View File

@ -893,16 +893,6 @@ static INT32 SpritePlaneOffsets[4] = { 0x80004, 0x80000, 4, 0 };
static INT32 SpriteXOffsets[16] = { 0, 1, 2, 3, 8, 9, 10, 11, 256, 257, 258, 259, 264, 265, 266, 267 };
static INT32 SpriteYOffsets[16] = { 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240 };
inline static INT32 DrvSynchroniseStream(INT32 nSoundRate)
{
return (INT64)(ZetTotalCycles() * nSoundRate / 3000000);
}
inline static double DrvGetTime()
{
return (double)ZetTotalCycles() / 3000000;
}
static INT32 DrvInit()
{
INT32 nRet = 0, nLen;
@ -988,7 +978,7 @@ static INT32 DrvInit()
ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram );
ZetClose();
BurnYM2203Init(2, 1500000, NULL, DrvSynchroniseStream, DrvGetTime, 0);
BurnYM2203Init(2, 1500000, NULL, BurnSynchroniseStream, BurnGetTime, 0);
BurnTimerAttachZet(3000000);
BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.20, BURN_SND_ROUTE_BOTH);
BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.40, BURN_SND_ROUTE_BOTH);
@ -1082,7 +1072,7 @@ static INT32 DiamondInit()
ZetMapArea(0xc000, 0xc7ff, 2, DrvZ80Ram );
ZetClose();
BurnYM2203Init(2, 1500000, NULL, DrvSynchroniseStream, DrvGetTime, 0);
BurnYM2203Init(2, 1500000, NULL, BurnSynchroniseStream, BurnGetTime, 0);
BurnTimerAttachZet(3000000);
BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.20, BURN_SND_ROUTE_BOTH);
BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.40, BURN_SND_ROUTE_BOTH);