Skip to content

Commit 5dfb6f2

Browse files
committed
resolved issues with statusbar & exit issue in 1st effect
1 parent c96c296 commit 5dfb6f2

File tree

3 files changed

+17
-29
lines changed

3 files changed

+17
-29
lines changed

effects.cpp

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void bars()
1919
glColor3f(1,((50-i)*10)/255.0,0);
2020
else
2121
glColor3f(1,0,(abs(50-i))*10/255.0);
22-
if((int)avgarr.size()<=j)
22+
if((int)avgarr.size()-2<=j)
2323
exit(0);
2424
float x=-60+(i+i),y=avgarr[j][i],z=-4;
2525
//end of music data
@@ -31,8 +31,13 @@ void bars()
3131
glVertex3f(x-d,0,z); //-x,y=0,z
3232
glEnd();
3333
}
34-
j++;
35-
Sleep(97);
34+
//sync3
35+
if( curtime > (j*100+100))
36+
{
37+
j++;
38+
//cout<<"arr_sz: "<<(int)avgarr.size()<<" j:"<<j<<" cur time:"<<curtime<<endl;
39+
//sync++;
40+
}
3641
}
3742

3843
/******************* CIRCLE3D **********************/
@@ -157,24 +162,14 @@ void circle3d()
157162
//deg+=5.625;
158163
}
159164

160-
// sync3
165+
//sync3
161166
if( curtime > (j*100+100))
162167
{
163168
j++;
164169
//cout<<"arr_sz: "<<(int)avgarr.size()<<" j:"<<j<<" cur time:"<<curtime<<endl;
165-
//sync++;
166170
}
167-
168-
// sync1
169-
// while((int)sound.getPlayingOffset().asSeconds()<(i*100+100)){
170-
// Sleep(1);
171-
// }
172-
173-
// sync2
174-
// Sleep(97);
175-
// j++;
176-
// cout<<"arr_sz: "<<(int)avgarr.size()<<" j:"<<j<<endl;
177171
}
172+
178173
/******************* PENTAGON **********************/
179174
void pentagon()
180175
{
@@ -203,13 +198,9 @@ void pentagon()
203198
{
204199
j++;
205200
//cout<<"arr_sz: "<<(int)avgarr.size()<<" j:"<<j<<" cur time:"<<curtime<<endl;
206-
//sync++;
207201
}
208-
// j++;
209-
// Sleep(97);
210202
}
211203

212-
213204
/******************* CUBICAL_MESH **********************/
214205
/*
215206
void CubicalMesh()
@@ -366,10 +357,7 @@ void waves()
366357
{
367358
j++;
368359
//cout<<"arr_sz: "<<(int)avgarr.size()<<" j:"<<j<<" cur time:"<<curtime<<endl;
369-
//sync++;
370360
}
371-
// j++;
372-
// Sleep(97);
373361
}
374362

375363
/******************* DWaves **********************/

headers.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ extern vector< array<double,60> > avgarr; //for average value
3535
extern double SAMPLE_COUNT;
3636
extern double SAMPLE_RATE;
3737
extern float curtime;
38-
extern int sync;
3938
extern kiss_fft_cpx in[N], out[N];
4039

4140
void circle3d();

main.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ int styleselect=0;
2626
int NO_STYLE=5;
2727
int countr=0,countg=0,countb=0;
2828
float curtime;
29-
int sync=0;
3029

3130
static timestamp_t
3231
get_timestamp ()
@@ -180,7 +179,8 @@ void processSpecialKeys(int key, int x, int y)
180179
countb-=5;
181180
break;
182181
case GLUT_KEY_F11:
183-
glutFullScreenToggle();
182+
glutFullScreen();
183+
//glutFullScreenToggle();
184184
break;
185185
}
186186
}
@@ -231,10 +231,11 @@ void display(void)
231231
else
232232
{
233233
std::ostringstream ss;
234-
float tottime = (int)buffer.getDuration().asSeconds();
235-
curtime = (int)sound.getPlayingOffset().asMilliseconds();
236-
float timepercent = ((curtime/1000)/tottime)*758;
237-
ss << (int)(curtime/1000);
234+
float tottime = buffer.getDuration().asSeconds();
235+
float cursor = sound.getPlayingOffset().asSeconds();
236+
curtime = sound.getPlayingOffset().asMilliseconds();
237+
float timepercent = (cursor/tottime)*760;
238+
ss << (int)cursor;
238239
const std::string tmp = "Time : " + ss.str();
239240
const char* cstr = tmp.c_str();
240241
glClearColor(0,0,0,0);

0 commit comments

Comments
 (0)