# jdlmendi/adaptivemetronome architecture

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

- Interactive diagram: https://gitdiagram.com/jdlmendi/adaptivemetronome
- Repository: https://github.com/jdlmendi/adaptivemetronome

## Overview

##### Main Components
- Plugin Core:
- PluginProcessor – the central audio processing engine.
- PluginEditor – the graphical user interface (GUI) component where users manipulate simulation parameters and interact with the plug-in.
- Simulation/Model Components:
- EnsembleModel – the core simulation of the quartet, managing the timing and synchronization of the virtual musicians.
- Player and UserPlayer – implement behaviors for virtual and possibly real (user-controlled) players.
- Communication Interface:
- OSCHandler – to manage any Open Sound Control (OSC) messages for communication with external devices or software.
- Configuration Files (PropertiesForConfig.txt) – represent system configurations/settings that might be loaded at startup or during runtime.

##### Out the Relationships/Interactions
- Within the plug-in, illustrate that the PluginEditor (UI) communicates user commands and adjustments to the PluginProcessor.
- The PluginProcessor should be shown interfacing with the EnsembleModel to update the simulation state in real time.
- That the EnsembleModel then interacts with the Player and UserPlayer classes to execute the performance logic.
- The OSCHandler should be connected to both the PluginProcessor and the EnsembleModel (or even directly to the players if necessary) to show that it handles external OSC messages, providing additional control or synchronization cues.

##### Architectural Patterns / Design Principles
- Separation of concerns: the graphical interface (PluginEditor) is decoupled from the processing logic (PluginProcessor) and the simulation logic (EnsembleModel and related classes). This separation aligns with common patterns (such as MVC) in audio plug-in design.
- That the use of classes like OSCHandler underlines the plug-in’s extensibility in handling external communication protocols.
- How the simulation’s modular components (EnsembleModel, Player, UserPlayer) fit within the processing workflow.

##### Relevant Technologies, Frameworks, or Libraries
- JUCE framework: Underpins both the audio processing and UI aspects.
- Audio plug-in formats: AU (for Logic Pro) and VST3 (for Reaper).
- MIDI and OSC protocols: Emphasize that the project integrates these communication standards.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Interfaces
    subgraph "External Interfaces"
        DAW["DAW Host (Logic Pro / Reaper)"]
    end

    %% Plugin Core Components
    subgraph "Plugin Core"
        PP["PluginProcessor"]
        PE["PluginEditor"]
        CF["PropertiesForConfig.txt"]
    end

    %% Simulation Model Components
    subgraph "Simulation Model"
        EM["EnsembleModel"]
        P["Player"]
        UP["UserPlayer"]
    end

    %% Communication Layer
    subgraph "Communication Layer"
        OSCH["OSCHandler"]
    end

    %% Relationships / Data Flow
    DAW -->|"MIDI/control"| PP
    PE -->|"parameter_adjustments"| PP
    CF -->|"load_config"| PP
    PP -->|"update_simulation"| EM
    EM -->|"play_note"| P
    EM -->|"play_note"| UP
    OSCH -->|"OSC_messages"| PP
    OSCH -->|"OSC_sync"| EM

    %% Click Events for PluginProcessor
    click PP "https://github.com/jdlmendi/adaptivemetronome/blob/Evaluation/Source/PluginProcessor.cpp"
    click PP "https://github.com/jdlmendi/adaptivemetronome/blob/Evaluation/Source/PluginProcessor.h"

    %% Click Events for PluginEditor
    click PE "https://github.com/jdlmendi/adaptivemetronome/blob/Evaluation/Source/PluginEditor.cpp"
    click PE "https://github.com/jdlmendi/adaptivemetronome/blob/Evaluation/Source/PluginEditor.h"

    %% Click Events for EnsembleModel
    click EM "https://github.com/jdlmendi/adaptivemetronome/blob/Evaluation/Source/EnsembleModel.cpp"
    click EM "https://github.com/jdlmendi/adaptivemetronome/blob/Evaluation/Source/EnsembleModel.h"

    %% Click Events for Player
    click P "https://github.com/jdlmendi/adaptivemetronome/blob/Evaluation/Source/Player.cpp"
    click P "https://github.com/jdlmendi/adaptivemetronome/blob/Evaluation/Source/Player.h"

    %% Click Events for UserPlayer
    click UP "https://github.com/jdlmendi/adaptivemetronome/blob/Evaluation/Source/UserPlayer.cpp"
    click UP "https://github.com/jdlmendi/adaptivemetronome/blob/Evaluation/Source/UserPlayer.h"

    %% Click Events for OSCHandler
    click OSCH "https://github.com/jdlmendi/adaptivemetronome/blob/Evaluation/Source/OSCHandler.cpp"
    click OSCH "https://github.com/jdlmendi/adaptivemetronome/blob/Evaluation/Source/OSCHandler.h"

    %% Click Event for Configuration File
    click CF "https://github.com/jdlmendi/adaptivemetronome/blob/Evaluation/PropertiesForConfig.txt"

    %% Class Definitions for Colors
    classDef external fill:#f9e79f,stroke:#b9770e,stroke-width:2px;
    classDef core fill:#aed6f1,stroke:#2471a3,stroke-width:2px;
    classDef simulation fill:#abebc6,stroke:#1e8449,stroke-width:2px;
    classDef communication fill:#f5b7b1,stroke:#c0392b,stroke-width:2px;
    classDef configuration fill:#d7bde2,stroke:#8e44ad,stroke-width:2px;

    %% Assigning Classes to Nodes
    class DAW external;
    class PP,PE core;
    class EM,P,UP simulation;
    class OSCH communication;
    class CF configuration;
```
