1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2004 VideoLAN
7 * Authors: Cyril Deguet <asmax@videolan.org>
8 * Adapted from projectM (http://xmms-projectm.sourceforge.net/)
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
34 #include "preset_types.h"
36 #include "engine_vars.h"
37 #include "per_pixel_eqn_types.h"
38 #include "per_pixel_eqn.h"
39 #include "interface_types.h"
40 #include "video_init.h" //Video Init Routines, resizing/fullscreen, creating pbuffers
41 #include "PCM.h" //Sound data handler (buffering, FFT, etc.)
42 #include "beat_detect.h" //beat detection routines
43 #include "custom_wave_types.h"
44 #include "custom_wave.h"
45 #include "custom_shape_types.h"
46 #include "custom_shape.h"
47 //#include <dmalloc.h>
49 // Forward declarations
53 void modulate_opacity_by_volume();
54 void maximize_colors();
55 void do_per_pixel_math();
58 void render_interpolation();
59 void render_texture_to_screen();
60 void render_texture_to_studio();
61 void draw_motion_vectors();
65 void draw_custom_waves();
67 void reset_per_pixel_matrices();
68 void init_per_pixel_matrices();
69 void free_per_pixel_matrices();
78 extern preset_t * active_preset;
80 GLuint RenderTargetTextureID;
84 //double gx=32; //size of interpolation
87 int texsize=512; //size of texture to do actual graphics
88 int vw=512; //runtime dimensions
92 int maxsamples=2048; //size of PCM buffer
93 int numsamples; //size of new PCM info
94 double *pcmdataL; //holder for most recent pcm data
95 double *pcmdataR; //holder for most recent pcm data
97 int avgtime=500; //# frames per preset
108 //per pixel equation variables
111 double **gridx; //grid containing interpolated mesh
113 double **origtheta; //grid containing interpolated mesh reference values
115 double **origx; //original mesh
120 int galaktos_init( galaktos_thread_t *p_thread )
122 init_per_pixel_matrices();
123 pcmdataL=(double *)malloc(maxsamples*sizeof(double));
124 pcmdataR=(double *)malloc(maxsamples*sizeof(double));
126 /* Preset loading function */
129 /* Load default preset directory */
130 loadPresetDir("/home/cyril/.vlc/galaktos");
131 // loadPresetDir("/etc/projectM/presets");
136 // mutex = SDL_CreateMutex();
141 void galaktos_done( galaktos_thread_t *p_thread )
148 free_per_pixel_matrices();
150 // destroyPresetLoader(); XXX segfaults :(
154 int galaktos_update( galaktos_thread_t *p_thread )
157 double vdataL[512]; //holders for FFT data (spectrum)
161 totalframes++; //total amount of frames since startup
163 Time=(double)(mdate()/1000000);
165 frame++; //number of frames for current preset
166 progress= frame/(double)avgtime;
167 if (progress>1.0) progress=1.0;
168 // printf("start:%d at:%d min:%d stop:%d on:%d %d\n",startframe, frame frame-startframe,avgtime, noSwitch,progress);
172 if (noSwitch==0) switchPreset(RANDOM_NEXT,0);
175 evalInitConditions();
176 evalPerFrameEquations();
178 evalCustomWaveInitConditions();
179 evalCustomShapeInitConditions();
181 // printf("%f %d\n",Time,frame);
183 reset_per_pixel_matrices();
186 numsamples = getPCMnew(pcmdataR,1,0,fWaveSmoothing,0,0);
187 getPCMnew(pcmdataL,0,0,fWaveSmoothing,0,1);
188 getPCM(vdataL,512,0,1,0,0);
189 getPCM(vdataR,512,1,1,0,0);
193 getBeatVals(vdataL,vdataR,&vol);
196 if(vol>8.0 && nohard<0 && noSwitch==0)
199 switchPreset(RANDOM_NEXT, HARD_CUT);
205 //This pass is used to render our texture
206 //the texture is drawn to a subsection of the framebuffer
207 //and then we perform our manipulations on it
208 //in pass 2 we will copy the texture into texture memory
210 // galaktos_glx_activate_pbuffer( p_thread );
212 glPushAttrib( GL_ALL_ATTRIB_BITS ); /* Overkill, but safe */
214 // if (RenderTarget) glViewport( 0, 0, RenderTarget->w, RenderTarget->h );
216 else glViewport( 0, 0, texsize, texsize );
219 glMatrixMode( GL_MODELVIEW );
223 glMatrixMode( GL_PROJECTION );
227 glOrtho(0.0, texsize, 0.0,texsize,10,40);
231 do_per_frame(); //apply per-frame effects
232 render_interpolation(); //apply per-pixel effects
233 draw_motion_vectors(); //draw motion vectors
234 draw_borders(); //draw borders
240 glMatrixMode( GL_MODELVIEW );
243 glMatrixMode( GL_PROJECTION );
248 //if ( RenderTarget ) SDL_GL_UnlockRenderTarget(RenderTarget);
249 /* Copy our rendering to the fake render target texture */
250 glBindTexture( GL_TEXTURE_2D, RenderTargetTextureID );
251 glCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, texsize, texsize);
252 // galaktos_glx_activate_window( p_thread );
256 //end of texture rendering
257 //now we copy the texture from the framebuffer to
258 //video texture memory and render fullscreen on a quad surface.
259 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
260 glMatrixMode(GL_PROJECTION);
263 glFrustum(-vw*.5, vw*.5, -vh*.5,vh*.5,10,40);
265 glLineWidth(texsize/512.0);
266 if(studio%2)render_texture_to_studio();
267 else render_texture_to_screen();
271 // printf("Flush %d\n",(SDL_GetTicks()-timestart));
272 galaktos_glx_swap( p_thread );
274 /* Process X11 events */
275 if( galaktos_glx_handle_events( p_thread ) == 1 )
284 void free_per_pixel_matrices()
288 for(x = 0; x < gx; x++)
313 void init_per_pixel_matrices()
317 gridx=(double **)malloc(gx * sizeof(double *));
318 gridy=(double **)malloc(gx * sizeof(double *));
320 origx=(double **)malloc(gx * sizeof(double *));
321 origy=(double **)malloc(gx * sizeof(double *));
322 origrad=(double **)malloc(gx * sizeof(double *));
323 origtheta=(double **)malloc(gx * sizeof(double *));
325 x_mesh=(double **)malloc(gx * sizeof(double *));
326 y_mesh=(double **)malloc(gx * sizeof(double *));
327 rad_mesh=(double **)malloc(gx * sizeof(double *));
328 theta_mesh=(double **)malloc(gx * sizeof(double *));
330 sx_mesh=(double **)malloc(gx * sizeof(double *));
331 sy_mesh=(double **)malloc(gx * sizeof(double *));
332 dx_mesh=(double **)malloc(gx * sizeof(double *));
333 dy_mesh=(double **)malloc(gx * sizeof(double *));
334 cx_mesh=(double **)malloc(gx * sizeof(double *));
335 cy_mesh=(double **)malloc(gx * sizeof(double *));
336 zoom_mesh=(double **)malloc(gx * sizeof(double *));
337 zoomexp_mesh=(double **)malloc(gx * sizeof(double *));
338 rot_mesh=(double **)malloc(gx * sizeof(double *));
340 for(x = 0; x < gx; x++)
342 gridx[x] = (double *)malloc(gy * sizeof(double));
343 gridy[x] = (double *)malloc(gy * sizeof(double));
345 origtheta[x] = (double *)malloc(gy * sizeof(double));
346 origrad[x] = (double *)malloc(gy * sizeof(double));
347 origx[x] = (double *)malloc(gy * sizeof(double));
348 origy[x] = (double *)malloc(gy * sizeof(double));
350 x_mesh[x] = (double *)malloc(gy * sizeof(double));
351 y_mesh[x] = (double *)malloc(gy * sizeof(double));
353 rad_mesh[x] = (double *)malloc(gy * sizeof(double));
354 theta_mesh[x] = (double *)malloc(gy * sizeof(double));
356 sx_mesh[x] = (double *)malloc(gy * sizeof(double));
357 sy_mesh[x] = (double *)malloc(gy * sizeof(double));
358 dx_mesh[x] = (double *)malloc(gy * sizeof(double));
359 dy_mesh[x] = (double *)malloc(gy * sizeof(double));
360 cx_mesh[x] = (double *)malloc(gy * sizeof(double));
361 cy_mesh[x] = (double *)malloc(gy * sizeof(double));
363 zoom_mesh[x] = (double *)malloc(gy * sizeof(double));
364 zoomexp_mesh[x] = (double *)malloc(gy * sizeof(double));
366 rot_mesh[x] = (double *)malloc(gy * sizeof(double));
369 //initialize reference grid values
374 origx[x][y]=x/(double)(gx-1);
375 origy[x][y]=-((y/(double)(gy-1))-1);
376 origrad[x][y]=hypot((origx[x][y]-.5)*2,(origy[x][y]-.5)*2) * .7071067;
377 origtheta[x][y]=atan2(((origy[x][y]-.5)*2),((origx[x][y]-.5)*2));
378 gridx[x][y]=origx[x][y]*texsize;
379 gridy[x][y]=origy[x][y]*texsize;
386 //calculate matrices for per_pixel
387 void do_per_pixel_math()
391 double rotx=0,roty=0;
394 if(!isPerPixelEqn(CX_OP))
404 if(!isPerPixelEqn(CY_OP))
415 if(isPerPixelEqn(ROT_OP))
421 x_mesh[x][y]=x_mesh[x][y]-cx_mesh[x][y];
422 y_mesh[x][y]=y_mesh[x][y]-cy_mesh[x][y];
423 rotx=(x_mesh[x][y])*cos(rot_mesh[x][y])-(y_mesh[x][y])*sin(rot_mesh[x][y]);
424 roty=(x_mesh[x][y])*sin(rot_mesh[x][y])+(y_mesh[x][y])*cos(rot_mesh[x][y]);
425 x_mesh[x][y]=rotx+cx_mesh[x][y];
426 y_mesh[x][y]=roty+cy_mesh[x][y];
433 if(!isPerPixelEqn(ZOOM_OP))
439 zoom_mesh[x][y]=zoom;
444 if(!isPerPixelEqn(ZOOMEXP_OP))
450 zoomexp_mesh[x][y]=zoomexp;
461 x_mesh[x][y]=(x_mesh[x][y]-.5)*2;
462 y_mesh[x][y]=(y_mesh[x][y]-.5)*2;
463 x_mesh[x][y]=x_mesh[x][y]/(((zoom_mesh[x][y]-1)*(pow(rad_mesh[x][y],zoomexp_mesh[x][y])/rad_mesh[x][y]))+1);
464 y_mesh[x][y]=y_mesh[x][y]/(((zoom_mesh[x][y]-1)*(pow(rad_mesh[x][y],zoomexp_mesh[x][y])/rad_mesh[x][y]))+1);
465 x_mesh[x][y]=(x_mesh[x][y]*.5)+.5;
466 y_mesh[x][y]=(y_mesh[x][y]*.5)+.5;
470 if(isPerPixelEqn(SX_OP))
476 x_mesh[x][y]=((x_mesh[x][y]-cx_mesh[x][y])/sx_mesh[x][y])+cx_mesh[x][y];
481 if(isPerPixelEqn(SY_OP))
487 y_mesh[x][y]=((y_mesh[x][y]-cy_mesh[x][y])/sy_mesh[x][y])+cy_mesh[x][y];
492 if(isPerPixelEqn(DX_OP))
499 x_mesh[x][y]=x_mesh[x][y]-dx_mesh[x][y];
505 if(isPerPixelEqn(DY_OP))
511 y_mesh[x][y]=y_mesh[x][y]-dy_mesh[x][y];
520 void reset_per_pixel_matrices()
528 x_mesh[x][y]=origx[x][y];
529 y_mesh[x][y]=origy[x][y];
530 rad_mesh[x][y]=origrad[x][y];
531 theta_mesh[x][y]=origtheta[x][y];
538 void draw_custom_waves()
542 custom_wave_t *wavecode;
543 glPointSize(texsize/512);
544 //printf("%d\n",wavecode);
545 // more=isMoreCustomWave();
546 // printf("not inner loop\n");
547 while ((wavecode = nextCustomWave()) != NULL)
549 //printf("begin inner loop\n");
550 if(wavecode->enabled==1)
556 //if(wavecode->bUseDots==1) glEnable(GL_LINE_STIPPLE);
557 if (wavecode->bAdditive==0) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
558 else glBlendFunc(GL_SRC_ALPHA, GL_ONE);
559 if (wavecode->bDrawThick==1) glLineWidth(2*texsize/512);
561 // xx= ((pcmdataL[x]-pcmdataL[x-1])*80*fWaveScale)*2;
562 //yy=pcmdataL[x]*80*fWaveScale,-1;
563 //glVertex3f( (wave_x*texsize)+(xx+yy)*cos(45), (wave_y*texsize)+(-yy+xx)*cos(45),-1);
564 // printf("samples: %d\n", wavecode->samples);
566 getPCM(wavecode->value1,wavecode->samples,0,wavecode->bSpectrum,wavecode->smoothing,0);
567 getPCM(wavecode->value2,wavecode->samples,1,wavecode->bSpectrum,wavecode->smoothing,0);
568 // printf("%f\n",pcmL[0]);
569 for(x=0;x<wavecode->samples;x++)
570 {wavecode->value1[x]=wavecode->value1[x]*wavecode->scaling;}
572 for(x=0;x<wavecode->samples;x++)
573 {wavecode->value2[x]=wavecode->value2[x]*wavecode->scaling;}
575 for(x=0;x<wavecode->samples;x++)
576 {wavecode->sample_mesh[x]=((double)x)/((double)(wavecode->samples-1));}
578 // printf("mid inner loop\n");
581 if(!isPerPointEquation("x"))
582 {for(x=0;x<wavecode->samples;x++)
585 if(!isPerPointEquation(Y_POINT_OP))
586 {for(x=0;x<wavecode->samples;x++)
589 if(!isPerPointEquation(R_POINT_OP))
590 {for(x=0;x<wavecode->samples;x++)
591 {cw_r[x]=wavecode->r;}}
592 if(!isPerPointEquation(G_POINT_OP))
593 {for(x=0;x<wavecode->samples;x++)
594 {cw_g[x]=wavecode->g;}}
595 if(!isPerPointEquation(B_POINT_OP))
596 {for(x=0;x<wavecode->samples;x++)
597 {cw_b[x]=wavecode->b;}}
598 if(!isPerPointEquation(A_POINT_OP))
599 {for(x=0;x<wavecode->samples;x++)
600 {cw_a[x]=wavecode->a;}}
602 //put drawing code here
603 if (wavecode->bUseDots==1) glBegin(GL_POINTS);
604 else glBegin(GL_LINE_STRIP);
606 for(x=0;x<wavecode->samples;x++)
608 // printf("x:%f y:%f a:%f g:%f %f\n", wavecode->x_mesh[x], wavecode->y_mesh[x], wavecode->a_mesh[x], wavecode->g_mesh[x], wavecode->sample_mesh[x]);
609 glColor4f(wavecode->r_mesh[x],wavecode->g_mesh[x],wavecode->b_mesh[x],wavecode->a_mesh[x]);
610 glVertex3f(wavecode->x_mesh[x]*texsize,-(wavecode->y_mesh[x]-1)*texsize,-1);
613 glPointSize(texsize/512);
614 glLineWidth(texsize/512);
615 glDisable(GL_LINE_STIPPLE);
616 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
633 double pi = 3.14159265;
634 double start,inc,xval,yval;
635 custom_shape_t *shapecode;
637 while ((shapecode = nextCustomShape()) != NULL)
639 if(shapecode->enabled==1)
641 // printf("drawing shape %f\n",shapecode->ang);
642 shapecode->y=-((shapecode->y)-1);
644 shapecode->rad=shapecode->rad*(texsize*.707*.707*.707*1.04);
645 //Additive Drawing or Overwrite
646 if (shapecode->additive==0) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
647 else glBlendFunc(GL_SRC_ALPHA, GL_ONE);
649 glMatrixMode(GL_MODELVIEW);
653 glTranslatef(texsize*.5,texsize*.5, 0);
654 glScalef(1.0,vw/(double)vh,1.0);
655 glTranslatef((-texsize*.5) ,(-texsize*.5),0);
658 start=.78539+shapecode->ang;
659 inc=(pi*2)/(double)shapecode->sides;
660 xval=shapecode->x*texsize;
661 yval=shapecode->y*texsize;
663 if (shapecode->textured)
665 glMatrixMode(GL_TEXTURE);
669 glTranslatef(.5,.5, 0);
670 if (correction) glScalef(1,vw/(double)vh,1);
672 glRotatef((shapecode->tex_ang*360/6.280), 0, 0, 1);
674 glScalef(1/(shapecode->tex_zoom),1/(shapecode->tex_zoom),1);
676 // glScalef(1,vh/(double)vw,1);
677 glTranslatef((-.5) ,(-.5),0);
678 // glScalef(1,vw/(double)vh,1);
679 glEnable(GL_TEXTURE_2D);
682 glBegin(GL_TRIANGLE_FAN);
684 glColor4f(shapecode->r,shapecode->g,shapecode->b,shapecode->a);
687 glVertex3f(xval,yval,-1);
688 glColor4f(shapecode->r2,shapecode->g2,shapecode->b2,shapecode->a2);
690 for ( i=0;i<shapecode->sides+1;i++)
694 // glColor4f(shapecode->r2,shapecode->g2,shapecode->b2,shapecode->a2);
695 glTexCoord2f(rad2*cos(theta)+.5 ,rad2*sin(theta)+.5 );
696 glVertex3f(shapecode->rad*cos(theta)+xval,shapecode->rad*sin(theta)+yval,-1);
703 glDisable(GL_TEXTURE_2D);
705 glMatrixMode(GL_MODELVIEW);
708 {//Untextured (use color values)
709 //printf("untextured %f %f %f @:%f,%f %f %f\n",shapecode->a2,shapecode->a,shapecode->border_a, shapecode->x,shapecode->y,shapecode->rad,shapecode->ang);
710 //draw first n-1 triangular pieces
711 glBegin(GL_TRIANGLE_FAN);
713 glColor4f(shapecode->r,shapecode->g,shapecode->b,shapecode->a);
715 // glTexCoord2f(.5,.5);
716 glVertex3f(xval,yval,-1);
717 glColor4f(shapecode->r2,shapecode->g2,shapecode->b2,shapecode->a2);
719 for ( i=0;i<shapecode->sides+1;i++)
723 // glColor4f(shapecode->r2,shapecode->g2,shapecode->b2,shapecode->a2);
724 // glTexCoord2f(rad2*cos(theta)+.5 ,rad2*sin(theta)+.5 );
725 glVertex3f(shapecode->rad*cos(theta)+xval,shapecode->rad*sin(theta)+yval,-1);
731 if (bWaveThick==1) glLineWidth(2*texsize/512);
732 glBegin(GL_LINE_LOOP);
733 glColor4f(shapecode->border_r,shapecode->border_g,shapecode->border_b,shapecode->border_a);
734 for ( i=0;i<shapecode->sides;i++)
737 glVertex3f(shapecode->rad*cos(theta)+xval,shapecode->rad*sin(theta)+yval,-1);
740 if (bWaveThick==1) glLineWidth(texsize/512);
756 double offset,scale,dy2_adj;
760 double wave_x_temp=0;
761 double wave_y_temp=0;
763 modulate_opacity_by_volume();
766 if(bWaveDots==1) glEnable(GL_LINE_STIPPLE);
768 offset=(wave_x-.5)*texsize;
772 if (bWaveThick==1) glLineWidth(2*texsize/512);
774 //Additive wave drawing (vice overwrite)
775 if (bAdditiveWaves==0) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
776 else glBlendFunc(GL_SRC_ALPHA, GL_ONE);
784 glTranslatef(texsize*.5,texsize*.5, 0);
785 glRotated(-wave_mystery*90,0,0,1);
787 glTranslatef(-texsize*.5,-texsize*.825, 0);
792 glBegin(GL_LINE_STRIP);
793 glColor4f(1.0-(x/15.0),.5,x/15.0,1.0);
794 glVertex3f((totalframes%256)*2*scale, -beat_val[x]*fWaveScale+texsize*wave_y,-1);
795 glColor4f(.5,.5,.5,1.0);
796 glVertex3f((totalframes%256)*2*scale, texsize*wave_y,-1);
797 glColor4f(1.0,1.0,0,1.0);
798 //glVertex3f((totalframes%256)*scale*2, beat_val_att[x]*fWaveScale+texsize*wave_y,-1);
801 glTranslatef(0,texsize*(1/36.0), 0);
805 glTranslatef(0,texsize*(1/18.0), 0);
808 glBegin(GL_LINE_STRIP);
809 glColor4f(1.0,1.0,0.5,1.0);
810 glVertex3f((totalframes%256)*2*scale, treb_att*5*fWaveScale+texsize*wave_y,-1);
811 glColor4f(.2,.2,.2,1.0);
812 glVertex3f((totalframes%256)*2*scale, texsize*wave_y,-1);
813 glColor4f(1.0,1.0,0,1.0);
814 glVertex3f((totalframes%256)*scale*2, treb*-5*fWaveScale+texsize*wave_y,-1);
817 glTranslatef(0,texsize*.075, 0);
818 glBegin(GL_LINE_STRIP);
819 glColor4f(0,1.0,0.0,1.0);
820 glVertex3f((totalframes%256)*2*scale, mid_att*5*fWaveScale+texsize*wave_y,-1);
821 glColor4f(.2,.2,.2,1.0);
822 glVertex3f((totalframes%256)*2*scale, texsize*wave_y,-1);
823 glColor4f(.5,1.0,.5,1.0);
824 glVertex3f((totalframes%256)*scale*2, mid*-5*fWaveScale+texsize*wave_y,-1);
828 glTranslatef(0,texsize*.075, 0);
829 glBegin(GL_LINE_STRIP);
830 glColor4f(1.0,0,0,1.0);
831 glVertex3f((totalframes%256)*2*scale, bass_att*5*fWaveScale+texsize*wave_y,-1);
832 glColor4f(.2,.2,.2,1.0);
833 glVertex3f((totalframes%256)*2*scale, texsize*wave_y,-1);
834 glColor4f(1.0,.5,.5,1.0);
835 glVertex3f((totalframes%256)*scale*2, bass*-5*fWaveScale+texsize*wave_y,-1);
842 case 0://circular waveforms
846 glTranslatef(texsize*.5,texsize*.5, 0);
847 glScalef(1.0,vw/(double)vh,1.0);
848 glTranslatef((-texsize*.5) ,(-texsize*.5),0);
850 wave_y=-1*(wave_y-1.0);
852 glBegin(GL_LINE_STRIP);
854 for ( x=0;x<numsamples;x++)
856 co= -(abs(x-((numsamples*.5)-1))/numsamples)+1;
857 // printf("%d %f\n",x,co);
858 theta=x*(6.28/numsamples);
859 r= ((1+2*wave_mystery)*(texsize/5.0)+
860 ( co*pcmdataL[x]+ (1-co)*pcmdataL[-(x-(numsamples-1))])
863 glVertex3f(r*cos(theta)+(wave_x*texsize),r*sin(theta)+(wave_y*texsize),-1);
866 r= ( (1+2*wave_mystery)*(texsize/5.0)+
867 (0.5*pcmdataL[0]+ 0.5*pcmdataL[numsamples-1])
870 glVertex3f(r*cos(0)+(wave_x*texsize),r*sin(0)+(wave_y*texsize),-1);
874 glBegin(GL_LINE_LOOP);
876 for ( x=0;x<(512/pcmbreak);x++)
878 theta=(blockstart+x)*((6.28*pcmbreak)/512.0);
879 r= ((1+2*wave_mystery)*(texsize/5.0)+fdata_buffer[fbuffer][0][blockstart+x]*.0025*fWaveScale);
881 glVertex3f(r*cos(theta)+(wave_x*texsize),r*sin(theta)+(wave_y*texsize),-1);
889 case 1://circularly moving waveform
893 glTranslatef(texsize*.5,texsize*.5, 0);
894 glScalef(1.0,vw/(double)vh,1.0);
895 glTranslatef((-texsize*.5) ,(-texsize*.5),0);
897 wave_y=-1*(wave_y-1.0);
899 glBegin(GL_LINE_STRIP);
900 //theta=(frame%512)*(6.28/512.0);
904 co= -(abs(x-255)/512.0)+1;
905 // printf("%d %f\n",x,co);
906 theta=((frame%256)*(2*6.28/512.0))+pcmdataL[x]*.2*fWaveScale;
907 r= ((1+2*wave_mystery)*(texsize/5.0)+
908 (pcmdataL[x]-pcmdataL[x-1])*80*fWaveScale);
910 glVertex3f(r*cos(theta)+(wave_x*texsize),r*sin(theta)+(wave_y*texsize),-1);
919 case 2://EXPERIMENTAL
920 wave_y=-1*(wave_y-1.0);
922 glBegin(GL_LINE_STRIP);
924 // double xr= (wave_x*texsize), yr=(wave_y*texsize);
928 //xx = ((pcmdataL[x]-pcmdataL[x-1])*80*fWaveScale)*2;
929 xx += (pcmdataL[x]*fWaveScale);
930 yy= pcmdataL[x]*80*fWaveScale;
931 // glVertex3f( (wave_x*texsize)+(xx+yy)*2, (wave_y*texsize)+(xx-yy)*2,-1);
932 glVertex3f( (wave_x*texsize)+(xx)*2, (wave_y*texsize)+(yy)*2,-1);
935 // xr+=fdata_buffer[fbuffer][0][x] *.0005* fWaveScale;
936 //yr=(fdata_buffer[fbuffer][0][x]-fdata_buffer[fbuffer][0][x-1])*.05*fWaveScale+(wave_y*texsize);
937 //glVertex3f(xr,yr,-1);
944 case 3://EXPERIMENTAL
946 wave_y=-1*(wave_y-1.0);
947 glBegin(GL_LINE_STRIP);
952 xx= ((pcmdataL[x]-pcmdataL[x-1])*80*fWaveScale)*2;
953 yy=pcmdataL[x]*80*fWaveScale,-1;
954 glVertex3f( (wave_x*texsize)+(xx+yy)*cos(45), (wave_y*texsize)+(-yy+xx)*cos(45),-1);
960 case 4://single x-axis derivative waveform
962 wave_y=-1*(wave_y-1.0);
963 glTranslatef(texsize*.5,texsize*.5, 0);
964 glRotated(-wave_mystery*90,0,0,1);
965 glTranslatef(-texsize*.5,-texsize*.5, 0);
966 wave_x=(wave_x*.75)+.125; wave_x=-(wave_x-1);
967 glBegin(GL_LINE_STRIP);
972 dy_adj= pcmdataL[x]*20*fWaveScale-pcmdataL[x-1]*20*fWaveScale;
973 glVertex3f((x*scale)+dy_adj, pcmdataL[x]*20*fWaveScale+texsize*wave_x,-1);
979 case 5://EXPERIMENTAL
983 wave_y=-1*(wave_y-1.0);
984 wave_x_temp=(wave_x*.75)+.125;
985 wave_x_temp=-(wave_x_temp-1);
986 glBegin(GL_LINE_STRIP);
988 for ( x=1;x<(512);x++)
990 dy2_adj= (pcmdataL[x]-pcmdataL[x-1])*20*fWaveScale;
991 glVertex3f((wave_x_temp*texsize)+dy2_adj*2, pcmdataL[x]*20*fWaveScale+texsize*wave_y,-1);
997 case 6://single waveform
1002 glTranslatef(0,0, -1);
1004 //glMatrixMode(GL_MODELVIEW);
1006 // glLoadIdentity();
1008 glTranslatef(texsize*.5,texsize*.5, 0);
1009 glRotated(-wave_mystery*90,0,0,1);
1011 wave_x_temp=-2*0.4142*(abs(abs(wave_mystery)-.5)-.5);
1012 glScalef(1.0+wave_x_temp,1.0,1.0);
1013 glTranslatef(-texsize*.5,-texsize*.5, 0);
1014 wave_x_temp=-1*(wave_x-1.0);
1016 glBegin(GL_LINE_STRIP);
1017 // wave_x_temp=(wave_x*.75)+.125;
1018 // wave_x_temp=-(wave_x_temp-1);
1019 for ( x=0;x<numsamples;x++)
1022 //glVertex3f(x*scale, fdata_buffer[fbuffer][0][blockstart+x]*.0012*fWaveScale+texsize*wave_x_temp,-1);
1023 glVertex3f(x*texsize/(double)numsamples, pcmdataR[x]*20*fWaveScale+texsize*wave_x_temp,-1);
1025 //glVertex3f(x*scale, texsize*wave_y_temp,-1);
1027 // printf("%f %f\n",texsize*wave_y_temp,wave_y_temp);
1032 case 7://dual waveforms
1036 glTranslatef(texsize*.5,texsize*.5, 0);
1037 glRotated(-wave_mystery*90,0,0,1);
1039 wave_x_temp=-2*0.4142*(abs(abs(wave_mystery)-.5)-.5);
1040 glScalef(1.0+wave_x_temp,1.0,1.0);
1041 glTranslatef(-texsize*.5,-texsize*.5, 0);
1043 wave_y_temp=-1*(wave_x-1);
1045 glBegin(GL_LINE_STRIP);
1047 for ( x=0;x<numsamples;x++)
1050 glVertex3f((x*texsize)/(double)numsamples, pcmdataL[x]*20*fWaveScale+texsize*(wave_y_temp+(wave_y*wave_y*.5)),-1);
1054 glBegin(GL_LINE_STRIP);
1057 for ( x=0;x<numsamples;x++)
1060 glVertex3f((x*texsize)/(double)numsamples, pcmdataR[x]*20*fWaveScale+texsize*(wave_y_temp-(wave_y*wave_y*.5)),-1);
1067 glBegin(GL_LINE_LOOP);
1069 for ( x=0;x<512;x++)
1071 theta=(x)*(6.28/512.0);
1072 r= (texsize/5.0+pcmdataL[x]*.002);
1074 glVertex3f(r*cos(theta)+(wave_x*texsize),r*sin(theta)+(wave_y*texsize),-1);
1078 glBegin(GL_LINE_STRIP);
1080 for ( x=0;x<512;x++)
1082 glVertex3f(x*scale, pcmdataL[x]*20*fWaveScale+(texsize*(wave_x+.1)),-1);
1086 glBegin(GL_LINE_STRIP);
1088 for ( x=0;x<512;x++)
1090 glVertex3f(x*scale, pcmdataR[x]*20*fWaveScale+(texsize*(wave_x-.1)),-1);
1095 if (bWaveThick==1) glLineWidth(2*texsize/512);
1097 glLineWidth(texsize/512);
1098 glDisable(GL_LINE_STIPPLE);
1102 void maximize_colors()
1104 float wave_r_switch=0,wave_g_switch=0,wave_b_switch=0;
1105 //wave color brightening
1107 //forces max color value to 1.0 and scales
1108 // the rest accordingly
1110 if (bMaximizeWaveColor==1)
1112 if(wave_r>=wave_g && wave_r>=wave_b) //red brightest
1114 wave_b_switch=wave_b*(1/wave_r);
1115 wave_g_switch=wave_g*(1/wave_r);
1118 else if (wave_b>=wave_g && wave_b>=wave_r) //blue brightest
1120 wave_r_switch=wave_r*(1/wave_b);
1121 wave_g_switch=wave_g*(1/wave_b);
1126 else if (wave_g>=wave_b && wave_g>=wave_r) //green brightest
1128 wave_b_switch=wave_b*(1/wave_g);
1129 wave_r_switch=wave_r*(1/wave_g);
1132 glColor4f(wave_r_switch, wave_g_switch, wave_b_switch, wave_o);
1136 glColor4f(wave_r, wave_g, wave_b, wave_o);
1142 void modulate_opacity_by_volume()
1145 //modulate volume by opacity
1147 //set an upper and lower bound and linearly
1148 //calculate the opacity from 0=lower to 1=upper
1149 //based on current volume
1151 if (bModWaveAlphaByVolume==1)
1152 {if (vol<=fModWaveAlphaStart) wave_o=0.0;
1153 else if (vol>=fModWaveAlphaEnd) wave_o=fWaveAlpha;
1154 else wave_o=fWaveAlpha*((vol-fModWaveAlphaStart)/(fModWaveAlphaEnd-fModWaveAlphaStart));}
1155 else wave_o=fWaveAlpha;
1159 void draw_motion_vectors()
1163 double offsetx=mv_dx*texsize, intervalx=texsize/(double)mv_x;
1164 double offsety=mv_dy*texsize, intervaly=texsize/(double)mv_y;
1167 glColor4f(mv_r, mv_g, mv_b, mv_a);
1169 for (x=0;x<mv_x;x++){
1170 for(y=0;y<mv_y;y++){
1171 glVertex3f(offsetx+x*intervalx,offsety+y*intervaly,-1);
1180 //no additive drawing for borders
1181 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1183 glTranslatef(0,0,-1);
1185 double of=texsize*ob_size*.5;
1186 double iff=(texsize*ib_size*.5);
1187 double texof=texsize-of;
1189 glColor4d(ob_r,ob_g,ob_b,ob_a);
1191 glRectd(0,0,of,texsize);
1192 glRectd(of,0,texof,of);
1193 glRectd(texof,0,texsize,texsize);
1194 glRectd(of,texsize,texof,texof);
1195 glColor4d(ib_r,ib_g,ib_b,ib_a);
1196 glRectd(of,of,of+iff,texof);
1197 glRectd(of+iff,of,texof-iff,of+iff);
1198 glRectd(texof-iff,of,texof,texof);
1199 glRectd(of+iff,texof,texof-iff,texof-iff);
1203 //Here we render the interpolated mesh, and then apply the texture to it.
1204 //Well, we actually do the inverse, but its all the same.
1205 void render_interpolation()
1210 glMatrixMode(GL_MODELVIEW);
1212 glTranslated(0, 0, -9);
1214 glColor4f(0.0, 0.0, 0.0,decay);
1216 glEnable(GL_TEXTURE_2D);
1218 for (x=0;x<gx-1;x++)
1220 glBegin(GL_TRIANGLE_STRIP);
1223 glTexCoord4f(x_mesh[x][y], y_mesh[x][y],-1,1); glVertex4f(gridx[x][y], gridy[x][y],-1,1);
1224 glTexCoord4f(x_mesh[x+1][y], y_mesh[x+1][y],-1,1); glVertex4f(gridx[x+1][y], gridy[x+1][y],-1,1);
1228 glDisable(GL_TEXTURE_2D);
1234 //Texture wrapping( clamp vs. wrap)
1237 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
1238 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
1242 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
1243 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
1247 // glRasterPos2i(0,0);
1248 // glClear(GL_COLOR_BUFFER_BIT);
1249 // glColor4d(0.0, 0.0, 0.0,1.0);
1251 // glMatrixMode(GL_TEXTURE);
1252 // glLoadIdentity();
1255 glClear(GL_COLOR_BUFFER_BIT);
1256 glColor4d(0.0, 0.0, 0.0,1.0);
1258 glMatrixMode(GL_TEXTURE);
1261 glTranslatef(cx,cy, 0);
1262 if(correction) glScalef(1,vw/(double)vh,1);
1264 if(!isPerPixelEqn(ROT_OP))
1266 // printf("ROTATING: rot = %f\n", rot);
1267 glRotatef(rot*90, 0, 0, 1);
1269 if(!isPerPixelEqn(SX_OP)) glScalef(1/sx,1,1);
1270 if(!isPerPixelEqn(SY_OP)) glScalef(1,1/sy,1);
1272 if(correction) glScalef(1,vh/(double)vw,1);
1273 glTranslatef((-cx) ,(-cy),0);
1275 if(!isPerPixelEqn(DX_OP)) glTranslatef(-dx,0,0);
1276 if(!isPerPixelEqn(DY_OP)) glTranslatef(0 ,-dy,0);
1281 //Actually draws the texture to the screen
1283 //The Video Echo effect is also applied here
1284 void render_texture_to_screen()
1286 glMatrixMode(GL_TEXTURE);
1289 glMatrixMode(GL_MODELVIEW);
1291 glTranslatef(0, 0, -9);
1293 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1294 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1296 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
1297 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
1299 // glClear(GL_ACCUM_BUFFER_BIT);
1300 glColor4d(0.0, 0.0, 0.0,1.0f);
1303 glVertex4d(-vw*.5,-vh*.5,-1,1);
1304 glVertex4d(-vw*.5, vh*.5,-1,1);
1305 glVertex4d(vw*.5, vh*.5,-1,1);
1306 glVertex4d(vw*.5, -vh*.5,-1,1);
1309 // glBindTexture( GL_TEXTURE_2D, tex2 );
1310 glEnable(GL_TEXTURE_2D);
1312 // glAccum(GL_LOAD,0);
1313 // if (bDarken==1) glBlendFunc(GL_SRC_COLOR,GL_ZERO);
1315 //Draw giant rectangle and texture it with our texture!
1317 glTexCoord4d(0, 1,0,1); glVertex4d(-vw*.5,-vh*.5,-1,1);
1318 glTexCoord4d(0, 0,0,1); glVertex4d(-vw*.5, vh*.5,-1,1);
1319 glTexCoord4d(1, 0,0,1); glVertex4d(vw*.5, vh*.5,-1,1);
1320 glTexCoord4d(1, 1,0,1); glVertex4d(vw*.5, -vh*.5,-1,1);
1323 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1325 // if (bDarken==1) glBlendFunc(GL_SRC_COLOR,GL_ONE_MINUS_SRC_ALPHA);
1327 // if (bDarken==1) { glAccum(GL_ACCUM,1-fVideoEchoAlpha); glBlendFunc(GL_SRC_COLOR,GL_ZERO); }
1329 glMatrixMode(GL_TEXTURE);
1332 glColor4f(0.0, 0.0, 0.0,fVideoEchoAlpha);
1333 glTranslated(.5,.5,0);
1334 glScaled(1/fVideoEchoZoom,1/fVideoEchoZoom,1);
1335 glTranslated(-.5,-.5,0);
1337 int flipx=1,flipy=1;
1338 switch (((int)nVideoEchoOrientation))
1340 case 0: flipx=1;flipy=1;break;
1341 case 1: flipx=-1;flipy=1;break;
1342 case 2: flipx=1;flipy=-1;break;
1343 case 3: flipx=-1;flipy=-1;break;
1344 default: flipx=1;flipy=1; break;
1347 glTexCoord4d(0, 1,0,1); glVertex4f(-vw*.5*flipx,-vh*.5*flipy,-1,1);
1348 glTexCoord4d(0, 0,0,1); glVertex4f(-vw*.5*flipx, vh*.5*flipy,-1,1);
1349 glTexCoord4d(1, 0,0,1); glVertex4f(vw*.5*flipx, vh*.5*flipy,-1,1);
1350 glTexCoord4d(1, 1,0,1); glVertex4f(vw*.5*flipx, -vh*.5*flipy,-1,1);
1354 glDisable(GL_TEXTURE_2D);
1355 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1357 // if (bDarken==1) { glAccum(GL_ACCUM,fVideoEchoAlpha); glAccum(GL_RETURN,1);}
1361 glColor4f(1.0, 1.0, 1.0,1.0);
1362 glBlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ZERO);
1364 glVertex4f(-vw*.5*flipx,-vh*.5*flipy,-1,1);
1365 glVertex4f(-vw*.5*flipx, vh*.5*flipy,-1,1);
1366 glVertex4f(vw*.5*flipx, vh*.5*flipy,-1,1);
1367 glVertex4f(vw*.5*flipx, -vh*.5*flipy,-1,1);
1369 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1374 void render_texture_to_studio()
1376 glMatrixMode(GL_TEXTURE);
1379 glMatrixMode(GL_MODELVIEW);
1381 glTranslatef(0, 0, -9);
1383 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1384 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1386 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
1387 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
1389 // glClear(GL_ACCUM_BUFFER_BIT);
1390 glColor4f(0.0, 0.0, 0.0,0.04);
1392 glVertex4d(-vw*.5,-vh*.5,-1,1);
1393 glVertex4d(-vw*.5, vh*.5,-1,1);
1394 glVertex4d(vw*.5, vh*.5,-1,1);
1395 glVertex4d(vw*.5, -vh*.5,-1,1);
1398 glColor4f(0.0, 0.0, 0.0,1.0);
1401 glVertex4d(-vw*.5,0,-1,1);
1402 glVertex4d(-vw*.5, vh*.5,-1,1);
1403 glVertex4d(vw*.5, vh*.5,-1,1);
1404 glVertex4d(vw*.5, 0,-1,1);
1408 glVertex4d(0,-vh*.5,-1,1);
1409 glVertex4d(0, vh*.5,-1,1);
1410 glVertex4d(vw*.5, vh*.5,-1,1);
1411 glVertex4d(vw*.5, -vh*.5,-1,1);
1415 glTranslatef(.25*vw, .25*vh, 0);
1418 // glBindTexture( GL_TEXTURE_2D, tex2 );
1419 glEnable(GL_TEXTURE_2D);
1421 // glAccum(GL_LOAD,0);
1422 // if (bDarken==1) glBlendFunc(GL_SRC_COLOR,GL_ZERO);
1424 //Draw giant rectangle and texture it with our texture!
1426 glTexCoord4d(0, 1,0,1); glVertex4d(-vw*.5,-vh*.5,-1,1);
1427 glTexCoord4d(0, 0,0,1); glVertex4d(-vw*.5, vh*.5,-1,1);
1428 glTexCoord4d(1, 0,0,1); glVertex4d(vw*.5, vh*.5,-1,1);
1429 glTexCoord4d(1, 1,0,1); glVertex4d(vw*.5, -vh*.5,-1,1);
1432 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1434 // if (bDarken==1) glBlendFunc(GL_SRC_COLOR,GL_ONE_MINUS_SRC_ALPHA);
1436 // if (bDarken==1) { glAccum(GL_ACCUM,1-fVideoEchoAlpha); glBlendFunc(GL_SRC_COLOR,GL_ZERO); }
1438 glMatrixMode(GL_TEXTURE);
1441 glColor4f(0.0, 0.0, 0.0,fVideoEchoAlpha);
1442 glTranslated(.5,.5,0);
1443 glScaled(1/fVideoEchoZoom,1/fVideoEchoZoom,1);
1444 glTranslated(-.5,-.5,0);
1446 int flipx=1,flipy=1;
1447 switch (((int)nVideoEchoOrientation))
1449 case 0: flipx=1;flipy=1;break;
1450 case 1: flipx=-1;flipy=1;break;
1451 case 2: flipx=1;flipy=-1;break;
1452 case 3: flipx=-1;flipy=-1;break;
1453 default: flipx=1;flipy=1; break;
1456 glTexCoord4d(0, 1,0,1); glVertex4f(-vw*.5*flipx,-vh*.5*flipy,-1,1);
1457 glTexCoord4d(0, 0,0,1); glVertex4f(-vw*.5*flipx, vh*.5*flipy,-1,1);
1458 glTexCoord4d(1, 0,0,1); glVertex4f(vw*.5*flipx, vh*.5*flipy,-1,1);
1459 glTexCoord4d(1, 1,0,1); glVertex4f(vw*.5*flipx, -vh*.5*flipy,-1,1);
1462 glDisable(GL_TEXTURE_2D);
1463 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1465 // if (bDarken==1) { glAccum(GL_ACCUM,fVideoEchoAlpha); glAccum(GL_RETURN,1);}
1470 glColor4f(1.0, 1.0, 1.0,1.0);
1471 glBlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ZERO);
1473 glVertex4f(-vw*.5*flipx,-vh*.5*flipy,-1,1);
1474 glVertex4f(-vw*.5*flipx, vh*.5*flipy,-1,1);
1475 glVertex4f(vw*.5*flipx, vh*.5*flipy,-1,1);
1476 glVertex4f(vw*.5*flipx, -vh*.5*flipy,-1,1);
1478 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1481 // glTranslated(.5,.5,0);
1482 // glScaled(1/fVideoEchoZoom,1/fVideoEchoZoom,1);
1483 // glTranslated(-.5,-.5,0);
1484 //glTranslatef(0,.5*vh,0);
1487 //glBlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ZERO);
1489 glMatrixMode(GL_MODELVIEW);
1492 glTranslatef(.25*vw, -.25*vh, 0);
1494 glColor4f(1,1,1,.6);
1498 glBegin(GL_LINE_STRIP);
1501 glVertex4f((x_mesh[x][y]-.5)* vw, (y_mesh[x][y]-.5)*vh,-1,1);
1502 //glVertex4f((origx[x+1][y]-.5) * vw, (origy[x+1][y]-.5) *vh ,-1,1);
1509 glBegin(GL_LINE_STRIP);
1512 glVertex4f((x_mesh[x][y]-.5)* vw, (y_mesh[x][y]-.5)*vh,-1,1);
1513 //glVertex4f((origx[x+1][y]-.5) * vw, (origy[x+1][y]-.5) *vh ,-1,1);
1519 for (x=0;x<gx-1;x++){
1522 glVertex4f((origx[x][y]-.5)* vw, (origy[x][y]-.5)*vh,-1,1);
1523 glVertex4f((origx[x+1][y]-.5) * vw, (origy[x+1][y]-.5) *vh ,-1,1);
1528 // glTranslated(-.5,-.5,0); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1529 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1530 glMatrixMode(GL_MODELVIEW);
1533 glTranslatef(-.5*vw,0, 0);
1536 glTranslatef(0,-vh*.10, 0);
1537 glBegin(GL_LINE_STRIP);
1538 glColor4f(0,1.0,1.0,1.0);
1539 glVertex3f((((totalframes%256)/551.0))*vw, treb_att*-7,-1);
1540 glColor4f(1.0,1.0,1.0,1.0);
1541 glVertex3f((((totalframes%256)/551.0))*vw,0 ,-1);
1542 glColor4f(.5,1.0,1.0,1.0);
1543 glVertex3f((((totalframes%256)/551.0))*vw, treb*7,-1);
1546 glTranslatef(0,-vh*.13, 0);
1547 glBegin(GL_LINE_STRIP);
1548 glColor4f(0,1.0,0.0,1.0);
1549 glVertex3f((((totalframes%256)/551.0))*vw, mid_att*-7,-1);
1550 glColor4f(1.0,1.0,1.0,1.0);
1551 glVertex3f((((totalframes%256)/551.0))*vw,0 ,-1);
1552 glColor4f(.5,1.0,0.0,0.5);
1553 glVertex3f((((totalframes%256)/551.0))*vw, mid*7,-1);
1556 glTranslatef(0,-vh*.13, 0);
1557 glBegin(GL_LINE_STRIP);
1558 glColor4f(1.0,0.0,0.0,1.0);
1559 glVertex3f((((totalframes%256)/551.0))*vw, bass_att*-7,-1);
1560 glColor4f(1.0,1.0,1.0,1.0);
1561 glVertex3f((((totalframes%256)/551.0))*vw,0 ,-1);
1562 glColor4f(.7,0.2,0.2,1.0);
1563 glVertex3f((((totalframes%256)/551.0))*vw, bass*7,-1);
1566 glTranslatef(0,-vh*.13, 0);
1569 glColor4f(1.0,1.0,1.0,1.0);
1570 glVertex3f((((totalframes%256)/551.0))*vw,0 ,-1);
1571 glColor4f(1.0,0.6,1.0,1.0);
1572 glVertex3f((((totalframes%256)/551.0))*vw, vol*7,-1);