AsoundingReference

ASNMusic

Inherits fromNSObject
Declared inASNMusic.h
Part ofAsounding Audio Engine

Overview

A music for playing in the background by the ASNEngine.

Tasks

Initializing a music object

- initWithContentsOfURL:error:
Initialize with music from the given URL.

Setting Playback Parameters

duration property
The duration of the music.
numberOfLoops property
Number of times this music will repeat.

Properties

duration

The duration of the music.

@property(readonly) NSTimeInterval duration

numberOfLoops

Number of times this music will repeat.

@property(assign) NSInteger numberOfLoops

Discussion

Use value -1 to repeat indefinitely.

Instance Methods

initWithContentsOfURL:error:

Initialize with music from the given URL.

- (id)initWithContentsOfURL:(NSURL *)url error:(NSError **)outError

Parameters

url
URL to read the music from.
outError
Error object in case music couldn't be loaded.

Discussion

The selected audio file must be in a format understood by CoreAudio. This includes AIFF, WAV, MP3, AAC, and CAF files. Compressed formats such as MP3 and AAC will benefit from the hardware decoder when available.