From 76dcdf776beea310d6e4a9ce084a9f7d5f334562 Mon Sep 17 00:00:00 2001 From: Dylan Perks <11160611+Perksey@users.noreply.github.com> Date: Fri, 24 Dec 2021 19:16:24 +0000 Subject: [PATCH] Reorder examples in README --- README.md | 71 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 2bbeb1ba..1b45c4ff 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,42 @@ Examples ======== + +This example shows one way to play a sound using the high level API. + +```c +#define MINIAUDIO_IMPLEMENTATION +#include "../miniaudio.h" + +#include + +int main(int argc, char** argv) +{ + ma_result result; + ma_engine engine; + + if (argc < 2) { + printf("No input file."); + return -1; + } + + result = ma_engine_init(NULL, &engine); + if (result != MA_SUCCESS) { + printf("Failed to initialize audio engine."); + return -1; + } + + ma_engine_play_sound(&engine, argv[1], NULL); + + printf("Press Enter to quit..."); + getchar(); + + ma_engine_uninit(&engine); + + return 0; +} +``` + This example shows how to decode and play a sound using the low level API. ```c @@ -89,41 +125,6 @@ int main(int argc, char** argv) } ``` -This example shows one way to play a sound using the high level API. - -```c -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" - -#include - -int main(int argc, char** argv) -{ - ma_result result; - ma_engine engine; - - if (argc < 2) { - printf("No input file."); - return -1; - } - - result = ma_engine_init(NULL, &engine); - if (result != MA_SUCCESS) { - printf("Failed to initialize audio engine."); - return -1; - } - - ma_engine_play_sound(&engine, argv[1], NULL); - - printf("Press Enter to quit..."); - getchar(); - - ma_engine_uninit(&engine); - - return 0; -} -``` - More examples can be found in the [examples](examples) folder or online here: https://miniaud.io/docs/examples/