AVAudioMixInputParameters Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AVFoundation.framework
Availability
Available in iOS 4.0 and later.
Declared in
AVAudioMix.h

Overview

An AVAudioMixInputParameters object represents the parameters that should be applied to an audio track when it is added to a mix.

You use an instance AVAudioMixInputParameters to apply audio volume ramps for an input to an audio mix. Mix parameters are associated with audio tracks via the trackID property.

Audio volume is currently supported as a time-varying parameter. AVAudioMixInputParameters has a mutable subclass, AVMutableAudioMixInputParameters.

Before the first time at which a volume is set, a volume of 1.0 used; after the last time for which a volume has been set, the last volume is used. Within the time range of a volume ramp, the volume is interpolated between the start volume and end volume of the ramp. For example, setting the volume to 1.0 at time 0 and also setting a volume ramp from a volume of 0.5 to 0.2 with a timeRange of [4.0, 5.0] results in an audio volume parameters that hold the volume constant at 1.0 from 0.0 sec to 4.0 sec, then cause it to jump to 0.5 and descend to 0.2 from 4.0 sec to 9.0 sec, holding constant at 0.2 thereafter.

Given that this is an immutable variant of the object, you should not allocate and initialize a version of this class yourself. Other classes may return instances of this class.

Tasks

Getting the Track ID

Getting Volume Ramps

Getting an Audio Tap

Getting the Time Pitch Algorithm Setting

Properties

audioTapProcessor

The audio processing tap associated with the track. (read-only)

@property(nonatomic, readonly, retain) MTAudioProcessingTapRef audioTapProcessor
Discussion

You can use the audio tap to access the track’s audio data before it is played, read, or exported.

This property is nil by default.

The process of setting up a tap requires the configuration of an instance of AVMutableAudioMixInputParameters. If an instance of AVMutableAudioMixInputParameters is present in the inputParameters array of an AVAudioMix, the results of mutating the AVMutableAudioMixInputParameters while the audio mix is in use are undefined

Availability
  • Available in iOS 6.0 and later.
Declared In
AVAudioMix.h

audioTimePitchAlgorithm

The processing algorithm used to manage audio pitch for scaled audio edits.

@property(nonatomic, copy) NSString *audioTimePitchAlgorithm
Discussion

The supported constants are defined in Time Pitch Algorithm Settings.

An NSInvalidArgumentException will be raised if this property is set to a value other than the defined constants.

Availability
  • Available in iOS 7.0 and later.
Declared In
AVAudioMix.h

trackID

The ID of the audio track to which the parameters should be applied. (read-only)

@property(nonatomic, readonly) CMPersistentTrackID trackID
Availability
  • Available in iOS 4.0 and later.
Declared In
AVAudioMix.h

Instance Methods

getVolumeRampForTime:startVolume:endVolume:timeRange:

Obtains the volume ramp that includes the specified time.

- (BOOL)getVolumeRampForTime:(CMTime)time startVolume:(float *)startVolume endVolume:(float *)endVolume timeRange:(CMTimeRange *)timeRange
Parameters
time

If a ramp with a time range that contains the specified time has been set, information about the effective ramp for that time is supplied. Otherwise, information about the first ramp that starts after the specified time is supplied.

startVolume

A pointer to a float to receive the starting volume value for the volume ramp.

This value may be NULL.

endVolume

A pointer to a float to receive the ending volume value for the volume ramp.

This value may be NULL.

timeRange

A pointer to a CMTimeRange to receive the time range of the volume ramp.

This value may be NULL.

Return Value

YES if the values were retrieved successfully, otherwise NO. Returns NO if time is beyond the duration of the last volume ramp that has been set.

Discussion

The process of setting up volume ramps requires the configuration of an instance of AVMutableAudioMixInputParameters.

Availability
  • Available in iOS 4.0 and later.
Declared In
AVAudioMix.h