Commit 3bee97a9 authored by David Reid's avatar David Reid

Remove sigvis.

This will be replaced with a more complete solution later.

Public issue #105.
parent cd44057a
[submodule "tools/external/dred"]
path = tools/external/dred
url = https://github.com/dr-soft/dred
// 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_SSE2
#define MA_NO_AVX2 #define MA_NO_AVX2
#ifdef NO_SIGVIS #define MINIAUDIO_IMPLEMENTATION
#define MINIAUDIO_IMPLEMENTATION #include "../miniaudio.h"
#include "../miniaudio.h"
#else
#define MINI_SIGVIS_IMPLEMENTATION
#include "../tools/mini_sigvis/mini_sigvis.h" // <-- Includes miniaudio.
#endif
// There is a usage pattern for resampling that miniaudio does not properly support which is where the client continuously // 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 // 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) ...@@ -137,66 +130,6 @@ int main(int argc, char** argv)
return -1; 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); result = ma_device_start(&device);
if (result != MA_SUCCESS) { if (result != MA_SUCCESS) {
return -2; return -2;
...@@ -205,7 +138,6 @@ int main(int argc, char** argv) ...@@ -205,7 +138,6 @@ int main(int argc, char** argv)
printf("Press Enter to quit...\n"); printf("Press Enter to quit...\n");
getchar(); getchar();
ma_device_uninit(&device); ma_device_uninit(&device);
#endif
return 0; return 0;
} }
Subproject commit f18b0c5d9245560d529af9ba6fc9691ec7cad34e
This is a simple library for visualizing signals. This readme will be updated later when the library stabilizes.
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment