Class AudioHelper

java.lang.Object
com.digimarc.capture.audio.AudioHelper

public class AudioHelper extends Object
The AudioHelper class provides an easy way to add audio support to an application. It handles configuring, connecting and receiving data from the system audio service.

Note that in DM SDK 3.0 audio capture is now handled by the AudioCaptureReader itself, so in most cases you will not need to use the AudioHelper class directly.

  • Field Details

  • Method Details

    • Builder

      @NonNull public static AudioHelper.Builder Builder()
      Get Builder object for creating a AudioHelper object
      Returns:
      Builder
    • start

      public void start()
      Starts the audio service. This should be called in your application's onResume method. The call is asynchronous, and audio data will be flowing (via the AudioDataListener.onAudioBuffer(ByteBuffer) method) once the has finished initialization.
    • stop

      public void stop()
      Stops the audio service. This should be called in your application's onPause method.
    • release

      public void release()
      Releases all resources held by the class. This should be called in your application's onDestroy method.
    • getSampleRate

      public int getSampleRate()
      Get the configured audio sample rate.
      Returns:
      Sample rate.
    • getNumChannels

      public int getNumChannels()
      Get the configured number of audio channels.
      Returns:
      Number of audio channels.
    • haveAudioPermission

      public static boolean haveAudioPermission()
      This method wraps Android 23+ permission checking code so that we don't need to use the Support v4 library in DMSDK.
      Returns:
      True if the app has Audio permission.