Skip to content

Commit

Permalink
Fix #687 again.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiw committed Apr 13, 2024
1 parent f9273d5 commit 40bc9c0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ if(NOT USE_STATIC_PORTAUDIO AND NOT USE_PULSEAUDIO)
message(FATAL_ERROR "portaudio library not found.
On Linux systems try installing:
portaudio-devel (RPM based systems)
libportaudio-dev (DEB based systems)
portaudio19-dev (DEB based systems)
On Windows it's easiest to use the cmake option: USE_STATIC_PORTAUDIO"
)
endif()
Expand Down
26 changes: 21 additions & 5 deletions src/audio/PortAudioEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,27 @@ std::vector<int> PortAudioEngine::getSupportedSampleRates(wxString deviceName, A
int rateIndex = 0;
while (IAudioEngine::StandardSampleRates[rateIndex] != -1)
{
PaError err = Pa_IsFormatSupported(
direction == AUDIO_ENGINE_IN ? &streamParameters : NULL,
direction == AUDIO_ENGINE_OUT ? &streamParameters : NULL,
IAudioEngine::StandardSampleRates[rateIndex]);

PaError err = paFormatIsSupported;

bool isDeviceWithKnownMinimum =
!strcmp(deviceName, "sysdefault") ||
!strcmp(deviceName, "front") ||
!strcmp(deviceName, "surround") ||
!strcmp(deviceName, "samplerate") ||
!strcmp(deviceName, "speexrate") ||
!strcmp(deviceName, "pulse") ||
!strcmp(deviceName, "upmix") ||
!strcmp(deviceName, "vdownmix") ||
!strcmp(deviceName, "dmix") ||
!strcmp(deviceName, "default");
if (!isDeviceWithKnownMinimum)
{
err = Pa_IsFormatSupported(
direction == AUDIO_ENGINE_IN ? &streamParameters : NULL,
direction == AUDIO_ENGINE_OUT ? &streamParameters : NULL,
IAudioEngine::StandardSampleRates[rateIndex]);
}

if (err == paFormatIsSupported)
{
result.push_back(IAudioEngine::StandardSampleRates[rateIndex]);
Expand Down

0 comments on commit 40bc9c0

Please sign in to comment.