• 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 truncates the beginnings of sounds
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSound truncates the beginnings of sounds


  • Subject: Re: NSSound truncates the beginnings of sounds
  • From: "Alastair J.Houghton" <email@hidden>
  • Date: Thu, 18 Sep 2003 09:11:49 +0100

On Thursday, September 18, 2003, at 01:06 am, John Stiles wrote:

I've begun to notice that NSSound will often drop the beginning of a sound effect.
Imagine a user in my app clicks a button which is supposed to play a noise and simultaneously make a sheet drop down. Here's an example of what I'm trying to do with NSSound:

static NSSound *mySoundEffect = [[NSSound alloc] initWithContentsOfFile:@"sound.wav" byReference:NO];
[mySoundEffect play];
[NSApp beginSheet:_mySheet modalForWindow:_myWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:NULL];
Imagine the sheet-dropping takes 3/4s of a second; in that case, the first 3/4ths of a second worth of sound will not be played.

Are you using a PowerBook, by any chance? Apple turn-off the sound hardware after a certain amount of time, and it doesn't come back to life immediately. You can tell if this is the problem, because the sound hardware only gets switched-off after a period of inactivity, so if this is what's giving you grief, you should find that if you play two sounds in succession, only the first one gets clipped. If this does turn out to be the problem, I imagine it's possible to make the sound hardware stay active somehow, although you'll have to search the docs.

Failing that, you could try using Core Audio instead, although that looks a bit more complicated.

Kind regards,

Alastair.
_______________________________________________
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: NSSound truncates the beginnings of sounds
      • From: John Stiles <email@hidden>
References: 
 >NSSound truncates the beginnings of sounds (From: John Stiles <email@hidden>)

  • Prev by Date: Re: OpenGL performance (Cocoa)
  • Next by Date: NSDraggingInfo to DragRef
  • Previous by thread: NSSound truncates the beginnings of sounds
  • Next by thread: Re: NSSound truncates the beginnings of sounds
  • Index(es):
    • Date
    • Thread