# ioma8/littlegptracker architecture

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

- Interactive diagram: https://gitdiagram.com/ioma8/littlegptracker
- Repository: https://github.com/ioma8/littlegptracker

## Overview

##### Main Components

- Core Application Layer – This is where the tracking functionality lives. It includes modules for:
- Application logic (see sources/Application, with subdirectories like Controllers, Instruments, Mixer, Model, Persistency, Player, and Views)
- UI Framework and Views (found in sources/UIFramework and sources/Application/Views)

- Services Layer – This layer provides system-wide capabilities such as:
- Audio Services: Drivers and mixers (sources/Services/Audio, sources/Application/Audio)
- MIDI Services: Message handling and device management (sources/Services/Midi, sources/Application/Instruments for MIDI instruments)
- Controller Services: Input handling via various controllers (sources/Services/Controllers)
- Time Services and other utilities (sources/Services/Time, Foundation utilities)

- Adapters/Platform Abstraction Layer – Given the extensive set of adapters in sources/Adapters for different target platforms (e.g., CAANOO, DINGOO, GP2X, Jack, NDS, OSX, PSP, W32, etc.), this layer abstracts platform-specific functionality. It should also include any specialized audio, filesystem, and user interface implementations for each platform.

- Foundation and System Layer – This includes core utilities, error handling, memory management, logging, file systems, and process control (see sources/Foundation, sources/System). This layer supports both the Application and Services layers.

- External Libraries Integration – Components like SDL, RtAudio, RtMidi, and TinyXML (maintained under sources/Externals) interact with both the adapters and the core services, providing third-party functionality such as sound, MIDI communication, and XML parsing.

- Separation of concerns:
- The Core Application layer uses the Services layer to handle business logic (audio mixing, MIDI, UI updates) without depending directly on platform-specific details.
- The Adapters layer provides a bridge between the generic services and the low-level, platform-specific implementations.
- External libraries are “plugged into” the Services and Adapters layers, showing how third-party tools (SDL, RtAudio, etc.) are leveraged.

- From Adapters to Services (e.g., platform-specific Audio input/output channels flowing into the Audio Service)
- From Services to Application (e.g., processed MIDI events triggering UI or model updates)
- Between Foundation/System Utilities and all higher layers (providing common support like logging, error handling, and file I/O)

##### Architectural Patterns and Design Principles

- The Adapter Pattern – This is central to the project, as each “sources/Adapters/*” directory houses platform-specific code that implements abstract interfaces expected by the rest of the system.
- Separation of Concerns – Each subdirectory (for instruments, controllers, persistency, etc.) handles a distinct function, supporting easier maintainability and testing.
- Layered Architecture – The project is clearly structured from low-level system components upward to application-specific business logic and presentation.

##### Specific Technologies/Frameworks

- SDL and its variants (GP2XSDL, WSDL, etc.) for cross-platform graphics, audio, and event handling.
- RtAudio and RtMidi for real-time audio and MIDI services.
- TinyXML for XML parsing (configuration, project persistence, mapping specifications).

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% Foundation & System Layer
    subgraph "Foundation & System"
        FS["Foundation & System"]:::foundation
    end

    %% External Libraries Integration
    subgraph "External Libraries"
        EL["External Libraries"]:::external
    end

    %% Adapters/Platform Abstraction Layer
    subgraph "Adapters/Platform Abstraction"
        PA["Platform Adapters"]:::adapters
    end

    %% Services Layer
    subgraph "Services Layer"
        AAS["Audio Services"]:::services
        MMS["MIDI Services"]:::services
        CS["Controller Services"]:::services
        TS["Time Services"]:::services
    end

    %% Core Application Layer
    subgraph "Core Application Layer"
        AL["Application Logic"]:::coreApp
        UV["UI Framework & Views"]:::coreApp
    end

    %% Inter-layer Connections

    %% Core Application uses Services
    AL -->|"invokes"| AAS
    AL -->|"invokes"| MMS
    AL -->|"invokes"| CS
    AL -->|"invokes"| TS

    %% Services Interaction with Adapters
    PA -->|"providesInterface"| AAS
    PA -->|"providesInterface"| MMS
    PA -->|"providesInterface"| CS
    PA -->|"providesInterface"| TS

    %% External Libraries support Adapters and Services
    EL -->|"integratesWith"| PA
    EL -->|"integratesWith"| AAS

    %% All higher layers use Foundation & System Utilities
    AL -->|"uses"| FS
    UV -->|"uses"| FS
    AAS -->|"uses"| FS
    MMS -->|"uses"| FS
    CS -->|"uses"| FS
    TS -->|"uses"| FS
    PA -->|"uses"| FS
    EL -->|"uses"| FS

    %% Class Definitions for Colors
    classDef coreApp fill:#f9e79f,stroke:#333,stroke-width:2px;
    classDef services fill:#aed6f1,stroke:#333,stroke-width:2px;
    classDef adapters fill:#d2b4de,stroke:#333,stroke-width:2px;
    classDef foundation fill:#fadbd8,stroke:#333,stroke-width:2px;
    classDef external fill:#d5f5e3,stroke:#333,stroke-width:2px;

    %% Click Events
    click AL "https://github.com/ioma8/littlegptracker/tree/master/sources/Application"
    click UV "https://github.com/ioma8/littlegptracker/tree/master/sources/UIFramework"
    click AAS "https://github.com/ioma8/littlegptracker/tree/master/sources/Services/Audio"
    click MMS "https://github.com/ioma8/littlegptracker/tree/master/sources/Services/Midi"
    click CS "https://github.com/ioma8/littlegptracker/tree/master/sources/Services/Controllers"
    click TS "https://github.com/ioma8/littlegptracker/tree/master/sources/Services/Time"
    click PA "https://github.com/ioma8/littlegptracker/tree/master/sources/Adapters"
    click FS "https://github.com/ioma8/littlegptracker/tree/master/sources/Foundation"
    click EL "https://github.com/ioma8/littlegptracker/tree/master/sources/Externals"
```
