• 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
Re: [NSSound isPlaying] fails to indicate sound termination in Lion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NSSound isPlaying] fails to indicate sound termination in Lion


  • Subject: Re: [NSSound isPlaying] fails to indicate sound termination in Lion
  • From: Ken Thomases <email@hidden>
  • Date: Sun, 22 Jul 2012 20:03:47 -0500

On Jul 22, 2012, at 7:43 PM, Jay Reynolds Freeman wrote:

> The "sleep" was only for instrumentation; without the sleep and the NSLog, the code exhibits the problem described.  And [NSSound play] is supposed to run asynchronously ...

You didn't pay attention to what Fritz wrote.  You need to allow flow of execution to leave your code and return to the framework, so that the framework can run the main event loop.  In all probability, NSSound needs to receive an external notification or event to realize that the sound has finished playing.  It probably receives that notification/event via a run-loop source scheduled on the main thread's run loop.

There's no good reason for you to loop, polling for the sound's completion.  Use the asynchronously-delivered delegate method, as Fritz suggested.

Regards,
Ken


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: [NSSound isPlaying] fails to indicate sound termination in Lion
      • From: Jay Reynolds Freeman <email@hidden>
References: 
 >[NSSound isPlaying] fails to indicate sound termination in Lion (From: Jay Reynolds Freeman <email@hidden>)
 >Re: [NSSound isPlaying] fails to indicate sound termination in Lion (From: Fritz Anderson <email@hidden>)
 >Re: [NSSound isPlaying] fails to indicate sound termination in Lion (From: Jay Reynolds Freeman <email@hidden>)

  • Prev by Date: Re: [NSSound isPlaying] fails to indicate sound termination in Lion
  • Next by Date: Re: [NSSound isPlaying] fails to indicate sound termination in Lion
  • Previous by thread: Re: [NSSound isPlaying] fails to indicate sound termination in Lion
  • Next by thread: Re: [NSSound isPlaying] fails to indicate sound termination in Lion
  • Index(es):
    • Date
    • Thread