diff --git a/src/engine/platform/ga20.cpp b/src/engine/platform/ga20.cpp index 1bab91e3b..e955b9d86 100644 --- a/src/engine/platform/ga20.cpp +++ b/src/engine/platform/ga20.cpp @@ -52,39 +52,23 @@ inline void DivPlatformGA20::chWrite(unsigned char ch, unsigned int addr, unsign } void DivPlatformGA20::acquire(short** buf, size_t len) { - if (ga20BufLenbegin(len); } for (size_t h=0; h>2; + ga20.sound_stream_update(ga20Buf,1); + buf[0][h]=(signed int)(ga20Buf[0]+ga20Buf[1]+ga20Buf[2]+ga20Buf[3])>>2; for (int i=0; i<4; i++) { - oscBuf[i]->putSample(h,ga20Buf[i][h]>>1); + oscBuf[i]->putSample(h,ga20Buf[i]>>1); } } @@ -94,43 +78,42 @@ void DivPlatformGA20::acquire(short** buf, size_t len) { } void DivPlatformGA20::acquireDirect(blip_buffer_t** bb, size_t off, size_t len) { - if (ga20BufLenbegin(len); } for (size_t h=off; h>2; + ga20.sound_stream_update(ga20Buf,advance+1); + h+=advance; + const int out=(signed int)(ga20Buf[0]+ga20Buf[1]+ga20Buf[2]+ga20Buf[3])>>2; if (out!=oldOut) { blip_add_delta(bb[0],h,out-oldOut); oldOut=out; } for (int i=0; i<4; i++) { - oscBuf[i]->putSample(h,ga20Buf[i][h]>>1); + oscBuf[i]->putSample(h,ga20Buf[i]>>1); } } @@ -420,7 +403,6 @@ void DivPlatformGA20::reset() { writes.clear(); memset(regPool,0,32); ga20.device_reset(); - delay=0; oldOut=0; for (int i=0; i<4; i++) { chan[i]=DivPlatformGA20::Channel(); @@ -561,7 +543,6 @@ int DivPlatformGA20::init(DivEngine* p, int channels, int sugRate, const DivConf } sampleMem=new unsigned char[getSampleMemCapacity()]; sampleMemLen=0; - delay=0; setFlags(flags); ga20BufLen=65536; for (int i=0; i<4; i++) ga20Buf[i]=new short[ga20BufLen]; diff --git a/src/engine/platform/ga20.h b/src/engine/platform/ga20.h index 4cc212308..2ff1dc2e9 100644 --- a/src/engine/platform/ga20.h +++ b/src/engine/platform/ga20.h @@ -58,7 +58,6 @@ class DivPlatformGA20: public DivDispatch, public iremga20_intf { unsigned int sampleOffGA20[256]; bool sampleLoaded[256]; - int delay; int oldOut; short* ga20Buf[4]; diff --git a/src/engine/platform/sound/ga20/iremga20.cpp b/src/engine/platform/sound/ga20/iremga20.cpp index 097de21d5..2e81b25d2 100644 --- a/src/engine/platform/sound/ga20/iremga20.cpp +++ b/src/engine/platform/sound/ga20/iremga20.cpp @@ -89,35 +89,32 @@ void iremga20_device::device_reset() // sound_stream_update - handle a stream update //------------------------------------------------- -void iremga20_device::sound_stream_update(short** outputs, int len) +void iremga20_device::sound_stream_update(short* outputs, int len) { - for (int i = 0; i < len; i++) + for (int j = 0; j < 4; j++) { - for (int j = 0; j < 4; j++) + channel_def &ch = m_channel[j]; + if (ch.play) { - channel_def &ch = m_channel[j]; - if (ch.play) + if (ch.sample == 0x00) // check for sample end marker + ch.play = false; + else { - if (ch.sample == 0x00) // check for sample end marker - ch.play = false; - else + if (ch.hot) { + ch.hot=false; + ch.output = ch.mute ? 0 : (ch.sample - 0x80) * (s32)ch.volume; + } + ch.counter-=len; + if (ch.counter <= ch.rate) { - if (ch.hot) { - ch.hot=false; - ch.output = ch.mute ? 0 : (ch.sample - 0x80) * (s32)ch.volume; - } - ch.counter--; - if (ch.counter <= ch.rate) - { - ch.pos++; - ch.counter = 0x100; - ch.sample = m_intf.read_byte(ch.pos); - ch.hot=true; - } + ch.pos++; + ch.counter = 0x100; + ch.sample = m_intf.read_byte(ch.pos); + ch.hot=true; } } - outputs[j][i] = ch.output; } + outputs[j] = ch.output; } } diff --git a/src/engine/platform/sound/ga20/iremga20.h b/src/engine/platform/sound/ga20/iremga20.h index ccc6e3b61..c13570d5b 100644 --- a/src/engine/platform/sound/ga20/iremga20.h +++ b/src/engine/platform/sound/ga20/iremga20.h @@ -6,7 +6,7 @@ DISCLAIMER - This file is modified for suitable in furnace. - - modified by cam900 + - modified by cam900 and tildearrow *********************************************************/ #ifndef MAME_SOUND_IREMGA20_H @@ -50,10 +50,9 @@ public: void device_reset(); // sound stream update overrides - void sound_stream_update(short** outputs, int len); + void sound_stream_update(short* outputs, int len); -private: struct channel_def { channel_def() : diff --git a/src/gui/debug.cpp b/src/gui/debug.cpp index 376ed250f..e5a1525c7 100644 --- a/src/gui/debug.cpp +++ b/src/gui/debug.cpp @@ -521,7 +521,6 @@ void putDispatchChip(void* data, int type) { DivPlatformGA20* ch=(DivPlatformGA20*)data; ImGui::Text("> GA20"); COMMON_CHIP_DEBUG; - ImGui::Text("- delay: %.2x",ch->delay); COMMON_CHIP_DEBUG_BOOL; break; }