mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Stop using MINIAUDIO_IMPLEMENTATION in examples.
This commit is contained in:
@@ -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
|
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.
|
the start as miniaudio will do that for you internally.
|
||||||
*/
|
*/
|
||||||
#define MA_EXPERIMENTAL__DATA_LOOPING_AND_CHAINING
|
#include "../miniaudio.c"
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
the miniaudio repository. The vocoder node uses https://github.com/blastbay/voclib to achieve the
|
||||||
effect.
|
effect.
|
||||||
*/
|
*/
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
#include "../extras/nodes/ma_vocoder_node/ma_vocoder_node.c"
|
#include "../extras/nodes/ma_vocoder_node/ma_vocoder_node.c"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|||||||
@@ -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
|
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.
|
might be a local co-op multiplayer game where each player has their own headphones.
|
||||||
*/
|
*/
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
#define MAX_DEVICES 2
|
#define MAX_DEVICES 2
|
||||||
#define MAX_SOUNDS 32
|
#define MAX_SOUNDS 32
|
||||||
|
|||||||
@@ -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
|
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.
|
sound file, you need multiple `ma_sound` objects.
|
||||||
*/
|
*/
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
#define DELAY_IN_SECONDS 0.2f
|
#define DELAY_IN_SECONDS 0.2f
|
||||||
#define DECAY 0.25f /* Volume falloff for each echo. */
|
#define DECAY 0.25f /* Volume falloff for each echo. */
|
||||||
|
|||||||
@@ -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.
|
This will play the sound specified on the command line.
|
||||||
*/
|
*/
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ This example will load the sound specified on the command line and rotate it aro
|
|||||||
head.
|
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 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.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
#define SDL_MAIN_HANDLED
|
#define SDL_MAIN_HANDLED
|
||||||
#include <SDL2/SDL.h> /* Change this to your include location. Might be <SDL.h>. */
|
#include <SDL2/SDL.h> /* Change this to your include location. Might be <SDL.h>. */
|
||||||
|
|||||||
@@ -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
|
engine to be different to that of your Steam Audio configuration, you'll need to implement a sort
|
||||||
of buffering solution to your node.
|
of buffering solution to your node.
|
||||||
*/
|
*/
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
#include <stdint.h> /* 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 <stdint.h> /* 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 <phonon.h> /* Steam Audio */
|
#include <phonon.h> /* Steam Audio */
|
||||||
|
|||||||
@@ -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
|
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.
|
may be updated to make use of a more advanced data source that handles all of this.
|
||||||
*/
|
*/
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
static ma_pcm_rb rb;
|
static ma_pcm_rb rb;
|
||||||
static ma_device device;
|
static ma_device device;
|
||||||
|
|||||||
@@ -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()`.
|
When you want to read from the graph, you simply call `ma_node_graph_read_pcm_frames()`.
|
||||||
*/
|
*/
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
/* Data Format */
|
/* Data Format */
|
||||||
#define FORMAT ma_format_f32 /* Must always be f32. */
|
#define FORMAT ma_format_f32 /* Must always be f32. */
|
||||||
|
|||||||
@@ -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.
|
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 MA_NO_ENGINE /* We're intentionally not using the ma_engine API here. */
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
|
|||||||
@@ -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.
|
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 MA_NO_ENGINE /* We're intentionally not using the ma_engine API here. */
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
static ma_resource_manager_data_source g_dataSources[16];
|
static ma_resource_manager_data_source g_dataSources[16];
|
||||||
static ma_uint32 g_dataSourceCount;
|
static ma_uint32 g_dataSourceCount;
|
||||||
|
|||||||
@@ -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
|
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.
|
data received by the microphone straight to a WAV file.
|
||||||
*/
|
*/
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|||||||
@@ -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 for both capture and playback. If internally the native sample rates differ, miniaudio will perform the
|
||||||
sample rate conversion for you automatically.
|
sample rate conversion for you automatically.
|
||||||
*/
|
*/
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
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.
|
`ma_device_init()` when you initialize your devices.
|
||||||
*/
|
*/
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
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.
|
properties. The output buffer in the callback will be null whereas the input buffer will be valid.
|
||||||
*/
|
*/
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|||||||
@@ -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
|
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.
|
decoder straight into `ma_data_source_read_pcm_frames()` and it will just work.
|
||||||
*/
|
*/
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ Usage: simple_mixing [input file 0] [input file 1] ... [input file n]
|
|||||||
Example: simple_mixing file1.wav file2.flac
|
Example: simple_mixing file1.wav file2.flac
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
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.
|
the simple_mixing example for how best to do this.
|
||||||
*/
|
*/
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ This example works with Emscripten.
|
|||||||
*/
|
*/
|
||||||
#define MA_NO_DECODING
|
#define MA_NO_DECODING
|
||||||
#define MA_NO_ENCODING
|
#define MA_NO_ENCODING
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
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.
|
orbiting effect. Terminate the program with Ctrl+C.
|
||||||
*/
|
*/
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#include "../miniaudio.c"
|
||||||
#include "../miniaudio.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <math.h> /* For sinf() and cosf() */
|
#include <math.h> /* For sinf() and cosf() */
|
||||||
|
|||||||
Reference in New Issue
Block a user