Re: AudioUnitInitialize returning -1 or -50 for remoteIO
Re: AudioUnitInitialize returning -1 or -50 for remoteIO
- Subject: Re: AudioUnitInitialize returning -1 or -50 for remoteIO
- From: Doug McCoy <email@hidden>
- Date: Wed, 10 Feb 2010 16:53:13 -0800
I am using code based on the aurioTouch example for iPhone.
As
with aurioTouch, I am attempting to init and start the remote IO
audiounit. The arioTouch example works fine in the simulator and on the
device. But my code, based on and almost identical to the aurioTouch
example, seems to get an error on AudioUnitInitialize().
AudioUnitInitialize() is returning -1 or -50. I can not seem to
correlate these errors to anything and I can't find any documentation
as to what they mean.
Below is the full code of the setup function taken from my code.
Does anyone have any insights? Thanks in advance.
---
Check out my new iPhone app, FlipTalk. Featured on the iTunes App Store "What's Hot" list!
http://fliptalkapp.com
http://tinyurl.com/iTunesHotListhttp://itunes.com/apps/FlipTalk/http://tinyurl.com/FlipTalkYoutube
int SetupRemoteIO (AudioUnit& inRemoteIOUnit, AURenderCallbackStruct inRenderProc, CAStreamBasicDescription& outFormat)
{
try {
// Open the output unit
AudioComponentDescription desc;
desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_RemoteIO;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
AudioComponent comp = AudioComponentFindNext(NULL, &desc);
XThrowIfError(
AudioComponentInstanceNew(comp, &inRemoteIOUnit), "couldn't open the remote I/O unit");
UInt32 > XThrowIfError(AudioUnitSetProperty(inRemoteIOUnit,
kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Input,
1,
&one,
sizeof(one)), "couldn't enable input on the remote I/O unit");
XThrowIfError(AudioUnitSetProperty(inRemoteIOUnit,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input,
0,
&inRenderProc,
sizeof(inRenderProc)), "couldn't set remote i/o render callback");
// set our required format - Canonical AU format: LPCM non-interleaved 8.24 fixed point
outFormat.SetAUCanonical(2, false);
XThrowIfError(AudioUnitSetProperty(inRemoteIOUnit, kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input, 0, &outFormat, sizeof(outFormat)), "couldn't
set the remote I/O unit's output client format");
XThrowIfError(AudioUnitSetProperty(inRemoteIOUnit, kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output, 1, &outFormat, sizeof(outFormat)),
"couldn't set the remote I/O unit's input client format");
XThrowIfError(AudioUnitInitialize(inRemoteIOUnit), "couldn't initialize the remote I/O unit");
}
catch (CAXException &e) {
char buf[256];
fprintf(stderr, "Error: %s (%s)\n", e.mOperation, e.FormatError(buf));
return 1;
}
catch (...) {
fprintf(stderr, "An unknown error occurred\n");
return 1;
}
return 0;
}
_______________________________________________
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