Inherits from NSObject
Declared in OALAudioFile.h

Overview

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

Tasks

  •   url

    The URL of the audio file

    property
  •   streamDescription

    A description of the audio data in this file.

    property
  •   totalFrames

    The total number of audio frames in this file

    property
  •   reduceToMono

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

    property
  • + fileWithUrl:reduceToMono:

    Open the audio file at the specified URL. * * @param url The URL to open the audio file from. * @param reduceToMono If YES, reduce any stereo track to mono

                       (stereo samples don't support panning or positional audio).
    
    • @return a new audio file object.
  • – initWithUrl:reduceToMono:

    Initialize this object with the audio file at the specified URL. * * @param url The URL to open the audio file from. * @param reduceToMono If YES, reduce any stereo track to mono

                       (stereo samples don't support panning or positional audio).
    
    • @return the initialized audio file object.
  • – audioDataWithStartFrame:numFrames:bufferSize:

    Read audio data from this file into a new buffer.

  • – bufferNamed:startFrame:numFrames:

    Create a new ALBuffer with the contents of this file.

  • + bufferFromUrl:reduceToMono:

    Convenience method to load the entire contents of a URL into a new ALBuffer. * * @param url The URL to open the audio file from. * @param reduceToMono If YES, reduce any stereo track to mono

                       (stereo samples don't support panning or positional audio).
    
    • @return an ALBuffer object.

Properties

reduceToMono

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

@property (nonatomic, readwrite, assign) bool reduceToMono

Declared In

OALAudioFile.h

streamDescription

A description of the audio data in this file.

@property (nonatomic, readonly) AudioStreamBasicDescription *streamDescription

Declared In

OALAudioFile.h

totalFrames

The total number of audio frames in this file

@property (nonatomic, readonly) SInt64 totalFrames

Declared In

OALAudioFile.h

url

The URL of the audio file

@property (nonatomic, readonly) NSURL *url

Declared In

OALAudioFile.h

Class Methods

bufferFromUrl:reduceToMono:

Convenience method to load the entire contents of a URL into a new ALBuffer. * * @param url The URL to open the audio file from. * @param reduceToMono If YES, reduce any stereo track to mono

                   (stereo samples don't support panning or positional audio).
  • @return an ALBuffer object.
+ (ALBuffer *)bufferFromUrl:(NSURL *)url reduceToMono:(bool)reduceToMono

Declared In

OALAudioFile.h

fileWithUrl:reduceToMono:

Open the audio file at the specified URL. * * @param url The URL to open the audio file from. * @param reduceToMono If YES, reduce any stereo track to mono

                   (stereo samples don't support panning or positional audio).
  • @return a new audio file object.
+ (OALAudioFile *)fileWithUrl:(NSURL *)url reduceToMono:(bool)reduceToMono

Declared In

OALAudioFile.h

Instance Methods

audioDataWithStartFrame:numFrames:bufferSize:

Read audio data from this file into a new buffer.

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

Parameters

startFrame

The starting audio frame to read data from.

numFrames

The number of frames to read.

bufferSize

On successful return, contains the size of the returned buffer, in bytes.

Return Value

The audio data or nil on error. You are responsible for calling free() on the data.

Declared In

OALAudioFile.h

bufferNamed:startFrame:numFrames:

Create a new ALBuffer with the contents of this file.

- (ALBuffer *)bufferNamed:(NSString *)name startFrame:(SInt64)startFrame numFrames:(SInt64)numFrames

Parameters

name

The name to be given to this ALBuffer.

startFrame

The starting audio frame to read data from.

numFrames

The number of frames to read.

Return Value

a new ALBuffer containing the audio data.

Declared In

OALAudioFile.h

initWithUrl:reduceToMono:

Initialize this object with the audio file at the specified URL. * * @param url The URL to open the audio file from. * @param reduceToMono If YES, reduce any stereo track to mono

                   (stereo samples don't support panning or positional audio).
  • @return the initialized audio file object.
- (id)initWithUrl:(NSURL *)url reduceToMono:(bool)reduceToMono

Declared In

OALAudioFile.h