• 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
AudioUnit FormatConverter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AudioUnit FormatConverter


  • Subject: AudioUnit FormatConverter
  • From: George Malayil-Philip <email@hidden>
  • Date: Wed, 28 Dec 2005 05:09:42 -0500
  • Thread-topic: AudioUnit FormatConverter

Hi,
    Again a bit confused...I read in a file into a audio unit as BEI32 (big
endian unsigned integer 32-bit). When I pass this on to a audio unit set up
as default output, I get audio with a lot of noise. I am guessing this is
because the default output audio unit expects BEF32(big endian float 32), as
the noise is similar to when I encode BEF32 with lame which expects BEI32.
So, I set up a audio unit to convert the BEI32 to BEF32 with the following
calls

AudioUnit converterUnit;
ComponentDescription desc;
desc.componentType = kAudioUnitType_FormatConverter;
desc.componentSubType = kAudioUnitType_AUConverter;
desc.componentManufacturer = kAudioUnitManufacturer_Apple
desc.componentFlags = 0;
desc.componentFlagsMask = 0;

Component comp;
comp = FindNextComponent(NULL, &desc);
OpenAComponent(comp, &converterUnit);
AudioUnitInitialize(converterUnit);

CAAudioStreamBasicDescription outputFormat;
outputFormat.SetCanonical(2,false);
outputFormat.mFormatID = kAudioFormatLinearPCM;
outputFormat.mSampleRate = 44100;

CAAudioStreamBasicDescription inputFormat;
inputFormat.SetCanonical(2,false);
inputFormat.mFormatID = kAudioFormatLinearPCM,
inputFormat.mSampleRate = 44100;
inputFormat.mFormatFlags = ~(clientFormat.mFormatFlags &
kAudioFormatFlagIsFloat);
inputFormat.mFormatFlags |= kAudioFormatFlagIsSignedInteger;

AudioUnitSetProperty(converterUnit,
                     kAudioUnitProperty_StreamFormat,
                     kAudioUnitScope_Input,
                     0,
                     &inputFormat,
                     sizeof(AudioStreamBasicDescription));

AudioUnitSetProperty(converterUnit,
                     kAudioUnitProperty_StreamFormat,
                     kAudioUnitScope_Output,
                     0,
                     &outputFormat,
                     sizeof(AudioStreamBasicDescription));

With this audio unit hooked up as input to the outputUnit, I get perfect
output. What's confusing me though is that if I replace outputFormat with
inputFormat in the call to set converterUnit's output Stream Format, I still
get perfect output?!? How is this? Does a AUConverter always output BEF32
despite the settings on input and output formats? I am asking this because
in another program I tried a similar thing, except in the reverse, I set up
the converterUnit to convert BEF32 to BEI32, but it doesn't seem to do that.
Is there any other call I need to set to make this work? Or can't
AUFormatConverter's be used this way?

Thanks and sorry for the long post...

Regards
George M.P.




 _______________________________________________
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

  • Follow-Ups:
    • Re: AudioUnit FormatConverter
      • From: Jeff Moore <email@hidden>
  • Prev by Date: Re: Writing a private device driver
  • Next by Date: Re: Writing a private device driver
  • Previous by thread: Re: Accessing AudioCodec from AudioConverter?
  • Next by thread: Re: AudioUnit FormatConverter
  • Index(es):
    • Date
    • Thread