View Source Membrane.AudioMixerBin (Membrane Audio Mix plugin v0.12.0)

Bin element distributing a mixing job between multiple Membrane.AudioMixer elements.

A tree of AudioMixers is created according to max_inputs_per_node parameter:

  • if number of input tracks is smaller than max_inputs_per_node, only one AudioMixer element is created for the entire job
  • if there are more input tracks than max_inputs_per_node, there are created enough mixers so that each mixer has at most max_inputs_per_node inputs - outputs from those mixers are then mixed again following the same rules - another level of mixers is created having enough mixers so that each mixer on this level has at most max_inputs_per_node inputs (those are now the outputs of the previous level mixers). Levels are created until only one mixer in the level is needed - output from this mixer is the final mixed track.

Bin allows for specifying options for Membrane.AudioMixer, which are applied for all AudioMixers.

Recommended to use in case of mixing jobs with many inputs.

A number of inputs to the bin must be specified in the number_of_inputs option.

bin-options

Bin options

Passed via struct Membrane.AudioMixerBin.t/0

  • max_inputs_per_node

    pos_integer()

    Default value: 10
    The maximum number of inputs to a single mixer in the mixers tree. Must be at least 2.

  • mixer_options

    AudioMixer.t()

    Default value: %Membrane.AudioMixer{frames_per_buffer: 2048, native_mixer: false, prevent_clipping: true, stream_format: nil, synchronize_buffers?: false}
    The options that would be passed to each created AudioMixer.

  • number_of_inputs

    pos_integer()

    Required
    The exact number of inputs to the bin. Must be at least 1.

pads

Pads

input

:input

Accepted formats:

%RawAudio{sample_format: sample_format} when sample_format in [:s8, :s16le, :s16be, :s24le, :s24be, :s32le, :s32be]
Membrane.RemoteStream
Direction::input
Availability::on_request
Mode::pull
Demand unit::bytes

Pad options:

  • offset

    Time.t()

    Default value: 0
    Offset of the input audio at the pad.

output

:output

Accepted formats:

RawAudio
Direction::output
Availability::always
Mode::pull
Demand unit::bytes

Link to this section Summary

Types

Options for pad :input

t()

Struct containing options for Membrane.AudioMixerBin

Functions

Generates a spec for a single mixer or a tree of mixers.

Returns description of options available for this module

Link to this section Types

@type input_pad_opts_t() :: [{:offset, Time.t()}]

Options for pad :input

@type t() :: %Membrane.AudioMixerBin{
  max_inputs_per_node: pos_integer(),
  mixer_options: Membrane.AudioMixer.t(),
  number_of_inputs: pos_integer()
}

Struct containing options for Membrane.AudioMixerBin

Link to this section Functions

Link to this function

gen_mixing_spec(inputs_data, max_degree, mixer_options)

View Source

Generates a spec for a single mixer or a tree of mixers.

Levels of the tree will be 0-indexed with tree root being level 0 For a bottom level of mixing tree (leaves of the tree) links generator will be used to generate links between inputs and mixers.

@spec options() :: keyword()

Returns description of options available for this module