# acidanthera/applealc architecture

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

- Interactive diagram: https://gitdiagram.com/acidanthera/applealc
- Repository: https://github.com/acidanthera/applealc

## Overview

AppleALC is a macOS kernel extension that enables native audio for unsupported HD-audio codecs, with configuration-driven controller patching and codec layout/platform injection. Its main runtime starts the enabler, detects and validates audio hardware, and applies patches and properties; the separate alc-verb utility sends diagnostic or custom verbs through an IOKit user-client path. The README also documents installer/recovery support, digital-only audio, and arbitrary kext patching. Detailed internal links are limited to the excerpts; broader capabilities are represented as documented responsibilities.

Main entry points: [`AppleALC/kern_alc.cpp`](https://github.com/acidanthera/applealc/blob/master/AppleALC/kern_alc.cpp) (ALC enabler), [`alc-verb/main.c`](https://github.com/acidanthera/applealc/blob/master/alc-verb/main.c) (alc-verb CLI), [`AppleALC/ALCUserClient/ALCUserClient.cpp`](https://github.com/acidanthera/applealc/blob/master/AppleALC/ALCUserClient/ALCUserClient.cpp) (IOKit user client), [`AppleALC/ALCUserClientProvider/ALCUserClientProvider.cpp`](https://github.com/acidanthera/applealc/blob/master/AppleALC/ALCUserClientProvider/ALCUserClientProvider.cpp) (Verb provider)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_kernel["Kernel runtime"]
  node_startup["Plugin startup<br/>[kern_start.cpp]"]
  node_enabler["ALC enabler<br/>[kern_alc.cpp]"]
end

subgraph group_audio["Audio enablement"]
  node_controller["Controller detection<br/>[kern_alc.cpp]"]
  node_codec["Codec detection<br/>[kern_alc.cpp]"]
  node_patching["Controller patching<br/>[kern_alc.cpp]"]
  node_injection["Layout injection<br/>[kern_alc.cpp]"]
end

subgraph group_resources["Codec resources"]
  node_resources["Codec configurations"]
  node_resource_types["Resource definitions<br/>[kern_resources.hpp]"]
end

subgraph group_verbs["Verb interface"]
  node_verb_cli["alc-verb CLI<br/>[main.c]"]
  node_verb_tables["HDA verb tables<br/>[hdaverb.h]"]
  node_userclient["IOKit user client<br/>[ALCUserClient.cpp]"]
  node_provider["Verb provider"]
  node_shared_protocol["Shared method IDs<br/>[UserKernelShared.h]"]
end

node_macos(("macOS"))

node_macos -.->|"loads extension"| node_startup
node_startup -->|"initializes"| node_enabler
node_enabler -->|"detects"| node_controller
node_enabler -->|"detects"| node_codec
node_enabler -->|"patches hardware"| node_patching
node_enabler -->|"injects layouts"| node_injection
node_enabler -->|"uses definitions"| node_resource_types
node_resource_types -->|"describes resources"| node_resources
node_macos -.->|"runs utility"| node_verb_cli
node_verb_cli -->|"looks up verbs"| node_verb_tables
node_verb_cli -->|"opens service"| node_provider
node_verb_cli -->|"calls method"| node_userclient
node_userclient -->|"uses method IDs"| node_shared_protocol
node_userclient -->|"dispatches verbs"| node_provider
node_provider -->|"executes codec verb"| node_enabler

click node_startup "https://github.com/acidanthera/applealc/blob/master/AppleALC/kern_start.cpp"
click node_enabler "https://github.com/acidanthera/applealc/blob/master/AppleALC/kern_alc.cpp"
click node_controller "https://github.com/acidanthera/applealc/blob/master/AppleALC/kern_alc.cpp"
click node_codec "https://github.com/acidanthera/applealc/blob/master/AppleALC/kern_alc.cpp"
click node_patching "https://github.com/acidanthera/applealc/blob/master/AppleALC/kern_alc.cpp"
click node_injection "https://github.com/acidanthera/applealc/blob/master/AppleALC/kern_alc.cpp"
click node_resources "https://github.com/acidanthera/applealc/tree/master/Resources"
click node_resource_types "https://github.com/acidanthera/applealc/blob/master/AppleALC/kern_resources.hpp"
click node_verb_cli "https://github.com/acidanthera/applealc/blob/master/alc-verb/main.c"
click node_verb_tables "https://github.com/acidanthera/applealc/blob/master/alc-verb/hdaverb.h"
click node_userclient "https://github.com/acidanthera/applealc/blob/master/AppleALC/ALCUserClient/ALCUserClient.cpp"
click node_provider "https://github.com/acidanthera/applealc/blob/master/AppleALC/ALCUserClientProvider/ALCUserClientProvider.cpp"
click node_shared_protocol "https://github.com/acidanthera/applealc/blob/master/AppleALC/UserKernelShared.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_startup,node_enabler toneBlue
class node_controller,node_codec,node_patching,node_injection toneAmber
class node_resources,node_resource_types toneMint
class node_verb_cli,node_verb_tables,node_userclient,node_provider,node_shared_protocol toneRose
class node_macos toneIndigo
```

## Components

### Kernel runtime

- [Plugin startup](https://github.com/acidanthera/applealc/blob/master/AppleALC/kern_start.cpp): `AppleALC/kern_start.cpp`
- [ALC enabler](https://github.com/acidanthera/applealc/blob/master/AppleALC/kern_alc.cpp): `AppleALC/kern_alc.cpp`

### Audio enablement

- [Controller detection](https://github.com/acidanthera/applealc/blob/master/AppleALC/kern_alc.cpp): `AppleALC/kern_alc.cpp`
- [Codec detection](https://github.com/acidanthera/applealc/blob/master/AppleALC/kern_alc.cpp): `AppleALC/kern_alc.cpp`
- [Controller patching](https://github.com/acidanthera/applealc/blob/master/AppleALC/kern_alc.cpp): `AppleALC/kern_alc.cpp`
- [Layout injection](https://github.com/acidanthera/applealc/blob/master/AppleALC/kern_alc.cpp): `AppleALC/kern_alc.cpp`

### Codec resources

- [Codec configurations](https://github.com/acidanthera/applealc/tree/master/Resources): `Resources`
- [Resource definitions](https://github.com/acidanthera/applealc/blob/master/AppleALC/kern_resources.hpp): `AppleALC/kern_resources.hpp`

### Verb interface

- [alc-verb CLI](https://github.com/acidanthera/applealc/blob/master/alc-verb/main.c): `alc-verb/main.c`
- [HDA verb tables](https://github.com/acidanthera/applealc/blob/master/alc-verb/hdaverb.h): `alc-verb/hdaverb.h`
- [IOKit user client](https://github.com/acidanthera/applealc/blob/master/AppleALC/ALCUserClient/ALCUserClient.cpp): `AppleALC/ALCUserClient/ALCUserClient.cpp`
- [Verb provider](https://github.com/acidanthera/applealc/blob/master/AppleALC/ALCUserClientProvider/ALCUserClientProvider.cpp): `AppleALC/ALCUserClientProvider/ALCUserClientProvider.cpp`
- [Shared method IDs](https://github.com/acidanthera/applealc/blob/master/AppleALC/UserKernelShared.h): `AppleALC/UserKernelShared.h`

### Other components

- **macOS**

## Connections

- macOS → Plugin startup: loads extension (evidence: `README.md`)
- Plugin startup → ALC enabler: initializes (evidence: `AppleALC/kern_start.cpp`)
- ALC enabler → Controller detection: detects (evidence: `AppleALC/kern_alc.cpp`)
- ALC enabler → Codec detection: detects (evidence: `AppleALC/kern_alc.cpp`)
- ALC enabler → Controller patching: patches hardware (evidence: `AppleALC/kern_alc.cpp`)
- ALC enabler → Layout injection: injects layouts (evidence: `AppleALC/kern_alc.cpp`)
- ALC enabler → Resource definitions: uses definitions (evidence: `AppleALC/kern_alc.cpp`)
- Resource definitions → Codec configurations: describes resources (evidence: `AppleALC/kern_resources.hpp`)
- macOS → alc-verb CLI: runs utility
- alc-verb CLI → HDA verb tables: looks up verbs (evidence: `alc-verb/main.c`)
- alc-verb CLI → Verb provider: opens service (evidence: `alc-verb/main.c`)
- alc-verb CLI → IOKit user client: calls method (evidence: `alc-verb/main.c`)
- IOKit user client → Shared method IDs: uses method IDs
- IOKit user client → Verb provider: dispatches verbs (evidence: `AppleALC/ALCUserClient/ALCUserClient.cpp`)
- Verb provider → ALC enabler: executes codec verb (evidence: `AppleALC/ALCUserClientProvider/ALCUserClientProvider.cpp`)
