Skip to content

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

// Buffers multi-canal
AudioBuffer<float> buffer(numChannels, blockSize);
buffer.applyGain(0.5f);

04_06_threading_architecture

// Threading RT-safe
AudioThread audioThread;
thread_local Storage<float> cache;

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

// State machine
Uninitialized β†’ Initialized β†’ Active β†’ Suspended

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

// Save/load presets
State state;
state.serialize(file);
state.deserialize(file);

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)

Usa: Layer 1 (types) + Layer 4 (AudioProcessor, Parameter)

Plugin con Delay (Delay, Reverb)

Usa: Layer 1 + Layer 2 (RingBuffer) + Layer 4

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