On Apr 17, 2007, at 11:29 AM, James McCartney wrote: AudioChannelLayout *acl = (AudioChannelLayout*)calloc(1, sizeof(AudioChannelLayout) + 2 * sizeof(AudioChannelDescription)); acl->mChannelLayoutTag = kAudioChannelLayoutTag_UseChannelDescriptions; acl->mNumberChannelDescriptions = 3; acl->mChannelDescriptions[0].mChannelLabel = kAudioChannelLabel_Ambisonic_W; acl->mChannelDescriptions[1].mChannelLabel = kAudioChannelLabel_Ambisonic_X; acl->mChannelDescriptions[2].mChannelLabel = kAudioChannelLabel_Ambisonic_Y; UInt32 propertySize = sizeof(acl); OSStatus err = AudioFileSetProperty(afid, kAudioFilePropertyChannelLayout, propertySize, acl); free(acl);
...never write code in email should be more like this:
UInt32 propertySize = sizeof(AudioChannelLayout) + 2 * sizeof(AudioChannelDescription); AudioChannelLayout *acl = (AudioChannelLayout*)calloc(1, propertySize); acl->mChannelLayoutTag = kAudioChannelLayoutTag_UseChannelDescriptions; acl->mNumberChannelDescriptions = 3; acl->mChannelDescriptions[0].mChannelLabel = kAudioChannelLabel_Ambisonic_W; acl->mChannelDescriptions[1].mChannelLabel = kAudioChannelLabel_Ambisonic_X; acl->mChannelDescriptions[2].mChannelLabel = kAudioChannelLabel_Ambisonic_Y; OSStatus err = AudioFileSetProperty(afid, kAudioFilePropertyChannelLayout, propertySize, acl); free(acl);
|