AudioStreamBasicDescription help
AudioStreamBasicDescription help
- Subject: AudioStreamBasicDescription help
- From: David Blake <email@hidden>
- Date: Tue, 24 May 2011 23:49:13 +1000
Hi,
Forgive me for this is probably a simple and easy question for most of you hardened veterans. I am attempting to learn Audio Units on iOS. I am editing the Apple sample project MixerHost, and im trying to get it to play my own wav file which I have loaded into the project. My problem is setting up the AudioStreamBasicDescription for the wav. I cant seem to work out how to know what settings to specify for my file, how do I know what properties my file has ?
I thought I could use
result = ExtAudioFileGetProperty (
audioFileObject,
kExtAudioFileProperty_FileDataFormat,
&formatPropertySize,
&fileAudioFormat
);
to return the format of my file, but that doesn't seem to work, and curiously when I run that on the caf files supplied in the sample project by apple, it actually returns a different ASBD to what they actually feed in in the project.
The printout of the ASBD defined for the 'beats' file in the project:
Sample Rate: 44100
Format ID: lpcm
Format Flags: C2C
Bytes per Packet: 4
Frames per Packet: 1
Bytes per Frame: 4
Channels per Frame: 1
Bits per Channel: 32
The properties of the same file as retrieved using kExtAudioFileProperty_FileDataFormat:
Sample Rate: 44100
Format ID: lpcm
Format Flags: E
Bytes per Packet: 3
Frames per Packet: 1
Bytes per Frame: 3
Channels per Frame: 1
Bits per Channel: 24
Just for informations sake, here is the property of my file as retrieved using kExtAudioFileProperty_FileDataFormat:
Sample Rate: 44100
Format ID: lpcm
Format Flags: C
Bytes per Packet: 2
Frames per Packet: 1
Bytes per Frame: 2
Channels per Frame: 1
Bits per Channel: 16
I'm pretty sure everything else is set up fine in the project as at one point I lucked in with the settings and I got it to play the file, albeit it was a bit garbled, and in attempting to fix it I lost the settings. My presumption is that my file is not in 'canonical' (the AudioSampleUnitType format) format. Although I have no idea how to check? And if it isn't, how to convert it to/save it as AudioSampleUnitType format?
If anyone can answer this or point me in the direction of something that can I would be most grateful.
Regards,
David
_______________________________________________
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