Class DefaultAudioRecordingService

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void clearAudioFolder()
      Removes the content of the audio folder.
      javafx.beans.property.ReadOnlyListProperty<java.lang.String> getAudioChunkFiles()
      Returns a read only observable list of file names.
      java.io.File getAudioFolder()
      Returns the folder where all the audio files will be stored
      javafx.beans.property.ReadOnlyBooleanProperty recordingProperty()
      Returns true when the audio recording is currently active and false if audio recording is stopped.
      void setAudioFolderName​(java.lang.String folderName)
      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, java.util.function.Function<java.lang.String,​java.lang.Boolean> addChunk)  
      void startRecording​(float sampleRate, int sampleSizeInBits, int channels, int chunkRecordTime)
      Start audio recording with the given parameters.
      protected abstract void stop()  
      void stopRecording()
      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
    • Constructor Detail

      • DefaultAudioRecordingService

        public DefaultAudioRecordingService()
    • Method Detail

      • 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, ...)
      • 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
        Returns:
        a read only boolean property with the recording status
      • 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<java.lang.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,
                                      java.util.function.Function<java.lang.String,​java.lang.Boolean> addChunk)
      • stop

        protected abstract void stop()
      • updateRecordingStatus

        protected static void updateRecordingStatus​(boolean recording)