diff --git a/src/audio/IAudioEngine.cpp b/src/audio/IAudioEngine.cpp index 1723a6f2e..b94661493 100644 --- a/src/audio/IAudioEngine.cpp +++ b/src/audio/IAudioEngine.cpp @@ -24,8 +24,6 @@ int IAudioEngine::StandardSampleRates[] = { - 8000, 9600, - 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, diff --git a/src/main.cpp b/src/main.cpp index 30e85d70b..7d9013306 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3166,6 +3166,44 @@ bool MainFrame::validateSoundCardSetup() "Your %s device cannot be found and may have been removed from your system. Please reattach this device, close this message box and retry. If this fails, go to Tools->Audio Config... to check your settings.", failedDeviceName), wxT("Sound Device Not Found"), wxOK, this); } + else + { + const int MIN_SAMPLE_RATE = 16000; + int failedSampleRate = 0; + + // Validate sample rates + if (wxGetApp().appConfiguration.audioConfiguration.soundCard1In.deviceName != "none" && wxGetApp().appConfiguration.audioConfiguration.soundCard1In.sampleRate < MIN_SAMPLE_RATE) + { + failedDeviceName = wxGetApp().appConfiguration.audioConfiguration.soundCard1In.deviceName.get(); + failedSampleRate = wxGetApp().appConfiguration.audioConfiguration.soundCard1In.sampleRate; + canRun = false; + } + else if (wxGetApp().appConfiguration.audioConfiguration.soundCard1Out.deviceName != "none" && wxGetApp().appConfiguration.audioConfiguration.soundCard1Out.sampleRate < MIN_SAMPLE_RATE) + { + failedDeviceName = wxGetApp().appConfiguration.audioConfiguration.soundCard1Out.deviceName.get(); + failedSampleRate = wxGetApp().appConfiguration.audioConfiguration.soundCard1Out.sampleRate; + canRun = false; + } + else if (wxGetApp().appConfiguration.audioConfiguration.soundCard2In.deviceName != "none" && wxGetApp().appConfiguration.audioConfiguration.soundCard2In.sampleRate < MIN_SAMPLE_RATE) + { + failedDeviceName = wxGetApp().appConfiguration.audioConfiguration.soundCard2In.deviceName.get(); + failedSampleRate = wxGetApp().appConfiguration.audioConfiguration.soundCard2In.sampleRate; + canRun = false; + } + else if (wxGetApp().appConfiguration.audioConfiguration.soundCard2Out.deviceName != "none" && wxGetApp().appConfiguration.audioConfiguration.soundCard2Out.sampleRate < MIN_SAMPLE_RATE) + { + failedDeviceName = wxGetApp().appConfiguration.audioConfiguration.soundCard2Out.deviceName.get(); + failedSampleRate = wxGetApp().appConfiguration.audioConfiguration.soundCard2Out.sampleRate; + canRun = false; + } + + if (!canRun) + { + wxMessageBox(wxString::Format( + "Your %s device is set to use a sample rate of %d, which is less than the minimum of %d. Please go to Tools->Audio Config... to check your settings.", + failedDeviceName, failedSampleRate, MIN_SAMPLE_RATE), wxT("Sample Rate Too Low"), wxOK, this); + } + } engine->stop(); engine->setOnEngineError(nullptr, nullptr);