• 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: Playing sound effect in thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Playing sound effect in thread


  • Subject: Re: Playing sound effect in thread
  • From: Jörn Salewski <email@hidden>
  • Date: Fri, 30 Jan 2004 12:41:20 +0100

am 30.01.2004 12:10 Uhr schrieb Rick Anderson unter email@hidden:

> I'm working on an application that simulates the flipping of a page
> visually and I wanted to add sound of a page flip when the user does
> this. Initially, when I first added the sound effect, the sound didn't
> work as smoothly as I had intended and the sound was holding up the
> page flip visual. So I placed the sound code in a thread to see if that
> would help.

AFAIK NSSound plays the sound in a secondary thread anyway. So there
shouldn't be any reason to wrap it up in an extra thread.

> It did somewhat, but it still seems jerky and it
> occasionally pauses for a half-second or so before anything happens.

Apparently, quite many others encountered the same problem. In fact only a
few days ago a similar question has been asked on the list:

http://cocoa.mamasam.com/COCOADEV/2004/01/2/81978.php

I think it's a bug, and I'm afraid that I cannot give a proper solution
(despite some vague reflections that I made in the aforementioned archived
thread.)


>
> thePageFlipSound = [[NSSound alloc]
> initWithContentsOfFile:[[NSBundle mainBundle]
> pathForSoundResource:@"pageturn-short.wav"] byReference:NO];
>

You could try to use a different sound format. Maybe it turnes out to have
any impact on your problem.

Yours,

Joern Salewski
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Playing sound effect in thread
      • From: Rick Anderson <email@hidden>
References: 
 >Playing sound effect in thread (From: Rick Anderson <email@hidden>)

  • Prev by Date: Re: Pausing workspace actions
  • Next by Date: Re: Any new/updated Cocoa books soon?
  • Previous by thread: Playing sound effect in thread
  • Next by thread: Re: Playing sound effect in thread
  • Index(es):
    • Date
    • Thread