Class ChannelExtractor

java.lang.Object
com.vivoka.vsdk.audio.modifiers.ChannelExtractor
All Implemented Interfaces:
IModifierModule

public class ChannelExtractor extends Object implements IModifierModule
ChannelExtractor is a module that extracts a specific channel from a multi-channel audio buffer. It allows the user to select which channel to extract. This is useful for processing audio data that may contain multiple channels, such as stereo or surround sound.
  • Constructor Details

    • ChannelExtractor

      public ChannelExtractor()
      Constructs a ChannelExtractor that will extract the first channel from the audio buffer.
    • ChannelExtractor

      public ChannelExtractor(int channelIndex) throws Exception
      Constructs a ChannelExtractor that will extract the specified channel index from the audio buffer. The channel index is zero-based, meaning 0 corresponds to the first channel. If the channel index is less than 0, an exception will be thrown. If the channel index is greater than the number of channels in the buffer, it will default to 0.
      Parameters:
      channelIndex - The index of the channel to extract (0 for the first channel, 1 for the second, etc.).
      Throws:
      Exception - If the channel index is less than 0.
  • Method Details

    • getSelectedChannelIndex

      public int getSelectedChannelIndex()
      Gets the index of the currently selected channel. This index is zero-based, meaning 0 corresponds to the first channel.
      Returns:
      The index of the selected channel.
    • setSelectedChannelIndex

      public void setSelectedChannelIndex(int value) throws Exception
      Sets the index of the channel to extract. The channel index is zero-based, meaning 0 corresponds to the first channel. If the channel index is less than 0, an exception will be thrown. If the channel index is greater than the number of channels in the buffer, it will default to 0.
      Parameters:
      value - The index of the channel to extract.
      Throws:
      Exception - If the channel index is less than 0.
    • process

      public void process(Buffer buffer, boolean last) throws Exception
      Description copied from interface: IModifierModule
      Processes the given audio buffer and modifies it in place.
      Specified by:
      process in interface IModifierModule
      Parameters:
      buffer - The audio buffer to process.
      last - Indicates if this is the last buffer in the stream.
      Throws:
      Exception - If an error occurs during processing.