Show / Hide Table of Contents

Class SoundManager

The main class for sound playback and bank management.

Inheritance
System.Object
SoundManager
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 static class SoundManager

Properties

| Improve this Doc View Source

Banks

The collection of all registered sound banks.

Declaration
public static ReadOnlyCollection<SoundBank> Banks { get; }
Property Value
Type Description
System.Collections.ObjectModel.ReadOnlyCollection<SoundBank>

A reference to a read-only collection of sound banks.

| Improve this Doc View Source

PrimaryBank

The primary sound bank that will be searched first in case of name collisions.

Declaration
public static SoundBank PrimaryBank { get; set; }
Property Value
Type Description
SoundBank

A reference to a primary sound bank.

Methods

| Improve this Doc View Source

DeregisterBank(SoundBank)

Deregisters existing sound bank.

Declaration
public static bool DeregisterBank(SoundBank bank)
Parameters
Type Name Description
SoundBank bank

A reference to a sound bank to deregister.

Returns
Type Description
System.Boolean

True, if sound bank was succesfully deregistered. False otherwise.

| Improve this Doc View Source

GetSound(ID)

Searches for the specified sound with a matching unique ID.

Declaration
public static Sound GetSound(ID id)
Parameters
Type Name Description
ID id

ID referring to the sound.

Returns
Type Description
Sound

A reference to a sound, if found. Null reference otherwise.

| Improve this Doc View Source

GetSound(String)

Searches for the specified sound with a matching name.

Declaration
public static Sound GetSound(string name)
Parameters
Type Name Description
System.String name

Name of the sound.

Returns
Type Description
Sound

A reference to a sound, if found. Null reference otherwise.

Remarks

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

| Improve this Doc View Source

GetSoundBus(ID)

Searches for the specified sound bus with a matching unique ID.

Declaration
public static SoundBus GetSoundBus(ID id)
Parameters
Type Name Description
ID id

ID referring to the sound bus.

Returns
Type Description
SoundBus

A reference to a sound bus, if found. Null reference otherwise.

| Improve this Doc View Source

GetSoundBus(String)

Searches for the specified sound bus with a matching name.

Declaration
public static SoundBus GetSoundBus(string name)
Parameters
Type Name Description
System.String name

Name of the sound bus.

Returns
Type Description
SoundBus

A reference to a sound bus, if found. Null reference otherwise.

Remarks

If multiple banks have sound buses with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound bus will be used.

| Improve this Doc View Source

GrabSound()

Grabs an empty sound instance from the sound pool. Used for manual playback and custom mixing logic.

Declaration
public static SoundInstance GrabSound()
Returns
Type Description
SoundInstance

A reference to an empty sound instance.

Remarks

This method may increase the size of the sound pool causing additional memory allocations.

When a sound instance is not needed anymore, use ReleaseSound(SoundInstance) to return it back to the sound pool.

| Improve this Doc View Source

GrabSound(ID)

Grabs a sound instance from the sound pool. Used for manual playback and custom mixing logic.

Declaration
public static SoundInstance GrabSound(ID id)
Parameters
Type Name Description
ID id

ID referring to the sound.

Returns
Type Description
SoundInstance

A reference to a sound instance.

Remarks

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

This method may increase the size of the sound pool causing additional memory allocations.

When a sound instance is not needed anymore, use ReleaseSound(SoundInstance) to return it back to the sound pool.

| Improve this Doc View Source

GrabSound(String)

Grabs a sound instance from the sound pool. Used for manual playback and custom mixing logic.

Declaration
public static SoundInstance GrabSound(string name)
Parameters
Type Name Description
System.String name

Name of the sound.

Returns
Type Description
SoundInstance

A reference to a sound instance.

Remarks

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

This method may increase the size of the sound pool causing additional memory allocations.

When a sound instance is not needed anymore, use ReleaseSound(SoundInstance) to return it back to the sound pool.

| Improve this Doc View Source

Pause()

Pauses all playing sounds.

Declaration
public static void Pause()
Remarks

This method will also stop all sounds instances returned from GrabSound() or GrabSound(String).

| Improve this Doc View Source

Play(ID)

Plays one-shot sound.

Declaration
public static void Play(ID id)
Parameters
Type Name Description
ID id

ID referring to the sound.

| Improve this Doc View Source

Play(ID, Int32)

Plays specific one-shot sound variation.

Declaration
public static void Play(ID id, int variationIndex)
Parameters
Type Name Description
ID id

ID referring to the sound.

System.Int32 variationIndex

Variation index. Must be within Variations bounds.

| Improve this Doc View Source

Play(ID, Int32, Single)

Plays specific one-shot sound variation.

Declaration
public static void Play(ID id, int variationIndex, float volume)
Parameters
Type Name Description
ID id

ID referring to 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

Play(ID, Int32, Single, Single)

Plays specific one-shot sound variation.

Declaration
public static void Play(ID id, int variationIndex, float volume, float pitch)
Parameters
Type Name Description
ID id

ID referring to 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

Play(ID, Int32, Single, Single, Single)

Plays specific one-shot sound variation.

Declaration
public static void Play(ID id, int variationIndex, float volume, float pitch, float delay)
Parameters
Type Name Description
ID id

ID referring to 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

Play(ID, Single)

Plays one-shot sound.

Declaration
public static void Play(ID id, float volume)
Parameters
Type Name Description
ID id

ID referring to 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

Play(ID, Single, Single)

Plays one-shot sound.

Declaration
public static void Play(ID id, float volume, float pitch)
Parameters
Type Name Description
ID id

ID referring to 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

Play(ID, Single, Single, Single)

Plays one-shot sound.

Declaration
public static void Play(ID id, float volume, float pitch, float delay)
Parameters
Type Name Description
ID id

ID referring to 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

Play(String)

Plays one-shot sound.

Declaration
public static void Play(string name)
Parameters
Type Name Description
System.String name

Name of the sound.

Remarks

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

| Improve this Doc View Source

Play(String, Int32)

Plays specific one-shot sound variation.

Declaration
public static void Play(string name, int variationIndex)
Parameters
Type Name Description
System.String name

Name of the sound.

System.Int32 variationIndex

Variation index. Must be within Variations bounds.

Remarks

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

| Improve this Doc View Source

Play(String, Int32, Single)

Plays specific one-shot sound variation.

Declaration
public static void Play(string name, int variationIndex, float volume)
Parameters
Type Name Description
System.String name

Name 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

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

Volume parameter value will override SoundVariation.Volume value.

| Improve this Doc View Source

Play(String, Int32, Single, Single)

Plays specific one-shot sound variation.

Declaration
public static void Play(string name, int variationIndex, float volume, float pitch)
Parameters
Type Name Description
System.String name

Name 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

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

Volume parameter value will override SoundVariation.Volume value.

Pitch parameter value will override SoundVariation.Pitch value.

| Improve this Doc View Source

Play(String, Int32, Single, Single, Single)

Plays specific one-shot sound variation.

Declaration
public static void Play(string name, int variationIndex, float volume, float pitch, float delay)
Parameters
Type Name Description
System.String name

Name 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

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

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(String, Single)

Plays one-shot sound.

Declaration
public static void Play(string name, float volume)
Parameters
Type Name Description
System.String name

Name of the sound.

System.Single volume

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

Remarks

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

Volume parameter value will override SoundVariation.Volume value.

| Improve this Doc View Source

Play(String, Single, Single)

Plays one-shot sound.

Declaration
public static void Play(string name, float volume, float pitch)
Parameters
Type Name Description
System.String name

Name 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

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

Volume parameter value will override SoundVariation.Volume value.

Pitch parameter value will override SoundVariation.Pitch value.

| Improve this Doc View Source

Play(String, Single, Single, Single)

Plays one-shot sound.

Declaration
public static void Play(string name, float volume, float pitch, float delay)
Parameters
Type Name Description
System.String name

Name 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

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

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(ID, Vector3)

Plays one-shot sound in 3D space.

Declaration
public static void Play3D(ID id, Vector3 position)
Parameters
Type Name Description
ID id

ID referring to the sound.

Vector3 position

Position of the sound.

| Improve this Doc View Source

Play3D(ID, Vector3, Int32)

Plays specific one-shot sound variation in 3D space.

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

ID referring to the sound.

Vector3 position

Position of the sound.

System.Int32 variationIndex

Variation index. Must be within Variations bounds.

| Improve this Doc View Source

Play3D(ID, Vector3, Int32, Single)

Plays specific one-shot sound variation in 3D space.

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

ID referring to the sound.

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(ID, Vector3, Int32, Single, Single)

Plays specific one-shot sound variation in 3D space.

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

ID referring to the sound.

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(ID, Vector3, Int32, Single, Single, Single)

Plays specific one-shot sound variation in 3D space.

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

ID referring to the sound.

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(ID, Vector3, Single)

Plays one-shot sound in 3D space.

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

ID referring to the sound.

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(ID, Vector3, Single, Single)

Plays one-shot sound in 3D space.

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

ID referring to the sound.

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(ID, Vector3, Single, Single, Single)

Plays one-shot sound in 3D space.

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

ID referring to the sound.

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

Play3D(String, Vector3)

Plays one-shot sound in 3D space.

Declaration
public static void Play3D(string name, Vector3 position)
Parameters
Type Name Description
System.String name

Name of the sound.

Vector3 position

Position of the sound.

Remarks

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

| Improve this Doc View Source

Play3D(String, Vector3, Int32)

Plays specific one-shot sound variation in 3D space.

Declaration
public static void Play3D(string name, Vector3 position, int variationIndex)
Parameters
Type Name Description
System.String name

Name of the sound.

Vector3 position

Position of the sound.

System.Int32 variationIndex

Variation index. Must be within Variations bounds.

Remarks

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

| Improve this Doc View Source

Play3D(String, Vector3, Int32, Single)

Plays specific one-shot sound variation in 3D space.

Declaration
public static void Play3D(string name, Vector3 position, int variationIndex, float volume)
Parameters
Type Name Description
System.String name

Name of the sound.

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

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

Volume parameter value will override SoundVariation.Volume value.

| Improve this Doc View Source

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

Plays specific one-shot sound variation in 3D space.

Declaration
public static void Play3D(string name, Vector3 position, int variationIndex, float volume, float pitch)
Parameters
Type Name Description
System.String name

Name of the sound.

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

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

Volume parameter value will override SoundVariation.Volume value.

Pitch parameter value will override SoundVariation.Pitch value.

| Improve this Doc View Source

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

Plays specific one-shot sound variation in 3D space.

Declaration
public static void Play3D(string name, Vector3 position, int variationIndex, float volume, float pitch, float delay)
Parameters
Type Name Description
System.String name

Name of the sound.

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

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

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(String, Vector3, Single)

Plays one-shot sound in 3D space.

Declaration
public static void Play3D(string name, Vector3 position, float volume)
Parameters
Type Name Description
System.String name

Name of the sound.

Vector3 position

Position of the sound.

System.Single volume

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

Remarks

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

Volume parameter value will override SoundVariation.Volume value.

| Improve this Doc View Source

Play3D(String, Vector3, Single, Single)

Plays one-shot sound in 3D space.

Declaration
public static void Play3D(string name, Vector3 position, float volume, float pitch)
Parameters
Type Name Description
System.String name

Name of the sound.

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

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

Volume parameter value will override SoundVariation.Volume value.

Pitch parameter value will override SoundVariation.Pitch value.

| Improve this Doc View Source

Play3D(String, Vector3, Single, Single, Single)

Plays one-shot sound in 3D space.

Declaration
public static void Play3D(string name, Vector3 position, float volume, float pitch, float delay)
Parameters
Type Name Description
System.String name

Name of the sound.

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

If multiple banks have sounds with a matching name, the primary sound bank will be checked first. Within a bank, the first occurrence of found sound will be used.

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

RegisterBank(SoundBank)

Registers new sound bank.

Declaration
public static bool RegisterBank(SoundBank bank)
Parameters
Type Name Description
SoundBank bank

A reference to a sound bank to register.

Returns
Type Description
System.Boolean

True, if sound bank was succesfully registered. False otherwise.

| Improve this Doc View Source

ReleaseSound(SoundInstance)

Releases sound instance and return it back to the sound pool.

Declaration
public static bool ReleaseSound(SoundInstance instance)
Parameters
Type Name Description
SoundInstance instance

A reference to a sound instance.

Returns
Type Description
System.Boolean

True, if the sound instance was successfully returned to sound pool. False otherwise.

Remarks

Once the sound instance is returned back to a sound pool, it's possible to reuse it again by calling GrabSound() or GrabSound(String).

| Improve this Doc View Source

Stop()

Stops all playing sounds.

Declaration
public static void Stop()
Remarks

This method will also stop all sounds instances returned from GrabSound() or GrabSound(String).

| Improve this Doc View Source

UnPause()

Resumes all paused sounds.

Declaration
public static void UnPause()
Remarks

This method will also resume all sounds instances returned from GrabSound() or GrabSound(String).

  • Improve this Doc
  • View Source
Back to top Generated by DocFX