• 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: Playing 2 or more audio data simultaneously
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Playing 2 or more audio data simultaneously


  • Subject: Re: Playing 2 or more audio data simultaneously
  • From: Kurt Revis <email@hidden>
  • Date: Wed, 18 Sep 2002 10:01:11 -0700

On Wednesday, September 18, 2002, at 08:28 AM, Robert Goulet wrote:

It is possible to mix sound with core audio? I'm currently able to play a single audio file because I don't understand how am I suppose to have more than one buffer in my output audio buffer list that I receive in my AudioIOProc.

This is not difficult at all; here's an overview. Use a mixer AudioUnit to mix multiple audio streams into one stream. You set up an input callback on the mixer, so it will ask you for data for each stream when it needs it. On the output side, you can do two things:

1. Use one of the default audio output AudioUnits (see AudioToolbox/DefaultAudioOutput.h). You can connect the mixer directly to this, and your application won't need to implement an IO proc anymore. This is definitely the easiest route.

2. Keep using the same IO proc that you're using now, but in it, ask the mixer AU for data using AudioUnitRender() (or AudioUnitRenderSlice() if the mixer AU is still a version-1 AU).

Despite what the other poster said, it's definitely not recommended to set up more than one IO proc on the same output in the same application. I think it works, but it will cost you CPU time and increase the total load on the system, and will be confusing too.

Hope this helps.

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

  • Follow-Ups:
    • Re: Playing 2 or more audio data simultaneously
      • From: Bill Stewart <email@hidden>
  • Prev by Date: Re: Playing 2 or more audio data simultaneously
  • Next by Date: Re: Playing 2 or more audio data simultaneously
  • Previous by thread: RE: Playing 2 or more audio data simultaneously
  • Next by thread: Re: Playing 2 or more audio data simultaneously
  • Index(es):
    • Date
    • Thread