Skip to content

Commit

Permalink
Fix Game Blaster, PS/1 Audio & Tandy audio issues at low host sample …
Browse files Browse the repository at this point in the history
…rates

Without this fix, these audio devices would fail in debug mode with an
assertion error if the host sample rate is between 16001 and 16059 Hz
(inclusive), and there is no sound if the host rate is 16000 Hz or
lower.

Most importantly, limiting the "highest accurate frequency" parameter
(`max_rate_hz` in the code) to at least 8000 Hz makes no sense at 16 kHz
or lower host rates.
  • Loading branch information
johnnovak committed Jun 19, 2024
1 parent fc2f7b3 commit aace331
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/hardware/gameblaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void GameBlaster::Open(const int port_choice, const std::string &card_choice,

// Set up the resampler to convert from the render rate to the mixer's
// frame rate
const auto max_rate_hz = std::max(sample_rate_hz * 0.9 / 2, 8000.0);
const auto max_rate_hz = sample_rate_hz * 0.9 / 2;
for (auto& r : resamplers) {
r.reset(reSIDfp::TwoPassSincResampler::create(render_rate_hz,
sample_rate_hz,
Expand Down
2 changes: 1 addition & 1 deletion src/hardware/ps1audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ Ps1Synth::Ps1Synth(const std::string& filter_choice)

// Setup the resampler
const auto channel_rate_hz = channel->GetSampleRate();
const auto max_rate_hz = std::max(channel_rate_hz * 0.9 / 2, 8000.0);
const auto max_rate_hz = channel_rate_hz * 0.9 / 2;
resampler.reset(reSIDfp::TwoPassSincResampler::create(render_rate_hz,
channel_rate_hz,
max_rate_hz));
Expand Down
2 changes: 1 addition & 1 deletion src/hardware/tandy_sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ TandyPSG::TandyPSG(const ConfigProfile config_profile, const bool is_dac_enabled
// Set up the resampler
const auto sample_rate_hz = channel->GetSampleRate();

const auto max_rate_hz = std::max(sample_rate_hz * 0.9 / 2, 8000.0);
const auto max_rate_hz = sample_rate_hz * 0.9 / 2;

resampler.reset(reSIDfp::TwoPassSincResampler::create(render_rate_hz,
sample_rate_hz,
Expand Down

0 comments on commit aace331

Please sign in to comment.