Replace process-spawning audio with miniaudio for non-blocking playback

Eliminates severe stuttering from fork/exec + disk I/O by streaming audio directly from memory using miniaudio library.
This commit is contained in:
Kelsi 2026-02-09 00:40:50 -08:00
parent 51e93808b3
commit 730017ce61
11 changed files with 96445 additions and 133 deletions

View file

@ -1,6 +1,5 @@
#pragma once
#include "platform/process.hpp"
#include <cstdint>
#include <random>
#include <string>
@ -49,8 +48,6 @@ private:
};
void preloadSurface(FootstepSurface surface, const std::vector<std::string>& candidates);
void stopCurrentProcess();
void reapFinishedProcess();
bool playRandomStep(FootstepSurface surface, bool sprinting);
static const char* surfaceName(FootstepSurface surface);
@ -58,8 +55,6 @@ private:
SurfaceSamples surfaces[7];
size_t sampleCount = 0;
std::string tempFilePath = platform::getTempFilePath("wowee_footstep.wav");
ProcessHandle playerPid = INVALID_PROCESS;
std::chrono::steady_clock::time_point lastPlayTime = std::chrono::steady_clock::time_point{};
std::mt19937 rng;