mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-25 22:15:14 +00:00
Renaming new POKEY core to AltASAP. Added core selection.
This commit is contained in:
parent
3a94a7acde
commit
4a7e76c448
8 changed files with 71 additions and 23 deletions
|
@ -425,7 +425,7 @@ src/engine/platform/sound/ymfm/ymfm_ssg.cpp
|
|||
src/engine/platform/sound/lynx/Mikey.cpp
|
||||
|
||||
src/engine/platform/sound/pokey/mzpokeysnd.c
|
||||
src/engine/platform/sound/pokey/Pokey.cpp
|
||||
src/engine/platform/sound/pokey/AltASAP.cpp
|
||||
|
||||
src/engine/platform/sound/qsound.c
|
||||
|
||||
|
|
|
@ -341,6 +341,7 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
|
|||
break;
|
||||
case DIV_SYSTEM_POKEY:
|
||||
dispatch=new DivPlatformPOKEY;
|
||||
((DivPlatformPOKEY*)dispatch)->setAltASAP(eng->getConfInt("pokeyCore",0)==1);
|
||||
break;
|
||||
case DIV_SYSTEM_QSOUND:
|
||||
dispatch=new DivPlatformQSound;
|
||||
|
|
|
@ -65,18 +65,22 @@ const char** DivPlatformPOKEY::getRegisterSheet() {
|
|||
}
|
||||
|
||||
void DivPlatformPOKEY::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||
if (useAltASAP)
|
||||
acquireASAP(bufL, start, len);
|
||||
else
|
||||
acquireMZ(bufL, start, len);
|
||||
}
|
||||
|
||||
void DivPlatformPOKEY::acquireMZ(short* buf, size_t start, size_t len) {
|
||||
for (size_t h=start; h<start+len; h++) {
|
||||
while (!writes.empty()) {
|
||||
QueuedWrite w=writes.front();
|
||||
mPokey2->write( w.addr, w.val );
|
||||
Update_pokey_sound_mz(&pokey,w.addr,w.val,0);
|
||||
regPool[w.addr&0x0f]=w.val;
|
||||
writes.pop();
|
||||
}
|
||||
|
||||
mzpokeysnd_process_16(&pokey,&bufL[h],1);
|
||||
mPokey2->sampleAudio( &bufL[h], 1 );
|
||||
bufL[h] *= 160;
|
||||
mzpokeysnd_process_16(&pokey,&buf[h],1);
|
||||
|
||||
if (++oscBufDelay>=14) {
|
||||
oscBufDelay=0;
|
||||
|
@ -86,6 +90,23 @@ void DivPlatformPOKEY::acquire(short* bufL, short* bufR, size_t start, size_t le
|
|||
oscBuf[3]->data[oscBuf[3]->needle++]=pokey.outvol_3<<11;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DivPlatformPOKEY::acquireASAP(short* buf, size_t start, size_t len) {
|
||||
while (!writes.empty()) {
|
||||
QueuedWrite w=writes.front();
|
||||
altASAP->write(w.addr, w.val);
|
||||
writes.pop();
|
||||
}
|
||||
|
||||
for (size_t h=start; h<start+len; h++) {
|
||||
if (++oscBufDelay>=14) {
|
||||
oscBufDelay=0;
|
||||
buf[h]=altASAP->sampleAudio(oscBuf);
|
||||
} else {
|
||||
buf[h]=altASAP->sampleAudio();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DivPlatformPOKEY::tick(bool sysTick) {
|
||||
|
@ -373,8 +394,10 @@ DivDispatchOscBuffer* DivPlatformPOKEY::getOscBuffer(int ch) {
|
|||
}
|
||||
|
||||
unsigned char* DivPlatformPOKEY::getRegisterPool() {
|
||||
return const_cast<unsigned char*>( mPokey2->getRegisterPool() );
|
||||
return regPool;
|
||||
if (useAltASAP)
|
||||
return const_cast<unsigned char*>(altASAP->getRegisterPool());
|
||||
else
|
||||
return regPool;
|
||||
}
|
||||
|
||||
int DivPlatformPOKEY::getRegisterPoolSize() {
|
||||
|
@ -392,8 +415,10 @@ void DivPlatformPOKEY::reset() {
|
|||
addWrite(0xffffffff,0);
|
||||
}
|
||||
|
||||
ResetPokeyState(&pokey);
|
||||
mPokey2->reset();
|
||||
if (useAltASAP)
|
||||
altASAP->reset();
|
||||
else
|
||||
ResetPokeyState(&pokey);
|
||||
|
||||
audctl=0;
|
||||
audctlChanged=true;
|
||||
|
@ -425,7 +450,8 @@ void DivPlatformPOKEY::setFlags(const DivConfig& flags) {
|
|||
oscBuf[i]->rate=rate/14;
|
||||
}
|
||||
|
||||
mPokey2 = std::make_unique<Test::Pokey>( chipClock, chipClock );
|
||||
if (useAltASAP)
|
||||
altASAP=std::make_unique<AltASAP::Pokey>(chipClock, chipClock);
|
||||
|
||||
}
|
||||
|
||||
|
@ -447,7 +473,8 @@ int DivPlatformPOKEY::init(DivEngine* p, int channels, int sugRate, const DivCon
|
|||
oscBuf[i]=new DivDispatchOscBuffer;
|
||||
}
|
||||
|
||||
MZPOKEYSND_Init(&pokey);
|
||||
if (!useAltASAP)
|
||||
MZPOKEYSND_Init(&pokey);
|
||||
|
||||
setFlags(flags);
|
||||
reset();
|
||||
|
@ -458,6 +485,10 @@ void DivPlatformPOKEY::quit() {
|
|||
for (int i=0; i<4; i++) {
|
||||
delete oscBuf[i];
|
||||
}
|
||||
}
|
||||
|
||||
void DivPlatformPOKEY::setAltASAP(bool value){
|
||||
useAltASAP=value;
|
||||
}
|
||||
|
||||
DivPlatformPOKEY::~DivPlatformPOKEY() {
|
||||
|
|
|
@ -27,7 +27,7 @@ extern "C" {
|
|||
#include "sound/pokey/mzpokeysnd.h"
|
||||
}
|
||||
|
||||
#include "sound/pokey/Pokey.hpp"
|
||||
#include "sound/pokey/AltASAP.hpp"
|
||||
|
||||
|
||||
class DivPlatformPOKEY: public DivDispatch {
|
||||
|
@ -52,12 +52,15 @@ class DivPlatformPOKEY: public DivDispatch {
|
|||
bool audctlChanged;
|
||||
unsigned char oscBufDelay;
|
||||
PokeyState pokey;
|
||||
std::unique_ptr<Test::Pokey> mPokey2;
|
||||
std::unique_ptr<AltASAP::Pokey> altASAP;
|
||||
bool useAltASAP;
|
||||
unsigned char regPool[16];
|
||||
friend void putDispatchChip(void*,int);
|
||||
friend void putDispatchChan(void*,int,int);
|
||||
public:
|
||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
||||
void acquireMZ(short* buf, size_t start, size_t len);
|
||||
void acquireASAP(short* buf, size_t start, size_t len);
|
||||
int dispatch(DivCommand c);
|
||||
void* getChanState(int chan);
|
||||
DivMacroInt* getChanMacroInt(int ch);
|
||||
|
@ -77,6 +80,7 @@ class DivPlatformPOKEY: public DivDispatch {
|
|||
const char** getRegisterSheet();
|
||||
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
||||
void quit();
|
||||
void setAltASAP(bool useAltASAP);
|
||||
~DivPlatformPOKEY();
|
||||
};
|
||||
|
||||
|
|
|
@ -20,14 +20,14 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "Pokey.hpp"
|
||||
#include "AltASAP.hpp"
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
namespace Test
|
||||
namespace AltASAP
|
||||
{
|
||||
|
||||
namespace
|
||||
|
@ -631,12 +631,9 @@ void Pokey::write( uint8_t address, uint8_t value )
|
|||
mPokey->write( address, value );
|
||||
}
|
||||
|
||||
void Pokey::sampleAudio( int16_t* buf, size_t size, DivDispatchOscBuffer** oscb )
|
||||
int16_t Pokey::sampleAudio( DivDispatchOscBuffer** oscb )
|
||||
{
|
||||
for ( size_t i = 0; i < size; ++i )
|
||||
{
|
||||
buf[i] = mPokey->sampleAudio( oscb );
|
||||
}
|
||||
return mPokey->sampleAudio( oscb ) * 160; //just some magick value to match the audio level of mzpokeysnd
|
||||
}
|
||||
|
||||
uint8_t const* Pokey::getRegisterPool()
|
|
@ -6,7 +6,7 @@
|
|||
// can you forgive me
|
||||
#include "../../../dispatch.h"
|
||||
|
||||
namespace Test
|
||||
namespace AltASAP
|
||||
{
|
||||
|
||||
class PokeyPimpl;
|
||||
|
@ -19,7 +19,7 @@ public:
|
|||
~Pokey();
|
||||
|
||||
void write( uint8_t address, uint8_t value );
|
||||
void sampleAudio( int16_t* buf, size_t size, DivDispatchOscBuffer** oscb = NULL );
|
||||
int16_t sampleAudio( DivDispatchOscBuffer** oscb = nullptr );
|
||||
|
||||
uint8_t const* getRegisterPool();
|
||||
|
|
@ -1177,6 +1177,7 @@ class FurnaceGUI {
|
|||
int nesCore;
|
||||
int fdsCore;
|
||||
int c64Core;
|
||||
int pokeyCore;
|
||||
int pcSpeakerOutMethod;
|
||||
String yrw801Path;
|
||||
String tg100Path;
|
||||
|
@ -1309,6 +1310,7 @@ class FurnaceGUI {
|
|||
nesCore(0),
|
||||
fdsCore(0),
|
||||
c64Core(1),
|
||||
pokeyCore(0),
|
||||
pcSpeakerOutMethod(0),
|
||||
yrw801Path(""),
|
||||
tg100Path(""),
|
||||
|
|
|
@ -102,6 +102,11 @@ const char* c64Cores[]={
|
|||
"reSIDfp"
|
||||
};
|
||||
|
||||
const char* pokeyCores[]={
|
||||
"mzpokeysnd",
|
||||
"altASAP"
|
||||
};
|
||||
|
||||
const char* pcspkrOutMethods[]={
|
||||
"evdev SND_TONE",
|
||||
"KIOCSOUND on /dev/tty1",
|
||||
|
@ -1069,6 +1074,10 @@ void FurnaceGUI::drawSettings() {
|
|||
ImGui::SameLine();
|
||||
ImGui::Combo("##C64Core",&settings.c64Core,c64Cores,2);
|
||||
|
||||
ImGui::Text("POKEY core");
|
||||
ImGui::SameLine();
|
||||
ImGui::Combo("##POKEYCore",&settings.pokeyCore,pokeyCores,2);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Text("PC Speaker strategy");
|
||||
|
@ -2336,6 +2345,7 @@ void FurnaceGUI::syncSettings() {
|
|||
settings.nesCore=e->getConfInt("nesCore",0);
|
||||
settings.fdsCore=e->getConfInt("fdsCore",0);
|
||||
settings.c64Core=e->getConfInt("c64Core",1);
|
||||
settings.pokeyCore=e->getConfInt("pokeyCore",0);
|
||||
settings.pcSpeakerOutMethod=e->getConfInt("pcSpeakerOutMethod",0);
|
||||
settings.yrw801Path=e->getConfString("yrw801Path","");
|
||||
settings.tg100Path=e->getConfString("tg100Path","");
|
||||
|
@ -2461,6 +2471,7 @@ void FurnaceGUI::syncSettings() {
|
|||
clampSetting(settings.nesCore,0,1);
|
||||
clampSetting(settings.fdsCore,0,1);
|
||||
clampSetting(settings.c64Core,0,1);
|
||||
clampSetting(settings.pokeyCore,0,1);
|
||||
clampSetting(settings.pcSpeakerOutMethod,0,4);
|
||||
clampSetting(settings.mainFont,0,6);
|
||||
clampSetting(settings.patFont,0,6);
|
||||
|
@ -2604,7 +2615,8 @@ void FurnaceGUI::commitSettings() {
|
|||
settings.snCore!=e->getConfInt("snCore",0) ||
|
||||
settings.nesCore!=e->getConfInt("nesCore",0) ||
|
||||
settings.fdsCore!=e->getConfInt("fdsCore",0) ||
|
||||
settings.c64Core!=e->getConfInt("c64Core",1)
|
||||
settings.c64Core!=e->getConfInt("c64Core",1) ||
|
||||
settings.pokeyCore!=e->getConfInt("pokeyCore",0)
|
||||
);
|
||||
|
||||
e->setConf("mainFontSize",settings.mainFontSize);
|
||||
|
@ -2624,6 +2636,7 @@ void FurnaceGUI::commitSettings() {
|
|||
e->setConf("nesCore",settings.nesCore);
|
||||
e->setConf("fdsCore",settings.fdsCore);
|
||||
e->setConf("c64Core",settings.c64Core);
|
||||
e->setConf("pokeyCore",settings.pokeyCore);
|
||||
e->setConf("pcSpeakerOutMethod",settings.pcSpeakerOutMethod);
|
||||
e->setConf("yrw801Path",settings.yrw801Path);
|
||||
e->setConf("tg100Path",settings.tg100Path);
|
||||
|
|
Loading…
Reference in a new issue