• 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: Polling Callback, Threads [Attn: Michael Thornburgh]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Polling Callback, Threads [Attn: Michael Thornburgh]


  • Subject: Re: Polling Callback, Threads [Attn: Michael Thornburgh]
  • From: Daniel Todd Currie <email@hidden>
  • Date: Thu, 11 Dec 2003 15:04:31 -0800

A fine suggestion, but I think it is the 2nd issue that concerns me the most, as I will be updating my UI about 4 times per second.


On 2003 Dec 11, at 14:12, john wrote:

Hi Daniel,

If I may present a possible solution to Michael's problem #1.

You can create the NSData object in the init or awakeFromNib methods in your class with the size you'll need for your ioproc audio data. This way you won't need to create the objc object for the ioproc, rather just use what already is allocated.

-- John


there are risks doing it that way. the two main ones are:

1) it is recommended that you not allocate memory (which means, no creating objc objects, including NSData objects) during the IOProc. this is because the memory allocation operation can wait on locks that may potentially be locked for extended periods, if lots of paging or swapping has to happen to accommodate your allocation request or allocation requests that may be happening in different threads. that can cause your IOProc to overload/glitch.

2) that way provides no discard-when-too-busy mechanism. if doing your DSP and updating the display, along with whatever else is going on on the computer, takes longer (on average) than the length of time represented by the buffer, then you'll get farther and farther behind AND use more and more memory. neither one of those is desirable.

-mike


-[NSObject performSelectorOnMainThread:withObject:waitUntilDone:]

I didn't realize this method exists...

Can't i just make my audio buffer into an NSData and shoot it out with the performSelectorOnMainThread method, setting waitUntilDone:NO? I tried it and it seems to run great. Are there risks involved in this simple solution?
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

References: 
 >Polling Callback, Threads [Attn: Michael Thornburgh] (From: Daniel Todd Currie <email@hidden>)
 >Re: Polling Callback, Threads [Attn: Michael Thornburgh] (From: Michael Thornburgh <email@hidden>)
 >Re: Polling Callback, Threads [Attn: Michael Thornburgh] (From: Daniel Todd Currie <email@hidden>)
 >Re: Polling Callback, Threads [Attn: Michael Thornburgh] (From: Michael Thornburgh <email@hidden>)
 >Re: Polling Callback, Threads [Attn: Michael Thornburgh] (From: john <email@hidden>)

  • Prev by Date: Re: HALLab errors
  • Next by Date: Re: Drum Kits in Apple's DLS Synth
  • Previous by thread: Re: Polling Callback, Threads [Attn: Michael Thornburgh]
  • Next by thread: Re: Polling Callback, Threads [Attn: Michael Thornburgh]
  • Index(es):
    • Date
    • Thread