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