From 1fbad32949152ce49f2b4b19dab6c9797fadbc4b Mon Sep 17 00:00:00 2001 From: David Reid Date: Sat, 22 Feb 2025 13:09:11 +1000 Subject: [PATCH] Stop using MINIAUDIO_IMPLEMENTATION in examples. --- examples/data_source_chaining.c | 4 +--- examples/duplex_effect.c | 3 +-- examples/engine_advanced.c | 3 +-- examples/engine_effects.c | 3 +-- examples/engine_hello_world.c | 3 +-- examples/engine_sdl.c | 3 +-- examples/engine_steamaudio.c | 3 +-- examples/hilo_interop.c | 3 +-- examples/node_graph.c | 3 +-- examples/resource_manager.c | 3 +-- examples/resource_manager_advanced.c | 3 +-- examples/simple_capture.c | 3 +-- examples/simple_duplex.c | 3 +-- examples/simple_enumeration.c | 3 +-- examples/simple_loopback.c | 3 +-- examples/simple_looping.c | 3 +-- examples/simple_mixing.c | 3 +-- examples/simple_playback.c | 3 +-- examples/simple_playback_sine.c | 3 +-- examples/simple_spatialization.c | 3 +-- 20 files changed, 20 insertions(+), 41 deletions(-) diff --git a/examples/data_source_chaining.c b/examples/data_source_chaining.c index c9126976..169ca1c8 100644 --- a/examples/data_source_chaining.c +++ b/examples/data_source_chaining.c @@ -31,9 +31,7 @@ starting the chain from the start again. It is also seeking the head data source so that playback starts from the start as expected. You do not need to seek non-head items back to the start as miniaudio will do that for you internally. */ -#define MA_EXPERIMENTAL__DATA_LOOPING_AND_CHAINING -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" #include diff --git a/examples/duplex_effect.c b/examples/duplex_effect.c index 6a07fd25..8ff31589 100644 --- a/examples/duplex_effect.c +++ b/examples/duplex_effect.c @@ -6,8 +6,7 @@ called `ma_vocoder_node` is used to achieve the effect which can be found in the the miniaudio repository. The vocoder node uses https://github.com/blastbay/voclib to achieve the effect. */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" #include "../extras/nodes/ma_vocoder_node/ma_vocoder_node.c" #include diff --git a/examples/engine_advanced.c b/examples/engine_advanced.c index 3911c221..d389c8d1 100644 --- a/examples/engine_advanced.c +++ b/examples/engine_advanced.c @@ -14,8 +14,7 @@ Using a shared resource manager, as we do in this example, is useful for when yo multiple engines so that you can output to multiple playback devices simultaneoulys. An example might be a local co-op multiplayer game where each player has their own headphones. */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" #define MAX_DEVICES 2 #define MAX_SOUNDS 32 diff --git a/examples/engine_effects.c b/examples/engine_effects.c index 876e4f87..a777a16d 100644 --- a/examples/engine_effects.c +++ b/examples/engine_effects.c @@ -13,8 +13,7 @@ This example is playing only a single sound at a time which means only a single it being used. If you want to play multiple sounds at the same time, even if they're for the same sound file, you need multiple `ma_sound` objects. */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" #define DELAY_IN_SECONDS 0.2f #define DECAY 0.25f /* Volume falloff for each echo. */ diff --git a/examples/engine_hello_world.c b/examples/engine_hello_world.c index f6f548f3..16a85291 100644 --- a/examples/engine_hello_world.c +++ b/examples/engine_hello_world.c @@ -3,8 +3,7 @@ This example demonstrates how to initialize an audio engine and play a sound. This will play the sound specified on the command line. */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" #include diff --git a/examples/engine_sdl.c b/examples/engine_sdl.c index 37541d24..9b07385d 100644 --- a/examples/engine_sdl.c +++ b/examples/engine_sdl.c @@ -9,8 +9,7 @@ This example will load the sound specified on the command line and rotate it aro head. */ #define MA_NO_DEVICE_IO /* <-- Disables the `ma_device` API. We don't need that in this example since SDL will be doing that part for us. */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" #define SDL_MAIN_HANDLED #include /* Change this to your include location. Might be . */ diff --git a/examples/engine_steamaudio.c b/examples/engine_steamaudio.c index 3e6469be..8e9512e1 100644 --- a/examples/engine_steamaudio.c +++ b/examples/engine_steamaudio.c @@ -14,8 +14,7 @@ you specify in your IPLAudioSettings object. If for some reason you want the per engine to be different to that of your Steam Audio configuration, you'll need to implement a sort of buffering solution to your node. */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" #include /* Required for uint32_t which is used by STEAMAUDIO_VERSION, and a random use of uint8_t. If there's a Steam Audio maintainer reading this, that needs to be fixed to use IPLuint32 and IPLuint8. */ #include /* Steam Audio */ diff --git a/examples/hilo_interop.c b/examples/hilo_interop.c index ea115660..9045f4fb 100644 --- a/examples/hilo_interop.c +++ b/examples/hilo_interop.c @@ -15,8 +15,7 @@ Instead you would probably want to do a custom data source that handles underrun the ring buffer and deals with desyncs between capture and playback. In the future this example may be updated to make use of a more advanced data source that handles all of this. */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" static ma_pcm_rb rb; static ma_device device; diff --git a/examples/node_graph.c b/examples/node_graph.c index dd1b9374..b83e854b 100644 --- a/examples/node_graph.c +++ b/examples/node_graph.c @@ -51,8 +51,7 @@ pass and echo effects so that one of them becomes more obvious than the other. When you want to read from the graph, you simply call `ma_node_graph_read_pcm_frames()`. */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" /* Data Format */ #define FORMAT ma_format_f32 /* Must always be f32. */ diff --git a/examples/resource_manager.c b/examples/resource_manager.c index 27d7fd51..03374634 100644 --- a/examples/resource_manager.c +++ b/examples/resource_manager.c @@ -24,8 +24,7 @@ data from the data source. This means the resource manager will ensure all sound set, each sound will have their own formats and you'll need to do the necessary data conversion yourself. */ #define MA_NO_ENGINE /* We're intentionally not using the ma_engine API here. */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" #ifdef __EMSCRIPTEN__ #include diff --git a/examples/resource_manager_advanced.c b/examples/resource_manager_advanced.c index 292aa99e..dfc14922 100644 --- a/examples/resource_manager_advanced.c +++ b/examples/resource_manager_advanced.c @@ -15,8 +15,7 @@ In this example we show how you can create a data source, mix them with other da threads to manage internally and how to implement your own custom job thread. */ #define MA_NO_ENGINE /* We're intentionally not using the ma_engine API here. */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" static ma_resource_manager_data_source g_dataSources[16]; static ma_uint32 g_dataSourceCount; diff --git a/examples/simple_capture.c b/examples/simple_capture.c index 6c08dc15..e0402ab1 100644 --- a/examples/simple_capture.c +++ b/examples/simple_capture.c @@ -8,8 +8,7 @@ Capturing works in a very similar way to playback. The only difference is the di the application sending data to the device, the device will send data to the application. This example just writes the data received by the microphone straight to a WAV file. */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" #include #include diff --git a/examples/simple_duplex.c b/examples/simple_duplex.c index 69cc6d84..8658b201 100644 --- a/examples/simple_duplex.c +++ b/examples/simple_duplex.c @@ -10,8 +10,7 @@ glitching which the backend may not be able to recover from. For this reason, mi sample rate for both capture and playback. If internally the native sample rates differ, miniaudio will perform the sample rate conversion for you automatically. */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" #include diff --git a/examples/simple_enumeration.c b/examples/simple_enumeration.c index b4f1243a..4c430ea1 100644 --- a/examples/simple_enumeration.c +++ b/examples/simple_enumeration.c @@ -7,8 +7,7 @@ context sits above a device. You can have many devices to one context. If you use device enumeration, you should explicitly specify the same context you used for enumeration in the call to `ma_device_init()` when you initialize your devices. */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" #include diff --git a/examples/simple_loopback.c b/examples/simple_loopback.c index df5fb0ab..f36a2124 100644 --- a/examples/simple_loopback.c +++ b/examples/simple_loopback.c @@ -10,8 +10,7 @@ used indirectly with PulseAudio by choosing the appropriate loopback device afte To use loopback mode you just need to set the device type to ma_device_type_loopback and set the capture device config properties. The output buffer in the callback will be null whereas the input buffer will be valid. */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" #include #include diff --git a/examples/simple_looping.c b/examples/simple_looping.c index dcc5a2b5..3031a912 100644 --- a/examples/simple_looping.c +++ b/examples/simple_looping.c @@ -5,8 +5,7 @@ This example uses a decoder as the data source. Decoders can be used with the `m supports looping via the `ma_data_source_read_pcm_frames()` API. To use it, all you need to do is pass a pointer to the decoder straight into `ma_data_source_read_pcm_frames()` and it will just work. */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" #include diff --git a/examples/simple_mixing.c b/examples/simple_mixing.c index cd72d3b9..2be8f6cf 100644 --- a/examples/simple_mixing.c +++ b/examples/simple_mixing.c @@ -11,8 +11,7 @@ Usage: simple_mixing [input file 0] [input file 1] ... [input file n] Example: simple_mixing file1.wav file2.flac ``` */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" #include diff --git a/examples/simple_playback.c b/examples/simple_playback.c index 491b4c26..1755b371 100644 --- a/examples/simple_playback.c +++ b/examples/simple_playback.c @@ -10,8 +10,7 @@ device and can be used independently of it. This example only plays back a singl back multiple files by simple loading multiple decoders and mixing them (do not create multiple devices to do this). See the simple_mixing example for how best to do this. */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" #include diff --git a/examples/simple_playback_sine.c b/examples/simple_playback_sine.c index d053f5a0..862c517c 100644 --- a/examples/simple_playback_sine.c +++ b/examples/simple_playback_sine.c @@ -14,8 +14,7 @@ This example works with Emscripten. */ #define MA_NO_DECODING #define MA_NO_ENCODING -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" #include diff --git a/examples/simple_spatialization.c b/examples/simple_spatialization.c index 48256eba..df61e399 100644 --- a/examples/simple_spatialization.c +++ b/examples/simple_spatialization.c @@ -14,8 +14,7 @@ To use this example, pass in the path of a sound as the first argument. The soun positioned in front of the listener, while the listener rotates on the the spot to create an orbiting effect. Terminate the program with Ctrl+C. */ -#define MINIAUDIO_IMPLEMENTATION -#include "../miniaudio.h" +#include "../miniaudio.c" #include #include /* For sinf() and cosf() */