# jmainguy/roland-capture-linux architecture

> Architecture diagram of the GitHub repository jmainguy/roland-capture-linux, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jmainguy/roland-capture-linux
- Repository: https://github.com/jmainguy/roland-capture-linux

## Overview

This repository provides Linux OCTA/QUAD-CAPTURE audio-device control: a native desktop panel and an `octa` CLI share device-support code. The main workflow discovers and identifies a device, reads its state, then applies validated control or sample-rate changes and verifies hardware readback; rate changes also coordinate PipeWire. Presets, diagnostics, meters, and QUAD-specific controls are additional product branches. Some UI and subsystem implementations were not sampled, so their links are omitted or marked unverified rather than inferred.

Main entry points: [`src/state.rs`](https://github.com/jmainguy/roland-capture-linux/blob/main/src/state.rs) (Device snapshot), [`src/control.rs`](https://github.com/jmainguy/roland-capture-linux/blob/main/src/control.rs) (Rate orchestration), [`src/bin/octa-control.rs`](https://github.com/jmainguy/roland-capture-linux/blob/main/src/bin/octa-control.rs) (Control panel), [`src/mixer.rs`](https://github.com/jmainguy/roland-capture-linux/blob/main/src/mixer.rs) (OCTA mixer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_panel["Control panel<br/>[octa-control.rs]"]
  node_cli["octa CLI<br/>[main.rs]"]
end

subgraph group_device["Device access"]
  node_discovery["Device discovery<br/>[identity.rs]"]
  node_alsa["ALSA discovery<br/>[alsa.rs]"]
  node_device_model["Device identity<br/>[device.rs]"]
  node_kernel_mixer["Kernel controls<br/>[kernel_mixer.rs]"]
  node_usb_rate["USB rate access<br/>[usb_rate.rs]"]
  node_sysex["SysEx transport<br/>[sysex.rs]"]
  node_seq_midi["Control MIDI<br/>[seq_midi.rs]"]
end

subgraph group_control["Control and state"]
  node_snapshot["Device snapshot<br/>[state.rs]"]
  node_typed_model["Settings model<br/>[model.rs]"]
  node_mixer["OCTA mixer<br/>[mixer.rs]"]
  node_quad["QUAD controls<br/>[quad.rs]"]
  node_preset["Preset validation<br/>[preset.rs]"]
  node_preset_apply["Preset application<br/>[preset_apply.rs]"]
  node_rate_control["Rate orchestration<br/>[control.rs]"]
end

subgraph group_support["Audio and support"]
  node_diagnostics["Diagnostics<br/>[diagnostics.rs]"]
  node_meter["Input meters<br/>[meter.rs]"]
  node_pipewire["PipeWire sync<br/>[pipewire.rs]"]
end

node_user(("Operator"))
node_external_device["Capture hardware"]
node_external_pw["PipeWire services"]

node_user -.->|"operates"| node_panel
node_user -->|"runs"| node_cli
node_panel -.->|"refreshes"| node_snapshot
node_panel -.->|"imports presets"| node_preset
node_panel -.->|"applies settings"| node_preset_apply
node_panel -.->|"exports diagnostics"| node_diagnostics
node_discovery -->|"identifies"| node_device_model
node_alsa -->|"uses identifiers"| node_device_model
node_snapshot -->|"finds card"| node_alsa
node_snapshot -->|"enumerates devices"| node_discovery
node_snapshot -->|"reads mixer"| node_mixer
node_snapshot -->|"reads controls"| node_kernel_mixer
node_snapshot -->|"reads QUAD state"| node_quad
node_snapshot -->|"reads rate"| node_usb_rate
node_mixer -->|"writes controls"| node_kernel_mixer
node_mixer -->|"uses MIDI port"| node_seq_midi
node_mixer -->|"uses settings"| node_typed_model
node_preset_apply -->|"validates settings"| node_typed_model
node_preset_apply -->|"applies mixer"| node_mixer
node_diagnostics -->|"exports snapshot"| node_snapshot
node_cli -->|"dispatches rate commands"| node_rate_control
node_rate_control -->|"finds card"| node_alsa
node_rate_control -->|"selects device"| node_device_model
node_rate_control -->|"coordinates audio"| node_pipewire
node_rate_control -->|"writes rate"| node_sysex
node_rate_control -->|"reads rate"| node_usb_rate
node_kernel_mixer -.->|"reads and writes"| node_external_device
node_seq_midi -.->|"controls"| node_external_device
node_sysex -->|"sets clock"| node_external_device
node_pipewire -->|"configures sync"| node_external_pw
node_snapshot -.->|"holds settings"| node_typed_model
node_meter -.->|"supplies readings"| node_panel

click node_panel "https://github.com/jmainguy/roland-capture-linux/blob/main/src/bin/octa-control.rs"
click node_cli "https://github.com/jmainguy/roland-capture-linux/blob/main/src/main.rs"
click node_discovery "https://github.com/jmainguy/roland-capture-linux/blob/main/src/identity.rs"
click node_alsa "https://github.com/jmainguy/roland-capture-linux/blob/main/src/alsa.rs"
click node_device_model "https://github.com/jmainguy/roland-capture-linux/blob/main/src/device.rs"
click node_snapshot "https://github.com/jmainguy/roland-capture-linux/blob/main/src/state.rs"
click node_typed_model "https://github.com/jmainguy/roland-capture-linux/blob/main/src/model.rs"
click node_mixer "https://github.com/jmainguy/roland-capture-linux/blob/main/src/mixer.rs"
click node_kernel_mixer "https://github.com/jmainguy/roland-capture-linux/blob/main/src/kernel_mixer.rs"
click node_quad "https://github.com/jmainguy/roland-capture-linux/blob/main/src/quad.rs"
click node_preset "https://github.com/jmainguy/roland-capture-linux/blob/main/src/preset.rs"
click node_preset_apply "https://github.com/jmainguy/roland-capture-linux/blob/main/src/preset_apply.rs"
click node_diagnostics "https://github.com/jmainguy/roland-capture-linux/blob/main/src/diagnostics.rs"
click node_meter "https://github.com/jmainguy/roland-capture-linux/blob/main/src/meter.rs"
click node_rate_control "https://github.com/jmainguy/roland-capture-linux/blob/main/src/control.rs"
click node_usb_rate "https://github.com/jmainguy/roland-capture-linux/blob/main/src/usb_rate.rs"
click node_sysex "https://github.com/jmainguy/roland-capture-linux/blob/main/src/sysex.rs"
click node_pipewire "https://github.com/jmainguy/roland-capture-linux/blob/main/src/pipewire.rs"
click node_seq_midi "https://github.com/jmainguy/roland-capture-linux/blob/main/src/seq_midi.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_panel,node_cli toneBlue
class node_discovery,node_alsa,node_device_model,node_kernel_mixer,node_usb_rate,node_sysex,node_seq_midi toneAmber
class node_snapshot,node_typed_model,node_mixer,node_quad,node_preset,node_preset_apply,node_rate_control toneMint
class node_diagnostics,node_meter,node_pipewire toneRose
class node_user,node_external_device,node_external_pw toneIndigo
```

## Components

### User interfaces

- [Control panel](https://github.com/jmainguy/roland-capture-linux/blob/main/src/bin/octa-control.rs): `src/bin/octa-control.rs`
- [octa CLI](https://github.com/jmainguy/roland-capture-linux/blob/main/src/main.rs): `src/main.rs`

### Device access

- [Device discovery](https://github.com/jmainguy/roland-capture-linux/blob/main/src/identity.rs): `src/identity.rs`
- [ALSA discovery](https://github.com/jmainguy/roland-capture-linux/blob/main/src/alsa.rs): `src/alsa.rs`
- [Device identity](https://github.com/jmainguy/roland-capture-linux/blob/main/src/device.rs): `src/device.rs`
- [Kernel controls](https://github.com/jmainguy/roland-capture-linux/blob/main/src/kernel_mixer.rs): `src/kernel_mixer.rs`
- [USB rate access](https://github.com/jmainguy/roland-capture-linux/blob/main/src/usb_rate.rs): `src/usb_rate.rs`
- [SysEx transport](https://github.com/jmainguy/roland-capture-linux/blob/main/src/sysex.rs): `src/sysex.rs`
- [Control MIDI](https://github.com/jmainguy/roland-capture-linux/blob/main/src/seq_midi.rs): `src/seq_midi.rs`

### Control and state

- [Device snapshot](https://github.com/jmainguy/roland-capture-linux/blob/main/src/state.rs): `src/state.rs`
- [Settings model](https://github.com/jmainguy/roland-capture-linux/blob/main/src/model.rs): `src/model.rs`
- [OCTA mixer](https://github.com/jmainguy/roland-capture-linux/blob/main/src/mixer.rs): `src/mixer.rs`
- [QUAD controls](https://github.com/jmainguy/roland-capture-linux/blob/main/src/quad.rs): `src/quad.rs`
- [Preset validation](https://github.com/jmainguy/roland-capture-linux/blob/main/src/preset.rs): `src/preset.rs`
- [Preset application](https://github.com/jmainguy/roland-capture-linux/blob/main/src/preset_apply.rs): `src/preset_apply.rs`
- [Rate orchestration](https://github.com/jmainguy/roland-capture-linux/blob/main/src/control.rs): `src/control.rs`

### Audio and support

- [Diagnostics](https://github.com/jmainguy/roland-capture-linux/blob/main/src/diagnostics.rs): `src/diagnostics.rs`
- [Input meters](https://github.com/jmainguy/roland-capture-linux/blob/main/src/meter.rs): `src/meter.rs`
- [PipeWire sync](https://github.com/jmainguy/roland-capture-linux/blob/main/src/pipewire.rs): `src/pipewire.rs`

### Other components

- **Operator**
- **Capture hardware**
- **PipeWire services**

## Connections

- Operator → Control panel: operates (evidence: `README.md`)
- Operator → octa CLI: runs (evidence: `README.md`)
- Control panel → Device snapshot: refreshes
- Control panel → Preset validation: imports presets (evidence: `README.md`)
- Control panel → Preset application: applies settings (evidence: `README.md`)
- Control panel → Diagnostics: exports diagnostics (evidence: `README.md`)
- Device discovery → Device identity: identifies (evidence: `src/identity.rs`)
- ALSA discovery → Device identity: uses identifiers (evidence: `src/alsa.rs`)
- Device snapshot → ALSA discovery: finds card (evidence: `src/state.rs`)
- Device snapshot → Device discovery: enumerates devices (evidence: `src/state.rs`)
- Device snapshot → OCTA mixer: reads mixer (evidence: `src/state.rs`)
- Device snapshot → Kernel controls: reads controls (evidence: `src/state.rs`)
- Device snapshot → QUAD controls: reads QUAD state (evidence: `src/state.rs`)
- Device snapshot → USB rate access: reads rate (evidence: `src/state.rs`)
- OCTA mixer → Kernel controls: writes controls (evidence: `src/mixer.rs`)
- OCTA mixer → Control MIDI: uses MIDI port (evidence: `src/mixer.rs`)
- OCTA mixer → Settings model: uses settings (evidence: `src/mixer.rs`)
- Preset application → Settings model: validates settings (evidence: `src/preset_apply.rs`)
- Preset application → OCTA mixer: applies mixer (evidence: `src/preset_apply.rs`)
- Diagnostics → Device snapshot: exports snapshot (evidence: `src/diagnostics.rs`)
- octa CLI → Rate orchestration: dispatches rate commands (evidence: `src/main.rs`)
- Rate orchestration → ALSA discovery: finds card (evidence: `src/control.rs`)
- Rate orchestration → Device identity: selects device (evidence: `src/control.rs`)
- Rate orchestration → PipeWire sync: coordinates audio (evidence: `src/control.rs`)
- Rate orchestration → SysEx transport: writes rate (evidence: `src/control.rs`)
- Rate orchestration → USB rate access: reads rate (evidence: `src/control.rs`)
- Kernel controls → Capture hardware: reads and writes (evidence: `README.md`)
- Control MIDI → Capture hardware: controls
- SysEx transport → Capture hardware: sets clock (evidence: `src/sysex.rs`)
- PipeWire sync → PipeWire services: configures sync (evidence: `src/pipewire.rs`)
- Device snapshot → Settings model: holds settings (evidence: `src/state.rs`)
- Input meters → Control panel: supplies readings (evidence: `README.md`)
