Skip to content

feat: miniaudio hybrid music system (no Wwise SDK)#41

Draft
gimploo wants to merge 7 commits into
devfrom
feat/miniaudio-music-system
Draft

feat: miniaudio hybrid music system (no Wwise SDK)#41
gimploo wants to merge 7 commits into
devfrom
feat/miniaudio-music-system

Conversation

@gimploo

@gimploo gimploo commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a header-only miniaudio-based audio stack for layered interactive music + one-shot SFX. Built for Vedanta's Wwise-authored theme (Music_Khushi) without requiring the Wwise SDK or SoundBanks.

What's included

  • application/audio_device.h — miniaudio engine lifecycle (init/shutdown/get_engine)
  • application/audio_music.h — 4-layer streaming music with piecewise-linear volume curves driven by a single intensity parameter (0..100)
  • application/audio_sfx.h — one-shot SFX pool with round-robin set playback (impact stingers)
  • application/music_config.h — Wwise-project-derived config (layer files, curves, sfx set) mapped 1:1 from Music_Khushi.wwu
  • external/miniaudio.h — vendored single-header audio library
  • application.h — device init/shutdown wired into app lifecycle

Design rationale

  • Hybrid workflow: Wwise remains the authoring tool; only WAVs + config are shipped
  • No SDK: Runtime is pure miniaudio; no .bnk, no Sound Engine, no license
  • Header-only: Follows poglib's #ifndef IGNORE_*_IMPLEMENTATION pattern
  • Minimal deps: miniaudio handles backends (WASAPI/ALSA); SDL stays for window/input only

Curves extracted from Wwise

  • Bed: always audible (0 dB)
  • Layers 1-3: silent until intensity ~45, full by ~60 (matching Parkour_intensity RTPC)
  • Intensity smoothing: lerp over dt to avoid volume pops

Tested

  • Windows build (MSVC, single-TU compile)
  • Linux build (clang)

gimploo added 2 commits July 18, 2026 08:29
Add PLANNED comments and stub headers for audio_device, audio_music,
and audio_sfx. No runtime behavior yet — waiting for approval before
vendoring miniaudio and implementing the hybrid Wwise-export path.
Implements layered interactive music + one-shot SFX for Vedanta's
Wwise-authored theme (Music_Khushi).

poglib changes:
- audio_device.h: miniaudio engine lifecycle (init/shutdown/engine)
- audio_music.h: 4-layer streaming with intensity-driven volume curves
- audio_sfx.h: one-shot impact stinger pool with round-robin sets
- music_config.h: Wwise-project-derived layer/curve/sfx definitions
- application.h: wire device init/shutdown into app lifecycle
- external/miniaudio.h: vendored single-header audio library
Comment thread application/audio_music.h Outdated
Comment on lines +29 to +30
char filepath[256];
ma_sound sound;

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use str_t

Comment thread application/audio_music.h Outdated

global music_theme_t g_music = {0};

static f32 music__db_from_curve(const music_curve_point_t *curve, u32 count, f32 intensity)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use INTERNAL and internal in the function name

Comment thread application/audio_music.h
ma_sound_set_volume(&layer->sound, gain);
}
}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid using char * and use str_t

gimploo added 5 commits July 18, 2026 11:38
- Replace char[]/char* with str_t in audio_music.h, audio_sfx.h, music_config.h
- Rename static helpers to INTERNAL + __internal__ naming pattern
- Add math.h include for powf/fabsf
MA_NO_DSOUND prevents miniaudio's DirectSound wrapper types from
conflicting with windows.h (pulled in by SDL2 before miniaudio).
WASAPI remains enabled as the primary Windows audio backend.
Also updated miniaudio.h to latest release (v0.11.25).
MSVC build needs Windows SDK types (WORD, DWORD, etc.) defined before
miniaudio's WASAPI backend code. Add explicit windows.h include with
WIN32_LEAN_AND_MEAN for miniaudio on Windows.
- Remove #define WORD 512 from common.h and dbg.h (collided with Windows SDK WORD type used by miniaudio.h)
- Replace all WORD buffer-size usages with literal 512
- Fix ma_sound_set_fade_in_milliseconds signature (4 args in miniaudio v0.11.25)
- Fix str() compound literal in music_config.h (not constant expression for file-scope statics)
Covers: hybrid Wwise/miniaudio approach, layer system, RTPC curves,
impact stingers, game integration, runtime data flow, tradeoffs,
limitations, troubleshooting. Intended for contributors unfamiliar
with the audio subsystem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant