Class: FMOD::DspConnection

Inherits:
Handle
  • Object
show all
Defined in:
lib/fmod/dsp_connection.rb

Overview

Represents a connection between two DSP units

Constant Summary collapse

STANDARD =

Default connection type. Audio is mixed from the input to the output DSP’s audible buffer.

0
SIDECHAIN =

Sidechain connection type. Audio is mixed from the input to the output DSP’s sidechain buffer.

1
SEND =

Send connection type. Audio is mixed from the input to the output DSP’s audible buffer, but the input is NOT executed, only copied from. A standard connection or sidechain needs to make an input execute to generate.rb data.

2
SEND_SIDECHAIN =

Send sidechain connection type. Audio is mixed from the input to the output DSP’s sidechain buffer, but the input is NOT executed, only copied from. A standard connection or sidechain needs to make an input execute to generate.rb data.

3

Instance Attribute Summary collapse

Attributes inherited from Handle

#user_data

Instance Method Summary collapse

Methods inherited from Handle

#initialize, #int_ptr, #release, #to_s

Constructor Details

This class inherits a constructor from FMOD::Handle

Instance Attribute Details

#inputDsp (readonly)

Returns the DSP unit that is the output of this connection.

Returns:

  • (Dsp)

    the DSP unit that is the output of this connection.



54
55
56
57
58
# File 'lib/fmod/dsp_connection.rb', line 54

def input
  dsp = int_ptr
  FMOD.invoke(:DSPConnection_GetInput, self, dsp)
  Dsp.from_handle(dsp)
end

#matrixArray<Array<Float>>

A 2D pan matrix that maps input channels (columns) to output speakers (rows).

Levels can be below 0 to invert a signal and above 1 to amplify the signal. Note that increasing the signal level too far may cause audible distortion.

The matrix size will generally be the size of the number of channels in the current speaker mode. Use {System.software_format }to determine this.

If a matrix already exists then the matrix passed in will applied over the top of it. The input matrix can be smaller than the existing matrix.

A “unit” matrix allows a signal to pass through unchanged. For example for a 5.1 matrix a unit matrix would look like this:

[[ 1, 0, 0, 0, 0, 0 ]
 [ 0, 1, 0, 0, 0, 0 ]
 [ 0, 0, 1, 0, 0, 0 ]
 [ 0, 0, 0, 1, 0, 0 ]
 [ 0, 0, 0, 0, 1, 0 ]
 [ 0, 0, 0, 0, 0, 1 ]]

Returns:

  • (Array<Array<Float>>)

    a 2-dimensional array of volume levels in row-major order. Each row represents an output speaker, each column represents an input channel.



96
97
98
99
100
101
102
103
104
# File 'lib/fmod/dsp_connection.rb', line 96

def matrix
  o, i = "\0" * SIZEOF_INT, "\0" * SIZEOF_INT
  FMOD.invoke(:DSPConnection_GetMixMatrix, self, nil, o, i, 0)
  o, i = o.unpack1('l'), i.unpack1('l')
  return [] if o.zero? || i.zero?
  buffer = "\0" * (SIZEOF_FLOAT * o * i)
  FMOD.invoke(:DSPConnection_GetMixMatrix, self, buffer, nil, nil, 0)
  buffer.unpack('f*').each_slice(i).to_a
end

#mixFloat

The volume of the connection - the scale level of the input before being passed to the output.

  • Minimum: 0.0 (silent)

  • Maximum: 1.0 (full volume)

  • Default: 1.0

Returns:

  • (Float)

    the volume or mix level.



48
# File 'lib/fmod/dsp_connection.rb', line 48

float_reader(:mix, :DSPConnection_GetMix)

#typeInteger (readonly)

Returns the type of the connection between 2 DSP units.

Will be one of the following:

Returns:



38
# File 'lib/fmod/dsp_connection.rb', line 38

integer_reader(:type, :DSPConnection_GetType)

Instance Method Details

#outputDsp

Returns the DSP unit that is the output of this connection.

Returns:

  • (Dsp)

    the DSP unit that is the output of this connection.



63
64
65
66
67
# File 'lib/fmod/dsp_connection.rb', line 63

def output
  dsp = int_ptr
  FMOD.invoke(:DSPConnection_GetOutput, self, dsp)
  Dsp.from_handle(dsp)
end