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
58 changes: 48 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3518,6 +3518,10 @@ if(QT6)
list(APPEND QT_EXTRA_COMPONENTS "ShaderTools")
list(APPEND QT_EXTRA_COMPONENTS "SvgWidgets")
list(APPEND QT_EXTRA_COMPONENTS "Core5Compat")
if(QT_VERSION VERSION_GREATER_EQUAL 6.10)
# from Qt 6.10 GuiPrivate required for QShader/rendergraph (rhi/qshader.h)
list(APPEND QT_EXTRA_COMPONENTS "GuiPrivate")
endif()
else()
find_package(QT 5.12 NAMES Qt5 COMPONENTS Core REQUIRED)
endif()
Expand Down Expand Up @@ -4778,25 +4782,59 @@ if(MEDIAFOUNDATION)
)
endif()

# Modplug support
find_package(Modplug)
default_option(MODPLUG "Modplug module decoder support" "Modplug_FOUND")
# tracker module support (openmpt preferred, modplug fallback)
find_package(OpenMPT)
default_option(OPENMPT "OpenMPT module decoder support" "OpenMPT_FOUND")

# only search for modplug as fallback if openmpt is not available
if(NOT OpenMPT_FOUND)
message(
STATUS
"libopenmpt not found, checking for fallback library libmodplug..."
)
find_package(Modplug)
default_option(MODPLUG "Modplug module decoder support (legacy)" "OFF")
endif()

if(OPENMPT OR MODPLUG)
# shared tracker DSP and preferences
target_sources(
mixxx-lib
PRIVATE
src/preferences/dialog/dlgprefmodplugdlg.ui
src/preferences/dialog/dlgprefmodplug.cpp
src/sources/trackerdsp.cpp
)
endif()

if(OPENMPT)
if(NOT OpenMPT_FOUND)
message(
FATAL_ERROR
"OpenMPT module decoder support requires libopenmpt and its development headers."
)
endif()
target_sources(mixxx-lib PRIVATE src/sources/soundsourceopenmpt.cpp)
target_compile_definitions(mixxx-lib PUBLIC __OPENMPT__)
target_link_libraries(mixxx-lib PRIVATE OpenMPT::OpenMPT)
message(STATUS "using libopenmpt for tracker module support")
endif()

if(MODPLUG)
if(NOT Modplug_FOUND)
message(
FATAL_ERROR
"Modplug module decoder support requires libmodplug and its development headers."
)
endif()
target_sources(
mixxx-lib
PRIVATE
src/preferences/dialog/dlgprefmodplugdlg.ui
src/sources/soundsourcemodplug.cpp
src/preferences/dialog/dlgprefmodplug.cpp
)
target_sources(mixxx-lib PRIVATE src/sources/soundsourcemodplug.cpp)
target_compile_definitions(mixxx-lib PUBLIC __MODPLUG__)
target_link_libraries(mixxx-lib PRIVATE Modplug::Modplug)
if(OPENMPT)
message(STATUS "libmodplug available as fallback (libopenmpt preferred)")
else()
message(STATUS "using libmodplug for tracker module support")
endif()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. For my understanding libopenmpt fully covers the libmodplug features. Do we know a single file that is not opened by libopenmpt and where libmodplug succeeds?
I suggest to use only one soundsource but keep this option for experimental purpose.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

afaicr, they didn't carry over the DSP because they a) were not good, b) not what the artist intended, and c) a responsibility for the player

endif()

find_package(Microsoft.GSL CONFIG)
Expand Down
88 changes: 88 additions & 0 deletions cmake/modules/FindOpenMPT.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#[=======================================================================[.rst:
FindOpenMPT
-----------

Finds the OpenMPT library.

Imported Targets
^^^^^^^^^^^^^^^^

This module provides the following imported targets, if found:

``OpenMPT::OpenMPT``
The OpenMPT library

Result Variables
^^^^^^^^^^^^^^^^

This will define the following variables:

``OpenMPT_FOUND``
True if the system has the OpenMPT library.
``OpenMPT_INCLUDE_DIRS``
Include directories needed to use OpenMPT.
``OpenMPT_LIBRARIES``
Libraries needed to link to OpenMPT.
``OpenMPT_DEFINITIONS``
Compile definitions needed to use OpenMPT.

Cache Variables
^^^^^^^^^^^^^^^

The following cache variables may also be set:

``OpenMPT_INCLUDE_DIR``
The directory containing ``libopenmpt/libopenmpt.hpp``.
``OpenMPT_LIBRARY``
The path to the OpenMPT library.

#]=======================================================================]

find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
pkg_check_modules(PC_OpenMPT QUIET libopenmpt)
endif()

find_path(
OpenMPT_INCLUDE_DIR
NAMES libopenmpt/libopenmpt.hpp libopenmpt/libopenmpt.h
HINTS ${PC_OpenMPT_INCLUDE_DIRS}
DOC "OpenMPT include directory"
)
mark_as_advanced(OpenMPT_INCLUDE_DIR)

find_library(
OpenMPT_LIBRARY
NAMES openmpt
HINTS ${PC_OpenMPT_LIBRARY_DIRS}
DOC "OpenMPT library"
)
mark_as_advanced(OpenMPT_LIBRARY)

if(DEFINED PC_OpenMPT_VERSION AND NOT PC_OpenMPT_VERSION STREQUAL "")
set(OpenMPT_VERSION "${PC_OpenMPT_VERSION}")
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
OpenMPT
REQUIRED_VARS OpenMPT_LIBRARY OpenMPT_INCLUDE_DIR
VERSION_VAR OpenMPT_VERSION
)

if(OpenMPT_FOUND)
set(OpenMPT_LIBRARIES "${OpenMPT_LIBRARY}")
set(OpenMPT_INCLUDE_DIRS "${OpenMPT_INCLUDE_DIR}")
set(OpenMPT_DEFINITIONS ${PC_OpenMPT_CFLAGS_OTHER})

if(NOT TARGET OpenMPT::OpenMPT)
add_library(OpenMPT::OpenMPT UNKNOWN IMPORTED)
set_target_properties(
OpenMPT::OpenMPT
PROPERTIES
IMPORTED_LOCATION "${OpenMPT_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_OpenMPT_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${OpenMPT_INCLUDE_DIR}"
)
endif()
endif()
2 changes: 1 addition & 1 deletion src/coreservices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "moc_coreservices.cpp"
#include "preferences/dialog/dlgpreferences.h"
#include "preferences/settingsmanager.h"
#ifdef __MODPLUG__
#if defined(__OPENMPT__) || defined(__MODPLUG__)
#include "preferences/dialog/dlgprefmodplug.h"
#endif
#include "skin/skincontrols.h"
Expand Down
25 changes: 25 additions & 0 deletions src/preferences/dialog/dlgprefmodplug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
#include "moc_dlgprefmodplug.cpp"
#include "preferences/dialog/ui_dlgprefmodplugdlg.h"
#include "preferences/usersettings.h"
#ifdef __OPENMPT__
#include "sources/soundsourceopenmpt.h"
#endif
#ifdef __MODPLUG__
#include "sources/soundsourcemodplug.h"
#endif
#include "util/string.h"

#define kConfigKey "[Modplug]"
Expand Down Expand Up @@ -142,6 +147,25 @@ void DlgPrefModplug::saveSettings() {
void DlgPrefModplug::applySettings() {
// read ui parameters and configure soundsource
unsigned int bufferSizeLimit = m_pUi->memoryLimit->value() << 20;

#ifdef __OPENMPT__
// configure openmpt with DSP settings
mixxx::TrackerDSP::Settings dspSettings;
dspSettings.reverbEnabled = m_pUi->reverb->isChecked();
dspSettings.reverbDepth = m_pUi->reverbDepth->value();
dspSettings.reverbDelay = m_pUi->reverbDelay->value();
dspSettings.megabassEnabled = m_pUi->megabass->isChecked();
dspSettings.bassDepth = m_pUi->bassDepth->value();
dspSettings.bassCutoff = m_pUi->bassCutoff->value();
dspSettings.surroundEnabled = m_pUi->surround->isChecked();
dspSettings.surroundDepth = m_pUi->surroundDepth->value();
dspSettings.surroundDelay = m_pUi->surroundDelay->value();
dspSettings.noiseReductionEnabled = m_pUi->noiseReduction->isChecked();

mixxx::SoundSourceOpenMPT::configure(bufferSizeLimit, dspSettings);
#endif

#ifdef __MODPLUG__
ModPlug::ModPlug_Settings settings;

// Note that ModPlug always decodes sound at 44.1kHz, 32 bit, stereo
Expand Down Expand Up @@ -210,4 +234,5 @@ void DlgPrefModplug::applySettings() {

// apply modplug settings
mixxx::SoundSourceModPlug::configure(bufferSizeLimit, settings);
#endif
}
Loading
Loading