Show / Hide Table of Contents

Class SoundInstance

The game object with audio source component. Used for manual playback and custom mixing logic.

Inheritance
System.Object
SoundInstance
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Stem
Assembly: Stem.dll
Syntax
public class SoundInstance

Properties

| Improve this Doc View Source

Looped

The flag indicating that the sound instance is looping. Set whether it should replay the audio clip after it finishes.

Declaration
public bool Looped { get; set; }
Property Value
Type Description
System.Boolean

True, if sound instance is looping. False otherwise.

| Improve this Doc View Source

Paused

The flag indicating that the sound instance is paused.

Declaration
public bool Paused { get; }
Property Value
Type Description
System.Boolean

True, if sound instance is paused. False otherwise.

| Improve this Doc View Source

Pitch

The pitch property allows controlling how high or low the tone of the audio source is.

Declaration
public float Pitch { get; set; }
Property Value
Type Description
System.Single

Pitch value in [3;3] range.

| Improve this Doc View Source

Playing

The flag indicating that the sound instance is playing.

Declaration
public bool Playing { get; }
Property Value
Type Description
System.Boolean

True, if sound instance is playing. False otherwise.

| Improve this Doc View Source

Position

The position of the sound instance in world space.

Declaration
public Vector3 Position { get; set; }
Property Value
Type Description
Vector3

A world space coordinates of the sound instance.

Remarks

Non-null Target will override this property value.

| Improve this Doc View Source

Sound

The reference to a sound which will be used for playback. Changing this value allows playing different sounds.

Declaration
public Sound Sound { get; set; }
Property Value
Type Description
Sound

A reference to a sound.

| Improve this Doc View Source

Target

The transform component to which sound instance is attached.

Declaration
public Transform Target { get; set; }
Property Value
Type Description
Transform

A reference a transform component.

Remarks

Once set, it will override Position property value.

| Improve this Doc View Source

TimeSamples

The playback position in samples.

Declaration
public int TimeSamples { get; }
Property Value
Type Description
System.Int32

An offset in samples from the start of an audio clip.

| Improve this Doc View Source

Volume

The volume property allows controlling the overall level of sound coming to the audio source.

Declaration
public float Volume { get; set; }
Property Value
Type Description
System.Single

Volume value in [0;1] range.

Methods

| Improve this Doc View Source

Pause()

Pauses sound.

Declaration
public void Pause()
| Improve this Doc View Source

Play()

Plays sound.

Declaration
public void Play()
| Improve this Doc View Source

Play(Int32)

Plays specific sound variation.

Declaration
public void Play(int variationIndex)
Parameters
Type Name Description
System.Int32 variationIndex

Variation index. Must be within Variations bounds.

| Improve this Doc View Source

Play(Int32, Single)

Plays specific sound variation.

Declaration
public void Play(int variationIndex, float volume)
Parameters
Type Name Description
System.Int32 variationIndex

Variation index. Must be within Variations bounds.

System.Single volume

Volume of the sound. Value must be in [0;1] range.

Remarks

Volume parameter value will override SoundVariation.Volume value.

| Improve this Doc View Source

Play(Int32, Single, Single)

Plays specific sound variation.

Declaration
public void Play(int variationIndex, float volume, float pitch)
Parameters
Type Name Description
System.Int32 variationIndex

Variation index. Must be within Variations bounds.

System.Single volume

Volume of the sound. Value must be in [0;1] range.

System.Single pitch

Pitch of the sound. Value must be in [-3;3] range.

Remarks

Volume parameter value will override SoundVariation.Volume value.

Pitch parameter value will override SoundVariation.Pitch value.

| Improve this Doc View Source

Play(Int32, Single, Single, Single)

Plays specific sound variation.

Declaration
public void Play(int variationIndex, float volume, float pitch, float delay)
Parameters
Type Name Description
System.Int32 variationIndex

Variation index. Must be within Variations bounds.

System.Single volume

Volume of the sound. Value must be in [0;1] range.

System.Single pitch

Pitch of the sound. Value must be in [-3;3] range.

System.Single delay

Delay of the sound. Value must be greater or equal to zero.

Remarks

Volume parameter value will override SoundVariation.Volume value.

Pitch parameter value will override SoundVariation.Pitch value.

Delay parameter value will override SoundVariation.Delay value.

| Improve this Doc View Source

Play(Single)

Plays sound.

Declaration
public void Play(float volume)
Parameters
Type Name Description
System.Single volume

Volume of the sound. Value must be in [0;1] range.

Remarks

Volume parameter value will override SoundVariation.Volume value.

| Improve this Doc View Source

Play(Single, Single)

Plays sound.

Declaration
public void Play(float volume, float pitch)
Parameters
Type Name Description
System.Single volume

Volume of the sound. Value must be in [0;1] range.

System.Single pitch

Pitch of the sound. Value must be in [-3;3] range.

Remarks

Volume parameter value will override SoundVariation.Volume value.

Pitch parameter value will override SoundVariation.Pitch value.

| Improve this Doc View Source

Play(Single, Single, Single)

Plays sound.

Declaration
public void Play(float volume, float pitch, float delay)
Parameters
Type Name Description
System.Single volume

Volume of the sound. Value must be in [0;1] range.

System.Single pitch

Pitch of the sound. Value must be in [-3;3] range.

System.Single delay

Delay of the sound. Value must be greater or equal to zero.

Remarks

Volume parameter value will override SoundVariation.Volume value.

Pitch parameter value will override SoundVariation.Pitch value.

Delay parameter value will override SoundVariation.Delay value.

| Improve this Doc View Source

Play3D(Vector3)

Plays sound in 3D space.

Declaration
public void Play3D(Vector3 position)
Parameters
Type Name Description
Vector3 position

Position of the sound.

| Improve this Doc View Source

Play3D(Vector3, Int32)

Plays specific sound variation in 3D space.

Declaration
public void Play3D(Vector3 position, int variationIndex)
Parameters
Type Name Description
Vector3 position

Position of the sound.

System.Int32 variationIndex

Variation index. Must be within Variations bounds.

| Improve this Doc View Source

Play3D(Vector3, Int32, Single)

Plays specific sound variation in 3D space.

Declaration
public void Play3D(Vector3 position, int variationIndex, float volume)
Parameters
Type Name Description
Vector3 position

Position of the sound.

System.Int32 variationIndex

Variation index. Must be within Variations bounds.

System.Single volume

Volume of the sound. Value must be in [0;1] range.

Remarks

Volume parameter value will override SoundVariation.Volume value.

| Improve this Doc View Source

Play3D(Vector3, Int32, Single, Single)

Plays specific sound variation in 3D space.

Declaration
public void Play3D(Vector3 position, int variationIndex, float volume, float pitch)
Parameters
Type Name Description
Vector3 position

Position of the sound.

System.Int32 variationIndex

Variation index. Must be within Variations bounds.

System.Single volume

Volume of the sound. Value must be in [0;1] range.

System.Single pitch

Pitch of the sound. Value must be in [-3;3] range.

Remarks

Volume parameter value will override SoundVariation.Volume value.

Pitch parameter value will override SoundVariation.Pitch value.

| Improve this Doc View Source

Play3D(Vector3, Int32, Single, Single, Single)

Plays specific sound variation in 3D space.

Declaration
public void Play3D(Vector3 position, int variationIndex, float volume, float pitch, float delay)
Parameters
Type Name Description
Vector3 position

Position of the sound.

System.Int32 variationIndex

Variation index. Must be within Variations bounds.

System.Single volume

Volume of the sound. Value must be in [0;1] range.

System.Single pitch

Pitch of the sound. Value must be in [-3;3] range.

System.Single delay

Delay of the sound. Value must be greater or equal to zero.

Remarks

Volume parameter value will override SoundVariation.Volume value.

Pitch parameter value will override SoundVariation.Pitch value.

Delay parameter value will override SoundVariation.Delay value.

| Improve this Doc View Source

Play3D(Vector3, Single)

Plays sound in 3D space.

Declaration
public void Play3D(Vector3 position, float volume)
Parameters
Type Name Description
Vector3 position

Position of the sound.

System.Single volume

Volume of the sound. Value must be in [0;1] range.

Remarks

Volume parameter value will override SoundVariation.Volume value.

| Improve this Doc View Source

Play3D(Vector3, Single, Single)

Plays sound in 3D space.

Declaration
public void Play3D(Vector3 position, float volume, float pitch)
Parameters
Type Name Description
Vector3 position

Position of the sound.

System.Single volume

Volume of the sound. Value must be in [0;1] range.

System.Single pitch

Pitch of the sound. Value must be in [-3;3] range.

Remarks

Volume parameter value will override SoundVariation.Volume value.

Pitch parameter value will override SoundVariation.Pitch value.

| Improve this Doc View Source

Play3D(Vector3, Single, Single, Single)

Plays sound in 3D space.

Declaration
public void Play3D(Vector3 position, float volume, float pitch, float delay)
Parameters
Type Name Description
Vector3 position

Position of the sound.

System.Single volume

Volume of the sound. Value must be in [0;1] range.

System.Single pitch

Pitch of the sound. Value must be in [-3;3] range.

System.Single delay

Delay of the sound. Value must be greater or equal to zero.

Remarks

Volume parameter value will override SoundVariation.Volume value.

Pitch parameter value will override SoundVariation.Pitch value.

Delay parameter value will override SoundVariation.Delay value.

| Improve this Doc View Source

Stop()

Stops sound.

Declaration
public void Stop()
| Improve this Doc View Source

UnPause()

Resumes sound.

Declaration
public void UnPause()
  • Improve this Doc
  • View Source
Back to top Generated by DocFX