Skip to content

Commit

Permalink
Linux: update FAudio to 25.01 (#1029)
Browse files Browse the repository at this point in the history
  • Loading branch information
brakhane authored Jan 24, 2025
1 parent c0cbd84 commit 4d9bd4a
Show file tree
Hide file tree
Showing 37 changed files with 2,567 additions and 1,350 deletions.
54 changes: 47 additions & 7 deletions WickedEngine/Utility/FAudio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
# Based on upstream's CMakeLists.txt
# Changes compared to upstream:
# * cmake_minimum_required adjusted
# * unused options removed
# * windows related stuff removed
# * install rule added

# CMake Project for FAudio
# Written by @NeroBurner
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.12)
project(FAudio C)

# Options
option(BUILD_SHARED_LIBS "Build shared library" OFF)
option(BUILD_SDL3 "Build against SDL 3.0" OFF)

# C99 Requirement
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_EXTENSIONS OFF)

# Version
SET(LIB_MAJOR_VERSION "0")
SET(LIB_MINOR_VERSION "21")
SET(LIB_REVISION "09")
SET(LIB_MINOR_VERSION "25")
SET(LIB_REVISION "01")
SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_REVISION}")

# Build Type
Expand Down Expand Up @@ -50,7 +58,7 @@ add_library(FAudio STATIC
src/FAudio_internal.h
src/stb.h
src/stb_vorbis.h
src/matrix_defaults.inl
src/qoa_decoder.h
# Source Files
src/F3DAudio.c
src/FACT3D.c
Expand All @@ -69,10 +77,10 @@ add_library(FAudio STATIC
src/FAudio_internal_simd.c
src/FAudio_operationset.c
src/FAudio_platform_sdl2.c
src/FAudio_platform_sdl3.c
src/FAudio_platform_win32.c
# Optional source files
src/XNA_Song.c
src/FAudio_gstreamer.c
)

install(FILES ${PUBLIC_HEADERS}
Expand All @@ -92,9 +100,41 @@ set_target_properties(FAudio PROPERTIES
SOVERSION ${LIB_MAJOR_VERSION}
)

# SDL2 Dependency
# SDL Dependency
if (PLATFORM_WIN32)
message(STATUS "not using SDL2")
message(STATUS "not using SDL")
elseif (BUILD_SDL3)
if (DEFINED SDL3_INCLUDE_DIRS AND DEFINED SDL3_LIBRARIES)
message(STATUS "using pre-defined SDL3 variables SDL3_INCLUDE_DIRS and SDL3_LIBRARIES")
target_include_directories(FAudio PUBLIC "$<BUILD_INTERFACE:${SDL3_INCLUDE_DIRS}>")
target_link_libraries(FAudio PUBLIC ${SDL3_LIBRARIES})
if(INSTALL_MINGW_DEPENDENCIES)
install_shared_libs(${SDL3_LIBRARIES} DESTINATION bin NO_INSTALL_SYMLINKS)
endif()
else()
# Only try to autodetect if both SDL3 variables aren't explicitly set
find_package(SDL3 CONFIG)
if (TARGET SDL3::SDL3)
message(STATUS "using TARGET SDL3::SDL3")
target_link_libraries(FAudio PUBLIC SDL3::SDL3)
if(INSTALL_MINGW_DEPENDENCIES)
install_shared_libs(TARGETS SDL3::SDL3 DESTINATION bin NO_INSTALL_SYMLINKS REQUIRED)
endif()
elseif (TARGET SDL3)
message(STATUS "using TARGET SDL3")
target_link_libraries(FAudio PUBLIC SDL3)
if(INSTALL_MINGW_DEPENDENCIES)
install_shared_libs(TARGETS SDL3 DESTINATION bin NO_INSTALL_SYMLINKS REQUIRED)
endif()
else()
message(STATUS "no TARGET SDL3::SDL3, or SDL3, using variables")
target_include_directories(FAudio PUBLIC "$<BUILD_INTERFACE:${SDL3_INCLUDE_DIRS}>")
target_link_libraries(FAudio PUBLIC ${SDL3_LIBRARIES})
if(INSTALL_MINGW_DEPENDENCIES)
install_shared_libs(${SDL3_LIBRARIES} DESTINATION bin NO_INSTALL_SYMLINKS)
endif()
endif()
endif()
elseif (DEFINED SDL2_INCLUDE_DIRS AND DEFINED SDL2_LIBRARIES)
message(STATUS "using pre-defined SDL2 variables SDL2_INCLUDE_DIRS and SDL2_LIBRARIES")
target_include_directories(FAudio PUBLIC "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>")
Expand Down
2 changes: 1 addition & 1 deletion WickedEngine/Utility/FAudio/include/F3DAudio.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* FAudio - XAudio Reimplementation for FNA
*
* Copyright (c) 2011-2021 Ethan Lee, Luigi Auriemma, and the MonoGame Team
* Copyright (c) 2011-2024 Ethan Lee, Luigi Auriemma, and the MonoGame Team
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
Expand Down
2 changes: 1 addition & 1 deletion WickedEngine/Utility/FAudio/include/FACT.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* FAudio - XAudio Reimplementation for FNA
*
* Copyright (c) 2011-2021 Ethan Lee, Luigi Auriemma, and the MonoGame Team
* Copyright (c) 2011-2024 Ethan Lee, Luigi Auriemma, and the MonoGame Team
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
Expand Down
2 changes: 1 addition & 1 deletion WickedEngine/Utility/FAudio/include/FACT3D.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* FAudio - XAudio Reimplementation for FNA
*
* Copyright (c) 2011-2021 Ethan Lee, Luigi Auriemma, and the MonoGame Team
* Copyright (c) 2011-2024 Ethan Lee, Luigi Auriemma, and the MonoGame Team
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
Expand Down
2 changes: 1 addition & 1 deletion WickedEngine/Utility/FAudio/include/FAPO.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* FAudio - XAudio Reimplementation for FNA
*
* Copyright (c) 2011-2021 Ethan Lee, Luigi Auriemma, and the MonoGame Team
* Copyright (c) 2011-2024 Ethan Lee, Luigi Auriemma, and the MonoGame Team
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
Expand Down
2 changes: 1 addition & 1 deletion WickedEngine/Utility/FAudio/include/FAPOBase.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* FAudio - XAudio Reimplementation for FNA
*
* Copyright (c) 2011-2021 Ethan Lee, Luigi Auriemma, and the MonoGame Team
* Copyright (c) 2011-2024 Ethan Lee, Luigi Auriemma, and the MonoGame Team
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
Expand Down
2 changes: 1 addition & 1 deletion WickedEngine/Utility/FAudio/include/FAPOFX.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* FAudio - XAudio Reimplementation for FNA
*
* Copyright (c) 2011-2021 Ethan Lee, Luigi Auriemma, and the MonoGame Team
* Copyright (c) 2011-2024 Ethan Lee, Luigi Auriemma, and the MonoGame Team
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
Expand Down
72 changes: 69 additions & 3 deletions WickedEngine/Utility/FAudio/include/FAudio.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* FAudio - XAudio Reimplementation for FNA
*
* Copyright (c) 2011-2021 Ethan Lee, Luigi Auriemma, and the MonoGame Team
* Copyright (c) 2011-2024 Ethan Lee, Luigi Auriemma, and the MonoGame Team
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
Expand Down Expand Up @@ -239,6 +239,14 @@ typedef struct FAudioFilterParameters
float OneOverQ; /* [0, FAUDIO_MAX_FILTER_ONEOVERQ] */
} FAudioFilterParameters;

typedef struct FAudioFilterParametersEXT
{
FAudioFilterType Type;
float Frequency; /* [0, FAUDIO_MAX_FILTER_FREQUENCY] */
float OneOverQ; /* [0, FAUDIO_MAX_FILTER_ONEOVERQ] */
float WetDryMix; /* [0, 1] */
} FAudioFilterParametersEXT;

typedef struct FAudioBuffer
{
/* Either 0 or FAUDIO_END_OF_STREAM */
Expand Down Expand Up @@ -375,6 +383,7 @@ typedef struct FAudioXMA2WaveFormatEx
#define FAUDIO_DEFAULT_FILTER_TYPE FAudioLowPassFilter
#define FAUDIO_DEFAULT_FILTER_FREQUENCY FAUDIO_MAX_FILTER_FREQUENCY
#define FAUDIO_DEFAULT_FILTER_ONEOVERQ 1.0f
#define FAUDIO_DEFAULT_FILTER_WETDRYMIX_EXT 1.0f

#define FAUDIO_LOG_ERRORS 0x0001
#define FAUDIO_LOG_WARNINGS 0x0002
Expand Down Expand Up @@ -484,8 +493,8 @@ extern FAudioGUID DATAFORMAT_SUBTYPE_IEEE_FLOAT;
#define FAUDIO_TARGET_VERSION 8 /* Targeting compatibility with XAudio 2.8 */

#define FAUDIO_ABI_VERSION 0
#define FAUDIO_MAJOR_VERSION 21
#define FAUDIO_MINOR_VERSION 9
#define FAUDIO_MAJOR_VERSION 25
#define FAUDIO_MINOR_VERSION 1
#define FAUDIO_PATCH_VERSION 0

#define FAUDIO_COMPILED_VERSION ( \
Expand Down Expand Up @@ -909,6 +918,58 @@ FAUDIOAPI void FAudioVoice_GetOutputFilterParameters(
FAudioFilterParameters *pParameters
);

/* Sets the filter variables for a voice.
* This is only valid on voices with the USEFILTER flag.
*
* pParameters: See FAudioFilterParametersEXT for details.
* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.
*
* Returns 0 on success.
*/
FAUDIOAPI uint32_t FAudioVoice_SetFilterParametersEXT(
FAudioVoice* voice,
const FAudioFilterParametersEXT* pParameters,
uint32_t OperationSet
);

/* Requests the filter variables for a voice.
* This is only valid on voices with the USEFILTER flag.
*
* pParameters: See FAudioFilterParametersEXT for details.
*/
FAUDIOAPI void FAudioVoice_GetFilterParametersEXT(
FAudioVoice* voice,
FAudioFilterParametersEXT* pParameters
);

/* Sets the filter variables for a voice's output voice.
* This is only valid on sends with the USEFILTER flag.
*
* pDestinationVoice: An output voice from the voice's send list.
* pParameters: See FAudioFilterParametersEXT for details.
* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.
*
* Returns 0 on success.
*/
FAUDIOAPI uint32_t FAudioVoice_SetOutputFilterParametersEXT(
FAudioVoice* voice,
FAudioVoice* pDestinationVoice,
const FAudioFilterParametersEXT* pParameters,
uint32_t OperationSet
);

/* Requests the filter variables for a voice's output voice.
* This is only valid on sends with the USEFILTER flag.
*
* pDestinationVoice: An output voice from the voice's send list.
* pParameters: See FAudioFilterParametersEXT for details.
*/
FAUDIOAPI void FAudioVoice_GetOutputFilterParametersEXT(
FAudioVoice* voice,
FAudioVoice* pDestinationVoice,
FAudioFilterParametersEXT* pParameters
);

/* Sets the global volume of a voice.
*
* Volume: Amplitude ratio. 1.0f is default, 0.0f is silence.
Expand Down Expand Up @@ -1003,6 +1064,11 @@ FAUDIOAPI void FAudioVoice_GetOutputMatrix(
/* Removes this voice from the audio graph and frees memory. */
FAUDIOAPI void FAudioVoice_DestroyVoice(FAudioVoice *voice);

/*
* Returns S_OK on success and E_FAIL if voice could not be destroyed (e. g., because it is in use).
*/
FAUDIOAPI uint32_t FAudioVoice_DestroyVoiceSafeEXT(FAudioVoice *voice);

/* FAudioSourceVoice Interface */

/* Starts processing for a source voice.
Expand Down
2 changes: 1 addition & 1 deletion WickedEngine/Utility/FAudio/include/FAudioFX.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* FAudio - XAudio Reimplementation for FNA
*
* Copyright (c) 2011-2021 Ethan Lee, Luigi Auriemma, and the MonoGame Team
* Copyright (c) 2011-2024 Ethan Lee, Luigi Auriemma, and the MonoGame Team
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
Expand Down
10 changes: 6 additions & 4 deletions WickedEngine/Utility/FAudio/src/F3DAudio.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* FAudio - XAudio Reimplementation for FNA
*
* Copyright (c) 2011-2021 Ethan Lee, Luigi Auriemma, and the MonoGame Team
* Copyright (c) 2011-2024 Ethan Lee, Luigi Auriemma, and the MonoGame Team
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
Expand Down Expand Up @@ -1274,7 +1274,7 @@ static inline void CalculateMatrix(
}
}
}
else
else if (curConfig != NULL)
{
listenerToEmitter = VectorScale(emitterToListener, -1.0f);

Expand Down Expand Up @@ -1351,8 +1351,10 @@ static inline void CalculateMatrix(
}
}
}


}
else
{
FAudio_assert(0 && "Config info not found!");
}

/* TODO: add post check to validate values
Expand Down
Loading

0 comments on commit 4d9bd4a

Please sign in to comment.