Package com.digimarc.capture.audio
Class AudioHelper
java.lang.Object
com.digimarc.capture.audio.AudioHelper
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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionstatic AudioHelper.Builder
Builder()
Get Builder object for creating a AudioHelper objectint
Get the configured number of audio channels.int
Get the configured audio sample rate.static boolean
This method wraps Android 23+ permission checking code so that we don't need to use the Support v4 library in DMSDK.void
release()
Releases all resources held by the class.void
start()
Starts the audio service.void
stop()
Stops the audio service.
-
Field Details
-
Default_Sample_Rate
public static final int Default_Sample_Rate- See Also:
-
Default_Channel_Count
public static final int Default_Channel_Count- See Also:
-
-
Method Details
-
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 theAudioDataListener.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.
-