Class Speaker
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
IsSpatial
Gets or sets a value indicating whether the audio source is spatialized.
public bool IsSpatial { get; set; }
Property Value
- bool
A bool where
truemeans the audio source is spatial, allowing for 3D audio positioning relative to the listener;falsemeans 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 if it's more it's will amplify it.
Methods
Create(Vector3?, Vector3?, Vector3?, bool)
Creates a new Speaker.
public static Speaker Create(Vector3? position, Vector3? rotation, Vector3? scale, bool spawn)
Parameters
positionVector3?The position of the Speaker.
rotationVector3?The rotation of the Speaker.
scaleVector3?The scale of the Speaker.
spawnboolWhether the Speaker should be initially spawned.
Returns
Create(Transform, bool, bool)
Creates a new Speaker.
public static Speaker Create(Transform transform, bool spawn, bool worldPositionStays = true)
Parameters
transformTransformThe transform to create this Speaker on.
spawnboolWhether the Speaker should be initially spawned.
worldPositionStaysboolWhether the Speaker should keep the same world position.
Returns
Play(byte[], int?, IEnumerable<Player>)
Plays audio through this speaker.
public void Play(byte[] samples, int? length = null, IEnumerable<Player> targets = null)
Parameters
samplesbyte[]Audio samples.
lengthint?The length of the samples array.
targetsIEnumerable<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
messageAudioMessageAn VoiceChat.Networking.AudioMessage instance.
targetsIEnumerable<Player>Targets who will hear the audio. If
null, audio will be sent to all players.