AudioSpeakerMode
The speaker configurations that Unity supports.
Read time 2 minutesLast updated 4 days ago
Definition
- Type: Enum
- Namespace: UnityEngine
- Assembly: UnityEngine.AudioModule
public enum AudioSpeakerMode
Remarks
Unity supports multiple speaker types. Each speaker type has a different number of channels and is suitable for different device types and situations. The operating system (OS) and hardware determine the final output. Unity requests a mode, but the system might override it. Always check the actual mode at runtime.
Note: configures the global audio output layout for the entire application. It doesn't assign an AudioSource to an individual speaker channel (for example, front left or rear right). To place sounds in the mix, use AudioSource.panStereo for left-right balance on mono or stereo clips, AudioSource.spatialBlend and the source position for 3D spatialization, AudioSource.spread for multichannel clips in speaker space.
AudioSpeakerModeThe following are common uses for the speaker modes:
- Stereo is the standard default for most applications.
- Use Mono for accessibility reasons.
- Use 5.1 or 7.1 for high-end PC and console setups, home televisions, theaters.
- Use Quad and 5.0 for specific installations.
- Only use Pro Logic if you must support matrix decoding.
Use AudioSettings.GetConfiguration and AudioSettings.Reset to request a speaker mode at runtime. The device might not accept or support your requested speaker mode. In that case:
- On some platforms, Unity automatically reduces the audio channel count (downmixes) to one your device supports.
- On other platforms, Unity runs the device's native channel count.
To set your project's default speaker mode, go to the Audio Manager: go to Edit > Project Settings > Audio and set Default Speaker Mode to your preferred speaker mode.
The following example demonstrates how to check the current speaker mode at runtime.
using UnityEngine;public class SpeakerModeExample : MonoBehaviour{ void Start() { Debug.Log("Current Speaker Mode: " + AudioSettings.GetConfiguration().speakerMode); }}
Additional Resources: AudioSettings, AudioSource.panStereo, AudioSource.spatialBlend, AudioSource.spread, AudioMixer, Audio Manager.
Fields
Value | Description |
|---|---|
| Mode5point1 | The Surround 5.1 speaker setup which contains six channels. |
| Mode7point1 | The Surround 7.1 speaker setup which contains eight channels. |
| Mono | The speakers are mono and contain one channel. |
| Prologic | Stereo output, but data is encoded in a way that is picked up by a Pro Logic or Pro Logic 2 decoder and split into a 5.1 speaker setup. |
| Quad | The Quad 4.0 speaker setup which contains four channels. |
| Stereo | The speakers are stereo and contain two channels. |
| Surround | The Surround 5.0 speaker setup which contains five channels. |