Questions on mixing .wav files
Questions on mixing .wav files
- Subject: Questions on mixing .wav files
- From: Jay Bone <email@hidden>
- Date: Sat, 8 Aug 2009 01:07:16 -0700
Hello CoreAudio gurus,
I am trying to mix multiple small .wav files to play on an iPhone 3.0.
Prior to the 3.0.1 SDK (using 2.2.1) I achieved this quite easily using AudioServicesPlaySystemSound() and an NSThread with sleepForTimeInterval.
But something must have changed wrt either NSThread sleeping, or AudioServicesPlaySystemSound as this approach no longer works for me in 3.0.
My suspicion is that instead the AudioUnit APIs should be used, and that is all new to me.
So I want to define an AudioUnit output node of subtype kAudioUnitSubType_RemoteIO
I then connect this to a kAudioUnitSubType_MultiChannelMixer.
Next would be connect my .wav's to the kAudioUnitSubType_MultiChannelMixer, but it is not clear to me how this is done.
Is there an AudioUnit which can be used to wrap a .wav file?
I've found this post to this group:
http://lists.apple.com/archives/coreaudio-api/2009/Jul/msg00066.html
Which seems to indicate the following can be done:
ExtAudioFileOpenURL(voice) -
| -
AUMixer(kAudioUnitSubType_MultiChannelMixer) - AUOutput(kAudioUnitSubType_RemoteIO)
ExtAudioFileOpenURL(music) - What I don't understand is, how is an ExtAudioFileOpenURL() "connected" to the mixer AudioUnit? The docs show ExtAudioFileOpenURL() interface defined as
OSStatus ExtAudioFileOpenURL (
CFURLRef inURL,
ExtAudioFileRef *outExtAudioFile
);
Can I "connect" (via AUGraphConnectNodeInput() ) an ExtAudioFileRef to a mixer node? If so, it's not clear to me from the docs how this is done.
Also I'd like to mix in the same .wav multiple times at different time offsets/intervals into the output. I noticed some kind of Delay Audio Unit in the docs, but nothing mentioned for iPhone specifically. E.g. a bassdrum .wav sound every .125 seconds. Is there a delay audio unit which can be used to achieve this?
Can this all be done without implementing my own callbacks to manually fill buffers?
Thanks in advance for any tips or help with this.
-J
_______________________________________________
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