Back to Exoplayer

ChannelMixingMatrix (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/audio/ChannelMixingMatrix.html

latest5.7 KB
Original Source

Package com.google.android.exoplayer2.audio

Class ChannelMixingMatrix


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classChannelMixingMatrixextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

An immutable matrix that describes the mapping of input channels to output channels.

The matrix coefficients define the scaling factor to use when mixing samples from the input channel (row) to the output channel (column).

Examples:

  • Stereo to mono with each channel at half volume:
[0.5 0.5]
  • Stereo to stereo with no mixing or scaling:
[1 0
          0 1]
  • Stereo to stereo with 0.7 volume:
[0.7 0
          0 0.7]

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | ChannelMixingMatrix​(int inputChannelCount, int outputChannelCount, float[] coefficients) | Deprecated.

Creates a matrix with the given coefficients in row-major order. |

Method Summary

All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | static ChannelMixingMatrix | create​(int inputChannelCount, int outputChannelCount) | Deprecated.

Creates a standard channel mixing matrix that converts from inputChannelCount channels to outputChannelCount channels. | | int | getInputChannelCount() | Deprecated. | | float | getMixingCoefficient​(int inputChannel, int outputChannel) | Deprecated.

Gets the scaling factor for the given input and output channel. | | int | getOutputChannelCount() | Deprecated. | | boolean | isDiagonal() | Deprecated.

Returns whether the matrix is square and all non-diagonal coefficients are zero. | | boolean | isIdentity() | Deprecated.

Returns whether this is an identity matrix. | | boolean | isSquare() | Deprecated.

Returns whether the input and output channel count is the same. | | boolean | isZero() | Deprecated.

Returns whether all mixing coefficients are zero. | | ChannelMixingMatrix | scaleBy​(float scale) | Deprecated.

Returns a new matrix with the given scaling factor applied to all coefficients. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

- 

ChannelMixingMatrix

public ChannelMixingMatrix​(int inputChannelCount,
                           int outputChannelCount,
                           float[] coefficients)

Deprecated.

Creates a matrix with the given coefficients in row-major order. Parameters:inputChannelCount - Number of input channels (rows in the matrix).outputChannelCount - Number of output channels (columns in the matrix).coefficients - Non-negative matrix coefficients in row-major order.

Method Detail

- 

create

public static[ChannelMixingMatrix](ChannelMixingMatrix.html "class in com.google.android.exoplayer2.audio")create​(int inputChannelCount,
                                         int outputChannelCount)

Deprecated.

Creates a standard channel mixing matrix that converts from inputChannelCount channels to outputChannelCount channels.

If the input and output channel counts match then a simple identity matrix will be returned. Otherwise, default matrix coefficients will be used to best match channel locations and overall power level.

Parameters:inputChannelCount - Number of input channels.outputChannelCount - Number of output channels.Returns:New channel mixing matrix.Throws:UnsupportedOperationException - If no default matrix coefficients are implemented for the given input and output channel counts.

- 

getInputChannelCount

public int getInputChannelCount()

Deprecated.

- 

getOutputChannelCount

public int getOutputChannelCount()

Deprecated.

- 

getMixingCoefficient

public float getMixingCoefficient​(int inputChannel,
                                  int outputChannel)

Deprecated.

Gets the scaling factor for the given input and output channel.

- 

isZero

public boolean isZero()

Deprecated.

Returns whether all mixing coefficients are zero.

- 

isSquare

public boolean isSquare()

Deprecated.

Returns whether the input and output channel count is the same.

- 

isDiagonal

public boolean isDiagonal()

Deprecated.

Returns whether the matrix is square and all non-diagonal coefficients are zero.

- 

isIdentity

public boolean isIdentity()

Deprecated.

Returns whether this is an identity matrix.

- 

scaleBy

public[ChannelMixingMatrix](ChannelMixingMatrix.html "class in com.google.android.exoplayer2.audio")scaleBy​(float scale)

Deprecated.

Returns a new matrix with the given scaling factor applied to all coefficients.