You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a program crash in Wine today and discovered that it was because the computer was a virtual machine with no audio hardware and FAudio does not handle that situation gracefully. Here is a small test program that behaves similarly to the program I was running. It runs fine on Windows if compiled to use XAudio instead of FAudio.
Test program
/*GetDeviceDetails-test.cCopyright 2024 Alex HenrieThis work is marked with CC0 1.0. To view a copy of this license, visithttps://creativecommons.org/publicdomain/zero/1.0/Testing on Wine---------------Compile FAudio with: mkdir build cd build i686-w64-mingw32-cmake -DPLATFORM_WIN32=1 .. makeCompile the test with: i686-w64-mingw32-cc GetDeviceDetails-test.c -Iinclude -Lbuild -lFAudio.dll -o GetDeviceDetails-test.exeRun the test with: cp build/FAudio.dll . cp /usr/i686-w64-mingw32/bin/libssp-0.dll . WINEDLLOVERRIDES=winepulse.drv,winealsa.drv=n wine GetDeviceDetails-test.exeTesting on Windows------------------Compile the test with: i686-w64-mingw32-cc GetDeviceDetails-test.c -Iinclude -DUSE_XAUDIO -lole32 -o GetDeviceDetails-test.exeRun the test with: GetDeviceDetails-test.exe*/#include<FAudio.h>#include<stdio.h>#ifdefUSE_XAUDIO#defineCOBJMACROS
#include <initguid.h>
#include<xaudio2.h>#defineFAudio IXAudio27
#defineFAudio_Initialize IXAudio27_Initialize
#defineFAudioDeviceDetails XAUDIO2_DEVICE_DETAILS
#defineFAudio_GetDeviceCount IXAudio27_GetDeviceCount
#defineFAudio_GetDeviceDetails IXAudio27_GetDeviceDetails
#endifintmain()
{
uint32_thr;
FAudio*fa;
uint32_tdevice_count;
FAudioDeviceDetailsdevice_details;
#ifndefUSE_XAUDIOhr=FAudioCreate((void*)&fa, 0, FAUDIO_DEFAULT_PROCESSOR);
printf("AudioCreate returned 0x%x\n", hr);
#elseCoInitialize(NULL);
hr=CoCreateInstance(&CLSID_XAudio27, NULL, CLSCTX_INPROC_SERVER, &IID_IXAudio27, (void**)&fa);
printf("CoCreateInstance returned 0x%x\n", hr);
hr=IXAudio27_Initialize(fa, 0, XAUDIO2_ANY_PROCESSOR);
printf("Initialize returned 0x%x\n", hr);
#endifhr=FAudio_GetDeviceCount(fa, &device_count);
printf("GetDeviceCount returned 0x%x, device_count=%d\n", hr, device_count);
hr=FAudio_GetDeviceDetails(fa, 0, &device_details);
printf("GetDeviceDetails returned 0x%x\n", hr);
return0;
}
Expected output
AudioCreate returned 0x0
GetDeviceCount returned 0x0, device_count=0
GetDeviceDetails returned 0x88960001
Actual output
AudioCreate returned 0x0
GetDeviceCount returned 0x0, device_count=0
0024:err:msvcrt:_wassert (L"!FAILED(hr) && \"Failed to get default audio endpoint!\"",L"/home/alex/workspace/faudio/src/FAudio_platform_win32.c",454)
Assertion failed: !FAILED(hr) && "Failed to get default audio endpoint!", file /home/alex/workspace/faudio/src/FAudio_platform_win32.c, line 454
The text was updated successfully, but these errors were encountered:
alexhenrie
added a commit
to alexhenrie/FAudio
that referenced
this issue
May 9, 2024
I had a program crash in Wine today and discovered that it was because the computer was a virtual machine with no audio hardware and FAudio does not handle that situation gracefully. Here is a small test program that behaves similarly to the program I was running. It runs fine on Windows if compiled to use XAudio instead of FAudio.
Test program
Expected output
Actual output
The text was updated successfully, but these errors were encountered: