# ---------------------------------------------------------------------------
# synth_app — the instrument: engine setup, voice map, audio task, metrics.
# ---------------------------------------------------------------------------

# The unattended stress program. Added to the build only when the flag is on, for
# the reason the screenshot mode gives in components/synth_ui: with the flag off
# the file is not compiled at all, which is what keeps a release image identical
# to one built before the service mode existed.
set(stress_srcs "")
if(CONFIG_OBOD_STRESS)
    list(APPEND stress_srcs "src/stress.c")
endif()

idf_component_register(
    SRCS
        "src/synth_app.cpp"
        ${stress_srcs}
    INCLUDE_DIRS
        "include"
    REQUIRES
        synth_core
        synth_dsp
        bsp_jc3636k718c
        # Presets: the store lives with the other NVS state, the parameters it
        # holds live here.
        app_settings
)

# A seed for the stress program's random choices, for replaying a run: the
# constant in src/stress.c is what an ordinary build uses. It has an effect only
# with the flag on and is passed as, for example,
#
#   idf.py -DSTRESS_SEED=7 build
#
if(CONFIG_OBOD_STRESS AND DEFINED STRESS_SEED)
    target_compile_definitions(${COMPONENT_LIB} PRIVATE STRESS_SEED=${STRESS_SEED})
endif()
