logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnitySoundMixerService

    Unity-specific implementation of the sound mixer service interface.
    Manages Unity AudioMixer operations including parameter control, volume mapping, and event-driven updates.
    Provides abstraction layer between domain logic and Unity's audio mixing system.

    Inheritance
    object
    UnitySoundMixerService
    Implements
    ISoundMixerService
    IService
    IFoundationSettings
    Namespace: Serenity.SoundMixer.Infrastructure.Services
    Assembly: Serenity.UnitySoundMixer.Infrastructure.dll
    Syntax
    public class UnitySoundMixerService : MonoBehaviour, ISoundMixerService, IService, IFoundationSettings

    Constructors

    UnitySoundMixerService()

    Declaration
    public UnitySoundMixerService()

    Properties

    Guid

    Gets or sets the global unique identifier for this service instance.

    Declaration
    public string Guid { get; set; }
    Property Value
    Type Description
    string

    The global unique identifier string.

    Id

    Gets or sets the unique identifier for this service instance.

    Declaration
    public string Id { get; set; }
    Property Value
    Type Description
    string

    The unique identifier string.

    LogService

    Declaration
    public ILogService LogService { get; set; }
    Property Value
    Type Description
    ILogService

    Methods

    GetAudioMixer()

    Gets the Unity AudioMixer instance managed by this service.
    Provides direct access to the underlying Unity audio mixer for advanced operations.

    Declaration
    public AudioMixer GetAudioMixer()
    Returns
    Type Description
    AudioMixer

    The Unity AudioMixer instance

    GetSoundMixerParameters()

    Gets the currently configured sound mixer parameters.
    Returns the list of mixer parameters that this service can control.

    Declaration
    public List<ConfigurationEntry> GetSoundMixerParameters()
    Returns
    Type Description
    List<ConfigurationEntry>

    List of key-value pairs representing available mixer parameters

    GetVolume(SoundMixerGetVolumeInput)

    Gets the current volume for a specific audio mixer parameter.
    Retrieves the raw volume value from the Unity AudioMixer.

    Declaration
    public float GetVolume(SoundMixerGetVolumeInput input)
    Parameters
    Type Name Description
    SoundMixerGetVolumeInput input

    DTO containing the parameter ID to query

    Returns
    Type Description
    float

    The current volume value from the audio mixer

    InitializeEventDispatcher(IEventDispatcherService)

    Initializes the event dispatcher service and subscribes to relevant events.
    Establishes the connection to the event system for handling audio mixer updates.

    Declaration
    public void InitializeEventDispatcher(IEventDispatcherService eventDispatcherService)
    Parameters
    Type Name Description
    IEventDispatcherService eventDispatcherService

    The event dispatcher service to use for event handling

    InitializeService(ISoundMixerSettings)

    Initializes the service with sound mixer settings configuration.
    Configures the audio mixer, volume ranges, and exposed parameters based on the provided settings.

    Declaration
    public void InitializeService(ISoundMixerSettings soundMixerSettings)
    Parameters
    Type Name Description
    ISoundMixerSettings soundMixerSettings

    The sound mixer settings containing configuration data

    SetEventDispatcherService(IEventDispatcherService)

    Sets the event dispatcher service for this mixer service.
    Configures the event dispatcher that will handle audio mixer related events.

    Declaration
    public void SetEventDispatcherService(IEventDispatcherService eventDispatcherService)
    Parameters
    Type Name Description
    IEventDispatcherService eventDispatcherService

    The event dispatcher service to use

    SetSoundMixerParameters(List<ConfigurationEntry>)

    Sets the sound mixer parameters for this service instance.
    Configures the available audio mixer parameters that can be controlled by this service.

    Declaration
    public void SetSoundMixerParameters(List<ConfigurationEntry> soundMixerIds)
    Parameters
    Type Name Description
    List<ConfigurationEntry> soundMixerIds

    List of key-value pairs representing mixer parameter names and their associated identifiers

    SetVolume(SoundMixerSetVolumeInput)

    Sets the volume for a specific audio mixer parameter.
    Applies volume mapping and updates the Unity AudioMixer with the calculated value.

    Declaration
    public void SetVolume(SoundMixerSetVolumeInput input)
    Parameters
    Type Name Description
    SoundMixerSetVolumeInput input

    DTO containing the parameter ID and desired volume level

    SubscribeToEventDispatcherEvents()

    Subscribes to relevant event dispatcher events for handling game settings updates.
    Registers this service to receive notifications when game settings values are updated.

    Declaration
    public void SubscribeToEventDispatcherEvents()

    Implements

    ISoundMixerService
    IService
    IFoundationSettings
    In this article
    © 2026 Serenity. All Rights Reserved