• 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
Re: My AUHAL Output Audio Unit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: My AUHAL Output Audio Unit


  • Subject: Re: My AUHAL Output Audio Unit
  • From: Doug Wyatt <email@hidden>
  • Date: Fri, 25 Jun 2004 14:58:50 -0700

On Jun 25, 2004, at 13:35, Daniel Todd Currie wrote:
Then in the sample code, shouldn't this line:
UInt32 numOfChannels = DesiredFormat.mChannelsPerFrame; // 2 channels

read:
UInt32 numOfChannels = DeviceFormat.mChannelsPerFrame; // 4 channels

No. DesiredFormat is the number of channels you want record. DeviceFormat is the number of channels on the device. A channel map always has the *destination* number of channels. For each destination, it says which source maps to the destination. One way to remember this is that this makes splitting a source to multiple destinations possible, but does not allow multiple sources to mix to a destination -- splitting is a simple copy, but mixing is a more complex operation.

I'm pretty sure I have the channel map set up correctly now, but I'm still getting buffers full of zeros.

What is in your channel map?

Has anyone had this problem before? It seems like AudioUnitRender() isn't writing any data to my AudioBufferList, but I have no idea why.

The simplest explanation is that the channel map or the stream formats, or both, are not correct.

AudioUnitRender() is returning noErr, so could that even be the problem?

Yes.

I also think my inputProc is screwed, because I am having to use all these arrows in my code -> that I don't see in anyone else's stuff in the docs or the archives. Here's my inputProc callback:

This is a C function, not an ObjC or C++ method. Accessing structures in C requires arrows or stars and dots.

OSStatus recordIOProc(void *inRefcon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumFrames,
AudioBufferList *ioData)
{
Recorder *client = (Recorder *)inRefcon;

OSStatus err = AudioUnitRender(client->inputAudioUnit,
ioActionFlags,
inTimeStamp,
inBusNumber,
inNumFrames,
client->inputBuffer);
if(err == noErr)
{
unsigned dataSize = client->inputBuffer->mBuffers[0].mDataByteSize;
client->tempBuffer = client->inputBuffer->mBuffers[0].mData;
[client->aQueue writeBytesWithoutBlockingFrom:client->tempBuffer length:dataSize];

return(noErr);
}
else return(err);
}

Rather than use render notifications etc., I elected to just pull the buffer using an MTCircularQueue (from MTCoreAudio). This callback worked when I was using a straight HAL implementation, but now I am upgrading to AUHAL and need to do something a little different?

You have to set an input callback, and your input callback must call AudioUnitRender. The input data is not available at any other time. Your code is doing this much right -- if it wasn't, you would be getting a cannotDoInCurrentContext error.

Doug
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: My AUHAL Output Audio Unit
      • From: Daniel Todd Currie <email@hidden>
References: 
 >My AUHAL Output Audio Unit (From: Daniel Todd Currie <email@hidden>)
 >Re: My AUHAL Output Audio Unit (From: Doug Wyatt <email@hidden>)
 >Re: My AUHAL Output Audio Unit (From: Daniel Todd Currie <email@hidden>)

  • Prev by Date: Re: My AUHAL Output Audio Unit
  • Next by Date: Re: My AUHAL Output Audio Unit
  • Previous by thread: Re: My AUHAL Output Audio Unit
  • Next by thread: Re: My AUHAL Output Audio Unit
  • Index(es):
    • Date
    • Thread