[Mono-osx] How do I play audio files using AudioToolbox APIs?
Andrew Friedley
afriedle at indiana.edu
Sat Apr 7 15:06:21 UTC 2012
Still trying to figure out.. I found that I can use audio units to output sound too, and tried working off this example:
https://github.com/migueldeicaza/MonoTouch.AudioUnit/blob/master/MonoTouch_AudioUnit_PlayingSoundFile/ExtAudioFilePlayer.cs
However a System.EntryPointNotFound exception is thrown from AudioComponentFindNext when I try to do this:
aComponent = AudioComponent.FindComponent(AudioTypeOutput.Default);
The example I linked to uses AudioTypeOutput.Remote, but that isn't defined in monomac. I've tried all four of the available options with the same result: Default, Generic, HAL, System.
Can anyone help, or point me at a working monomac example? Thanks,
Andrew
On Mar 31, 2012, at 8:07 AM, Andrew Friedley wrote:
> 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
> _______________________________________________
> Mono-osx mailing list
> Mono-osx at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-osx
More information about the Mono-osx
mailing list