diff --git a/src/engine/platform/ay.cpp b/src/engine/platform/ay.cpp index 08c310138..813a8e159 100644 --- a/src/engine/platform/ay.cpp +++ b/src/engine/platform/ay.cpp @@ -249,13 +249,7 @@ void DivPlatformAY8910::checkWrites() { } void DivPlatformAY8910::acquire_mame(short** buf, size_t len) { - if (ayBufLenbegin(len); @@ -268,7 +262,7 @@ void DivPlatformAY8910::acquire_mame(short** buf, size_t len) { checkWrites(); ay->sound_stream_update(ayBuf,1); - buf[0][i]=ayBuf[0][0]; + buf[0][i]=ayBuf[0]; buf[1][i]=buf[0][i]; oscBuf[0]->putSample(i,CLAMP(sunsoftVolTable[31-(ay->lastIndx&31)]<<3,-32768,32767)); @@ -283,16 +277,16 @@ void DivPlatformAY8910::acquire_mame(short** buf, size_t len) { ay->sound_stream_update(ayBuf,1); if (stereo) { - buf[0][i]=ayBuf[0][0]+ayBuf[1][0]+((ayBuf[2][0]*stereoSep)>>8); - buf[1][i]=((ayBuf[0][0]*stereoSep)>>8)+ayBuf[1][0]+ayBuf[2][0]; + buf[0][i]=ayBuf[0]+ayBuf[1]+((ayBuf[2]*stereoSep)>>8); + buf[1][i]=((ayBuf[0]*stereoSep)>>8)+ayBuf[1]+ayBuf[2]; } else { - buf[0][i]=ayBuf[0][0]+ayBuf[1][0]+ayBuf[2][0]; + buf[0][i]=ayBuf[0]+ayBuf[1]+ayBuf[2]; buf[1][i]=buf[0][i]; } - oscBuf[0]->putSample(i,ayBuf[0][0]<<2); - oscBuf[1]->putSample(i,ayBuf[1][0]<<2); - oscBuf[2]->putSample(i,ayBuf[2][0]<<2); + oscBuf[0]->putSample(i,ayBuf[0]<<2); + oscBuf[1]->putSample(i,ayBuf[1]<<2); + oscBuf[2]->putSample(i,ayBuf[2]<<2); } } @@ -1185,8 +1179,6 @@ int DivPlatformAY8910::init(DivEngine* p, int channels, int sugRate, const DivCo } ay=NULL; setFlags(flags); - ayBufLen=65536; - for (int i=0; i<3; i++) ayBuf[i]=new short[ayBufLen]; reset(); return 3; } @@ -1194,7 +1186,6 @@ int DivPlatformAY8910::init(DivEngine* p, int channels, int sugRate, const DivCo void DivPlatformAY8910::quit() { for (int i=0; i<3; i++) { delete oscBuf[i]; - delete[] ayBuf[i]; } if (ay!=NULL) delete ay; } diff --git a/src/engine/platform/ay.h b/src/engine/platform/ay.h index e6ed671d7..fa3a4a522 100644 --- a/src/engine/platform/ay.h +++ b/src/engine/platform/ay.h @@ -145,8 +145,6 @@ class DivPlatformAY8910: public DivDispatch { unsigned short ayEnvPeriod; short ayEnvSlideLow; short ayEnvSlide; - short* ayBuf[3]; - size_t ayBufLen; void checkWrites(); void updateOutSel(bool immediate=false); diff --git a/src/engine/platform/ay8930.cpp b/src/engine/platform/ay8930.cpp index 103f9ffd1..5aee28890 100644 --- a/src/engine/platform/ay8930.cpp +++ b/src/engine/platform/ay8930.cpp @@ -165,14 +165,7 @@ void DivPlatformAY8930::checkWrites() { } void DivPlatformAY8930::acquire(short** buf, size_t len) { - if (ayBufLenbegin(len); } @@ -183,16 +176,16 @@ void DivPlatformAY8930::acquire(short** buf, size_t len) { ay->sound_stream_update(ayBuf,1); if (stereo) { - buf[0][i]=ayBuf[0][0]+ayBuf[1][0]+((ayBuf[2][0]*stereoSep)>>8); - buf[1][i]=((ayBuf[0][0]*stereoSep)>>8)+ayBuf[1][0]+ayBuf[2][0]; + buf[0][i]=ayBuf[0]+ayBuf[1]+((ayBuf[2]*stereoSep)>>8); + buf[1][i]=((ayBuf[0]*stereoSep)>>8)+ayBuf[1]+ayBuf[2]; } else { - buf[0][i]=ayBuf[0][0]+ayBuf[1][0]+ayBuf[2][0]; + buf[0][i]=ayBuf[0]+ayBuf[1]+ayBuf[2]; buf[1][i]=buf[0][i]; } - oscBuf[0]->putSample(i,ayBuf[0][0]<<2); - oscBuf[1]->putSample(i,ayBuf[1][0]<<2); - oscBuf[2]->putSample(i,ayBuf[2][0]<<2); + oscBuf[0]->putSample(i,ayBuf[0]<<2); + oscBuf[1]->putSample(i,ayBuf[1]<<2); + oscBuf[2]->putSample(i,ayBuf[2]<<2); } for (int i=0; i<3; i++) { @@ -949,8 +942,6 @@ int DivPlatformAY8930::init(DivEngine* p, int channels, int sugRate, const DivCo setFlags(flags); ay=new ay8930_device(rate,clockSel); ay->device_start(); - ayBufLen=65536; - for (int i=0; i<3; i++) ayBuf[i]=new short[ayBufLen]; reset(); return 3; } @@ -958,7 +949,6 @@ int DivPlatformAY8930::init(DivEngine* p, int channels, int sugRate, const DivCo void DivPlatformAY8930::quit() { for (int i=0; i<3; i++) { delete oscBuf[i]; - delete[] ayBuf[i]; } delete ay; } diff --git a/src/engine/platform/ay8930.h b/src/engine/platform/ay8930.h index 726e07728..a902b37ed 100644 --- a/src/engine/platform/ay8930.h +++ b/src/engine/platform/ay8930.h @@ -121,8 +121,6 @@ class DivPlatformAY8930: public DivDispatch { short oldWrites[32]; short pendingWrites[32]; - short* ayBuf[3]; - size_t ayBufLen; void runDAC(); void checkWrites(); diff --git a/src/engine/platform/sound/ay8910.cpp b/src/engine/platform/sound/ay8910.cpp index 530b03d0c..5a3309929 100644 --- a/src/engine/platform/sound/ay8910.cpp +++ b/src/engine/platform/sound/ay8910.cpp @@ -1035,7 +1035,7 @@ void ay8910_device::ay8910_write_reg(int r, int v) // sound_stream_update - handle a stream update //------------------------------------------------- -void ay8910_device::sound_stream_update(short** outputs, int outLen) +void ay8910_device::sound_stream_update(short* outputs, int outLen) { tone_t *tone; envelope_t *envelope; @@ -1046,7 +1046,7 @@ void ay8910_device::sound_stream_update(short** outputs, int outLen) if (!m_ready) { for (int chan = 0; chan < m_streams; chan++) - memset(outputs[chan],0,outLen*sizeof(short)); + outputs[chan]=0; } /* The 8910 has three outputs, each output is the mix of one of the three */ @@ -1162,38 +1162,38 @@ void ay8910_device::sound_stream_update(short** outputs, int outLen) { env_volume >>= 1; if (m_feature & PSG_EXTENDED_ENVELOPE) // AY8914 Has a two bit tone_envelope field - outputs[chan][sampindex]=m_vol_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0]; + outputs[chan]=m_vol_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0]; else - outputs[chan][sampindex]=m_vol_table[chan][m_vol_enabled[chan] ? env_volume : 0]; + outputs[chan]=m_vol_table[chan][m_vol_enabled[chan] ? env_volume : 0]; } else { if (m_feature & PSG_EXTENDED_ENVELOPE) // AY8914 Has a two bit tone_envelope field - outputs[chan][sampindex]=m_env_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0]; + outputs[chan]=m_env_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0]; else - outputs[chan][sampindex]=m_env_table[chan][m_vol_enabled[chan] ? env_volume : 0]; + outputs[chan]=m_env_table[chan][m_vol_enabled[chan] ? env_volume : 0]; } } else { if (m_feature & PSG_EXTENDED_ENVELOPE) // AY8914 Has a two bit tone_envelope field - outputs[chan][sampindex]=m_env_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0]; + outputs[chan]=m_env_table[chan][m_vol_enabled[chan] ? env_volume >> (3-tone_envelope(tone)) : 0]; else - outputs[chan][sampindex]=m_env_table[chan][m_vol_enabled[chan] ? env_volume : 0]; + outputs[chan]=m_env_table[chan][m_vol_enabled[chan] ? env_volume : 0]; } } else { if (is_expanded_mode()) - outputs[chan][sampindex]=m_env_table[chan][m_vol_enabled[chan] ? tone_volume(tone) : 0]; + outputs[chan]=m_env_table[chan][m_vol_enabled[chan] ? tone_volume(tone) : 0]; else - outputs[chan][sampindex]=m_vol_table[chan][m_vol_enabled[chan] ? tone_volume(tone) : 0]; + outputs[chan]=m_vol_table[chan][m_vol_enabled[chan] ? tone_volume(tone) : 0]; } } } else { - outputs[0][sampindex]=mix_3D(); + outputs[0]=mix_3D(); } } } diff --git a/src/engine/platform/sound/ay8910.h b/src/engine/platform/sound/ay8910.h index 6f4c6f318..d56eb6feb 100644 --- a/src/engine/platform/sound/ay8910.h +++ b/src/engine/platform/sound/ay8910.h @@ -158,7 +158,7 @@ public: void device_reset(); // sound stream update overrides - void sound_stream_update(short** outputs, int outLen); + void sound_stream_update(short* outputs, int outLen); void ay8910_write_ym(int addr, unsigned char data); unsigned char ay8910_read_ym();