14 #define MINIAUDIO_IMPLEMENTATION
15 #include "../miniaudio.h"
22 #define SAMPLE_FORMAT ma_format_f32
23 #define CHANNEL_COUNT 2
24 #define SAMPLE_RATE 48000
55 while (totalFramesRead < frameCount) {
58 ma_uint32 totalFramesRemaining = frameCount - totalFramesRead;
59 ma_uint32 framesToReadThisIteration = tempCapInFrames;
60 if (framesToReadThisIteration > totalFramesRemaining) {
61 framesToReadThisIteration = totalFramesRemaining;
65 if (framesReadThisIteration == 0) {
70 for (iSample = 0; iSample < framesReadThisIteration*
CHANNEL_COUNT; ++iSample) {
71 pOutputF32[totalFramesRead*
CHANNEL_COUNT + iSample] += temp[iSample];
74 totalFramesRead += framesReadThisIteration;
76 if (framesReadThisIteration < framesToReadThisIteration) {
81 return totalFramesRead;
86 float* pOutputF32 = (
float*)pOutput;
94 if (framesRead < frameCount) {
120 printf(
"No input files.\n");
134 for (iDecoder2 = 0; iDecoder2 < iDecoder; ++iDecoder2) {
140 printf(
"Failed to load %s.\n",
argv[1+iDecoder]);
161 printf(
"Failed to open playback device.\n");
181 printf(
"Failed to start playback device.\n");
185 printf(
"Waiting for playback to complete...\n");