From efb74b8fc54d4afd10c6ce39e4d313fd906360a9 Mon Sep 17 00:00:00 2001 From: dinkc64 <12570148+dinkc64@users.noreply.github.com> Date: Fri, 31 Jul 2015 22:49:16 +0000 Subject: [PATCH] pokey: fix random, add clock rate to init --- src/burn/snd/pokey.cpp | 11 ++++++----- src/burn/snd/pokey.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/burn/snd/pokey.cpp b/src/burn/snd/pokey.cpp index 3b4d0881a..3a844ae07 100644 --- a/src/burn/snd/pokey.cpp +++ b/src/burn/snd/pokey.cpp @@ -34,7 +34,7 @@ * *****************************************************************************/ -#include "driver.h" +#include "burnint.h" #include "pokey.h" /* @@ -570,14 +570,15 @@ static void rand_init(UINT8 *rng, int size, int left, int right, int add) } } -int PokeyInit(int sample_rate, int num, int vol, int addtostream) +int PokeyInit(int clock, int num, int vol, int addtostream) { - int chip; + int chip, sample_rate; memset(&intf, 0, sizeof(intf)); + sample_rate = nBurnSoundRate; intf.num = num; intf.mixing_level[0] = vol; - intf.baseclock = FREQ_17_EXACT; + intf.baseclock = (clock) ? clock : FREQ_17_EXACT; intf.addtostream = addtostream; poly9 = (UINT8 *)malloc(0x1ff+1); @@ -883,7 +884,7 @@ int pokey_register_r(int chip, int offs) ****************************************************************/ if( p->SKCTL & SK_RESET ) { - UINT32 adjust = (UINT32)(/*timer_timeelapsed(p->rtimer)*/1234 * intf.baseclock); + UINT32 adjust = (UINT32)(/*timer_timeelapsed(p->rtimer)*/rand() /*dink*/ * intf.baseclock); p->r9 = (p->r9 + adjust) % 0x001ff; p->r17 = (p->r17 + adjust) % 0x1ffff; if( p->AUDCTL & POLY9 ) diff --git a/src/burn/snd/pokey.h b/src/burn/snd/pokey.h index 47352be6b..1edaa6783 100644 --- a/src/burn/snd/pokey.h +++ b/src/burn/snd/pokey.h @@ -98,7 +98,7 @@ struct POKEYinterface { }; -int PokeyInit (int sample_rate, int num, int vol, int addtostream); +int PokeyInit (int clock, int num, int vol, int addtostream); void PokeyExit (void); void pokey_update(int num, INT16 *buffer, int length);