Repository navigation
Audio Engine and MCI Sync
Mohammed Sahil edited this page Nov 21, 2026
·
1 revision
Audio playback runs via the Win32 Multimedia API (mmsystem.h) using Media Control Interface (MCI) commands:
mciSendStringA("open \"soundtrack.mp3\" type mpegvideo alias bgm", NULL, 0, NULL);
mciSendStringA("play bgm", NULL, 0, NULL);-
No Per-Frame Status Inquiries: Calling
mciSendStringA("status bgm position", ...)every frame blocks the main thread for 1 to 4 ms depending on the audio driver, resulting in micro-stuttering and dropping framerates below 60 FPS. -
Clock Source: The engine uses high-resolution Win32 performance counters (
QueryPerformanceCounter) as the master timeline clock, syncing audio only at milestone scene transitions. - Seamless Transitions: The Scene 3 entry transition at 44.0s is locked without forced seek commands to avoid audio pop artifacts.
Martian: High-performance real-time C++ / OpenGL cinematic space visualizer in 2.39:1 letterbox.