Namco WSG: 8 channel WSG (CUS30) now works

This commit is contained in:
tildearrow 2022-05-21 02:16:38 -05:00
parent c251ea2198
commit 9162e8e241
5 changed files with 37 additions and 13 deletions

View file

@ -83,8 +83,14 @@ void DivPlatformNamcoWSG::acquire(short* bufL, short* bufR, size_t start, size_t
} }
void DivPlatformNamcoWSG::updateWave(int ch) { void DivPlatformNamcoWSG::updateWave(int ch) {
for (int i=0; i<32; i++) { if (devType==30) {
namco->update_namco_waveform(i+ch*32,chan[ch].ws.output[i]); for (int i=0; i<32; i++) {
((namco_cus30_device*)namco)->namcos1_cus30_w(i+ch*32,chan[ch].ws.output[i]);
}
} else {
for (int i=0; i<32; i++) {
namco->update_namco_waveform(i+ch*32,chan[ch].ws.output[i]);
}
} }
} }
@ -212,6 +218,18 @@ void DivPlatformNamcoWSG::tick(bool sysTick) {
} }
break; break;
case 30: case 30:
for (int i=0; i<8; i++) {
if (chan[i].active && !isMuted[i]) {
rWrite((i<<3)+0x100,(chan[i].outVol*((chan[i].pan>>4)&15))/15);
rWrite((i<<3)+0x104,((chan[i].outVol*(chan[i].pan&15))/15)|(chan[(i+1)&7].noise?0x80:0));
} else {
rWrite((i<<3)+0x100,0);
rWrite((i<<3)+0x104,(chan[(i+1)&7].noise?0x80:0));
}
rWrite((i<<3)+0x103,chan[i].freq&0xff);
rWrite((i<<3)+0x102,(chan[i].freq>>8)&0xff);
rWrite((i<<3)+0x101,((chan[i].freq>>15)&15)|(i<<4));
}
break; break;
} }
} }

View file

@ -62,16 +62,14 @@ class DivPlatformNamcoWSG: public DivDispatch {
DivDispatchOscBuffer* oscBuf[8]; DivDispatchOscBuffer* oscBuf[8];
bool isMuted[8]; bool isMuted[8];
struct QueuedWrite { struct QueuedWrite {
unsigned char addr; unsigned short addr;
unsigned char val; unsigned char val;
QueuedWrite(unsigned char a, unsigned char v): addr(a), val(v) {} QueuedWrite(unsigned short a, unsigned char v): addr(a), val(v) {}
}; };
std::queue<QueuedWrite> writes; std::queue<QueuedWrite> writes;
unsigned char lastPan; unsigned char lastPan;
int cycles, curChan, delay; int cycles, curChan, delay;
int tempL[32];
int tempR[32];
namco_audio_device* namco; namco_audio_device* namco;
int devType, chans; int devType, chans;
unsigned char regPool[512]; unsigned char regPool[512];

View file

@ -87,6 +87,8 @@ void namco_audio_device::device_start(unsigned char* wavePtr)
m_wave_ptr = wavePtr; m_wave_ptr = wavePtr;
memset(m_waveram_alloc,0,1024);
/* build the waveform table */ /* build the waveform table */
build_decoded_waveform(m_wave_ptr); build_decoded_waveform(m_wave_ptr);
@ -581,8 +583,9 @@ void namco_cus30_device::namcos1_cus30_w(int offset, uint8_t data)
update_namco_waveform(offset, data); update_namco_waveform(offset, data);
} }
} }
else if (offset < 0x140) else if (offset < 0x140) {
namcos1_sound_w(offset - 0x100,data); namcos1_sound_w(offset - 0x100,data);
}
else else
m_wavedata[offset] = data; m_wavedata[offset] = data;
} }
@ -653,13 +656,13 @@ void namco_audio_device::sound_stream_update(short** outputs, int len)
if (voice->noise_state) if (voice->noise_state)
{ {
lmix[i]=l_noise_data; lmix[i]+=l_noise_data;
rmix[i]=r_noise_data; rmix[i]+=r_noise_data;
} }
else else
{ {
lmix[i]=-l_noise_data; lmix[i]+=-l_noise_data;
rmix[i]=-r_noise_data; rmix[i]+=-r_noise_data;
} }
if (hold) if (hold)

View file

@ -881,6 +881,9 @@ const int availableSystems[]={
DIV_SYSTEM_SCC, DIV_SYSTEM_SCC,
DIV_SYSTEM_SCC_PLUS, DIV_SYSTEM_SCC_PLUS,
DIV_SYSTEM_YMZ280B, DIV_SYSTEM_YMZ280B,
DIV_SYSTEM_NAMCO,
DIV_SYSTEM_NAMCO_15XX,
DIV_SYSTEM_NAMCO_CUS30,
DIV_SYSTEM_MSM6258, DIV_SYSTEM_MSM6258,
DIV_SYSTEM_MSM6295, DIV_SYSTEM_MSM6295,
DIV_SYSTEM_RF5C68, DIV_SYSTEM_RF5C68,

View file

@ -2757,7 +2757,8 @@ void FurnaceGUI::drawInsEdit() {
ins->type==DIV_INS_FDS || ins->type==DIV_INS_FDS ||
ins->type==DIV_INS_SWAN || ins->type==DIV_INS_SWAN ||
ins->type==DIV_INS_PCE || ins->type==DIV_INS_PCE ||
ins->type==DIV_INS_SCC) { ins->type==DIV_INS_SCC ||
ins->type==DIV_INS_NAMCO) {
if (ImGui::BeginTabItem("Wavetable")) { if (ImGui::BeginTabItem("Wavetable")) {
ImGui::Checkbox("Enable synthesizer",&ins->ws.enabled); ImGui::Checkbox("Enable synthesizer",&ins->ws.enabled);
ImGui::SameLine(); ImGui::SameLine();
@ -2926,7 +2927,8 @@ void FurnaceGUI::drawInsEdit() {
if (ins->type==DIV_INS_TIA || ins->type==DIV_INS_AMIGA || ins->type==DIV_INS_SCC || ins->type==DIV_INS_PET || ins->type==DIV_INS_VIC) { if (ins->type==DIV_INS_TIA || ins->type==DIV_INS_AMIGA || ins->type==DIV_INS_SCC || ins->type==DIV_INS_PET || ins->type==DIV_INS_VIC) {
dutyMax=0; dutyMax=0;
} }
if (ins->type==DIV_INS_PCE) { if (ins->type==DIV_INS_PCE || ins->type==DIV_INS_NAMCO) {
dutyLabel="Noise";
dutyMax=1; dutyMax=1;
} }
if (ins->type==DIV_INS_SWAN) { if (ins->type==DIV_INS_SWAN) {