Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ Sound/XRSound/**/Release-with-OrbiterRelease/
.kdev/
[Bb]uild/

Extern/irrKlang

Doc/**/*.log
Doc/**/*.pdf
Doc/**/*.gz
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,6 @@ option(ORBITER_SANITIZER
OFF
)

if(ORBITER_BUILD_XRSOUND)
set(IRRKLANG_DIR "" CACHE PATH "Path to the irrKlang library")
endif()

if(ORBITER_BUILD_D3D9CLIENT)
find_package(DXSDK REQUIRED)
set(DXSDK_DIR
Expand Down
5 changes: 3 additions & 2 deletions Doc/Orbiter User Manual/CREDITS.tex
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ \subsection{Source contributions and components}
Steve Arch: TransX development \url{http://orbiter.quorg.org}

\subsection{Libraries, code, data, algorithms}
\textbf{IrrKlang}\\
\textbf{SDL3 and SDL3_mixer}\\
Audio and sound library\\
\url{https://www.ambiera.com/irrklang/}\\
\url{https://github.com/libsdl-org/SDL/}\\
\url{https://github.com/libsdl-org/SDL_mixer/}\\
\\
\textbf{Zlib}\\
Compression/decompression library\\
Expand Down
1 change: 1 addition & 0 deletions Extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ endif(NOT DEFINED ORBITER_BINARY_ROOT_DIR)

add_subdirectory(Lua)
add_subdirectory(zlib)
add_subdirectory(SDL3)

## LFS
add_library(lfs SHARED luafilesystem/src/lfs.c)
Expand Down
52 changes: 52 additions & 0 deletions Extern/SDL3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
project(SDL3)

Include(FetchContent)

set(SDL_SHARED ON)
set(SDL_STATIC OFF)
#set(SDL_INSTALL ON)


FetchContent_Declare(
SDL3
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
# GIT_TAG release-3.2.24
GIT_TAG 8824eace93de228032639f11df262df91a6257a4
OVERRIDE_FIND_PACKAGE
)
FetchContent_MakeAvailable(SDL3)

set_target_properties(SDL3-shared PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR}
LIBRARY_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR}
RUNTIME_OUTPUT_DIRECTORY ${ORBITER_BINARY_ROOT_DIR}
)

set_target_properties(SDL3_Headers PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${ORBITER_INSTALL_SDK_DIR}/include"
LIBRARY_OUTPUT_DIRECTORY "${ORBITER_INSTALL_SDK_DIR}/include"
RUNTIME_OUTPUT_DIRECTORY "${ORBITER_INSTALL_SDK_DIR}/include"
)

file(GLOB SDL3_HEADERS "${SDL3_SOURCE_DIR}/include/SDL3/*.h" "${SDL3_BINARY_DIR}/include-revision/SDL3/*.h")
file(COPY ${SDL3_HEADERS} DESTINATION "${ORBITER_BINARY_SDK_DIR}/include/SDL3")

install(TARGETS SDL3_Headers RUNTIME DESTINATION "${ORBITER_INSTALL_SDK_DIR}/include")
install(TARGETS SDL3-shared RUNTIME DESTINATION ${ORBITER_INSTALL_ROOT_DIR})

###############
## SDL_mixer ##
###############

set(BUILD_SHARED_LIBS ON)

FetchContent_Declare(
SDL3_mixer
GIT_REPOSITORY https://github.com/libsdl-org/SDL_mixer.git
GIT_TAG 5cdf029bae982df1d6c210f915fc151a616d982f
)
FetchContent_MakeAvailable(SDL3_mixer)

install(TARGETS SDL3_mixer-shared RUNTIME DESTINATION ${ORBITER_INSTALL_ROOT_DIR})
file(GLOB SDL3_MIXER_HEADERS "${SDL3_mixer_SOURCE_DIR}/include/SDL3_mixer/*.h")
file(COPY ${SDL3_MIXER_HEADERS} DESTINATION "${ORBITER_BINARY_SDK_DIR}/include/SDL3_Mixer")
50 changes: 1 addition & 49 deletions Sound/XRSound/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,49 +1,7 @@
## irrKlang
if(NOT IRRKLANG_DIR)
set(IRRKLANG_DIR ${EXTERN_DIR}/irrKlang/${ARCH})

if(NOT EXISTS ${IRRKLANG_DIR})
if(BUILD64)
set(IRRKLANG_URL https://www.ambiera.at/downloads/irrKlang-64bit-1.6.0.zip)
else()
set(IRRKLANG_URL https://www.ambiera.at/downloads/irrKlang-32bit-1.6.0.zip)
endif()

include(FetchContent)
FetchContent_Declare(irrKlang
URL ${IRRKLANG_URL}
SOURCE_DIR ${IRRKLANG_DIR}
DOWNLOAD_EXTRACT_TIMESTAMP ON
)

message("Downloading irrKlang from ${IRRKLANG_URL} ...")
FetchContent_MakeAvailable(irrKlang)

else()
message("Found existing irrKlang at ${IRRKLANG_DIR}")
endif()

elseif(NOT EXISTS ${IRRKLANG_DIR})
message(FATAL_ERROR "IRRKLANG_DIR does not exist")
endif()

if(BUILD64)
set(IRRKLANG_BIN_DIR ${IRRKLANG_DIR}/bin/winx64-visualStudio)
set(IRRKLANG_LIB_DIR ${IRRKLANG_DIR}/lib/Winx64-visualStudio)
else()
# because of a bug in the 32bit version of irrKlang (it has hidden "__MACOSX" dir),
# CMake does not strip the top-level directory
string(APPEND IRRKLANG_DIR /irrKlang-1.6.0)

set(IRRKLANG_BIN_DIR ${IRRKLANG_DIR}/bin/win32-visualStudio)
set(IRRKLANG_LIB_DIR ${IRRKLANG_DIR}/lib/Win32-visualStudio)
endif()
set(IRRKLANG_LIB ${IRRKLANG_LIB_DIR}/irrKlang.lib)

## XRSound
set(ASSET_DIR ${CMAKE_CURRENT_SOURCE_DIR}/assets)
set(SOLUTION_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(IRRKLANG_DLL_DIR ${IRRKLANG_DIR})

# Deploy assets
file(GLOB config_files ${ASSET_DIR}/XRSound/*.cfg)

Expand All @@ -55,9 +13,6 @@ add_custom_target(XRSound_assets ALL
COMMAND ${CMAKE_COMMAND} -E copy ${ASSET_DIR}/XRSound/ReadMe.txt ${ORBITER_BINARY_ROOT_DIR}/XRSound/
COMMAND ${CMAKE_COMMAND} -E copy "${ASSET_DIR}/Doc/XRSound User Manual.pdf" ${ORBITER_BINARY_ROOT_DIR}/Doc/
COMMAND ${CMAKE_COMMAND} -E copy ${SOLUTION_DIR}/XRSound.h ${ORBITER_BINARY_SDK_DIR}/XRSound/
COMMAND ${CMAKE_COMMAND} -E copy ${IRRKLANG_BIN_DIR}/ikpMP3.dll ${ORBITER_BINARY_ROOT_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${IRRKLANG_BIN_DIR}/ikpFlac.dll ${ORBITER_BINARY_ROOT_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${IRRKLANG_BIN_DIR}/irrKlang.dll ${ORBITER_BINARY_ROOT_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${ASSET_DIR}/XRSound/Default ${ORBITER_BINARY_ROOT_DIR}/XRSound/Default
)

Expand All @@ -73,8 +28,5 @@ install(DIRECTORY ${ORBITER_BINARY_ROOT_DIR}/XRSound/Default
install(FILES "${ORBITER_BINARY_ROOT_DIR}/Doc/XRSound User Manual.pdf"
DESTINATION ${ORBITER_INSTALL_DOC_DIR}/
)
install(FILES ${ORBITER_BINARY_ROOT_DIR}/ikpMP3.dll ${ORBITER_BINARY_ROOT_DIR}/ikpFlac.dll ${ORBITER_BINARY_ROOT_DIR}/irrKlang.dll
DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/
)

add_subdirectory(src)
33 changes: 0 additions & 33 deletions Sound/XRSound/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

=============================================================================

DEPENDENCIES:

1) XRSound uses the irrKlang Sound Engine.
See https://www.ambiera.com/irrklang/license.html for details
about the ikkLang license. Its license as of 31-July-2021 is quoted below:

The irrKlang License
irrKlang's source codes, documentation and binaries contained within the
distributed archive are copyright © Nikolaus Gebhardt / Ambiera 2001-2020.

The contents of the irrKlang distribution archive may not be redistributed,
reproduced, modified, transmitted, broadcast, published or adapted in any way,
shape or form, without the prior written consent of the owner, Nikolaus
Gebhardt.

The irrKlang.dll, irrKlang.so and libirrklang.dylib files may be
redistributed without the author's prior permission in non-commercial
products, and must remain unmodified except for compressing the file.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ''AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
16 changes: 4 additions & 12 deletions Sound/XRSound/assets/XRSound/XRSound.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,15 @@
#--------------------------------------------------------------------------
# Space-separated list of sound file extensions supported by XRSound.
#
# XRSound uses irrKlang Pro, which supports these sound file formats by default:
# XRSound uses SDL3_mixer, which supports these sound file formats by default:
#
# RIFF WAVE (*.wav)
# Ogg Vorbis (*.ogg)
# MPEG-1 Audio Layer 3 (*.mp3) [via ikpMP3.dll plugin, included]
# Free Lossless Audio Codec (*.flac) [via ikpFlac.dll plugin, included]
# Amiga Modules (*.mod)
# Impulse Tracker (*.it)
# Scream Tracker 3 (*.s3d)
# Fast Tracker 2 (*.xm)
# MPEG-1 Audio Layer 3 (*.mp3)
#
# Additional formats may be supported via plugins; visit
# https://www.ambiera.com/irrklang/ for more information.
#
# Default = .wav .ogg .mp3 .flac .mod .it .s3d .xm
# Default = .wav .ogg .mp3
#--------------------------------------------------------------------------
SupportedSoundFileTypes = .wav .ogg .mp3 .flac .mod .it .s3d .xm
SupportedSoundFileTypes = .wav .ogg .mp3

#--------------------------------------------------------------------------
# Sets the master volume for all sounds.
Expand Down
7 changes: 5 additions & 2 deletions Sound/XRSound/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ add_library(XRSound_dll SHARED
Resource.rc
Utils/ConfigFileParser.cpp
Utils/FileList.cpp
ISound.cpp
)

set_target_properties(XRSound_dll PROPERTIES
Expand All @@ -22,18 +23,20 @@ set_target_properties(XRSound_dll PROPERTIES
target_include_directories(XRSound_dll PUBLIC
${ORBITER_SOURCE_SDK_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/Utils
${IRRKLANG_DIR}/include
)

target_link_libraries(XRSound_dll
${ORBITER_LIB}
${ORBITER_SDK_LIB}
${IRRKLANG_LIB}
SDL3::SDL3-shared
SDL3_mixer::SDL3_mixer-shared
)

add_dependencies(XRSound_dll
${OrbiterTgt}
Orbitersdk
SDL3::SDL3-shared
SDL3_mixer::SDL3_mixer-shared
)

install(TARGETS XRSound_dll
Expand Down
2 changes: 1 addition & 1 deletion Sound/XRSound/src/DefaultSoundGroupPreSteps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ void MusicDefaultSoundGroupPreStep::clbkPreStep(const double simt, const double
if (!HasFocus())
return;

// To prevent intermittent music stuttering on Orbiter startup when Orbiter hangs for a full second, which starves the irrKLang engine,
// To prevent intermittent music stuttering on Orbiter startup,
// don't play any music until two seconds after simulation start.
if (simt < 2.0)
{
Expand Down
Loading
Loading