#include "gnuplot_i.h" #define SAMPLING_RATE 44100.0 #define CHANNELS_NUMBER 1 #define N 1024 char *RAW_FILE = "tmp-in.raw"; FILE * sound_file_open_read (char *sound_file_name) { char cmd[256]; snprintf (cmd, 256, "/* A COMPLETER */", sound_file_name, CHANNELS_NUMBER, (int)SAMPLING_RATE, RAW_FILE); system (cmd); return fopen (RAW_FILE, "rb"); } void sound_file_close_read (FILE *fp) { fclose (fp); } int sound_file_read (FILE *fp, double *s) { /* A COMPLETER */ } int main (int argc, char *argv[]) { FILE *input; double s[N]; gnuplot_ctrl *h = gnuplot_init(); gnuplot_setstyle(h, "lines"); input = sound_file_open_read(argv[1]); while(sound_file_read (input, s)) { // affichage gnuplot_cmd(h, "set yr [-1:1]"); gnuplot_resetplot(h); /* affichage : A COMPLETER */ usleep(N * 1000000.0 / SAMPLING_RATE); } sound_file_close_read (input); exit (EXIT_SUCCESS); }