• 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: At my wits end with NSSound!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: At my wits end with NSSound!


  • Subject: Re: At my wits end with NSSound!
  • From: Ryan Bates <email@hidden>
  • Date: Tue, 10 Feb 2004 21:16:15 -0800

I have the same problem, but in my case it's not too big of a deal. If you are developing a game I suggest using Quicktime or CoreAudio. There's really not a whole lot you can do when it comes to NSSound - you can't even change the volume.

There was a short discussion about it at cocoadev.com. I don't know if it'll help or not, but worth a look:
<http://www.cocoadev.com/index.pl?PreloadASound>

Ryan

On Feb 10, 2004, at 7:54 PM, Mike Brinkman wrote:

I've tried everything I can think of and I still can't get the first sound
in my program to play without a delay. A search of the mailing list archive
turns up nothing of value.

I've tried:

mySound = [[NSSound soundNamed:@"aSound"] retain];

Then

[mySound play];

I've also tried to create a bundle, and init a sound with a path for a
resource:

mainBundle = [NSBundle mainBundle];
NSString *aSound = [mainBundle pathForResource:@"aSound" ofType:@"wav"];
mySound = [[NSSound alloc] initWithContentsOfFile:aSound byReference:NO];

Somebody here told me that the problem was that my sound was a .wav file, so
I converted it to .aiff using Quicktime, still to no avail.

I tried loading the sounds into an NSDictionary and then playing them as
such because somebody else here told me this would force them to be loaded:

[[sounds objectForKey:@"mySound"] play];

I'm using 10.2.8 & Project Builder v. 2.0.1 w/the August 2003 & October 2003
patches.

Sorry for the rant, but I've been trying to figure this out off and on for a
few weeks now, and it is extremely frustrating. Is there something I'm doing
wrong, or is there some sort of glitch with NSSound.

I was planning on doing a write-up for iDevGames about my experience
developing my first Cocoa game program, is there at least some explanation
for why there is a delay for the first time sounds are played?
_______________________________________________
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.
_______________________________________________
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: At my wits end with NSSound!
      • From: Mike Brinkman <email@hidden>
References: 
 >At my wits end with NSSound! (From: Mike Brinkman <email@hidden>)

  • Prev by Date: Re: Getting an NSString out of an NSTextView;
  • Next by Date: Re: Making the correct button the default button?
  • Previous by thread: Re: At my wits end with NSSound!
  • Next by thread: Re: At my wits end with NSSound!
  • Index(es):
    • Date
    • Thread