Re: stopping sound
Re: stopping sound
- Subject: Re: stopping sound
- From: "Kevin Dixon" <email@hidden>
- Date: Sat, 5 Apr 2008 12:52:14 -0400 (EDT)
- Importance: Normal
Right, assuming you're using Cocoa, you'll want to look at the docs for
NSThread, particularly detachNewThreadSelector:
and also the Threading Programming Guide
http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading
So then you might maintain a state variable such as a boolean
currentlyPlaying.
Your thread will do this:
while(currentlyPlaying) {
playABitOfTheSound();
}
while clicking the stop button in the main thread will change the state of
currentlyPlaying to false.
Hope that kind of gets you started
-Kevin
>
> On 4 Apr '08, at 6:52 PM, Roland Silver wrote:
>
>> ... in fact, while the 440 "A" is being played, nothing responds to
>> a user action, e.g. clicking a menu in the menu bar doesn't drop
>> down a list of choices.
>
> Sounds like your main thread is busy. I would imagine the code you're
> using runs synchronously, not returning to the event loop until the
> sound is finished. You need to change it so it's asynchronous, and
> your event loop continues to run, so it can detect the press of the
> Stop button.
>
> (If you're not sure what the main thread is doing, try running your
> app in the debugger and interrupting it (pressing Pause in Xcode)
> while it's playing the sound. Then look at the stack of the main
> thread.)
>
> Jens _______________________________________________
> 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
_______________________________________________
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