I’m familiar with this. had pretty much the identical issue. One of the
compounding problems is that there doesn’t seem to be one solution that will
work for both iOS 8 and iOS 7 and before. At least, I didn’t find one.
What is working for me, is using int32_t * as the sample data type for iOS 7
and below, then float * for iOS 8.
Then setting the format flags as:
if (iOS_8) {
bytesPerSample = sizeof (float);
// NSLog (@"size of AudioUnitSampleType: %lu", bytesPerSample);
stereoStreamFormat.mFormatFlags =
kAudioFormatFlagsNativeFloatPacked | kAudioFormatFlagIsNonInterleaved;
}
else {
bytesPerSample = sizeof (int32_t);
stereoStreamFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger
| kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked |
kAudioFormatFlagIsNonInterleaved | (kAudioUnitSampleFractionBits <<
kLinearPCMFormatFlagsSampleFractionShift);
}
This leads to a lot of unfortunate branched code. ie. separate audio callbacks
for pre iOS 8 vs iOS 8 etc. If there is a cleaner solution, I would love to
know it.
Hope this is helpful.
Robert Carroll
RSM Records
Toronto
http://www.rsmrecords.com
> On Mar 3, 2015, at 3:00 PM, [email protected] wrote:
>
> Send Coreaudio-api mailing list submissions to
> [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.apple.com/mailman/listinfo/coreaudio-api
> or, via email, send a message with subject or body 'help' to
> [email protected]
>
> You can reach the person managing the list at
> [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Coreaudio-api digest..."
>
>
> Today's Topics:
>
> 1. rendered sound is crackly under iOS8 (Bob Sabiston)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 02 Mar 2015 19:21:39 -0600
> From: Bob Sabiston <[email protected]>
> To: [email protected]
> Subject: rendered sound is crackly under iOS8
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset="windows-1252"
>
> Hello,
>
> I wrote about this a few weeks ago but I don’t think anyone had a response.
> I am trying to update my game from iOS7 to 8. My rendered sounds are full
> of noise on iOS8 and I haven’t been able to figure out the problem.
>
> The AudioUnitSampleType is deprecated, for one thing. I’ve tried setting it
> to float, and to SInt32, as that seems to be the two possible old values.
> But it doesn’t fix the problem. Also when setting up the
> AudioStreamBasicDescription stream format, the mFormatFlags used to be
> kAudioFormatFlagsAudioUnitCanonical. I’ve read that it should now be
> kAudioFormatFlagIsFloat | kAudioFormatFlagsNativeEndian |
> kAudioFormatFlagIsPacked | kAudioFormatFlagIsNonInterleaved.
>
> I’ve tried that and also changing ‘IsFloat’ to ‘IsSInt32’ to match whatever I
> had AudioUnitSampleType defined as. Nope, didn’t work.
>
> Does anyone use the AUGraph stuff, with AUGraphSetNodeInputCallback for
> example to set the callback to render a buffer full of sound samples? I use
> that and a bunch of AudioUnit stuff like result = AudioUnitSetProperty (
> mixerUnit,
> kAudioUnitProperty_StreamFormat,
> kAudioUnitScope_Input,
> busNumber,
> &monoStreamFormat,
> sizeof (monoStreamFormat)
> );
>
> It’s a couple of years since I looked at this stuff and I remember it being a
> pain to get working in the first place. Anyone else had to port code using
> these functions to iOS8? Any ideas about why it isn’t working right?
>
> Thanks!
> Bob
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <https://lists.apple.com/mailman/private/coreaudio-api/attachments/20150302/256c18a0/attachment.html>
>
> ------------------------------
>
> _______________________________________________
> Coreaudio-api mailing list
> [email protected]
> https://lists.apple.com/mailman/listinfo/coreaudio-api
>
> End of Coreaudio-api Digest, Vol 12, Issue 42
> *********************************************
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com
This email sent to [email protected]