Skip to content

Commit

Permalink
Remove sigvis.
Browse files Browse the repository at this point in the history
This will be replaced with a more complete solution later.

Public issue mackron#105.
  • Loading branch information
mackron committed Dec 12, 2019
1 parent cd44057 commit 3bee97a
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 540 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "tools/external/dred"]
path = tools/external/dred
url = https://github.com/dr-soft/dred
72 changes: 2 additions & 70 deletions tests/ma_resampling.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -205,7 +138,6 @@ int main(int argc, char** argv)
printf("Press Enter to quit...\n");
getchar();
ma_device_uninit(&device);
#endif

return 0;
}
1 change: 0 additions & 1 deletion tools/external/dred
Submodule dred deleted from f18b0c
1 change: 0 additions & 1 deletion tools/mini_sigvis/README.md

This file was deleted.

Loading

0 comments on commit 3bee97a

Please sign in to comment.