Re: still super duper frustrated about the au graph..
Re: still super duper frustrated about the au graph..
- Subject: Re: still super duper frustrated about the au graph..
- From: Christian Rober <email@hidden>
- Date: Sat, 21 Mar 2015 12:22:34 -0400
Patrick,
I think, in fact, you do want to call the render code yourself. (I am
just going to focus on that part of your issue set, those ASBD errors
are another matter)...
My take: In the audio unit world, Apple rely on a pull model. Some
thread or loop in your process (not necessarily code you wrote) has to
repeatedly pull audio through this graph of audio units. They use an
apt metaphor somewhere in the documentation: a straw. You suck on one
end of the straw, and audio flows back to you. Look at the diagram
here:
https://developer.apple.com/library/mac/documentation/MusicAudio/Conceptual/AudioUnitProgrammingGuide/AudioUnitDevelopmentFundamentals/AudioUnitDevelopmentFundamentals.html#//apple_ref/doc/uid/TP40003278-CH7-SW12
Now, in most applications I have written, the audio hardware is
pulling for me. Take iOS for example. You instantiate a RemoteIO,
which is an audio unit proxy for the hardware. Then you active your
AVAudioSession so that the hardware starts pulling on your remoteIO,
which in turn pulls on whatever audio callbacks or AUGraphs you have
set up. On the desktop I believe there is a similar semantic. I
think there is an AUHAL output audio unit (or something like that).
This connects to the hardware similarly to RemoteIO on iOS hardware
(sorry, it's been a while).
However, since you are not using the output hardware, you don't get
that automatic pulling for free. You have to build it yourself. The
good news is you can do this anywhere in your code. In other words it
does not have to be on a real-time thread. Indeed, I think
applications that do not use the built-in output audio units (like the
hal or remoteio) must do this. They must find a way to copy and write
audio buffers to/from the audio device hardware drivers, all in real
time.
For starters, I would try to instantiate an audio unit, by itself, and
call the render calls manually. Then see if the audio you expect is
coming back to you.
This would have to be some kind of generator AU, like a synth. This
is because it is "the end of the line" in the pull model. Since it
generates the audio (being a synth or file reader etc.) then it
doesn't pull on any other AUs. Once you have that working, you can
add your filter in front of that.
Again, you should be able to see, in the debugger, that the audio is
making the round trip through the two AUs. Look for PullInput() calls
happening at the beginning of the Render calls. Again, you should not
see PullInput() calls in the synth, but you should see it in the
filter.
Lastly, in the end, it should be OK to mix and match AUGraph semantics
with Render Callback/Audio Component semantics. Though, this mixture
may temporarily complicate both the debugging and the investigation in
your scenario. AUGraph makes many common tasks easier. Once I got
the hang of it, I found it to be a great API.
--Christian
On Sat, Mar 21, 2015 at 11:56 AM, Patrick J. Collins
<email@hidden> wrote:
>> But here is a stere float one anyway:
>>
>> mSampleRate 44100.000000
>> mFormatFlags kAudioFormatFlagIsFloat | kAudioFormatFlagIsNonInterleaved | kAudioFormatFlagIsPacked
>> mFormatID kAudioFormatLinearPCM
>> mFramesPerPacket 1
>> mBytesPerFrame 4
>> mChannelsPerFrame 2
>> mBitsPerChannel 32
>> mBytesPerPacket 4
>
> Yeah these asbds do not work on the graph, for whatever no matter what I
> do. If I put them on the output node, I get -50, and if i put them on
> the lowpass node, I get -10868...
>
> I am using audio units in another class where I do
> AudioComponentInstanceNew and AudioUnitInitialize... And I can set the
> asbd no problem, and it plays my buffer perfectly.
>
> However, as soon as the graph is involved, nothing works.
>
> Patrick J. Collins
> http://collinatorstudios.com
>
> _______________________________________________
> 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
>
_______________________________________________
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