mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-21 15:56:58 +02:00
Update docs.
This commit is contained in:
+43
-6
@@ -353,7 +353,7 @@ device on the stack, but you could allocate it on the heap if that suits your si
|
||||
|
||||
<span style="color:#009900">// Do something here. Probably your program's main loop.</span>
|
||||
|
||||
ma_device_uninit(&device); <span style="color:#009900">// This will stop the device so no need to do that manually.</span>
|
||||
ma_device_uninit(&device);
|
||||
<span style="color:#0033ff">return</span> 0;
|
||||
}
|
||||
</pre></div><p>
|
||||
@@ -1054,6 +1054,34 @@ You cannot use <span style="font-family:monospace;">-std=c*</span> compiler flag
|
||||
</p>
|
||||
<p>
|
||||
|
||||
You can enable the use of AudioWorkets by defining <span style="font-family:monospace;">MA_ENABLE_AUDIO_WORKLETS</span> and then compiling
|
||||
with the following options:
|
||||
</p>
|
||||
<ul style="overflow:hidden;">
|
||||
<li>
|
||||
AUDIO_WORKLET=1 -sWASM_WORKERS=1 -sASYNCIFY</li>
|
||||
</ul>
|
||||
<p>
|
||||
|
||||
An example for compiling with AudioWorklet support might look like this:
|
||||
</p>
|
||||
<p>
|
||||
|
||||
emcc program.c -o bin/program.html -DMA_ENABLE_AUDIO_WORKLETS -sAUDIO_WORKLET=1 -sWASM_WORKERS=1 -sASYNCIFY
|
||||
</p>
|
||||
<p>
|
||||
|
||||
To run locally, you'll need to use emrun:
|
||||
</p>
|
||||
<p>
|
||||
|
||||
emrun bin/program.html
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
@@ -2913,7 +2941,7 @@ result = ma_data_source_read_pcm_frames(&dataSource, pDecodedData, frameCoun
|
||||
|
||||
<span style="color:#009900">// ...</span>
|
||||
|
||||
ma_resource_manager_data_source_uninit(pResourceManager, &dataSource);
|
||||
ma_resource_manager_data_source_uninit(&dataSource);
|
||||
</pre></div><p>
|
||||
|
||||
The <span style="font-family:monospace;">flags</span> parameter specifies how you want to perform loading of the sound file. It can be a
|
||||
@@ -3220,10 +3248,10 @@ once after the other:
|
||||
</p>
|
||||
<div style="font-family:monospace; border:solid 1px #003800; border-left:solid 0.5em #003800; margin:1em 0em; width:100%;"><pre style="margin:0.5em 1em; padding:0; line-height:125%; overflow-x:auto;">
|
||||
ma_resource_manager_data_source_init(pResourceManager, <span style="color:#cc3300">"my_file"</span>, ..., &myDataBuffer0); <span style="color:#009900">// Refcount = 1. Initial load.</span>
|
||||
ma_resource_manager_data_source_uninit(pResourceManager, &myDataBuffer0); <span style="color:#009900">// Refcount = 0. Unloaded.</span>
|
||||
ma_resource_manager_data_source_uninit(&myDataBuffer0); <span style="color:#009900">// Refcount = 0. Unloaded.</span>
|
||||
|
||||
ma_resource_manager_data_source_init(pResourceManager, <span style="color:#cc3300">"my_file"</span>, ..., &myDataBuffer1); <span style="color:#009900">// Refcount = 1. Reloaded because previous uninit() unloaded it.</span>
|
||||
ma_resource_manager_data_source_uninit(pResourceManager, &myDataBuffer1); <span style="color:#009900">// Refcount = 0. Unloaded.</span>
|
||||
ma_resource_manager_data_source_uninit(&myDataBuffer1); <span style="color:#009900">// Refcount = 0. Unloaded.</span>
|
||||
</pre></div><p>
|
||||
|
||||
A binary search tree (BST) is used for storing data buffers as it has good balance between
|
||||
@@ -4325,9 +4353,18 @@ example below:
|
||||
|
||||
</p>
|
||||
<div style="font-family:monospace; border:solid 1px #003800; border-left:solid 0.5em #003800; margin:1em 0em; width:100%;"><pre style="margin:0.5em 1em; padding:0; line-height:125%; overflow-x:auto;">
|
||||
framesWritten = ma_encoder_write_pcm_frames(&encoder, pPCMFramesToWrite, framesToWrite);
|
||||
<span style="color:#0099cc">ma_uint64</span> framesWritten;
|
||||
result = ma_encoder_write_pcm_frames(&encoder, pPCMFramesToWrite, framesToWrite, &framesWritten);
|
||||
<span style="color:#0033ff">if</span> (result != MA_SUCCESS) {
|
||||
... handle error ...
|
||||
}
|
||||
</pre></div><p>
|
||||
|
||||
The <span style="font-family:monospace;">framesWritten</span> variable will contain the number of PCM frames that were actually written. This
|
||||
is optionally and you can pass in <span style="font-family:monospace;">NULL</span> if you need this.
|
||||
</p>
|
||||
<p>
|
||||
|
||||
Encoders must be uninitialized with <span style="font-family:monospace;">ma_encoder_uninit()</span>.
|
||||
</p>
|
||||
<p>
|
||||
@@ -5695,7 +5732,7 @@ you internally. Memory management is flexible and should support most use cases.
|
||||
</p>
|
||||
<p>
|
||||
|
||||
Audio buffers are initialised using the standard configuration system used everywhere in miniaudio:
|
||||
Audio buffers are initialized using the standard configuration system used everywhere in miniaudio:
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user