Table of Contents

Class Speaker

Namespace
Exiled.API.Features.Toys
Assembly
Exiled.API.dll

A wrapper class for AdminToys.SpeakerToy.

public class Speaker : AdminToy, IWorldSpace, IPosition, IRotation, IWrapper<SpeakerToy>
Inheritance
Speaker
Implements
IWrapper<SpeakerToy>
Inherited Members
Extension Methods

Properties

Base

Gets the base AdminToys.SpeakerToy.

public SpeakerToy Base { get; }

Property Value

SpeakerToy

ControllerId

Gets or sets the controller ID of speaker.

public byte ControllerId { get; set; }

Property Value

byte

IsSpatial

Gets or sets a value indicating whether the audio source is spatialized.

public bool IsSpatial { get; set; }

Property Value

bool

A bool where true means the audio source is spatial, allowing for 3D audio positioning relative to the listener; false means it is non-spatial.

MaxDistance

Gets or sets the maximum distance at which the audio source can be heard.

public float MaxDistance { get; set; }

Property Value

float

A float representing the maximum hearing distance for the audio source. Beyond this distance, the audio will not be audible.

MinDistance

Gets or sets the minimum distance at which the audio source reaches full volume.

public float MinDistance { get; set; }

Property Value

float

A float representing the distance from the source at which the audio is heard at full volume. Within this range, volume will not decrease with proximity.

Prefab

Gets the prefab.

public static SpeakerToy Prefab { get; }

Property Value

SpeakerToy

Volume

Gets or sets the volume of the audio source.

public float Volume { get; set; }

Property Value

float

A float representing the volume level of the audio source, where 0.0 is silent and 1.0 is full volume.

Methods

Create(Vector3?, Vector3?, Vector3?, bool)

Creates a new Speaker.

public static Speaker Create(Vector3? position, Vector3? rotation, Vector3? scale, bool spawn)

Parameters

position Vector3?

The position of the Speaker.

rotation Vector3?

The rotation of the Speaker.

scale Vector3?

The scale of the Speaker.

spawn bool

Whether the Speaker should be initially spawned.

Returns

Speaker

The new Speaker.

Play(byte[], int?, IEnumerable<Player>)

Plays audio through this speaker.

public void Play(byte[] samples, int? length = null, IEnumerable<Player> targets = null)

Parameters

samples byte[]

Audio samples.

length int?

The length of the samples array.

targets IEnumerable<Player>

Targets who will hear the audio. If null, audio will be sent to all players.

Play(AudioMessage, IEnumerable<Player>)

Plays audio through this speaker.

public static void Play(AudioMessage message, IEnumerable<Player> targets = null)

Parameters

message AudioMessage

An VoiceChat.Networking.AudioMessage instance.

targets IEnumerable<Player>

Targets who will hear the audio. If null, audio will be sent to all players.