Class

AVAudioTime

A class used by the audio engine to represent time.

Declaration

@interface AVAudioTime : NSObject

Overview

Instances of this class are immutable.

A single moment in time may be represented in two different ways:

  • Using mach_absolute_time(), the system's basic clock. Referred to as “host time.”

  • Audio samples at a particular sample rate.

A single AVAudioTime instance may contain either or both representations; it might represent only a sample time, only a host time, or both.

Topics

Creating an Audio Time Instance

- initWithAudioTimeStamp:sampleRate:

Initializes a new audio time object with the AudioTimeStamp struct and sample rate.

- initWithHostTime:

Initializes a new audio time object with the specified host time.

- initWithHostTime:sampleTime:atRate:

Initializes a new audio time object with the specified host time, sample time, and sample rate.

- initWithSampleTime:atRate:

Initializes a new audio time object with the specified AudioTimeStamp struct and sample rate.

+ timeWithAudioTimeStamp:sampleRate:

Creates an audio time object with the specified AudioTimeStamp struct and sample rate.

+ timeWithHostTime:sampleTime:atRate:

Creates an audio time object with the specified host time, sample time, and sample rate.

+ timeWithSampleTime:atRate:

Creates an audio time object with the specified sample time and sample rate.

+ timeWithHostTime:

Creates an audio time object with the specified host time.

- extrapolateTimeFromAnchor:

Creates an audio time object by converting between host and sample time.

Manipulating Host Time

hostTime

The host time.

hostTimeValid

A Boolean value that indicates whether the host time value is valid.

+ hostTimeForSeconds:

Converts seconds to host time.

+ secondsForHostTime:

Converts host time to seconds.

Getting Sample Rate Information

sampleRate

The sample rate at which the sample time is being expressed.

sampleTime

The time as a number of audio samples, as tracked by the current audio device.

sampleTimeValid

A Boolean value that indicates whether the sample time and sample rate properties are valid.

Getting the CoreAudio Time Stamp

audioTimeStamp

The time expressed as an AudioTimeStamp structure.

Relationships

Inherits From

See Also

First Steps

AVAudioFile

An audio file that can be opened for reading or writing.

AVAudioBuffer

A buffer of audio data and its format.

Audio Settings and Formats

Define audio data with these constants and classes.

Enabling USB Audio and MIDI for iOS

Set up your system to record digital audio from an iOS device and exchange MIDI data with it by enabling Inter-Device Audio and MIDI.