From 992bed5fbbbe47917e862ef6a4aee3921bdf4abb Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Fri, 2 Oct 2015 21:25:53 +0100 Subject: graphical waterfall drawing --- test/ui_gl_waterfall.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) (limited to 'test/ui_gl_waterfall.c') diff --git a/test/ui_gl_waterfall.c b/test/ui_gl_waterfall.c index 1af4096..cbc2ec4 100644 --- a/test/ui_gl_waterfall.c +++ b/test/ui_gl_waterfall.c @@ -3,7 +3,7 @@ #include //radiola -#include +#include #include #define SAMPLE_RATE 2048000 @@ -253,6 +253,76 @@ int main() { + int i,j; + uint8_t *buf, *sample_buf; + int buf_len, sample_len; + uint32_t dev_num; + + glui_t *t = NULL; + glui_waterfall_t *w = NULL; + + if ( sdr_init() == -1 ) + { + goto main_exit; + } + + sine_table( FFT_LEVEL ); + + + //printf("%x\n",t); + //open GUI + if ( glui_init( &t ) == -1 ) + { + printf("Cannot set glui\n"); + return 1; + } + + //printf("%x\n",t); + if ( glui_waterfall( &t, &w ) == -1 ) + { + printf("Cannot set waterfall\n"); + return 1; + } + + dev_num = rtlsdr_get_device_count(); + if ( dev_num < 1 ) + { + printf( "Cannot find any device" ); + goto main_exit; + } + + buf_len = sizeof(char)*w->w; + buf = malloc( buf_len ); + + sample_len = BUF_LENGHT; + sample_buf = malloc( sample_len ); + + srand(0); //fake seed + for ( i=0; i<400;i++ ) + { + //for (j=0; j