# geronimonzy/soundflip architecture

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

- Interactive diagram: https://gitdiagram.com/geronimonzy/soundflip
- Repository: https://github.com/geronimonzy/soundflip

## Overview

SoundFlip is a Windows tray utility and command-line tool for selecting, listing, and cycling playback and recording devices. The main workflow enters through Program.cs: parsed CLI commands operate on audio devices, while the tray path loads settings and exposes device rings, global hotkeys, language selection, and startup controls. TrayContext coordinates switching and persists device selections; Audio applies defaults through Windows audio APIs. The README documents additional settings and presentation capabilities; some links to their implementations are inferred only where the sampled excerpts do not show the call site.

Main entry points: [`TrayContext.cs`](https://github.com/geronimonzy/soundflip/blob/main/TrayContext.cs) (Tray controller), [`Program.cs`](https://github.com/geronimonzy/soundflip/blob/main/Program.cs) (Application entry), [`Audio.cs`](https://github.com/geronimonzy/soundflip/blob/main/Audio.cs) (Device operations), [`SettingsStore.cs`](https://github.com/geronimonzy/soundflip/blob/main/SettingsStore.cs) (Settings persistence)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and commands"]
  node_program["Application entry<br/>[Program.cs]"]
  node_command_line["Command parsing<br/>[CommandLine.cs]"]
end

subgraph group_audio["Audio switching"]
  node_audio["Device operations<br/>[Audio.cs]"]
  node_windows_audio["Windows audio"]
end

subgraph group_tray["Tray experience"]
  node_tray_context["Tray controller<br/>[TrayContext.cs]"]
  node_hotkeys["Global hotkeys<br/>[Hotkeys.cs]"]
  node_ui["Dialogs and toasts<br/>[UI.cs]"]
  node_about["About dialog<br/>[AboutDialog.cs]"]
  node_strings["Localized text<br/>[Strings.cs]"]
end

subgraph group_state["Preferences and integration"]
  node_settings_store[("Settings persistence<br/>[SettingsStore.cs]")]
  node_settings["Saved preferences"]
  node_autostart["Startup control<br/>[AutoStart.cs]"]
  node_windows_startup["Windows startup"]
end

node_cli_user(("CLI user"))
node_tray_user(("Desktop user"))

node_cli_user -->|"runs commands"| node_program
node_tray_user -->|"launches app"| node_program
node_program -->|"parses arguments"| node_command_line
node_program -->|"lists and sets"| node_audio
node_program -->|"loads preferences"| node_settings_store
node_program -->|"starts tray"| node_tray_context
node_audio -->|"reads and sets defaults"| node_windows_audio
node_tray_context -->|"switches and lists"| node_audio
node_tray_context -->|"registers bindings"| node_hotkeys
node_hotkeys -->|"dispatches actions"| node_tray_context
node_tray_context -->|"saves selections"| node_settings_store
node_settings_store -->|"reads and writes"| node_settings
node_tray_context -->|"checks and toggles"| node_autostart
node_autostart -->|"updates startup"| node_windows_startup
node_tray_context -->|"shows dialogs and toasts"| node_ui
node_tray_context -->|"opens about"| node_about
node_tray_context -->|"localizes labels"| node_strings

click node_program "https://github.com/geronimonzy/soundflip/blob/main/Program.cs"
click node_command_line "https://github.com/geronimonzy/soundflip/blob/main/CommandLine.cs"
click node_audio "https://github.com/geronimonzy/soundflip/blob/main/Audio.cs"
click node_tray_context "https://github.com/geronimonzy/soundflip/blob/main/TrayContext.cs"
click node_hotkeys "https://github.com/geronimonzy/soundflip/blob/main/Hotkeys.cs"
click node_ui "https://github.com/geronimonzy/soundflip/blob/main/UI.cs"
click node_about "https://github.com/geronimonzy/soundflip/blob/main/AboutDialog.cs"
click node_strings "https://github.com/geronimonzy/soundflip/blob/main/Strings.cs"
click node_settings_store "https://github.com/geronimonzy/soundflip/blob/main/SettingsStore.cs"
click node_autostart "https://github.com/geronimonzy/soundflip/blob/main/AutoStart.cs"

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_program,node_command_line,node_cli_user,node_tray_user toneBlue
class node_audio,node_windows_audio toneAmber
class node_tray_context,node_hotkeys,node_ui,node_about,node_strings toneMint
class node_settings_store,node_settings,node_autostart,node_windows_startup toneRose
```

## Components

### Entry and commands

- [Application entry](https://github.com/geronimonzy/soundflip/blob/main/Program.cs): `Program.cs`
- [Command parsing](https://github.com/geronimonzy/soundflip/blob/main/CommandLine.cs): `CommandLine.cs`

### Audio switching

- [Device operations](https://github.com/geronimonzy/soundflip/blob/main/Audio.cs): `Audio.cs`
- **Windows audio**

### Tray experience

- [Tray controller](https://github.com/geronimonzy/soundflip/blob/main/TrayContext.cs): `TrayContext.cs`
- [Global hotkeys](https://github.com/geronimonzy/soundflip/blob/main/Hotkeys.cs): `Hotkeys.cs`
- [Dialogs and toasts](https://github.com/geronimonzy/soundflip/blob/main/UI.cs): `UI.cs`
- [About dialog](https://github.com/geronimonzy/soundflip/blob/main/AboutDialog.cs): `AboutDialog.cs`
- [Localized text](https://github.com/geronimonzy/soundflip/blob/main/Strings.cs): `Strings.cs`

### Preferences and integration

- [Settings persistence](https://github.com/geronimonzy/soundflip/blob/main/SettingsStore.cs): `SettingsStore.cs`
- **Saved preferences**
- [Startup control](https://github.com/geronimonzy/soundflip/blob/main/AutoStart.cs): `AutoStart.cs`
- **Windows startup**

### Other components

- **CLI user**
- **Desktop user**

## Connections

- CLI user → Application entry: runs commands
- Desktop user → Application entry: launches app
- Application entry → Command parsing: parses arguments
- Application entry → Device operations: lists and sets
- Application entry → Settings persistence: loads preferences
- Application entry → Tray controller: starts tray
- Device operations → Windows audio: reads and sets defaults
- Tray controller → Device operations: switches and lists
- Tray controller → Global hotkeys: registers bindings
- Global hotkeys → Tray controller: dispatches actions
- Tray controller → Settings persistence: saves selections
- Settings persistence → Saved preferences: reads and writes
- Tray controller → Startup control: checks and toggles
- Startup control → Windows startup: updates startup
- Tray controller → Dialogs and toasts: shows dialogs and toasts
- Tray controller → About dialog: opens about
- Tray controller → Localized text: localizes labels
