# fna-xna/faudio architecture

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

- Interactive diagram: https://gitdiagram.com/fna-xna/faudio
- Repository: https://github.com/fna-xna/faudio

## Overview

FAudio is a DirectX Audio runtime reimplementation for FNA, covering XAudio2, X3DAudio, XAPO, and XACT3. The principal use is an application invoking audio-runtime APIs to manage voices, process effects, and render audio; XACT adds higher-level engine, bank, and cue behavior. The graph also shows platform output and the FAudio# binding. Source-index references support the internal dependency edges shown; the README establishes the product scope, but the excerpts do not expose the full runtime call flow, so uncertain connections are omitted.

Main entry points: [`src/FAudio.c`](https://github.com/fna-xna/faudio/blob/master/src/FAudio.c) (XAudio2 API), [`src/FAudio_internal.h`](https://github.com/fna-xna/faudio/blob/master/src/FAudio_internal.h) (Engine definitions), [`src/FACT_internal.h`](https://github.com/fna-xna/faudio/blob/master/src/FACT_internal.h) (XACT definitions), [`src/FAPOBase.c`](https://github.com/fna-xna/faudio/blob/master/src/FAPOBase.c) (Audio processing objects)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_engine["Audio Engine"]
  node_binding["FAudio&#35; binding<br/>[FAudio.cs]"]
  node_api["XAudio2 API<br/>[FAudio.c]"]
  node_engine_impl["Engine internals<br/>[FAudio_internal.c]"]
  node_engine_types["Engine definitions<br/>[FAudio_internal.h]"]
  node_operations["Operation sets"]
  node_codec["Audio decoding<br/>[stb.h]"]
end

subgraph group_platform["Platform Output"]
  node_sdl2["SDL2 backend"]
  node_sdl3["SDL3 backend"]
  node_win32["Win32 backend"]
end

subgraph group_xact["XACT Runtime"]
  node_xact_api["XACT3 API<br/>[FACT.h]"]
  node_xact_engine["XACT engine<br/>[FACT.c]"]
  node_xact_internal["XACT internals<br/>[FACT_internal.c]"]
  node_xact_types["XACT definitions<br/>[FACT_internal.h]"]
end

subgraph group_spatialfx["Spatial And Effects"]
  node_spatial["3D audio<br/>[F3DAudio.c]"]
  node_fact3d["XACT 3D<br/>[FACT3D.c]"]
  node_apo["Audio processing objects<br/>[FAPOBase.c]"]
  node_effects["Built-in effects<br/>[FAPOFX.c]"]
  node_effect_reverb["Reverb effect<br/>[FAudioFX_reverb.c]"]
  node_effect_meter["Volume meter"]
end

node_app(("FNA application"))

node_app -->|"uses"| node_binding
node_binding -.->|"binds runtime"| node_api
node_api -->|"uses definitions"| node_engine_types
node_engine_types -->|"includes API"| node_api
node_engine_types -->|"includes interface"| node_apo
node_xact_engine -->|"uses definitions"| node_xact_types
node_xact_internal -->|"uses definitions"| node_xact_types
node_xact_internal -->|"uses decoder"| node_codec
node_xact_types -->|"includes definitions"| node_engine_types
node_xact_types -->|"includes API"| node_xact_api
node_api -.->|"dispatches operations"| node_operations
node_engine_impl -.->|"renders through"| node_sdl2
node_engine_impl -.->|"renders through"| node_sdl3
node_engine_impl -.->|"renders through"| node_win32
node_xact_engine -.->|"uses runtime"| node_api
node_fact3d -.->|"uses spatial audio"| node_spatial
node_effects -.->|"implements processing"| node_apo
node_effect_reverb -.->|"implements processing"| node_apo
node_effect_meter -.->|"implements processing"| node_apo

click node_binding "https://github.com/fna-xna/faudio/blob/master/csharp/FAudio.cs"
click node_api "https://github.com/fna-xna/faudio/blob/master/src/FAudio.c"
click node_engine_impl "https://github.com/fna-xna/faudio/blob/master/src/FAudio_internal.c"
click node_engine_types "https://github.com/fna-xna/faudio/blob/master/src/FAudio_internal.h"
click node_operations "https://github.com/fna-xna/faudio/blob/master/src/FAudio_operationset.c"
click node_sdl2 "https://github.com/fna-xna/faudio/blob/master/src/FAudio_platform_sdl2.c"
click node_sdl3 "https://github.com/fna-xna/faudio/blob/master/src/FAudio_platform_sdl3.c"
click node_win32 "https://github.com/fna-xna/faudio/blob/master/src/FAudio_platform_win32.c"
click node_xact_api "https://github.com/fna-xna/faudio/blob/master/include/FACT.h"
click node_xact_engine "https://github.com/fna-xna/faudio/blob/master/src/FACT.c"
click node_xact_internal "https://github.com/fna-xna/faudio/blob/master/src/FACT_internal.c"
click node_xact_types "https://github.com/fna-xna/faudio/blob/master/src/FACT_internal.h"
click node_spatial "https://github.com/fna-xna/faudio/blob/master/src/F3DAudio.c"
click node_fact3d "https://github.com/fna-xna/faudio/blob/master/src/FACT3D.c"
click node_apo "https://github.com/fna-xna/faudio/blob/master/src/FAPOBase.c"
click node_effects "https://github.com/fna-xna/faudio/blob/master/src/FAPOFX.c"
click node_effect_reverb "https://github.com/fna-xna/faudio/blob/master/src/FAudioFX_reverb.c"
click node_effect_meter "https://github.com/fna-xna/faudio/blob/master/src/FAudioFX_volumemeter.c"
click node_codec "https://github.com/fna-xna/faudio/blob/master/src/stb.h"

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_binding,node_api,node_engine_impl,node_engine_types,node_operations,node_codec toneBlue
class node_sdl2,node_sdl3,node_win32 toneAmber
class node_xact_api,node_xact_engine,node_xact_internal,node_xact_types toneMint
class node_spatial,node_fact3d,node_apo,node_effects,node_effect_reverb,node_effect_meter toneRose
class node_app toneIndigo
```

## Components

### Audio Engine

- [FAudio# binding](https://github.com/fna-xna/faudio/blob/master/csharp/FAudio.cs): `csharp/FAudio.cs`
- [XAudio2 API](https://github.com/fna-xna/faudio/blob/master/src/FAudio.c): `src/FAudio.c`
- [Engine internals](https://github.com/fna-xna/faudio/blob/master/src/FAudio_internal.c): `src/FAudio_internal.c`
- [Engine definitions](https://github.com/fna-xna/faudio/blob/master/src/FAudio_internal.h): `src/FAudio_internal.h`
- [Operation sets](https://github.com/fna-xna/faudio/blob/master/src/FAudio_operationset.c): `src/FAudio_operationset.c`
- [Audio decoding](https://github.com/fna-xna/faudio/blob/master/src/stb.h): `src/stb.h`

### Platform Output

- [SDL2 backend](https://github.com/fna-xna/faudio/blob/master/src/FAudio_platform_sdl2.c): `src/FAudio_platform_sdl2.c`
- [SDL3 backend](https://github.com/fna-xna/faudio/blob/master/src/FAudio_platform_sdl3.c): `src/FAudio_platform_sdl3.c`
- [Win32 backend](https://github.com/fna-xna/faudio/blob/master/src/FAudio_platform_win32.c): `src/FAudio_platform_win32.c`

### XACT Runtime

- [XACT3 API](https://github.com/fna-xna/faudio/blob/master/include/FACT.h): `include/FACT.h`
- [XACT engine](https://github.com/fna-xna/faudio/blob/master/src/FACT.c): `src/FACT.c`
- [XACT internals](https://github.com/fna-xna/faudio/blob/master/src/FACT_internal.c): `src/FACT_internal.c`
- [XACT definitions](https://github.com/fna-xna/faudio/blob/master/src/FACT_internal.h): `src/FACT_internal.h`

### Spatial And Effects

- [3D audio](https://github.com/fna-xna/faudio/blob/master/src/F3DAudio.c): `src/F3DAudio.c`
- [XACT 3D](https://github.com/fna-xna/faudio/blob/master/src/FACT3D.c): `src/FACT3D.c`
- [Audio processing objects](https://github.com/fna-xna/faudio/blob/master/src/FAPOBase.c): `src/FAPOBase.c`
- [Built-in effects](https://github.com/fna-xna/faudio/blob/master/src/FAPOFX.c): `src/FAPOFX.c`
- [Reverb effect](https://github.com/fna-xna/faudio/blob/master/src/FAudioFX_reverb.c): `src/FAudioFX_reverb.c`
- [Volume meter](https://github.com/fna-xna/faudio/blob/master/src/FAudioFX_volumemeter.c): `src/FAudioFX_volumemeter.c`

### Other components

- **FNA application**

## Connections

- FNA application → FAudio# binding: uses (evidence: `README`)
- FAudio# binding → XAudio2 API: binds runtime
- XAudio2 API → Engine definitions: uses definitions (evidence: `src/FAudio.c`)
- Engine definitions → XAudio2 API: includes API (evidence: `src/FAudio_internal.h`)
- Engine definitions → Audio processing objects: includes interface (evidence: `src/FAudio_internal.h`)
- XACT engine → XACT definitions: uses definitions (evidence: `src/FACT.c`)
- XACT internals → XACT definitions: uses definitions (evidence: `src/FACT_internal.c`)
- XACT internals → Audio decoding: uses decoder (evidence: `src/FACT_internal.c`)
- XACT definitions → Engine definitions: includes definitions (evidence: `src/FACT_internal.h`)
- XACT definitions → XACT3 API: includes API (evidence: `src/FACT_internal.h`)
- XAudio2 API → Operation sets: dispatches operations
- Engine internals → SDL2 backend: renders through
- Engine internals → SDL3 backend: renders through
- Engine internals → Win32 backend: renders through
- XACT engine → XAudio2 API: uses runtime
- XACT 3D → 3D audio: uses spatial audio
- Built-in effects → Audio processing objects: implements processing
- Reverb effect → Audio processing objects: implements processing
- Volume meter → Audio processing objects: implements processing
