-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Change FFDShow DPL2 decoder to FreeSurround #5235
Conversation
All of this external library code should likely be placed into Externals, rather than AudioCommon, especially the FreeSurround stuff. |
df1627d
to
b491309
Compare
Just moved everything to Externals. |
Where is the CMakeLists.txt for non-Visual Studio platforms? |
b491309
to
b45f57e
Compare
CMakeLists.txt
Outdated
endif() | ||
message(STATUS "Using static FreeSurround from Externals") | ||
add_subdirectory(Externals/FreeSurround) | ||
include_directories(Externals) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
FreeSurroundDecoder.cpp | ||
) | ||
|
||
add_library(FreeSurround STATIC ${SRCS}) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
c834012
to
02d066e
Compare
I noticed that I had forgotten to update the References on the Debug build for Visual Studio. Now everything should compile fine there. I am doing experiments on padding the values to not only be able to use SoundTouch but also to allow its use on other backends. I noticed that PulseAudio, for example, rarely returns the desired 512 samples, it oscillates over it (505-520). Even though some days ago SoundTouch had horrible latency when forcing the output of 512 samples (for me), I found out the latency is bearable when changing the default periods and period size on OpenAL Soft's config file to small numbers like 3 and 128, respectively. Maybe on the OpenAL backend we can just do that? Personally I prefer to use OpenAL's frequency-shifter. |
f37f0e1
to
1f0aaa4
Compare
Just rebased this PR with the changes from merry's audio-stretching PR. |
Nothing you can do on your end, buildbot has a size limit on patches it can receive, and it seems our monkey-patch for that got lost in the upgrade. delroth knows, but he's on vacation and probably won't work on it until he's back. |
CMakeLists.txt
Outdated
@@ -650,6 +650,10 @@ else() | |||
endif() | |||
|
|||
find_package(OpenAL) | |||
if(OPENAL_FOUND) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
418cf32
to
e6b3785
Compare
|
||
add_library(FreeSurround STATIC ${SRCS}) | ||
target_include_directories(FreeSurround PUBLIC include) | ||
add_definitions(-w) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
source/KissFFT.cpp | ||
source/KissFFTR.cpp | ||
source/FreeSurroundDecoder.cpp | ||
) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
e6b3785
to
c067237
Compare
4af908b
to
8742ff6
Compare
Just rebased because of Cubeb. I will also try to add support for FreeSurround on Cubeb, but right now it is not respecting how many frames I ask for. |
8742ff6
to
bf092da
Compare
@LAGonauta I said a few things on IRC before I realized you were gone :)
|
<PropertyGroup Label="UserMacros" /> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<Lib> | ||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -78,6 +88,9 @@ | |||
<ProjectReference Include="$(CoreDir)Common\Common.vcxproj"> | |||
<Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project> | |||
</ProjectReference> | |||
<ProjectReference Include="..\..\..\Externals\FreeSurround\FreeSurround.vcxproj"> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -35,6 +35,16 @@ | |||
<Import Project="..\..\VSProps\PCHUse.props" /> | |||
</ImportGroup> | |||
<PropertyGroup Label="UserMacros" /> | |||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | |||
<ClCompile> | |||
<AdditionalIncludeDirectories>$(ExternalsDir)FreeSurround\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@ligfx No, the first callback asks for 960 frames while all other callback asks for 480 (may depend on the CPU usage, I guess). No callback ever asks for 512 frames. |
a2bec0e
to
fe8a560
Compare
Anything I can do to make this PR move forward for merge? |
85bb9f4
to
f52cece
Compare
f52cece
to
9db41cc
Compare
After extensive testing I found that it is still needed to clamp some rare samples depending on the game, re-added that function for better user experience. Also rebased the branch to the current master. |
9db41cc
to
3eceb86
Compare
Recently had the time try to find out what caused the glitches on Ubuntu 16.04 and they seem to have been fixed when using a fully updated distro. Yay! I guess? |
3eceb86
to
78dfd70
Compare
This PR seems fine to me, tbh my guess would be that people aren't merging it just because not many people have a way to test it... |
it's work fine on android, thx. |
It's a shame that the reviewers are ignoring this PR, some of us would love to get surround sound working correctly without having to rely on inconsistent pro logic support on modern HTIB systems and sound bars. In the meantime, LAGonauta, could you do a pull from master to keep your fork up to date? I'll be testing this soon on my HTPC that is connected to a surround sound system. |
78dfd70
to
24c83c9
Compare
@DanLaRoche Just rebased and pushed. |
The code seems fine to me, aside from a few small nitpicks (e.g. replace the clamping by if/else with MathUtil::Clamp). But I'm not very familiar with the audio side of Dolphin, so I'm probably not the best person to review it. But it's a shame for this to be sitting around, so unless anyone has any better ideas, I could merge it as-is and deal with any regressions later. |
@LAGonauta Needs another rebase. I have a 5.1 setup my self and I'm sad at the gaming/PC HW audio industry, audio is extremely underappreciated in general, so my hat off for this PR. |
Also cleaned up its source code to support only 5.1 and 7.1 setups.
Added class in AudioCommon for the surround decoder
Also removed minimum number of frames needed when decoding DPL2, and use std::numeric_limits to clamp the samples when needed. Clamping is still needed, but those samples are much rarer now and depend on the game.
24c83c9
to
c209d07
Compare
@ghost |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming this has been tested, and so far there's no objections to it being merged as-is. Had a quick look through the code again and can't see any major issues.
Hi, I have made more tests. With the above settings, using HLE and LLE Interpreter I get bad sound too. |
Investigated a little bit and it seems this is happening and it seems that the non-uniform number of samples output from SoundTouch might be doing that... I need to investigate more. |
Hi |
Added the FreeSurround decoder to the mixer, and removed the legacy FFDShow decoder.
The decoding is done through the new SurroundDecoder class using a FixedSizeQueue as a ring buffer as the decoder needs a fixed amount of frames to be able to decode the surround information.
Tested on XAudio2 (with PR #6171), OpenAL, and Cubeb on Windows.
Also tested on OpenAL, Cubeb, and PulseAudio on Ubuntu, but Cubeb seems to be downmixing the surround information to stereo. Works on Windows, so maybe there is a bug in Cubeb library associated with Linux.
The upmix works really well, but I am not sure if we should set SURROUND_BLOCK_SIZE to 1024, 512, or even 256. All work, but the algorithm has more quality with 1024, less steering glitches and less crosstalk. For now I set it to 512 for an OK mix of quality and latency. The best quality is with SURROUND_FRAMES_PER_CALL set to 4096, but the latency seems to be equivalent to time-stretching with a buffer size of 80 ms.
Fixes bug #9047.
The new decoder seems to have some kind of incompatibility with some distros (Ubuntu 16.04, for example) as it causes glitches on decode. I will investigate the glitches later.It seems that a fully updated Ubuntu 16.04 distro does not show this behaviour anymore.
Any suggestion is greatly appreciated :)