diff --git a/src/engine/platform/mmc5.cpp b/src/engine/platform/mmc5.cpp index 894965b50..124eb3350 100644 --- a/src/engine/platform/mmc5.cpp +++ b/src/engine/platform/mmc5.cpp @@ -63,14 +63,28 @@ void DivPlatformMMC5::acquireDirect(blip_buffer_t** bb, size_t len) { extcl_envelope_clock_MMC5(mmc5); extcl_length_clock_MMC5(mmc5); for (size_t i=0; i0) { + int remainTime=(rate-dacPeriod+dacRate-1)/dacRate; + if (remainTime=rate) { DivSample* s=parent->getSample(dacSample); if (s->samples>0 && dacPossamples) { if (!isMuted[2]) { - rWrite(0x5011,((unsigned char)s->data8[dacPos]+0x80)); + extcl_cpu_wr_mem_MMC5(mmc5,i,0x5011,((unsigned char)s->data8[dacPos]+0x80)); } dacPos++; if (s->isLoopable() && dacPos>=(unsigned int)s->loopEnd) { @@ -84,33 +98,8 @@ void DivPlatformMMC5::acquireDirect(blip_buffer_t** bb, size_t len) { } } } - */ - - - extcl_apu_tick_MMC5(mmc5,len); - break; - /* - if (mmc5->clocked) { - mmc5->clocked=false; - } - int sample=isMuted[0]?0:(mmc5->S3.output*10); - if (!isMuted[1]) { - sample+=mmc5->S4.output*10; - } - if (!isMuted[2]) { - sample+=mmc5->pcm.output*2; - } - if (sample>32767) sample=32767; - if (sample<-32768) sample=-32768; - buf[0][i]=sample; - - if (++writeOscBuf>=32) { - writeOscBuf=0; - oscBuf[0]->putSample(i,isMuted[0]?0:((mmc5->S3.output)<<11)); - oscBuf[1]->putSample(i,isMuted[1]?0:((mmc5->S4.output)<<11)); - oscBuf[2]->putSample(i,isMuted[2]?0:((mmc5->pcm.output)<<7)); - }*/ } + extcl_apu_tick_MMC5(mmc5,len); for (int i=0; i<3; i++) { oscBuf[i]->end(len); diff --git a/src/engine/platform/sound/nes/mmc5.cpp b/src/engine/platform/sound/nes/mmc5.cpp index a8d78dc82..dae78ef59 100644 --- a/src/engine/platform/sound/nes/mmc5.cpp +++ b/src/engine/platform/sound/nes/mmc5.cpp @@ -42,6 +42,9 @@ void map_init_MMC5(struct _mmc5* mmc5) { mmc5->oscBuf[0] = NULL; mmc5->oscBuf[1] = NULL; mmc5->oscBuf[2] = NULL; + + mmc5->S3.timer = 2048; + mmc5->S4.timer = 2048; } void extcl_cpu_wr_mem_MMC5(struct _mmc5* mmc5, int ts, WORD address, BYTE value) { if (address < 0x5000) {