andyjeffries / motion-audio

A simple example of how to play audio in iOS with RubyMotion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RubyMotion Simple Audio Playback

This is a simple example of playing an audio file from RubyMotion

The first step is to add AudioToolbox to the app.frameworks in Rakefile.

The audio is then played by getting the URL to the audio file within the resources folder using NSBundle.mainBundle.URLForResource:withExtension and then passing that URL (which is compatible with CFURLRef) to AudioServicesCreateSystemSoundID, dereferencing the Pointer passed in and passing that to AudioServicesPlaySystemSound.

About

A simple example of how to play audio in iOS with RubyMotion


Languages

Language:Ruby 100.0%