Ping Pong Delay Source Code

Official support for: expertsleepers.co.uk
Post Reply New Topic
RELATED
PRODUCTS

Post

Hey Guys,

Is there any chance, that the source code for the ping pong delay will be available for downloading again. I'm currently working on a similar plugin and I'm sure I could learn a lot from that source code.
Thanks in Advance

Post

The ping pong delay code is really old and doesn't even compile anymore on the current Mac tools, so I'm unlikely to release it again soon.

I'll happily answer any related questions you might have though.

Post

Thanks for the quick answer. I want to write a Panning tool that uses time-of-arrival Stereophony so I have to split my signal in the left and right channel and process them separately. I know that I have to override the ProcessBufferLists() and/or Render(), but I still don't know how to do it in detail, so I hoped that an Example Source Code would help me. But if you could post any part of standard source code for this process or other information concerning this subject, I would be very grateful.
best regards

Post

A good place for this sort of question is Apple's coreaudio-api mailing list:
http://lists.apple.com/mailman/listinfo/coreaudio-api

You should probably override Render() in this case. The relevant part of the ping pong delay code looks like this:

Code: Select all

ComponentResult 	ExSlPingPong::Render(	AudioUnitRenderActionFlags &ioActionFlags,
											const AudioTimeStamp &		inTimeStamp,
											UInt32						inFramesToProcess )
{
	ComponentResult result;
	if ( !HasInput(0) )
		return kAudioUnitErr_NoConnection;
	
	AUOutputElement *theOutput = GetOutput(0);	// throws if error
	AUInputElement *theInput = GetInput(0);
	result = theInput->PullInput( ioActionFlags, inTimeStamp, 0 /* element */, inFramesToProcess );
	if ( result != noErr )
		return result;

	if( ProcessesInPlace() )
		theOutput->SetBufferList( theInput->GetBufferList() );
	
	const AudioBufferList &	inBuffer = theInput->GetBufferList();
	AudioBufferList &		outBuffer = theOutput->GetBufferList();
	
    // only support AU v2 format i.e. non-interleaved
    if ( outBuffer.mNumberBuffers != 2 )
        return kAudioUnitErr_FormatNotSupported;
	
	const float *pIn0, *pIn1;
	switch ( inBuffer.mNumberBuffers )
	{
		case 1:
			pIn0 = pIn1 = (const float *)inBuffer.mBuffers[0].mData;
			break;
		case 2:
			pIn0 = (const float *)inBuffer.mBuffers[0].mData;
			pIn1 = (const float *)inBuffer.mBuffers[1].mData;
			break;
		default:
			return kAudioUnitErr_FormatNotSupported;
	}
	float *pOut0 = (float *)outBuffer.mBuffers[0].mData;
	float *pOut1 = (float *)outBuffer.mBuffers[1].mData;
	
	if ( ShouldBypassEffect() )
	{
		if ( !ProcessesInPlace() )
		{
			// init out buffer with in buffer
			for ( UInt32 i=inFramesToProcess; i; --i )
			{
				float f0 = *pIn0++;
				float f1 = *pIn1++;
				*pOut0++ = f0;
				*pOut1++ = f1;
			}
		}
		return noErr;
	}

  // ... call actual render code using pIn & pOut

Post Reply

Return to “Expert Sleepers”