Show / Hide Table of Contents

Class SoundManager

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

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: ItemChanger.Internal
Assembly: ItemChanger.dll
Syntax
public class SoundManager

Constructors

| Improve this Doc 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
System.Reflection.Assembly a
System.String resourcePrefix

Fields

| Improve this Doc 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

| Improve this Doc View Source

Instance

The SoundManager with access to embedded ItemChanger wavs.

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

Methods

| Improve this Doc 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
System.String name
Returns
Type Description
AudioClip
| Improve this Doc 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
System.String name
Returns
Type Description
AudioClip
| Improve this Doc 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
| Improve this Doc 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
System.String name
Vector3 pos
| Improve this Doc 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
System.String fileName

Extension Methods

Extensions.Yield<T>(T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX