Re: PlayFile
Re: PlayFile
- Subject: Re: PlayFile
- From: William Stewart <email@hidden>
- Date: Mon, 12 Dec 2005 10:51:58 -0800
If you are using the PlayFile example, then it should be sufficient
to just return from your button action after calling AUGraphStart -
there's no blocking going on (which is why we have to add the usleep
in the command line version, otherwise the code would just continue
and quit before it actually had the time to play the file)
Bill
On 09/12/2005, at 11:36 PM, Michael Hanna wrote:
I have a
-(IBAction)playFileNow:(id)sender
which is called from the nsbutton. It essentially does what the main
() function does in PlayFile.cpp. Upon clicking, the file plays but
the app becomes completely unresponsive(spinning pinwheel) until
the file has been fully played. I tried removing the usleep() call
but that seemed ineffective. Is this expected behaviour? How do I
make my app responsive to user interaction while it plays audio?
Michael
On 9-Dec-05, at 12:43 PM, William Stewart wrote:
Cool, I actually made a simple playback cocoa app that wraps the
functions found in PlayFile.cpp.
few things I'd like to know:
- the NSButton stays in the on state. How do I farm-out the
playback task to another thread?
The playback is happening in another thread. Once you start the
graph, playback is taking care of itself:
// start playing
XThrowIfError (AUGraphStart (theGraph), "AUGraphStart");
this is the part where you just return...
we wait in the command line for the file to finish playing
// sleep until the file is finished
usleep ((int)fileDuration * 1000 * 1000);
then we clean up.
// lets clean up
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________
__
_______________________________________________
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