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 *****************************************************************************/
31 #include "preset_types.h"
33 #include "engine_vars.h"
34 #include "per_pixel_eqn_types.h"
35 #include "per_pixel_eqn.h"
36 #include "interface_types.h"
37 #include "video_init.h" //Video Init Routines, resizing/fullscreen, creating pbuffers
38 #include "PCM.h" //Sound data handler (buffering, FFT, etc.)
39 #include "beat_detect.h" //beat detection routines
40 #include "custom_wave_types.h"
41 #include "custom_wave.h"
42 #include "custom_shape_types.h"
43 #include "custom_shape.h"
44 //#include <dmalloc.h>
46 // Forward declarations
50 void modulate_opacity_by_volume();
51 void maximize_colors();
52 void do_per_pixel_math();
55 void render_interpolation();
56 void render_texture_to_screen();
57 void render_texture_to_studio();
58 void draw_motion_vectors();
62 void draw_custom_waves();
64 void reset_per_pixel_matrices();
65 void init_per_pixel_matrices();
66 void free_per_pixel_matrices();
75 extern preset_t * active_preset;
77 GLuint RenderTargetTextureID;
81 //double gx=32; //size of interpolation
84 int texsize=512; //size of texture to do actual graphics
85 int vw=512; //runtime dimensions
89 int maxsamples=2048; //size of PCM buffer
90 int numsamples; //size of new PCM info
91 double *pcmdataL; //holder for most recent pcm data
92 double *pcmdataR; //holder for most recent pcm data
94 int avgtime=500; //# frames per preset
105 //per pixel equation variables
108 double **gridx; //grid containing interpolated mesh
110 double **origtheta; //grid containing interpolated mesh reference values
112 double **origx; //original mesh
117 int galaktos_init( galaktos_thread_t *p_thread )
119 init_per_pixel_matrices();
120 pcmdataL=(double *)malloc(maxsamples*sizeof(double));
121 pcmdataR=(double *)malloc(maxsamples*sizeof(double));
123 /* Preset loading function */
126 /* Load default preset directory */
127 // loadPresetDir("/home/cyril/.vlc/galaktos");
128 loadPresetDir("/etc/projectM/presets");
133 // mutex = SDL_CreateMutex();
138 void galaktos_done( galaktos_thread_t *p_thread )
145 free_per_pixel_matrices();
147 // destroyPresetLoader(); XXX segfaults :(
151 int galaktos_update( galaktos_thread_t *p_thread )
154 double vdataL[512]; //holders for FFT data (spectrum)
158 totalframes++; //total amount of frames since startup
160 Time=(double)(mdate()/1000000);
162 frame++; //number of frames for current preset
163 progress= frame/(double)avgtime;
164 if (progress>1.0) progress=1.0;
165 // printf("start:%d at:%d min:%d stop:%d on:%d %d\n",startframe, frame frame-startframe,avgtime, noSwitch,progress);
169 if (noSwitch==0) switchPreset(RANDOM_NEXT,0);
172 evalInitConditions();
173 evalPerFrameEquations();
175 evalCustomWaveInitConditions();
176 evalCustomShapeInitConditions();
178 // printf("%f %d\n",Time,frame);
180 reset_per_pixel_matrices();
183 numsamples = getPCMnew(pcmdataR,1,0,fWaveSmoothing,0,0);
184 getPCMnew(pcmdataL,0,0,fWaveSmoothing,0,1);
185 getPCM(vdataL,512,0,1,0,0);
186 getPCM(vdataR,512,1,1,0,0);
190 getBeatVals(vdataL,vdataR,&vol);
193 if(vol>8.0 && nohard<0 && noSwitch==0)
196 switchPreset(RANDOM_NEXT, HARD_CUT);
202 //This pass is used to render our texture
203 //the texture is drawn to a subsection of the framebuffer
204 //and then we perform our manipulations on it
205 //in pass 2 we will copy the texture into texture memory
207 // galaktos_glx_activate_pbuffer( p_thread );
209 glPushAttrib( GL_ALL_ATTRIB_BITS ); /* Overkill, but safe */
211 // if (RenderTarget) glViewport( 0, 0, RenderTarget->w, RenderTarget->h );
213 else glViewport( 0, 0, texsize, texsize );
216 glMatrixMode( GL_MODELVIEW );
220 glMatrixMode( GL_PROJECTION );
224 glOrtho(0.0, texsize, 0.0,texsize,10,40);
228 do_per_frame(); //apply per-frame effects
229 render_interpolation(); //apply per-pixel effects
230 draw_motion_vectors(); //draw motion vectors
231 draw_borders(); //draw borders
237 glMatrixMode( GL_MODELVIEW );
240 glMatrixMode( GL_PROJECTION );
245 //if ( RenderTarget ) SDL_GL_UnlockRenderTarget(RenderTarget);
246 /* Copy our rendering to the fake render target texture */
247 glBindTexture( GL_TEXTURE_2D, RenderTargetTextureID );
248 glCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, texsize, texsize);
249 // galaktos_glx_activate_window( p_thread );
253 //end of texture rendering
254 //now we copy the texture from the framebuffer to
255 //video texture memory and render fullscreen on a quad surface.
256 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
257 glMatrixMode(GL_PROJECTION);
260 glFrustum(-vw*.5, vw*.5, -vh*.5,vh*.5,10,40);
262 glLineWidth(texsize/512.0);
263 if(studio%2)render_texture_to_studio();
264 else render_texture_to_screen();
268 // printf("Flush %d\n",(SDL_GetTicks()-timestart));
270 p_thread->p_opengl->pf_swap( p_thread->p_opengl );
273 if( p_thread->p_opengl->pf_manage &&
274 p_thread->p_opengl->pf_manage( p_thread->p_opengl ) )
283 void free_per_pixel_matrices()
287 for(x = 0; x < gx; x++)
312 void init_per_pixel_matrices()
316 gridx=(double **)malloc(gx * sizeof(double *));
317 gridy=(double **)malloc(gx * sizeof(double *));
319 origx=(double **)malloc(gx * sizeof(double *));
320 origy=(double **)malloc(gx * sizeof(double *));
321 origrad=(double **)malloc(gx * sizeof(double *));
322 origtheta=(double **)malloc(gx * sizeof(double *));
324 x_mesh=(double **)malloc(gx * sizeof(double *));
325 y_mesh=(double **)malloc(gx * sizeof(double *));
326 rad_mesh=(double **)malloc(gx * sizeof(double *));
327 theta_mesh=(double **)malloc(gx * sizeof(double *));
329 sx_mesh=(double **)malloc(gx * sizeof(double *));
330 sy_mesh=(double **)malloc(gx * sizeof(double *));
331 dx_mesh=(double **)malloc(gx * sizeof(double *));
332 dy_mesh=(double **)malloc(gx * sizeof(double *));
333 cx_mesh=(double **)malloc(gx * sizeof(double *));
334 cy_mesh=(double **)malloc(gx * sizeof(double *));
335 zoom_mesh=(double **)malloc(gx * sizeof(double *));
336 zoomexp_mesh=(double **)malloc(gx * sizeof(double *));
337 rot_mesh=(double **)malloc(gx * sizeof(double *));
339 for(x = 0; x < gx; x++)
341 gridx[x] = (double *)malloc(gy * sizeof(double));
342 gridy[x] = (double *)malloc(gy * sizeof(double));
344 origtheta[x] = (double *)malloc(gy * sizeof(double));
345 origrad[x] = (double *)malloc(gy * sizeof(double));
346 origx[x] = (double *)malloc(gy * sizeof(double));
347 origy[x] = (double *)malloc(gy * sizeof(double));
349 x_mesh[x] = (double *)malloc(gy * sizeof(double));
350 y_mesh[x] = (double *)malloc(gy * sizeof(double));
352 rad_mesh[x] = (double *)malloc(gy * sizeof(double));
353 theta_mesh[x] = (double *)malloc(gy * sizeof(double));
355 sx_mesh[x] = (double *)malloc(gy * sizeof(double));
356 sy_mesh[x] = (double *)malloc(gy * sizeof(double));
357 dx_mesh[x] = (double *)malloc(gy * sizeof(double));
358 dy_mesh[x] = (double *)malloc(gy * sizeof(double));
359 cx_mesh[x] = (double *)malloc(gy * sizeof(double));
360 cy_mesh[x] = (double *)malloc(gy * sizeof(double));
362 zoom_mesh[x] = (double *)malloc(gy * sizeof(double));
363 zoomexp_mesh[x] = (double *)malloc(gy * sizeof(double));
365 rot_mesh[x] = (double *)malloc(gy * sizeof(double));
368 //initialize reference grid values
373 origx[x][y]=x/(double)(gx-1);
374 origy[x][y]=-((y/(double)(gy-1))-1);
375 origrad[x][y]=hypot((origx[x][y]-.5)*2,(origy[x][y]-.5)*2) * .7071067;
376 origtheta[x][y]=atan2(((origy[x][y]-.5)*2),((origx[x][y]-.5)*2));
377 gridx[x][y]=origx[x][y]*texsize;
378 gridy[x][y]=origy[x][y]*texsize;
385 //calculate matrices for per_pixel
386 void do_per_pixel_math()
390 double rotx=0,roty=0;
393 if(!isPerPixelEqn(CX_OP))
403 if(!isPerPixelEqn(CY_OP))
414 if(isPerPixelEqn(ROT_OP))
420 x_mesh[x][y]=x_mesh[x][y]-cx_mesh[x][y];
421 y_mesh[x][y]=y_mesh[x][y]-cy_mesh[x][y];
422 rotx=(x_mesh[x][y])*cos(rot_mesh[x][y])-(y_mesh[x][y])*sin(rot_mesh[x][y]);
423 roty=(x_mesh[x][y])*sin(rot_mesh[x][y])+(y_mesh[x][y])*cos(rot_mesh[x][y]);
424 x_mesh[x][y]=rotx+cx_mesh[x][y];
425 y_mesh[x][y]=roty+cy_mesh[x][y];
432 if(!isPerPixelEqn(ZOOM_OP))
438 zoom_mesh[x][y]=zoom;
443 if(!isPerPixelEqn(ZOOMEXP_OP))
449 zoomexp_mesh[x][y]=zoomexp;
460 x_mesh[x][y]=(x_mesh[x][y]-.5)*2;
461 y_mesh[x][y]=(y_mesh[x][y]-.5)*2;
462 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);
463 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);
464 x_mesh[x][y]=(x_mesh[x][y]*.5)+.5;
465 y_mesh[x][y]=(y_mesh[x][y]*.5)+.5;
469 if(isPerPixelEqn(SX_OP))
475 x_mesh[x][y]=((x_mesh[x][y]-cx_mesh[x][y])/sx_mesh[x][y])+cx_mesh[x][y];
480 if(isPerPixelEqn(SY_OP))
486 y_mesh[x][y]=((y_mesh[x][y]-cy_mesh[x][y])/sy_mesh[x][y])+cy_mesh[x][y];
491 if(isPerPixelEqn(DX_OP))
498 x_mesh[x][y]=x_mesh[x][y]-dx_mesh[x][y];
504 if(isPerPixelEqn(DY_OP))
510 y_mesh[x][y]=y_mesh[x][y]-dy_mesh[x][y];
519 void reset_per_pixel_matrices()
527 x_mesh[x][y]=origx[x][y];
528 y_mesh[x][y]=origy[x][y];
529 rad_mesh[x][y]=origrad[x][y];
530 theta_mesh[x][y]=origtheta[x][y];
537 void draw_custom_waves()
541 custom_wave_t *wavecode;
542 glPointSize(texsize/512);
543 //printf("%d\n",wavecode);
544 // more=isMoreCustomWave();
545 // printf("not inner loop\n");
546 while ((wavecode = nextCustomWave()) != NULL)
548 //printf("begin inner loop\n");
549 if(wavecode->enabled==1)
555 //if(wavecode->bUseDots==1) glEnable(GL_LINE_STIPPLE);
556 if (wavecode->bAdditive==0) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
557 else glBlendFunc(GL_SRC_ALPHA, GL_ONE);
558 if (wavecode->bDrawThick==1) glLineWidth(2*texsize/512);
560 // xx= ((pcmdataL[x]-pcmdataL[x-1])*80*fWaveScale)*2;
561 //yy=pcmdataL[x]*80*fWaveScale,-1;
562 //glVertex3f( (wave_x*texsize)+(xx+yy)*cos(45), (wave_y*texsize)+(-yy+xx)*cos(45),-1);
563 // printf("samples: %d\n", wavecode->samples);
565 getPCM(wavecode->value1,wavecode->samples,0,wavecode->bSpectrum,wavecode->smoothing,0);
566 getPCM(wavecode->value2,wavecode->samples,1,wavecode->bSpectrum,wavecode->smoothing,0);
567 // printf("%f\n",pcmL[0]);
568 for(x=0;x<wavecode->samples;x++)
569 {wavecode->value1[x]=wavecode->value1[x]*wavecode->scaling;}
571 for(x=0;x<wavecode->samples;x++)
572 {wavecode->value2[x]=wavecode->value2[x]*wavecode->scaling;}
574 for(x=0;x<wavecode->samples;x++)
575 {wavecode->sample_mesh[x]=((double)x)/((double)(wavecode->samples-1));}
577 // printf("mid inner loop\n");
580 if(!isPerPointEquation("x"))
581 {for(x=0;x<wavecode->samples;x++)
584 if(!isPerPointEquation(Y_POINT_OP))
585 {for(x=0;x<wavecode->samples;x++)
588 if(!isPerPointEquation(R_POINT_OP))
589 {for(x=0;x<wavecode->samples;x++)
590 {cw_r[x]=wavecode->r;}}
591 if(!isPerPointEquation(G_POINT_OP))
592 {for(x=0;x<wavecode->samples;x++)
593 {cw_g[x]=wavecode->g;}}
594 if(!isPerPointEquation(B_POINT_OP))
595 {for(x=0;x<wavecode->samples;x++)
596 {cw_b[x]=wavecode->b;}}
597 if(!isPerPointEquation(A_POINT_OP))
598 {for(x=0;x<wavecode->samples;x++)
599 {cw_a[x]=wavecode->a;}}
601 //put drawing code here
602 if (wavecode->bUseDots==1) glBegin(GL_POINTS);
603 else glBegin(GL_LINE_STRIP);
605 for(x=0;x<wavecode->samples;x++)
607 // 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]);
608 glColor4f(wavecode->r_mesh[x],wavecode->g_mesh[x],wavecode->b_mesh[x],wavecode->a_mesh[x]);
609 glVertex3f(wavecode->x_mesh[x]*texsize,-(wavecode->y_mesh[x]-1)*texsize,-1);
612 glPointSize(texsize/512);
613 glLineWidth(texsize/512);
614 glDisable(GL_LINE_STIPPLE);
615 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
632 double pi = 3.14159265;
633 double start,inc,xval,yval;
634 custom_shape_t *shapecode;
636 while ((shapecode = nextCustomShape()) != NULL)
638 if(shapecode->enabled==1)
640 // printf("drawing shape %f\n",shapecode->ang);
641 shapecode->y=-((shapecode->y)-1);
643 shapecode->rad=shapecode->rad*(texsize*.707*.707*.707*1.04);
644 //Additive Drawing or Overwrite
645 if (shapecode->additive==0) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
646 else glBlendFunc(GL_SRC_ALPHA, GL_ONE);
648 glMatrixMode(GL_MODELVIEW);
652 glTranslatef(texsize*.5,texsize*.5, 0);
653 glScalef(1.0,vw/(double)vh,1.0);
654 glTranslatef((-texsize*.5) ,(-texsize*.5),0);
657 start=.78539+shapecode->ang;
658 inc=(pi*2)/(double)shapecode->sides;
659 xval=shapecode->x*texsize;
660 yval=shapecode->y*texsize;
662 if (shapecode->textured)
664 glMatrixMode(GL_TEXTURE);
668 glTranslatef(.5,.5, 0);
669 if (correction) glScalef(1,vw/(double)vh,1);
671 glRotatef((shapecode->tex_ang*360/6.280), 0, 0, 1);
673 glScalef(1/(shapecode->tex_zoom),1/(shapecode->tex_zoom),1);
675 // glScalef(1,vh/(double)vw,1);
676 glTranslatef((-.5) ,(-.5),0);
677 // glScalef(1,vw/(double)vh,1);
678 glEnable(GL_TEXTURE_2D);
681 glBegin(GL_TRIANGLE_FAN);
683 glColor4f(shapecode->r,shapecode->g,shapecode->b,shapecode->a);
686 glVertex3f(xval,yval,-1);
687 glColor4f(shapecode->r2,shapecode->g2,shapecode->b2,shapecode->a2);
689 for ( i=0;i<shapecode->sides+1;i++)
693 // glColor4f(shapecode->r2,shapecode->g2,shapecode->b2,shapecode->a2);
694 glTexCoord2f(rad2*cos(theta)+.5 ,rad2*sin(theta)+.5 );
695 glVertex3f(shapecode->rad*cos(theta)+xval,shapecode->rad*sin(theta)+yval,-1);
702 glDisable(GL_TEXTURE_2D);
704 glMatrixMode(GL_MODELVIEW);
707 {//Untextured (use color values)
708 //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);
709 //draw first n-1 triangular pieces
710 glBegin(GL_TRIANGLE_FAN);
712 glColor4f(shapecode->r,shapecode->g,shapecode->b,shapecode->a);
714 // glTexCoord2f(.5,.5);
715 glVertex3f(xval,yval,-1);
716 glColor4f(shapecode->r2,shapecode->g2,shapecode->b2,shapecode->a2);
718 for ( i=0;i<shapecode->sides+1;i++)
722 // glColor4f(shapecode->r2,shapecode->g2,shapecode->b2,shapecode->a2);
723 // glTexCoord2f(rad2*cos(theta)+.5 ,rad2*sin(theta)+.5 );
724 glVertex3f(shapecode->rad*cos(theta)+xval,shapecode->rad*sin(theta)+yval,-1);
730 if (bWaveThick==1) glLineWidth(2*texsize/512);
731 glBegin(GL_LINE_LOOP);
732 glColor4f(shapecode->border_r,shapecode->border_g,shapecode->border_b,shapecode->border_a);
733 for ( i=0;i<shapecode->sides;i++)
736 glVertex3f(shapecode->rad*cos(theta)+xval,shapecode->rad*sin(theta)+yval,-1);
739 if (bWaveThick==1) glLineWidth(texsize/512);
755 double offset,scale,dy2_adj;
759 double wave_x_temp=0;
760 double wave_y_temp=0;
762 modulate_opacity_by_volume();
765 if(bWaveDots==1) glEnable(GL_LINE_STIPPLE);
767 offset=(wave_x-.5)*texsize;
771 if (bWaveThick==1) glLineWidth(2*texsize/512);
773 //Additive wave drawing (vice overwrite)
774 if (bAdditiveWaves==0) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
775 else glBlendFunc(GL_SRC_ALPHA, GL_ONE);
783 glTranslatef(texsize*.5,texsize*.5, 0);
784 glRotated(-wave_mystery*90,0,0,1);
786 glTranslatef(-texsize*.5,-texsize*.825, 0);
791 glBegin(GL_LINE_STRIP);
792 glColor4f(1.0-(x/15.0),.5,x/15.0,1.0);
793 glVertex3f((totalframes%256)*2*scale, -beat_val[x]*fWaveScale+texsize*wave_y,-1);
794 glColor4f(.5,.5,.5,1.0);
795 glVertex3f((totalframes%256)*2*scale, texsize*wave_y,-1);
796 glColor4f(1.0,1.0,0,1.0);
797 //glVertex3f((totalframes%256)*scale*2, beat_val_att[x]*fWaveScale+texsize*wave_y,-1);
800 glTranslatef(0,texsize*(1/36.0), 0);
804 glTranslatef(0,texsize*(1/18.0), 0);
807 glBegin(GL_LINE_STRIP);
808 glColor4f(1.0,1.0,0.5,1.0);
809 glVertex3f((totalframes%256)*2*scale, treb_att*5*fWaveScale+texsize*wave_y,-1);
810 glColor4f(.2,.2,.2,1.0);
811 glVertex3f((totalframes%256)*2*scale, texsize*wave_y,-1);
812 glColor4f(1.0,1.0,0,1.0);
813 glVertex3f((totalframes%256)*scale*2, treb*-5*fWaveScale+texsize*wave_y,-1);
816 glTranslatef(0,texsize*.075, 0);
817 glBegin(GL_LINE_STRIP);
818 glColor4f(0,1.0,0.0,1.0);
819 glVertex3f((totalframes%256)*2*scale, mid_att*5*fWaveScale+texsize*wave_y,-1);
820 glColor4f(.2,.2,.2,1.0);
821 glVertex3f((totalframes%256)*2*scale, texsize*wave_y,-1);
822 glColor4f(.5,1.0,.5,1.0);
823 glVertex3f((totalframes%256)*scale*2, mid*-5*fWaveScale+texsize*wave_y,-1);
827 glTranslatef(0,texsize*.075, 0);
828 glBegin(GL_LINE_STRIP);
829 glColor4f(1.0,0,0,1.0);
830 glVertex3f((totalframes%256)*2*scale, bass_att*5*fWaveScale+texsize*wave_y,-1);
831 glColor4f(.2,.2,.2,1.0);
832 glVertex3f((totalframes%256)*2*scale, texsize*wave_y,-1);
833 glColor4f(1.0,.5,.5,1.0);
834 glVertex3f((totalframes%256)*scale*2, bass*-5*fWaveScale+texsize*wave_y,-1);
841 case 0://circular waveforms
845 glTranslatef(texsize*.5,texsize*.5, 0);
846 glScalef(1.0,vw/(double)vh,1.0);
847 glTranslatef((-texsize*.5) ,(-texsize*.5),0);
849 wave_y=-1*(wave_y-1.0);
851 glBegin(GL_LINE_STRIP);
853 for ( x=0;x<numsamples;x++)
855 co= -(abs(x-((numsamples*.5)-1))/numsamples)+1;
856 // printf("%d %f\n",x,co);
857 theta=x*(6.28/numsamples);
858 r= ((1+2*wave_mystery)*(texsize/5.0)+
859 ( co*pcmdataL[x]+ (1-co)*pcmdataL[-(x-(numsamples-1))])
862 glVertex3f(r*cos(theta)+(wave_x*texsize),r*sin(theta)+(wave_y*texsize),-1);
865 r= ( (1+2*wave_mystery)*(texsize/5.0)+
866 (0.5*pcmdataL[0]+ 0.5*pcmdataL[numsamples-1])
869 glVertex3f(r*cos(0)+(wave_x*texsize),r*sin(0)+(wave_y*texsize),-1);
873 glBegin(GL_LINE_LOOP);
875 for ( x=0;x<(512/pcmbreak);x++)
877 theta=(blockstart+x)*((6.28*pcmbreak)/512.0);
878 r= ((1+2*wave_mystery)*(texsize/5.0)+fdata_buffer[fbuffer][0][blockstart+x]*.0025*fWaveScale);
880 glVertex3f(r*cos(theta)+(wave_x*texsize),r*sin(theta)+(wave_y*texsize),-1);
888 case 1://circularly moving waveform
892 glTranslatef(texsize*.5,texsize*.5, 0);
893 glScalef(1.0,vw/(double)vh,1.0);
894 glTranslatef((-texsize*.5) ,(-texsize*.5),0);
896 wave_y=-1*(wave_y-1.0);
898 glBegin(GL_LINE_STRIP);
899 //theta=(frame%512)*(6.28/512.0);
903 co= -(abs(x-255)/512.0)+1;
904 // printf("%d %f\n",x,co);
905 theta=((frame%256)*(2*6.28/512.0))+pcmdataL[x]*.2*fWaveScale;
906 r= ((1+2*wave_mystery)*(texsize/5.0)+
907 (pcmdataL[x]-pcmdataL[x-1])*80*fWaveScale);
909 glVertex3f(r*cos(theta)+(wave_x*texsize),r*sin(theta)+(wave_y*texsize),-1);
918 case 2://EXPERIMENTAL
919 wave_y=-1*(wave_y-1.0);
921 glBegin(GL_LINE_STRIP);
923 // double xr= (wave_x*texsize), yr=(wave_y*texsize);
927 //xx = ((pcmdataL[x]-pcmdataL[x-1])*80*fWaveScale)*2;
928 xx += (pcmdataL[x]*fWaveScale);
929 yy= pcmdataL[x]*80*fWaveScale;
930 // glVertex3f( (wave_x*texsize)+(xx+yy)*2, (wave_y*texsize)+(xx-yy)*2,-1);
931 glVertex3f( (wave_x*texsize)+(xx)*2, (wave_y*texsize)+(yy)*2,-1);
934 // xr+=fdata_buffer[fbuffer][0][x] *.0005* fWaveScale;
935 //yr=(fdata_buffer[fbuffer][0][x]-fdata_buffer[fbuffer][0][x-1])*.05*fWaveScale+(wave_y*texsize);
936 //glVertex3f(xr,yr,-1);
943 case 3://EXPERIMENTAL
945 wave_y=-1*(wave_y-1.0);
946 glBegin(GL_LINE_STRIP);
951 xx= ((pcmdataL[x]-pcmdataL[x-1])*80*fWaveScale)*2;
952 yy=pcmdataL[x]*80*fWaveScale,-1;
953 glVertex3f( (wave_x*texsize)+(xx+yy)*cos(45), (wave_y*texsize)+(-yy+xx)*cos(45),-1);
959 case 4://single x-axis derivative waveform
961 wave_y=-1*(wave_y-1.0);
962 glTranslatef(texsize*.5,texsize*.5, 0);
963 glRotated(-wave_mystery*90,0,0,1);
964 glTranslatef(-texsize*.5,-texsize*.5, 0);
965 wave_x=(wave_x*.75)+.125; wave_x=-(wave_x-1);
966 glBegin(GL_LINE_STRIP);
971 dy_adj= pcmdataL[x]*20*fWaveScale-pcmdataL[x-1]*20*fWaveScale;
972 glVertex3f((x*scale)+dy_adj, pcmdataL[x]*20*fWaveScale+texsize*wave_x,-1);
978 case 5://EXPERIMENTAL
982 wave_y=-1*(wave_y-1.0);
983 wave_x_temp=(wave_x*.75)+.125;
984 wave_x_temp=-(wave_x_temp-1);
985 glBegin(GL_LINE_STRIP);
987 for ( x=1;x<(512);x++)
989 dy2_adj= (pcmdataL[x]-pcmdataL[x-1])*20*fWaveScale;
990 glVertex3f((wave_x_temp*texsize)+dy2_adj*2, pcmdataL[x]*20*fWaveScale+texsize*wave_y,-1);
996 case 6://single waveform
1001 glTranslatef(0,0, -1);
1003 //glMatrixMode(GL_MODELVIEW);
1005 // glLoadIdentity();
1007 glTranslatef(texsize*.5,texsize*.5, 0);
1008 glRotated(-wave_mystery*90,0,0,1);
1010 wave_x_temp=-2*0.4142*(abs(abs(wave_mystery)-.5)-.5);
1011 glScalef(1.0+wave_x_temp,1.0,1.0);
1012 glTranslatef(-texsize*.5,-texsize*.5, 0);
1013 wave_x_temp=-1*(wave_x-1.0);
1015 glBegin(GL_LINE_STRIP);
1016 // wave_x_temp=(wave_x*.75)+.125;
1017 // wave_x_temp=-(wave_x_temp-1);
1018 for ( x=0;x<numsamples;x++)
1021 //glVertex3f(x*scale, fdata_buffer[fbuffer][0][blockstart+x]*.0012*fWaveScale+texsize*wave_x_temp,-1);
1022 glVertex3f(x*texsize/(double)numsamples, pcmdataR[x]*20*fWaveScale+texsize*wave_x_temp,-1);
1024 //glVertex3f(x*scale, texsize*wave_y_temp,-1);
1026 // printf("%f %f\n",texsize*wave_y_temp,wave_y_temp);
1031 case 7://dual waveforms
1035 glTranslatef(texsize*.5,texsize*.5, 0);
1036 glRotated(-wave_mystery*90,0,0,1);
1038 wave_x_temp=-2*0.4142*(abs(abs(wave_mystery)-.5)-.5);
1039 glScalef(1.0+wave_x_temp,1.0,1.0);
1040 glTranslatef(-texsize*.5,-texsize*.5, 0);
1042 wave_y_temp=-1*(wave_x-1);
1044 glBegin(GL_LINE_STRIP);
1046 for ( x=0;x<numsamples;x++)
1049 glVertex3f((x*texsize)/(double)numsamples, pcmdataL[x]*20*fWaveScale+texsize*(wave_y_temp+(wave_y*wave_y*.5)),-1);
1053 glBegin(GL_LINE_STRIP);
1056 for ( x=0;x<numsamples;x++)
1059 glVertex3f((x*texsize)/(double)numsamples, pcmdataR[x]*20*fWaveScale+texsize*(wave_y_temp-(wave_y*wave_y*.5)),-1);
1066 glBegin(GL_LINE_LOOP);
1068 for ( x=0;x<512;x++)
1070 theta=(x)*(6.28/512.0);
1071 r= (texsize/5.0+pcmdataL[x]*.002);
1073 glVertex3f(r*cos(theta)+(wave_x*texsize),r*sin(theta)+(wave_y*texsize),-1);
1077 glBegin(GL_LINE_STRIP);
1079 for ( x=0;x<512;x++)
1081 glVertex3f(x*scale, pcmdataL[x]*20*fWaveScale+(texsize*(wave_x+.1)),-1);
1085 glBegin(GL_LINE_STRIP);
1087 for ( x=0;x<512;x++)
1089 glVertex3f(x*scale, pcmdataR[x]*20*fWaveScale+(texsize*(wave_x-.1)),-1);
1094 if (bWaveThick==1) glLineWidth(2*texsize/512);
1096 glLineWidth(texsize/512);
1097 glDisable(GL_LINE_STIPPLE);
1101 void maximize_colors()
1103 float wave_r_switch=0,wave_g_switch=0,wave_b_switch=0;
1104 //wave color brightening
1106 //forces max color value to 1.0 and scales
1107 // the rest accordingly
1109 if (bMaximizeWaveColor==1)
1111 if(wave_r>=wave_g && wave_r>=wave_b) //red brightest
1113 wave_b_switch=wave_b*(1/wave_r);
1114 wave_g_switch=wave_g*(1/wave_r);
1117 else if (wave_b>=wave_g && wave_b>=wave_r) //blue brightest
1119 wave_r_switch=wave_r*(1/wave_b);
1120 wave_g_switch=wave_g*(1/wave_b);
1125 else if (wave_g>=wave_b && wave_g>=wave_r) //green brightest
1127 wave_b_switch=wave_b*(1/wave_g);
1128 wave_r_switch=wave_r*(1/wave_g);
1131 glColor4f(wave_r_switch, wave_g_switch, wave_b_switch, wave_o);
1135 glColor4f(wave_r, wave_g, wave_b, wave_o);
1141 void modulate_opacity_by_volume()
1144 //modulate volume by opacity
1146 //set an upper and lower bound and linearly
1147 //calculate the opacity from 0=lower to 1=upper
1148 //based on current volume
1150 if (bModWaveAlphaByVolume==1)
1151 {if (vol<=fModWaveAlphaStart) wave_o=0.0;
1152 else if (vol>=fModWaveAlphaEnd) wave_o=fWaveAlpha;
1153 else wave_o=fWaveAlpha*((vol-fModWaveAlphaStart)/(fModWaveAlphaEnd-fModWaveAlphaStart));}
1154 else wave_o=fWaveAlpha;
1158 void draw_motion_vectors()
1162 double offsetx=mv_dx*texsize, intervalx=texsize/(double)mv_x;
1163 double offsety=mv_dy*texsize, intervaly=texsize/(double)mv_y;
1166 glColor4f(mv_r, mv_g, mv_b, mv_a);
1168 for (x=0;x<mv_x;x++){
1169 for(y=0;y<mv_y;y++){
1170 glVertex3f(offsetx+x*intervalx,offsety+y*intervaly,-1);
1179 //no additive drawing for borders
1180 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1182 glTranslatef(0,0,-1);
1184 double of=texsize*ob_size*.5;
1185 double iff=(texsize*ib_size*.5);
1186 double texof=texsize-of;
1188 glColor4d(ob_r,ob_g,ob_b,ob_a);
1190 glRectd(0,0,of,texsize);
1191 glRectd(of,0,texof,of);
1192 glRectd(texof,0,texsize,texsize);
1193 glRectd(of,texsize,texof,texof);
1194 glColor4d(ib_r,ib_g,ib_b,ib_a);
1195 glRectd(of,of,of+iff,texof);
1196 glRectd(of+iff,of,texof-iff,of+iff);
1197 glRectd(texof-iff,of,texof,texof);
1198 glRectd(of+iff,texof,texof-iff,texof-iff);
1202 //Here we render the interpolated mesh, and then apply the texture to it.
1203 //Well, we actually do the inverse, but its all the same.
1204 void render_interpolation()
1209 glMatrixMode(GL_MODELVIEW);
1211 glTranslated(0, 0, -9);
1213 glColor4f(0.0, 0.0, 0.0,decay);
1215 glEnable(GL_TEXTURE_2D);
1217 for (x=0;x<gx-1;x++)
1219 glBegin(GL_TRIANGLE_STRIP);
1222 glTexCoord4f(x_mesh[x][y], y_mesh[x][y],-1,1); glVertex4f(gridx[x][y], gridy[x][y],-1,1);
1223 glTexCoord4f(x_mesh[x+1][y], y_mesh[x+1][y],-1,1); glVertex4f(gridx[x+1][y], gridy[x+1][y],-1,1);
1227 glDisable(GL_TEXTURE_2D);
1233 //Texture wrapping( clamp vs. wrap)
1236 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
1237 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
1241 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
1242 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
1246 // glRasterPos2i(0,0);
1247 // glClear(GL_COLOR_BUFFER_BIT);
1248 // glColor4d(0.0, 0.0, 0.0,1.0);
1250 // glMatrixMode(GL_TEXTURE);
1251 // glLoadIdentity();
1254 glClear(GL_COLOR_BUFFER_BIT);
1255 glColor4d(0.0, 0.0, 0.0,1.0);
1257 glMatrixMode(GL_TEXTURE);
1260 glTranslatef(cx,cy, 0);
1261 if(correction) glScalef(1,vw/(double)vh,1);
1263 if(!isPerPixelEqn(ROT_OP))
1265 // printf("ROTATING: rot = %f\n", rot);
1266 glRotatef(rot*90, 0, 0, 1);
1268 if(!isPerPixelEqn(SX_OP)) glScalef(1/sx,1,1);
1269 if(!isPerPixelEqn(SY_OP)) glScalef(1,1/sy,1);
1271 if(correction) glScalef(1,vh/(double)vw,1);
1272 glTranslatef((-cx) ,(-cy),0);
1274 if(!isPerPixelEqn(DX_OP)) glTranslatef(-dx,0,0);
1275 if(!isPerPixelEqn(DY_OP)) glTranslatef(0 ,-dy,0);
1280 //Actually draws the texture to the screen
1282 //The Video Echo effect is also applied here
1283 void render_texture_to_screen()
1285 glMatrixMode(GL_TEXTURE);
1288 glMatrixMode(GL_MODELVIEW);
1290 glTranslatef(0, 0, -9);
1292 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1293 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1295 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
1296 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
1298 // glClear(GL_ACCUM_BUFFER_BIT);
1299 glColor4d(0.0, 0.0, 0.0,1.0f);
1302 glVertex4d(-vw*.5,-vh*.5,-1,1);
1303 glVertex4d(-vw*.5, vh*.5,-1,1);
1304 glVertex4d(vw*.5, vh*.5,-1,1);
1305 glVertex4d(vw*.5, -vh*.5,-1,1);
1308 // glBindTexture( GL_TEXTURE_2D, tex2 );
1309 glEnable(GL_TEXTURE_2D);
1311 // glAccum(GL_LOAD,0);
1312 // if (bDarken==1) glBlendFunc(GL_SRC_COLOR,GL_ZERO);
1314 //Draw giant rectangle and texture it with our texture!
1316 glTexCoord4d(0, 1,0,1); glVertex4d(-vw*.5,-vh*.5,-1,1);
1317 glTexCoord4d(0, 0,0,1); glVertex4d(-vw*.5, vh*.5,-1,1);
1318 glTexCoord4d(1, 0,0,1); glVertex4d(vw*.5, vh*.5,-1,1);
1319 glTexCoord4d(1, 1,0,1); glVertex4d(vw*.5, -vh*.5,-1,1);
1322 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1324 // if (bDarken==1) glBlendFunc(GL_SRC_COLOR,GL_ONE_MINUS_SRC_ALPHA);
1326 // if (bDarken==1) { glAccum(GL_ACCUM,1-fVideoEchoAlpha); glBlendFunc(GL_SRC_COLOR,GL_ZERO); }
1328 glMatrixMode(GL_TEXTURE);
1331 glColor4f(0.0, 0.0, 0.0,fVideoEchoAlpha);
1332 glTranslated(.5,.5,0);
1333 glScaled(1/fVideoEchoZoom,1/fVideoEchoZoom,1);
1334 glTranslated(-.5,-.5,0);
1336 int flipx=1,flipy=1;
1337 switch (((int)nVideoEchoOrientation))
1339 case 0: flipx=1;flipy=1;break;
1340 case 1: flipx=-1;flipy=1;break;
1341 case 2: flipx=1;flipy=-1;break;
1342 case 3: flipx=-1;flipy=-1;break;
1343 default: flipx=1;flipy=1; break;
1346 glTexCoord4d(0, 1,0,1); glVertex4f(-vw*.5*flipx,-vh*.5*flipy,-1,1);
1347 glTexCoord4d(0, 0,0,1); glVertex4f(-vw*.5*flipx, vh*.5*flipy,-1,1);
1348 glTexCoord4d(1, 0,0,1); glVertex4f(vw*.5*flipx, vh*.5*flipy,-1,1);
1349 glTexCoord4d(1, 1,0,1); glVertex4f(vw*.5*flipx, -vh*.5*flipy,-1,1);
1353 glDisable(GL_TEXTURE_2D);
1354 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1356 // if (bDarken==1) { glAccum(GL_ACCUM,fVideoEchoAlpha); glAccum(GL_RETURN,1);}
1360 glColor4f(1.0, 1.0, 1.0,1.0);
1361 glBlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ZERO);
1363 glVertex4f(-vw*.5*flipx,-vh*.5*flipy,-1,1);
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);
1368 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1373 void render_texture_to_studio()
1375 glMatrixMode(GL_TEXTURE);
1378 glMatrixMode(GL_MODELVIEW);
1380 glTranslatef(0, 0, -9);
1382 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1383 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1385 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
1386 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
1388 // glClear(GL_ACCUM_BUFFER_BIT);
1389 glColor4f(0.0, 0.0, 0.0,0.04);
1391 glVertex4d(-vw*.5,-vh*.5,-1,1);
1392 glVertex4d(-vw*.5, vh*.5,-1,1);
1393 glVertex4d(vw*.5, vh*.5,-1,1);
1394 glVertex4d(vw*.5, -vh*.5,-1,1);
1397 glColor4f(0.0, 0.0, 0.0,1.0);
1400 glVertex4d(-vw*.5,0,-1,1);
1401 glVertex4d(-vw*.5, vh*.5,-1,1);
1402 glVertex4d(vw*.5, vh*.5,-1,1);
1403 glVertex4d(vw*.5, 0,-1,1);
1407 glVertex4d(0,-vh*.5,-1,1);
1408 glVertex4d(0, vh*.5,-1,1);
1409 glVertex4d(vw*.5, vh*.5,-1,1);
1410 glVertex4d(vw*.5, -vh*.5,-1,1);
1414 glTranslatef(.25*vw, .25*vh, 0);
1417 // glBindTexture( GL_TEXTURE_2D, tex2 );
1418 glEnable(GL_TEXTURE_2D);
1420 // glAccum(GL_LOAD,0);
1421 // if (bDarken==1) glBlendFunc(GL_SRC_COLOR,GL_ZERO);
1423 //Draw giant rectangle and texture it with our texture!
1425 glTexCoord4d(0, 1,0,1); glVertex4d(-vw*.5,-vh*.5,-1,1);
1426 glTexCoord4d(0, 0,0,1); glVertex4d(-vw*.5, vh*.5,-1,1);
1427 glTexCoord4d(1, 0,0,1); glVertex4d(vw*.5, vh*.5,-1,1);
1428 glTexCoord4d(1, 1,0,1); glVertex4d(vw*.5, -vh*.5,-1,1);
1431 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1433 // if (bDarken==1) glBlendFunc(GL_SRC_COLOR,GL_ONE_MINUS_SRC_ALPHA);
1435 // if (bDarken==1) { glAccum(GL_ACCUM,1-fVideoEchoAlpha); glBlendFunc(GL_SRC_COLOR,GL_ZERO); }
1437 glMatrixMode(GL_TEXTURE);
1440 glColor4f(0.0, 0.0, 0.0,fVideoEchoAlpha);
1441 glTranslated(.5,.5,0);
1442 glScaled(1/fVideoEchoZoom,1/fVideoEchoZoom,1);
1443 glTranslated(-.5,-.5,0);
1445 int flipx=1,flipy=1;
1446 switch (((int)nVideoEchoOrientation))
1448 case 0: flipx=1;flipy=1;break;
1449 case 1: flipx=-1;flipy=1;break;
1450 case 2: flipx=1;flipy=-1;break;
1451 case 3: flipx=-1;flipy=-1;break;
1452 default: flipx=1;flipy=1; break;
1455 glTexCoord4d(0, 1,0,1); glVertex4f(-vw*.5*flipx,-vh*.5*flipy,-1,1);
1456 glTexCoord4d(0, 0,0,1); glVertex4f(-vw*.5*flipx, vh*.5*flipy,-1,1);
1457 glTexCoord4d(1, 0,0,1); glVertex4f(vw*.5*flipx, vh*.5*flipy,-1,1);
1458 glTexCoord4d(1, 1,0,1); glVertex4f(vw*.5*flipx, -vh*.5*flipy,-1,1);
1461 glDisable(GL_TEXTURE_2D);
1462 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1464 // if (bDarken==1) { glAccum(GL_ACCUM,fVideoEchoAlpha); glAccum(GL_RETURN,1);}
1469 glColor4f(1.0, 1.0, 1.0,1.0);
1470 glBlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ZERO);
1472 glVertex4f(-vw*.5*flipx,-vh*.5*flipy,-1,1);
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);
1477 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1480 // glTranslated(.5,.5,0);
1481 // glScaled(1/fVideoEchoZoom,1/fVideoEchoZoom,1);
1482 // glTranslated(-.5,-.5,0);
1483 //glTranslatef(0,.5*vh,0);
1486 //glBlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ZERO);
1488 glMatrixMode(GL_MODELVIEW);
1491 glTranslatef(.25*vw, -.25*vh, 0);
1493 glColor4f(1,1,1,.6);
1497 glBegin(GL_LINE_STRIP);
1500 glVertex4f((x_mesh[x][y]-.5)* vw, (y_mesh[x][y]-.5)*vh,-1,1);
1501 //glVertex4f((origx[x+1][y]-.5) * vw, (origy[x+1][y]-.5) *vh ,-1,1);
1508 glBegin(GL_LINE_STRIP);
1511 glVertex4f((x_mesh[x][y]-.5)* vw, (y_mesh[x][y]-.5)*vh,-1,1);
1512 //glVertex4f((origx[x+1][y]-.5) * vw, (origy[x+1][y]-.5) *vh ,-1,1);
1518 for (x=0;x<gx-1;x++){
1521 glVertex4f((origx[x][y]-.5)* vw, (origy[x][y]-.5)*vh,-1,1);
1522 glVertex4f((origx[x+1][y]-.5) * vw, (origy[x+1][y]-.5) *vh ,-1,1);
1527 // glTranslated(-.5,-.5,0); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1528 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1529 glMatrixMode(GL_MODELVIEW);
1532 glTranslatef(-.5*vw,0, 0);
1535 glTranslatef(0,-vh*.10, 0);
1536 glBegin(GL_LINE_STRIP);
1537 glColor4f(0,1.0,1.0,1.0);
1538 glVertex3f((((totalframes%256)/551.0))*vw, treb_att*-7,-1);
1539 glColor4f(1.0,1.0,1.0,1.0);
1540 glVertex3f((((totalframes%256)/551.0))*vw,0 ,-1);
1541 glColor4f(.5,1.0,1.0,1.0);
1542 glVertex3f((((totalframes%256)/551.0))*vw, treb*7,-1);
1545 glTranslatef(0,-vh*.13, 0);
1546 glBegin(GL_LINE_STRIP);
1547 glColor4f(0,1.0,0.0,1.0);
1548 glVertex3f((((totalframes%256)/551.0))*vw, mid_att*-7,-1);
1549 glColor4f(1.0,1.0,1.0,1.0);
1550 glVertex3f((((totalframes%256)/551.0))*vw,0 ,-1);
1551 glColor4f(.5,1.0,0.0,0.5);
1552 glVertex3f((((totalframes%256)/551.0))*vw, mid*7,-1);
1555 glTranslatef(0,-vh*.13, 0);
1556 glBegin(GL_LINE_STRIP);
1557 glColor4f(1.0,0.0,0.0,1.0);
1558 glVertex3f((((totalframes%256)/551.0))*vw, bass_att*-7,-1);
1559 glColor4f(1.0,1.0,1.0,1.0);
1560 glVertex3f((((totalframes%256)/551.0))*vw,0 ,-1);
1561 glColor4f(.7,0.2,0.2,1.0);
1562 glVertex3f((((totalframes%256)/551.0))*vw, bass*7,-1);
1565 glTranslatef(0,-vh*.13, 0);
1568 glColor4f(1.0,1.0,1.0,1.0);
1569 glVertex3f((((totalframes%256)/551.0))*vw,0 ,-1);
1570 glColor4f(1.0,0.6,1.0,1.0);
1571 glVertex3f((((totalframes%256)/551.0))*vw, vol*7,-1);