Re: What sort of timer should I use for my sequencer?
Re: What sort of timer should I use for my sequencer?
- Subject: Re: What sort of timer should I use for my sequencer?
- From: Brian Willoughby <email@hidden>
- Date: Sat, 29 Jan 2011 16:05:49 -0800
Also, don't be afraid to read the "man" pages for the system API that
you're using to set priority. You might want to find some of Apple's
overviews about OSX to learn more about threading in general. A lot
of the programming issues that come up when writing your first
CoreAudio program really have little to do with CoreAudio, so you
have to be willing to look elsewhere for answers to some of the
questions. Or, at the very least, you have to be willing to read
documentation for parts of OSX besides just CoreAudio.
Unfortunately, there isn't a simple system call in OSX that says:
"Make the priority just perfect for my audio processing thread." If
you search the archives of this mailing list, though, you'll see
extensive discussions of thread priority and the consequences of
getting it wrong.
Brian Willoughby
Sound Consulting
On Jan 29, 2011, at 15:50, Morgan Packard wrote:
Thanks Brian,
So, setting the priority to one million isn't going to help :)
-m-
On Sat, Jan 29, 2011 at 4:49 PM, Brian Willoughby
<email@hidden> wrote:
You should not use the highest priority. If you just blindly
crank up the
priority then you'll either make the rest of the system perform
poorly, or
you'll get busted and the system will demote your priority as
punishment.
Instead, you should use fixed priority.
Also, I seem to recall that priority is relative, so 0 priority is
probably
not the lowest, but normal. I think you can have positive and
negative
priorities. Plus, the system will alter your priority if your
code behaves
poorly. There should be tons of information in the comments of
the various
CoreAudio samples about just this sort of thing.
On Jan 29, 2011, at 12:08, Morgan Packard wrote:
I set it to highest priority -- 1. It's working well now, but not
100%
perfectly. I'm pretty sure the last time I tested it, I got a few
glitches as the app was entering the background.
2011/1/29 Morgan Packard <email@hidden>:
I've managed to move my audio generation code out of the RemoteIO
callback thread. I'm now writing to a buffer on a separate thread,
using a while loop and [NSThread sleepForTimeInterval:] on a new
thread (NSThread detachNewThreadSelector). It took me a minute to
figure out that I need to set the priority on the thread. Seems
that
the default priority is zero, so I was getting many more
glitches than
I was with my objective-c selectors in the remote io callback
thread!
_______________________________________________
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