mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-15 17:25:06 +00:00
Namco WSG: 3 channel WSG now works
This commit is contained in:
parent
a9f9d6144a
commit
b17694c6a3
3 changed files with 39 additions and 11 deletions
|
@ -24,7 +24,7 @@
|
||||||
//#define rWrite(a,v) pendingWrites[a]=v;
|
//#define rWrite(a,v) pendingWrites[a]=v;
|
||||||
#define rWrite(a,v) if (!skipRegisterWrites) {writes.emplace(a,v); if (dumpWrites) {addWrite(a,v);} }
|
#define rWrite(a,v) if (!skipRegisterWrites) {writes.emplace(a,v); if (dumpWrites) {addWrite(a,v);} }
|
||||||
|
|
||||||
#define CHIP_FREQBASE 524288
|
#define CHIP_FREQBASE 2097152
|
||||||
|
|
||||||
const char* regCheatSheetNamcoWSG[]={
|
const char* regCheatSheetNamcoWSG[]={
|
||||||
"Select", "0",
|
"Select", "0",
|
||||||
|
@ -83,7 +83,6 @@ void DivPlatformNamcoWSG::acquire(short* bufL, short* bufR, size_t start, size_t
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformNamcoWSG::updateWave(int ch) {
|
void DivPlatformNamcoWSG::updateWave(int ch) {
|
||||||
printf("UPDATE NAMCO WAVE\n");
|
|
||||||
for (int i=0; i<32; i++) {
|
for (int i=0; i<32; i++) {
|
||||||
namco->update_namco_waveform(i+ch*32,chan[ch].ws.output[i]);
|
namco->update_namco_waveform(i+ch*32,chan[ch].ws.output[i]);
|
||||||
}
|
}
|
||||||
|
@ -150,7 +149,6 @@ void DivPlatformNamcoWSG::tick(bool sysTick) {
|
||||||
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
||||||
//DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_PCE);
|
//DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_PCE);
|
||||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE);
|
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE);
|
||||||
printf("f: %d\n",chan[i].freq);
|
|
||||||
if (chan[i].freq>1048575) chan[i].freq=1048575;
|
if (chan[i].freq>1048575) chan[i].freq=1048575;
|
||||||
if (chan[i].keyOn) {
|
if (chan[i].keyOn) {
|
||||||
}
|
}
|
||||||
|
@ -163,10 +161,22 @@ void DivPlatformNamcoWSG::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// update state
|
// update state
|
||||||
rWrite(0x15,chan[0].outVol);
|
if (chan[0].active) {
|
||||||
rWrite(0x1a,chan[1].outVol);
|
rWrite(0x15,chan[0].outVol);
|
||||||
rWrite(0x1f,chan[2].outVol);
|
} else {
|
||||||
printf("%d %d %d\n",chan[0].outVol,chan[1].outVol,chan[2].outVol);
|
rWrite(0x15,0);
|
||||||
|
}
|
||||||
|
if (chan[1].active) {
|
||||||
|
rWrite(0x1a,chan[1].outVol);
|
||||||
|
} else {
|
||||||
|
rWrite(0x1a,0);
|
||||||
|
}
|
||||||
|
if (chan[2].active) {
|
||||||
|
rWrite(0x1f,chan[2].outVol);
|
||||||
|
} else {
|
||||||
|
rWrite(0x1f,0);
|
||||||
|
}
|
||||||
|
//printf("%d %d %d\n",chan[0].outVol,chan[1].outVol,chan[2].outVol);
|
||||||
|
|
||||||
rWrite(0x10,(chan[0].freq)&15);
|
rWrite(0x10,(chan[0].freq)&15);
|
||||||
rWrite(0x11,(chan[0].freq>>4)&15);
|
rWrite(0x11,(chan[0].freq>>4)&15);
|
||||||
|
@ -415,7 +425,7 @@ void DivPlatformNamcoWSG::setDeviceType(int type) {
|
||||||
|
|
||||||
void DivPlatformNamcoWSG::setFlags(unsigned int flags) {
|
void DivPlatformNamcoWSG::setFlags(unsigned int flags) {
|
||||||
chipClock=3072000;
|
chipClock=3072000;
|
||||||
rate=chipClock/16;
|
rate=chipClock/32;
|
||||||
namco->device_clock_changed(rate);
|
namco->device_clock_changed(rate);
|
||||||
for (int i=0; i<chans; i++) {
|
for (int i=0; i<chans; i++) {
|
||||||
oscBuf[i]->rate=rate;
|
oscBuf[i]->rate=rate;
|
||||||
|
|
|
@ -129,7 +129,6 @@ void namco_audio_device::device_clock_changed(int clk)
|
||||||
/* update the decoded waveform data */
|
/* update the decoded waveform data */
|
||||||
void namco_audio_device::update_namco_waveform(int offset, uint8_t data)
|
void namco_audio_device::update_namco_waveform(int offset, uint8_t data)
|
||||||
{
|
{
|
||||||
printf("writing %d to %d\n",data,offset);
|
|
||||||
if (m_wave_size == 1)
|
if (m_wave_size == 1)
|
||||||
{
|
{
|
||||||
int16_t wdata;
|
int16_t wdata;
|
||||||
|
@ -188,6 +187,20 @@ void namco_audio_device::sound_enable_w(int state)
|
||||||
m_sound_enable = state;
|
m_sound_enable = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void namco_device::device_start(unsigned char* wavePtr) {
|
||||||
|
memset(m_soundregs,0,1024);
|
||||||
|
namco_audio_device::device_start(wavePtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void namco_15xx_device::device_start(unsigned char* wavePtr) {
|
||||||
|
memset(m_soundregs,0,1024);
|
||||||
|
namco_audio_device::device_start(wavePtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void namco_cus30_device::device_start(unsigned char* wavePtr) {
|
||||||
|
namco_audio_device::device_start(wavePtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************************/
|
/********************************************************************************/
|
||||||
|
|
||||||
|
@ -235,7 +248,6 @@ void namco_device::pacman_sound_w(int offset, uint8_t data)
|
||||||
{
|
{
|
||||||
case 0x05:
|
case 0x05:
|
||||||
voice->waveform_select = data & 7;
|
voice->waveform_select = data & 7;
|
||||||
printf("selecting waveform %d\n",data);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x10:
|
case 0x10:
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
namco_audio_device(uint32_t clock);
|
namco_audio_device(uint32_t clock);
|
||||||
|
|
||||||
// device-level overrides
|
// device-level overrides
|
||||||
void device_start(unsigned char* wavePtr);
|
virtual void device_start(unsigned char* wavePtr);
|
||||||
void device_clock_changed(int clk);
|
void device_clock_changed(int clk);
|
||||||
|
|
||||||
// internal state
|
// internal state
|
||||||
|
@ -82,6 +82,8 @@ public:
|
||||||
uint8_t polepos_sound_r(int offset);
|
uint8_t polepos_sound_r(int offset);
|
||||||
void polepos_sound_w(int offset, uint8_t data);
|
void polepos_sound_w(int offset, uint8_t data);
|
||||||
|
|
||||||
|
void device_start(unsigned char* wavePtr);
|
||||||
|
|
||||||
~namco_device() {}
|
~namco_device() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -98,6 +100,8 @@ public:
|
||||||
uint8_t sharedram_r(int offset);
|
uint8_t sharedram_r(int offset);
|
||||||
void sharedram_w(int offset, uint8_t data);
|
void sharedram_w(int offset, uint8_t data);
|
||||||
|
|
||||||
|
void device_start(unsigned char* wavePtr);
|
||||||
|
|
||||||
~namco_15xx_device() {}
|
~namco_15xx_device() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -116,6 +120,8 @@ public:
|
||||||
|
|
||||||
void pacman_sound_w(int offset, uint8_t data);
|
void pacman_sound_w(int offset, uint8_t data);
|
||||||
|
|
||||||
|
void device_start(unsigned char* wavePtr);
|
||||||
|
|
||||||
~namco_cus30_device() {}
|
~namco_cus30_device() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue