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 "splaytree.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
121 static inline int isPerPixelEqn(int op) {
123 return active_preset->per_pixel_flag[op];
126 int galaktos_init( galaktos_thread_t *p_thread )
128 init_per_pixel_matrices();
129 pcmdataL=(double *)malloc(maxsamples*sizeof(double));
130 pcmdataR=(double *)malloc(maxsamples*sizeof(double));
132 /* Preset loading function */
135 /* Load default preset directory */
136 // loadPresetDir("/home/cyril/.vlc/galaktos");
137 loadPresetDir("/etc/projectM/presets");
142 // mutex = SDL_CreateMutex();
147 void galaktos_done( galaktos_thread_t *p_thread )
154 free_per_pixel_matrices();
156 // destroyPresetLoader(); XXX segfaults :(
160 int galaktos_update( galaktos_thread_t *p_thread )
163 double vdataL[512]; //holders for FFT data (spectrum)
167 totalframes++; //total amount of frames since startup
169 Time=(double)(mdate()/1000000);
171 frame++; //number of frames for current preset
172 progress= frame/(double)avgtime;
173 if (progress>1.0) progress=1.0;
174 // printf("start:%d at:%d min:%d stop:%d on:%d %d\n",startframe, frame frame-startframe,avgtime, noSwitch,progress);
178 if (noSwitch==0) switchPreset(RANDOM_NEXT,0);
181 evalInitConditions();
182 evalPerFrameEquations();
184 evalCustomWaveInitConditions();
185 evalCustomShapeInitConditions();
187 // printf("%f %d\n",Time,frame);
189 reset_per_pixel_matrices();
192 numsamples = getPCMnew(pcmdataR,1,0,fWaveSmoothing,0,0);
193 getPCMnew(pcmdataL,0,0,fWaveSmoothing,0,1);
194 getPCM(vdataL,512,0,1,0,0);
195 getPCM(vdataR,512,1,1,0,0);
199 getBeatVals(vdataL,vdataR,&vol);
202 if(vol>8.0 && nohard<0 && noSwitch==0)
205 switchPreset(RANDOM_NEXT, HARD_CUT);
211 //This pass is used to render our texture
212 //the texture is drawn to a subsection of the framebuffer
213 //and then we perform our manipulations on it
214 //in pass 2 we will copy the texture into texture memory
216 // galaktos_glx_activate_pbuffer( p_thread );
218 glPushAttrib( GL_ALL_ATTRIB_BITS ); /* Overkill, but safe */
220 // if (RenderTarget) glViewport( 0, 0, RenderTarget->w, RenderTarget->h );
222 else glViewport( 0, 0, texsize, texsize );
225 glMatrixMode( GL_MODELVIEW );
229 glMatrixMode( GL_PROJECTION );
233 glOrtho(0.0, texsize, 0.0,texsize,10,40);
237 do_per_frame(); //apply per-frame effects
238 render_interpolation(); //apply per-pixel effects
239 draw_motion_vectors(); //draw motion vectors
240 draw_borders(); //draw borders
246 glMatrixMode( GL_MODELVIEW );
249 glMatrixMode( GL_PROJECTION );
254 //if ( RenderTarget ) SDL_GL_UnlockRenderTarget(RenderTarget);
255 /* Copy our rendering to the fake render target texture */
256 glBindTexture( GL_TEXTURE_2D, RenderTargetTextureID );
257 glCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, texsize, texsize);
258 // galaktos_glx_activate_window( p_thread );
262 //end of texture rendering
263 //now we copy the texture from the framebuffer to
264 //video texture memory and render fullscreen on a quad surface.
265 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
266 glMatrixMode(GL_PROJECTION);
269 glFrustum(-vw*.5, vw*.5, -vh*.5,vh*.5,10,40);
271 glLineWidth(texsize/512.0);
272 if(studio%2)render_texture_to_studio();
273 else render_texture_to_screen();
277 // printf("Flush %d\n",(SDL_GetTicks()-timestart));
279 p_thread->p_opengl->pf_swap( p_thread->p_opengl );
282 if( p_thread->p_opengl->pf_manage &&
283 p_thread->p_opengl->pf_manage( p_thread->p_opengl ) )
292 void free_per_pixel_matrices()
296 for(x = 0; x < gx; x++)
321 void init_per_pixel_matrices()
325 gridx=(double **)malloc(gx * sizeof(double *));
326 gridy=(double **)malloc(gx * sizeof(double *));
328 origx=(double **)malloc(gx * sizeof(double *));
329 origy=(double **)malloc(gx * sizeof(double *));
330 origrad=(double **)malloc(gx * sizeof(double *));
331 origtheta=(double **)malloc(gx * sizeof(double *));
333 x_mesh=(double **)malloc(gx * sizeof(double *));
334 y_mesh=(double **)malloc(gx * sizeof(double *));
335 rad_mesh=(double **)malloc(gx * sizeof(double *));
336 theta_mesh=(double **)malloc(gx * sizeof(double *));
338 sx_mesh=(double **)malloc(gx * sizeof(double *));
339 sy_mesh=(double **)malloc(gx * sizeof(double *));
340 dx_mesh=(double **)malloc(gx * sizeof(double *));
341 dy_mesh=(double **)malloc(gx * sizeof(double *));
342 cx_mesh=(double **)malloc(gx * sizeof(double *));
343 cy_mesh=(double **)malloc(gx * sizeof(double *));
344 zoom_mesh=(double **)malloc(gx * sizeof(double *));
345 zoomexp_mesh=(double **)malloc(gx * sizeof(double *));
346 rot_mesh=(double **)malloc(gx * sizeof(double *));
348 for(x = 0; x < gx; x++)
350 gridx[x] = (double *)malloc(gy * sizeof(double));
351 gridy[x] = (double *)malloc(gy * sizeof(double));
353 origtheta[x] = (double *)malloc(gy * sizeof(double));
354 origrad[x] = (double *)malloc(gy * sizeof(double));
355 origx[x] = (double *)malloc(gy * sizeof(double));
356 origy[x] = (double *)malloc(gy * sizeof(double));
358 x_mesh[x] = (double *)malloc(gy * sizeof(double));
359 y_mesh[x] = (double *)malloc(gy * sizeof(double));
361 rad_mesh[x] = (double *)malloc(gy * sizeof(double));
362 theta_mesh[x] = (double *)malloc(gy * sizeof(double));
364 sx_mesh[x] = (double *)malloc(gy * sizeof(double));
365 sy_mesh[x] = (double *)malloc(gy * sizeof(double));
366 dx_mesh[x] = (double *)malloc(gy * sizeof(double));
367 dy_mesh[x] = (double *)malloc(gy * sizeof(double));
368 cx_mesh[x] = (double *)malloc(gy * sizeof(double));
369 cy_mesh[x] = (double *)malloc(gy * sizeof(double));
371 zoom_mesh[x] = (double *)malloc(gy * sizeof(double));
372 zoomexp_mesh[x] = (double *)malloc(gy * sizeof(double));
374 rot_mesh[x] = (double *)malloc(gy * sizeof(double));
377 //initialize reference grid values
382 origx[x][y]=x/(double)(gx-1);
383 origy[x][y]=-((y/(double)(gy-1))-1);
384 origrad[x][y]=hypot((origx[x][y]-.5)*2,(origy[x][y]-.5)*2) * .7071067;
385 origtheta[x][y]=atan2(((origy[x][y]-.5)*2),((origx[x][y]-.5)*2));
386 gridx[x][y]=origx[x][y]*texsize;
387 gridy[x][y]=origy[x][y]*texsize;
394 //calculate matrices for per_pixel
395 void do_per_pixel_math()
399 double rotx=0,roty=0;
402 if(!isPerPixelEqn(CX_OP))
412 if(!isPerPixelEqn(CY_OP))
423 if(isPerPixelEqn(ROT_OP))
429 x_mesh[x][y]=x_mesh[x][y]-cx_mesh[x][y];
430 y_mesh[x][y]=y_mesh[x][y]-cy_mesh[x][y];
431 rotx=(x_mesh[x][y])*cos(rot_mesh[x][y])-(y_mesh[x][y])*sin(rot_mesh[x][y]);
432 roty=(x_mesh[x][y])*sin(rot_mesh[x][y])+(y_mesh[x][y])*cos(rot_mesh[x][y]);
433 x_mesh[x][y]=rotx+cx_mesh[x][y];
434 y_mesh[x][y]=roty+cy_mesh[x][y];
441 if(!isPerPixelEqn(ZOOM_OP))
447 zoom_mesh[x][y]=zoom;
452 if(!isPerPixelEqn(ZOOMEXP_OP))
458 zoomexp_mesh[x][y]=zoomexp;
469 x_mesh[x][y]=(x_mesh[x][y]-.5)*2;
470 y_mesh[x][y]=(y_mesh[x][y]-.5)*2;
471 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);
472 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);
473 x_mesh[x][y]=(x_mesh[x][y]*.5)+.5;
474 y_mesh[x][y]=(y_mesh[x][y]*.5)+.5;
478 if(isPerPixelEqn(SX_OP))
484 x_mesh[x][y]=((x_mesh[x][y]-cx_mesh[x][y])/sx_mesh[x][y])+cx_mesh[x][y];
489 if(isPerPixelEqn(SY_OP))
495 y_mesh[x][y]=((y_mesh[x][y]-cy_mesh[x][y])/sy_mesh[x][y])+cy_mesh[x][y];
500 if(isPerPixelEqn(DX_OP))
507 x_mesh[x][y]=x_mesh[x][y]-dx_mesh[x][y];
513 if(isPerPixelEqn(DY_OP))
519 y_mesh[x][y]=y_mesh[x][y]-dy_mesh[x][y];
528 void reset_per_pixel_matrices()
536 x_mesh[x][y]=origx[x][y];
537 y_mesh[x][y]=origy[x][y];
538 rad_mesh[x][y]=origrad[x][y];
539 theta_mesh[x][y]=origtheta[x][y];
546 void draw_custom_waves()
550 custom_wave_t *wavecode;
551 glPointSize(texsize/512);
552 //printf("%d\n",wavecode);
553 // more=isMoreCustomWave();
554 // printf("not inner loop\n");
555 while ((wavecode = nextCustomWave()) != NULL)
557 //printf("begin inner loop\n");
558 if(wavecode->enabled==1)
564 //if(wavecode->bUseDots==1) glEnable(GL_LINE_STIPPLE);
565 if (wavecode->bAdditive==0) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
566 else glBlendFunc(GL_SRC_ALPHA, GL_ONE);
567 if (wavecode->bDrawThick==1) glLineWidth(2*texsize/512);
569 // xx= ((pcmdataL[x]-pcmdataL[x-1])*80*fWaveScale)*2;
570 //yy=pcmdataL[x]*80*fWaveScale,-1;
571 //glVertex3f( (wave_x*texsize)+(xx+yy)*cos(45), (wave_y*texsize)+(-yy+xx)*cos(45),-1);
572 // printf("samples: %d\n", wavecode->samples);
574 getPCM(wavecode->value1,wavecode->samples,0,wavecode->bSpectrum,wavecode->smoothing,0);
575 getPCM(wavecode->value2,wavecode->samples,1,wavecode->bSpectrum,wavecode->smoothing,0);
576 // printf("%f\n",pcmL[0]);
577 for(x=0;x<wavecode->samples;x++)
578 {wavecode->value1[x]=wavecode->value1[x]*wavecode->scaling;}
580 for(x=0;x<wavecode->samples;x++)
581 {wavecode->value2[x]=wavecode->value2[x]*wavecode->scaling;}
583 for(x=0;x<wavecode->samples;x++)
584 {wavecode->sample_mesh[x]=((double)x)/((double)(wavecode->samples-1));}
586 // printf("mid inner loop\n");
589 if(!isPerPointEquation("x"))
590 {for(x=0;x<wavecode->samples;x++)
593 if(!isPerPointEquation(Y_POINT_OP))
594 {for(x=0;x<wavecode->samples;x++)
597 if(!isPerPointEquation(R_POINT_OP))
598 {for(x=0;x<wavecode->samples;x++)
599 {cw_r[x]=wavecode->r;}}
600 if(!isPerPointEquation(G_POINT_OP))
601 {for(x=0;x<wavecode->samples;x++)
602 {cw_g[x]=wavecode->g;}}
603 if(!isPerPointEquation(B_POINT_OP))
604 {for(x=0;x<wavecode->samples;x++)
605 {cw_b[x]=wavecode->b;}}
606 if(!isPerPointEquation(A_POINT_OP))
607 {for(x=0;x<wavecode->samples;x++)
608 {cw_a[x]=wavecode->a;}}
610 //put drawing code here
611 if (wavecode->bUseDots==1) glBegin(GL_POINTS);
612 else glBegin(GL_LINE_STRIP);
614 for(x=0;x<wavecode->samples;x++)
616 // 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]);
617 glColor4f(wavecode->r_mesh[x],wavecode->g_mesh[x],wavecode->b_mesh[x],wavecode->a_mesh[x]);
618 glVertex3f(wavecode->x_mesh[x]*texsize,-(wavecode->y_mesh[x]-1)*texsize,-1);
621 glPointSize(texsize/512);
622 glLineWidth(texsize/512);
623 glDisable(GL_LINE_STIPPLE);
624 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
641 double pi = 3.14159265;
642 double start,inc,xval,yval;
643 custom_shape_t *shapecode;
645 while ((shapecode = nextCustomShape()) != NULL)
647 if(shapecode->enabled==1)
649 // printf("drawing shape %f\n",shapecode->ang);
650 shapecode->y=-((shapecode->y)-1);
652 shapecode->rad=shapecode->rad*(texsize*.707*.707*.707*1.04);
653 //Additive Drawing or Overwrite
654 if (shapecode->additive==0) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
655 else glBlendFunc(GL_SRC_ALPHA, GL_ONE);
657 glMatrixMode(GL_MODELVIEW);
661 glTranslatef(texsize*.5,texsize*.5, 0);
662 glScalef(1.0,vw/(double)vh,1.0);
663 glTranslatef((-texsize*.5) ,(-texsize*.5),0);
666 start=.78539+shapecode->ang;
667 inc=(pi*2)/(double)shapecode->sides;
668 xval=shapecode->x*texsize;
669 yval=shapecode->y*texsize;
671 if (shapecode->textured)
673 glMatrixMode(GL_TEXTURE);
677 glTranslatef(.5,.5, 0);
678 if (correction) glScalef(1,vw/(double)vh,1);
680 glRotatef((shapecode->tex_ang*360/6.280), 0, 0, 1);
682 glScalef(1/(shapecode->tex_zoom),1/(shapecode->tex_zoom),1);
684 // glScalef(1,vh/(double)vw,1);
685 glTranslatef((-.5) ,(-.5),0);
686 // glScalef(1,vw/(double)vh,1);
687 glEnable(GL_TEXTURE_2D);
690 glBegin(GL_TRIANGLE_FAN);
692 glColor4f(shapecode->r,shapecode->g,shapecode->b,shapecode->a);
695 glVertex3f(xval,yval,-1);
696 glColor4f(shapecode->r2,shapecode->g2,shapecode->b2,shapecode->a2);
698 for ( i=0;i<shapecode->sides+1;i++)
702 // glColor4f(shapecode->r2,shapecode->g2,shapecode->b2,shapecode->a2);
703 glTexCoord2f(rad2*cos(theta)+.5 ,rad2*sin(theta)+.5 );
704 glVertex3f(shapecode->rad*cos(theta)+xval,shapecode->rad*sin(theta)+yval,-1);
711 glDisable(GL_TEXTURE_2D);
713 glMatrixMode(GL_MODELVIEW);
716 {//Untextured (use color values)
717 //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);
718 //draw first n-1 triangular pieces
719 glBegin(GL_TRIANGLE_FAN);
721 glColor4f(shapecode->r,shapecode->g,shapecode->b,shapecode->a);
723 // glTexCoord2f(.5,.5);
724 glVertex3f(xval,yval,-1);
725 glColor4f(shapecode->r2,shapecode->g2,shapecode->b2,shapecode->a2);
727 for ( i=0;i<shapecode->sides+1;i++)
731 // glColor4f(shapecode->r2,shapecode->g2,shapecode->b2,shapecode->a2);
732 // glTexCoord2f(rad2*cos(theta)+.5 ,rad2*sin(theta)+.5 );
733 glVertex3f(shapecode->rad*cos(theta)+xval,shapecode->rad*sin(theta)+yval,-1);
739 if (bWaveThick==1) glLineWidth(2*texsize/512);
740 glBegin(GL_LINE_LOOP);
741 glColor4f(shapecode->border_r,shapecode->border_g,shapecode->border_b,shapecode->border_a);
742 for ( i=0;i<shapecode->sides;i++)
745 glVertex3f(shapecode->rad*cos(theta)+xval,shapecode->rad*sin(theta)+yval,-1);
748 if (bWaveThick==1) glLineWidth(texsize/512);
764 double offset,scale,dy2_adj;
768 double wave_x_temp=0;
769 double wave_y_temp=0;
771 modulate_opacity_by_volume();
774 if(bWaveDots==1) glEnable(GL_LINE_STIPPLE);
776 offset=(wave_x-.5)*texsize;
780 if (bWaveThick==1) glLineWidth(2*texsize/512);
782 //Additive wave drawing (vice overwrite)
783 if (bAdditiveWaves==0) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
784 else glBlendFunc(GL_SRC_ALPHA, GL_ONE);
792 glTranslatef(texsize*.5,texsize*.5, 0);
793 glRotated(-wave_mystery*90,0,0,1);
795 glTranslatef(-texsize*.5,-texsize*.825, 0);
800 glBegin(GL_LINE_STRIP);
801 glColor4f(1.0-(x/15.0),.5,x/15.0,1.0);
802 glVertex3f((totalframes%256)*2*scale, -beat_val[x]*fWaveScale+texsize*wave_y,-1);
803 glColor4f(.5,.5,.5,1.0);
804 glVertex3f((totalframes%256)*2*scale, texsize*wave_y,-1);
805 glColor4f(1.0,1.0,0,1.0);
806 //glVertex3f((totalframes%256)*scale*2, beat_val_att[x]*fWaveScale+texsize*wave_y,-1);
809 glTranslatef(0,texsize*(1/36.0), 0);
813 glTranslatef(0,texsize*(1/18.0), 0);
816 glBegin(GL_LINE_STRIP);
817 glColor4f(1.0,1.0,0.5,1.0);
818 glVertex3f((totalframes%256)*2*scale, treb_att*5*fWaveScale+texsize*wave_y,-1);
819 glColor4f(.2,.2,.2,1.0);
820 glVertex3f((totalframes%256)*2*scale, texsize*wave_y,-1);
821 glColor4f(1.0,1.0,0,1.0);
822 glVertex3f((totalframes%256)*scale*2, treb*-5*fWaveScale+texsize*wave_y,-1);
825 glTranslatef(0,texsize*.075, 0);
826 glBegin(GL_LINE_STRIP);
827 glColor4f(0,1.0,0.0,1.0);
828 glVertex3f((totalframes%256)*2*scale, mid_att*5*fWaveScale+texsize*wave_y,-1);
829 glColor4f(.2,.2,.2,1.0);
830 glVertex3f((totalframes%256)*2*scale, texsize*wave_y,-1);
831 glColor4f(.5,1.0,.5,1.0);
832 glVertex3f((totalframes%256)*scale*2, mid*-5*fWaveScale+texsize*wave_y,-1);
836 glTranslatef(0,texsize*.075, 0);
837 glBegin(GL_LINE_STRIP);
838 glColor4f(1.0,0,0,1.0);
839 glVertex3f((totalframes%256)*2*scale, bass_att*5*fWaveScale+texsize*wave_y,-1);
840 glColor4f(.2,.2,.2,1.0);
841 glVertex3f((totalframes%256)*2*scale, texsize*wave_y,-1);
842 glColor4f(1.0,.5,.5,1.0);
843 glVertex3f((totalframes%256)*scale*2, bass*-5*fWaveScale+texsize*wave_y,-1);
850 case 0://circular waveforms
854 glTranslatef(texsize*.5,texsize*.5, 0);
855 glScalef(1.0,vw/(double)vh,1.0);
856 glTranslatef((-texsize*.5) ,(-texsize*.5),0);
858 wave_y=-1*(wave_y-1.0);
860 glBegin(GL_LINE_STRIP);
862 for ( x=0;x<numsamples;x++)
864 co= -(abs(x-((numsamples*.5)-1))/numsamples)+1;
865 // printf("%d %f\n",x,co);
866 theta=x*(6.28/numsamples);
867 r= ((1+2*wave_mystery)*(texsize/5.0)+
868 ( co*pcmdataL[x]+ (1-co)*pcmdataL[-(x-(numsamples-1))])
871 glVertex3f(r*cos(theta)+(wave_x*texsize),r*sin(theta)+(wave_y*texsize),-1);
874 r= ( (1+2*wave_mystery)*(texsize/5.0)+
875 (0.5*pcmdataL[0]+ 0.5*pcmdataL[numsamples-1])
878 glVertex3f(r*cos(0)+(wave_x*texsize),r*sin(0)+(wave_y*texsize),-1);
882 glBegin(GL_LINE_LOOP);
884 for ( x=0;x<(512/pcmbreak);x++)
886 theta=(blockstart+x)*((6.28*pcmbreak)/512.0);
887 r= ((1+2*wave_mystery)*(texsize/5.0)+fdata_buffer[fbuffer][0][blockstart+x]*.0025*fWaveScale);
889 glVertex3f(r*cos(theta)+(wave_x*texsize),r*sin(theta)+(wave_y*texsize),-1);
897 case 1://circularly moving waveform
901 glTranslatef(texsize*.5,texsize*.5, 0);
902 glScalef(1.0,vw/(double)vh,1.0);
903 glTranslatef((-texsize*.5) ,(-texsize*.5),0);
905 wave_y=-1*(wave_y-1.0);
907 glBegin(GL_LINE_STRIP);
908 //theta=(frame%512)*(6.28/512.0);
912 co= -(abs(x-255)/512.0)+1;
913 // printf("%d %f\n",x,co);
914 theta=((frame%256)*(2*6.28/512.0))+pcmdataL[x]*.2*fWaveScale;
915 r= ((1+2*wave_mystery)*(texsize/5.0)+
916 (pcmdataL[x]-pcmdataL[x-1])*80*fWaveScale);
918 glVertex3f(r*cos(theta)+(wave_x*texsize),r*sin(theta)+(wave_y*texsize),-1);
927 case 2://EXPERIMENTAL
928 wave_y=-1*(wave_y-1.0);
930 glBegin(GL_LINE_STRIP);
932 // double xr= (wave_x*texsize), yr=(wave_y*texsize);
936 //xx = ((pcmdataL[x]-pcmdataL[x-1])*80*fWaveScale)*2;
937 xx += (pcmdataL[x]*fWaveScale);
938 yy= pcmdataL[x]*80*fWaveScale;
939 // glVertex3f( (wave_x*texsize)+(xx+yy)*2, (wave_y*texsize)+(xx-yy)*2,-1);
940 glVertex3f( (wave_x*texsize)+(xx)*2, (wave_y*texsize)+(yy)*2,-1);
943 // xr+=fdata_buffer[fbuffer][0][x] *.0005* fWaveScale;
944 //yr=(fdata_buffer[fbuffer][0][x]-fdata_buffer[fbuffer][0][x-1])*.05*fWaveScale+(wave_y*texsize);
945 //glVertex3f(xr,yr,-1);
952 case 3://EXPERIMENTAL
954 wave_y=-1*(wave_y-1.0);
955 glBegin(GL_LINE_STRIP);
960 xx= ((pcmdataL[x]-pcmdataL[x-1])*80*fWaveScale)*2;
961 yy=pcmdataL[x]*80*fWaveScale,-1;
962 glVertex3f( (wave_x*texsize)+(xx+yy)*cos(45), (wave_y*texsize)+(-yy+xx)*cos(45),-1);
968 case 4://single x-axis derivative waveform
970 wave_y=-1*(wave_y-1.0);
971 glTranslatef(texsize*.5,texsize*.5, 0);
972 glRotated(-wave_mystery*90,0,0,1);
973 glTranslatef(-texsize*.5,-texsize*.5, 0);
974 wave_x=(wave_x*.75)+.125; wave_x=-(wave_x-1);
975 glBegin(GL_LINE_STRIP);
980 dy_adj= pcmdataL[x]*20*fWaveScale-pcmdataL[x-1]*20*fWaveScale;
981 glVertex3f((x*scale)+dy_adj, pcmdataL[x]*20*fWaveScale+texsize*wave_x,-1);
987 case 5://EXPERIMENTAL
991 wave_y=-1*(wave_y-1.0);
992 wave_x_temp=(wave_x*.75)+.125;
993 wave_x_temp=-(wave_x_temp-1);
994 glBegin(GL_LINE_STRIP);
996 for ( x=1;x<(512);x++)
998 dy2_adj= (pcmdataL[x]-pcmdataL[x-1])*20*fWaveScale;
999 glVertex3f((wave_x_temp*texsize)+dy2_adj*2, pcmdataL[x]*20*fWaveScale+texsize*wave_y,-1);
1005 case 6://single waveform
1010 glTranslatef(0,0, -1);
1012 //glMatrixMode(GL_MODELVIEW);
1014 // glLoadIdentity();
1016 glTranslatef(texsize*.5,texsize*.5, 0);
1017 glRotated(-wave_mystery*90,0,0,1);
1019 wave_x_temp=-2*0.4142*(abs(abs(wave_mystery)-.5)-.5);
1020 glScalef(1.0+wave_x_temp,1.0,1.0);
1021 glTranslatef(-texsize*.5,-texsize*.5, 0);
1022 wave_x_temp=-1*(wave_x-1.0);
1024 glBegin(GL_LINE_STRIP);
1025 // wave_x_temp=(wave_x*.75)+.125;
1026 // wave_x_temp=-(wave_x_temp-1);
1027 for ( x=0;x<numsamples;x++)
1030 //glVertex3f(x*scale, fdata_buffer[fbuffer][0][blockstart+x]*.0012*fWaveScale+texsize*wave_x_temp,-1);
1031 glVertex3f(x*texsize/(double)numsamples, pcmdataR[x]*20*fWaveScale+texsize*wave_x_temp,-1);
1033 //glVertex3f(x*scale, texsize*wave_y_temp,-1);
1035 // printf("%f %f\n",texsize*wave_y_temp,wave_y_temp);
1040 case 7://dual waveforms
1044 glTranslatef(texsize*.5,texsize*.5, 0);
1045 glRotated(-wave_mystery*90,0,0,1);
1047 wave_x_temp=-2*0.4142*(abs(abs(wave_mystery)-.5)-.5);
1048 glScalef(1.0+wave_x_temp,1.0,1.0);
1049 glTranslatef(-texsize*.5,-texsize*.5, 0);
1051 wave_y_temp=-1*(wave_x-1);
1053 glBegin(GL_LINE_STRIP);
1055 for ( x=0;x<numsamples;x++)
1058 glVertex3f((x*texsize)/(double)numsamples, pcmdataL[x]*20*fWaveScale+texsize*(wave_y_temp+(wave_y*wave_y*.5)),-1);
1062 glBegin(GL_LINE_STRIP);
1065 for ( x=0;x<numsamples;x++)
1068 glVertex3f((x*texsize)/(double)numsamples, pcmdataR[x]*20*fWaveScale+texsize*(wave_y_temp-(wave_y*wave_y*.5)),-1);
1075 glBegin(GL_LINE_LOOP);
1077 for ( x=0;x<512;x++)
1079 theta=(x)*(6.28/512.0);
1080 r= (texsize/5.0+pcmdataL[x]*.002);
1082 glVertex3f(r*cos(theta)+(wave_x*texsize),r*sin(theta)+(wave_y*texsize),-1);
1086 glBegin(GL_LINE_STRIP);
1088 for ( x=0;x<512;x++)
1090 glVertex3f(x*scale, pcmdataL[x]*20*fWaveScale+(texsize*(wave_x+.1)),-1);
1094 glBegin(GL_LINE_STRIP);
1096 for ( x=0;x<512;x++)
1098 glVertex3f(x*scale, pcmdataR[x]*20*fWaveScale+(texsize*(wave_x-.1)),-1);
1103 if (bWaveThick==1) glLineWidth(2*texsize/512);
1105 glLineWidth(texsize/512);
1106 glDisable(GL_LINE_STIPPLE);
1110 void maximize_colors()
1112 float wave_r_switch=0,wave_g_switch=0,wave_b_switch=0;
1113 //wave color brightening
1115 //forces max color value to 1.0 and scales
1116 // the rest accordingly
1118 if (bMaximizeWaveColor==1)
1120 if(wave_r>=wave_g && wave_r>=wave_b) //red brightest
1122 wave_b_switch=wave_b*(1/wave_r);
1123 wave_g_switch=wave_g*(1/wave_r);
1126 else if (wave_b>=wave_g && wave_b>=wave_r) //blue brightest
1128 wave_r_switch=wave_r*(1/wave_b);
1129 wave_g_switch=wave_g*(1/wave_b);
1134 else if (wave_g>=wave_b && wave_g>=wave_r) //green brightest
1136 wave_b_switch=wave_b*(1/wave_g);
1137 wave_r_switch=wave_r*(1/wave_g);
1140 glColor4f(wave_r_switch, wave_g_switch, wave_b_switch, wave_o);
1144 glColor4f(wave_r, wave_g, wave_b, wave_o);
1150 void modulate_opacity_by_volume()
1153 //modulate volume by opacity
1155 //set an upper and lower bound and linearly
1156 //calculate the opacity from 0=lower to 1=upper
1157 //based on current volume
1159 if (bModWaveAlphaByVolume==1)
1160 {if (vol<=fModWaveAlphaStart) wave_o=0.0;
1161 else if (vol>=fModWaveAlphaEnd) wave_o=fWaveAlpha;
1162 else wave_o=fWaveAlpha*((vol-fModWaveAlphaStart)/(fModWaveAlphaEnd-fModWaveAlphaStart));}
1163 else wave_o=fWaveAlpha;
1167 void draw_motion_vectors()
1171 double offsetx=mv_dx*texsize, intervalx=texsize/(double)mv_x;
1172 double offsety=mv_dy*texsize, intervaly=texsize/(double)mv_y;
1175 glColor4f(mv_r, mv_g, mv_b, mv_a);
1177 for (x=0;x<mv_x;x++){
1178 for(y=0;y<mv_y;y++){
1179 glVertex3f(offsetx+x*intervalx,offsety+y*intervaly,-1);
1188 //no additive drawing for borders
1189 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1191 glTranslatef(0,0,-1);
1193 double of=texsize*ob_size*.5;
1194 double iff=(texsize*ib_size*.5);
1195 double texof=texsize-of;
1197 glColor4d(ob_r,ob_g,ob_b,ob_a);
1199 glRectd(0,0,of,texsize);
1200 glRectd(of,0,texof,of);
1201 glRectd(texof,0,texsize,texsize);
1202 glRectd(of,texsize,texof,texof);
1203 glColor4d(ib_r,ib_g,ib_b,ib_a);
1204 glRectd(of,of,of+iff,texof);
1205 glRectd(of+iff,of,texof-iff,of+iff);
1206 glRectd(texof-iff,of,texof,texof);
1207 glRectd(of+iff,texof,texof-iff,texof-iff);
1211 //Here we render the interpolated mesh, and then apply the texture to it.
1212 //Well, we actually do the inverse, but its all the same.
1213 void render_interpolation()
1218 glMatrixMode(GL_MODELVIEW);
1220 glTranslated(0, 0, -9);
1222 glColor4f(0.0, 0.0, 0.0,decay);
1224 glEnable(GL_TEXTURE_2D);
1226 for (x=0;x<gx-1;x++)
1228 glBegin(GL_TRIANGLE_STRIP);
1231 glTexCoord4f(x_mesh[x][y], y_mesh[x][y],-1,1); glVertex4f(gridx[x][y], gridy[x][y],-1,1);
1232 glTexCoord4f(x_mesh[x+1][y], y_mesh[x+1][y],-1,1); glVertex4f(gridx[x+1][y], gridy[x+1][y],-1,1);
1236 glDisable(GL_TEXTURE_2D);
1242 //Texture wrapping( clamp vs. wrap)
1245 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
1246 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
1250 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
1251 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
1255 // glRasterPos2i(0,0);
1256 // glClear(GL_COLOR_BUFFER_BIT);
1257 // glColor4d(0.0, 0.0, 0.0,1.0);
1259 // glMatrixMode(GL_TEXTURE);
1260 // glLoadIdentity();
1263 glClear(GL_COLOR_BUFFER_BIT);
1264 glColor4d(0.0, 0.0, 0.0,1.0);
1266 glMatrixMode(GL_TEXTURE);
1269 glTranslatef(cx,cy, 0);
1270 if(correction) glScalef(1,vw/(double)vh,1);
1272 if(!isPerPixelEqn(ROT_OP))
1274 // printf("ROTATING: rot = %f\n", rot);
1275 glRotatef(rot*90, 0, 0, 1);
1277 if(!isPerPixelEqn(SX_OP)) glScalef(1/sx,1,1);
1278 if(!isPerPixelEqn(SY_OP)) glScalef(1,1/sy,1);
1280 if(correction) glScalef(1,vh/(double)vw,1);
1281 glTranslatef((-cx) ,(-cy),0);
1283 if(!isPerPixelEqn(DX_OP)) glTranslatef(-dx,0,0);
1284 if(!isPerPixelEqn(DY_OP)) glTranslatef(0 ,-dy,0);
1289 //Actually draws the texture to the screen
1291 //The Video Echo effect is also applied here
1292 void render_texture_to_screen()
1294 glMatrixMode(GL_TEXTURE);
1297 glMatrixMode(GL_MODELVIEW);
1299 glTranslatef(0, 0, -9);
1301 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1302 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1304 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
1305 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
1307 // glClear(GL_ACCUM_BUFFER_BIT);
1308 glColor4d(0.0, 0.0, 0.0,1.0f);
1311 glVertex4d(-vw*.5,-vh*.5,-1,1);
1312 glVertex4d(-vw*.5, vh*.5,-1,1);
1313 glVertex4d(vw*.5, vh*.5,-1,1);
1314 glVertex4d(vw*.5, -vh*.5,-1,1);
1317 // glBindTexture( GL_TEXTURE_2D, tex2 );
1318 glEnable(GL_TEXTURE_2D);
1320 // glAccum(GL_LOAD,0);
1321 // if (bDarken==1) glBlendFunc(GL_SRC_COLOR,GL_ZERO);
1323 //Draw giant rectangle and texture it with our texture!
1325 glTexCoord4d(0, 1,0,1); glVertex4d(-vw*.5,-vh*.5,-1,1);
1326 glTexCoord4d(0, 0,0,1); glVertex4d(-vw*.5, vh*.5,-1,1);
1327 glTexCoord4d(1, 0,0,1); glVertex4d(vw*.5, vh*.5,-1,1);
1328 glTexCoord4d(1, 1,0,1); glVertex4d(vw*.5, -vh*.5,-1,1);
1331 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1333 // if (bDarken==1) glBlendFunc(GL_SRC_COLOR,GL_ONE_MINUS_SRC_ALPHA);
1335 // if (bDarken==1) { glAccum(GL_ACCUM,1-fVideoEchoAlpha); glBlendFunc(GL_SRC_COLOR,GL_ZERO); }
1337 glMatrixMode(GL_TEXTURE);
1340 glColor4f(0.0, 0.0, 0.0,fVideoEchoAlpha);
1341 glTranslated(.5,.5,0);
1342 glScaled(1/fVideoEchoZoom,1/fVideoEchoZoom,1);
1343 glTranslated(-.5,-.5,0);
1345 int flipx=1,flipy=1;
1346 switch (((int)nVideoEchoOrientation))
1348 case 0: flipx=1;flipy=1;break;
1349 case 1: flipx=-1;flipy=1;break;
1350 case 2: flipx=1;flipy=-1;break;
1351 case 3: flipx=-1;flipy=-1;break;
1352 default: flipx=1;flipy=1; break;
1355 glTexCoord4d(0, 1,0,1); glVertex4f(-vw*.5*flipx,-vh*.5*flipy,-1,1);
1356 glTexCoord4d(0, 0,0,1); glVertex4f(-vw*.5*flipx, vh*.5*flipy,-1,1);
1357 glTexCoord4d(1, 0,0,1); glVertex4f(vw*.5*flipx, vh*.5*flipy,-1,1);
1358 glTexCoord4d(1, 1,0,1); glVertex4f(vw*.5*flipx, -vh*.5*flipy,-1,1);
1362 glDisable(GL_TEXTURE_2D);
1363 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1365 // if (bDarken==1) { glAccum(GL_ACCUM,fVideoEchoAlpha); glAccum(GL_RETURN,1);}
1369 glColor4f(1.0, 1.0, 1.0,1.0);
1370 glBlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ZERO);
1372 glVertex4f(-vw*.5*flipx,-vh*.5*flipy,-1,1);
1373 glVertex4f(-vw*.5*flipx, vh*.5*flipy,-1,1);
1374 glVertex4f(vw*.5*flipx, vh*.5*flipy,-1,1);
1375 glVertex4f(vw*.5*flipx, -vh*.5*flipy,-1,1);
1377 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1382 void render_texture_to_studio()
1384 glMatrixMode(GL_TEXTURE);
1387 glMatrixMode(GL_MODELVIEW);
1389 glTranslatef(0, 0, -9);
1391 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1392 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1394 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
1395 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
1397 // glClear(GL_ACCUM_BUFFER_BIT);
1398 glColor4f(0.0, 0.0, 0.0,0.04);
1400 glVertex4d(-vw*.5,-vh*.5,-1,1);
1401 glVertex4d(-vw*.5, vh*.5,-1,1);
1402 glVertex4d(vw*.5, vh*.5,-1,1);
1403 glVertex4d(vw*.5, -vh*.5,-1,1);
1406 glColor4f(0.0, 0.0, 0.0,1.0);
1409 glVertex4d(-vw*.5,0,-1,1);
1410 glVertex4d(-vw*.5, vh*.5,-1,1);
1411 glVertex4d(vw*.5, vh*.5,-1,1);
1412 glVertex4d(vw*.5, 0,-1,1);
1416 glVertex4d(0,-vh*.5,-1,1);
1417 glVertex4d(0, vh*.5,-1,1);
1418 glVertex4d(vw*.5, vh*.5,-1,1);
1419 glVertex4d(vw*.5, -vh*.5,-1,1);
1423 glTranslatef(.25*vw, .25*vh, 0);
1426 // glBindTexture( GL_TEXTURE_2D, tex2 );
1427 glEnable(GL_TEXTURE_2D);
1429 // glAccum(GL_LOAD,0);
1430 // if (bDarken==1) glBlendFunc(GL_SRC_COLOR,GL_ZERO);
1432 //Draw giant rectangle and texture it with our texture!
1434 glTexCoord4d(0, 1,0,1); glVertex4d(-vw*.5,-vh*.5,-1,1);
1435 glTexCoord4d(0, 0,0,1); glVertex4d(-vw*.5, vh*.5,-1,1);
1436 glTexCoord4d(1, 0,0,1); glVertex4d(vw*.5, vh*.5,-1,1);
1437 glTexCoord4d(1, 1,0,1); glVertex4d(vw*.5, -vh*.5,-1,1);
1440 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1442 // if (bDarken==1) glBlendFunc(GL_SRC_COLOR,GL_ONE_MINUS_SRC_ALPHA);
1444 // if (bDarken==1) { glAccum(GL_ACCUM,1-fVideoEchoAlpha); glBlendFunc(GL_SRC_COLOR,GL_ZERO); }
1446 glMatrixMode(GL_TEXTURE);
1449 glColor4f(0.0, 0.0, 0.0,fVideoEchoAlpha);
1450 glTranslated(.5,.5,0);
1451 glScaled(1/fVideoEchoZoom,1/fVideoEchoZoom,1);
1452 glTranslated(-.5,-.5,0);
1454 int flipx=1,flipy=1;
1455 switch (((int)nVideoEchoOrientation))
1457 case 0: flipx=1;flipy=1;break;
1458 case 1: flipx=-1;flipy=1;break;
1459 case 2: flipx=1;flipy=-1;break;
1460 case 3: flipx=-1;flipy=-1;break;
1461 default: flipx=1;flipy=1; break;
1464 glTexCoord4d(0, 1,0,1); glVertex4f(-vw*.5*flipx,-vh*.5*flipy,-1,1);
1465 glTexCoord4d(0, 0,0,1); glVertex4f(-vw*.5*flipx, vh*.5*flipy,-1,1);
1466 glTexCoord4d(1, 0,0,1); glVertex4f(vw*.5*flipx, vh*.5*flipy,-1,1);
1467 glTexCoord4d(1, 1,0,1); glVertex4f(vw*.5*flipx, -vh*.5*flipy,-1,1);
1470 glDisable(GL_TEXTURE_2D);
1471 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1473 // if (bDarken==1) { glAccum(GL_ACCUM,fVideoEchoAlpha); glAccum(GL_RETURN,1);}
1478 glColor4f(1.0, 1.0, 1.0,1.0);
1479 glBlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ZERO);
1481 glVertex4f(-vw*.5*flipx,-vh*.5*flipy,-1,1);
1482 glVertex4f(-vw*.5*flipx, vh*.5*flipy,-1,1);
1483 glVertex4f(vw*.5*flipx, vh*.5*flipy,-1,1);
1484 glVertex4f(vw*.5*flipx, -vh*.5*flipy,-1,1);
1486 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1489 // glTranslated(.5,.5,0);
1490 // glScaled(1/fVideoEchoZoom,1/fVideoEchoZoom,1);
1491 // glTranslated(-.5,-.5,0);
1492 //glTranslatef(0,.5*vh,0);
1495 //glBlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ZERO);
1497 glMatrixMode(GL_MODELVIEW);
1500 glTranslatef(.25*vw, -.25*vh, 0);
1502 glColor4f(1,1,1,.6);
1506 glBegin(GL_LINE_STRIP);
1509 glVertex4f((x_mesh[x][y]-.5)* vw, (y_mesh[x][y]-.5)*vh,-1,1);
1510 //glVertex4f((origx[x+1][y]-.5) * vw, (origy[x+1][y]-.5) *vh ,-1,1);
1517 glBegin(GL_LINE_STRIP);
1520 glVertex4f((x_mesh[x][y]-.5)* vw, (y_mesh[x][y]-.5)*vh,-1,1);
1521 //glVertex4f((origx[x+1][y]-.5) * vw, (origy[x+1][y]-.5) *vh ,-1,1);
1527 for (x=0;x<gx-1;x++){
1530 glVertex4f((origx[x][y]-.5)* vw, (origy[x][y]-.5)*vh,-1,1);
1531 glVertex4f((origx[x+1][y]-.5) * vw, (origy[x+1][y]-.5) *vh ,-1,1);
1536 // glTranslated(-.5,-.5,0); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1537 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1538 glMatrixMode(GL_MODELVIEW);
1541 glTranslatef(-.5*vw,0, 0);
1544 glTranslatef(0,-vh*.10, 0);
1545 glBegin(GL_LINE_STRIP);
1546 glColor4f(0,1.0,1.0,1.0);
1547 glVertex3f((((totalframes%256)/551.0))*vw, treb_att*-7,-1);
1548 glColor4f(1.0,1.0,1.0,1.0);
1549 glVertex3f((((totalframes%256)/551.0))*vw,0 ,-1);
1550 glColor4f(.5,1.0,1.0,1.0);
1551 glVertex3f((((totalframes%256)/551.0))*vw, treb*7,-1);
1554 glTranslatef(0,-vh*.13, 0);
1555 glBegin(GL_LINE_STRIP);
1556 glColor4f(0,1.0,0.0,1.0);
1557 glVertex3f((((totalframes%256)/551.0))*vw, mid_att*-7,-1);
1558 glColor4f(1.0,1.0,1.0,1.0);
1559 glVertex3f((((totalframes%256)/551.0))*vw,0 ,-1);
1560 glColor4f(.5,1.0,0.0,0.5);
1561 glVertex3f((((totalframes%256)/551.0))*vw, mid*7,-1);
1564 glTranslatef(0,-vh*.13, 0);
1565 glBegin(GL_LINE_STRIP);
1566 glColor4f(1.0,0.0,0.0,1.0);
1567 glVertex3f((((totalframes%256)/551.0))*vw, bass_att*-7,-1);
1568 glColor4f(1.0,1.0,1.0,1.0);
1569 glVertex3f((((totalframes%256)/551.0))*vw,0 ,-1);
1570 glColor4f(.7,0.2,0.2,1.0);
1571 glVertex3f((((totalframes%256)/551.0))*vw, bass*7,-1);
1574 glTranslatef(0,-vh*.13, 0);
1577 glColor4f(1.0,1.0,1.0,1.0);
1578 glVertex3f((((totalframes%256)/551.0))*vw,0 ,-1);
1579 glColor4f(1.0,0.6,1.0,1.0);
1580 glVertex3f((((totalframes%256)/551.0))*vw, vol*7,-1);