Re: HALOutputUnit (Pt 2)
Re: HALOutputUnit (Pt 2)
- Subject: Re: HALOutputUnit (Pt 2)
- From: Craig Bakalian <email@hidden>
- Date: Thu, 26 Feb 2004 07:50:29 -0500
Hi,
The only problem with code below is that it will crash if the default
microphone
is a USB microphone. Unless someone can tell me otherwise. Why does
the code
below crash with a _CurrentDevice on a USB microphone?
Craig Bakalian
www.eThinkingCap.com
On Feb 26, 2004, at 1:00 AM, email@hidden
wrote:
Okay, here's a list of ALL the steps I take.
1 - set the device sample rate:
AudioDeviceSetProperty(deviceID, 0, 0, true,
kAudioDevicePropertyNominalSampleRate, size, &rate)
2 - open either a "graph and AUHAL node" or just a "AUHAL Audio Unit"
3 - enable input:
AudioUnitSetProperty(unit, kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Input, 1, ...)
4 - set device:
AudioUnitSetProperty(unit, kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global, 1, deviceID, size);
5 - get the inputScope inputBus ASBD:
AudioUnitGetProperty(unit, kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input, 1, &inASBD, &size);
6 - get the outputScope inputBus ASBD: (you could also just create one
to be what you want)
AudioUnitGetProperty(unit, kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output, 1, &outASBD, &size);
7 - adjust the outputScope inputBus ASBD to match the sample rate of
the input:
outASBD.mSampleRate = inASBD.mSampleRate;
8 - set the outputScope inputBus ASBD:
AudioUnitSetProperty(unit, kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output, 1, &outASBD, size);
9 - hook up the input callback:
AURenderCallbackStruct callback; callback.inputProc = foo;
callback.inputProcRefCon = this;
AudioUnitSetProperty(unit, kAudioUnitProperty_SetInputCallback,
global?, 1, callback, size);
10 - alloc buffers
11 - initialize AudioUnit or AUGraph (depending on if you used a graph
or not)
12 - start graph or unit
13 - in your callback, call:
AudioUnitRender(unit, 0, timestamp, 1, frames, bufferlist);
_______________________________________________
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.