Skip to content

Commit 34d4f1e

Browse files
authored
Switch to libxmp for tracker music (#721)
* Revert "Merge pull request #678 from qookei/libopenmpt" This reverts commit afa3eea, reversing changes made to 0653a51. * Switch to libxmp for tracker music * Set initial volume * Update vcpkg.json
1 parent 6397cc7 commit 34d4f1e

15 files changed

+289
-385
lines changed

.github/workflows/continuous_integration.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
${{ matrix.config.msys-env }}-cmake
8484
${{ matrix.config.msys-env }}-ninja
8585
${{ matrix.config.msys-env }}-pkgconf
86-
${{ matrix.config.msys-env }}-libopenmpt
86+
${{ matrix.config.msys-env }}-libxmp
8787
${{ matrix.config.msys-env }}-fluidsynth
8888
${{ matrix.config.msys-env }}-libmad
8989
${{ matrix.config.msys-env }}-libvorbis
@@ -103,7 +103,7 @@ jobs:
103103
gcc \
104104
ninja-build \
105105
pkg-config \
106-
libopenmpt-dev \
106+
libxmp-dev \
107107
libfluidsynth-dev \
108108
fluidsynth \
109109
libgl-dev \
@@ -129,7 +129,7 @@ jobs:
129129
python \
130130
ninja \
131131
pkg-config \
132-
libopenmpt \
132+
libxmp \
133133
fluid-synth \
134134
libvorbis \
135135
libzip \

docs/guides/building_on_macos.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ On arm64 machines, brew will be installed in `/opt/homebrew`.
1313
## Install Build Dependencies
1414
Install cmake, SDL2 and additional dependencies for DSDA-Doom:
1515
```
16-
brew install cmake pkgconf libopenmpt fluid-synth libvorbis libzip mad portmidi sdl2 sdl2_image sdl2_mixer
16+
brew install cmake pkgconf libxmp fluid-synth libvorbis libzip mad portmidi sdl2 sdl2_image sdl2_mixer
1717
```
1818
## Build DSDA-Doom
1919
Make a clone of the DSDA-Doom Git repository:

docs/guides/building_on_windows.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ pacman -S mingw-w64-ucrt-x86_64-gcc cmake git ninja pkgconf
123123
Additionally, you will need the following external libraries:
124124

125125
```
126-
pacman -S mingw-w64-ucrt-x86_64-libopenmpt mingw-w64-ucrt-x86_64-fluidsynth mingw-w64-ucrt-x86_64-libmad mingw-w64-ucrt-x86_64-libvorbis mingw-w64-ucrt-x86_64-libzip mingw-w64-ucrt-x86_64-portmidi mingw-w64-ucrt-x86_64-SDL2 mingw-w64-ucrt-x86_64-SDL2_image mingw-w64-ucrt-x86_64-SDL2_mixer
126+
pacman -S mingw-w64-ucrt-x86_64-libxmp mingw-w64-ucrt-x86_64-fluidsynth mingw-w64-ucrt-x86_64-libmad mingw-w64-ucrt-x86_64-libvorbis mingw-w64-ucrt-x86_64-libzip mingw-w64-ucrt-x86_64-portmidi mingw-w64-ucrt-x86_64-SDL2 mingw-w64-ucrt-x86_64-SDL2_image mingw-w64-ucrt-x86_64-SDL2_mixer
127127
```
128128

129129
### Building

prboom2/CMakeLists.txt

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
cmake_minimum_required(VERSION 3.9)
22

3+
option(WITH_XMP "Use libxmp if available" ON)
4+
if(WITH_XMP)
5+
list(APPEND VCPKG_MANIFEST_FEATURES "libxmp")
6+
endif()
7+
38
option(WITH_FLUIDSYNTH "Use FluidSynth if available" ON)
49
if(WITH_FLUIDSYNTH)
510
list(APPEND VCPKG_MANIFEST_FEATURES "fluidsynth")
@@ -25,11 +30,6 @@ if(WITH_VORBISFILE)
2530
list(APPEND VCPKG_MANIFEST_FEATURES "libvorbis")
2631
endif()
2732

28-
option(WITH_LIBOPENMPT "Use libopenmpt if available" ON)
29-
if(WITH_LIBOPENMPT)
30-
list(APPEND VCPKG_MANIFEST_FEATURES "libopenmpt")
31-
endif()
32-
3333
# Automatically install dependencies
3434
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
3535
set(X_VCPKG_APPLOCAL_DEPS_INSTALL TRUE)
@@ -121,6 +121,20 @@ if(WITH_FLUIDSYNTH)
121121
endif()
122122
endif()
123123

124+
if(WITH_XMP)
125+
find_package(libxmp)
126+
if(libxmp_FOUND)
127+
set(HAVE_LIBXMP TRUE)
128+
if(NOT TARGET libxmp::xmp)
129+
if(TARGET libxmp::xmp_shared)
130+
add_library(libxmp::xmp ALIAS libxmp::xmp_shared)
131+
else()
132+
add_library(libxmp::xmp ALIAS libxmp::xmp_static)
133+
endif()
134+
endif()
135+
endif()
136+
endif()
137+
124138
if(WITH_VORBISFILE)
125139
find_package(Vorbis COMPONENTS File)
126140
if(Vorbis_File_FOUND)
@@ -135,13 +149,6 @@ if(WITH_PORTMIDI)
135149
endif()
136150
endif()
137151

138-
if(WITH_LIBOPENMPT)
139-
find_package(libopenmpt)
140-
if(libopenmpt_FOUND)
141-
set(HAVE_LIBOPENMPT TRUE)
142-
endif()
143-
endif()
144-
145152
if(WIN32)
146153
set(DEFAULT_WAD_DIR ".")
147154
else()

prboom2/INSTALL

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Prerequisites
99
* FluidSynth (MIDI)
1010
* PortMidi (MIDI)
1111
* MAD (MP3)
12-
* libopenmpt (various tracker-style formats)
12+
* libxmp (various tracker-style formats)
1313
* vorbisfile (OGG)
1414

1515
You will need `cmake` and `make` if you haven't already installed them.
@@ -18,13 +18,13 @@ On a typical Debian or Ubuntu system, these commands may be sufficient:
1818
`sudo apt install build-essential cmake git`
1919

2020
As well as the following:
21-
`sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libfluidsynth-dev libportmidi-dev libmad0-dev libopenmpt-dev libvorbis-dev libzip-dev zipcmp zipmerge ziptool fluidsynth libglu1-mesa-dev`
21+
`sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libfluidsynth-dev libportmidi-dev libmad0-dev libxmp-dev libvorbis-dev libzip-dev zipcmp zipmerge ziptool fluidsynth libglu1-mesa-dev`
2222

2323
On a typical Fedora system, these commands may be sufficient:
2424
`dnf install cmake git gcc gcc-g++`
2525

2626
As well as the following:
27-
`sudo dnf install SDL2_mixer-devel SDL2_image-devel mesa-libGLU-devel libzip-devel libzip-tools zlib-static libvorbis-devel libmad-devel libopenmpt-devel portmidi-devel fluidsynth-devel`
27+
`sudo dnf install SDL2_mixer-devel SDL2_image-devel mesa-libGLU-devel libzip-devel libzip-tools zlib-static libvorbis-devel libmad-devel libxmp-devel portmidi-devel fluidsynth-devel`
2828

2929
2. Clone the repository and navigate to the directory containing the DSDA-Doom distribution (the directory this file is in, prboom2).
3030
`git clone https://github.com/kraflab/dsda-doom.git`

prboom2/cmake/Findlibopenmpt.cmake

Lines changed: 0 additions & 118 deletions
This file was deleted.

prboom2/cmake/Findlibxmp.cmake

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Variables defined:
2+
# libxmp_FOUND
3+
# libxmp_INCLUDE_DIR
4+
# libxmp_LIBRARY
5+
6+
find_package(PkgConfig QUIET)
7+
pkg_check_modules(PC_libxmp QUIET libxmp)
8+
9+
find_library(libxmp_LIBRARY
10+
NAMES xmp
11+
HINTS "${PC_libxmp_LIBDIR}")
12+
13+
find_path(libxmp_INCLUDE_DIR
14+
NAMES xmp.h
15+
HINTS "${PC_libxmp_INCLUDEDIR}")
16+
17+
include(FindPackageHandleStandardArgs)
18+
find_package_handle_standard_args(libxmp
19+
REQUIRED_VARS libxmp_LIBRARY libxmp_INCLUDE_DIR)
20+
21+
if(libxmp_FOUND)
22+
if(NOT TARGET libxmp::xmp)
23+
add_library(libxmp::xmp UNKNOWN IMPORTED)
24+
set_target_properties(libxmp::xmp PROPERTIES
25+
IMPORTED_LOCATION "${libxmp_LIBRARY}"
26+
INTERFACE_INCLUDE_DIRECTORIES "${libxmp_INCLUDE_DIR}")
27+
endif()
28+
endif()
29+
30+
mark_as_advanced(libxmp_LIBRARY libxmp_INCLUDE_DIR)

prboom2/cmake/config.h.cin

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626

2727
#cmakedefine HAVE_LIBMAD
2828
#cmakedefine HAVE_LIBFLUIDSYNTH
29+
#cmakedefine HAVE_LIBXMP
2930
#cmakedefine HAVE_LIBVORBISFILE
3031
#cmakedefine HAVE_LIBPORTMIDI
31-
#cmakedefine HAVE_LIBOPENMPT
3232
#cmakedefine HAVE_SNDFILE_MPEG
3333

3434
#cmakedefine SIMPLECHECKS

prboom2/src/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,8 @@ set(SDLDOOM_SOURCES
454454
)
455455

456456
set(DOOMMUSIC_SOURCES
457+
MUSIC/xmpplayer.c
458+
MUSIC/xmpplayer.h
457459
MUSIC/flplayer.c
458460
MUSIC/flplayer.h
459461
MUSIC/madplayer.c
@@ -473,8 +475,6 @@ set(DOOMMUSIC_SOURCES
473475
MUSIC/portmidiplayer.h
474476
MUSIC/vorbisplayer.c
475477
MUSIC/vorbisplayer.h
476-
MUSIC/libopenmptplayer.c
477-
MUSIC/libopenmptplayer.h
478478
)
479479

480480
set(EXTRA_FILES
@@ -575,6 +575,10 @@ function(AddGameExecutable TARGET SOURCES)
575575
target_link_libraries(${TARGET} PRIVATE FluidSynth::libfluidsynth)
576576
endif()
577577

578+
if(HAVE_LIBXMP)
579+
target_link_libraries(${TARGET} PRIVATE libxmp::xmp)
580+
endif()
581+
578582
if(HAVE_LIBVORBISFILE)
579583
target_link_libraries(${TARGET} PRIVATE Vorbis::vorbisfile)
580584
endif()
@@ -583,10 +587,6 @@ function(AddGameExecutable TARGET SOURCES)
583587
target_link_libraries(${TARGET} PRIVATE PortMidi::portmidi)
584588
endif()
585589

586-
if(HAVE_LIBOPENMPT)
587-
target_link_libraries(${TARGET} PRIVATE libopenmpt::libopenmpt)
588-
endif()
589-
590590
add_dependencies(${TARGET} dsda-doom-wad)
591591

592592
if(MSVC)

0 commit comments

Comments
 (0)