Re: Sample player streaming from disk
Re: Sample player streaming from disk
- Subject: Re: Sample player streaming from disk
- From: Kurt Revis <email@hidden>
- Date: Tue, 2 Sep 2003 09:21:06 -0700
On Tuesday, September 2, 2003, at 04:55 AM, Cesare Ferrari wrote:
I've got a sample player engine which is working as an AU, but one of
the
features i've yet to implement on OSX is disk streaming of sample data.
Now I could use the old OS9 async disk I/O calls, but I was wondering
if
there was a nice OSX (BSD maybe) way. The thing is, i don't need OS9
compatibility, and the old async calls are rather ugly, and i'm not
sure how
they actually behave under OSX given that they will need to be layered
on
top of something lower level.
Anyone got any advice about how to go about this in OSX land?
You can use a separate thread to do the disk I/O, which communicates
with the audio I/O thread via some kind of buffer. Here's how I did it:
http://www.snoize.com/Code/PlayBufferedSoundFile.tar.gz
The code has lots of comments and references to earlier discussions on
this list.
Carbon file manager calls always go through the POSIX file layer, so if
you want maximum performance, just use the POSIX calls in the first
place. Carbon's asynchronous file I/O just does regular synchronous
I/O in a separate thread -- and it only uses one for your whole
process! You can probably do better than that.
http://developer.apple.com/technotes/tn/tn2028.html (scroll down to
the section "Carbon and Interrupts")
--
Kurt Revis
email@hidden
_______________________________________________
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.