Class DefaultAudioRecordingService

java.lang.Object
com.gluonhq.attach.audiorecording.impl.DefaultAudioRecordingService
All Implemented Interfaces:
AudioRecordingService
Direct Known Subclasses:
DesktopAudioRecordingService, IOSAudioRecordingService

public abstract class DefaultAudioRecordingService extends Object implements AudioRecordingService
  • Property Summary

    Properties
    Type
    Property
    Description
    javafx.beans.property.ReadOnlyBooleanProperty
    Returns true when the audio recording is currently active and false if audio recording is stopped.
  • Field Summary

    Fields inherited from interface com.gluonhq.attach.audiorecording.AudioRecordingService

    DEFAULT_EXTERNAL_FOLDER
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Removes the content of the audio folder.
    javafx.beans.property.ReadOnlyListProperty<String>
    Returns a read only observable list of file names.
    Returns the folder where all the audio files will be stored
    javafx.beans.property.ReadOnlyBooleanProperty
    Returns true when the audio recording is currently active and false if audio recording is stopped.
    void
    Sets the name of the external folder where the audio files will be saved.
    protected abstract void
    start(float sampleRate, int sampleSizeInBits, int channels, int chunkRecordTime, Function<String,Boolean> addChunk)
     
    void
    startRecording(float sampleRate, int sampleSizeInBits, int channels, int chunkRecordTime)
    Start audio recording with the given parameters.
    protected abstract void
     
    void
    Stop audio recording.
    protected static void
    updateRecordingStatus(boolean recording)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Property Details

  • Constructor Details

    • DefaultAudioRecordingService

      public DefaultAudioRecordingService()
  • Method Details

    • startRecording

      public void startRecording(float sampleRate, int sampleSizeInBits, int channels, int chunkRecordTime)
      Description copied from interface: AudioRecordingService
      Start audio recording with the given parameters. The recorded audio files are saved in wav format in chunks of the specified recording time.
      Specified by:
      startRecording in interface AudioRecordingService
      Parameters:
      sampleRate - the number of samples per second (8000.0f, 44100.0f, ...)
      sampleSizeInBits - the number of bits in each sample (16 or 8)
      channels - the number of channels (1 for mono, 2 for stereo)
      chunkRecordTime - the duration in seconds of each chunk (60, 360, ...)
    • stopRecording

      public void stopRecording()
      Description copied from interface: AudioRecordingService
      Stop audio recording.
      Specified by:
      stopRecording in interface AudioRecordingService
    • recordingProperty

      public javafx.beans.property.ReadOnlyBooleanProperty recordingProperty()
      Description copied from interface: AudioRecordingService
      Returns true when the audio recording is currently active and false if audio recording is stopped.
      Specified by:
      recordingProperty in interface AudioRecordingService
    • setAudioFolderName

      public void setAudioFolderName(String folderName)
      Description copied from interface: AudioRecordingService
      Sets the name of the external folder where the audio files will be saved. If not set, by default it will use AudioRecordingService.DEFAULT_EXTERNAL_FOLDER.
      Specified by:
      setAudioFolderName in interface AudioRecordingService
      Parameters:
      folderName - the name of the external folder where the audio files will be saved
    • getAudioFolder

      public File getAudioFolder()
      Description copied from interface: AudioRecordingService
      Returns the folder where all the audio files will be stored
      Specified by:
      getAudioFolder in interface AudioRecordingService
      Returns:
      a File with the audio folder
    • clearAudioFolder

      public void clearAudioFolder()
      Description copied from interface: AudioRecordingService
      Removes the content of the audio folder.

      This method can be called at any time. It is convenient to call it before the audio recording starts, or when it ends and the audio files have been safely extracted.

      Specified by:
      clearAudioFolder in interface AudioRecordingService
    • getAudioChunkFiles

      public javafx.beans.property.ReadOnlyListProperty<String> getAudioChunkFiles()
      Description copied from interface: AudioRecordingService
      Returns a read only observable list of file names. It contains a list of file chunks that are saved in the audio folder. It can be used during recording to track when new audio chunks are made available in the audio folder.
      Specified by:
      getAudioChunkFiles in interface AudioRecordingService
      Returns:
      A ReadOnlyListProperty of file names
    • start

      protected abstract void start(float sampleRate, int sampleSizeInBits, int channels, int chunkRecordTime, Function<String,Boolean> addChunk)
    • stop

      protected abstract void stop()
    • updateRecordingStatus

      protected static void updateRecordingStatus(boolean recording)