Package com.vivoka.vsdk.audio.modifiers
Class ChannelExtractor
java.lang.Object
com.vivoka.vsdk.audio.modifiers.ChannelExtractor
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionConstructs a ChannelExtractor that will extract the first channel from the audio buffer.ChannelExtractor(int channelIndex) Constructs a ChannelExtractor that will extract the specified channel index from the audio buffer. -
Method Summary
Modifier and TypeMethodDescriptionintGets the index of the currently selected channel.voidProcesses the given audio buffer and modifies it in place.voidsetSelectedChannelIndex(int value) Sets the index of the channel to extract.
-
Constructor Details
-
ChannelExtractor
public ChannelExtractor()Constructs a ChannelExtractor that will extract the first channel from the audio buffer. -
ChannelExtractor
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
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
Description copied from interface:IModifierModuleProcesses the given audio buffer and modifies it in place.- Specified by:
processin interfaceIModifierModule- 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.
-