---
title: "init(audioSource:relativeAudioSourceReference:)"
framework: intents
role: symbol
role_heading: Initializer
path: "intents/insetaudiosourceincarintent/init(audiosource:relativeaudiosourcereference:)"
---

# init(audioSource:relativeAudioSourceReference:)

Initializes the intent object with the specified audio source information.

## Declaration

```swift
init(audioSource: INCarAudioSource, relativeAudioSourceReference: INRelativeReference)
```

## Parameters

- `audioSource`: The specific audio source to select. If you want to specify the next or previous audio source instead of a specific audio source, specify doc://com.apple.sirikit/documentation/Intents/INCarAudioSource/sourceUnknown for this parameter and specify an appropriate value in the relativeAudioSourceReference parameter.
- `relativeAudioSourceReference`: The relative audio source to select. If you want to select a specific audio source instead, specify doc://com.apple.sirikit/documentation/Intents/INRelativeReference/unknown for this parameter and specify an appropriate value in the audioSource parameter.

## Return Value

Return Value An initialized intent object or nil if the object could not be created.

## Discussion

Discussion Normally, you don’t create instances of this class yourself. Instead, Siri creates instances when the user asks to change the vehicle’s audio source. However, you can use this method during testing to create intent objects in order to validate your intent handling code paths. Your test code should always specify the unknown constant for one of the parameters; don’t specify the unknown constant for both parameters.
