Class: FMOD::DspConnection
- 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
-
#input ⇒ Dsp
readonly
The DSP unit that is the output of this connection.
-
#matrix ⇒ Array<Array<Float>>
A 2D pan matrix that maps input channels (columns) to output speakers (rows).
-
#mix ⇒ Float
The volume of the connection - the scale level of the input before being passed to the output.
-
#type ⇒ Integer
readonly
The type of the connection between 2 DSP units.
Attributes inherited from Handle
Instance Method Summary collapse
-
#output ⇒ Dsp
The DSP unit that is the output of this connection.
Methods inherited from Handle
#initialize, #int_ptr, #release, #to_s
Constructor Details
This class inherits a constructor from FMOD::Handle
Instance Attribute Details
#input ⇒ Dsp (readonly)
Returns 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 |
#matrix ⇒ Array<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 ]]
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 |
#mix ⇒ Float
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
48 |
# File 'lib/fmod/dsp_connection.rb', line 48 float_reader(:mix, :DSPConnection_GetMix) |
#type ⇒ Integer (readonly)
Returns the type of the connection between 2 DSP units.
Will be one of the following:
38 |
# File 'lib/fmod/dsp_connection.rb', line 38 integer_reader(:type, :DSPConnection_GetType) |
Instance Method Details
#output ⇒ Dsp
Returns 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 |