-
Notifications
You must be signed in to change notification settings - Fork 329
Open
Description
In my NDK project, I integrated SoLoud , and the entire integration process was very smooth. I’m using the OpenSLES backend and successfully played MP3 audio.
However, there are numerous AudioTrack logs continuously being printed. I would like to know how to eliminate these excessive logs?
soloud的CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(SoLoud VERSION 1.0.0 LANGUAGES C CXX)
# 设置 C++ 标准
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# 输出目录
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# 平台检测和后端自动选择
if(ANDROID)
set(WITH_OPENSLES ON)
set(WITH_NULL ON)
elseif(IOS)
set(WITH_COREAUDIO ON)
set(WITH_NULL ON)
elseif(WIN32)
set(WITH_WINMM ON)
set(WITH_XAUDIO2 ON)
set(WITH_NULL ON)
else()
# 默认使用空驱动程序作为后端
set(WITH_NULL ON)
endif()
# 基础目录路径
set(SOLOUD_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(SOLOUD_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
# 收集所有源文件
file(GLOB SOLOUD_CORE_SOURCES
"${SOLOUD_SRC_DIR}/core/*.cpp"
)
file(GLOB SOLOUD_AUDIOSOURCE_SOURCES
"${SOLOUD_SRC_DIR}/audiosource/wav/*.cpp"
"${SOLOUD_SRC_DIR}/audiosource/wav/stb_vorbis.c"
"${SOLOUD_SRC_DIR}/audiosource/speech/*.cpp"
"${SOLOUD_SRC_DIR}/audiosource/noise/*.cpp"
"${SOLOUD_SRC_DIR}/audiosource/sfxr/*.cpp"
)
file(GLOB SOLOUD_FILTER_SOURCES
"${SOLOUD_SRC_DIR}/filter/*.cpp"
)
# 收集后端源文件(根据选项选择性包含)
set(SOLOUD_BACKEND_SOURCES "")
if(WITH_WINMM AND WIN32)
list(APPEND SOLOUD_BACKEND_SOURCES "${SOLOUD_SRC_DIR}/backend/winmm/soloud_winmm.cpp")
endif()
if(WITH_XAUDIO2 AND WIN32)
list(APPEND SOLOUD_BACKEND_SOURCES "${SOLOUD_SRC_DIR}/backend/xaudio2/soloud_xaudio2.cpp")
endif()
if(WITH_OPENSLES AND ANDROID)
list(APPEND SOLOUD_BACKEND_SOURCES "${SOLOUD_SRC_DIR}/backend/opensles/soloud_opensles.cpp")
endif()
if(WITH_COREAUDIO AND APPLE)
list(APPEND SOLOUD_BACKEND_SOURCES "${SOLOUD_SRC_DIR}/backend/coreaudio/soloud_coreaudio.cpp")
endif()
if(WITH_NULL)
list(APPEND SOLOUD_BACKEND_SOURCES "${SOLOUD_SRC_DIR}/backend/null/soloud_null.cpp")
endif()
# 合并所有源文件
set(SOLOUD_SOURCES
${SOLOUD_CORE_SOURCES}
${SOLOUD_AUDIOSOURCE_SOURCES}
${SOLOUD_FILTER_SOURCES}
${SOLOUD_BACKEND_SOURCES}
)
# 添加静态库目标
add_library(soloud STATIC ${SOLOUD_SOURCES})
# 设置包含目录
target_include_directories(soloud PUBLIC
${SOLOUD_INCLUDE_DIR}
${SOLOUD_SRC_DIR}/core
${SOLOUD_SRC_DIR}/audiosource
${SOLOUD_SRC_DIR}/filter
${SOLOUD_SRC_DIR}/backend
)
# 设置编译定义
if(WITH_WINMM)
target_compile_definitions(soloud PUBLIC WITH_WINMM)
endif()
if(WITH_XAUDIO2)
target_compile_definitions(soloud PUBLIC WITH_XAUDIO2)
endif()
if(WITH_OPENSLES)
target_compile_definitions(soloud PUBLIC WITH_OPENSLES)
endif()
if(WITH_COREAUDIO)
target_compile_definitions(soloud PUBLIC WITH_COREAUDIO)
endif()
if(WITH_NULL)
target_compile_definitions(soloud PUBLIC WITH_NULL)
endif()
# 平台特定设置
if(WIN32)
# 链接 Windows 库
if(WITH_WINMM)
target_link_libraries(soloud PRIVATE winmm)
endif()
if(WITH_XAUDIO2)
target_link_libraries(soloud PRIVATE ole32)
endif()
# Windows 特定的编译选项
if(MSVC)
target_compile_options(soloud PRIVATE /W4 /wd4100 /wd4244 /wd4456)
endif()
elseif(ANDROID)
# Android 特定设置
if(WITH_OPENSLES)
target_link_libraries(soloud PRIVATE OpenSLES)
endif()
elseif(APPLE)
# iOS/macOS 特定设置
if(WITH_COREAUDIO)
target_link_libraries(soloud PRIVATE "-framework AudioToolbox" "-framework CoreFoundation")
endif()
endif()
# 安装规则
install(TARGETS soloud
ARCHIVE DESTINATION lib)
install(DIRECTORY ${SOLOUD_INCLUDE_DIR}/
DESTINATION include/soloud
FILES_MATCHING PATTERN "*.h")
# 输出配置信息
message(STATUS "SoLoud Configuration:")
message(STATUS " Building static library only")
message(STATUS " Backends:")
message(STATUS " WinMM: ${WITH_WINMM}")
message(STATUS " XAudio2: ${WITH_XAUDIO2}")
message(STATUS " OpenSL ES: ${WITH_OPENSLES}")
message(STATUS " CoreAudio: ${WITH_COREAUDIO}")
message(STATUS " NullDriver: ${WITH_NULL}")
This is logcat:
libOpenSLES arda.game.mtr W class OutputMix interface 0 requested but unavailable MPH=43
2025-04-02 14:44:06.677 14502-14649 libOpenSLES arda.game.mtr W Leaving Object::GetInterface (SL_RESULT_FEATURE_UNSUPPORTED)
2025-04-02 14:44:06.677 14502-14649 SoLoud arda.game.mtr I Failed to get output mix volume interface.
2025-04-02 14:44:06.678 14502-14649 <no-tag> arda.game.mtr D PlayerBase::PlayerBase()
2025-04-02 14:44:06.678 14502-14649 <no-tag> arda.game.mtr D TrackPlayerBase::TrackPlayerBase()
2025-04-02 14:44:06.679 14502-14649 libOpenSLES arda.game.mtr I Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
2025-04-02 14:44:06.681 14502-14502 threaded_app arda.game.mtr V WindowFocusChanged: 0x71179f9a80 -- 1
2025-04-02 14:44:06.684 14502-14502 InputMethodManager arda.game.mtr W startInputReason = 1
2025-04-02 14:44:06.688 14502-14649 AudioTrack arda.game.mtr W AUDIO_OUTPUT_FLAG_FAST denied by server; frameCount 0 -> 1924
2025-04-02 14:44:06.734 14502-14502 ViewRootImpl arda.game.mtr I jank_removeInvalidNode jank list is null
2025-04-02 14:44:06.737 14502-14681 <no-tag> arda.game.mtr D PlayerBase::stop() from IPlayer
2025-04-02 14:44:06.737 14502-14649 SoLoud arda.game.mtr I Creating audio thread.
2025-04-02 14:44:06.737 14502-14681 AudioTrack arda.game.mtr D stop() called with 0 frames delivered
2025-04-02 14:44:06.737 14502-14502 InputMethodManager arda.game.mtr W startInputReason = 5
2025-04-02 14:44:06.748 14502-14649 arda arda.game.mtr D [DEBUG]: app_handle_cmd : APP_CMD_GAINED_FOCUS
2025-04-02 14:44:06.750 14502-14681 <no-tag> arda.game.mtr D PlayerBase::stop() from IPlayer
2025-04-02 14:44:06.750 14502-14681 AudioTrack arda.game.mtr D stop() called with 960 frames delivered
2025-04-02 14:44:06.933 14502-14681 <no-tag> arda.game.mtr D PlayerBase::stop() from IPlayer
2025-04-02 14:44:06.933 14502-14681 AudioTrack arda.game.mtr D stop() called with 960 frames delivered
2025-04-02 14:44:06.954 14502-14681 <no-tag> arda.game.mtr D PlayerBase::stop() from IPlayer
2025-04-02 14:44:06.954 14502-14681 AudioTrack arda.game.mtr D stop() called with 960 frames delivered
2025-04-02 14:44:06.976 14502-14681 <no-tag> arda.game.mtr D PlayerBase::stop() from IPlayer
2025-04-02 14:44:06.976 14502-14681 AudioTrack arda.game.mtr D stop() called with 960 frames delivered
2025-04-02 14:44:06.998 14502-14681 <no-tag> arda.game.mtr D PlayerBase::stop() from IPlayer
2025-04-02 14:44:06.998 14502-14681 AudioTrack arda.game.mtr D stop() called with 960 frames delivered
2025-04-02 14:44:07.020 14502-14681 <no-tag> arda.game.mtr D PlayerBase::stop() from IPlayer
2025-04-02 14:44:07.020 14502-14681 AudioTrack arda.game.mtr D stop() called with 960 frames delivered
2025-04-02 14:44:07.040 14502-14681 <no-tag> arda.game.mtr D PlayerBase::stop() from IPlayer
2025-04-02 14:44:07.040 14502-14681 AudioTrack arda.game.mtr D stop() called with 960 frames delivered
2025-04-02 14:44:07.061 14502-14681 <no-tag> arda.game.mtr D PlayerBase::stop() from IPlayer
2025-04-02 14:44:07.061 14502-14681 AudioTrack arda.game.mtr D stop() called with 960 frames delivered
2025-04-02 14:44:07.082 14502-14681 <no-tag> arda.game.mtr D PlayerBase::stop() from IPlayer
2025-04-02 14:44:07.082 14502-14681 AudioTrack arda.game.mtr D stop() called with 960 frames delivered
2025-04-02 14:44:07.104 14502-14681 <no-tag> arda.game.mtr D PlayerBase::stop() from IPlayer
2025-04-02 14:44:07.104 14502-14681 AudioTrack arda.game.mtr D stop() called with 960 frames delivered
2025-04-02 14:44:07.125 14502-14681 <no-tag> arda.game.mtr D PlayerBase::stop() from IPlayer
2025-04-02 14:44:07.126 14502-14681 AudioTrack arda.game.mtr D stop() called with 960 frames delivered
2025-04-02 14:44:07.146 14502-14681 <no-tag> arda.game.mtr D PlayerBase::stop() from IPlayer
2025-04-02 14:44:07.146 14502-14681 AudioTrack arda.game.mtr D stop() called with 960 frames delivered
2025-04-02 14:44:07.167 14502-14681 <no-tag> arda.game.mtr D PlayerBase::stop() from IPlayer
2025-04-02 14:44:07.167 14502-14681 AudioTrack arda.game.mtr D stop() called with 960 frames delivered
2025-04-02 14:44:07.169 14502-14681 <no-tag> arda.game.mtr D PlayerBase::stop() from IPlayer
2025-04-02 14:44:07.169 14502-14681 AudioTrack arda.game.mtr D stop() called with 960 frames delivered
2025-04-02 14:44:07.190 14502-14681 <no-tag> arda.game.mtr D PlayerBase::stop() from IPlayer
2025-04-02 14:44:07.190 14502-14681 AudioTrack arda.game.mtr D stop() called with 960 frames delivered
2025-04-02 14:44:07.211 14502-14681 <no-tag> arda.game.mtr D PlayerBase::stop() from IPlayer
......
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels