• 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: default output start & stop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: default output start & stop


  • Subject: Re: default output start & stop
  • From: papi <email@hidden>
  • Date: Sun, 05 Jan 2003 15:32:33 -0800

There's a thread feeding the audio? I haven't worked with threads myself
yet, but I haven't been able to find anything in the DefaultAudioOutput
sample app that says it's creating or calling a thread.

So, I hope this isn't off-topic, but if the theOutputUnit is/contains/represents
a thread and the AudioOutputUnitStart() function starts playing it, how
does one stop it? Pressing my button that calls AudioOutputUnitStop()
just waits for the usleep() "timer" to expire.

Thanks again!
Scott

p.s. the render callback supplies a never-ending supply of PCM data
to the AU. Playback duration is currently (temporarily!) controlled solely
by the length of time specified in usleep().


On Sunday, January 5, 2003, at 10:17 AM, David Duncan wrote:

On Sunday, January 5, 2003, at 12:55 PM, papi wrote:

New to core audio -- still pretty green at C++.

The DefaultAudioOutput example project's TestDefaultAU() function has
some
code that starts and stops a simple sine wave render. Can someone
explain
in further detail what exactly is happening here? (I've copied the
snippet below.)


Starting the audio unit here...
verify_noerr(AudioOutputUnitStart(theOutputUnit));

Sleeping the current thread for 5 seconds (the audio is played on a separate thread) usleep() is a BSD call.
usleep (5 * 1000 * 1000); // sleep for 5 seconds

And stop the audio unit here...
verify_noerr(AudioOutputUnitStop(theOutputUnit));

That is literally all this code is doing. Now, the thread that is feeding the audio may only play 5 seconds worth of sound regardless, I have not looked at the source code for TestDefaultAU() so I don't know. But if your looking for more clues, it would be more useful to look at the render callback that is being installed on the output > unit.
--
Reality is what, when you stop believing in it, doesn't go away.
Failure is not an option. It is a privilege reserved for those who try.

David Duncan
_______________________________________________
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.

  • Follow-Ups:
    • Re: default output start & stop
      • From: David Duncan <email@hidden>
References: 
 >Re: default output start & stop (From: David Duncan <email@hidden>)

  • Prev by Date: Re: default output start & stop
  • Next by Date: Re: default output start & stop
  • Previous by thread: Re: default output start & stop
  • Next by thread: Re: default output start & stop
  • Index(es):
    • Date
    • Thread