Why is mData empty for Built in Audio?
Why is mData empty for Built in Audio?
- Subject: Why is mData empty for Built in Audio?
- From: Craig Bakalian <email@hidden>
- Date: Mon, 8 Mar 2004 10:32:17 -0500
Hi,
I have made a prototype of application of microphone input with a ring
buffer. It works fine. I can select from built-in-audio and a usb
microphone, I change the AudioInputStreamDescription and all is well.
However, I have added the same code to a larger application with
different results. The usb microphone works, or the mData in the
IOProc has data, yet when switching to the built-in-audio the mData is
null. The IOProc is working, the pull on the render is working, yet
the mData is empty. I have no errors in any of the setup for
microphone input, and a check to kAudioDevicePropertyDeviceIsRunning is
1.
What would allow the setup of an AudioDeviceAddIOProc and
AudioDeviceStart with no errors yet, empty mData? Or what would
prevent mData from being loaded into an IOProc? Also, myRecordCallback
gives a valid AudioDeviceID while it is running. Generally from
debugging, I am seeing that the built-in-audio is equal to 11 and the
usb microphone is equal to 10.
OSStatus myThruCallback(void *inRefCon,
AudioUnitRenderActionFlags *inActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumFrames,
AudioBufferList *ioData)
{
AudioTrackView *con = (AudioTrackView *)inRefCon;
if(con->playThru)
{
memcpy(ioData->mBuffers[0].mData, con->playThru,
ioData->mBuffers[0].mDataByteSize);
}
return(kAudioHardwareNoError);
}
OSStatus myRecordCallback(AudioDeviceID device,
const AudioTimeStamp *now,
const AudioBufferList *inputdata,
const AudioTimeStamp *input_time,
AudioBufferList *outputdata,
const AudioTimeStamp *output_time,
void *client)
{
AudioTrackView *con = (AudioTrackView *)client;
if((inputdata != NULL) && (inputdata->mNumberBuffers > 0))
{
if(inputdata->mBuffers[0].mData)
{
memcpy(con->playThru,inputdata->mBuffers[0].mData,
inputdata->mBuffers[0].mDataByteSize);
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
con->captureStoragePtr= [NSData
dataWithBytes:inputdata->mBuffers[0].mData
length: inputdata->mBuffers[0].mDataByteSize];
[con->captureStorage appendData: con->captureStoragePtr];
con->captureTotalBytesCaptured +=
inputdata->mBuffers[0].mDataByteSize;
[pool release];
}
}
return(kAudioHardwareNoError);
}
Craig Bakalian
www.eThinkingCap.com
_______________________________________________
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.