diff --git a/cmake/FindSpeexDSP.cmake b/cmake/FindSpeexDSP.cmake deleted file mode 100644 index d1267499fd..0000000000 --- a/cmake/FindSpeexDSP.cmake +++ /dev/null @@ -1,40 +0,0 @@ -# -# - Find speexdsp libraries -# -# SPEEXDSP_INCLUDE_DIRS - where to find speexdsp headers. -# SPEEXDSP_LIBRARIES - List of libraries when using speexdsp. -# SPEEXDSP_FOUND - True if speexdsp is found. - -find_package(PkgConfig QUIET) -pkg_search_module(PC_SPEEXDSP QUIET speexdsp) - -find_path(SPEEXDSP_INCLUDE_DIR - NAMES - speex/speex_resampler.h - HINTS - ${PC_SPEEXDSP_INCLUDE_DIRS} -) - -find_library(SPEEXDSP_LIBRARY - NAMES - speexdsp - HINTS - ${PC_SPEEXDSP_LIBRARY_DIRS} -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(SpeexDSP - REQUIRED_VARS SPEEXDSP_LIBRARY SPEEXDSP_INCLUDE_DIR - VERSION_VAR PC_SPEEXDSP_VERSION) - -if(SPEEXDSP_FOUND) - set(SPEEXDSP_LIBRARIES ${SPEEXDSP_LIBRARY}) - set(SPEEXDSP_INCLUDE_DIRS ${SPEEXDSP_INCLUDE_DIR}) - set(SPEEX_INCLUDE_DIRS ${SPEEXDSP_INCLUDE_DIR}) -else() - set(SPEEXDSP_LIBRARIES) - set(SPEEXDSP_INCLUDE_DIRS) - set(SPEEX_INCLUDE_DIRS) -endif() - -mark_as_advanced(SPEEXDSP_LIBRARIES SPEEXDSP_INCLUDE_DIRS SPEEX_INCLUDE_DIRS) diff --git a/debian/control b/debian/control index a284b2bef6..0789d4b3a9 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,7 @@ Section: misc Priority: optional Standards-Version: 3.9.2 Multi-Arch: same -Build-Depends: debhelper (>= 9), cmake (>= 3.8), libsdl2-dev, g++ (>= 4:10), pkg-config, nlohmann-json3-dev (>= 3.9.0), libspeex-dev, libspeexdsp-dev, libcurl4-openssl-dev, libcrypto++-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev, libssl-dev, libzip-dev (>= 1.0.0), libicu-dev (>= 59.0), libflac-dev, libvorbis-dev, libzstd-dev +Build-Depends: debhelper (>= 9), cmake (>= 3.8), libsdl2-dev, g++ (>= 4:10), pkg-config, nlohmann-json3-dev (>= 3.9.0), libcurl4-openssl-dev, libcrypto++-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev, libssl-dev, libzip-dev (>= 1.0.0), libicu-dev (>= 59.0), libflac-dev, libvorbis-dev, libzstd-dev Package: openrct2 Architecture: any diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 41cf226399..c5f173bad8 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -4,6 +4,7 @@ - Improved: [#21753] Tracked rides with cheated powered launch mode can change powered launch speed without extra cheats. - Improved: [#25526] When a shop item cannot be recoloured, show a preview of the building instead. - Improved: [#25941] The command line sprite build command is now faster. +- Change: [#26011] Audio resampling no longer depends on the third-party library libspeexdsp. - Fix: [#14686, #23996, #25981] Preview images from different windows overwrite each other when using OpenGL. - Fix: [#15128, #15626, #16331, #17443, #18626, #21597, #24175, #24971, #25963] Crash when loading corrupted RCT2/RCT1 save files with duplicate entity indices. - Fix: [#25237] Wrong colours on the Knight costume. diff --git a/distribution/readme.txt b/distribution/readme.txt index ce496cdc5d..ce0bfa9a58 100644 --- a/distribution/readme.txt +++ b/distribution/readme.txt @@ -1,4 +1,4 @@ -Last updated: 2025-08-04 +Last updated: 2026-02-15 ------------------------------------------------------------------------ @@ -146,7 +146,6 @@ duktape | MIT licence. libcURL | MIT (or Modified BSD-style) licence. libicu | Unicode licence. libpng | libpng licence. -libspeex | BSD-style licence. libzip | BSD 3 clause licence. nlohmann-json | MIT licence. OpenSSL | OpenSSL licence. diff --git a/openrct2.common.props b/openrct2.common.props index 9028146f6d..ad32ad3818 100644 --- a/openrct2.common.props +++ b/openrct2.common.props @@ -88,7 +88,7 @@ DebugFull brotlicommon.lib;brotlidec.lib;brotlienc.lib;%(AdditionalDependencies) libbreakpadd.lib;libbreakpad_clientd.lib;%(AdditionalDependencies) - bz2d.lib;discord-rpc.lib;flac.lib;freetyped.lib;libpng16d.lib;ogg.lib;speexdsp.lib;SDL2-staticd.lib;vorbis.lib;vorbisfile.lib;zip.lib;zlibd.lib;zstd.lib;%(AdditionalDependencies) + bz2d.lib;discord-rpc.lib;flac.lib;freetyped.lib;libpng16d.lib;ogg.lib;SDL2-staticd.lib;vorbis.lib;vorbisfile.lib;zip.lib;zlibd.lib;zstd.lib;%(AdditionalDependencies) @@ -109,7 +109,7 @@ true brotlicommon.lib;brotlidec.lib;brotlienc.lib;%(AdditionalDependencies) libbreakpad.lib;libbreakpad_client.lib;%(AdditionalDependencies) - bz2.lib;discord-rpc.lib;flac.lib;freetype.lib;libpng16.lib;ogg.lib;speexdsp.lib;SDL2-static.lib;vorbis.lib;vorbisfile.lib;zip.lib;zlib.lib;zstd.lib;%(AdditionalDependencies) + bz2.lib;discord-rpc.lib;flac.lib;freetype.lib;libpng16.lib;ogg.lib;SDL2-static.lib;vorbis.lib;vorbisfile.lib;zip.lib;zlib.lib;zstd.lib;%(AdditionalDependencies) diff --git a/scripts/build-emscripten b/scripts/build-emscripten index d6604f1ed2..2780a9af0f 100755 --- a/scripts/build-emscripten +++ b/scripts/build-emscripten @@ -6,7 +6,6 @@ mkdir -p build cd build START_DIR=$(pwd) -SPEEXDSP_ROOT=/ext/speexdsp ICU_ROOT=/ext/icu/icu4c/source LIBZIP_ROOT=/ext/libzip ZSTD_ROOT=/ext/zstd @@ -22,8 +21,6 @@ emcmake cmake ../ \ -DDISABLE_DISCORD_RPC=ON \ -DCMAKE_SYSTEM_NAME=Emscripten \ -DCMAKE_BUILD_TYPE=Release \ - -DSPEEXDSP_INCLUDE_DIR="$SPEEXDSP_ROOT/include/" \ - -DSPEEXDSP_LIBRARY="$SPEEXDSP_ROOT/libspeexdsp/.libs/libspeexdsp.a" \ -DICU_INCLUDE_DIR="$ICU_ROOT/common" \ -DICU_DATA_LIBRARIES=$ICU_ROOT/lib/libicuuc.so \ -DICU_DT_LIBRARY_RELEASE="$ICU_ROOT/stubdata/libicudata.so" \ diff --git a/src/openrct2-android/app/src/main/CMakeLists.txt b/src/openrct2-android/app/src/main/CMakeLists.txt index 375481a0dd..2ed448a79d 100644 --- a/src/openrct2-android/app/src/main/CMakeLists.txt +++ b/src/openrct2-android/app/src/main/CMakeLists.txt @@ -40,7 +40,6 @@ ExternalProject_Add(libs ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}freetype${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}png16${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX} - ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}speexdsp${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}ssl${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}icudata${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}icui18n${CMAKE_SHARED_LIBRARY_SUFFIX} @@ -76,7 +75,6 @@ add_custom_command(TARGET libs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libfreetype.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libpng16.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libSDL2.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libspeexdsp.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libssl.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libz.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libs/lib/libzstd.so" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} @@ -118,12 +116,6 @@ set_target_properties(SDL2main PROPERTIES IMPORTED_LOCATION ) add_dependencies(SDL2main libs) -add_library(speexdsp SHARED IMPORTED) -set_target_properties(speexdsp PROPERTIES IMPORTED_LOCATION - ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}speexdsp${CMAKE_SHARED_LIBRARY_SUFFIX} -) -add_dependencies(speexdsp libs) - add_library(icu STATIC IMPORTED) set_target_properties(icu PROPERTIES IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/libs/lib/${CMAKE_SHARED_LIBRARY_PREFIX}icui18n${CMAKE_SHARED_LIBRARY_SUFFIX} @@ -207,9 +199,6 @@ add_definitions(-DDISABLE_DISCORD_RPC -DDISABLE_OPENGL -DGL_GLEXT_PROTOTYPES -D_ # Enable scripting add_definitions(-DENABLE_SCRIPTING) -# Fix SpeexDSP compilation -add_definitions(-DHAVE_STDINT_H) - # -Werror -Wall set(COMMON_COMPILE_OPTIONS "${COMMON_COMPILE_OPTIONS} -fstrict-aliasing -Wundef -Wmissing-declarations -Winit-self -Wno-unknown-pragmas -Wno-unused-function -Wno-missing-braces ") set(COMMON_COMPILE_OPTIONS "${COMMON_COMPILE_OPTIONS} -Wno-comment -Wshadow -Wmissing-declarations -Wnonnull") @@ -261,7 +250,7 @@ add_library(openrct2 SHARED ${LIBOPENRCT2_SOURCES}) target_link_libraries(openrct2 android stdc++ log dl SDL2 png z zstd icu icuuc icudata crypto ssl freetype) add_library(openrct2-ui SHARED ${OPENRCT2_GUI_SOURCES}) -target_link_libraries(openrct2-ui openrct2 android stdc++ GLESv1_CM GLESv2 SDL2main speexdsp brotlicommon brotlidec bz2 freetype ogg vorbis vorbisfile FLAC) +target_link_libraries(openrct2-ui openrct2 android stdc++ GLESv1_CM GLESv2 SDL2main brotlicommon brotlidec bz2 freetype ogg vorbis vorbisfile FLAC) add_executable(openrct2-cli ${OPENRCT2_CLI_SOURCES}) target_link_libraries(openrct2-cli openrct2 android stdc++ GLESv1_CM GLESv2) diff --git a/src/openrct2-android/app/src/main/java/io/openrct2/GameActivity.java b/src/openrct2-android/app/src/main/java/io/openrct2/GameActivity.java index d8350d049f..43fac485b4 100644 --- a/src/openrct2-android/app/src/main/java/io/openrct2/GameActivity.java +++ b/src/openrct2-android/app/src/main/java/io/openrct2/GameActivity.java @@ -76,7 +76,6 @@ public class GameActivity extends SDLActivity { protected String[] getLibraries() { return new String[]{ "c++_shared", - "speexdsp", "bz2", "freetype", "z", diff --git a/src/openrct2-ui/CMakeLists.txt b/src/openrct2-ui/CMakeLists.txt index d253b9bce8..39863d8e2d 100644 --- a/src/openrct2-ui/CMakeLists.txt +++ b/src/openrct2-ui/CMakeLists.txt @@ -13,20 +13,10 @@ if (EMSCRIPTEN) set(SHARED_FLAGS "-fexceptions") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${USE_FLAGS} ${SHARED_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EMSCRIPTEN_LDFLAGS} --bind ${SHARED_FLAGS} -sEXPORTED_FUNCTIONS=${EMSCRIPTEN_EXPORTED_FUNCTIONS} --js-library ${ROOT_DIR}/emscripten/deps.js") - find_package(SpeexDSP REQUIRED) elseif (MSVC) find_package(SDL2 REQUIRED) - find_library(SPEEX_LDFLAGS libspeexdsp) - if (NOT DISABLE_FLAC) - find_library(SPEEX_LDFLAGS libflac) - endif () - if (NOT DISABLE_VORBIS) - find_library(SPEEX_LDFLAGS libogg) - find_library(SPEEX_LDFLAGS libvorbis) - endif () else () PKG_CHECK_MODULES(SDL2 REQUIRED IMPORTED_TARGET sdl2) - PKG_CHECK_MODULES(SPEEX REQUIRED IMPORTED_TARGET speexdsp) if (NOT DISABLE_FLAC) PKG_CHECK_MODULES(FLAC REQUIRED IMPORTED_TARGET flac) endif () @@ -67,17 +57,14 @@ ipo_set_target_properties(openrct2) # mingw builds cannot use the PkgConfig imported targets if (EMSCRIPTEN) target_link_libraries(openrct2 "libopenrct2" - ${SPEEXDSP_LIBRARIES} ${ICU_DATA_LIBRARIES} ${ICU_DT_LIBRARY_RELEASE}) elseif (NOT MSVC AND NOT WIN32) target_link_libraries(openrct2 "libopenrct2" - PkgConfig::SDL2 - PkgConfig::SPEEX) + PkgConfig::SDL2) else () target_link_libraries(openrct2 "libopenrct2" - ${SDL2_LDFLAGS} - ${SPEEX_LDFLAGS}) + ${SDL2_LDFLAGS}) endif () target_link_platform_libraries(openrct2) @@ -109,7 +96,6 @@ endif () # Includes target_include_directories(openrct2 PRIVATE "${CMAKE_CURRENT_LIST_DIR}/.." - ${SPEEX_INCLUDE_DIRS} ${OGG_INCLUDE_DIRS} ${VORBIS_INCLUDE_DIRS} ${FLAC_INCLUDE_DIRS}) diff --git a/src/openrct2-ui/audio/AudioChannel.cpp b/src/openrct2-ui/audio/AudioChannel.cpp index 3d139120d2..9b03a1e840 100644 --- a/src/openrct2-ui/audio/AudioChannel.cpp +++ b/src/openrct2-ui/audio/AudioChannel.cpp @@ -14,7 +14,6 @@ #include #include #include -#include namespace OpenRCT2::Audio { @@ -25,7 +24,6 @@ namespace OpenRCT2::Audio private: AudioSource_* _source = nullptr; - SpeexResamplerState* _resampler = nullptr; MixerGroup _group = MixerGroup::Sound; double _rate = 0; @@ -52,30 +50,11 @@ namespace OpenRCT2::Audio AudioChannelImpl::SetPan(0.5f); } - ~AudioChannelImpl() override - { - if (_resampler != nullptr) - { - speex_resampler_destroy(_resampler); - _resampler = nullptr; - } - } - [[nodiscard]] IAudioSource* GetSource() const override { return _source; } - [[nodiscard]] SpeexResamplerState* GetResampler() const override - { - return _resampler; - } - - void SetResampler(SpeexResamplerState* value) override - { - _resampler = value; - } - [[nodiscard]] MixerGroup GetGroup() const override { return _group; diff --git a/src/openrct2-ui/audio/AudioContext.h b/src/openrct2-ui/audio/AudioContext.h index 8451b3bae8..fe45af0ed2 100644 --- a/src/openrct2-ui/audio/AudioContext.h +++ b/src/openrct2-ui/audio/AudioContext.h @@ -15,7 +15,6 @@ #include struct SDL_RWops; -using SpeexResamplerState = struct SpeexResamplerState_; namespace OpenRCT2::Audio { @@ -25,8 +24,6 @@ namespace OpenRCT2::Audio struct ISDLAudioChannel : public IAudioChannel { [[nodiscard]] virtual AudioFormat GetFormat() const = 0; - [[nodiscard]] virtual SpeexResamplerState* GetResampler() const = 0; - virtual void SetResampler(SpeexResamplerState* value) = 0; }; namespace AudioChannel diff --git a/src/openrct2-ui/audio/AudioMixer.cpp b/src/openrct2-ui/audio/AudioMixer.cpp index ad7ea788ba..6d80ca64b9 100644 --- a/src/openrct2-ui/audio/AudioMixer.cpp +++ b/src/openrct2-ui/audio/AudioMixer.cpp @@ -13,7 +13,6 @@ #include #include #include -#include using namespace OpenRCT2::Audio; @@ -124,6 +123,7 @@ const AudioFormat& AudioMixer::GetFormat() const return _outputFormat; } +// TODO: investigate replacing this with OpenAL (#26035) void AudioMixer::GetNextAudioChunk(uint8_t* dst, size_t length) { UpdateAdjustedSound(); @@ -156,6 +156,7 @@ void AudioMixer::GetNextAudioChunk(uint8_t* dst, size_t length) } } +// TODO: investigate replacing this with OpenAL (#26035) void AudioMixer::UpdateAdjustedSound() { // Did the volume level get changed? Recalculate level in this case. @@ -171,6 +172,7 @@ void AudioMixer::UpdateAdjustedSound() } } +// TODO: investigate replacing this with OpenAL (#26035) void AudioMixer::MixChannel(ISDLAudioChannel* channel, uint8_t* data, size_t length) { int32_t outputByteRate = _outputFormat.GetByteRate(); @@ -236,8 +238,7 @@ void AudioMixer::MixChannel(ISDLAudioChannel* channel, uint8_t* data, size_t len outRate = _outputFormat.freq * (1 / rate); } _effectBuffer.resize(length); - bufferLen = ApplyResample( - channel, buffer, static_cast(bufferLen / outputByteRate), numSamples, inRate, outRate); + bufferLen = ApplyResample(buffer, static_cast(bufferLen / outputByteRate), numSamples, inRate, outRate); buffer = _effectBuffer.data(); } @@ -256,30 +257,60 @@ void AudioMixer::MixChannel(ISDLAudioChannel* channel, uint8_t* data, size_t len /** * Resample the given buffer into _effectBuffer. * Assumes that srcBuffer is the same format as _outputFormat. + * + * TODO: investigate replacing this with OpenAL (#26035) */ -size_t AudioMixer::ApplyResample( - ISDLAudioChannel* channel, const void* srcBuffer, int32_t srcSamples, int32_t dstSamples, int32_t inRate, int32_t outRate) +size_t AudioMixer::ApplyResample(const void* srcBuffer, int32_t srcSamples, int32_t dstSamples, int32_t inRate, int32_t outRate) { - int32_t outputByteRate = _outputFormat.GetByteRate(); + // Prevent buffer underread in inner loop + if (srcSamples < 2) + return 0; - // Create resampler - SpeexResamplerState* resampler = channel->GetResampler(); - if (resampler == nullptr) + const int channels = _outputFormat.channels; + const int bytesPerFrame = channels * sizeof(int16_t); + + const int16_t* src = static_cast(srcBuffer); + int16_t* dst = reinterpret_cast(_effectBuffer.data()); + + double ratio = static_cast(inRate) / static_cast(outRate); + + for (int32_t i = 0; i < dstSamples; ++i) { - resampler = speex_resampler_init(_outputFormat.channels, _outputFormat.freq, _outputFormat.freq, 0, nullptr); - channel->SetResampler(resampler); + double srcPos = i * ratio; + int32_t index = static_cast(srcPos); + double frac = srcPos - index; + + // Clamp to avoid reading past end + if (index >= srcSamples - 1) + { + index = srcSamples - 2; + frac = 1.0; + } + + for (int ch = 0; ch < channels; ++ch) + { + int32_t baseIndex = index * channels + ch; + + int16_t s1 = src[baseIndex]; + int16_t s2 = src[baseIndex + channels]; + + // Linear interpolation + double sample = (1.0 - frac) * s1 + frac * s2; + + // Clamp to int16 range + if (sample > 32767.0) + sample = 32767.0; + if (sample < -32768.0) + sample = -32768.0; + + dst[i * channels + ch] = static_cast(sample); + } } - speex_resampler_set_rate(resampler, inRate, outRate); - uint32_t inLen = srcSamples; - uint32_t outLen = dstSamples; - speex_resampler_process_interleaved_int( - resampler, static_cast(srcBuffer), &inLen, reinterpret_cast(_effectBuffer.data()), - &outLen); - - return outLen * outputByteRate; + return dstSamples * bytesPerFrame; } +// TODO: investigate replacing this with OpenAL (#26035) void AudioMixer::ApplyPan(const IAudioChannel* channel, void* buffer, size_t len, size_t sampleSize) { if (channel->GetPan() != 0.5f && _outputFormat.channels == 2) @@ -296,6 +327,7 @@ void AudioMixer::ApplyPan(const IAudioChannel* channel, void* buffer, size_t len } } +// TODO: investigate replacing this with OpenAL (#26035) int32_t AudioMixer::ApplyVolume(const IAudioChannel* channel, void* buffer, size_t len) { float volumeAdjust = _volume; @@ -347,6 +379,7 @@ int32_t AudioMixer::ApplyVolume(const IAudioChannel* channel, void* buffer, size return mixVolume; } +// TODO: investigate replacing this with OpenAL (#26035) void AudioMixer::EffectPanS16(const IAudioChannel* channel, int16_t* data, int32_t length) { const float dt = 1.0f / static_cast(length * 2.0f); @@ -364,6 +397,7 @@ void AudioMixer::EffectPanS16(const IAudioChannel* channel, int16_t* data, int32 } } +// TODO: investigate replacing this with OpenAL (#26035) void AudioMixer::EffectPanU8(const IAudioChannel* channel, uint8_t* data, int32_t length) { float volumeL = channel->GetVolumeL(); @@ -379,6 +413,7 @@ void AudioMixer::EffectPanU8(const IAudioChannel* channel, uint8_t* data, int32_ } } +// TODO: investigate replacing this with OpenAL (#26035) void AudioMixer::EffectFadeS16(int16_t* data, int32_t length, int32_t startvolume, int32_t endvolume) { static_assert(SDL_MIX_MAXVOLUME == kMixerVolumeMax, "Max volume differs between OpenRCT2 and SDL2"); @@ -392,6 +427,7 @@ void AudioMixer::EffectFadeS16(int16_t* data, int32_t length, int32_t startvolum } } +// TODO: investigate replacing this with OpenAL (#26035) void AudioMixer::EffectFadeU8(uint8_t* data, int32_t length, int32_t startvolume, int32_t endvolume) { static_assert(SDL_MIX_MAXVOLUME == kMixerVolumeMax, "Max volume differs between OpenRCT2 and SDL2"); diff --git a/src/openrct2-ui/audio/AudioMixer.h b/src/openrct2-ui/audio/AudioMixer.h index b43d655e21..df68e18b86 100644 --- a/src/openrct2-ui/audio/AudioMixer.h +++ b/src/openrct2-ui/audio/AudioMixer.h @@ -69,9 +69,7 @@ namespace OpenRCT2::Audio * Resample the given buffer into _effectBuffer. * Assumes that srcBuffer is the same format as _outputFormat. */ - size_t ApplyResample( - ISDLAudioChannel* channel, const void* srcBuffer, int32_t srcSamples, int32_t dstSamples, int32_t inRate, - int32_t outRate); + size_t ApplyResample(const void* srcBuffer, int32_t srcSamples, int32_t dstSamples, int32_t inRate, int32_t outRate); void ApplyPan(const IAudioChannel* channel, void* buffer, size_t len, size_t sampleSize); int32_t ApplyVolume(const IAudioChannel* channel, void* buffer, size_t len); static void EffectPanS16(const IAudioChannel* channel, int16_t* data, int32_t length); diff --git a/src/openrct2/CMakeLists.txt b/src/openrct2/CMakeLists.txt index e74c6be4a7..e63299dc73 100644 --- a/src/openrct2/CMakeLists.txt +++ b/src/openrct2/CMakeLists.txt @@ -126,7 +126,6 @@ if (EMSCRIPTEN) set(SHARED_FLAGS "-fexceptions") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${USE_FLAGS} ${SHARED_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EMSCRIPTEN_LDFLAGS} --bind ${SHARED_FLAGS}") - find_package(SpeexDSP REQUIRED) elseif (MSVC) find_package(png 1.6 REQUIRED) find_package(zlib REQUIRED)