Search Results for

    Class SoundTools

    Inheritance
    object
    SoundTools
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: SonsSdk
    Assembly: SonsSdk.dll
    Syntax
    public static class SoundTools

    Fields

    CoreSystem

    Declaration
    public static Lazy<System> CoreSystem
    Field Value
    Type Description
    Lazy<System>

    Properties

    MasterBus

    Declaration
    public static Bus MasterBus { get; }
    Property Value
    Type Description
    Bus

    MasterVolume

    The master volume in the game settings.

    Declaration
    public static float MasterVolume { get; }
    Property Value
    Type Description
    float

    MusicVolume

    The music volume in the game settings. Multiplied by the master volume.

    Declaration
    public static float MusicVolume { get; }
    Property Value
    Type Description
    float

    SfxVolume

    The sfx volume in the game settings. Multiplied by the master volume.

    Declaration
    public static float SfxVolume { get; }
    Property Value
    Type Description
    float

    VoiceVolume

    The voice volume in the game settings. Multiplied by the master volume.

    Declaration
    public static float VoiceVolume { get; }
    Property Value
    Type Description
    float

    Methods

    BindSound(GameObject, string)

    Bind a sound to a gameobject. The sound will be played at the position of the gameobject.

    Declaration
    public static SoundPlayer BindSound(GameObject go, string id)
    Parameters
    Type Name Description
    GameObject go

    The gameobject to bind the sound to

    string id

    The id of the sound to play

    Returns
    Type Description
    SoundPlayer

    GetSound(string)

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

    LoadBank(byte[], byte[], LOAD_BANK_FLAGS)

    Loads and registeres a bank from a byte buffer

    Declaration
    public static Bank? LoadBank(byte[] data, byte[] stringsData = null, LOAD_BANK_FLAGS flags = 0)
    Parameters
    Type Name Description
    byte[] data

    The .bank data

    byte[] stringsData

    The .strings.bank data

    LOAD_BANK_FLAGS flags
    Returns
    Type Description
    Bank?

    LoadBank(string, bool, LOAD_BANK_FLAGS)

    Loads and registeres a bank file

    Declaration
    public static Bank? LoadBank(string path, bool loadStringsFile = true, LOAD_BANK_FLAGS flags = 0)
    Parameters
    Type Name Description
    string path

    The path of the bank file (Make sure the {name}.strings.bank file is also present at that location)

    bool loadStringsFile

    If the .strings.bank file should also be loaded. If true make sure it exists beside the .bank file

    LOAD_BANK_FLAGS flags
    Returns
    Type Description
    Bank?

    PlaySound(Sound, float, float?)

    Gets the sound by id.

    Declaration
    public static Channel PlaySound(Sound sound, float volume, float? pitch = null)
    Parameters
    Type Name Description
    Sound sound
    float volume
    float? pitch
    Returns
    Type Description
    Channel

    PlaySound(Sound, Vector3, float?, float?, float?)

    Declaration
    public static Channel PlaySound(Sound sound, Vector3 pos, float? maxDist = null, float? volume = null, float? pitch = null)
    Parameters
    Type Name Description
    Sound sound
    Vector3 pos
    float? maxDist
    float? volume
    float? pitch
    Returns
    Type Description
    Channel

    PlaySound(string, float?, float?)

    Play a registered sound

    Declaration
    public static Channel PlaySound(string id, float? volume = null, float? pitch = null)
    Parameters
    Type Name Description
    string id

    The id you specified in RegisterSound(string, string, bool)

    float? volume

    The volume of the sound. If nothing is specified the settings music volume is used

    float? pitch

    The pitch of the sound. 1 is normal pitch

    Returns
    Type Description
    Channel

    A channel which let's you control and stop the sound again

    PlaySound(string, Vector3, float?, float?, float?)

    Play a registered sound

    Declaration
    public static Channel PlaySound(string id, Vector3 pos, float? maxDist = null, float? volume = null, float? pitch = null)
    Parameters
    Type Name Description
    string id

    The id you specified in RegisterSound(string, string, bool)

    Vector3 pos

    The position at which to play the sound

    float? maxDist

    The maximum distance at which the sound is still audible

    float? volume

    The volume of the sound. If nothing is specified the settings music volume is used

    float? pitch

    The pitch of the sound. 1 is normal pitch

    Returns
    Type Description
    Channel

    A channel which let's you control and stop the sound again

    RegisterSound(string, byte[], bool)

    Register a sound to the fmod system from memory. You can play it with PlaySound(string, float?, float?).

    Declaration
    public static void RegisterSound(string id, byte[] data, bool use3d = false)
    Parameters
    Type Name Description
    string id

    The id of the sound by which you can play it later

    byte[] data

    the data of the sound file

    bool use3d

    RegisterSound(string, string, bool)

    Register a sound to the fmod system from a file. You can play it with PlaySound(string, float?, float?).

    Declaration
    public static Sound RegisterSound(string id, string filepath, bool use3d = false)
    Parameters
    Type Name Description
    string id

    The id of the sound by which you can play it later

    string filepath

    The file path of the sound

    bool use3d
    Returns
    Type Description
    Sound

    SetPosition(ref Channel, float, float, float)

    Declaration
    public static void SetPosition(ref Channel channel, float x, float y, float z)
    Parameters
    Type Name Description
    Channel channel
    float x
    float y
    float z

    SetupRedirect(string, string)

    Redirects a registered fmod event to another event

    Declaration
    public static void SetupRedirect(string srcEvent, string dstEvent)
    Parameters
    Type Name Description
    string srcEvent

    The original event

    string dstEvent

    The event that should be played instead