perfromance on mobile
This commit is contained in:
parent
aeaa86794f
commit
b77b1cdf84
|
|
@ -21,6 +21,21 @@ include(FetchContent)
|
|||
option(BUILD_ANDROID "Build for Android" OFF)
|
||||
option(BUILD_IOS "Build for iOS" OFF)
|
||||
|
||||
# --- Feature Flags ---
|
||||
# Default to OFF for mobile to save resources, ON for desktop
|
||||
if(BUILD_ANDROID OR BUILD_IOS)
|
||||
option(ENABLE_TEMPO_ESTIMATION "Enable Loop Tempo Estimator for BPM detection" OFF)
|
||||
else()
|
||||
option(ENABLE_TEMPO_ESTIMATION "Enable Loop Tempo Estimator for BPM detection" ON)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TEMPO_ESTIMATION)
|
||||
message(STATUS "Tempo Estimation (Entropy) Enabled")
|
||||
add_compile_definitions(ENABLE_TEMPO_ESTIMATION)
|
||||
else()
|
||||
message(STATUS "Tempo Estimation (Entropy) Disabled")
|
||||
endif()
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Multimedia OpenGLWidgets)
|
||||
|
||||
# --- FFTW3 Configuration (Double Precision) ---
|
||||
|
|
@ -88,9 +103,11 @@ else()
|
|||
endif()
|
||||
|
||||
# --- Loop Tempo Estimator ---
|
||||
set(BUILD_TESTS OFF CACHE BOOL "Build tests" FORCE)
|
||||
set(BUILD_VAMP_PLUGIN OFF CACHE BOOL "Build Vamp plugin" FORCE)
|
||||
add_subdirectory(libraries/loop-tempo-estimator)
|
||||
if(ENABLE_TEMPO_ESTIMATION)
|
||||
set(BUILD_TESTS OFF CACHE BOOL "Build tests" FORCE)
|
||||
set(BUILD_VAMP_PLUGIN OFF CACHE BOOL "Build Vamp plugin" FORCE)
|
||||
add_subdirectory(libraries/loop-tempo-estimator)
|
||||
endif()
|
||||
|
||||
# ==========================================
|
||||
# --- ICON GENERATION ---
|
||||
|
|
@ -216,9 +233,12 @@ endif()
|
|||
target_link_libraries(YrCrystals PRIVATE
|
||||
Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Multimedia Qt6::OpenGLWidgets
|
||||
${FFTW_TARGET}
|
||||
loop-tempo-estimator
|
||||
)
|
||||
|
||||
if(ENABLE_TEMPO_ESTIMATION)
|
||||
target_link_libraries(YrCrystals PRIVATE loop-tempo-estimator)
|
||||
endif()
|
||||
|
||||
if(BUILD_ANDROID)
|
||||
target_link_libraries(YrCrystals PRIVATE log m)
|
||||
set_property(TARGET YrCrystals PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
#include <QThreadPool>
|
||||
#include <QPointer> // Added for QPointer
|
||||
#include "Utils.h"
|
||||
|
||||
#ifdef ENABLE_TEMPO_ESTIMATION
|
||||
#include "LoopTempoEstimator/LoopTempoEstimator.h"
|
||||
|
||||
// --- Helper: Memory Reader for BPM ---
|
||||
|
|
@ -38,6 +40,7 @@ private:
|
|||
long long m_numFrames;
|
||||
int m_sampleRate;
|
||||
};
|
||||
#endif
|
||||
|
||||
// =========================================================
|
||||
// AudioEngine (Playback) Implementation
|
||||
|
|
@ -243,6 +246,7 @@ void AudioEngine::onFinished() {
|
|||
|
||||
if (totalFrames > 0) {
|
||||
// 1. BPM Detection
|
||||
#ifdef ENABLE_TEMPO_ESTIMATION
|
||||
MemoryAudioReader reader(rawFloats, totalFrames, newData->sampleRate);
|
||||
auto bpmOpt = LTE::GetBpm(reader, LTE::FalsePositiveTolerance::Lenient, nullptr);
|
||||
|
||||
|
|
@ -253,6 +257,7 @@ void AudioEngine::onFinished() {
|
|||
QMetaObject::invokeMethod(self, "analysisReady", Qt::QueuedConnection,
|
||||
Q_ARG(float, bpm), Q_ARG(float, 1.0f));
|
||||
}
|
||||
#endif
|
||||
|
||||
// 2. Hilbert Transform
|
||||
std::vector<double> inputL(totalFrames), inputR(totalFrames);
|
||||
|
|
|
|||
Loading…
Reference in New Issue