Show / Hide Table of Contents

Class SoundBank

The persistent storage for sounds and sound buses.

Inheritance
System.Object
SoundBank
Implements
IBank
ISerializationCallbackReceiver
Namespace: Stem
Assembly: Stem.dll
Syntax
public class SoundBank : ScriptableObject, IBank, ISerializationCallbackReceiver

Properties

| Improve this Doc View Source

Buses

The collection of sound buses.

Declaration
public ReadOnlyCollection<SoundBus> Buses { get; }
Property Value
Type Description
System.Collections.ObjectModel.ReadOnlyCollection<SoundBus>

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

| Improve this Doc View Source

DefaultBus

The sound bus which will be used by default on newly created sounds.

Declaration
public SoundBus DefaultBus { get; }
Property Value
Type Description
SoundBus

A reference to a sound bus.

| Improve this Doc View Source

ShowSoundBuses

The flag indicating whether the sound bank inspector should show the 'Buses' group.

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

True, if the 'Buses' group is shown. False otherwise.

Remarks

This property is used only by the sound bank inspector and does nothing during runtime.

| Improve this Doc View Source

ShowSounds

The flag indicating whether the sound bank inspector should show the 'Sounds' group.

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

True, if the 'Sounds' group is shown. False otherwise.

Remarks

This property is used only by the sound bank inspector and does nothing during runtime.

| Improve this Doc View Source

SoundBatchImportMode

The batch import mode defining how new sounds will be created after the drag-drop event.

Declaration
public AudioClipImportMode SoundBatchImportMode { get; set; }
Property Value
Type Description
AudioClipImportMode

An enum value.

| Improve this Doc View Source

SoundManagementMode

The default audio clip management mode for all sounds of the sound bank.

Declaration
public AudioClipManagementMode SoundManagementMode { get; set; }
Property Value
Type Description
AudioClipManagementMode

An enum value.

Remarks

By default, all sounds will use this value for audio clip management, however, it can be overridden by the OverrideAudioClipManagement flag.

| Improve this Doc View Source

Sounds

The collection of sounds.

Declaration
public ReadOnlyCollection<Sound> Sounds { get; }
Property Value
Type Description
System.Collections.ObjectModel.ReadOnlyCollection<Sound>

A reference to a read-only collection of sounds.

| Improve this Doc View Source

SoundUnloadInterval

The default audio clip unload interval for all sounds of the the sound bank.

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

A time interval in seconds.

Remarks

By default, all sounds will use this value for audio clip unload interval, however, it can be overridden by the OverrideAudioClipManagement flag.

Methods

| Improve this Doc View Source

AddSound(String)

Adds an empty sound to the sound bank.

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

Name of the sound.

Returns
Type Description
Sound

A reference to a newly created sound.

| Improve this Doc View Source

AddSound(String, AudioClip)

Adds a sound with a single variation to the sound bank.

Declaration
public Sound AddSound(string name, AudioClip clip)
Parameters
Type Name Description
System.String name

Name of the sound.

AudioClip clip

A reference to the audio clip with audio data.

Returns
Type Description
Sound

A reference to a newly created sound.

| Improve this Doc View Source

AddSound(String, AudioClip[])

Adds a sound with multiple variations to the sound bank.

Declaration
public Sound AddSound(string name, AudioClip[] clips)
Parameters
Type Name Description
System.String name

Name of the sound.

AudioClip[] clips

An array of audio clips with audio data.

Returns
Type Description
Sound

A reference to a newly created sound.

| Improve this Doc View Source

AddSoundBus(String)

Adds a new sound bus to the sound bank.

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

Name of the sound bus.

Returns
Type Description
SoundBus

A reference to a newly created sound bus.

| Improve this Doc View Source

GetBankID()

Returns sound bank ID.

Declaration
public ID GetBankID()
Returns
Type Description
ID

An ID value.

| Improve this Doc View Source

GetSound(ID)

Searches for the specified sound by ID.

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

ID that refers to a 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 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.

| Improve this Doc View Source

GetSoundBus(ID)

Searches for the specified sound bus by ID.

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

ID that refers to a 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 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.

| Improve this Doc View Source

GetSoundBusID(Int32)

Gets an ID to the specific sound bus.

Declaration
public ID GetSoundBusID(int index)
Parameters
Type Name Description
System.Int32 index

Zero-based index of the sound bus in the current sound bank.

Returns
Type Description
ID

An ID to the specific sound bus.

| Improve this Doc View Source

GetSoundID(Int32)

Gets an ID to the specific sound.

Declaration
public ID GetSoundID(int index)
Parameters
Type Name Description
System.Int32 index

Zero-based index of the sound in the current sound bank.

Returns
Type Description
ID

An ID to the specific sound.

| Improve this Doc View Source

OnAfterDeserialize()

Prepares sound bank for runtime use after deserialization.

Declaration
public void OnAfterDeserialize()
Remarks

This method is automatically called by Unity during deserialization process. Don't call it manually.

| Improve this Doc View Source

OnBeforeSerialize()

Prepares sound bank for serialization.

Declaration
public void OnBeforeSerialize()
Remarks

This method is automatically called by Unity during serialization process. Don't call it manually.

| Improve this Doc View Source

RegenerateBankID()

Generates a new unique ID for the sound bank.

Declaration
public void RegenerateBankID()
Remarks

This method is automatically called by Stem during serialization process. Don't call it manually as it may break existing ID references.

| Improve this Doc View Source

RemoveSound(Sound)

Removes existing sound from the sound bank.

Declaration
public void RemoveSound(Sound sound)
Parameters
Type Name Description
Sound sound

A reference to a sound.

Remarks

This method does nothing if the sound was not found in the sound bank.

| Improve this Doc View Source

RemoveSoundBus(SoundBus)

Removes existing sound bus from the sound bank.

Declaration
public void RemoveSoundBus(SoundBus bus)
Parameters
Type Name Description
SoundBus bus

A reference to a sound bus.

Remarks

This method does nothing if the sound bus was not found in the sound bank.

Events

| Improve this Doc View Source

OnSoundAdded

The delegate informing about adding sounds.

Declaration
public event SoundAddedDelegate OnSoundAdded
Event Type
Type Description
SoundAddedDelegate
| Improve this Doc View Source

OnSoundBusAdded

The delegate informing about adding sound buses.

Declaration
public event SoundBusAddedDelegate OnSoundBusAdded
Event Type
Type Description
SoundBusAddedDelegate
| Improve this Doc View Source

OnSoundBusRemoved

The delegate informing about removing sound buses.

Declaration
public event SoundBusRemovedDelegate OnSoundBusRemoved
Event Type
Type Description
SoundBusRemovedDelegate
| Improve this Doc View Source

OnSoundBusRenamed

The delegate informing about the change of sound bus names.

Declaration
public event SoundBusRenamedDelegate OnSoundBusRenamed
Event Type
Type Description
SoundBusRenamedDelegate
| Improve this Doc View Source

OnSoundRemoved

The delegate informing about removing sounds.

Declaration
public event SoundRemovedDelegate OnSoundRemoved
Event Type
Type Description
SoundRemovedDelegate
| Improve this Doc View Source

OnSoundRenamed

The delegate informing about the change of sound names.

Declaration
public event SoundRenamedDelegate OnSoundRenamed
Event Type
Type Description
SoundRenamedDelegate

Implements

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