I finally have playback of multichannel audio with code based on PlayFile.cpp.
Using AudioFileGetProperty(), I load a file into a buffer:
XThrowIfError (AudioFileGetProperty(fAudioFile, kAudioFilePropertyDataFormat, &propsize, &fFileFormat), "AudioFileGetProperty");
I could not get sound when playing a multichannel file; I thought it was because I wasn't using SetFormat(), but it apparently it causes an exception, of which kind I don't know:
/*** using SetFormat seems to cause an exception, any idea why? ***/
I finally decided to comment-out any code that calls SetNumberChannels() or SetSampleRate(). Removing these results in successful playback of multichannel audio, any idea why?
/*** commenting-out these lines results in successful playback of multichannel audio, why? ***/
Any pointers would be helpful.
Mike |