Re: using stereo mixer
Re: using stereo mixer
- Subject: Re: using stereo mixer
- From: Craig Bakalian <email@hidden>
- Date: Mon, 11 Jul 2005 06:37:30 -0400
Hi jh,
I haven't looked a PlayAudioFileLite. I don't think you are going to be able to just use the stereo mixer in this situation. You are going to need a format converter for each input of the mixer unit, so two format converters connected to the stereo mixer. The stereo mixer output will need to be connected to a output unit (default output), to make the paper cones of your speakers vibrate. The input of the format converters needs to be set to the format of the file (s) and the output of the format converters need to be set to the format of the stereo mixer. Don't forget to initialize all of the audio units.
You will need a input callback set up for each format converter. This design will enable you to start the output unit playing to pull the data from each format converter. The C code below is called by an Objective C thread, so there has to be a NextStep AutoreleasePool in place->
OSStatus playCallback(void *inRefCon,
AudioUnitRenderActionFlags *inActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
BGAudioTrackView *con = (BGAudioTrackView *)inRefCon;
0;i<con->numberOfBuffers;i++)
{
if(con->playedBytes < con->totalBytesInStorage)
{
[con->audioStorage getBytes: ioData->mBuffers[i].mData
range: NSMakeRange(con->playedBytes, ioData->mBuffers[i].mDataByteSize)];
con->playedBytes += ioData->mBuffers[i].mDataByteSize;
}
else
{
inActionFlags = (UInt32 *)kAudioUnitRenderAction_OutputIsSilence;
memset(ioData->mBuffers[i].mData, 0.0, ioData->mBuffers[i].mDataByteSize);
if(con)[con stopIfSelfIsBiggest];
}
}
[pool release];
return(kAudioHardwareNoError);
}
I hope this helps
Craig Bakalian
www.eThinkingCap.com
On Jul 10, 2005, at 3:03 PM, email@hidden wrote:
Message: 3
Date: Sun, 10 Jul 2005 08:22:27 -0700 (PDT)
From: j h <email@hidden>
Subject: using stereo mixer
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=iso-8859-1
I am writting an app that will take 2 or more audio
files and play them at the same time. I have used the
code from the PlayAudioFileLite project to load the
files, and have added functions to setup the audio
mixer. I am unable to get any sounds to play, as I
dont know what code to put in the callback (it uses an
audiobuffer whereas the PlayAudioFileLite uses an
audiobufferlist). I'm sorry if this is a stupid
question, but I have looked through the mailing list
archive and am still not sure how to proceed.
Does anyone know of some source which shows how to use
the stereo mixer?
Thanks for any help you can give!
_______________________________________________
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