Skip to content

04_15_core_config

Centralized configuration system for all AudioLab Core modules.

Quick Start

#include <alcore.hpp>

// Access configuration constants
alignas(al::cfg::CacheLine) MyData data;
static_assert(al::cfg::QParams >= 1024);

CMake Integration

add_subdirectory(04_15_core_config)
target_link_libraries(your_module PUBLIC alcore_config)

Files

  • alcore_config.hpp: Platform detection & compile-time constants
  • config_validator.hpp: Compile-time validation (automatic)
  • config_presets.hpp: Runtime switchable profiles (Debug/Release/Realtime/HighQuality/Testing)
  • rt_defaults.hpp: RT-specific utilities
  • queue_sizes.hpp: Lock-free queue capacities
  • alcore.hpp: Master include (use this)

Configuration Override

Override at CMake configuration time:

cmake -DALCORE_SPSC_CAPACITY_Params=8192 -DALCORE_CACHE_LINE_SIZE=128 ..

Presets

// Get current build mode preset
auto cfg = al::cfg::presets::getCurrent();

// Or use explicit preset
auto rtCfg = al::cfg::presets::Realtime;

Available: Debug, Release, Realtime, HighQuality, Testing

Key Constants

Memory & Alignment - CacheLine: 64/128/256 bytes (platform-detected) - AlignDefault: 16 bytes (SSE/NEON) - AlignSIMD: 16/32/64 bytes (based on CPU features) - TLSScratchBytes: 128 KB thread-local scratch - MaxBlockSize: 8192 samples max

Queue Sizes - QParams: 4096 parameter changes - QLog: 8192 log messages - QMeters: 2048 meter updates - QCommands: 1024 commands - QEvents: 2048 events - TripleDepth: 8192 triple buffer

RT Safety - RTMaxSpinNs: 10 µs max spinlock - RTMaxAllocBytes: 0 (no RT allocations) - RTWatchdogMs: 50 ms timeout

Parameters - MaxParameters: 1024 - ParamSmoothingMs: 8.0 ms - EnvSmoothingMs: 2.0 ms

Validation

All constants are validated at compile-time. Invalid configs will fail to build with clear error messages.

al::cfg::validateConfig();  // Optional runtime entry point