• 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: simple(?) NSSound selector not recognized error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: simple(?) NSSound selector not recognized error


  • Subject: Re: simple(?) NSSound selector not recognized error
  • From: "Shawn Erickson" <email@hidden>
  • Date: Thu, 16 Aug 2007 11:55:53 -0700

On 8/16/07, Russ McBride <email@hidden> wrote:
>
>
> Thanks for the reply Shawn.  This seems like it should be really simple, but
> I still can't seem to figure out why I'm getting a "selector not recognized"
> error when I try to pause a playing sound.  When I pause a playing built-in
> system sound everything works find.  But I get the error when I try to pause
> a playing sound for a local file.
>
> I'll provide a bit more code:

(on a side note your questions aren't related to Core Audio and likely
should be directed to the Cocoa-Dev list)

You are getting bitten by a basic memory management issue. Read at
least the following to save yourself pain / time in the future...

<http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmPractical.html>

> - (void)setTheSound:(NSSound *)newSound
> {
>     theSound = newSound;
>     [theSound setDelegate:self];
> }

The above code is the problem since it doesn't make any attempts to
ensure the object set stays around. If was implemented as follows your
issue should go away...

- (void)setTheSound:(NSSound *)newSound
{
    if (newSound != theSound) {
        [theSound release];
        theSound = [newSound retain];
        [theSound setDelegate:self];
    }
 }

...because your setTheSound method isn't currently doing something
like the above the following lines are the source of your problem...

    selectedSound = [NSSound soundNamed:selectedSoundAsString];
    [self setTheSound:selectedSound];

-Shawn
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >simple(?) NSSound selector not recognized error (From: Russ McBride <email@hidden>)
 >Re: simple(?) NSSound selector not recognized error (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Re: Aggregate device problems
  • Next by Date: Re: MIDI Plugin exclusive access
  • Previous by thread: Re: simple(?) NSSound selector not recognized error
  • Next by thread: Re: simple(?) NSSound selector not recognized error
  • Index(es):
    • Date
    • Thread