# naresh-ashok-mali/syncwave architecture

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

- Interactive diagram: https://gitdiagram.com/naresh-ashok-mali/syncwave
- Repository: https://github.com/naresh-ashok-mali/syncwave

## Overview

SyncWave is a Windows desktop app that captures system audio, synchronizes it across selected output devices, and exposes per-device volume, delay, and live status controls. Its primary workflow is driven by MainViewModel, which starts capture and configures output streams using latency compensation. The README also documents waveform and buffer monitoring, device reconnection, echo prevention, saved profiles, and hotkey flyouts. Some subsystem links are based on README descriptions because the corresponding implementation was not fully sampled.

Main entry points: [`ViewModels/MainViewModel.cs`](https://github.com/naresh-ashok-mali/syncwave/blob/main/ViewModels/MainViewModel.cs) (Main view model), [`Core/AudioOutputService.cs`](https://github.com/naresh-ashok-mali/syncwave/blob/main/Core/AudioOutputService.cs) (Multi-device output), [`Views/MainWindow.xaml.cs`](https://github.com/naresh-ashok-mali/syncwave/blob/main/Views/MainWindow.xaml.cs) (Main window), [`Core/ProcessLoopbackCaptureService.cs`](https://github.com/naresh-ashok-mali/syncwave/blob/main/Core/ProcessLoopbackCaptureService.cs) (Process capture)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_audio["Audio pipeline"]
  node_capture["Process capture"]
  node_legacycapture["WASAPI capture"]
  node_latency["Latency compensation<br/>[LatencyManager.cs]"]
  node_output["Multi-device output"]
  node_volume["Volume scaling"]
  node_windowsaudio["Windows audio system"]
end

subgraph group_app["App and interface"]
  node_mainvm["Main view model<br/>[MainViewModel.cs]"]
  node_mainwindow["Main window<br/>[MainWindow.xaml.cs]"]
  node_flyout["Quick-volume flyout"]
  node_device["Device state"]
end

subgraph group_prefs["Preferences and integration"]
  node_profiles["Profile manager"]
  node_profilefile[("Saved profiles")]
  node_hotkeys["Global hotkeys<br/>[HotkeyManager.cs]"]
  node_mainhotkey["Main-window hotkey"]
end

node_user(("User"))
node_outputs(("Audio output devices"))
node_hotkeyos["Windows hotkey API"]

node_user -->|"operates"| node_mainwindow
node_mainwindow -->|"binds controls"| node_mainvm
node_mainwindow -->|"opens"| node_flyout
node_flyout -->|"binds controls"| node_mainvm
node_mainvm -->|"updates state"| node_device
node_mainvm -->|"starts capture"| node_capture
node_capture -->|"captures system audio"| node_windowsaudio
node_capture -->|"sends audio data"| node_mainvm
node_mainvm -->|"sets delays"| node_latency
node_mainvm -->|"configures streams"| node_output
node_output -->|"requests delayed audio"| node_latency
node_output -->|"scales per-device audio"| node_volume
node_output -->|"enumerates devices"| node_windowsaudio
node_output -->|"streams audio"| node_outputs
node_mainvm -->|"loads and saves settings"| node_profiles
node_profiles -->|"reads and writes"| node_profilefile
node_mainwindow -->|"registers flyout shortcut"| node_hotkeys
node_mainwindow -->|"registers main shortcut"| node_mainhotkey
node_hotkeys -->|"registers shortcut"| node_hotkeyos
node_mainhotkey -->|"registers shortcut"| node_hotkeyos
node_legacycapture -.->|"captures default output"| node_windowsaudio

click node_mainvm "https://github.com/naresh-ashok-mali/syncwave/blob/main/ViewModels/MainViewModel.cs"
click node_mainwindow "https://github.com/naresh-ashok-mali/syncwave/blob/main/Views/MainWindow.xaml.cs"
click node_flyout "https://github.com/naresh-ashok-mali/syncwave/blob/main/Views/FlyoutWindow.xaml.cs"
click node_device "https://github.com/naresh-ashok-mali/syncwave/blob/main/Models/AudioDeviceModel.cs"
click node_capture "https://github.com/naresh-ashok-mali/syncwave/blob/main/Core/ProcessLoopbackCaptureService.cs"
click node_legacycapture "https://github.com/naresh-ashok-mali/syncwave/blob/main/Core/AudioCaptureService.cs"
click node_latency "https://github.com/naresh-ashok-mali/syncwave/blob/main/Core/LatencyManager.cs"
click node_output "https://github.com/naresh-ashok-mali/syncwave/blob/main/Core/AudioOutputService.cs"
click node_volume "https://github.com/naresh-ashok-mali/syncwave/blob/main/Core/VolumeWaveProvider.cs"
click node_profiles "https://github.com/naresh-ashok-mali/syncwave/blob/main/Utils/DeviceProfileManager.cs"
click node_hotkeys "https://github.com/naresh-ashok-mali/syncwave/blob/main/Utils/HotkeyManager.cs"
click node_mainhotkey "https://github.com/naresh-ashok-mali/syncwave/blob/main/Utils/MainHotkeyManager.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_capture,node_legacycapture,node_latency,node_output,node_volume,node_windowsaudio,node_user toneBlue
class node_mainvm,node_mainwindow,node_flyout,node_device toneAmber
class node_profiles,node_profilefile,node_hotkeys,node_mainhotkey,node_hotkeyos toneMint
class node_outputs toneIndigo
```

## Components

### Audio pipeline

- [Process capture](https://github.com/naresh-ashok-mali/syncwave/blob/main/Core/ProcessLoopbackCaptureService.cs): `Core/ProcessLoopbackCaptureService.cs`
- [WASAPI capture](https://github.com/naresh-ashok-mali/syncwave/blob/main/Core/AudioCaptureService.cs): `Core/AudioCaptureService.cs`
- [Latency compensation](https://github.com/naresh-ashok-mali/syncwave/blob/main/Core/LatencyManager.cs): `Core/LatencyManager.cs`
- [Multi-device output](https://github.com/naresh-ashok-mali/syncwave/blob/main/Core/AudioOutputService.cs): `Core/AudioOutputService.cs`
- [Volume scaling](https://github.com/naresh-ashok-mali/syncwave/blob/main/Core/VolumeWaveProvider.cs): `Core/VolumeWaveProvider.cs`
- **Windows audio system**

### App and interface

- [Main view model](https://github.com/naresh-ashok-mali/syncwave/blob/main/ViewModels/MainViewModel.cs): `ViewModels/MainViewModel.cs`
- [Main window](https://github.com/naresh-ashok-mali/syncwave/blob/main/Views/MainWindow.xaml.cs): `Views/MainWindow.xaml.cs`
- [Quick-volume flyout](https://github.com/naresh-ashok-mali/syncwave/blob/main/Views/FlyoutWindow.xaml.cs): `Views/FlyoutWindow.xaml.cs`
- [Device state](https://github.com/naresh-ashok-mali/syncwave/blob/main/Models/AudioDeviceModel.cs): `Models/AudioDeviceModel.cs`

### Preferences and integration

- [Profile manager](https://github.com/naresh-ashok-mali/syncwave/blob/main/Utils/DeviceProfileManager.cs): `Utils/DeviceProfileManager.cs`
- **Saved profiles**
- [Global hotkeys](https://github.com/naresh-ashok-mali/syncwave/blob/main/Utils/HotkeyManager.cs): `Utils/HotkeyManager.cs`
- [Main-window hotkey](https://github.com/naresh-ashok-mali/syncwave/blob/main/Utils/MainHotkeyManager.cs): `Utils/MainHotkeyManager.cs`

### Other components

- **User**
- **Audio output devices**
- **Windows hotkey API**

## Connections

- User → Main window: operates
- Main window → Main view model: binds controls
- Main window → Quick-volume flyout: opens
- Quick-volume flyout → Main view model: binds controls
- Main view model → Device state: updates state
- Main view model → Process capture: starts capture
- Process capture → Windows audio system: captures system audio
- Process capture → Main view model: sends audio data
- Main view model → Latency compensation: sets delays
- Main view model → Multi-device output: configures streams
- Multi-device output → Latency compensation: requests delayed audio
- Multi-device output → Volume scaling: scales per-device audio
- Multi-device output → Windows audio system: enumerates devices
- Multi-device output → Audio output devices: streams audio
- Main view model → Profile manager: loads and saves settings
- Profile manager → Saved profiles: reads and writes
- Main window → Global hotkeys: registers flyout shortcut
- Main window → Main-window hotkey: registers main shortcut
- Global hotkeys → Windows hotkey API: registers shortcut
- Main-window hotkey → Windows hotkey API: registers shortcut
- WASAPI capture → Windows audio system: captures default output
