Class: FMOD::Effects::ChannelMix

Inherits:
Dsp
  • Object
show all
Defined in:
lib/fmod/effects/channel_mix.rb

Overview

This unit provides per signal channel gain, and output channel mapping to allow 1 multichannel signal made up of many groups of signals to map to a single output signal.

Constant Summary collapse

DEFAULT =

Output channel count = input channel count.

See Also:

0
ALL_MONO =

Output channel count = 1. Mapping: Mono, Mono, Mono, Mono, Mono, Mono, … (each channel all the way up to MAX_CHANNEL_WIDTH channels are treated as if they were mono)

1
ALL_STEREO =

Output channel count = 2. Mapping: Left, Right, Left, Right, Left, Right, … (each pair of channels is treated as stereo all the way up to MAX_CHANNEL_WIDTH channels)

2
ALL_QUAD =

Output channel count = 4. Mapping: Repeating pattern of Front Left, Front Right, Surround Left, Surround Right

3
ALL_5POINT1 =

Output channel count = 6. Mapping: Repeating pattern of Front Left, Front Right, Center, LFE, Surround Left, Surround Right.

4
ALL_7POINT1 =

Output channel count = 8. Mapping: Repeating pattern of Front Left, Front Right, Center, LFE, Surround Left, Surround Right, Back Left, Back Right.

5
ALL_LFE =

Output channel count = 6. Mapping: Repeating pattern of LFE in a 5.1 output signal.

6

Instance Attribute Summary collapse

Attributes inherited from Dsp

#active, #bypass, #channel_format, #input_count, #output_count, #parameter_count, #parent, #type, #wet_dry_mix

Attributes inherited from Handle

#user_data

Instance Method Summary collapse

Methods inherited from Dsp

#add_input, bool_param, data_param, #disconnect, #disconnect_from, #enable_metering, float_param, from_handle, #get_bool, #get_data, #get_float, #get_integer, #idle?, #info, #input, #input_connection, #input_metering?, integer_param, #name, #output, #output_connection, #output_format, #output_metering?, #param_info, #play, #reset, #set_bool, #set_data, #set_float, #set_integer, #set_wet_dry_mix, #show_dialog, #to_s, type_map, #version

Methods inherited from Handle

#initialize, #int_ptr, #release, #to_s

Constructor Details

This class inherits a constructor from FMOD::Handle

Instance Attribute Details

#output_groupingInteger

Determines the output mapping.

This value will set the output speaker format for the DSP, and also map the incoming channels to the outgoing channels in a round-robin fashion. Use this for example play a 32 channel input signal as if it were a repeating group of output signals.

ALL_MONO = all incoming channels are mixed to a mono output.

ALL_STEREO = all incoming channels are mixed to a stereo output, ie even incoming channels 0,2,4,6,etc are mixed to left, and odd incoming channels 1,3,5,7,etc are mixed to right.

ALL_5POINT1 = all incoming channels are mixed to a 5.1 output. If there are less than 6 coming in, it will just fill the first n channels in the 6 output channels. If there are more, then it will repeat the input pattern to the output like it did with the stereo case, ie 12 incoming channels are mapped as 0-5 mixed to the 5.1 output and 6 to 11 mapped to the 5.1 output.

ALL_LFE = all incoming channels are mixed to a 5.1 output but via the LFE channel only.

Returns:

  • (Integer)

    the current value of output_grouping

See Also:



40
41
42
# File 'lib/fmod/effects/channel_mix.rb', line 40

def output_grouping
  @output_grouping
end

Instance Method Details

#[](channel) ⇒ Float

Retrieves the gain for the specified channel.

Parameters:

  • channel (Integer)

    The channel index, clamped between 0 and 31.

Returns:

  • (Float)

    The gain.



86
87
88
# File 'lib/fmod/effects/channel_mix.rb', line 86

def [](channel)
  get_float(channel.clamp(0, 31) + 1)
end

#[]=(channel, gain) ⇒ Float

Sets the gain, in dB for the specified channel.

Parameters:

  • channel (Integer)

    The channel index, clamped between 0 and 31.

  • gain (Float)

    The gain, in dB, clamped between -80.0 and 10.0.

Returns:

  • (Float)

    The gain.



95
96
97
98
# File 'lib/fmod/effects/channel_mix.rb', line 95

def []=(channel, gain)
  set_float(channel.clamp(0, 31) + 1, gain.clamp(-80.0, 10.0))
  gain
end