Re: Combining AUHAL input and an AudioConverter
Re: Combining AUHAL input and an AudioConverter
- Subject: Re: Combining AUHAL input and an AudioConverter
- From: Heath Raftery <email@hidden>
- Date: Tue, 10 May 2005 05:02:53 +1000
On 10/05/2005, at 3:44 AM, William Stewart wrote:
On 06/05/2005, at 9:27 PM, Heath Raftery wrote:
Hello there,
I've been trying for some time to allow sound input and compression
in my app. So far I've struggled through the process of getting sound
in - that appears to be working well now. I'm now stuck getting the
input to feed into the converter for compression. Here's what I have:
<CODE>
//connect to input device
...
//connect to input converter
AudioStreamBasicDescription asbdIn, asbdOut;
theStatus = AudioUnitGetProperty(*fInputUnit,
kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &asbdIn,
&theSize);
memset(&asbdOut, 0, sizeof(asbdOut));
asbdOut.mFormatID = kAudioFormatQUALCOMM;
asbdOut.mBytesPerFrame = asbdIn.mBytesPerFrame;
asbdOut.mBytesPerPacket = asbdIn.mBytesPerPacket;
asbdOut.mChannelsPerFrame = asbdIn.mChannelsPerFrame;
//I was hoping this would fill in some details of the QUALCOMM
format, but alas, it does nothing despite trying many alternatives
It does
That's reassuring! I'd rather not guess the values.
theStatus = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo,
theSize, &asbdOut, &theSize, &asbdOut);
//so instead I fill it out manually...
asbdOut.mSampleRate = 512; //compression?
sample rate - all audio has a sample rate...
Sure, but Qualcomm is an audio compression format, which can operate at
a range of sample rates, right? I hope to vary the compression level
based on my available network bandwidth - is this where I do it?
Anyway, that's battle for the future. This is all based on guesswork
though, I haven't found any source or example code that actually uses a
AudioFormat, let alone the Qualcomm one.
What does the ASBD look like after you make the call to
AudioFormatGetProperty?
Unfortunately it looks just like it did before the call. I've literally
just written the following program:
<CODE>
#include <CoreServices/CoreServices.h>
#include <CoreAudio/CoreAudio.h>
#include <AudioUnit/AudioUnit.h>
#include <AudioToolbox/AudioToolbox.h>
int main (int argc, const char * argv[])
{
OSStatus theStatus;
AudioStreamBasicDescription asbdOut;
UInt32 theSize;
memset(&asbdOut, 0, sizeof(asbdOut));
asbdOut.mFormatID = kAudioFormatQUALCOMM;
theSize = sizeof(asbdOut);
theStatus = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo,
theSize, &asbdOut, &theSize, &asbdOut);
return 0;
}
</CODE>
Just before the call to AudioFormatGetPropert, asbdOut has 1365470320
for mFormatID and zero everywhere else. After the call (and a bit of a
pause) theStatus is zero and asbdOut remains the same. Bugger ay? Of
course, I've tried plenty of other permutations (including separate in
and out asbd's) with no success. Slipping
kAudioFormatProperty_FormatName in there instead, works as expected.
Incidentally it doesn't seem to matter than I'm specifying Qualcomm.
None of the formats appear to fill out the asbd.
Thanks for the reply Bill.
Heath
_______________________________________________
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