<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PHASE",
  "identifier" : "/documentation/PHASE/PHASEGroupPreset",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "PHASE"
    ],
    "preciseIdentifier" : "c:objc(cs)PHASEGroupPreset"
  },
  "title" : "PHASEGroupPreset"
}
-->

# PHASEGroupPreset

A collection of settings for groups.

```
class PHASEGroupPreset
```

## Overview

Group presets pair groups with audio settings that your app can apply to specific sounds at a particular time in your app’s life cycle. This class enables many predefined group settings to take effect all at once.

### Toggle Between Group Presets

The group preset’s utility materializes when you switch between settings. The following example creates two group presets: one for an in-game experience and another for a menu that displays when the user pauses the app.

```objc
// Create groups for the sounds. 
PHASEGroup* bgmGroup = [[PHASEGroup alloc] initWithEngine:_objects->mEngine uid:@"backgroundMusicGroup"];
PHASEGroup* voGroup = [[PHASEGroup alloc] initWithEngine:_objects->mEngine uid:@"voiceOverGroup"];
PHASEGroup* menuGroup = [[PHASEGroup alloc] initWithEngine:_objects->mEngine uid:@"menuSoundsGroup"];

// Create settings for the groups.
PHASEGroupPresetSetting* groupSettingFullVolume = [PHASEGroupPresetSetting alloc] initWithGain:1
    rate:1 gainCurveType:PHASECurveTypeLinear rateCurveType:PHASECurveTypeLinear];
                                                
PHASEGroupPresetSetting* groupSettingZeroVolume = [PHASEGroupPresetSetting alloc] initWithGain:0
    rate:1 gainCurveType:PHASECurveTypeLinear rateCurveType:PHASECurveTypeLinear];

// Create a dictionary for the `settings` argument of the group preset initializer.
NSMutableDictionary<PHASEGroup*, PHASEGroupPresetSetting*> pauseMenuDictionary;

// Enable volume only for menu group sounds.
[pauseMenuDictionary setObject:groupSettingFullVolume forKey:menuGroup]
[pauseMenuDictionary setObject:groupSettingZeroVolume forKey:bgmGroup]
[pauseMenuDictionary setObject:groupSettingZeroVolume forKey:voGroup]
PHASEGroupPreset* pauseMenuPreset = [[PHASEGroupPreset alloc] initWithEngine:myPHASEEngine
    settings:pauseMenuDictionary timeToTarget:1 timeToReset:1];

// Create a settings dictionary for the in-game experience.
NSMutableDictionary<PHASEGroup*, PHASEGroupPresetSetting*> inGameDictionary;

// Enable volume only for in-game sounds.
[inGameDictionary setObject:groupSettingZeroVolume forKey:menuGroup]
[inGameDictionary setObject:groupSettingFullVolume forKey:bgmGroup]
[inGameDictionary setObject:groupSettingFullVolume forKey:voGroup]
PHASEGroupPreset* inGamePreset = [[PHASEGroupPreset alloc] initWithEngine:myPHASEEngine
    settings:inGameDictionary timeToTarget:1 timeToReset:1];

// Activate the pause menu preset when the user pauses the app.
[pauseMenuPreset activate];

// Activate the in-game preset when the user resumes the app. 
[inGamePreset activate];

// Clear the current preset by deactivating it.
[myPHASEEngine.activeGroupPreset deactivate]
```

## Topics

### Creating a Group Preset

[`-  initWithEngine:settings:timeToTarget:timeToReset:`](/documentation/PHASE/PHASEGroupPreset/init(engine:settings:timeToTarget:timeToReset:))

Creates a group preset with the designated engine, settings, and fade parameters.

### Applying Settings

[`settings`](/documentation/PHASE/PHASEGroupPreset/settings)

A dictionary with preset setting values and group objects as keys.

### Fading Between Settings

[`timeToTarget`](/documentation/PHASE/PHASEGroupPreset/timeToTarget)

A duration in which the engine fades the settings from their original value to their new value.

[`timeToReset`](/documentation/PHASE/PHASEGroupPreset/timeToReset)

A duration in which the framework restores the group’s original state.

### Activating a Group Preset

[`-  activate`](/documentation/PHASE/PHASEGroupPreset/activate())

Applies settings to the designated groups.

[`-  activateWithTimeToTargetOverride:`](/documentation/PHASE/PHASEGroupPreset/activate(timeToTargetOverride:))

Applies settings with an overriden fade duration.

### Deactivating a Group Preset

[`-  deactivate`](/documentation/PHASE/PHASEGroupPreset/deactivate())

Reverts settings for the preset’s groups.

[`-  deactivateWithTimeToResetOverride:`](/documentation/PHASE/PHASEGroupPreset/deactivate(timeToResetOverride:))

Reverts settings for the preset’s groups using a timed adjustment.

## Relationships

### Conforms To

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`CVarArg`](/documentation/Swift/CVarArg)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)