ObjectAL
 All Classes Functions Variables Properties Pages
Instance Methods | Class Methods | Protected Attributes | Properties | List of all members
OALAudioFile Class Reference

Maintains an open audio file and allows loading data from that file into new ALBuffer objects. More...

#import <OALAudioFile.h>

Inheritance diagram for OALAudioFile:

Instance Methods

(id) - initWithUrl:reduceToMono:
 Initialize this object with the audio file at the specified URL. More...
 
(void *) - audioDataWithStartFrame:numFrames:bufferSize:
 Read audio data from this file into a new buffer. More...
 
(ALBuffer *) - bufferNamed:startFrame:numFrames:
 Create a new ALBuffer with the contents of this file. More...
 

Class Methods

(OALAudioFile *) + fileWithUrl:reduceToMono:
 Open the audio file at the specified URL. More...
 
(ALBuffer *) + bufferFromUrl:reduceToMono:
 Convenience method to load the entire contents of a URL into a new ALBuffer. More...
 

Protected Attributes

AudioStreamBasicDescription streamDescription
 A description of the audio data in this file. More...
 
ExtAudioFileRef fileHandle
 The OS specific file handle. More...
 
UInt32 originalChannelsPerFrame
 The actual number of channels in the audio data if not reducing to mono. More...
 

Properties

NSURL * url
 The URL of the audio file. More...
 
AudioStreamBasicDescription * streamDescription
 A description of the audio data in this file. More...
 
SInt64 totalFrames
 The total number of audio frames in this file. More...
 
bool reduceToMono
 If YES, reduce any stereo data to mono (stereo samples don't support panning or positional audio). More...
 

Detailed Description

Maintains an open audio file and allows loading data from that file into new ALBuffer objects.

Method Documentation

- (void *) audioDataWithStartFrame: (SInt64)  startFrame
numFrames: (SInt64)  numFrames
bufferSize: (UInt32*)  bufferSize 

Read audio data from this file into a new buffer.

Parameters
startFrameThe starting audio frame to read data from.
numFramesThe number of frames to read.
bufferSizeOn successful return, contains the size of the returned buffer, in bytes.
Returns
The audio data or nil on error. You are responsible for calling free() on the data.
+ (ALBuffer *) bufferFromUrl: (NSURL*)  url
reduceToMono: (bool)  reduceToMono 

Convenience method to load the entire contents of a URL into a new ALBuffer.

Parameters
urlThe URL to open the audio file from.
reduceToMonoIf YES, reduce any stereo track to mono (stereo samples don't support panning or positional audio).
Returns
an ALBuffer object.
- (ALBuffer *) bufferNamed: (NSString*)  name
startFrame: (SInt64)  startFrame
numFrames: (SInt64)  numFrames 

Create a new ALBuffer with the contents of this file.

Parameters
nameThe name to be given to this ALBuffer.
startFrameThe starting audio frame to read data from.
numFramesThe number of frames to read.
Returns
a new ALBuffer containing the audio data.
+ (OALAudioFile *) fileWithUrl: (NSURL*)  url
reduceToMono: (bool)  reduceToMono 

Open the audio file at the specified URL.

Parameters
urlThe URL to open the audio file from.
reduceToMonoIf YES, reduce any stereo track to mono (stereo samples don't support panning or positional audio).
Returns
a new audio file object.
- (id) initWithUrl: (NSURL*)  url
reduceToMono: (bool)  reduceToMono 

Initialize this object with the audio file at the specified URL.

Parameters
urlThe URL to open the audio file from.
reduceToMonoIf YES, reduce any stereo track to mono (stereo samples don't support panning or positional audio).
Returns
the initialized audio file object.

Member Data Documentation

- (ExtAudioFileRef) fileHandle
protected

The OS specific file handle.

- (UInt32) originalChannelsPerFrame
protected

The actual number of channels in the audio data if not reducing to mono.

- (AudioStreamBasicDescription) streamDescription
protected

A description of the audio data in this file.

Property Documentation

- (bool) reduceToMono
readwritenonatomicassign

If YES, reduce any stereo data to mono (stereo samples don't support panning or positional audio).

- (AudioStreamBasicDescription *) streamDescription
readnonatomicassign

A description of the audio data in this file.

- (SInt64) totalFrames
readnonatomicassign

The total number of audio frames in this file.

- (NSURL *) url
readnonatomicretain

The URL of the audio file.


The documentation for this class was generated from the following files: