Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect error from WASAPI on sample rate error #314

Closed
sveinse opened this issue Oct 3, 2020 · 3 comments · Fixed by #316
Closed

Incorrect error from WASAPI on sample rate error #314

sveinse opened this issue Oct 3, 2020 · 3 comments · Fixed by #316
Assignees
Labels
src-wasapi MS WASAPI Host API /src/hostapi/wasapi windows Affects MS Windows

Comments

@sveinse
Copy link
Contributor

sveinse commented Oct 3, 2020

Created from discussions in #303 about WASAPI glitching issues.

If a WASAPI device is opened in shared mode and not using the paWinWasapiAutoConvert flag, the device fails to open the audio device if the sample rate does not match the system rate (which is correct behavior). However PA returns an error "Invalid device", which is hard to understand.

Investigation reveals that the sample rate error (-9997) is detected properly but later mutated into another error (-9996 Invalid device). The latter error should not occur.

WASAPI: IAudioClient2 set properties: IsOffload = 0, Category = 0, Options = 0
WASAPI ERROR HRESULT: 0x88890008 : AUDCLNT_E_UNSUPPORTED_FORMAT
 [FUNCTION: CreateAudioClient FILE: \elns-wasapi\portaudio-pr307\src\hostapi\wasapi\pa_win_wasapi.c {LINE: 3132}]
WASAPI ERROR PAERROR: -9997 : Invalid sample rate
 [FUNCTION: ActivateAudioClientOutput FILE: \elns-wasapi\portaudio-pr307\src\hostapi\wasapi\pa_win_wasapi.c {LINE: 3449}]
WASAPI ERROR PAERROR: -9996 : Invalid device
 [FUNCTION: OpenStream FILE: \elns-wasapi\portaudio-pr307\src\hostapi\wasapi\pa_win_wasapi.c {LINE: 2143}]
An error occured while using the portaudio stream
Error number: -9996
Error message: Invalid device
ERROR: Opening audio device failed. OSError: [Errno -9996] Invalid device
@dmitrykos dmitrykos added the src-wasapi MS WASAPI Host API /src/hostapi/wasapi label Oct 3, 2020
@dmitrykos dmitrykos self-assigned this Oct 3, 2020
@dmitrykos dmitrykos added the windows Affects MS Windows label Oct 3, 2020
@dmitrykos
Copy link
Collaborator

@sveinse I created the pull request #316 to fix this issue, would you please check if it works for you. Logic is correct now.

@sveinse
Copy link
Contributor Author

sveinse commented Oct 5, 2020

@dmitrykos I confirm that PR #316 fixes the issue

@dmitrykos
Copy link
Collaborator

@sveinse thank you for a test and confirmation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
src-wasapi MS WASAPI Host API /src/hostapi/wasapi windows Affects MS Windows
Projects
None yet
2 participants