# ahornberg/ahornberg-vcv-modules architecture

> Architecture diagram of the GitHub repository ahornberg/ahornberg-vcv-modules, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ahornberg/ahornberg-vcv-modules
- Repository: https://github.com/ahornberg/ahornberg-vcv-modules

## Overview

##### Main Components

a. Module Layer
- Modules into functional categories:
- Audio Processing (TapeRecorder, CVFreqShift)
- MIDI Modules (MIDIController, MIDIOverAudio, MIDIPolyExpression)
- Utility Modules (Metronome, CopyPastePreset)
- Musical Tools (EqualDivision, Harmonizer)
- UI/Control Modules (FlyingFader, Tracker)

b. Core Infrastructure Layer
- Base plugin infrastructure (Ahornberg.cpp/hpp)
- Utility services (src/util directory)
- External window management system

c. Resource Layer
- Assets management (res directory)
- Presets system
- Font management

##### Component Relationships

**[VCV Rack Host Application]**
- ↑
- [Plugin Interface]
- ↑
**┌─────────┴─────────┐**
- Module Layer     │
- ┤
- Infrastructure   │
- ┤
- Resources     │
- ┘

##### Specific Implementation Details

- Rectangles: Individual modules
- Hexagons: Core services

##### Module Architecture Pattern

For each module, show the consistent pattern:
**[ModuleWidget (UI)] ←→ [Module Logic]**
- ↓
**[Port Connections]**

##### Key Technical Elements to Highlight

- The separation between UI (.hpp) and logic (.cpp) files
- Resource management system
- Test infrastructure

##### Implementation Notes

- Each module follows a consistent pattern with separate Widget and Logic classes
- Common utilities are shared across modules
- Resource management is centralized
- External window support is available for certain modules

This architecture reflects a plugin-based system with multiple independent modules sharing common infrastructure, which is typical for audio processing applications.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph VCV["VCV Rack Host Application"]
        Plugin["Plugin Interface"]
    end

    subgraph ML["Module Layer"]
        direction TB
        subgraph APM["Audio Processing Modules"]
            TR["TapeRecorder"]:::audio
            CVF["CVFreqShift"]:::audio
        end

        subgraph MM["MIDI Modules"]
            MC["MIDIController"]:::midi
            MOA["MIDIOverAudio"]:::midi
            MPE["MIDIPolyExpression"]:::midi
        end

        subgraph UM["Utility Modules"]
            Met["Metronome"]:::utility
            CPP["CopyPastePreset"]:::utility
        end

        subgraph MTM["Musical Tools"]
            ED["EqualDivision"]:::musical
            Harm["Harmonizer"]:::musical
        end

        subgraph UCM["UI/Control Modules"]
            FF["FlyingFader"]:::ui
            Track["Tracker"]:::ui
        end
    end

    subgraph Core["Core Infrastructure Layer"]
        direction TB
        PI["Plugin Infrastructure"]:::infra
        WM["Window Management"]:::infra
        Utils["Utility Services"]:::infra
        Test["Testing Infrastructure"]:::infra
    end

    subgraph RL["Resource Layer"]
        direction TB
        Assets["Asset Management"]:::resource
        Presets["Preset System"]:::resource
        Fonts["Font Management"]:::resource
    end

    VCV --> Plugin
    Plugin --> ML
    ML --> Core
    Core --> RL

    classDef audio fill:#3498db
    classDef midi fill:#2ecc71
    classDef utility fill:#f1c40f
    classDef musical fill:#e67e22
    classDef ui fill:#9b59b6
    classDef infra fill:#95a5a6
    classDef resource fill:#34495e

    %% Click events for components
    click PI "https://github.com/Ahornberg/Ahornberg-VCV-Modules/blob/master/src/Ahornberg.cpp"
    click WM "https://github.com/Ahornberg/Ahornberg-VCV-Modules/blob/master/src/include/WindowManager.h"
    click TR "https://github.com/Ahornberg/Ahornberg-VCV-Modules/tree/master/src/modules/TapeRecorder"
    click CVF "https://github.com/Ahornberg/Ahornberg-VCV-Modules/tree/master/src/modules/CVFreqShift"
    click MC "https://github.com/Ahornberg/Ahornberg-VCV-Modules/tree/master/src/modules/MIDIController"
    click MOA "https://github.com/Ahornberg/Ahornberg-VCV-Modules/tree/master/src/modules/MIDIOverAudio"
    click MPE "https://github.com/Ahornberg/Ahornberg-VCV-Modules/tree/master/src/modules/MIDIPolyExpression"
    click Met "https://github.com/Ahornberg/Ahornberg-VCV-Modules/tree/master/src/modules/Metronome"
    click CPP "https://github.com/Ahornberg/Ahornberg-VCV-Modules/tree/master/src/modules/CopyPastePreset"
    click ED "https://github.com/Ahornberg/Ahornberg-VCV-Modules/tree/master/src/modules/EqualDivision"
    click Harm "https://github.com/Ahornberg/Ahornberg-VCV-Modules/tree/master/src/modules/Harmonizer"
    click FF "https://github.com/Ahornberg/Ahornberg-VCV-Modules/tree/master/src/modules/FlyingFader"
    click Track "https://github.com/Ahornberg/Ahornberg-VCV-Modules/tree/master/src/modules/Tracker"
    click Utils "https://github.com/Ahornberg/Ahornberg-VCV-Modules/tree/master/src/util"
    click Assets "https://github.com/Ahornberg/Ahornberg-VCV-Modules/tree/master/res"
    click Fonts "https://github.com/Ahornberg/Ahornberg-VCV-Modules/tree/master/res/fonts"
    click Presets "https://github.com/Ahornberg/Ahornberg-VCV-Modules/tree/master/presets/EqualDivision"
    click Test "https://github.com/Ahornberg/Ahornberg-VCV-Modules/blob/master/src/test/Asserts.cpp"
```
