Skip to content

Commit

Permalink
Changed FFDShow DPL2 decoder to FreeSurround on OpenAL.
Browse files Browse the repository at this point in the history
Right now SoundTouch doesn't work with FreeSurround, but I made OpenAL frequency-shift the output so that no buffer-underrun can happen.

OpenAL's current audio latency is ~30ms (was 36ms), in addition to WASAPI, PulseAudio, ALSA etc latency.
  • Loading branch information
LAGonauta committed Apr 11, 2017
1 parent 36ab5ea commit c834012
Show file tree
Hide file tree
Showing 19 changed files with 12,164 additions and 71 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -657,8 +657,9 @@ if(OPENAL_FOUND)
else()
message(STATUS "Using static soundtouch from Externals")
add_subdirectory(Externals/soundtouch)
include_directories(Externals)
endif()
message(STATUS "Using static FreeSurround from Externals")
add_subdirectory(Externals/FreeSurround)
endif()

if(NOT ANDROID)
Expand Down
14 changes: 14 additions & 0 deletions Externals/FreeSurround/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(SRCS
source/ChannelMaps.cpp
source/KissFFT.cpp
source/KissFFTR.cpp
source/FreeSurroundDecoder.cpp
)

add_library(FreeSurround STATIC ${SRCS})
target_include_directories(FreeSurround PUBLIC include)
add_definitions(-w)
61 changes: 61 additions & 0 deletions Externals/FreeSurround/FreeSurround.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{8498F2FA-5CA6-4169-9971-DE5B1FE6132C}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\Source\VSProps\Base.props" />
<Import Project="..\..\Source\VSProps\ClDisableAllWarnings.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Lib>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="include\FreeSurround\ChannelMaps.h" />
<ClInclude Include="include\FreeSurround\FreeSurroundDecoder.h" />
<ClInclude Include="include\FreeSurround\KissFFT.h" />
<ClInclude Include="include\FreeSurround\KissFFTR.h" />
<ClInclude Include="include\FreeSurround\_KissFFTGuts.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="source\ChannelMaps.cpp" />
<ClCompile Include="source\FreeSurroundDecoder.cpp" />
<ClCompile Include="source\KissFFT.cpp" />
<ClCompile Include="source\KissFFTR.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
42 changes: 42 additions & 0 deletions Externals/FreeSurround/FreeSurround.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="source\ChannelMaps.cpp">
<Filter>source</Filter>
</ClCompile>
<ClCompile Include="source\FreeSurroundDecoder.cpp">
<Filter>source</Filter>
</ClCompile>
<ClCompile Include="source\KissFFT.cpp">
<Filter>source</Filter>
</ClCompile>
<ClCompile Include="source\KissFFTR.cpp">
<Filter>source</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\FreeSurround\_KissFFTGuts.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="include\FreeSurround\ChannelMaps.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="include\FreeSurround\FreeSurroundDecoder.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="include\FreeSurround\KissFFT.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="include\FreeSurround\KissFFTR.h">
<Filter>include</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="include">
<UniqueIdentifier>{776ecb31-6d5e-489f-bac9-b91a1b202345}</UniqueIdentifier>
</Filter>
<Filter Include="source">
<UniqueIdentifier>{11345325-d67c-4a21-b2e9-c7c6c8cfc8b4}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
36 changes: 36 additions & 0 deletions Externals/FreeSurround/include/FreeSurround/ChannelMaps.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
Copyright (C) 2010 Christian Kothe
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#ifndef CHANNELMAPS_H
#define CHANNELMAPS_H
#include "FreeSurroundDecoder.h"
#include <map>
#include <vector>

const int grid_res = 21; // resolution of the lookup grid

// channel allocation maps (per setup)
typedef std::vector<std::vector<float *>> alloc_lut;
extern std::map<unsigned, alloc_lut> chn_alloc;
// channel metadata maps (per setup)
extern std::map<unsigned, std::vector<float>> chn_angle;
extern std::map<unsigned, std::vector<float>> chn_xsf;
extern std::map<unsigned, std::vector<float>> chn_ysf;
extern std::map<unsigned, std::vector<channel_id>> chn_id;

#endif
Loading

0 comments on commit c834012

Please sign in to comment.