View Source Membrane.AudioMixerBin (Membrane Audio Mix plugin v0.16.3)
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 mostmax_inputs_per_nodeinputs - 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 mostmax_inputs_per_nodeinputs (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
Passed via struct Membrane.AudioMixerBin.t/0
max_inputs_per_nodepos_integer()Default value:
10
The maximum number of inputs to a single mixer in the mixers tree. Must be at least 2.mixer_optionsAudioMixer.t()Default value:
%Membrane.AudioMixer{stream_format: nil, frames_per_buffer: 2048, prevent_clipping: true, native_mixer: false, synchronize_buffers?: false}
The options that would be passed to each created AudioMixer.number_of_inputspos_integer()Required
The exact number of inputs to the bin. Must be at least 1.
Pads
: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 |
Pad options:
offsetTime.t()Default value:
0
Offset of the input audio at the pad.
:output
Accepted formats:
RawAudio| Direction: | :output |
| Availability: | :always |
Summary
Functions
Generates a spec for a single mixer or a tree of mixers.
Returns description of options available for this module
Types
@type input_pad_opts() :: [{: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
Functions
@spec gen_mixing_spec( [Membrane.Bin.PadData.t()], pos_integer(), Membrane.AudioMixer.t() ) :: Membrane.ChildrenSpec.t()
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