Add syntax highlighting to documentation.

This commit is contained in:
David Reid
2020-07-16 21:32:01 +10:00
parent aba471bbe9
commit ba57831c18
10 changed files with 469 additions and 469 deletions
+27 -27
View File
@@ -255,40 +255,40 @@ 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.</p>
<div style="font-family:monospace; border:solid 1px #003800; border-left:solid 0.5em #003800; margin:1em 0em;"><pre style="margin:0.5em 1em; padding:0; line-height:125%">
#define MINIAUDIO_IMPLEMENTATION
#include &quot;../miniaudio.h&quot;
<span style="color:#666666">#define</span> MINIAUDIO_IMPLEMENTATION
<span style="color:#666666">#include</span> <span style="color:#cc3300">&quot;../miniaudio.h&quot;</span>
#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
<span style="color:#666666">#include</span> <span style="color:#cc3300">&lt;stdlib.h&gt;</span>
<span style="color:#666666">#include</span> <span style="color:#cc3300">&lt;stdio.h&gt;</span>
void data_callback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount)
<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_encoder* pEncoder = (ma_encoder*)pDevice-&gt;pUserData;
<span style="color:#0099cc">ma_encoder</span>* pEncoder = (<span style="color:#0099cc">ma_encoder</span>*)pDevice-&gt;pUserData;
MA_ASSERT(pEncoder != NULL);
ma_encoder_write_pcm_frames(pEncoder, pInput, frameCount);
(void)pOutput;
(<span style="color:#0033ff">void</span>)pOutput;
}
int main(int argc, char** argv)
<span style="color:#0033ff">int</span> main(<span style="color:#0033ff">int</span> argc, <span style="color:#0033ff">char</span>** argv)
{
ma_result result;
ma_encoder_config encoderConfig;
ma_encoder encoder;
ma_device_config deviceConfig;
ma_device device;
<span style="color:#0099cc">ma_result</span> result;
<span style="color:#0099cc">ma_encoder_config</span> encoderConfig;
<span style="color:#0099cc">ma_encoder</span> encoder;
<span style="color:#0099cc">ma_device_config</span> deviceConfig;
<span style="color:#0099cc">ma_device</span> device;
if (argc &lt; 2) {
printf(&quot;No input file.\n&quot;);
return -1;
<span style="color:#0033ff">if</span> (argc &lt; 2) {
printf(<span style="color:#cc3300">&quot;No input file.\n&quot;</span>);
<span style="color:#0033ff">return</span> -1;
}
encoderConfig = ma_encoder_config_init(ma_resource_format_wav, ma_format_f32, 2, 44100);
if (ma_encoder_init_file(argv[1], &amp;encoderConfig, &amp;encoder) != MA_SUCCESS) {
printf(&quot;Failed to initialize output file.\n&quot;);
return -1;
<span style="color:#0033ff">if</span> (ma_encoder_init_file(argv[1], &amp;encoderConfig, &amp;encoder) != MA_SUCCESS) {
printf(<span style="color:#cc3300">&quot;Failed to initialize output file.\n&quot;</span>);
<span style="color:#0033ff">return</span> -1;
}
deviceConfig = ma_device_config_init(ma_device_type_capture);
@@ -299,25 +299,25 @@ int main(int argc, char** argv)
deviceConfig.pUserData = &amp;encoder;
result = ma_device_init(NULL, &amp;deviceConfig, &amp;device);
if (result != MA_SUCCESS) {
printf(&quot;Failed to initialize capture device.\n&quot;);
return -2;
<span style="color:#0033ff">if</span> (result != MA_SUCCESS) {
printf(<span style="color:#cc3300">&quot;Failed to initialize capture device.\n&quot;</span>);
<span style="color:#0033ff">return</span> -2;
}
result = ma_device_start(&amp;device);
if (result != MA_SUCCESS) {
<span style="color:#0033ff">if</span> (result != MA_SUCCESS) {
ma_device_uninit(&amp;device);
printf(&quot;Failed to start device.\n&quot;);
return -3;
printf(<span style="color:#cc3300">&quot;Failed to start device.\n&quot;</span>);
<span style="color:#0033ff">return</span> -3;
}
printf(&quot;Press Enter to stop recording...\n&quot;);
printf(<span style="color:#cc3300">&quot;Press Enter to stop recording...\n&quot;</span>);
getchar();
ma_device_uninit(&amp;device);
ma_encoder_uninit(&amp;encoder);
return 0;
<span style="color:#0033ff">return</span> 0;
}
</pre></div></td>
</tr></table>