# old-tech3465/wiispin architecture

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

- Interactive diagram: https://gitdiagram.com/old-tech3465/wiispin
- Repository: https://github.com/old-tech3465/wiispin

## Overview

WiiSpin is a Wii homebrew Sendspin player. Its main workflow initializes the device and audio, connects to a Sendspin server, synchronizes and buffers playback, then presents player state and controls through the on-screen UI. Supporting branches cover secure transport and pairing, visualizations and beat lighting, artwork, and diagnostics. Edges are limited to calls visible in excerpts or capabilities and relationships stated in the README; unsampled implementation details are not inferred.

Main entry points: [`src/main.c`](https://github.com/old-tech3465/wiispin/blob/main/src/main.c) (Runtime coordinator), [`src/sendspin.c`](https://github.com/old-tech3465/wiispin/blob/main/src/sendspin.c) (Sendspin session), [`src/pairing.c`](https://github.com/old-tech3465/wiispin/blob/main/src/pairing.c) (Pairing flow), [`src/audio.c`](https://github.com/old-tech3465/wiispin/blob/main/src/audio.c) (PCM playback and DMA)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and playback"]
  node_main["Runtime coordinator<br/>[main.c]"]
  node_audio["PCM playback and DMA<br/>[audio.c]"]
  node_timefilter["Clock synchronization<br/>[timefilter.c]"]
end

subgraph group_protocol["Connection and identity"]
  node_sendspin["Sendspin session<br/>[sendspin.c]"]
  node_websocket["WebSocket transport<br/>[ws.c]"]
  node_noise["Noise encryption<br/>[noise.c]"]
  node_crypto["Cryptographic primitives<br/>[crypto.c]"]
  node_identity["Identity and credentials<br/>[identity.c]"]
  node_pairing["Pairing flow<br/>[pairing.c]"]
  node_cpace["CPace PAKE<br/>[cpace.c]"]
  node_paircode["Pairing code<br/>[paircode.c]"]
end

subgraph group_experience["Player experience"]
  node_ui["Setup and player UI<br/>[ui.c]"]
  node_gx["GX rendering<br/>[ui_gx.c]"]
  node_display["Display calibration<br/>[display.c]"]
  node_artwork["Artwork decoding<br/>[artwork_decode.c]"]
  node_viz["Spectrum visualization<br/>[viz.c]"]
  node_led["Beat slot lighting<br/>[disc_led.c]"]
end

subgraph group_support["Device support"]
  node_logging[("Rotating diagnostics log<br/>[log.c]")]
end

node_user(("Wii user"))
node_server["Sendspin server"]

node_user -->|"operates"| node_main
node_main -->|"loads identity"| node_identity
node_main -->|"initializes audio"| node_audio
node_main -->|"initializes display"| node_display
node_main -->|"starts session"| node_sendspin
node_main -->|"decodes artwork"| node_artwork
node_main -->|"sets artwork"| node_gx
node_main -->|"presents controls"| node_ui
node_main -->|"updates lighting"| node_led
node_main -->|"writes diagnostics"| node_logging
node_sendspin -->|"exchanges protocol"| node_server
node_sendspin -->|"connects through"| node_websocket
node_sendspin -->|"encrypts session"| node_noise
node_sendspin -->|"sets playback gain"| node_audio
node_sendspin -->|"pushes samples"| node_viz
node_sendspin -->|"persists pairing"| node_identity
node_sendspin -->|"handles pairing"| node_pairing
node_pairing -->|"uses PAKE"| node_cpace
node_pairing -->|"uses code"| node_paircode
node_audio -.->|"schedules to clock"| node_timefilter
node_ui -->|"renders modern mode"| node_gx
node_user -->|"sets preferences"| node_ui
node_main -->|"displays spectrum"| node_viz

click node_main "https://github.com/old-tech3465/wiispin/blob/main/src/main.c"
click node_sendspin "https://github.com/old-tech3465/wiispin/blob/main/src/sendspin.c"
click node_websocket "https://github.com/old-tech3465/wiispin/blob/main/src/ws.c"
click node_noise "https://github.com/old-tech3465/wiispin/blob/main/src/noise.c"
click node_crypto "https://github.com/old-tech3465/wiispin/blob/main/src/crypto.c"
click node_identity "https://github.com/old-tech3465/wiispin/blob/main/src/identity.c"
click node_pairing "https://github.com/old-tech3465/wiispin/blob/main/src/pairing.c"
click node_cpace "https://github.com/old-tech3465/wiispin/blob/main/src/cpace.c"
click node_paircode "https://github.com/old-tech3465/wiispin/blob/main/src/paircode.c"
click node_audio "https://github.com/old-tech3465/wiispin/blob/main/src/audio.c"
click node_timefilter "https://github.com/old-tech3465/wiispin/blob/main/src/timefilter.c"
click node_ui "https://github.com/old-tech3465/wiispin/blob/main/src/ui.c"
click node_gx "https://github.com/old-tech3465/wiispin/blob/main/src/ui_gx.c"
click node_display "https://github.com/old-tech3465/wiispin/blob/main/src/display.c"
click node_artwork "https://github.com/old-tech3465/wiispin/blob/main/src/artwork_decode.c"
click node_viz "https://github.com/old-tech3465/wiispin/blob/main/src/viz.c"
click node_led "https://github.com/old-tech3465/wiispin/blob/main/src/disc_led.c"
click node_logging "https://github.com/old-tech3465/wiispin/blob/main/src/log.c"

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_main,node_audio,node_timefilter,node_user toneBlue
class node_sendspin,node_websocket,node_noise,node_crypto,node_identity,node_pairing,node_cpace,node_paircode toneAmber
class node_ui,node_gx,node_display,node_artwork,node_viz,node_led,node_server toneMint
class node_logging toneRose
```

## Components

### Runtime and playback

- [Runtime coordinator](https://github.com/old-tech3465/wiispin/blob/main/src/main.c): `src/main.c`
- [PCM playback and DMA](https://github.com/old-tech3465/wiispin/blob/main/src/audio.c): `src/audio.c`
- [Clock synchronization](https://github.com/old-tech3465/wiispin/blob/main/src/timefilter.c): `src/timefilter.c`

### Connection and identity

- [Sendspin session](https://github.com/old-tech3465/wiispin/blob/main/src/sendspin.c): `src/sendspin.c`
- [WebSocket transport](https://github.com/old-tech3465/wiispin/blob/main/src/ws.c): `src/ws.c`
- [Noise encryption](https://github.com/old-tech3465/wiispin/blob/main/src/noise.c): `src/noise.c`
- [Cryptographic primitives](https://github.com/old-tech3465/wiispin/blob/main/src/crypto.c): `src/crypto.c`
- [Identity and credentials](https://github.com/old-tech3465/wiispin/blob/main/src/identity.c): `src/identity.c`
- [Pairing flow](https://github.com/old-tech3465/wiispin/blob/main/src/pairing.c): `src/pairing.c`
- [CPace PAKE](https://github.com/old-tech3465/wiispin/blob/main/src/cpace.c): `src/cpace.c`
- [Pairing code](https://github.com/old-tech3465/wiispin/blob/main/src/paircode.c): `src/paircode.c`

### Player experience

- [Setup and player UI](https://github.com/old-tech3465/wiispin/blob/main/src/ui.c): `src/ui.c`
- [GX rendering](https://github.com/old-tech3465/wiispin/blob/main/src/ui_gx.c): `src/ui_gx.c`
- [Display calibration](https://github.com/old-tech3465/wiispin/blob/main/src/display.c): `src/display.c`
- [Artwork decoding](https://github.com/old-tech3465/wiispin/blob/main/src/artwork_decode.c): `src/artwork_decode.c`
- [Spectrum visualization](https://github.com/old-tech3465/wiispin/blob/main/src/viz.c): `src/viz.c`
- [Beat slot lighting](https://github.com/old-tech3465/wiispin/blob/main/src/disc_led.c): `src/disc_led.c`

### Device support

- [Rotating diagnostics log](https://github.com/old-tech3465/wiispin/blob/main/src/log.c): `src/log.c`

### Other components

- **Wii user**
- **Sendspin server**

## Connections

- Wii user → Runtime coordinator: operates
- Runtime coordinator → Identity and credentials: loads identity (evidence: `src/main.c`)
- Runtime coordinator → PCM playback and DMA: initializes audio (evidence: `src/main.c`)
- Runtime coordinator → Display calibration: initializes display (evidence: `src/main.c`)
- Runtime coordinator → Sendspin session: starts session
- Runtime coordinator → Artwork decoding: decodes artwork (evidence: `src/main.c`)
- Runtime coordinator → GX rendering: sets artwork (evidence: `src/main.c`)
- Runtime coordinator → Setup and player UI: presents controls
- Runtime coordinator → Beat slot lighting: updates lighting
- Runtime coordinator → Rotating diagnostics log: writes diagnostics (evidence: `src/main.c`)
- Sendspin session → Sendspin server: exchanges protocol
- Sendspin session → WebSocket transport: connects through (evidence: `src/sendspin.c`)
- Sendspin session → Noise encryption: encrypts session
- Sendspin session → PCM playback and DMA: sets playback gain (evidence: `src/sendspin.c`)
- Sendspin session → Spectrum visualization: pushes samples (evidence: `src/sendspin.c`)
- Sendspin session → Identity and credentials: persists pairing (evidence: `src/sendspin.c`)
- Sendspin session → Pairing flow: handles pairing (evidence: `src/sendspin.c`)
- Pairing flow → CPace PAKE: uses PAKE
- Pairing flow → Pairing code: uses code
- PCM playback and DMA → Clock synchronization: schedules to clock
- Setup and player UI → GX rendering: renders modern mode
- Wii user → Setup and player UI: sets preferences
- Runtime coordinator → Spectrum visualization: displays spectrum
