[Mono-osx] How do I play audio files using AudioToolbox APIs?

Andrew Friedley afriedle at indiana.edu
Sat Mar 31 15:07:51 UTC 2012


I'm an experienced C programmer but new to C#/OSX development, and am having trouble figuring out how to connect the AudioFile and OutputAudioQueue APIs to play an MP3.  I've been looking at the mono touch StreamingAudio example, but AudioFile doesn't have the event callbacks (PacketDecoded, PropertyFound) that AudioFileStream does.

Reading the Apple documentation, it looks like AudioFile.ReadPacketData is what I want to use for reading, however that gives me data in a byte array.  I've been trying to figure out how to get that data into an IntPtr form for handing off to OutputAudioQueue.EnqueueBuffer, but not having any luck.  What is the proper way to pull data from an audio file and play it using the AudioToolbox APIs?

Thanks,

Andrew


More information about the Mono-osx mailing list