Applied code review remarks.

This commit is contained in:
Waldemar Pawlaszek 2022-12-22 23:17:38 +01:00
parent 1b2eb9cacb
commit 44a26791c6
3 changed files with 20 additions and 13 deletions

View file

@ -65,10 +65,12 @@ const char** DivPlatformPOKEY::getRegisterSheet() {
} }
void DivPlatformPOKEY::acquire(short* bufL, short* bufR, size_t start, size_t len) { void DivPlatformPOKEY::acquire(short* bufL, short* bufR, size_t start, size_t len) {
if (useAltASAP) if (useAltASAP) {
acquireASAP(bufL, start, len); acquireASAP(bufL, start, len);
else }
else {
acquireMZ(bufL, start, len); acquireMZ(bufL, start, len);
}
} }
void DivPlatformPOKEY::acquireMZ(short* buf, size_t start, size_t len) { void DivPlatformPOKEY::acquireMZ(short* buf, size_t start, size_t len) {
@ -394,10 +396,12 @@ DivDispatchOscBuffer* DivPlatformPOKEY::getOscBuffer(int ch) {
} }
unsigned char* DivPlatformPOKEY::getRegisterPool() { unsigned char* DivPlatformPOKEY::getRegisterPool() {
if (useAltASAP) if (useAltASAP) {
return const_cast<unsigned char*>(altASAP->getRegisterPool()); return const_cast<unsigned char*>(altASAP->getRegisterPool());
else }
else {
return regPool; return regPool;
}
} }
int DivPlatformPOKEY::getRegisterPoolSize() { int DivPlatformPOKEY::getRegisterPoolSize() {
@ -415,10 +419,12 @@ void DivPlatformPOKEY::reset() {
addWrite(0xffffffff,0); addWrite(0xffffffff,0);
} }
if (useAltASAP) if (useAltASAP) {
altASAP->reset(); altASAP->reset();
else }
else {
ResetPokeyState(&pokey); ResetPokeyState(&pokey);
}
audctl=0; audctl=0;
audctlChanged=true; audctlChanged=true;
@ -450,9 +456,9 @@ void DivPlatformPOKEY::setFlags(const DivConfig& flags) {
oscBuf[i]->rate=rate/14; oscBuf[i]->rate=rate/14;
} }
if (useAltASAP) if (useAltASAP) {
altASAP=std::make_unique<AltASAP::Pokey>(chipClock, chipClock); altASAP=std::make_unique<AltASAP::Pokey>(chipClock, chipClock);
}
} }
void DivPlatformPOKEY::poke(unsigned int addr, unsigned short val) { void DivPlatformPOKEY::poke(unsigned int addr, unsigned short val) {
@ -473,8 +479,9 @@ int DivPlatformPOKEY::init(DivEngine* p, int channels, int sugRate, const DivCon
oscBuf[i]=new DivDispatchOscBuffer; oscBuf[i]=new DivDispatchOscBuffer;
} }
if (!useAltASAP) if (!useAltASAP) {
MZPOKEYSND_Init(&pokey); MZPOKEYSND_Init(&pokey);
}
setFlags(flags); setFlags(flags);
reset(); reset();
@ -487,7 +494,7 @@ void DivPlatformPOKEY::quit() {
} }
} }
void DivPlatformPOKEY::setAltASAP(bool value){ void DivPlatformPOKEY::setAltASAP(bool value) {
useAltASAP=value; useAltASAP=value;
} }

View file

@ -612,7 +612,7 @@ private:
}; };
Pokey::Pokey( uint32_t pokeyClock, uint32_t sampleRate ) : mPokey{}, mPokeyClock{ pokeyClock }, mSampleRate{ sampleRate } Pokey::Pokey( uint32_t pokeyClock, uint32_t sampleRate ) : mPokey{ std::make_unique<PokeyPimpl>( mPokeyClock, mSampleRate ) }, mPokeyClock{ pokeyClock }, mSampleRate{ sampleRate }
{ {
} }

View file

@ -103,8 +103,8 @@ const char* c64Cores[]={
}; };
const char* pokeyCores[]={ const char* pokeyCores[]={
"mzpokeysnd", "Atari800 (mzpokeysnd)",
"altASAP" "ASAP (C++ port)"
}; };
const char* pcspkrOutMethods[]={ const char* pcspkrOutMethods[]={