Skip to content

Audio mixer API

Mixer implementations

See the extension registry.

mopidy.mixer

Classes:

  • Mixer

    Audio mixer API.

  • MixerListener

    Marker interface for recipients of events sent by the mixer actor.

  • MixerProxy

    Mixer wrapped in a Pykka actor proxy.

Mixer

Mixer(config: dict)

Audio mixer API.

If the mixer has problems during initialization it should raise MixerError with a descriptive error message. This will make Mopidy print the error message and exit so that the user can fix the issue.

Methods:

  • get_mute

    Get mute state of the mixer.

  • get_volume

    Get volume level of the mixer on a linear scale from 0 to 100.

  • ping

    Called to check if the actor is still alive.

  • set_mute

    Mute or unmute the mixer.

  • set_volume

    Set volume level of the mixer.

  • trigger_mute_changed

    Send mute_changed event to all mixer listeners.

  • trigger_volume_changed

    Send volume_changed event to all mixer listeners.

Attributes:

  • name (str) –

    Name of the mixer.

name class-attribute

name: str = ''

Name of the mixer.

Used when configuring what mixer to use. Should match the ext_name of the extension providing the mixer.

get_mute

get_mute() -> bool | None

Get mute state of the mixer.

MAY be implemented by subclass.

Returns True if muted, False if unmuted, and None if unknown.

get_volume

get_volume() -> Percentage | None

Get volume level of the mixer on a linear scale from 0 to 100.

Example values:

0

Minimum volume, usually silent.

100: Maximum volume. None: Volume is unknown.

MAY be implemented by subclass.

ping

ping() -> bool

Called to check if the actor is still alive.

set_mute

set_mute(mute: bool) -> bool

Mute or unmute the mixer.

MAY be implemented by subclass.

Returns True if successful, False otherwise.

set_volume

set_volume(volume: Percentage) -> bool

Set volume level of the mixer.

MAY be implemented by subclass.

Returns True if successful, False otherwise.

trigger_mute_changed

trigger_mute_changed(mute: bool) -> None

Send mute_changed event to all mixer listeners.

This method should be called by subclasses when the mute state is changed, either because of a call to set_mute or because of any external entity changing the mute state.

trigger_volume_changed

trigger_volume_changed(volume: Percentage) -> None

Send volume_changed event to all mixer listeners.

This method should be called by subclasses when the volume is changed, either because of a call to set_volume or because of any external entity changing the volume.

MixerListener

Bases: Listener

Marker interface for recipients of events sent by the mixer actor.

Any Pykka actor that mixes in this class will receive calls to the methods defined here when the corresponding events happen in the mixer actor. This interface is used both for looking up what actors to notify of the events, and for providing default implementations for those listeners that are not interested in all events.

Methods:

  • mute_changed

    Called after the mute state has changed.

  • on_event

    Called on all events.

  • send

    Helper to allow calling of mixer listener events.

  • volume_changed

    Called after the volume has changed.

mute_changed

mute_changed(mute: bool) -> None

Called after the mute state has changed.

MAY be implemented by actor.

Parameters:

  • mute
    (bool) –

    True if muted, False if not muted.

on_event

on_event(event: Any, **kwargs: Any) -> None

Called on all events.

MAY be implemented by actor. By default, this method forwards the event to the specific event methods.

Parameters:

  • event
    (Any) –

    The event name.

  • kwargs
    (Any, default: {} ) –

    Any other arguments to the specific event handlers.

send staticmethod

send(event: str, **kwargs: Any) -> None

Helper to allow calling of mixer listener events.

volume_changed

volume_changed(volume: Percentage) -> None

Called after the volume has changed.

MAY be implemented by actor.

Parameters:

MixerProxy

Bases: ActorMemberMixin, ActorProxy[MixerActor]

Mixer wrapped in a Pykka actor proxy.