godotengine/godot
Audio and input drivers
Audio drivers
Each audio driver subclasses AudioDriver (core/os/audio_driver.h) and exposes itself via AudioDriverManager::add_driver on the platform that owns it.
| Driver | Directory | Platforms | Notes |
|---|---|---|---|
AudioDriverPulseAudio |
drivers/pulseaudio/ |
Linux/BSD | Default Linux backend; works alongside PipeWire's PulseAudio compatibility |
AudioDriverALSA |
drivers/alsa/ |
Linux/BSD | Direct hardware access, lower latency for specialized setups |
AudioDriverWASAPI |
drivers/wasapi/ |
Windows | Default Windows backend; supports shared + exclusive modes |
AudioDriverXAudio2 |
drivers/xaudio2/ |
Windows / GDK | Fallback / console-friendly |
AudioDriverCoreAudio |
drivers/coreaudio/ |
macOS / iOS / visionOS | Apple's primary audio API |
AudioDriverDummy |
servers/audio/audio_driver_dummy.cpp |
All | No-op (headless / disabled audio) |
AudioDriverOpenSL |
platform/android/audio_driver_opensl.cpp |
Android | OpenSL ES |
AudioDriverWeb |
platform/web/audio_driver_web.cpp |
Web | Web Audio API (AudioWorklet) |
The selection happens at startup: AudioServer consults the project setting audio/driver/driver (default Default picks the platform's native driver) and the CLI flag --audio-driver.
How an audio driver runs
AudioDriver::init()opens the device with the configured channel count, sample rate, and latency.AudioDriver::start()spawns a callback thread (or registers a callback with the OS audio API).- On each callback, the driver requests a chunk of frames from
AudioServer::_driver_process. AudioServermixes the active streams and bus graph into the chunk and returns it.- The driver presents the chunk to the OS.
The audio thread runs concurrent with the main thread; AudioServer::lock()/unlock() is used to safely modify bus state from the main thread.
MIDI
Three MIDI drivers ship:
| Driver | Directory | Platforms |
|---|---|---|
MIDIDriverALSAMidi |
drivers/alsamidi/ |
Linux/BSD |
MIDIDriverCoreMidi |
drivers/coremidi/ |
macOS / iOS |
MIDIDriverWinMidi |
drivers/winmidi/ |
Windows |
They poll attached MIDI input devices and turn MIDIIn events into InputEventMIDI instances, which then flow through the standard input pipeline.
Input / joypad
Joypad handling lives mostly under each platform's directory because Linux uses evdev, Windows uses XInput/DirectInput, macOS uses GameController, and Android/iOS use platform APIs. Cross-platform pieces:
drivers/sdl/joypad_sdl.{cpp,h}— SDL3-based joypad implementation. Linux can use this as an alternative to the evdev-basedJoypadLinux. Brings SDL's mature gamepad mapping ecosystem (gamecontrollerdb.txt).- Per-platform implementations:
platform/linuxbsd/joypad_linux.cpp— evdev / udev.platform/windows/joypad_windows.cpp— XInput + DirectInput.platform/macos/joypad_macos.mmandplatform/apple_embedded/...(sharedjoypad_apple.mmfor iOS / visionOS) — GameController.framework + IOHIDManager.platform/android/android_input_handler.cpp— Android InputDevice API.platform/web/display_server_web.cpp— Web Gamepad API.
Input (core/input/input.cpp) aggregates joypad state from whichever driver is active, applies the user's InputMap, and exposes actions to scripts.
Accessibility
drivers/accesskit/ integrates AccessKit — a cross-platform accessibility tree library — with Godot's AccessibilityServer. It bridges Godot's UI to:
- UI Automation on Windows.
- AT-SPI on Linux.
- NSAccessibility on macOS.
- TalkBack on Android (where applicable).
The integration is per-platform; accesskit provides the cross-platform trees while platform-specific code activates the OS-side a11y service.
Backtrace bridges
drivers/backtrace/ includes libbacktrace-style bridges used by the platform crash handlers to symbolicate stack traces. The actual symbol resolution depends on the platform — DWARF on Linux, PDB on Windows (via DbgHelp), Mach-O on macOS.
Key abstractions
| Abstraction | File | Role |
|---|---|---|
AudioDriver |
core/os/audio_driver.h |
Audio backend interface |
AudioDriverManager |
core/os/audio_driver.h |
Driver registry |
MIDIDriver |
core/os/midi_driver.h |
MIDI input interface |
JoypadSDL |
drivers/sdl/joypad_sdl.cpp |
Cross-platform SDL3 joypad driver |
AccessibilityDriver |
drivers/accesskit/accessibility_driver_accesskit.cpp |
Accessibility tree bridge |
OS::ensure_user_data_dir, file/dir access |
drivers/unix/, drivers/windows/ |
Cross-platform POSIX/Win32 file helpers |
Entry points for modification
- Switching the default audio driver per platform → adjust
AudioDriverManager::add_driverorder and the project setting defaults. - New audio backend → subclass
AudioDriver, register from the relevant platform'sregister_driver_types.cpp. - New joypad mapping → update
gamecontrollerdb.txt(vendored SDL mappings); the driver re-reads it at startup.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.