• 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
Playing multiple sounds
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Playing multiple sounds


  • Subject: Playing multiple sounds
  • From: "Andreas Falkenhahn" <email@hidden>
  • Date: Thu, 23 Aug 2007 22:45:03 +0200

Hi,

I am a newbie to Core Audio. I've read a lot of documentation about Core Audio over
the last days, but I find it very hard to understand because it is lots of theory and
little example code. What I'm trying to do is, basically, to play up to 8 sounds at
the same time.

I did some searches in the archives and found this very helpful example by Mr Kurt Revis:
http://lists.apple.com/archives/coreaudio-api/2002/Sep/msg00264.html

This really helped me to get some ideas of how all the theory from the docs looks
in practice. But I still have a problem: The sounds I will be playing through the 8 busses,
which I've created using a mixer as described in the post quoted above, will not use
one and the same format. It's all linear PCM data that I'm streaming in, but the
sounds differ in the bits per channel (8 and 16), channels per frame (1 and 2) and in
the sample rate (10000 to 44100hz). So I guess I will have to use the audio converter
to convert the data to the format of the default audio output device, right?

But I don't know where in my code I have to call AudioConverterFillComplexBuffer(). The
example code by Mr Revis quoted above uses an input proc which receives an
AudioBuffer as an argument. But I can't use AudioConverterFillComplexBuffer()
in that proc, because its callback wants an AudioBufferList. I would need a render
proc in order to use AudioConverterFillComplexBuffer() if I understand this correctly.
But what confuses me even further is that according to this technical note

http://developer.apple.com/technotes/tn2004/tn2097.html

kAudioUnitProperty_SetInputCallback has been superseded by kAudioUnitProperty_SetRenderCallback.
But when I try to install a kAudioUnitProperty_SetRenderCallback on my mixer audio
unit, AudioUnitSetProperty() returns kAudioUnitErr_InvalidProperty. So I guess I still
have to go with the input callback for the mixer audio unit.

But when do I have to do the audio conversion? I've currently configured everything
as shown in the example by Mr Revis. How do I make sure that the audio is
converted correctly to the format of the default audio output device? Do I have
to use an audio converter at all, or is there maybe also a way to have the audio
converted automatically so that it fits to the settings of the default output device?
That would be much more convenient.

Any help is greatly appreciated.

Andreas

 _______________________________________________
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

  • Follow-Ups:
    • Re: Playing multiple sounds
      • From: Mark Pauley <email@hidden>
  • Prev by Date: Re: Problem in AUElement::SaveState, conversion from Float32 -> UInt32 not working in non debug mode
  • Next by Date: Re: CallHostTransportState doesn't return to stopped state
  • Previous by thread: Re: Problem in AUElement::SaveState, conversion from Float32 -> UInt32 not working in non debug mode
  • Next by thread: Re: Playing multiple sounds
  • Index(es):
    • Date
    • Thread