• 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
Reverb AudioUnit Crashes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reverb AudioUnit Crashes


  • Subject: Reverb AudioUnit Crashes
  • From: "Douglas Tanner" <email@hidden>
  • Date: Fri, 07 Jan 2005 14:32:34 +0000

Hi, I'm currently trying to get a reverb unit working, I just want to make sure I'm going about it the right way (well, I'm obviously not, as it's crashing). The thing is, it crashes inside the reverb unit code (after pulling in the input in the callback), without returning any sort of error, so I have no idea what's wrong...

The most important things that I want to verify are:
1. When copying in data in the callback, the buffer already exists and I should be using a memcpy.
2. The output buffer list mData should be NULL when passed in.
3. I'm using timestamps properly.



Here is how I'm using it:

1. Initialize the unit

reverbComponentDescription.componentType = kAudioUnitType_Effect;
reverbComponentDescription.componentSubType = kAudioUnitSubType_MatrixReverb;
reverbComponentDescription.componentManufacturer = kAudioUnitManufacturer_Apple;


reverbComponent = FindNextComponent(NULL, &reverbComponentDescription);
OpenAComponent(reverbComponent, &mReverbUnit);
AudioUnitInitialize(mReverbUnit);

AudioUnitSetProperty(mReverbUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &mReverbFormat, sizeof(AudioStreamBasicDescription));
AudioUnitSetProperty(mReverbUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &mReverbFormat, sizeof(AudioStreamBasicDescription));


(The stream format is 44100 kHz/32-bit floating point/non-interleaved)


2. Create Output Data Structure

mpReverbOutBufferList = (AudioBufferList *) malloc(sizeof(UInt32) + sizeof(AudioBuffer) * 2);

for(int i = 0; i < mpReverbOutBufferList->mNumberBuffers; i++)
{
	mpReverbOutBufferList->mBuffers[i].mNumberChannels = 1;
	mpReverbOutBufferList->mBuffers[i].mDataByteSize = uiReverbBufferSize;
	mpReverbOutBufferList->mBuffers[i].mData = NULL;
}


3. Set Callback

AURenderCallbackStruct renderCallbackStruct;
renderCallbackStruct.inputProc = ReverbRenderCallback;
renderCallbackStruct.inputProcRefCon = (void *) mpReverbBufferList;
AudioUnitSetProperty(mReverbUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &renderCallbackStruct, sizeof(AURenderCallbackStruct));



4. Render Reverb

AudioUnitRenderActionFlags actionFlags = 0;
uint32 uiNumberFrames = 1080;
actionFlags = 0;
AudioUnitRender(mReverbUnit, &actionFlags, &mTimeStamp, 0, uiNumberFrames, mpReverbOutBufferList);



5. Callback

OSStatus ReverbRenderCallback(void * inRefCon, AudioUnitRenderActionFlags * ioActionFlags, const AudioTimeStamp * inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList * ioData)
{
uint32 numberBytes = inNumberFrames << 2;
AudioBufferList * pReverbBufferList = (AudioBufferList *) inRefCon;


for(int i=0; i<pReverbBufferList->mNumberBuffers; i++)
memcpy(ioData->mBuffers[i].mData, pReverbBufferList->mBuffers[i].mData, numberBytes);



return noErr; }


6. Increment the time stamp

mTimeStamp.mSampleTime += uiNumberFrames;
mTimeStamp.mFlags = kAudioTimeStampSampleTimeValid;


Thanks in advance for your help, -Douglas Tanner

_________________________________________________________________
Take charge with a pop-up guard built on patented Microsoft® SmartScreen Technology http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*.


_______________________________________________
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


  • Prev by Date: Re: coreaudio example compilation errors
  • Next by Date: Re: How to wait for sysex?
  • Previous by thread: Re: Bandwidth to Q conversion
  • Next by thread: Strange sysex problems
  • Index(es):
    • Date
    • Thread