mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 01:04:02 +02:00
Use C syntax highlighting for example.
This commit is contained in:
@@ -21,23 +21,10 @@ Example
|
|||||||
=======
|
=======
|
||||||
mini_al will request and deliver audio data through callbacks.
|
mini_al will request and deliver audio data through callbacks.
|
||||||
|
|
||||||
```
|
```c
|
||||||
#define MAL_IMPLEMENTATION
|
|
||||||
#include "../mini_al.h"
|
|
||||||
|
|
||||||
#define DR_WAV_IMPLEMENTATION
|
|
||||||
#include "dr_wav.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
// This is the function that's used for sending more data to the device for playback.
|
|
||||||
mal_uint32 on_send_frames_to_device(mal_device* pDevice, mal_uint32 frameCount, void* pSamples)
|
mal_uint32 on_send_frames_to_device(mal_device* pDevice, mal_uint32 frameCount, void* pSamples)
|
||||||
{
|
{
|
||||||
drwav* pWav = (drwav*)pDevice->pUserData;
|
drwav* pWav = (drwav*)pDevice->pUserData;
|
||||||
if (pWav == NULL) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (mal_uint32)drwav_read_f32(pWav, frameCount * pDevice->channels, (float*)pSamples) / pDevice->channels;
|
return (mal_uint32)drwav_read_f32(pWav, frameCount * pDevice->channels, (float*)pSamples) / pDevice->channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user