compat.miniaudio
#includeSingle-file audio playback and capture library with native backends and WAV/FLAC/MP3 decoding
#include <miniaudio.h>
mcpp add compat.miniaudio@0.11.25
用法
來自本倉庫自己的測試專案 —— CI 真的編譯並執行過,不是為了網站寫的。
// 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 · 專案 tests/examples/miniaudio
建置
- targets
miniaudio (lib)- language
c++23- C standard
c11- import std
- no
- include dirs
*
原始檔 (1)
*/miniaudio.c