Addressing audio plugin crash

Stereo buffer is not remade in the case of audio plugin
switch (only affects GBA, not GB).  This results in a crash.
We need to remake the stereo buffer and reinit the pointers
in Gba_Pcm.output or they will be dangling, and lead to a
crash.  Also, cleaning up the Multi_Buffer class a bit.
This commit is contained in:
Brian Searls 2020-08-09 20:35:17 -07:00 committed by Rafael Kitover
parent 9c314a155d
commit 1e5693009c
2 changed files with 11 additions and 5 deletions

View File

@ -58,10 +58,12 @@ class Multi_Buffer
}
// See Blip_Buffer.h
virtual long read_samples(blip_sample_t *, long)
BLARGG_PURE({ return 0; }) virtual long samples_avail() const BLARGG_PURE({ return 0; })
virtual long read_samples(blip_sample_t *, long) BLARGG_PURE({ return 0; })
virtual long samples_avail() const BLARGG_PURE({ return 0; })
public : BLARGG_DISABLE_NOTHROW void disable_immediate_removal()
BLARGG_DISABLE_NOTHROW
void disable_immediate_removal()
{
immediate_removal_ = false;
}

View File

@ -540,6 +540,10 @@ bool soundInit()
if (!soundDriver->init(soundSampleRate))
return false;
if (!stereo_buffer) {
remake_stereo_buffer();
}
soundPaused = true;
return true;
}