6 #define DR_FLAC_IMPLEMENTATION
7 #include "../extras/dr_flac.h"
8 #define DR_MP3_IMPLEMENTATION
9 #include "../extras/dr_mp3.h"
10 #define DR_WAV_IMPLEMENTATION
11 #include "../extras/dr_wav.h"
13 #define MINIAUDIO_IMPLEMENTATION
14 #include "../miniaudio.h"
21 #define SAMPLE_FORMAT ma_format_f32
22 #define CHANNEL_COUNT 2
23 #define SAMPLE_RATE 48000
54 while (totalFramesRead < frameCount) {
57 ma_uint32 totalFramesRemaining = frameCount - totalFramesRead;
58 ma_uint32 framesToReadThisIteration = tempCapInFrames;
59 if (framesToReadThisIteration > totalFramesRemaining) {
60 framesToReadThisIteration = totalFramesRemaining;
64 if (framesReadThisIteration == 0) {
69 for (iSample = 0; iSample < framesReadThisIteration*
CHANNEL_COUNT; ++iSample) {
70 pOutputF32[totalFramesRead*
CHANNEL_COUNT + iSample] += temp[iSample];
73 totalFramesRead += framesReadThisIteration;
75 if (framesReadThisIteration < framesToReadThisIteration) {
80 return totalFramesRead;
85 float* pOutputF32 = (
float*)pOutput;
93 if (framesRead < frameCount) {
119 printf(
"No input files.\n");
133 for (iDecoder2 = 0; iDecoder2 < iDecoder; ++iDecoder2) {
139 printf(
"Failed to load %s.\n",
argv[1+iDecoder]);
160 printf(
"Failed to open playback device.\n");
180 printf(
"Failed to start playback device.\n");
184 printf(
"Waiting for playback to complete...\n");