mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Update website.
This commit is contained in:
@@ -248,7 +248,7 @@ a.doc-navigation-l4 {
|
||||
<div style="background-color:#fff; padding-bottom:0em; border-top:solid 1px #003800; background-color:#eee;">
|
||||
<table border="0" style="margin:0 auto; width:100%; border-collapse:collapse; border:solid 0px #000; table-layout:fixed;"><tr>
|
||||
<td valign="top" style="width:20em; padding:0; margin:0; border-right:solid 0px #000;"><div style="position:relative; height:100%; width:100%; border:solid 0px #000; padding:0; margin:0;">
|
||||
<a href="../index.html" class="doc-navigation">Documentation Home</a><a href="../manual/index.html" class="doc-navigation">Programming Manual</a><a href="index.html" class="doc-navigation ">Examples</a><a href="custom_backend.html" class="doc-navigation doc-navigation-l1 doc-navigation-active">Custom Backend</a><a href="custom_decoder.html" class="doc-navigation doc-navigation-l1 ">Custom Decoder</a><a href="custom_decoder_engine.html" class="doc-navigation doc-navigation-l1 ">Custom Decoder Engine</a><a href="data_source_chaining.html" class="doc-navigation doc-navigation-l1 ">Data Source Chaining</a><a href="duplex_effect.html" class="doc-navigation doc-navigation-l1 ">Duplex Effect</a><a href="engine_advanced.html" class="doc-navigation doc-navigation-l1 ">Engine Advanced</a><a href="engine_effects.html" class="doc-navigation doc-navigation-l1 ">Engine Effects</a><a href="engine_hello_world.html" class="doc-navigation doc-navigation-l1 ">Engine Hello World</a><a href="engine_sdl.html" class="doc-navigation doc-navigation-l1 ">Engine Sdl</a><a href="engine_steamaudio.html" class="doc-navigation doc-navigation-l1 ">Engine Steamaudio</a><a href="hilo_interop.html" class="doc-navigation doc-navigation-l1 ">Hilo Interop</a><a href="node_graph.html" class="doc-navigation doc-navigation-l1 ">Node Graph</a><a href="resource_manager.html" class="doc-navigation doc-navigation-l1 ">Resource Manager</a><a href="resource_manager_advanced.html" class="doc-navigation doc-navigation-l1 ">Resource Manager Advanced</a><a href="simple_capture.html" class="doc-navigation doc-navigation-l1 ">Simple Capture</a><a href="simple_duplex.html" class="doc-navigation doc-navigation-l1 ">Simple Duplex</a><a href="simple_enumeration.html" class="doc-navigation doc-navigation-l1 ">Simple Enumeration</a><a href="simple_loopback.html" class="doc-navigation doc-navigation-l1 ">Simple Loopback</a><a href="simple_looping.html" class="doc-navigation doc-navigation-l1 ">Simple Looping</a><a href="simple_mixing.html" class="doc-navigation doc-navigation-l1 ">Simple Mixing</a><a href="simple_playback.html" class="doc-navigation doc-navigation-l1 ">Simple Playback</a><a href="simple_playback_sine.html" class="doc-navigation doc-navigation-l1 ">Simple Playback Sine</a><a href="simple_playback_sine.html" class="doc-navigation doc-navigation-l1 ">Simple Playback Sine</a><a href="../api/index.html" class="doc-navigation" style="border-bottom:none;">API Reference</a></div></td><td valign="top" style="padding:1em; border-left:solid 1px #bbb;">
|
||||
<a href="../index.html" class="doc-navigation">Documentation Home</a><a href="../manual/index.html" class="doc-navigation">Programming Manual</a><a href="index.html" class="doc-navigation ">Examples</a><a href="custom_backend.html" class="doc-navigation doc-navigation-l1 doc-navigation-active">Custom Backend</a><a href="custom_decoder.html" class="doc-navigation doc-navigation-l1 ">Custom Decoder</a><a href="custom_decoder_engine.html" class="doc-navigation doc-navigation-l1 ">Custom Decoder Engine</a><a href="data_source_chaining.html" class="doc-navigation doc-navigation-l1 ">Data Source Chaining</a><a href="duplex_effect.html" class="doc-navigation doc-navigation-l1 ">Duplex Effect</a><a href="engine_advanced.html" class="doc-navigation doc-navigation-l1 ">Engine Advanced</a><a href="engine_effects.html" class="doc-navigation doc-navigation-l1 ">Engine Effects</a><a href="engine_hello_world.html" class="doc-navigation doc-navigation-l1 ">Engine Hello World</a><a href="engine_sdl.html" class="doc-navigation doc-navigation-l1 ">Engine Sdl</a><a href="engine_steamaudio.html" class="doc-navigation doc-navigation-l1 ">Engine Steamaudio</a><a href="hilo_interop.html" class="doc-navigation doc-navigation-l1 ">Hilo Interop</a><a href="node_graph.html" class="doc-navigation doc-navigation-l1 ">Node Graph</a><a href="resource_manager.html" class="doc-navigation doc-navigation-l1 ">Resource Manager</a><a href="resource_manager_advanced.html" class="doc-navigation doc-navigation-l1 ">Resource Manager Advanced</a><a href="simple_capture.html" class="doc-navigation doc-navigation-l1 ">Simple Capture</a><a href="simple_duplex.html" class="doc-navigation doc-navigation-l1 ">Simple Duplex</a><a href="simple_enumeration.html" class="doc-navigation doc-navigation-l1 ">Simple Enumeration</a><a href="simple_loopback.html" class="doc-navigation doc-navigation-l1 ">Simple Loopback</a><a href="simple_looping.html" class="doc-navigation doc-navigation-l1 ">Simple Looping</a><a href="simple_mixing.html" class="doc-navigation doc-navigation-l1 ">Simple Mixing</a><a href="simple_playback.html" class="doc-navigation doc-navigation-l1 ">Simple Playback</a><a href="simple_playback_sine.html" class="doc-navigation doc-navigation-l1 ">Simple Playback Sine</a><a href="simple_playback_sine.html" class="doc-navigation doc-navigation-l1 ">Simple Playback Sine</a><a href="simple_spatialization.html" class="doc-navigation doc-navigation-l1 ">Simple Spatialization</a><a href="../api/index.html" class="doc-navigation" style="border-bottom:none;">API Reference</a></div></td><td valign="top" style="padding:1em; border-left:solid 1px #bbb;">
|
||||
<h1>Custom Backend</h1><p>
|
||||
This example show how a custom backend can be implemented.
|
||||
</p>
|
||||
@@ -439,9 +439,6 @@ ma_format ma_format_from_sdl(MA_SDL_AudioFormat format)
|
||||
<span style="color:#0099cc">ma_bool32</span> cbResult;
|
||||
<span style="color:#0033ff">int</span> iDevice;
|
||||
|
||||
MA_ASSERT(pContext != NULL);
|
||||
MA_ASSERT(callback != NULL);
|
||||
|
||||
<span style="color:#009900">/* Playback */</span>
|
||||
<span style="color:#0033ff">if</span> (!isTerminated) {
|
||||
<span style="color:#0033ff">int</span> deviceCount = ((MA_PFN_SDL_GetNumAudioDevices)pContextEx->sdl.SDL_GetNumAudioDevices)(0);
|
||||
@@ -500,8 +497,6 @@ ma_format ma_format_from_sdl(MA_SDL_AudioFormat format)
|
||||
<span style="color:#0033ff">const</span> <span style="color:#0033ff">char</span>* pDeviceName;
|
||||
<span style="color:#666666">#endif</span>
|
||||
|
||||
MA_ASSERT(pContext != NULL);
|
||||
|
||||
<span style="color:#0033ff">if</span> (pDeviceID == NULL) {
|
||||
<span style="color:#0033ff">if</span> (deviceType == ma_device_type_playback) {
|
||||
pDeviceInfo->id.custom.<span style="color:#0033ff">i</span> = 0;
|
||||
@@ -525,7 +520,7 @@ ma_format ma_format_from_sdl(MA_SDL_AudioFormat format)
|
||||
of the device's _actual_ ideal format.
|
||||
|
||||
Note: With Emscripten, it looks like non-zero values need to be specified for desiredSpec. Whatever is specified in
|
||||
desiredSpec will be used by SDL since it uses it just does it's own format conversion internally. Therefore, from what
|
||||
desiredSpec will be used by SDL since it uses it just does its own format conversion internally. Therefore, from what
|
||||
I can tell, there's no real way to know the device's actual format which means I'm just going to fall back to the full
|
||||
range of channels and sample rates on Emscripten builds.
|
||||
*/</span>
|
||||
@@ -581,8 +576,6 @@ ma_format ma_format_from_sdl(MA_SDL_AudioFormat format)
|
||||
{
|
||||
ma_device_ex* pDeviceEx = (ma_device_ex*)pUserData;
|
||||
|
||||
MA_ASSERT(pDeviceEx != NULL);
|
||||
|
||||
ma_device_handle_backend_data_callback((<span style="color:#0099cc">ma_device</span>*)pDeviceEx, NULL, pBuffer, (<span style="color:#0099cc">ma_uint32</span>)bufferSizeInBytes / ma_get_bytes_per_frame(pDeviceEx->device.capture.internalFormat, pDeviceEx->device.capture.internalChannels));
|
||||
}
|
||||
|
||||
@@ -590,8 +583,6 @@ ma_format ma_format_from_sdl(MA_SDL_AudioFormat format)
|
||||
{
|
||||
ma_device_ex* pDeviceEx = (ma_device_ex*)pUserData;
|
||||
|
||||
MA_ASSERT(pDeviceEx != NULL);
|
||||
|
||||
ma_device_handle_backend_data_callback((<span style="color:#0099cc">ma_device</span>*)pDeviceEx, pBuffer, NULL, (<span style="color:#0099cc">ma_uint32</span>)bufferSizeInBytes / ma_get_bytes_per_frame(pDeviceEx->device.playback.internalFormat, pDeviceEx->device.playback.internalChannels));
|
||||
}
|
||||
|
||||
@@ -603,9 +594,6 @@ ma_format ma_format_from_sdl(MA_SDL_AudioFormat format)
|
||||
<span style="color:#0033ff">const</span> <span style="color:#0033ff">char</span>* pDeviceName;
|
||||
<span style="color:#0033ff">int</span> deviceID;
|
||||
|
||||
MA_ASSERT(pDeviceEx != NULL);
|
||||
MA_ASSERT(pDescriptor != NULL);
|
||||
|
||||
<span style="color:#009900">/*
|
||||
SDL is a little bit awkward with specifying the buffer size, You need to specify the size of the buffer in frames, but since we may
|
||||
have requested a period size in milliseconds we'll need to convert, which depends on the sample rate. But there's a possibility that
|
||||
@@ -689,8 +677,6 @@ ma_format ma_format_from_sdl(MA_SDL_AudioFormat format)
|
||||
ma_context_ex* pContextEx = (ma_context_ex*)pDevice->pContext;
|
||||
<span style="color:#0099cc">ma_result</span> result;
|
||||
|
||||
MA_ASSERT(pDevice != NULL);
|
||||
|
||||
<span style="color:#009900">/* SDL does not support loopback mode, so must return MA_DEVICE_TYPE_NOT_SUPPORTED if it's requested. */</span>
|
||||
<span style="color:#0033ff">if</span> (pConfig->deviceType == ma_device_type_loopback) {
|
||||
<span style="color:#0033ff">return</span> MA_DEVICE_TYPE_NOT_SUPPORTED;
|
||||
@@ -722,8 +708,6 @@ ma_format ma_format_from_sdl(MA_SDL_AudioFormat format)
|
||||
ma_device_ex* pDeviceEx = (ma_device_ex*)pDevice;
|
||||
ma_context_ex* pContextEx = (ma_context_ex*)pDevice->pContext;
|
||||
|
||||
MA_ASSERT(pDevice != NULL);
|
||||
|
||||
<span style="color:#0033ff">if</span> (pDevice-><span style="color:#0033ff">type</span> == ma_device_type_capture || pDevice-><span style="color:#0033ff">type</span> == ma_device_type_duplex) {
|
||||
((MA_PFN_SDL_CloseAudioDevice)pContextEx->sdl.SDL_CloseAudioDevice)(pDeviceEx->sdl.deviceIDCapture);
|
||||
}
|
||||
@@ -740,8 +724,6 @@ ma_format ma_format_from_sdl(MA_SDL_AudioFormat format)
|
||||
ma_device_ex* pDeviceEx = (ma_device_ex*)pDevice;
|
||||
ma_context_ex* pContextEx = (ma_context_ex*)pDevice->pContext;
|
||||
|
||||
MA_ASSERT(pDevice != NULL);
|
||||
|
||||
<span style="color:#0033ff">if</span> (pDevice-><span style="color:#0033ff">type</span> == ma_device_type_capture || pDevice-><span style="color:#0033ff">type</span> == ma_device_type_duplex) {
|
||||
((MA_PFN_SDL_PauseAudioDevice)pContextEx->sdl.SDL_PauseAudioDevice)(pDeviceEx->sdl.deviceIDCapture, 0);
|
||||
}
|
||||
@@ -758,8 +740,6 @@ ma_format ma_format_from_sdl(MA_SDL_AudioFormat format)
|
||||
ma_device_ex* pDeviceEx = (ma_device_ex*)pDevice;
|
||||
ma_context_ex* pContextEx = (ma_context_ex*)pDevice->pContext;
|
||||
|
||||
MA_ASSERT(pDevice != NULL);
|
||||
|
||||
<span style="color:#0033ff">if</span> (pDevice-><span style="color:#0033ff">type</span> == ma_device_type_capture || pDevice-><span style="color:#0033ff">type</span> == ma_device_type_duplex) {
|
||||
((MA_PFN_SDL_PauseAudioDevice)pContextEx->sdl.SDL_PauseAudioDevice)(pDeviceEx->sdl.deviceIDCapture, 1);
|
||||
}
|
||||
@@ -775,8 +755,6 @@ ma_format ma_format_from_sdl(MA_SDL_AudioFormat format)
|
||||
{
|
||||
ma_context_ex* pContextEx = (ma_context_ex*)pContext;
|
||||
|
||||
MA_ASSERT(pContext != NULL);
|
||||
|
||||
((MA_PFN_SDL_QuitSubSystem)pContextEx->sdl.SDL_QuitSubSystem)(MA_SDL_INIT_AUDIO);
|
||||
|
||||
<span style="color:#009900">/* Close the handle to the SDL shared object last. */</span>
|
||||
@@ -804,8 +782,6 @@ ma_format ma_format_from_sdl(MA_SDL_AudioFormat format)
|
||||
<span style="color:#666666">#endif</span>
|
||||
};
|
||||
|
||||
MA_ASSERT(pContext != NULL);
|
||||
|
||||
(<span style="color:#0033ff">void</span>)pConfig;
|
||||
|
||||
<span style="color:#009900">/* Check if we have SDL2 installed somewhere. If not it's not usable and we need to abort. */</span>
|
||||
@@ -900,15 +876,8 @@ Main program starts here.
|
||||
|
||||
<span style="color:#0033ff">void</span> data_callback(<span style="color:#0099cc">ma_device</span>* pDevice, <span style="color:#0033ff">void</span>* pOutput, <span style="color:#0033ff">const</span> <span style="color:#0033ff">void</span>* pInput, <span style="color:#0099cc">ma_uint32</span> frameCount)
|
||||
{
|
||||
MA_ASSERT(pDevice->playback.channels == DEVICE_CHANNELS);
|
||||
|
||||
<span style="color:#0033ff">if</span> (pDevice-><span style="color:#0033ff">type</span> == ma_device_type_playback) {
|
||||
<span style="color:#0099cc">ma_waveform</span>* pSineWave;
|
||||
|
||||
pSineWave = (<span style="color:#0099cc">ma_waveform</span>*)pDevice->pUserData;
|
||||
MA_ASSERT(pSineWave != NULL);
|
||||
|
||||
ma_waveform_read_pcm_frames(pSineWave, pOutput, frameCount, NULL);
|
||||
ma_waveform_read_pcm_frames((<span style="color:#0099cc">ma_waveform</span>*)pDevice->pUserData, pOutput, frameCount, NULL);
|
||||
}
|
||||
|
||||
<span style="color:#0033ff">if</span> (pDevice-><span style="color:#0033ff">type</span> == ma_device_type_duplex) {
|
||||
@@ -996,7 +965,8 @@ Main program starts here.
|
||||
(<span style="color:#0033ff">void</span>)argv;
|
||||
|
||||
<span style="color:#0033ff">return</span> 0;
|
||||
}</pre></div></td>
|
||||
}
|
||||
</pre></div></td>
|
||||
</tr></table>
|
||||
</div>
|
||||
<table style="margin:0 auto; padding:1em 0px; text-align:center;">
|
||||
@@ -1009,7 +979,7 @@ Main program starts here.
|
||||
</table>
|
||||
|
||||
<div style="color:#e0d7cf; font-size:9pt; padding:2em 0px; text-align:center;">
|
||||
Copyright © 2023 David Reid<br/>
|
||||
Copyright © 2025 David Reid<br/>
|
||||
Developed by David Reid - <a class="footer-link" href="mailto:mackron@gmail.com">mackron@gmail.com</a>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user