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:
parent
9c314a155d
commit
1e5693009c
|
@ -47,8 +47,8 @@ class Multi_Buffer
|
||||||
// See Blip_Buffer.h
|
// See Blip_Buffer.h
|
||||||
virtual void end_frame(blip_time_t) BLARGG_PURE({})
|
virtual void end_frame(blip_time_t) BLARGG_PURE({})
|
||||||
|
|
||||||
// Number of samples per output frame (1 = mono, 2 = stereo)
|
// Number of samples per output frame (1 = mono, 2 = stereo)
|
||||||
int samples_per_frame() const;
|
int samples_per_frame() const;
|
||||||
|
|
||||||
// Count of changes to channel configuration. Incremented whenever
|
// Count of changes to channel configuration. Incremented whenever
|
||||||
// a change is made to any of the Blip_Buffers for any channel.
|
// a change is made to any of the Blip_Buffers for any channel.
|
||||||
|
@ -58,10 +58,12 @@ class Multi_Buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
// See Blip_Buffer.h
|
// See Blip_Buffer.h
|
||||||
virtual long read_samples(blip_sample_t *, long)
|
virtual long read_samples(blip_sample_t *, long) BLARGG_PURE({ return 0; })
|
||||||
BLARGG_PURE({ return 0; }) virtual long samples_avail() const 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;
|
immediate_removal_ = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -540,6 +540,10 @@ bool soundInit()
|
||||||
if (!soundDriver->init(soundSampleRate))
|
if (!soundDriver->init(soundSampleRate))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!stereo_buffer) {
|
||||||
|
remake_stereo_buffer();
|
||||||
|
}
|
||||||
|
|
||||||
soundPaused = true;
|
soundPaused = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue