• 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
Copy iPhone microphone to output: Only kAudioFormatFlagsAudioUnitCanonical works?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Copy iPhone microphone to output: Only kAudioFormatFlagsAudioUnitCanonical works?


  • Subject: Copy iPhone microphone to output: Only kAudioFormatFlagsAudioUnitCanonical works?
  • From: Joel Reymont <email@hidden>
  • Date: Fri, 13 Feb 2009 17:15:55 +0000

I'm using a single render callback in the style of aurioTouch.

I'm running this directly on the iPhone because the simulator crashes.

audioFormat.mSampleRate = 44100.0;
audioFormat.mFormatID = kAudioFormatLinearPCM;
UInt32 a = kAudioFormatFlagsCanonical;
UInt32 b = kAudioFormatFlagsAudioUnitCanonical;
UInt32 c = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;


    audioFormat.mFormatFlags = c;

    audioFormat.mFramesPerPacket = 1;
    audioFormat.mChannelsPerFrame = kChannelsPerFrame;
    audioFormat.mBitsPerChannel = 32;
    audioFormat.mBytesPerPacket = 4;
    audioFormat.mBytesPerFrame = 4;

size = sizeof(audioFormat);
status = AudioUnitSetProperty(_audioUnit, kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output, kInputBus,
&audioFormat, sizeof(audioFormat));


status = AudioUnitSetProperty(_audioUnit, kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input, kOutputBus,
&audioFormat, sizeof(audioFormat));



My understanding is that I'm setting the format of the data that the microphone gives to me and the format of what I'm going to be feeding to the headphones or speakers.


I have 3 format flag options above (a, b, c). Of those only b (kAudioFormatFlagsAudioUnitCanonical) results in proper playthrough. The rest produce loud repeating noise.

Am I doing something obviously wrong here?

My render callback looks like this:

static OSStatus recordingCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData) {
AudioEngine* engine = (AudioEngine*)inRefCon;


    OSStatus status = AudioUnitRender([engine audioUnit],
                                      ioActionFlags,
                                      inTimeStamp,
                                      1,
                                      inNumberFrames,
                                      ioData);

    if (status != noErr)
        return status;

    return noErr;
}

	Thanks, Joel

---
http://tinyco.de
--- Mac & iPhone

_______________________________________________
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: Copy iPhone microphone to output: Only kAudioFormatFlagsAudioUnitCanonical works?
      • From: Joel Reymont <email@hidden>
  • Prev by Date: adding filter, flange or delay to SoundEngine effects
  • Next by Date: Re: Copy iPhone microphone to output: Only kAudioFormatFlagsAudioUnitCanonical works?
  • Previous by thread: Re: adding filter, flange or delay to SoundEngine effects
  • Next by thread: Re: Copy iPhone microphone to output: Only kAudioFormatFlagsAudioUnitCanonical works?
  • Index(es):
    • Date
    • Thread