Best way to "sleep" and redraw
Best way to "sleep" and redraw
- Subject: Best way to "sleep" and redraw
- From: Robbie Haertel <email@hidden>
- Date: Sat, 5 Feb 2005 13:36:51 -0700
I'm writing an app in which I need to display a picture, play a sound
file related to that picture and when the sound is done playing,
switch to the next picture.
So far, I have run into several problems. First, isPlaying in NSImage
apparently doesn't awlays work from what I've seen in other posts.
Even using the delegate doesn't seem to always work. I am doing the
code in Java, and I'm not even sure the delegate method
soundDidFinishPlaying() even gets called.
So...at first I had a while (sound.isPlaying()) Thread.sleep(250), but
since isPlaying doesn't work this causes an infinite loop.
Then, I just settled for a 5 sec pause (Thread.sleep(5000)), but this
doesn't allow events to get through and the picture never draws.
What is the best way to "pause" the program while I wait for the sound
to finish but still ensure the picture draws? Any tips on figuring
out when the sound file is done playing?
Thanks in advance!
Robbie
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden