We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Visualization loads 20 seconds later than Music
Page Index Toggle Pages: 1
Visualization loads 20 seconds later than Music (Read 310 times)
Visualization loads 20 seconds later than Music
Feb 12th, 2010, 12:19am
 
Hi Everybody,

I am making a music visualization application using processing. The thing is that it is quite high resolution (1440x900 at 30 fps) ... so when i run the application in Present mode on a Macbook pro, the music starts playing, but I see the visualization after about 20-30 seconds. Till that, the screen is gray and shows some text at the corner saying "Stop".

My question is:

1. How do I avoid this from happening? ... Is there a way for me to start showing the visualization only when the music starts playing?

2. I also want to add a start/loading screen, which shows some kind of loading animation while the music and the visualization load. Kind of like in flash.

3. Also, is there a way for me to execute the draw function or the visualization by using a keypress or mousepress?
Re: Visualization loads 20 seconds later than Music
Reply #1 - Feb 12th, 2010, 1:00am
 
1)
boolean playNow = false;
void setup(){
...
playNow = true;
}
void draw(){
if( playNow ){
startMusic();
playNow = false;
}
...
}

2)
That depends. How are you loading the music and data for the visualization? If you're doing it in setup(), no, it's not easy.

3)
boolean drawActivated = false;
void draw(){
if( !drawActivated ){ return; }
...
}
void mousePressed(){
drawActivated = true;
...
}
Page Index Toggle Pages: 1