mcpp index

compat.miniaudio

#include

Single-file audio playback and capture library with native backends and WAV/FLAC/MP3 decoding

#include <miniaudio.h>
mcpp add compat.miniaudio@0.11.25

Usage

From this repository's own test project — built and run by CI, not written for the website.

// compat.miniaudio — encode a WAV, decode it back, and assert the samples
// survive the round trip.
//
// Deliberately DEVICE-FREE. A CI runner has no sound card, so ma_device_init
// would fail for reasons that say nothing about the package. The encoder,
// decoder and the WAV codec behind them are the parts that can be asserted
// anywhere, and they still prove the implementation TU (miniaudio.c) is
// compiled and linked -- none of these symbols exist without it.
#include <miniaudio.h>
import std;

int main() {
    bool ok = true;
    auto check = [&](bool cond, std::string_view what) {
        if (!cond) {
            std::println("FAIL: {}", what);
            ok = false;
        }
    };

    constexpr ma_uint32 RATE     = 48000;
    constexpr ma_uint32 CHANNELS = 1;
// …

tests/examples/miniaudio/tests/roundtrip.cpp · project tests/examples/miniaudio

Build

targets
miniaudio (lib)
language
c++23
C standard
c11
import std
no
include dirs
*

Sources (1)

  • */miniaudio.c

Versions

VersionPlatforms Mirrorssha256
0.11.25 latest LinuxWindowsmacOS GLOBAL CN b900edcffe97…