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

Re: Playing multiple sounds


  • Subject: Re: Playing multiple sounds
  • From: Mark Pauley <email@hidden>
  • Date: Thu, 23 Aug 2007 14:22:28 -0700

You should use an AudioConverter. I'm sure it's really fast and we probably have good dithering algorithms, etc.
Just make up an AudioBufferList struct (either local or malloc'ed), and pass the AudioBuffer's through (by setting pointers in the AudioBufferList struct).



Even better would be to use the AURenderCallback mechanism as opposed to the (deprecated?)input callback mechanism:


http://developer.apple.com/documentation/MusicAudio/Reference/CoreAudio/audio_units/chapter_5_section_3.html#/ /apple_ref/c/tdef/AURenderCallback

Set a render callback on the audio unit and you'll be dealing with AudioBufferLists the whole way.

_Mark

On Aug 23, 2007, at 1:45 PM, Andreas Falkenhahn wrote:


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

_______________________________________________ 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>
References: 
 >Playing multiple sounds (From: "Andreas Falkenhahn" <email@hidden>)

  • Prev by Date: Re: CallHostTransportState doesn't return to stopped state
  • Next by Date: Re: Playing multiple sounds
  • Previous by thread: Playing multiple sounds
  • Next by thread: Re: Playing multiple sounds
  • Index(es):
    • Date
    • Thread