# hundredrabbits/orca architecture

> Architecture diagram of the GitHub repository hundredrabbits/orca, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hundredrabbits/orca
- Repository: https://github.com/hundredrabbits/orca

## Overview

##### Main Components Identification

The system should be represented with these primary components:

a) Desktop Application Layer (Electron-based):
- Main Process (desktop/main.js)
- Renderer Process (desktop/sources/index.html)

b) Core Engine Layer:
- ORCA Engine (core/orca.js)
- Operator System (core/operator.js)
- Library Management (core/library.js)

c) I/O Interface Layer:
- MIDI Interface (core/io/midi.js)
- OSC Interface (core/io/osc.js)
- UDP Interface (core/io/udp.js)
- CC Interface (core/io/cc.js)
- Mono Output (core/io/mono.js)

d) User Interface Components:
- Clock System (scripts/clock.js)
- Command Interface (scripts/commander.js)
- Cursor Management (scripts/cursor.js)
- Client Handler (scripts/client.js)

**┌─ User Interface Layer ─────────────────┐**
- [Client] ←→ [Commander] ←→ [Clock]   │
- ↕                         │
- Core Engine Layer ────────────────────┤
- [ORCA Engine] ←→ [Operator System]   │
- ↕            ↕                 │
- [Library] ←→ [Transpose System]      │
- ↓                         │
- I/O Interface Layer ─────────────────-┤
- [MIDI] [OSC] [UDP] [CC] [Mono Output] │
- ┘

##### Connection Types

- Double lines: Data flow

##### Additional Elements

- The different operator types (A-Z)
- The base36 numerical system
- The MIDI/OSC/UDP port configurations
- The command system structure

##### Implementation Notes

- Keep the main electron process and renderer process relationship clear
- How the library system integrates with the core engine
- Event loop for the clock system
- Demonstrate how the I/O interfaces interact with external systems

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Desktop
        MainProcess["Main Process"]
        RendererProcess["Renderer Process"]
    end

    subgraph UI["User Interface Layer"]
        Client["Client Handler"]
        Commander["Command Interface"]
        Clock["Clock System"]
        Acels["Accelerator Controls"]
        History["History Management"]
        Theme["Theme System"]
        Source["Source Management"]
    end

    subgraph Core["Core Engine Layer"]
        Orca["ORCA Engine"]
        Operator["Operator System"]
        Library["Library Management"]
        Transpose["Transpose System"]
    end

    subgraph IO["I/O Interface Layer"]
        IOBase["I/O Base"]
        MIDI["MIDI Interface"]
        OSC["OSC Interface"]
        UDP["UDP Interface"]
        CC["CC Interface"]
        Mono["Mono Output"]
    end

    MainProcess <--> RendererProcess
    RendererProcess --> Client

    Client <--> Commander
    Client <--> Clock
    Client <--> Acels
    Client <--> History
    Client <--> Theme
    Client <--> Source

    Commander --> Orca
    Clock --> Orca
    
    Orca <--> Operator
    Orca <--> Library
    Orca <--> Transpose
    
    Orca --> IOBase
    IOBase --> MIDI
    IOBase --> OSC
    IOBase --> UDP
    IOBase --> CC
    IOBase --> Mono

    classDef default fill:#f9f9f9,stroke:#333,stroke-width:1px
    classDef desktop fill:#d4d4d4,stroke:#333
    classDef ui fill:#b3d9ff,stroke:#333
    classDef core fill:#90EE90,stroke:#333
    classDef io fill:#ffb366,stroke:#333

    class MainProcess,RendererProcess desktop
    class Client,Commander,Clock,Acels,History,Theme,Source ui
    class Orca,Operator,Library,Transpose core
    class IOBase,MIDI,OSC,UDP,CC,Mono io

    click MainProcess "https://github.com/hundredrabbits/Orca/blob/main/desktop/main.js"
    click RendererProcess "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/index.html"
    click Client "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/scripts/client.js"
    click Commander "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/scripts/commander.js"
    click Clock "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/scripts/clock.js"
    click Acels "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/scripts/lib/acels.js"
    click History "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/scripts/lib/history.js"
    click Theme "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/scripts/lib/theme.js"
    click Source "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/scripts/lib/source.js"
    click Orca "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/scripts/core/orca.js"
    click Operator "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/scripts/core/operator.js"
    click Library "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/scripts/core/library.js"
    click Transpose "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/scripts/core/transpose.js"
    click IOBase "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/scripts/core/io.js"
    click MIDI "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/scripts/core/io/midi.js"
    click OSC "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/scripts/core/io/osc.js"
    click UDP "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/scripts/core/io/udp.js"
    click CC "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/scripts/core/io/cc.js"
    click Mono "https://github.com/hundredrabbits/Orca/blob/main/desktop/sources/scripts/core/io/mono.js"
```
