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
+35 -35
View File
@@ -263,45 +263,45 @@ the <span style="font-family:monospace;">ma_waveform_read_pcm_frames()</span> AP
This example works with Emscripten.</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 MA_NO_DECODING
#define MA_NO_ENCODING
#define MINIAUDIO_IMPLEMENTATION
#include &quot;../miniaudio.h&quot;
<span style="color:#666666">#define</span> MA_NO_DECODING
<span style="color:#666666">#define</span> MA_NO_ENCODING
<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;stdio.h&gt;
<span style="color:#666666">#include</span> <span style="color:#cc3300">&lt;stdio.h&gt;</span>
#ifdef __EMSCRIPTEN__
#include &lt;emscripten.h&gt;
<span style="color:#666666">#ifdef</span> __EMSCRIPTEN__
<span style="color:#666666">#include</span> <span style="color:#cc3300">&lt;emscripten.h&gt;</span>
void main_loop__em()
<span style="color:#0033ff">void</span> main_loop__em()
{
}
#endif
<span style="color:#666666">#endif</span>
#define DEVICE_FORMAT ma_format_f32
#define DEVICE_CHANNELS 2
#define DEVICE_SAMPLE_RATE 48000
<span style="color:#666666">#define</span> DEVICE_FORMAT ma_format_f32
<span style="color:#666666">#define</span> DEVICE_CHANNELS 2
<span style="color:#666666">#define</span> DEVICE_SAMPLE_RATE 48000
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_waveform* pSineWave;
<span style="color:#0099cc">ma_waveform</span>* pSineWave;
MA_ASSERT(pDevice-&gt;playback.channels == DEVICE_CHANNELS);
pSineWave = (ma_waveform*)pDevice-&gt;pUserData;
pSineWave = (<span style="color:#0099cc">ma_waveform</span>*)pDevice-&gt;pUserData;
MA_ASSERT(pSineWave != NULL);
ma_waveform_read_pcm_frames(pSineWave, pOutput, frameCount);
(void)pInput; /* Unused. */
(<span style="color:#0033ff">void</span>)pInput; <span style="color:#009900">/* Unused. */</span>
}
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_waveform sineWave;
ma_device_config deviceConfig;
ma_device device;
ma_waveform_config sineWaveConfig;
<span style="color:#0099cc">ma_waveform</span> sineWave;
<span style="color:#0099cc">ma_device_config</span> deviceConfig;
<span style="color:#0099cc">ma_device</span> device;
<span style="color:#0099cc">ma_waveform_config</span> sineWaveConfig;
sineWaveConfig = ma_waveform_config_init(DEVICE_FORMAT, DEVICE_CHANNELS, DEVICE_SAMPLE_RATE, ma_waveform_type_sine, 0.2, 220);
ma_waveform_init(&amp;sineWaveConfig, &amp;sineWave);
@@ -313,31 +313,31 @@ int main(int argc, char** argv)
deviceConfig.dataCallback = data_callback;
deviceConfig.pUserData = &amp;sineWave;
if (ma_device_init(NULL, &amp;deviceConfig, &amp;device) != MA_SUCCESS) {
printf(&quot;Failed to open playback device.\n&quot;);
return -4;
<span style="color:#0033ff">if</span> (ma_device_init(NULL, &amp;deviceConfig, &amp;device) != MA_SUCCESS) {
printf(<span style="color:#cc3300">&quot;Failed to open playback device.\n&quot;</span>);
<span style="color:#0033ff">return</span> -4;
}
printf(&quot;Device Name: %s\n&quot;, device.playback.name);
printf(<span style="color:#cc3300">&quot;Device Name: %s\n&quot;</span>, device.playback.name);
if (ma_device_start(&amp;device) != MA_SUCCESS) {
printf(&quot;Failed to start playback device.\n&quot;);
<span style="color:#0033ff">if</span> (ma_device_start(&amp;device) != MA_SUCCESS) {
printf(<span style="color:#cc3300">&quot;Failed to start playback device.\n&quot;</span>);
ma_device_uninit(&amp;device);
return -5;
<span style="color:#0033ff">return</span> -5;
}
#ifdef __EMSCRIPTEN__
<span style="color:#666666">#ifdef</span> __EMSCRIPTEN__
emscripten_set_main_loop(main_loop__em, 0, 1);
#else
printf(&quot;Press Enter to quit...\n&quot;);
<span style="color:#666666">#else</span>
printf(<span style="color:#cc3300">&quot;Press Enter to quit...\n&quot;</span>);
getchar();
#endif
<span style="color:#666666">#endif</span>
ma_device_uninit(&amp;device);
(void)argc;
(void)argv;
return 0;
(<span style="color:#0033ff">void</span>)argc;
(<span style="color:#0033ff">void</span>)argv;
<span style="color:#0033ff">return</span> 0;
}
</pre></div></td>
</tr></table>