CORE Architecture Overview¶
Arquitectura completa del sistema 04_CORE y cΓ³mo fluyen los datos
ποΈ Vista General¶
04_CORE estΓ‘ organizado en 5 capas arquitectΓ³nicas con 16 subsistemas totales.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LAYER 5: Cross-Cutting (12-15) β
β Error Recovery | Platform | Testing | Config β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β²
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LAYER 4: Plugin Infrastructure (08-11) β
β Parameters | Lifecycle | Processor | Serialization β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β²
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LAYER 3: Audio Processing (05-07) β
β Buffers | Threading | Events β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β²
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LAYER 2: Memory & Safety (03-04) β
β Memory Management | RT-Safety β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β²
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LAYER 1: Foundation (00-02) β
β Types | Interfaces | Math β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Layer 1: Foundation (00-02)¶
Base fundacional - zero dependencies externas
04_00_type_system¶
// Tipos bΓ‘sicos para audio
Sample<float> sample;
AudioBuffer<float, 2> stereoBuffer;
SIMDVector<float, 4> simdData; // AVX2/NEON
04_01_core_interfaces¶
// Interfaces puras (contratos)
class IAudioProcessor { virtual void process(...) = 0; };
class IActivatable { virtual void activate() = 0; };
04_02_math_primitives¶
// DSP math optimizado
float y = fast_sin(x); // 1000x faster than std::sin
float db = linear_to_db(gain);
Usado por: Todas las capas superiores
π Layer 2: Memory & Safety (03-04)¶
GarantΓas RT-safe y gestiΓ³n de memoria
04_03_memory_management¶
// Allocators RT-safe
PoolAllocator<128> voices(64); // Voice pool
RingBuffer<float> delay(48000); // Delay line
TripleBuffer<float> param; // Lock-free updates
04_04_realtime_safety¶
// Primitivas lock-free
WaitFreeSPSC<Event, 256> queue;
RT_SAFE void process() { /* verified */ }
RTWatchdog watchdog; // Hang detection
Usado por: Layer 3 (buffers, events, threads)
π΅ Layer 3: Audio Processing (05-07)¶
Infraestructura de procesamiento audio
04_05_buffer_management¶
04_06_threading_architecture¶
04_07_event_dispatcher¶
// GUI β Audio communication
EventDispatcher::instance().dispatch(event);
enqueue_deferred(event); // RT-safe
Usado por: Layer 4 (plugins)
π Layer 4: Plugin Infrastructure (08-11)¶
Sistema completo de plugins
04_08_parameter_system¶
Parameter<float> gain("Gain", 0, 10, 1);
gain.set(5.0f); // GUI thread
float value = gain.get(); // Audio thread (smoothed)
04_09_plugin_lifecycle¶
04_10_audio_processor (β MΓ‘s usado)¶
class MyPlugin : public AudioProcessor {
protected:
void on_prepare(const ProcessorConfig& config) override {
// Allocate here
}
void on_process(...) noexcept override {
// DSP here (RT-safe)
}
};
04_11_state_serialization¶
Usado por: Tus plugins y mΓ³dulos
π οΈ Layer 5: Cross-Cutting (12-15)¶
Servicios transversales
04_12_error_recovery¶
- Error handling strategies
- Recovery mechanisms
04_13_platform_abstraction¶
- Windows/Mac/Linux/ARM abstraction
- Platform-specific optimizations
04_14_audio_test_utilities¶
- Test generators
- Audio analysis tools
04_15_core_config¶
- Build-time configuration
- Feature flags
π Flujo de Datos TΓpico¶
1. InicializaciΓ³n¶
DAW/Host
β
ββ> prepareToPlay(sampleRate, bufferSize)
β ββ> on_prepare()
β ββ> Allocate RingBuffer (Layer 2)
β ββ> Create Parameters (Layer 4)
β ββ> Initialize AudioBuffer (Layer 3)
β
ββ> activate()
ββ> on_activate()
ββ> Prime buffers
2. Processing Loop¶
Audio Thread (RT-critical)
β
ββ> processBlock(buffer)
ββ> Read Parameters (Layer 4)
β ββ> Uses: TripleBuffer (Layer 2)
β
ββ> on_process(inputs, outputs, numSamples)
β ββ> Read: RingBuffer (Layer 2)
β ββ> Math: fast_sin() (Layer 1)
β ββ> Write: outputs
β
ββ> Enqueue events (Layer 3)
ββ> Uses: WaitFreeSPSC (Layer 2)
3. GUI Updates¶
GUI Thread (Non-RT)
β
ββ> User moves slider
β ββ> parameter.set(value)
β ββ> TripleBuffer::write() (Lock-free)
β
ββ> Timer (30ms)
ββ> process_deferred_events()
ββ> EventDispatcher (Layer 3)
ββ> Update meters, displays
π Dependency Graph¶
graph TD
TuPlugin[Tu Plugin]
TuPlugin --> L4_10[AudioProcessor]
TuPlugin --> L4_08[Parameter]
L4_10 --> L3_05[AudioBuffer]
L4_10 --> L3_07[EventDispatcher]
L4_08 --> L2_03[TripleBuffer]
L3_05 --> L1_00[Sample Types]
L3_07 --> L2_04[WaitFreeSPSC]
L2_03 --> L1_00
L2_04 --> L1_01[Interfaces]
Regla clave: Las flechas siempre van hacia abajo (capas superiores usan inferiores)
π― Patrones de Uso Comunes¶
Plugin Simple (Gain, Pan)¶
Plugin con Delay (Delay, Reverb)¶
Plugin Complejo (Synth)¶
Usa: Todas las capas
- Layer 1: SIMD types
- Layer 2: PoolAllocator (voices), RingBuffer (effects)
- Layer 3: Threading (voice rendering)
- Layer 4: Full plugin infrastructure
π Ver TambiΓ©n¶
- Using CORE Library - CΓ³mo empezar
- Building Plugins - Tutorial paso a paso
- Delay Example - CΓ³digo real
- System Audit - AnΓ‘lisis completo