iPhone AudioUnitRender error -50 in device

I am working on one project in which i have used AudioUnitRender it runs fine in simulator but gives -50 error in the device.

If anyone have faced similar problem please give me some solution.

RIOInterface* THIS = (RIOInterface *)inRefCon;
COMPLEX_SPLIT A = THIS->A;
void *dataBuffer = THIS->dataBuffer;
float *outputBuffer = THIS->outputBuffer;
FFTSetup fftSetup = THIS->fftSetup;

uint32_t log2n = THIS->log2n;
uint32_t n = THIS->n;
uint32_t nOver2 = THIS->nOver2;
uint32_t stride = 1;
int bufferCapacity = THIS->bufferCapacity;
SInt16 index = THIS->index;

AudioUnit rioUnit = THIS->ioUnit;
OSStatus renderErr;
UInt32 bus1 = 1;

renderErr = AudioUnitRender(rioUnit, ioActionFlags, 
    inTimeStamp, bus1, inNumberFrames, THIS->bufferList);
NSLog(@"%d",renderErr);
if (renderErr < 0) {
    return renderErr;
}

data regarding sample size and frame...

bytesPerSample = sizeof(SInt16);
asbd.mFormatID = kAudioFormatLinearPCM;
asbd.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
asbd.mBitsPerChannel = 8 * bytesPerSample;
asbd.mFramesPerPacket = 1;
asbd.mChannelsPerFrame = 1; 

//asbd.mBytesPerPacket = asbd.mBytesPerFrame * asbd.mFramesPerPacket;
asbd.mBytesPerPacket = bytesPerSample * asbd.mFramesPerPacket;


//asbd.mBytesPerFrame = bytesPerSample * asbd.mChannelsPerFrame;    
asbd.mBytesPerFrame = bytesPerSample * asbd.mChannelsPerFrame;          

asbd.mSampleRate = sampleRate;      

thanks in advance..

6
задан Nik Reiman 6 May 2011 в 06:51
поделиться