GA20: Fix build and sound output, Add debug

This commit is contained in:
cam900 2022-12-15 20:37:19 +09:00
parent ee983e47f0
commit be9a1a17f0
3 changed files with 52 additions and 29 deletions

View file

@ -71,8 +71,9 @@ void DivPlatformGA20::acquire(short* bufL, short* bufR, size_t start, size_t len
delay=w.delay; delay=w.delay;
} }
} }
ga20.sound_stream_update(ga20Buf, 1); short *buffer[4] = {&ga20Buf[0][h],&ga20Buf[1][h],&ga20Buf[2][h],&ga20Buf[3][h]};
bufL[h]=(ga20Buf[0][h]+ga20Buf[1][h]+ga20Buf[2][h]+ga20Buf[3][h]); ga20.sound_stream_update(buffer, 1);
bufL[h]=(signed int)(ga20Buf[0][h]+ga20Buf[1][h]+ga20Buf[2][h]+ga20Buf[3][h])>>2;
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
oscBuf[i]->data[oscBuf[i]->needle++]=ga20Buf[i][h]; oscBuf[i]->data[oscBuf[i]->needle++]=ga20Buf[i][h];
} }

View file

@ -74,33 +74,32 @@ class DivPlatformGA20: public DivDispatch, public iremga20_intf {
void chWrite(unsigned char ch, unsigned int addr, unsigned char val); void chWrite(unsigned char ch, unsigned int addr, unsigned char val);
public: public:
virtual u8 read_byte(u32 address) override; virtual u8 read_byte(u32 address) override;
void acquire(short* bufL, short* bufR, size_t start, size_t len); virtual void acquire(short* bufL, short* bufR, size_t start, size_t len) override;
int dispatch(DivCommand c); virtual int dispatch(DivCommand c) override;
void* getChanState(int chan); virtual void* getChanState(int chan) override;
DivMacroInt* getChanMacroInt(int ch); virtual DivMacroInt* getChanMacroInt(int ch) override;
DivDispatchOscBuffer* getOscBuffer(int chan); virtual DivDispatchOscBuffer* getOscBuffer(int chan) override;
unsigned char* getRegisterPool(); virtual unsigned char* getRegisterPool() override;
int getRegisterPoolSize(); virtual int getRegisterPoolSize() override;
void reset(); virtual void reset() override;
void forceIns(); virtual void forceIns() override;
void tick(bool sysTick=true); virtual void tick(bool sysTick=true) override;
void muteChannel(int ch, bool mute); virtual void muteChannel(int ch, bool mute) override;
bool isStereo(); virtual bool isStereo() override;
void setChipModel(int type); virtual void notifyInsChange(int ins) override;
void notifyInsChange(int ins); virtual void notifyWaveChange(int wave) override;
void notifyWaveChange(int wave); virtual void notifyInsDeletion(void* ins) override;
void notifyInsDeletion(void* ins); virtual void setFlags(const DivConfig& flags) override;
void setFlags(const DivConfig& flags); virtual void poke(unsigned int addr, unsigned short val) override;
void poke(unsigned int addr, unsigned short val); virtual void poke(std::vector<DivRegWrite>& wlist) override;
void poke(std::vector<DivRegWrite>& wlist); virtual const char** getRegisterSheet() override;
const char** getRegisterSheet(); virtual const void* getSampleMem(int index = 0) override;
const void* getSampleMem(int index = 0); virtual size_t getSampleMemCapacity(int index = 0) override;
size_t getSampleMemCapacity(int index = 0); virtual size_t getSampleMemUsage(int index = 0) override;
size_t getSampleMemUsage(int index = 0); virtual bool isSampleLoaded(int index, int sample) override;
bool isSampleLoaded(int index, int sample); virtual void renderSamples(int chipID) override;
void renderSamples(int chipID); virtual int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags) override;
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags); virtual void quit() override;
void quit();
DivPlatformGA20(): DivPlatformGA20():
DivDispatch(), DivDispatch(),
iremga20_intf(), iremga20_intf(),

View file

@ -49,6 +49,7 @@
#include "../engine/platform/lynx.h" #include "../engine/platform/lynx.h"
#include "../engine/platform/pcmdac.h" #include "../engine/platform/pcmdac.h"
#include "../engine/platform/k007232.h" #include "../engine/platform/k007232.h"
#include "../engine/platform/ga20.h"
#include "../engine/platform/dummy.h" #include "../engine/platform/dummy.h"
#define COMMON_CHIP_DEBUG \ #define COMMON_CHIP_DEBUG \
@ -502,6 +503,14 @@ void putDispatchChip(void* data, int type) {
ImGui::TextColored(ch->stereo?colorOn:colorOff,">> Stereo"); ImGui::TextColored(ch->stereo?colorOn:colorOff,">> Stereo");
break; break;
} }
case DIV_SYSTEM_GA20: {
DivPlatformGA20* ch=(DivPlatformGA20*)data;
ImGui::Text("> GA20");
COMMON_CHIP_DEBUG;
ImGui::Text("- delay: %.2x",ch->delay);
COMMON_CHIP_DEBUG_BOOL;
break;
}
default: default:
ImGui::Text("Unimplemented chip! Help!"); ImGui::Text("Unimplemented chip! Help!");
break; break;
@ -914,6 +923,20 @@ void putDispatchChan(void* data, int chanNum, int type) {
ImGui::TextColored(ch->setPos?colorOn:colorOff,">> SetPos"); ImGui::TextColored(ch->setPos?colorOn:colorOff,">> SetPos");
break; break;
} }
case DIV_SYSTEM_GA20: {
DivPlatformGA20::Channel* ch=(DivPlatformGA20::Channel*)data;
ImGui::Text("> GA20");
COMMON_CHAN_DEBUG;
ImGui::Text("- prevFreq: %d",ch->prevFreq);
ImGui::Text("* Sample: %d",ch->sample);
ImGui::Text(" - pos: %d",ch->audPos);
ImGui::Text("- resVol: %.2x",ch->resVol);
ImGui::Text("- macroVolMul: %.2x",ch->macroVolMul);
COMMON_CHAN_DEBUG_BOOL;
ImGui::TextColored(ch->volumeChanged?colorOn:colorOff,">> VolumeChanged");
ImGui::TextColored(ch->setPos?colorOn:colorOff,">> SetPos");
break;
}
default: default:
ImGui::Text("Unimplemented chip! Help!"); ImGui::Text("Unimplemented chip! Help!");
break; break;