1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2004 the VideoLAN team
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
33 #include "preset_types.h"
35 #include "engine_vars.h"
36 #include "per_pixel_eqn_types.h"
37 #include "per_pixel_eqn.h"
38 #include "interface_types.h"
39 #include "video_init.h" //Video Init Routines, resizing/fullscreen, creating pbuffers
40 #include "PCM.h" //Sound data handler (buffering, FFT, etc.)
41 #include "beat_detect.h" //beat detection routines
42 #include "custom_wave_types.h"
43 #include "custom_wave.h"
44 #include "custom_shape_types.h"
45 #include "custom_shape.h"
46 //#include <dmalloc.h>
48 // Forward declarations
52 void modulate_opacity_by_volume();
53 void maximize_colors();
54 void do_per_pixel_math();
57 void render_interpolation();
58 void render_texture_to_screen();
59 void render_texture_to_studio();
60 void draw_motion_vectors();
64 void draw_custom_waves();
66 void reset_per_pixel_matrices();
67 void init_per_pixel_matrices();
68 void free_per_pixel_matrices();
77 extern preset_t * active_preset;
79 GLuint RenderTargetTextureID;
83 //double gx=32; //size of interpolation
86 int texsize=512; //size of texture to do actual graphics
87 int vw=512; //runtime dimensions
91 int maxsamples=2048; //size of PCM buffer
92 int numsamples; //size of new PCM info
93 double *pcmdataL; //holder for most recent pcm data
94 double *pcmdataR; //holder for most recent pcm data
96 int avgtime=500; //# frames per preset
107 //per pixel equation variables
110 double **gridx; //grid containing interpolated mesh
112 double **origtheta; //grid containing interpolated mesh reference values
114 double **origx; //original mesh
119 int galaktos_init( galaktos_thread_t *p_thread )
121 init_per_pixel_matrices();
122 pcmdataL=(double *)malloc(maxsamples*sizeof(double));
123 pcmdataR=(double *)malloc(maxsamples*sizeof(double));
125 /* Preset loading function */
128 /* Load default preset directory */
129 // loadPresetDir("/home/cyril/.vlc/galaktos");
130 loadPresetDir("/etc/projectM/presets");
135 // mutex = SDL_CreateMutex();
140 void galaktos_done( galaktos_thread_t *p_thread )
147 free_per_pixel_matrices();
149 // destroyPresetLoader(); XXX segfaults :(
153 int galaktos_update( galaktos_thread_t *p_thread )
156 double vdataL[512]; //holders for FFT data (spectrum)
160 totalframes++; //total amount of frames since startup
162 Time=(double)(mdate()/1000000);
164 frame++; //number of frames for current preset
165 progress= frame/(double)avgtime;
166 if (progress>1.0) progress=1.0;
167 // printf("start:%d at:%d min:%d stop:%d on:%d %d\n",startframe, frame frame-startframe,avgtime, noSwitch,progress);
171 if (noSwitch==0) switchPreset(RANDOM_NEXT,0);
174 evalInitConditions();
175 evalPerFrameEquations();
177 evalCustomWaveInitConditions();
178 evalCustomShapeInitConditions();
180 // printf("%f %d\n",Time,frame);
182 reset_per_pixel_matrices();
185 numsamples = getPCMnew(pcmdataR,1,0,fWaveSmoothing,0,0);
186 getPCMnew(pcmdataL,0,0,fWaveSmoothing,0,1);
187 getPCM(vdataL,512,0,1,0,0);
188 getPCM(vdataR,512,1,1,0,0);
192 getBeatVals(vdataL,vdataR,&vol);
195 if(vol>8.0 && nohard<0 && noSwitch==0)
198 switchPreset(RANDOM_NEXT, HARD_CUT);
204 //This pass is used to render our texture
205 //the texture is drawn to a subsection of the framebuffer
206 //and then we perform our manipulations on it
207 //in pass 2 we will copy the texture into texture memory
209 // galaktos_glx_activate_pbuffer( p_thread );
211 glPushAttrib( GL_ALL_ATTRIB_BITS ); /* Overkill, but safe */
213 // if (RenderTarget) glViewport( 0, 0, RenderTarget->w, RenderTarget->h );
215 else glViewport( 0, 0, texsize, texsize );
218 glMatrixMode( GL_MODELVIEW );
222 glMatrixMode( GL_PROJECTION );
226 glOrtho(0.0, texsize, 0.0,texsize,10,40);
230 do_per_frame(); //apply per-frame effects
231 render_interpolation(); //apply per-pixel effects
232 draw_motion_vectors(); //draw motion vectors
233 draw_borders(); //draw borders
239 glMatrixMode( GL_MODELVIEW );
242 glMatrixMode( GL_PROJECTION );
247 //if ( RenderTarget ) SDL_GL_UnlockRenderTarget(RenderTarget);
248 /* Copy our rendering to the fake render target texture */
249 glBindTexture( GL_TEXTURE_2D, RenderTargetTextureID );
250 glCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, texsize, texsize);
251 // galaktos_glx_activate_window( p_thread );
255 //end of texture rendering
256 //now we copy the texture from the framebuffer to
257 //video texture memory and render fullscreen on a quad surface.
258 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
259 glMatrixMode(GL_PROJECTION);
262 glFrustum(-vw*.5, vw*.5, -vh*.5,vh*.5,10,40);
264 glLineWidth(texsize/512.0);
265 if(studio%2)render_texture_to_studio();
266 else render_texture_to_screen();
270 // printf("Flush %d\n",(SDL_GetTicks()-timestart));
272 p_thread->p_opengl->pf_swap( p_thread->p_opengl );
275 if( p_thread->p_opengl->pf_manage &&
276 p_thread->p_opengl->pf_manage( p_thread->p_opengl ) )
285 void free_per_pixel_matrices()
289 for(x = 0; x < gx; x++)
314 void init_per_pixel_matrices()
318 gridx=(double **)malloc(gx * sizeof(double *));
319 gridy=(double **)malloc(gx * sizeof(double *));
321 origx=(double **)malloc(gx * sizeof(double *));
322 origy=(double **)malloc(gx * sizeof(double *));
323 origrad=(double **)malloc(gx * sizeof(double *));
324 origtheta=(double **)malloc(gx * sizeof(double *));
326 x_mesh=(double **)malloc(gx * sizeof(double *));
327 y_mesh=(double **)malloc(gx * sizeof(double *));
328 rad_mesh=(double **)malloc(gx * sizeof(double *));
329 theta_mesh=(double **)malloc(gx * sizeof(double *));
331 sx_mesh=(double **)malloc(gx * sizeof(double *));
332 sy_mesh=(double **)malloc(gx * sizeof(double *));
333 dx_mesh=(double **)malloc(gx * sizeof(double *));
334 dy_mesh=(double **)malloc(gx * sizeof(double *));
335 cx_mesh=(double **)malloc(gx * sizeof(double *));
336 cy_mesh=(double **)malloc(gx * sizeof(double *));
337 zoom_mesh=(double **)malloc(gx * sizeof(double *));
338 zoomexp_mesh=(double **)malloc(gx * sizeof(double *));
339 rot_mesh=(double **)malloc(gx * sizeof(double *));
341 for(x = 0; x < gx; x++)
343 gridx[x] = (double *)malloc(gy * sizeof(double));
344 gridy[x] = (double *)malloc(gy * sizeof(double));
346 origtheta[x] = (double *)malloc(gy * sizeof(double));
347 origrad[x] = (double *)malloc(gy * sizeof(double));
348 origx[x] = (double *)malloc(gy * sizeof(double));
349 origy[x] = (double *)malloc(gy * sizeof(double));
351 x_mesh[x] = (double *)malloc(gy * sizeof(double));
352 y_mesh[x] = (double *)malloc(gy * sizeof(double));
354 rad_mesh[x] = (double *)malloc(gy * sizeof(double));
355 theta_mesh[x] = (double *)malloc(gy * sizeof(double));
357 sx_mesh[x] = (double *)malloc(gy * sizeof(double));
358 sy_mesh[x] = (double *)malloc(gy * sizeof(double));
359 dx_mesh[x] = (double *)malloc(gy * sizeof(double));
360 dy_mesh[x] = (double *)malloc(gy * sizeof(double));
361 cx_mesh[x] = (double *)malloc(gy * sizeof(double));
362 cy_mesh[x] = (double *)malloc(gy * sizeof(double));
364 zoom_mesh[x] = (double *)malloc(gy * sizeof(double));
365 zoomexp_mesh[x] = (double *)malloc(gy * sizeof(double));
367 rot_mesh[x] = (double *)malloc(gy * sizeof(double));
370 //initialize reference grid values
375 origx[x][y]=x/(double)(gx-1);
376 origy[x][y]=-((y/(double)(gy-1))-1);
377 origrad[x][y]=hypot((origx[x][y]-.5)*2,(origy[x][y]-.5)*2) * .7071067;
378 origtheta[x][y]=atan2(((origy[x][y]-.5)*2),((origx[x][y]-.5)*2));
379 gridx[x][y]=origx[x][y]*texsize;
380 gridy[x][y]=origy[x][y]*texsize;
387 //calculate matrices for per_pixel
388 void do_per_pixel_math()
392 double rotx=0,roty=0;
395 if(!isPerPixelEqn(CX_OP))
405 if(!isPerPixelEqn(CY_OP))
416 if(isPerPixelEqn(ROT_OP))
422 x_mesh[x][y]=x_mesh[x][y]-cx_mesh[x][y];
423 y_mesh[x][y]=y_mesh[x][y]-cy_mesh[x][y];
424 rotx=(x_mesh[x][y])*cos(rot_mesh[x][y])-(y_mesh[x][y])*sin(rot_mesh[x][y]);
425 roty=(x_mesh[x][y])*sin(rot_mesh[x][y])+(y_mesh[x][y])*cos(rot_mesh[x][y]);
426 x_mesh[x][y]=rotx+cx_mesh[x][y];
427 y_mesh[x][y]=roty+cy_mesh[x][y];
434 if(!isPerPixelEqn(ZOOM_OP))
440 zoom_mesh[x][y]=zoom;
445 if(!isPerPixelEqn(ZOOMEXP_OP))
451 zoomexp_mesh[x][y]=zoomexp;
462 x_mesh[x][y]=(x_mesh[x][y]-.5)*2;
463 y_mesh[x][y]=(y_mesh[x][y]-.5)*2;
464 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);
465 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);
466 x_mesh[x][y]=(x_mesh[x][y]*.5)+.5;
467 y_mesh[x][y]=(y_mesh[x][y]*.5)+.5;
471 if(isPerPixelEqn(SX_OP))
477 x_mesh[x][y]=((x_mesh[x][y]-cx_mesh[x][y])/sx_mesh[x][y])+cx_mesh[x][y];
482 if(isPerPixelEqn(SY_OP))
488 y_mesh[x][y]=((y_mesh[x][y]-cy_mesh[x][y])/sy_mesh[x][y])+cy_mesh[x][y];
493 if(isPerPixelEqn(DX_OP))
500 x_mesh[x][y]=x_mesh[x][y]-dx_mesh[x][y];
506 if(isPerPixelEqn(DY_OP))
512 y_mesh[x][y]=y_mesh[x][y]-dy_mesh[x][y];
521 void reset_per_pixel_matrices()
529 x_mesh[x][y]=origx[x][y];
530 y_mesh[x][y]=origy[x][y];
531 rad_mesh[x][y]=origrad[x][y];
532 theta_mesh[x][y]=origtheta[x][y];
539 void draw_custom_waves()
543 custom_wave_t *wavecode;
544 glPointSize(texsize/512);
545 //printf("%d\n",wavecode);
546 // more=isMoreCustomWave();
547 // printf("not inner loop\n");
548 while ((wavecode = nextCustomWave()) != NULL)
550 //printf("begin inner loop\n");
551 if(wavecode->enabled==1)
557 //if(wavecode->bUseDots==1) glEnable(GL_LINE_STIPPLE);
558 if (wavecode->bAdditive==0) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
559 else glBlendFunc(GL_SRC_ALPHA, GL_ONE);
560 if (wavecode->bDrawThick==1) glLineWidth(2*texsize/512);
562 // xx= ((pcmdataL[x]-pcmdataL[x-1])*80*fWaveScale)*2;
563 //yy=pcmdataL[x]*80*fWaveScale,-1;
564 //glVertex3f( (wave_x*texsize)+(xx+yy)*cos(45), (wave_y*texsize)+(-yy+xx)*cos(45),-1);
565 // printf("samples: %d\n", wavecode->samples);
567 getPCM(wavecode->value1,wavecode->samples,0,wavecode->bSpectrum,wavecode->smoothing,0);
568 getPCM(wavecode->value2,wavecode->samples,1,wavecode->bSpectrum,wavecode->smoothing,0);
569 // printf("%f\n",pcmL[0]);
570 for(x=0;x<wavecode->samples;x++)
571 {wavecode->value1[x]=wavecode->value1[x]*wavecode->scaling;}
573 for(x=0;x<wavecode->samples;x++)
574 {wavecode->value2[x]=wavecode->value2[x]*wavecode->scaling;}
576 for(x=0;x<wavecode->samples;x++)
577 {wavecode->sample_mesh[x]=((double)x)/((double)(wavecode->samples-1));}
579 // printf("mid inner loop\n");
582 if(!isPerPointEquation("x"))
583 {for(x=0;x<wavecode->samples;x++)
586 if(!isPerPointEquation(Y_POINT_OP))
587 {for(x=0;x<wavecode->samples;x++)
590 if(!isPerPointEquation(R_POINT_OP))
591 {for(x=0;x<wavecode->samples;x++)
592 {cw_r[x]=wavecode->r;}}
593 if(!isPerPointEquation(G_POINT_OP))
594 {for(x=0;x<wavecode->samples;x++)
595 {cw_g[x]=wavecode->g;}}
596 if(!isPerPointEquation(B_POINT_OP))
597 {for(x=0;x<wavecode->samples;x++)
598 {cw_b[x]=wavecode->b;}}
599 if(!isPerPointEquation(A_POINT_OP))
600 {for(x=0;x<wavecode->samples;x++)
601 {cw_a[x]=wavecode->a;}}
603 //put drawing code here
604 if (wavecode->bUseDots==1) glBegin(GL_POINTS);
605 else glBegin(GL_LINE_STRIP);
607 for(x=0;x<wavecode->samples;x++)
609 // 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]);
610 glColor4f(wavecode->r_mesh[x],wavecode->g_mesh[x],wavecode->b_mesh[x],wavecode->a_mesh[x]);
611 glVertex3f(wavecode->x_mesh[x]*texsize,-(wavecode->y_mesh[x]-1)*texsize,-1);
614 glPointSize(texsize/512);
615 glLineWidth(texsize/512);
616 glDisable(GL_LINE_STIPPLE);
617 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
634 double pi = 3.14159265;
635 double start,inc,xval,yval;
636 custom_shape_t *shapecode;
638 while ((shapecode = nextCustomShape()) != NULL)
640 if(shapecode->enabled==1)
642 // printf("drawing shape %f\n",shapecode->ang);
643 shapecode->y=-((shapecode->y)-1);
645 shapecode->rad=shapecode->rad*(texsize*.707*.707*.707*1.04);
646 //Additive Drawing or Overwrite
647 if (shapecode->additive==0) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
648 else glBlendFunc(GL_SRC_ALPHA, GL_ONE);
650 glMatrixMode(GL_MODELVIEW);
654 glTranslatef(texsize*.5,texsize*.5, 0);
655 glScalef(1.0,vw/(double)vh,1.0);
656 glTranslatef((-texsize*.5) ,(-texsize*.5),0);
659 start=.78539+shapecode->ang;
660 inc=(pi*2)/(double)shapecode->sides;
661 xval=shapecode->x*texsize;
662 yval=shapecode->y*texsize;
664 if (shapecode->textured)
666 glMatrixMode(GL_TEXTURE);
670 glTranslatef(.5,.5, 0);
671 if (correction) glScalef(1,vw/(double)vh,1);
673 glRotatef((shapecode->tex_ang*360/6.280), 0, 0, 1);
675 glScalef(1/(shapecode->tex_zoom),1/(shapecode->tex_zoom),1);
677 // glScalef(1,vh/(double)vw,1);
678 glTranslatef((-.5) ,(-.5),0);
679 // glScalef(1,vw/(double)vh,1);
680 glEnable(GL_TEXTURE_2D);
683 glBegin(GL_TRIANGLE_FAN);
685 glColor4f(shapecode->r,shapecode->g,shapecode->b,shapecode->a);
688 glVertex3f(xval,yval,-1);
689 glColor4f(shapecode->r2,shapecode->g2,shapecode->b2,shapecode->a2);
691 for ( i=0;i<shapecode->sides+1;i++)
695 // glColor4f(shapecode->r2,shapecode->g2,shapecode->b2,shapecode->a2);
696 glTexCoord2f(rad2*cos(theta)+.5 ,rad2*sin(theta)+.5 );
697 glVertex3f(shapecode->rad*cos(theta)+xval,shapecode->rad*sin(theta)+yval,-1);
704 glDisable(GL_TEXTURE_2D);
706 glMatrixMode(GL_MODELVIEW);
709 {//Untextured (use color values)
710 //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);
711 //draw first n-1 triangular pieces
712 glBegin(GL_TRIANGLE_FAN);
714 glColor4f(shapecode->r,shapecode->g,shapecode->b,shapecode->a);
716 // glTexCoord2f(.5,.5);
717 glVertex3f(xval,yval,-1);
718 glColor4f(shapecode->r2,shapecode->g2,shapecode->b2,shapecode->a2);
720 for ( i=0;i<shapecode->sides+1;i++)
724 // glColor4f(shapecode->r2,shapecode->g2,shapecode->b2,shapecode->a2);
725 // glTexCoord2f(rad2*cos(theta)+.5 ,rad2*sin(theta)+.5 );
726 glVertex3f(shapecode->rad*cos(theta)+xval,shapecode->rad*sin(theta)+yval,-1);
732 if (bWaveThick==1) glLineWidth(2*texsize/512);
733 glBegin(GL_LINE_LOOP);
734 glColor4f(shapecode->border_r,shapecode->border_g,shapecode->border_b,shapecode->border_a);
735 for ( i=0;i<shapecode->sides;i++)
738 glVertex3f(shapecode->rad*cos(theta)+xval,shapecode->rad*sin(theta)+yval,-1);
741 if (bWaveThick==1) glLineWidth(texsize/512);
757 double offset,scale,dy2_adj;
761 double wave_x_temp=0;
762 double wave_y_temp=0;
764 modulate_opacity_by_volume();
767 if(bWaveDots==1) glEnable(GL_LINE_STIPPLE);
769 offset=(wave_x-.5)*texsize;
773 if (bWaveThick==1) glLineWidth(2*texsize/512);
775 //Additive wave drawing (vice overwrite)
776 if (bAdditiveWaves==0) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
777 else glBlendFunc(GL_SRC_ALPHA, GL_ONE);
785 glTranslatef(texsize*.5,texsize*.5, 0);
786 glRotated(-wave_mystery*90,0,0,1);
788 glTranslatef(-texsize*.5,-texsize*.825, 0);
793 glBegin(GL_LINE_STRIP);
794 glColor4f(1.0-(x/15.0),.5,x/15.0,1.0);
795 glVertex3f((totalframes%256)*2*scale, -beat_val[x]*fWaveScale+texsize*wave_y,-1);
796 glColor4f(.5,.5,.5,1.0);
797 glVertex3f((totalframes%256)*2*scale, texsize*wave_y,-1);
798 glColor4f(1.0,1.0,0,1.0);
799 //glVertex3f((totalframes%256)*scale*2, beat_val_att[x]*fWaveScale+texsize*wave_y,-1);
802 glTranslatef(0,texsize*(1/36.0), 0);
806 glTranslatef(0,texsize*(1/18.0), 0);
809 glBegin(GL_LINE_STRIP);
810 glColor4f(1.0,1.0,0.5,1.0);
811 glVertex3f((totalframes%256)*2*scale, treb_att*5*fWaveScale+texsize*wave_y,-1);
812 glColor4f(.2,.2,.2,1.0);
813 glVertex3f((totalframes%256)*2*scale, texsize*wave_y,-1);
814 glColor4f(1.0,1.0,0,1.0);
815 glVertex3f((totalframes%256)*scale*2, treb*-5*fWaveScale+texsize*wave_y,-1);
818 glTranslatef(0,texsize*.075, 0);
819 glBegin(GL_LINE_STRIP);
820 glColor4f(0,1.0,0.0,1.0);
821 glVertex3f((totalframes%256)*2*scale, mid_att*5*fWaveScale+texsize*wave_y,-1);
822 glColor4f(.2,.2,.2,1.0);
823 glVertex3f((totalframes%256)*2*scale, texsize*wave_y,-1);
824 glColor4f(.5,1.0,.5,1.0);
825 glVertex3f((totalframes%256)*scale*2, mid*-5*fWaveScale+texsize*wave_y,-1);
829 glTranslatef(0,texsize*.075, 0);
830 glBegin(GL_LINE_STRIP);
831 glColor4f(1.0,0,0,1.0);
832 glVertex3f((totalframes%256)*2*scale, bass_att*5*fWaveScale+texsize*wave_y,-1);
833 glColor4f(.2,.2,.2,1.0);
834 glVertex3f((totalframes%256)*2*scale, texsize*wave_y,-1);
835 glColor4f(1.0,.5,.5,1.0);
836 glVertex3f((totalframes%256)*scale*2, bass*-5*fWaveScale+texsize*wave_y,-1);
843 case 0://circular waveforms
847 glTranslatef(texsize*.5,texsize*.5, 0);
848 glScalef(1.0,vw/(double)vh,1.0);
849 glTranslatef((-texsize*.5) ,(-texsize*.5),0);
851 wave_y=-1*(wave_y-1.0);
853 glBegin(GL_LINE_STRIP);
855 for ( x=0;x<numsamples;x++)
857 co= -(abs(x-((numsamples*.5)-1))/numsamples)+1;
858 // printf("%d %f\n",x,co);
859 theta=x*(6.28/numsamples);
860 r= ((1+2*wave_mystery)*(texsize/5.0)+
861 ( co*pcmdataL[x]+ (1-co)*pcmdataL[-(x-(numsamples-1))])
864 glVertex3f(r*cos(theta)+(wave_x*texsize),r*sin(theta)+(wave_y*texsize),-1);
867 r= ( (1+2*wave_mystery)*(texsize/5.0)+
868 (0.5*pcmdataL[0]+ 0.5*pcmdataL[numsamples-1])
871 glVertex3f(r*cos(0)+(wave_x*texsize),r*sin(0)+(wave_y*texsize),-1);
875 glBegin(GL_LINE_LOOP);
877 for ( x=0;x<(512/pcmbreak);x++)
879 theta=(blockstart+x)*((6.28*pcmbreak)/512.0);
880 r= ((1+2*wave_mystery)*(texsize/5.0)+fdata_buffer[fbuffer][0][blockstart+x]*.0025*fWaveScale);
882 glVertex3f(r*cos(theta)+(wave_x*texsize),r*sin(theta)+(wave_y*texsize),-1);
890 case 1://circularly moving waveform
894 glTranslatef(texsize*.5,texsize*.5, 0);
895 glScalef(1.0,vw/(double)vh,1.0);
896 glTranslatef((-texsize*.5) ,(-texsize*.5),0);
898 wave_y=-1*(wave_y-1.0);
900 glBegin(GL_LINE_STRIP);
901 //theta=(frame%512)*(6.28/512.0);
905 co= -(abs(x-255)/512.0)+1;
906 // printf("%d %f\n",x,co);
907 theta=((frame%256)*(2*6.28/512.0))+pcmdataL[x]*.2*fWaveScale;
908 r= ((1+2*wave_mystery)*(texsize/5.0)+
909 (pcmdataL[x]-pcmdataL[x-1])*80*fWaveScale);
911 glVertex3f(r*cos(theta)+(wave_x*texsize),r*sin(theta)+(wave_y*texsize),-1);
920 case 2://EXPERIMENTAL
921 wave_y=-1*(wave_y-1.0);
923 glBegin(GL_LINE_STRIP);
925 // double xr= (wave_x*texsize), yr=(wave_y*texsize);
929 //xx = ((pcmdataL[x]-pcmdataL[x-1])*80*fWaveScale)*2;
930 xx += (pcmdataL[x]*fWaveScale);
931 yy= pcmdataL[x]*80*fWaveScale;
932 // glVertex3f( (wave_x*texsize)+(xx+yy)*2, (wave_y*texsize)+(xx-yy)*2,-1);
933 glVertex3f( (wave_x*texsize)+(xx)*2, (wave_y*texsize)+(yy)*2,-1);
936 // xr+=fdata_buffer[fbuffer][0][x] *.0005* fWaveScale;
937 //yr=(fdata_buffer[fbuffer][0][x]-fdata_buffer[fbuffer][0][x-1])*.05*fWaveScale+(wave_y*texsize);
938 //glVertex3f(xr,yr,-1);
945 case 3://EXPERIMENTAL
947 wave_y=-1*(wave_y-1.0);
948 glBegin(GL_LINE_STRIP);
953 xx= ((pcmdataL[x]-pcmdataL[x-1])*80*fWaveScale)*2;
954 yy=pcmdataL[x]*80*fWaveScale,-1;
955 glVertex3f( (wave_x*texsize)+(xx+yy)*cos(45), (wave_y*texsize)+(-yy+xx)*cos(45),-1);
961 case 4://single x-axis derivative waveform
963 wave_y=-1*(wave_y-1.0);
964 glTranslatef(texsize*.5,texsize*.5, 0);
965 glRotated(-wave_mystery*90,0,0,1);
966 glTranslatef(-texsize*.5,-texsize*.5, 0);
967 wave_x=(wave_x*.75)+.125; wave_x=-(wave_x-1);
968 glBegin(GL_LINE_STRIP);
973 dy_adj= pcmdataL[x]*20*fWaveScale-pcmdataL[x-1]*20*fWaveScale;
974 glVertex3f((x*scale)+dy_adj, pcmdataL[x]*20*fWaveScale+texsize*wave_x,-1);
980 case 5://EXPERIMENTAL
984 wave_y=-1*(wave_y-1.0);
985 wave_x_temp=(wave_x*.75)+.125;
986 wave_x_temp=-(wave_x_temp-1);
987 glBegin(GL_LINE_STRIP);
989 for ( x=1;x<(512);x++)
991 dy2_adj= (pcmdataL[x]-pcmdataL[x-1])*20*fWaveScale;
992 glVertex3f((wave_x_temp*texsize)+dy2_adj*2, pcmdataL[x]*20*fWaveScale+texsize*wave_y,-1);
998 case 6://single waveform
1003 glTranslatef(0,0, -1);
1005 //glMatrixMode(GL_MODELVIEW);
1007 // glLoadIdentity();
1009 glTranslatef(texsize*.5,texsize*.5, 0);
1010 glRotated(-wave_mystery*90,0,0,1);
1012 wave_x_temp=-2*0.4142*(abs(abs(wave_mystery)-.5)-.5);
1013 glScalef(1.0+wave_x_temp,1.0,1.0);
1014 glTranslatef(-texsize*.5,-texsize*.5, 0);
1015 wave_x_temp=-1*(wave_x-1.0);
1017 glBegin(GL_LINE_STRIP);
1018 // wave_x_temp=(wave_x*.75)+.125;
1019 // wave_x_temp=-(wave_x_temp-1);
1020 for ( x=0;x<numsamples;x++)
1023 //glVertex3f(x*scale, fdata_buffer[fbuffer][0][blockstart+x]*.0012*fWaveScale+texsize*wave_x_temp,-1);
1024 glVertex3f(x*texsize/(double)numsamples, pcmdataR[x]*20*fWaveScale+texsize*wave_x_temp,-1);
1026 //glVertex3f(x*scale, texsize*wave_y_temp,-1);
1028 // printf("%f %f\n",texsize*wave_y_temp,wave_y_temp);
1033 case 7://dual waveforms
1037 glTranslatef(texsize*.5,texsize*.5, 0);
1038 glRotated(-wave_mystery*90,0,0,1);
1040 wave_x_temp=-2*0.4142*(abs(abs(wave_mystery)-.5)-.5);
1041 glScalef(1.0+wave_x_temp,1.0,1.0);
1042 glTranslatef(-texsize*.5,-texsize*.5, 0);
1044 wave_y_temp=-1*(wave_x-1);
1046 glBegin(GL_LINE_STRIP);
1048 for ( x=0;x<numsamples;x++)
1051 glVertex3f((x*texsize)/(double)numsamples, pcmdataL[x]*20*fWaveScale+texsize*(wave_y_temp+(wave_y*wave_y*.5)),-1);
1055 glBegin(GL_LINE_STRIP);
1058 for ( x=0;x<numsamples;x++)
1061 glVertex3f((x*texsize)/(double)numsamples, pcmdataR[x]*20*fWaveScale+texsize*(wave_y_temp-(wave_y*wave_y*.5)),-1);
1068 glBegin(GL_LINE_LOOP);
1070 for ( x=0;x<512;x++)
1072 theta=(x)*(6.28/512.0);
1073 r= (texsize/5.0+pcmdataL[x]*.002);
1075 glVertex3f(r*cos(theta)+(wave_x*texsize),r*sin(theta)+(wave_y*texsize),-1);
1079 glBegin(GL_LINE_STRIP);
1081 for ( x=0;x<512;x++)
1083 glVertex3f(x*scale, pcmdataL[x]*20*fWaveScale+(texsize*(wave_x+.1)),-1);
1087 glBegin(GL_LINE_STRIP);
1089 for ( x=0;x<512;x++)
1091 glVertex3f(x*scale, pcmdataR[x]*20*fWaveScale+(texsize*(wave_x-.1)),-1);
1096 if (bWaveThick==1) glLineWidth(2*texsize/512);
1098 glLineWidth(texsize/512);
1099 glDisable(GL_LINE_STIPPLE);
1103 void maximize_colors()
1105 float wave_r_switch=0,wave_g_switch=0,wave_b_switch=0;
1106 //wave color brightening
1108 //forces max color value to 1.0 and scales
1109 // the rest accordingly
1111 if (bMaximizeWaveColor==1)
1113 if(wave_r>=wave_g && wave_r>=wave_b) //red brightest
1115 wave_b_switch=wave_b*(1/wave_r);
1116 wave_g_switch=wave_g*(1/wave_r);
1119 else if (wave_b>=wave_g && wave_b>=wave_r) //blue brightest
1121 wave_r_switch=wave_r*(1/wave_b);
1122 wave_g_switch=wave_g*(1/wave_b);
1127 else if (wave_g>=wave_b && wave_g>=wave_r) //green brightest
1129 wave_b_switch=wave_b*(1/wave_g);
1130 wave_r_switch=wave_r*(1/wave_g);
1133 glColor4f(wave_r_switch, wave_g_switch, wave_b_switch, wave_o);
1137 glColor4f(wave_r, wave_g, wave_b, wave_o);
1143 void modulate_opacity_by_volume()
1146 //modulate volume by opacity
1148 //set an upper and lower bound and linearly
1149 //calculate the opacity from 0=lower to 1=upper
1150 //based on current volume
1152 if (bModWaveAlphaByVolume==1)
1153 {if (vol<=fModWaveAlphaStart) wave_o=0.0;
1154 else if (vol>=fModWaveAlphaEnd) wave_o=fWaveAlpha;
1155 else wave_o=fWaveAlpha*((vol-fModWaveAlphaStart)/(fModWaveAlphaEnd-fModWaveAlphaStart));}
1156 else wave_o=fWaveAlpha;
1160 void draw_motion_vectors()
1164 double offsetx=mv_dx*texsize, intervalx=texsize/(double)mv_x;
1165 double offsety=mv_dy*texsize, intervaly=texsize/(double)mv_y;
1168 glColor4f(mv_r, mv_g, mv_b, mv_a);
1170 for (x=0;x<mv_x;x++){
1171 for(y=0;y<mv_y;y++){
1172 glVertex3f(offsetx+x*intervalx,offsety+y*intervaly,-1);
1181 //no additive drawing for borders
1182 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1184 glTranslatef(0,0,-1);
1186 double of=texsize*ob_size*.5;
1187 double iff=(texsize*ib_size*.5);
1188 double texof=texsize-of;
1190 glColor4d(ob_r,ob_g,ob_b,ob_a);
1192 glRectd(0,0,of,texsize);
1193 glRectd(of,0,texof,of);
1194 glRectd(texof,0,texsize,texsize);
1195 glRectd(of,texsize,texof,texof);
1196 glColor4d(ib_r,ib_g,ib_b,ib_a);
1197 glRectd(of,of,of+iff,texof);
1198 glRectd(of+iff,of,texof-iff,of+iff);
1199 glRectd(texof-iff,of,texof,texof);
1200 glRectd(of+iff,texof,texof-iff,texof-iff);
1204 //Here we render the interpolated mesh, and then apply the texture to it.
1205 //Well, we actually do the inverse, but its all the same.
1206 void render_interpolation()
1211 glMatrixMode(GL_MODELVIEW);
1213 glTranslated(0, 0, -9);
1215 glColor4f(0.0, 0.0, 0.0,decay);
1217 glEnable(GL_TEXTURE_2D);
1219 for (x=0;x<gx-1;x++)
1221 glBegin(GL_TRIANGLE_STRIP);
1224 glTexCoord4f(x_mesh[x][y], y_mesh[x][y],-1,1); glVertex4f(gridx[x][y], gridy[x][y],-1,1);
1225 glTexCoord4f(x_mesh[x+1][y], y_mesh[x+1][y],-1,1); glVertex4f(gridx[x+1][y], gridy[x+1][y],-1,1);
1229 glDisable(GL_TEXTURE_2D);
1235 //Texture wrapping( clamp vs. wrap)
1238 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
1239 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
1243 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
1244 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
1248 // glRasterPos2i(0,0);
1249 // glClear(GL_COLOR_BUFFER_BIT);
1250 // glColor4d(0.0, 0.0, 0.0,1.0);
1252 // glMatrixMode(GL_TEXTURE);
1253 // glLoadIdentity();
1256 glClear(GL_COLOR_BUFFER_BIT);
1257 glColor4d(0.0, 0.0, 0.0,1.0);
1259 glMatrixMode(GL_TEXTURE);
1262 glTranslatef(cx,cy, 0);
1263 if(correction) glScalef(1,vw/(double)vh,1);
1265 if(!isPerPixelEqn(ROT_OP))
1267 // printf("ROTATING: rot = %f\n", rot);
1268 glRotatef(rot*90, 0, 0, 1);
1270 if(!isPerPixelEqn(SX_OP)) glScalef(1/sx,1,1);
1271 if(!isPerPixelEqn(SY_OP)) glScalef(1,1/sy,1);
1273 if(correction) glScalef(1,vh/(double)vw,1);
1274 glTranslatef((-cx) ,(-cy),0);
1276 if(!isPerPixelEqn(DX_OP)) glTranslatef(-dx,0,0);
1277 if(!isPerPixelEqn(DY_OP)) glTranslatef(0 ,-dy,0);
1282 //Actually draws the texture to the screen
1284 //The Video Echo effect is also applied here
1285 void render_texture_to_screen()
1287 glMatrixMode(GL_TEXTURE);
1290 glMatrixMode(GL_MODELVIEW);
1292 glTranslatef(0, 0, -9);
1294 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1295 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1297 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
1298 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
1300 // glClear(GL_ACCUM_BUFFER_BIT);
1301 glColor4d(0.0, 0.0, 0.0,1.0f);
1304 glVertex4d(-vw*.5,-vh*.5,-1,1);
1305 glVertex4d(-vw*.5, vh*.5,-1,1);
1306 glVertex4d(vw*.5, vh*.5,-1,1);
1307 glVertex4d(vw*.5, -vh*.5,-1,1);
1310 // glBindTexture( GL_TEXTURE_2D, tex2 );
1311 glEnable(GL_TEXTURE_2D);
1313 // glAccum(GL_LOAD,0);
1314 // if (bDarken==1) glBlendFunc(GL_SRC_COLOR,GL_ZERO);
1316 //Draw giant rectangle and texture it with our texture!
1318 glTexCoord4d(0, 1,0,1); glVertex4d(-vw*.5,-vh*.5,-1,1);
1319 glTexCoord4d(0, 0,0,1); glVertex4d(-vw*.5, vh*.5,-1,1);
1320 glTexCoord4d(1, 0,0,1); glVertex4d(vw*.5, vh*.5,-1,1);
1321 glTexCoord4d(1, 1,0,1); glVertex4d(vw*.5, -vh*.5,-1,1);
1324 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1326 // if (bDarken==1) glBlendFunc(GL_SRC_COLOR,GL_ONE_MINUS_SRC_ALPHA);
1328 // if (bDarken==1) { glAccum(GL_ACCUM,1-fVideoEchoAlpha); glBlendFunc(GL_SRC_COLOR,GL_ZERO); }
1330 glMatrixMode(GL_TEXTURE);
1333 glColor4f(0.0, 0.0, 0.0,fVideoEchoAlpha);
1334 glTranslated(.5,.5,0);
1335 glScaled(1/fVideoEchoZoom,1/fVideoEchoZoom,1);
1336 glTranslated(-.5,-.5,0);
1338 int flipx=1,flipy=1;
1339 switch (((int)nVideoEchoOrientation))
1341 case 0: flipx=1;flipy=1;break;
1342 case 1: flipx=-1;flipy=1;break;
1343 case 2: flipx=1;flipy=-1;break;
1344 case 3: flipx=-1;flipy=-1;break;
1345 default: flipx=1;flipy=1; break;
1348 glTexCoord4d(0, 1,0,1); glVertex4f(-vw*.5*flipx,-vh*.5*flipy,-1,1);
1349 glTexCoord4d(0, 0,0,1); glVertex4f(-vw*.5*flipx, vh*.5*flipy,-1,1);
1350 glTexCoord4d(1, 0,0,1); glVertex4f(vw*.5*flipx, vh*.5*flipy,-1,1);
1351 glTexCoord4d(1, 1,0,1); glVertex4f(vw*.5*flipx, -vh*.5*flipy,-1,1);
1355 glDisable(GL_TEXTURE_2D);
1356 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1358 // if (bDarken==1) { glAccum(GL_ACCUM,fVideoEchoAlpha); glAccum(GL_RETURN,1);}
1362 glColor4f(1.0, 1.0, 1.0,1.0);
1363 glBlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ZERO);
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);
1368 glVertex4f(vw*.5*flipx, -vh*.5*flipy,-1,1);
1370 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1375 void render_texture_to_studio()
1377 glMatrixMode(GL_TEXTURE);
1380 glMatrixMode(GL_MODELVIEW);
1382 glTranslatef(0, 0, -9);
1384 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1385 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1387 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
1388 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
1390 // glClear(GL_ACCUM_BUFFER_BIT);
1391 glColor4f(0.0, 0.0, 0.0,0.04);
1393 glVertex4d(-vw*.5,-vh*.5,-1,1);
1394 glVertex4d(-vw*.5, vh*.5,-1,1);
1395 glVertex4d(vw*.5, vh*.5,-1,1);
1396 glVertex4d(vw*.5, -vh*.5,-1,1);
1399 glColor4f(0.0, 0.0, 0.0,1.0);
1402 glVertex4d(-vw*.5,0,-1,1);
1403 glVertex4d(-vw*.5, vh*.5,-1,1);
1404 glVertex4d(vw*.5, vh*.5,-1,1);
1405 glVertex4d(vw*.5, 0,-1,1);
1409 glVertex4d(0,-vh*.5,-1,1);
1410 glVertex4d(0, vh*.5,-1,1);
1411 glVertex4d(vw*.5, vh*.5,-1,1);
1412 glVertex4d(vw*.5, -vh*.5,-1,1);
1416 glTranslatef(.25*vw, .25*vh, 0);
1419 // glBindTexture( GL_TEXTURE_2D, tex2 );
1420 glEnable(GL_TEXTURE_2D);
1422 // glAccum(GL_LOAD,0);
1423 // if (bDarken==1) glBlendFunc(GL_SRC_COLOR,GL_ZERO);
1425 //Draw giant rectangle and texture it with our texture!
1427 glTexCoord4d(0, 1,0,1); glVertex4d(-vw*.5,-vh*.5,-1,1);
1428 glTexCoord4d(0, 0,0,1); glVertex4d(-vw*.5, vh*.5,-1,1);
1429 glTexCoord4d(1, 0,0,1); glVertex4d(vw*.5, vh*.5,-1,1);
1430 glTexCoord4d(1, 1,0,1); glVertex4d(vw*.5, -vh*.5,-1,1);
1433 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1435 // if (bDarken==1) glBlendFunc(GL_SRC_COLOR,GL_ONE_MINUS_SRC_ALPHA);
1437 // if (bDarken==1) { glAccum(GL_ACCUM,1-fVideoEchoAlpha); glBlendFunc(GL_SRC_COLOR,GL_ZERO); }
1439 glMatrixMode(GL_TEXTURE);
1442 glColor4f(0.0, 0.0, 0.0,fVideoEchoAlpha);
1443 glTranslated(.5,.5,0);
1444 glScaled(1/fVideoEchoZoom,1/fVideoEchoZoom,1);
1445 glTranslated(-.5,-.5,0);
1447 int flipx=1,flipy=1;
1448 switch (((int)nVideoEchoOrientation))
1450 case 0: flipx=1;flipy=1;break;
1451 case 1: flipx=-1;flipy=1;break;
1452 case 2: flipx=1;flipy=-1;break;
1453 case 3: flipx=-1;flipy=-1;break;
1454 default: flipx=1;flipy=1; break;
1457 glTexCoord4d(0, 1,0,1); glVertex4f(-vw*.5*flipx,-vh*.5*flipy,-1,1);
1458 glTexCoord4d(0, 0,0,1); glVertex4f(-vw*.5*flipx, vh*.5*flipy,-1,1);
1459 glTexCoord4d(1, 0,0,1); glVertex4f(vw*.5*flipx, vh*.5*flipy,-1,1);
1460 glTexCoord4d(1, 1,0,1); glVertex4f(vw*.5*flipx, -vh*.5*flipy,-1,1);
1463 glDisable(GL_TEXTURE_2D);
1464 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1466 // if (bDarken==1) { glAccum(GL_ACCUM,fVideoEchoAlpha); glAccum(GL_RETURN,1);}
1471 glColor4f(1.0, 1.0, 1.0,1.0);
1472 glBlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ZERO);
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);
1477 glVertex4f(vw*.5*flipx, -vh*.5*flipy,-1,1);
1479 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1482 // glTranslated(.5,.5,0);
1483 // glScaled(1/fVideoEchoZoom,1/fVideoEchoZoom,1);
1484 // glTranslated(-.5,-.5,0);
1485 //glTranslatef(0,.5*vh,0);
1488 //glBlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ZERO);
1490 glMatrixMode(GL_MODELVIEW);
1493 glTranslatef(.25*vw, -.25*vh, 0);
1495 glColor4f(1,1,1,.6);
1499 glBegin(GL_LINE_STRIP);
1502 glVertex4f((x_mesh[x][y]-.5)* vw, (y_mesh[x][y]-.5)*vh,-1,1);
1503 //glVertex4f((origx[x+1][y]-.5) * vw, (origy[x+1][y]-.5) *vh ,-1,1);
1510 glBegin(GL_LINE_STRIP);
1513 glVertex4f((x_mesh[x][y]-.5)* vw, (y_mesh[x][y]-.5)*vh,-1,1);
1514 //glVertex4f((origx[x+1][y]-.5) * vw, (origy[x+1][y]-.5) *vh ,-1,1);
1520 for (x=0;x<gx-1;x++){
1523 glVertex4f((origx[x][y]-.5)* vw, (origy[x][y]-.5)*vh,-1,1);
1524 glVertex4f((origx[x+1][y]-.5) * vw, (origy[x+1][y]-.5) *vh ,-1,1);
1529 // glTranslated(-.5,-.5,0); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1530 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1531 glMatrixMode(GL_MODELVIEW);
1534 glTranslatef(-.5*vw,0, 0);
1537 glTranslatef(0,-vh*.10, 0);
1538 glBegin(GL_LINE_STRIP);
1539 glColor4f(0,1.0,1.0,1.0);
1540 glVertex3f((((totalframes%256)/551.0))*vw, treb_att*-7,-1);
1541 glColor4f(1.0,1.0,1.0,1.0);
1542 glVertex3f((((totalframes%256)/551.0))*vw,0 ,-1);
1543 glColor4f(.5,1.0,1.0,1.0);
1544 glVertex3f((((totalframes%256)/551.0))*vw, treb*7,-1);
1547 glTranslatef(0,-vh*.13, 0);
1548 glBegin(GL_LINE_STRIP);
1549 glColor4f(0,1.0,0.0,1.0);
1550 glVertex3f((((totalframes%256)/551.0))*vw, mid_att*-7,-1);
1551 glColor4f(1.0,1.0,1.0,1.0);
1552 glVertex3f((((totalframes%256)/551.0))*vw,0 ,-1);
1553 glColor4f(.5,1.0,0.0,0.5);
1554 glVertex3f((((totalframes%256)/551.0))*vw, mid*7,-1);
1557 glTranslatef(0,-vh*.13, 0);
1558 glBegin(GL_LINE_STRIP);
1559 glColor4f(1.0,0.0,0.0,1.0);
1560 glVertex3f((((totalframes%256)/551.0))*vw, bass_att*-7,-1);
1561 glColor4f(1.0,1.0,1.0,1.0);
1562 glVertex3f((((totalframes%256)/551.0))*vw,0 ,-1);
1563 glColor4f(.7,0.2,0.2,1.0);
1564 glVertex3f((((totalframes%256)/551.0))*vw, bass*7,-1);
1567 glTranslatef(0,-vh*.13, 0);
1570 glColor4f(1.0,1.0,1.0,1.0);
1571 glVertex3f((((totalframes%256)/551.0))*vw,0 ,-1);
1572 glColor4f(1.0,0.6,1.0,1.0);
1573 glVertex3f((((totalframes%256)/551.0))*vw, vol*7,-1);