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

[pull] master from FNA-XNA:master #2

Open
wants to merge 194 commits into
base: master
Choose a base branch
from
Open

Conversation

pull[bot]
Copy link

@pull pull bot commented Mar 8, 2021

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

@pull pull bot added the ⤵️ pull label Mar 8, 2021
W4RH4WK and others added 28 commits March 12, 2021 11:32
Fixes parsing for big-endian SoundBanks.
Fixes parsing for big-endian SoundBanks
incorrect frequency and q variation calculations.

Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
Even with the engine procedure callback, Wine has to swap it to another
thread in order for the application-provided callbacks to be executed in
the context of a Wine thread, and not the SDL audio created thread.

This will also allow Wine get rid of the FAudio SDL2 dependency, which
is desirable, considering we'll ultimately need FAudio built as PE.
We might overflow the read buffer otherwise.
flibitijibibo and others added 30 commits February 1, 2024 11:00
Add an ALIGN(type, boundary) macro with an MSVC equivalent using
__declspec(align(x)) to the gcc/clang-specific
__attribute__((aligned(x))). Fallback to no alignment for other
compilers.

Link system DLLs on Windows by name instead of as an -l linker flag,
cmake automatically produces the correct linker invocation on both MINGW
and MSVC.

Include <windows.h> with WIN32_LEAN_AND_MEAN defined instead of
including <windef.h> and <winbase.h>, because this breaks the Windows
header architecture detection on MSVC.

Define the GUIDs for IID_IAudioClient, IID_IAudioRenderClient,
IID_IMMDeviceEnumerator and CLSID_MMDeviceEnumerator for PLATFORM_WIN32
taken from the SDK headers, because MSVC cannot find the linkage for
them. Define them only for MSVC because MINGW throws a redeclaration
error.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This is a followup on 81d5a24 (build: fix building with MSVC,
2024-03-07).

Fix the missing trailing _ in __attribute__ for
__attribute((aligned(x))).

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This is a followup on 81d5a24 (build: fix building with MSVC,
2024-03-07) and 68a555e (build: fix __attribute__((aligned(x))) on
gcc/clang, 2024-03-09) for the purposes of creating a vcpkg FAudio port.

Add a `Requires.private: sdl2` to the pkgconf file for the SDL2
dependency when not using PLATFORM_WIN32.

Add the SDL2 dependency to the generated cmake config file when not
using PLATFORM_WIN32 as well.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Deadlock was being caused by the fact that some private FAudio routines
hold internal mutexes while calling application callbacks. This may result
in a deadlock because app might have a huge global mutex that is locked
both by callbacks and by some code that e.g. submits new buffers to XAudio.

Should fix https://bugs.winehq.org/show_bug.cgi?id=54246
This caused some issues with streaming audio playback in FNA.

This reverts commit a623edb.
And don't crash if the computer doesn't have any audio devices.

Fixes #347
Deadlock was being caused by the fact that some private FAudio routines
hold internal mutexes while calling application callbacks. This may result
in a deadlock because app might have a huge global mutex that is locked
both by callbacks and by some code that e.g. submits new buffers to XAudio.

Should fix https://bugs.winehq.org/show_bug.cgi?id=54246
Now that we release buffer lock before executing callbacks, some code
from another thread can get scheduled between mutex unlock and callback
call and observe empty buffer queue right before callback puts a new
buffer there. XNA_Song determines the end of the song by simply checking
if the queue is empty, which may lead to random playback breaks.

Not sure how to properly check for the song end but the buffer decoding
function also zeroes out total samples counter when it finishes a
EOS-flagged buffer so checking if that counter is zero should cut it...
probably?
Previously, we would crash when the audio device was disconnected.
Previously, FAudio with `PLATFORM_WIN32` would only list the default audio device. This reworks the FAudio `PLATFORM_WIN32` code to enable access to every audio device on the system. In order to preserve the existing behavior (and XAudio2 compabitility), the audio devices are re-ordered so the first device is always the default one.

In addition:

* Properly populates the `DisplayName` field in `FAudioDeviceDetails`. Previously, it was set to the device GUID.
* [windows] Return error code for DefaultDeviceIndex
* Rework `FAudio_DefaultDeviceIndex` to return the Windows API error code and take the `defaultDeviceIndex` as parameter.

Test: Local build with visualboyadvance-m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet