• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Best way to "sleep" and redraw
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: Re: How do you use the space key as a key equivalent
  • Next by Date: NS(Array)Controller and To-Many Relationships (how to add objects from one to another)
  • Previous by thread: Re: How do you use the space key as a key equivalent
  • Next by thread: Re: Best way to "sleep" and redraw
  • Index(es):
    • Date
    • Thread