Allow use of Snes9x-side buffer if needed.

This commit is contained in:
Brandon Wright 2019-02-05 19:56:59 -06:00
parent 1a41ca21b3
commit 9994023f09
2 changed files with 12 additions and 5 deletions

View File

@ -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.
int buffer_size_samples = MAX_SAMPLE_FRAMES * 2;
if (buffer_ms > 0)
buffer_size_samples = Settings.SoundPlaybackRate * buffer_ms * 2 / 1000;
if (!spc::resampler)
{
spc::resampler = new HermiteResampler(MAX_SAMPLE_FRAMES * 2);
spc::resampler = new HermiteResampler(buffer_size_samples);
if (!spc::resampler)
return (FALSE);
}
if (!msu::resampler)
{
msu::resampler = new HermiteResampler(msu::buffer_size);
msu::resampler = new HermiteResampler(buffer_size_samples * 3 / 2);
if (!msu::resampler)
return (FALSE);
}
else
msu::resampler->resize(msu::buffer_size);
msu::resampler->resize(buffer_size_samples * 3 / 2);
reset_dsp_output();

View File

@ -144,7 +144,10 @@ S9xPortSoundInit ()
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);
}