Struct ChannelEnumConverter
Utility class for converting between AudioSpeakerMode, SoundFormat, and channel count
Inherited Members
Namespace: Unity.Audio
Syntax
public struct ChannelEnumConverter
Methods
GetChannelCountFromSoundFormat(SoundFormat)
Get the channel count for a SoundFormat
Declaration
public static int GetChannelCountFromSoundFormat(SoundFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| SoundFormat | format | The sound format whose channel count is desired |
Returns
| Type | Description |
|---|---|
| Int32 | The number of channels for the provided format |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |
GetSoundFormatFromSpeakerMode(AudioSpeakerMode)
Convert an AudioSpeakerMode to a SoundFormat
Declaration
public static SoundFormat GetSoundFormatFromSpeakerMode(AudioSpeakerMode mode)
Parameters
| Type | Name | Description |
|---|---|---|
| AudioSpeakerMode | mode | The speaker mode to convert |
Returns
| Type | Description |
|---|---|
| SoundFormat | The equivalent sound format |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |