GBHawk: Attempt to fix audio crash
This commit is contained in:
parent
58240dfe05
commit
123df38731
|
@ -117,6 +117,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_bufferPool.Release(_sourceVoice.State.BuffersQueued);
|
_bufferPool.Release(_sourceVoice.State.BuffersQueued);
|
||||||
int byteCount = sampleCount * Sound.BlockAlign;
|
int byteCount = sampleCount * Sound.BlockAlign;
|
||||||
var buffer = _bufferPool.Obtain(byteCount);
|
var buffer = _bufferPool.Obtain(byteCount);
|
||||||
|
if (byteCount > (samples.Length * 2)) { byteCount = samples.Length * 2; }
|
||||||
Buffer.BlockCopy(samples, 0, buffer.Bytes, 0, byteCount);
|
Buffer.BlockCopy(samples, 0, buffer.Bytes, 0, byteCount);
|
||||||
_sourceVoice.SubmitSourceBuffer(new AudioBuffer
|
_sourceVoice.SubmitSourceBuffer(new AudioBuffer
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,8 +12,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
{
|
{
|
||||||
public GBHawk Core { get; set; }
|
public GBHawk Core { get; set; }
|
||||||
|
|
||||||
private readonly BlipBuffer _blip_L = new BlipBuffer(15000);
|
private BlipBuffer _blip_L = new BlipBuffer(15000);
|
||||||
private readonly BlipBuffer _blip_R = new BlipBuffer(15000);
|
private BlipBuffer _blip_R = new BlipBuffer(15000);
|
||||||
|
|
||||||
public static int[] DUTY_CYCLES = new int[] {0, 0, 0, 0, 0, 0, 0, 1,
|
public static int[] DUTY_CYCLES = new int[] {0, 0, 0, 0, 0, 0, 0, 1,
|
||||||
1, 0, 0, 0, 0, 0, 0, 1,
|
1, 0, 0, 0, 0, 0, 0, 1,
|
||||||
|
@ -1117,12 +1117,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public void DisposeSound()
|
public void DisposeSound()
|
||||||
{
|
{
|
||||||
|
_blip_L.Clear();
|
||||||
|
_blip_R.Clear();
|
||||||
_blip_L.Dispose();
|
_blip_L.Dispose();
|
||||||
_blip_R.Dispose();
|
_blip_R.Dispose();
|
||||||
|
_blip_L = null;
|
||||||
|
_blip_R = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue