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

default output start & stop


  • Subject: default output start & stop
  • From: papi <email@hidden>
  • Date: Sun, 05 Jan 2003 09:55:23 -0800

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.)

I'm wrestling audio output start and stop in a simple app using Carbon
controls.
My start button calls a function that contains AudioOutputUnitStart();
my stop
button calls a function that contains AudioOutputUnitStop(). Sounds
reasonable, but ...

What does usleep() do? I can't find it in a search of any of the
frameworks included
in the project.

How is CFRunLoopRunInMode called? It's not an explicit call, since the
only mention of it is in a comment string.

The last comment says to stop the AU; but then continues by saying that
the process is already nuked. How? Where?

My best guess on all this is that the usleep() function causes something
somewhere to sleep for 5 seconds -- allowing the tone to be played --
before the AU is stopped by AudioUnitStop(). But:

commenting-out the AudioUntiStop() function, the tone still plays
for 5 seconds; so something else is stopping it.

commenting-out the usleep() function causes no sound to be played;
now that's puzzling.

So my guess isn't entirely correct.

Thanks in advance!
Scott


// Start the rendering
// The DefaultOutputUnit will do any format conversions to the
format of the default device
verify_noerr(AudioOutputUnitStart(theOutputUnit));

// RUNS FOREVER!!!!
// we call the CFRunLoopRunInMode to service any notifications that
the audio
// system has to deal with
usleep (5 * 1000 * 1000); // sleep for 5 seconds

// REALLY after you're finished playing STOP THE AUDIO OUTPUT
UNIT!!!!!!
// but we never get here because we're running until the process is
nuked...
verify_noerr(AudioOutputUnitStop(theOutputUnit));
_______________________________________________
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>
  • Prev by Date: Vector Unit Overhead in RT under OSX?
  • Next by Date: Re: default output start & stop
  • Previous by thread: Vector Unit Overhead in RT under OSX?
  • Next by thread: Re: default output start & stop
  • Index(es):
    • Date
    • Thread