Show / Hide Table of Contents

Class SoundManager

Class for managing loading and caching of AudioClips from wav files.

Inheritance
object
SoundManager
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: ItemChanger.Internal
Assembly: ItemChanger.dll
Syntax
public class SoundManager

Constructors

View Source

SoundManager(Assembly, string)

Creates a SoundManager to lazily load and cache AudioClips from the embedded wav files in the specified assembly.
Only filepaths with the matching prefix are considered, and the prefix is removed to determine clip names (e.g. "ItemChanger.Resources.Audio." is the prefix for Instance).

Declaration
public SoundManager(Assembly a, string resourcePrefix)
Parameters
Type Name Description
Assembly a
string resourcePrefix

Fields

View Source

actors

The Actors AudioMixerGroup, from global resources. Used as the mixer for SoundManager.PlayClipAtPoint.

Declaration
public static readonly AudioMixerGroup actors
Field Value
Type Description
AudioMixerGroup

Properties

View Source

Instance

The SoundManager with access to embedded ItemChanger wavs.

Declaration
public static SoundManager Instance { get; }
Property Value
Type Description
SoundManager

Methods

View Source

FromStream(Stream, string)

Convert the stream representing a 16-bit uncompressed .WAV file to an AudioClip.

Declaration
public static AudioClip FromStream(Stream s, string name)
Parameters
Type Name Description
Stream s
string name
Returns
Type Description
AudioClip
View Source

GetAudioClip(string)

Fetches the AudioClip with the specified name. If it has not yet been loaded, loads it from embedded resources and caches the result.

Declaration
public AudioClip GetAudioClip(string name)
Parameters
Type Name Description
string name
Returns
Type Description
AudioClip
View Source

PlayClipAtPoint(string, Vector3)

Equivalent to the static PlayClipAtPoint, composed with GetAudioClip.

Declaration
public void PlayClipAtPoint(string name, Vector3 pos)
Parameters
Type Name Description
string name
Vector3 pos
View Source

PlayClipAtPoint(AudioClip, Vector3)

Creates an AudioSource component at the specified point with generally applicable settings, and plays the clip from that source.

Declaration
public static void PlayClipAtPoint(AudioClip clip, Vector3 pos)
Parameters
Type Name Description
AudioClip clip
Vector3 pos
View Source

SaveAs(AudioClip, string)

Save the uncompressed 16-bit audio clip as a .WAV file.

Declaration
public static void SaveAs(AudioClip clip, string fileName)
Parameters
Type Name Description
AudioClip clip
string fileName

Extension Methods

Extensions.Yield<T>(T)
  • View Source
In this article
Back to top Generated by DocFX