LISNR Radius Android SDK 2.0.0
Classes | Public Member Functions | List of all members
com.lisnr.radius.StreamBuilder Class Reference

Class used to specify different audio system settings. More...

Classes

enum  AudioApi
 Enum specifying the audio api types. More...
 
enum  ContentType
 Enum specifying content types. This attribute only has an effect on Android API 28+. More...
 
enum  Direction
 Enum specifying the directionality types. More...
 
enum  InputPreset
 Enum specifying input preset types. This attribute only has an effect on Android API 28+. More...
 
enum  PerformanceMode
 Enum specifying the performance mode types. More...
 
enum  SharingMode
 Enum specifying the sharing mode types. More...
 
enum  Usage
 Enum specifying usage types. More...
 

Public Member Functions

 StreamBuilder (Context context, Direction direction)
 Constructor for StreamBuilder object. More...
 
Direction getDirection ()
 Gets the directionality of the stream. More...
 
int getChannelCount ()
 Gets the channel count of the stream. More...
 
void setAudioApi (AudioApi audioApi)
 Set the underlying audio library of the stream. More...
 
AudioApi getAudioApi ()
 Gets the underlying audio library of the stream. More...
 
void setSharingMode (SharingMode mode)
 Sets the SharingMode of the stream. More...
 
SharingMode getSharingMode ()
 Gets the SharingMode of the stream. More...
 
void setPerformanceMode (PerformanceMode mode)
 Sets the PerformanceMode of the stream. More...
 
PerformanceMode getPerformanceMode ()
 Gets the PerformanceMode of the stream. More...
 
void setUsage (Usage usage)
 Sets the Usage of the stream. More...
 
Usage getUsage ()
 Gets the Usage of the stream. More...
 
void setContentType (ContentType type)
 Sets the ContentType of the stream. More...
 
ContentType getContentType ()
 Gets the ContentType of the stream. More...
 
void setInputPreset (InputPreset preset)
 Sets the InputPreset of the stream. More...
 
InputPreset getInputPreset ()
 Gets the InputPreset of the stream. More...
 
int getDeviceId ()
 Get the audio device ID for the stream. More...
 
void setDeviceId (int deviceId)
 Sets the audio device ID for the stream. More...
 
void setNumInputChannels (int channelCount)
 Sets the number of input channels for the stream. More...
 
void setAudioOutStream (int audioManagerStream)
 Sets the audio output stream. More...
 
int getAudioOutStream ()
 Gets the audio output stream of the stream. More...
 
void setAudioFocusRequestType (int audioFocusRequestType) throws InvalidArgumentException
 
int getAudioFocusRequestType ()
 

Detailed Description

Class used to specify different audio system settings.

Constructor & Destructor Documentation

◆ StreamBuilder()

com.lisnr.radius.StreamBuilder.StreamBuilder ( Context  context,
Direction  direction 
)
inline

Constructor for StreamBuilder object.

Constructor for the StreamBuilder object. A newly constructed StreamBuilder object will contain LISNR recommended default values, which vary by device. The default values can be seen by using the corresponding get function, e.g. getDeviceId(), prior to calling any set function, e.g. setDeviceID() (see Audio System Configuration Audio System Configuration).

Parameters
contextContext for the StreamBuilder (must be non-null)
directionDirection for the StreamBuilder (must be non-null)

Member Function Documentation

◆ getAudioApi()

AudioApi com.lisnr.radius.StreamBuilder.getAudioApi ( )
inline

Gets the underlying audio library of the stream.

Get the underlying audio library being requested.

Returns
The AudioApi requested by this StreamBuilder

◆ getAudioFocusRequestType()

int com.lisnr.radius.StreamBuilder.getAudioFocusRequestType ( )
inline

Get the AudioFocus request type that will be used by the audio system.

Returns
The request type used. For details on AudioFocus types, see https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_GAIN
Note
For additional details on audio focus, see https://developer.android.com/guide/topics/media-apps/audio-focus

◆ getAudioOutStream()

int com.lisnr.radius.StreamBuilder.getAudioOutStream ( )
inline

Gets the audio output stream of the stream.

Get the audio output stream configured for the stream.

Returns
The configured audio output stream, android.media.AudioManager.STREAM_MUSIC by default (see android.media.AudioManager for values)

◆ getChannelCount()

int com.lisnr.radius.StreamBuilder.getChannelCount ( )
inline

Gets the channel count of the stream.

Get the channel count of the stream being built.

Returns
The number of channels configured for this stream builder

◆ getContentType()

ContentType com.lisnr.radius.StreamBuilder.getContentType ( )
inline

Gets the ContentType of the stream.

Get the ContentType configured for the stream.

Returns
The configured ContentType, ContentType.SONIFICATION by default

◆ getDeviceId()

int com.lisnr.radius.StreamBuilder.getDeviceId ( )
inline

Get the audio device ID for the stream.

Returns
int device ID

◆ getDirection()

Direction com.lisnr.radius.StreamBuilder.getDirection ( )
inline

Gets the directionality of the stream.

Get the directionality of the stream being built.

Returns
The direction which this stream builder is configured

◆ getInputPreset()

InputPreset com.lisnr.radius.StreamBuilder.getInputPreset ( )
inline

Gets the InputPreset of the stream.

Get the InputPreset configured for the stream.

Returns
The configured InputPreset, InputPreset.UNPROCESSED by default except on certain devices
See also
InputPreset for more details

◆ getPerformanceMode()

PerformanceMode com.lisnr.radius.StreamBuilder.getPerformanceMode ( )
inline

Gets the PerformanceMode of the stream.

Get the PerformanceMode configured for this stream.

Returns
The configured PerformanceMode, PerformanceMode.LOW_LATENCY by default
Note
If a device advertises hardware low latency audio support, the PerformanceMode will be turned to None by default. This is due to a HAL incompatibility between Android's Oboe and those devices.

◆ getSharingMode()

SharingMode com.lisnr.radius.StreamBuilder.getSharingMode ( )
inline

Gets the SharingMode of the stream.

Get the SharingMode configured for this stream.

Returns
The configured SharingMode, SharingMode.EXCLUSIVE by default

◆ getUsage()

Usage com.lisnr.radius.StreamBuilder.getUsage ( )
inline

Gets the Usage of the stream.

Get the Usage configured for this stream.

Returns
The configured Usage, Usage.ALARM by default

◆ setAudioApi()

void com.lisnr.radius.StreamBuilder.setAudioApi ( AudioApi  audioApi)
inline

Set the underlying audio library of the stream.

Set the underlying audio library used by the SDK.

Note
On Android 8.0, OpenSLES is mandated due to crashes caused by AAudio. (https://github.com/google/oboe/issues/40)
Parameters
audioApi- Requested AudioApi

◆ setAudioFocusRequestType()

void com.lisnr.radius.StreamBuilder.setAudioFocusRequestType ( int  audioFocusRequestType) throws InvalidArgumentException
inline

Sets the AudioFocus request type to be used when the AudioSystem is in output or duplex mode. This option is only used for output streams. Setting this to AudioManager.AUDIOFOCUS_NONE prevents the AudioManager.requestAudioFocus call from occurring automatically when the audio system is in output or duplex mode.

The Default value for this is AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE.

Parameters
audioFocusRequestTyperequest type to be used. Valid options are: AudioManager.AUDIOFOCUS_GAIN, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK and AudioManager.AUDIOFOCUS_NONE
Exceptions
InvalidArgumentExceptionif an invalid request type is provided
Note
For details on AudioFocus types, see For details, see https://developer.android.com/reference/android/media/AudioManager#AUDIOFOCUS_GAIN
For additional details on audio focus, see https://developer.android.com/guide/topics/media-apps/audio-focus

◆ setAudioOutStream()

void com.lisnr.radius.StreamBuilder.setAudioOutStream ( int  audioManagerStream)
inline

Sets the audio output stream.

Set the audio output stream used for volume control and sampling rate determination.

Parameters
audioManagerStream- Identifier for an AudioManager stream constant (see android.media.AudioManager for values)

◆ setContentType()

void com.lisnr.radius.StreamBuilder.setContentType ( ContentType  type)
inline

Sets the ContentType of the stream.

Set the ContentType for the stream.

Parameters
typeThe requested ContentType

◆ setDeviceId()

void com.lisnr.radius.StreamBuilder.setDeviceId ( int  deviceId)
inline

Sets the audio device ID for the stream.

Request a stream to a specific audio input/output device given an audio device ID.

Note
By default, the StreamBuilder will determine the audio devices for the built-in speaker and microphone and use those. If a phone has multiple built-in microphones (like the Samsung Galaxy S9), by default the StreamBuilder will want to use all of the microphones in conjunction for better receiving performance. If that behavior is not desired, make sure to adjust the number of input channels on the StreamBuilder as well as the device ID before starting the SDK.
Parameters
deviceIdThe deviceId of the requested audio device

◆ setInputPreset()

void com.lisnr.radius.StreamBuilder.setInputPreset ( InputPreset  preset)
inline

Sets the InputPreset of the stream.

Set the InputPreset for the stream.

Parameters
presetThe requested InputPreset

◆ setNumInputChannels()

void com.lisnr.radius.StreamBuilder.setNumInputChannels ( int  channelCount)
inline

Sets the number of input channels for the stream.

Set the number of input channels for the stream. This setting should be the same as the number of microphones the target device has on the requested deviceId.

See also
setDeviceId for more details.
Parameters
channelCountThe requested channel count, 1 by default
Note
Channel counts greater than 1 are only accepted on a subset of devices (currently Samsung Galaxy S8 and Samsung Galaxy S9) that are on API 28+. Setting the input channel count to anything other than 1 (or 2 for the previously mentioned devices) will result in undefined behavior.

◆ setPerformanceMode()

void com.lisnr.radius.StreamBuilder.setPerformanceMode ( PerformanceMode  mode)
inline

Sets the PerformanceMode of the stream.

Set the PerformanceMode for the stream.

Parameters
modeThe requested PerformanceMode

◆ setSharingMode()

void com.lisnr.radius.StreamBuilder.setSharingMode ( SharingMode  mode)
inline

Sets the SharingMode of the stream.

Set the SharingMode for the stream.

Parameters
modeThe requested SharingMode
Note
Setting this to SharingMode.SHARED will impose higher latency on audio playback

◆ setUsage()

void com.lisnr.radius.StreamBuilder.setUsage ( Usage  usage)
inline

Sets the Usage of the stream.

Set the Usage for the stream.

Parameters
usageThe requested Usage mode

The documentation for this class was generated from the following file: