# wasted-audio/hvcc architecture

> Architecture diagram of the GitHub repository wasted-audio/hvcc, 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/wasted-audio/hvcc
- Repository: https://github.com/wasted-audio/hvcc

## Overview

##### Main Components Overview
The system should be divided into three main layers:

A. Input Layer
- Pure Data (.pd) files input
- Meta-data JSON files
- Search paths for abstractions

B. Compiler Core
- Heavy Language (hv) representation
- Heavy IR (Intermediate Representation)
- Core processing components

C. Output Layer
- C/C++ generation
- Framework-specific generators
- Build system integration

##### Detailed Component Breakdown

a) Core Components (hvcc/core):
- hv2ir: Converter from Heavy Language to IR
- JSON definitions (heavy.ir.json, heavy.lang.json)
- Parser components
- Graph processing

b) Interpreters (hvcc/interpreters):
- pd2hv: Pure Data to Heavy Language converter
- Connection handling
- Object management

c) Generators (hvcc/generators):
- ir2c: IR to C/C++ converter
- Framework-specific generators:
- Daisy
- DPF
- JavaScript
- OWL
- PD External
- Unity
- Wwise

##### Data Flow Representation

**Input → Interpreter → Core Processing → Generators → Output**
**[.pd files] → [pd2hv] → [hv2ir] → [ir2c/framework generators] → [Generated Code]**

**[Input Sources] → [Compiler Core] → [Output Generators]**
- ↓                  ↓                    ↓
**[File System]    [Processing Pipeline]  [Framework Adapters]**
- ↓                  ↓                    ↓
**[Configuration]   [Optimizations]      [Build Integration]**

##### Implementation Notes
- Use standardized UML notation where appropriate
- Version/configuration management touchpoints
- Test integration points
- External dependency connections

This system design should capture both the high-level architecture and the detailed relationships between components while maintaining clarity and usefulness for development purposes.

Remember to include notes about the various supported platforms and frameworks as auxiliary information, as these affect the overall system design and generation paths.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef input fill:#a8d1f0,stroke:#000
    classDef core fill:#90EE90,stroke:#000
    classDef ir fill:#FFE5B4,stroke:#000
    classDef generator fill:#FFA07A,stroke:#000
    classDef output fill:#DDA0DD,stroke:#000
    classDef framework fill:#F0E68C,stroke:#000

    %% Input Layer
    subgraph InputLayer
        PD[".pd Files"]:::input
        Meta["Meta-data JSON"]:::input
        Paths["Search Paths"]:::input
    end

    %% Core Processing Layer
    subgraph CoreLayer
        PD2HV["Pure Data Interpreter"]:::core
        HV2IR["Heavy Language Core"]:::core
        Types["Core Types"]:::core
        IR["Heavy IR"]:::ir
        HVLang["Heavy Language Spec"]:::ir
        HVDef["Heavy IR Spec"]:::ir
    end

    %% Generator Layer
    subgraph GeneratorLayer
        IR2C["IR to C/C++ Generator"]:::generator
        Copyright["Copyright Management"]:::generator
    end

    %% Framework Generators
    subgraph Frameworks
        Daisy["Daisy Generator"]:::framework
        DPF["DPF Generator"]:::framework
        JS["JavaScript Generator"]:::framework
        OWL["OWL Generator"]:::framework
        PDExt["PD External Generator"]:::framework
        Unity["Unity Generator"]:::framework
        Wwise["Wwise Generator"]:::framework
    end

    %% Output Layer
    subgraph OutputLayer
        CCode["C/C++ Output"]:::output
        FrameworkCode["Framework-Specific Code"]:::output
        BuildSystem["Build Integration"]:::output
    end

    %% Main Compiler
    Compiler["Main Compiler Interface"]:::core

    %% Relationships
    PD --> PD2HV
    Meta --> PD2HV
    Paths --> PD2HV
    PD2HV --> HV2IR
    HV2IR --> IR
    IR --> IR2C
    Types --> HV2IR
    HVLang --> HV2IR
    HVDef --> IR
    IR2C --> Copyright
    Copyright --> CCode
    IR2C --> Frameworks
    Frameworks --> FrameworkCode
    Compiler --> PD2HV
    Compiler --> HV2IR
    Compiler --> IR2C

    %% Click Events
    click PD2HV "https://github.com/Wasted-Audio/hvcc/tree/develop/hvcc/interpreters/pd2hv/"
    click HV2IR "https://github.com/Wasted-Audio/hvcc/tree/develop/hvcc/core/hv2ir/"
    click IR "https://github.com/Wasted-Audio/hvcc/tree/develop/hvcc/core/json/"
    click IR2C "https://github.com/Wasted-Audio/hvcc/tree/develop/hvcc/generators/ir2c/"
    click Daisy "https://github.com/Wasted-Audio/hvcc/tree/develop/hvcc/generators/c2daisy/"
    click DPF "https://github.com/Wasted-Audio/hvcc/tree/develop/hvcc/generators/c2dpf/"
    click JS "https://github.com/Wasted-Audio/hvcc/tree/develop/hvcc/generators/c2js/"
    click OWL "https://github.com/Wasted-Audio/hvcc/tree/develop/hvcc/generators/c2owl/"
    click PDExt "https://github.com/Wasted-Audio/hvcc/tree/develop/hvcc/generators/c2pdext/"
    click Unity "https://github.com/Wasted-Audio/hvcc/tree/develop/hvcc/generators/c2unity/"
    click Wwise "https://github.com/Wasted-Audio/hvcc/tree/develop/hvcc/generators/c2wwise/"
    click Types "https://github.com/Wasted-Audio/hvcc/tree/develop/hvcc/types/"
    click Copyright "https://github.com/Wasted-Audio/hvcc/tree/develop/hvcc/generators/copyright/"
    click Compiler "https://github.com/Wasted-Audio/hvcc/blob/develop/hvcc/compiler.py"
    click HVLang "https://github.com/Wasted-Audio/hvcc/blob/develop/hvcc/core/json/heavy.lang.json"
    click HVDef "https://github.com/Wasted-Audio/hvcc/blob/develop/hvcc/core/json/heavy.ir.json"

    %% Legend
    subgraph Legend
        L1["Input Components"]:::input
        L2["Core Processing"]:::core
        L3["Intermediate Rep"]:::ir
        L4["Generators"]:::generator
        L5["Framework Specific"]:::framework
        L6["Output"]:::output
    end
```
