mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-23 08:44:04 +02:00
Minor updates to examples.
This commit is contained in:
@@ -8,10 +8,11 @@ The following features are demonstrated:
|
|||||||
* Multiple engines with a shared resource manager.
|
* Multiple engines with a shared resource manager.
|
||||||
* Creation and management of `ma_sound` objects.
|
* Creation and management of `ma_sound` objects.
|
||||||
|
|
||||||
This example will play the sound that's passed in the command line.
|
This example will play the sound that's passed in on the command line.
|
||||||
|
|
||||||
If you were wanting to support multiple listeners, this example will show you how to do that. You achieve this by
|
Using a shared resource manager, as we do in this example, is useful for when you want to user
|
||||||
initializing one `ma_engine` object for each listener, each of which share a single self-managed resource manager.
|
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
|
#define MINIAUDIO_IMPLEMENTATION
|
||||||
#include "../miniaudio.h"
|
#include "../miniaudio.h"
|
||||||
@@ -24,9 +25,10 @@ void data_callback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uin
|
|||||||
(void)pInput;
|
(void)pInput;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Since we're managing the underlying device ourselves, we need to manually call the engine's data handler. To do
|
Since we're managing the underlying device ourselves, we need to read from the engine directly.
|
||||||
this we need access to the `ma_engine` object which we passed in to the user data. The advantage of this is that
|
To do this we need access to the `ma_engine` object which we passed in to the user data. One
|
||||||
you could do your own audio processing in addition to the engine's standard processing.
|
advantage of this is that you could do your own audio processing in addition to the engine's
|
||||||
|
standard processing.
|
||||||
*/
|
*/
|
||||||
ma_engine_read_pcm_frames((ma_engine*)pDevice->pUserData, pOutput, frameCount, NULL);
|
ma_engine_read_pcm_frames((ma_engine*)pDevice->pUserData, pOutput, frameCount, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ int main(int argc, char** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Connect the output bus fo the delay node to the input bus of the endpoint. */
|
/* Connect the output bus of the delay node to the input bus of the endpoint. */
|
||||||
ma_node_attach_output_bus(&g_delayNode, 0, ma_node_graph_get_endpoint(&g_nodeGraph), 0);
|
ma_node_attach_output_bus(&g_delayNode, 0, ma_node_graph_get_endpoint(&g_nodeGraph), 0);
|
||||||
|
|
||||||
/* Set the volume of the delay filter to make it more of less impactful. */
|
/* Set the volume of the delay filter to make it more of less impactful. */
|
||||||
|
|||||||
Reference in New Issue
Block a user