mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-21 15:56:58 +02:00
Remove sigvis.
This will be replaced with a more complete solution later. Public issue #105.
This commit is contained in:
+2
-70
@@ -1,16 +1,9 @@
|
||||
// We're using sigvis for visualizations. This will include miniaudio for us, so no need to include miniaudio in this file.
|
||||
#define NO_SIGVIS
|
||||
|
||||
#define MA_NO_SSE2
|
||||
#define MA_NO_AVX2
|
||||
|
||||
#ifdef NO_SIGVIS
|
||||
#define MINIAUDIO_IMPLEMENTATION
|
||||
#include "../miniaudio.h"
|
||||
#else
|
||||
#define MINI_SIGVIS_IMPLEMENTATION
|
||||
#include "../tools/mini_sigvis/mini_sigvis.h" // <-- Includes miniaudio.
|
||||
#endif
|
||||
#define MINIAUDIO_IMPLEMENTATION
|
||||
#include "../miniaudio.h"
|
||||
|
||||
// There is a usage pattern for resampling that miniaudio does not properly support which is where the client continuously
|
||||
// reads samples until ma_src_read() returns 0. The problem with this pattern is that is consumes the samples sitting
|
||||
@@ -137,66 +130,6 @@ int main(int argc, char** argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifndef NO_SIGVIS
|
||||
msigvis_context sigvis;
|
||||
result = msigvis_init(&sigvis);
|
||||
if (result != MA_SUCCESS) {
|
||||
printf("Failed to initialize mini_sigvis context.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
msigvis_screen screen;
|
||||
result = msigvis_screen_init(&sigvis, 1280, 720, &screen);
|
||||
if (result != MA_SUCCESS) {
|
||||
printf("Failed to initialize mini_sigvis screen.\n");
|
||||
return -2;
|
||||
}
|
||||
|
||||
msigvis_screen_show(&screen);
|
||||
|
||||
|
||||
msigvis_channel channelSineWave;
|
||||
result = msigvis_channel_init(&sigvis, ma_format_f32, sampleRateOut, &channelSineWave);
|
||||
if (result != MA_SUCCESS) {
|
||||
printf("Failed to initialize mini_sigvis channel.\n");
|
||||
return -3;
|
||||
}
|
||||
|
||||
float testSamples[40960];
|
||||
float* pFramesF32 = testSamples;
|
||||
|
||||
// To reproduce the case we are needing to test, we need to read from the SRC in a very specific way. We keep looping
|
||||
// until we've read the requested frame count, however we have an inner loop that keeps running until ma_src_read()
|
||||
// returns 0, in which case we need to reload the SRC's input data and keep going.
|
||||
ma_uint32 totalFramesRead = 0;
|
||||
while (totalFramesRead < ma_countof(testSamples)) {
|
||||
ma_uint32 maxFramesToRead = 128;
|
||||
ma_uint32 framesToRead = ma_countof(testSamples);
|
||||
if (framesToRead > maxFramesToRead) {
|
||||
framesToRead = maxFramesToRead;
|
||||
}
|
||||
|
||||
ma_uint32 framesRead = (ma_uint32)ma_src_read_deinterleaved(&src, framesToRead, (void**)&pFramesF32, NULL);
|
||||
if (framesRead == 0) {
|
||||
reload_src_input();
|
||||
}
|
||||
|
||||
totalFramesRead += framesRead;
|
||||
pFramesF32 += framesRead;
|
||||
}
|
||||
|
||||
msigvis_channel_push_samples(&channelSineWave, ma_countof(testSamples), testSamples);
|
||||
msigvis_screen_add_channel(&screen, &channelSineWave);
|
||||
|
||||
|
||||
int exitCode = msigvis_run(&sigvis);
|
||||
|
||||
msigvis_screen_uninit(&screen);
|
||||
msigvis_uninit(&sigvis);
|
||||
#else
|
||||
|
||||
result = ma_device_start(&device);
|
||||
if (result != MA_SUCCESS) {
|
||||
return -2;
|
||||
@@ -205,7 +138,6 @@ int main(int argc, char** argv)
|
||||
printf("Press Enter to quit...\n");
|
||||
getchar();
|
||||
ma_device_uninit(&device);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user