# asb2m10/dexed architecture

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

- Interactive diagram: https://gitdiagram.com/asb2m10/dexed
- Repository: https://github.com/asb2m10/dexed

## Overview

##### Main Components
- Synth Engine – The core FM synthesis engine is implemented in the Source folder. It is split into at least two engines (EngineMkI.cpp/h and EngineOpl.cpp/h) along with supporting DSP modules and synergy with msfa (found in Source/msfa). This engine handles synthesis processing and sound generation.
- UI & Editor Components – Files like PluginEditor.cpp/h, GlobalEditor, OperatorEditor, and Parameter dialogs indicate that the user interface is a layered set of controls that interact with the synthesis engine.
- MIDI/Sysex Communication – The presence of SysexComm.cpp/h, Cartridge and tuning managers, and related UI components explicitly deals with MIDI message handling and sysex integration.
- Build System & Deployment Scripts – The cmake files (CMakeLists.txt in root and within subdirectories), installer scripts (in Resources/Installers and scripts/ directory), and GitHub Actions workflows indicate a robust build and deployment pipeline across platforms (Linux, macOS, and Windows).

##### Relationships and Interactions
- Inside PluginProcessor (and related files like PluginData and PluginParam), indicate the data flow toward lower-level DSP and synthesis functions (EngineMkI, EngineOpl, and the msfa modules such as fm_core, op_kernel, etc.).
- Communication path for MIDI/Sysex processing flowing from input (MIDI controllers), to SysexComm, and then to update components in the synth engine.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Distinguish clearly between the UI layer (editors, skins, and dialogs) and the synthesis engine (DSP, sound generation, and midi processing). Each main folder (Source for core C++ implementation, Resources for UI assets, Documentation, and Installer scripts) should be shown as a distinct layer.
- Modular Design: Emphasize the use of submodules/libraries hosted in the libs directory and the clear modularization inside the Source directory (e.g., separate files for different editor components, algorithm display, parameter handling, etc.).
- Build & Cross-Platform Abstraction: Note the use of CMake as the primary build system along with platform-specific installer scripts in the Resources/Installers and scripts directories.

##### Following Specific Technologies/Frameworks
- JUCE – powering both the plugin wrapper and the GUI.
- msfa – powering core FM synthesis functionality.
- CMake – as the build configuration system.
- VST3, CLAP, AU – plugin APIs that the project supports, based upon integration in the build system and folders in the libs directory.
- External installer scripts and shell scripts that manage packaging and versioning.

##### Elements That Must Be Present
- Clear labels for each architectural module (UI Layer, Audio Processing Engine, MIDI/Sysex Manager, Build and Deployment Infrastructure).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input Layer
    M["MIDI Controller"]

    %% Plugin Host (JUCE Container)
    PC["JUCE Plugin Container"]:::container
    PP["Plugin Processor"]

    %% UI Layer
    subgraph "UI Layer"
        PEdi["PluginEditor"]:::ui
        GE["GlobalEditor"]:::ui
        OE["OperatorEditor"]:::ui
        PD["ParamDialog"]:::ui
    end

    %% Synthesis Engine
    subgraph "Synthesis Engine"
        EM1["EngineMkI"]:::engine
        EO["EngineOpl"]:::engine
        MS["msfa Modules"]:::engine
    end

    %% MIDI/Sysex Manager
    SM["SysexComm"]:::comm

    %% External Dependencies
    EX["External Libraries"]:::external

    %% Build & Deployment
    subgraph "Build & Deployment"
        RC["Root CMake"]:::build
        ResC["Resources CMake"]:::build
        SrcC["Source CMake"]:::build
        INS["Installers"]:::build
        SCR["Scripts"]:::build
    end

    %% Connections
    M -->|"sendsMIDI&Parameter"| PC
    M -->|"MIDI/Sysex"| SM

    PC -->|"updatesUI"| PEdi
    PC -->|"processesData"| PP

    %% UI interactions
    PC -->|"UIinteraction"| GE
    PC -->|"UIinteraction"| OE
    PC -->|"UIinteraction"| PD

    %% Data flow from Processor to Synthesis Engine
    PP -->|"drivesAudio"| EM1
    PP -->|"drivesAudio"| EO
    PP -->|"drivesAudio"| MS

    %% MIDI/Sysex communication flows
    SM -->|"updatesSynthesis"| EM1
    SM -->|"feedbackToUI"| PEdi

    %% External Dependencies integration
    EX -->|"integratesWith"| PC
    EX -->|"integratesWith"| EM1
    EX -->|"integratesWith"| EO

    %% Build and Deployment integration (dashed connectors)
    RC ---|"builds"| PC
    ResC ---|"builds"| PC
    SrcC ---|"builds"| EM1
    INS ---|"packages"| PC
    SCR ---|"scripts"| PC

    %% Styling
    classDef ui fill:#a2d2ff,stroke:#333,stroke-width:2px;
    classDef engine fill:#bde0fe,stroke:#333,stroke-width:2px;
    classDef container fill:#ffafcc,stroke:#333,stroke-width:2px;
    classDef comm fill:#ffd6a5,stroke:#333,stroke-width:2px;
    classDef build fill:#caffbf,stroke:#333,stroke-width:2px;
    classDef external fill:#e0ffff,stroke:#333,stroke-width:2px;

    %% Click Events for Plugin Wrapper & Application Shell
    click PC "https://github.com/asb2m10/dexed/blob/master/Dexed.jucer"
    click PC "https://github.com/asb2m10/dexed/tree/master/Resources/ui"

    %% Click Events for Synth Engine Components
    click EM1 "https://github.com/asb2m10/dexed/blob/master/Source/EngineMkI.cpp"
    click EM1 "https://github.com/asb2m10/dexed/blob/master/Source/EngineMkI.h"
    click EO "https://github.com/asb2m10/dexed/blob/master/Source/EngineOpl.cpp"
    click EO "https://github.com/asb2m10/dexed/blob/master/Source/EngineOpl.h"
    click MS "https://github.com/asb2m10/dexed/tree/master/Source/msfa"

    %% Click Events for UI & Editor Components
    click PEdi "https://github.com/asb2m10/dexed/blob/master/Source/PluginEditor.cpp"
    click PEdi "https://github.com/asb2m10/dexed/blob/master/Source/PluginEditor.h"
    click GE "https://github.com/asb2m10/dexed/blob/master/Source/GlobalEditor.cpp"
    click GE "https://github.com/asb2m10/dexed/blob/master/Source/GlobalEditor.h"
    click OE "https://github.com/asb2m10/dexed/blob/master/Source/OperatorEditor.cpp"
    click OE "https://github.com/asb2m10/dexed/blob/master/Source/OperatorEditor.h"
    click PD "https://github.com/asb2m10/dexed/blob/master/Source/ParamDialog.cpp"
    click PD "https://github.com/asb2m10/dexed/blob/master/Source/ParamDialog.h"

    %% Click Events for MIDI/Sysex Communication
    click SM "https://github.com/asb2m10/dexed/blob/master/Source/SysexComm.cpp"
    click SM "https://github.com/asb2m10/dexed/blob/master/Source/SysexComm.h"

    %% Click Events for Build System & Deployment Scripts
    click RC "https://github.com/asb2m10/dexed/blob/master/CMakeLists.txt"
    click ResC "https://github.com/asb2m10/dexed/blob/master/Resources/CMakeLists.txt"
    click SrcC "https://github.com/asb2m10/dexed/blob/master/Source/CMakeLists.txt"
    click INS "https://github.com/asb2m10/dexed/tree/master/Resources/Installers"
    click SCR "https://github.com/asb2m10/dexed/tree/master/scripts"

    %% Click Event for External Libraries & Plugin APIs
    click EX "https://github.com/asb2m10/dexed/tree/master/libs"
```
