Contents

PHASEEngine

An object that manages audio assets, controls playback, and configures environmental effects.

Declaration

class PHASEEngine

Overview

Before using PHASE, an app creates an instance of this object. Apps access all of the framework’s functionality through engine functions or properties, or through other PHASE classes into which you pass the engine object.

Create and Start the Engine

To create an engine object, choose a value for the init(updateMode:) argument that selects the desired control over scene setup and playback timing.

// Apps that need precise audio synchronization and 
// synchronized dynamic mix control pass in `.manual`.
engine = PHASEEngine(updateMode: .automatic) 

Then, load your sound assets, sound event assets, and shapes for sound occlusion. Before your app attempts to play sounds, start the engine object.

do { try engine.start() } 
catch { /* Handle the error. */ }

To stop audio playback and enable the engine to deallocate system resources, call the stop() function.

engine.stop()

Topics

Creating an Engine

Registering Audio Resources

Accessing Scene Hierarchy

Defining Environmental Effects

Controlling and Inspecting Playback State

Managing Groups of Sounds

Accessing In-Flight Audio

Measuring Units

See Also

Setup