# Manage in-meeting audio settings

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

After the SDK is initialized and you are connected to the Zoom client, use `ZoomToolSuiteAPI.Setting.Audio`
for device selection and audio processing, and `ZoomToolSuiteAPI.Meeting.Audio` for in-meeting mute
controls. Participant audio state comes from `ZoomToolSuiteUser` via `ZoomToolSuiteAPI.Meeting.Participants`.

APIs are static on `ZoomToolSuiteAPI.Setting.Audio` and `ZoomToolSuiteAPI.Meeting.Audio`.

## Participant audio state

`ZoomToolSuiteUser` exposes `ZoomToolSuiteAudioType` and `bAudioMuted`.

```swift
let me = ZoomToolSuiteAPI.Meeting.Participants.getMySelf()
let _ = me.audioType
let _ = me.bAudioMuted
if let other = ZoomToolSuiteAPI.Meeting.Participants.getUserByUserID(12345, meetingType: .default) {
    let _ = other.audioType
}
```

## Manage the audio speaker

List devices with `getAudioDeviceList(false)`, and inspect devices with `ZoomToolSuiteDeviceInfo`.
Switch devices with `selectAudioDevice(_:deviceId:deviceName:completion:)`, with the first
parameter for the speaker set as `false`.

```swift
let speakers = ZoomToolSuiteAPI.Setting.Audio.getAudioDeviceList(bMic: false)
for device in speakers where device.isSelected {
    // current output
}
ZoomToolSuiteAPI.Setting.Audio.selectAudioDevice(
    bMic: false,
    deviceId: deviceId,
    deviceName: deviceName
) { result in
}
```

## Manage the audio microphone

Managing audio microphone follows a similar pattern as managing the audio speaker. List devices with
`getAudioDeviceList(true)`, and inspect devices with `ZoomToolSuiteDeviceInfo`. Switch with
`selectAudioDevice(_:deviceId:deviceName:completion:)`, with the first parameter for the microphone set as `true`.

```swift
let mics = ZoomToolSuiteAPI.Setting.Audio.getAudioDeviceList(bMic: true)
ZoomToolSuiteAPI.Setting.Audio.selectAudioDevice(
    bMic: true,
    deviceId: deviceId,
    deviceName: deviceName
) { result in
}
```

## Mute or unmute your microphone

To mute the current user's microphone, use `muteMyAudio`. To unmute on the current user's microphone,
use `unmuteMyAudio`. To toggle the current user's microphone mute or unmute status, use `toggleMyAudioStatus`.

```swift
ZoomToolSuiteAPI.Meeting.Audio.muteMyAudio { result in
}
ZoomToolSuiteAPI.Meeting.Audio.unmuteMyAudio { result in
}
ZoomToolSuiteAPI.Meeting.Audio.toggleMyAudioStatus { result in
}
```

Hosts can control whether participants may unmute themselves. To check if participants are
allowed to unmute themselves, hosts can use `isParticipantsUnmuteSelfAllowed`. To let all
participants mute or unmute themselves, use `allowParticipantsToUnmuteSelf`.

```swift
ZoomToolSuiteAPI.Meeting.Participants.isParticipantsUnmuteSelfAllowed { result in
    // result.value, etc.
}
ZoomToolSuiteAPI.Meeting.Participants.allowParticipantsToUnmuteSelf(
    true,
    completion: { _ in },
    meetingType: .default
)
```

## Mute or unmute everyone

To mute all current participants, use `muteAllAudio`. To unmute all current participants, use `unMuteAllAudio`.

**NOTE** Only hosts or co-hosts may mute or unmute all participants.

```swift
ZoomToolSuiteAPI.Meeting.Audio.muteAllAudio { result in
}
ZoomToolSuiteAPI.Meeting.Audio.unMuteAllAudio { result in
}
```

## Mute participants on entry

To mute participants as they enter the meeting, use `enableMuteOnEntryFeature`. To see if
this feature is currently enabled, use `isMuteOnEntryFeatureOn`.

```swift
ZoomToolSuiteAPI.Meeting.Audio.enableMuteOnEntryFeature(
    enable: true,
    allowUnmuteBySelf: true,
    completion: { _ in },
    meetingType: .default
)
ZoomToolSuiteAPI.Meeting.Audio.isMuteOnEntryFeatureOn { _ in
}
```
