mirror of https://github.com/snes9xgit/snes9x.git
Allow use of Snes9x-side buffer if needed.
This commit is contained in:
parent
1a41ca21b3
commit
9994023f09
12
apu/apu.cpp
12
apu/apu.cpp
|
@ -224,24 +224,28 @@ static void UpdatePlaybackRate(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 S9xInitSound(int unused, int unused2)
|
bool8 S9xInitSound(int buffer_ms, int unused2)
|
||||||
{
|
{
|
||||||
// The resampler and spc unit use samples (16-bit short) as arguments.
|
// The resampler and spc unit use samples (16-bit short) as arguments.
|
||||||
|
int buffer_size_samples = MAX_SAMPLE_FRAMES * 2;
|
||||||
|
if (buffer_ms > 0)
|
||||||
|
buffer_size_samples = Settings.SoundPlaybackRate * buffer_ms * 2 / 1000;
|
||||||
|
|
||||||
if (!spc::resampler)
|
if (!spc::resampler)
|
||||||
{
|
{
|
||||||
spc::resampler = new HermiteResampler(MAX_SAMPLE_FRAMES * 2);
|
spc::resampler = new HermiteResampler(buffer_size_samples);
|
||||||
if (!spc::resampler)
|
if (!spc::resampler)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!msu::resampler)
|
if (!msu::resampler)
|
||||||
{
|
{
|
||||||
msu::resampler = new HermiteResampler(msu::buffer_size);
|
msu::resampler = new HermiteResampler(buffer_size_samples * 3 / 2);
|
||||||
if (!msu::resampler)
|
if (!msu::resampler)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
msu::resampler->resize(msu::buffer_size);
|
msu::resampler->resize(buffer_size_samples * 3 / 2);
|
||||||
|
|
||||||
reset_dsp_output();
|
reset_dsp_output();
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,10 @@ S9xPortSoundInit ()
|
||||||
|
|
||||||
Settings.SoundPlaybackRate = playback_rates[gui_config->sound_playback_rate];
|
Settings.SoundPlaybackRate = playback_rates[gui_config->sound_playback_rate];
|
||||||
|
|
||||||
S9xInitSound (gui_config->sound_buffer_size, 0);
|
if (gui_config->sound_driver == sdl_driver)
|
||||||
|
S9xInitSound(gui_config->sound_buffer_size, 0);
|
||||||
|
else
|
||||||
|
S9xInitSound(0, 0);
|
||||||
|
|
||||||
S9xSetSoundMute (false);
|
S9xSetSoundMute (false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue