+ for(ch = 1;ch < nb_display_channels; ch++) {
+ y = s->ytop + ch * h;
+ fill_rectangle(screen,
+ s->xleft, y, s->width, 1,
+ fgcolor);
+ }
+ SDL_UpdateRect(screen, s->xleft, s->ytop, s->width, s->height);
+ }else{
+ nb_display_channels= FFMIN(nb_display_channels, 2);
+ if(rdft_bits != s->rdft_bits){
+ ff_rdft_end(&s->rdft);
+ ff_rdft_init(&s->rdft, rdft_bits, RDFT);
+ s->rdft_bits= rdft_bits;
+ }
+ {
+ FFTSample data[2][2*nb_freq];
+ for(ch = 0;ch < nb_display_channels; ch++) {
+ i = i_start + ch;
+ for(x = 0; x < 2*nb_freq; x++) {
+ double w= (x-nb_freq)*(1.0/nb_freq);
+ data[ch][x]= s->sample_array[i]*(1.0-w*w);
+ i += channels;
+ if (i >= SAMPLE_ARRAY_SIZE)
+ i -= SAMPLE_ARRAY_SIZE;
+ }
+ ff_rdft_calc(&s->rdft, data[ch]);
+ }
+ //least efficient way to do this, we should of course directly access it but its more than fast enough
+ for(y=0; y<s->height; y++){
+ double w= 1/sqrt(nb_freq);
+ int a= sqrt(w*sqrt(data[0][2*y+0]*data[0][2*y+0] + data[0][2*y+1]*data[0][2*y+1]));
+ int b= sqrt(w*sqrt(data[1][2*y+0]*data[1][2*y+0] + data[1][2*y+1]*data[1][2*y+1]));
+ a= FFMIN(a,255);
+ b= FFMIN(b,255);
+ fgcolor = SDL_MapRGB(screen->format, a, b, (a+b)/2);
+
+ fill_rectangle(screen,
+ s->xpos, s->height-y, 1, 1,
+ fgcolor);
+ }
+ }
+ SDL_UpdateRect(screen, s->xpos, s->ytop, 1, s->height);
+ s->xpos++;
+ if(s->xpos >= s->width)
+ s->xpos= s->xleft;