Class File

java.lang.Object
com.vivoka.vsdk.audio.consumers.File
All Implemented Interfaces:
IConsumerModule

public class File extends Object implements IConsumerModule
Represents a module that consumes audio buffers and writes them to a file in raw format. This module can be used to save audio data to a specified file path.
  • Constructor Details

    • File

      public File(String path, boolean truncate) throws Exception
      Constructs a File consumer module that writes audio data to the specified file path. The file will be created if it does not exist, and it can be truncated or appended to. Each time the user restarts the pipeline, the file will be reopened for writing in append mode.
      Parameters:
      path - The path to the file where audio data will be written.
      truncate - If true, the file will be truncated before writing; if false, data will be appended.
      Throws:
      Exception - If there is an error opening the file for writing.
  • Method Details

    • process

      public void process(Buffer buffer, boolean last) throws Exception
      Description copied from interface: IConsumerModule
      Processes the given audio buffer.
      Specified by:
      process in interface IConsumerModule
      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.